From b2f17afe50abd6b3284cee588a7bd8712ba22817 Mon Sep 17 00:00:00 2001 From: czm <2192718639@qq.com> Date: Fri, 1 Jul 2022 20:28:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=94=AE=E5=90=8E=E5=9F=BA=E6=9C=AC=E5=AF=B9?= =?UTF-8?q?=E5=AE=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/user.ts | 13 +- src/common/constant.js | 4 +- src/components/afterOrderBtns/index.tsx | 56 +++-- src/components/orderBtns/index.tsx | 1 - .../components/kindList/index.tsx | 2 +- src/pages/applyAfterSales/index.tsx | 2 +- src/pages/order/comfirm.tsx | 4 +- .../components/addressInfoDetail/index.tsx | 26 ++- .../orderList/components/order/index.tsx | 2 + .../components/addressInfoDetail/index.tsx | 13 +- .../components/applyRecord/index.module.scss | 5 + .../components/applyRecord/index.tsx | 5 +- .../components/cutlKindList/index.module.scss | 131 ++++++++++++ .../components/cutlKindList/index.tsx | 192 ++++++++++++++++++ .../components/kindList/index.module.scss | 5 + .../salesAfter/components/kindList/index.tsx | 93 ++++++--- .../modelKindList/index.module.scss | 131 ++++++++++++ .../components/modelKindList/index.tsx | 168 +++++++++++++++ src/pages/salesAfter/index.tsx | 14 +- .../salesAfterList/components/order/index.tsx | 6 +- 20 files changed, 780 insertions(+), 93 deletions(-) create mode 100644 src/pages/salesAfter/components/cutlKindList/index.module.scss create mode 100644 src/pages/salesAfter/components/cutlKindList/index.tsx create mode 100644 src/pages/salesAfter/components/modelKindList/index.module.scss create mode 100644 src/pages/salesAfter/components/modelKindList/index.tsx diff --git a/src/api/user.ts b/src/api/user.ts index aa29919..ee51fc1 100644 --- a/src/api/user.ts +++ b/src/api/user.ts @@ -78,4 +78,15 @@ import { useRequest } from "@/use/useHttp" url: `/v1/mall/orderAccess/apply`, method: "post", }) -} \ No newline at end of file +} + +/** + * 订阅模板id + */ + export const SubscriptionMessageApi = () => { + return useRequest({ + url: `/v1/mall/subscriptionMessage`, + method: "post", + }) +} + diff --git a/src/common/constant.js b/src/common/constant.js index 9eb3a66..3dc9ec4 100644 --- a/src/common/constant.js +++ b/src/common/constant.js @@ -10,8 +10,8 @@ // export const BASE_URL = `https://dev.zzfzyc.com/lymarket` // 开发环境 // export const BASE_URL = `https://www.zzfzyc.com/lymarket` // 正式环境 // export const BASE_URL = `http://192.168.1.5:40001/lymarket` // 王霞 -export const BASE_URL = `http://192.168.1.7:50002/lymarket` // 添 -// export const BASE_URL = `http://192.168.1.42:50001/lymarket` // 杰 +// export const BASE_URL = `http://192.168.1.7:50002/lymarket` // 添 +export const BASE_URL = `http://192.168.1.42:50001/lymarket` // 杰 // CDN // 生成密钥 diff --git a/src/components/afterOrderBtns/index.tsx b/src/components/afterOrderBtns/index.tsx index 3fdacbe..5d0bec8 100644 --- a/src/components/afterOrderBtns/index.tsx +++ b/src/components/afterOrderBtns/index.tsx @@ -39,68 +39,64 @@ export default memo(({orderInfo, onClick, onBtnNull}:Param) => { //售后按钮按售后状态归类, value是该订单状态,可能该按钮会出现 const orderBtnsList = useRef([ + { + id: 8, + big_value: [ReturnStageQualityCheckPendingRefund.value, ReturnStageServiceOrderPendingRefund.value], + cut_value: [ReturnStageQualityCheckPendingRefund.value, ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value ], + model_value: [], + label: '申请记录' + }, { id: 1, - value: [ReturnStageApplying.value, ReturnStageWaitCheck.value], + big_value: [ReturnStageApplying.value, ReturnStageWaitCheck.value], + cut_value: [], + model_value: [], label: '取消退货' }, { id: 2, - value: [ReturnStageWaitCheck.value], + big_value: [ReturnStageWaitCheck.value], + cut_value: [], + model_value: [], label: '退货物流' }, - // { - // id: 3, - // value: [ReturnStageChecked.value, ReturnStageQualityCheckPendingRefund.value], - // label: '查看物流' - // }, { id: 4, - value: [ReturnStageQualityCheckPendingRefund.value, ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value], + big_value: [ReturnStageQualityCheckPendingRefund.value, ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value], + cut_value: [ReturnStageQualityCheckPendingRefund.value, ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value], + model_value: [], label: '质检结果' }, - // { - // id: 5, - // value: [ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value], - // label: '退货码单' - // }, { id: 6, - value: [ReturnStageApplying.value, ReturnStageServiceOrderPendingRefund.value], + big_value: [ReturnStageApplying.value, ReturnStageServiceOrderPendingRefund.value], + cut_value: [ReturnStageWaitCheck.value, ReturnStageApplying.value], + model_value: [ReturnStageApplying.value], label: '取消退款' }, - // { - // id: 7, - // value: [ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value], - // label: '退款码单' - // }, - { - id: 8, - value: [], - label: '申请记录' - }, + ]) //判断是否显示该按钮 const orderBtnsShow = (item) => { - if(!orderInfo) return false + let key = ['big_value', 'model_value', 'cut_value'] if(item.id == 1) { //取消退货 - return (orderInfo.type == 1)&&item.value.includes(orderInfo.stage) + return (orderInfo.type == 1)&&item[key[orderInfo?.sale_mode]]?.includes(orderInfo.stage) } else if (item.id == 6) { //取消退款 - return (orderInfo.type == 2)&&item.value.includes(orderInfo.stage) + return (orderInfo.type == 2)&&item[key[orderInfo?.sale_mode]]?.includes(orderInfo.stage) } else if (item.id == 4) { //质检结果 - return (orderInfo?.type == 1)&&item.value.includes(orderInfo.stage) //退货才有 + return (orderInfo?.type == 1)&&item[key[orderInfo?.sale_mode]]?.includes(orderInfo.stage) //退货才有 } else { - return item.value.includes(orderInfo.stage) + return item[key[orderInfo?.sale_mode]]?.includes(orderInfo.stage) } } //显示的按钮数组 - const orderBtnsShowList: {id: number, value: any, label: string}[] = useMemo(() => { + const orderBtnsShowList: any[] = useMemo(() => { return orderBtnsList.current.filter(item => { return orderBtnsShow(item) }) diff --git a/src/components/orderBtns/index.tsx b/src/components/orderBtns/index.tsx index b0d4ce6..dce9a65 100644 --- a/src/components/orderBtns/index.tsx +++ b/src/components/orderBtns/index.tsx @@ -168,7 +168,6 @@ export default memo(({orderInfo, onClick}:Param) => { //确认订单 const {fetchData: receiveOrderFetchData} = ReceiveOrderApi() const receiveOrder = async () => { - console.log('123456') Taro.showModal({ title: '确定收货?', success: async function (res) { diff --git a/src/pages/applyAfterSales/components/kindList/index.tsx b/src/pages/applyAfterSales/components/kindList/index.tsx index e4a032b..9b7492e 100644 --- a/src/pages/applyAfterSales/components/kindList/index.tsx +++ b/src/pages/applyAfterSales/components/kindList/index.tsx @@ -30,7 +30,7 @@ const kindeList:FC = memo(({order, onNumChange}) => { //计步器失返回值 const getCounterChange = useCallback((colorItem) => { return (number) => { - onNumChange?.({number, color_id: colorItem.id}) + onNumChange?.({number, color_id: colorItem.id, sale_order_detail_id:colorItem.sale_order_detail_id}) } }, []) diff --git a/src/pages/applyAfterSales/index.tsx b/src/pages/applyAfterSales/index.tsx index 7d170e5..7d320eb 100644 --- a/src/pages/applyAfterSales/index.tsx +++ b/src/pages/applyAfterSales/index.tsx @@ -86,7 +86,7 @@ export default () => { //大货时获取计步器数据 const getNumChange = useCallback((val) => { if(parseInt(val.number) > 0) { - roll_list.current[val.color_id] = {product_color_id: val.color_id, product_roll: val.number} + roll_list.current[val.color_id] = {product_color_id: val.color_id, product_roll: val.number, sale_order_detail_id: val.sale_order_detail_id} } else { delete roll_list.current[val.color_id] } diff --git a/src/pages/order/comfirm.tsx b/src/pages/order/comfirm.tsx index 52371dc..e89ba97 100644 --- a/src/pages/order/comfirm.tsx +++ b/src/pages/order/comfirm.tsx @@ -89,7 +89,9 @@ import AddressInfoDetail from "./components/addressInfoDetail"; id: address?.id, name: address?.name, phone: address?.phone, - shipment_mode: address?.shipment_mode + shipment_mode: address?.shipment_mode, + take_goods_address: address?.take_goods_address, + take_goods_phone: address?.take_goods_phone, } }, [preViewOrder]) diff --git a/src/pages/order/components/addressInfoDetail/index.tsx b/src/pages/order/components/addressInfoDetail/index.tsx index f7194be..89b8216 100644 --- a/src/pages/order/components/addressInfoDetail/index.tsx +++ b/src/pages/order/components/addressInfoDetail/index.tsx @@ -31,7 +31,9 @@ type Param = { province_name: string, city_name: string, district_name: string, - address_detail: string + address_detail: string, + take_goods_address: string, + take_goods_phone: string } } @@ -46,14 +48,7 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, orderInfo, stat }, [orderInfo]) - //地址格式 - const formatAddress = useMemo(() => { - if(addressInfo?.province_name) { - return addressInfo.province_name + addressInfo.city_name + addressInfo.district_name + addressInfo.address_detail - } else { - return '' - } - }, [addressInfo]) + //打开地址列表 const [showAddressList, setShowAddressList] = useState(false) @@ -134,6 +129,15 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, orderInfo, stat return logisticsShowList.includes(orderInfo?.status as number) }, [orderInfo]) + //地址格式 + const formatAddress = useMemo(() => { + if(receivingStatus == 2) { + return addressInfo?.province_name?addressInfo.province_name + addressInfo.city_name + addressInfo.district_name + addressInfo.address_detail:'' + } else { + return addressInfo?.take_goods_address + } + }, [addressInfo, receivingStatus]) + return ( changeShow()}> @@ -144,8 +148,8 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, orderInfo, stat {(receivingStatus == 2 && !logisticsShow)&&} - {addressInfo?.name} - {addressInfo?.phone} + {receivingStatus == 1?'管理员':addressInfo?.name} + {receivingStatus == 1?addressInfo?.take_goods_phone: addressInfo?.phone} {!logisticsShow&& diff --git a/src/pages/orderList/components/order/index.tsx b/src/pages/orderList/components/order/index.tsx index 5dbb13c..b21c722 100644 --- a/src/pages/orderList/components/order/index.tsx +++ b/src/pages/orderList/components/order/index.tsx @@ -29,6 +29,7 @@ type Param = { actual_amount: number, //实付金额 wait_pay_amount: number, //待付金额 should_collect_order_id: number, //应付单id + av_return_roll: number }, onClickBtn?: (val:{status:number, orderInfo:Param['value']}) => void } @@ -56,6 +57,7 @@ export default memo(({value, onClickBtn}: Param) => { actual_amount: value?.actual_amount, //实付金额 wait_pay_amount: value?.wait_pay_amount, //待付金额 sale_mode: value?.sale_mode, //订单类型 + av_return_roll: value?.av_return_roll //可退条数 } }, [value]) diff --git a/src/pages/salesAfter/components/addressInfoDetail/index.tsx b/src/pages/salesAfter/components/addressInfoDetail/index.tsx index db4d5f3..ef9438c 100644 --- a/src/pages/salesAfter/components/addressInfoDetail/index.tsx +++ b/src/pages/salesAfter/components/addressInfoDetail/index.tsx @@ -8,7 +8,7 @@ type Param = { return_address?:string, return_phone?: string, onLogistics?: (val: number) => void, - stage?: number + stage?: number, } export default memo(({return_address = '', return_phone = '', onLogistics, stage}:Param) => { const { @@ -30,12 +30,7 @@ export default memo(({return_address = '', return_phone = '', onLogistics, stage //上传物流 const upLogistics = useMemo(() => { return stage == ReturnStageWaitCheck.value - }, [stage]) - - //查看物流 - const showLogistics = useMemo(() => { - return (stage == ReturnStageChecked.value || stage == ReturnStageQualityCheckPendingRefund.value) - }, [stage]) + }, [stage]) return ( @@ -56,8 +51,8 @@ export default memo(({return_address = '', return_phone = '', onLogistics, stage {return_phone} {upLogistics&& onLogistics?.(1)}> 上传物流 - } - {showLogistics&& onLogistics?.(2)}> + + || onLogistics?.(2)}> 查看物流 } diff --git a/src/pages/salesAfter/components/applyRecord/index.module.scss b/src/pages/salesAfter/components/applyRecord/index.module.scss index ad1916d..b9603f6 100644 --- a/src/pages/salesAfter/components/applyRecord/index.module.scss +++ b/src/pages/salesAfter/components/applyRecord/index.module.scss @@ -89,6 +89,11 @@ .order_list_item_price{ font-size: 26px; color: $color_font_three; + text{ + &:nth-child(1) { + margin-right: 10px; + } + } } } .order_list_item_count{ diff --git a/src/pages/salesAfter/components/applyRecord/index.tsx b/src/pages/salesAfter/components/applyRecord/index.tsx index 2d48da6..d631ac3 100644 --- a/src/pages/salesAfter/components/applyRecord/index.tsx +++ b/src/pages/salesAfter/components/applyRecord/index.tsx @@ -98,7 +98,10 @@ export default memo(({show, onClose, onSubmit, id}:Param) => { {colorItem.code + ' ' + colorItem.name} - ¥{standardPrice(colorItem.sale_price)} + + ¥{standardPrice(colorItem.sale_price)} + 总重{standardPrice(colorItem.estimate_weight)} + ×{formatCount(colorItem)}{formatDetailOrder.unit} diff --git a/src/pages/salesAfter/components/cutlKindList/index.module.scss b/src/pages/salesAfter/components/cutlKindList/index.module.scss new file mode 100644 index 0000000..e713a98 --- /dev/null +++ b/src/pages/salesAfter/components/cutlKindList/index.module.scss @@ -0,0 +1,131 @@ + +.kindsList_main{ + margin-top: 20px; +} +.orders_list_con{ + + background-color: #fff; + border-radius: 20px; + padding: 20px; + .orders_return_title{ + font-size: 28px; + font-weight: 700; + padding-bottom: 20px; + } + .order_list{ + &:nth-child(n+2) { + margin-top: 30px; + } + .order_list_title{ + display: flex; + align-items: center; + .tag{ + font-size: $font_size_min; + background-color: #CDE5FF; + padding: 5px 10px; + border-radius: 6px; + color: $color_main; + } + .title{ + font-weight: 700; + font-size: $font_size; + margin-left: 20px; + flex:1; + } + .num{ + color: $color_font_two; + font-size: $font_size_min; + } + } + } + .order_list_scroll{ + margin-top: 30px; + + .order_list_item { + display: flex; + &:nth-child(2) { + margin-top: 30px; + } + .order_list_item_img{ + width: 126px; + height: 126px; + border-radius: 20px; + } + .order_list_item_con{ + display: flex; + width: 100%; + flex:1; + border-bottom: 1px solid #f0f0f0; + height: 150px; + padding-top: 20px; + box-sizing: border-box; + } + .order_list_item_des{ + flex:1; + box-sizing: border-box; + padding-left: 30px; + .order_list_item_title{ + font-weight: 700; + font-size: $font_size; + margin-bottom: 15px; + } + .order_list_item_price{ + font-size: 26px; + color: $color_font_three; + text{ + &:nth-child(n+1) { + margin-right: 20px; + } + } + } + } + .order_list_item_count{ + display: flex; + flex-direction: column; + justify-content: center; + align-items: flex-end; + .count_num{ + color: $color_main; + font-size: $font_size; + margin-bottom: 15px; + font-weight: 400; + text{ + font-size: $font_size_min; + } + } + .count_price { + font-size: $font_size; + font-weight: 700; + text{ + font-size: $font_size_min; + } + } + } + } + } + .order_total{ + padding-top: 20px; + display: flex; + justify-content: space-between; + text{ + &:nth-child(1) { + font-size: 28px; + font-weight: 700; + } + &:nth-child(2) { + font-size: 24px; + font-weight: 700; + } + } + } + .order_estimated_amount{ + display: flex; + align-items: flex-end; + flex-direction: column; + padding: 30px 0; + .order_price_des{ + font-size: $font_size_medium; + color: $color_font_two; + } + } +} diff --git a/src/pages/salesAfter/components/cutlKindList/index.tsx b/src/pages/salesAfter/components/cutlKindList/index.tsx new file mode 100644 index 0000000..ca0caf5 --- /dev/null +++ b/src/pages/salesAfter/components/cutlKindList/index.tsx @@ -0,0 +1,192 @@ +import { AFTER_ORDER_STATUS, ORDER_STATUS } from "@/common/enum" +import { formatHashTag, formatPriceDiv, formatWeightDiv } from "@/common/fotmat" +import LabAndImg from "@/components/LabAndImg" +import { Text, View } from "@tarojs/components" +import { memo, useCallback, useMemo } from "react" +import EstimatedAmount from "../estimatedAmount" +import styles from './index.module.scss' + +type OrderParam = { + estimate_amount: number, //预估金额 + list: any[], + sale_mode: number, + sale_mode_name: string, + unit: string, + total_colors: number, + total_fabrics: number, + total_number: number, + stage: number, //订单状态 + type: 1|2, //1退货, 2退款 + total_sale_price: number, //销售金额 + total_should_collect_money: number, //应收金额 + total_weight_error_discount: number, //空差优惠 + the_previous_status: number, //取消订单时的订单状态 + actual_amount: number //实付金额 +} + +type Param = { + order: OrderParam, + comfirm?: boolean //是否是确认订单页面使用 +} + +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) + return `${order?.total_fabrics}种面料,${order?.total_colors}种颜色,共${order?.total_number}${order?.unit}` + }, [order]) + + //售后单状态枚举 + const { + ReturnStageApplying, // 申请中 + ReturnStageWaitCheck, // 退货中 + ReturnStageChecked, // 待验布 + ReturnStageReturned, // 已退款 + ReturnStageCancel, // 已取消 + ReturnStageQualityCheckPendingRefund, // 已验布 + ReturnStageServiceOrderPendingRefund, // 待退款 + ReturnStageRejected, // 已拒绝 + } = AFTER_ORDER_STATUS + + + //金额列表枚举 + const priceList = [ + { + id:1, + value:[], + label:'退货条数', + field: '' + }, + { + id:2, + value:[ + ReturnStageServiceOrderPendingRefund.value, + ReturnStageReturned.value + ], + label:'扣款金额', + field: 'total_sale_price' + }, + { + id:3, + value:[ + ReturnStageServiceOrderPendingRefund.value, + ReturnStageReturned.value + ], + label:'其他扣款', + field: 'total_weight_error_discount' + }, + { + id:4, + value:[ + ReturnStageServiceOrderPendingRefund.value, + ReturnStageReturned.value + ], + label:'应退金额', + field: 'total_should_collect_money' + }, + { + id:5, + value:[ReturnStageReturned.value], + label:'退款金额', + field: 'total_should_collect_money' + }, + { + id:6, + value:[ReturnStageReturned.value], + label:'退款去向', + field: 'actual_amount' + }, + { + id:7, + value:[ReturnStageQualityCheckPendingRefund.value], + label:'合计金额', + field: 'actual_amount' + }, + ] + + //是否显示价格 + const showPrice = useCallback((priceInfo) => { + if(priceInfo.value == 8) { + //合计金额 + + } + return priceInfo.value.includes(order?.stage) + }, [order]) + + const priceConDom = useMemo(() => { + if(!order) return + return ( + <> + { + priceList.map(item => { + return <>{showPrice(item)&&} + }) + } + + ) + }, [order]) + + //整理颜色 + const labAndRgbAndUrl = useCallback((item) => { + return {lab:{...item?.lab}, rgb:{...item?.rgb}, texturl_url: item?.texturl_url} + }, []) + + //单价显示判断 + const sale_price_show = useMemo(() => { + return order?.stage != ReturnStageServiceOrderPendingRefund.value && order?.stage != ReturnStageQualityCheckPendingRefund.value + }, [order]) + + return ( + + + {order?.type == 1?'退货信息':'退款信息'} + { + order?.list?.map(item => { + return + + {order.sale_mode_name} + {formatHashTag(item.code, item.name)} + 共{item?.product_colors?.length}种 + + + {item?.product_colors?.map(colorItem => { + return + + + + + + {colorItem.code + ' ' + colorItem.name} + + {sale_price_show&&¥{standardPrice(colorItem.sale_price)}} + 总重{formatWeightDiv(colorItem.estimate_weight)}kg + + + + ×{formatCount(colorItem)}{order.unit} + ¥{formatPriceDiv(colorItem.estimate_amount).toLocaleString()} + + + + })} + + + }) + } + 合计{numText} + + {priceConDom} + + + + ) +}) \ No newline at end of file diff --git a/src/pages/salesAfter/components/kindList/index.module.scss b/src/pages/salesAfter/components/kindList/index.module.scss index de1171e..e713a98 100644 --- a/src/pages/salesAfter/components/kindList/index.module.scss +++ b/src/pages/salesAfter/components/kindList/index.module.scss @@ -72,6 +72,11 @@ .order_list_item_price{ font-size: 26px; color: $color_font_three; + text{ + &:nth-child(n+1) { + margin-right: 20px; + } + } } } .order_list_item_count{ diff --git a/src/pages/salesAfter/components/kindList/index.tsx b/src/pages/salesAfter/components/kindList/index.tsx index a6a0bf4..16d4321 100644 --- a/src/pages/salesAfter/components/kindList/index.tsx +++ b/src/pages/salesAfter/components/kindList/index.tsx @@ -1,5 +1,5 @@ -import { ORDER_STATUS } from "@/common/enum" -import { formatHashTag, formatPriceDiv } from "@/common/fotmat" +import { AFTER_ORDER_STATUS, ORDER_STATUS } from "@/common/enum" +import { formatHashTag, formatPriceDiv, formatWeightDiv } from "@/common/fotmat" import LabAndImg from "@/components/LabAndImg" import { Text, View } from "@tarojs/components" import { memo, useCallback, useMemo } from "react" @@ -45,57 +45,88 @@ export default memo(({order, comfirm = false}:Param) => { return `${order?.total_fabrics}种面料,${order?.total_colors}种颜色,共${order?.total_number}${order?.unit}` }, [order]) - + //售后单状态枚举 + const { + ReturnStageApplying, // 申请中 + ReturnStageWaitCheck, // 退货中 + ReturnStageChecked, // 待验布 + ReturnStageReturned, // 已退款 + ReturnStageCancel, // 已取消 + ReturnStageQualityCheckPendingRefund, // 已验布 + ReturnStageServiceOrderPendingRefund, // 待退款 + ReturnStageRejected, // 已拒绝 + } = AFTER_ORDER_STATUS + //金额列表枚举 const priceList = [ + { id:1, - value:[], - label:'退货条数', - field: 'estimate_amount' - }, - { - id:2, - value:[], + big_value:[ + ReturnStageServiceOrderPendingRefund.value, + ReturnStageReturned.value + ], + cut_value: [ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value], + model_value: [], label:'扣款金额', field: 'total_sale_price' }, { - id:3, - value:[], + id:2, + big_value:[ + ReturnStageServiceOrderPendingRefund.value, + ReturnStageReturned.value + ], + cut_value: [], + model_value: [], label:'其他扣款', field: 'total_weight_error_discount' }, { - id:4, - value:[], + id:3, + big_value:[ + ReturnStageServiceOrderPendingRefund.value, + ReturnStageReturned.value + ], + cut_value: [ReturnStageServiceOrderPendingRefund.value], + model_value: [ + ReturnStageQualityCheckPendingRefund.value, + ReturnStageServiceOrderPendingRefund.value + ], label:'应退金额', field: 'total_should_collect_money' }, { - id:5, - value:[], + id:4, + big_value:[ReturnStageReturned.value], + cut_value: [ReturnStageReturned.value], + model_value: [ReturnStageReturned.value], label:'退款金额', field: 'total_should_collect_money' }, { - id:6, - value:[], + id:5, + big_value:[ReturnStageReturned.value], + cut_value: [ReturnStageReturned.value], + model_value: [ReturnStageReturned.value], label:'退款去向', field: 'actual_amount' }, { - id:7, - value:[], - label:'实付金额', + id:6, + big_value:[ReturnStageQualityCheckPendingRefund.value], + cut_value: [ReturnStageRejected.value, ReturnStageApplying.value, ReturnStageWaitCheck.value, ReturnStageChecked.value, ReturnStageQualityCheckPendingRefund.value, ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value], + model_value: [ReturnStageApplying.value], + label:'合计金额', field: 'actual_amount' - } + }, ] //是否显示价格 - const showPrice = useCallback((priceInfo, status) => { - return priceInfo.value.includes(status) + const showPrice = useCallback((priceInfo) => { + let key = ['big_value', 'model_value', 'cut_value'] + return priceInfo[key[order?.sale_mode]].includes(order?.stage) }, [order]) const priceConDom = useMemo(() => { @@ -104,7 +135,7 @@ export default memo(({order, comfirm = false}:Param) => { <> { priceList.map(item => { - return <>{showPrice(item, order?.stage)&&} + return <>{showPrice(item)&&} }) } @@ -115,6 +146,11 @@ export default memo(({order, comfirm = false}:Param) => { const labAndRgbAndUrl = useCallback((item) => { return {lab:{...item?.lab}, rgb:{...item?.rgb}, texturl_url: item?.texturl_url} }, []) + + //单价显示判断 + const sale_price_show = useMemo(() => { + return order?.stage != ReturnStageServiceOrderPendingRefund.value && order?.stage != ReturnStageQualityCheckPendingRefund.value + }, [order]) return ( @@ -126,7 +162,7 @@ export default memo(({order, comfirm = false}:Param) => { {order.sale_mode_name} {formatHashTag(item.code, item.name)} - 共{item?.product_colors.length}种 + 共{item?.product_colors?.length}种 {item?.product_colors?.map(colorItem => { @@ -137,7 +173,10 @@ export default memo(({order, comfirm = false}:Param) => { {colorItem.code + ' ' + colorItem.name} - ¥{standardPrice(colorItem.sale_price)} + + {sale_price_show&&¥{standardPrice(colorItem.sale_price)}} + 总重{formatWeightDiv(colorItem.estimate_weight)}kg + ×{formatCount(colorItem)}{order.unit} diff --git a/src/pages/salesAfter/components/modelKindList/index.module.scss b/src/pages/salesAfter/components/modelKindList/index.module.scss new file mode 100644 index 0000000..e713a98 --- /dev/null +++ b/src/pages/salesAfter/components/modelKindList/index.module.scss @@ -0,0 +1,131 @@ + +.kindsList_main{ + margin-top: 20px; +} +.orders_list_con{ + + background-color: #fff; + border-radius: 20px; + padding: 20px; + .orders_return_title{ + font-size: 28px; + font-weight: 700; + padding-bottom: 20px; + } + .order_list{ + &:nth-child(n+2) { + margin-top: 30px; + } + .order_list_title{ + display: flex; + align-items: center; + .tag{ + font-size: $font_size_min; + background-color: #CDE5FF; + padding: 5px 10px; + border-radius: 6px; + color: $color_main; + } + .title{ + font-weight: 700; + font-size: $font_size; + margin-left: 20px; + flex:1; + } + .num{ + color: $color_font_two; + font-size: $font_size_min; + } + } + } + .order_list_scroll{ + margin-top: 30px; + + .order_list_item { + display: flex; + &:nth-child(2) { + margin-top: 30px; + } + .order_list_item_img{ + width: 126px; + height: 126px; + border-radius: 20px; + } + .order_list_item_con{ + display: flex; + width: 100%; + flex:1; + border-bottom: 1px solid #f0f0f0; + height: 150px; + padding-top: 20px; + box-sizing: border-box; + } + .order_list_item_des{ + flex:1; + box-sizing: border-box; + padding-left: 30px; + .order_list_item_title{ + font-weight: 700; + font-size: $font_size; + margin-bottom: 15px; + } + .order_list_item_price{ + font-size: 26px; + color: $color_font_three; + text{ + &:nth-child(n+1) { + margin-right: 20px; + } + } + } + } + .order_list_item_count{ + display: flex; + flex-direction: column; + justify-content: center; + align-items: flex-end; + .count_num{ + color: $color_main; + font-size: $font_size; + margin-bottom: 15px; + font-weight: 400; + text{ + font-size: $font_size_min; + } + } + .count_price { + font-size: $font_size; + font-weight: 700; + text{ + font-size: $font_size_min; + } + } + } + } + } + .order_total{ + padding-top: 20px; + display: flex; + justify-content: space-between; + text{ + &:nth-child(1) { + font-size: 28px; + font-weight: 700; + } + &:nth-child(2) { + font-size: 24px; + font-weight: 700; + } + } + } + .order_estimated_amount{ + display: flex; + align-items: flex-end; + flex-direction: column; + padding: 30px 0; + .order_price_des{ + font-size: $font_size_medium; + color: $color_font_two; + } + } +} diff --git a/src/pages/salesAfter/components/modelKindList/index.tsx b/src/pages/salesAfter/components/modelKindList/index.tsx new file mode 100644 index 0000000..d33bf66 --- /dev/null +++ b/src/pages/salesAfter/components/modelKindList/index.tsx @@ -0,0 +1,168 @@ +import { AFTER_ORDER_STATUS, ORDER_STATUS } from "@/common/enum" +import { formatHashTag, formatPriceDiv, formatWeightDiv } from "@/common/fotmat" +import LabAndImg from "@/components/LabAndImg" +import { Text, View } from "@tarojs/components" +import { memo, useCallback, useMemo } from "react" +import EstimatedAmount from "../estimatedAmount" +import styles from './index.module.scss' + +type OrderParam = { + estimate_amount: number, //预估金额 + list: any[], + sale_mode: number, + sale_mode_name: string, + unit: string, + total_colors: number, + total_fabrics: number, + total_number: number, + stage: number, //订单状态 + type: 1|2, //1退货, 2退款 + total_sale_price: number, //销售金额 + total_should_collect_money: number, //应收金额 + total_weight_error_discount: number, //空差优惠 + the_previous_status: number, //取消订单时的订单状态 + actual_amount: number //实付金额 +} + +type Param = { + order: OrderParam, + comfirm?: boolean //是否是确认订单页面使用 +} + +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) + return `${order?.total_fabrics}种面料,${order?.total_colors}种颜色,共${order?.total_number}${order?.unit}` + }, [order]) + + //售后单状态枚举 + const { + ReturnStageApplying, // 申请中 + ReturnStageWaitCheck, // 退货中 + ReturnStageChecked, // 待验布 + ReturnStageReturned, // 已退款 + ReturnStageCancel, // 已取消 + ReturnStageQualityCheckPendingRefund, // 已验布 + ReturnStageServiceOrderPendingRefund, // 待退款 + ReturnStageRejected, // 已拒绝 + } = AFTER_ORDER_STATUS + + + //金额列表枚举 + const priceList = [ + { + id:1, + value:[ + ReturnStageServiceOrderPendingRefund.value, + ReturnStageReturned.value + ], + label:'应退金额', + field: 'total_should_collect_money' + }, + { + id:2, + value:[ReturnStageReturned.value], + label:'退款金额', + field: 'total_should_collect_money' + }, + { + id:3, + value:[ReturnStageReturned.value], + label:'退款去向', + field: 'actual_amount' + }, + { + id:4, + value:[ReturnStageQualityCheckPendingRefund.value], + label:'合计金额', + field: 'actual_amount' + }, + ] + + //是否显示价格 + const showPrice = useCallback((priceInfo) => { + if(priceInfo.value == 8) { + //合计金额 + + } + return priceInfo.value.includes(order?.stage) + }, [order]) + + const priceConDom = useMemo(() => { + if(!order) return + return ( + <> + { + priceList.map(item => { + return <>{showPrice(item)&&} + }) + } + + ) + }, [order]) + + //整理颜色 + const labAndRgbAndUrl = useCallback((item) => { + return {lab:{...item?.lab}, rgb:{...item?.rgb}, texturl_url: item?.texturl_url} + }, []) + + //单价显示判断 + const sale_price_show = useMemo(() => { + return order?.stage != ReturnStageServiceOrderPendingRefund.value && order?.stage != ReturnStageQualityCheckPendingRefund.value + }, [order]) + + return ( + + + {order?.type == 1?'退货信息':'退款信息'} + { + order?.list?.map(item => { + return + + {order.sale_mode_name} + {formatHashTag(item.code, item.name)} + 共{item?.product_colors?.length}种 + + + {item?.product_colors?.map(colorItem => { + return + + + + + + {colorItem.code + ' ' + colorItem.name} + + {sale_price_show&&¥{standardPrice(colorItem.sale_price)}} + 总重{formatWeightDiv(colorItem.estimate_weight)}kg + + + + ×{formatCount(colorItem)}{order.unit} + ¥{formatPriceDiv(colorItem.estimate_amount).toLocaleString()} + + + + })} + + + }) + } + 合计{numText} + + {priceConDom} + + + + ) +}) \ No newline at end of file diff --git a/src/pages/salesAfter/index.tsx b/src/pages/salesAfter/index.tsx index 3a31486..0a41aca 100644 --- a/src/pages/salesAfter/index.tsx +++ b/src/pages/salesAfter/index.tsx @@ -52,7 +52,7 @@ import styles from './index.module.scss' total_number: orderDetail.total_number, //总数量 total_fabrics: orderDetail.total_fabrics, //面料数量 unit: orderDetail.sale_mode == 0?'条':'m', //单位 - list: orderDetail.product_list, + list: orderDetail.quality_check_pass_product, stage: orderDetail.stage, //订单状态 type: orderDetail.type, //退货or退款 total_sale_price: orderDetail.total_sale_price, //销售金额 @@ -69,7 +69,10 @@ import styles from './index.module.scss' //获取底部按钮点击, 获取按钮状态 const orderStateClick = useCallback((val) => { - + if(val == 8) { + //申请记录 + setApplyRecord(true) + } }, [orderDetail]) //页面下拉刷新 @@ -85,7 +88,7 @@ import styles from './index.module.scss' orderId: orderDetail?.id, settle_mode: orderDetail?.settle_mode, type: orderDetail?.type, //退货or退款 - sale_mode: orderDetail?.sale_model, //订单类型 + sale_mode: orderDetail?.sale_mode, //订单类型 return_apply_order_id: orderDetail?.return_apply_order_id } }, [orderDetail]) @@ -119,13 +122,14 @@ import styles from './index.module.scss' getSaleOrderPreView() }, []) - //显示生气记录 + //显示记录 const [applyRecord, setApplyRecord] = useState(false) + return ( - + diff --git a/src/pages/salesAfterList/components/order/index.tsx b/src/pages/salesAfterList/components/order/index.tsx index 749d956..8170c64 100644 --- a/src/pages/salesAfterList/components/order/index.tsx +++ b/src/pages/salesAfterList/components/order/index.tsx @@ -77,16 +77,16 @@ export default memo(({value, onClickBtn}: Param) => { goLink('/pages/salesAfter/index', {id: value?.id})}> {value?.sale_mode_name} - {formatHashTag(value?.product_list[0].code, value?.product_list[0].name)} + {formatHashTag(value?.product_list?.[0].code, value?.product_list?.[0].name)} {value?.stage_name} - {value?.product_list[0].product_colors[0].code} + {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)}