From af03e5fdd3b5855502a9bb70b1d91ae2a2795936 Mon Sep 17 00:00:00 2001 From: czm <2192718639@qq.com> Date: Tue, 3 Jan 2023 14:42:14 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(=E9=A2=84=E8=A7=88=E7=A0=81?= =?UTF-8?q?=E5=8D=95=E5=AF=B9=E6=8E=A5):?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/constant.ts | 8 +-- src/components/calendar/body/index.tsx | 3 +- src/components/calendar/index.tsx | 1 + .../calendar/ui/date-list/index.tsx | 1 - src/components/timePicker/index.tsx | 10 ++-- src/components/viewCodeList/index.tsx | 15 +++++- .../codeList/components/codeModel/index.tsx | 8 ++- src/pages/codeList/index.tsx | 4 +- .../components/main/index.module.scss | 3 ++ .../codeColorList/components/main/index.tsx | 13 ++++- .../components/colorItemSetting/index.tsx | 7 +-- .../codeSetting/components/main/index.tsx | 54 +++++++++++++++++++ 12 files changed, 105 insertions(+), 22 deletions(-) diff --git a/src/common/constant.ts b/src/common/constant.ts index d0d8762..985e4ff 100644 --- a/src/common/constant.ts +++ b/src/common/constant.ts @@ -4,7 +4,7 @@ // export const BASE_URL = `http://10.0.0.5:50001/lymarket` // export const BASE_URL = `http://192.168.0.89:40001/lymarket` // export const BASE_URL = `http://192.168.1.165:40001/lymarket` // 王霞 -export const BASE_URL = 'https://test.zzfzyc.com/lymarket' // 测试环境 +// export const BASE_URL = 'https://test.zzfzyc.com/lymarket' // 测试环境 // export const BASE_URL = 'https://pre.zzfzyc.com/lymarket' // 预发布 // export const BASE_URL = `http://192.168.1.9:40001/lymarket` // 发 // export const BASE_URL = `http://192.168.1.9:50005/lymarket` // 发 @@ -14,7 +14,7 @@ export const BASE_URL = 'https://test.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.28:50002/lymarket' // 婷 -// export const BASE_URL = 'http://192.168.1.42:50002/lymarket' // 杰 +export const BASE_URL = 'http://192.168.1.42:50002/lymarket' // 杰 // CDN // 生成密钥 @@ -28,8 +28,8 @@ export const SEARCH_EMPTY_IMAGE = `${IMG_CND_Prefix}/search_empty.png` export const COLLECTION_EMPTY_IMAGE = `${IMG_CND_Prefix}/mall/collection_empty.png` // 在线支付图片baseUrl -export const CAP_HTML_TO_IMAGE_BASE_URL = CURRENT_CAP_HTML_TO_IMAGE_BASE_URL -// export const CAP_HTML_TO_IMAGE_BASE_URL = 'http://192.168.1.127:8081' +// export const CAP_HTML_TO_IMAGE_BASE_URL = CURRENT_CAP_HTML_TO_IMAGE_BASE_URL +export const CAP_HTML_TO_IMAGE_BASE_URL = 'http://192.168.1.127:8081' // 获取CND资源 export const getCDNSource = (suffix: string) => { return IMG_CND_Prefix + suffix diff --git a/src/components/calendar/body/index.tsx b/src/components/calendar/body/index.tsx index c091f98..f6664bc 100644 --- a/src/components/calendar/body/index.tsx +++ b/src/components/calendar/body/index.tsx @@ -133,6 +133,8 @@ Readonly true, ) + console.log('nowList:::', selectedDate) + const nextList: Calendar.ListInfo = this.generateFunc( dayjsDate.add(1, 'month').valueOf(), selectedDate, @@ -259,7 +261,6 @@ Readonly public render(): JSX.Element { const { isSwiper } = this.props const { isAnimate, offsetSize, listGroup } = this.state - if (!isSwiper) { return ( end = start } + console.log('generateDateValue:::', generateDateValue) return { generateDate: generateDateValue, selectedDate: this.getSelectedDate(start, end), diff --git a/src/components/calendar/ui/date-list/index.tsx b/src/components/calendar/ui/date-list/index.tsx index f421331..fc34aba 100644 --- a/src/components/calendar/ui/date-list/index.tsx +++ b/src/components/calendar/ui/date-list/index.tsx @@ -34,7 +34,6 @@ export default class AtCalendarList extends React.Component { public render(): JSX.Element | null { const { list } = this.props if (!list || list.length === 0) { return null } - return ( {list.map((item: Calendar.Item) => ( diff --git a/src/components/timePicker/index.tsx b/src/components/timePicker/index.tsx index 2497dbd..ef69af0 100644 --- a/src/components/timePicker/index.tsx +++ b/src/components/timePicker/index.tsx @@ -1,5 +1,5 @@ import { View } from '@tarojs/components' -import { memo, useState } from 'react' +import { memo, useMemo, useState } from 'react' import dayjs from 'dayjs' import NormalButton from '../normalButton' import styles from './index.module.scss' @@ -34,6 +34,9 @@ const TimePicker = (props: Props) => { console.log('e===>', e) setTime(e) } + const currentDate = useMemo(() => { + return (!start && !end) ? null : { start, end } + }, [props]) // 由于小程序的bug,部分ios和安卓显示时间的时候会有问题,原因是格式化时有`-`这个横杠 return ( <> @@ -41,10 +44,7 @@ const TimePicker = (props: Props) => { handTime(e)} /> diff --git a/src/components/viewCodeList/index.tsx b/src/components/viewCodeList/index.tsx index cdd885b..529a068 100644 --- a/src/components/viewCodeList/index.tsx +++ b/src/components/viewCodeList/index.tsx @@ -23,6 +23,7 @@ export default (props: Props) => { // 手机号 const userPhone = (addressInfo) => { + if (addressInfo.purchaser_phone) { return addressInfo.purchaser_phone } return addressInfo?.shipment_mode == 2 ? props.orderObj.target_user_phone : props.orderObj.take_goods_phone } @@ -41,6 +42,11 @@ export default (props: Props) => { return addressInfo?.shipment_mode == 2 ? props?.orderObj.target_user_name : '' } + // 显示隐藏 + const showStatus = (state: boolean) => { + return (state !== false && state !== true) ? true : state + } + // 预览图片 const showImage = (e) => { e.stopPropagation() @@ -92,6 +98,7 @@ export default (props: Props) => { client: props.orderObj.purchaser_name, // 客户名称 phone: userPhone(props.orderObj), // 收货手机号码 order_total_length: (props.orderObj.total_number / 100).toString(), // 订单布匹长度 + order_total_num: `${props.orderObj.total_number}`, order_total_price: formatPriceDiv(props.orderObj.bill_total_sale_price).toString(), // 订单价格 qrcode: `${PAY_H5_CODE_URL}?key=${props.orderObj.md5_key}`, // 跳转链接 order_total_weight: formatWeightDiv(props.orderObj.total_weight || props.orderObj.total_estimate_weight).toString(), // 订单布匹重量 @@ -104,8 +111,12 @@ export default (props: Props) => { show_deduction_amount: false, show_sale_price: props.orderObj.is_display_price, - show_barcode: true, // 条形码 - show_qrcode: true, + show_barcode: showStatus(props.orderObj.show_barcode), // 条形码 + show_qrcode: showStatus(props.orderObj.show_qrcode), + show_pay_type: showStatus(props.orderObj.show_pay_type), // 是否显示结算方式 + show_order_no: showStatus(props.orderObj.show_order_no), // 是否显示订单号 + show_shipment_mode: showStatus(props.orderObj.show_shipment_mode), // 是否显示发货方式 + } const res = await fetchData(query) if (res.data) { diff --git a/src/pages/codeList/components/codeModel/index.tsx b/src/pages/codeList/components/codeModel/index.tsx index 8b2404e..6bbd847 100644 --- a/src/pages/codeList/components/codeModel/index.tsx +++ b/src/pages/codeList/components/codeModel/index.tsx @@ -8,7 +8,11 @@ import SelectList from '@/components/selectList' import Search from '@/components/search' import { GetCustomCodeLApi } from '@/api/codeManage' -export default () => { +interface ParamType { + onClickData: () => void +} +export default (props: ParamType) => { + const { onClickData } = props const [formData, setFormData] = useState<{ sale_start_time?: string; sale_end_time?: string; any_query?: string }|null>(null) // 获取码单列表 const [list, setList] = useState([]) @@ -33,7 +37,7 @@ export default () => { return - + 日期 diff --git a/src/pages/codeList/index.tsx b/src/pages/codeList/index.tsx index 3bd793e..6ab083b 100644 --- a/src/pages/codeList/index.tsx +++ b/src/pages/codeList/index.tsx @@ -14,9 +14,9 @@ export default () => { ] const [selectIndex, setSelectIndex] = useState(1) return - {selectIndex == 1 && setSelectIndex(index)} />} + setSelectIndex(index)} /> {selectIndex == 1 && } {selectIndex == 2 && } - + {/* */} } diff --git a/src/pages/codeSetting/codeColorList/components/main/index.module.scss b/src/pages/codeSetting/codeColorList/components/main/index.module.scss index 50e077e..413df56 100644 --- a/src/pages/codeSetting/codeColorList/components/main/index.module.scss +++ b/src/pages/codeSetting/codeColorList/components/main/index.module.scss @@ -4,6 +4,9 @@ padding-bottom: 200px; min-height: 100vh; box-sizing: border-box; + .loading_card { + height: 70vh; + } .bottom_btn { display: flex; justify-content: space-between; diff --git a/src/pages/codeSetting/codeColorList/components/main/index.tsx b/src/pages/codeSetting/codeColorList/components/main/index.tsx index 2a7a631..25577bc 100644 --- a/src/pages/codeSetting/codeColorList/components/main/index.tsx +++ b/src/pages/codeSetting/codeColorList/components/main/index.tsx @@ -1,9 +1,10 @@ import { Text, View } from '@tarojs/components' import Taro, { getCurrentPages, useDidHide } from '@tarojs/taro' -import { useEffect } from 'react' +import { useEffect, useState, useTransition } from 'react' import ColorItemSetting from '../../../components/colorItemSetting' import styles from './index.module.scss' import { useCurrenCode } from '@/context/ContextCodeSetting' +import LoadingCard from '@/components/loadingCard' export default () => { const { dispatch, productData } = useCurrenCode() @@ -16,13 +17,21 @@ export default () => { dispatch({ type: 'updateData', data: { ...productData.data }, update_status: 1 }) Taro.navigateBack() } + const [colorData, setColorData] = useState([]) + const [isPending, startTransition] = useTransition() useEffect(() => { + startTransition(() => { + setColorData(productData.color_item_data) + }) return () => { dispatch({ type: 'updateColorData', data: null }) } }, []) + return - + {isPending || colorData.length == 0 + ? + : } 取消 diff --git a/src/pages/codeSetting/components/colorItemSetting/index.tsx b/src/pages/codeSetting/components/colorItemSetting/index.tsx index 0020882..63d04ef 100644 --- a/src/pages/codeSetting/components/colorItemSetting/index.tsx +++ b/src/pages/codeSetting/components/colorItemSetting/index.tsx @@ -8,10 +8,11 @@ import PopupModal from '@/components/popupModal' interface IndexParam { productInfo: any - onChangeName: (val: string) => void + onChangeName?: (val: string) => void } -export default memo(() => { +export default memo((props: IndexParam) => { + const { productInfo } = props const { dispatch, productData } = useCurrenCode() const getNewName = useCallback((name) => { productData.color_item_data = { @@ -19,7 +20,7 @@ export default memo(() => { product_name: name, } dispatch({ type: 'updateColorData', data: { ...productData.color_item_data }, update_status: 2 }) - }, [productData.color_item_data]) + }, [productInfo]) return <> diff --git a/src/pages/codeSetting/components/main/index.tsx b/src/pages/codeSetting/components/main/index.tsx index b7e69e4..c39c954 100644 --- a/src/pages/codeSetting/components/main/index.tsx +++ b/src/pages/codeSetting/components/main/index.tsx @@ -15,7 +15,26 @@ import { formatPriceDiv, formatWeightDiv } from '@/common/fotmat' import { useCurrenCode } from '@/context/ContextCodeSetting' import { alert } from '@/common/common' import LoadingCard from '@/components/loadingCard' +import ViewCodeList from '@/components/viewCodeList' +interface previewParam { + dyelot_number_list: any[] + total_number: number + title: string + sale_mode_name: string + purchaser_name: string + purchaser_phone: string + create_time: string + bill_total_sale_price: number + total_weight: number + total_settle_weight: number + total_weight_error: number + show_pay_type: boolean + show_order_no: boolean + show_shipment_mode: boolean + show_barcode: boolean + show_qrcode: boolean +} export default () => { const { productData, dispatch } = useCurrenCode() const { custom_print_id, sale_order_id } = useRouter().params @@ -90,6 +109,24 @@ export default () => { total_sale_weight: codeData.total_sale_weight, total_amount: codeData.total_amount, })) + setPreviewData({ + dyelot_number_list: codeData.dyelot_number_list, + total_number: codeData.roll, + title: codeData.purchaser_name, + sale_mode_name: codeData.sale_mode_name, + purchaser_name: codeData.purchaser_name, + purchaser_phone: codeData.purchaser_phone, + create_time: codeData.create_time, + bill_total_sale_price: codeData.total_amount, + total_weight: codeData.total_sale_weight, + total_settle_weight: codeData.total_settlement_weight, + total_weight_error: codeData.total_weight_error, + show_pay_type: false, + show_order_no: false, + show_shipment_mode: false, + show_barcode: false, + show_qrcode: false, + }) } }, [codeData]) @@ -128,6 +165,9 @@ export default () => { else if (type === 'del') { deleteCode() } + else if (type === 'preview') { + setshowPopup(true) + } })() } @@ -155,6 +195,14 @@ export default () => { total_sale_weight: res?.data?.total_sale_weight, total_amount: res?.data?.total_amount, })) + setPreviewData(e => ({ + ...e, + bill_total_sale_price: res?.data?.total_amount, + total_weight: res?.data?.total_sale_weight, + total_settle_weight: res?.data?.total_settlement_weight, + total_weight_error: res?.data?.total_weight_error, + dyelot_number_list: res?.data?.dyelot_number_list, + })) } } @@ -178,6 +226,11 @@ export default () => { }) } + // 获取预览码单数据 + const [previewData, setPreviewData] = useState({}) + + const [showPopup, setshowPopup] = useState(false) + return @@ -227,6 +280,7 @@ export default () => { } + setshowPopup(false)}> }