Commit 98e0f6b8 authored by 邓春圆's avatar 邓春圆

Merge remote-tracking branch 'origin/dev' into dev

parents 39451113 1e08da8f
......@@ -13,7 +13,7 @@
<el-button type="primary" @click="reLoad" :loading="loading">{{$t('搜索')}}</el-button>
<div style="height: 36px; display: flex; align-items: center">
<el-checkbox :label="$t('全选') + `(${$t('{total}个', {total})})`" @change="toggleAll" :disabled="isAllProduct || loading"></el-checkbox>
<el-checkbox :label="$t('全选') + `(${$t('{total}个', {total})})`" @change="toggleAll" v-model="isCheckedAll" :disabled="isAllProduct || loading"></el-checkbox>
</div>
</div>
<div class="list">
......@@ -102,7 +102,9 @@ export default {
// 右侧页码
rightPage: 1,
// 页大小
pageSize: 100
pageSize: 100,
// 是否选中全选
isCheckedAll: false
}
},
computed: {
......@@ -229,6 +231,8 @@ export default {
let res = await getSimpleProductList(this.queryParams)
this.loading = false
this.list = res.data
this.choosedList = []
this.isCheckedAll = false
},
// 获得指定条件的商品的全部ID
getFilteredIds(){
......
......@@ -19,6 +19,13 @@ const service = axios.create({
// 超时
timeout: 1000 * 30
})
// 如果是生产环境则打印提示
if (process.env.NODE_ENV === 'development' && service.defaults.baseURL === 'https://api2.groupage.cn/admin-api/') {
console.log('%c请注意,当前为生产环境请谨慎操作!!', 'background-color: red; font-size: 3em; color:yellow');
console.log('%c接口地址:' + service.defaults.baseURL, 'background-color: black; font-size: 1.5em; color:yellow !important');
}
// request拦截器
service.interceptors.request.use(config => {
config.headers['locale'] = getLocale()
......
......@@ -65,11 +65,11 @@
</el-form-item>
<el-form-item :label="$t('出仓箱数')" prop="realNum">
<el-input-number v-model="airCheckoutObj.realNum" :controls="false" :precision="0" />
<el-input-number v-model="airCheckoutObj.realNum" :controls="false" :precision="0" disabled />
</el-form-item>
<el-form-item :label="$t('出仓影像')">
<ImageUpload :limit="1" :isShowTip=false v-model="airCheckoutObj.checkoutFiles" />
<ImageUpload :limit="1" :isShowTip=false v-model="airCheckoutObj.checkoutFiles" @input="saveImage" />
</el-form-item>
<el-form-item :label="$t('备注')">
......@@ -81,19 +81,20 @@
<!-- 开始出仓 -->
<el-dialog :title="$t('开始出仓')" :visible.sync="dialogVisible" fullscreen :modal-append-to-body=false append-to-body>
<startCheckout v-bind="$attrs" v-if="dialogVisible" v-on="$listeners" @closeDialog1="closeDialog1" />
<startCheckout v-bind="$attrs" v-if="dialogVisible" v-on="$listeners" @closeDialog1="closeDialog1" @reload="reload" />
</el-dialog>
<el-row class="operate-button">
<el-button type="primary" @click="onSubmit(1)">{{$t('保存')}}</el-button>
<el-button :disabled="$attrs.shipmentObj.approvaling" type="success" @click="onSubmit(2)">{{$t('提交')}}</el-button>
<el-button @click="cancel">{{$t('关闭')}}</el-button>
<el-button @click="startCheckout">{{$t('确认出仓')}}</el-button>
<el-button type="danger" @click="startCheckout">{{$t('确认出仓')}}</el-button>
</el-row>
</div>
</template>
<script>
import { getbox } from "@/api/ecw/box";
import { airCheckoutCreate } from "@/api/ecw/boxSea";
import startCheckout from "./checkout/startCheckout.vue";
import userSelect from "./common/userSelect.vue";
......@@ -158,6 +159,12 @@ export default {
}
});
},
reload() {
getbox(this.$attrs.shipmentObj.id).then((res)=>{
this.$set(this.airCheckoutObj, 'planNum', res.data.planNum)
this.$set(this.airCheckoutObj, 'realNum', res.data.realNum)
})
},
/** 取消 */
cancel(type) {
this.$emit("closeDialog", type);
......@@ -169,6 +176,27 @@ export default {
closeDialog1() {
this.dialogVisible = false;
},
//自动保存图片
saveImage() {
const { ldPictures } = this.airCheckoutObj;
let pictures = ldPictures?.split(",") ?? [];
let newPictures = [];
for (const item of pictures) {
if (item) {
newPictures.push({
type: "image",
url: item,
});
}
}
airCheckoutCreate({
...this.airCheckoutObj,
shipmentId: this.$attrs.shipmentObj.id,
operateType: 1,
}).then(()=>{
this.$emit("getBoxInfo");
})
}
},
};
</script>
......
......@@ -5,7 +5,7 @@
<div><dict-tag :type="DICT_TYPE.ECW_TRANSPORT_TYPE" :value="shipmentObj.transportType" />{{importCityName(shipmentObj.startWarehouseId)}}{{importCityName(shipmentObj.destWarehouseId)}}{{getShipChannelName(shipmentObj.channelRespVO.channelId)}}</div>
<div>
<template>
<el-input v-model="qrCode" :placeholder="$t('请输入二维码/条码编号')" clearable></el-input>
<el-input style="width: 270px;" v-model="qrCode" :placeholder="$t('请输入二维码/条码编号/合包箱号标签')" clearable></el-input>
<el-button type="primary" @click="handlerBatchCreate('single')">{{$t('确定')}}</el-button>
<el-button type="primary" @click="handlerClick('batchInput',$t('批量输入'))">{{$t('批量输入')}}</el-button>
<el-button type="primary" @click="handlerClick('correction',$t('出仓纠错'))">{{$t('出仓纠错')}}</el-button>
......@@ -21,12 +21,10 @@
<el-table-column :label="$t('序号')" align="center" width="50" prop="tidanNum" />
<el-table-column :label="$t('订单号')" align="center" prop="orderNo">
<template slot-scope="scope">
<div>
<a href="javascript:void(0);" class="order-href" @click="orderClick(scope.row)">{{ scope.row.orderNo }}</a>
</div>
<div style="color:blue;fontWeight:bold;">
{{ scope.row.isExternalWarehouse === 1 ? '(' + $t('外部仓') + ')' : ''}}
</div>
<router-link :to="{path: '/order/detail',query: {orderId: scope.row.orderId}}" class="link-type">
<span>{{ scope.row.orderNo }}</span>
</router-link>
</template>
</el-table-column>
<el-table-column :label="$t('货物信息')" align="center" prop="goodsList">
......@@ -50,12 +48,22 @@
</el-table-column>
<el-table-column :label="$t('计划箱数')" align="center" prop="num">
<template slot-scope="scope">
{{getTotlContent(scope.row,['num'])}}
<div>
<a href="javascript:void(0);" class="order-href" @click="orderClick(scope.row)">{{getTotlContent(scope.row,['num'])}}</a>
</div>
<div style="color:blue;fontWeight:bold;">
{{ scope.row.isExternalWarehouse === 1 ? '(' + $t('外部仓') + ')' : ''}}
</div>
</template>
</el-table-column>
<el-table-column :label="$t('实装箱数')" align="center" prop="installNum">
<el-table-column :label="$t('出仓箱数')" align="center" prop="installNum">
<template slot-scope="scope">
{{ scope.row.installNum }}{{$t('')}}
<div>
<a href="javascript:void(0);" class="order-href" @click="orderClick(scope.row)">{{ scope.row.installNum }}{{$t('')}}</a>
</div>
<div style="color:blue;fontWeight:bold;">
{{ scope.row.isExternalWarehouse === 1 ? '(' + $t('外部仓') + ')' : ''}}
</div>
</template>
</el-table-column>
<el-table-column :label="$t('体积')" align="center" prop="volume">
......@@ -68,6 +76,11 @@
{{getTotlContent(scope.row,['weight'])}}
</template>
</el-table-column>
<el-table-column :label="$t('合包箱号')" align="center" prop="pkgNum">
<template slot-scope="scope">
{{scope.row.pkgNum}}
</template>
</el-table-column>
</el-table>
</el-row>
</el-card>
......@@ -87,7 +100,7 @@
</el-row>
<el-row style="margin-top: 20px;">
<el-button type="primary" @click="submitCheckout">{{$t('确认出仓')}}</el-button>
<el-button @click="$emit('closeDialog1')">{{$t('取消')}}</el-button>
<el-button @click="closeReload">{{$t('取消')}}</el-button>
</el-row>
......@@ -104,7 +117,7 @@
<template v-if="dialogConfig.type === 'correction' && dialogConfig.dialogVisible">
<el-form ref="correctionForm" :rules="rules" :model="correctionObj" label-position="top">
<el-form-item :label="$t('出仓纠错(二维码/条形码编号)')" prop="qrCode">
<el-input v-model="correctionObj.qrCode" :placeholder="$t('请输入二维码/条形码编号')" clearable />
<el-input v-model="correctionObj.qrCode" :placeholder="$t('请输入二维码/条形码编号/合包箱号标签')" clearable />
</el-form-item>
</el-form>
<el-row class="operate-button">
......@@ -528,9 +541,13 @@ export default {
submitCheckout(){
confirmAirCheckout({shipmentId: this.shipmentObj.id}).then((res) => {
serviceMsg(res, this).then(() => {
this.$emit('closeDialog1')
this.closeReload()
});
});
},
closeReload(){
this.$emit('closeDialog1')
this.$emit('reload')
}
},
computed: {
......
......@@ -22,9 +22,10 @@
<el-table-column align="center" :label="$t('序号')" width="50" type="index" />
<el-table-column :label="$t('订单号')" align="center" prop="orderNo">
<template slot-scope="scope">
<el-link type="primary" @click.native="orderClick(scope.row)">
{{ scope.row.orderNo }}
</el-link>
<router-link :to="{path: '/order/detail',query: {orderId: scope.row.orderId}}" class="link-type">
<span>{{ scope.row.orderNo }}</span>
</router-link>
</template>
</el-table-column>
<el-table-column :label="$t('商品信息')" width="250px" align="center">
......@@ -41,7 +42,9 @@
</el-table-column>
<el-table-column :label="$t('计划/已装')" align="center" prop="sumNum">
<template slot-scope="scope">
<el-link type="primary" @click.native="orderClick(scope.row)">
{{ scope.row.sumNum }}/{{ scope.row.installNum }}
</el-link>
</template>
</el-table-column>
<el-table-column :label="$t('纸箱尺寸')" align="center">
......@@ -314,6 +317,7 @@ export default {
getPkgPageByPkgId(queryParams).then((res) => {
this.pagList = res.data.list
this.total = res.data.total
console.log(this.pagList,'222');
})
},
// 格式化日期
......
......@@ -25,7 +25,7 @@
<el-button :disabled="shipmentObj.approvaling" size="small" type="primary" @click="()=>tallyClick('batch')">{{$t('批量理货')}}</el-button>
<el-button :disabled="shipmentObj.approvaling" size="small" type="primary" @click="()=>removeClick('batch')">{{$t('批量移出')}}</el-button>
</div>
<div v-if="false">
<div>
<template>
<el-input v-model="qrCode" :placeholder="$t('请输入二维码/条码编号')" clearable></el-input>
<el-button type="primary" @click="handlerBatchCreate()">{{$t('确定')}}</el-button>
......@@ -476,13 +476,15 @@ export default {
// 理货完成
tallyFinish() {
let flag = false
let orderNo = ''
this.checkOrderList.forEach(item=>{
if(item.installNum != item.num){
flag = true
orderNo = orderNo + '' + item.orderNo + ''
}
})
if(flag){
this.$message.error(this.$t("仍有订单未理货,请完成所有订单箱号标签扫码后完成理货"));
this.$message.error(this.$t(`订单号${orderNo}未完成理货,请完成全部订单理货后重试`));
return;
}
tallyCommit({ shipmentId: this.shipmentObj.id }).then((res) => {
......
......@@ -129,7 +129,7 @@
<span>{{ parseTime(scope.row.updateTime) }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('新人')" prop="updaterName">
<el-table-column :label="$t('新人')" prop="updaterName">
</el-table-column>
<el-table-column :label="$t('操作')" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
......
......@@ -795,7 +795,9 @@ export default {
this.getOpenedRouterList()
},
// 目的地
'form.objectiveId'(){
async 'form.objectiveId'(){
await this.$nextTick()
await this.getChannelList()
this.getOpenedRouterList()
},
'form.transportId'(transportId, oldTransportId){
......@@ -818,20 +820,22 @@ export default {
this.$set(this.form, 'lineId', undefined)
}
},
'form.channelId'(){
async 'form.channelId'(){
await this.getTradeCity()
this.getOpenedRouterList()
this.calculationPrice('form.channelId')
},
'form.lineId'(lineId){
async 'form.lineId'(lineId){
let router = this.routerList.find(item => item.id == lineId)
if(router){
this.$set(this.form, 'departureId', router.startCityId)
this.$set(this.form, 'objectiveId', router.destCityId)
}
this.$nextTick(() => {
this.calculationPrice('form.lineId')
})
await this.$nextTick()
await this.getChannelList()
await this.getTradeCity()
await this.calculationPrice('form.lineId')
},
'form.transportVO.packageTypeArr'(val){
this.$set(this.form.transportVO, 'packageType', (val || []).join(','))
......@@ -851,10 +855,10 @@ export default {
this.getOffer()
}
},
created() {
async created() {
await this.getChannelList()
await this.getTradeCity()
getProductAttrList().then(res => this.productAttrList = res.data)
getChannelList().then(res => this.channelList = res.data)
getTradeCityList().then(res => this.tradeCityList = res.data)
getCurrencyList().then(res => this.currencyList = res.data)
getUnitList().then(res => this.unitList = res.data)
this.transportList = this.getDictDatas(this.DICT_TYPE.ECW_TRANSPORT_TYPE)
......@@ -864,6 +868,20 @@ export default {
}else this.addProduct()
},
methods: {
async getChannelList(){
let query = {
cityId: this.form.objectiveId,
lineId: this.form.lineId
}
this.channelList = (await getChannelList(query)).data || []
},
async getTradeCity(){
let query = {}
if(this.form.channelId){
query.channelId = this.form.channelId
}
this.tradeCityList = (await getTradeCityList(query)).data || []
},
getOffer(){
getOffer(this.$route.query.id).then(res => {
let formData = res.data
......
......@@ -165,6 +165,10 @@ export default {
})
})
})
// 按照入仓时间inTime排序
arr.sort((a, b) => {
return new Date(a.inTime).getTime() - new Date(b.inTime).getTime()
})
return arr
},
calcTotal(){
......
......@@ -975,7 +975,7 @@ export default {
'form.consignorPhone'(){
if(this.form.lineId) this.getOfferData()
},
'form.lineId'(lineId){
async 'form.lineId'(lineId){
let router = this.routerList.find(item => item.id == lineId)
if(!router){
return
......@@ -983,7 +983,7 @@ export default {
this.$set(this.form, 'departureId', router.startCityId)
this.$set(this.form, 'objectiveId', router.destCityId)
this.$set(this.form, 'transportId', router.transportType)
await this.getChannelList()
this.calculationPrice()
this.$nextTick(() => {
// 如果开启了默认送货上门,则默认选择送货上门,2是送货上门,10是默认送货上门
......@@ -1142,7 +1142,8 @@ export default {
},
async getChannelList(){
let query = {
cityId: this.form.objectiveId
cityId: this.form.objectiveId,
lineId: this.form.lineId
}
this.channelList = (await getChannelList(query)).data
},
......
......@@ -40,7 +40,7 @@ export default {
</script>
<template>
<el-dialog :visible.sync="show" :before-close="onBeforeClose" append-to-body title="$t('查看影像')">
<el-dialog :visible.sync="show" :before-close="onBeforeClose" append-to-body :title="$t('查看影像')">
<image-and-video-upload v-model="pictureUrls" readonly></image-and-video-upload>
</el-dialog>
</template>
<template>
<div style="display: inline-block">
<template v-if="text">
<el-button size="mini" type="text" style="margin-right: 10px" @click="handleOpen">{{ num }}混箱</el-button>
<el-button size="mini" type="text" style="margin-right: 10px" @click="handleOpen">{{ num }}{{$t('混箱')}}}</el-button>
</template>
<template v-else>
<el-button size="mini" type="primary" style="margin-right: 10px" @click="handleOpen">{{ title }}</el-button>
......@@ -14,8 +14,8 @@
:before-close="handleClose">
<template v-slot:title>
<div class="flex flex-items-center">
<div class="title flex-1 flex flex-items-center">{{$t('选择订单商品')}}</div>
<el-button v-if="showChooseOrderItem" type="primary" size="mini" @click="handleShowChooseDialog">选择订单商品</el-button>
<div class="title flex-1 flex flex-items-center">{{title}}</div>
<el-button v-if="showChooseOrderItem" type="primary" size="mini" @click="handleShowChooseDialog">{{$t('选择订单商品')}}</el-button>
<div style="width: 100px"><!--占位,防止被关闭按钮挡住--></div>
</div>
</template>
......@@ -30,11 +30,11 @@
/>
</el-form>
<el-button v-show="!readonly" type="primary" size="mini" @click="handleAddItem">添加一条明细</el-button>
<el-button v-show="!readonly" type="primary" size="mini" @click="handleAddItem">{{$t('添加一条明细')}}</el-button>
<span v-show="!readonly" slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">取 消</el-button>
<el-button type="primary" @click="handleSave">确 定</el-button>
<el-button @click="dialogVisible = false">{{$t('取消')}}</el-button>
<el-button type="primary" @click="handleSave">{{$t('确定')}}</el-button>
</span>
</el-dialog>
<choose-order-products
......@@ -165,13 +165,19 @@ export default {
for (let i = 0; i < this.dataList.length; i++) {
if (!this.dataList[i].prodId) {
return this.$notify({
title: '明细' + (i + 1) + ': ' + '请选择品名',
title: this.$t("填写第{n}条明细的品名", {n: i=1}),
type: "warning"
})
}
if (!this.dataList[i].brand) {
return this.$notify({
title: '明细' + (i + 1) + ': ' + '请选择品牌',
title: this.$t("填写第{n}条明细的品牌", {n: i=1}),
type: "warning"
})
}
if(!this.dataList[i].quantityAll){
return this.$notify({
title: this.$t("填写第{n}条明细的数量", {n: i=1}),
type: "warning"
})
}
......@@ -218,9 +224,9 @@ export default {
computed: {
title() {
if (this.readonly) {
return '查看箱明细'
return this.$t('查看箱明细')
}
return !this.value || this.value.length === 0 ? '添加箱明细' : '编辑箱明细'
return !this.value || this.value.length === 0 ? this.$t('添加箱明细') : this.$t('编辑箱明细')
}
}
}
......
......@@ -90,7 +90,7 @@
</el-form-item>
</el-col>-->
<el-col :span="4">
<el-form-item :label="$t('数量')">
<el-form-item :label="$t('数量')" required>
<el-input v-model="value.quantityAll" type="number" :disabled="readonly" />
</el-form-item>
</el-col>
......
......@@ -135,8 +135,8 @@
{{parseTime(handlerParams.handlerTime)}}
</el-descriptions-item>
<el-descriptions-item :label="$t('处理结果')">
<span v-if="handlerParams.handlerResult=='general_cargo'">{{$t('设为普货')}}</span>
<span v-else-if="handlerParams.handlerResult=='process'">{{$t('设为已处理')}}</span>
<span v-if="handlerParams.handlerResult=='general_cargo'">{{$t('设为免泡')}}</span>
<span v-else-if="handlerParams.handlerResult=='process'">{{$t('设为全泡')}}</span>
<span v-else>{{$t('设为半抛')}}</span>
</el-descriptions-item>
<el-descriptions-item :label="$t('备注')">
......@@ -146,8 +146,8 @@
</el-card>
<div slot="footer" class="dialog-footer">
<div v-if="list.orderExceptionStatus!=2">
<el-button type="primary" @click="submit('general_cargo')">{{$t('设为普货')}}</el-button>
<el-button plain type="primary" @click="submit('process')">{{$t('设为已处理')}}</el-button>
<el-button type="primary" @click="submit('general_cargo')">{{$t('设为免泡')}}</el-button>
<el-button plain type="primary" @click="submit('process')">{{$t('设为全泡')}}</el-button>
<el-button v-if="type!='order_heavy_cargo_exception'" plain type="primary" @click="submit('half_throw')">{{$t('设为半抛')}}</el-button>
</div>
<div v-else>
......
......@@ -93,15 +93,45 @@
</el-col>
</el-row>
</template>
<template v-else-if="form.priceType === 1">
<sea-price
ref="seaPrice"
:currency-list="currencyList"
:unit-list="unitList"
:value="form"
field-prefix="all"
:price-name="$t('全包价')"
packaging-field="fullPricePackagingList"
@changeUnit="handleFormUnitChange($event)"
></sea-price>
</template>
<template v-else>
<el-row :gutter="20">
<el-col :span="12">
<sea-price
ref="seaPrice"
:price-type="form.priceType"
:currency-list="currencyList"
:unit-list="unitList"
:value="form"
field-prefix="transport"
:price-name="$t('运费')"
packaging-field="freightPricePackagingList"
@changeUnit="handleFormUnitChange($event)"
></sea-price>
</el-col>
<el-col :span="12">
<sea-price
ref="seaPrice"
:currency-list="currencyList"
:unit-list="unitList"
:value="form"
field-prefix="clearance"
:price-name="$t('清关费')"
packaging-field="clearancePricePackagingList"
@changeUnit="handleFormUnitChange($event)"
></sea-price>
</el-col>
</el-row>
</template>
</el-card>
......@@ -461,6 +491,26 @@ export default {
p[data.field] = data.value
})
}
// 同步包装的单位
let packingField = {
transportVolumeUnit: 'freightPricePackagingList',
clearanceVolumeUnit: 'clearancePricePackagingList',
allVolumeUnit: 'fullPricePackagingList',
transportPriceUnit: 'freightPricePackagingList',
clearancePriceUnit: 'clearancePricePackagingList'
}[data.field]
if(!this.form[packingField]?.length){
return false
}
this.form[packingField].forEach(item => {
if(data.field.indexOf("PriceUnit") > -1){
item['packagingPriceUnit'] = data.value
}
if(data.field.indexOf("VolumeUnit") > -1){
item['packagingVolumeUnit'] = data.value
}
})
},
initStepPrice(){
if(this.form.priceType == 1 && !this.form.fullPriceStepList?.length){
......
......@@ -81,15 +81,46 @@
</el-col>
</el-row>
</template>
<template v-else-if="form.priceType === 1">
<sea-price
ref="seaPrice"
:currency-list="currencyList"
:unit-list="unitList"
:value="form"
:readonly="readonly"
field-prefix="all"
:price-name="$t('全包价')"
packaging-field="fullPricePackagingList"
@changeUnit="handleFormUnitChange($event)"
></sea-price>
</template>
<template v-else>
<el-row :gutter="20">
<el-col :span="12">
<sea-price
ref="seaPrice"
:price-type="form.priceType"
:currency-list="currencyList"
:unit-list="unitList"
:value="form"
field-prefix="transport"
:price-name="$t('运费')"
packaging-field="freightPricePackagingList"
@changeUnit="handleFormUnitChange($event)"
></sea-price>
</el-col>
<el-col :span="12">
<sea-price
ref="seaPrice"
:currency-list="currencyList"
:unit-list="unitList"
:value="form"
field-prefix="clearance"
:price-name="$t('清关费')"
packaging-field="clearancePricePackagingList"
@changeUnit="handleFormUnitChange($event)"
></sea-price>
</el-col>
</el-row>
</template>
</div>
......@@ -114,6 +145,7 @@ import Decimal from 'decimal.js'
import SeaPrice from "@/views/ecw/productPrice/components/SeaPrice.vue";
import Template from "@/views/cms/template/index.vue";
import PriceStep from "@/views/ecw/productPrice/components/PriceStep.vue";
import { getFormData } from '@/views/ecw/productPrice/util'
const DEFAULT_PRICE_UNIT = 1
const DEFAULT_VOLUME_UNIT = 7
......@@ -186,10 +218,6 @@ export default {
this.currencyList = (await getCurrencyList())?.data || []
this.unitList = (await getUnitList())?.data || []
this.$nextTick(async() => {
this.setDefaultVolumeUnit(this.type == 'air' ? 6 : 7)
})
this.getDictDatas(this.DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS).forEach(item => {
// 没有的才push,已有的可能是从复制模板携带过来的数据
if(!this.form.specialList.find(special => special.specialDictType == item.value)) {
......@@ -257,28 +285,57 @@ export default {
})
},
// 获得用提交的阶梯价副本
// 获得用提交的阶梯价副本
getPriceList(stepList){
if(!stepList?.length) return []
let stepPriceList = JSON.parse(JSON.stringify(stepList))
stepPriceList.forEach((item, index) => {
item.rankNum = index + 1
item.packagingList = item.packagingList.filter(p => !!p.packagingTypes?.length)
item.packagingList = item.packagingList.map( p => {
p.packagingTypes = p.packagingTypes.join(",")
return p
})
item.packagingList = this.getPackagingPrice(item.packagingList)
})
// 过滤掉空的阶梯
return stepPriceList.filter(this.isStepPriceValid)
},
// 获取包装类型价
getPackagingPrice(packagingList){
const list = JSON.parse(JSON.stringify(packagingList))
return list.filter(p => !!p.packagingTypes?.length).map( p => {
p.packagingTypes = p.packagingTypes.join(",")
return p
})
},
// 非阶梯价格更新单位
handleFormUnitChange(data){
// 海运非阶梯价没有重量单位,所以按照体积单位同步最小起计量单位
if(data.field === 'transportVolumeUnit' || data.field == 'allVolumeUnit'){
this.form.minWeightUnit = data.value
}
if(this.form.specialList?.length){
this.form.specialList.forEach(p => {
p[data.field] = data.value
})
}
// 同步包装的单位
let packingField = {
transportVolumeUnit: 'freightPricePackagingList',
clearanceVolumeUnit: 'clearancePricePackagingList',
allVolumeUnit: 'fullPricePackagingList',
transportPriceUnit: 'freightPricePackagingList',
clearancePriceUnit: 'clearancePricePackagingList'
}[data.field]
if(!this.form[packingField]?.length){
return false
}
this.form[packingField].forEach(item => {
if(data.field.indexOf("PriceUnit") > -1){
item['packagingPriceUnit'] = data.value
}
if(data.field.indexOf("VolumeUnit") > -1){
item['packagingVolumeUnit'] = data.value
}
})
},
initStepPrice(){
if(this.form.priceType == 1 && !this.form.fullPriceStepList?.length){
......@@ -293,68 +350,80 @@ export default {
}
}
},
// 检查包装类型价格是否有效
validatePackagingPrice(packagingList, priceName){
if(!packagingList?.length) return true
let valid = true
for(const index in packagingList){
const item = packagingList[index]
if(!item.packagingPrice){
valid = false
const no = parseInt(index) + 1
this.$message.error(this.$t("请设置{priceName}的第{no}包装费", {priceName, no}))
break;
}
}
return valid
},
submitForm() {
this.$refs["form"].validate(async (valid) => {
if (!valid) {
return;
}
// 只有新增的时候做判断
if (!this.$route.query.ids && (!this.selectedRoutes || !this.selectedRoutes.length)) {
this.$message.error(this.$t('请选择线路'));
return;
}
let data = JSON.parse(JSON.stringify(this.form))
let data = Object.assign({}, this.form, {
// lineChannelList: this.selectedRoutes,
// specialList: this.specialProducts,
isAllProduct: this.isAllProduct ? 1:0
})
data.isAllProduct = this.isAllProduct ? 1:0
data.lineChannelList = this.selectedRoutes
// 如果是勾選了全部篩選商品,則獲取商品ID
if(this.isAllFilteredProduct){
data.productIdList = await this.$refs.productSelector.getFilteredIds()
if(!data.lineChannelList?.length){
return this.$message.error(this.$t('请选择需要修改的路线'))
}
if(!data.isAllProduct && (!data.productIdList || !data.productIdList.length)){
if(!data.productIdList?.length){
return this.$message.error(this.$t('请选择商品') + "!")
}
data.lineChannelList = this.selectedRoutes
if(data.lineChannelList.length < 1){
return this.$message.error(this.$t('请选择需要修改的路线'))
// 如果是阶梯价,需要把阶梯价的数据转换成提交的格式
delete data.freightPriceStepList
delete data.clearancePriceStepList
delete data.fullPriceStepList
delete data.clearancePricePackagingList
delete data.freightPricePackagingList
delete data.fullPricePackagingList
// 阶梯价
if(data.stepPrice){
delete data.specialList
if(data.priceType === 1){
data.fullPriceStepList = this.getPriceList(this.form.fullPriceStepList)
}else{
data.freightPriceStepList = this.getPriceList(this.form.freightPriceStepList)
data.clearancePriceStepList = this.getPriceList(this.form.clearancePriceStepList)
}
data.fullPriceStepList= this.getPriceList(data.fullPriceStepList)
data.freightPriceStepList= this.getPriceList(data.freightPriceStepList)
data.clearancePriceStepList= this.getPriceList(data.clearancePriceStepList)
// 检查被忽略的阶梯价
let msgArr = [];
}else{
if(data.priceType){
const ignoreAll = data.fullPriceStepList.length != this.form.fullPriceStepList.length
if(ignoreAll){
msgArr.push(this.$t("{n}个全包阶梯价", {n: ignoreAll}))
data.fullPricePackagingList = this.getPackagingPrice(this.form.fullPricePackagingList)
if(!this.validatePackagingPrice(data.fullPricePackagingList, "全包价")){
return false
}
}else{
const ignoreFreight = this.form.freightPriceStepList.length - data.freightPriceStepList.length
const ignoreClearance = this.form.clearancePriceStepList.length - data.clearancePriceStepList.length
if(ignoreFreight){
msgArr.push(this.$t("{n}个运费阶梯价", {n: ignoreFreight}))
data.clearancePricePackagingList = this.getPackagingPrice(this.form.clearancePricePackagingList)
data.freightPricePackagingList = this.getPackagingPrice(this.form.freightPricePackagingList)
if(
!this.validatePackagingPrice(data.freightPricePackagingList, this.$t("运费")) ||
!this.validatePackagingPrice(data.clearancePricePackagingList, this.$t("清关费"))
){
return false
}
if(ignoreClearance){
msgArr.push(this.$t("{n}个清关费阶梯价", {n: ignoreClearance}))
}
data.specialList = data.specialList.filter(item => {
return item.transportPrice || item.clearancePrice
})
}
let msg = this.$t('已选择{route}条路线,{product}个商品', {
route: data.lineChannelList.length,
product: this.isAllProduct ? this.$refs.productSelector.allTotal : data.productIdList.length
})
console.log(msgArr)
if(msgArr.length){
msg += ";" + msgArr.join(",") + "被忽略"
}
await this.$confirm(msg + this.$t(';确认提交修改?', ))
this.loading = true
......
......@@ -136,7 +136,7 @@ export default {
// 判断阶梯价是否有效
isStepPriceValid(){
return stepPrice => {
return stepPrice.startNum && stepPrice.endNum
return (stepPrice.startNum || stepPrice.startNum === 0) && stepPrice.endNum
}
},
},
......
......@@ -9,6 +9,7 @@ export default {
components: {Template, Inputor, Selector},
props:{
index: Number,
type: String,
priceName: String,
fieldPrefix: String,
unitList:{
......@@ -154,7 +155,7 @@ export default {
<template>
<div>
<div class="bold text-lg">{{$t('空运{type}设置', {type: priceName})}}</div>
<div class="bold text-lg">{{$t('{type}{priceName}价格设置', {type, priceName})}}</div>
<div style="font-size:14px; margin:10px 0">
{{$t('第{index}阶梯定价方案', {index: index+1})}}
<template v-if="showAdd">
......@@ -212,7 +213,7 @@ export default {
<!--特性加价-->
<template v-for="(special, specialIndex) in value.specialList">
<el-form-item
:label="getDictDataLabel(DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS, special.specialDictType) + priceName"
:label="getDictDataLabel(DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS, special.specialDictType) + priceName + $t('加价')"
:key="specialIndex + 'transport'"
>
<el-input-number v-model.number="special[`${fieldPrefix}Price`]" :controls="false" :min="0" :placeholder="$t('整数或者两位小数')" class="w-100 mr-10" />
......@@ -224,9 +225,9 @@ export default {
<!--包装类型价格-->
<template v-for="(item, i) in value.packagingList">
<el-form-item :label="$t('包装类型') + priceName + (i+1)" :key="i">
<el-form-item :label="$t('包装类型加价') + (i+1)" :key="i">
<template #label>
<div class="el-form-item__label" style="width: 150px;">{{$t('包装类型') + priceName + (i+1)}}</div>
<div class="el-form-item__label" style="width: 150px;">{{$t('包装类型{name}加价', {name: priceName}) + (i+1)}}</div>
<div v-if="!item.packagingTypes || !item.packagingTypes.length" class="tips">{{$t('未选择包装类型将被忽略')}}</div>
</template>
<el-select v-model="item.packagingTypes" multiple placeholder="请选择" style="width: 100%; max-width: 450px; margin-bottom: 5px; display: block">
......
......@@ -3,12 +3,16 @@ import Selector from "@/components/Selector/index.vue";
import Inputor from "@/components/Inputor/index.vue";
import Template from "@/views/cms/template/index.vue";
import {DICT_TYPE, getDictDatas} from "@/utils/dict";
export default {
name: "SeaPrice",
components: {Template, Inputor, Selector},
components: {Inputor, Selector},
props:{
priceType: Number, // 1全包价,0清关费+运费
// 字段前缀
fieldPrefix: String,
// 价格名称
priceName: String,
// 包装类型字段
packagingField: String,
unitList:{
type: Array,
default: []
......@@ -21,14 +25,27 @@ export default {
value:{
type: Object,
default: () => {
return {
return {}
}
}
},
computed:{
packagingList(){
const dicts = JSON.parse(JSON.stringify(getDictDatas(DICT_TYPE.ECW_PACKAGING_TYPE)))
return dicts.map(dict => {
dict.enable = true
this.value[this.packagingField]?.forEach(item => {
if(item.packagingTypes?.length && item.packagingTypes.indexOf(dict.value) > -1){
dict.enable = false
}
})
return dict
})
}
},
created() {
this.initSpecialPrice()
this.initPackingPrice()
},
data(){
return {
......@@ -37,6 +54,21 @@ export default {
},
methods:{
getDictDatas,
// 包装类型初始化
initPackingPrice(){
// 已有包装类型则处理字段,没有则初始化一个
if(this.value[this.packagingField]?.length){
this.value[this.packagingField].forEach(item => {
if(!item.packagingTypes){
this.$set(item, 'packagingTypes', [])
}else if(typeof item.packagingTypes == 'string'){
item.packagingTypes = item.packagingTypes.split(',')
}
})
return
}
this.addPackage()
},
// 初始化特需加价
initSpecialPrice(){
if(!this.value.specialList){
......@@ -59,24 +91,39 @@ export default {
}
})
},
// 添加包装类型运费
addPackage(){
if(!this.value[this.packagingField]){
this.$set(this.value, this.packagingField, [])
}
this.value[this.packagingField]?.push({
packagingPrice: undefined,
packagingPriceUnit : this.value[`${this.fieldPrefix}PriceUnit`],
packagingVolumeUnit : this.value[`${this.fieldPrefix}VolumeUnit`],
})
},
// 删除包装类型运费
deletePackage(index){
this.value[this.packagingField]?.splice(index, 1)
},
// 校验
validate(){
let valid = true
// 价格检查
if(this.priceType){
if(!this.validatePrice(this.value[`allPrice`])){
if(!this.validatePrice(this.value[`${this.fieldPrefix}Price`])){
valid = false
this.$message.error(`请设置全包价`)
this.$message.error(this.$t("请设置{name}", {name: this.priceName}))
}
}else{
if(!this.validatePrice(this.value[`transportPrice`])){
valid = false
this.$message.error(`请设置运费`)
}
if(!this.validatePrice(this.value[`clearancePrice`])){
// 检查包装费
if(this.value[this.packagingField]?.length){
this.value[this.packagingField]?.forEach((item, index) => {
if(!item.packagingTypes?.length) return
if(!this.validatePrice(item.packagingPrice)){
valid = false
this.$message.error(`请设置清关费`)
this.$message.error(this.$t("请设置{name}的包装费{index}", {name: this.priceName, index: index+1}))
}
})
}
return valid
......@@ -93,133 +140,78 @@ export default {
</script>
<template>
<el-row>
<el-col :span="12">
<div class="page-title">{{$t('海运运费价格设置')}}</div>
<el-form-item :label="$t('默认运费')" v-if="!priceType">
<el-input-number v-model="value[`transportPrice`]" :placeholder="$t('整数或者两位小数')" :controls="false":disabled="readonly" class="w-100 mr-10"/>
<div>
<div class="page-title">{{$t('{name}价格设置', {name: this.priceName})}}</div>
<el-form-item :label="$t('默认{name}', {name: this.priceName})">
<el-input-number v-model="value[`${fieldPrefix}Price`]" :placeholder="$t('整数或者两位小数')" :controls="false":disabled="readonly" class="w-100 mr-10"/>
<selector
:disabled="readonly"
v-model="value[`transportPriceUnit`]"
v-model="value[`${fieldPrefix}PriceUnit`]"
:options="currencyList"
:label-field="$l(null, 'title')"
@input="$emit('changeUnit', {
value: $event,
field: `transportPriceUnit`
field: `${fieldPrefix}PriceUnit`
})"
value-field="id"
class="w-100" />
/
<selector
:disabled="readonly"
v-model="value[`transportVolumeUnit`]"
v-model="value[`${fieldPrefix}VolumeUnit`]"
:options="unitList"
:label-field="$l(null, 'title')"
@input="$emit('changeUnit', {
value: $event,
field: `transportVolumeUnit`
field: `${fieldPrefix}VolumeUnit`
})"
value-field="id"
class="w-100" />
</el-form-item>
<el-form-item :label="$t('默认全包价')" v-if="priceType">
<el-input-number v-model="value[`allPrice`]" :placeholder="$t('整数或者两位小数')" :disabled="readonly" :controls="false" class="w-100 mr-10"/>
<selector
:disabled="readonly"
v-model="value[`allPriceUnit`]"
:options="currencyList"
:label-field="$l(null, 'title')"
@input="$emit('changeUnit', {
value: $event,
field: `allPriceUnit`
})"
value-field="id"
class="w-100" />
/
<selector
:disabled="readonly"
v-model="value[`allVolumeUnit`]"
:options="unitList"
:label-field="$l(null, 'title')"
@input="$emit('changeUnit', {
value: $event,
field: `allVolumeUnit`
})"
value-field="id"
class="w-100" />
</el-form-item>
<!--特性加价-->
<template v-for="(special, specialIndex) in value.specialList">
<div :key="specialIndex + 'transport'">
<el-form-item
v-if="!priceType"
:label="getDictDataLabel(DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS, special.specialDictType) + $t('运费')"
:label="getDictDataLabel(DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS, special.specialDictType) + priceName + $t('加价')"
>
<el-input-number v-model.number="special[`transportPrice`]" :controls="false" :min="0" :disabled="readonly" :placeholder="$t('整数或者两位小数')" class="w-100 mr-10" />
<selector disabled v-model="special[`transportPriceUnit`]" :options="currencyList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100 mr-10" />
<el-input-number v-model.number="special[`${fieldPrefix}Price`]" :controls="false" :min="0" :disabled="readonly" :placeholder="$t('整数或者两位小数')" class="w-100 mr-10" />
<selector disabled v-model="special[`${fieldPrefix}PriceUnit`]" :options="currencyList" :label-field="$l(null, 'title')" value-field="id" class="w-100 mr-10" />
<span class="mr-10">/</span>
<selector disabled v-model="special[`transportVolumeUnit`]" :options="unitList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100" />
</el-form-item>
<el-form-item
v-if="priceType"
:label="getDictDataLabel(DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS, special.specialDictType) + $t('全包价')"
>
<el-input-number v-model.number="special[`allPrice`]" :controls="false" :min="0" :disabled="readonly" :placeholder="$t('整数或者两位小数')" class="w-100 mr-10" />
<selector disabled v-model="special[`allPriceUnit`]" :options="currencyList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100 mr-10" />
<span class="mr-10">/</span>
<selector disabled v-model="special[`allVolumeUnit`]" :options="unitList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100" />
<selector disabled v-model="special[`${fieldPrefix}VolumeUnit`]" :options="unitList" :label-field="$l(null, 'title')" value-field="id" class="w-100" />
</el-form-item>
</div>
</template>
</el-col>
<el-col :span="12" v-if="!priceType">
<div class="page-title">{{$t('海运清关费价格设置')}}</div>
<el-form-item :label="$t('默认清关费')">
<el-input-number v-model="value[`clearancePrice`]" :placeholder="$t('整数或者两位小数')" :disabled="readonly" :controls="false" class="w-100 mr-10"/>
<selector
:disabled="readonly"
v-model="value[`clearancePriceUnit`]"
:options="currencyList"
:label-field="$l(null, 'title')"
@input="$emit('changeUnit', {
value: $event,
field: `clearancePriceUnit`
})"
value-field="id"
class="w-100" />
/
<selector
:disabled="readonly"
v-model="value[`clearanceVolumeUnit`]"
:options="unitList"
:label-field="$l(null, 'title')"
@input="$emit('changeUnit', {
value: $event,
field: `clearanceVolumeUnit`
})"
value-field="id"
class="w-100" />
</el-form-item>
<!--特性加价-->
<template v-for="(special, specialIndex) in value.specialList">
<div :key="specialIndex + 'transport'">
<el-form-item
v-if="!priceType"
:label="getDictDataLabel(DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS, special.specialDictType) + $t('清关费')"
<!--包装类型价格-->
<template v-for="(item, i) in value[packagingField]">
<el-form-item :label="$t('包装类型') + priceName + (i+1)" :key="i">
<template #label>
<div class="el-form-item__label" style="width: 150px;">{{$t('包装类型{name}加价', {name: priceName}) + (i+1)}}</div>
<div v-if="!item.packagingTypes || !item.packagingTypes.length" class="tips">{{$t('未选择包装类型将被忽略')}}</div>
</template>
<el-select v-model="item.packagingTypes" multiple placeholder="请选择" style="width: 100%; max-width: 450px; margin-bottom: 5px; display: block">
<el-option
v-for="item in packagingList"
:key="item.value"
:label="$l(item, 'label')"
:value="item.value"
:disabled="!item.enable"
>
<el-input-number v-model.number="special[`clearancePrice`]" :controls="false" :min="0" :disabled="readonly" :placeholder="$t('整数或者两位小数')" class="w-100 mr-10" />
<selector disabled v-model="special[`clearancePriceUnit`]" :options="currencyList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100 mr-10" />
</el-option>
</el-select>
<el-input-number v-model="item.packagingPrice" :controls="false" :min="0" :placeholder="$t('整数或者两位小数')" class="w-100 mr-10" />
<selector disabled v-model="item.packagingPriceUnit" :options="currencyList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100 mr-10" />
<span class="mr-10">/</span>
<selector disabled v-model="special[`clearanceVolumeUnit`]" :options="unitList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100" />
<selector disabled v-model="item.packagingVolumeUnit" :options="unitList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100" />
<template v-if="i == value[packagingField].length -1 && !readonly">
<el-link type="primary" @click.native="addPackage" class="ml-5">{{$t('添加')}}</el-link>
<el-divider direction="vertical"></el-divider>
<el-link type="danger" @click.native="deletePackage(i)">{{$t('删除')}}</el-link>
</template>
</el-form-item>
</div>
</template>
</el-col>
</el-row>
</div>
</template>
<style scoped lang="scss">
......
......@@ -43,9 +43,9 @@ export default {
{{$t("第{no}阶段", {no: index + 1})}} {{priceName}}
{{value.startNum}} - {{value.endNum}} {{unitMap[value.weightUnit]}}
</div>
<div class="pl-10" >
<div>
{{$t('默认') + priceName}}
{{value.transportPrice}} {{currencyMap[value[`${fieldPrefix}PriceUnit`]]}} / {{unitMap[value[`${fieldPrefix}VolumeUnit`]]}}
{{value[`${fieldPrefix}Price`]}} {{currencyMap[value[`${fieldPrefix}PriceUnit`]]}} / {{unitMap[value[`${fieldPrefix}VolumeUnit`]]}}
</div>
<!--特需加价-->
<div v-for="(special, specialIndex) in value.specialList">
......
......@@ -112,6 +112,7 @@
:currency-list="currencyList"
:unit-list="unitList"
field-prefix="all"
:type="$t('海运')"
:price-name="$t('全包价')"
:show-add="index === form.fullPriceStepList.length -1 && !readonly"
:value="item"
......@@ -131,6 +132,7 @@
:currency-list="currencyList"
:unit-list="unitList"
field-prefix="transport"
:type="$t('海运')"
:price-name="$t('运费')"
:show-add="index === form.freightPriceStepList.length -1 && !readonly"
:value="item"
......@@ -149,6 +151,7 @@
:currency-list="currencyList"
:unit-list="unitList"
field-prefix="clearance"
:type="$t('海运')"
:price-name="$t('清关费')"
:show-add="index === form.clearancePriceStepList.length -1 && !readonly"
:value="item"
......@@ -161,16 +164,48 @@
</el-col>
</el-row>
</template>
<template v-else-if="form.priceType === 1">
<sea-price
ref="seaPrice"
:currency-list="currencyList"
:unit-list="unitList"
:value="form"
:readonly="readonly"
field-prefix="all"
:price-name="$t('全包价')"
packaging-field="fullPricePackagingList"
@changeUnit="handleFormUnitChange($event)"
></sea-price>
</template>
<template v-else>
<el-row :gutter="20">
<el-col :span="12">
<sea-price
ref="seaPrice"
:currency-list="currencyList"
:unit-list="unitList"
:value="form"
:readonly="readonly"
field-prefix="transport"
:price-name="$t('运费')"
packaging-field="freightPricePackagingList"
@changeUnit="handleFormUnitChange($event)"
></sea-price>
</el-col>
<el-col :span="12">
<sea-price
ref="seaPrice"
:price-type="form.priceType"
:currency-list="currencyList"
:unit-list="unitList"
:value="form"
:readonly="readonly"
field-prefix="clearance"
:price-name="$t('清关费')"
packaging-field="clearancePricePackagingList"
@changeUnit="handleFormUnitChange($event)"
></sea-price>
</el-col>
</el-row>
</template>
<el-form-item :label="$t('价格有效期')">
......@@ -419,6 +454,27 @@ export default {
}
this.lineList = [res.data]
// 如果不是阶梯价,需要初始化包装类型
if(this.form.stepPrice != 1){
if(this.form.freightPricePackagingList?.length){
this.form.freightPricePackagingList.forEach(item => {
if(!item.packagingTypes){
this.$set(item, 'packagingTypes', [])
}else if(typeof item.packagingTypes == 'string'){
item.packagingTypes = item.packagingTypes.split(',')
}
})
}else this.form.freightPricePackagingList = [{}]
if(this.form.clearancePricePackagingList?.length){
this.form.clearancePricePackagingList.forEach(item => {
if(!item.packagingTypes){
this.$set(item, 'packagingTypes', [])
}else if(typeof item.packagingTypes == 'string'){
item.packagingTypes = item.packagingTypes.split(',')
}
})
}else this.form.clearancePricePackagingList = [{}]
}
}
// action=batchUpdate且ids不为空
......@@ -455,7 +511,9 @@ export default {
advanceStatus: 0,
needBook: 0,
specialList: [],
priceStepList: this.type === 'air' ? [{},{}] : [],
clearancePricePackagingList: [{}],
freightPricePackagingList: [{}],
fullPricePackagingList: [{}],
// dayLimit: 10000,
validateEndDate: undefined,
validateStartDate: undefined,
......@@ -608,6 +666,15 @@ export default {
})
return stepPriceList
},
// 格式化包装类型费用
getPackingPrice(packging){
if(!packging?.length) return
packging = JSON.parse(JSON.stringify(packging))
return packging.map(item => {
item.packagingTypes = item.packagingTypes.join(",")
return item
})
},
// 非阶梯价格更新单位
handleFormUnitChange(data){
// 海运非阶梯价没有重量单位,所以按照体积单位同步最小起计量单位
......@@ -621,7 +688,25 @@ export default {
})
}
// TODO 等加了包装之后还需要同步包装的单位
// 同步包装的单位
let packingField = {
transportVolumeUnit: 'freightPricePackagingList',
clearanceVolumeUnit: 'clearancePricePackagingList',
allVolumeUnit: 'fullPricePackagingList',
transportPriceUnit: 'freightPricePackagingList',
clearancePriceUnit: 'clearancePricePackagingList'
}[data.field]
if(!this.form[packingField]?.length){
return false
}
this.form[packingField].forEach(item => {
if(data.field.indexOf("PriceUnit") > -1){
item['packagingPriceUnit'] = data.value
}
if(data.field.indexOf("VolumeUnit") > -1){
item['packagingVolumeUnit'] = data.value
}
})
},
initStepPrice(){
if(this.form.priceType == 1 && !this.form.fullPriceStepList?.length){
......@@ -638,7 +723,6 @@ export default {
},
// force 为是否强制提交,在价格过期的时候需要确认后强制提交
submitForm(force = false) {
console.log("this.$refs[\"form\"]", this.$refs["form"])
this.$refs["form"].validate(async (valid) => {
if (!valid) {
return;
......@@ -658,7 +742,8 @@ export default {
// specialList: this.specialProducts,
isAllProduct: 0
})
if(this.$refs.stepPrice){
// 阶梯价
if(this.form.stepPrice){
let isValid = true
for (let stepPrice of this.$refs.stepPrice){
if(!stepPrice.validate()){
......@@ -667,8 +752,6 @@ export default {
}
}
if(!isValid)return
}
// 全包价
if(this.form.priceType == 1) {
......@@ -680,6 +763,42 @@ export default {
data.freightPriceStepList = this.getPriceList(this.form.freightPriceStepList)
delete data.fullPriceStepList
}
}
//海运非阶梯价校验
else{
// 有多个组件则表示清关费 + 运费
if(this.$refs.seaPrice?.length){
let isValid = true
for (let seaPrice of this.$refs.seaPrice){
if(!seaPrice.validate()){
isValid = false
break
}
}
if(!isValid)return
}
// 只有一个海运费组件,全包价
else if(this.$refs.seaPrice && !this.$refs.seaPrice.validate()){
return
}
// 格式化
if(this.form.priceType === 1){
data.fullPricePackagingList = this.getPackingPrice(data.fullPricePackagingList)
delete data.freightPricePackagingList
delete data.clearancePricePackagingList
}else{
data.freightPricePackagingList = this.getPackingPrice(data.freightPricePackagingList)
data.clearancePricePackagingList = this.getPackingPrice(data.clearancePricePackagingList)
delete data.fullPricePackagingList
}
// 删除阶梯价字段
delete data.freightPriceStepList
delete data.fullPriceStepList
delete data.clearancePriceStepList
}
// 设置了有效期,且已过期则给提示
if(this.form.validateEndDate && force !== true){
......
......@@ -99,6 +99,7 @@
:currency-list="currencyList"
:unit-list="unitList"
field-prefix="all"
:type="$t('空运')"
:price-name="$t('全包价')"
:show-add="index === form.fullPriceStepList.length -1 && !readonly"
:value="item"
......@@ -118,6 +119,7 @@
:currency-list="currencyList"
:unit-list="unitList"
field-prefix="transport"
:type="$t('空运')"
:price-name="$t('运费')"
:show-add="index === form.freightPriceStepList.length -1 && !readonly"
:value="item"
......@@ -136,6 +138,7 @@
:currency-list="currencyList"
:unit-list="unitList"
field-prefix="clearance"
:type="$t('空运')"
:price-name="$t('清关费')"
:show-add="index === form.clearancePriceStepList.length -1 && !readonly"
:value="item"
......
......@@ -57,6 +57,7 @@
<el-form-item :label="$t('状态')" prop="combStatus">
<el-select v-model="queryParams.combStatus" :placeholder="$t('请选择状态')" clearable>
<el-option :label="$t('未设置价格')" value="setPrice_1"></el-option>
<el-option :label="$t('未过期')" value="setPrice_2"></el-option>
<el-option :label="$t('黑名单')" value="blacklist_1"></el-option>
</el-select>
</el-form-item>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment