emis-app/pages/post/openorder.vue
2024-05-02 00:46:30 +08:00

421 lines
16 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<tpx-page>
<tpx-layout>
<template v-slot:body>
<view class="com-jianju pos-rlt pb-30" style="padding-top: 2rpx;">
<view class="blcok-white">
<u-row justify="between">
<view style="width: 130rpx;">运单号</view>
<view style="flex:1;">
<tpx-scan-input v-model:value="submitParam.billCode"></tpx-scan-input>
</view>
<view class="pl-10">
<u-button @click="handleCreateOrderNo()"
custom-style="font-size: 28rpx;padding:0 10rpx;height: 74rpx;" :plain="true" >系统生成</u-button>
</view>
</u-row>
<u-row justify="between" custom-style="margin-top:20rpx;">
<view style="width: 130rpx;">客户</view>
<view style="flex:1;">
<tpx-select v-model:resObject="kehuRes" :getListFun="getCustomerUserList" :transKeyVal="{valKey: 'customerCode',titleKey: 'customerName'}" v-model:value="submitParam.customerCode" :isWhite="true"></tpx-select>
</view>
</u-row>
</view>
<view class="com-section mt-30" @click="goto('post/detail')">
<u-row justify="space-between">
<text>订单号:TWO291929</text>
<u-icon name="bag" size="42"></u-icon>
</u-row>
</view>
<view class="blcok-white">
<!-- 地址选择 -->
<bpe-addressinfo-tmp v-model:value="submitParam"></bpe-addressinfo-tmp>
</view>
<view class="com-section mt-30">路线信息</view>
<view class="blcok-white" style="padding-top: 0;padding-bottom: 0;">
<view>
<template v-if="submitParam.reciever.country && submitParam.sender.country">
<view class="yunf-input-item">
<tpx-select v-model:value="submitParam.transLine" v-model:resObject="wayRes" :getListFun="getTransLineList" :transKeyVal="{valKey: 'lineCode',titleKey: 'lineName'}"
:searchParam="waySearchParam" @onChange="handleWayChange"
>
<tpx-text-item label="线路" :value="submitParam.transLine" :list="wayRes.list"></tpx-text-item>
</tpx-select>
</view>
</template>
<template v-if="submitParam.transLine">
<view class="yunf-input-item">
<tpx-select v-model:value="submitParam.productType" v-model:resObject="productRes" :getListFun="getTransProductList" :transKeyVal="{valKey: 'prodCode',titleKey: 'prodName'}" :isWhite="true"
:searchParam="productSearchParam"
>
<tpx-text-item label="产品类型" :value="submitParam.productType" :list="productRes.list"></tpx-text-item>
</tpx-select>
</view>
</template>
<view class="yunf-input-item">
<tpx-select v-model:value="submitParam.customsEclaration" :list="dicData.emis_declare_mode"
mode="drop"
>
<tpx-text-item label="报关方式" :value="submitParam.customsEclaration" :list="dicData.emis_declare_mode"></tpx-text-item>
</tpx-select>
</view>
<view class="yunf-input-item">
<tpx-select v-model:value="submitParam.customsClear" :list="dicData.emis_customs_clear"
mode="drop"
>
<tpx-text-item label="清关方式" :value="submitParam.customsClear" :list="dicData.emis_customs_clear"></tpx-text-item>
</tpx-select>
</view>
<view class="yunf-input-item">
<tpx-select v-model:value="submitParam.pickupMethod" :list="dicData.emis_qujian_fangshi"
mode="drop"
>
<tpx-text-item label="取件方式" :value="submitParam.pickupMethod" :list="dicData.emis_qujian_fangshi"></tpx-text-item>
</tpx-select>
</view>
<view class="yunf-input-item">
<tpx-select v-model:value="submitParam.operateEmployeeCode" v-model:resObject="caozuoRes" :getListFun="getOpStaffList" :transKeyVal="{valKey: 'empCode',titleKey: 'empName'}" >
<tpx-text-item label="操作员" :value="submitParam.operateEmployeeCode" :list="caozuoRes.list"></tpx-text-item>
</tpx-select>
</view>
<view class="yunf-input-item">
<tpx-select v-model:value="submitParam.takePieceEmployeeCode" v-model:resObject="shoupaiRes" :getListFun="getRSDStaffList" :transKeyVal="{valKey: 'empCode',titleKey: 'empName'}" >
<tpx-text-item label="收派员" :value="submitParam.takePieceEmployeeCode" :list="shoupaiRes.list"></tpx-text-item>
</tpx-select>
</view>
<view class="yunf-input-item">
<tpx-select v-model:value="submitParam.paymentType" :list="dicData.emis_payment_type"
mode="drop"
>
<tpx-text-item label="付款方式" :value="submitParam.paymentType" :list="dicData.emis_payment_type"></tpx-text-item>
</tpx-select>
<view v-if="submitParam.paymentType == 6" class="pt-10">
<u-textarea v-model="submitParam.feeRemaker" border="surround" height="120" placeholder="备注"
maxlength="50" count></u-textarea>
</view>
</view>
<view v-if="submitParam.paymentType == 2 || submitParam.paymentType == 4 || submitParam.paymentType == 5" class="yunf-input-item">
<tpx-select v-model:value="submitParam.custNo" v-model:resObject="yuejieRes" :getListFun="getMonthpayAccountList" :transKeyVal="{valKey: 'custNo',titleKey: 'custName'}"
@onChange="handleYueJieSelect"
>
<tpx-text-item label="月结账户" :value="submitParam.custNo" :list="yuejieRes.list"></tpx-text-item>
</tpx-select>
</view>
<template v-if="submitParam.custNo">
<view class="yunf-input-item">
<tpx-text-item label="月结编号" :value="submitParam.custNo"></tpx-text-item>
</view>
<view class="yunf-input-item">
<tpx-text-item label="销售联系人" :value="submitParam.salesmenName"></tpx-text-item>
</view>
<view class="yunf-input-item">
<tpx-text-item label="回款联系人" :value="submitParam.payeeName"></tpx-text-item>
</view>
</template>
<view v-if="submitParam.transLine" class="yunf-input-item">
<tpx-select v-model:value="submitParam.destinationCode" v-model:resObject="destPostRes" :getListFun="getDestPositionList" :transKeyVal="{valKey: 'destCode',titleKey: 'destName'}" :isWhite="true"
:searchParam="destPostParam" @onChange="handleDestPostChange"
>
<tpx-text-item label="目的地" :value="submitParam.destinationCode" :list="destPostRes.list"></tpx-text-item>
</tpx-select>
</view>
<view v-if="submitParam.destinationCode" class="yunf-input-item">
<tpx-text-item label="目的网点" :value="submitParam.dispatchUnderlingSite"></tpx-text-item>
</view>
<view class="yunf-input-item">
<tpx-select v-model:value="submitParam.warehouseInNo" v-model:resObject="wareRes" :getListFun="getWarehouseInList" :transKeyVal="{valKey: 'inNo',titleKey: 'inNo'}" :isWhite="true"
searchParam="" type="multiple"
>
<tpx-text-item label="进仓单" :value="submitParam.warehouseInNo" :list="wareRes.list"></tpx-text-item>
</tpx-select>
</view>
<view class="yunf-input-item">
<tpx-select v-model:value="submitParam.dispatchMethod" :list="dicData.emis_tab_dispatch_mode"
mode="drop"
>
<tpx-text-item label="派送方式" :value="submitParam.dispatchMethod" :list="dicData.emis_tab_dispatch_mode"></tpx-text-item>
</tpx-select>
</view>
<view class="yunf-input-item">
<tpx-text-item label="寄件短信">
<template v-slot:right>
<text class="pr-20 clr-sub">是否短信</text>
<u-switch v-model="submitParam.blMessage" activeValue="1" inactiveValue="0" active-color="#B12D29" size="34"></u-switch>
</template>
</tpx-text-item>
</view>
<view class="yunf-input-item">
<tpx-text-item label="收件短信">
<template v-slot:right>
<text class="pr-20 clr-sub">是否短信</text>
<u-switch v-model="submitParam.blAcceptMessage" activeValue="1" inactiveValue="0" active-color="#B12D29" size="34"></u-switch>
</template>
</tpx-text-item>
</view>
</view>
</view>
<view class="com-section mt-30" @click="handleDialogClick(goodChooseModal)">
<u-row justify="space-between">
<text>发货信息(进仓情况)</text>
<u-icon name="edit-pen" size="42"></u-icon>
</u-row>
</view>
<view class="blcok-white">
<bpe-goodstatic-tmp v-model:value="submitParam"></bpe-goodstatic-tmp>
</view>
<template v-if="isShowJifei">
<view class="com-section mt-30">
<u-row justify="space-between">
<text>计费信息</text>
</u-row>
</view>
<view class="blcok-white">
<bpe-cost-tmp v-model:value="submitParam" :searchParam="jifeiParam"></bpe-cost-tmp>
</view>
</template>
<view class="com-section mt-30">
<u-row justify="space-between">
<text>备注</text>
</u-row>
</view>
<view class="blcok-white">
<u-textarea v-model="submitParam.remark" border="surround" height="120" placeholder="备注"
maxlength="50" count></u-textarea>
</view>
</view>
</template>
<template v-slot:footer>
<view class="pos-rlt blcok-white" style="border-radius: 0;margin-top: 0;">
<u-row>
<u-button @click="handleSave()" size="large" shape="circle"
custom-style="width: 260rpx;height:80rpx;font-size: 30rpx;" :plain="true" type="primary">保存</u-button>
<u-button @click="handleSave('print')" size="large" shape="circle"
custom-style="width: 400rpx;height:80rpx;font-size: 30rpx;" type="primary" >确认并打印</u-button>
</u-row>
</view>
</template>
</tpx-layout>
<buns-edit-sheet percentHeight="70" title="商品信息" v-model:show="goodChooseModal.show" v-model:value="submitParam" v-slot="tempObject" @onSure="handleGoodInfoSure">
<view class="mb-20">托寄货物描述</view>
<bpe-gooditem-edit-tmp :value="tempObject.value"></bpe-gooditem-edit-tmp>
<view class="mt-30">
<bpe-goodphoto-tmp title="货物照片" :value="tempObject.value" filedName="goodsPics"></bpe-goodphoto-tmp>
</view>
<view class="mt-30">
<bpe-good-kuaidi-tmp :value="tempObject.value"></bpe-good-kuaidi-tmp>
</view>
<view class="mt-30">
<bpe-goodsize-tmp ref="goodSize" :value="tempObject.value"></bpe-goodsize-tmp>
</view>
</buns-edit-sheet>
</tpx-page>
</template>
<script>
// import { sendTypeEnum } from "@/common/enum"
import BpeAddressinfoTmp from "@/components/buns-post-edit-templates/bpe-addressinfo-tmp"
import BpeGoodstaticTmp from "@/components/buns-post-edit-templates/bpe-goodstatic-tmp"
import BpeCostTmp from "@/components/buns-post-edit-templates/bpe-cost-tmp"
import BpeGooditemEditTmp from "@/components/buns-post-edit-templates/bpe-gooditem-edit-tmp"
import BpeGoodphotoTmp from "@/components/buns-post-edit-templates/bpe-goodphoto-tmp"
import BpeGoodKuaidiTmp from "@/components/buns-post-edit-templates/bpe-good-kuaidi-tmp"
import BpeGoodsizeTmp from "@/components/buns-post-edit-templates/bpe-goodsize-tmp"
import * as apiService from "@/common/api"
import { getOrderModels } from "./model"
export default {
components: { BpeAddressinfoTmp, BpeGoodstaticTmp, BpeCostTmp, BpeGooditemEditTmp, BpeGoodphotoTmp, BpeGoodKuaidiTmp, BpeGoodsizeTmp },
props: {
// hasLeftWin: {
// type: Boolean
// }
},
computed: {
waySearchParam() {
return { country: this.submitParam.reciever.country, fromCountry: this.submitParam.sender.country }
},
productSearchParam() {
return { transLineCode: this.submitParam.transLine }
},
destPostParam(){
const { country } = this.submitParam.reciever
return { lineCode: this.submitParam.transLine, countryCode: country }
},
dicData() {
return this.$store.getters.dicData
},
jifeiParam(){
let info = this.submitParam
let param = {
productType: info.productType,
customerCode: info.customerCode,
custNo: info.custNo,
calcFeeType: info.calcFeeType,
settlementWeight: info.settlementWeight,
totalVolume: info.totalVolume,
sendSiteCode: this.$store.getters.userInfo.ownerSiteCode,
dispatchUnderlingSiteCode: info.dispatchUnderlingSiteCode,
}
return param
},
isShowJifei(){
let vals = Object.values(this.jifeiParam)
return vals.length == vals.filter(v => !!v).length
}
},
data() {
return {
queryOption: {
id: '', // 运单id
},
kehuRes: { list: [] },
wayRes: { list: [] },
productRes: { list: [] },
caozuoRes: { list: [] },
shoupaiRes: { list: [] },
yuejieRes: { list: [] },
destPostRes: { list: [] },
wareRes: { list: [] },
goodChooseModal: {
show: false,
},
submitParam: {
...getOrderModels(),
sendSiteCode: this.$store.getters.userInfo.ownerSiteCode,
}
}
},
onShareAppMessage() {
return {
// title: '',
// path: 'TODO'
}
},
onLoad(option) {
this.queryOption = queryOption
this.initData();
this.initEvent()
},
unmounted() {
},
methods: {
getCustomerUserList: apiService.getCustomerUserList,
getTransLineList: apiService.getTransLineList,
getTransProductList: apiService.getTransProductList,
getOpStaffList: apiService.getOpStaffList,
getRSDStaffList: apiService.getRSDStaffList,
getMonthpayAccountList: apiService.getMonthpayAccountList,
getDestPositionList: apiService.getDestPositionList,
getWarehouseInList: apiService.warehouseInList,
async initData() {
},
initEvent() {
},
async handleCreateOrderNo() {
const res = await apiService.createOrderNo()
this.submitParam.billCode = res.data
},
handleYueJieSelect(val) {
const item = this.yuejieRes.list.filter(t=> t.val == val)[0]
this.submitParam.payee = item.payee
this.submitParam.salesmen = item.salesmen
this.submitParam.salesmenName = item.salesmenName
this.submitParam.payee = item.payeeName
},
handleWayChange(val) {
const item = this.wayRes.list.filter(t=> t.val == val)[0]
this.submitParam.meterRate = item.meterRate
this.updateDltDestSite({ lineCode: val })
},
handleDestPostChange(val) {
const item = this.destPostRes.list.filter(t=> t.val == val)[0]
this.submitParam.dispatchUnderlingSiteCode = item.siteCode;
this.submitParam.dispatchUnderlingSite = item.siteName;
},
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 })
// 更新路线推荐的默认目的地
this.submitParam.destinationCode = res.data.destCode
this.handleDestPostChange(this.submitParam.destinationCode)
},
async handleGoodInfoSure() {
// 校验各个组件的参数
let res = await this.$refs.goodSize.validData()
},
async handleSave(type) {
let saveServerHand = apiService.submitOrder
if(this.queryOption.id) {
// 编辑订单 TODO
}
let params = JSON.parse(JSON.stringify(this.submitParam));
params.warehouseInNo = params.warehouseInNo.join(",")
params.goodsPics = params.goodsPics.join(",")
await saveServerHand(params)
this.showToast('操作成功')
}
}
}
</script>
<style lang="scss">
@import '@/common/uni-nvue.scss';
page {
background-color: #F6F6F6;
height: 100% !important;
}
</style>
<style scoped lang="scss">
.yunf-item {
margin-bottom: 20rpx;
padding: 30rpx;
background: #F6F6F6;
border-radius: 20rpx;
border: 2rpx solid transparent;
&.active {
border-color: $uni-color-primary;
}
}
.yunf-input-item{
padding: 26rpx 0;
border-bottom: 2rpx solid #F6F6F6;
}
</style>