diff --git a/src/common/enum.ts b/src/common/enum.ts index cdcdf7a..51d35a0 100644 --- a/src/common/enum.ts +++ b/src/common/enum.ts @@ -22,7 +22,7 @@ export const AFTER_ORDER_STATUS = { ReturnStageChecked : {value:2, label:'待验布'}, // 待验布 ReturnStageReturned : {value:3, label:'已退款'}, // 已退款 ReturnStageCancel : {value:4, label:'已取消'}, // 已取消 - ReturnStageQualityCheckPendingRefund : {value:5, label:'待退款'}, // 待退款-质检 + ReturnStageQualityCheckPendingRefund : {value:5, label:'待退款'}, // 已验布 ReturnStageServiceOrderPendingRefund : {value:6, label:'待退款'}, // 待退款 ReturnStageRejected : {value:7, label:'已拒绝'}, // 已拒绝 } diff --git a/src/components/afterOrderBtns/index.tsx b/src/components/afterOrderBtns/index.tsx index 2a4a560..d3cc84f 100644 --- a/src/components/afterOrderBtns/index.tsx +++ b/src/components/afterOrderBtns/index.tsx @@ -58,21 +58,21 @@ export default memo(({orderInfo, onClick, onBtnNull}:Param) => { value: [ReturnStageQualityCheckPendingRefund.value, ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value], label: '质检结果' }, - { - id: 5, - value: [ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value], - label: '退货码单' - }, + // { + // id: 5, + // value: [ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value], + // label: '退货码单' + // }, { id: 6, value: [ReturnStageApplying.value, ReturnStageServiceOrderPendingRefund.value], label: '取消退款' }, - { - id: 7, - value: [ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value], - label: '退款码单' - }, + // { + // id: 7, + // value: [ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value], + // label: '退款码单' + // }, { id: 8, value: [], @@ -90,15 +90,12 @@ export default memo(({orderInfo, onClick, onBtnNull}:Param) => { } else if (item.id == 6) { //取消退款 return (orderInfo.type == 2)&&item.value.includes(orderInfo.stage) + } else if (item.id == 4) { + //质检结果 + return (orderInfo?.type == 1)&&item.value.includes(orderInfo.stage) //退货才有 } else { - if(item.value.includes(orderInfo.stage)) { - return true - } else { - onBtnNull?.() - } + return item.value.includes(orderInfo.stage) } - - } //显示的按钮数组 diff --git a/src/components/orderBtns/index.tsx b/src/components/orderBtns/index.tsx index 756083f..22b67ae 100644 --- a/src/components/orderBtns/index.tsx +++ b/src/components/orderBtns/index.tsx @@ -15,7 +15,9 @@ type Param = { orderId: number, //订单id actual_amount: number, //实付金额 wait_pay_amount: number, //待付金额 - sale_mode: number //订单类型 + sale_mode: number, //订单类型 + av_return_roll?: number, //可退数量 + }|null, onClick?: (val: number) => void //点击后触发的事件,返回订单状态 } @@ -104,7 +106,7 @@ export default memo(({orderInfo, onClick}:Param) => { return( orderInfo.wait_pay_amount != 0 && item.value.includes(orderInfo.status)) //只要没有付完款就显示 } else if(item.id == 3 ) { //申请退款, 只有大货才有 - return (orderInfo.sale_mode == SaLeModeBulk.value && orderInfo.actual_amount != 0 && item.value.includes(orderInfo.status)) //大货在待发货付过款 + return (orderInfo.sale_mode == SaLeModeBulk.value && orderInfo.actual_amount != 0 && item.value.includes(orderInfo.status)) //大货在待发货付过款 } else if( item.id == 8) { //退款按钮(直接退款不用申请), 只有散剪和剪板有 return (orderInfo.sale_mode != SaLeModeBulk.value && orderInfo.actual_amount != 0 && item.value.includes(orderInfo.status)) //散剪和剪板在待接单时付过款 @@ -133,7 +135,8 @@ export default memo(({orderInfo, onClick}:Param) => { } else if (val == 6) { receiveOrder() } else if(val == 5) { - goLink('/pages/applyAfterSales/index',{id:orderInfo?.orderId}) + if(!orderInfo?.av_return_roll) return alert.none('该订单没有可退条数') + goLink('/pages/applyAfterSales/index',{id:orderInfo?.orderId}) } else if(val == 8) { applyRefund() } else { @@ -187,6 +190,7 @@ export default memo(({orderInfo, onClick}:Param) => { //退款 const {fetchData: fetchDataApplyRefund} = ApplyRefundApi() const applyRefund = async () => { + if(!orderInfo?.av_return_roll) return alert.none('该订单没有可退条数') Taro.showModal({ title: '确定退款?', success: async function async (res) { diff --git a/src/pages/order/components/applyRefund/index.tsx b/src/pages/order/components/applyRefund/index.tsx index 456075b..3f6311e 100644 --- a/src/pages/order/components/applyRefund/index.tsx +++ b/src/pages/order/components/applyRefund/index.tsx @@ -58,8 +58,17 @@ export default memo(({show, onClose, orderId}:Param) => { //提交 - const onSubmit = () => { - getApplyRefund() + const onSubmit = (val) => { + if(val == 2) { + getApplyRefund() + } else { + onClose?.() + submitData.current = { + return_explain: 0, + sale_order_id: 0, + reason_describe: '' + } + } } diff --git a/src/pages/order/components/kindList/index.module.scss b/src/pages/order/components/kindList/index.module.scss index 2c4b957..64b65b8 100644 --- a/src/pages/order/components/kindList/index.module.scss +++ b/src/pages/order/components/kindList/index.module.scss @@ -65,6 +65,17 @@ font-weight: 700; font-size: $font_size; margin-bottom: 15px; + text{ + height: 30px; + background: #f0f0f0; + border-radius: 6px; + color: #ABABAB; + font-size: 24px; + padding: 0 10px; + margin-left: 20px; + font-weight: normal; + line-height: 30px; + } } .order_list_item_price, .order_list_item_price_dg{ font-size: 26px; diff --git a/src/pages/order/components/kindList/index.tsx b/src/pages/order/components/kindList/index.tsx index 185a3b9..ce8e4b6 100644 --- a/src/pages/order/components/kindList/index.tsx +++ b/src/pages/order/components/kindList/index.tsx @@ -165,7 +165,10 @@ export default memo(({order, comfirm = false}:Param) => { - {colorItem.code + ' ' + colorItem.name} + + {colorItem.code + ' ' + colorItem.name} + {colorItem?.return_roll&&{`已退${colorItem?.return_roll}条`}} + ¥{standardPrice(colorItem.sale_price)} {aboutWeight(colorItem.estimate_weight)} diff --git a/src/pages/order/index.tsx b/src/pages/order/index.tsx index 5868c32..7c678e1 100644 --- a/src/pages/order/index.tsx +++ b/src/pages/order/index.tsx @@ -150,6 +150,8 @@ import styles from './index.module.scss' //待付款 toPay() } else if(val == 3) { + //申请退款 + if(!orderDetail?.av_return_roll) return alert.none('该订单已申请过退款') setRefundShow(true) } else if(val == 7) { //再购 @@ -183,6 +185,7 @@ import styles from './index.module.scss' actual_amount: orderDetail?.actual_amount, //实付金额 wait_pay_amount: orderDetail?.wait_pay_amount, //待付金额 sale_mode: orderDetail?.sale_mode, //订单类型 + av_return_roll: orderDetail?.av_return_roll //可退条数 } }, [orderDetail]) diff --git a/src/pages/orderList/components/applyRefund/index.module.scss b/src/pages/orderList/components/applyRefund/index.module.scss new file mode 100644 index 0000000..ec17129 --- /dev/null +++ b/src/pages/orderList/components/applyRefund/index.module.scss @@ -0,0 +1,66 @@ + +.apply_after_sales_con{ + padding: 20px; + .returnSaleInput_item{ + display: flex; + align-items: center; + padding-bottom: 50px; + flex-wrap: wrap; + .title{ + font-size: $font_size; + font-weight: 700; + width: 119px; + } + .select{ + flex:1; + height: 60px; + border: 2px solid #e6e6e6; + border-radius: 10px; + margin-left: 20px; + display: flex; + align-items: center; + justify-content: space-between; + padding: 0 20px; + font-size: 26px; + color: $color_font_two; + .miconfont{ + font-size: 30px; + } + } + .upload_image{ + flex:1; + } + } + .btns_con{ + width: 100%; + bottom:0; + box-sizing: border-box; + margin-top: 50px; + .btns_two{ + display: flex; + height: 82px; + // border: 1PX solid #007aff; + font-size: $font_size_big; + border-radius: 40px; + margin-bottom: 20px; + .rest_btn{ + flex:1; + border: 1PX solid #007aff; + border-radius: 40px 0 0 40px; + text-align: center; + line-height: 82px; + color: $color_main; + background-color: #fff; + + } + .verify_btn{ + flex:1; + border-radius: 0 40px 40px 0; + background: #007aff; + text-align: center; + line-height: 82px; + color: #fff; + } + } + } +} \ No newline at end of file diff --git a/src/pages/orderList/components/applyRefund/index.tsx b/src/pages/orderList/components/applyRefund/index.tsx new file mode 100644 index 0000000..8b81cd4 --- /dev/null +++ b/src/pages/orderList/components/applyRefund/index.tsx @@ -0,0 +1,99 @@ +import Popup from "@/components/popup"; +import TextareaEnhance from "@/components/textareaEnhance"; +import { ScrollView, Text, View } from "@tarojs/components"; +import { memo, useCallback, useEffect, useRef, useState } from "react"; +import styles from './index.module.scss' +import classnames from "classnames"; +import { ApplyRefundApi } from "@/api/salesAfterOrder"; +import { alert } from "@/common/common"; +import ReasonPopup from "@/pages/order/components/reasonPopup"; + +type Param = { + show?: true|false, + onClose?: () => void, + orderId?: number +} +export default memo(({show, onClose, orderId}:Param) => { + + //提交的数据 + const submitData = useRef({ + return_explain: 1, + sale_order_id: 0, + reason_describe: '' + }) + + useEffect(() => { + if(orderId) + submitData.current.sale_order_id = orderId + }, [orderId]) + + //申请退款 + const {fetchData} = ApplyRefundApi() + const getApplyRefund = async () => { + let res = await fetchData(submitData.current) + if(!submitData.current.return_explain) return alert.error('请选择说明原因') + if(res.success) { + alert.error('申请成功') + } else { + alert.error('申请失败') + } + onClose?.() + } + + //获取说明数据 + const [list, setList] = useState([]) + + + //备注 + const getOtherReason = useCallback((val) => { + submitData.current.reason_describe = val + }, []) + + + //显示说明 + const [showReason, setShowReason] = useState(false) + const closeReason = useCallback(() => { + setShowReason(false) + }, []) + + + //提交 + const onSubmit = (val) => { + if(val == 2) { + getApplyRefund() + } else { + onClose?.() + submitData.current = { + return_explain: 0, + sale_order_id: 0, + reason_describe: '' + } + } + } + + + + return ( + <> + + + + 退款说明 + setShowReason(true)}> + 请选择 + + + + + + + onSubmit(1)}>取消 + onSubmit(2)}>确认 + + + + + + + ) +}) \ No newline at end of file diff --git a/src/pages/orderList/components/order/index.module.scss b/src/pages/orderList/components/order/index.module.scss index de34b8b..d63a621 100644 --- a/src/pages/orderList/components/order/index.module.scss +++ b/src/pages/orderList/components/order/index.module.scss @@ -60,7 +60,8 @@ flex:1; font-size: $font_size; font-weight: 700; - padding-left: 20px; + padding: 0 20px; + @include common_ellipsis() } .product_status{ font-size: $font_size; diff --git a/src/pages/orderList/index.tsx b/src/pages/orderList/index.tsx index 0c9ad18..fa55e30 100644 --- a/src/pages/orderList/index.tsx +++ b/src/pages/orderList/index.tsx @@ -14,6 +14,8 @@ import Payment from "../order/components/payment" import { ORDER_STATUS } from "@/common/enum" import { AddShoppingCartApi } from "@/api/shopCart" import ShopCart from "@/components/shopCart" +import ApplyRefund from "./components/applyRefund" +import { alert } from "@/common/common" export default () => { const {checkLogin} = useLogin() @@ -98,12 +100,16 @@ export default () => { //监听点击的按钮 const clickOrderBtn = useCallback(({status, orderInfo}) => { + setCallBackPayOrderInfo(() => orderInfo) if(status == 1 || status == 6) { getOrderList() } else if(status == 2) { //去支付 - setPayOrderInfo(() => orderInfo) toPay() + } else if (status == 3) { + //申请退款 + if(!orderInfo?.av_return_roll) return alert.none('该订单已申请过退款') + setRefundShow(true) } else if (status == 7) { //购买 addShopCart(orderInfo) @@ -111,8 +117,9 @@ export default () => { }, [orderData]) + const [callBackOrderInfo, setCallBackPayOrderInfo] = useState() + //去付款 - const [payOrderInfo, setPayOrderInfo] = useState() const [payMentShow, setPayMentShow] = useState(false) const toPay = () => { setPayMentShow(true) @@ -159,6 +166,12 @@ export default () => { } + //申请退款 + const [refundShow, setRefundShow] = useState(false) + const applyRefundClose = useCallback(() => { + setRefundShow(false) + }, []) + return ( @@ -173,8 +186,9 @@ export default () => { })} + setShowCart(false)}/> - + ) } diff --git a/src/pages/salesAfter/index.tsx b/src/pages/salesAfter/index.tsx index 1c318e1..63b5e20 100644 --- a/src/pages/salesAfter/index.tsx +++ b/src/pages/salesAfter/index.tsx @@ -178,7 +178,7 @@ import styles from './index.module.scss' {orderInfo?.return_explain_name} - {orderInfo?.return_remark} + {orderInfo?.reason_describe} {orderInfo?.goods_status_name} diff --git a/src/pages/salesAfterList/components/order/index.module.scss b/src/pages/salesAfterList/components/order/index.module.scss index 2582b83..0579abd 100644 --- a/src/pages/salesAfterList/components/order/index.module.scss +++ b/src/pages/salesAfterList/components/order/index.module.scss @@ -59,7 +59,8 @@ flex:1; font-size: $font_size; font-weight: 700; - padding-left: 20px; + padding: 0 20px; + @include common_ellipsis() } .product_status{ font-size: $font_size; diff --git a/src/pages/salesAfterList/components/orderStatusTag/index.tsx b/src/pages/salesAfterList/components/orderStatusTag/index.tsx index 1a794dc..c72373e 100644 --- a/src/pages/salesAfterList/components/orderStatusTag/index.tsx +++ b/src/pages/salesAfterList/components/orderStatusTag/index.tsx @@ -5,7 +5,7 @@ import styles from './index.module.scss' type Param = { - status?: 0|1|2 //0默认不处理, 1退货,2退款 + status?: number //0默认不处理, 1退货,2退款 } export default memo(({status = 0}:Param) => { return (