Commit 7fb46a5d authored by 邓春圆's avatar 邓春圆

批量设置阶梯价

parent ed961b1e
......@@ -228,7 +228,12 @@ export default {
if(!this.form.channelPackagingList === null ){
this.form.channelPackagingList = [];
}
if(this.form.attrId){
this.form.attrId = this.form.attrId.split(',').map(i => +i)
}else {
this.form.attrId = []
}
this.form.channelPackagingList.forEach(item =>{
item.packagingTypes = item.packagingTypes.split(',') || []
})
......
......@@ -130,7 +130,7 @@
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" @pagination="getList" />
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="title" :visible.sync="open" width="850px" append-to-body>
<el-dialog :modal-append-to-body="false" :title="title" :visible.sync="open" width="850px" >
<el-form v-if="open" ref="form" :model="form" :rules="rules" label-width="110px">
<el-form-item :label="$t('商品类型')" prop="typeId">
<el-select v-model="form.typeId" :placeholder="$t('选择商品类型')" clearable>
......@@ -231,7 +231,7 @@
<span>
复制模板线路价格:{{lineNum}}个
</span>
<span style="color: #0a84ff;cursor: pointer;">
<span @click="toPriceManager(formCopy)" style="color: #0a84ff;cursor: pointer;">
查看《#选择空运商品模板名称#》路线价格
</span>
</p>
......@@ -323,6 +323,7 @@ export default {
form: {
},
formCopy:{},
// 表单校验
rules: {
typeId: [{ required: true, message: this.$t("商品类型不能为空"), trigger: "change" }],
......@@ -414,7 +415,9 @@ export default {
},
methods: {
copyLine(val , bol){
this.formCopy = val;
let copy = ()=>{
if(val.priceStepClearanceList.length === 0) return this.form.priceStepClearanceList = []
this.form.airWeightLimit = val.airWeightLimit;
val.priceStepClearanceList.forEach((item ,index) =>{
if(this.form.priceStepClearanceList[index]){
......@@ -655,10 +658,6 @@ export default {
this.exportLoading = false;
}).catch(() => { });
},
// 覆盖默认的上传行为
requestUpload() {
},
// 上传预处理
beforeUpload(file) {
if (file.type.indexOf("image/") == -1) {
......
......@@ -35,13 +35,26 @@
<el-form-item :label="$t('商品材质')" prop="materialType">
<dict-selector form-type="checkbox" :type="DICT_TYPE.ECW_PRODUCT_MATERIAL" v-model="form.materialTypeArr" multiple />
</el-form-item>
<packaging-type key-arr="priceStepClearanceList" v-model="form">
<el-button @click="visible = true; open = false;" type="text">选择空运模板</el-button>
</packaging-type>
<p v-if="lineNum">
<span>
复制模板线路价格:{{lineNum}}个
</span>
<span @click="toPriceManager(formCopv)" style="color: #0a84ff;cursor: pointer;">
查看《#选择空运商品模板名称#》路线价格
</span>
</p>
<el-form-item>
<el-button type="primary" @click="submitForm">{{$t('确定')}}</el-button>
<el-button @click="$router.back()">{{$t('返回')}}</el-button>
<el-button type="default" @click="reset">{{$t('重置')}}</el-button>
</el-form-item>
</el-form>
<el-dialog :visible.sync="visible" >
<product-dialog @copyLine="copyLine"></product-dialog>
</el-dialog>
</div>
</template>
<script>
......@@ -53,11 +66,16 @@ import RoutersSelector from '@/components/RoutersSelector'
import ProductsSelector from '@/components/ProductsSelector'
import Editor from '@/components/Editor'
import Selector from '@/components/Selector/index'
import PackagingType from "@/views/ecw/channel/componrnts/packaging-type.vue";
import ProductDialog from "@/views/ecw/product/product-dialog.vue";
export default {
name: "AttrEdit",
components: { CustomersSelector, RoutersSelector, ProductsSelector, Editor, Selector },
name: "EcwProductattrEdit",
components: {ProductDialog, PackagingType, CustomersSelector, RoutersSelector, ProductsSelector, Editor, Selector },
data() {
return {
formCopv:{},
lineNum:0,
visible:false,
// 遮罩层
loading: true,
attrList: [],
......@@ -69,11 +87,14 @@ export default {
"dayLimit": undefined,
"idList": [],
"isAllProduct": 0,
"needBook": false,
"needBook": undefined,
"packaging": undefined,
"requirements": undefined,
"square": undefined,
"materialType": undefined
"materialType": undefined,
priceStepClearanceList:[],
priceLineCount:undefined,
isCopyProductPriceTemplate:false,
},
// 表单校验
rules: {},
......@@ -105,7 +126,71 @@ export default {
this.attrList = res.data
})
},
activated() {
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: {
/**跳转价格管理 */
toPriceManager(row) {
/* localStorage.setItem('product', JSON.stringify(row));
localStorage.setItem('typeList', JSON.stringify(this.typeList)); */
this.$router.push({
name: 'ProductPrice',
query: {
product_id: row.id,
product_type: row.typeId
}
})
},
copyLine(val , bol){
this.formCopv = val
let copy = ()=>{
this.form.airWeightLimit = val.airWeightLimit;
val.priceStepClearanceList.forEach((item ,index) =>{
if(this.form.priceStepClearanceList[index]){
this.form.priceStepClearanceList[index].clearancePrice = item.clearancePrice
this.form.priceStepClearanceList[index].clearancePriceUnit = item.clearancePriceUnit
this.form.priceStepClearanceList[index].clearanceVolumeUnit = item.clearanceVolumeUnit
}else {
let p = {
"channelId":'',
"clearancePrice":item.clearancePrice,
"clearancePriceUnit":item.clearancePriceUnit,
"clearanceVolumeUnit":item.clearanceVolumeUnit,
"endNum":'',
"packagingId":'',
"startNum":'',
"weightUnit":''
}
this.form.priceStepClearanceList.push(p)
}
})
}
this.visible = false;
if(bol){
this.$confirm(`请确认是否要将#${this.$l(val,'title')}#的所有路线价格复制到当前商品#${this.$l(this.form,'title')}#中?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.form.priceLineCount = val.id;
this.lineNum = val.priceStepClearanceCount;
this.form.priceLineCount = val.id;
this.isCopyProductPriceTemplate = true;
copy()
this.open = true;
}).catch(() => {
this.open = true;
});
}else {
this.open = true;
copy()
}
this.$forceUpdate()
},
toggleAll(e){
this.$set(this.form, 'isAllProduct', e ? 1 : 0)
},
......@@ -121,26 +206,35 @@ export default {
"packaging": undefined,
"requirements": undefined,
"square": undefined,
"materialType": undefined
"materialType": undefined,
priceStepClearanceList:[],
priceLineCount:undefined,
isCopyProductPriceTemplate:false,
materialTypeArr:[],
};
this.attrIds = []
this.resetForm("form");
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate((valid) => {
if (!valid) {
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.$store.dispatch('tagsView/delCurrentView')
});
});
this.reset()
console.log(this.form.priceStepClearanceList,'priceStepClearanceList')
// this.$refs["form"].validate((valid) => {
// if (!valid) {
// 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.$forceUpdate()
// // 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