From 9cebc040b6738ed37191efeb7bff1e755da66a1e Mon Sep 17 00:00:00 2001 From: xuan Date: Thu, 8 Dec 2022 20:05:32 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8C=88=20style(=E9=94=80=E5=94=AE?= =?UTF-8?q?=E8=AF=A6=E6=83=85):=20=E8=A7=A3=E5=86=B3eslint=E7=9A=84?= =?UTF-8?q?=E6=8A=A5=E9=94=99=E2=9D=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- project.private.config.json | 7 +++ src/components/SaleCodeList/index.tsx | 23 +++++----- src/pages/orderDetails/index.tsx | 64 +++++++++++++-------------- 3 files changed, 50 insertions(+), 44 deletions(-) diff --git a/project.private.config.json b/project.private.config.json index 8b83c17..c95350b 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -246,6 +246,13 @@ "query": "orderId=31742", "launchMode": "default", "scene": null + }, + { + "name": "", + "pathName": "pages/orderDetails/index", + "query": "id=34626", + "launchMode": "default", + "scene": null } ] } diff --git a/src/components/SaleCodeList/index.tsx b/src/components/SaleCodeList/index.tsx index b1b8823..9dd359d 100644 --- a/src/components/SaleCodeList/index.tsx +++ b/src/components/SaleCodeList/index.tsx @@ -19,14 +19,9 @@ interface Props { popupClose: () => void } -const codeList = (props: Props) => { +const CodeList = (props: Props) => { const { fetchData: payFetch } = GetPayCode() const [PicUrl, setPicUrl] = useState('') - useEffect(() => { - // 判断进来的是否是空对象,减少性能问题 - const length = Object.keys(props.obj) - if (length.length > 0) { getPic() } - }, [props.obj]) const getPic = async() => { Taro.showLoading({ @@ -131,10 +126,6 @@ const codeList = (props: Props) => { // 检查是否开启保存图片权限 const { check } = useCheckAuthorize({ scope: 'scope.writePhotosAlbum', msg: '您没授权,无法保存图片' }) - const saveImageCheck = async() => { - const res = await check() - res && 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 ( props.popupClose?.()}> @@ -175,4 +174,4 @@ const codeList = (props: Props) => { ) } -export default memo(codeList) +export default memo(CodeList) diff --git a/src/pages/orderDetails/index.tsx b/src/pages/orderDetails/index.tsx index 1cdcc77..5ac0dbe 100644 --- a/src/pages/orderDetails/index.tsx +++ b/src/pages/orderDetails/index.tsx @@ -127,13 +127,6 @@ const OrderDetails = () => { // useEffect(() => { // getDetail() // }, []) - useDidShow(() => { - getDetail() - }) - // 页面下拉刷新 - usePullDownRefresh(() => { - getDetail() - }) // 收货方法,1:自提,2物流 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: infoTwoFetch } = OrderPaymentPreCollectOrderOrderPaymentMethodInfo() @@ -467,26 +468,13 @@ const OrderDetails = () => { setShowPay(true) } - // 选择支付方式 - const clickItem = (item) => { - if (item.name === '扫码支付') { handScanpay() } - if (item.name === '线下汇款') { setShowOffine(true) } - payList.map((it) => { - if (item.id === it.id) { - it.checked = true - } - else { - it.checked = false - } - return it - }) - setPayList([...payList]) - } - - // 扫码支付 - const [showSide, setShowSide] = useState(true) - const [title, setTitle] = useState('') - const [picUrl, setPicUrl] = useState('') + useDidShow(() => { + getDetail() + }) + // 页面下拉刷新 + usePullDownRefresh(() => { + getDetail() + }) const { fetchData: payFetch } = GetPayCode() const handScanpay = async() => { 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) => { 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) => { 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(() => { setInfoObj(infoObj) }, [infoObj]) @@ -880,7 +880,7 @@ const OrderDetails = () => { title={title} picUrl={picUrl} > - setShowOffine(false)} offlineInfo={infoObj}> + setShowOffline(false)} offlineInfo={infoObj}> setshowCodeList(false)}> )