From 5ebd403866667423ade28c22d55d154383266cd2 Mon Sep 17 00:00:00 2001 From: czm <2192718639@qq.com> Date: Tue, 28 Jun 2022 11:35:45 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=9B=BE=E7=89=87=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E5=A4=84=E7=90=86=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/salesAfterOrder.ts | 2 +- src/common/fotmat.js | 2 +- src/components/afterOrderBtns/index.tsx | 39 +++++-------------- src/pages/details/components/swiper/index.tsx | 2 +- .../advanceOrderState/index.module.scss | 0 .../components/advanceOrderState/index.tsx | 16 ++++++++ src/pages/salesAfter/index.tsx | 1 + src/pages/user/index.tsx | 2 +- 8 files changed, 30 insertions(+), 34 deletions(-) create mode 100644 src/pages/order/components/advanceOrderState/index.module.scss create mode 100644 src/pages/order/components/advanceOrderState/index.tsx diff --git a/src/api/salesAfterOrder.ts b/src/api/salesAfterOrder.ts index 9104042..40dc158 100644 --- a/src/api/salesAfterOrder.ts +++ b/src/api/salesAfterOrder.ts @@ -21,7 +21,7 @@ export const GetSaleOrderListApi = () => { } /** - * 取消退货 + * 取消退货/退款 */ export const ReturnApplyOrderCancelApi = () => { return useRequest({ diff --git a/src/common/fotmat.js b/src/common/fotmat.js index 09b2d01..6fac0e2 100644 --- a/src/common/fotmat.js +++ b/src/common/fotmat.js @@ -142,7 +142,7 @@ export const toDecimal2 = (x) => { * @returns */ export const formatImgUrl = (url, suffix="!w200") => { - return url?IMG_CND_Prefix + url + suffix:IMG_CND_Prefix +'/mall/no_img.png' + return url?url + suffix:IMG_CND_Prefix +'/mall/no_img.png' } /** diff --git a/src/components/afterOrderBtns/index.tsx b/src/components/afterOrderBtns/index.tsx index d3cc84f..3fdacbe 100644 --- a/src/components/afterOrderBtns/index.tsx +++ b/src/components/afterOrderBtns/index.tsx @@ -12,8 +12,9 @@ type Param = { orderInfo: { stage: number, //售后状态 orderId: number, //订单id - sale_mode: number //订单类型 - type: number //1退货,2退款 + sale_mode: number, //订单类型 + type: number, //1退货,2退款 + return_apply_order_id: number //售后申请单 }, onClick?: (val: number) => void, //点击后触发的事件,返回订单状态 onBtnNull?: () => void //所有按钮都为空 @@ -110,22 +111,22 @@ export default memo(({orderInfo, onClick, onBtnNull}:Param) => { //点击按钮操作 const submitBtns = (val, index) => { if (val == 1) { - cancelOrder() + cancelOrder({title:'要取消退货吗?'}) } else if (val == 6) { - receiveOrder() + cancelOrder({title:'要取消退款吗?'}) } else { onClick?.(val) } } - //取消退货 + //取消退货/退款 const {fetchData: returnApplyOrderCancelFetchData} = ReturnApplyOrderCancelApi() - const cancelOrder = () => { + const cancelOrder = ({title = ''}) => { Taro.showModal({ - title: '要取消退货吗?', + title, success: async function (res) { if (res.confirm) { - let res = await returnApplyOrderCancelFetchData({id: orderInfo?.orderId}) + let res = await returnApplyOrderCancelFetchData({id: orderInfo?.return_apply_order_id}) if(res.success) { alert.success('取消成功') onClick?.(1) @@ -136,28 +137,6 @@ export default memo(({orderInfo, onClick, onBtnNull}:Param) => { console.log('用户点击取消') } } - }) - } - - //确认订单 - const {fetchData: receiveOrderFetchData} = ReceiveOrderApi() - const receiveOrder = async () => { - console.log('123456') - Taro.showModal({ - title: '确定收货?', - success: async function (res) { - if (res.confirm) { - let res = await receiveOrderFetchData({sale_order_id: orderInfo?.orderId}) - if(res.success){ - onClick?.(6) - alert.success('收货成功') - } else { - alert.error('收货失败') - } - } else if (res.cancel) { - console.log('用户点击取消') - } - } }) } diff --git a/src/pages/details/components/swiper/index.tsx b/src/pages/details/components/swiper/index.tsx index a0cb48e..501566b 100644 --- a/src/pages/details/components/swiper/index.tsx +++ b/src/pages/details/components/swiper/index.tsx @@ -23,7 +23,7 @@ export default ({list = []}: params) => { return ( swiperChange(e)}> - {list.map((item) => { + {list?.map((item) => { return diff --git a/src/pages/order/components/advanceOrderState/index.module.scss b/src/pages/order/components/advanceOrderState/index.module.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/pages/order/components/advanceOrderState/index.tsx b/src/pages/order/components/advanceOrderState/index.tsx new file mode 100644 index 0000000..a60698b --- /dev/null +++ b/src/pages/order/components/advanceOrderState/index.tsx @@ -0,0 +1,16 @@ +import { Text, View } from "@tarojs/components"; +import { memo } from "react"; +import styles from './index.module.scss' + +export default memo(() => { + return ( + + + + + + 支付关闭,订单自动取消 + + + ) +}) \ No newline at end of file diff --git a/src/pages/salesAfter/index.tsx b/src/pages/salesAfter/index.tsx index 63b5e20..d84ae04 100644 --- a/src/pages/salesAfter/index.tsx +++ b/src/pages/salesAfter/index.tsx @@ -92,6 +92,7 @@ import styles from './index.module.scss' settle_mode: orderDetail?.settle_mode, type: orderDetail?.type, //退货or退款 sale_mode: orderDetail?.sale_model, //订单类型 + return_apply_order_id: orderDetail?.return_apply_order_id } }, [orderDetail]) diff --git a/src/pages/user/index.tsx b/src/pages/user/index.tsx index 29dbef6..bf9e1bf 100644 --- a/src/pages/user/index.tsx +++ b/src/pages/user/index.tsx @@ -72,7 +72,7 @@ const Header = memo((props: any) => { const { data } = props; let menu = [{ text: "待配布", icon: "icon-daipeibu", url: "/pages/orderList/index" }, { text: "待付款", icon: "icon-daifukuan", url: "/pages/orderList/index" }, { text: "待发货", icon: "icon-daifahuo", url: "/pages/orderList/index" }, { text: "已发货", icon: "icon-yifahuo", url: "/pages/orderList/index" }, - { text: "退款/售后", icon: "icon-a-tuikuanshouhou", url: "/pages/orderList/index" }]; + { text: "退款/售后", icon: "icon-a-tuikuanshouhou", url: "/pages/salesAfterList/index" }]; const { getPhoneNumber } = useLogin(); const mGetPhoneNumber = (ev) => { if (ev.detail?.code) {