diff --git a/src/common/constant.js b/src/common/constant.js index 4b55726..5c76048 100644 --- a/src/common/constant.js +++ b/src/common/constant.js @@ -11,8 +11,8 @@ // 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.7:50002/lymarket` // 添 -export const BASE_URL = `http://192.168.1.42:50001/lymarket` // 杰 +export const BASE_URL = `http://192.168.1.7:50002/lymarket` // 添 +// export const BASE_URL = `http://192.168.1.42:50001/lymarket` // 杰 // CDN // 生成密钥 @@ -25,7 +25,6 @@ export const IMG_CND_Prefix = CURRENT_ENV.includes('development')? "https://test //在线支付图片baseUrl export const CAP_HTML_TO_IMAGE_BASE_URL = CURRENT_ENV.includes('development')? "https://test.zzfzyc.com":"https://www.zzfzyc.com" - // 上传图片视频 export const CDN_UPLOAD_IMG = `${UPLOAD_CDN_URL || ''}`; diff --git a/src/common/fotmat.js b/src/common/fotmat.js index 0e76e3c..5e72052 100644 --- a/src/common/fotmat.js +++ b/src/common/fotmat.js @@ -168,7 +168,7 @@ export const isLabImage = (imgurl, rgb, suffix="!w200") => { export const numberWithCommas = ({number = 0, digit = 2}) => { if(!isNaN(Number(number))) { // return parseFloat(number).toFixed(digit).replace(/^\B(? { id: 1, label: '取消退货', validatarFunc: (orderInfo) => { - if(orderInfo.sale_mode !== 1) return [ReturnStageApplying.value, ReturnStageWaitCheck.value].includes(orderInfo.stage) + if(orderInfo?.sale_mode != 1 && orderInfo.type == ReturnApplyOrderTypeReturnForRefund.value) return [ReturnStageApplying.value, ReturnStageWaitCheck.value].includes(orderInfo.stage) return false } }, @@ -61,7 +61,7 @@ export default memo(({orderInfo, onClick, fixedBottom = true}:Param) => { id: 4, label: '质检结果', validatarFunc: (orderInfo) => { - if(orderInfo.sale_mode !== 1) return [ReturnStageQualityCheckPendingRefund.value, ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value].includes(orderInfo.stage) + if(orderInfo.sale_mode !== 1 && orderInfo.type == ReturnApplyOrderTypeReturnForRefund.value) return [ReturnStageQualityCheckPendingRefund.value, ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value].includes(orderInfo.stage) return false } }, @@ -69,9 +69,8 @@ export default memo(({orderInfo, onClick, fixedBottom = true}:Param) => { id: 6, label: '取消退款', validatarFunc: (orderInfo) => { - //大货 是销售退款时 - if(orderInfo?.sale_mode == 0 && orderInfo.type != ReturnApplyOrderTypeReturnForRefund.value) return [ReturnStageApplying.value, ReturnStageServiceOrderPendingRefund.value]?.includes(orderInfo.stage) - if(orderInfo?.sale_mode == 1) return [ReturnStageApplying.value].includes(orderInfo.stage) + if (orderInfo?.sale_mode != 1 && orderInfo.type != ReturnApplyOrderTypeReturnForRefund.value) return [ReturnStageApplying.value, ReturnStageServiceOrderPendingRefund.value]?.includes(orderInfo.stage) + if (orderInfo?.sale_mode == 1) return [ReturnStageApplying.value].includes(orderInfo.stage) return false } }, diff --git a/src/components/bindSalesmanPopup/index.tsx b/src/components/bindSalesmanPopup/index.tsx index 5860458..cab8af9 100644 --- a/src/components/bindSalesmanPopup/index.tsx +++ b/src/components/bindSalesmanPopup/index.tsx @@ -25,7 +25,7 @@ export default ({show, onClose}:params) => { const onConfirm = () => { onClose?.() - // goLink('/') + goLink('/pages/bindSalesman/index') } return ( <> diff --git a/src/components/estimatedAmount/index.module.scss b/src/components/estimatedAmount/index.module.scss index 6ddb7d3..3bd308c 100644 --- a/src/components/estimatedAmount/index.module.scss +++ b/src/components/estimatedAmount/index.module.scss @@ -81,5 +81,8 @@ } } } + .refund_destination{ + font-size: 28px; + } } \ No newline at end of file diff --git a/src/components/estimatedAmount/index.tsx b/src/components/estimatedAmount/index.tsx index 39dd7c0..43782d5 100644 --- a/src/components/estimatedAmount/index.tsx +++ b/src/components/estimatedAmount/index.tsx @@ -8,15 +8,16 @@ import AmountShow from "../amountShow"; type Param = { style?: Object, - number?: number, + number?: number|string, title?: string, titleStatus?: true|false, //true 标题加大加深 numberStatus?: 0|1|2, //数字尺寸 messageTitle?: string, messageWidth?: number, messageShow?: true|false, + numberFormat?: 'number'|'text' //数字还是字符串 } -export default memo(({number = 0, titleStatus = true, title = '', messageTitle = '', numberStatus = 1, messageWidth = 430, messageShow = false}:Param) => { +export default memo(({number = 0, titleStatus = true, title = '', messageTitle = '', numberStatus = 1, messageWidth = 430, messageShow = false, numberFormat = 'number'}:Param) => { const [show, setShow] = useState(messageShow) const onClose = () => { setShow(false) @@ -54,7 +55,8 @@ export default memo(({number = 0, titleStatus = true, title = '', messageTitle = - + {numberFormat == 'number' && } + {(numberFormat == 'text') && {number}} {show&&} diff --git a/src/components/orderBtns/index.tsx b/src/components/orderBtns/index.tsx index 64b018e..5ac96f5 100644 --- a/src/components/orderBtns/index.tsx +++ b/src/components/orderBtns/index.tsx @@ -22,10 +22,11 @@ type Param = { is_return?: true|false, //是否申请了售后 }, + showStatus?: 'detail'|'list', //订单详情,订单列表 onClick?: (val: number) => void //点击后触发的事件,返回订单状态 } -export default memo(({orderInfo, onClick}:Param) => { +export default memo(({orderInfo, showStatus = 'detail', onClick}:Param) => { //订单状态枚举 const { SaleOrderStatusBooking, @@ -126,6 +127,13 @@ export default memo(({orderInfo, onClick}:Param) => { 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: '去付款', @@ -142,7 +150,8 @@ export default memo(({orderInfo, onClick}:Param) => { ] return orderInfo.wait_pay_amount != 0 && orderStatus.includes(orderInfo.status) } - }, + } + ]) //显示的按钮数组 diff --git a/src/components/product/index.module.scss b/src/components/product/index.module.scss index 3b62f33..342b778 100644 --- a/src/components/product/index.module.scss +++ b/src/components/product/index.module.scss @@ -31,7 +31,7 @@ right:0; bottom: 0; background: rgba($color: #000, $alpha: 0.3); - border-radius: 36px 0px 10px 0px; + border-radius: 36px 0px 20px 0px; color: #fff; text-align: center; } diff --git a/src/components/product/index.tsx b/src/components/product/index.tsx index c6b900d..b1387e3 100644 --- a/src/components/product/index.tsx +++ b/src/components/product/index.tsx @@ -4,18 +4,24 @@ import { goLink } from "@/common/common" import styles from './index.module.scss' import { formatHashTag, formatImgUrl } from "@/common/fotmat" import LabAndImg from "../LabAndImg" +import { useCallback, useMemo } from "react" type Params = { desStatus?: true|false, productList?: any[] } export default ({desStatus = true, productList = []}:Params) => { + + const labAndImgObj = useCallback((item) => { + const img = item?item.texture_url.split(',')[0]:'' + return {lab:item.lab,rgb:item.rgb,texture_url:img} + }, [productList]) return ( {productList?.map(item => { return goLink(`/pages/details/index?id=${item.id}`)}> - + {item.product_color_count}色 diff --git a/src/components/search/index.module.scss b/src/components/search/index.module.scss index 46a8c27..bd72902 100644 --- a/src/components/search/index.module.scss +++ b/src/components/search/index.module.scss @@ -3,6 +3,7 @@ align-items: center; position: relative; width: 100%; + z-index: 0; .icon_a_sousuo1_self{ font-size: 37px; color: $color_font_two; diff --git a/src/components/shopCart/index.tsx b/src/components/shopCart/index.tsx index f1c46d1..0d55be8 100644 --- a/src/components/shopCart/index.tsx +++ b/src/components/shopCart/index.tsx @@ -15,6 +15,7 @@ import { debounce, throttle } from "@/common/util"; import Counter from "../counter"; import { ApplyOrderAccessApi, GetAdminUserInfoApi, SubscriptionMessageApi } from "@/api/user"; import useCommonData from "@/use/useCommonData"; +import BindSalesmanPopup from "../bindSalesmanPopup"; type param = { show?: true|false, @@ -89,6 +90,7 @@ export default ({show = false, onClose, intoStatus='shop'}: param) => { setLoading(true) initStatus.current = true getShoppingCart() + setShowBindSalesman(() => false) } }, [show]) @@ -232,25 +234,8 @@ export default ({show = false, onClose, intoStatus='shop'}: param) => { let res = await useFetchData() if(res.data.order_access_status !== 3) { if(res.data.order_access_status == 1) applyOrderAccessFetchData() - let modal_res = await Taro.showModal({ - title: '提示', - content: '暂未开通下单权限功能,稍后有客服联系您,请注意接受电话。', - confirmText: '联系客服', - cancelText: '我知道', - }) - if (modal_res.confirm) { - let res = await Taro.showModal({ - title: '是否拨打服务热线', - confirmText: '拨打', - content: '(0757) 8270 6695', - cancelText: '取消', - }) - if(res.confirm) { - Taro.makePhoneCall({ - phoneNumber: '(0757)82706695' - }) - } - } + setShowBindSalesman(() => true) + onClose?.() return false } getSelectId() @@ -283,6 +268,9 @@ export default ({show = false, onClose, intoStatus='shop'}: param) => { } }, 300) + //绑定业务员和电话号码 + const [showBindSalesman, setShowBindSalesman] = useState(false) + return ( closePopup()} > @@ -363,6 +351,7 @@ export default ({show = false, onClose, intoStatus='shop'}: param) => { + setShowBindSalesman(false)}/> ) } diff --git a/src/pages/applyAfterSales/index copy 2.tsx b/src/pages/applyAfterSales/index copy 2.tsx deleted file mode 100644 index d012b74..0000000 --- a/src/pages/applyAfterSales/index copy 2.tsx +++ /dev/null @@ -1,254 +0,0 @@ -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 CutKindList from "./components/cutkindList" -import { ReturnApplyOrderApi, ReturnExplainApi, ReturnGoodsStatusApi, ReturnReasonApi } from "@/api/salesAfterOrder"; -import { alert, goLink } from "@/common/common"; -import UploadImage from "@/components/uploadImage" -import TextareaEnhance from "@/components/textareaEnhance"; -import useLogin from "@/use/useLogin"; - -enum returnStatus { - return_reason = 1, //原因 - goods_status = 2, //状况 - return_explain = 3, //说明 - -} -export default () => { - useLogin() - 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: 0, - 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, 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})) - }, []) - - //散剪和剪板 - 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} - } 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('请选择退货颜色') - console.log('submitData::',submitData) - let res = await fetchDataReturnApply(submitData) - if(res.success) { - alert.success('申请成功') - goLink('/pages/salesAfterList/index',{}, 'reLaunch') - } else { - alert.error(res.msg) - } - } - - //底部按钮 - const onSubmit = (val) => { - if(val == 2) { - onSubmitData() - } - } - - //退货选择弹窗 - 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) - } - - console.log('aaa:', 123456789) - - //请求获取到的数据 - 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||[], status:returnStatus.goods_status})) - } - //退货原因 - 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 ( - - - {dataCount} - - - {(orderDetail?.sale_mode == 0)&&|| - } - - - 退货原因 - onShowReason(returnStatus.return_reason)}> - {returnObj[returnStatus.return_reason]?.name||'请选择'} - - - - - 货物状况 - onShowReason(returnStatus.goods_status)}> - {returnObj[returnStatus.goods_status]?.name||'请选择'} - - - - - 退货说明 - onShowReason(returnStatus.return_explain)}> - {returnObj[returnStatus.return_explain]?.name||'请选择'} - - - - - 拍照上传 - - - - - - - - - - - - - - onSubmit(1)}>取消 - onSubmit(2)}>确认 - - - - - ) -} \ No newline at end of file diff --git a/src/pages/applyAfterSales/index copy.tsx b/src/pages/applyAfterSales/index copy.tsx deleted file mode 100644 index 32cb3b4..0000000 --- a/src/pages/applyAfterSales/index copy.tsx +++ /dev/null @@ -1,253 +0,0 @@ -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 95e5ccb..a6e74f2 100644 --- a/src/pages/applyAfterSales/index.tsx +++ b/src/pages/applyAfterSales/index.tsx @@ -62,23 +62,17 @@ export default () => { 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, //面料数量 + ...orderDetail, unit: orderDetail.sale_mode == 0?'条':'m', //单位 list: orderDetail.product_list, - status: orderDetail.status, //订单状态 - av_return_roll: orderDetail.av_return_roll //可退条数 }) } //数据总量 const dataCount = useMemo(() => { if(formatDetailOrder) { - let total_number = formatDetailOrder.sale_mode == 0?formatDetailOrder.total_number + '条':(formatDetailOrder.total_number/100) + '米' - return `${formatDetailOrder.total_fabrics}种面料,${formatDetailOrder.total_colors}种颜色,共${total_number}` + let total_number = formatDetailOrder.sale_mode == 0?formatDetailOrder.av_total_number + '条':(formatDetailOrder.av_total_number/100) + '米' + return `${formatDetailOrder.av_total_fabrics}种面料,${formatDetailOrder.av_total_colors}种颜色,共${total_number}` } }, [formatDetailOrder]) diff --git a/src/pages/bindSalesman/index.module.scss b/src/pages/bindSalesman/index.module.scss index ae9fd1d..2bc9294 100644 --- a/src/pages/bindSalesman/index.module.scss +++ b/src/pages/bindSalesman/index.module.scss @@ -11,6 +11,17 @@ height: 100%; } } + .salesman_name{ + font-size: 30px; + color: #007AFF; + box-sizing: border-box; + padding-top: 50px; + text{ + &:nth-child(2) { + margin-left: 20px; + } + } + } .inputCode{ width: 670px; height: 106px; @@ -46,7 +57,7 @@ width: 670px; height: 90px; opacity: 0.6; - background: linear-gradient(41deg,#007aff, #4fa6ff 86%, #68b4ff 100%); + background: linear-gradient(41deg,#007aff, #3a9bfd 86%, #4ba2fa 100%);; border-radius: 46px; text-align: center; line-height: 90px; diff --git a/src/pages/bindSalesman/index.tsx b/src/pages/bindSalesman/index.tsx index 2555b77..cb8ab7b 100644 --- a/src/pages/bindSalesman/index.tsx +++ b/src/pages/bindSalesman/index.tsx @@ -38,12 +38,13 @@ export default () => { } }) } - + //获取粘贴版内容 const onClipboardData = () => { Taro.getClipboardData({ success: function (res){ - console.log('res.data:::', res.data) + let val = res.data.match(/InviteCode:([a-zA-Z0-9]{4})/) + setSubmitData((...e) => ({...e, code: val?val[1]:''})) } }) } @@ -62,6 +63,7 @@ export default () => { + 邀请人:李先生(132****6690) 提交 温馨提示 diff --git a/src/pages/details/index.tsx b/src/pages/details/index.tsx index a9791c9..fcbaebf 100644 --- a/src/pages/details/index.tsx +++ b/src/pages/details/index.tsx @@ -187,7 +187,7 @@ export default (props:Params) => { return ( - + {productInfo.code&&{productName}} diff --git a/src/pages/index/index.tsx b/src/pages/index/index.tsx index 9a4ee91..93d3183 100644 --- a/src/pages/index/index.tsx +++ b/src/pages/index/index.tsx @@ -12,8 +12,6 @@ import Taro, { Events, useDidShow, usePullDownRefresh } from '@tarojs/taro' import { GetProductKindListApi, GetProductListApi } from '@/api/material' import useLogin from '@/use/useLogin' import { dataLoadingStatus } from '@/common/util' -import BindSalesman from '@/components/bindSalesmanPopup' -import BindSalesmanPopup from '@/components/bindSalesmanPopup' export default () => { @@ -107,7 +105,6 @@ export default () => { setShowShopCart(false)} /> - diff --git a/src/pages/order/comfirm.tsx b/src/pages/order/comfirm.tsx index 0427e63..c846492 100644 --- a/src/pages/order/comfirm.tsx +++ b/src/pages/order/comfirm.tsx @@ -150,12 +150,19 @@ import { throttle } from "@/common/util"; alert.error('请选择地址') return false } - await openSubscriptionMessage({scenes: SubmitOrder.value}) - const res = await saleOrderFetchData(submitOrderData) - if(res.success) { - goLink('/pages/order/index',{id: res.data.id}, 'redirectTo') - } else { - alert.none(res.msg) + let showModalRes = await Taro.showModal({ + content: '确定提交订单?', + confirmText: '确定', + cancelText: '取消', + }) + if(showModalRes.confirm) { + await openSubscriptionMessage({scenes: SubmitOrder.value}) + const res = await saleOrderFetchData(submitOrderData) + if(res.success) { + goLink('/pages/order/index',{id: res.data.id}, 'redirectTo') + } else { + alert.none(res.msg) + } } }, 600) diff --git a/src/pages/order/components/kindList/index copy.tsx b/src/pages/order/components/kindList/index copy.tsx new file mode 100644 index 0000000..dff1a9c --- /dev/null +++ b/src/pages/order/components/kindList/index copy.tsx @@ -0,0 +1,208 @@ +import { ORDER_STATUS } from "@/common/enum" +import { formatHashTag, formatPriceDiv, formatWeightDiv } from "@/common/fotmat" +import EstimatedAmount from "@/components/estimatedAmount" +import LabAndImg from "@/components/LabAndImg" +import { Text, View } from "@tarojs/components" +import { memo, useCallback, useMemo, useState } from "react" +import styles from './index.module.scss' + +type OrderParam = { + estimate_amount: number, //预估金额 + list: any[], + sale_mode: number, + sale_mode_name: string, + unit: string, + total_colors: number, + total_fabrics: number, + total_number: number, + status: number, //订单状态 + total_sale_price: number, //合计金额 + total_weight_error_discount: number, //空差优惠 + the_previous_status: number, //取消订单时的订单状态 + actual_amount: number, //实付金额 + wait_pay_amount: number //待付金额 +} + +type Param = { + order: OrderParam, + comfirm?: boolean //是否是确认订单页面使用 +} + +export default memo(({order, comfirm = false}:Param) => { + + const { + SaleOrderStatusBooking, // 待接单 + SaleOrderStatusArranging, // 配布中 + SaleOrderStatusArranged, // 已配布 + SaleOrderStatusWaitingPayment, // 待付款 + SaleOrderStatusWaitingDelivery, // 待发货 + SaleOrderStatusWaitingReceipt, // 待收货 + SaleOrderStatusAlreadyReceipt, // 已收货 + SaleOrderStatusComplete, // 已完成 + SaleOrderStatusRefund, // 已退款 + SaleOrderStatusCancel, // 已取消 + SaleorderstatusWaitingPrePayment, // 预付款 + SaleOrderStatusTaking //提货 + } = ORDER_STATUS + + //注册金额 + type orderPriceListParams = {id: number, label: string, field: string, message: string, validatarFunc: (val: typeof order) => any} + const priceList:orderPriceListParams[] = [ + { + id:1, + label:'预估金额', + field: 'estimate_amount', + message: '预估金额按生产商定义的标准匹重计算,仅供参考。详细交易金额以出单为准!', + validatarFunc: (order) => { + return order['estimate_amount'] > 0 && order['total_sale_price'] <= 0 + } + + }, + { + id:2, + label:'合计金额', + field: 'total_sale_price', + message: '包含空差的货款金额', + validatarFunc: (order) => { + return order['total_sale_price'] > 0 + } + }, + { + id:3, + label:'空差优惠', + field: 'total_weight_error_discount', + message: '扣除空差金额', + validatarFunc: (order) => { + return order['total_weight_error_discount'] > 0 + } + }, + { + id:5, + label:'实付金额', + field: 'actual_amount', + message: '本单实付总金额', + validatarFunc: (order) => { + let value = [SaleOrderStatusWaitingPayment.value, SaleOrderStatusTaking.value, SaleOrderStatusWaitingDelivery.value, SaleOrderStatusWaitingReceipt.value, SaleOrderStatusAlreadyReceipt.value, SaleOrderStatusComplete.value, SaleOrderStatusRefund.value] + return value.includes(order.status) + } + }, + { + id:4, + label:'待付金额', + field: 'wait_pay_amount', + message: '扣除空差后的货款金额', + validatarFunc: (order) => { + let value = [SaleOrderStatusWaitingPayment.value, SaleOrderStatusTaking.value, SaleOrderStatusWaitingDelivery.value, SaleOrderStatusWaitingReceipt.value, SaleOrderStatusAlreadyReceipt.value, SaleOrderStatusComplete.value, SaleOrderStatusRefund.value] + return value.includes(order.status) + } + }, + + ] + + //订单流程金额展示 + const priceConDom = useMemo(() => { + if(!order) return + return ( + <> + { + priceList.map(item => { + return <>{item.validatarFunc(order)&&} + }) + } + + ) + }, [order]) + + //对应数量 + const formatCount = useCallback((item) => { + return order?.sale_mode == 0? item.roll : Number(item.length / 100) + }, [order]) + //对应单价 + const standardPrice = useCallback(price => { + return formatPriceDiv(price, 100, true) + '/' + (order?.sale_mode == 1?'m':'kg') + }, [order]) + + //数量格式 + const numText = useMemo(() => { + if(order) { + 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}` + } + }, [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 colorPrice = useCallback((item) => { + let res = item.total_sale_price||item.estimate_amount + return formatPriceDiv(res, 100, true) + },[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 ( + <> + {numText} + + { + order?.list?.map(item => { + return + + {order.sale_mode_name} + {formatHashTag(item.code, item.name)} + 共{item?.product_colors.length}种 + + + {item?.product_colors?.map(colorItem => { + return + + + + + + + {colorItem.code + ' ' + colorItem.name} + {(colorItem?.return_roll > 0)&&{`已退${colorItem?.return_roll}条`}} + {(colorItem?.apply_return_roll > 0)&&{`待退${colorItem?.apply_return_roll}条`}} + + + ¥{standardPrice(colorItem.sale_price)} + {aboutWeight(colorItem.estimate_weight)} + + + + ×{formatCount(colorItem)}{order.unit} + ¥{colorPrice(colorItem)} + + + + })} + + + }) + } + + {showPriceConDom} + + + + ) +}) \ No newline at end of file diff --git a/src/pages/order/components/kindList/index.tsx b/src/pages/order/components/kindList/index.tsx index 1eb8328..754055a 100644 --- a/src/pages/order/components/kindList/index.tsx +++ b/src/pages/order/components/kindList/index.tsx @@ -54,10 +54,8 @@ export default memo(({order, comfirm = false}:Param) => { field: 'estimate_amount', message: '预估金额按生产商定义的标准匹重计算,仅供参考。详细交易金额以出单为准!', validatarFunc: (order) => { - let value = [SaleorderstatusWaitingPrePayment.value, SaleOrderStatusBooking.value, SaleOrderStatusArranging.value] - return value.includes(order.status) + return order['estimate_amount'] > 0 && order['total_sale_price'] <= 0 } - }, { id:2, @@ -65,8 +63,7 @@ export default memo(({order, comfirm = false}:Param) => { field: 'total_sale_price', message: '包含空差的货款金额', validatarFunc: (order) => { - let value = [SaleOrderStatusTaking.value, SaleOrderStatusArranged.value, SaleOrderStatusWaitingPayment.value, SaleOrderStatusWaitingDelivery.value, SaleOrderStatusWaitingReceipt.value, SaleOrderStatusAlreadyReceipt.value, SaleOrderStatusComplete.value, SaleOrderStatusRefund.value, SaleOrderStatusCancel.value] - return (value.includes(order.status)|| order.sale_mode == 1) + return order['total_sale_price'] > 0 } }, { @@ -75,8 +72,7 @@ export default memo(({order, comfirm = false}:Param) => { field: 'total_weight_error_discount', message: '扣除空差金额', validatarFunc: (order) => { - let value = [SaleOrderStatusWaitingPayment.value, SaleOrderStatusWaitingDelivery.value, SaleOrderStatusWaitingReceipt.value, SaleOrderStatusAlreadyReceipt.value, SaleOrderStatusComplete.value, SaleOrderStatusRefund.value, SaleOrderStatusCancel.value] - return (value.includes(order.status) && order.sale_mode == 0 ) + return order['total_weight_error_discount'] > 0 } }, { @@ -85,8 +81,7 @@ export default memo(({order, comfirm = false}:Param) => { field: 'actual_amount', message: '本单实付总金额', validatarFunc: (order) => { - let value = [SaleOrderStatusWaitingPayment.value, SaleOrderStatusTaking.value, SaleOrderStatusWaitingDelivery.value, SaleOrderStatusWaitingReceipt.value, SaleOrderStatusAlreadyReceipt.value, SaleOrderStatusComplete.value, SaleOrderStatusRefund.value] - return value.includes(order.status) + return order['actual_amount'] > 0 } }, { @@ -95,8 +90,16 @@ export default memo(({order, comfirm = false}:Param) => { field: 'wait_pay_amount', message: '扣除空差后的货款金额', validatarFunc: (order) => { - let value = [SaleOrderStatusWaitingPayment.value, SaleOrderStatusTaking.value, SaleOrderStatusWaitingDelivery.value, SaleOrderStatusWaitingReceipt.value, SaleOrderStatusAlreadyReceipt.value, SaleOrderStatusComplete.value, SaleOrderStatusRefund.value] - return value.includes(order.status) + return order['wait_pay_amount'] > 0 && order['refund_amount'] <= 0 + } + }, + { + id:6, + label:'退款金额', + field: 'refund_amount', + message: '已退款金额', + validatarFunc: (order) => { + return order['refund_amount'] > 0 } }, @@ -109,7 +112,7 @@ export default memo(({order, comfirm = false}:Param) => { <> { priceList.map(item => { - return <>{item.validatarFunc(order)&&} + return <>{item.validatarFunc(order)&&} }) } @@ -137,7 +140,7 @@ export default memo(({order, comfirm = false}:Param) => { const comfirmPriceConDom = useMemo(() => { if(!order) return let item = order.sale_mode == 1?priceList[1]:priceList[0] - return + return }, [order]) //确认金额展示 diff --git a/src/pages/order/components/returnRecord/index.tsx b/src/pages/order/components/returnRecord/index.tsx index 2a615d4..6c23990 100644 --- a/src/pages/order/components/returnRecord/index.tsx +++ b/src/pages/order/components/returnRecord/index.tsx @@ -151,7 +151,7 @@ export default memo(({show, onClose, onSubmit, id}:Param) => { {numText(item)} - {item?.type == ReturnApplyOrderTypeReturnForRefund.value?'已申请退货':'已申请退款'} + {item?.type == ReturnApplyOrderTypeReturnForRefund?.value?'已申请退货':'已申请退款'} 订单号:{item?.order_no} diff --git a/src/pages/order/components/scanPayCheck/index.module.scss b/src/pages/order/components/scanPayCheck/index.module.scss new file mode 100644 index 0000000..1aa0537 --- /dev/null +++ b/src/pages/order/components/scanPayCheck/index.module.scss @@ -0,0 +1,55 @@ +$top:170px; +.scanPay_main{ + .scanPay_con{ + padding: 20px; + background-color: #F6F6F6; + border-radius: 20px; + .miconfont_title{ + transform: rotate(-180deg); + position: absolute; + left: 20px; + top: 27px; + font-size: 37px; + color: $color_font_three; + z-index: 99; + + } + } + .title{ + font-size: $font_size_big; + color: #000000; + text-align: center; + font-weight: 700; + position: relative; + padding: 10px 0; + } + .desc{ + font-size: $font_size_min; + color: $color_main; + text-align: center; + padding: 10px 0; + .miconfont{ + font-size: 25px; + } + } + + .scanPay_list{ + border-radius: 10px; + height: 900px; + image{ + width: 100%; + } + } + .btns{ + background: #007aff; + border-radius: 40px; + width: 668px; + height: 82px; + text-align: center; + line-height: 80px; + width: 100%; + color: #fff; + font-size: 32px; + margin-top: 30px; + } +} \ No newline at end of file diff --git a/src/pages/order/components/scanPayCheck/index.tsx b/src/pages/order/components/scanPayCheck/index.tsx new file mode 100644 index 0000000..2c9f805 --- /dev/null +++ b/src/pages/order/components/scanPayCheck/index.tsx @@ -0,0 +1,204 @@ +import { Image, ScrollView, Text, View } from "@tarojs/components"; +import { memo, useEffect, useRef, useState } from "react"; +import classnames from "classnames"; +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 useCheckAuthorize from "@/use/useCheckAuthorize"; +import { GetPayCode } from "@/api/onlinePay"; +import LoadingCard from "@/components/loadingCard"; +import { GetOrderPayApi, GetPrepayOrderPayApi } from "@/api/orderPay"; + + +type Param = { + show?: true|false, + onClose?: () => void, + company?: string, + qrcode?: string, + orderInfo?: any, + +} +type ListParam = { + product_code: string, + product_name: string, + product_color_code: string, + product_color_name: string, + num: string, + weight: string, + length: string, + sale_price: string, + total_price: string +} +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 { + //用预付单id获取支付信息 + let {data} = await prepayOrderFetchData({id: orderInfo?.pre_collect_order_id}) + setPayInfo(() => data) + } + } + + useEffect(() => { + if(orderInfo) + getOrderPay() + }, [orderInfo]) + + useEffect(() => { + if(show) { + getCore() + } + }, [show]) + + useEffect(() => { + if(orderInfo && payInfo) { + console.log('orderInfo::',orderInfo) + let lists:ListParam[] = [] + orderInfo.product_list?.map(pitem => { + pitem?.product_colors?.map(citem => { + lists.push({ + product_code: formatHashTag(pitem.code, '', 'name')!, + product_name: pitem.name, + product_color_code: formatHashTag(citem.code)!, + product_color_name: citem.name, + num: citem.roll.toString(), + length: (citem.length/100).toString(), + weight: formatWeightDiv(citem.estimate_weight).toString(), + sale_price: formatPriceDiv(citem.sale_price).toString(), + total_price: formatPriceDiv(citem.total_sale_price||citem.estimate_amount).toString(), + }) + }) + }) + setDetail(() => ({ + title: "面料销售电子确认单", + company: orderInfo.company_name, //后端公司 + order_type: orderInfo.sale_mode_name, //类型:大货 + sale_user: orderInfo.sale_user_name, //业务员 + order_created_time: formatDateTime(orderInfo.create_time), + order_no: orderInfo.order_no, + shipment_mode: orderInfo.shipment_mode_name, //发货方式 + 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_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) + '', + qrcode:"", //跳转链接 + order_total_weight: formatWeightDiv(orderInfo.total_estimate_weight).toString(), //订单布匹重量 + list: lists + })) + } + }, [orderInfo, payInfo]) + + //收货地址 + const address = (addressInfo) => { + if(addressInfo?.shipment_mode == 2) { + return addressInfo?.province_name?addressInfo.province_name + addressInfo.city_name + addressInfo.district_name + addressInfo.address_detail:'' + } else { + return addressInfo?.take_goods_address + } + } + + //收件人 + const userName = (addressInfo) => { + return addressInfo?.shipment_mode == 2? orderInfo.target_user_name: '' + } + + //手机号 + const userPhone = (addressInfo) => { + return addressInfo?.shipment_mode == 2? orderInfo.target_user_phone : orderInfo.take_goods_phone + } + + + //获取支付二维码 + const [payCodeImage, setPayCodeImage] = useState('') + const fileData = useRef({ + filePath: '', + base64: '' + }) + const {fetchData, state} = GetPayCode() + const getCore = async () => { + let res = await fetchData(detail) + const base64 = res.data.base64 + setPayCodeImage(() => base64) + const time = new Date().valueOf() + const [, format, bodyData] = /data:image\/(\w+);base64,(.*)/.exec(base64) || []; + let filePath = Taro.env.USER_DATA_PATH + '/img' + time +'.'+ format + fileData.current.filePath = filePath + fileData.current.base64 = bodyData + const save = Taro.getFileSystemManager() + save.writeFile({ + filePath: fileData.current.filePath, + data: fileData.current.base64, + encoding: 'base64', + }) + } + + + //检查是否开启保存图片权限 + const {check} = useCheckAuthorize({scope:'scope.writePhotosAlbum', msg:'您没授权,无法保存图片'}) + const saveImageCheck = async () => { + const res = await check() + res&&saveImage() + } + + //保存图片 + const saveImage = () => { + alert.loading('正在保存图片') + Taro.saveImageToPhotosAlbum({ + filePath: fileData.current.filePath, + success: function (res) { + alert.success('图片保存成功') + }, + fail: function (err) { + console.log('err::', err) + } + }) + } + + //预览图片 + const showImage = () => { + console.log('fileData.current.filePath::', fileData.current.filePath) + Taro.previewImage({ + current: fileData.current.filePath, // 当前显示 + urls: [fileData.current.filePath] // 需要预览的图片http链接列表 + }) + } + + //复制功能 + return ( + + + + + 查看销售码单 + + {(state.loading)&&|| + + + } + + 保存电子确认单 + + + + + ) +}) \ No newline at end of file diff --git a/src/pages/order/index.tsx b/src/pages/order/index.tsx index 19ede87..280c016 100644 --- a/src/pages/order/index.tsx +++ b/src/pages/order/index.tsx @@ -24,6 +24,7 @@ import OrderState from "./components/orderState"; import Payment from "./components/payment"; import Remark from "./components/remark"; import ReturnRecord from "./components/returnRecord"; +import ScanPayCheck from "./components/scanPayCheck"; import styles from './index.module.scss' export default () => { @@ -76,23 +77,9 @@ import styles from './index.module.scss' const [formatDetailOrder, setFormatDetailOrder] = useState() //格式化后的数据 const formatData = () => { setFormatDetailOrder({ - estimate_amount: orderDetail.estimate_amount, //预估金额 - 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, //面料数量 + ...orderDetail, unit: orderDetail.sale_mode == 0?'条':'m', //单位 list: orderDetail.product_list, - status: orderDetail.status, //订单状态 - total_sale_price: orderDetail.total_sale_price, //销售金额 - total_should_collect_money: orderDetail.total_should_collect_money, //应收金额 - total_weight_error_discount: orderDetail.total_weight_error_discount, //空差优惠 - actual_amount: orderDetail.actual_amount, //实付金额 - the_previous_status: orderDetail.the_previous_status, //取消订单时的订单状态 - account_period: orderDetail.account_period, - wait_pay_amount: orderDetail.wait_pay_amount //待付金额 - }) } const formatPreViewOrderMemo = useMemo(() => { @@ -195,6 +182,8 @@ import styles from './index.module.scss' } else if(val == 9) { //售后记录 onReturnRecordShow() + } else if(val == 10) { + setShowScanPayCheck(true) } }, [orderDetail]) @@ -239,7 +228,7 @@ import styles from './index.module.scss' const getLogistics = useCallback(() => { if (orderDetail?.delivery_appendix_url) { const list = orderDetail?.delivery_appendix_url?.map(item => { - return formatImgUrl(item) + return formatImgUrl(item, '!w800') }) Taro.previewImage({ current: list[0], // 当前显示 @@ -289,6 +278,9 @@ import styles from './index.module.scss' setReturnRecordShow(false) }, []) + //显示 + const [showScanPayCheck, setShowScanPayCheck] = useState(false) + return ( {(orderDetail?.status != SaleorderstatusWaitingPrePayment.value)&&|| @@ -328,6 +320,7 @@ import styles from './index.module.scss' getRemark(e)} defaultValue={orderDetail?.remark}/> + setShowScanPayCheck(false)} orderInfo={orderDetail}/> setShowCart(false)}/> diff --git a/src/pages/orderList/components/order/index.tsx b/src/pages/orderList/components/order/index.tsx index 04eed24..562ee73 100644 --- a/src/pages/orderList/components/order/index.tsx +++ b/src/pages/orderList/components/order/index.tsx @@ -118,11 +118,11 @@ export default memo(({value, onClickBtn}: Param) => { ) }) } - + {value?.product_list[0].length > 2 && …… …… …… - + } @@ -130,7 +130,7 @@ export default memo(({value, onClickBtn}: Param) => { ¥{value.total_sale_price?formatPriceDiv(value.total_sale_price, 100, true):formatPriceDiv(value.estimate_amount, 100, true)} - + ) }) diff --git a/src/pages/orderList/index.tsx b/src/pages/orderList/index.tsx index 65e3df3..9420e38 100644 --- a/src/pages/orderList/index.tsx +++ b/src/pages/orderList/index.tsx @@ -16,6 +16,7 @@ import { alert } from "@/common/common" import { useRouter } from "@tarojs/runtime" import ApplyRefund from "../order/components/applyRefund" import ReturnRecord from "../order/components/returnRecord" +import ScanPayCheck from "../order/components/scanPayCheck" export default () => { const {checkLogin} = useLogin() @@ -122,6 +123,8 @@ export default () => { addShopCart(orderInfo) } else if (status == 9) { onReturnRecordShow() + } else if (status == 10) { + setShowScanPayCheck(true) } }, [orderData]) @@ -190,7 +193,9 @@ export default () => { setReturnRecordShow(false) }, []) - + //显示 + const [showScanPayCheck, setShowScanPayCheck] = useState(false) + return ( diff --git a/src/pages/salesAfter/components/kindList/index copy.tsx b/src/pages/salesAfter/components/kindList/index copy.tsx new file mode 100644 index 0000000..2bcf0e2 --- /dev/null +++ b/src/pages/salesAfter/components/kindList/index copy.tsx @@ -0,0 +1,224 @@ +import { AFTER_ORDER_STATUS, ORDER_STATUS, REFUND_STATUS } from "@/common/enum" +import { formatHashTag, formatPriceDiv, formatWeightDiv } from "@/common/fotmat" +import EstimatedAmount from "@/components/estimatedAmount" +import LabAndImg from "@/components/LabAndImg" +import { Text, View } from "@tarojs/components" +import { memo, useCallback, useMemo } from "react" +import styles from './index.module.scss' + +type OrderParam = { + estimate_amount: number, //预估金额 + list: any[], + product_list: any[], + quality_check_pass_product: any[], + sale_mode: number, + sale_mode_name: string, + unit: string, + total_colors: number, + total_fabrics: number, + total_number: number, + stage: number, //订单状态 + type: 1|2, //1退货, 2退款 + refund_type: number, //退款状态 + total_sale_price: number, //销售金额 + total_should_collect_money: number, //应收金额 + total_weight_error_discount: number, //空差优惠 + the_previous_status: number, //取消订单时的订单状态 + actual_amount: number //实付金额 + quality_check_pass_colors: number, //验布后的颜色总数 + quality_check_pass_fabrics: number, //验布后的面料数量 + quality_check_pass_number: number, //验布后的总数量 +} + +type Param = { + order: OrderParam, + comfirm?: boolean //是否是确认订单页面使用 +} + +export default memo(({order, comfirm = false}:Param) => { + //对应数量 + const formatCount = useCallback((item) => { + return order?.sale_mode == 0? item.roll : Number(item.length / 100) + }, [order]) + //对应单价 + const standardPrice = useCallback(price => { + return formatPriceDiv(price).toLocaleString() + '/' + (order?.sale_mode == 1?'m':'kg') + }, [order]) + //数量格式 + const numText = useMemo(() => { + 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}` + } 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}` + } + } + }, [order]) + + //获取面料数组 + const list = useMemo(() => { + return order?.quality_check_pass_product?.length > 0?order?.quality_check_pass_product:order?.product_list + }, [order]) + + //售后单状态枚举 + const { + ReturnStageApplying, // 申请中 + ReturnStageWaitCheck, // 退货中 + ReturnStageChecked, // 待验布 + ReturnStageReturned, // 已退款 + ReturnStageCancel, // 已取消 + ReturnStageQualityCheckPendingRefund, // 已验布 + ReturnStageServiceOrderPendingRefund, // 待退款 + ReturnStageRejected, // 已拒绝 + } = AFTER_ORDER_STATUS + + //退款状态枚举 + const { + ShouldCollectOrderRefundTypeUnknown, + ShouldCollectOrderRefundTypeAdvanceReceiptRefund, + ShouldCollectOrderRefundTypeReturnForRefund, + ShouldCollectOrderRefundTypeSalesRefund, + } = REFUND_STATUS + + //金额列表枚举 + const priceList = [ + { + id:5, + big_value:[ + ReturnStageQualityCheckPendingRefund.value, + ReturnStageServiceOrderPendingRefund.value, + ReturnStageReturned.value, + ], + cut_value: [ + ReturnStageRejected.value, + ReturnStageApplying.value, + ReturnStageWaitCheck.value, + ReturnStageChecked.value, + ReturnStageQualityCheckPendingRefund.value, + ReturnStageServiceOrderPendingRefund.value, + ReturnStageReturned.value, + ReturnStageCancel.value + ], + model_value: [ + ReturnStageApplying.value, + ReturnStageWaitCheck.value, + ReturnStageChecked.value, + ReturnStageQualityCheckPendingRefund.value, + ReturnStageServiceOrderPendingRefund.value, + ReturnStageReturned.value, + ReturnStageCancel.value + ], + label:'合计金额', + field: 'total_refund_amount', + message: '按原单价*退货重量的金额', + + }, + { + id:1, + big_value:[ReturnStageReturned.value], + cut_value: [ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value], + model_value: [], + label:'扣款金额', + field: 'other_deduction_amount', + message: '本次售后扣款金额' + }, + { + id:3, + big_value:[ReturnStageReturned.value], + cut_value: [ReturnStageReturned.value], + model_value: [ReturnStageReturned.value], + label:'退款金额', + field: 'refund_amount', + message: '本次售后应退款金额' + }, + { + id:4, + big_value:[ReturnStageReturned.value], + cut_value: [ReturnStageReturned.value], + model_value: [ReturnStageReturned.value], + label:'退款去向', + field: 'refund_flow_name', + message: '本次售后应退款金额' + }, + ] + + //是否显示价格 + const showPrice = useCallback((priceInfo) => { + let key = ['big_value', 'model_value', 'cut_value'] + if(priceInfo.id == 5) { + return priceInfo[key[order?.sale_mode]].includes(order?.stage)||(order.refund_type == ShouldCollectOrderRefundTypeSalesRefund.value) + } else { + return priceInfo[key[order?.sale_mode]].includes(order?.stage) + } + }, [order]) + + const priceConDom = useMemo(() => { + if(!order) return + return ( + <> + { + priceList.map(item => { + return <>{showPrice(item)&&} + }) + } + + ) + }, [order]) + + //整理颜色 + const labAndRgbAndUrl = useCallback((item) => { + return {lab:{...item?.lab}, rgb:{...item?.rgb}, texturl_url: item?.texturl_url} + }, []) + + //单价显示判断 + const sale_price_show = useMemo(() => { + return order?.stage != ReturnStageServiceOrderPendingRefund.value && order?.stage != ReturnStageQualityCheckPendingRefund.value + }, [order]) + + return ( + + + {order?.type == 1?'退货信息':'退款信息'} + { + list?.map(item => { + return + + {order.sale_mode_name} + {formatHashTag(item.code, item.name)} + 共{item?.product_colors?.length}种 + + + {item?.product_colors?.map(colorItem => { + return + + + + + + {colorItem.code + ' ' + colorItem.name} + + {sale_price_show&&¥{standardPrice(colorItem.sale_price)}} + {(order?.stage == ReturnStageReturned.value)&&总重{formatWeightDiv(colorItem.estimate_weight)}kg} + + + + ×{formatCount(colorItem)}{order.unit} + ¥{formatPriceDiv(colorItem.estimate_amount).toLocaleString()} + + + + })} + + + }) + } + 合计{numText} + + {priceConDom} + + + + ) +}) \ No newline at end of file diff --git a/src/pages/salesAfter/components/kindList/index.module.scss b/src/pages/salesAfter/components/kindList/index.module.scss index e713a98..40fbb04 100644 --- a/src/pages/salesAfter/components/kindList/index.module.scss +++ b/src/pages/salesAfter/components/kindList/index.module.scss @@ -40,10 +40,9 @@ } .order_list_scroll{ margin-top: 30px; - .order_list_item { display: flex; - &:nth-child(2) { + &:nth-child(n + 2) { margin-top: 30px; } .order_list_item_img{ @@ -82,7 +81,6 @@ .order_list_item_count{ display: flex; flex-direction: column; - justify-content: center; align-items: flex-end; .count_num{ color: $color_main; diff --git a/src/pages/salesAfter/components/kindList/index.tsx b/src/pages/salesAfter/components/kindList/index.tsx index 4a98a5c..3129cc2 100644 --- a/src/pages/salesAfter/components/kindList/index.tsx +++ b/src/pages/salesAfter/components/kindList/index.tsx @@ -59,7 +59,7 @@ export default memo(({order, comfirm = false}:Param) => { //获取面料数组 const list = useMemo(() => { - return order?.quality_check_pass_product.length > 0?order?.quality_check_pass_product:order?.product_list + return order?.quality_check_pass_product?.length > 0?order?.quality_check_pass_product:order?.product_list }, [order]) //售后单状态枚举 @@ -75,82 +75,49 @@ export default memo(({order, comfirm = false}:Param) => { } = AFTER_ORDER_STATUS //退款状态枚举 - const { - ShouldCollectOrderRefundTypeUnknown, - ShouldCollectOrderRefundTypeAdvanceReceiptRefund, - ShouldCollectOrderRefundTypeReturnForRefund, - ShouldCollectOrderRefundTypeSalesRefund, - } = REFUND_STATUS + // const { + // ShouldCollectOrderRefundTypeUnknown, + // ShouldCollectOrderRefundTypeAdvanceReceiptRefund, + // ShouldCollectOrderRefundTypeReturnForRefund, + // ShouldCollectOrderRefundTypeSalesRefund, + // } = REFUND_STATUS //金额列表枚举 const priceList = [ { id:5, - big_value:[ - ReturnStageQualityCheckPendingRefund.value, - ReturnStageServiceOrderPendingRefund.value, - ReturnStageReturned.value, - ], - cut_value: [ReturnStageRejected.value, - ReturnStageApplying.value, - ReturnStageWaitCheck.value, - ReturnStageChecked.value, - ReturnStageQualityCheckPendingRefund.value, - ReturnStageServiceOrderPendingRefund.value, - ReturnStageReturned.value, - ReturnStageCancel.value - ], - model_value: [ - ReturnStageApplying.value, - ReturnStageWaitCheck.value, - ReturnStageChecked.value, - ReturnStageQualityCheckPendingRefund.value, - ReturnStageServiceOrderPendingRefund.value, - ReturnStageReturned.value, - ReturnStageCancel.value - ], + value: [ReturnStageReturned.value], label:'合计金额', field: 'total_refund_amount', - message: '按原单价*退货重量的金额' + message: '按原单价*退货重量的金额', + }, { id:1, - big_value:[ReturnStageReturned.value], - cut_value: [ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value], - model_value: [], + value: [ReturnStageReturned.value], label:'扣款金额', field: 'other_deduction_amount', message: '本次售后扣款金额' }, { id:3, - big_value:[ReturnStageReturned.value], - cut_value: [ReturnStageReturned.value], - model_value: [ReturnStageReturned.value], + value: [ReturnStageReturned.value], label:'退款金额', field: 'refund_amount', message: '本次售后应退款金额' }, { id:4, - big_value:[ReturnStageReturned.value], - cut_value: [ReturnStageReturned.value], - model_value: [ReturnStageReturned.value], + value: [ReturnStageReturned.value], label:'退款去向', field: 'refund_flow_name', - message: '本次售后应退款金额' + message: '本次售后退款金额去向' }, - ] //是否显示价格 const showPrice = useCallback((priceInfo) => { - let key = ['big_value', 'model_value', 'cut_value'] - if(priceInfo.id == 5) { - return priceInfo[key[order?.sale_mode]].includes(order?.stage)||(order.refund_type == ShouldCollectOrderRefundTypeSalesRefund.value) - } else { - return priceInfo[key[order?.sale_mode]].includes(order?.stage) - } + return priceInfo.value.includes(order?.stage) }, [order]) const priceConDom = useMemo(() => { @@ -159,7 +126,7 @@ export default memo(({order, comfirm = false}:Param) => { <> { priceList.map(item => { - return <>{showPrice(item)&&} + return <>{showPrice(item)&&} }) } @@ -175,6 +142,11 @@ export default memo(({order, comfirm = false}:Param) => { const sale_price_show = useMemo(() => { return order?.stage != ReturnStageServiceOrderPendingRefund.value && order?.stage != ReturnStageQualityCheckPendingRefund.value }, [order]) + + //销售价格 + const formatPrice = useCallback((colorItem) => { + return (ReturnStageReturned.value == order?.stage) && ¥{formatPriceDiv(colorItem.estimate_amount, {} , true)} + }, [order]) return ( @@ -204,7 +176,7 @@ export default memo(({order, comfirm = false}:Param) => { ×{formatCount(colorItem)}{order.unit} - ¥{formatPriceDiv(colorItem.estimate_amount).toLocaleString()} + {formatPrice(colorItem)} diff --git a/src/pages/searchList/hightSearchList.tsx b/src/pages/searchList/hightSearchList.tsx index a829398..97e638f 100644 --- a/src/pages/searchList/hightSearchList.tsx +++ b/src/pages/searchList/hightSearchList.tsx @@ -153,6 +153,11 @@ export default () => { setSearchField((e) => ({...e, abstract_sort_key: value})) } } + + const labAndImgObj = useCallback((item) => { + const img = item?item.texture_url.split(',')[0]:'' + return {lab:item.lab,rgb:item.rgb,texture_url:img} + }, [materialList]) return ( @@ -202,7 +207,7 @@ export default () => { {materialList.list.map(item => { return goLinkPage(item)}> - + {(item.product_color_code)} diff --git a/src/pages/searchList/searchList.config.ts b/src/pages/searchList/searchList.config.ts index 51b40a0..34c8c61 100644 --- a/src/pages/searchList/searchList.config.ts +++ b/src/pages/searchList/searchList.config.ts @@ -1,5 +1,5 @@ export default { - navigationBarTitleText: '高级搜索', + navigationBarTitleText: '搜索', enablePullDownRefresh: true, backgroundTextStyle: 'dark' } diff --git a/src/pages/searchList/searchList.tsx b/src/pages/searchList/searchList.tsx index 12f10da..e1e7574 100644 --- a/src/pages/searchList/searchList.tsx +++ b/src/pages/searchList/searchList.tsx @@ -136,6 +136,11 @@ export default () => { setSearchField((e) => ({...e, abstract_sort_key: value})) } } + + const labAndImgObj = useCallback((item) => { + const img = item?item.texture_url.split(',')[0]:'' + return {lab:item.lab,rgb:item.rgb,texture_url:img} + }, [materialList]) return ( @@ -179,7 +184,7 @@ export default () => { {materialList.list.map(item => { return goLinkPage(item)}> - + {(item.product_color_count)}色