🌈 style(销售详情): 解决eslint的报错

This commit is contained in:
xuan 2022-12-08 20:05:32 +08:00
parent 5d0dc586d2
commit 9cebc040b6
3 changed files with 50 additions and 44 deletions

View File

@ -246,6 +246,13 @@
"query": "orderId=31742", "query": "orderId=31742",
"launchMode": "default", "launchMode": "default",
"scene": null "scene": null
},
{
"name": "",
"pathName": "pages/orderDetails/index",
"query": "id=34626",
"launchMode": "default",
"scene": null
} }
] ]
} }

View File

@ -19,14 +19,9 @@ interface Props {
popupClose: () => void popupClose: () => void
} }
const codeList = (props: Props) => { const CodeList = (props: Props) => {
const { fetchData: payFetch } = GetPayCode() const { fetchData: payFetch } = GetPayCode()
const [PicUrl, setPicUrl] = useState<string>('') const [PicUrl, setPicUrl] = useState<string>('')
useEffect(() => {
// 判断进来的是否是空对象,减少性能问题
const length = Object.keys(props.obj)
if (length.length > 0) { getPic() }
}, [props.obj])
const getPic = async() => { const getPic = async() => {
Taro.showLoading({ Taro.showLoading({
@ -131,10 +126,6 @@ const codeList = (props: Props) => {
// 检查是否开启保存图片权限 // 检查是否开启保存图片权限
const { check } = useCheckAuthorize({ scope: 'scope.writePhotosAlbum', msg: '您没授权,无法保存图片' }) const { check } = useCheckAuthorize({ scope: 'scope.writePhotosAlbum', msg: '您没授权,无法保存图片' })
const saveImageCheck = async() => {
const res = await check()
res && saveImage()
}
// 保存图片 // 保存图片
const saveImage = () => { const saveImage = () => {
@ -160,7 +151,15 @@ const codeList = (props: Props) => {
}, },
}) })
} }
const saveImageCheck = async() => {
const res = await check()
res && saveImage()
}
useEffect(() => {
// 判断进来的是否是空对象,减少性能问题
const length = Object.keys(props.obj)
if (length.length > 0) { getPic() }
}, [props.obj])
return ( return (
<Popup show={props.showPopup} title="销售码单" onClose={() => props.popupClose?.()}> <Popup show={props.showPopup} title="销售码单" onClose={() => props.popupClose?.()}>
<View className={styles.popupBox}> <View className={styles.popupBox}>
@ -175,4 +174,4 @@ const codeList = (props: Props) => {
) )
} }
export default memo(codeList) export default memo(CodeList)

View File

@ -127,13 +127,6 @@ const OrderDetails = () => {
// useEffect(() => { // useEffect(() => {
// getDetail() // getDetail()
// }, []) // }, [])
useDidShow(() => {
getDetail()
})
// 页面下拉刷新
usePullDownRefresh(() => {
getDetail()
})
// 收货方法,1:自提2物流 // 收货方法,1:自提2物流
const [receivingStatus, setReceivingStatus] = useState(null) const [receivingStatus, setReceivingStatus] = useState(null)
@ -342,6 +335,14 @@ const OrderDetails = () => {
}) })
} }
} }
// 扫码支付
const [showSide, setShowSide] = useState(true)
const [title, setTitle] = useState('')
const [picUrl, setPicUrl] = useState('')
// 显示支付
const [showPay, setShowPay] = useState(false)
// 去支付逻辑 // 去支付逻辑
const { fetchData: infoOneFetch } = OrderPaymentOrderPaymentMethodInfo() const { fetchData: infoOneFetch } = OrderPaymentOrderPaymentMethodInfo()
const { fetchData: infoTwoFetch } = OrderPaymentPreCollectOrderOrderPaymentMethodInfo() const { fetchData: infoTwoFetch } = OrderPaymentPreCollectOrderOrderPaymentMethodInfo()
@ -467,26 +468,13 @@ const OrderDetails = () => {
setShowPay(true) setShowPay(true)
} }
// 选择支付方式 useDidShow(() => {
const clickItem = (item) => { getDetail()
if (item.name === '扫码支付') { handScanpay() } })
if (item.name === '线下汇款') { setShowOffine(true) } // 页面下拉刷新
payList.map((it) => { usePullDownRefresh(() => {
if (item.id === it.id) { getDetail()
it.checked = true })
}
else {
it.checked = false
}
return it
})
setPayList([...payList])
}
// 扫码支付
const [showSide, setShowSide] = useState(true)
const [title, setTitle] = useState('')
const [picUrl, setPicUrl] = useState('')
const { fetchData: payFetch } = GetPayCode() const { fetchData: payFetch } = GetPayCode()
const handScanpay = async() => { const handScanpay = async() => {
const list: any = [] const list: any = []
@ -613,10 +601,8 @@ const OrderDetails = () => {
// } // }
} }
// 显示支付
const [showPay, setShowPay] = useState(false)
// 显示线下汇款 // 显示线下汇款
const [showOffline, setShowOffine] = useState(false) const [showOffline, setShowOffline] = useState(false)
// 选择地址 // 选择地址
const handSelect = (obj) => { const handSelect = (obj) => {
if (receivingStatus === 1 || (infoObj.status === 8 || infoObj.status === 9 || infoObj.status === 4 || infoObj.status === 5 || infoObj.status === 11 || infoObj.status === 3)) { if (receivingStatus === 1 || (infoObj.status === 8 || infoObj.status === 9 || infoObj.status === 4 || infoObj.status === 5 || infoObj.status === 11 || infoObj.status === 3)) {
@ -694,7 +680,21 @@ const OrderDetails = () => {
const onChange = (e) => { const onChange = (e) => {
setInfoObj(val => ({ ...val, remark: e })) setInfoObj(val => ({ ...val, remark: e }))
} }
// 选择支付方式
const clickItem = (item) => {
if (item.name === '扫码支付') { handScanpay() }
if (item.name === '线下汇款') { setShowOffline(true) }
payList.map((it) => {
if (item.id === it.id) {
it.checked = true
}
else {
it.checked = false
}
return it
})
setPayList([...payList])
}
useEffect(() => { useEffect(() => {
setInfoObj(infoObj) setInfoObj(infoObj)
}, [infoObj]) }, [infoObj])
@ -880,7 +880,7 @@ const OrderDetails = () => {
title={title} title={title}
picUrl={picUrl} picUrl={picUrl}
></PayPopup> ></PayPopup>
<OfflinePay showKong={false} show={showOffline} onClose={() => setShowOffine(false)} offlineInfo={infoObj}></OfflinePay> <OfflinePay showKong={false} show={showOffline} onClose={() => setShowOffline(false)} offlineInfo={infoObj}></OfflinePay>
<SaleCodeList obj={infoObj} showPopup={showCodeList} popupClose={() => setshowCodeList(false)}></SaleCodeList> <SaleCodeList obj={infoObj} showPopup={showCodeList} popupClose={() => setshowCodeList(false)}></SaleCodeList>
</View > </View >
) )