Commit 47b6fa0b authored by dragondean@qq.com's avatar dragondean@qq.com

批量设置路线价格分开为海运和空运

parent 78f3f9d1
......@@ -57,8 +57,11 @@ export default {
}
},
computed:{
dicts(){
return this.getList(this.type)
},
dictList(){
return this.getList(this.type).filter(this.filter)
return this.dicts.filter(this.filter)
},
formattedList(){
let arr = []
......@@ -104,7 +107,7 @@ export default {
},
setValueSync(){
if(this.value === null || this.value === undefined || this.value === ''){
return this.valueSync = this.multiple ? [] : this.value
return this.valueSync = this.multiple ? [] : this.value
}
if(this.multiple){
let value = this.value || []
......
......@@ -2,8 +2,8 @@
<div>
<div class="filters mb-10">
{{$t('运输方式')}}
<dict-selector :type='DICT_TYPE.ECW_TRANSPORT_TYPE' v-model="transportType" :placeholder="$t('请选择运输方式')" style="width:150px" />
<dict-selector :type='DICT_TYPE.ECW_TRANSPORT_TYPE' v-model="transportType" :placeholder="$t('请选择运输方式')" :filter="transportFilter" style="width:150px" />
{{$t('始发地')}}
<el-select :placeholder="$t('请选择始发地')" v-model="exportCity" clearable>
<el-option v-for="item in exportCityList" :key="item.id" :label="item.titleZh" :value="item.id" />
......@@ -50,6 +50,11 @@
{{$l(row.channel, 'name')}}
</template>
</el-table-column>
<el-table-column v-if="showAttr" :label="$t('商品特性')" prop="startTitleZh">
<template slot-scope="{row}">
{{ getAttrNames(row.attrId) }}
</template>
</el-table-column>
<el-table-column :label="$t('操作')" prop="">
<template slot="header">
<el-checkbox @change="toggleGroupChecker(index, $event)" v-model="groupChecker[item.value]"></el-checkbox>
......@@ -69,12 +74,15 @@
import {getChannelList} from '@/api/ecw/channel'
import {getTradeCityList} from '@/api/ecw/region'
import {openedRouterList} from '@/api/ecw/warehouse'
import {getProductAttrList} from "@/api/ecw/productAttr";
export default {
props:{
value: {
type: Array
},
option: Object
value: {
type: Array
},
option: Object,
// 类型,sea海运,air空运
type: String
},
data(){
return {
......@@ -90,7 +98,7 @@ export default {
hideMap: {}, // 折叠状态
checkAll: null,
groupChecker: {}, // 分组全选状态
attrList:[], // 商品特性
}
},
computed:{
......@@ -114,12 +122,14 @@ export default {
})
return ids
},
// 根据选择的渠道筛选
availChannelList(){
return this.channelList.filter(item => !this.channelId || this.channelId == item.channelId)
return this.channelList.filter(item => !this.channelId || this.channelId == item.channelId)
},
filteredRouterList(){
let transportTypeList = []
this.transportTypeDicts
.filter(this.transportFilter)
.filter(transport => !this.channelId || transport.cssClass == 'channel')
.forEach(item => {
if(this.transportType === null || this.transportType == '' || this.transportType == item.value){
......@@ -151,6 +161,25 @@ export default {
}
})
return transportTypeList
},
// 是否显示商品特性(渠道)
showAttr(){
return this.type == 'air'
},
// 显示产品特性
getAttrName(){
return (id) => {
let item = this.attrList.find(item => item.id == id)
if(!item) return ''
return this.$l(item, 'attrName')
}
},
// 显示多个商品特性
getAttrNames(){
return (ids) => {
if(!ids) return ''
return ids.split(',').filter( item => !!item).map(id => this.getAttrName(id)).join(',')
}
}
},
watch:{
......@@ -188,7 +217,7 @@ export default {
if(option){
this.changeOption()
}
}
},
created(){
......@@ -200,7 +229,7 @@ export default {
// 路线需要过滤失效的进出口城市,所以在程序加载后再加载路线
this.getOpenedRouterList()
})
if(this.value && this.value.length){
this.selectedRoutes = this.value
}
......@@ -208,9 +237,19 @@ export default {
if(this.option){
this.changeOption()
}
// 如果显示特性,则需要查询特数据备用
if(this.showAttr){
this.getAttrList()
}
},
methods:{
getAttrList(){
getProductAttrList().then(res => {
this.attrList = res.data
})
},
changeOption(){
if(!this.option) return
this.importCity = +this.option.importCity || null
......@@ -258,22 +297,13 @@ export default {
if(index > -1){
this.selectedRoutes.splice(index, 1)
}
}
},
getSelectedIndex(router){
return this.selectedRoutes.findIndex(item => {
return item.lineId == router.id && item.channelId == router.channel.channelId
})
/* let index = null
this.selectedRoutes.forEach((item, i)=>{
if(item.lineId == router.id && item.shippingChannelId == router.channel.channelId){
index = i
// break
}
})
return index */
},
SpanMethod({ row, column, rowIndex, columnIndex }){
if (columnIndex < 2 ) {
......@@ -290,7 +320,11 @@ export default {
// 折叠,展开
toggleHide(value){
this.$set(this.hideMap, value, !this.hideMap[value])
}
},
// 运输方式筛选
transportFilter(item){
return (this.type == 'sea' ? ['1','2'] : ['3', '4']).indexOf(item.value) > -1
},
}
}
</script>
......@@ -298,4 +332,4 @@ export default {
.mb-10{
margin-bottom: 10px
}
</style>
\ No newline at end of file
</style>
......@@ -3,13 +3,13 @@
<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" />
<routers-selector v-model="selectedRoutes" />
<routers-selector v-model="selectedRoutes" :type="type" />
<el-card style="margin-bottom: 10px">
<div slot="header" style="font-size:20px;">
{{$t('价格设置')}}
<span>
<!-- <el-checkbox label="" @change="form.needPay=$event ? 1 : 0">{{$t('预付')}}</el-checkbox> -->
<!--空运只有阶梯价格,不显示阶梯价格勾选-->
<span v-if="type != 'air'">
<el-checkbox label="" @change="form.stepPrice=$event ? 1 : 0">{{$t('阶梯价格')}}</el-checkbox>
</span>
</div>
......@@ -22,7 +22,7 @@
<el-form-item :label="$t('单价模式')" prop="priceType">
<dict-selector :type="DICT_TYPE.ECW_PRICE_TYPE" v-model="form.priceType" form-type="radio" />
</el-form-item>
<!--阶梯订单-->
<template v-if="form.stepPrice==1" >
<div v-for="(item, index) in form.priceStepList" :key="index">
......@@ -46,7 +46,7 @@
<selector :disabled="index > 0" @input="syncAllUnit" v-model="item.transportPriceUnit" :options="currencyList" :label-field="$l('title')" value-field="id" defaultable2 class="w100" />
/ <selector :disabled="index > 0" @input="syncAllUnit" v-model="item.transportVolumeUnit" :options="unitList" :label-field="$l('title')" value-field="id" defaultable2 class="w100" />
</el-form-item>
<el-form-item :label="$t('默认清关费')" v-if="form.priceType != 1">
<el-form-item :label="$t('默认清关费')" v-if="form.priceType != 1 && type != 'air'">
<inputor default2="0" v-model.number="item.clearancePrice" type="number" :placeholder="$t('整数或者两位小数')" class="w100 mr10" />
<selector :disabled="index > 0" @input="syncAllUnit" v-model="item.clearancePriceUnit" :options="currencyList" :label-field="$l('title')" value-field="id" defaultable2 class="w100" />
/ <selector :disabled="index > 0" @input="syncAllUnit" v-model="item.clearanceVolumeUnit" :options="unitList" :label-field="$l('title')" value-field="id" defaultable2 class="w100" />
......@@ -80,7 +80,7 @@
<inputor default2="0" v-model.number="form.transportPrice" type="number" :placeholder="$t('整数或者两位小数')" class="w-100 ml-10 mr-10" />
/ <selector v-model="form.transportVolumeUnit" @input="syncAllUnit" :options="unitList" :label-field="$l('title')" value-field="id" defaultable2 class="w-100" />
</el-form-item>
<el-form-item :label="$t('默认清关费')" prop="clearancePrice">
<el-form-item :label="$t('默认清关费')" prop="clearancePrice" v-if="type != 'air'">
<selector v-model="form.clearancePriceUnit" @input="syncAllUnit" :options="currencyList" :label-field="$l('title')" value-field="id" defaultable2 class="w-100" />
<inputor default2="0" v-model.number="form.clearancePrice" type="number" :placeholder="$t('整数或者两位小数')" class="w-100 ml-10 mr-10" />
/ <selector v-model="form.clearanceVolumeUnit" @input="syncAllUnit" :options="unitList" :label-field="$l('title')" value-field="id" defaultable2 class="w-100" />
......@@ -108,6 +108,7 @@
/ <selector disabled v-model="special.transportVolumeUnit" :options="unitList" :label-field="$l('title')" value-field="id" defaultable2 class="w-100" />
</el-form-item>
<el-form-item
v-if="type != 'air'"
:label="getDictDataLabel(DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS, special.specialDictType) + $t('清关费')"
:key="specialIndex + 'clearance'">
<selector disabled v-model="special.clearancePriceUnit" :options="currencyList" :label-field="$l('title')" value-field="id" defaultable2 class="w-100" />
......@@ -137,16 +138,24 @@
<el-radio v-model.number="form.needBook" :label="0">{{$t('')}}</el-radio>
</el-form-item>
<el-form-item :label="$t('每日入仓上限')" prop="dayLimit" v-if="form.needBook == 1">
<el-input v-model.number="form.dayLimit" type="number" class="w-100" />{{$t('立方米')}}
</el-form-item>
<!--下面几个字段只有批量设置海运才需要-->
<template v-if="type == 'sea'">
<el-form-item :label="$t('每日入仓上限')" prop="dayLimit" v-if="form.needBook == 1">
<el-input v-model.number="form.dayLimit" type="number" class="w-100" />{{$t('立方米')}}
</el-form-item>
<el-form-item :label="$t('货柜位置')" prop="containerLocation">
<dict-selector :type="DICT_TYPE.ECW_CONTAINER_LOCATION" v-model="form.containerLocation" />
</el-form-item>
<el-form-item :label="$t('货柜位置')" prop="containerLocation">
<dict-selector :type="DICT_TYPE.ECW_CONTAINER_LOCATION" v-model="form.containerLocation" />
</el-form-item>
<el-form-item :label="$t('订单方数上限')" prop="square">
<el-input v-model.number="form.square" type="number" style="width:200px" />
</el-form-item>
</template>
<el-form-item :label="$t('订单方数上限')" prop="square">
<el-input v-model.number="form.square" type="number" style="width:200px" />
<el-form-item :label="$t('是否単询')" prop="inquiry">
<!--// TODO 字段待完善-->
<el-input v-model.number="form.needOrderInquiry" type="number" style="width:200px" />
</el-form-item>
</el-card>
</el-form>
......@@ -168,9 +177,10 @@ import { arrryToKeyedObjectBy } from '@/utils/index'
import Selector from '@/components/Selector'
import Inputor from '@/components/Inputor'
import { parseTime } from '@/utils/ruoyi'
import Template from "@/views/cms/template";
export default {
components: { RoutersSelector, ProductsSelector, Selector, Inputor },
components: {Template, RoutersSelector, ProductsSelector, Selector, Inputor },
data() {
return {
checkList: [],
......@@ -195,11 +205,14 @@ export default {
productTypeList: [],
productDisabled: true,
lineList: [], //路线数组
loading: false
loading: false,
}
},
computed: {
// 类型,默认海运sea,air表示空运
type(){
return this.$route.path.split(/[-_]/).pop()
}
},
watch: {
checkList() { //选择路线
......@@ -290,6 +303,13 @@ export default {
"transportVolumeUnit": null,
})
})
this.$nextTick(() => {
// 如果是空运,阶梯价格默认为1
if(this.type == 'air'){
this.$set(this.form, 'stepPrice', 1)
}
})
},
methods: {
// 同步全部单位
......@@ -339,7 +359,15 @@ export default {
this.$set(this.form, 'minWeightUnit', obj['transportVolumeUnit'] || obj['allVolumeUnit'])
}
},
// 价格校验器
priceValidator(rule, value, callback){
if(!value || value == '') return callback()
value = parseFloat(value)
if(!value || value < 0){
return callback(new Error('价格错误'))
}
callback()
},
setDefaultVolumeUnit(unit){
this.$set(this.form, 'transportVolumeUnit', unit)
this.$set(this.form, 'clearanceVolumeUnit', unit)
......
......@@ -3,14 +3,6 @@
<div class="page-title">{{$route.query.product_id ? productTitle + '-' : this.$t('全部')}}{{$t('路线价格列表')}}</div>
<!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<!-- <el-form-item :label="$t('商品编码')" prop="productCode" v-if="!$route.query.product_id">
<el-input v-model="queryParams.productCode" :placeholder="$t('请输入商品编码')" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item :label="$t('海关编码')" prop="customsCode" v-if="!$route.query.product_id">
<el-input v-model="queryParams.customsCode" :placeholder="$t('请输入海关编码')" clearable @keyup.enter.native="handleQuery"/>
</el-form-item> -->
<el-form-item :label="$t('商品名称')" prop="titleZh" v-if="!$route.query.product_id">
<el-input v-model="queryParams.titleZh" :placeholder="$t('请输入中英文名称、商品编码、海关编码')" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
......@@ -20,14 +12,6 @@
<el-option v-for="type in typeList" :key="type.id" :label="type.titleZh" :value="type.id"/>
</el-select>
</el-form-item>
<!-- <el-form-item :label="$t('商品属性')" prop="attrId" v-if="!$route.query.product_id">
<el-select v-model="queryParams.attrId" :placeholder="$t('选择商品属性')" clearable>
<el-option v-for="attr in attrList" :key="attr.id" :label="attr.attrName" :value="attr.id"/>
</el-select>
</el-form-item>
<el-form-item :label="$t('商品特性')" prop="attrId" v-if="!$route.query.product_id">
// TODO
</el-form-item> -->
<el-form-item :label="$t('运输方式')" prop="transportType">
<dict-selector :type="DICT_TYPE.ECW_TRANSPORT_TYPE" v-model="queryParams.transportType" formatter="number" clearable />
</el-form-item>
......@@ -73,19 +57,19 @@
</el-col>
<el-col :span="1.5">
<!--未指定商品-->
<el-button v-if="!$route.query.product_id" type="primary" v-hasPermi="['ecw:product-price:batch_update']" size="mini" @click="handleBatchEdit">{{$t('批量设置价格')}}</el-button>
<el-button v-if="!$route.query.product_id" type="primary" v-hasPermi="['ecw:product-price:bartch_black']" size="mini" @click="batchBlock" :disabled="multiple">{{$t('批量加入黑名单')}}</el-button>
<el-button v-if="!$route.query.product_id" type="primary" v-hasPermi="['ecw:product-price:batch_down']" size="mini" @click="batchOff" :disabled="multiple">{{$t('批量下架')}}</el-button>
<el-button v-if="!$route.query.product_id" type="warning" v-hasPermi="['ecw:product-price:export']" @click="handleExport" :loading="exportLoading" >{{$t('导出')}}</el-button>
<template v-if="!$route.query.product_id">
<!--<el-button type="primary" v-hasPermi="['ecw:product-price:batch_update']" size="mini" @click="handleBatchEdit">{{$t('批量设置价格')}}</el-button>-->
<el-button type="primary" v-hasPermi="['ecw:product-price:bartch_black']" size="mini" @click="batchBlock" :disabled="multiple">{{$t('批量加入黑名单')}}</el-button>
<el-button type="primary" v-hasPermi="['ecw:product-price:batch_down']" size="mini" @click="batchOff" :disabled="multiple">{{$t('批量下架')}}</el-button>
<el-button type="warning" v-hasPermi="['ecw:product-price:export']" @click="handleExport" :loading="exportLoading" >{{$t('导出')}}</el-button>
<el-button type="primary" v-hasPermi="['ecw:product-price:batch_update']" size="mini" @click="handleBatchEdit('sea')">{{$t('批量设置海运价格')}}</el-button>
<el-button type="primary" v-hasPermi="['ecw:product-price:batch_update']" size="mini" @click="handleBatchEdit('air')">{{$t('批量设置空运价格')}}</el-button>
</template>
<!--指定商品-->
<el-button v-if="$route.query.product_id" type="primary" v-hasPermi="['ecw:product-price:single_product']" @click="batchSetSingleProductPrice">{{$t('批量设置单个商品的路线')}}</el-button>
</el-col>
<!-- <el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
v-hasPermi="['ecw:product-price:export']">{{ $t('导出') }}</el-button>
</el-col> -->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
......@@ -249,10 +233,12 @@ import DictTag from '@/components/DictTag'
import {arrryToKeyedObjectBy} from '@/utils/index'
import { getProduct } from '@/api/ecw/product';
import {parseTime} from '@/utils/ruoyi'
import Template from "@/views/cms/template";
export default {
name: "EcwProductpriceIndex",
filters: {parseTime},
components: {
Template,
DictTag
},
data() {
......@@ -640,8 +626,8 @@ export default {
this.$router.push('../../lineProject/product-price/edit?action=batchUpdate&product_id=' + this.$route.query.product_id + '&ids=' + this.ids)
},
// 批量设置路线
handleBatchEdit() {
this.$router.push('../../lineProject/batch-edit')
handleBatchEdit(type) {
this.$router.push('../../lineProject/batch-edit-' + type)
},
/** 修改按钮操作 */
handleUpdate(row, readonly) {
......
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