From 79de81702a2bc82c905ac5d80e412aa906b7ebc5 Mon Sep 17 00:00:00 2001 From: xuan Date: Tue, 28 Feb 2023 16:49:37 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20fix(ID1001366):=20=E3=80=90?= =?UTF-8?q?=E5=86=85=E9=83=A8=E5=B0=8F=E7=A8=8B=E5=BA=8F=E3=80=91-?= =?UTF-8?q?=E3=80=90=E9=A2=86=E5=8F=96=E8=89=B2=E5=8D=A1=E3=80=91--?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E5=AE=A2=E6=88=B7=E5=90=8E=EF=BC=8C=E6=9C=89?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E5=9C=B0=E5=9D=80=E7=9A=84=EF=BC=8C=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E8=87=AA=E5=8A=A8=E5=B8=A6=E5=85=A5=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【【内部小程序】-【领取色卡】--选择客户后,有默认地址的,没有自动带入默认地址】 https://www.tapd.cn/53459131/bugtrace/bugs/view/1153459131001001366 --- project.private.config.json | 7 +++ src/common/constant.ts | 4 +- src/components/AddressList/index.tsx | 2 - .../colorCardItem/index.module.scss | 2 +- src/pages/getColorCard/addColorCard/index.tsx | 43 ++++++++++--------- .../addressDetailBox/index.module.scss | 5 --- .../components/addressDetailBox/index.tsx | 26 +++++------ .../sampleCutting/addSampleCutting/index.tsx | 20 +++++++++ .../sampleCutting/sampleCuttingList/index.tsx | 7 ++- 9 files changed, 71 insertions(+), 45 deletions(-) diff --git a/project.private.config.json b/project.private.config.json index 14ae573..6eca9dd 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -72,6 +72,13 @@ "query": "", "launchMode": "default", "scene": null + }, + { + "name": "", + "pathName": "pages/getColorCard/addColorCard/index", + "query": "", + "launchMode": "default", + "scene": null } ] } diff --git a/src/common/constant.ts b/src/common/constant.ts index d61dedd..14bc3f1 100644 --- a/src/common/constant.ts +++ b/src/common/constant.ts @@ -1,4 +1,4 @@ -// export const BASE_URL = CURRENT_BASE_URL +export const BASE_URL = CURRENT_BASE_URL // export const BASE_URL = `http://192.168.0.75:50001/lymarket` // export const BASE_URL = `http://192.168.0.89:50001/lymarket` // export const BASE_URL = `http://10.0.0.5:50001/lymarket` @@ -15,7 +15,7 @@ // export const BASE_URL = 'http://192.168.1.7:50002/lymarket' // 添 // export const BASE_URL = 'http://192.168.1.42:50002/lymarket' // 杰 // export const BASE_URL = `http://192.168.1.95:40001/lymarket` // 华 -export const BASE_URL = 'http://192.168.1.28:50002/lymarket' // 婷 +// export const BASE_URL = 'http://192.168.1.28:50002/lymarket' // 婷 // CDN // 生成密钥 diff --git a/src/components/AddressList/index.tsx b/src/components/AddressList/index.tsx index 79f88a4..086e1b3 100644 --- a/src/components/AddressList/index.tsx +++ b/src/components/AddressList/index.tsx @@ -65,9 +65,7 @@ const AddressList = (props: Params, AddressListRef) => { await getData() setRefreshState(false) } - const data = Array.from({ length: 15 }) const router = useRouter() - const [addressObj, setAddressObj] = useState({}) // 列表选择 const { fetchData: selectFetch } = MpSaleOrderAddress() const handleSelect = async(item: any, index: number) => { diff --git a/src/pages/getColorCard/addColorCard/components/colorCardItem/index.module.scss b/src/pages/getColorCard/addColorCard/components/colorCardItem/index.module.scss index 5a9dd7a..b4c9cc1 100644 --- a/src/pages/getColorCard/addColorCard/components/colorCardItem/index.module.scss +++ b/src/pages/getColorCard/addColorCard/components/colorCardItem/index.module.scss @@ -33,7 +33,7 @@ overflow: hidden; } &__right { - width: 30%; + width: 35%; } } } diff --git a/src/pages/getColorCard/addColorCard/index.tsx b/src/pages/getColorCard/addColorCard/index.tsx index 46b5350..9ad899f 100644 --- a/src/pages/getColorCard/addColorCard/index.tsx +++ b/src/pages/getColorCard/addColorCard/index.tsx @@ -7,18 +7,14 @@ import LayoutBlock from '@/components/layoutBlock' import NormalButton from '@/components/normalButton' import Divider from '@/components/divider' import IconFont from '@/components/iconfont/iconfont' -import LabAndImg from '@/components/LabAndImg' -import Counter from '@/components/counter' -import Tag from '@/components/tag' import { alert, goLink } from '@/common/common' import { ClientListApi } from '@/api/order' import AddressDetailBox from '@/pages/orderDetails/components/addressDetailBox' import Popup from '@/components/popup' import Remark from '@/pages/orderDetails/components/remark' -import { formatRemoveHashTag } from '@/common/format' import { SubmitColorCardOrder } from '@/api/colorCard' -import MoveBtn from '@/components/moveBtn' import NavBar from '@/pages/order/components/NavBar' +import { MpPurchaserAddressList } from '@/api/addressList' const AddColorCard = () => { // 获取选择的客户 @@ -95,20 +91,10 @@ const AddColorCard = () => { // 提交订单 const handleSubmitOrder = async() => { if (!addressInfo.address_id) { - Taro.showToast({ - title: '请选择地址', - icon: 'none', - duration: 2000, - }) - return + return alert.none('请选择地址') } if (!clientInfo.clientId) { - Taro.showToast({ - title: '请选择客户', - icon: 'none', - duration: 2000, - }) - return + return alert.none('请选择客户') } if (order.length === 0) { return alert.none('请选择色卡') } // 请求数据 @@ -131,10 +117,6 @@ const AddColorCard = () => { } } - const labAndImgObj = useCallback((item) => { - return { lab: item?.lab, rgb: item?.rgb, texture_url: item?.texture_url } - }, []) - const deleteColorCard = (id) => { setOrder((prev) => { return prev.filter(item => item.id !== id) @@ -184,6 +166,7 @@ const AddColorCard = () => { clientName: currPage.data?.clientName, clientPhone: currPage.data?.clientPhone, }) + getAddressList(currPage.data?.clientId) } // 默认客户 if (currPage.data?.clientId == null) { @@ -274,6 +257,24 @@ const AddColorCard = () => { }) } + const { fetchData: addressListApi } = MpPurchaserAddressList() + const getAddressList = async(purchaser_id: number) => { + const res = await addressListApi({ purchaser_id }) + if (res.success) { + const { list } = res.data + setAddressInfo(val => ({ + ...val, + province_name: list?.[0]?.province_name || '', + address_id: list?.[0]?.id || '', + city_name: list?.[0]?.city_name || '', + address_detail: list?.[0]?.address_detail || '', + district_name: list?.[0]?.district_name || '', + target_user_name: list?.[0]?.name || '', + purchaser_phone: list?.[0]?.phone || '', + })) + } + } + return diff --git a/src/pages/orderDetails/components/addressDetailBox/index.module.scss b/src/pages/orderDetails/components/addressDetailBox/index.module.scss index 9fd5178..4862988 100644 --- a/src/pages/orderDetails/components/addressDetailBox/index.module.scss +++ b/src/pages/orderDetails/components/addressDetailBox/index.module.scss @@ -74,22 +74,17 @@ display: flex; align-items: center; .name { - line-height: 34px; width: 84px; height: 34px; @include common_ellipsis(); font-size: 28px; - font-weight: 400; color: #343434; margin-right: 16px; } .phone { - height: 34px; font-size: 28px; - font-weight: 400; color: #343434; - // margin-right: 70px; } } diff --git a/src/pages/orderDetails/components/addressDetailBox/index.tsx b/src/pages/orderDetails/components/addressDetailBox/index.tsx index 09eb909..72f60ce 100644 --- a/src/pages/orderDetails/components/addressDetailBox/index.tsx +++ b/src/pages/orderDetails/components/addressDetailBox/index.tsx @@ -67,22 +67,22 @@ const AddressDetailBox = (props: propsObj) => { {receivingStatus === 1 ? '谭先生' : obj.target_user_name} {receivingStatus === 1 ? 13242128982 : obj.purchaser_phone} - - { - showBtn && - - - onReceivingStatus?.(e, 1)}> - 自提 - - onReceivingStatus?.(e, 2)}> - 物流 + { + showBtn && + + + onReceivingStatus?.(e, 1)}> + 自提 + + onReceivingStatus?.(e, 2)}> + 物流 + + - - - } + } + { !showBtn && {showWhatFont} } diff --git a/src/pages/sampleCutting/addSampleCutting/index.tsx b/src/pages/sampleCutting/addSampleCutting/index.tsx index 67a22d0..3fc0e7d 100644 --- a/src/pages/sampleCutting/addSampleCutting/index.tsx +++ b/src/pages/sampleCutting/addSampleCutting/index.tsx @@ -17,6 +17,7 @@ import Remark from '@/pages/orderDetails/components/remark' import { formatRemoveHashTag } from '@/common/format' import { SubmitCutSampleOrder } from '@/api/sampleCutting' import NavBar from '@/pages/order/components/NavBar' +import { MpPurchaserAddressList } from '@/api/addressList' const AddColorCard = () => { // 获取选择的客户 @@ -217,6 +218,7 @@ const AddColorCard = () => { clientName: currPage.data?.clientName, clientPhone: currPage.data?.clientPhone, }) + getAddressList(currPage.data?.clientId) } // 默认客户 if (currPage.data?.clientId == null) { @@ -321,6 +323,24 @@ const AddColorCard = () => { }) } + const { fetchData: addressListApi } = MpPurchaserAddressList() + const getAddressList = async(purchaser_id: number) => { + const res = await addressListApi({ purchaser_id }) + if (res.success) { + const { list } = res.data + setAddressInfo(val => ({ + ...val, + province_name: list?.[0]?.province_name || '', + address_id: list?.[0]?.id || '', + city_name: list?.[0]?.city_name || '', + address_detail: list?.[0]?.address_detail || '', + district_name: list?.[0]?.district_name || '', + target_user_name: list?.[0]?.name || '', + purchaser_phone: list?.[0]?.phone || '', + })) + } + } + return diff --git a/src/pages/sampleCutting/sampleCuttingList/index.tsx b/src/pages/sampleCutting/sampleCuttingList/index.tsx index f3abf1e..3ca4d42 100644 --- a/src/pages/sampleCutting/sampleCuttingList/index.tsx +++ b/src/pages/sampleCutting/sampleCuttingList/index.tsx @@ -172,7 +172,12 @@ const SampleCuttingList = () => { const index = multipleSelection.current.findIndex(mul => mul.product_id === currentSelect.current.id) if (index !== -1) { multipleSelection.current[index].multipleSelection = productMultipleSelection + // 检查是否有数据 + if (multipleSelection.current[index].multipleSelection.length === 0) { + multipleSelection.current.splice(index, 1) + } } + console.log('multipleSelection==>', multipleSelection.current) setShow(false) setProductMultipleSelection([]) } @@ -265,7 +270,7 @@ const SampleCuttingList = () => { onClick={() => handleClickAddButton(item)} > { - isAdd?.includes(item.id) || multipleSelection.current.find(mul => mul.product_id === item.id)?.multipleSelection.length ? '继续添加' : '添加' + multipleSelection.current.find(mul => mul.product_id === item.id)?.multipleSelection.length ? '继续添加' : '添加' }