🎈 perf(从小程序卡片进来的没有权限跳回首页):
This commit is contained in:
parent
2babf94747
commit
ac260696f8
@ -44,7 +44,7 @@ export default memo(({ value, onClick, showStatus = false, round = false, name =
|
||||
setLabAndImgShow(false)
|
||||
}, [])
|
||||
|
||||
const onShowLabAndImg = () => {
|
||||
const onShowLabAndImg = (e) => {
|
||||
onClick?.(value)
|
||||
if (!showStatus) return false
|
||||
setLabAndImgShow(true)
|
||||
@ -56,7 +56,7 @@ export default memo(({ value, onClick, showStatus = false, round = false, name =
|
||||
|
||||
return (
|
||||
<>
|
||||
<View className={styles.labAndImg_main} style={{ borderRadius: round ? '50%' : '' }} onClick={() => onShowLabAndImg()}>
|
||||
<View className={styles.labAndImg_main} style={{ borderRadius: round ? '50%' : '' }} onClick={onShowLabAndImg}>
|
||||
{value.texture_url && (
|
||||
<Image
|
||||
mode='aspectFill'
|
||||
|
@ -33,6 +33,7 @@
|
||||
input {
|
||||
font-size: $font_size_medium;
|
||||
// text-align: right;
|
||||
width: 100%;
|
||||
padding-right: 10px;
|
||||
}
|
||||
}
|
||||
|
@ -47,12 +47,16 @@ const Counter = memo((props: params) => {
|
||||
//保留小数
|
||||
const formatDigits = (num) => {
|
||||
num = num + ''
|
||||
if (num.includes('.') && digits > 0) {
|
||||
console.log('num::', num.includes('.'))
|
||||
if (num.includes('.')) {
|
||||
let res = num.split('.')
|
||||
let last_num = res[1].substr(0, digits)
|
||||
return res[0] + '.' + last_num
|
||||
if (digits > 0) {
|
||||
let last_num = res[1].substr(0, digits)
|
||||
return res[0] + '.' + last_num
|
||||
} else {
|
||||
return res[0]
|
||||
}
|
||||
}
|
||||
|
||||
return parseFloat(num)
|
||||
}
|
||||
|
||||
@ -67,22 +71,18 @@ const Counter = memo((props: params) => {
|
||||
const onInputEven = (e) => {
|
||||
let res = e.detail.value
|
||||
if (res === '') {
|
||||
// setValue({ ...value, count: minNum })
|
||||
onChange?.(minNum)
|
||||
} else if (!isNaN(Number(res))) {
|
||||
let count = formatDigits(res)
|
||||
count = checkData(count)
|
||||
// setValue({ ...value, count })
|
||||
onChange?.(parseFloat(count as string))
|
||||
} else {
|
||||
let num = parseFloat(res)
|
||||
if (!isNaN(num)) {
|
||||
let count = formatDigits(num)
|
||||
count = checkData(count)
|
||||
// setValue({ ...value, count })
|
||||
onChange?.(count as number)
|
||||
} else {
|
||||
// setValue({ ...value, count: defaultNum })
|
||||
onChange?.(defaultNum)
|
||||
}
|
||||
}
|
||||
@ -104,12 +104,12 @@ const Counter = memo((props: params) => {
|
||||
}
|
||||
}
|
||||
return (
|
||||
<View className={styles.main}>
|
||||
<View className={styles.main} onClick={(e) => e.stopPropagation()}>
|
||||
<View className={styles.reduce} onClick={() => minus()}>
|
||||
-
|
||||
</View>
|
||||
<View className={styles.input}>
|
||||
<Input value={String(value.count)} onInput={onInputEven} onBlur={onBluerEven} disabled={disabled} alwaysEmbed={true} cursorSpacing={150} />
|
||||
<Input type='digit' value={String(value.count)} onInput={onInputEven} onBlur={onBluerEven} disabled={disabled} alwaysEmbed={true} cursorSpacing={150} />
|
||||
<View className={styles.unit}>{unit}</View>
|
||||
</View>
|
||||
<View className={styles.plus} onClick={() => onPlus()}>
|
||||
|
@ -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}>
|
||||
|
@ -168,10 +168,16 @@ export const useRequest = (
|
||||
stateRef.current.data = data
|
||||
stateRef.current.total = data?.list ? data?.total : 0
|
||||
if (code !== 0) {
|
||||
if (code === 50332) {
|
||||
Taro.switchTab({
|
||||
url: '/pages/index/index',
|
||||
})
|
||||
}
|
||||
options.apiMsgStatus !== false &&
|
||||
Taro.showToast({
|
||||
title: `${msg}`,
|
||||
icon: 'none',
|
||||
duration: 3000,
|
||||
})
|
||||
console.log('错误::', msg)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user