🎈 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)
|
setLabAndImgShow(false)
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
const onShowLabAndImg = () => {
|
const onShowLabAndImg = (e) => {
|
||||||
onClick?.(value)
|
onClick?.(value)
|
||||||
if (!showStatus) return false
|
if (!showStatus) return false
|
||||||
setLabAndImgShow(true)
|
setLabAndImgShow(true)
|
||||||
@ -56,7 +56,7 @@ export default memo(({ value, onClick, showStatus = false, round = false, name =
|
|||||||
|
|
||||||
return (
|
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 && (
|
{value.texture_url && (
|
||||||
<Image
|
<Image
|
||||||
mode='aspectFill'
|
mode='aspectFill'
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
input {
|
input {
|
||||||
font-size: $font_size_medium;
|
font-size: $font_size_medium;
|
||||||
// text-align: right;
|
// text-align: right;
|
||||||
|
width: 100%;
|
||||||
padding-right: 10px;
|
padding-right: 10px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,12 +47,16 @@ const Counter = memo((props: params) => {
|
|||||||
//保留小数
|
//保留小数
|
||||||
const formatDigits = (num) => {
|
const formatDigits = (num) => {
|
||||||
num = num + ''
|
num = num + ''
|
||||||
if (num.includes('.') && digits > 0) {
|
if (num.includes('.')) {
|
||||||
console.log('num::', num.includes('.'))
|
|
||||||
let res = num.split('.')
|
let res = num.split('.')
|
||||||
let last_num = res[1].substr(0, digits)
|
if (digits > 0) {
|
||||||
return res[0] + '.' + last_num
|
let last_num = res[1].substr(0, digits)
|
||||||
|
return res[0] + '.' + last_num
|
||||||
|
} else {
|
||||||
|
return res[0]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return parseFloat(num)
|
return parseFloat(num)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,22 +71,18 @@ const Counter = memo((props: params) => {
|
|||||||
const onInputEven = (e) => {
|
const onInputEven = (e) => {
|
||||||
let res = e.detail.value
|
let res = e.detail.value
|
||||||
if (res === '') {
|
if (res === '') {
|
||||||
// setValue({ ...value, count: minNum })
|
|
||||||
onChange?.(minNum)
|
onChange?.(minNum)
|
||||||
} else if (!isNaN(Number(res))) {
|
} else if (!isNaN(Number(res))) {
|
||||||
let count = formatDigits(res)
|
let count = formatDigits(res)
|
||||||
count = checkData(count)
|
count = checkData(count)
|
||||||
// setValue({ ...value, count })
|
|
||||||
onChange?.(parseFloat(count as string))
|
onChange?.(parseFloat(count as string))
|
||||||
} else {
|
} else {
|
||||||
let num = parseFloat(res)
|
let num = parseFloat(res)
|
||||||
if (!isNaN(num)) {
|
if (!isNaN(num)) {
|
||||||
let count = formatDigits(num)
|
let count = formatDigits(num)
|
||||||
count = checkData(count)
|
count = checkData(count)
|
||||||
// setValue({ ...value, count })
|
|
||||||
onChange?.(count as number)
|
onChange?.(count as number)
|
||||||
} else {
|
} else {
|
||||||
// setValue({ ...value, count: defaultNum })
|
|
||||||
onChange?.(defaultNum)
|
onChange?.(defaultNum)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -104,12 +104,12 @@ const Counter = memo((props: params) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<View className={styles.main}>
|
<View className={styles.main} onClick={(e) => e.stopPropagation()}>
|
||||||
<View className={styles.reduce} onClick={() => minus()}>
|
<View className={styles.reduce} onClick={() => minus()}>
|
||||||
-
|
-
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.input}>
|
<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 className={styles.unit}>{unit}</View>
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.plus} onClick={() => onPlus()}>
|
<View className={styles.plus} onClick={() => onPlus()}>
|
||||||
|
@ -6,6 +6,7 @@ import MCheckbox from '@/components/checkbox'
|
|||||||
import Counter from '@/components/counter'
|
import Counter from '@/components/counter'
|
||||||
import LabAndImg from '@/components/LabAndImg'
|
import LabAndImg from '@/components/LabAndImg'
|
||||||
import { formatHashTag, formatImgUrl, formatPriceDiv } from '@/common/fotmat'
|
import { formatHashTag, formatImgUrl, formatPriceDiv } from '@/common/fotmat'
|
||||||
|
import Big from 'big.js'
|
||||||
import { saleModeType } from '@/common/enum'
|
import { saleModeType } from '@/common/enum'
|
||||||
type param = {
|
type param = {
|
||||||
sale_model: saleModeType
|
sale_model: saleModeType
|
||||||
@ -28,7 +29,7 @@ export default memo((props: param) => {
|
|||||||
const getInputValue = useCallback(
|
const getInputValue = useCallback(
|
||||||
(e) => {
|
(e) => {
|
||||||
let roll = item.sale_mode == 0 ? parseFloat(e) : 0
|
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 })
|
onChangeCount({ ...item, roll, length })
|
||||||
},
|
},
|
||||||
[item],
|
[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 }
|
return { lab: item.lab, rgb: item.rgb, texture_url: item.texture_url, title: item.product_color_code }
|
||||||
}, [item])
|
}, [item])
|
||||||
|
|
||||||
|
const clickProduct = useCallback(() => {
|
||||||
|
if (sale_model == item.sale_mode) onChangeSelect({ ...item, selected: !item.selected })
|
||||||
|
}, [item])
|
||||||
|
|
||||||
console.log('刷新2::', item)
|
console.log('刷新2::', item)
|
||||||
|
|
||||||
//格式化金额
|
//格式化金额
|
||||||
@ -52,8 +57,8 @@ export default memo((props: param) => {
|
|||||||
return item.sale_mode == 0 ? '条' : '米'
|
return item.sale_mode == 0 ? '条' : '米'
|
||||||
}, [])
|
}, [])
|
||||||
return (
|
return (
|
||||||
<View className={classnames(styles.product_item, sale_model != item.sale_mode && styles.no_product_item_select)}>
|
<View className={classnames(styles.product_item, sale_model != item.sale_mode && styles.no_product_item_select)} onClick={clickProduct}>
|
||||||
<View className={styles.checkbox}>
|
<View className={styles.checkbox} catchMove>
|
||||||
<MCheckbox status={item.selected} onSelect={selectCallBack} onClose={colseCallBack} disabled={sale_model != item.sale_mode} />
|
<MCheckbox status={item.selected} onSelect={selectCallBack} onClose={colseCallBack} disabled={sale_model != item.sale_mode} />
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.img}>
|
<View className={styles.img}>
|
||||||
|
@ -168,10 +168,16 @@ export const useRequest = (
|
|||||||
stateRef.current.data = data
|
stateRef.current.data = data
|
||||||
stateRef.current.total = data?.list ? data?.total : 0
|
stateRef.current.total = data?.list ? data?.total : 0
|
||||||
if (code !== 0) {
|
if (code !== 0) {
|
||||||
|
if (code === 50332) {
|
||||||
|
Taro.switchTab({
|
||||||
|
url: '/pages/index/index',
|
||||||
|
})
|
||||||
|
}
|
||||||
options.apiMsgStatus !== false &&
|
options.apiMsgStatus !== false &&
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: `${msg}`,
|
title: `${msg}`,
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
|
duration: 3000,
|
||||||
})
|
})
|
||||||
console.log('错误::', msg)
|
console.log('错误::', msg)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user