✨ feat(订单模块):提交订单对接
This commit is contained in:
parent
6c0ecd5ea1
commit
9377ea964f
@ -107,13 +107,6 @@
|
||||
"launchMode": "default",
|
||||
"scene": null
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"pathName": "pages/submitOrder/index",
|
||||
"query": "",
|
||||
"launchMode": "default",
|
||||
"scene": null
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"pathName": "pages/refundPage/index",
|
||||
|
@ -179,3 +179,18 @@ export const mpenumrefundExplainone = () => {
|
||||
method: "get",
|
||||
})
|
||||
}
|
||||
|
||||
//提交订单
|
||||
export const mpsaleOrderpost = () => {
|
||||
return useRequest({
|
||||
url: `/v1/mp/saleOrder`,
|
||||
method: "post",
|
||||
})
|
||||
}
|
||||
//修改销售单物流方式
|
||||
export const mpsaleOrdershipmentMode = () => {
|
||||
return useRequest({
|
||||
url: `/v1/mp/saleOrder/shipmentMode`,
|
||||
method: "put",
|
||||
})
|
||||
}
|
||||
|
@ -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`
|
||||
@ -12,7 +12,7 @@ export const BASE_URL = CURRENT_BASE_URL
|
||||
// export const BASE_URL = `https://dev.zzfzyc.com/lymarket` // 开发环境
|
||||
// export const BASE_URL = `https://www.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.7:50002/lymarket` // 添
|
||||
// export const BASE_URL = `http://192.168.1.42:50001/lymarket` // 杰
|
||||
// export const BASE_URL = `http://192.168.1.95:40001/lymarket` // 华
|
||||
|
||||
|
@ -5,6 +5,7 @@ import "./index.scss"
|
||||
import { mppurchaseraddresslist } from "@/api/addressList"
|
||||
import { alert } from "@/common/common"
|
||||
import Taro, { showModal, useDidShow, useRouter } from "@tarojs/taro"
|
||||
import IconFont from '@/components/iconfont/iconfont'
|
||||
import { mpsaleOrderaddress } from '@/api/order'
|
||||
interface Params {
|
||||
refresherEnabled?: boolean,//是否开启刷新
|
||||
@ -58,7 +59,8 @@ const AddressList = memo((props: Params) => {
|
||||
// 列表选择
|
||||
const { fetchData: selectFetch } = mpsaleOrderaddress()
|
||||
const handleSelect = async (item: any, index: number) => {
|
||||
if (router.params.orderId) {
|
||||
if (router.params.orderId && router.params.orderId != '-100') {
|
||||
console.log(typeof (router.params.orderId) != 'undefined', 'router.params.orderId')
|
||||
Taro.showLoading({
|
||||
title: '请稍等...',
|
||||
mask: true
|
||||
@ -80,6 +82,15 @@ const AddressList = memo((props: Params) => {
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
} else {
|
||||
let pages = Taro.getCurrentPages(); // 获取当前的页面栈
|
||||
let prevPage = pages[pages.length - 2];
|
||||
prevPage.setData({ //设置上一个页面的值
|
||||
addressObj: item
|
||||
});
|
||||
Taro.navigateBack({
|
||||
delta: 1
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@ -117,7 +128,8 @@ const AddressList = memo((props: Params) => {
|
||||
}
|
||||
</View>
|
||||
<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>
|
||||
{/* <Text className="iconfont icon-bianji"></Text> */}
|
||||
<IconFont name={'icon-bianji'} size={40} ></IconFont>
|
||||
</Navigator>
|
||||
</View>
|
||||
</View>
|
||||
|
@ -111,7 +111,7 @@ export default memo(
|
||||
handScan?.()
|
||||
}}>
|
||||
<IconFont
|
||||
name={'icon-saomiao'} size={40}
|
||||
name={'icon-saomiao'} size={40} color={'#337FFF'}
|
||||
></IconFont>
|
||||
</View>
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ import {
|
||||
} from "@/api/newCollection"
|
||||
import TimePicker from "@/components/timePicker"
|
||||
import dayjs from 'dayjs'
|
||||
import IconFont from '@/components/iconfont/iconfont'
|
||||
|
||||
export default () => {
|
||||
let myDate = new Date();
|
||||
@ -231,7 +232,8 @@ export default () => {
|
||||
<View style={{ background: '#FFFFFF', paddingLeft: '20rpx', paddingBottom: '20rpx', position: 'sticky', top: '0', zIndex: '99' }}>
|
||||
<Search placeholder='请输入客户或客户跟进人' showBtn={false} changeOnSearch={getSearchData} debounceTime={300} >
|
||||
<View className={styles.flexBox} onClick={() => { setSelectPopup(true) }}>
|
||||
<View className={classnames('iconfont', 'icon-shaixuan', !isDisabled ? styles.icon_shaixuan : styles.activeshaixuan)}></View>
|
||||
<IconFont name='icon-shaixuan' size={35} color={!isDisabled ? '#0D7CFF' : ''} customClassName={styles['activeshaixuan']} />
|
||||
{/* <View className={classnames('iconfont', 'icon-shaixuan', !isDisabled ? styles.icon_shaixuan : styles.activeshaixuan)}></View> */}
|
||||
<View className={classnames(isDisabled ? styles.shaixuan : styles.activeshai)}>筛选</View>
|
||||
</View>
|
||||
</Search>
|
||||
@ -275,10 +277,16 @@ export default () => {
|
||||
}
|
||||
</View>
|
||||
<View className={classnames(timeArea == '自定义起始时间' ? styles.timeBox2 : styles.activetimeBox2)} onClick={() => { setShowTime(true) }}>{timeArea}
|
||||
<View className={styles.more}>
|
||||
{
|
||||
timeArea == '自定义起始时间' && <View className={classnames('iconfont', 'icon-chakanquanbukehu', styles.more)}></View>
|
||||
timeArea == '自定义起始时间' &&
|
||||
<IconFont name={'icon-chakanquanbukehu'} color={'#000000'} size={40} customClassName={styles['more']}></IconFont>
|
||||
}
|
||||
</View>
|
||||
{/* {
|
||||
timeArea == '自定义起始时间' && <View className={classnames('iconfont', 'icon-chakanquanbukehu', styles.more)}></View>
|
||||
} */}
|
||||
</View>
|
||||
<View style={{ height: '100rpx' }}></View>
|
||||
<View className={styles.bottomBox}>
|
||||
<Button className={styles.resetBox} onClick={() => { handReset() }}> 重置</Button >
|
||||
|
@ -22,6 +22,7 @@ import {
|
||||
} from '@/api/order'
|
||||
import PayPopup from './components/PayPopup'
|
||||
import { formatDateTime, formatHashTag, formatImgUrl, formatPriceDiv, formatWeightDiv } from '@/common/format'
|
||||
import IconFont from '@/components/iconfont/iconfont'
|
||||
interface filterObj {
|
||||
purchaser_id?: string | number,
|
||||
clientName?: string,
|
||||
@ -597,7 +598,8 @@ export default () => {
|
||||
<View style={{ background: '#FFFFFF', paddingLeft: '20rpx', paddingBottom: '20rpx', position: 'sticky', top: '0', zIndex: '99' }}>
|
||||
<Search handScan={() => handScan()} showScan placeholder='搜索商品/名称/颜色/订单号' showBtn={false} changeOnSearch={getSearchData} debounceTime={300}>
|
||||
<View className={styles.flexBox} onClick={() => showSelctPopup()}>
|
||||
<View className={classnames('iconfont', 'icon-shaixuan', !isDisabled ? styles.icon_shaixuan : styles.activeshaixuan)}></View>
|
||||
<IconFont name='icon-shaixuan' size={35} color={!isDisabled ? '#0D7CFF' : ''} customClassName={styles['activeshaixuan']} />
|
||||
{/* <View className={classnames('iconfont', 'icon-shaixuan', !isDisabled ? styles.icon_shaixuan : styles.activeshaixuan)}></View> */}
|
||||
<View className={classnames(isDisabled ? styles.shaixuan : styles.activeshai)}>筛选</View>
|
||||
</View>
|
||||
</Search>
|
||||
|
@ -2,7 +2,7 @@ import { Image, Text, View } from "@tarojs/components";
|
||||
import { memo, useEffect, useMemo, useRef, useState } from "react";
|
||||
import classnames from "classnames";
|
||||
import styles from './index.module.scss'
|
||||
|
||||
import IconFont from '@/components/iconfont/iconfont'
|
||||
interface propsObj {
|
||||
receivingStatus: Number | null,
|
||||
onReceivingStatus?: (any, Number) => void,
|
||||
@ -45,11 +45,14 @@ export default memo((props: propsObj) => {
|
||||
<View className={styles.addressBox}>
|
||||
<View className={styles.topBox} onClick={() => navSelect?.(obj)}>
|
||||
<View className={styles.cirle}>
|
||||
<View className={classnames('iconfont', 'icon-dingwei', styles.dingwei)}></View>
|
||||
<IconFont name={'icon-dingwei'} size={26} color={'#ffffff'}></IconFont>
|
||||
{/* <View className={classnames('iconfont', 'icon-dingwei', styles.dingwei)}></View> */}
|
||||
</View>
|
||||
<View className={styles.address}>{addressInfo}</View>
|
||||
{
|
||||
receivingStatus !== 1 && <View className={classnames('iconfont', 'icon-chakanquanbukehu', styles.icon_more)}></View>
|
||||
receivingStatus !== 1 &&
|
||||
<IconFont name={'icon-chakanquanbukehu'} size={50} ></IconFont>
|
||||
// <View className={classnames('iconfont', 'icon-chakanquanbukehu', styles.icon_more)}></View>
|
||||
}
|
||||
</View>
|
||||
<View className={styles.line}></View>
|
||||
|
@ -23,12 +23,13 @@ import {
|
||||
mpsaleOrdercancel,
|
||||
GetPayCode,
|
||||
mpsaleOrderaddress,
|
||||
mpsaleOrdershipmentMode,
|
||||
mpsaleOrderreceive
|
||||
} from '@/api/order'
|
||||
import { alert, goLink } from '@/common/common'
|
||||
import { formatPriceDiv, formatDateTime, formatWeightDiv } from '@/common/format'
|
||||
import PayPopup from '../order/components/PayPopup'
|
||||
|
||||
import IconFont from '@/components/iconfont/iconfont'
|
||||
export default () => {
|
||||
const router = useRouter()
|
||||
// useEffect(() => {
|
||||
@ -46,7 +47,7 @@ export default () => {
|
||||
//收货方法,1:自提,2物流
|
||||
const [receivingStatus, setReceivingStatus] = useState(null)
|
||||
//切换自提或者物流
|
||||
const { fetchData: selectFetch } = mpsaleOrderaddress()
|
||||
const { fetchData: selectFetch } = mpsaleOrdershipmentMode()
|
||||
const onReceivingStatus = debounce(async (e, value) => {
|
||||
if (infoObj.status === 8 || infoObj.status === 9 || infoObj.status === 4 || infoObj.status === 5) {
|
||||
alert.error('不允许更改')
|
||||
@ -69,10 +70,11 @@ export default () => {
|
||||
icon: 'success'
|
||||
})
|
||||
setReceivingStatus(value)
|
||||
getDetail()
|
||||
} else {
|
||||
Taro.hideLoading()
|
||||
Taro.showToast({
|
||||
title: res.msg,
|
||||
title: '请先去新增地址',
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
@ -595,21 +597,22 @@ export default () => {
|
||||
<View className={styles.flexMoney}>
|
||||
<View className={styles.flexTotalBox}>
|
||||
<View className={styles.totalFont}>合计金额</View>
|
||||
<View className={classnames('iconfont', 'icon-tishi', styles.tishi)}></View>
|
||||
<IconFont name={'icon-tishi'} size={28} ></IconFont>
|
||||
</View>
|
||||
<View className={styles.shoudPay}>{formatPriceDiv(infoObj.total_should_collect_money)}</View>
|
||||
</View>
|
||||
<View className={styles.flexMoney}>
|
||||
<View className={styles.flexTotalBox}>
|
||||
<View className={styles.totalFont}>实付金额</View>
|
||||
<View className={classnames('iconfont', 'icon-tishi', styles.tishi)}></View>
|
||||
<IconFont name={'icon-tishi'} size={28} ></IconFont>
|
||||
</View>
|
||||
<View className={styles.shoudPay}>{formatPriceDiv(infoObj.actual_amount)}</View>
|
||||
</View>
|
||||
<View className={styles.flexMoney}>
|
||||
<View className={styles.flexTotalBox}>
|
||||
<View className={styles.totalFont}>待付金额</View>
|
||||
<View className={classnames('iconfont', 'icon-tishi', styles.tishi)}></View>
|
||||
{/* <View className={classnames('iconfont', 'icon-tishi', styles.tishi)}></View> */}
|
||||
<IconFont name={'icon-tishi'} size={28} ></IconFont>
|
||||
</View>
|
||||
<View className={styles.shoudPay}>{formatPriceDiv(infoObj.wait_pay_amount)}</View>
|
||||
</View>
|
||||
|
@ -17,9 +17,38 @@ import {
|
||||
import Tabs from "./components/tabs"
|
||||
import TimePicker from "@/components/timePicker"
|
||||
import dayjs from 'dayjs'
|
||||
import IconFont from '@/components/iconfont/iconfont'
|
||||
export default () => {
|
||||
//页码和页数
|
||||
|
||||
const [searchField, setSearchField] = useState<
|
||||
{
|
||||
status: number | unknown;
|
||||
page: number;
|
||||
size: number;
|
||||
name: string;
|
||||
sale_mode: number | string;
|
||||
stage: number | string;
|
||||
return_type: number | string;
|
||||
sale_start_time: number | string;
|
||||
sale_end_time: number | string;
|
||||
}>({
|
||||
status: 1,
|
||||
page: 1,
|
||||
size: 10,
|
||||
name: '',
|
||||
sale_mode: '不限',
|
||||
stage: '不限',
|
||||
return_type: '不限',
|
||||
sale_start_time: '',
|
||||
sale_end_time: ''
|
||||
})
|
||||
const pageNum = useRef({ size: searchField.size, page: searchField.page })
|
||||
|
||||
//监听筛选条件变化
|
||||
useEffect(() => {
|
||||
getOrderList()
|
||||
}, [searchField.size, searchField.name])
|
||||
|
||||
//获取订单列表
|
||||
const { fetchData: listFetchData, state: orderState } = mpreturnApplyOrderlist()
|
||||
@ -35,36 +64,9 @@ export default () => {
|
||||
setRefresherTriggeredStatus(() => false)
|
||||
}
|
||||
|
||||
//页码和页数
|
||||
|
||||
const [searchField, setSearchField] = useState<
|
||||
{
|
||||
status: number | unknown;
|
||||
page: number;
|
||||
size: number;
|
||||
name: string;
|
||||
sale_mode: number | string;
|
||||
stage: number | string;
|
||||
return_type: number | string;
|
||||
saleStartTime: number | string;
|
||||
saleEndTime: number | string;
|
||||
}>({
|
||||
status: 1,
|
||||
page: 1,
|
||||
size: 10,
|
||||
name: '',
|
||||
sale_mode: '不限',
|
||||
stage: '不限',
|
||||
return_type: '不限',
|
||||
saleStartTime: '',
|
||||
saleEndTime: ''
|
||||
})
|
||||
const pageNum = useRef({ size: searchField.size, page: searchField.page })
|
||||
|
||||
//监听筛选条件变化
|
||||
useEffect(() => {
|
||||
getOrderList()
|
||||
}, [searchField])
|
||||
|
||||
|
||||
//输入了搜索关键字
|
||||
const getSearchData = useCallback((e) => {
|
||||
@ -136,7 +138,7 @@ export default () => {
|
||||
return it
|
||||
})
|
||||
setModeList([...modeList])
|
||||
setSearchField((e) => ({ ...e, sale_mode: item.id }))
|
||||
setSearchField((e) => ({ ...e, sale_mode: item.id, }))
|
||||
}
|
||||
useEffect(() => {
|
||||
getStagelist()
|
||||
@ -172,7 +174,7 @@ export default () => {
|
||||
return it
|
||||
})
|
||||
setStageList([...stageList])
|
||||
setSearchField((val) => ({ ...val, size: 10, stage: item.id }))
|
||||
setSearchField((val) => ({ ...val, stage: item.id }))
|
||||
}
|
||||
|
||||
|
||||
@ -203,7 +205,7 @@ export default () => {
|
||||
return it
|
||||
})
|
||||
setTypeList([...typeList])
|
||||
setSearchField((val) => ({ ...val, size: 10, return_type: item.id }))
|
||||
setSearchField((val) => ({ ...val, return_type: item.id }))
|
||||
}
|
||||
|
||||
//是否不允许确认筛选
|
||||
@ -211,8 +213,8 @@ export default () => {
|
||||
if (searchField.stage !== '不限' ||
|
||||
searchField.sale_mode !== '不限' ||
|
||||
searchField.return_type !== '不限' ||
|
||||
searchField.saleStartTime !== '' ||
|
||||
searchField.saleEndTime !== ''
|
||||
searchField.sale_start_time !== '' ||
|
||||
searchField.sale_end_time !== ''
|
||||
) {
|
||||
return false
|
||||
} else {
|
||||
@ -234,10 +236,11 @@ export default () => {
|
||||
sale_mode: '不限',
|
||||
stage: '不限',
|
||||
return_type: '不限',
|
||||
saleStartTime: '',
|
||||
saleEndTime: '',
|
||||
sale_start_time: '',
|
||||
sale_end_time: '',
|
||||
}))
|
||||
setStart(myDate.toLocaleDateString())
|
||||
getOrderList()
|
||||
setEnd('')
|
||||
}
|
||||
|
||||
@ -267,11 +270,11 @@ export default () => {
|
||||
start: '',
|
||||
end: ''
|
||||
}
|
||||
obj.start = myDate?.toLocaleDateString() + ' ' + '00:00:00'
|
||||
obj.start = `${dayjs(new Date(myDate?.toLocaleDateString() + ' ' + '00:00:00',)).format('YYYY-MM-DD')} 00:00:00`,
|
||||
obj.end = `${dayjs(new Date(obj?.start)).add(1, 'day').format('YYYY-MM-DD')} 00:00:00`
|
||||
eq.value = obj
|
||||
}
|
||||
setSearchField((val) => ({ ...val, saleStartTime: eq?.value?.start, saleEndTime: eq?.value?.end }))
|
||||
setSearchField((val) => ({ ...val, sale_start_time: eq?.value?.start, sale_end_time: eq?.value?.end, size: 10 }))
|
||||
setStart(eq?.value?.start)
|
||||
setEnd(eq?.value?.end)
|
||||
setShowTime(false)
|
||||
@ -285,17 +288,26 @@ export default () => {
|
||||
}
|
||||
}, [end])
|
||||
|
||||
const handSure = () => {
|
||||
pageNum.current.page = 1
|
||||
setSearchField((val) => ({ ...val, size: 10 }))
|
||||
setshowPopup?.(false)
|
||||
getOrderList()
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
setSearchField(searchField)
|
||||
console.log(searchField, 9999)
|
||||
}, [searchField])
|
||||
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
<View style={{ background: '#FFFFFF', paddingLeft: '20rpx', paddingBottom: '20rpx', position: 'sticky', top: '0', zIndex: '99' }}>
|
||||
<Search placeholder='搜索商品/名称/颜色/订单号' showBtn={false} changeOnSearch={getSearchData} debounceTime={300} >
|
||||
<View className={styles.flexBox} onClick={() => showSelctPopup()}>
|
||||
<View className={classnames('iconfont', 'icon-shaixuan', !isDisabled ? styles.icon_shaixuan : styles.activeshaixuan)}></View>
|
||||
<IconFont name='icon-shaixuan' size={35} color={!isDisabled ? '#0D7CFF' : ''} customClassName={styles['activeshaixuan']} />
|
||||
{/* <View className={classnames('iconfont', 'icon-shaixuan', !isDisabled ? styles.icon_shaixuan : styles.activeshaixuan)}></View> */}
|
||||
<View className={classnames(isDisabled ? styles.shaixuan : styles.activeshai)}>筛选</View>
|
||||
</View>
|
||||
</Search>
|
||||
@ -362,17 +374,20 @@ export default () => {
|
||||
<View className={styles.thirdBox}>
|
||||
<View className={styles.thirdTopfont}>售后时间</View>
|
||||
<View className={styles.timeBox2} onClick={() => { setShowTime(true) }}>{timeArea}
|
||||
<View className={styles.more}>
|
||||
{
|
||||
timeArea == '自定义起始时间' && <View className={classnames('iconfont', 'icon-chakanquanbukehu', styles.more)}></View>
|
||||
timeArea == '自定义起始时间' &&
|
||||
<IconFont name={'icon-chakanquanbukehu'} color={'#000000'} size={40} customClassName={styles['more']}></IconFont>
|
||||
}
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
<View style={{ height: '100rpx' }}></View>
|
||||
|
||||
<View className={styles.bottomBox}>
|
||||
|
||||
<Button className={styles.resetBox} onClick={() => { handReset() }}> 重置</Button >
|
||||
<Button className={classnames(isDisabled ? styles.button : styles.activeButton)} disabled={isDisabled} onClick={() => { setshowPopup?.(false) }}> 确认</Button >
|
||||
<Button className={classnames(isDisabled ? styles.button : styles.activeButton)} disabled={isDisabled} onClick={() => handSure()}> 确认</Button >
|
||||
</View>
|
||||
|
||||
{/* <View className={styles.areaBox}></View> */}
|
||||
|
@ -104,11 +104,11 @@ const ShoppingCartContainer: FC<InternalContainer> = () => {
|
||||
goLink('/pages/submitOrder/index', {
|
||||
purchaser_id: currentCheckedPurchaserId,
|
||||
sale_mode: currentCheckedSaleMode,
|
||||
shopping_cart_product_color_list: Object.values(targetGoodsKind).map((item: Goods) => {
|
||||
shopping_cart_product_color_list: JSON.stringify(Object.values(targetGoodsKind).map((item: Goods) => {
|
||||
if (item.checked) {
|
||||
return item.id
|
||||
}
|
||||
}),
|
||||
}))
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -9,35 +9,45 @@ import Popup from '@/components/popup'
|
||||
import { debounce } from '@/common/util'
|
||||
import {
|
||||
mpsaleOrderpreView,
|
||||
mpsaleOrderput,
|
||||
mpsaleOrderaddress
|
||||
mpsaleOrderpost,
|
||||
} from '@/api/order'
|
||||
import { alert } from '@/common/common'
|
||||
import { formatPriceDiv, formatDateTime, formatWeightDiv } from '@/common/format'
|
||||
|
||||
import IconFont from '@/components/iconfont/iconfont'
|
||||
export default () => {
|
||||
const router: any = useRouter()
|
||||
|
||||
const [infoObj, setInfoObj] = useState<any>({})
|
||||
useDidShow(() => {
|
||||
getDetail()
|
||||
})
|
||||
//页面下拉刷新
|
||||
usePullDownRefresh(() => {
|
||||
getDetail()
|
||||
})
|
||||
|
||||
//获取选择的客户
|
||||
let pages = Taro.getCurrentPages();
|
||||
let currPage = pages[pages.length - 1]; // 获取当前页面
|
||||
|
||||
setInfoObj({
|
||||
...infoObj,
|
||||
province_name: currPage.data.addressObj.province_name,
|
||||
address_id: currPage.data.addressObj.id,
|
||||
city_name: currPage.data.addressObj.city_name,
|
||||
district_name: currPage.data.addressObj.district_name,
|
||||
target_user_name: currPage.data.addressObj.name,
|
||||
purchaser_phone: currPage.data.addressObj.phone,
|
||||
})
|
||||
})
|
||||
useEffect(() => {
|
||||
getDetail()
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
setInfoObj(infoObj)
|
||||
console.log(infoObj, 66666)
|
||||
}, [infoObj])
|
||||
|
||||
//收货方法,1:自提,2物流
|
||||
const [receivingStatus, setReceivingStatus] = useState(null)
|
||||
const [receivingStatus, setReceivingStatus] = useState<any>(null)
|
||||
//切换自提或者物流
|
||||
const { fetchData: selectFetch } = mpsaleOrderaddress()
|
||||
const onReceivingStatus = debounce(async (e, value) => {
|
||||
if (infoObj.status === 8 || infoObj.status === 9 || infoObj.status === 4 || infoObj.status === 5) {
|
||||
alert.error('不允许更改')
|
||||
return false
|
||||
}
|
||||
e.stopPropagation()
|
||||
if (receivingStatus === value) {
|
||||
if (receivingStatus == value) {
|
||||
alert.error('不能选择相同的方式')
|
||||
return false
|
||||
}
|
||||
@ -45,57 +55,37 @@ export default () => {
|
||||
title: '请稍等...',
|
||||
mask: true
|
||||
})
|
||||
const res = await selectFetch({ id: Number(infoObj.id), shipment_mode: value })
|
||||
if (res.msg === 'success') {
|
||||
Taro.hideLoading()
|
||||
Taro.showToast({
|
||||
title: '成功',
|
||||
icon: 'success'
|
||||
})
|
||||
setReceivingStatus(value)
|
||||
} else {
|
||||
Taro.hideLoading()
|
||||
Taro.showToast({
|
||||
title: res.msg,
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
}, 300)
|
||||
|
||||
const { fetchData: infoFetch } = mpsaleOrderpreView()
|
||||
const [infoObj, setInfoObj] = useState<any>({})
|
||||
//获取订单详情
|
||||
const getDetail = async () => {
|
||||
let arr: any[] = []
|
||||
arr = JSON.parse(decodeURIComponent(router.params.shopping_cart_product_color_list))
|
||||
let list: any[] = []
|
||||
router.params?.shopping_cart_product_color_list?.forEach(item => {
|
||||
arr?.forEach(item => {
|
||||
list.push({
|
||||
shopping_cart_product_color_id: item.shopping_cart_product_color_id,
|
||||
shopping_cart_product_color_id: item,
|
||||
sale_price: 0
|
||||
})
|
||||
})
|
||||
const query = {
|
||||
purchaser_id: router.params.purchaser_id,
|
||||
sale_mode: router.params.sale_mode,
|
||||
purchaser_id: Number(router.params.purchaser_id),
|
||||
sale_mode: Number(router.params.sale_mode),
|
||||
shopping_cart_product_color_list: list
|
||||
}
|
||||
const res = await infoFetch(query)
|
||||
setInfoObj(res.data)
|
||||
setReceivingStatus(res.data.shipment_mode)
|
||||
setReceivingStatus(1)
|
||||
}
|
||||
|
||||
//备注操作
|
||||
const [showDesc, setShowDesc] = useState(false)
|
||||
const { fetchData: remarkFetch } = mpsaleOrderput()
|
||||
const getRemark = useCallback(async (e) => {
|
||||
const res = await remarkFetch({ remark: e, id: Number(router.params.id) })
|
||||
if (res.msg === 'success') {
|
||||
Taro.showToast({
|
||||
title: '成功',
|
||||
icon: 'success'
|
||||
})
|
||||
setShowDesc(false)
|
||||
getDetail()
|
||||
}
|
||||
setInfoObj((val) => ({ ...val, remark: e }))
|
||||
}, [])
|
||||
|
||||
|
||||
@ -103,10 +93,65 @@ export default () => {
|
||||
|
||||
const handSelect = (obj) => {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/addressManager/index?orderId=' + obj.id + '&purchaser_id=' + obj.purchaser_id
|
||||
url: '/pages/addressManager/index?orderId=' + '-100' + '&purchaser_id=' + router.params.purchaser_id
|
||||
})
|
||||
}
|
||||
|
||||
//提交订单
|
||||
const { fetchData: postFetch } = mpsaleOrderpost()
|
||||
const handSure = () => {
|
||||
if (receivingStatus == 2 && !infoObj.address_id) {
|
||||
return alert.error('请选择地址')
|
||||
}
|
||||
let list: any[] = []
|
||||
infoObj.product_list.forEach(item => {
|
||||
item.product_colors.forEach(it => {
|
||||
list.push({
|
||||
sale_price: it.sale_price,
|
||||
shopping_cart_product_color_id: Number(it.id)
|
||||
})
|
||||
})
|
||||
})
|
||||
let query = {
|
||||
address_id: Number(infoObj.address_id) ? Number(infoObj.address_id) : 0,
|
||||
list: list,
|
||||
physical_warehouse: infoObj.physical_warehouse,
|
||||
purchaser_id: Number(router.params.purchaser_id),
|
||||
remark: infoObj.remark,
|
||||
sale_mode: infoObj.sale_mode,
|
||||
shipment_mode: receivingStatus
|
||||
}
|
||||
Taro.showModal({
|
||||
content: "确认提交吗?",
|
||||
confirmText: "确认",
|
||||
cancelText: "取消",
|
||||
success: async function (res) {
|
||||
if (res.confirm) {
|
||||
Taro.showLoading({
|
||||
title: '请稍等...',
|
||||
mask: true
|
||||
})
|
||||
const res = await postFetch(query)
|
||||
if (res?.msg === 'success') {
|
||||
Taro.showToast({
|
||||
title: '成功'
|
||||
})
|
||||
Taro.hideLoading()
|
||||
Taro.redirectTo({
|
||||
url: '/pages/orderDetails/index?id=' + res.data.id
|
||||
})
|
||||
} else {
|
||||
Taro.hideLoading()
|
||||
Taro.showToast({
|
||||
title: res?.msg,
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
return (
|
||||
<View className={styles.mainBox}>
|
||||
<AddressDetailBox
|
||||
@ -121,19 +166,20 @@ export default () => {
|
||||
modeName={infoObj.sale_mode_name}
|
||||
>
|
||||
<View className={styles.pussBox}>
|
||||
<View className={styles.pussName}>{infoObj.purchaser_name}</View>
|
||||
<View className={styles.pussPhone}>{infoObj.purchaser_phone}</View>
|
||||
<View className={styles.pussName}>{router.params.purchaser_name}</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>
|
||||
{/* <View className={styles.total}> {infoObj.product_list?.length} 种面料,{infoObj.total_colors} 个颜色,共 {infoObj.sale_mode === 0 ? infoObj.total_number : infoObj.total_number / 100} {infoObj.sale_mode === 0 ? '条' : 'm'}</View> */}
|
||||
<View className={styles.productBox}>
|
||||
<GoodsItem list={infoObj?.product_list} obj={infoObj}></GoodsItem>
|
||||
<View className={styles.flexMoney}>
|
||||
<View className={styles.flexTotalBox}>
|
||||
<View className={styles.totalFont}>合计金额</View>
|
||||
<View className={classnames('iconfont', 'icon-tishi', styles.tishi)}></View>
|
||||
<IconFont name={'icon-tishi'} size={28} ></IconFont>
|
||||
{/* <View className={classnames('iconfont', 'icon-tishi', styles.tishi)}></View> */}
|
||||
</View>
|
||||
<View className={styles.shoudPay}>{formatPriceDiv(infoObj.total_should_collect_money)}</View>
|
||||
<View className={styles.shoudPay}>{formatPriceDiv(infoObj.estimate_amount)}</View>
|
||||
</View>
|
||||
</View>
|
||||
<DefaultBox title={'备注信息'} showMode={true} modeName={`${'填写/修改备注'} >`} clickNode={() => setShowDesc(true)}>
|
||||
@ -147,11 +193,11 @@ export default () => {
|
||||
<View className={styles.leftBottom}>
|
||||
<View className={styles.topFlex}>
|
||||
<View className={styles.topFont}>预估金额:</View>
|
||||
<View className={styles.topTotal}>¥3564.00</View>
|
||||
<View className={styles.topTotal}>¥{formatPriceDiv(infoObj.estimate_amount)}</View>
|
||||
</View>
|
||||
<View className={styles.bottomFlex}>3 种面料,3 种颜色,共 3 M</View>
|
||||
<View className={styles.bottomFlex}>{infoObj.product_list?.length} 种面料,{infoObj.total_colors} 种颜色,共 {infoObj.sale_mode === 0 ? infoObj.total_number : infoObj.total_number / 100} {infoObj.sale_mode === 0 ? '条' : 'm'}</View>
|
||||
</View>
|
||||
<View className={styles.rightBottom}>提交订单</View>
|
||||
<View className={styles.rightBottom} onClick={() => handSure()}>提交订单</View>
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
@ -219,12 +265,12 @@ const GoodsItem = memo((porps: PropGoods) => {
|
||||
<View className={styles.itemPic} style={{ backgroundColor: `rgb(${it?.rgb?.r} ${it?.rgb?.g} ${it?.rgb?.b})` }}></View>
|
||||
<View className={styles.itemRight}>
|
||||
<View className={styles.item_right_top}>
|
||||
<View className={styles.itemName}>{it.code}# {it.name}</View>
|
||||
<View className={styles.itemName}>{it.code} {it.name}</View>
|
||||
<View className={styles.itemNums}>x{obj?.sale_mode === 0 ? it.roll : it.length / 100}{obj?.sale_mode === 0 ? '条' : 'm'}</View>
|
||||
</View>
|
||||
<View className={styles.item_right_Bottom}>
|
||||
<View className={styles.itemMoney}>¥{it.sale_price / 100}/{obj?.sale_mode === 0 ? '条' : 'm'}</View>
|
||||
<View className={styles.itemMoneyOne}>¥{formatPriceDiv(it.total_sale_price)}</View>
|
||||
<View className={styles.itemMoneyOne}>¥{formatPriceDiv(it.estimate_amount)}</View>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
|
Loading…
x
Reference in New Issue
Block a user