对接确认订单

This commit is contained in:
2022-05-13 19:28:46 +08:00
parent 26555a9541
commit ab1118c5b4
32 changed files with 2233 additions and 160 deletions
+11 -10
View File
@@ -9,7 +9,8 @@ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import Taro from "@tarojs/taro";
import { alert, goLink } from "@/common/common";
import {GetShoppingCartApi, DelShoppingCartApi} from "@/api/shopCart"
import { formatHashTag, formatImgUrl, formatMillionYuan } from "@/common/fotmat";
import { formatHashTag, formatImgUrl, formatPriceDiv } from "@/common/fotmat";
import { setParam } from "@/common/system";
type param = {
show?: true|false,
@@ -175,13 +176,12 @@ export default ({show = false, onClose}: param) => {
//格式化金额
const formatPirce = useCallback((price) => {
const {num} = formatMillionYuan(price, 100)
return Number(num)
return Number(formatPriceDiv(price))
}, [])
//格式化数量
const formatCount = useCallback((item) => {
return item.sale_mode == 0? item.roll + '件': item.length + 'm'
return item.sale_mode == 0? item.roll + '件': (item.length/100) + 'm'
}, [])
//预估金额
@@ -190,7 +190,7 @@ export default ({show = false, onClose}: param) => {
list.map(item => {
if(item.select) count += item.sale_price
})
return Number(formatMillionYuan(count, 100).num)
return Number(formatPriceDiv(count))
},[list])
//去结算
@@ -200,7 +200,8 @@ export default ({show = false, onClose}: param) => {
alert.error('请选择面料')
} else {
let ids = selectIds.current.join('-')
goLink('/pages/order/index',{ids, sale_mode:selectIndex})
setParam({ids, sale_mode:selectIndex})
goLink('/pages/order/comfirm')
}
}
@@ -212,8 +213,8 @@ export default ({show = false, onClose}: param) => {
<View className={styles.header}>
<View onClick={selectAll}>{!selectStatus?'全选':'反选'}</View>
<View onClick={delSelect}>
<text className={classnames('iconfont', 'icon-lajixiang', styles.miconfont)}></text>
删除勾选项
<text className={classnames('iconfont', 'icon-shanchu', styles.miconfont)}></text>
删除所选
</View>
</View>
<View className={styles.search}>
@@ -223,7 +224,7 @@ export default ({show = false, onClose}: param) => {
</View>
<View className={styles.con}>
{loading&&<LoadingCard/>}
{!loading&&list?.length > 0&&<InfiniteScroll refresherTriggered={true} refresherEnabled={true} moreStatus={false} >
{!loading&&list?.length > 0&&<InfiniteScroll moreStatus={false} >
<View className={styles.product_list}>
{list?.map((item, index) => {
return <View key={index} className={classnames(styles.product_item, (selectIndex!=-1&&selectIndex!= item.sale_mode)&&styles.no_product_item_select)}>
@@ -239,7 +240,7 @@ export default ({show = false, onClose}: param) => {
<View className={styles.tag}>{item.sale_mode_name}</View>
</View>
<View className={styles.count}>
<View className={styles.price}><text>¥</text>{formatPirce(item.sale_price)}<text>/kg</text></View>
<View className={styles.price}><text>¥</text>{formatPirce(item.sale_price)}<text>/{selectList[selectIndex].eunit}</text></View>
<View className={styles.long}>×{formatCount(item)}</View>
</View>
</View>