This commit is contained in:
aihe 2024-05-23 23:15:34 +08:00
parent 816146c3bd
commit 644a3f6d53
4 changed files with 90 additions and 81 deletions

View File

@ -41,7 +41,7 @@ export const getSalemanList = (data = {})=> {
// 报价试算
export const preCalcWaybillFee = (data = {})=> {
return coreRequest(url.preCalcWaybillFee, { ...data, postCode: 'RSD' }, {}, "GET")
return coreRequest(url.preCalcWaybillFee, { ...data, postCode: 'RSD' }, {})
}
// 物流轨迹

View File

@ -54,7 +54,7 @@
return {
submitParams: {
username: '25001108',
password: '123456'
password: 'q123456'
},
remberPassport: [true]
}

View File

@ -6,32 +6,29 @@
<view class="blcok-white" style="padding-top: 0;padding-bottom: 0;">
<view>
<view class="yunf-input-item">
<tpx-select v-model:value="submitParam.sendSiteCode" v-model:text="submitParam.sendSiteName" v-model:resObject="sendPostRes" :getListFun="getSendPositionList" :transKeyVal="{valKey: 'destCode',titleKey: 'destName'}" :isWhite="true"
:searchParam="sendPostParam" placeholder="请选择始发网点"
>
<tpx-text-item label="始发网点" :value="submitParam.sendSiteName"></tpx-text-item>
</tpx-select>
<tpx-text-item label="始发网点">
<template v-slot:right>{{submitParam.sendSiteName}}</template>
</tpx-text-item>
</view>
<view class="yunf-input-item">
<tpx-select v-model:value="submitParam.sendSiteCode" v-model:text="submitParam.sendSiteName" v-model:resObject="sendPostRes" :getListFun="getSendPositionList" :transKeyVal="{valKey: 'destCode',titleKey: 'destName'}" :isWhite="true"
:searchParam="sendPostParam" placeholder="请选择始目的国"
<tpx-select v-model:value="submitParam.reciever.country" v-model:resObject="countryRes" :getListFun="getEmisCountry" :transKeyVal="{valKey: 'code',titleKey: 'name'}" :isWhite="true"
v-model:text="submitParam.reciever.countryName" :searchParam="countrySearchParam" placeholder="请选择目的国" @onChange="handleCountryChange"
>
<tpx-text-item label="目的国" :value="submitParam.sendSiteName"></tpx-text-item>
<tpx-text-item label="目的国" :value="submitParam.reciever.countryName"></tpx-text-item>
</tpx-select>
</view>
</view>
<view class="yunf-input-item">
<tpx-select v-model:value="submitParam.sendSiteCode" v-model:text="submitParam.sendSiteName" v-model:resObject="sendPostRes" :getListFun="getSendPositionList" :transKeyVal="{valKey: 'destCode',titleKey: 'destName'}" :isWhite="true"
:searchParam="sendPostParam" placeholder="请选择省/州"
<view v-if="submitParam.reciever.country" class="yunf-input-item">
<tpx-select v-model:value="submitParam.reciever.province" v-model:resObject="provRes" :getListFun="getEmisRegion" :transKeyVal="{valKey: 'regionCode',titleKey: 'regionName'}" :isWhite="true"
v-model:text="submitParam.reciever.provinceName" :searchParam="provParam" placeholder="请选择省/州" @onChange="handlePrvChange"
>
<tpx-text-item label="省/州" :value="submitParam.sendSiteName"></tpx-text-item>
<tpx-text-item label="省/州" :value="submitParam.reciever.provinceName"></tpx-text-item>
</tpx-select>
</view>
</view>
<template v-if="submitParam.senderCountry">
<template v-if="submitParam.reciever.province">
<view class="yunf-input-item">
<tpx-select v-model:value="submitParam.transLine" v-model:text="submitParam.transLineTypeName" v-model:resObject="wayRes"
:getListFun="getTransLineList" :transKeyVal="{valKey: 'lineCode',titleKey: 'lineName'}"
@ -42,12 +39,10 @@
</view>
</template>
<view v-if="submitParam.transLine" class="yunf-input-item">
<tpx-select v-model:value="submitParam.destinationCode" v-model:text="submitParam.destinationName" v-model:resObject="destPostRes" :getListFun="getDestPositionList" :transKeyVal="{valKey: 'destCode',titleKey: 'destName'}" :isWhite="true"
:searchParam="destPostParam" @onChange="handleDestPostChange" placeholder="请选择目的网点"
>
<tpx-text-item label="目的网点" :value="submitParam.destinationName"></tpx-text-item>
</tpx-select>
<view class="yunf-input-item">
<tpx-text-item label="目的网点">
<template v-slot:right>{{submitParam.dispatchUnderlingSiteName}}</template>
</tpx-text-item>
</view>
<view class="yunf-input-item">
@ -84,27 +79,29 @@
</view>
</view>
<template v-if="true">
<view class="com-section mt-30">产品类型TODO</view>
<view v-if="proTypeList.length > 0">
<view class="com-section mt-30">产品类型</view>
<view class="blcok-white yunf-list" style="padding-bottom: 2rpx;">
<tpx-checkitems :list="proList" v-model:value="submitParam.prodId" v-slot="curPro" min-checked="1" type="single">
<tpx-checkitems :list="proTypeList" v-model:value="submitParam.productType" v-model:text="submitParam.productTypeName" v-slot="curPro" min-checked="1" type="single"
:transKeyVal="{valKey: 'productType', titleKey: 'productTypeName'}"
>
<view slot :class="`yunf-item ${curPro.checked?'active':''}`">
<u-row justify="between">
<u-col span="8">
<u-text :text="`柬埔寨-国际特快`" size="28" :bold="true"></u-text>
<u-text margin="6rpx" text="1-2工作日 ¥80元起" size="26" color="#999"></u-text>
<u-text :text="curPro.item.productTypeName" size="28" :bold="true"></u-text>
<u-text margin="6rpx" :text="curPro.item.agingDesc" size="26" color="#999"></u-text>
</u-col>
<u-col span="4">
<u-text align="right" text="运费预估" size="26" color="#999"></u-text>
<u-text align="right" margin="6rpx" text="32" size="26" :bold="true" mode="price"
<u-text align="right" margin="6rpx" :text="curPro.item.estFee" size="26" :bold="true" mode="price"
color="#B12D29"></u-text>
</u-col>
</u-row>
</view>
</tpx-checkitems>
</view>
</template>
</view>
<u-row justify="center">
<view class="mt-40">
@ -115,7 +112,7 @@
</view>
</template>
<template v-if="hasCalcuPost" v-slot:footer>
<template v-if="proTypeList.length > 0" v-slot:footer>
<view class="pos-rlt blcok-white" style="border-radius: 0;margin-top: 0;">
<u-row justify="between">
@ -125,7 +122,7 @@
<view class="mr-10">
<u-text text="预估" :bold="true" size="28"></u-text>
</view>
<u-text :text="80" mode="price" color="#B12D29" :bold="true" size="28"></u-text>
<u-text :text="checkedEstFee" mode="price" color="#B12D29" :bold="true" size="28"></u-text>
</u-row>
<u-text margin="10rpx 0 0 0" text="温馨提示:具体费用以快递小哥核实为准" color="#999" size="26"></u-text>
</view>
@ -156,30 +153,30 @@
// }
},
computed: {
sendPostParam(){
return {}
},
waySearchParam() {
return { country: this.submitParam.reciever.country, fromCountry: this.submitParam.sender.country }
return { country: this.submitParam.reciever.country, fromCountry: '' }
},
productSearchParam() {
countrySearchParam() {
return { transLineCode: this.submitParam.transLine }
},
destPostParam(){
provParam(){
const { country } = this.submitParam.reciever
return { lineCode: this.submitParam.transLine, countryCode: country }
return { countryCode: country, regionType: 1 }
},
dicData() {
return this.$store.getters.dicData
},
checkedEstFee() {
let item = this.proTypeList.filter(t=> t.val == this.submitParam.productType)[0] || {}
return item.estFee
},
},
data() {
return this.getDefaultData()
},
onShareAppMessage() {
return {
// title: '',
// path: 'TODO'
}
},
onLoad(option) {
@ -192,31 +189,36 @@
},
methods: {
getDefaultData() { // data的默认数据
let { ownerSiteCode, ownerSiteName } = this.$store.getters.userInfo
return {
pageLoading: true,
queryOption: {
},
sendPostRes: { list: [] },
proTypeList: [],
countryRes: { list: [] },
provRes: { list: [] },
wayRes: { list: [] },
productRes: { list: [] },
destPostRes: { list: [] },
submitParam: {
reciever: {
country: '',
province: ''
},
transLine: "", // 线路编码
productType: "", // 产品类型code
calcFeeType: "", // 计费类型 1-重量计费 2-体积计费
billWeight: "", // 实际重量
totalVolume: "", // 总体积
dispatchUnderlingSiteCode: "", // 目的地站点
customsClear: "", // 清关方式
customsEclaration:"", // 清关方式
sendSiteCode: this.$store.getters.userInfo.ownerSiteCode, // 发件站点
sendSiteCode: ownerSiteCode, // 发件站点
sendSiteName: ownerSiteName, // 发件站点名称
}
}
},
getSendPositionList: apiService.getDestPositionList,
getEmisCountry: apiService.getEmisCountry,
getTransLineList: apiService.getTransLineList,
getTransProductList: apiService.getTransProductList,
getRSDStaffList: apiService.getRSDStaffList,
getDestPositionList: apiService.getDestPositionList,
getEmisRegion: apiService.getEmisRegion,
async initData() { // 初始化
this.pageLoading = false
},
@ -224,52 +226,50 @@
initEvent() {
},
handleAddressChange() { // 地址切换
let { wayRes, submitParam } = this.getDefaultData()
if(this.submitParam.reciever.country && this.submitParam.sender.country) {
this.submitParam.transLine = submitParam.transLine
this.submitParam.transLineTypeName = submitParam.transLineTypeName
this.handleWayChange() // 调用线路切换,清空后续数据
}
handleCountryChange(val) {
this.submitParam.reciever.province = ''
this.submitParam.reciever.provinceName = ''
this.handlePrvChange()
},
handlePrvChange(val){
this.submitParam.transLine = ''
this.submitParam.transLineTypeName = ''
this.handleWayChange() // 调用线路切换,清空后续数据
},
handleWayChange(val) { // 线路切换
let { productRes, submitParam } = this.getDefaultData()
// 清空产品类型数据
this.submitParam.productType = submitParam.productType
this.submitParam.productTypeName = submitParam.productTypeName
const item = this.wayRes.list.filter(t=> t.val == val)[0]
this.updateDltDestSite({ lineCode: val })
},
handleDestPostChange(val) {
const item = this.destPostRes.list.filter(t=> t.val == val)[0]
this.submitParam.dispatchUnderlingSiteCode = item.siteCode;
this.submitParam.dispatchUnderlingSiteName = item.siteName;
if(val) {
this.updateDltDestSite({ lineCode: val })
} else {
this.submitParam.dispatchUnderlingSiteCode = ''
this.submitParam.dispatchUnderlingSiteName = ''
}
},
handleDialogClick(curModal){
curModal.show = true
},
async updateDltDestSite({ lineCode }) {
const { country, province, city, county, address } = this.submitParam.reciever
let res = await apiService.getCaculteDestSite({ lineCode, country, province, city, county, address })
const { country, province } = this.submitParam.reciever
let res = await apiService.getCaculteDestSite({ lineCode, country, province })
// 更新路线推荐的默认目的地
let data = res.data || {}
this.submitParam.destinationCode = data.destCode
this.submitParam.destinationName = data.destName
this.submitParam.dispatchUnderlingSiteCode = data.siteCode;
this.submitParam.dispatchUnderlingSiteName = data.siteName;
},
async handleGoodInfoSure() {
// 校验各个组件的参数
let res = await this.$refs.goodSize.validData()
},
async handleCalPost(type) {
let params = JSON.parse(JSON.stringify(this.submitParam));
params.goodsPics = params.goodsPics.join(",")
await saveServerHand(params)
this.showToast('操作成功')
// TOTO
debugger
params.calcFeeType = 1 // "计费类型 1-重量计费 2-体积计费"
let res = await apiService.preCalcWaybillFee({ ...params, _loading: true })
this.proTypeList = res.data || []
if(this.proTypeList.length > 0) {
this.showToast('试算成功')
} else {
this.showToast('未匹配到产品信息,请切换条件重新试算')
}
},
handleGoXiaDan() {
this.goto(`post/openorder?defaultSubParams=${encodeURIComponent(JSON.stringify(this.submitParam))}`)
}
}
}

View File

@ -337,6 +337,7 @@
pageLoading: true,
isEdit: false,
queryOption: {
defaultSubParams: '', // 提交默认参数
billCode: '', // 运单id
orderSn: '', // 订单id
},
@ -371,6 +372,14 @@
getSalemanList: apiService.getSalemanList,
async initData() { // 初始化
this.isEdit = Boolean(this.queryOption.billCode || this.queryOption.orderSn)
if(this.queryOption.defaultSubParams) {
try{
this.queryOption.defaultSubParams = JSON.parse(decodeURIComponent(this.queryOption.defaultSubParams))
Object.assign(this.submitParam, this.queryOption.defaultSubParams)
}catch(e){
console.error("queryOption.defaultSubParams=====转换失败===", this.queryOption.defaultSubParams)
}
}
if(this.isEdit) {
let res = await apiService.getOrderDetail({...this.queryOption, _loading: true})
let data = res.data || {}