Commit 91131da6 authored by dragondean@qq.com's avatar dragondean@qq.com

修复bug,完善路线价格和商品批量修改

parent ffcacc51
......@@ -83,10 +83,10 @@ export default {
computed:{
importCityList(){
return this.tradeCityList.filter(item => item.type == 1)
return this.tradeCityList.filter(item => item.type == 1 || item.type == 3)
},
exportCityList(){
return this.tradeCityList.filter(item => item.type == 2)
return this.tradeCityList.filter(item => item.type == 2 || item.type == 3)
},
availChannelList(){
return this.channelList.filter(item => !this.channelId || this.channelId == item.channelId)
......@@ -197,7 +197,8 @@ export default {
if(selected){
this.selectedRoutes.push({
lineId: router.id,
channelId: router.channel.channelId
channelId: router.channel.channelId,
transportId: router.transportType
})
}else{
let index = this.getSelectedIndex(router)
......
......@@ -66,14 +66,14 @@
<el-descriptions-item label="*始发城市" :labelStyle="labelStyle">
<el-form-item label="" label-width="0" style="margin-bottom: 0" prop="departureId" required error="始发地必选">
<el-select v-model="form.departureId" placeholder="请选择始发地">
<el-option v-for="item in expoerCityList" :label="item.titleZh" :value="item.id" :key="item.id"></el-option>
<el-option v-for="item in exportCityList" :label="item.titleZh" :value="item.id" :key="item.id"></el-option>
</el-select>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="*目的城市" :labelStyle="labelStyle">
<el-form-item label="" label-width="0" style="margin-bottom: 0" prop="objectiveId" required error="目的城市必选">
<el-select v-model="form.objectiveId" placeholder="请选择目的地">
<el-option v-for="item in importCityList" :label="item.titleZh" :value="item.id" :key="item.id"></el-option>
<el-option v-for="item in importCityList" :label="item.titleZh" :value="item.id" :key="item.id"></el-option>
</el-select>
</el-form-item>
</el-descriptions-item>
......@@ -316,7 +316,7 @@
<el-descriptions-item label="入仓类型">
<dict-selector :type="DICT_TYPE.ECW_WAREHOUSING_TYPE" v-model="form.warehouseType" />
<dict-selector :type="DICT_TYPE.ECW_WAREHOUSING_TYPE" v-model="form.warehouseType" defaultable />
</el-descriptions-item>
<el-descriptions-item label="收货方式">
<dict-selector :type="DICT_TYPE.ECW_HARVEST_METHOD" v-model="form.harvestMethod" :filter="item => item.value == 1 || homeDeliveryService" defaultable />
......@@ -494,11 +494,25 @@ export default {
};
},
computed:{
expoerCityList(){
return this.tradeCityList.filter(item => item.type == 2)
exportCityList(){
return this.tradeCityList.filter(item => item.type == 2 || item.type == 3)
},
importCityList(){
return this.tradeCityList.filter(item => item.type == 1)
return this.tradeCityList.filter(item => item.type == 1 || item.type == 3)
},
exportCityIds(){
let ids = []
this.exportCityList.forEach(item => {
ids.push(item.id)
})
return ids
},
importCityIds(){
let ids = []
this.importCityList.forEach(item => {
ids.push(item.id)
})
return ids
},
getDictData(){
return (type, value) => getDictData(type, value) || {}
......@@ -506,17 +520,6 @@ export default {
getDictDatas(){
return getDictDatas
},
// 根据线路id显示线路名称
/* getRouterNameById(){
return routerId => {
let router = this.routerList.find(item => item.id == routerId)
if(router){
return router.startTitleZh + ' > ' + router.destTitleZh
}
return '-'
}
}, */
selectedRouter(){
// otherService 1 送货上门,2非控货订单代收货款
if(!this.form.lineId)return null
......@@ -740,7 +743,9 @@ export default {
if(this.form.transportId){
params.transportType = this.form.transportId
}
getOpenedRouterList(params).then(res => this.routerList = res.data)
getOpenedRouterList(params).then(res => this.routerList = res.data.filter(item => {
return this.exportCityIds.indexOf(item.startCityId) > -1 && this.importCityIds.indexOf(item.destCityId) > -1
}))
},
// 计算体积
calcVolume(row){
......
......@@ -133,7 +133,7 @@
<template slot-scope="{row}">{{row.totalNum}}箱/{{row.sumNum}}</template>
</el-table-column>
<el-table-column label="体积/重量" align="center" prop="sumWeight">
<template slot-scope="{row}">{{row.totalVolume}}m³ /{{row.totalWeight}}Kg</template>
<template slot-scope="{row}">{{row.sumVolume}}m³ /{{row.sumWeight}}Kg</template>
</el-table-column>
<el-table-column label="始发仓" align="center" prop="departureName" />
<el-table-column label="运输方式/目的地" align="center" prop="transportId">
......
......@@ -11,7 +11,7 @@
<div class="line">路线:{{order.logisticsInfoDto.startTitleZh}} >> {{order.logisticsInfoDto.destTitleZh}}</div>
<div class="line">商品列表:
<span v-for="(item, index) in order.orderItemVOList" :key="index">
{{item.titleZh}}
{{item.prodTitleZh}}
<template v-if="index < order.orderItemVOList.length - 1"></template>
</span>
</div>
......
......@@ -172,13 +172,13 @@
</el-select>
</el-form-item>
<el-form-item label="默认方数要求" prop="square">
<el-form-item label="订单方数上限" prop="square">
<el-input v-model.number="form.square" type="number">
<!-- <template slot="append">立方米</template> -->
</el-input>
</el-form-item>
<el-form-item label="需要预约入仓" prop="needBook">
<el-form-item label="预约入仓" prop="needBook">
<el-radio v-model.number="form.needBook" :label="1"></el-radio>
<el-radio v-model.number="form.needBook" :label="0"></el-radio>
</el-form-item>
......
......@@ -12,22 +12,25 @@
<el-form-item label="出运要求" prop="requirements">
<el-checkbox true-label="1" v-model="form.requirements">证书要求(支持多证书)</el-checkbox>
</el-form-item>
<el-form-item label="方数要求" prop="square">
<el-input v-model="form.square" placeholder="" style="width: 200px"></el-input>
<el-form-item label="订单方数上限" prop="square">
<el-input v-model="form.square" placeholder="" class="w-200"></el-input>
</el-form-item>
<el-form-item label="包装要求" prop="packaging">
<dict-selector :type="DICT_TYPE.ECW_PACKAGING_TYPE" v-model="form.packaging" />
</el-form-item>
<el-form-item label="需要预约入仓" prop="needBook">
<el-form-item label="是否预约入仓" prop="needBook">
<dict-selector formatter="bool" form-type="radio" :type="DICT_TYPE.ECW_YESNO" v-model="form.needBook" :formater="Boolean" />
</el-form-item>
<el-form-item label="每日入仓上限" prop="dayLimit">
<el-input placeholder="" v-model="form.dayLimit" style="width: 200px">
<el-form-item label="每日入仓上限" prop="dayLimit" v-if="form.needBook">
<el-input placeholder="" v-model="form.dayLimit" class="w-200">
<template slot="suffix">立方米</template>
</el-input>
</el-form-item>
<el-form-item label="商品特性" prop="attrId">
<dict-selector form-type="checkbox" :type="DICT_TYPE.ECW_ORDER_ATTR" v-model="form.attrId" multiple />
<!-- <dict-selector form-type="checkbox" :type="DICT_TYPE.ECW_ORDER_ATTR" v-model="form.attrId" multiple /> -->
<el-checkbox-group v-model="attrIds">
<el-checkbox v-for="item in attrList" :label="item.id" :key="item.id">{{item.attrName}}</el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item label="商品材质" prop="materialType">
<dict-selector form-type="checkbox" :type="DICT_TYPE.ECW_PRODUCT_MATERIAL" v-model="form.materialType" multiple />
......@@ -43,7 +46,7 @@
</template>
<script>
import { batchUpdateProduct } from '@/api/ecw/product';
import { getProductAttrList } from "@/api/ecw/productAttr";
import CustomersSelector from '@/components/CustomersSelector'
import { getDictData } from '@/utils/dict'
import RoutersSelector from '@/components/RoutersSelector'
......@@ -57,6 +60,8 @@ export default {
return {
// 遮罩层
loading: true,
attrList: [],
attrIds:[],
// 表单参数
form: {
"attrId": undefined,
......@@ -64,7 +69,7 @@ export default {
"dayLimit": undefined,
"idList": [],
"isAllProduct": undefined,
"needBook": undefined,
"needBook": false,
"packaging": undefined,
"requirements": undefined,
"square": undefined,
......@@ -85,11 +90,17 @@ export default {
} else {
this.form.isAllProduct = 1
}
},
attrIds(val){
this.form.attrId = val.join(',')
}
},
created() {
this.reset()
this.form.idList = this.$route.query && this.$route.query.ids ? [...this.$route.query.ids].map(item => { return Number(item) }) : []
getProductAttrList().then(res => {
this.attrList = res.data
})
},
methods: {
/** 表单重置 */
......@@ -100,7 +111,7 @@ export default {
"dayLimit": undefined,
"idList": [],
"isAllProduct": undefined,
"needBook": undefined,
"needBook": false,
"packaging": undefined,
"requirements": undefined,
"square": undefined,
......
<template>
<div class="app-container">
<el-form ref="form" :model="form" :rules="rules" label-width="150px">
<products-selector v-model="form.productIdList" class="mb-20" />
<routers-selector v-model="selectedRoutes" />
<el-card style="margin-bottom: 10px">
<div slot="header" style="font-size:20px;">
价格设置
<span>
<el-checkbox label="" @change="form.advanceStatus=$event ? 1 : 0">预付</el-checkbox>
<el-checkbox label="" @change="form.stepPrice=$event ? 1 : 0">阶梯订单</el-checkbox>
</span>
</div>
<el-form-item label="单价模式" prop="priceType">
<dict-selector :type="DICT_TYPE.ECW_PRICE_TYPE" v-model="form.priceType" form-type="radio" defaultable />
</el-form-item>
<!--阶梯订单-->
<template v-if="form.stepPrice==1" >
<div v-for="(item, index) in priceStepList" :key="index">
<div style="font-size:14px; margin:10px 0">
{{index+1}}阶梯定价方案:
<template v-if="index == priceStepList.length - 1">
<el-link type="primary" @click.native="priceStepList.push({})">添加区间</el-link>
<el-divider direction="vertical"></el-divider>
<el-link type="danger" @click.native="priceStepList.splice(index, 1)">删除</el-link>
</template>
</div>
<el-form-item :label="`第${index+1}阶梯`">
<el-input v-model="item.startNum" type="number" placeholder="" class="w100"></el-input>
-
<el-input v-model="item.endNum" type="number" placeholder="" class="w100"></el-input>
/
<selector v-model="form.weightUnit" :options="unitList" label-field="titleZh" value-field="id" defaultable class="w100" />
</el-form-item>
<el-form-item label="默认运费" v-if="form.priceType != 1">
<inputor default="0" v-model.number="item.transportPrice" type="number" placeholder="整数或者两位小数" class="w100 mr10" />
<selector v-model="item.transportPriceUnit" :options="currencyList" label-field="titleZh" value-field="id" defaultable class="w100" />
/ <selector v-model="item.transportVolumeUnit" :options="unitList" label-field="titleZh" value-field="id" defaultable class="w100" />
</el-form-item>
<el-form-item label="默认清关费" v-if="form.priceType != 1">
<inputor default="0" v-model.number="item.clearancePrice" type="number" placeholder="整数或者两位小数" class="w100 mr10" />
<selector v-model="item.clearancePriceUnit" :options="currencyList" label-field="titleZh" value-field="id" defaultable class="w100" />
/ <selector v-model="item.clearanceVolumeUnit" :options="unitList" label-field="titleZh" value-field="id" defaultable class="w100" />
</el-form-item>
<el-form-item label="默认全包价" v-if="form.priceType == 1">
<inputor default="0" v-model.number="item.allPrice" type="number" placeholder="整数或者两位小数" class="w100 mr10" />
<selector v-model="item.allPriceUnit" :options="currencyList" label-field="titleZh" value-field="id" defaultable class="w100" />
/ <selector v-model="item.allVolumeUnit" :options="unitList" label-field="titleZh" value-field="id" defaultable class="w100" />
</el-form-item>
</div>
</template>
<template v-else>
<el-form-item label="默认全包价" v-if="form.priceType == 1">
<inputor default="0" v-model.number="form.allPrice" type="number" placeholder="整数或者两位小数" class="w100 mr10" />
<selector v-model="form.allPriceUnit" :options="currencyList" label-field="titleZh" value-field="id" defaultable class="w100" />
/ <selector v-model="form.allVolumeUnit" :options="unitList" label-field="titleZh" value-field="id" defaultable class="w100" />
</el-form-item>
<template v-else>
<el-form-item label="默认运费" prop="transportPrice">
<el-row :gutter="20">
<el-col :span="4">
<selector v-model="form.transportPriceUnit" :options="currencyList" label-field="titleZh" value-field="id" defaultable class="w-100" />
</el-col>
<el-col :span="6">
<inputor default="0" v-model.number="form.transportPrice" type="number" placeholder="整数或者两位小数" />
</el-col>
<el-col :span="4">
/ <selector v-model="form.transportVolumeUnit" :options="unitList" label-field="titleZh" value-field="id" defaultable class="w-100" />
</el-col>
</el-row>
</el-form-item>
<el-form-item label="默认清关费" prop="clearancePrice">
<el-row :gutter="20">
<el-col :span="4">
<selector v-model="form.clearancePriceUnit" :options="currencyList" label-field="titleZh" value-field="id" defaultable class="w-100" />
</el-col>
<el-col :span="6">
<inputor default="0" v-model.number="form.clearancePrice" type="number" placeholder="整数或者两位小数" />
</el-col>
<el-col :span="4">
/
<selector v-model="form.clearanceVolumeUnit" :options="unitList" label-field="titleZh" value-field="id" defaultable class="w-100" />
</el-col>
</el-row>
</el-form-item>
</template>
<!--特需-->
<template v-if="form.priceType==1">
<el-form-item
v-for="(special, specialIndex) in this.specialProducts"
:label="getDictDataLabel(DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS, special.specialDictType) + '全包价'"
:key="specialIndex + 'transport'">
<el-row :gutter="20">
<el-col :span="4">
<selector v-model="special.allPriceUnit" :options="currencyList" label-field="titleZh" value-field="id" defaultable class="w-100" />
</el-col>
<el-col :span="6">
<inputor default="0" v-model.number="special.allPrice" type="number" placeholder="整数或者两位小数" />
</el-col>
<el-col :span="4">
/ <selector v-model="special.allVolumeUnit" :options="unitList" label-field="titleZh" value-field="id" defaultable class="w-100" />
</el-col>
</el-row>
</el-form-item>
</template>
<template v-else v-for="(special, specialIndex) in this.specialProducts">
<el-form-item
:label="getDictDataLabel(DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS, special.specialDictType) + '运费'"
:key="specialIndex + 'transport'">
<el-row :gutter="20">
<el-col :span="4">
<selector v-model="special.transportPriceUnit" :options="currencyList" label-field="titleZh" value-field="id" defaultable class="w-100" />
</el-col>
<el-col :span="6">
<inputor default="0" v-model.number="special.transportPrice" type="number" placeholder="整数或者两位小数" />
</el-col>
<el-col :span="4">
/ <selector v-model="special.transportVolumeUnit" :options="unitList" label-field="titleZh" value-field="id" defaultable class="w-100" />
</el-col>
</el-row>
</el-form-item>
<el-form-item
:label="getDictDataLabel(DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS, special.specialDictType) + '清关费'"
:key="specialIndex + 'clearance'">
<el-row :gutter="20">
<el-col :span="4">
<selector v-model="special.clearancePriceUnit" :options="currencyList" label-field="titleZh" value-field="id" defaultable class="w-100" />
</el-col>
<el-col :span="6">
<inputor default="0" v-model.number="special.clearancePrice" type="number" placeholder="整数或者两位小数" />
</el-col>
<el-col :span="4">
/ <selector v-model="special.clearanceVolumeUnit" :options="unitList" label-field="titleZh" value-field="id" defaultable class="w-100" />
</el-col>
</el-row>
</el-form-item>
</template>
</template>
<!-- <el-form-item label="是否预付" prop="advanceStatus">
<dict-selector form-type="radio" :type="DICT_TYPE.ADVANCE_STATUS" v-model="form.advanceStatus" />
</el-form-item> -->
</el-card>
<el-card>
<div slot="header" style="font-size:20px;">
基础信息
</div>
<el-form-item label="是否预约入仓" prop="needBook">
<el-radio v-model.number="form.needBook" :label="1"></el-radio>
<el-radio v-model.number="form.needBook" :label="0"></el-radio>
</el-form-item>
<el-form-item label="每日入仓上限" prop="dayLimit" v-if="form.needBook == 1">
<el-input v-model.number="form.dayLimit" type="number" class="w-100" />立方米
</el-form-item>
<el-form-item label="货柜位置" prop="containerLocation">
<dict-selector :type="DICT_TYPE.ECW_CONTAINER_LOCATION" v-model="form.containerLocation" />
</el-form-item>
<el-form-item label="订单方数上限" prop="square">
<el-input v-model.number="form.square" type="number" style="width:200px" />
</el-form-item>
</el-card>
</el-form>
<div style="margin: 20px 0">
<el-button @click="submitForm" type="primary">确认提交</el-button>
<el-button type="default" @click="$router.back()">返回上一页</el-button>
</div>
</div>
</template>
<script>
import RoutersSelector from '@/components/RoutersSelector'
import { createProductPrice, updateProductPrice, batchUpdateProductPrice, deleteProductPrice, getProductPrice, getProductPriceList, getProductPricePage, exportProductPriceExcel } from "@/api/ecw/productPrice";
import { getProductType, getProductTypeList } from '@/api/ecw/productType'
import { getCurrencyList } from '@/api/ecw/currency';
import { getUnitList } from '@/api/ecw/unit';
import ProductsSelector from '@/components/ProductsSelector'
import { arrryToKeyedObjectBy } from '@/utils/index'
import Selector from '@/components/Selector'
import Inputor from '@/components/Inputor'
export default {
components: { RoutersSelector, ProductsSelector, Selector, Inputor },
data() {
return {
checkList: [],
selectedRoutes: [], // 勾选的路线渠道
form: {
stepPrice: 0,
advanceStatus: 0,
needBook: 0,
dayLimit: 10000
},
specialProducts: [],
priceStepList: [{},{}], // 阶梯价格
// specialList:[], // 特殊需求,默认四个
rules: {
/* typeId: [{ required: true, message: "产品类型不能为空", trigger: "blur" }],
titleZh: [{ required: true, message: "产品名称不能为空", trigger: "blur" }],
titleEn: [{ required: true, message: "英文名称不能为空", trigger: "blur" }], */
transportPrice: [{ required: true, message: "海运费不能为空", trigger: "blur" }],
clearancePrice: [{ required: true, message: "清关费不能为空", trigger: "blur" }],
advanceStatus: [{ required: true, message: "是否预付不能为空", trigger: "blur" }],
//containerLocation: [{ required: true, message: "货柜位置不能为空", trigger: "blur" }],
//square: [{ required: true, message: "方数不能为空", trigger: "blur" }],
// zhongLinjie:[{ required: true, message: "默认重货标准不能为空", trigger: "blur" }],
// paoLinjie:[{ required: true, message: "默认泡货标准不能为空", trigger: "blur" }],
// needBook: [{ required: true, message: "预约入仓不能为空", trigger: "blur" }],
},
product: null,
/* productType: null, */
currencyList: [],
unitList: [],
productTypeList: [],
productDisabled: true,
lineList: [] //路线数组
}
},
computed: {
},
watch: {
checkList() { //选择路线
if (this.checkList.length > 0) {
this.form.lineChannelList = this.checkList.map(item => {
return { lineId: item, shippingChannelId: 0 }
})
} else {
this.form.lineChannelList = []
}
},
product() {
this.$set(this.form, 'productType', this.product.typeId)
/* getProductType(this.product.typeId).then(res => {
this.productType = res.data
}) */
},
form(val) {
if (!val) return
// 特殊需求回显
if (val.specialList) {
let keyed = arrryToKeyedObjectBy(val.specialList, 'specialDictType')
this.specialProducts.map((item, index) => {
if (keyed[item.specialDictType]) {
for (let field in item) {
if (keyed[item.specialDictType][field]) {
item[field] = keyed[item.specialDictType][field]
}
}
}
})
}
},
'form.transportVolumeUnit'(val){
this.specialProducts.forEach(item => {
item.transportVolumeUnit = val
})
},
'form.clearanceVolumeUnit'(val){
this.specialProducts.forEach(item => {
item.clearanceVolumeUnit = val
})
},
'form.allVolumeUnit'(val){
this.specialProducts.forEach(item => {
item.allVolumeUnit = val
})
},
selectedRoutes(routers) {
let transportIds = []
routers.forEach(item => {
item.shippingChannelId = item.channelId
transportIds.push(+item.transportId)
})
// 如果只选择了空运(3),则默认体积单位改成千克
transportIds = new Set(transportIds)
console.log(transportIds)
window.transportIds = transportIds
if(transportIds.size == 1 && transportIds.has(3)){
this.setDefaultVolumeUnit(6)
}else this.setDefaultVolumeUnit(7)
}
},
async created() {
/* this.productDisabled = false
// 获取类型列表
getProductTypeList().then(res => this.productTypeList = res.data) */
/* if (this.$route.query.product_type) {
this.$set(this.form, 'productType', +this.$route.query.product_type)
}
if (this.$route.query.product_id) {
this.$set(this.form, 'productId', +this.$route.query.product_id)
}
*/
// 默认费用单位
this.setDefaultVolumeUnit(7)
getCurrencyList().then(res => this.currencyList = res.data)
getUnitList().then(res => this.unitList = res.data)
this.getDictDatas(this.DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS).forEach(item => {
this.specialProducts.push({
"clearancePrice": null,
"clearancePriceUnit": null,
"clearanceVolumeUnit": null,
"specialDictType": item.value,
"transportPrice": null,
"transportPriceUnit": null,
"transportVolumeUnit": null,
})
})
},
methods: {
setDefaultVolumeUnit(unit){
this.$set(this.form, 'transportVolumeUnit', unit)
this.$set(this.form, 'clearanceVolumeUnit', unit)
this.$set(this.form, 'allVolumeUnit', unit)
},
submitForm() {
this.$refs["form"].validate(valid => {
if (!valid) {
return;
}
// 只有新增的时候做判断
if (!this.$route.query.ids && (!this.selectedRoutes || !this.selectedRoutes.length)) {
this.$message.error('请选择线路');
return;
}
let data = Object.assign({}, this.form, {
// lineChannelList: this.selectedRoutes,
specialList: this.specialProducts,
isAllProduct: this.form.productIdList.length == 0 ? 1 : 0
})
if(this.form.stepPrice == 1){
data.priceStepList = this.priceStepList
}
data.lineChannelList = this.selectedRoutes
if(data.lineChannelList.length < 1){
return this.$message.error('请选择需要修改的路线')
}
batchUpdateProductPrice(data).then(response => {
this.$modal.msgSuccess("修改成功");
this.$router.replace('/lineProject/product-price?' + (new URLSearchParams(this.$route.query)).toString())
})
});
},
}
}
</script>
<style scoped>
.w100{
width: 100px;
}
.mr10{
margin-right: 10px;
}
</style>
\ No newline at end of file
......@@ -294,12 +294,12 @@
基础信息
</div>
<el-form-item label="需要预约入仓" prop="needBook">
<el-form-item label="是否预约入仓" prop="needBook">
<el-radio v-model.number="form.needBook" :label="1"></el-radio>
<el-radio v-model.number="form.needBook" :label="0"></el-radio>
</el-form-item>
<el-form-item label="每日入仓上限" prop="dayLimit">
<el-form-item label="每日入仓上限" prop="dayLimit" v-if="form.needBook == 1">
<el-input v-model.number="form.dayLimit" type="number">
<template slot="append">立方米</template>
</el-input>
......@@ -311,7 +311,7 @@
</el-select>
</el-form-item>
<el-form-item label="方数要求" prop="square">
<el-form-item label="订单方数上限" prop="square">
<el-input v-model.number="form.square" type="number">
<!-- <template slot="append">立方米</template> -->
</el-input>
......
......@@ -2,7 +2,7 @@
<div class="app-container">
<el-form ref="form" :model="form" :rules="rules" label-width="150px">
<el-form-item label="商品类型" prop="typeId">
<el-form-item label="商品类型" prop="productType">
<el-select v-model="form.productType" :disabled="!!$route.query.ids">
<el-option v-for="type in productTypeList" :key="type.id" :label="type.titleZh" :value="type.id" />
</el-select>
......@@ -209,12 +209,12 @@
基础信息
</div>
<el-form-item label="需要预约入仓" prop="needBook">
<el-form-item label="是否预约入仓" prop="needBook">
<el-radio v-model.number="form.needBook" :label="1"></el-radio>
<el-radio v-model.number="form.needBook" :label="0"></el-radio>
</el-form-item>
<el-form-item label="每日入仓上限" prop="dayLimit">
<el-form-item label="每日入仓上限" prop="dayLimit" v-if="form.needBook == 1">
<el-input v-model.number="form.dayLimit" type="number" class="w-100" />立方米
</el-form-item>
......@@ -222,7 +222,7 @@
<dict-selector :type="DICT_TYPE.ECW_CONTAINER_LOCATION" v-model="form.containerLocation" />
</el-form-item>
<el-form-item label="方数要求" prop="square">
<el-form-item label="订单方数上限" prop="square">
<el-input v-model.number="form.square" type="number" style="width:200px" />
</el-form-item>
</el-card>
......@@ -253,7 +253,9 @@ export default {
selectedRoutes: [], // 勾选的路线渠道
form: {
stepPrice: 0,
advanceStatus: 0
advanceStatus: 0,
needBook: 0,
dayLimit: 10000
},
specialProducts: [],
priceStepList: [{},{}], // 阶梯价格
......@@ -269,7 +271,7 @@ export default {
//square: [{ required: true, message: "方数不能为空", trigger: "blur" }],
// zhongLinjie:[{ required: true, message: "默认重货标准不能为空", trigger: "blur" }],
// paoLinjie:[{ required: true, message: "默认泡货标准不能为空", trigger: "blur" }],
needBook: [{ required: true, message: "预约入仓不能为空", trigger: "blur" }],
// needBook: [{ required: true, message: "预约入仓不能为空", trigger: "blur" }],
},
product: null,
/* productType: null, */
......@@ -293,11 +295,12 @@ export default {
this.form.lineChannelList = []
}
},
/* product() {
getProductType(this.product.typeId).then(res => {
product() {
this.$set(this.form, 'productType', this.product.typeId)
/* getProductType(this.product.typeId).then(res => {
this.productType = res.data
})
}, */
}) */
},
form(val) {
if (!val) return
// 特殊需求回显
......@@ -314,10 +317,35 @@ export default {
})
}
},
'form.transportVolumeUnit'(val){
this.specialProducts.forEach(item => {
item.transportVolumeUnit = val
})
},
'form.clearanceVolumeUnit'(val){
this.specialProducts.forEach(item => {
item.clearanceVolumeUnit = val
})
},
'form.allVolumeUnit'(val){
this.specialProducts.forEach(item => {
item.allVolumeUnit = val
})
},
selectedRoutes(routers) {
let transportIds = []
routers.forEach(item => {
item.shippingChannelId = item.channelId
transportIds.push(+item.transportId)
})
// 如果只选择了空运(3),则默认体积单位改成千克
transportIds = new Set(transportIds)
console.log(transportIds)
window.transportIds = transportIds
if(transportIds.size == 1 && transportIds.has(3)){
this.setDefaultVolumeUnit(6)
}else this.setDefaultVolumeUnit(7)
}
},
async created() {
......@@ -355,7 +383,9 @@ export default {
this.product = res.data
}) */
}
// 默认费用单位
this.setDefaultVolumeUnit(7)
}
/* // 指定产品
else
......@@ -379,6 +409,11 @@ export default {
})
},
methods: {
setDefaultVolumeUnit(unit){
this.$set(this.form, 'transportVolumeUnit', unit)
this.$set(this.form, 'clearanceVolumeUnit', unit)
this.$set(this.form, 'allVolumeUnit', unit)
},
submitForm() {
this.$refs["form"].validate(valid => {
if (!valid) {
......@@ -400,7 +435,7 @@ export default {
}
// 修改的提交
if (this.$route.query.ids) {
if (this.$route.query.action == 'update') {
if(this.lineList.length == 1){
data.lineChannelList = {
lineId: this.lineList[0].warehouseLineId,
......@@ -409,7 +444,6 @@ export default {
}else{
data.lineChannelList = []
this.lineList.forEach(item => {
console.log(item.id, this.checkList.indexOf(item.id) > -1)
if(this.checkList.indexOf(item.id) > -1){
data.lineChannelList.push({
lineId: item.warehouseLineId,
......
......@@ -66,11 +66,13 @@
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['ecw:product-price:create']">新建价格</el-button>
</el-col>
<el-col :span="1.5">
<el-button v-if="!$route.query.product_id" type="primary" plain icon="el-icon-setting" size="mini" @click="handleBatchEdit" :disabled="multiple">设置已选路线价格</el-button>
<!--未指定商品-->
<el-button v-if="!$route.query.product_id" type="primary" plain icon="el-icon-setting" size="mini" @click="handleBatchEdit">批量设置价格</el-button>
<el-button v-if="!$route.query.product_id" type="primary" plain icon="el-icon-setting" size="mini" @click="handleBatchEdit" :disabled="multiple">批量加入黑名单</el-button>
<el-button v-if="!$route.query.product_id" type="primary" plain icon="el-icon-setting" size="mini" @click="handleBatchEdit" :disabled="multiple">批量下架</el-button>
<el-button type="primary" plain icon="el-icon-setting" size="mini" @click="handleBatchEdit" :disabled="multiple">批量设置路线</el-button>
<!--指定商品-->
<el-button v-if="$route.query.product_id" type="primary" plain icon="el-icon-setting" size="mini" @click="batchSetSingleProductPrice">批量设置单个商品的路线路线</el-button>
</el-col>
<!-- <el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
......@@ -381,14 +383,23 @@ export default {
activated() {
console.log('activated')
let typeId = this.$route.query.product_type;
if(typeId) {
if(!this.queryParams.typeId || this.queryParams.typeId != typeId)
this.$set(this.queryParams, 'typeId', +typeId);
}
this.$set(this.queryParams, 'typeId', +this.$route.query.product_type || null)
this.handleQuery()
},
watch:{
'$route.query.product_id'(){
console.log(this.$route.query)
if(!this.$route.query.product_id){
return this.product = null
}
if(!this.product || this.$route.query.product_id == this.product.id){
getProduct(this.$route.query.product_id).then(res => {
this.product = res.data
})
}
}
},
created() {
// this.transportDatas = getDictDatas(DICT_TYPE.ECW_TRANSPORT_TYPE);
// console.log(this.transportDatas);
......@@ -571,9 +582,12 @@ export default {
return this.$router.push('../../lineProject/product-price/edit?' + (new URLSearchParams(this.$route.query)).toString())
},
batchSetSingleProductPrice(){
this.$router.push('../../lineProject/product-price/edit?action=update&product_id=' + this.$route.query.product_id + '&ids=' + this.ids)
},
// 批量设置路线
handleBatchEdit() {
this.$router.push('../../lineProject/product-price/edit?ids=' + this.ids)
this.$router.push('../../lineProject/batch-edit')
},
/** 修改按钮操作 */
handleUpdate(row) {
......
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