diff --git a/src/components/sp-page/index.js b/src/components/sp-page/index.js index 6229a6d32..dd7126140 100644 --- a/src/components/sp-page/index.js +++ b/src/components/sp-page/index.js @@ -175,7 +175,7 @@ const SpPage = memo( menuWidth: _menuWidth, footerHeight: _height }) - }, []) + }, [sys]) useEffect(() => { const { diff --git a/src/hooks/themeColor.js b/src/hooks/themeColor.js index 5f4966262..d516cd7a2 100644 --- a/src/hooks/themeColor.js +++ b/src/hooks/themeColor.js @@ -55,7 +55,6 @@ function useThemsColor() { // 检查是否找到匹配项 const status = regex !== null && prefixes[regex] const newPrefixes = prefixes[regex] - // 查找与给定路由匹配的主题 const theme = { // 如果没有找到匹配项,则使用默认主题 diff --git a/src/subpages/trade/detail.js b/src/subpages/trade/detail.js index 42221f8f1..58c0a3d2e 100644 --- a/src/subpages/trade/detail.js +++ b/src/subpages/trade/detail.js @@ -41,7 +41,6 @@ import CompTradeCancel from './comps/comp-tradecancel' import CompWriteOffCode from './comps/comp-writeoff-code' import CompTrackDetail from './comps/comp-track-detail' import './detail.scss' -import { includes } from 'lodash' const initialState = { info: null, @@ -55,11 +54,11 @@ const initialState = { webSocketOpenFlag: false, openTrackDetail: false, trackDetailList: [], - squareRoot: false, //待开方 - supplement: false, //待补充 + squareRoot: false, //待开方 + supplement: false, //待补充 prescriptionUrl: '', prescriptionStatus: false, - openingTime:'squareRoots', + openingTime: 'squareRoots' } function TradeDetail(props) { const [state, setState] = useImmer(initialState) @@ -91,16 +90,14 @@ function TradeDetail(props) { const router = useRouter() const websocketRef = useRef(null) - const isMounted = useRef(true) // 添加组件挂载状态标志 + const isMounted = useRef(true) // 添加组件挂载状态标志 - useDidShow(()=>{ - - }) + useDidShow(() => {}) useEffect(() => { fetch() - isMounted.current = true // 组件挂载时设置为true + isMounted.current = true // 组件挂载时设置为true // 提交售后事件 Taro.eventCenter.on('onEventAfterSalesApply', () => { @@ -108,7 +105,6 @@ function TradeDetail(props) { }) // 撤销售后事件 Taro.eventCenter.on('onEventAfterSalesCancel', () => { - fetch() }) //线下转账 @@ -130,18 +126,17 @@ function TradeDetail(props) { Taro.eventCenter.off('onEventOfflineApply') Taro.eventCenter.off('onEventInvoiceStatusChange') - isMounted.current = false // 组件卸载时设置为false + isMounted.current = false // 组件卸载时设置为false } }, [openingTime]) - const totalFreightFee = useMemo(() => { const { freightFee, freightPointFee } = info || {} return Number(freightFee || 0 + freightPointFee || 0)?.toFixed(2) }, [info?.freightFee, info?.freightPointFee]) const fetch = async () => { - const { order_id } = await parameter() + const { order_id } = await parameter() const { distributor, orderInfo, tradeInfo, cancelData } = await api.trade.detail(order_id) const _orderInfo = pickBy(orderInfo, doc.trade.TRADE_ITEM) // 自提订单未核销,开启websocket监听核销状态 @@ -154,8 +149,14 @@ function TradeDetail(props) { draft.cancelData = isArray(cancelData) ? null : cancelData draft.distirbutorInfo = distributor draft.loading = false - draft.squareRoot = _orderInfo.orderStatus == 'NOTPAY' && _orderInfo.prescriptionStatus == 1 && _orderInfo?.diagnosisData?.id - draft.supplement = _orderInfo.orderStatus == 'NOTPAY' && _orderInfo.prescriptionStatus == 1 && isArray(_orderInfo?.diagnosisData) + draft.squareRoot = + _orderInfo.orderStatus == 'NOTPAY' && + _orderInfo.prescriptionStatus == 1 && + _orderInfo?.diagnosisData?.id + draft.supplement = + _orderInfo.orderStatus == 'NOTPAY' && + _orderInfo.prescriptionStatus == 1 && + isArray(_orderInfo?.diagnosisData) }) } @@ -247,16 +248,20 @@ function TradeDetail(props) { } } - const onClickItem = ({ itemId, distributorId,activityId,orderClass }) => { - if(orderClass == 'employee_purchase'){ + const onClickItem = ({ itemId, distributorId, activityId, orderClass }) => { + if (orderClass == 'employee_purchase') { Taro.navigateTo({ - url:`/subpages/purchase/espier-detail?id=${itemId}&dtid=${distributorId || 0}&activity_id=${activityId}&enterprise_id=${info.enterpriseId}` + url: `/subpages/purchase/espier-detail?id=${itemId}&dtid=${ + distributorId || 0 + }&activity_id=${activityId}&enterprise_id=${info.enterpriseId}` }) - } else if(orderClass == 'pointsmall'){ + } else if (orderClass == 'pointsmall') { Taro.navigateTo({ - url:`/subpages/pointshop/espier-detail?id=${itemId}&dtid=${distributorId || 0}&activity_id=${activityId}&enterprise_id=${info.enterpriseId}` + url: `/subpages/pointshop/espier-detail?id=${itemId}&dtid=${ + distributorId || 0 + }&activity_id=${activityId}&enterprise_id=${info.enterpriseId}` }) - }else{ + } else { Taro.navigateTo({ url: `/pages/item/espier-detail?id=${itemId}&dtid=${distributorId}&_original=1` }) @@ -342,17 +347,17 @@ function TradeDetail(props) { if (info.receiptType == 'dada') { // 达达同城配,订单状态单独处理 return ORDER_DADA_STATUS[info.dada?.dadaStatus]?.msg - }else if (squareRoot) { + } else if (squareRoot) { return '待医生开方' } else if (supplement) { return '待补充处方信息' } else if (info.deliveryStatus == 'PARTAIL') { return '部分商品已发货' - } else if (info.cancelStatus == 'WAIT_PROCESS') { + } else if (info.cancelStatus == 'WAIT_PROCESS') { return '订单取消,退款处理中' - }else if (info.zitiStatus == 'PENDING' && info.orderStatus == "PAYED") { + } else if (info.zitiStatus == 'PENDING' && info.orderStatus == 'PAYED') { return '等待核销' - } else if ( + } else if ( info.orderStatus == 'NOTPAY' && info.payType == 'offline_pay' && info.offlinePayCheckStatus == '0' @@ -385,7 +390,11 @@ function TradeDetail(props) { } // 自提订单 - if (info.receiptType == 'ziti' && info.orderStatus == "PAYED" && info.zitiStatus == 'PENDING') { + if ( + info.receiptType == 'ziti' && + info.orderStatus == 'PAYED' && + info.zitiStatus == 'PENDING' + ) { btns.unshift(tradeActionBtns.WRITE_OFF) } @@ -416,7 +425,7 @@ function TradeDetail(props) { // const routeParams = await entryLaunch.getRouteParams() // return routeParams && routeParams.order_id ? routeParams : storedData const order_id = router.params?.order_id - return order_id ? {order_id} : storedData + return order_id ? { order_id } : storedData } const handleCallOpreator = () => { @@ -479,7 +488,6 @@ function TradeDetail(props) { }) } - return ( {getTradeStatusDesc()} - { - supplement && + {supplement && ( 前往补充 - } + )} {info?.selfDeliveryOperatorName && info?.selfDeliveryOperatorMobile && ( @@ -513,7 +520,7 @@ function TradeDetail(props) { 拨打电话 - + 订单跟踪 @@ -541,8 +548,7 @@ function TradeDetail(props) { )} - { - info?.prescriptionStatus > 0 && + {info?.prescriptionStatus > 0 && ( 1 @@ -550,8 +556,14 @@ function TradeDetail(props) { ----- - 2 - 医生开方 + + 2 + + + 医生开方 + ----- @@ -559,9 +571,8 @@ function TradeDetail(props) { 支付订单 - } - { - (squareRoot && !supplement) && + )} + {squareRoot && !supplement && ( 处方已开具,正在药师审方中,请等待! @@ -572,8 +583,7 @@ function TradeDetail(props) { /> - } - + )} { // 普通快递 @@ -635,7 +645,7 @@ function TradeDetail(props) { info?.receiptType == 'dada' && info.dada.dadaStatus > 1 && info.dada.dadaStatus !== 5 && ( - + 骑手:{info.dada.dmName} { if (info?.orderClass === 'pointsmall') { - return `${pointName} ${info?.itemPoint}${info?.itemFee ? `+¥${Number(info?.itemFee).toFixed(2)}` : ''}` + return `${pointName} ${info?.itemPoint}${ + info?.itemFee ? `+¥${Number(info?.itemFee).toFixed(2)}` : '' + }` } else { return } @@ -747,19 +759,21 @@ function TradeDetail(props) { ) })()} /> - {info?.pointFee > 0 && + {info?.pointFee > 0 && ( { return - })()} + })()} /> - } + )} { if (info?.orderClass === 'pointsmall') { - return `${pointName} ${info?.point}${info?.totalFee >0 ? `+¥${Number(info?.totalFee).toFixed(2)}` : ''}` + return `${pointName} ${info?.point}${ + info?.totalFee > 0 ? `+¥${Number(info?.totalFee).toFixed(2)}` : '' + }` } else { return } @@ -769,64 +783,64 @@ function TradeDetail(props) { {/* */} - { - console.log(info, 'info------') - } + {console.log(info, 'info------')} - { - info?.prescriptionStatus > 0 && !supplement && + {info?.prescriptionStatus > 0 && !supplement && ( 处方信息 - { - info?.diagnosisData?.doctor_name && + {info?.diagnosisData?.doctor_name && ( { + return {info?.diagnosisData?.doctor_name} + })()} + /> + )} + {info?.diagnosisData?.location_url && ( + { return ( - - {info?.diagnosisData?.doctor_name} + { + const webviewSrc = encodeURIComponent(info?.diagnosisData?.location_url) + Taro.redirectTo({ + url: `/pages/webview?url=${webviewSrc}` + }) + }} + > + 查看 ) })()} /> - } - { - info?.diagnosisData?.location_url && - { - return ( - { - const webviewSrc = encodeURIComponent(info?.diagnosisData?.location_url) - Taro.redirectTo({ - url: `/pages/webview?url=${webviewSrc}` - }) - }}> - 查看 - - ) - })()} + )} + {info?.prescriptionData?.audit_apothecary_name && ( + { + return {info?.prescriptionData?.audit_apothecary_name} + })()} /> - } - {info?.prescriptionData?.audit_apothecary_name && - { - return ( - - {info?.prescriptionData?.audit_apothecary_name} - - ) - })()} + )} + {info?.prescriptionData?.dst_file_path && ( + { + return ( + dstFilePath(info?.prescriptionData?.dst_file_path)} + > + 查看 + + ) + })()} /> - } - {info?.prescriptionData?.dst_file_path && { - return ( - dstFilePath(info?.prescriptionData?.dst_file_path)}> - 查看 - - ) - })()} - />} + )} - } - + )} 订单信息 @@ -913,13 +927,16 @@ function TradeDetail(props) { }} /> - + 长按可保存处方图片 - { - Taro.previewImage({ - urls: prescriptionUrl - }) - }}> + { + Taro.previewImage({ + urls: prescriptionUrl + }) + }} + > )