🎈 perf(从小程序卡片进来的没有权限跳回首页):

This commit is contained in:
2022-11-26 14:20:34 +08:00
parent 2babf94747
commit ac260696f8
5 changed files with 27 additions and 15 deletions
@@ -6,6 +6,7 @@ import MCheckbox from '@/components/checkbox'
import Counter from '@/components/counter'
import LabAndImg from '@/components/LabAndImg'
import { formatHashTag, formatImgUrl, formatPriceDiv } from '@/common/fotmat'
import Big from 'big.js'
import { saleModeType } from '@/common/enum'
type param = {
sale_model: saleModeType
@@ -28,7 +29,7 @@ export default memo((props: param) => {
const getInputValue = useCallback(
(e) => {
let roll = item.sale_mode == 0 ? parseFloat(e) : 0
let length = item.sale_mode != 0 ? parseFloat(e) * 100 : 0
let length = item.sale_mode != 0 ? parseFloat(new Big(parseFloat(e)).times(100)) : 0
onChangeCount({ ...item, roll, length })
},
[item],
@@ -37,6 +38,10 @@ export default memo((props: param) => {
return { lab: item.lab, rgb: item.rgb, texture_url: item.texture_url, title: item.product_color_code }
}, [item])
const clickProduct = useCallback(() => {
if (sale_model == item.sale_mode) onChangeSelect({ ...item, selected: !item.selected })
}, [item])
console.log('刷新2::', item)
//格式化金额
@@ -52,8 +57,8 @@ export default memo((props: param) => {
return item.sale_mode == 0 ? '条' : '米'
}, [])
return (
<View className={classnames(styles.product_item, sale_model != item.sale_mode && styles.no_product_item_select)}>
<View className={styles.checkbox}>
<View className={classnames(styles.product_item, sale_model != item.sale_mode && styles.no_product_item_select)} onClick={clickProduct}>
<View className={styles.checkbox} catchMove>
<MCheckbox status={item.selected} onSelect={selectCallBack} onClose={colseCallBack} disabled={sale_model != item.sale_mode} />
</View>
<View className={styles.img}>