diff --git a/src/api/salesAfterOrder.ts b/src/api/salesAfterOrder.ts index 1755ce0..9104042 100644 --- a/src/api/salesAfterOrder.ts +++ b/src/api/salesAfterOrder.ts @@ -60,3 +60,33 @@ export const GetSaleOrderListApi = () => { method: "get", }) } + +/** + * 售后退货原因 + */ + export const ReturnReasonApi = () => { + return useRequest({ + url: `/v1/mall/enum/returnOrder/returnReason`, + method: "get", + }) +} + +/** + * 售后退货原因 + */ + export const ReturnExplainApi = () => { + return useRequest({ + url: `/v1/mall/enum/returnExplain`, + method: "get", + }) +} + +/** + * 申请退款 + */ + export const ApplyRefundApi = () => { + return useRequest({ + url: `/v1/mall/returnApplyOrder`, + method: "post", + }) +} diff --git a/src/common/constant.js b/src/common/constant.js index 6b30deb..04bb338 100644 --- a/src/common/constant.js +++ b/src/common/constant.js @@ -5,12 +5,13 @@ export const BASE_URL = CURRENT_ENV.includes('development') ? `https://test.zzfz // export const BASE_URL = `http://192.168.0.89:40001/lymarket` // export const BASE_URL = `http://192.168.1.165:40001/lymarket` // 王霞 // export const BASE_URL = `https://test.zzfzyc.com/lymarket` // 测试环境 -// export const BASE_URL = `http://192.168.1.9:40001/lymarket` // 发 +// export const BASE_URL = `http://192.168.1.30:40001/lymarket` // 发 // export const BASE_URL = `http://192.168.1.30:50001/lymarket` // 发 // 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.4:40001/lymarket` // 王霞 // export const BASE_URL = `http://192.168.1.7:50001/lymarket` // 添 +// export const BASE_URL = `http://192.168.1.5:40001/lymarket` // 王霞 // export const BASE_URL = `http://192.168.1.15:50001/lymarket` // 杰 // CDN 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 6750838..d3cc84f 100644 --- a/src/components/afterOrderBtns/index.tsx +++ b/src/components/afterOrderBtns/index.tsx @@ -15,28 +15,26 @@ type Param = { sale_mode: number //订单类型 type: number //1退货,2退款 }, - onClick?: (val: number) => void //点击后触发的事件,返回订单状态 + onClick?: (val: number) => void, //点击后触发的事件,返回订单状态 + onBtnNull?: () => void //所有按钮都为空 } -export default memo(({orderInfo, onClick}:Param) => { +export default memo(({orderInfo, onClick, onBtnNull}:Param) => { //售后订单状态 const { ReturnStageApplying, ReturnStageWaitCheck, - ReturnStageChecked, ReturnStageReturned, - ReturnStageCancel, ReturnStageQualityCheckPendingRefund, ReturnStageServiceOrderPendingRefund, - ReturnStageRejected } = AFTER_ORDER_STATUS //订单类型 - const { - SaLeModeBulk, - SaleModeLengthCut, - SaLeModeWeightCut, - } = SALE_MODE + // const { + // SaLeModeBulk, + // SaleModeLengthCut, + // SaLeModeWeightCut, + // } = SALE_MODE //售后按钮按售后状态归类, value是该订单状态,可能该按钮会出现 const orderBtnsList = useRef([ @@ -50,31 +48,31 @@ export default memo(({orderInfo, onClick}:Param) => { value: [ReturnStageWaitCheck.value], label: '退货物流' }, - { - id: 3, - value: [ReturnStageChecked.value, ReturnStageQualityCheckPendingRefund.value], - label: '查看物流' - }, + // { + // id: 3, + // value: [ReturnStageChecked.value, ReturnStageQualityCheckPendingRefund.value], + // label: '查看物流' + // }, { id: 4, 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: [], @@ -86,17 +84,18 @@ export default memo(({orderInfo, onClick}:Param) => { //判断是否显示该按钮 const orderBtnsShow = (item) => { if(!orderInfo) return false - if(item.id == 1) { //取消退货 return (orderInfo.type == 1)&&item.value.includes(orderInfo.stage) } 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 { return item.value.includes(orderInfo.stage) } - } //显示的按钮数组 diff --git a/src/components/orderBtns/index.tsx b/src/components/orderBtns/index.tsx index 871f2a2..22b67ae 100644 --- a/src/components/orderBtns/index.tsx +++ b/src/components/orderBtns/index.tsx @@ -7,6 +7,7 @@ import {useRef, memo, useState, useMemo } from "react" import classnames from "classnames"; import styles from './index.module.scss' import { AddShoppingCartApi } from "@/api/shopCart" +import { ApplyRefundApi } from "@/api/salesAfterOrder" type Param = { orderInfo: { @@ -14,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 //点击后触发的事件,返回订单状态 } @@ -103,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)) //散剪和剪板在待接单时付过款 @@ -132,7 +135,10 @@ 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 { onClick?.(val) } @@ -181,6 +187,29 @@ 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) { + if(res.confirm) { + let res = await fetchDataApplyRefund({sale_order_id: orderInfo?.orderId}) + if(res.success) { + alert.success('申请成功') + } else { + alert.error('申请失败') + } + onClick?.(8) + } else if (res.cancel) { + console.log('用户点击取消') + } + } + }) + + } + //显示更多按钮 const [showMore, setShowMore] = useState(false) diff --git a/src/constants/userInfo.ts b/src/constants/userInfo.ts index 88982c6..14f529a 100644 --- a/src/constants/userInfo.ts +++ b/src/constants/userInfo.ts @@ -7,4 +7,5 @@ export const CLEAR_TOKEN = 'clearToken' export const CLEAR_SESSIONKEY = 'clearSessionkey' export const CLEAR_USERINFO = 'clearUserInfo' export const CLEAR_ADMINUSERINFO = 'clearAdminUserInfo' -export const CLEAR_SORTCODE = 'clearSortCode' \ No newline at end of file +export const CLEAR_SORTCODE = 'clearSortCode' +export const LOGIN_STATUS = 'loginStatus' \ No newline at end of file diff --git a/src/pages/applyAfterSales/components/reasonPopup/index.module.scss b/src/pages/applyAfterSales/components/reasonPopup/index.module.scss index eba26cd..2d0f899 100644 --- a/src/pages/applyAfterSales/components/reasonPopup/index.module.scss +++ b/src/pages/applyAfterSales/components/reasonPopup/index.module.scss @@ -22,6 +22,9 @@ .reason_item{ margin-bottom: 36px; } + .select_item { + color: #007AFF; + } } } } \ No newline at end of file diff --git a/src/pages/applyAfterSales/components/reasonPopup/index.tsx b/src/pages/applyAfterSales/components/reasonPopup/index.tsx index 6b1f1ef..0ed990c 100644 --- a/src/pages/applyAfterSales/components/reasonPopup/index.tsx +++ b/src/pages/applyAfterSales/components/reasonPopup/index.tsx @@ -1,16 +1,19 @@ import Popup from "@/components/popup"; import { ScrollView, Text, View } from "@tarojs/components"; import { memo, useMemo } from "react"; +import classnames from "classnames"; import styles from './index.module.scss' //原因选择 type ReasonInfoParam = { - show?: boolean, - onClose?: () => void, - title?: string, - list?: {id:number, name:string}[] + show?: boolean, //显示 + onClose?: () => void, //关闭 + title?: string, //标题 + list?: {id:number, name:string, typle?:number}[], //数据列表 + onSelect?: (val: object) => void, //选择 + defaultValue?: number, //默认选中 } -export default memo(({show = false, onClose, title = '', list= []}: ReasonInfoParam) => { +export default memo(({show = false, onClose, title = '', list= [], onSelect, defaultValue}: ReasonInfoParam) => { return ( @@ -18,7 +21,7 @@ export default memo(({show = false, onClose, title = '', list= []}: ReasonInfoPa {title} - {list.map(item => {item.name} )} + {list.map(item => onSelect?.(item)} key={item.id} className={classnames(styles.reason_item, item.id == defaultValue&&styles.select_item)}>{item.name} )} diff --git a/src/pages/applyAfterSales/index copy.tsx b/src/pages/applyAfterSales/index copy.tsx new file mode 100644 index 0000000..32cb3b4 --- /dev/null +++ b/src/pages/applyAfterSales/index copy.tsx @@ -0,0 +1,253 @@ +import { Image, ScrollView, Text, View } from "@tarojs/components"; +import { FC, memo, useCallback, useEffect, useMemo, useRef, useState } from "react"; +import classnames from "classnames"; +import styles from './index.module.scss' +import ReasonPopup from "./components/reasonPopup"; +import { useDidShow, useRouter } from "@tarojs/taro"; +import { GetSaleOrderDetailApi } from "@/api/order"; +import KindList from "./components/kindList" +import { ReturnApplyOrderApi, ReturnExplainApi, ReturnGoodsStatusApi, ReturnReasonApi } from "@/api/salesAfterOrder"; +import { alert, goLink } from "@/common/common"; +import UploadImage from "@/components/uploadImage" +import TextareaEnhance from "@/components/textareaEnhance"; + +enum returnStatus { + return_reason = 1, //原因 + reason_describe = 2, //状况 + return_explain = 3, //说明 + +} +export default () => { + + useDidShow(() => { + getSaleOrderPreView() + }) + + const router = useRouter() + const orderId = useRef(Number(router.params.id)) + + //需要提交的数据 + const [submitData, setSubmitData] = useState({ + fabric_piece_accessory_url: [], + goods_status: 0, + reason_describe: '', + return_explain: 0, + return_reason: 1, + roll: 0, + roll_list: [], + sale_order_id: orderId.current + }) + + //获取订单数据 + const [orderDetail, setOrderDetail] = useState() //获取到的原始数据 + const {fetchData: getOrderFetchData} = GetSaleOrderDetailApi() + const getSaleOrderPreView = async () => { + if(orderId.current) { + let res = await getOrderFetchData({id: orderId.current}) + setOrderDetail(res.data) + } + } + + //监听获取到的数据 + useEffect(() => { + if(orderDetail) { + formatData() + } + }, [orderDetail]) + + //格式化数据格式 + const [formatDetailOrder, setFormatDetailOrder] = useState() //格式化后的数据 + const formatData = () => { + setFormatDetailOrder({ + 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, //面料数量 + unit: orderDetail.sale_mode == 0?'条':'m', //单位 + list: orderDetail.product_list, + status: orderDetail.status, //订单状态 + }) + } + + //数据总量 + const dataCount = useMemo(() => { + if(formatDetailOrder) { + return `${formatDetailOrder.total_fabrics}种面料,${formatDetailOrder.total_colors}种颜色,共${formatDetailOrder.total_number}条` + } + }, [formatDetailOrder]) + + + + //面料数据 + let roll_list = useRef({}) + + //大货时获取计步器数据 + 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} + } else { + delete roll_list.current[val.color_id] + } + + let count = 0 + Object.values(roll_list.current).map((item: any) => { + count += item.product_roll + }) + setSubmitData((e) => ({...e, roll_list:Object.values(roll_list.current), roll: count})) + }, []) + + //散剪和剪板 + const getSelectChange = useCallback((val) => { + if(val.status) { + roll_list.current[val.color_id] = {product_color_id: val.color_id, product_roll: val.length} + } else { + delete roll_list.current[val.color_id] + } + let count = 0 + Object.values(roll_list.current).map((item: any) => { + count += item.product_roll + }) + setSubmitData((e) => ({...e, roll_list:Object.values(roll_list.current), roll: count})) + }, []) + + //获取图片列表 + const getImageList = useCallback((list) => { + setSubmitData((e) => ({...e, fabric_piece_accessory_url:list})) + }, []) + + //其他说明 + const getOtherReason = useCallback((val) => { + setSubmitData((e) => ({...e, reason_describe: val})) + }, []) + + //提交数据 + const {fetchData: fetchDataReturnApply} = ReturnApplyOrderApi() + const onSubmitData = async () => { + if(submitData.roll_list.length <= 0) return alert.error('请选择退货颜色') + let res = await fetchDataReturnApply(submitData) + if(res.success) { + alert.success('申请成功') + goLink('/pages/salesAfterList/index',{}, 'reLaunch') + } else { + alert.error('申请失败') + } + console.log('提交::',submitData) + } + + //底部按钮 + const onSubmit = (val) => { + if(val == 2) { + onSubmitData() + } + } + + //退货选择弹窗 + + const [showReason, setShowReason] = useState(false) + const closeReason = useCallback(() => setShowReason(false), []) + const onShowReason = (status) => { + if(status == returnStatus.reason_describe) { + getReturnReason() + } else if (status == returnStatus.return_explain) { + getReturnGoodsStatus() + } else { + getReturnExplain() + } + setShowReason(true) + } + + const [returnGoodsInfo, setReturnGoodsInfo] = useState<{title:string, list: any[], status: 1|2|3}>({title:'', list:[], status: returnStatus.reason_describe}) + //售后货物状况 + const {fetchData: fetchDataGoodsStatus} = ReturnGoodsStatusApi() + const getReturnGoodsStatus = async () => { + let res = await fetchDataGoodsStatus() + setReturnGoodsInfo((e) => ({...e, title: '货物状况', list:res.data?.list||[], status:returnStatus.reason_describe})) + } + //退货原因 + const {fetchData: fetchDataReturnReason} = ReturnReasonApi() + const getReturnReason = async () => { + let res = await fetchDataReturnReason() + setReturnGoodsInfo((e) => ({...e, title: '退货原因', list:res.data?.list||[], status:returnStatus.return_explain})) + } + //售后退货说明 + const {fetchData: fetchDataReturnExplain} = ReturnExplainApi() + const getReturnExplain = async () => { + let res = await fetchDataReturnExplain() + setReturnGoodsInfo((e) => ({...e, title: '退货说明', list:res.data?.list||[], status:returnStatus.return_reason})) + } + //选择返回的数据 + const [returnObj, setReturnObj] = useState<{[val:number]:string, id: number}>({}) + const onReturnSelect = useCallback((val) => { + let {id, name} = val + if(returnGoodsInfo.status == returnStatus.reason_describe) { + setSubmitData((e) => ({...e, reason_describe:id})) + setReturnObj(e => ({...e, [returnStatus.reason_describe]:name, id})) + } + if(returnGoodsInfo.status == returnStatus.return_explain) { + setSubmitData((e) => ({...e, return_explain:id})) + setReturnObj(e => ({...e, [returnStatus.return_explain]:name, id})) + } + if(returnGoodsInfo.status == returnStatus.return_reason) { + setSubmitData((e) => ({...e, return_reason:id})) + setReturnObj(e => ({...e, [returnStatus.return_reason]:name, id})) + } + + }, []) + + useEffect(() => { + console.log('returnObj::', returnObj) + }, [returnObj]) + + return ( + + + {dataCount} + + + + + + 退货原因 + onShowReason(returnStatus.reason_describe)}> + {returnObj[returnStatus.reason_describe]||'请选择'} + + + + + 货物状况 + onShowReason(returnStatus.return_explain)}> + {returnObj[returnStatus.return_explain]||'请选择'} + + + + + 退货说明 + onShowReason(returnStatus.return_reason)}> + {returnObj[returnStatus.return_reason]||'请选择'} + + + + + 拍照上传 + + + + + + + + + + + + + + onSubmit(1)}>取消 + onSubmit(2)}>确认 + + + + + ) +} \ No newline at end of file diff --git a/src/pages/applyAfterSales/index.tsx b/src/pages/applyAfterSales/index.tsx index 9698934..7cfbc41 100644 --- a/src/pages/applyAfterSales/index.tsx +++ b/src/pages/applyAfterSales/index.tsx @@ -3,16 +3,20 @@ import { FC, memo, useCallback, useEffect, useMemo, useRef, useState } from "rea import classnames from "classnames"; import styles from './index.module.scss' import ReasonPopup from "./components/reasonPopup"; -import OtherReason from "./components/otherReason"; import { useDidShow, useRouter } from "@tarojs/taro"; import { GetSaleOrderDetailApi } from "@/api/order"; import KindList from "./components/kindList" -import { ReturnApplyOrderApi, ReturnGoodsStatusApi } from "@/api/salesAfterOrder"; +import { ReturnApplyOrderApi, ReturnExplainApi, ReturnGoodsStatusApi, ReturnReasonApi } from "@/api/salesAfterOrder"; import { alert, goLink } from "@/common/common"; import UploadImage from "@/components/uploadImage" import TextareaEnhance from "@/components/textareaEnhance"; -type ReasonParam = 1|2|3 //1 退货原因 2 货物状况 3 退货说明 +enum returnStatus { + return_reason = 1, //原因 + goods_status = 2, //状况 + return_explain = 3, //说明 + +} export default () => { useDidShow(() => { @@ -28,7 +32,7 @@ export default () => { goods_status: 0, reason_describe: '', return_explain: 0, - return_reason: 1, + return_reason: 0, roll: 0, roll_list: [], sale_order_id: orderId.current @@ -75,13 +79,7 @@ export default () => { }, [formatDetailOrder]) - //退货选择弹窗 - const [showReason, setShowReason] = useState<{show:true|false, title: string}>({show:false, title: ''}) - const closeReason = useCallback(() => setShowReason({...showReason, show:false}), []) - const onShowReason = (status) => { - setShowReason({...showReason, show:true}) - } - + //面料数据 let roll_list = useRef({}) @@ -102,7 +100,6 @@ export default () => { //散剪和剪板 const getSelectChange = useCallback((val) => { - console.log('val::', val) if(val.status) { roll_list.current[val.color_id] = {product_color_id: val.color_id, product_roll: val.length} } else { @@ -146,17 +143,59 @@ export default () => { } } - const [returnGoodsInfo, setReturnGoodsInfo] = useState<{title:string, list: any[]}>({title:'', list:[]}) + //退货选择弹窗 + const [showReason, setShowReason] = useState(false) + const closeReason = useCallback(() => setShowReason(false), []) + const onShowReason = (status) => { + if(status == returnStatus.return_reason) { + getReturnReason() + } else if (status == returnStatus.goods_status) { + getReturnGoodsStatus() + } else { + getReturnExplain() + } + setShowReason(true) + } + + //请求获取到的数据 + const [returnGoodsInfo, setReturnGoodsInfo] = useState<{title:string, list: any[], status: 1|2|3}>({title:'', list:[], status: returnStatus.goods_status}) //售后货物状况 const {fetchData: fetchDataGoodsStatus} = ReturnGoodsStatusApi() const getReturnGoodsStatus = async () => { let res = await fetchDataGoodsStatus() - setReturnGoodsInfo((e) => ({...e, title: '售后货物状况', list:res.data?.list||[]})) + setReturnGoodsInfo((e) => ({...e, title: '货物状况', list:res.data?.list||[], status:returnStatus.goods_status})) } - useEffect(() => { - getReturnGoodsStatus() - }, []) - + //退货原因 + const {fetchData: fetchDataReturnReason} = ReturnReasonApi() + const getReturnReason = async () => { + let res = await fetchDataReturnReason() + setReturnGoodsInfo((e) => ({...e, title: '退货原因', list:res.data?.list||[], status:returnStatus.return_reason})) + } + //售后退货说明 + const {fetchData: fetchDataReturnExplain} = ReturnExplainApi() + const getReturnExplain = async () => { + let res = await fetchDataReturnExplain() + setReturnGoodsInfo((e) => ({...e, title: '退货说明', list:res.data?.list||[], status:returnStatus.return_explain})) + } + //选择列表返回的数据 + const [returnObj, setReturnObj] = useState<{[val:number]:{name:string, id: number}}>({}) + const onReturnSelect = useCallback((val) => { + let {id, name} = val + if(returnGoodsInfo.status == returnStatus.goods_status) { + setSubmitData((e) => ({...e, goods_status:id})) + setReturnObj(e => ({...e, [returnStatus.goods_status]:{name, id}})) + } + if(returnGoodsInfo.status == returnStatus.return_explain) { + setSubmitData((e) => ({...e, return_explain:id})) + setReturnObj(e => ({...e, [returnStatus.return_explain]:{name, id}})) + } + if(returnGoodsInfo.status == returnStatus.return_reason) { + setSubmitData((e) => ({...e, return_reason:id})) + setReturnObj(e => ({...e, [returnStatus.return_reason]:{name, id}})) + } + setShowReason(false) + }, [returnGoodsInfo]) + return ( @@ -167,22 +206,22 @@ export default () => { 退货原因 - onShowReason(1)}> - 请选择 + onShowReason(returnStatus.return_reason)}> + {returnObj[returnStatus.return_reason]?.name||'请选择'} 货物状况 - onShowReason(2)}> - 请选择 + onShowReason(returnStatus.goods_status)}> + {returnObj[returnStatus.goods_status]?.name||'请选择'} 退货说明 - onShowReason(3)}> - 请选择 + onShowReason(returnStatus.return_explain)}> + {returnObj[returnStatus.return_explain]?.name||'请选择'} @@ -205,7 +244,7 @@ export default () => { onSubmit(2)}>确认 - + ) } \ No newline at end of file diff --git a/src/pages/details/index.tsx b/src/pages/details/index.tsx index 3d289d7..87903c5 100644 --- a/src/pages/details/index.tsx +++ b/src/pages/details/index.tsx @@ -192,9 +192,9 @@ export default (props:Params) => { { (!userInfo.adminUserInfo?.is_authorize_phone)&& - 开始下单 + 选购商品 - || placeOrder('to_order')}>开始下单 + || placeOrder('to_order')}>选购商品 } diff --git a/src/pages/order/components/applyRefund/index.tsx b/src/pages/order/components/applyRefund/index.tsx index 481d03f..3f6311e 100644 --- a/src/pages/order/components/applyRefund/index.tsx +++ b/src/pages/order/components/applyRefund/index.tsx @@ -1,43 +1,85 @@ import Popup from "@/components/popup"; import TextareaEnhance from "@/components/textareaEnhance"; import { ScrollView, Text, View } from "@tarojs/components"; -import { memo, useCallback, useState } from "react"; +import { memo, useCallback, useEffect, useRef, useState } from "react"; import ReasonPopup from "../reasonPopup"; import styles from './index.module.scss' import classnames from "classnames"; +import { ApplyRefundApi } from "@/api/salesAfterOrder"; +import { alert } from "@/common/common"; type Param = { show?: true|false, - onClose?: () => void + onClose?: () => void, + orderId?: number } -export default memo(({show, onClose}:Param) => { +export default memo(({show, onClose, orderId}:Param) => { - - const getOtherReason = useCallback(() => { + //提交的数据 + const submitData = useRef({ + return_explain: 1, + sale_order_id: 0, + reason_describe: '' + }) - }, []) - - const onSubmit = (val) => { + 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 onShowReason = () => { - setShowReason(true) + + //提交 + const onSubmit = (val) => { + if(val == 2) { + getApplyRefund() + } else { + onClose?.() + submitData.current = { + return_explain: 0, + sale_order_id: 0, + reason_describe: '' + } + } } + + return ( <> 退款说明 - onShowReason()}> + setShowReason(true)}> 请选择 @@ -51,7 +93,7 @@ export default memo(({show, onClose}:Param) => { - + ) }) \ No newline at end of file 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/components/payment/index.module.scss b/src/pages/order/components/payment/index.module.scss index 0f16e80..ade0ca3 100644 --- a/src/pages/order/components/payment/index.module.scss +++ b/src/pages/order/components/payment/index.module.scss @@ -96,9 +96,15 @@ $top:190px; } .miconfont{ font-size: 30px; - color: #FFC300; + color: #007AFF; padding-right: 10px; } + .advance_payment{ + color: #FFC300; + } + .account_period{ + color: #07C160; + } .payment_list_item_left_price{ font-size: $font_size_min; color: $color_font_two; diff --git a/src/pages/order/components/payment/index.tsx b/src/pages/order/components/payment/index.tsx index 303b62f..d8d2506 100644 --- a/src/pages/order/components/payment/index.tsx +++ b/src/pages/order/components/payment/index.tsx @@ -122,7 +122,7 @@ export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param) //是否显示七天账期 const show_account_payment = useMemo(() => { - console.log('orderInfo?.status::',orderInfo) + console.log('orderInfo?.status::123',orderInfo) //剪板合散剪不显示 if(orderInfo?.sale_mode != 0) return false //支付方式是账期支付,不显示 @@ -174,7 +174,7 @@ export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param) - + 预存款 {advance_payment} @@ -184,7 +184,7 @@ export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param) {show_account_payment&& - + {payInfo?.account_period}天账期 {account_peyment} @@ -194,7 +194,7 @@ export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param) - + 线下汇款 @@ -203,7 +203,7 @@ export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param) - + 扫码支付 diff --git a/src/pages/order/components/reasonPopup/index.module.scss b/src/pages/order/components/reasonPopup/index.module.scss index eba26cd..2d0f899 100644 --- a/src/pages/order/components/reasonPopup/index.module.scss +++ b/src/pages/order/components/reasonPopup/index.module.scss @@ -22,6 +22,9 @@ .reason_item{ margin-bottom: 36px; } + .select_item { + color: #007AFF; + } } } } \ No newline at end of file diff --git a/src/pages/order/components/reasonPopup/index.tsx b/src/pages/order/components/reasonPopup/index.tsx index 1230787..0ed990c 100644 --- a/src/pages/order/components/reasonPopup/index.tsx +++ b/src/pages/order/components/reasonPopup/index.tsx @@ -1,34 +1,27 @@ import Popup from "@/components/popup"; import { ScrollView, Text, View } from "@tarojs/components"; import { memo, useMemo } from "react"; +import classnames from "classnames"; import styles from './index.module.scss' //原因选择 type ReasonInfoParam = { - show?: boolean, - onClose?: () => void, + show?: boolean, //显示 + onClose?: () => void, //关闭 + title?: string, //标题 + list?: {id:number, name:string, typle?:number}[], //数据列表 + onSelect?: (val: object) => void, //选择 + defaultValue?: number, //默认选中 } -export default memo(({show = false, onClose}: ReasonInfoParam) => { +export default memo(({show = false, onClose, title = '', list= [], onSelect, defaultValue}: ReasonInfoParam) => { + return ( - + - 退款说明 + {title} - 完好无损带原标签 - 完好无损带原标签 - 完好无损带原标签 - 完好无损带原标签 - 完好无损带原标签 - 完好无损带原标签 - 完好无损带原标签 - 完好无损带原标签 - 完好无损带原标签 - 完好无损带原标签 - 完好无损带原标签 - 完好无损带原标签 - 完好无损带原标签 - 完好无损带原标签 + {list.map(item => onSelect?.(item)} key={item.id} className={classnames(styles.reason_item, item.id == defaultValue&&styles.select_item)}>{item.name} )} diff --git a/src/pages/order/components/remark/index.tsx b/src/pages/order/components/remark/index.tsx index 11d870f..8fdd21a 100644 --- a/src/pages/order/components/remark/index.tsx +++ b/src/pages/order/components/remark/index.tsx @@ -19,13 +19,13 @@ export default ({onBlur, onSave, defaultValue = ''}:Param) => { getDesc(defaultValue) }, [defaultValue]) - const getDesc = useCallback((value) => { + const getDesc = (value) => { let res = value if(value.length > descData.count) { res = value.slice(0, descData.count) } setDescData({...descData, number:res.length, value: res}) - },[]) + } const setSave = () => { onSave?.(descData.value) @@ -34,7 +34,7 @@ export default ({onBlur, onSave, defaultValue = ''}:Param) => { 编辑备注 - + {descData.number}/{descData.count} setSave()}>保存 diff --git a/src/pages/order/index.tsx b/src/pages/order/index.tsx index fae2191..7c678e1 100644 --- a/src/pages/order/index.tsx +++ b/src/pages/order/index.tsx @@ -127,11 +127,6 @@ import styles from './index.module.scss' setPayMentShow(true) } - //地址组件所需数据 - const addressInfoDetailData = useMemo(() => { - return {orderId:orderDetail?.id, shipment_mode:orderDetail?.shipment_mode, status: orderDetail?.status} - }, [orderDetail]) - //打开地址修改 const addressRef = useRef(null) @@ -155,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) { //再购 @@ -188,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]) @@ -287,7 +285,7 @@ import styles from './index.module.scss' getRemark(e)} defaultValue={orderDetail?.remark}/> - + setShowCart(false)}/> 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 63a4e0a..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; @@ -72,8 +73,7 @@ .image{ width: 126px; height: 126px; - background: #e5ad3a; - border-radius: 20px 20px 0px 0px; + border-radius: 20px; position: relative; image{ width: 100%; @@ -82,13 +82,13 @@ } .color_num { background: rgba(0,0,0, 0.5); - border-radius: 50px 0px 0px 0px; + border-radius: 50px 0px 20px 0px; font-size: $font_size_min; color: #fff; position: absolute; right:0; bottom:0; - padding: 5px 10px; + padding: 5px 10px 5px 20px; box-sizing: border-box; } } diff --git a/src/pages/orderList/components/order/index.tsx b/src/pages/orderList/components/order/index.tsx index 466bc5e..5dbb13c 100644 --- a/src/pages/orderList/components/order/index.tsx +++ b/src/pages/orderList/components/order/index.tsx @@ -27,8 +27,8 @@ type Param = { texture_url: string, payment_method: number, //支付方式 actual_amount: number, //实付金额 - wait_pay_amount: number //待付金额 - should_collect_order_id: number //应付单id + wait_pay_amount: number, //待付金额 + should_collect_order_id: number, //应付单id }, onClickBtn?: (val:{status:number, orderInfo:Param['value']}) => void } @@ -59,6 +59,11 @@ export default memo(({value, onClickBtn}: Param) => { } }, [value]) + //总条数 + const numText = useMemo(() => { + return `${value?.total_fabrics}种面料,${value?.total_colors}种颜色,共${value?.total_number}${value?.sale_mode == 0? '条':'米'}` + }, [value]) + return ( goLink('/pages/order/index', {id: value?.id})}> @@ -80,8 +85,8 @@ export default memo(({value, onClickBtn}: Param) => { - - {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) => { @@ -89,7 +94,7 @@ export default memo(({value, onClickBtn}: Param) => { (index <= 1)&& {formatHashTag(itemColor.code, itemColor.name)} {standardPrice(itemColor.sale_price, value.sale_mode)} - ×{formatCount(itemColor, value.sale_mode)}条 + ×{formatCount(itemColor, value.sale_mode) + (value.sale_mode == 0?'条':'米')} ) }) @@ -101,7 +106,7 @@ export default memo(({value, onClickBtn}: Param) => { - {`${value?.total_fabrics}种面料,${value?.total_colors}种颜色,共${value?.total_number}条`} + {numText} diff --git a/src/pages/orderList/index.tsx b/src/pages/orderList/index.tsx index 982f9d2..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,18 +100,16 @@ export default () => { //监听点击的按钮 const clickOrderBtn = useCallback(({status, orderInfo}) => { + setCallBackPayOrderInfo(() => orderInfo) if(status == 1 || status == 6) { getOrderList() } else if(status == 2) { //去支付 - console.log('orderInfo::',orderInfo) - setPayOrderInfo({ - should_collect_order_id: orderInfo.should_collect_order_id,//应付单id - pre_collect_order_id: orderInfo.pre_collect_order_id, //预付单id - status: orderInfo.status, //订单状态 - payment_method: orderInfo.payment_method //支付方式 - }) toPay() + } else if (status == 3) { + //申请退款 + if(!orderInfo?.av_return_roll) return alert.none('该订单已申请过退款') + setRefundShow(true) } else if (status == 7) { //购买 addShopCart(orderInfo) @@ -117,8 +117,9 @@ export default () => { }, [orderData]) + const [callBackOrderInfo, setCallBackPayOrderInfo] = useState() + //去付款 - const [payOrderInfo, setPayOrderInfo] = useState() const [payMentShow, setPayMentShow] = useState(false) const toPay = () => { setPayMentShow(true) @@ -165,6 +166,12 @@ export default () => { } + //申请退款 + const [refundShow, setRefundShow] = useState(false) + const applyRefundClose = useCallback(() => { + setRefundShow(false) + }, []) + return ( @@ -179,8 +186,9 @@ export default () => { })} + setShowCart(false)}/> - + ) } diff --git a/src/pages/salesAfter/index.tsx b/src/pages/salesAfter/index.tsx index 2796f66..63b5e20 100644 --- a/src/pages/salesAfter/index.tsx +++ b/src/pages/salesAfter/index.tsx @@ -5,7 +5,7 @@ import { import { GetOrderPayApi } from "@/api/orderPay"; import { SaleOrderOrderDetailApi } from "@/api/salesAfterOrder"; import { alert, goLink } from "@/common/common"; -import { ORDER_STATUS } from "@/common/enum"; +import { AFTER_ORDER_STATUS, ORDER_STATUS } from "@/common/enum"; import { formatDateTime, formatImgUrl, formatPriceDiv } from "@/common/fotmat"; import AfterOrderBtns from "@/components/afterOrderBtns"; import OrderBtns from "@/components/orderBtns"; @@ -95,8 +95,10 @@ import styles from './index.module.scss' } }, [orderDetail]) - //订单状态枚举 - const {SaleOrderStatusCancel} = ORDER_STATUS + //售后订单状态枚举 + const { + + } = AFTER_ORDER_STATUS //物流显示 const [logisticsShow, setLogisticsShow] = useState(false) @@ -122,15 +124,17 @@ import styles from './index.module.scss' //显示生气记录 const [applyRecord, setApplyRecord] = useState(false) + //货 + return ( - {(orderDetail?.status != SaleOrderStatusCancel.value)&& - - } + + + setApplyRecord(false)}/> @@ -174,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/order/index.tsx b/src/pages/salesAfterList/components/order/index.tsx index 7dd2ac9..749d956 100644 --- a/src/pages/salesAfterList/components/order/index.tsx +++ b/src/pages/salesAfterList/components/order/index.tsx @@ -109,7 +109,7 @@ export default memo(({value, onClickBtn}: Param) => { 订单号:{value?.order_no} - + ) }) 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 ( diff --git a/src/pages/salesAfterList/index.tsx b/src/pages/salesAfterList/index.tsx index 9c4f25e..bd52d1c 100644 --- a/src/pages/salesAfterList/index.tsx +++ b/src/pages/salesAfterList/index.tsx @@ -107,7 +107,6 @@ export default () => { const [logisticsShow, setLogisticsShow] = useState(false) const onCloseLogistics = useCallback(() => setLogisticsShow(false), []) - return ( diff --git a/src/reducers/userInfo.ts b/src/reducers/userInfo.ts index b7215c1..6a4cb11 100644 --- a/src/reducers/userInfo.ts +++ b/src/reducers/userInfo.ts @@ -10,7 +10,8 @@ import { CLEAR_USERINFO, CLEAR_SESSIONKEY, CLEAR_ADMINUSERINFO, - CLEAR_SORTCODE + CLEAR_SORTCODE, + LOGIN_STATUS } from '../constants/userInfo' export type UserParam = { @@ -54,6 +55,7 @@ export type DataParam = { userInfo: UserParam, adminUserInfo: UserAdminParam, sort_code: SortCodeParam + logingStatus?: false //登录状态 true 正在登录 } type Action = { @@ -68,6 +70,7 @@ const INIT_USER = { token: Taro.getStorageSync('token')||'', session_key: Taro.getStorageSync('session_key')||'', sort_code: Taro.getStorageSync('sort_code')?JSON.parse(Taro.getStorageSync('sort_code')):null, + logingStatus: false } export default function counter (state = INIT_USER, action: Action) { @@ -103,6 +106,8 @@ export default function counter (state = INIT_USER, action: Action) { case CLEAR_SORTCODE: Taro.removeStorageSync('sort_code') return {...state, sortCode: null} + case LOGIN_STATUS: + return {...state, ...data} default: return state } diff --git a/src/use/useHttp.ts b/src/use/useHttp.ts index 2f38afc..07312f4 100644 --- a/src/use/useHttp.ts +++ b/src/use/useHttp.ts @@ -85,6 +85,8 @@ const showStatus = (status) => { return `${message},请检查网络或联系管理员!` } +//登录状态 +const loginStatus: false|true = false // true:登录中 /** * axios 请求状态封装,返回响应式数据 fetch(), loading, error, code, msg 等常用方法/状态 @@ -133,7 +135,6 @@ export const useRequest = (options:option = { const fetchData = async (sub_options?:any) => { stateRef.current.loading = true setState((e) => ({...e, loading:true})) - console.log('tf:::', stateRef.current.loading) stateRef.current.query = { ...sub_options, ...options.pagination && { @@ -161,7 +162,6 @@ export const useRequest = (options:option = { } } const result = await Taro.request(q as any) - const { statusCode } = result const { code,