From c4684c11b8313f47096b14db3df713e5784289ba Mon Sep 17 00:00:00 2001 From: czm <2192718639@qq.com> Date: Fri, 22 Jul 2022 20:46:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=9F=8E=E6=B5=8B=E8=AF=95=E7=89=88v7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/user.ts | 21 +++++- src/components/afterOrderBtns/index.tsx | 6 +- .../component/successBind/index.module.scss | 15 ++++- .../component/successBind/index.tsx | 20 +++--- src/pages/bindSalesman/index.tsx | 46 +++++++++---- src/pages/details/index.tsx | 1 - src/pages/order/comfirm.tsx | 2 +- src/pages/order/components/kindList/index.tsx | 2 +- src/pages/order/components/payment/index.tsx | 7 +- .../components/returnRecord/index.module.scss | 2 +- src/pages/order/components/scanPay/index.tsx | 6 +- .../order/components/scanPayCheck/index.tsx | 11 ++-- .../orderList/components/order/index.tsx | 2 +- src/pages/orderList/index.config.ts | 2 + .../components/applyRecord/index.tsx | 4 +- .../salesAfter/components/kindList/index.tsx | 66 +++++++++---------- src/pages/salesAfter/index.tsx | 33 +--------- .../salesAfterList/components/order/index.tsx | 15 ++--- src/use/useHttp.ts | 11 ++-- 19 files changed, 142 insertions(+), 130 deletions(-) diff --git a/src/api/user.ts b/src/api/user.ts index abdc9c9..9dc2573 100644 --- a/src/api/user.ts +++ b/src/api/user.ts @@ -42,7 +42,7 @@ import { useRequest } from "@/use/useHttp" /** * 公司类型|企业类型 下拉列表 */ - export const companyTypeApi = () => { +export const companyTypeApi = () => { return useRequest({ url: `/v1/mall/enum/purchaserType`, method: "get", @@ -89,3 +89,22 @@ import { useRequest } from "@/use/useHttp" }) } +/** + * 邀请码获取业务员信息 + */ + export const GetInvitationInfoApi = () => { + return useRequest({ + url: `/v1/mall/user/invitationInfo`, + method: "get", + }) +} + +/** + * 绑定业务员 + */ + export const BindInvitationInfoApi = () => { + return useRequest({ + url: `/v1/mall/user/bindInvitationCode`, + method: "post", + }) +} diff --git a/src/components/afterOrderBtns/index.tsx b/src/components/afterOrderBtns/index.tsx index 19f2c5e..d85567f 100644 --- a/src/components/afterOrderBtns/index.tsx +++ b/src/components/afterOrderBtns/index.tsx @@ -1,4 +1,3 @@ -import { CancelOrderApi, ReceiveOrderApi } from "@/api/order" import { alert } from "@/common/common" import { AFTER_ORDER_STATUS, ORDER_STATUS, REFUND_STATUS_ORDER, SALE_MODE } from "@/common/enum" import {Text, View } from "@tarojs/components" @@ -12,10 +11,10 @@ import { throttle } from "@/common/util" type Param = { orderInfo: { stage: number, //售后状态 - orderId: number, //订单id sale_mode: number, //订单类型 type: number, //1退货,2退款 return_apply_order_id: number //售后申请单 + is_quality_check: true|false //质检结果 }, onClick?: (val: number) => void, //点击后触发的事件,返回订单状态 fixedBottom?: true|false, //是否固定在底部 @@ -61,8 +60,7 @@ export default memo(({orderInfo, onClick, fixedBottom = true}:Param) => { id: 4, label: '质检结果', validatarFunc: (orderInfo) => { - if(orderInfo.sale_mode !== 1 && orderInfo.type == ReturnApplyOrderTypeReturnForRefund.value) return [ReturnStageQualityCheckPendingRefund.value, ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value].includes(orderInfo.stage) - return false + return orderInfo?.is_quality_check } }, { diff --git a/src/pages/bindSalesman/component/successBind/index.module.scss b/src/pages/bindSalesman/component/successBind/index.module.scss index 31c0382..9abce63 100644 --- a/src/pages/bindSalesman/component/successBind/index.module.scss +++ b/src/pages/bindSalesman/component/successBind/index.module.scss @@ -21,16 +21,29 @@ z-index: 1999; .bindSalesman_header{ width: 654px; - height: 654px; + position: relative; image{ width: 100%; height: 100%; border-radius: 40px 40px 0 0; } + .sale_man{ + color: #fff; + text-align: center; + font-size: 26px; + position: absolute; + margin: auto; + left: 0; + right: 0; + bottom: 60px; + height: 100px; + line-height: 100px; + } } .btns{ width: 488px; height: 104px; + margin: 50px; image{ width: 100%; } diff --git a/src/pages/bindSalesman/component/successBind/index.tsx b/src/pages/bindSalesman/component/successBind/index.tsx index 8d431f5..bf10072 100644 --- a/src/pages/bindSalesman/component/successBind/index.tsx +++ b/src/pages/bindSalesman/component/successBind/index.tsx @@ -8,16 +8,12 @@ import { useEffect, useState } from "react"; type params = { show?: true|false, - onClose?: () => void + onClose?: () => void, + saleMan?: string } -export default ({show = false, onClose}:params) => { - const [showPop, setShowPop] = useState(false) - useEffect(() => { - if(show !== undefined) setShowPop(() => show) - }, [show]) +export default ({show = false, saleMan = '', onClose}:params) => { const onClick = async (val) => { onClose?.() - setShowPop(() => false) if(val == 1) { goLink('/pages/depositBeforehand/index') } else { @@ -25,20 +21,20 @@ export default ({show = false, onClose}:params) => { } } const onCloseEven = () => { - setShowPop(() => false) onClose?.() } return ( <> - {showPop&& + {show&& onClick(1)}> + 邀请人: {saleMan} - onClick(2)}> - + + onClick(2)}/> - {/* */} + } diff --git a/src/pages/bindSalesman/index.tsx b/src/pages/bindSalesman/index.tsx index cb8ab7b..4e3df8b 100644 --- a/src/pages/bindSalesman/index.tsx +++ b/src/pages/bindSalesman/index.tsx @@ -3,11 +3,13 @@ import styles from './index.module.scss' import useLogin from '@/use/useLogin' import classnames from "classnames"; import { formatImgUrl } from '@/common/fotmat' -import { useEffect, useState } from 'react'; +import { useEffect, useMemo, useState } from 'react'; import { alert } from '@/common/common'; import CloseBtn from '@/components/closeBtn'; import SuccessBind from './component/successBind'; import Taro, { useDidShow } from "@tarojs/taro"; +import { BindInvitationInfoApi, GetInvitationInfoApi } from '@/api/user'; +import { debounce, getFilterData, throttle } from '@/common/util'; export default () => { useLogin() @@ -16,25 +18,45 @@ export default () => { }) const [submitData, setSubmitData] = useState({ - code: '', + invitation_code: '', }) - const onSubmit = () => { - if(!submitData.code) alert.error('请输入邀请码') + //获取业务员信息 + type Param = {invitation_code: string, name: string, phone: string} + const [salesMan, setSalesMan] = useState(null) + const {fetchData: GetInvitationInfoFetchData} = GetInvitationInfoApi() + const getInvitationInfo = async () => { + let res = await GetInvitationInfoFetchData(getFilterData({...submitData})) + res.success?setSalesMan(res.data):setSalesMan(null) } + useEffect(() => { + if(submitData.invitation_code.length === 4) + getInvitationInfo() + }, [submitData]) const onInputCode = (e) => { - setSubmitData((val) => ({...val, code:e.detail.value})) + const value = e.detail.value.replace(/[\W]/g, "") + setSubmitData((val) => ({...val, invitation_code:value})) } const oncloseEven = () => { - setSubmitData((val) => ({...val, code:''})) + setSubmitData((val) => ({...val, invitation_code:''})) + setSalesMan(null) + } + + //绑定业务员 + const [bindShow, setBindShow] = useState(false) + const {fetchData: bindInvitationInfoFetchData} = BindInvitationInfoApi() + const onSubmit = async () => { + if(!submitData.invitation_code) return alert.error('请输入邀请码') + let res = await bindInvitationInfoFetchData({...submitData}) + if(res.success) setBindShow(() => true) } const onScanCode = () => { Taro.scanCode({ success: (res) => { - console.log(res) + setSubmitData(() => ({invitation_code: res.result})) } }) } @@ -44,7 +66,7 @@ export default () => { Taro.getClipboardData({ success: function (res){ let val = res.data.match(/InviteCode:([a-zA-Z0-9]{4})/) - setSubmitData((...e) => ({...e, code: val?val[1]:''})) + setSubmitData((e) => ({...e, invitation_code: val?val[1]:''})) } }) } @@ -55,15 +77,15 @@ export default () => { - onInputCode(e)}/> + - {submitData.code&&} + {submitData.invitation_code&&} onScanCode()}> - 邀请人:李先生(132****6690) + {salesMan&&邀请人:{`${salesMan.name} (${salesMan.phone})`}} 提交 温馨提示 @@ -71,7 +93,7 @@ export default () => { 2. 一个手机只能输入一次邀请码。输入邀请码。 - + setBindShow(false)} saleMan={salesMan?.name}/> ) } diff --git a/src/pages/details/index.tsx b/src/pages/details/index.tsx index b4d42c8..752b177 100644 --- a/src/pages/details/index.tsx +++ b/src/pages/details/index.tsx @@ -19,7 +19,6 @@ import AddCollection from '@/components/addCollection'; import { AddFavoriteApi, DelFavoriteProductApi } from '@/api/favorite'; import useCommonData from '@/use/useCommonData'; import { IMG_CND_Prefix } from '@/common/constant'; -import LabAndImgShow from '@/components/LabAndImgShow'; type item = {title:string, img:string, url:string, id:number} diff --git a/src/pages/order/comfirm.tsx b/src/pages/order/comfirm.tsx index 2ff6d0c..018b15e 100644 --- a/src/pages/order/comfirm.tsx +++ b/src/pages/order/comfirm.tsx @@ -165,7 +165,7 @@ import { throttle } from "@/common/util"; alert.none(res.msg) } } - }, 600) + }, 800) //页面下拉刷新 usePullDownRefresh(() => { diff --git a/src/pages/order/components/kindList/index.tsx b/src/pages/order/components/kindList/index.tsx index 754055a..25e3d2f 100644 --- a/src/pages/order/components/kindList/index.tsx +++ b/src/pages/order/components/kindList/index.tsx @@ -125,7 +125,7 @@ export default memo(({order, comfirm = false}:Param) => { }, [order]) //对应单价 const standardPrice = useCallback(price => { - return formatPriceDiv(price, 100, true) + '/' + (order?.sale_mode == 1?'m':'kg') + return formatPriceDiv(price) + '/' + (order?.sale_mode == 1?'m':'kg') }, [order]) //数量格式 diff --git a/src/pages/order/components/payment/index.tsx b/src/pages/order/components/payment/index.tsx index eca1354..c29e09f 100644 --- a/src/pages/order/components/payment/index.tsx +++ b/src/pages/order/components/payment/index.tsx @@ -13,6 +13,7 @@ import { formatPriceDiv } from "@/common/fotmat"; import {alert} from "@/common/common" import { ORDER_STATUS, PAYMENT_METHOD, SUBSCRIPTION_MESSAGE_SCENE } from "@/common/enum"; import { UseSubscriptionMessage } from "@/use/useCommon"; +import { throttle } from "@/common/util"; type Param = { show?: true|false, @@ -28,6 +29,8 @@ type OrderInfo = { status?: number, //订单状态 payment_method?: number, //支付方式 sale_mode?: number, //订单类型 0:大货 1剪板 2散剪 + actual_weight?: number, //实际重量 + estimate_weight?: number, //预估重量 [val: string]: any } @@ -99,7 +102,7 @@ export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param) //提交支付 const {fetchData: submitFetchData} = SubmitOrderPayApi() //应收单提交 const {fetchData: submitPrepayOrderFetchData} = SubmitPrepayOrderPayApi() //预付单提交 - const submitPay = async () => { + const submitPay = throttle(async () => { if(submitData.payment_method === null) { alert.error('请选择支付方式') return false @@ -121,7 +124,7 @@ export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param) } else { alert.none(res.msg) } - } + }, 800) //预付款 const advance_payment = useMemo(() => { diff --git a/src/pages/order/components/returnRecord/index.module.scss b/src/pages/order/components/returnRecord/index.module.scss index 632ac3e..4ef3d47 100644 --- a/src/pages/order/components/returnRecord/index.module.scss +++ b/src/pages/order/components/returnRecord/index.module.scss @@ -9,7 +9,7 @@ padding: 20px; box-sizing: border-box; box-shadow: 0px 0px 12px 0px rgba(0,0,0,0.16); - margin-bottom: 20px;; + margin-bottom: 20px; .header{ display: flex; align-items: center; diff --git a/src/pages/order/components/scanPay/index.tsx b/src/pages/order/components/scanPay/index.tsx index d8d92d9..cf4ad29 100644 --- a/src/pages/order/components/scanPay/index.tsx +++ b/src/pages/order/components/scanPay/index.tsx @@ -46,7 +46,7 @@ export default memo(({show = true, onClose, company, orderInfo}:Param) => { product_color_name: citem.name, num: citem.roll.toString(), length: (citem.length/100).toString(), - weight: formatWeightDiv(citem.estimate_weight).toString(), + weight: formatWeightDiv(citem.actual_weight||citem.estimate_weight).toString(), sale_price: formatPriceDiv(citem.sale_price).toString(), total_price: formatPriceDiv(citem.estimate_amount).toString(), }) @@ -73,7 +73,7 @@ export default memo(({show = true, onClose, company, orderInfo}:Param) => { order_total_price: formatPriceDiv(orderInfo.total_sale_price).toString(), //订单价格 order_total_num: (orderInfo.total_number) + '', qrcode:"", //跳转链接 - order_total_weight: formatWeightDiv(orderInfo.total_estimate_weight).toString(), //订单布匹重量 + order_total_weight: formatWeightDiv(orderInfo.total_weight||orderInfo.total_estimate_weight).toString(), //订单布匹重量 list: lists , show_qrcode: true //是否显示码单 })) @@ -172,7 +172,7 @@ export default memo(({show = true, onClose, company, orderInfo}:Param) => { {(state.loading)&&|| - + } 保存电子确认单 diff --git a/src/pages/order/components/scanPayCheck/index.tsx b/src/pages/order/components/scanPayCheck/index.tsx index 2305ba8..4011d3c 100644 --- a/src/pages/order/components/scanPayCheck/index.tsx +++ b/src/pages/order/components/scanPayCheck/index.tsx @@ -5,12 +5,10 @@ import styles from './index.module.scss' import Popup from "@/components/popup"; import Taro from "@tarojs/taro"; import { alert } from "@/common/common"; -import { formatDateTime, formatHashTag, formatImgUrl, formatPriceDiv, formatRemoveHashTag, formatWeightDiv } from "@/common/fotmat"; +import { formatDateTime, formatPriceDiv, formatRemoveHashTag, formatWeightDiv } from "@/common/fotmat"; import useCheckAuthorize from "@/use/useCheckAuthorize"; import { GetPayCode } from "@/api/onlinePay"; import LoadingCard from "@/components/loadingCard"; -import { GetOrderPayApi, GetPrepayOrderPayApi } from "@/api/orderPay"; - type Param = { show?: true|false, @@ -52,7 +50,7 @@ export default memo(({show = true, onClose, company, orderInfo}:Param) => { product_color_name: citem.name, num: citem.roll.toString(), length: (citem.length/100).toString(), - weight: formatWeightDiv(citem.estimate_weight).toString(), + weight: formatWeightDiv(citem.actual_weight||citem.estimate_weight).toString(), sale_price: formatPriceDiv(citem.sale_price).toString(), total_price: formatPriceDiv(citem.total_sale_price||citem.estimate_amount).toString(), }) @@ -79,7 +77,7 @@ export default memo(({show = true, onClose, company, orderInfo}:Param) => { order_total_price: formatPriceDiv(orderInfo.total_sale_price).toString(), //订单价格 order_total_num: (orderInfo.total_number).toString(), qrcode:"", //跳转链接 - order_total_weight: formatWeightDiv(orderInfo.total_estimate_weight).toString(), //订单布匹重量 + order_total_weight: formatWeightDiv(orderInfo.total_weight||orderInfo.total_estimate_weight).toString(), //订单布匹重量 list: lists })) } @@ -104,7 +102,6 @@ export default memo(({show = true, onClose, company, orderInfo}:Param) => { return addressInfo?.shipment_mode == 2? orderInfo.target_user_phone : orderInfo.take_goods_phone } - //获取支付二维码 const [payCodeImage, setPayCodeImage] = useState('') const fileData = useRef({ @@ -142,7 +139,7 @@ export default memo(({show = true, onClose, company, orderInfo}:Param) => { alert.loading('正在保存图片') Taro.saveImageToPhotosAlbum({ filePath: fileData.current.filePath, - success: function (res) { + success: function () { alert.success('图片保存成功') }, fail: function (err) { diff --git a/src/pages/orderList/components/order/index.tsx b/src/pages/orderList/components/order/index.tsx index 18c0de0..6d0d02e 100644 --- a/src/pages/orderList/components/order/index.tsx +++ b/src/pages/orderList/components/order/index.tsx @@ -48,7 +48,7 @@ export default memo(({value, onClickBtn}: Param) => { }, [value]) //对应单价 const standardPrice = useCallback((price, sale_mode) => { - return formatPriceDiv(price).toLocaleString() + '/' + (sale_mode == 1?'m':'kg') + return '¥' + formatPriceDiv(price).toLocaleString() + '/' + (sale_mode == 1?'m':'kg') }, [value]) //点击订单按钮 diff --git a/src/pages/orderList/index.config.ts b/src/pages/orderList/index.config.ts index ef55be9..7a9457b 100644 --- a/src/pages/orderList/index.config.ts +++ b/src/pages/orderList/index.config.ts @@ -1,4 +1,6 @@ export default { navigationBarTitleText: '订单列表', enableShareAppMessage: true, + enablePullDownRefresh: true, + backgroundTextStyle: 'dark', } diff --git a/src/pages/salesAfter/components/applyRecord/index.tsx b/src/pages/salesAfter/components/applyRecord/index.tsx index 2ea28b1..39849ee 100644 --- a/src/pages/salesAfter/components/applyRecord/index.tsx +++ b/src/pages/salesAfter/components/applyRecord/index.tsx @@ -1,5 +1,5 @@ import { SaleOrderOrderDetailApi } from "@/api/salesAfterOrder"; -import { formatHashTag, formatPriceDiv } from "@/common/fotmat"; +import { formatHashTag, formatPriceDiv, formatWeightDiv } from "@/common/fotmat"; import LabAndImg from "@/components/LabAndImg"; import Popup from "@/components/popup"; import { ScrollView, Text, View } from "@tarojs/components"; @@ -106,7 +106,7 @@ export default memo(({show, onClose, onSubmit, id}:Param) => { {colorItem.code + ' ' + colorItem.name} ¥{standardPrice(colorItem.sale_price)} - 总重{standardPrice(colorItem.estimate_weight)} + 总重{formatWeightDiv(colorItem.estimate_weight)}kg diff --git a/src/pages/salesAfter/components/kindList/index.tsx b/src/pages/salesAfter/components/kindList/index.tsx index 149de15..6804558 100644 --- a/src/pages/salesAfter/components/kindList/index.tsx +++ b/src/pages/salesAfter/components/kindList/index.tsx @@ -28,6 +28,7 @@ type OrderParam = { quality_check_pass_colors: number, //验布后的颜色总数 quality_check_pass_fabrics: number, //验布后的面料数量 quality_check_pass_number: number, //验布后的总数量 + is_quality_check: true|false, //是否质检过 } type Param = { @@ -36,31 +37,6 @@ type Param = { } export default memo(({order, comfirm = false}:Param) => { - //对应数量 - const formatCount = useCallback((item) => { - return order?.sale_mode == 0? item.roll : Number(item.length / 100) - }, [order]) - //对应单价 - const standardPrice = useCallback(price => { - return formatPriceDiv(price).toLocaleString() + '/' + (order?.sale_mode == 1?'m':'kg') - }, [order]) - //数量格式 - const numText = useMemo(() => { - if(order) { - if(!order?.quality_check_pass_fabrics&&!order?.quality_check_pass_number&&!order?.quality_check_pass_colors) { - let total_number = order?.sale_mode == 0?order?.total_number:(order?.total_number/100) - return `${order?.total_fabrics} 种面料,${order?.total_colors} 种颜色,共 ${total_number} ${order?.unit}` - } else { - let total_number = order?.sale_mode == 0?order?.quality_check_pass_number:(order?.quality_check_pass_number/100) - return `${order?.quality_check_pass_fabrics} 种面料,${order?.quality_check_pass_colors} 种颜色,共 ${total_number} ${order?.unit}` - } - } - }, [order]) - - //获取面料数组 - const list = useMemo(() => { - return order?.quality_check_pass_product?.length > 0?order?.quality_check_pass_product:order?.product_list - }, [order]) //售后单状态枚举 const { @@ -73,15 +49,7 @@ export default memo(({order, comfirm = false}:Param) => { ReturnStageServiceOrderPendingRefund, // 待退款 ReturnStageRejected, // 已拒绝 } = AFTER_ORDER_STATUS - - //退款状态枚举 - // const { - // ShouldCollectOrderRefundTypeUnknown, - // ShouldCollectOrderRefundTypeAdvanceReceiptRefund, - // ShouldCollectOrderRefundTypeReturnForRefund, - // ShouldCollectOrderRefundTypeSalesRefund, - // } = REFUND_STATUS - + //金额列表枚举 const priceList = [ { @@ -133,6 +101,34 @@ export default memo(({order, comfirm = false}:Param) => { ) }, [order]) + //对应数量 + const formatCount = useCallback((item) => { + return order?.sale_mode == 0? item.roll : Number(item.length / 100) + }, [order]) + + //对应单价 + const standardPrice = useCallback(price => { + return formatPriceDiv(price).toLocaleString() + '/' + (order?.sale_mode == 1?'m':'kg') + }, [order]) + + //数量格式 + const numText = useMemo(() => { + if(order) { + if(!order?.is_quality_check) { + let total_number = order?.sale_mode == 0?order?.total_number:(order?.total_number/100) + return `${order?.total_fabrics} 种面料,${order?.total_colors} 种颜色,共 ${total_number} ${order?.unit}` + } else { + let total_number = order?.sale_mode == 0?order?.quality_check_pass_number:(order?.quality_check_pass_number/100) + return `${order?.quality_check_pass_fabrics} 种面料,${order?.quality_check_pass_colors} 种颜色,共 ${total_number} ${order?.unit}` + } + } + }, [order]) + + //获取面料数组 + const list = useMemo(() => { + return order?.is_quality_check?order?.quality_check_pass_product:order?.product_list + }, [order]) + //整理颜色 const labAndRgbAndUrl = useCallback((item) => { return {lab:{...item?.lab}, rgb:{...item?.rgb}, texturl_url: item?.texturl_url} @@ -145,7 +141,7 @@ export default memo(({order, comfirm = false}:Param) => { //销售价格 const formatPrice = useCallback((colorItem) => { - return (ReturnStageReturned.value == order?.stage) && ¥{formatPriceDiv(colorItem.estimate_amount, {} , true)} + return (ReturnStageReturned.value == order?.stage) && ¥{formatPriceDiv(colorItem.estimate_amount, 100 , true)} }, [order]) return ( diff --git a/src/pages/salesAfter/index.tsx b/src/pages/salesAfter/index.tsx index 6f6e868..7f5c0b3 100644 --- a/src/pages/salesAfter/index.tsx +++ b/src/pages/salesAfter/index.tsx @@ -46,32 +46,8 @@ import styles from './index.module.scss' const [formatDetailOrder, setFormatDetailOrder] = useState() //格式化后的数据 const formatData = () => { setFormatDetailOrder({ - estimate_amount: orderDetail.estimate_amount, //预估金额 - sale_mode: orderDetail.sale_mode, - sale_mode_name: orderDetail.sale_mode_name, - total_colors: orderDetail.total_colors, //总颜色数量 - total_number: orderDetail.total_number, //总数量 - total_fabrics: orderDetail.total_fabrics, //面料数量 - quality_check_pass_colors: orderDetail.quality_check_pass_colors, //验布后的颜色总数 - quality_check_pass_fabrics: orderDetail.quality_check_pass_fabrics, //验布后的面料数量 - quality_check_pass_number: orderDetail.quality_check_pass_number, //验布后的总数量 + ...orderDetail, unit: orderDetail.sale_mode == 0?'条':'m', //单位 - // list: orderDetail.quality_check_pass_product.length > 0?orderDetail.quality_check_pass_product:orderDetail.product_list, - product_list: orderDetail.product_list, - quality_check_pass_product: orderDetail.quality_check_pass_product, - stage: orderDetail.stage, //订单状态 - type: orderDetail.type, //退货or退款 - total_sale_price: orderDetail.total_sale_price, //销售金额 - total_should_collect_money: orderDetail.total_should_collect_money, //应收金额 - total_weight_error_discount: orderDetail.total_weight_error_discount, //空差优惠 - actual_amount: orderDetail.actual_amount, //实付金额 - the_previous_status: orderDetail.the_previous_status, //取消订单时的订单状态 - other_deduction_amount: orderDetail.other_deduction_amount, //其他扣除金额 - total_refund_amount: orderDetail.total_refund_amount, //合计金额 - refund_amount: orderDetail.refund_amount, //退款金额 - refund_type: orderDetail.refund_type, //退款状态 - refund_flow_name: orderDetail.refund_flow_name //退款去向 - }) } const formatPreViewOrderMemo = useMemo(() => { @@ -99,12 +75,7 @@ import styles from './index.module.scss' //按钮所需数据 const orderInfo = useMemo(() => { return { - stage: orderDetail?.stage, //售后订单状态 - orderId: orderDetail?.id, - settle_mode: orderDetail?.settle_mode, - type: orderDetail?.type, //退货or退款 - sale_mode: orderDetail?.sale_mode, //订单类型 - return_apply_order_id: orderDetail?.return_apply_order_id + ...orderDetail } }, [orderDetail]) diff --git a/src/pages/salesAfterList/components/order/index.tsx b/src/pages/salesAfterList/components/order/index.tsx index 119ccc8..c81aa4a 100644 --- a/src/pages/salesAfterList/components/order/index.tsx +++ b/src/pages/salesAfterList/components/order/index.tsx @@ -31,6 +31,7 @@ type Param = { type: number //2 退货 1 预收退款 3 销售 return_apply_order_id: number //退款申请单 refund_amount: number // 退款金额 + is_quality_check: true|false }, onClickBtn?: (val:{status:number, orderInfo:Param['value']}) => void } @@ -52,13 +53,7 @@ export default memo(({value, onClickBtn}: Param) => { //按钮所需数据 const orderInfo = useMemo(() => { - return { - stage: value?.stage, //订单状态 - orderId: value?.id, - sale_mode: value?.sale_mode, //订单类型 - type: value?.type, //退货or退款 - return_apply_order_id: value?.return_apply_order_id //退款申请单 - } + return value }, [value]) //整理颜色 @@ -110,11 +105,11 @@ export default memo(({value, onClickBtn}: Param) => { {value?.product_list?.[0].product_colors?.[0].code} - {value?.product_list?.[0].product_colors.map((itemColor, index) => { + {value?.product_list?.[0].product_colors?.map((itemColor, index) => { return ( (index <= 1)&& {formatHashTag(itemColor.code, itemColor.name)} - {standardPrice(itemColor.sale_price, value.sale_mode)} + ¥{standardPrice(itemColor.sale_price, value.sale_mode)} ×{formatCount(itemColor, value.sale_mode)} ) @@ -129,7 +124,7 @@ export default memo(({value, onClickBtn}: Param) => { {numText} - {ReturnStageReturned.value == value?.stage && ¥{formatPriceDiv(value?.refund_amount, 100, true)}} + {/* {ReturnStageReturned.value == value?.stage && ¥{formatPriceDiv(value?.refund_amount, 100, true)}} */} {value?.type == ReturnApplyOrderTypeReturnForRefund.value?'已申请退货':'已申请退款'} diff --git a/src/use/useHttp.ts b/src/use/useHttp.ts index 0403c1b..314c0b6 100644 --- a/src/use/useHttp.ts +++ b/src/use/useHttp.ts @@ -35,7 +35,8 @@ type option = { page?: number, pageSize?: number, pagination?: true|false, - base_url?: string + base_url?: string, + apiMsgStatus?: true|false } /** @@ -101,8 +102,10 @@ export const useRequest = (options:option = { page: 1, pageSize: 24, pagination: false, // 是否分页 - base_url: '' + base_url: '', + apiMsgStatus: true //是否直接弹出后端错误 }) => { + options.url = `${options.base_url||BASE_URL}${options.url}` let params:Params = { code: null, // 业务码 @@ -127,7 +130,6 @@ export const useRequest = (options:option = { // 请求函数 const fetchData = async (sub_options?:any) => { - stateRef.current.loading = true setState((e) => ({...e, loading:true})) stateRef.current.query = { @@ -170,7 +172,7 @@ export const useRequest = (options:option = { stateRef.current.data = data stateRef.current.total = data?.list ? data?.total : 0 if(code !== 0) { - Taro.showToast({ + options.apiMsgStatus !== false &&Taro.showToast({ title: `${msg}`, icon: 'none' }) @@ -183,7 +185,6 @@ export const useRequest = (options:option = { removeSessionKey() removeUserInfo() login() - //todo 登录数据刷新次数问题 } else { Taro.showToast({ title: `错误:${showStatus(statusCode)}`,