部分优化对接售后原因枚举

This commit is contained in:
2022-06-23 16:57:12 +08:00
parent 7c758f6896
commit 3b0f32c88a
13 changed files with 130 additions and 351 deletions
+6 -8
View File
@@ -52,7 +52,6 @@ export default ({show = false, onClose}: param) => {
const [loading, setLoading] = useState(false)
const {fetchData} = GetShoppingCartApi()
const getShoppingCart = async () => {
setLoading(true)
const {data} = await fetchData()
let color_list = data.color_list||[]
initList(color_list)
@@ -74,6 +73,7 @@ export default ({show = false, onClose}: param) => {
setList([])
setSelectIndex(0)
} else {
setLoading(true)
getShoppingCart()
}
}, [show])
@@ -206,7 +206,7 @@ export default ({show = false, onClose}: param) => {
}
})
let all_count_text = selectIndex == 0?all_count + '条': (all_count/100) + '米'
return {price: Number(formatPriceDiv(estimate_amount)), countText: `已选${product_list.size}种面料,${color_count}个颜色,共${all_count_text}`, color_count}
return {price: Number(formatPriceDiv(estimate_amount)).toFixed(2), countText: `已选${product_list.size}种面料,${color_count}个颜色,共${all_count_text}`, color_count}
},[list])
@@ -226,18 +226,16 @@ export default ({show = false, onClose}: param) => {
//计数组件-当后端修改完成才修改前端显示
const {fetchData: fetchDataUpdateShoppingCart} = UpdateShoppingCartApi()
const [UpdateShoppingCartLoading, setUpdateShoppingCartLoading] = useState(false)
const getInputValue = async (num, item) => {
const getInputValue = debounce(async (num, item) => {
let roll = item.sale_mode == 0?parseFloat(num):0
let length = item.sale_mode != 0?(parseFloat(num)*100):0
setUpdateShoppingCartLoading(() => true)
let res = await fetchDataUpdateShoppingCart({id: item.id, roll, length})
setUpdateShoppingCartLoading(() => false)
if(res.success) {
item.count = parseFloat(num)
setList([...list])
getShoppingCart()
}
}
}, 300)
return (
<View className={styles.shop_cart_main}>
@@ -275,7 +273,7 @@ export default ({show = false, onClose}: param) => {
</View>
<View className={styles.count}>
<View className={styles.price}><text>¥</text>{formatPirce(item.sale_price)}<text>/{selectList[selectIndex].eunit}</text></View>
{/* <View className={styles.long}>×{formatCount(item)}</View> */}
{/* <View className={styles.long}>×{formatCount(item)}{selectList[selectIndex].unit}</View> */}
<View className={styles.btn_count}>
<Counter
onBlue={(e) => getInputValue(e, item)}