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

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

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