|
@@ -46,7 +46,6 @@
|
|
<a-input-number
|
|
<a-input-number
|
|
style="width:100%"
|
|
style="width:100%"
|
|
id="promotionEdit-sort"
|
|
id="promotionEdit-sort"
|
|
- :disabled="isDisabled"
|
|
|
|
allowClear
|
|
allowClear
|
|
placeholder="请输入排序数字(数字越大越靠后)"
|
|
placeholder="请输入排序数字(数字越大越靠后)"
|
|
v-model="form.sort"
|
|
v-model="form.sort"
|
|
@@ -104,7 +103,6 @@
|
|
<a-form-model-item label="促销描述" prop="description">
|
|
<a-form-model-item label="促销描述" prop="description">
|
|
<a-input
|
|
<a-input
|
|
v-model="form.description"
|
|
v-model="form.description"
|
|
- :disabled="isDisabled"
|
|
|
|
type="textarea"
|
|
type="textarea"
|
|
id="promotionEdit-description"
|
|
id="promotionEdit-description"
|
|
placeholder="请输入促销描述(最多500个字符)"
|
|
placeholder="请输入促销描述(最多500个字符)"
|
|
@@ -277,12 +275,11 @@
|
|
<a-button
|
|
<a-button
|
|
type="primary"
|
|
type="primary"
|
|
id="promotionEdit-addSet-btn"
|
|
id="promotionEdit-addSet-btn"
|
|
- :disabled="isDisabled"
|
|
|
|
class="button-primary"
|
|
class="button-primary"
|
|
size="small"
|
|
size="small"
|
|
@click="handleBatchAdd">批量设置</a-button>
|
|
@click="handleBatchAdd">批量设置</a-button>
|
|
</div>
|
|
</div>
|
|
- <a-button type="primary" id="promotionEdit-add-btn" :disabled="isDisabled" @click="handleAddProduct" size="small">选择产品</a-button>
|
|
|
|
|
|
+ <a-button type="primary" id="promotionEdit-add-btn" @click="showProModal = true" size="small">选择产品</a-button>
|
|
</div>
|
|
</div>
|
|
</a-form-model-item>
|
|
</a-form-model-item>
|
|
</a-col>
|
|
</a-col>
|
|
@@ -317,8 +314,6 @@
|
|
<!-- 添加产品 -->
|
|
<!-- 添加产品 -->
|
|
<chooseProduct
|
|
<chooseProduct
|
|
ref="chooseProduct"
|
|
ref="chooseProduct"
|
|
- :chooseType="chooseTypeList"
|
|
|
|
- :itemSn="$route.params.sn"
|
|
|
|
:openModal="showProModal"
|
|
:openModal="showProModal"
|
|
@ok="addProductSuccess"
|
|
@ok="addProductSuccess"
|
|
@close="closeProductModal"></chooseProduct>
|
|
@close="closeProductModal"></chooseProduct>
|
|
@@ -352,8 +347,7 @@ export default {
|
|
},
|
|
},
|
|
productRangeList: [], // 产品范围列表
|
|
productRangeList: [], // 产品范围列表
|
|
dateFormat: 'YYYY-MM-DD', // 促销时间显示格式
|
|
dateFormat: 'YYYY-MM-DD', // 促销时间显示格式
|
|
- openDealerModal: false,
|
|
|
|
-
|
|
|
|
|
|
+ openDealerModal: false, // 打开选择经销商弹窗
|
|
pageType: undefined, // 促销类型
|
|
pageType: undefined, // 促销类型
|
|
// 链接配置内容
|
|
// 链接配置内容
|
|
form: {
|
|
form: {
|
|
@@ -388,10 +382,6 @@ export default {
|
|
promotionName: '', // 促销名称
|
|
promotionName: '', // 促销名称
|
|
showProModal: false, // 打开产品弹窗
|
|
showProModal: false, // 打开产品弹窗
|
|
isShowNextStep: false, // 是否显示下一步 并提交一半配置产品
|
|
isShowNextStep: false, // 是否显示下一步 并提交一半配置产品
|
|
- isDisabled: false, // 控制页面是否能编辑
|
|
|
|
- chooseTypeList: [], // 已选中产品范围
|
|
|
|
- imageSet: [], // 回显显示图片数据
|
|
|
|
- productTypeList: [], // 产品范围 列表数据
|
|
|
|
// 表单验证规则
|
|
// 表单验证规则
|
|
rules: {
|
|
rules: {
|
|
promoName: [{ required: true, message: '请输入促销名称', trigger: 'blur' }],
|
|
promoName: [{ required: true, message: '请输入促销名称', trigger: 'blur' }],
|
|
@@ -411,12 +401,14 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ // 参与经销商 change
|
|
changeDealerScope () {},
|
|
changeDealerScope () {},
|
|
- addDealerOk () {},
|
|
|
|
- // 选择经销商
|
|
|
|
|
|
+ // 部分 打开选择经销商弹窗
|
|
handleDealerModal () {
|
|
handleDealerModal () {
|
|
this.openDealerModal = true
|
|
this.openDealerModal = true
|
|
},
|
|
},
|
|
|
|
+ // 添加参与经销商成功
|
|
|
|
+ addDealerOk () {},
|
|
// 关闭经销商弹窗
|
|
// 关闭经销商弹窗
|
|
closeDealerModal () {
|
|
closeDealerModal () {
|
|
this.openDealerModal = false
|
|
this.openDealerModal = false
|
|
@@ -445,13 +437,7 @@ export default {
|
|
this.timeLimit = []
|
|
this.timeLimit = []
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- // 打开产品弹窗
|
|
|
|
- insterProduct (obj) {
|
|
|
|
- if (obj && Object.keys(obj).length > 0) {
|
|
|
|
- this.chooseTypeList = obj.typeArr
|
|
|
|
- }
|
|
|
|
- this.showProModal = true
|
|
|
|
- },
|
|
|
|
|
|
+ // 选择优惠方式 change
|
|
async handleDiscountType (val) {
|
|
async handleDiscountType (val) {
|
|
this.form.discountType = val
|
|
this.form.discountType = val
|
|
this.resultValue = undefined
|
|
this.resultValue = undefined
|
|
@@ -460,6 +446,24 @@ export default {
|
|
this.$refs.chooseProductList.pageInit()
|
|
this.$refs.chooseProductList.pageInit()
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ // 添加产品成功
|
|
|
|
+ addProductSuccess (list) {
|
|
|
|
+ const productArr = list.map(item => {
|
|
|
|
+ return {
|
|
|
|
+ promoSn: this.form.promoSn,
|
|
|
|
+ shopProductSn: item.shopProductSn,
|
|
|
|
+ productSn: item.productSn,
|
|
|
|
+ productCode: item.productCode
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ saveChooseProduct(productArr).then(res => {
|
|
|
|
+ if (res.status == 200) {
|
|
|
|
+ this.showProModal = false
|
|
|
|
+ // 获取产品列表 有分页
|
|
|
|
+ this.$refs.chooseProductList.pageInit()
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
// 关闭产品弹窗
|
|
// 关闭产品弹窗
|
|
closeProductModal () {
|
|
closeProductModal () {
|
|
this.showProModal = false
|
|
this.showProModal = false
|
|
@@ -522,25 +526,25 @@ export default {
|
|
const _this = this
|
|
const _this = this
|
|
_this.form.promoType = _this.pageType
|
|
_this.form.promoType = _this.pageType
|
|
var formData = JSON.parse(JSON.stringify(_this.form))
|
|
var formData = JSON.parse(JSON.stringify(_this.form))
|
|
|
|
+ if (formData.promoType === 'BUY_PROD_GIVE_VALID') {
|
|
|
|
+ if (formData.validType === 'FIXED') {
|
|
|
|
+ if (!formData.validStartDate || !formData.validEndDate) {
|
|
|
|
+ _this.$message.warning('请输入券有效期!')
|
|
|
|
+ return false
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ if (!formData.validDays) {
|
|
|
|
+ _this.$message.warning('请输入券有效期!')
|
|
|
|
+ return false
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
if (type === 'all') {
|
|
if (type === 'all') {
|
|
formData.productNum = _this.$refs.chooseProductList.getChooseProductNum()
|
|
formData.productNum = _this.$refs.chooseProductList.getChooseProductNum()
|
|
if (formData.productNum && formData.productNum == 0) {
|
|
if (formData.productNum && formData.productNum == 0) {
|
|
_this.$message.warning('请先选择产品!')
|
|
_this.$message.warning('请先选择产品!')
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- if (formData.promoType === 'BUY_PROD_GIVE_VALID') {
|
|
|
|
- if (formData.validType === 'FIXED') {
|
|
|
|
- if (!formData.validStartDate || !formData.validEndDate) {
|
|
|
|
- _this.$message.warning('请输入券有效期!')
|
|
|
|
- return false
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- if (!formData.validDays) {
|
|
|
|
- _this.$message.warning('请输入券有效期!')
|
|
|
|
- return false
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
delete formData.productNum
|
|
delete formData.productNum
|
|
}
|
|
}
|
|
delete formData.time
|
|
delete formData.time
|
|
@@ -587,17 +591,6 @@ export default {
|
|
},
|
|
},
|
|
// 重置
|
|
// 重置
|
|
resetSearchForm () {
|
|
resetSearchForm () {
|
|
- if (this.pageType == 'add' || (this.pageType == 'edit' && !this.isDisabled)) {
|
|
|
|
- if (this.$refs.imageSet) {
|
|
|
|
- this.$refs.imageSet.setFileList('')
|
|
|
|
- }
|
|
|
|
- if (this.$refs.videoSet) {
|
|
|
|
- this.$refs.videoSet.setFileList('')
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if (this.$refs.editor) {
|
|
|
|
- this.$refs.editor.setHtml('')
|
|
|
|
- }
|
|
|
|
this.form = {
|
|
this.form = {
|
|
promoType: undefined, // 促销类型
|
|
promoType: undefined, // 促销类型
|
|
promoName: '', // '促销名称'
|
|
promoName: '', // '促销名称'
|
|
@@ -623,20 +616,12 @@ export default {
|
|
validInfo: '', // 使用说明
|
|
validInfo: '', // 使用说明
|
|
productNum: 0
|
|
productNum: 0
|
|
}
|
|
}
|
|
|
|
+ this.$refs.imageSet.setFileList('')
|
|
this.isShowNextStep = false
|
|
this.isShowNextStep = false
|
|
- this.isDisabled = false
|
|
|
|
- if (this.$refs.ruleForm) {
|
|
|
|
- this.$refs.ruleForm.resetFields()
|
|
|
|
- }
|
|
|
|
if (this.$refs.ruleForm) {
|
|
if (this.$refs.ruleForm) {
|
|
this.$refs.ruleForm.resetFields()
|
|
this.$refs.ruleForm.resetFields()
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- // 添加产品
|
|
|
|
- handleAddProduct () {
|
|
|
|
- this.chooseTypeList = this.productRangeList
|
|
|
|
- this.showProModal = true
|
|
|
|
- },
|
|
|
|
// 批量设置
|
|
// 批量设置
|
|
handleBatchAdd () {
|
|
handleBatchAdd () {
|
|
if (!this.conditionValue && !this.resultValue) {
|
|
if (!this.conditionValue && !this.resultValue) {
|
|
@@ -645,24 +630,6 @@ export default {
|
|
}
|
|
}
|
|
this.$refs.chooseProductList.editMorePrice({ conditionValue: this.conditionValue, resultValue: this.resultValue })
|
|
this.$refs.chooseProductList.editMorePrice({ conditionValue: this.conditionValue, resultValue: this.resultValue })
|
|
},
|
|
},
|
|
- // 添加产品成功
|
|
|
|
- addProductSuccess (list) {
|
|
|
|
- const productArr = list.map(item => {
|
|
|
|
- return {
|
|
|
|
- promoSn: this.form.promoSn,
|
|
|
|
- shopProductSn: item.shopProductSn,
|
|
|
|
- productSn: item.productSn,
|
|
|
|
- productCode: item.productCode
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- saveChooseProduct(productArr).then(res => {
|
|
|
|
- if (res.status == 200) {
|
|
|
|
- this.showProModal = false
|
|
|
|
- // 获取产品列表 有分页
|
|
|
|
- this.$refs.chooseProductList.pageInit()
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
// 初始化
|
|
// 初始化
|
|
pageInit () {
|
|
pageInit () {
|
|
if (this.$route.params.pageType === 'edit') {
|
|
if (this.$route.params.pageType === 'edit') {
|