diff --git a/src/api/salesAfterOrder.ts b/src/api/salesAfterOrder.ts new file mode 100644 index 0000000..6b9472b --- /dev/null +++ b/src/api/salesAfterOrder.ts @@ -0,0 +1,22 @@ +import { useRequest } from "@/use/useHttp" + +/** + * 售后订单列表 + */ +export const GetHotSearchApi = () => { + return useRequest({ + url: `/v1/mall/hotSearch/list`, + method: "get", + }) +} + +/** + * 申请售后订单列表 + */ + export const ReturnApplyOrderApi = () => { + return useRequest({ + url: `/v1/mall/returnApplyOrder`, + method: "get", + }) +} + diff --git a/src/api/user.ts b/src/api/user.ts index 345c9c7..7d7c97f 100644 --- a/src/api/user.ts +++ b/src/api/user.ts @@ -60,3 +60,12 @@ import { useRequest } from "@/use/useHttp" }) } +/** + * 绑定公司 + */ + export const BindingCompanyApi = () => { + return useRequest({ + url: `/v1/mall/user/binding/company`, + method: "put", + }) +} \ No newline at end of file diff --git a/src/common/constant.js b/src/common/constant.js index a845430..d470ae0 100644 --- a/src/common/constant.js +++ b/src/common/constant.js @@ -6,12 +6,12 @@ // 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.30:40001/lymarket` // 发 -export const BASE_URL = `http://192.168.1.30:50001/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.5:40001/lymarket` // 王霞 // export const BASE_URL = `http://192.168.1.224:50001/lymarket` // 添 -// export const BASE_URL = `http://192.168.1.15:50001/lymarket` // 杰 +export const BASE_URL = `http://192.168.1.15:50001/lymarket` // 杰 // CDN // 生成密钥 diff --git a/src/components/counter/index.module.scss b/src/components/counter/index.module.scss index fe96cca..2748cef 100644 --- a/src/components/counter/index.module.scss +++ b/src/components/counter/index.module.scss @@ -4,19 +4,25 @@ align-items: center; justify-content: space-between; width: 100%; - .reduce, .plus{ - font-size: $font_size_big; + .plus{ color: $color_main; width: 46px; height: 46px; - display: flex; - align-items: center; - justify-content:center; + text-align: center; + line-height: 43px; font-size: 50px; background-color: $color_main; color: #fff; border-radius: 8px; } + .reduce { + font-size: 50px; + width: 46px; + height: 46px; + text-align: center; + line-height: 43px; + color:#007AFF; + } .input{ display: flex; align-items: flex-end; @@ -25,10 +31,13 @@ box-sizing: border-box; width: 106px; border-radius: 10px; + input{ + font-size: $font_size_medium; + text-align: right; + padding-right: 10px; + } } - input{ - font-size: $font_size_medium; - } + .unit{ font-size: $font_size_min; color: $color_font_two; diff --git a/src/components/counter/index1.module.scss b/src/components/counter/index1.module.scss new file mode 100644 index 0000000..fe96cca --- /dev/null +++ b/src/components/counter/index1.module.scss @@ -0,0 +1,37 @@ + +.main{ + display: flex; + align-items: center; + justify-content: space-between; + width: 100%; + .reduce, .plus{ + font-size: $font_size_big; + color: $color_main; + width: 46px; + height: 46px; + display: flex; + align-items: center; + justify-content:center; + font-size: 50px; + background-color: $color_main; + color: #fff; + border-radius: 8px; + } + .input{ + display: flex; + align-items: flex-end; + background-color: #fff; + padding: 5px 10px; + box-sizing: border-box; + width: 106px; + border-radius: 10px; + } + input{ + font-size: $font_size_medium; + } + .unit{ + font-size: $font_size_min; + color: $color_font_two; + } + +} \ No newline at end of file diff --git a/src/components/counter/index1.tsx b/src/components/counter/index1.tsx new file mode 100644 index 0000000..d7f632d --- /dev/null +++ b/src/components/counter/index1.tsx @@ -0,0 +1,111 @@ +import { Input, View } from "@tarojs/components" +import { useEffect, useMemo, useRef, useState } from "react" +import Big from 'big.js' +import styles from "./index.module.scss" +type params = { + minNum?: number, //最小值 + maxNum?: number, //最大值 + step?: number, //步长 + defaultNum?: number, //默认值 + digits?: number //多少位小数 + onChange?:(val:number) => void, + onBlue?:(val:number) => void, //失去焦点触发 + onClickBtn?:(val:number) => void, + unit?: string +} +export default ({minNum = 0, maxNum = 100, step=1, digits = 0, defaultNum = 0, onChange, onBlue, onClickBtn, unit = ''}: params) => { + const [value, setValue] = useState({count:defaultNum}) + + const onPlus = () => { + let {count} = value + let num_res = Big(count).add(step).toNumber() + num_res = num_res >= maxNum?maxNum:num_res + num_res = formatDigits(num_res) + setValue({...value, count:num_res}) + onChange?.(parseFloat(num_res)) + onClickBtn?.(parseFloat(num_res)) + } + const minus = () => { + let {count} = value + let num_res = Big(count).minus(step).toNumber() + num_res = num_res < minNum?0:num_res + setValue({...value, count:num_res}) + onChange?.(parseFloat(num_res)) + onClickBtn?.(parseFloat(num_res)) + } + + //保留小数 + const formatDigits = (num) => { + num = num + '' + if(num.includes('.')&&digits > 0) { + console.log('num::',num.includes('.')) + let res = num.split('.') + let last_num = res[1].substr(0, digits) + return res[0] + '.' + last_num + } + return parseFloat(num) + } + + //检查数据 + const checkData = (val) => { + let num = parseFloat(val) + if(num > maxNum) return maxNum + if(num < minNum) return minNum + return val + } + + + const onInputEven = (e) => { + let res = e.detail.value + if(res === '') { + setValue({...value, count:minNum}) + onChange?.(minNum) + } + else if(!isNaN(Number(res))) { + let count = formatDigits(res) + count = checkData(count) + setValue({...value, count}) + onChange?.(parseFloat(count as string)) + } else { + let num = parseFloat(res) + if(!isNaN(num)) { + let count = formatDigits(num) + count = checkData(count) + setValue({...value, count}) + onChange?.(count as number) + } else { + setValue({...value, count:defaultNum}) + onChange?.(defaultNum) + } + + } + } + + const onBluerEven = () => { + let num = parseFloat(value.count) + if(!isNaN(num)) { + let count = formatDigits(num) + count = checkData(count) + setValue({...value, count}) + onBlue?.(count as number) + } else { + setValue({...value, count:defaultNum}) + onBlue?.(defaultNum) + } + } + return ( + + minus()}>- + + + {unit} + + onPlus()}>+ + + ) +} \ No newline at end of file diff --git a/src/components/orderBtns/index.tsx b/src/components/orderBtns/index.tsx index 90fe9be..a18dde6 100644 --- a/src/components/orderBtns/index.tsx +++ b/src/components/orderBtns/index.tsx @@ -125,9 +125,14 @@ export default memo(({orderInfo, onClick}:Param) => { //点击按钮操作 const submitBtns = (val, index) => { (val == 1)&&cancelOrder(); //取消订单按钮 - (val == 2)&&onClick?.(2); //去付款按钮 (val == 6)&&receiveOrder(); //确认收货 - + if (val == 1) { + cancelOrder() + } else if (val == 6) { + receiveOrder() + } else { + onClick?.(val) + } } //取消订单 diff --git a/src/pages/applyAfterSales/components/kindList/index.module.scss b/src/pages/applyAfterSales/components/kindList/index.module.scss new file mode 100644 index 0000000..679ffbb --- /dev/null +++ b/src/pages/applyAfterSales/components/kindList/index.module.scss @@ -0,0 +1,64 @@ +.apply_after_sales_list{ + padding: 0 20px; + .apply_after_sales_item{ + margin-bottom: 50px; + .apply_after_sales_title{ + display: flex; + align-items: center; + .tag{ + font-size: $font_size_min; + background-color: #CDE5FF; + padding: 5px 10px; + border-radius: 6px; + color: $color_main; + } + .title{ + font-weight: 700; + font-size: $font_size; + margin-left: 20px; + flex:1; + } + } + .color_list { + .color_item{ + display: flex; + align-items: center; + margin: 20px 0; + } + .image{ + width: 70px; + height: 70px; + image{ + width: 100%; + height: 100%; + border-radius: 50%; + } + } + .name_and_number{ + padding-left: 30px; + flex:1; + text{ + &:nth-child(1) { + font-weight: 700; + font-size: $font_size; + } + &:nth-child(2) { + color: $color_font_two; + font-size: $font_size; + margin-left: 20px; + } + } + } + .btn_count{ + width: 216px; + height: 64px; + background-color: #ECF5FF; + border-radius: 40px 0px 16px 0px; + padding: 0 20px; + display: flex; + align-items: center; + } + } + } + +} diff --git a/src/pages/applyAfterSales/components/kindList/index.tsx b/src/pages/applyAfterSales/components/kindList/index.tsx new file mode 100644 index 0000000..c9feceb --- /dev/null +++ b/src/pages/applyAfterSales/components/kindList/index.tsx @@ -0,0 +1,43 @@ +import { formatHashTag, formatImgUrl } from "@/common/fotmat"; +import Counter from "@/components/counter"; +import { Image, Text, View } from "@tarojs/components"; +import { memo, useCallback } from "react"; +import styles from './index.module.scss' + +type OrderParam = { + list?: any[], + sale_mode?: number, + sale_mode_name?: string, + unit?: string, + total_colors?: number, + total_fabrics?: number, + total_number?: number, + status?: number, //订单状态 +} + +export default memo(({order}:{order:OrderParam}) => { + //对应数量 + const formatCount = useCallback((item) => { + return (order?.sale_mode == 0? item.roll : Number(item.length / 100)) + order?.unit + }, [order]) + + return ( + + {order?.list?.map(item => + + {order.sale_mode_name} + {formatHashTag(item.code, item.name)} + + + {item.product_colors.map(colorItem => + + {colorItem.code + ' ' + colorItem.name}x {formatCount(colorItem)} + + + + )} + + )} + + ) +}) \ No newline at end of file diff --git a/src/pages/applyAfterSales/index.module.scss b/src/pages/applyAfterSales/index.module.scss index b4ce39c..a9491da 100644 --- a/src/pages/applyAfterSales/index.module.scss +++ b/src/pages/applyAfterSales/index.module.scss @@ -92,6 +92,9 @@ margin-bottom: 20px; position: relative; border-radius: 10px; + &:nth-child(1) { + margin-left: 50px; + } image{ width: 100%; height: 100%; @@ -114,70 +117,6 @@ } } - .apply_after_sales_list{ - padding: 0 20px; - .apply_after_sales_item{ - margin-bottom: 50px; - .apply_after_sales_title{ - display: flex; - align-items: center; - .tag{ - font-size: $font_size_min; - background-color: #CDE5FF; - padding: 5px 10px; - border-radius: 6px; - color: $color_main; - } - .title{ - font-weight: 700; - font-size: $font_size; - margin-left: 20px; - flex:1; - } - } - .color_list { - .color_item{ - display: flex; - align-items: center; - margin: 20px 0; - } - .image{ - width: 70px; - height: 70px; - image{ - width: 100%; - height: 100%; - border-radius: 50%; - } - } - .name_and_number{ - padding-left: 30px; - flex:1; - text{ - &:nth-child(1) { - font-weight: 700; - font-size: $font_size; - } - &:nth-child(2) { - color: $color_font_two; - font-size: $font_size; - margin-left: 20px; - } - } - } - .btn_count{ - width: 235px; - height: 64px; - background-color: #ECF5FF; - border-radius: 40px 0px 16px 0px; - padding: 0 20px; - display: flex; - align-items: center; - } - } - } - - } .btns_con{ diff --git a/src/pages/applyAfterSales/index.tsx b/src/pages/applyAfterSales/index.tsx index dd07f90..c0494a4 100644 --- a/src/pages/applyAfterSales/index.tsx +++ b/src/pages/applyAfterSales/index.tsx @@ -1,24 +1,77 @@ import { Image, ScrollView, Text, Textarea, View } from "@tarojs/components"; -import { memo, useCallback, useMemo, useState } from "react"; +import { memo, useCallback, useEffect, useMemo, useRef, useState } from "react"; import classnames from "classnames"; import styles from './index.module.scss' -import { formatImgUrl } from "@/common/fotmat"; +import { formatHashTag, formatImgUrl } from "@/common/fotmat"; import Counter from "@/components/counter"; import ReasonPopup from "./components/reasonPopup"; import OtherReason from "./components/otherReason"; -import Taro from "@tarojs/taro"; +import Taro, { useDidShow, useRouter } from "@tarojs/taro"; import useUploadCDNImg from "@/use/useUploadImage"; +import { GetSaleOrderDetailApi } from "@/api/order"; +import KindList from "./components/kindList" type ReasonParam = 1|2|3 //1 退货原因 2 货物状况 3 退货说明 export default () => { - const [showDesc, setShowDesc] = useState(true) + + const router = useRouter() + const orderId = useRef(Number(router.params.id)) + + useDidShow(() => { + getSaleOrderPreView() + }) + + //获取订单数据 + 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]) + + //对应数量 + const formatCount = useCallback((item) => { + return (formatDetailOrder?.sale_mode == 0? item.roll : Number(item.length / 100)) + formatDetailOrder?.unit + }, [formatDetailOrder]) + + //退货选择弹窗 const [showReason, setShowReason] = useState<{show:true|false, status:ReasonParam}>({show:false, status:1}) const closeReason = useCallback(() => setShowReason({...showReason, show:false}), []) const onShowReason = (status) => setShowReason({...showReason, status, show:true}) - //底部按钮 const onSubmit = (val) => { @@ -27,35 +80,10 @@ export default () => { return ( - 2种面料,3种颜色,共6条 + {dataCount} - - - {new Array(5).fill(5).map(item => - - 大货 - 0770# 21S单面平纹(食毛) - - - - - 1# 薄荷绿x1 - - - - - - - 1# 薄荷绿x1 - - - - - - )} - - + 退货原因 @@ -103,16 +131,26 @@ export default () => { //图片列表 const PictureItem = memo(() => { const {getWxPhoto} = useUploadCDNImg() - //图片 + const [imageList, setImageLise] = useState([]) + const uploadImage = async () => { - let res = await getWxPhoto('after-sale') + let res:any = await getWxPhoto('after-sale') + if(res.code == 200) { + setImageLise([...imageList, res.url]) + } + } + + //删除图片 + const delImage = (index) => { + } return ( <> - - - - + {imageList.map((item, index) => + + + delImage(index)} className={classnames(styles.miconfont_close, 'iconfont icon-qingkong')}> + )} 上传照片 diff --git a/src/pages/order/comfirm.tsx b/src/pages/order/comfirm.tsx index 4078471..f1fcb70 100644 --- a/src/pages/order/comfirm.tsx +++ b/src/pages/order/comfirm.tsx @@ -70,7 +70,8 @@ import AddressInfoDetail from "./components/addressInfoDetail"; total_fabrics: preViewOrder.total_fabrics, //面料数量 unit: preViewOrder.sale_mode == 0?'条':'m', //单位 list: preViewOrder.product_list, - total_should_collect_money: preViewOrder.total_should_collect_money //应收金额 + total_should_collect_money: preViewOrder.total_should_collect_money, //应收金额 + total_sale_price: preViewOrder.total_sale_price //合计金额 }) } const formatPreViewOrderMemo = useMemo(() => { @@ -134,14 +135,15 @@ import AddressInfoDetail from "./components/addressInfoDetail"; //提交订单 const {fetchData: saleOrderFetchData} = SaleOrderApi() const submitOrderEven = () => { - if(!submitOrderData?.address_id) { - alert.error('请选择地址') - return false - } if(!submitOrderData?.shipment_mode) { alert.error('请选择收货方式') return false } + if(!submitOrderData?.address_id&&submitOrderData?.shipment_mode == 2) { + alert.error('请选择地址') + return false + } + Taro.showModal({ title: '确定提交?', success: async function (res) { diff --git a/src/pages/order/components/addressInfoDetail/index.tsx b/src/pages/order/components/addressInfoDetail/index.tsx index 70c42d9..bef3292 100644 --- a/src/pages/order/components/addressInfoDetail/index.tsx +++ b/src/pages/order/components/addressInfoDetail/index.tsx @@ -40,9 +40,10 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, orderInfo, stat const [addressInfo, setAddressInfo] = useState() useEffect(() => { - setAddressInfo(() => orderInfo) - if(orderInfo) + if(orderInfo) { setReceivingStatus(() => orderInfo.shipment_mode||2) + setAddressInfo(() => orderInfo) + } }, [orderInfo]) //地址格式 diff --git a/src/pages/order/components/kindList/index.module.scss b/src/pages/order/components/kindList/index.module.scss index a4b4c9e..2c4b957 100644 --- a/src/pages/order/components/kindList/index.module.scss +++ b/src/pages/order/components/kindList/index.module.scss @@ -66,9 +66,14 @@ font-size: $font_size; margin-bottom: 15px; } - .order_list_item_price{ + .order_list_item_price, .order_list_item_price_dg{ font-size: 26px; color: $color_font_three; + display: flex; + align-items: center; + Text{ + padding-left: 13px; + } } } .order_list_item_count{ diff --git a/src/pages/order/components/kindList/index.tsx b/src/pages/order/components/kindList/index.tsx index 61bd404..83f9210 100644 --- a/src/pages/order/components/kindList/index.tsx +++ b/src/pages/order/components/kindList/index.tsx @@ -1,7 +1,7 @@ import { ORDER_STATUS } from "@/common/enum" -import { formatHashTag, formatPriceDiv } from "@/common/fotmat" +import { formatHashTag, formatPriceDiv, formatWeightDiv } from "@/common/fotmat" import LabAndImg from "@/components/LabAndImg" -import { View } from "@tarojs/components" +import { Text, View } from "@tarojs/components" import { memo, useCallback, useMemo } from "react" import EstimatedAmount from "../estimatedAmount" import styles from './index.module.scss' @@ -16,7 +16,7 @@ type OrderParam = { total_fabrics: number, total_number: number, status: number, //订单状态 - total_sale_price: number, //销售金额 + total_sale_price: number, //合计金额 total_should_collect_money: number, //应收金额 total_weight_error_discount: number, //空差优惠 the_previous_status: number, //取消订单时的订单状态 @@ -57,7 +57,8 @@ export default memo(({order, comfirm = false}:Param) => { SaleOrderStatusComplete, // 已完成 SaleOrderStatusRefund, // 已退款 SaleOrderStatusCancel, // 已取消 - SaleorderstatusWaitingPrePayment // 预付款 + SaleorderstatusWaitingPrePayment, // 预付款 + SaleOrderStatusTaking //提货 } = ORDER_STATUS //金额列表枚举 @@ -70,7 +71,7 @@ export default memo(({order, comfirm = false}:Param) => { }, { id:2, - value:[SaleOrderStatusArranged.value, SaleOrderStatusWaitingPayment.value, SaleOrderStatusWaitingDelivery.value, SaleOrderStatusWaitingReceipt.value, SaleOrderStatusAlreadyReceipt.value, SaleOrderStatusComplete.value, SaleOrderStatusRefund.value, SaleOrderStatusCancel.value], + value:[SaleOrderStatusTaking.value, SaleOrderStatusArranged.value, SaleOrderStatusWaitingPayment.value, SaleOrderStatusWaitingDelivery.value, SaleOrderStatusWaitingReceipt.value, SaleOrderStatusAlreadyReceipt.value, SaleOrderStatusComplete.value, SaleOrderStatusRefund.value, SaleOrderStatusCancel.value], label:'合计金额', field: 'total_sale_price' }, @@ -88,13 +89,13 @@ export default memo(({order, comfirm = false}:Param) => { }, { id:5, - value:[SaleOrderStatusWaitingDelivery.value, SaleOrderStatusWaitingReceipt.value, SaleOrderStatusAlreadyReceipt.value, SaleOrderStatusComplete.value, SaleOrderStatusRefund.value, SaleOrderStatusCancel.value], + value:[SaleOrderStatusTaking.value, SaleOrderStatusWaitingDelivery.value, SaleOrderStatusWaitingReceipt.value, SaleOrderStatusAlreadyReceipt.value, SaleOrderStatusComplete.value, SaleOrderStatusRefund.value, SaleOrderStatusCancel.value], label:'实付金额', field: 'actual_amount' } ] - //是否显示价格 + //订单流程是否显示价格 const showPrice = (item) => { if (item.id == 2) { //合计金额 (剪板特殊请情况) @@ -102,9 +103,10 @@ export default memo(({order, comfirm = false}:Param) => { } else { return (item.value.includes(order.status) && order.sale_mode != 1 ) } + } - //金额展示 + //订单流程金额展示 const priceConDom = useMemo(() => { if(!order) return return ( @@ -117,6 +119,28 @@ export default memo(({order, comfirm = false}:Param) => { ) }, [order]) + + //确认订单金额展示 + const comfirmPriceConDom = useMemo(() => { + if(!order) return + let item = order.sale_mode == 1?priceList[1]:priceList[0] + return + }, [order]) + + //金额展示 + const showPriceConDom = useMemo(() => { + return comfirm?comfirmPriceConDom:priceConDom + }, [order]) + + + //散剪大约重量 + const aboutWeight = useCallback((weight) => { + if(order.sale_mode == 2 ) { + let showWeight = [SaleorderstatusWaitingPrePayment.value, SaleOrderStatusBooking.value, SaleOrderStatusArranging.value].includes(order.status) + return showWeight?; ≈{formatWeightDiv(weight)}kg:<> + } + return <> + }, [order]) return ( <> @@ -139,7 +163,11 @@ export default memo(({order, comfirm = false}:Param) => { {colorItem.code + ' ' + colorItem.name} - ¥{standardPrice(colorItem.sale_price)} + + ¥{standardPrice(colorItem.sale_price)} + {aboutWeight(colorItem.estimate_weight)} + + ×{formatCount(colorItem)}{order.unit} @@ -153,7 +181,7 @@ export default memo(({order, comfirm = false}:Param) => { }) } - {priceConDom} + {showPriceConDom} diff --git a/src/pages/order/index.tsx b/src/pages/order/index.tsx index 244c9d1..6713c99 100644 --- a/src/pages/order/index.tsx +++ b/src/pages/order/index.tsx @@ -93,9 +93,10 @@ import styles from './index.module.scss' city_name: orderDetail?.city_name, district_name: orderDetail?.district_name, address_detail: orderDetail?.address_detail, - // id: address.id, name: orderDetail?.target_user_name, - phone: orderDetail?.target_user_phone + phone: orderDetail?.target_user_phone, + shipment_mode: orderDetail?.shipment_mode, + id: orderDetail?.id } }, [orderDetail]) @@ -141,12 +142,16 @@ import styles from './index.module.scss' //获取底部按钮点击, 获取按钮状态 const orderStateClick = useCallback((val) => { + console.log('123456789',val) if(val == 1 || val == 6) { //取消订单 getSaleOrderPreView() }else if(val == 2) { //待付款 toPay() + } else if (val == 5) { + console.log('aa:::',orderDetail) + goLink('/pages/applyAfterSales/index',{id:orderDetail.id}) } }, [orderDetail]) diff --git a/src/pages/salesAfter/components/addressInfoDetail/index.module.scss b/src/pages/salesAfter/components/addressInfoDetail/index.module.scss index 68e6171..a57550a 100644 --- a/src/pages/salesAfter/components/addressInfoDetail/index.module.scss +++ b/src/pages/salesAfter/components/addressInfoDetail/index.module.scss @@ -26,87 +26,46 @@ .order_address_text_title{ font-size: $font_size_medium; margin-top: 10px; - @include common_ellipsis; display: flex; align-items: center; justify-content: space-between; .moreIconfont{ font-size: 20px; } + .address_text{ + word-break:break-all; + font-size: 28px; + font-weight: 700; + } } .order_address_text_name{ - + color: #707070; align-items: center; + display: flex; + margin-top: 20px; text{ &:nth-child(1) { - color: #000; - font-weight: 700; - font-size: $color_font_one; + font-size: $font_size_medium; margin-right: 40px; } &:nth-child(2) { - color: $color_font_one; + flex:1; font-size: $font_size_medium; } } } } .updateBtn{ - width:200px; - font-size: $font_size_min; - background-color: #F0F0F0; - height: 64px; - border-radius: 24px; + width:152px; + font-size: 28px; + height: 60px; color: $color_font_two; - position: absolute; - bottom: 10px; - right: 10px; z-index: 999; - .updateBtn_list{ - position: absolute; - display: flex; - z-index: 5; - width: 100%; - .updateBtn_item_select{ - color: #fff; - } - } - .updateBtn_item{ - flex:1; - text-align: center; - line-height: 64px; - } - .updateBtn_select{ - color: #fff; - background-color: $color_main; - border-radius: 24px; - position: absolute; - width: 100px; - height: 61px; - z-index: 1; - transition: all 0.3s ease-in-out; - } + border: 2px solid #dddddd; + border-radius: 36px; + text-align: center; + line-height: 60px; } - .order_address_text_no{ - flex: 1; - font-size: $font_size; - font-weight: 700; - margin-left: 30px; - } - .order_address_more_icon{ - color: $color_font_three; - font-size: $font_size; - } -} -.order_address_list { - height: 900px; - .order_address_title{ - font-size: $font_size; - font-weight: 700; - width: 100%; - text-align: center; - padding: 20px 0 30px 0; - } } \ No newline at end of file diff --git a/src/pages/salesAfter/components/addressInfoDetail/index.tsx b/src/pages/salesAfter/components/addressInfoDetail/index.tsx index 7290ae6..87d144e 100644 --- a/src/pages/salesAfter/components/addressInfoDetail/index.tsx +++ b/src/pages/salesAfter/components/addressInfoDetail/index.tsx @@ -1,122 +1,26 @@ -import { EditSaleOrderAddressApi, EditSaleOrderShipmentModeApi } from "@/api/order"; -import { alert } from "@/common/common"; -import { debounce } from "@/common/util"; -import AddressList from "@/components/AddressList"; -import Popup from "@/components/popup"; import { Text, View } from "@tarojs/components" import classnames from "classnames"; -import { forwardRef, memo, useCallback, useEffect, useImperativeHandle, useMemo, useState } from "react"; +import {memo} from "react"; import styles from './index.module.scss' -export type AddressInfoParam = { - province_name: string, - city_name: string, - district_name: string, - address_detail: string, - id?: number, - name: string, - phone: string, -} -type Param = { - onSelect?: (val:any) => void, //选择 - defaultValue?: AddressInfoParam|null, //默认值 - disabled?: false|true, //true禁用后只用于展示 - shipment_mode?: 1|2, //1自提 2物流 - onChangeShipmentMode?: (val: number) => void, //返回收货方式 - orderId?: number //订单id -} - -export default memo(forwardRef(({onSelect, onChangeShipmentMode, defaultValue = null, orderId = 0, shipment_mode = 1}: Param, ref) => { - const [showAddressList, setShowAddressList] = useState(false) - - useEffect(() => { - setUserInfo(() => defaultValue) - }, [defaultValue]) - - const [userInfo, setUserInfo] = useState() - - //地址格式 - const formatAddress = useMemo(() => { - if(userInfo) - return userInfo.province_name + userInfo.city_name + userInfo.district_name + userInfo.address_detail - }, [userInfo]) - - const changeShow = () => { - if(receivingStatus == 2) - setShowAddressList(() => true) - } - - useEffect(() => { - setReceivingStatus(() => shipment_mode) - }, [shipment_mode]) - - //把内部方法提供给外部 - useImperativeHandle(ref, () => ({ - changeShow - })) - - //收货方法,1:自提,2物流 - const [receivingStatus, setReceivingStatus] = useState(1) - const {fetchData: shipmentModeFetchData} = EditSaleOrderShipmentModeApi() - const onReceivingStatus = (value, e) => { - e.stopPropagation() - changeReceivingStatus(value) - } - const changeReceivingStatus = debounce(async (value) => { - alert.loading('正在修改') - const res = await shipmentModeFetchData({id: orderId, shipment_mode:value}) - if(res.success) { - alert.success('收货方式修改成功') - onChangeShipmentMode?.(value) - setReceivingStatus(value) - } else { - alert.none(res.msg) - } - }, 10) - - //修改地址 - const {fetchData: addressFetchData} = EditSaleOrderAddressApi() - const getAddress = async (value) => { - alert.loading('正在修改') - const res = await addressFetchData({id: orderId, address_id: value.id}) - if(res.success) { - alert.success('地址修改成功') - onSelect?.(value) - setShowAddressList(() => false) - setUserInfo(() => value) - } else { - alert.none(res.msg) - } - } - +export default memo(({defaultValue}:{defaultValue:string}) => { return ( - changeShow()}> - + + - {formatAddress} - {(receivingStatus == 2)&&} + {defaultValue} - {userInfo?.name} - {userInfo?.phone} + 管理员 + 13939399536 + + 上传物流 + - - - onReceivingStatus(1,e)}>自提 - onReceivingStatus(2,e)}>物流 - - - - setShowAddressList(false)}> - - 请选择收货地址 - - - ) -})) \ No newline at end of file +}) \ No newline at end of file diff --git a/src/pages/salesAfter/components/kindList/index.tsx b/src/pages/salesAfter/components/kindList/index.tsx index e93be35..23a2a0c 100644 --- a/src/pages/salesAfter/components/kindList/index.tsx +++ b/src/pages/salesAfter/components/kindList/index.tsx @@ -61,7 +61,7 @@ export default memo(({order, comfirm = false}:Param) => { { id:1, value:[SaleOrderStatusBooking.value, SaleOrderStatusArranging.value], - label:'预估金额', + label:'扣款金额', field: 'estimate_amount' }, { diff --git a/src/pages/salesAfter/index.tsx b/src/pages/salesAfter/index.tsx index aff512d..ecdec5c 100644 --- a/src/pages/salesAfter/index.tsx +++ b/src/pages/salesAfter/index.tsx @@ -12,6 +12,7 @@ import { Image, Text, Textarea, View } from "@tarojs/components" import Taro, {useDidShow, usePullDownRefresh, useRouter } from "@tarojs/taro"; import classnames from "classnames"; import { useCallback, useEffect, useMemo, useRef, useState, memo } from "react"; +import AddressInfoDetail from "./components/addressInfoDetail"; import ContentBox from "./components/contentBox"; import KindList from "./components/kindList"; import OrderState from "./components/orderState"; @@ -101,6 +102,7 @@ import styles from './index.module.scss' return ( + {(orderDetail?.status != SaleOrderStatusCancel.value)&& diff --git a/src/use/useLogin.ts b/src/use/useLogin.ts index 08d80d2..7435b02 100644 --- a/src/use/useLogin.ts +++ b/src/use/useLogin.ts @@ -1,6 +1,6 @@ import useUserInfo from "./useUserInfo" import Taro, { useRouter } from "@tarojs/taro" -import { GetWxUserInfoApi, GetAdminUserInfoApi, GetPhoneNumberApi } from "@/api/user" +import { GetWxUserInfoApi, GetAdminUserInfoApi, GetPhoneNumberApi, BindingCompanyApi } from "@/api/user" import useLoginRequest from "./useLoginRequest" import { SHARE_SCENE } from "@/common/enum" import { GetShortCodeApi } from "@/api/share" @@ -93,6 +93,7 @@ export default () => { //获取手机号码 const {fetchData: fetchDataUserPhone} = GetPhoneNumberApi() + const {fetchData: fetchBindingCompany} = BindingCompanyApi() const getPhoneNumber = (code) => { return new Promise( async (reslove, reject) => { if(userInfo.adminUserInfo?.is_authorize_phone) { @@ -102,6 +103,7 @@ export default () => { const res = await fetchDataUserPhone({code}) if(res.success) { setUserInfo({...userInfo.userInfo, phone:res.data.phone_number}) + await fetchBindingCompany() getAdminUserInfo() reslove(res.data) } else { diff --git a/src/use/useUploadImage.ts b/src/use/useUploadImage.ts index 4b69a0d..86c698e 100644 --- a/src/use/useUploadImage.ts +++ b/src/use/useUploadImage.ts @@ -126,7 +126,7 @@ export default () => { const getWxPhoto = (cdn_upload_type: cdn_upload_type_Param) => { return new Promise((resolve, reject) => { Taro.chooseImage({ - count: 1, // 默认9 + count: 1, sizeType: ['original', 'compressed'], sourceType: ['album', 'camera'], success: async function (res) {