Commit 8a7e6896 authored by 邓春圆's avatar 邓春圆

添加优惠活动

parent c464a206
......@@ -78,4 +78,11 @@ export function calculationPrice(data){
method: 'post',
data: data
})
}
\ No newline at end of file
}
//新增商品可用优惠信息列表
export function product_coupon_newProd(){
return request({
url:'/product/coupon/newProd/list',
method:'get',
})
}
......@@ -106,9 +106,9 @@
<el-table-column :label="$t('修改时间')" align="center">
<template slot-scope="scope">
<span>{{parseTime(scope.row.updateTime)}}</span>
</template>
</el-table-column>
<span>{{parseTime(scope.row.updateTime)}}</span>
</template>
</el-table-column>
<!-- <el-table-column prop="status" align="center" :label="$t('状态')" width="120">
<template slot-scope="scope">
......@@ -206,11 +206,24 @@
<el-radio v-model.number="form.needBook" :label="1">{{$t('是')}}</el-radio>
<el-radio v-model.number="form.needBook" :label="0">{{$t('否')}}</el-radio>
</el-form-item>
<!-- <el-form-item :label="$t('可参与优惠活动')" prop="you">
<el-select v-model="form.you" :placeholder="$t('可参与优惠活动')" clearable>
<el-option v-for="packageItem in packagingList" :key="packageItem.value" :label="packageItem.label" :value="packageItem.value" />
</el-select>
</el-form-item> -->
<el-form-item v-if="this.form.id == null " :label="$t('可参与优惠')">
<!-- <el-select multiple v-model="form.couponlds" size="5" style="min-width: 300px; border:1px solid #DCDFE6; border-radius:4px">-->
<!-- <el-option v-for="item in preferentialList" :value="item.couponId" :label="item.titleZh" :key="item.couponId" :disabled="item.mandatory">{{item.titleZh}}</el-option>-->
<!-- </el-select>-->
<div style="width: 300px;height: 400px;border: 1px solid;overflow-y: auto">
<div @click="selectMoveAbout(item)" style="display: flex;justify-content: space-between; align-items: center;" :style="{'cursor':item.mandatory ? 'no-drop' : 'pointer' }" v-for="item in preferentialList">
<div>
{{$l(item, 'title')}}
</div>
<i v-if="form.couponIds.includes(item.couponId)" style="margin-right: 20px;" class="el-icon-check"></i>
</div>
</div>
</el-form-item>
<!-- <el-form-item :label="$t('可参与优惠活动')" prop="you">
<el-select v-model="form.you" :placeholder="$t('可参与优惠活动')" clearable>
<el-option v-for="packageItem in packagingList" :key="packageItem.value" :label="packageItem.label" :value="packageItem.value" />
</el-select>
</el-form-item> -->
<el-form-item :label="$t('每日入仓上限')" prop="dayLimit" v-if="form.needBook==1">
<el-input v-model.number="form.dayLimit" type="number">
<template slot="append">{{$t('立方米')}}</template>
......@@ -227,7 +240,15 @@
</template>
<script>
import { createProduct, updateProduct, deleteProduct, getProduct, getProductPage, exportProductExcel } from "@/api/ecw/product";
import {
createProduct,
updateProduct,
deleteProduct,
getProduct,
getProductPage,
exportProductExcel,
product_coupon_newProd
} from "@/api/ecw/product";
import { getProductAttrList } from "@/api/ecw/productAttr";
import { getProductTypeList } from "@/api/ecw/productType";
import { getDictDatas, DICT_TYPE } from '@/utils/dict';
......@@ -305,7 +326,8 @@ export default {
auditStatusDictDatas: getDictDatas(DICT_TYPE.AUDIT_STATUS),
materialList: getDictDatas(DICT_TYPE.ECW_PRODUCT_MATERIAL),
packagingList: getDictDatas(DICT_TYPE.ECW_PACKAGING_TYPE),
locationList: getDictDatas(DICT_TYPE.ECW_CONTAINER_LOCATION)
locationList: getDictDatas(DICT_TYPE.ECW_CONTAINER_LOCATION),
preferentialList:[],
};
},
......@@ -360,6 +382,10 @@ export default {
this.getAttrList();
this.getTypeList();
this.getList();
product_coupon_newProd().then(r => {
this.preferentialList = r.data
this.reset()
})
},
methods: {
/** 获取产品属性列表 */
......@@ -433,8 +459,11 @@ export default {
auditStatus: undefined,
status: undefined,
requirements: 0,
needBook: 0
needBook: 0,
couponIds:[],
};
let c = this.preferentialList.filter(i => i.isDefault).map(i => i.couponId)
this.form.couponIds = c
this.resetForm("form");
},
/** 搜索按钮操作 */
......@@ -485,7 +514,6 @@ export default {
}
//商品特性转字符串
this.form.attrId = this.form.attrArray.join(',');
// 修改的提交
if (this.form.id != null) {
updateProduct(this.form).then(response => {
......@@ -576,7 +604,21 @@ export default {
ids: this.ids
}
});
},
selectMoveAbout(val){
if(!val.mandatory){
let index = this.form.couponIds.findIndex(i => val.couponId == i)
if(index >= 0){
this.form.couponIds.splice(index,1)
}else {
this.form.couponIds.push(val.couponId)
}
}
}
}
};
</script>
<style lang="scss" scoped>
</style>
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