emis-app/pages/post/openorder.vue
2025-06-26 11:08:47 +08:00

676 lines
28 KiB
Vue

<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"
@scanChange="handleScanChange" :showConfirm="!showCreateBNoBtn" @confirmClick="handleScanChange"></tpx-scan-input>
</view>
<view class="pl-10" v-if="showCreateBNoBtn">
<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" v-model:text="submitParam.customerName" :getListFun="getCustomerUserList" :transKeyVal="{valKey: 'monthlyPayCode',titleKey: 'company'}" v-model:value="submitParam.customerCode" :isWhite="true" placeholder="请选择客户"></tpx-select>
</view>
</u-row> -->
</view>
<view v-if="!pageLoading">
<view v-if="submitParam.orderSn" class="com-section mt-30" @click="goto(`post/detail?billCode=${submitParam.billCode}&orderSn=${submitParam.orderSn}`)">
<u-row justify="space-between">
<text>订单号:{{submitParam.orderSn}}</text>
<u-icon name="bag" size="42"></u-icon>
</u-row>
</view>
<view class="blcok-white">
<!-- 地址选择 -->
<bpe-addressinfo-tmp v-model:value="submitParam" @onChange="handleAddressChange"></bpe-addressinfo-tmp>
</view>
<view class="com-section mt-30">路线信息</view>
<view class="blcok-white" style="padding-top: 0;padding-bottom: 0;">
<view class="yunf-input-item">
<tpx-select v-model:value="submitParam.startSiteCode" v-model:text="submitParam.startSiteName" v-model:resObject="startSiteRes" :getListFun="listSimple" :transKeyVal="{valKey: 'siteCode',titleKey: 'siteName'}" :isWhite="true"
:searchParam="productSearchParam" placeholder="请选择始发网点"
>
<tpx-text-item label="始发网点" :value="submitParam.startSiteName"></tpx-text-item>
</tpx-select>
</view>
<view>
<template v-if="submitParam.reciever.country && submitParam.sender.country">
<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'}"
:searchParam="waySearchParam" @onChange="handleWayChange" placeholder="请选择路线"
>
<tpx-text-item label="路线" :value="submitParam.transLineTypeName"></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:text="submitParam.productTypeName" v-model:resObject="productRes" :getListFun="getTransProductList" :transKeyVal="{valKey: 'prodCode',titleKey: 'prodName'}" :isWhite="true"
:searchParam="productSearchParam" placeholder="请选择产品类型"
>
<tpx-text-item label="产品类型" :value="submitParam.productTypeName"></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 v-show="submitParam.pickupMethod == 1" class="yunf-input-item">
<tpx-select v-model:value="submitParam.operateEmployeeCode" v-model:resObject="caozuoRes" v-model:text="submitParam.operateEmployeeName" :getListFun="getOpStaffList" :transKeyVal="{valKey: 'empCode',titleKey: 'empName'}" placeholder="请选择操作员">
<tpx-text-item label="操作员" :value="submitParam.operateEmployeeName"></tpx-text-item>
</tpx-select>
</view>
<view v-show="submitParam.pickupMethod == 2" class="yunf-input-item">
<tpx-select v-model:value="submitParam.takePieceEmployeeCode" v-model:resObject="shoupaiRes" v-model:text="submitParam.takePieceEmployeeName" :getListFun="getRSDStaffList" :transKeyVal="{valKey: 'empCode',titleKey: 'empName'}" placeholder="请选择收派员">
<tpx-text-item label="收派员" :value="submitParam.takePieceEmployeeName"></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>
<template v-if="isShowYueJie">
<view class="yunf-input-item">
<tpx-select v-model:value="submitParam.custNo" v-model:text="submitParam.custName" v-model:resObject="yuejieRes" :getListFun="getMonthpayAccountList" :transKeyVal="{valKey: 'custNo',titleKey: 'custName'}"
@onChange="handleYueJieSelect" placeholder="请选择月结账户"
>
<tpx-text-item label="月结账户" :value="submitParam.custName"></tpx-text-item>
</tpx-select>
</view>
<template v-if="submitParam.custNo">
<view class="yunf-input-item">
<tpx-text-item label="月结编号">
<template v-slot:right>{{submitParam.custNo}}</template>
</tpx-text-item>
</view>
</template>
</template>
<template v-if="submitParam.paymentType">
<view class="yunf-input-item">
<tpx-select v-model:value="submitParam.salesmen" v-model:text="submitParam.salesmen" v-model:resObject="salemanRes" :getListFun="getSalemanList" :transKeyVal="{valKey: 'empName',titleKey: 'empName'}"
placeholder="请选择销售联系人" :disabled="isShowYueJie"
>
<tpx-text-item label="销售联系人">
<template v-slot:right>
{{submitParam.salesmen || (isShowYueJie ? '': '请选择')}}
<u-icon v-if="!isShowYueJie" size="26" name="arrow-right" color="#333"></u-icon>
</template>
</tpx-text-item>
</tpx-select>
</view>
<view class="yunf-input-item">
<tpx-select v-model:value="submitParam.payee" v-model:text="submitParam.payee" v-model:resObject="paybeeRes" :getListFun="getPayeeList" :transKeyVal="{valKey: 'empName',titleKey: 'empName'}"
placeholder="请选择回款联系人" :disabled="isShowYueJie"
>
<tpx-text-item label="回款联系人">
<template v-slot:right>
{{submitParam.payee || (isShowYueJie ? '': '请选择')}}
<u-icon v-if="!isShowYueJie" size="26" name="arrow-right" color="#333"></u-icon>
</template>
</tpx-text-item>
</tpx-select>
</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>
<view v-if="submitParam.destinationCode" class="yunf-input-item">
<tpx-text-item label="目的网点">
<template v-slot:right>{{submitParam.dispatchUnderlingSiteName}}</template>
</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" placeholder="请选择进仓单" minChecked="0"
>
<tpx-text-item label="进仓单" :value="submitParam.warehouseInNo"></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" v-if="['012','002','014','078'].includes(submitParam.transLine)">
<tpx-text-item label="是否为虚拟单">
<template v-slot:right>
<u-switch v-model="submitParam.blVirtual" activeValue="1" inactiveValue="0" active-color="#B12D29" size="34" @change="handleVirtualChange"></u-switch>
</template>
</tpx-text-item>
</view>
<view class="yunf-input-item" v-if="submitParam.blVirtual==='1' && ['012','002','014','078'].includes(submitParam.transLine)">
<tpx-select v-model:value="submitParam.masterBillCode" v-model:resObject="mastRes" :getListFun="getMasterEmisWaybills" :transKeyVal="{valKey: 'billCode',titleKey: 'billCode'}" :isWhite="true"
:searchParam="masterBillSearchParam" placeholder="请选择关联主单" minChecked="0" @onChange="handleMasterSelectChange"
>
<tpx-text-item label="关联主单" :value="submitParam.masterBillCode"></tpx-text-item>
</tpx-select>
</view>
<view class="yunf-input-item">
<tpx-text-item label="生成子单">
<template v-slot:right>
<u-switch v-model="submitParam.blGenSubbill" 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>
<tpx-input v-model:value="submitParam.custOrderId" inputAlign="right"></tpx-input>
</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.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>
<view>
<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" ref="bCostRef"></bpe-cost-tmp>
</view>
</view>
<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="300" count></u-textarea>
</view>
</view>
</view>
</template>
<template v-slot:footer>
<view class="pos-rlt blcok-white" style="border-radius: 0;margin-top: 0;">
<view v-if="submitParam.lockFlag == 'T'">
<view class="clr-prm font-weight font-30" style="padding: 20rpx 0;">{{submitParam.lockReason}}</view>
</view>
<view v-else>
<u-row v-if="!pageLoading">
<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>
</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 v-if="goodChooseModal.show">
<view class="mt-30">
<bpe-gooditem-edit-tmp ref="goodEditInfo" :value="tempObject.value"></bpe-gooditem-edit-tmp>
</view>
<view class="mt-30">
<bpe-good-kuaidi-tmp :value="tempObject.value"></bpe-good-kuaidi-tmp>
</view>
<view class="mt-30">
<bpe-goodphoto-tmp :value="tempObject.value" filedName="goodsPics">
<template v-slot:title>
<text class="font-weight font-28">货物照片</text>
</template>
</bpe-goodphoto-tmp>
</view>
</view>
</buns-edit-sheet>
<tpx-bluetooth-print-preview ref="curPrint"></tpx-bluetooth-print-preview>
</tpx-page>
</template>
<script>
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 TpxBluetoothPrintPreview from "@/components/tpx-bluetooth-print/tpx-bluetooth-print-preview"
import { debounce } from "@/common/util"
import * as apiService from "@/common/api"
import { getBillPrintData } from "@/pages/print/printData"
import { getOrderModels } from "./model"
const pageTypeEnum = {
create: 'create',
edit: 'edit'
}
export default {
components: { BpeAddressinfoTmp, BpeGoodstaticTmp, BpeCostTmp, BpeGooditemEditTmp, BpeGoodphotoTmp, BpeGoodKuaidiTmp, TpxBluetoothPrintPreview },
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
},
isShowYueJie(){
let { submitParam } = this
return submitParam.paymentType == 2 || submitParam.paymentType == 4 || submitParam.paymentType == 5
},
showCreateBNoBtn(){
return this.queryOption.type == this.pageTypeEnum.create || this.queryOption.copyBillCode
},
masterBillSearchParam(){
return {
transLineType: this.submitParam.transLine,
productType: this.submitParam.productType,
// 寄件点编码
sendSiteCode: this.submitParam.sendSiteCode,
}
},
},
data() {
return this.getDefaultData()
},
onShareAppMessage() {
return {
// title: '',
// path: 'TODO'
}
},
onLoad(option) {
this.queryOption = option
this.initData();
this.initEvent()
},
unmounted() {
},
methods: {
getDefaultData() { // data的默认数据
return {
pageTypeEnum,
pageTypeMap: {
[pageTypeEnum.create]: { title: '开单', savedConfirmTitle: '是否操作下一单' },
[pageTypeEnum.edit]: { title: '运单修改', savedConfirmTitle: '是否操作下一单' }
},
curPageType: {},
pageLoading: true,
isEdit: false,
queryOption: {
type: '', // edit: 运单修改, create: 下单,
defaultSubParams: '', // 提交默认参数
billCode: '', // 运单id
orderSn: '', // 订单id
copyBillCode: '', // 复制的运单id
},
kehuRes: { list: [] },
wayRes: { list: [] },
productRes: { list: [] },
caozuoRes: { list: [] },
shoupaiRes: { list: [] },
yuejieRes: { list: [] },
destPostRes: { list: [] },
wareRes: { list: [] },
paybeeRes: { list: [] },
salemanRes: { list: [] },
mastRes:{ list: [] }, // 主单列表数据
startSiteRes: { list: [] }, // 始发网点列表数据
goodChooseModal: {
show: false,
},
submitParam: {
...getOrderModels(),
sendSiteCode: this.$store.getters.userInfo.ownerSiteCode,
//始发网点初始值
startSiteCode: this.$store.getters.userInfo.ownerSiteCode,
startSiteName: this.$store.getters.userInfo.ownerSiteName,
}
}
},
getCustomerUserList: apiService.getCustomerUserList,
getTransLineList: apiService.getTransLineList,
getTransProductList: apiService.getTransProductList,
getOpStaffList: apiService.getOpStaffList,
getRSDStaffList: apiService.getRSDStaffList,
getMonthpayAccountList: apiService.getMonthpayAccountList,
getDestPositionList: apiService.getDestPositionList,
getWarehouseInList: apiService.getWarehouseInList,
getPayeeList: apiService.getPayeeList,
getSalemanList: apiService.getSalemanList,
getMasterEmisWaybills: apiService.getMasterEmisWaybills, // 获取关联主单号
listSimple: apiService.listSimple, // 获取网点列表
async initData() { // 初始化
this.queryOption.billCode = this.queryOption.billCode || this.queryOption.copyBillCode
this.curPageType = this.pageTypeMap[this.queryOption.type] || {}
this.setNavigationBarTitle(this.curPageType.title || this.pageTypeMap[pageTypeEnum.create].title)
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) {
this.pageLoading = true
this.submitParam.billCode = this.queryOption.billCode
let res = await apiService.getOrderDetail({...this.queryOption, _loading: true})
let data = res.data || {}
data.goodsPics = (data.goodsPics && data.goodsPics.split(",")) || []
this.submitParam = res.data
if(res.data.lockFlag == 'T') {
setTimeout(()=> {
this.showToast(res.data.lockReason)
}, 500)
}
// 复制场景 清除billCode orderSn
if(this.queryOption.copyBillCode) {
delete this.submitParam.billCode
delete this.submitParam.orderSn
this.submitParam.pickStartDate = ''
this.submitParam.sendDate = getOrderModels().sendDate
}
}
let qsParam = this.queryOption.defaultSubParams || {}
if(qsParam.warehouseInNo) {
this.submitParam.warehouseInNo = qsParam.warehouseInNo
}
this.pageLoading = false
},
initEvent() {
},
handleScanChange: debounce(function(){
// 创建不做 查询详情
if(this.queryOption.type != pageTypeEnum.create) {
// 扫码回调 要重新查询新运单信息,并覆盖老的
this.queryOption.billCode = this.submitParam.billCode
this.initData();
this.initEvent()
}
}),
async handleCreateOrderNo() {
const res = await apiService.createOrderNo()
this.submitParam.billCode = res.data
},
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() // 调用线路切换,清空后续数据
}
},
handleYueJieSelect(val) {
const item = this.yuejieRes.list.filter(t=> t.val == val)[0]
this.submitParam.salesmen = item.salesmen
this.submitParam.salesmenName = item.salesmenName
// this.submitParam.payee = item.payeeName
this.submitParam.payee = item.payee
},
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 })
//非缅甸快递/缅甸快递进口/柬埔寨快递进口 重置虚拟单
if (val && !['002', '012', '014','078'].includes(val)) {
this.submitParam.masterBillCode = null;
this.submitParam.blVirtual = null;
}
if (val && val !== '002' && this.submitParam.remark && this.submitParam.remark !== null) {
this.submitParam.remark = this.submitParam.remark.replace(/该单为虚拟单:对应主单为[\da-zA-Z]+/g, '');
}
},
handleDestPostChange(val) {
const item = this.destPostRes.list.filter(t=> t.val == val)[0]
this.submitParam.dispatchUnderlingSiteCode = item.siteCode;
this.submitParam.dispatchUnderlingSiteName = 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 })
// 更新路线推荐的默认目的地
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.goodEditInfo.validData()
// 同步 代垫运费 数据
setTimeout(()=> {
this.$refs.bCostRef.updateDaiDianFeeData()
}, 300)
},
async handleSave(type) {
//校验产品类型和关联主单产品类型 线路是否一致
if(this.submitParam.transLine && this.submitParam.masterBillCode){
let masterRes = await apiService.getOrderDetail({billCode: this.submitParam.masterBillCode})
if(masterRes.data.productType != this.submitParam.productType){
this.showToast('主单和虚拟单线路不一致')
return
}
}
let saveServerHand = apiService.submitOrder
if(this.isEdit) { }
let params = JSON.parse(JSON.stringify(this.submitParam));
params.goodsPics = params.goodsPics.join(",")
params._loading = true
await saveServerHand(params)
if(type == 'print') {
this.showToast('操作成功')
this.handlePrint()
} else {
await this.saveSuccessBack()
}
},
async handlePrint(){
let { billCode, blGenSubbill, parcelQty } = this.submitParam
let param = {
billCode,
printType: 'TAN-GC-130,TAN-GM-130'
}
// 生成子单,需要传递范围
if(blGenSubbill == '1' && parcelQty) {
param.subBillCodeRange = `1,${parcelQty}`
}
let prtRes = await getBillPrintData(param)
this.$refs.curPrint.confirmPrint(prtRes)
this.resetForm()
},
async saveSuccessBack(){
let { savedConfirmTitle } = this.curPageType
if(savedConfirmTitle) {
let cBl = await this.confirmModal(`操作成功,${savedConfirmTitle}`)
if(cBl) {
// 刷新当前页面状态
this.reloadCurrentPage(this)
} else {
this.goBack()
}
} else {
this.showToast('操作成功')
this.goBack()
}
},
resetForm(){
// 清空新建的数据
if(this.showCreateBNoBtn) {
this.submitParam = this.getDefaultData().submitParam
}
},
//关联主单改变
handleMasterSelectChange(val) {
if (val) {
this.submitParam.masterBillCode = val
}
if (val && this.submitParam.transLine === '002') {
if (this.submitParam.remark == null || this.submitParam.remark.trim() === '') {
//生成备注
this.submitParam.remark = `该单为虚拟单:对应主单为${val}`;
} else {
if (this.submitParam.remark.indexOf('该单为虚拟单:对应主单为') > -1) {
//替换主单号
this.submitParam.remark = this.submitParam.remark.replace(/主单为[\da-zA-Z]+/g, '主单为' + val);
} else {
//判断结尾是不是逗号
if(this.submitParam.remark){
if (!this.submitParam.remark.endsWith(',')) {
this.submitParam.remark = this.submitParam.remark + ',';
}
this.submitParam.remark = this.submitParam.remark + '该单为虚拟单:对应主单为' + val;
}
}
}
} else {
//删除备注中虚拟单部分
if (this.submitParam.remark) {
this.submitParam.remark = this.submitParam.remark.replace(/该单为虚拟单:对应主单为[\da-zA-Z]+/g, '');
}
}
},
//虚拟单变化
handleVirtualChange() {
if (this.submitParam.blVirtual !== '1') {
this.submitParam.masterBillCode = null;
//删除备注中虚拟单内容
if (this.submitParam.remark && this.submitParam.remark.trim() != '') {
this.submitParam.remark = this.submitParam.remark.replace(/该单为虚拟单:对应主单为[\da-zA-Z]+/g, '');
}
}
}
}
}
</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>