🦄 refactor:订单详情对接修改地址
This commit is contained in:
parent
52c4d92433
commit
7ddb3bf784
@ -4,13 +4,7 @@ export default defineAppConfig({
|
||||
'pages/index/index',
|
||||
'pages/order/index',
|
||||
'pages/shopping/index',
|
||||
'pages/searchPage/index',
|
||||
'pages/customerPage/index',
|
||||
'pages/saleuserPage/index',
|
||||
'pages/user/index',
|
||||
'pages/orderDetails/index',
|
||||
'pages/addressManager/index',
|
||||
'pages/addAddress/index',
|
||||
'pages/login/index',
|
||||
],
|
||||
window: {
|
||||
@ -58,5 +52,41 @@ export default defineAppConfig({
|
||||
'findColor/index'
|
||||
],
|
||||
},
|
||||
{
|
||||
root: "pages/addAddress",
|
||||
pages: [
|
||||
"index"
|
||||
]
|
||||
},
|
||||
{
|
||||
root: "pages/addressManager",
|
||||
pages: [
|
||||
"index"
|
||||
]
|
||||
},
|
||||
{
|
||||
root: "pages/customerPage",
|
||||
pages: [
|
||||
"index"
|
||||
]
|
||||
},
|
||||
{
|
||||
root: "pages/orderDetails",
|
||||
pages: [
|
||||
"index"
|
||||
]
|
||||
},
|
||||
{
|
||||
root: "pages/saleuserPage",
|
||||
pages: [
|
||||
"index"
|
||||
]
|
||||
},
|
||||
{
|
||||
root: "pages/searchPage",
|
||||
pages: [
|
||||
"index"
|
||||
]
|
||||
},
|
||||
],
|
||||
})
|
||||
|
@ -4,15 +4,16 @@ import { memo, useEffect, useState } from "react"
|
||||
import "./index.scss"
|
||||
import { mppurchaseraddresslist } from "@/api/addressList"
|
||||
import { alert } from "@/common/common"
|
||||
import Taro, { showModal, useDidShow } from "@tarojs/taro"
|
||||
|
||||
import Taro, { showModal, useDidShow, useRouter } from "@tarojs/taro"
|
||||
import { mpsaleOrderaddress } from '@/api/order'
|
||||
interface Params {
|
||||
refresherEnabled?: boolean,//是否开启刷新
|
||||
onSelect?: (item: any, index: number) => void,//列表选择
|
||||
addButtonEnabled?: boolean, //是否显示添加按钮
|
||||
focusBorderEnabled?: boolean, //焦点显示蓝色边框
|
||||
id?: number, //默认选择值,
|
||||
purchaser_id: Number
|
||||
purchaser_id: Number,
|
||||
// handSelect?: (any) => void
|
||||
}
|
||||
|
||||
// 地址列表
|
||||
@ -52,8 +53,33 @@ const AddressList = memo((props: Params) => {
|
||||
const data = Array.from({ length: 15 });
|
||||
// 焦点
|
||||
const [focusId, setFocusId] = useState();
|
||||
const router = useRouter()
|
||||
const [addressObj, setAddressObj] = useState<any>({})
|
||||
// 列表选择
|
||||
const handleSelect = (item: any, index: number) => {
|
||||
const { fetchData: selectFetch } = mpsaleOrderaddress()
|
||||
const handleSelect = async (item: any, index: number) => {
|
||||
Taro.showLoading({
|
||||
title: '请稍等...',
|
||||
mask: true
|
||||
})
|
||||
const res = await selectFetch({ address_id: item.id, id: Number(router.params.orderId), shipment_mode: 2 })
|
||||
if (res.msg === 'success') {
|
||||
Taro.hideLoading()
|
||||
Taro.showToast({
|
||||
title: '成功',
|
||||
icon: 'success'
|
||||
})
|
||||
Taro.navigateBack({
|
||||
delta: 1
|
||||
})
|
||||
} else {
|
||||
Taro.hideLoading()
|
||||
Taro.showToast({
|
||||
title: res.msg,
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
|
||||
props.onSelect && props.onSelect(item, index);
|
||||
if (focusBorderEnabled) {
|
||||
setFocusId(item?.id);
|
||||
@ -78,7 +104,6 @@ const AddressList = memo((props: Params) => {
|
||||
// }
|
||||
// }))
|
||||
// }
|
||||
|
||||
return (
|
||||
<View className="address-scroll-view">
|
||||
<ScrollView scrollY refresherEnabled={props.refresherEnabled} enhanced refresherTriggered={refreshState} onRefresherRefresh={handleRefresh}>
|
||||
@ -106,7 +131,7 @@ const AddressList = memo((props: Params) => {
|
||||
item.is_default && <Text className="address-list-phone">{item.phone.replace(item.phone.substring(3, 7), "****")}</Text>
|
||||
}
|
||||
</View>
|
||||
<Navigator onClick={e => e.stopPropagation()} url={`/pages/addAddress/index?type=edit&id=${item.id}&&purchaser_id=${642}`} hoverClass="none" className="address-edit">
|
||||
<Navigator onClick={e => e.stopPropagation()} url={`/pages/addAddress/index?type=edit&id=${item.id}&&purchaser_id=${Number(router.params.purchaser_id)}`} hoverClass="none" className="address-edit">
|
||||
<Text className="iconfont icon-bianji"></Text>
|
||||
</Navigator>
|
||||
</View>
|
||||
@ -117,7 +142,7 @@ const AddressList = memo((props: Params) => {
|
||||
}
|
||||
</View>
|
||||
</ScrollView>
|
||||
{addButtonEnabled && <Navigator url={`/pages/addAddress/index?type=add&purchaser_id=${642}`} hoverClass="none" className="add-address">添加收货地址</Navigator>}
|
||||
{addButtonEnabled && <Navigator url={`/pages/addAddress/index?type=add&purchaser_id=${Number(router.params.purchaser_id)}`} hoverClass="none" className="add-address">添加收货地址</Navigator>}
|
||||
</View>
|
||||
)
|
||||
})
|
||||
|
@ -104,6 +104,7 @@ export default memo(forwardRef((props: prosObj, ref) => {
|
||||
|
||||
return (
|
||||
<Popup showTitle={false} show={showPopup} onClose={() => closePopup?.()}>
|
||||
<ScrollView style={{ height: '1000rpx' }} scrollY>
|
||||
<View className={styles.shopcartBox}>
|
||||
<View className={styles.topTitle}>{obj?.code}# {obj?.name}</View>
|
||||
<View className={styles.selectFont}>已选 1 种面料,{selectTotal} 个颜色,共 {selectNums} {showModefont}</View>
|
||||
@ -154,6 +155,7 @@ export default memo(forwardRef((props: prosObj, ref) => {
|
||||
<BottomCustomer clientName={clientName} clientId={clientId} isDisabled={selectTotal > 0 && clientName !== '' ? false : true} handSure={() => { handSure() }}></BottomCustomer>
|
||||
</View>
|
||||
</View>
|
||||
</ScrollView>
|
||||
</Popup>
|
||||
|
||||
)
|
||||
|
@ -1,14 +1,15 @@
|
||||
|
||||
import AddressList from "@/components/AddressList"
|
||||
import { Button, ScrollView, Text, View } from "@tarojs/components"
|
||||
import { stopPullDownRefresh, usePullDownRefresh } from "@tarojs/taro"
|
||||
import { stopPullDownRefresh, useDidShow, usePullDownRefresh, useRouter } from "@tarojs/taro"
|
||||
import { useState } from "react"
|
||||
import "./index.scss"
|
||||
|
||||
export default () => {
|
||||
const router = useRouter()
|
||||
return (
|
||||
<View className="address-manager">
|
||||
<AddressList refresherEnabled={true} purchaser_id={642} />
|
||||
<AddressList refresherEnabled={true} purchaser_id={router.params.purchaser_id as any} />
|
||||
</View>
|
||||
)
|
||||
}
|
@ -83,7 +83,9 @@ export default memo((props: prosObj) => {
|
||||
showTake && <View className={styles.tuikuan} onClick={() => handSureGoods?.()}>确认收货</View>
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
!showTuihuo && !showTuikuan && !showTake && <View className={styles.title} >暂无更多</View>
|
||||
}
|
||||
</>
|
||||
)
|
||||
})
|
@ -41,6 +41,8 @@
|
||||
/*这里设置几行*/
|
||||
overflow: hidden;
|
||||
margin-right: 41px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.icon_more {
|
||||
|
@ -6,14 +6,16 @@ import styles from './index.module.scss'
|
||||
interface propsObj {
|
||||
receivingStatus: Number | null,
|
||||
onReceivingStatus?: (any, Number) => void,
|
||||
obj: any
|
||||
obj: any,
|
||||
navSelect?: (any) => void
|
||||
}
|
||||
export default memo((props: propsObj) => {
|
||||
|
||||
const {
|
||||
receivingStatus = 2,
|
||||
onReceivingStatus,
|
||||
obj = {}
|
||||
obj = {},
|
||||
navSelect
|
||||
} = props
|
||||
const addressInfo = useMemo(() => {
|
||||
if (receivingStatus == 1) {
|
||||
@ -21,37 +23,39 @@ export default memo((props: propsObj) => {
|
||||
} else {
|
||||
return obj.province_name + obj.city_name + obj.district_name
|
||||
}
|
||||
}, [receivingStatus])
|
||||
}, [obj, receivingStatus])
|
||||
|
||||
const addressPone = useMemo(() => {
|
||||
if (receivingStatus == 1) {
|
||||
return 13242128982
|
||||
} else {
|
||||
return obj.purchaser_phone
|
||||
}
|
||||
}, [receivingStatus])
|
||||
// const addressPone = useMemo(() => {
|
||||
// if (receivingStatus == 1) {
|
||||
// return 13242128982
|
||||
// } else {
|
||||
// return obj.purchaser_phone
|
||||
// }
|
||||
// }, [obj,receivingStatus])
|
||||
|
||||
const addressUser = useMemo(() => {
|
||||
if (receivingStatus == 1) {
|
||||
return '谭先生'
|
||||
} else {
|
||||
return obj.target_user_name
|
||||
}
|
||||
}, [receivingStatus])
|
||||
// const addressUser = useMemo(() => {
|
||||
// if (receivingStatus == 1) {
|
||||
// return '谭先生'
|
||||
// } else {
|
||||
// return obj.target_user_name
|
||||
// }
|
||||
// }, [obj,receivingStatus])
|
||||
|
||||
return (
|
||||
<View className={styles.addressBox}>
|
||||
<View className={styles.topBox}>
|
||||
<View className={styles.topBox} onClick={() => navSelect?.(obj)}>
|
||||
<View className={styles.cirle}>
|
||||
<View className={classnames('iconfont', 'icon-dingwei', styles.dingwei)}></View>
|
||||
</View>
|
||||
<View className={styles.address}>{addressInfo}</View>
|
||||
<View className={classnames('iconfont', 'icon-chakanquanbukehu', styles.icon_more)}></View>
|
||||
{
|
||||
receivingStatus !== 1 && <View className={classnames('iconfont', 'icon-chakanquanbukehu', styles.icon_more)}></View>
|
||||
}
|
||||
</View>
|
||||
<View className={styles.line}></View>
|
||||
<View className={styles.bottom}>
|
||||
<View className={styles.name}>{addressUser}</View>
|
||||
<View className={styles.phone}>{addressPone}</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.reatBox}>
|
||||
<View className={styles.updateBtn}>
|
||||
<View className={styles.updateBtn_list}>
|
||||
|
@ -29,14 +29,30 @@ import PayPopup from '../order/components/PayPopup'
|
||||
|
||||
export default () => {
|
||||
const router = useRouter()
|
||||
useEffect(() => {
|
||||
// useEffect(() => {
|
||||
// getDetail()
|
||||
// }, [])
|
||||
useDidShow(() => {
|
||||
getDetail()
|
||||
}, [])
|
||||
|
||||
})
|
||||
//页面下拉刷新
|
||||
usePullDownRefresh(() => {
|
||||
getDetail()
|
||||
})
|
||||
|
||||
|
||||
//收货方法,1:自提,2物流
|
||||
const [receivingStatus, setReceivingStatus] = useState(null)
|
||||
//切换自提或者物流
|
||||
const onReceivingStatus = debounce((e, value) => {
|
||||
if (infoObj.status === 8 || infoObj.status === 9 || infoObj.status === 4 || infoObj.status === 5) {
|
||||
alert.error('不允许更改')
|
||||
return false
|
||||
}
|
||||
e.stopPropagation()
|
||||
setReceivingStatus(value)
|
||||
}, 300)
|
||||
|
||||
const { fetchData: infoFetch } = mpsaleOrder()
|
||||
const [infoObj, setInfoObj] = useState<any>({})
|
||||
//获取订单详情
|
||||
@ -73,14 +89,9 @@ export default () => {
|
||||
})
|
||||
}
|
||||
|
||||
//收货方法,1:自提,2物流
|
||||
const [receivingStatus, setReceivingStatus] = useState(null)
|
||||
//切换自提或者物流
|
||||
const onReceivingStatus = debounce((e, value) => {
|
||||
e.stopPropagation()
|
||||
setReceivingStatus(value)
|
||||
}, 300)
|
||||
|
||||
// useEffect(() => {
|
||||
// setReceivingStatus(receivingStatus)
|
||||
// }, [receivingStatus])
|
||||
//订单信息文字数组
|
||||
const [orderMsg, setOrderMsg] = useState<any[]>([
|
||||
{
|
||||
@ -459,6 +470,16 @@ export default () => {
|
||||
const [showPay, setShowPay] = useState(false)
|
||||
//显示线下汇款
|
||||
const [showOffline, setShowOffine] = useState(false)
|
||||
//选择地址
|
||||
const handSelect = (obj) => {
|
||||
if (receivingStatus === 1 || (infoObj.status === 8 || infoObj.status === 9 || infoObj.status === 4 || infoObj.status === 5)) {
|
||||
alert.error('不允许更改')
|
||||
return false
|
||||
}
|
||||
Taro.navigateTo({
|
||||
url: '/pages/addressManager/index?orderId=' + obj.id + '&purchaser_id=' + obj.purchaser_id
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
<View className={styles.mainBox}>
|
||||
@ -466,7 +487,12 @@ export default () => {
|
||||
{
|
||||
infoObj.status === 10 && <AdvanceOrderState orderInfo={infoObj} onRefresh={() => refresh()} />
|
||||
}
|
||||
<AddressDetailBox obj={infoObj} receivingStatus={receivingStatus} onReceivingStatus={(e, value) => onReceivingStatus(e, value)}></AddressDetailBox>
|
||||
<AddressDetailBox
|
||||
navSelect={(obj) => handSelect(obj)}
|
||||
obj={infoObj}
|
||||
receivingStatus={receivingStatus}
|
||||
onReceivingStatus={(e, value) => onReceivingStatus(e, value)}
|
||||
></AddressDetailBox>
|
||||
<DefaultBox
|
||||
showMode={true}
|
||||
title={'客户信息'}
|
||||
@ -474,7 +500,7 @@ export default () => {
|
||||
>
|
||||
<View className={styles.pussBox}>
|
||||
<View className={styles.pussName}>{infoObj.purchaser_name}</View>
|
||||
<View className={styles.pussPhone}>{1310154151}</View>
|
||||
<View className={styles.pussPhone}>{infoObj.purchaser_phone}</View>
|
||||
</View>
|
||||
</DefaultBox>
|
||||
<View className={styles.total}> {infoObj.total_fabrics} 种面料,{infoObj.total_colors} 个颜色,共 {infoObj.sale_mode === 0 ? infoObj.total_number : infoObj.total_number / 100} {infoObj.sale_mode === 0 ? '条' : 'm'}</View>
|
||||
|
Loading…
x
Reference in New Issue
Block a user