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

修复新建订单,商品属性批量编辑等bug

parent 6f257f86
...@@ -48,19 +48,11 @@ export default { ...@@ -48,19 +48,11 @@ export default {
}, },
'formData.country'(country){ 'formData.country'(country){
this.$emit('countryChange', country) this.$emit('countryChange', country)
/* this.treeList.forEach(item => { this.$set(this.formData, 'province', undefined)
if(item.id == country){
this.provinceList = item.children || []
}
}) */
}, },
'formData.province'(province){ 'formData.province'(province){
this.$emit('provinceChange', province) this.$emit('provinceChange', province)
/* this.provinceList.forEach(item => { this.$set(this.formData, 'city', '')
if(item.id == province){
this.cityList = item.children || []
}
}) */
} }
}, },
computed:{ computed:{
......
...@@ -11,6 +11,11 @@ ...@@ -11,6 +11,11 @@
</el-select> </el-select>
<el-input v-model="queryParams.titleZh" :placeholder="$t('产品关键字')" style="width:120px" clearable /> <el-input v-model="queryParams.titleZh" :placeholder="$t('产品关键字')" style="width:120px" clearable />
<el-button type="primary" @click="reLoad">{{$t('搜索')}}</el-button> <el-button type="primary" @click="reLoad">{{$t('搜索')}}</el-button>
<div v-if="showAll">
<el-checkbox :label="$t('全选(最多500)')" @change="toggleAll"></el-checkbox>
<el-checkbox :label="$t('全选库内商品(共{cnt}个)', {cnt: total})" v-model="isAllProduct"></el-checkbox>
</div>
</div> </div>
<div class="list"> <div class="list">
<div class="item" v-for="item in list" :key="item.id"> <div class="item" v-for="item in list" :key="item.id">
...@@ -23,7 +28,7 @@ ...@@ -23,7 +28,7 @@
<div class="flex-1 ml-10"> <div class="flex-1 ml-10">
<el-card style="height:100%"> <el-card style="height:100%">
<div slot="header" class="header"> <div slot="header" class="header">
{{$t('已选产品')}} {{$t('已选{cnt}个产品', {cnt: isAllProduct ? total : choosedList.length})}}
</div> </div>
<div class="list"> <div class="list">
<div class="item" v-for="(choosed) in choosedList" :key="choosed.id" :data-data="JSON.stringify(choosed)"> <div class="item" v-for="(choosed) in choosedList" :key="choosed.id" :data-data="JSON.stringify(choosed)">
...@@ -47,13 +52,15 @@ export default { ...@@ -47,13 +52,15 @@ export default {
default: () => { default: () => {
return [] return []
} }
} },
showAll: Boolean
}, },
data() { data() {
return { return {
list: [], list: [],
page: 1, page: 1,
pages: 1, pages: 1,
total: 0, // 商品总数
queryParams: { queryParams: {
pageNo: 1, pageNo: 1,
pageSize: 500, pageSize: 500,
...@@ -63,7 +70,8 @@ export default { ...@@ -63,7 +70,8 @@ export default {
}, },
choosedList: [], choosedList: [],
typeList: [], typeList: [],
attrList: [] attrList: [],
isAllProduct: false
} }
}, },
computed: { computed: {
...@@ -83,6 +91,9 @@ export default { ...@@ -83,6 +91,9 @@ export default {
watch: { watch: {
ids(val) { ids(val) {
this.$emit('input', val) this.$emit('input', val)
},
isAllProduct(isAllProduct){
this.$emit('setall', isAllProduct)
} }
}, },
created() { created() {
...@@ -92,6 +103,14 @@ export default { ...@@ -92,6 +103,14 @@ export default {
this.ids = this.defaultIds //数据回显 this.ids = this.defaultIds //数据回显
}, },
methods: { methods: {
/* setAllProduct(status){
this.isAllProduct = true
}, */
toggleAll(status){
this.list.forEach(item => {
this.toggleCheck(item, status)
})
},
reLoad() { reLoad() {
this.queryParams.page = 1 this.queryParams.page = 1
this.list = [] this.list = []
...@@ -109,6 +128,7 @@ export default { ...@@ -109,6 +128,7 @@ export default {
this.list = res.data.list //.concat(res.data.list || []) this.list = res.data.list //.concat(res.data.list || [])
this.page = res.data.page this.page = res.data.page
this.pages = res.data.pages this.pages = res.data.pages
this.total = res.data.total
this.choosedList = [] //搜搜重置,数据回显 this.choosedList = [] //搜搜重置,数据回显
if (this.defaultIds.length > 0) { if (this.defaultIds.length > 0) {
this.defaultIds.map(item => { this.defaultIds.map(item => {
...@@ -129,7 +149,9 @@ export default { ...@@ -129,7 +149,9 @@ export default {
} }
}, },
choose(item) { choose(item) {
this.choosedList.push(item) if(!this.choosedList.find(it => it.id == item.id)){
this.choosedList.push(item)
}
}, },
remove(item) { remove(item) {
this.choosedList.forEach((choosed, index) => { this.choosedList.forEach((choosed, index) => {
......
...@@ -176,7 +176,7 @@ ...@@ -176,7 +176,7 @@
</el-table-column> </el-table-column>
<el-table-column :label="$t('数量') + '(个)'" width="120px"> <el-table-column :label="$t('数量') + '(个)'" width="120px">
<template slot-scope="{row}"> <template slot-scope="{row}">
<el-input v-model="row.quantity" type="number" :disabled="!canAddProduct || !productEditable" /> <el-input v-model="row.quantity" type="number" @keyup.native="checkQuantity(row)" :disabled="!canAddProduct || !productEditable" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="$t('总体积') + '(m³)'" width="100px"> <el-table-column :label="$t('总体积') + '(m³)'" width="100px">
...@@ -588,6 +588,7 @@ export default { ...@@ -588,6 +588,7 @@ export default {
contactChooseType: null, // 联系人选择对象consignor(发货人) 或者 consignee(收货人) contactChooseType: null, // 联系人选择对象consignor(发货人) 或者 consignee(收货人)
quickCreateType: null, // 快速新建客户类型,1发货人,2收货人 quickCreateType: null, // 快速新建客户类型,1发货人,2收货人
showWorkFlow: false, // 是否显示工作流表单 showWorkFlow: false, // 是否显示工作流表单
calculating: false, // 是否正在计算费用,防止频繁重新请求
}; };
}, },
computed:{ computed:{
...@@ -740,9 +741,15 @@ export default { ...@@ -740,9 +741,15 @@ export default {
this.$set(this.form, 'lineId', undefined) this.$set(this.form, 'lineId', undefined)
this.getOpenedRouterList() this.getOpenedRouterList()
}, },
'form.channelId'(){
this.calculationPrice()
},
'form.lineId'(lineId){ 'form.lineId'(lineId){
let router = this.routerList.find(item => item.id == lineId) let router = this.routerList.find(item => item.id == lineId)
if(!router) return if(!router){
console.log('未选择路线', router, lineId, JSON.stringify(this.routerList))
return
}
this.$set(this.form, 'departureId', router.startCityId) this.$set(this.form, 'departureId', router.startCityId)
this.$set(this.form, 'objectiveId', router.destCityId) this.$set(this.form, 'objectiveId', router.destCityId)
...@@ -911,10 +918,12 @@ export default { ...@@ -911,10 +918,12 @@ export default {
}, },
setLink(row){ setLink(row){
this.$prompt(this.$t('请输入商品链接'), {inputValue: row.link}).then(({value}) => { this.$prompt(this.$t('请输入商品链接'), {inputValue: row.link}).then(({value}) => {
console.log('value', value)
this.$set(row, 'link', value) this.$set(row, 'link', value)
}) })
}, },
checkQuantity(row){
row.quantity = row.quantity.replace(/[^\d]/g, '')
},
/* onFileChoosed(e){ /* onFileChoosed(e){
window.choosed = e window.choosed = e
console.log('onFileChoosed', e) console.log('onFileChoosed', e)
...@@ -1070,12 +1079,14 @@ export default { ...@@ -1070,12 +1079,14 @@ export default {
calcable = false calcable = false
} }
}) })
console.log('calculationPrice', calcable)
if(this.calculating || !calcable) return false if(this.calculating || !calcable) return false
this.calculating = true this.calculating = true
console.log('calculating ---> ')
calculationPrice({ calculationPrice({
lineId: this.form.lineId, lineId: this.form.lineId,
transportId: this.form.transportId, transportId: this.form.transportId,
channelId: this.form.channelId, channelId: [3,4].indexOf(this.form.transportId) > -1 ? this.form.channelId : undefined,
prodConditionParamList: this.getProductListWithDefaultValue() prodConditionParamList: this.getProductListWithDefaultValue()
}).then(res => { }).then(res => {
this.$set(this, 'fee', res.data.costDto) this.$set(this, 'fee', res.data.costDto)
......
...@@ -33,8 +33,7 @@ ...@@ -33,8 +33,7 @@
+{{order.consigneeVO.countryCode}} {{order.consigneeVO.phone}} +{{order.consigneeVO.countryCode}} {{order.consigneeVO.phone}}
</el-form-item> </el-form-item>
<el-form-item :label="$t('收货地址')"> <el-form-item :label="$t('收货地址')">
<!--缺少国城名字--> <el-input v-model="form.deliverAddress" placeholder=""></el-input>
{{order.consigneeVO.address}}
</el-form-item> </el-form-item>
<el-form-item :label="$t('快递单号')"> <el-form-item :label="$t('快递单号')">
<el-input v-model="form.trackingNumber" placeholder=""></el-input> <el-input v-model="form.trackingNumber" placeholder=""></el-input>
...@@ -73,6 +72,13 @@ export default { ...@@ -73,6 +72,13 @@ export default {
form: {} form: {}
} }
}, },
watch:{
'form.pickType'(type){
if(type == 1 && this.order.consigneeVO.address){
this.$set(this.form, 'deliverAddress', this.order.consigneeVO.address)
}
}
},
created(){ created(){
this.loadOrderData() this.loadOrderData()
}, },
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<el-form ref="form" :model="form" :rules="rules" label-width="120px"> <el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-form-item :label="$t('适用商品')" prop="idList"> <el-form-item :label="$t('适用商品')" prop="idList">
<products-selector :defaultIds="form.idList" v-model="form.idList" /> <products-selector :defaultIds="form.idList" v-model="form.idList" show-all @setall="toggleAll" />
</el-form-item> </el-form-item>
<el-form-item :label="$t('货柜位置')" prop="containerLocation"> <el-form-item :label="$t('货柜位置')" prop="containerLocation">
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
</el-checkbox-group> </el-checkbox-group>
</el-form-item> </el-form-item>
<el-form-item :label="$t('商品材质')" prop="materialType"> <el-form-item :label="$t('商品材质')" prop="materialType">
<dict-selector form-type="checkbox" :type="DICT_TYPE.ECW_PRODUCT_MATERIAL" v-model="form.materialType" multiple /> <dict-selector form-type="checkbox" :type="DICT_TYPE.ECW_PRODUCT_MATERIAL" v-model="form.materialTypeArr" multiple />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
...@@ -68,7 +68,7 @@ export default { ...@@ -68,7 +68,7 @@ export default {
"containerLocation": undefined, "containerLocation": undefined,
"dayLimit": undefined, "dayLimit": undefined,
"idList": [], "idList": [],
"isAllProduct": undefined, "isAllProduct": 0,
"needBook": false, "needBook": false,
"packaging": undefined, "packaging": undefined,
"requirements": undefined, "requirements": undefined,
...@@ -84,12 +84,15 @@ export default { ...@@ -84,12 +84,15 @@ export default {
}, },
watch: { watch: {
'form.idList'(val) { /* 'form.idList'(val) {
if (val.length > 0) { if (val.length > 0) {
this.form.isAllProduct = 0 this.form.isAllProduct = 0
} else { } else {
this.form.isAllProduct = 1 this.form.isAllProduct = 1
} }
}, */
'form.materialTypeArr'(typeArr){
this.$set(this.form, 'form.materialTyp', typeArr.join(','))
}, },
attrIds(val){ attrIds(val){
this.form.attrId = val.join(',') this.form.attrId = val.join(',')
...@@ -103,6 +106,9 @@ export default { ...@@ -103,6 +106,9 @@ export default {
}) })
}, },
methods: { methods: {
toggleAll(e){
this.$set(this.form, 'isAllProduct', e ? 1 : 0)
},
/** 表单重置 */ /** 表单重置 */
reset() { reset() {
this.form = { this.form = {
...@@ -110,7 +116,7 @@ export default { ...@@ -110,7 +116,7 @@ export default {
"containerLocation": undefined, "containerLocation": undefined,
"dayLimit": undefined, "dayLimit": undefined,
"idList": [], "idList": [],
"isAllProduct": undefined, "isAllProduct": 0,
"needBook": undefined, "needBook": undefined,
"packaging": undefined, "packaging": undefined,
"requirements": undefined, "requirements": undefined,
...@@ -127,9 +133,12 @@ export default { ...@@ -127,9 +133,12 @@ export default {
return; return;
} }
let data = Object.assign({}, this.form) let data = Object.assign({}, this.form)
if(!data.isAllProduct && !data.idList.length){
return this.$message(this.$t('请选择商品或勾选全部'))
}
batchUpdateProduct(data).then((response) => { batchUpdateProduct(data).then((response) => {
this.$modal.msgSuccess(this.$t("修改成功")); this.$modal.msgSuccess(this.$t("修改成功"));
this.$router.back(); this.$store.dispatch('tagsView/delCurrentView')
}); });
}); });
}, },
......
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