🐞 fix(ID1001366): 【内部小程序】-【领取色卡】--选择客户后,有默认地址的,没有自动带入默认地址

【【内部小程序】-【领取色卡】--选择客户后,有默认地址的,没有自动带入默认地址】 https://www.tapd.cn/53459131/bugtrace/bugs/view/1153459131001001366
This commit is contained in:
xuan 2023-02-28 16:49:37 +08:00
parent 118c1ba987
commit 79de81702a
9 changed files with 71 additions and 45 deletions

View File

@ -72,6 +72,13 @@
"query": "", "query": "",
"launchMode": "default", "launchMode": "default",
"scene": null "scene": null
},
{
"name": "",
"pathName": "pages/getColorCard/addColorCard/index",
"query": "",
"launchMode": "default",
"scene": null
} }
] ]
} }

View File

@ -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.75:50001/lymarket`
// export const BASE_URL = `http://192.168.0.89:50001/lymarket` // export const BASE_URL = `http://192.168.0.89:50001/lymarket`
// export const BASE_URL = `http://10.0.0.5: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.7:50002/lymarket' // 添
// export const BASE_URL = 'http://192.168.1.42: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.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 // CDN
// 生成密钥 // 生成密钥

View File

@ -65,9 +65,7 @@ const AddressList = (props: Params, AddressListRef) => {
await getData() await getData()
setRefreshState(false) setRefreshState(false)
} }
const data = Array.from({ length: 15 })
const router = useRouter() const router = useRouter()
const [addressObj, setAddressObj] = useState<any>({})
// 列表选择 // 列表选择
const { fetchData: selectFetch } = MpSaleOrderAddress() const { fetchData: selectFetch } = MpSaleOrderAddress()
const handleSelect = async(item: any, index: number) => { const handleSelect = async(item: any, index: number) => {

View File

@ -33,7 +33,7 @@
overflow: hidden; overflow: hidden;
} }
&__right { &__right {
width: 30%; width: 35%;
} }
} }
} }

View File

@ -7,18 +7,14 @@ import LayoutBlock from '@/components/layoutBlock'
import NormalButton from '@/components/normalButton' import NormalButton from '@/components/normalButton'
import Divider from '@/components/divider' import Divider from '@/components/divider'
import IconFont from '@/components/iconfont/iconfont' 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 { alert, goLink } from '@/common/common'
import { ClientListApi } from '@/api/order' import { ClientListApi } from '@/api/order'
import AddressDetailBox from '@/pages/orderDetails/components/addressDetailBox' import AddressDetailBox from '@/pages/orderDetails/components/addressDetailBox'
import Popup from '@/components/popup' import Popup from '@/components/popup'
import Remark from '@/pages/orderDetails/components/remark' import Remark from '@/pages/orderDetails/components/remark'
import { formatRemoveHashTag } from '@/common/format'
import { SubmitColorCardOrder } from '@/api/colorCard' import { SubmitColorCardOrder } from '@/api/colorCard'
import MoveBtn from '@/components/moveBtn'
import NavBar from '@/pages/order/components/NavBar' import NavBar from '@/pages/order/components/NavBar'
import { MpPurchaserAddressList } from '@/api/addressList'
const AddColorCard = () => { const AddColorCard = () => {
// 获取选择的客户 // 获取选择的客户
@ -95,20 +91,10 @@ const AddColorCard = () => {
// 提交订单 // 提交订单
const handleSubmitOrder = async() => { const handleSubmitOrder = async() => {
if (!addressInfo.address_id) { if (!addressInfo.address_id) {
Taro.showToast({ return alert.none('请选择地址')
title: '请选择地址',
icon: 'none',
duration: 2000,
})
return
} }
if (!clientInfo.clientId) { if (!clientInfo.clientId) {
Taro.showToast({ return alert.none('请选择客户')
title: '请选择客户',
icon: 'none',
duration: 2000,
})
return
} }
if (order.length === 0) { 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) => { const deleteColorCard = (id) => {
setOrder((prev) => { setOrder((prev) => {
return prev.filter(item => item.id !== id) return prev.filter(item => item.id !== id)
@ -184,6 +166,7 @@ const AddColorCard = () => {
clientName: currPage.data?.clientName, clientName: currPage.data?.clientName,
clientPhone: currPage.data?.clientPhone, clientPhone: currPage.data?.clientPhone,
}) })
getAddressList(currPage.data?.clientId)
} }
// 默认客户 // 默认客户
if (currPage.data?.clientId == null) { 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 <View className={styles.main}> return <View className={styles.main}>
<NavBar hasLeft leftSlot={ <NavBar hasLeft leftSlot={
<View onClick={onClickBack}> <View onClick={onClickBack}>

View File

@ -74,22 +74,17 @@
display: flex; display: flex;
align-items: center; align-items: center;
.name { .name {
line-height: 34px;
width: 84px; width: 84px;
height: 34px; height: 34px;
@include common_ellipsis(); @include common_ellipsis();
font-size: 28px; font-size: 28px;
font-weight: 400;
color: #343434; color: #343434;
margin-right: 16px; margin-right: 16px;
} }
.phone { .phone {
height: 34px;
font-size: 28px; font-size: 28px;
font-weight: 400;
color: #343434; color: #343434;
// margin-right: 70px;
} }
} }

View File

@ -67,7 +67,6 @@ const AddressDetailBox = (props: propsObj) => {
<View className={styles.leftbottom}> <View className={styles.leftbottom}>
<View className={styles.name}>{receivingStatus === 1 ? '谭先生' : obj.target_user_name}</View> <View className={styles.name}>{receivingStatus === 1 ? '谭先生' : obj.target_user_name}</View>
<View className={styles.phone}>{receivingStatus === 1 ? 13242128982 : obj.purchaser_phone}</View> <View className={styles.phone}>{receivingStatus === 1 ? 13242128982 : obj.purchaser_phone}</View>
</View>
{ {
showBtn && <View className={styles.reatBox}> showBtn && <View className={styles.reatBox}>
<View className={styles.updateBtn}> <View className={styles.updateBtn}>
@ -83,6 +82,7 @@ const AddressDetailBox = (props: propsObj) => {
</View> </View>
</View> </View>
} }
</View>
{ {
!showBtn && <View className={styles.reatName}>{showWhatFont}</View> !showBtn && <View className={styles.reatName}>{showWhatFont}</View>
} }

View File

@ -17,6 +17,7 @@ import Remark from '@/pages/orderDetails/components/remark'
import { formatRemoveHashTag } from '@/common/format' import { formatRemoveHashTag } from '@/common/format'
import { SubmitCutSampleOrder } from '@/api/sampleCutting' import { SubmitCutSampleOrder } from '@/api/sampleCutting'
import NavBar from '@/pages/order/components/NavBar' import NavBar from '@/pages/order/components/NavBar'
import { MpPurchaserAddressList } from '@/api/addressList'
const AddColorCard = () => { const AddColorCard = () => {
// 获取选择的客户 // 获取选择的客户
@ -217,6 +218,7 @@ const AddColorCard = () => {
clientName: currPage.data?.clientName, clientName: currPage.data?.clientName,
clientPhone: currPage.data?.clientPhone, clientPhone: currPage.data?.clientPhone,
}) })
getAddressList(currPage.data?.clientId)
} }
// 默认客户 // 默认客户
if (currPage.data?.clientId == null) { 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 <View className={styles.main}> return <View className={styles.main}>
<NavBar hasLeft leftSlot={ <NavBar hasLeft leftSlot={
<View onClick={onClickBack}> <View onClick={onClickBack}>

View File

@ -172,7 +172,12 @@ const SampleCuttingList = () => {
const index = multipleSelection.current.findIndex(mul => mul.product_id === currentSelect.current.id) const index = multipleSelection.current.findIndex(mul => mul.product_id === currentSelect.current.id)
if (index !== -1) { if (index !== -1) {
multipleSelection.current[index].multipleSelection = productMultipleSelection multipleSelection.current[index].multipleSelection = productMultipleSelection
// 检查是否有数据
if (multipleSelection.current[index].multipleSelection.length === 0) {
multipleSelection.current.splice(index, 1)
} }
}
console.log('multipleSelection==>', multipleSelection.current)
setShow(false) setShow(false)
setProductMultipleSelection([]) setProductMultipleSelection([])
} }
@ -265,7 +270,7 @@ const SampleCuttingList = () => {
onClick={() => handleClickAddButton(item)} 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 ? '继续添加' : '添加'
} }
</NormalButton> </NormalButton>
</View> </View>