Commit e7493a3e authored by dragondean@qq.com's avatar dragondean@qq.com

完善价格相关的功能

parent a521ab93
<template>
<div class="app-container">
<el-form ref="form" :model="form" :rules="rules" label-width="150px">
<products-selector v-model="form.productIdList" show-all @setall="isAllProduct=$event" class="mb-20" />
<products-selector ref="productSelector" v-model="form.productIdList" show-all @setall="isAllProduct=$event" :default-ids="form.productIdList" class="mb-20" />
<routers-selector v-model="selectedRoutes" :type="type" />
......@@ -191,13 +191,14 @@
</template>
<script>
import RoutersSelector from '@/components/RoutersSelector'
import { batchUpdateProductPrice} from "@/api/ecw/productPrice";
import {batchUpdateProductPrice, getProductPrice} from "@/api/ecw/productPrice";
import { getCurrencyList } from '@/api/ecw/currency';
import { getUnitList } from '@/api/ecw/unit';
import ProductsSelector from '@/components/ProductsSelector'
import Selector from '@/components/Selector'
import Inputor from '@/components/Inputor'
import Decimal from 'decimal.js'
import {getProduct} from "@/api/ecw/product";
export default {
components: { RoutersSelector, ProductsSelector, Selector, Inputor },
......@@ -294,16 +295,24 @@ export default {
getCurrencyList().then(res => this.currencyList = res.data)
getUnitList().then(res => this.unitList = res.data)
// 如果是复制,则获取数据并填充,先复制,然后填充特需,避免数据的特需不全导致部分不显示
if(this.$route.query.templateId){
await this.getTemplateDetail(this.$route.query.templateId)
}
this.getDictDatas(this.DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS).forEach(item => {
this.form.specialList.push({
"clearancePrice": null,
"clearancePriceUnit": null,
"clearanceVolumeUnit": null,
"specialDictType": item.value,
"transportPrice": null,
"transportPriceUnit": null,
"transportVolumeUnit": null,
})
// 没有的才push,已有的可能是从复制模板携带过来的数据
if(!this.form.specialList.find(special => special.specialDictType == item.value)) {
this.form.specialList.push({
"clearancePrice": null,
"clearancePriceUnit": null,
"clearanceVolumeUnit": null,
"specialDictType": item.value,
"transportPrice": null,
"transportPriceUnit": null,
"transportVolumeUnit": null,
})
}
})
this.$nextTick(() => {
......@@ -312,8 +321,62 @@ export default {
this.$set(this.form, 'stepPrice', 1)
}
})
},
methods: {
// 获取模板数据(复制的源路线价格信息)
async getTemplateDetail(id){
await getProductPrice(id).then(res => {
// 填充商品、线路、价格信息、出货渠道(空运)
// this.form.productIdList = [res.data.productId]
this.selectedRoutes = [{
"lineId": res.data.warehouseLineId,
"channelId": res.data.shippingChannelId,
"transportId": res.data.warehouseLineDO.transportType,
"shippingChannelId":res.data.channelId
}]
// 要复制过来的字段
const {
allPrice,
allPriceUnit,
allVolumeUnit,
transportPrice,
transportPriceUnit,
transportVolumeUnit,
clearancePrice,
clearancePriceUnit,
clearanceVolumeUnit,
priceType,
stepPrice,
specialList,
priceStepList
} = res.data
this.$set(this, 'form', Object.assign({}, this.form, {
allPrice,
allPriceUnit,
allVolumeUnit,
transportPrice,
transportPriceUnit,
transportVolumeUnit,
clearancePrice,
clearancePriceUnit,
clearanceVolumeUnit,
priceType,
stepPrice,
specialList,
priceStepList,
minWeight,
minWeightUnit
}))
// 产品选择器默认选择的商品
getProduct(res.data.productId).then(res => {
this.$refs.productSelector.choose(res.data)
})
})
},
// 同步全部单位
syncAllUnit(){
let obj = this.form.stepPrice == 1 ? this.form.priceStepList[0] : this.form
......
This diff is collapsed.
......@@ -54,7 +54,8 @@
<el-row :gutter="10" class="mb8">
<!--全部路线吗没有新增入口,指定商品的路线价格才有添加路线-->
<el-col :span="1.5" v-if="$route.query.product_id">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['ecw:product-price:create']">{{$t('新建价格')}}</el-button>
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd('air')" v-hasPermi="['ecw:product-price:create']">{{$t('新建空运价格')}}</el-button>
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd('sea')" v-hasPermi="['ecw:product-price:create']">{{$t('新建海运价格')}}</el-button>
</el-col>
<el-col :span="1.5">
<!--未指定商品-->
......@@ -150,8 +151,19 @@
{{$t('运费')}}:{{ getCurrencySymbol(scope.row.priceStepList[0].transportPriceUnit) + scope.row.priceStepList[0].transportPrice}}&nbsp;
{{ getCurrencyTitle(scope.row.priceStepList[0].transportPriceUnit) + '/' + getUnitTitle(scope.row.priceStepList[0].transportVolumeUnit)}}
<br />
{{$t('清关费')}}:{{ getCurrencySymbol(scope.row.priceStepList[0].clearancePriceUnit) + scope.row.priceStepList[0].clearancePrice}}&nbsp;
{{ getCurrencyTitle(scope.row.priceStepList[0].clearancePriceUnit) + '/' + getUnitTitle(scope.row.priceStepList[0].clearanceVolumeUnit)}}
<template v-if="[3,4].indexOf(+scope.row.warehouseLineDO.transportType) > -1">
<!--空运的清关费-->
<template v-if="scope.row.clearPriceStepList.length">
{{$t('清关费')}}:{{ getCurrencySymbol(scope.row.clearPriceStepList[0].clearancePriceUnit) + scope.row.clearPriceStepList[0].clearancePrice}}&nbsp;
{{ getCurrencyTitle(scope.row.clearPriceStepList[0].clearancePriceUnit) + '/' + getUnitTitle(scope.row.clearPriceStepList[0].clearanceVolumeUnit)}}
</template>
<template v-else>{{$t('暂无清关费设置')}}</template>
</template>
<template v-else>
<!--海运的清关费-->
{{$t('清关费')}}:{{ getCurrencySymbol(scope.row.priceStepList[0].clearancePriceUnit) + scope.row.priceStepList[0].clearancePrice}}&nbsp;
{{ getCurrencyTitle(scope.row.priceStepList[0].clearancePriceUnit) + '/' + getUnitTitle(scope.row.priceStepList[0].clearanceVolumeUnit)}}
</template>
</div>
<div v-if="scope.row.priceType == 1">
{{$t('全包价')}}:{{ getCurrencySymbol(scope.row.priceStepList[0].allPriceUnit) + scope.row.priceStepList[0].allPrice}}&nbsp;
......@@ -348,7 +360,8 @@ export default {
computed: {
// 路径中的运输方式参数
transportType() {
return this.$route.path.split('-').pop();
// product-price-1_2的格式,如果没有三段则最后一段不是运输方式
return this.$route.path.split('-')[2] || '';
},
// 路由中的标题
routeName(){
......@@ -505,9 +518,11 @@ export default {
this.product = res.data
})
}else{
// 如果指定了单个的运输方式则赋值
if(this.transportType.split('_').length == 1){
this.$set(this.queryParams, 'transportType', +this.transportType)
if(this.transportType) {
// 如果指定了单个的运输方式则赋值
if (this.transportType.split('_').length == 1) {
this.$set(this.queryParams, 'transportType', +this.transportType)
}
}
this.getAttrList();
}
......@@ -576,9 +591,9 @@ export default {
})
},
handleSelectionChange(val) {
/*handleSelectionChange(val) {
this.lineList = val;
},
},*/
/**运输线路改变 */
transportTypeChange(newVal) {
......@@ -658,8 +673,8 @@ export default {
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
return this.$router.push('../../lineProject/product-price/edit?' + (new URLSearchParams(this.$route.query)).toString())
handleAdd(type) {
return this.$router.push(`../../lineProject/product-price/edit-${type}?` + (new URLSearchParams(this.$route.query)).toString())
},
// 批量修改单个商品的价格(一条或者多条,后者全部路线)
......@@ -672,7 +687,9 @@ export default {
},
/** 修改按钮操作 */
handleUpdate(row, readonly) {
let url = '../../lineProject/product-price/edit?action=update&id=' + row.id
let transportType = row.warehouseLineDO.transportType
let type = transportType == 3 || transportType == 4 ? 'air' : 'sea'
let url = `../../lineProject/product-price/edit-${type}?action=update&id=${row.id}`
if(readonly)url += '&readonly=1'
return this.$router.push(url)
},
......@@ -712,7 +729,7 @@ export default {
},
/** 提交按钮 */
submitForm() {
/*submitForm() {
this.$refs["form"].validate(valid => {
if (!valid) {
return;
......@@ -747,7 +764,7 @@ export default {
this.getList();
});
});
},
},*/
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
......@@ -805,7 +822,8 @@ export default {
},
// 复制模板
copyTemplate(row){
this.$alert('// TODO')
// 跳转到批量设置页面,并填充数据
this.$router.push(`../../lineProject/batch-edit-${row.transportType == 3 || row.transportType == 4 ? 'air' : 'sea'}?templateId=${row.id}`)
}
}
......
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