diff --git a/src/components/BottomBtns/index.tsx b/src/components/BottomBtns/index.tsx index c80ac50..d942ad0 100644 --- a/src/components/BottomBtns/index.tsx +++ b/src/components/BottomBtns/index.tsx @@ -45,7 +45,9 @@ export default memo((props: prosObj) => { (obj.sale_mode === 1 && obj.status === 10) || (obj.sale_mode === 2 && obj.status === 10) || (obj.sale_mode === 2 && obj.status === 0 && (obj.collect_status == 1 || obj.collect_status == 2)) || - (obj.sale_mode === 2 && obj.status === 0 && obj.collect_status == 0) + (obj.sale_mode === 2 && obj.status === 0 && obj.collect_status == 0) || + (obj.sale_mode === 1 && obj.status === 10) || + (obj.sale_mode === 2 && obj.status === 10) ) { return true } else return false @@ -73,7 +75,9 @@ export default memo((props: prosObj) => { (obj.sale_mode === 0 && obj.status === 9 && obj.collect_status == 1) || (obj.sale_mode === 0 && obj.status === 9 && obj.collect_status == 0) || (obj.sale_mode === 2 && obj.status === 2) || - (obj.sale_mode === 2 && obj.status === 7) + (obj.sale_mode === 2 && obj.status === 7) || + (obj.sale_mode === 1 && obj.status === 10) || + (obj.sale_mode === 2 && obj.status === 10) ) { return true } else return false diff --git a/src/components/goodsItem/index.tsx b/src/components/goodsItem/index.tsx index e87884e..f4394a2 100644 --- a/src/components/goodsItem/index.tsx +++ b/src/components/goodsItem/index.tsx @@ -43,8 +43,8 @@ export default memo((props: props) => { } } if (props.modeFont == 2) { - if (Number(res) == 0 || Number(res) < 3) { - setValue({ count: 3 }) + if (Number(res) < 3) { + setValue({ count: '' }) } } } diff --git a/src/pages/applyMoney/index.module.scss b/src/pages/applyMoney/index.module.scss index 4267754..4629514 100644 --- a/src/pages/applyMoney/index.module.scss +++ b/src/pages/applyMoney/index.module.scss @@ -1,5 +1,277 @@ .main {} +.bgBox { + margin: 24px; + background: #FFFFFF; + border-radius: 16px; + overflow: hidden; +} + + + +.goodsBox { + margin-top: 24px; + overflow: hidden; + border-bottom: 8px solid #F7F7F7; + + .goodsProduct { + font-size: 28px; + font-family: PingFangSC-Medium, PingFang SC; + font-weight: 500; + color: #000000; + margin-left: 32px; + } + + .goodsLine { + width: 638px; + height: 1px; + background: #000000; + opacity: 0.1; + margin-left: 32px; + margin-top: 24px; + } + + .itemGoods { + margin-top: 24px; + display: flex; + + .itemPic { + margin-left: 32px; + margin-right: 42px; + width: 108px; + height: 108px; + background: #322F2F; + border-radius: 8px; + } + + .itemRight { + padding-bottom: 24px; + width: 495px; + border-bottom: 1px solid #f7f7f7; + + .item_right_top { + margin-bottom: 41px; + display: flex; + align-items: center; + justify-content: space-between; + + .itemName { + font-size: 28px; + font-family: PingFangSC-Regular, PingFang SC; + font-weight: 400; + color: #000000; + } + + .itemNums { + font-size: 28px; + font-family: PingFangSC-Regular, PingFang SC; + font-weight: 400; + color: #000000; + } + } + + .item_right_Bottom { + display: flex; + align-items: center; + justify-content: space-between; + + .itemMoney { + font-size: 28px; + font-family: PingFangSC-Regular, PingFang SC; + font-weight: 400; + color: #000000; + } + + .itemMoneyOne { + font-size: 28px; + font-family: PingFangSC-Medium, PingFang SC; + font-weight: 500; + color: #000000; + } + + .btn { + width: 120px; + height: 64px; + border-radius: 8px; + border: 1px solid #337FFF; + font-size: 28px; + font-weight: 400; + color: #337FFF; + text-align: center; + line-height: 64px; + } + + .btnOne { + width: 204px; + height: 64px; + border-radius: 8px; + border: 1px solid #337FFF; + font-size: 28px; + font-weight: 400; + color: #337FFF; + text-align: center; + line-height: 64px; + } + + .inputBox { + width: 189px; + height: 64px; + border-radius: 8px; + border: 1px solid #337FFF; + display: flex; + + .redceBox { + width: 64px; + height: 64px; + border-radius: 8px 0px 0px 8px; + border-right: 1px solid #337FFF; + display: flex; + align-items: center; + justify-content: center; + + .reduce { + width: 20px; + height: 2px; + background: #337FFF; + } + } + + .inputBig { + width: 61px; + height: 64px; + display: flex; + align-items: center; + justify-content: center; + text-align: center; + font-size: 24px; + font-weight: 400; + color: #337FFF; + } + + .addBox { + width: 64px; + height: 64px; + border-left: 1px solid #337FFF; + display: flex; + align-items: center; + justify-content: center; + font-size: 40px; + color: #337FFF; + } + } + } + } + + + } + + .itemGoods:last-child { + margin-top: 24px; + display: flex; + + .itemPic { + margin-left: 32px; + margin-right: 42px; + width: 108px; + height: 108px; + background: #322F2F; + border-radius: 8px; + } + + .itemRight { + padding-bottom: 24px; + width: 495px; + border-bottom: none; + + .item_right_top { + margin-bottom: 41px; + display: flex; + align-items: center; + justify-content: space-between; + + .itemName { + font-size: 28px; + font-family: PingFangSC-Regular, PingFang SC; + font-weight: 400; + color: #000000; + } + + .itemNums { + font-size: 28px; + font-family: PingFangSC-Regular, PingFang SC; + font-weight: 400; + color: #000000; + } + } + + .item_right_Bottom { + display: flex; + align-items: center; + justify-content: space-between; + + .itemMoney { + font-size: 28px; + font-family: PingFangSC-Regular, PingFang SC; + font-weight: 400; + color: #000000; + } + + .itemMoneyOne { + font-size: 28px; + font-family: PingFangSC-Medium, PingFang SC; + font-weight: 500; + color: #000000; + } + + .btn { + width: 120px; + height: 64px; + border-radius: 8px; + border: 1px solid #337FFF; + font-size: 28px; + font-weight: 400; + color: #337FFF; + text-align: center; + line-height: 64px; + } + + .btnOne { + width: 204px; + height: 64px; + border-radius: 8px; + border: 1px solid #337FFF; + font-size: 28px; + font-weight: 400; + color: #337FFF; + text-align: center; + line-height: 64px; + } + } + } + + + } +} + +.goodsBox { + border-bottom: none; +} + +.hasSelect { + margin-left: 32px; + margin-right: 32px; + height: 54px; + background: #FEF9F4; + border-radius: 8px; + display: flex; + align-items: center; + font-size: 24px; + font-weight: 600; + color: #F79B31; + padding-left: 20px; + margin-bottom: 24px; +} + .resonBig { overflow: hidden; margin: 24px; diff --git a/src/pages/applyMoney/index.tsx b/src/pages/applyMoney/index.tsx index 644b526..17dd7ad 100644 --- a/src/pages/applyMoney/index.tsx +++ b/src/pages/applyMoney/index.tsx @@ -5,6 +5,7 @@ import classnames from "classnames"; import Taro, { faceVerifyForPay, useDidShow, useRouter } from '@tarojs/taro' import { formatDateTime, formatHashTag, formatImgUrl, formatPriceDiv, formatWeightDiv } from '@/common/format' import { + mpsaleOrder, mpreturnApplyOrder, mpenumrefundExplainone, } from "@/api/order" @@ -14,9 +15,116 @@ import Popup from '@/components/popup' export default () => { useEffect(() => { + getDetail() getEnum() }, []) const Router = useRouter() + const { fetchData: infoFetch } = mpsaleOrder() + const [ListArr, setListArr] = useState([]) + const [infoObj, setInfoObj] = useState({}) + + //获取订单详情 + const getDetail = async () => { + Taro.showLoading({ + title: '请稍等...', + mask: true + }) + const res = await infoFetch({ id: Router.params.orderId }) + if (res.data) { + res.data.av_return_product.forEach(item => { + item.av_product_color.map(it => { + it.isTui = false + it.nums = 1 + }) + return item + }) + setInfoObj(res.data) + setListArr(res.data.av_return_product) + Taro.hideLoading() + } + } + + //点击退货 + const handTui = (val) => { + let res = ListArr + res.forEach(item => { + item.av_product_color?.map(it => { + if (it.sale_order_detail_id == val.sale_order_detail_id) { + it.isTui = true + } + return it + }) + + }) + setListArr([...res]) + + } + //点击取消退货 + const handCancel = (val) => { + ListArr.forEach(item => { + item.av_product_color.map(it => { + if (it.sale_order_detail_id === val.sale_order_detail_id) { + it.isTui = false + } + return it + }) + }) + setListArr([...ListArr]) + } + + //点击减 + const handReduce = (val) => { + ListArr.forEach(item => { + item.av_product_color.map(it => { + if (it.sale_order_detail_id === val.sale_order_detail_id) { + if (val.nums === 1) { + it.isTui = false + it.nums = 1 + } else { + it.nums-- + } + } + return it + }) + }) + setListArr([...ListArr]) + } + + const onInputEven = (e, val) => { + ListArr.forEach(item => { + item.av_product_color.map(it => { + if (it.sale_order_detail_id === val.sale_order_detail_id) { + if (Number(e.detail.value) < 1) { + it.nums = 1 + } else { + it.nums = Number(e.detail.value) + } + if (Number(e.detail.value) > it.roll) { + it.nums = 1 + } + } + return it + }) + }) + setListArr([...ListArr]) + } + + //点击加 + const handAdd = (val) => { + ListArr.forEach(item => { + item.av_product_color.map(it => { + if (it.sale_order_detail_id === val.sale_order_detail_id) { + if (it.nums < it.roll) { + it.nums++ + } else { + return + } + } + return it + }) + }) + setListArr([...ListArr]) + } //获取枚举 const [List, setList] = useState([]) @@ -74,6 +182,18 @@ export default () => { setshowPopup(false) } + const totalNums = useMemo(() => { + const arr: any[] = [] + ListArr.forEach(item => { + item.av_product_color.forEach(it => { + if (it.isTui) { + arr.push(it) + } + }) + }) + return arr.length + }, [ListArr]) + //重置 const handReset = () => { setQuery(({ reasonId: '', reasonName: '请选择' })) @@ -91,6 +211,26 @@ export default () => { } }, [Query]) + //判断是否允许提交 + const canTui = useMemo(() => { + if (totalNums > 0 && Query.reasonId !== '') { + return false + } else { + return true + } + + }, [Query, totalNums]) + + const noGoods = useMemo(() => { + if (Query.reasonId !== '') { + return false + } else { + return true + } + + }, [Query]) + + //数组重置 const resetArr = (arr) => { arr.map(it => { @@ -102,15 +242,47 @@ export default () => { //确认退款 const { fetchData: sureFetch } = mpreturnApplyOrder() const handSure = () => { + let arr: any = []; + if (infoObj.sale_mode == 0 && infoObj.status == 9) { + ListArr.forEach((item) => { + item.av_product_color.forEach((it) => { + if (it.isTui) { + arr.push({ + product_color_id: it.sale_mode == 0 ? it.product_color_id : '', + product_id: it.sale_mode == 0 ? it.product_id : '', + product_roll: it.sale_mode == 0 ? it.nums : 0, + sale_order_detail_id: it.sale_order_detail_id, + }); + } + + }); + }); + } + if ((infoObj.sale_mode == 1 && infoObj.status == 9) || (infoObj.sale_mode == 2 && infoObj.status == 9)) { + ListArr.forEach((item) => { + item.av_product_color.forEach((it) => { + if (it.isTui) { + arr.push({ + product_color_id: it.product_color_id, + product_id: it.product_id, + product_roll: 0, + sale_order_detail_id: it.sale_order_detail_id, + }); + } + + }); + }); + } const query = { reason_describe: TextareaValue, fabric_piece_accessory_url: [], goods_status: 100, return_explain: Query.reasonId, roll: 0, - roll_list: [], + roll_list: arr, sale_order_id: Number(Router.params.orderId), }; + console.log(query, 888) Taro.showModal({ content: "确认退款吗?", confirmText: "确认", @@ -141,12 +313,38 @@ export default () => { }) } + + + const showItem = useMemo(() => { + if ((infoObj.sale_mode == 0 && infoObj.status == 9) || (infoObj.sale_mode == 1 && infoObj.status == 9) || (infoObj.sale_mode == 2 && infoObj.status == 9)) { + return true + } else { + return false + } + + }, [infoObj]) + return ( + { + showItem && + handTui(item)} + handCancel={(item) => handCancel(item)} + // onBlur={(e, item) => onBlur(e, item)} + handReduce={(item) => handReduce(item)} + handAdd={(item) => handAdd(item)} + onInputEven={(e, item) => onInputEven(e, item)} + > + 汇总:已选{totalNums}种商品 + + } { setshowPopup(true) }}> - 退货原因 + 退款原因 * { Query.reasonName === '请选择' && 请选择 @@ -175,7 +373,14 @@ export default () => { - + { + showItem && + + } + { + !showItem && + + } { setshowPopup?.(false) }}> @@ -203,4 +408,84 @@ export default () => { ) -} \ No newline at end of file +} + + + +//产品商品元素 +interface PropGoods { + list: any[], + obj: { + sale_mode?: number | string + }, + handTui?: (any) => void, + handCancel?: (any) => void, + onBlur?: (e: any, obj: any) => void, + onInputEven?: (e: any, obj: any) => void, + handReduce?: (any) => void, + handAdd?: (any) => void, +} +const GoodsItem = memo((porps: PropGoods) => { + const { list = [], obj = {}, handTui, handCancel, onBlur, handReduce, handAdd, onInputEven } = porps + // const [value, setValue] = useState({ count: 1 }) + // const onInputEven = (e) => { + // let res = Number(e.detail.value) + // if (res < 1) { + // setValue({ count: 1 }) + // } else { + // setValue({ count: res }) + // } + // } + + return ( + <> + { + list.map((item, index) => { + return ( + + {item.product_code}# {item.product_name} + + { + item.av_product_color.map((it, inx) => { + return ( + + + + + {it.product_color_code} {it.product_color_name} + + + x{obj?.sale_mode === 0 ? it.roll : it.length / 100}{obj?.sale_mode === 0 ? '条' : 'm'} + { + !it.isTui && handTui?.(it)}>退货 + } + { + (it.sale_mode != 0 && it.isTui) && handCancel?.(it)}>已选择退货 + } + { + (it.sale_mode == 0 && it.isTui) && + handReduce?.(it)}> + + + + onInputEven?.(e, it)} maxlength={it.roll} onBlur={(e) => onBlur?.(e, it)}> + + handAdd?.(it)}> + + + + + } + + + + ) + }) + } + + ) + }) + } + + + ) +}) \ No newline at end of file diff --git a/src/pages/index/index.tsx b/src/pages/index/index.tsx index 54b323a..06f04e1 100644 --- a/src/pages/index/index.tsx +++ b/src/pages/index/index.tsx @@ -273,7 +273,11 @@ export default () => { } else if (search.modeId == 1 && Number(e.detail.value) >= 0.5) { item.nums = e.detail.value } - if (search.modeId == 2) { + if (search.modeId == 2 && Number(e.detail.value) < 3) { + item.nums = 3 + item.showInput = false + + } else if (search.modeId == 2 && Number(e.detail.value) >= 3) { item.nums = e.detail.value } diff --git a/src/pages/order/components/itemList/index.tsx b/src/pages/order/components/itemList/index.tsx index 2992d88..5d3cf43 100644 --- a/src/pages/order/components/itemList/index.tsx +++ b/src/pages/order/components/itemList/index.tsx @@ -21,6 +21,22 @@ export default memo((props: propsObj) => { }) } + const monyFont = useMemo(() => { + if (props?.obj.status == 0 || props?.obj.status == 1 || props?.obj.status == 2) { + return '预估金额:' + } else { + return '合计金额:' + } + }, [props?.obj]) + + const totalMoney = useMemo(() => { + if (props?.obj.status == 0 || props?.obj.status == 1 || props?.obj.status == 2) { + return props?.obj?.estimate_amount + } else { + return props?.obj?.bill_total_sale_price + } + }, [props?.obj]) + return ( navTo(e)}> @@ -65,10 +81,12 @@ export default memo((props: propsObj) => { 布料信息: {props?.obj?.total_fabrics} 种面料,{props?.obj?.total_colors} 种颜色,共 {props?.obj?.sale_mode === 0 ? props?.obj?.total_number : props?.obj?.total_number / 100} {props?.obj?.sale_mode === 0 ? '条' : 'm'} - - 预估金额: - ¥{formatPriceDiv(props?.obj?.estimate_amount)} - + { + props?.obj.status != 5 && + {monyFont} + ¥{formatPriceDiv(totalMoney)} + + } { //申请退款 const handApplyMoney = () => { + Taro.navigateTo({ url: '/pages/applyMoney/index?orderId=' + infoObj.id }) @@ -586,6 +587,14 @@ export default () => { useEffect(() => { setInfoObj(infoObj) }, [infoObj]) + const showRemarkFont = useMemo(() => { + if (infoObj.status === 10 || infoObj.status == 0 || infoObj.status == 1 || infoObj.status == 2 || infoObj.status == 7) { + return `${'填写/修改备注'} >` + } else { + return '' + } + }, [infoObj]) + return ( {(infoObj?.status != 10 && )} @@ -616,7 +625,7 @@ export default () => { 合计金额 - {formatPriceDiv(infoObj.total_should_collect_money)} + {formatPriceDiv(infoObj.bill_total_sale_price)} @@ -653,12 +662,9 @@ export default () => { } - { - (infoObj.status != 11 && infoObj.status != 3 && infoObj.status != 8 && infoObj.status != 9 && infoObj.status != 4 - ) && `} clickNode={() => setShowDesc(true)}> - {infoObj.remark === '' ? '暂无' : infoObj.remark} - - } + setShowDesc(showRemarkFont != '' ? true : false)}> + {infoObj.remark === '' ? '暂无' : infoObj.remark} + setShowDesc(false)}> diff --git a/src/pages/refundDetail/components/addressDetailBox/index.tsx b/src/pages/refundDetail/components/addressDetailBox/index.tsx index 196395a..f266bf3 100644 --- a/src/pages/refundDetail/components/addressDetailBox/index.tsx +++ b/src/pages/refundDetail/components/addressDetailBox/index.tsx @@ -2,7 +2,7 @@ import { Image, Text, View } from "@tarojs/components"; import { memo, useEffect, useMemo, useRef, useState } from "react"; import classnames from "classnames"; import styles from './index.module.scss' - +import IconFont from '@/components/iconfont/iconfont' interface propsObj { receivingStatus?: Number | null, onReceivingStatus?: (any, Number) => void, @@ -29,7 +29,7 @@ export default memo((props: propsObj) => { 请按以下退货地址寄回货物并提供退货物流信息 - + {'广东省佛山市禅城区陆盈纺织仓库'} diff --git a/src/pages/refundDetail/components/orderState/index.tsx b/src/pages/refundDetail/components/orderState/index.tsx index 97121a2..a2dbd37 100644 --- a/src/pages/refundDetail/components/orderState/index.tsx +++ b/src/pages/refundDetail/components/orderState/index.tsx @@ -35,8 +35,12 @@ export default memo(({ orderInfo = { logistics_details: [], payment_method: 0, s setShowMore(() => !showMore) } const dataList = useMemo(() => { - console.log(orderInfo.logistics_details ? orderInfo?.logistics_details.reverse() : [],'5555') - return orderInfo.logistics_details ? orderInfo?.logistics_details.reverse() : [] + let arr = orderInfo?.logistics_details + if (orderInfo.logistics_details) { + return arr.reverse() + } else { + return [] + } }, [orderInfo.logistics_details]) diff --git a/src/pages/refundDetail/index.tsx b/src/pages/refundDetail/index.tsx index d23fbda..076dac0 100644 --- a/src/pages/refundDetail/index.tsx +++ b/src/pages/refundDetail/index.tsx @@ -253,6 +253,16 @@ export default () => { DeatailObj?.sale_mode == 0 ? DeatailObj?.return_roll : DeatailObj?.total_number / 100 } {DeatailObj?.sale_mode == 0 ? "条" : "米"} + { + (DeatailObj.stage == 3) && + + 退款金额 + ¥{ + formatPriceDiv(DeatailObj.refund_amount) + } + + + } { diff --git a/src/pages/refundMoneyDetail/components/orderState/index.tsx b/src/pages/refundMoneyDetail/components/orderState/index.tsx index 97121a2..a2dbd37 100644 --- a/src/pages/refundMoneyDetail/components/orderState/index.tsx +++ b/src/pages/refundMoneyDetail/components/orderState/index.tsx @@ -35,8 +35,12 @@ export default memo(({ orderInfo = { logistics_details: [], payment_method: 0, s setShowMore(() => !showMore) } const dataList = useMemo(() => { - console.log(orderInfo.logistics_details ? orderInfo?.logistics_details.reverse() : [],'5555') - return orderInfo.logistics_details ? orderInfo?.logistics_details.reverse() : [] + let arr = orderInfo?.logistics_details + if (orderInfo.logistics_details) { + return arr.reverse() + } else { + return [] + } }, [orderInfo.logistics_details]) diff --git a/src/pages/refundMoneyDetail/index.tsx b/src/pages/refundMoneyDetail/index.tsx index e34801a..2b4e2aa 100644 --- a/src/pages/refundMoneyDetail/index.tsx +++ b/src/pages/refundMoneyDetail/index.tsx @@ -213,32 +213,32 @@ export default () => { DeatailObj.stage == 0 && 合计金额 - { + ¥{ formatPriceDiv(DeatailObj.total_refund_amount) } } { - (DeatailObj.stage == 5 || DeatailObj.stage == 6) && + (DeatailObj.stage == 3) && 退款金额 - { + ¥{ formatPriceDiv(DeatailObj.refund_amount) } } { - (DeatailObj.stage == 5 || DeatailObj.stage == 6) && + (DeatailObj.stage == 3) && 其他扣除金额 - { + ¥{ formatPriceDiv(DeatailObj.other_deduction_amount) } } { - (DeatailObj.stage == 5 || DeatailObj.stage == 6) && + (DeatailObj.stage == 3) && 退款去向 { - formatPriceDiv(DeatailObj.refund_flow_name) + DeatailObj.refund_flow_name } } diff --git a/src/pages/refundPage/components/itemList/index.tsx b/src/pages/refundPage/components/itemList/index.tsx index 56556f2..12f663e 100644 --- a/src/pages/refundPage/components/itemList/index.tsx +++ b/src/pages/refundPage/components/itemList/index.tsx @@ -100,7 +100,7 @@ export default memo((props: propsObj) => { (props?.obj.stage == 5 || props?.obj.stage == 6 || props?.obj.stage == 3) && 退款金额: - ¥{formatPriceDiv(props?.obj?.refundable_amount)} + ¥{formatPriceDiv(props?.obj?.refund_amount)} } diff --git a/src/pages/searchPage/index.tsx b/src/pages/searchPage/index.tsx index 04ef636..f92be5d 100644 --- a/src/pages/searchPage/index.tsx +++ b/src/pages/searchPage/index.tsx @@ -274,6 +274,7 @@ export default memo(() => { if (search.modeId == 0 && (e.detail.value == '' || Number(e.detail.value) == 0)) { item.showInput = false item.nums = 1 + } else if (search.modeId == 0 && (e.detail.value != '' || Number(e.detail.value) > 0)) { item.nums = e.detail.value } @@ -283,7 +284,11 @@ export default memo(() => { } else if (search.modeId == 1 && Number(e.detail.value) >= 0.5) { item.nums = e.detail.value } - if (search.modeId == 2) { + if (search.modeId == 2 && Number(e.detail.value) < 3) { + item.nums = 3 + item.showInput = false + + } else if (search.modeId == 2 && Number(e.detail.value) >= 3) { item.nums = e.detail.value }