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

批量设置阶梯价

parent ed961b1e
...@@ -228,7 +228,12 @@ export default { ...@@ -228,7 +228,12 @@ export default {
if(!this.form.channelPackagingList === null ){ if(!this.form.channelPackagingList === null ){
this.form.channelPackagingList = []; this.form.channelPackagingList = [];
} }
if(this.form.attrId){
this.form.attrId = this.form.attrId.split(',').map(i => +i) this.form.attrId = this.form.attrId.split(',').map(i => +i)
}else {
this.form.attrId = []
}
this.form.channelPackagingList.forEach(item =>{ this.form.channelPackagingList.forEach(item =>{
item.packagingTypes = item.packagingTypes.split(',') || [] item.packagingTypes = item.packagingTypes.split(',') || []
}) })
......
...@@ -130,7 +130,7 @@ ...@@ -130,7 +130,7 @@
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" @pagination="getList" /> <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 v-if="open" ref="form" :model="form" :rules="rules" label-width="110px">
<el-form-item :label="$t('商品类型')" prop="typeId"> <el-form-item :label="$t('商品类型')" prop="typeId">
<el-select v-model="form.typeId" :placeholder="$t('选择商品类型')" clearable> <el-select v-model="form.typeId" :placeholder="$t('选择商品类型')" clearable>
...@@ -231,7 +231,7 @@ ...@@ -231,7 +231,7 @@
<span> <span>
复制模板线路价格:{{lineNum}}个 复制模板线路价格:{{lineNum}}个
</span> </span>
<span style="color: #0a84ff;cursor: pointer;"> <span @click="toPriceManager(formCopy)" style="color: #0a84ff;cursor: pointer;">
查看《#选择空运商品模板名称#》路线价格 查看《#选择空运商品模板名称#》路线价格
</span> </span>
</p> </p>
...@@ -323,6 +323,7 @@ export default { ...@@ -323,6 +323,7 @@ export default {
form: { form: {
}, },
formCopy:{},
// 表单校验 // 表单校验
rules: { rules: {
typeId: [{ required: true, message: this.$t("商品类型不能为空"), trigger: "change" }], typeId: [{ required: true, message: this.$t("商品类型不能为空"), trigger: "change" }],
...@@ -414,7 +415,9 @@ export default { ...@@ -414,7 +415,9 @@ export default {
}, },
methods: { methods: {
copyLine(val , bol){ copyLine(val , bol){
this.formCopy = val;
let copy = ()=>{ let copy = ()=>{
if(val.priceStepClearanceList.length === 0) return this.form.priceStepClearanceList = []
this.form.airWeightLimit = val.airWeightLimit; this.form.airWeightLimit = val.airWeightLimit;
val.priceStepClearanceList.forEach((item ,index) =>{ val.priceStepClearanceList.forEach((item ,index) =>{
if(this.form.priceStepClearanceList[index]){ if(this.form.priceStepClearanceList[index]){
...@@ -655,10 +658,6 @@ export default { ...@@ -655,10 +658,6 @@ export default {
this.exportLoading = false; this.exportLoading = false;
}).catch(() => { }); }).catch(() => { });
}, },
// 覆盖默认的上传行为
requestUpload() {
},
// 上传预处理 // 上传预处理
beforeUpload(file) { beforeUpload(file) {
if (file.type.indexOf("image/") == -1) { if (file.type.indexOf("image/") == -1) {
......
...@@ -35,13 +35,26 @@ ...@@ -35,13 +35,26 @@
<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.materialTypeArr" multiple /> <dict-selector form-type="checkbox" :type="DICT_TYPE.ECW_PRODUCT_MATERIAL" v-model="form.materialTypeArr" multiple />
</el-form-item> </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-form-item>
<el-button type="primary" @click="submitForm">{{$t('确定')}}</el-button> <el-button type="primary" @click="submitForm">{{$t('确定')}}</el-button>
<el-button @click="$router.back()">{{$t('返回')}}</el-button> <el-button @click="$router.back()">{{$t('返回')}}</el-button>
<el-button type="default" @click="reset">{{$t('重置')}}</el-button> <el-button type="default" @click="reset">{{$t('重置')}}</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-dialog :visible.sync="visible" >
<product-dialog @copyLine="copyLine"></product-dialog>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
...@@ -53,11 +66,16 @@ import RoutersSelector from '@/components/RoutersSelector' ...@@ -53,11 +66,16 @@ import RoutersSelector from '@/components/RoutersSelector'
import ProductsSelector from '@/components/ProductsSelector' import ProductsSelector from '@/components/ProductsSelector'
import Editor from '@/components/Editor' import Editor from '@/components/Editor'
import Selector from '@/components/Selector/index' 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 { export default {
name: "AttrEdit", name: "EcwProductattrEdit",
components: { CustomersSelector, RoutersSelector, ProductsSelector, Editor, Selector }, components: {ProductDialog, PackagingType, CustomersSelector, RoutersSelector, ProductsSelector, Editor, Selector },
data() { data() {
return { return {
formCopv:{},
lineNum:0,
visible:false,
// 遮罩层 // 遮罩层
loading: true, loading: true,
attrList: [], attrList: [],
...@@ -69,11 +87,14 @@ export default { ...@@ -69,11 +87,14 @@ export default {
"dayLimit": undefined, "dayLimit": undefined,
"idList": [], "idList": [],
"isAllProduct": 0, "isAllProduct": 0,
"needBook": false, "needBook": undefined,
"packaging": undefined, "packaging": undefined,
"requirements": undefined, "requirements": undefined,
"square": undefined, "square": undefined,
"materialType": undefined "materialType": undefined,
priceStepClearanceList:[],
priceLineCount:undefined,
isCopyProductPriceTemplate:false,
}, },
// 表单校验 // 表单校验
rules: {}, rules: {},
...@@ -105,7 +126,71 @@ export default { ...@@ -105,7 +126,71 @@ export default {
this.attrList = res.data 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: { 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){ toggleAll(e){
this.$set(this.form, 'isAllProduct', e ? 1 : 0) this.$set(this.form, 'isAllProduct', e ? 1 : 0)
}, },
...@@ -121,26 +206,35 @@ export default { ...@@ -121,26 +206,35 @@ export default {
"packaging": undefined, "packaging": undefined,
"requirements": undefined, "requirements": undefined,
"square": undefined, "square": undefined,
"materialType": undefined "materialType": undefined,
priceStepClearanceList:[],
priceLineCount:undefined,
isCopyProductPriceTemplate:false,
materialTypeArr:[],
}; };
this.attrIds = []
this.resetForm("form"); this.resetForm("form");
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
this.$refs["form"].validate((valid) => { this.reset()
if (!valid) { console.log(this.form.priceStepClearanceList,'priceStepClearanceList')
return; // this.$refs["form"].validate((valid) => {
} // if (!valid) {
let data = Object.assign({}, this.form) // return;
if(!data.isAllProduct && !data.idList.length){ // }
return this.$message(this.$t('请选择商品或勾选全部')) // let data = Object.assign({}, this.form)
} // if(!data.isAllProduct && !data.idList.length){
batchUpdateProduct(data).then((response) => { // return this.$message(this.$t('请选择商品或勾选全部'))
this.$modal.msgSuccess(this.$t("修改成功")); // }
this.$store.dispatch('tagsView/delCurrentView') // 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