|
@@ -26,14 +26,16 @@
|
|
|
:maxLength="20"></a-input>
|
|
|
</a-form-model-item>
|
|
|
<a-form-model-item label="规则门槛" prop="gateFlag">
|
|
|
- <a-radio-group v-model="form.gateFlag" button-style="solid" size="small" @change="changeGateFlag">
|
|
|
- <a-radio value="1">
|
|
|
- 有
|
|
|
- </a-radio>
|
|
|
- <a-radio value="0">
|
|
|
- 无
|
|
|
- </a-radio>
|
|
|
- </a-radio-group>
|
|
|
+ <div class="fixWidthBox">
|
|
|
+ <a-radio-group v-model="form.gateFlag" button-style="solid" size="small" @change="changeGateFlag">
|
|
|
+ <a-radio-button value="1">
|
|
|
+ 有
|
|
|
+ </a-radio-button>
|
|
|
+ <a-radio-button value="0">
|
|
|
+ 无
|
|
|
+ </a-radio-button>
|
|
|
+ </a-radio-group>
|
|
|
+ </div>
|
|
|
<div v-if="form.gateFlag && form.gateFlag === '1'">
|
|
|
<v-select
|
|
|
size="small"
|
|
@@ -41,21 +43,21 @@
|
|
|
v-model="form.gateType"
|
|
|
id="promotionList-gateType"
|
|
|
code="PROMOTION_GATE_TYPE"
|
|
|
- placeholder="请选择"
|
|
|
+ placeholder="请选择门槛与配额设置要求"
|
|
|
@change="changeGateTypeFlag"
|
|
|
allowClear></v-select>
|
|
|
<div v-if="form.gateType==='RATIO_AMOUNT'">
|
|
|
- 购买门槛产品金额 <a-input-number v-model="form.gateAmount" :min="0" :max="999999" :precision="2" size="small"/> %作为配额
|
|
|
+ 购买门槛产品金额 <a-input-number v-model="form.gateValue" :min="0" :max="999999" :precision="2" size="small"/> %作为配额
|
|
|
<a-tooltip title="如:填写100%,则购买10000元门槛产品,可享受10000配额购买正价产品,根据门槛金额动态调整配额">
|
|
|
<a-icon type="question-circle" theme="filled" :style="{ fontSize: '14px', color: 'gray' }"/>
|
|
|
</a-tooltip>
|
|
|
</div>
|
|
|
<div v-if="form.gateType==='MIN_AMOUNT'">
|
|
|
- 购买门槛产品满最低金额 <a-input-number v-model="form.gateAmount" :min="0" :max="999999" :precision="2" size="small"/>元,不限制配额。
|
|
|
+ 购买门槛产品满最低金额 <a-input-number v-model="form.gateValue" :min="0" :max="999999" :precision="2" size="small"/>元,不限制配额。
|
|
|
</div>
|
|
|
<div class="ruleDescList" v-if="form.gateType==='FIXED_AMOUNT'">
|
|
|
购买满
|
|
|
- <a-input-number v-model="form.gateAmount" :min="0" :max="999999" :precision="2" size="small"/>
|
|
|
+ <a-input-number v-model="form.gateValue" :min="0" :max="999999" :precision="2" size="small"/>
|
|
|
元门槛产品,可使用
|
|
|
<a-input-number v-model="form.quotaAmount" :min="0" :max="999999" :precision="2" size="small"/>
|
|
|
元配额,采购规则中的正价商品(配额算销售额)
|
|
@@ -63,32 +65,58 @@
|
|
|
</div>
|
|
|
</a-form-model-item>
|
|
|
<a-form-model-item label="满赠规则" prop="regularSameFlag">
|
|
|
- <div class="ruleDescList">
|
|
|
- <a-select default-value="1" v-model="form.regularSameFlag" style="width: 100px" size="small" @change="handleFullGift">
|
|
|
- <a-select-option value="1">
|
|
|
- 同款
|
|
|
- </a-select-option>
|
|
|
- <a-select-option value="0">
|
|
|
- 不同款
|
|
|
- </a-select-option>
|
|
|
- </a-select>
|
|
|
- 产品购买满
|
|
|
- <a-input-number
|
|
|
- v-model="form.regularQty"
|
|
|
- :min="0"
|
|
|
- :step="1"
|
|
|
- :max="999999"
|
|
|
- :precision="0"
|
|
|
- size="small"/>
|
|
|
- 个正价产品,送
|
|
|
- <a-input-number
|
|
|
- v-model="form.promotionQty"
|
|
|
- :min="0"
|
|
|
- :step="1"
|
|
|
- :precision="0"
|
|
|
- :max="999999"
|
|
|
- size="small"/>
|
|
|
- 个促销产品
|
|
|
+ <div class="fullGiftRuleBox">
|
|
|
+ <div class="ruleDescList" v-for="(con,i) in fullGiftRuleList" :key="i">
|
|
|
+ <span v-if="fullGiftRuleList.length>1">{{ i*1+1 }}、</span>
|
|
|
+ <a-select
|
|
|
+ default-value="1"
|
|
|
+ :disabled="i!=0"
|
|
|
+ v-model="form.regularSameFlag"
|
|
|
+ style="width: 100px"
|
|
|
+ size="small"
|
|
|
+ @change="handleFullGift"
|
|
|
+ allowClear>
|
|
|
+ <a-select-option value="1">
|
|
|
+ 同款
|
|
|
+ </a-select-option>
|
|
|
+ <a-select-option value="0">
|
|
|
+ 不同款
|
|
|
+ </a-select-option>
|
|
|
+ </a-select>
|
|
|
+ 产品购买满
|
|
|
+ <a-input-number
|
|
|
+ v-model="con.regularValue"
|
|
|
+ :min="i!=0?fullGiftRuleList[i-1].regularValue:0"
|
|
|
+ :step="1"
|
|
|
+ :max="999999"
|
|
|
+ :precision="form.regularUnit==='YUAN'?2:0"
|
|
|
+ size="small"/>
|
|
|
+ <a-select
|
|
|
+ default-value="GE"
|
|
|
+ :disabled="i!=0"
|
|
|
+ v-model="form.regularUnit"
|
|
|
+ style="width: 50px;margin-left:5px;"
|
|
|
+ size="small"
|
|
|
+ @change="handleChangeUnit">
|
|
|
+ <a-select-option value="GE">
|
|
|
+ 个
|
|
|
+ </a-select-option>
|
|
|
+ <a-select-option value="YUAN">
|
|
|
+ 元
|
|
|
+ </a-select-option>
|
|
|
+ </a-select>
|
|
|
+ 正价产品,送
|
|
|
+ <a-input-number
|
|
|
+ v-model="con.promotionValue"
|
|
|
+ :min="0"
|
|
|
+ :step="1"
|
|
|
+ :precision="0"
|
|
|
+ :max="999999"
|
|
|
+ size="small"/>
|
|
|
+ 个促销产品
|
|
|
+ <a-button type="link" v-if="i==0&&fullGiftRuleList&&fullGiftRuleList.length<5" class="button-info" @click="addFullGiftRule">+新增</a-button>
|
|
|
+ <a-button type="link" v-if="i!=0" class="button-error" @click="delFullGiftRule(con.id)">删除</a-button>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<div class="ruleDescList">
|
|
|
<a-checkbox :checked="form.restrictFlag === '1'" size="small" @change="onChange">
|
|
@@ -101,7 +129,11 @@
|
|
|
:step="1"
|
|
|
:max="999999"
|
|
|
:precision="0"
|
|
|
- size="small"/>
|
|
|
+ size="small"
|
|
|
+ style="margin-right:10px;"/>
|
|
|
+ <a-checkbox :checked="form.convertExpenseFlag==='1'" size="small" @change="onChangeConvert">
|
|
|
+ 可转费用报销单
|
|
|
+ </a-checkbox>
|
|
|
</div>
|
|
|
</a-form-model-item>
|
|
|
<a-form-model-item label="数量叠加" prop="accrualFlag">
|
|
@@ -115,80 +147,30 @@
|
|
|
</a-radio-group>
|
|
|
<span style="color:gray;">(如:满10送2,数量叠加则:满20送4,满30送6)</span>
|
|
|
</a-form-model-item>
|
|
|
- <a-form-model-item prop="minOrderFlag">
|
|
|
- <span slot="label">
|
|
|
- <!-- <a-tooltip title="What do you want others to call you?">
|
|
|
- <a-icon type="info-circle" />
|
|
|
- </a-tooltip> -->
|
|
|
- 订单起订金额
|
|
|
- </span>
|
|
|
- <a-select v-model="form.minOrderFlag" style="width: 160px" size="small">
|
|
|
- <a-select-option value="0">
|
|
|
- 不限
|
|
|
- </a-select-option>
|
|
|
- <a-select-option value="1">
|
|
|
- 限制
|
|
|
- </a-select-option>
|
|
|
- </a-select>
|
|
|
- <a-input-number
|
|
|
- v-show="form.minOrderFlag && form.minOrderFlag=='1'"
|
|
|
- size="small"
|
|
|
- style="margin-left:10px;width:300px;"
|
|
|
- v-model="form.minOrderAmount"
|
|
|
- :min="0"
|
|
|
- :max="999999"
|
|
|
- :step="1"
|
|
|
- :precision="2"
|
|
|
- placeholder="请输入金额"/>
|
|
|
- </a-form-model-item>
|
|
|
- <a-form-model-item prop="upperLimitFlag">
|
|
|
- <span slot="label">
|
|
|
- <!-- <a-tooltip title="What do you want others to call you?">
|
|
|
- <a-icon type="info-circle" />
|
|
|
- </a-tooltip> -->
|
|
|
- 活动经费上限
|
|
|
- </span>
|
|
|
- <a-select v-model="form.upperLimitFlag" style="width: 160px" size="small">
|
|
|
- <a-select-option value="0">
|
|
|
- 不限
|
|
|
- </a-select-option>
|
|
|
- <a-select-option value="1">
|
|
|
- 限制
|
|
|
- </a-select-option>
|
|
|
- </a-select>
|
|
|
- <a-input-number
|
|
|
- v-show="form.upperLimitFlag&&form.upperLimitFlag=='1'"
|
|
|
- size="small"
|
|
|
- style="margin-left:10px;width:300px;"
|
|
|
- v-model="form.upperLimitAmount"
|
|
|
- :min="0"
|
|
|
- :step="1"
|
|
|
- :max="999999"
|
|
|
- :precision="2"
|
|
|
- placeholder="请输入金额"/>
|
|
|
- </a-form-model-item>
|
|
|
<a-form-model-item label="促销品与正品一致" prop="regularPromotionSameFlag">
|
|
|
- <a-radio-group v-model="form.regularPromotionSameFlag" button-style="solid" size="small" :disabled="form.regularSameFlag==0">
|
|
|
- <a-radio value="1">
|
|
|
- 是
|
|
|
- </a-radio>
|
|
|
- <a-radio value="0">
|
|
|
- 否
|
|
|
- </a-radio>
|
|
|
- </a-radio-group>
|
|
|
+ <div class="fixWidthBox">
|
|
|
+ <a-radio-group v-model="form.regularPromotionSameFlag" button-style="solid" size="small" :disabled="form.regularSameFlag==0" @change="handleSameFlag">
|
|
|
+ <a-radio-button value="1">
|
|
|
+ 是
|
|
|
+ </a-radio-button>
|
|
|
+ <a-radio-button value="0">
|
|
|
+ 否
|
|
|
+ </a-radio-button>
|
|
|
+ </a-radio-group>
|
|
|
+ </div>
|
|
|
</a-form-model-item>
|
|
|
</a-form-model>
|
|
|
<a-card size="small" :bordered="false" class="pages-wrap">
|
|
|
- <div class="flex">
|
|
|
- <a-radio-group v-model="chooseVal" button-style="solid">
|
|
|
+ <div class="flex" style="margin-bottom:10px;">
|
|
|
+ <a-radio-group v-model="chooseVal" button-style="solid" @change="onChooseVal">
|
|
|
<a-radio-button value="a" v-show="form.gateFlag==='1'">
|
|
|
门槛产品
|
|
|
</a-radio-button>
|
|
|
<a-radio-button value="b">
|
|
|
正价产品
|
|
|
</a-radio-button>
|
|
|
- <a-radio-button value="c" v-show="form.regularPromotionSameFlag==='0'">
|
|
|
- 促销产品
|
|
|
+ <a-radio-button :value="'c'+item.id" v-for="(item,i) in fullGiftRuleList" :key="i" v-show="form.regularPromotionSameFlag==='0'">
|
|
|
+ {{ fullGiftRuleList.length>1?'促销产品('+'阶梯'+(i*1+1)+')':'促销产品' }}
|
|
|
</a-radio-button>
|
|
|
</a-radio-group>
|
|
|
<a-button
|
|
@@ -198,13 +180,13 @@
|
|
|
@click="openGuideModal=true"
|
|
|
id="promotionList-edit-btn">+导入产品</a-button>
|
|
|
</div>
|
|
|
- <div v-show="chooseVal=='a'"><tableType1 ref="cillProduct"></tableType1></div>
|
|
|
- <div v-show="chooseVal=='b'"><tableType1 ref="normalPriceProduct"></tableType1></div>
|
|
|
- <div v-show="chooseVal=='c'"><tableType2 ref="offerProduct"></tableType2></div>
|
|
|
+ <div v-show="chooseVal=='a'"><tableType1 :unitTypeList="unitTypeDataList" ref="cillProduct"></tableType1></div>
|
|
|
+ <div v-show="chooseVal=='b'"><tableType1 :unitTypeList="unitTypeDataList" ref="normalPriceProduct"></tableType1></div>
|
|
|
+ <div v-show="chooseVal==('c'+item.id)" v-for="(item,i) in fullGiftRuleList" :key="item.id"><tableType1 :unitTypeList="unitTypeDataList" :ref="'offerProduct'+i"></tableType1></div>
|
|
|
</a-card>
|
|
|
<div class="btn-cont">
|
|
|
<a-button id="promotionList-basicInfo-modal-back" @click="isShow = false">取消</a-button>
|
|
|
- <a-button style="margin-left: 15px;" type="primary" id="promotionList-modal-save" @click="handleSave">确定</a-button>
|
|
|
+ <a-button style="margin-left: 15px;" type="primary" id="promotionList-modal-save" :loading="loadingSave" @click="handleSave">确定</a-button>
|
|
|
</div>
|
|
|
</a-spin>
|
|
|
<!-- 导入产品 -->
|
|
@@ -216,13 +198,13 @@
|
|
|
import { commonMixin } from '@/utils/mixin'
|
|
|
import { VSelect } from '@/components'
|
|
|
import tableType1 from './tableType1.vue'
|
|
|
-import tableType2 from './tableType2.vue'
|
|
|
-import { promotionSave, getRuleDetail } from '@/api/promotion'
|
|
|
+import { promotionSave, getRuleDetail, getNewScopeSn } from '@/api/promotion'
|
|
|
import ImportGuideModal from './importGuideModal.vue'
|
|
|
+import { getLookUpData } from '@/api/data'
|
|
|
export default {
|
|
|
name: 'PromotionListBasicInfoModal',
|
|
|
mixins: [commonMixin],
|
|
|
- components: { VSelect, tableType1, tableType2, ImportGuideModal },
|
|
|
+ components: { VSelect, tableType1, ImportGuideModal },
|
|
|
props: {
|
|
|
openModal: { // 弹框显示状态
|
|
|
type: Boolean,
|
|
@@ -245,46 +227,88 @@ export default {
|
|
|
labelCol: { span: 4 },
|
|
|
wrapperCol: { span: 17 }
|
|
|
},
|
|
|
+ fullGiftRuleList: [{
|
|
|
+ id: undefined,
|
|
|
+ scopeLevel: undefined,
|
|
|
+ regularValue: undefined,
|
|
|
+ promotionValue: undefined
|
|
|
+ }],
|
|
|
form: {
|
|
|
+ giveRuleType: 'RATIO', // 满赠规则类型: SUM_MONEY[金额叠加] / RATIO[按比例] 满产品送产品写死为: 按比例
|
|
|
promotionRuleType: 'BUY_PROD_GIVE_PROD', // 买产品送产品
|
|
|
description: '', // 简称
|
|
|
gateFlag: '0', // 门槛
|
|
|
gateType: undefined,
|
|
|
- gateAmount: undefined,
|
|
|
+ gateValue: undefined,
|
|
|
quotaAmount: undefined,
|
|
|
- regularSameFlag: '1', // 满赠规则 不同款商品
|
|
|
- regularQty: undefined,
|
|
|
- promotionQty: undefined,
|
|
|
+ regularSameFlag: '1', // 满赠规则 同款不同款商品
|
|
|
+ regularUnit: 'GE',
|
|
|
restrictFlag: '0', // 限制正价产品款数
|
|
|
+ convertExpenseFlag: '0', // 转费用报销标记
|
|
|
restrictCategory: '',
|
|
|
accrualFlag: '1', // 数量叠加
|
|
|
- minOrderFlag: '0', // 起订金额
|
|
|
- minOrderAmount: undefined,
|
|
|
- upperLimitFlag: '0', // 活动经费上限
|
|
|
- upperLimitAmount: undefined,
|
|
|
- regularPromotionSameFlag: '1'
|
|
|
+ regularPromotionSameFlag: '1',
|
|
|
+ giftProductMap: {},
|
|
|
+ gateInfo: undefined,
|
|
|
+ ruleInfo: undefined,
|
|
|
+ gateUnit: undefined,
|
|
|
+ quotaUnit: undefined
|
|
|
},
|
|
|
rules: {
|
|
|
description: [ { required: true, message: '请输入规则简称', trigger: 'blur' } ],
|
|
|
gateFlag: [ { required: true, message: '请选择规则门槛', trigger: 'change' } ],
|
|
|
regularSameFlag: [{ required: true, message: '请选择满赠规则', trigger: 'change' }],
|
|
|
accrualFlag: [{ required: true, message: '请选择数量是否叠加', trigger: 'change' }],
|
|
|
- minOrderFlag: [{ required: true, message: '请选择订单起订金额', trigger: 'change' }],
|
|
|
- upperLimitFlag: [{ required: true, message: '请选择活动经费上限', trigger: 'change' }],
|
|
|
regularPromotionSameFlag: [{ required: true, message: '请选择促销品与正品是否一致', trigger: 'change' }]
|
|
|
},
|
|
|
chooseVal: 'a',
|
|
|
- openGuideModal: false// 导入弹窗
|
|
|
+ openGuideModal: false, // 导入弹窗
|
|
|
+ id: null,
|
|
|
+ code: 'SCOPE_UNIT_TYPE', // 起订类型数据字典
|
|
|
+ unitTypeDataList: [],
|
|
|
+ loadingSave: false
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 单位切换时,满赠规则数据清空
|
|
|
+ handleChangeUnit (e) {
|
|
|
+ this.form.regularUnit = e
|
|
|
+ this.fullGiftRuleList.forEach(item => {
|
|
|
+ item.regularValue = undefined
|
|
|
+ })
|
|
|
+ },
|
|
|
+ onChooseVal (e) {
|
|
|
+ this.chooseVal = e.target.value
|
|
|
+ },
|
|
|
+ // 新增 满减规则 最多能添加五个
|
|
|
+ async addFullGiftRule () {
|
|
|
+ const result = await getNewScopeSn({})
|
|
|
+ const obj = {
|
|
|
+ id: result.data,
|
|
|
+ scopeLevel: undefined,
|
|
|
+ regularValue: undefined,
|
|
|
+ promotionValue: undefined
|
|
|
+ }
|
|
|
+ this.fullGiftRuleList.push(obj)
|
|
|
+ },
|
|
|
+ // 删除满减规则
|
|
|
+ delFullGiftRule (id) {
|
|
|
+ const pos = this.fullGiftRuleList.findIndex(con => { return con.id == id })
|
|
|
+ this.fullGiftRuleList.splice(pos, 1)
|
|
|
+ if (this.chooseVal == 'c' + id) {
|
|
|
+ this.chooseVal = this.form.gateFlag == '0' ? 'b' : 'a'
|
|
|
+ }
|
|
|
+ },
|
|
|
// 满赠 同款 促销品与正品一致 默认是 可修改
|
|
|
// 不同款 默认否 不可修改
|
|
|
handleFullGift (e) {
|
|
|
- if (e === '0') {
|
|
|
+ if (e === '0') { // 不同款
|
|
|
this.form.regularPromotionSameFlag = '0'
|
|
|
} else {
|
|
|
this.form.regularPromotionSameFlag = '1'
|
|
|
+ if (this.chooseVal.indexOf('c') != -1) {
|
|
|
+ this.chooseVal = this.form.gateFlag == '0' ? 'b' : 'a'
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
// 导入
|
|
@@ -292,37 +316,43 @@ export default {
|
|
|
this.openGuideModal = false
|
|
|
},
|
|
|
hanldeOk (arr) {
|
|
|
- const resultArr = []
|
|
|
- arr.forEach(item => {
|
|
|
- const obj = {
|
|
|
- productCode: item.productCode,
|
|
|
- productSn: item.product.productSn
|
|
|
+ if (this.chooseVal == 'a') {
|
|
|
+ this.$refs['cillProduct'].importRow(arr)
|
|
|
+ } else if (this.chooseVal == 'b') {
|
|
|
+ this.$refs['normalPriceProduct'].importRow(arr)
|
|
|
+ } else {
|
|
|
+ const pos = this.fullGiftRuleList.findIndex(item => { return 'c' + item.id == this.chooseVal })
|
|
|
+ if (pos != -1) {
|
|
|
+ this.$refs['offerProduct' + pos][0].importRow(arr)
|
|
|
}
|
|
|
- resultArr.push(obj)
|
|
|
- })
|
|
|
- const name = this.chooseVal == 'a' ? 'cill' : this.chooseVal == 'b' ? 'normalPrice' : 'offer'
|
|
|
- this.$refs[name + 'Product'].importRow(resultArr)
|
|
|
+ }
|
|
|
},
|
|
|
// 限制正价产品款数
|
|
|
onChange (e) {
|
|
|
this.form.restrictFlag = e.target.checked ? '1' : '0'
|
|
|
},
|
|
|
+ onChangeConvert (e) {
|
|
|
+ this.form.convertExpenseFlag = e.target.checked ? '1' : '0'
|
|
|
+ },
|
|
|
// 门槛切换 tab 按钮默认显示问题
|
|
|
changeGateFlag (e) {
|
|
|
- if (this.chooseVal != 'c') {
|
|
|
- if (e.target.value == '0') {
|
|
|
- this.chooseVal = 'b'
|
|
|
- this.form.gateType = undefined
|
|
|
- this.form.gateAmount = undefined
|
|
|
- this.form.quotaAmount = undefined
|
|
|
- } else {
|
|
|
- this.chooseVal = 'a'
|
|
|
- }
|
|
|
+ if (e.target.value == '0') {
|
|
|
+ this.chooseVal = 'b'
|
|
|
+ this.form.gateType = undefined
|
|
|
+ this.form.gateValue = undefined
|
|
|
+ this.form.quotaAmount = undefined
|
|
|
+ } else {
|
|
|
+ this.chooseVal = 'a'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleSameFlag (e) {
|
|
|
+ if (e.target.value != '0') {
|
|
|
+ this.chooseVal = this.form.gateFlag == '1' ? 'a' : 'b'
|
|
|
}
|
|
|
},
|
|
|
changeGateTypeFlag (val) {
|
|
|
this.form.gateType = val
|
|
|
- this.form.gateAmount = undefined
|
|
|
+ this.form.gateValue = undefined
|
|
|
this.form.quotaAmount = undefined
|
|
|
},
|
|
|
// 保存
|
|
@@ -336,7 +366,7 @@ export default {
|
|
|
_this.$message.warning('请选择规则门槛设置类型!')
|
|
|
return
|
|
|
}
|
|
|
- if (!_this.form.gateAmount) {
|
|
|
+ if (!_this.form.gateValue) {
|
|
|
_this.$message.warning('规则门槛条件不能为空!')
|
|
|
return
|
|
|
}
|
|
@@ -344,8 +374,23 @@ export default {
|
|
|
_this.$message.warning('规则门槛条件不能为空!')
|
|
|
return
|
|
|
}
|
|
|
+ if (_this.form.gateType == 'RATIO_AMOUNT') {
|
|
|
+ _this.form.gateUnit = 'RATIO'
|
|
|
+ } else if (_this.form.gateType == 'MIN_AMOUNT') {
|
|
|
+ _this.form.gateUnit = 'YUAN'
|
|
|
+ } else {
|
|
|
+ _this.form.gateUnit = 'YUAN'
|
|
|
+ _this.form.quotaUnit = 'YUAN'
|
|
|
+ }
|
|
|
}
|
|
|
- if (!_this.form.regularQty || !_this.form.promotionQty) {
|
|
|
+ const hasNullVal = _this.fullGiftRuleList.some(itemVal => {
|
|
|
+ if (itemVal.regularValue && itemVal.promotionValue) {
|
|
|
+ return (itemVal.regularValue <= 0 || itemVal.promotionValue <= 0)
|
|
|
+ } else {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if (hasNullVal) {
|
|
|
_this.$message.warning('满赠规则条件不能为空!')
|
|
|
return
|
|
|
}
|
|
@@ -353,30 +398,11 @@ export default {
|
|
|
_this.$message.warning('请输入限制正价产品款数个数!')
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
- if (_this.form.minOrderFlag == 1 && !_this.form.minOrderAmount) {
|
|
|
- _this.$message.warning('请输入订单起订限制金额数!')
|
|
|
- return
|
|
|
- }
|
|
|
- if (_this.form.minOrderFlag == 0) {
|
|
|
- _this.form.minOrderAmount = undefined
|
|
|
- }
|
|
|
-
|
|
|
- if (_this.form.upperLimitFlag == 1 && !_this.form.upperLimitAmount) {
|
|
|
- _this.$message.warning('请输入活动经费上限金额!')
|
|
|
- return
|
|
|
- }
|
|
|
- if (_this.form.upperLimitFlag == 0) {
|
|
|
- _this.form.upperLimitAmount = undefined
|
|
|
- }
|
|
|
-
|
|
|
- const form = JSON.parse(JSON.stringify(_this.form))
|
|
|
- let rowFlag1 = null
|
|
|
- let rowFlag2 = null
|
|
|
- let rowFlag3 = null
|
|
|
- if (form.gateFlag == '1') {
|
|
|
+ var form = JSON.parse(JSON.stringify(_this.form))
|
|
|
+ let rowFlag1, rowFlag2, rowFlag3
|
|
|
+ if (form.gateFlag == '1') { // 门槛产品
|
|
|
form.gateProductList = this.$refs.cillProduct.getResultVal()
|
|
|
- form.gateAmount = form.gateType === 'RATIO_AMOUNT' ? form.gateAmount / 100 : form.gateAmount
|
|
|
+ form.gateValue = form.gateType === 'RATIO_AMOUNT' ? form.gateValue / 100 : form.gateValue
|
|
|
if (form.gateProductList.length == 0) {
|
|
|
_this.$message.warning('请添加门槛产品!')
|
|
|
return
|
|
@@ -390,11 +416,9 @@ export default {
|
|
|
}
|
|
|
} else {
|
|
|
form.gateProductList = []
|
|
|
- form.gateAmount = ''
|
|
|
- form.quotaAmount = ''
|
|
|
form.gateType = undefined
|
|
|
}
|
|
|
-
|
|
|
+ // 正价产品
|
|
|
form.regularProductList = this.$refs.normalPriceProduct.getResultVal()
|
|
|
// 判断表格必填
|
|
|
if (form.regularProductList.length == 0) {
|
|
@@ -406,25 +430,72 @@ export default {
|
|
|
_this.$message.warning('订单起订量设置不能为空!')
|
|
|
return
|
|
|
}
|
|
|
- rowFlag3 = _this.isJudge(form.regularProductList)
|
|
|
+ rowFlag2 = _this.isJudge(form.regularProductList)
|
|
|
}
|
|
|
- if (form.regularPromotionSameFlag == '0') {
|
|
|
- form.giftProductList = this.$refs.offerProduct.getResultVal()
|
|
|
- if (form.giftProductList.length == 0) {
|
|
|
+ if (form.regularPromotionSameFlag === '0') { // 促销产品 阶梯促销产品
|
|
|
+ const allGiftObj = {}
|
|
|
+ _this.fullGiftRuleList.forEach((val, i) => {
|
|
|
+ allGiftObj['GIFT' + (i * 1 + 1)] = _this.$refs['offerProduct' + i][0].getResultVal()
|
|
|
+ })
|
|
|
+ var lengthFlag = null
|
|
|
+ for (const key in allGiftObj) {
|
|
|
+ if (allGiftObj[key].length === 0) {
|
|
|
+ lengthFlag = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (lengthFlag) {
|
|
|
_this.$message.warning('请添加促销产品!')
|
|
|
return
|
|
|
}
|
|
|
- rowFlag2 = _this.isJudge(form.giftProductList)
|
|
|
+ const arrFlag = []
|
|
|
+ for (const key in allGiftObj) {
|
|
|
+ if (allGiftObj[key] && allGiftObj[key].length > 0) {
|
|
|
+ arrFlag.push(_this.isJudge(allGiftObj[key]))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ rowFlag3 = arrFlag.some(val => { return val })
|
|
|
+ // 组数据,添加数组标识
|
|
|
+ let keyPos = 0
|
|
|
+ for (const key in allGiftObj) {
|
|
|
+ keyPos += 1
|
|
|
+ allGiftObj[key].forEach((item, j) => {
|
|
|
+ item.scopeLevel = keyPos
|
|
|
+ })
|
|
|
+ }
|
|
|
+ form.giftProductMap = allGiftObj
|
|
|
} else {
|
|
|
- form.giftProductList = []
|
|
|
+ form.giftProductMap = {}
|
|
|
}
|
|
|
|
|
|
if (rowFlag1 || rowFlag2 || rowFlag3) {
|
|
|
_this.$message.warning('请选择产品分类、品牌或产品!')
|
|
|
return
|
|
|
}
|
|
|
+ // 组传给后台所需数据
|
|
|
+ _this.fullGiftRuleList.map((val, i) => {
|
|
|
+ val.scopeLevel = i * 1 + 1
|
|
|
+ val.regularSameFlag = form.regularSameFlag
|
|
|
+ val.regularUnit = form.regularUnit
|
|
|
+ })
|
|
|
form.promotionSn = _this.promotionSn
|
|
|
+ form.giveRuleList = _this.fullGiftRuleList
|
|
|
+ if (form.gateFlag == '1') {
|
|
|
+ if (form.gateType === 'RATIO_AMOUNT') {
|
|
|
+ form.gateInfo = '购买门槛产品金额' + (form.gateValue * 100).toFixed(2) + '%作为配额'
|
|
|
+ } else if (form.gateType === 'MIN_AMOUNT') {
|
|
|
+ form.gateInfo = '购买门槛产品满最低金额' + form.gateValue.toFixed(2) + '元,不限制配额'
|
|
|
+ } else {
|
|
|
+ form.gateInfo = '购买满' + form.gateValue.toFixed(2) + '元门槛产品,可使用' + form.quotaAmount.toFixed(2) + '元配额,采购规则中的正价商品(配额算销售额)'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ var newInfo = `<div>${form.accrualFlag == '1' ? '数量叠加;' : ''}${form.convertExpenseFlag == '1' ? '可转费用报销单;' : ''}</div>`
|
|
|
+ _this.fullGiftRuleList.forEach((item, i) => {
|
|
|
+ newInfo += `<div>${_this.fullGiftRuleList.length > 1 ? (i * 1 + 1) + '、' : ''}${form.regularSameFlag == '1' ? '同款' : '不同款'}产品购买满${form.regularUnit == 'YUAN' ? item.regularValue.toFixed(2) : item.regularValue}${form.regularUnit == 'YUAN' ? '元' : '个'}正价产品,送${item.promotionValue}个促销产品</div>`
|
|
|
+ })
|
|
|
+ newInfo += form.restrictFlag == '1' ? `<div>限制正价产品${form.restrictCategory}款</div>` : ''
|
|
|
+ form.ruleInfo = newInfo
|
|
|
_this.spinning = true
|
|
|
+ _this.loadingSave = true
|
|
|
promotionSave(form).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
_this.$message.success(res.message)
|
|
@@ -432,9 +503,11 @@ export default {
|
|
|
_this.isShow = false
|
|
|
_this.$emit('ok')
|
|
|
_this.spinning = false
|
|
|
+ _this.loadingSave = false
|
|
|
}, 1000)
|
|
|
} else {
|
|
|
_this.spinning = false
|
|
|
+ _this.loadingSave = false
|
|
|
}
|
|
|
})
|
|
|
} else {
|
|
@@ -467,60 +540,76 @@ export default {
|
|
|
return flag
|
|
|
},
|
|
|
// 重置表格
|
|
|
- resetSearchForm () {
|
|
|
+ async resetSearchForm () {
|
|
|
this.form = {
|
|
|
+ giveRuleType: 'RATIO', // 满赠规则类型: SUM_MONEY[金额叠加] / RATIO[按比例] 满产品送产品写死为: 按比例
|
|
|
promotionRuleType: 'BUY_PROD_GIVE_PROD', // 买产品送产品
|
|
|
description: '', // 简称
|
|
|
gateFlag: '0', // 门槛
|
|
|
gateType: undefined,
|
|
|
- gateAmount: undefined,
|
|
|
+ gateValue: undefined,
|
|
|
quotaAmount: undefined,
|
|
|
- regularSameFlag: '1', // 满赠规则 不同款商品
|
|
|
- regularQty: undefined,
|
|
|
- promotionQty: undefined,
|
|
|
+ regularSameFlag: '1', // 满赠规则 同款不同款商品
|
|
|
+ regularUnit: 'GE',
|
|
|
restrictFlag: '0', // 限制正价产品款数
|
|
|
+ convertExpenseFlag: '0', // 转费用报销标记
|
|
|
restrictCategory: '',
|
|
|
accrualFlag: '1', // 数量叠加
|
|
|
- minOrderFlag: '0', // 起订金额
|
|
|
- minOrderAmount: undefined,
|
|
|
- upperLimitFlag: '0', // 活动经费上限
|
|
|
- upperLimitAmount: undefined,
|
|
|
regularPromotionSameFlag: '1',
|
|
|
+ giftProductMap: {},
|
|
|
gateProductList: undefined,
|
|
|
- giftProductList: undefined,
|
|
|
- regularProductList: undefined
|
|
|
+ regularProductList: undefined,
|
|
|
+ gateInfo: undefined,
|
|
|
+ ruleInfo: undefined,
|
|
|
+ gateUnit: undefined,
|
|
|
+ quotaUnit: undefined
|
|
|
}
|
|
|
this.$nextTick(() => {
|
|
|
this.$refs.ruleForm.resetFields()
|
|
|
this.$refs.cillProduct.reSetTableData()
|
|
|
this.$refs.normalPriceProduct.reSetTableData()
|
|
|
- this.$refs.offerProduct.reSetTableData()
|
|
|
})
|
|
|
+ this.fullGiftRuleList.forEach((val, i) => {
|
|
|
+ this.$refs['offerProduct' + i][0].reSetTableData()
|
|
|
+ })
|
|
|
+ const result = await getNewScopeSn({})
|
|
|
+ this.fullGiftRuleList = [{
|
|
|
+ id: result.data,
|
|
|
+ regularValue: undefined,
|
|
|
+ promotionValue: undefined
|
|
|
+ }]
|
|
|
+ this.id = null
|
|
|
},
|
|
|
// 获取编辑详情
|
|
|
getDetail () {
|
|
|
const _this = this
|
|
|
- getRuleDetail({ sn: this.itemSn }).then(res => {
|
|
|
+ getRuleDetail({ sn: _this.itemSn }).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
const resultObj = res.data
|
|
|
_this.chooseVal = resultObj.gateFlag == '0' ? 'b' : 'a'
|
|
|
- if (resultObj.gateFlag === '1') {
|
|
|
- resultObj.gateAmount = resultObj.gateType === 'RATIO_AMOUNT' ? resultObj.gateAmount * 100 : resultObj.gateAmount
|
|
|
+ if (resultObj.gateFlag == '1') {
|
|
|
+ resultObj.gateValue = resultObj.gateType === 'RATIO_AMOUNT' ? resultObj.gateValue * 100 : resultObj.gateValue
|
|
|
+ }
|
|
|
+ if (resultObj.giveRuleList && resultObj.giveRuleList.length > 0) {
|
|
|
+ _this.fullGiftRuleList = resultObj.giveRuleList
|
|
|
+ _this.$nextTick(() => {
|
|
|
+ resultObj.giveRuleList.forEach((item, i) => {
|
|
|
+ _this.$refs['offerProduct' + i][0].setTabVal(_this.newData(resultObj.giftProductMap['GIFT' + (i * 1 + 1)]))
|
|
|
+ })
|
|
|
+ })
|
|
|
}
|
|
|
// 重新组成保存数据
|
|
|
if (resultObj.gateProductList && resultObj.gateProductList.length > 0) {
|
|
|
resultObj.gateProductList = _this.newData(resultObj.gateProductList)
|
|
|
- this.$refs.cillProduct.setTabVal(resultObj.gateProductList)
|
|
|
+ _this.$refs.cillProduct.setTabVal(resultObj.gateProductList)
|
|
|
}
|
|
|
if (resultObj.regularProductList && resultObj.regularProductList.length > 0) {
|
|
|
resultObj.regularProductList = _this.newData(resultObj.regularProductList)
|
|
|
- this.$refs.normalPriceProduct.setTabVal(resultObj.regularProductList)
|
|
|
+ _this.$refs.normalPriceProduct.setTabVal(resultObj.regularProductList)
|
|
|
}
|
|
|
- if (resultObj.giftProductList && resultObj.giftProductList.length > 0) {
|
|
|
- resultObj.giftProductList = _this.newData(resultObj.giftProductList)
|
|
|
- this.$refs.offerProduct.setTabVal(resultObj.giftProductList)
|
|
|
- }
|
|
|
- this.form = { ...this.form, ...resultObj }
|
|
|
+ const newDataObj = { ..._this.form, ...resultObj }
|
|
|
+ delete newDataObj.giftProductList
|
|
|
+ _this.form = newDataObj
|
|
|
}
|
|
|
})
|
|
|
},
|
|
@@ -547,11 +636,9 @@ export default {
|
|
|
const num = 3
|
|
|
for (var i = 0; i < num; i++) {
|
|
|
if (item['productTypeName' + (i + 1)]) {
|
|
|
- // item.title += item['productTypeName' + (i + 1)] + (item['productTypeName' + (i + 1)] ? '/' : '')
|
|
|
typeObj['productTypeSn' + (i + 1)] = item['productTypeSn' + (i + 1)] ? item['productTypeSn' + (i + 1)] : ''
|
|
|
}
|
|
|
}
|
|
|
- // item.title = item.title.slice(0, item.title.length - 1)
|
|
|
if (item.productTypeName3) {
|
|
|
item.title = item.productTypeName2 + '/' + item.productTypeName3
|
|
|
} else if (!item.productTypeName3 && item.productTypeName2) {
|
|
@@ -579,6 +666,18 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
return list
|
|
|
+ },
|
|
|
+ getUnitTypeList () {
|
|
|
+ const _this = this
|
|
|
+ getLookUpData({
|
|
|
+ pageNo: 1,
|
|
|
+ pageSize: 1000,
|
|
|
+ lookupCode: _this.code
|
|
|
+ }).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ _this.unitTypeDataList = res.data.list
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
@@ -592,6 +691,8 @@ export default {
|
|
|
this.$emit('close')
|
|
|
this.resetSearchForm()
|
|
|
} else {
|
|
|
+ // 获取起订类型数据字典
|
|
|
+ this.getUnitTypeList()
|
|
|
if (this.itemSn) {
|
|
|
this.getDetail()
|
|
|
} else {
|
|
@@ -610,7 +711,7 @@ export default {
|
|
|
max-height: 745px !important;
|
|
|
overflow-y: scroll !important;
|
|
|
}
|
|
|
- .ant-radio-button-wrapper{
|
|
|
+ .fixWidthBox .ant-radio-button-wrapper{
|
|
|
width:80px;
|
|
|
text-align: center;
|
|
|
}
|
|
@@ -633,5 +734,8 @@ export default {
|
|
|
background-color: #ed1c24 !important;
|
|
|
}
|
|
|
}
|
|
|
+ /deep/.ve-table{
|
|
|
+ border-radius:5px;
|
|
|
+ }
|
|
|
|
|
|
</style>
|