对接确认订单
This commit is contained in:
parent
4d3135ed76
commit
26555a9541
@ -15,6 +15,8 @@ import styles from './index.module.scss'
|
|||||||
export default () => {
|
export default () => {
|
||||||
const [price, setPrice] = useState(123000.33)
|
const [price, setPrice] = useState(123000.33)
|
||||||
const [showDesc, setShowDesc] = useState(false)
|
const [showDesc, setShowDesc] = useState(false)
|
||||||
|
|
||||||
|
//复制功能
|
||||||
const clipboardData = () => {
|
const clipboardData = () => {
|
||||||
Taro.setClipboardData({
|
Taro.setClipboardData({
|
||||||
data: '123123121321',
|
data: '123123121321',
|
||||||
@ -40,12 +42,35 @@ import styles from './index.module.scss'
|
|||||||
getSaleOrderPreView()
|
getSaleOrderPreView()
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
//获取销售订单预览图
|
//获取销售预览订单
|
||||||
|
type preViewOrderParam = {estimate_amount:number, estimate_weight:number, product_color_list:any[], sale_mode:number, sale_mode_name:string}
|
||||||
|
const [preViewOrder, setPreViewOrder] = useState<preViewOrderParam>()
|
||||||
const {fetchData} = SaleOrderPreViewApi()
|
const {fetchData} = SaleOrderPreViewApi()
|
||||||
const getSaleOrderPreView = async () => {
|
const getSaleOrderPreView = async () => {
|
||||||
if(idsAndSaleModel.current.shopping_cart_product_color_list?.length > 0) {
|
if(idsAndSaleModel.current.shopping_cart_product_color_list?.length > 0) {
|
||||||
let res = await fetchData(idsAndSaleModel.current)
|
let res = await fetchData(idsAndSaleModel.current)
|
||||||
console.log('res::', res)
|
setPreViewOrder(res.data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
formatData()
|
||||||
|
}, [preViewOrder])
|
||||||
|
|
||||||
|
//格式化数据格式
|
||||||
|
const formatData = () => {
|
||||||
|
if(preViewOrder?.product_color_list&&preViewOrder?.product_color_list.length > 0) {
|
||||||
|
let dataList = {}
|
||||||
|
preViewOrder?.product_color_list.map(item => {
|
||||||
|
dataList[item.product_code] = dataList[item.product_code]||{}
|
||||||
|
dataList[item.product_code].product_code = item.product_code
|
||||||
|
dataList[item.product_code].product_name = item.product_name
|
||||||
|
dataList[item.product_code].sale_mode_name = item.sale_mode_name
|
||||||
|
dataList[item.product_code].color_list = dataList[item.product_code]?.color_list||[]
|
||||||
|
dataList[item.product_code].color_list.push(item)
|
||||||
|
})
|
||||||
|
console.log('dataList::',Object.values(dataList))
|
||||||
|
return Object.values(dataList)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user