diff --git a/src/components/codeSelect/index.module.scss b/src/components/codeSelect/index.module.scss index 4d4b5f8..305fc2e 100644 --- a/src/components/codeSelect/index.module.scss +++ b/src/components/codeSelect/index.module.scss @@ -8,7 +8,7 @@ width: 306px; background-color: #fff; color: #337fff; - top: -290px; + transform: translateY(-100%); right: 0; padding: 20px; font-size: 28px; diff --git a/src/components/codeSelect/index.tsx b/src/components/codeSelect/index.tsx index 54c9512..6243e0c 100644 --- a/src/components/codeSelect/index.tsx +++ b/src/components/codeSelect/index.tsx @@ -5,6 +5,7 @@ import IconFont from '../iconfont/iconfont' import styles from './index.module.scss' import { goLink } from '@/common/common' import ViewCodeList from '@/components/viewCodeList/index' +import { GetCustomCodeDetailApi } from '@/api/codeManage' interface param { y: number @@ -28,15 +29,50 @@ export default ({ y, orderObj = {} }: param) => { const [showPopup, setshowPopup] = useState(false) + const [codeData, setCodeData] = useState(null) + + const { fetchData: getCustomCodeDetail } = GetCustomCodeDetailApi() + const onGetCustomCodeDetail = async() => { + const res = await getCustomCodeDetail({ id: orderObj.custom_print_id }) + const { data } = res + setCodeData({ + dyelot_number_list: data.dyelot_number_list, + total_number: data.roll, + title: data.purchaser_name, + sale_mode_name: data.sale_mode_name, + purchaser_name: data.purchaser_name, + purchaser_phone: data.purchaser_phone, + create_time: data.create_time, + bill_total_sale_price: data.total_amount, + total_weight: data.total_sale_weight, + total_settle_weight: data.total_settlement_weight, + total_weight_error: data.total_weight_error, + show_pay_type: false, + show_order_no: false, + show_shipment_mode: false, + show_barcode: false, + show_qrcode: false, + }) + } + + const openOldPrive = () => { + setCodeData(orderObj) + setshowPopup(true) + } + + const openNewPrive = () => { + onGetCustomCodeDetail() + setshowPopup(true) + } return (<> {showCode && setShowCode(!showCode)}>} {showCode && - setshowPopup(true)}> + 原始码单预览 - {!!orderObj?.custom_print_id && + {!!orderObj?.custom_print_id && 自定义码单预览 } @@ -47,7 +83,7 @@ export default ({ y, orderObj = {} }: param) => { } setShowCode(!showCode)}>码单 - setshowPopup(false)}> + setshowPopup(false)}> ) } diff --git a/src/components/moveBtn/index.tsx b/src/components/moveBtn/index.tsx index 8df39a9..e5dc9f6 100644 --- a/src/components/moveBtn/index.tsx +++ b/src/components/moveBtn/index.tsx @@ -1,7 +1,7 @@ import { Button, Image, MovableArea, MovableView, View } from '@tarojs/components' import Taro, { useDidShow, useReady, useRouter } from '@tarojs/taro' import type { ReactElement } from 'react' -import { useEffect, useLayoutEffect, useRef, useState } from 'react' +import { useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react' import classnames from 'classnames' import Customer from '../customer' import CodeSelect from '../codeSelect' @@ -11,6 +11,7 @@ import useCommonData from '@/use/useCommonData' import { useSelector } from '@/reducers/hooks' import { alert } from '@/common/common' import { formatImgUrl } from '@/common/fotmat' +import { ORDER_STATUS } from '@/common/enum' type ShowStatus = 'shop'|'customer'|'order'|'code' interface param { @@ -68,6 +69,31 @@ const MoveBtn = ({ orderObj = {}, children = null, onShopClick, showList = [], m set_customer_service_show(false) } + // 订单状态枚举 + const { + SaleOrderStatusArranged, // 已配布 + SaleOrderStatusWaitingPayment, // 待付款 + SaleOrderStatusTaking, // 提货中 + SaleOrderStatusWaitingDelivery, // 待发货 + SaleOrderStatusWaitingReceipt, // 待收货 + SaleOrderStatusAlreadyReceipt, // 已收货 + SaleOrderStatusComplete, // 已完成 + SaleOrderStatusRefund, // 已退款 + } = ORDER_STATUS + + const showCode = useMemo(() => { + return onShow('code') && [ + SaleOrderStatusArranged.value, + SaleOrderStatusWaitingPayment.value, + SaleOrderStatusTaking.value, + SaleOrderStatusWaitingDelivery.value, + SaleOrderStatusWaitingReceipt.value, + SaleOrderStatusAlreadyReceipt.value, + SaleOrderStatusComplete.value, + SaleOrderStatusRefund.value, + ].includes(orderObj.status) + }, [orderObj.status]) + return ( {children} @@ -102,7 +128,7 @@ const MoveBtn = ({ orderObj = {}, children = null, onShopClick, showList = [], m > } - {onShow('code') && } + {showCode && } )