From 87bcda1c38839b34bb82ea6fffa9c72e348c23f5 Mon Sep 17 00:00:00 2001 From: czm <2192718639@qq.com> Date: Wed, 20 Jul 2022 19:09:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=9F=8E=E6=B5=8B=E8=AF=95=E7=89=88v7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/orderBtns/index.module.scss | 2 +- src/components/orderBtns/index.tsx | 153 +++++++------- .../components/cutKindList/index.tsx | 25 +-- .../components/kindList/index.tsx | 29 +-- src/pages/applyAfterSales/index.tsx | 18 +- .../order/components/scanPayCheck/index.tsx | 41 +--- src/pages/order/index.tsx | 1 + .../orderList/components/order/index.tsx | 4 +- src/pages/orderList/index copy.tsx | 194 ------------------ .../salesAfter/components/kindList/index.tsx | 4 +- .../salesAfterList/components/order/index.tsx | 6 +- src/pages/salesAfterList/index copy.tsx | 124 ----------- src/pages/searchList/search.tsx | 4 +- 13 files changed, 122 insertions(+), 483 deletions(-) delete mode 100644 src/pages/orderList/index copy.tsx delete mode 100644 src/pages/salesAfterList/index copy.tsx diff --git a/src/components/orderBtns/index.module.scss b/src/components/orderBtns/index.module.scss index e121bca..e6bce03 100644 --- a/src/components/orderBtns/index.module.scss +++ b/src/components/orderBtns/index.module.scss @@ -17,7 +17,7 @@ position: absolute; background-color: #fff; width: 226px; - box-shadow: 0px 0px 20px 0px rgba(0,0,0,0.06); + box-shadow: 0px 0px 20px 0px rgba(0,0,0,0.3); border-radius: 10px; padding: 0 20px; box-sizing: border-box; diff --git a/src/components/orderBtns/index.tsx b/src/components/orderBtns/index.tsx index 5ac96f5..2b06074 100644 --- a/src/components/orderBtns/index.tsx +++ b/src/components/orderBtns/index.tsx @@ -49,12 +49,13 @@ export default memo(({orderInfo, showStatus = 'detail', onClick}:Param) => { SaLeModeWeightCut, } = SALE_MODE - //注册按钮 - type orderBtnsListParams = {id: number, label: string, validatarFunc: (val: typeof orderInfo) => any} + //注册按钮, id:按钮id唯一,label:按钮名称,sort:排序数字越大越靠后,validatarFunc:验证 + type orderBtnsListParams = {id: number, label: string, sort: number, validatarFunc: (val: typeof orderInfo) => any} const orderBtnsList = useRef([ { id: 1, label: '取消订单', + sort: 1, validatarFunc: (orderInfo) => { //在待发货之前没有付过款 let orderStatus = [ @@ -69,74 +70,10 @@ export default memo(({orderInfo, showStatus = 'detail', onClick}:Param) => { return orderInfo.actual_amount == 0 && orderStatus.includes(orderInfo.status) } }, - { - id: 7, - label: '再次购买', - validatarFunc: () => { - return true - } - }, - { - id: 8, - label: '退款', - validatarFunc: (orderInfo) => { - //散剪和剪板在待接单时付过款 - let orderStatus = [ - SaleOrderStatusBooking.value - ] - return orderInfo.sale_mode != SaLeModeBulk.value && orderInfo.actual_amount != 0 && orderStatus.includes(orderInfo.status) - } - }, - { - id: 9, - label: '售后记录', - validatarFunc: (orderInfo) => { - return orderInfo.is_return - } - }, - { - id: 3, - label: '申请退款', - validatarFunc: (orderInfo) => { - //大货在待发货付过款 - let orderStatus = [ - SaleOrderStatusWaitingDelivery.value, - SaleOrderStatusTaking.value - ] - return orderInfo.sale_mode == SaLeModeBulk.value && orderInfo.actual_amount != 0 && orderInfo.av_return_roll && orderStatus.includes(orderInfo.status) - } - }, - { - id: 5, - label: '申请退货', - validatarFunc: (orderInfo) => { - let orderStatus = [ - SaleOrderStatusAlreadyReceipt.value, - SaleOrderStatusRefund.value - ] - return orderInfo.av_return_roll&& orderStatus.includes(orderInfo.status) - } - }, - { - id: 6, - label: '确认收货', - validatarFunc: (orderInfo) => { - let orderStatus = [ - SaleOrderStatusWaitingReceipt.value - ] - return orderStatus.includes(orderInfo.status) - } - }, - { - id: 10, - label: '销售码单', - validatarFunc: (orderInfo) => { - return orderInfo.actual_amount > 0 && orderInfo.wait_pay_amount == 0 && showStatus == 'detail' - } - }, { id: 2, label: '去付款', + sort: 100, validatarFunc: (orderInfo) => { //只要没有付完款就显示 let orderStatus = [ @@ -150,15 +87,87 @@ export default memo(({orderInfo, showStatus = 'detail', onClick}:Param) => { ] return orderInfo.wait_pay_amount != 0 && orderStatus.includes(orderInfo.status) } - } - + }, + { + id: 3, + label: '申请退款', + sort: 5, + validatarFunc: (orderInfo) => { + //大货在待发货付过款 + let orderStatus = [ + SaleOrderStatusWaitingDelivery.value, + SaleOrderStatusTaking.value + ] + return orderInfo.sale_mode == SaLeModeBulk.value && orderInfo.actual_amount != 0 && orderInfo.av_return_roll && orderStatus.includes(orderInfo.status) + } + }, + { + id: 5, + label: '申请退货', + sort: 5, + validatarFunc: (orderInfo) => { + let orderStatus = [ + SaleOrderStatusAlreadyReceipt.value, + SaleOrderStatusRefund.value + ] + return orderInfo.av_return_roll&& orderStatus.includes(orderInfo.status) + } + }, + { + id: 6, + label: '确认收货', + sort: 10, + validatarFunc: (orderInfo) => { + let orderStatus = [ + SaleOrderStatusWaitingReceipt.value + ] + return orderStatus.includes(orderInfo.status) + } + }, + { + id: 7, + label: '再次购买', + sort: 6, + validatarFunc: () => { + return true + } + }, + { + id: 8, + label: '退款', + sort: 5, + validatarFunc: (orderInfo) => { + //散剪和剪板在待接单时付过款 + let orderStatus = [ + SaleOrderStatusBooking.value + ] + return orderInfo.sale_mode != SaLeModeBulk.value && orderInfo.actual_amount != 0 && orderStatus.includes(orderInfo.status) + } + }, + { + id: 9, + label: '售后记录', + sort: 6, + validatarFunc: (orderInfo) => { + return orderInfo.is_return + } + }, + { + id: 10, + label: '销售码单', + sort: 9, + validatarFunc: (orderInfo) => { + return orderInfo.actual_amount > 0 && orderInfo.wait_pay_amount == 0 && showStatus == 'detail' + } + }, ]) //显示的按钮数组 const orderBtnsShowList: orderBtnsListParams[] = useMemo(() => { - return orderBtnsList.current.filter(item => { + let list = orderBtnsList.current.filter(item => { return item.validatarFunc(orderInfo) }) + return list.sort((a, b) => a.sort - b.sort) }, [orderInfo]) //小程序订阅 @@ -278,7 +287,7 @@ export default memo(({orderInfo, showStatus = 'detail', onClick}:Param) => { {showMore&& {orderBtnsShowList.map((item, index) => { - return ((index >= 3) && submitBtns(item.id, index)}>{item.label}) + return ((index < (orderBtnsShowList.length - 3)) && submitBtns(item.id, index)}>{item.label}) })} setShowMore(false)}> @@ -287,7 +296,7 @@ export default memo(({orderInfo, showStatus = 'detail', onClick}:Param) => { {orderBtnsShowList.map((item, index) => - (index < 3)&& submitBtns(item.id, index)}>{item.label} + ((orderBtnsShowList.length - 3) <= index)&& submitBtns(item.id, index)}>{item.label} )} diff --git a/src/pages/applyAfterSales/components/cutKindList/index.tsx b/src/pages/applyAfterSales/components/cutKindList/index.tsx index 70e7825..aea397b 100644 --- a/src/pages/applyAfterSales/components/cutKindList/index.tsx +++ b/src/pages/applyAfterSales/components/cutKindList/index.tsx @@ -14,6 +14,7 @@ type OrderParam = { total_fabrics?: number, total_number?: number, status?: number, //订单状态 + av_return_product?: any[] //申请售后列表 } type Param = { @@ -22,40 +23,28 @@ type Param = { } const kindeList:FC = memo(({order, onSelectChange}) => { - //对应数量 - const formatCount = useCallback((item) => { - return (order?.sale_mode == 0? item.roll : Number(item.length / 100)) + order?.unit - }, [order]) - //checkbox选中回调 const selectCallBack = (colorItem) => { - onSelectChange?.({color_id:colorItem.id, length:colorItem.length, sale_order_detail_id:colorItem.sale_order_detail_id, status: true}) + onSelectChange?.({color_id:colorItem.product_color_id, length:colorItem.length, sale_order_detail_id:colorItem.sale_order_detail_id, status: true}) } //checkbox关闭回调 const colseCallBack = (colorItem) => { - onSelectChange?.({color_id:colorItem.id, length:colorItem.length, status: false, sale_order_detail_id:colorItem.sale_order_detail_id,}) - } - - //判断该面料下的颜色都退完了 - const colorNum = (item) => { - return item.product_colors.some(val => { - return val.return_roll + val.apply_return_roll == 0 - }) + onSelectChange?.({color_id:colorItem.product_color_id, length:colorItem.length, status: false, sale_order_detail_id:colorItem.sale_order_detail_id,}) } return ( - {order?.list?.map(item => colorNum(item)&& + {order?.av_return_product?.map(item => {order.sale_mode_name} - {formatHashTag(item.code, item.name)} + {formatHashTag(item.product_code, item.product_name)} - {item.product_colors.map(colorItem => ((colorItem.return_roll + colorItem.apply_return_roll) == 0)&& + {item?.av_product_color?.map(colorItem => - {colorItem.code + ' ' + colorItem.name}x {formatCount(colorItem)} + {colorItem.product_color_code + ' ' + colorItem.product_color_name}x {colorItem.length/100} m selectCallBack(colorItem)} onClose={() => colseCallBack(colorItem)}/> )} diff --git a/src/pages/applyAfterSales/components/kindList/index.tsx b/src/pages/applyAfterSales/components/kindList/index.tsx index 6c7092b..c5cecd2 100644 --- a/src/pages/applyAfterSales/components/kindList/index.tsx +++ b/src/pages/applyAfterSales/components/kindList/index.tsx @@ -14,6 +14,7 @@ type OrderParam = { total_fabrics?: number, total_number?: number, status?: number, //订单状态 + av_return_product?: any[] //申请售后列表 } type Param = { @@ -22,39 +23,27 @@ type Param = { } const kindeList:FC = memo(({order, onNumChange}) => { - //对应数量 - const formatCount = useCallback((item) => { - return (item.roll - item.return_roll - item.apply_return_roll) + order?.unit! - }, [order]) - //计步器失返回值 + //计步器返回值 const getCounterChange = useCallback((colorItem) => { return (number) => { - onNumChange?.({number, color_id: colorItem.id, sale_order_detail_id:colorItem.sale_order_detail_id}) + onNumChange?.({number, color_id: colorItem.product_color_id, sale_order_detail_id:colorItem.sale_order_detail_id}) } - }, []) - - //判断该面料下的颜色都退完了 - const colorNum = (item) => { - let res = item.product_colors.some(val => { - return (val.return_roll + val.apply_return_roll) < val.roll - }) - return res - } + }, [order]) return ( - {order?.list?.map(item => (colorNum(item))&& + {order?.av_return_product?.map(item => {order.sale_mode_name} - {formatHashTag(item.code, item.name)} + {formatHashTag(item.product_code, item.product_name)} - {item.product_colors.map(colorItem => ((colorItem.return_roll + colorItem.apply_return_roll) < colorItem.roll)&& + {item?.av_product_color?.map(colorItem => - {colorItem.code + ' ' + colorItem.name}x {formatCount(colorItem)} + {colorItem.product_color_code + ' ' + colorItem.product_color_name}x {colorItem.roll} - + )} diff --git a/src/pages/applyAfterSales/index.tsx b/src/pages/applyAfterSales/index.tsx index a6e74f2..0b72cf1 100644 --- a/src/pages/applyAfterSales/index.tsx +++ b/src/pages/applyAfterSales/index.tsx @@ -65,6 +65,7 @@ export default () => { ...orderDetail, unit: orderDetail.sale_mode == 0?'条':'m', //单位 list: orderDetail.product_list, + }) } @@ -84,30 +85,21 @@ 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, sale_order_detail_id: val.sale_order_detail_id} + roll_list.current[val.color_id] = {product_roll: val.number, sale_order_detail_id: val.sale_order_detail_id} } 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})) + setSubmitData((e) => ({...e, roll_list:Object.values(roll_list.current)})) }, []) //散剪和剪板 const getSelectChange = useCallback((val) => { if(val.status) { - roll_list.current[val.color_id] = {product_color_id: val.color_id, product_roll: val.length, sale_order_detail_id: val.sale_order_detail_id} + roll_list.current[val.color_id] = {product_roll: val.length, sale_order_detail_id: val.sale_order_detail_id} } 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})) + setSubmitData((e) => ({...e, roll_list:Object.values(roll_list.current)})) }, []) //获取图片列表 diff --git a/src/pages/order/components/scanPayCheck/index.tsx b/src/pages/order/components/scanPayCheck/index.tsx index 4927d70..2305ba8 100644 --- a/src/pages/order/components/scanPayCheck/index.tsx +++ b/src/pages/order/components/scanPayCheck/index.tsx @@ -5,7 +5,7 @@ import styles from './index.module.scss' import Popup from "@/components/popup"; import Taro from "@tarojs/taro"; import { alert } from "@/common/common"; -import { formatDateTime, formatHashTag, formatImgUrl, formatPriceDiv, formatWeightDiv } from "@/common/fotmat"; +import { formatDateTime, formatHashTag, formatImgUrl, formatPriceDiv, formatRemoveHashTag, formatWeightDiv } from "@/common/fotmat"; import useCheckAuthorize from "@/use/useCheckAuthorize"; import { GetPayCode } from "@/api/onlinePay"; import LoadingCard from "@/components/loadingCard"; @@ -33,28 +33,6 @@ type ListParam = { } export default memo(({show = true, onClose, company, orderInfo}:Param) => { const [detail, setDetail] = useState() - - //获取支付方式数据 - const [payInfo, setPayInfo] = useState() - const {fetchData: orderFetchData} = GetOrderPayApi() - const {fetchData: prepayOrderFetchData} = GetPrepayOrderPayApi() - const getOrderPay = async () => { - if(orderInfo&&orderInfo.should_collect_order_id) { - //有应收单id时用应收单获取数据 - let {data} = await orderFetchData({id: orderInfo?.should_collect_order_id}) - setPayInfo(() => data) - } - else if(orderInfo&&orderInfo.pre_collect_order_id) { - //用预付单id获取支付信息 - let {data} = await prepayOrderFetchData({id: orderInfo?.pre_collect_order_id}) - setPayInfo(() => data) - } - } - - useEffect(() => { - if(orderInfo) - getOrderPay() - }, [orderInfo]) useEffect(() => { if(show) { @@ -63,14 +41,14 @@ export default memo(({show = true, onClose, company, orderInfo}:Param) => { }, [show]) useEffect(() => { - if(orderInfo && payInfo) { + if(orderInfo) { let lists:ListParam[] = [] orderInfo.product_list?.map(pitem => { pitem?.product_colors?.map(citem => { lists.push({ - product_code: formatHashTag(pitem.code, '', 'name')!, + product_code: formatRemoveHashTag(pitem.code), product_name: pitem.name, - product_color_code: formatHashTag(citem.code)!, + product_color_code: formatRemoveHashTag(citem.code), product_color_name: citem.name, num: citem.roll.toString(), length: (citem.length/100).toString(), @@ -91,21 +69,21 @@ export default memo(({show = true, onClose, company, orderInfo}:Param) => { target_user_name: userName(orderInfo), //收件人 target_address: address(orderInfo), //收货地址 target_description: orderInfo.remark, //发货备注 - pay_account: payInfo.offline_remittance_information?.transfer_remittance_account, //专属收款账号 - bank_account_name: payInfo.offline_remittance_information?.account_name, //账户名称 - bank_name: payInfo.offline_remittance_information?.bank_of_deposit, //开户银行 + pay_account: orderInfo.account, //专属收款账号 + bank_account_name: orderInfo.account_name, //账户名称 + bank_name: orderInfo.bank_of_deposit, //开户银行 pay_type:"", //支付方式, 可不传 client: orderInfo.purchaser_name, //客户名称 phone: userPhone(orderInfo), //收货手机号码 order_total_length: (orderInfo.total_number/100).toString(), //订单布匹长度 order_total_price: formatPriceDiv(orderInfo.total_sale_price).toString(), //订单价格 - order_total_num: (orderInfo.total_number) + '', + order_total_num: (orderInfo.total_number).toString(), qrcode:"", //跳转链接 order_total_weight: formatWeightDiv(orderInfo.total_estimate_weight).toString(), //订单布匹重量 list: lists })) } - }, [orderInfo, payInfo]) + }, [orderInfo]) //收货地址 const address = (addressInfo) => { @@ -199,6 +177,5 @@ export default memo(({show = true, onClose, company, orderInfo}:Param) => { - ) }) \ No newline at end of file diff --git a/src/pages/order/index.tsx b/src/pages/order/index.tsx index 280c016..3b79edc 100644 --- a/src/pages/order/index.tsx +++ b/src/pages/order/index.tsx @@ -195,6 +195,7 @@ import styles from './index.module.scss' //支付成功 const onPaySuccess = useCallback(() => { + alert.success('支付成功') getSaleOrderPreView() closePayShow() }, [orderDetail]) diff --git a/src/pages/orderList/components/order/index.tsx b/src/pages/orderList/components/order/index.tsx index 562ee73..17aa283 100644 --- a/src/pages/orderList/components/order/index.tsx +++ b/src/pages/orderList/components/order/index.tsx @@ -73,7 +73,7 @@ export default memo(({value, onClickBtn}: Param) => { //总条数 const numText = useMemo(() => { let total_number_new = value?.sale_mode == 0? value?.total_number:(value?.total_number/100) - return `${value?.total_fabrics}种面料,${value?.total_colors}种颜色,共${total_number_new}${value?.sale_mode == 0? '条':'米'}` + return `${value?.total_fabrics} 种面料,${value?.total_colors} 种颜色,共 ${total_number_new}${value?.sale_mode == 0? ' 条':' 米'}` }, [value]) @@ -113,7 +113,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) + (value.sale_mode == 0?'条':'米')} + ×{formatCount(itemColor, value.sale_mode) + (value.sale_mode == 0?' 条':' 米')} ) }) diff --git a/src/pages/orderList/index copy.tsx b/src/pages/orderList/index copy.tsx deleted file mode 100644 index 66d344b..0000000 --- a/src/pages/orderList/index copy.tsx +++ /dev/null @@ -1,194 +0,0 @@ -import Search from "@/components/search" -import useLogin from "@/use/useLogin" -import { Image, ScrollView, Text, View } from "@tarojs/components" -import Taro, { useDidShow, usePullDownRefresh, useRouter } from "@tarojs/taro" -import { useCallback, useEffect, useMemo, useRef, useState } from "react" -import styles from './index.module.scss' -import classnames from "classnames"; -import Order from "./components/order" -import InfiniteScroll from "@/components/infiniteScroll" -import {GetOrderStatusListApi, GetOrderListApi, OrderStatusListApi} from '@/api/order' -import { dataLoadingStatus, getFilterData } from "@/common/util" -import OrderStatusList from "./components/orderStatusList" -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() - useDidShow(async () => { - await checkLogin() - }) - - //搜索参数 - const [searchField, setSearchField] = useState({ - status: -1, - page : 1, - size : 10, - Name:'' - }) - - //获取订单状态 - const {fetchData: orderStatusListFetchData} = OrderStatusListApi() - const [statusList, setStatusList] = useState([{id: -1, name: '全部'}]) - const getOrderStatusList = () => { - const status = Object.values(ORDER_STATUS).map(item => { - return {id: item.value, name: item.label} - }) - setStatusList((e) => [...e, ...status]) - } - useEffect(() => { - getOrderStatusList() - }, []) - - //获取订单列表 - const {fetchData: listFetchData, state:orderState} = GetOrderListApi() - const [orderData, setOrderData] = useState<{list:any[], total:number}>({list:[], total:0}) - const getOrderList = async () => { - let res = await listFetchData(getFilterData(searchField)) - setOrderData({list: res.data.list, total: res.data.total}) - setRefresherTriggeredStatus(() => false) - } - - - //监听筛选条件变化 - useEffect(() => { - getOrderList() - }, [searchField]) - - //上拉加载数据 - const pageNum = useRef({size: searchField.size, page: searchField.page}) - const getScrolltolower = useCallback(() => { - if(orderData.list.length < orderData.total) { - pageNum.current.page++ - const size = pageNum.current.size * pageNum.current.page - setSearchField({...searchField, size }) - } - }, [orderData]) - - //状态改变 - const changeStatus = useCallback((e) => { - pageNum.current.page = 1 - setSearchField((value) => ({...value, status:e, size:10})) - setOrderData(() => ({list:[], total:0})) - }, []) - - - //数据加载状态 - const statusMore = useMemo(() => { - return dataLoadingStatus({list:orderData.list, total: orderData.total, status: orderState.loading}) - }, [orderData, orderState]) - - //输入了搜索关键字 - const getSearchData = useCallback((e) => { - pageNum.current.page = 1 - setOrderData(() => ({list:[], total:0})) - setSearchField((val) => ({...val, name:e, size:10})) - }, []) - - - //列表下拉刷新 - const [refresherTriggeredStatus, setRefresherTriggeredStatus] = useState(false) - const getRefresherRefresh = async () => { - pageNum.current.size = 1 - setRefresherTriggeredStatus(true) - setSearchField((val) => ({...val, size:10})) - } - - //监听点击的按钮 - const clickOrderBtn = useCallback(({status, orderInfo}) => { - setCallBackPayOrderInfo(() => orderInfo) - if(status == 1 || status == 6) { - getOrderList() - } else if(status == 2) { - //去支付 - toPay() - } else if (status == 3) { - //申请退款 - if(!orderInfo?.av_return_roll) return alert.none('该订单已申请过退款') - setRefundShow(true) - } else if (status == 7) { - //购买 - addShopCart(orderInfo) - } - }, [orderData]) - - - const [callBackOrderInfo, setCallBackPayOrderInfo] = useState() - - //去付款 - const [payMentShow, setPayMentShow] = useState(false) - const toPay = () => { - setPayMentShow(true) - } - //关闭支付弹窗 - const closePayShow = useCallback(() => { - setPayMentShow(() => false) - }, []) - //支付成功 - const onPaySuccess = useCallback(() => { - getOrderList() - closePayShow() - }, []) - - //添加购物车 - const [showCart, setShowCart] = useState(false) - const {fetchData:addFetchData} = AddShoppingCartApi() - const addShopCart = async (item) => { - let color_list:{product_color_id: number, roll?: number, length?: number}[] = [] - item?.product_list.map(pitem => { - pitem?.product_colors.map(citem => { - if(item?.sale_mode == 0) { - return color_list.push({product_color_id: citem.id, roll: citem.roll}) - } else { - return color_list.push({product_color_id: citem.id, length: citem.length}) - } - }) - }) - const state = await addFetchData({ - sale_mode: item?.sale_mode, - color_list - }) - if(state.success) { - Taro.showToast({ - title:'已加入购物车' - }) - setShowCart(true) - } else { - Taro.showToast({ - icon:'none', - title: state.msg - }) - } - - } - - //申请退款 - const [refundShow, setRefundShow] = useState(false) - const applyRefundClose = useCallback(() => { - setRefundShow(false) - }, []) - - - return ( - - - - - - - - {orderData?.list.map(item => { - return - })} - - - - setShowCart(false)}/> - - - ) -} diff --git a/src/pages/salesAfter/components/kindList/index.tsx b/src/pages/salesAfter/components/kindList/index.tsx index 3129cc2..149de15 100644 --- a/src/pages/salesAfter/components/kindList/index.tsx +++ b/src/pages/salesAfter/components/kindList/index.tsx @@ -49,10 +49,10 @@ export default memo(({order, comfirm = false}:Param) => { if(order) { if(!order?.quality_check_pass_fabrics&&!order?.quality_check_pass_number&&!order?.quality_check_pass_colors) { let total_number = order?.sale_mode == 0?order?.total_number:(order?.total_number/100) - return `${order?.total_fabrics}种面料,${order?.total_colors}种颜色,共${total_number}${order?.unit}` + return `${order?.total_fabrics} 种面料,${order?.total_colors} 种颜色,共 ${total_number} ${order?.unit}` } else { let total_number = order?.sale_mode == 0?order?.quality_check_pass_number:(order?.quality_check_pass_number/100) - return `${order?.quality_check_pass_fabrics}种面料,${order?.quality_check_pass_colors}种颜色,共${total_number}${order?.unit}` + return `${order?.quality_check_pass_fabrics} 种面料,${order?.quality_check_pass_colors} 种颜色,共 ${total_number} ${order?.unit}` } } }, [order]) diff --git a/src/pages/salesAfterList/components/order/index.tsx b/src/pages/salesAfterList/components/order/index.tsx index 7c7f1eb..3232e6c 100644 --- a/src/pages/salesAfterList/components/order/index.tsx +++ b/src/pages/salesAfterList/components/order/index.tsx @@ -71,7 +71,7 @@ export default memo(({value, onClickBtn}: Param) => { const numText = useMemo(() => { let total_number_new = value?.sale_mode == 0? value?.total_number:(value?.total_number/100) - return `${value?.total_fabrics}种面料,${value?.total_colors}种颜色,共${total_number_new}${value?.sale_mode == 0? '条':'米'}` + return `${value?.total_fabrics} 种面料,${value?.total_colors} 种颜色,共 ${total_number_new}${value?.sale_mode == 0? ' 条':' 米'}` }, [value]) //售后单状态 @@ -119,11 +119,11 @@ export default memo(({value, onClickBtn}: Param) => { ) }) } - + {value?.product_list?.[0].product_colors.length > 2 && …… …… …… - + } {numText} diff --git a/src/pages/salesAfterList/index copy.tsx b/src/pages/salesAfterList/index copy.tsx deleted file mode 100644 index 6cc25ea..0000000 --- a/src/pages/salesAfterList/index copy.tsx +++ /dev/null @@ -1,124 +0,0 @@ -import Search from "@/components/search" -import useLogin from "@/use/useLogin" -import { Image, ScrollView, Text, View } from "@tarojs/components" -import Taro, { useDidShow, usePullDownRefresh, useRouter } from "@tarojs/taro" -import { useCallback, useEffect, useMemo, useRef, useState } from "react" -import styles from './index.module.scss' -import classnames from "classnames"; -import Order from "./components/order" -import InfiniteScroll from "@/components/infiniteScroll" -import { dataLoadingStatus, getFilterData } from "@/common/util" -import OrderStatusList from "./components/orderStatusList" -import { AFTER_ORDER_STATUS } from "@/common/enum" -import { GetSaleOrderListApi } from "@/api/salesAfterOrder" -import ReturnLogistics from "./components/returnLogistics" - -export default () => { - const {checkLogin} = useLogin() - useDidShow(async () => { - await checkLogin() - }) - - //搜索参数 - const [searchField, setSearchField] = useState({ - status: -1, - page : 1, - size : 10, - Name:'' - }) - - //获取订单状态 - const [statusList, setStatusList] = useState([{id: -1, name: '全部'}]) - const getOrderStatusList = () => { - const status = Object.values(AFTER_ORDER_STATUS).map(item => { - return {id: item.value, name: item.label} - }) - setStatusList((e) => [...e, ...status]) - } - useEffect(() => { - getOrderStatusList() - }, []) - - //获取订单列表 - const {fetchData: listFetchData, state:orderState} = GetSaleOrderListApi() - const [orderData, setOrderData] = useState<{list:any[], total:number}>({list:[], total:0}) - const getOrderList = async () => { - let res = await listFetchData(getFilterData(searchField)) - setOrderData({list: res.data.list, total: res.data.total}) - setRefresherTriggeredStatus(() => false) - } - - - //监听筛选条件变化 - useEffect(() => { - getOrderList() - }, [searchField]) - - //上拉加载数据 - const pageNum = useRef({size: searchField.size, page: searchField.page}) - const getScrolltolower = useCallback(() => { - if(orderData.list.length < orderData.total) { - pageNum.current.page++ - const size = pageNum.current.size * pageNum.current.page - setSearchField({...searchField, size }) - } - }, [orderData]) - - //状态改变 - const changeStatus = useCallback((e) => { - pageNum.current.page = 1 - setSearchField((value) => ({...value, status:e, size:10})) - setOrderData(() => ({list:[], total:0})) - }, []) - - - //数据加载状态 - const statusMore = useMemo(() => { - return dataLoadingStatus({list:orderData.list, total: orderData.total, status: orderState.loading}) - }, [orderData, orderState]) - - //输入了搜索关键字 - const getSearchData = useCallback((e) => { - pageNum.current.page = 1 - setOrderData(() => ({list:[], total:0})) - setSearchField((val) => ({...val, name:e, size:10})) - }, []) - - - //列表下拉刷新 - const [refresherTriggeredStatus, setRefresherTriggeredStatus] = useState(false) - const getRefresherRefresh = async () => { - pageNum.current.size = 1 - setRefresherTriggeredStatus(true) - setSearchField((val) => ({...val, size:10})) - } - - //监听点击的按钮 - const clickOrderBtn = useCallback(({status, orderInfo}) => { - if(status == 2) { - //退货物流 - - } - }, [orderData]) - - //物流显示 - const [logisticsShow, setLogisticsShow] = useState(false) - const onCloseLogistics = useCallback(() => setLogisticsShow(false), []) - - return ( - - - - - - - - {orderData?.list.map(item => { - return - })} - - - - - ) -} diff --git a/src/pages/searchList/search.tsx b/src/pages/searchList/search.tsx index 93f1ac5..dffa3ce 100644 --- a/src/pages/searchList/search.tsx +++ b/src/pages/searchList/search.tsx @@ -1,5 +1,5 @@ -import { View } from '@tarojs/components' +import { Text, View } from '@tarojs/components' import Search from '@/components/search' import { alert, goLink } from '@/common/common'; import classnames from "classnames"; @@ -80,7 +80,7 @@ export default () => { {searchData?.historyField.length > 0 && 历史搜索 - + {searchData?.historyField?.map((item, index) => searchEvent(item.search_key, false)}>{item.search_key})}