Commit eb90b805 by caoyanzhi

update: 奥莱抵金券

parent 2f4f0384
......@@ -151,7 +151,7 @@ export default {
};
const that = this;
return {
initStoreSelector: true,
storeUuid: '',
// 商场抵金券适用门店-部分门店列表数据
originStoreList: [],
// 商场抵金券适用门店-门店选择器选中的数据
......@@ -437,12 +437,11 @@ export default {
},
methods: {
onOptionsChange(value) {
this.storeMode = value == 0 ? 0 : 1;
this.originStoreList = [];
},
onStoreChange(id) {
// 编辑卡券时,不保存门店选择器初始化的数据
if ((this.isEdit || this.isInfo) && this.initStoreSelector) {
this.initStoreSelector = false;
return;
}
getStoreWidgetStore({ key: id, pageSize: 99999, currentPage: 1 }).then(res => {
const { result, errorCode } = res || {};
if (errorCode == 0 && Array.isArray(result.result)) {
......@@ -632,13 +631,19 @@ export default {
initForm.useCardCodePrefix = this.form.useCardCodePrefix;
initForm.cardCodePrefix = this.form.cardCodePrefix;
this.uuid = '';
this.storeUuid = '';
this.originStoreList = [];
this.storeMode = 0;
this.form = JSON.parse(JSON.stringify(initForm));
this.sale_limit = JSON.parse(JSON.stringify(sale_limit));
this.goods = JSON.parse(JSON.stringify(goods));
this.form.cardType = e;
this.$nextTick(_ => {
this.$refs.storeCard.initLeftList();
});
if (this.form.cardType != 3) {
this.$nextTick(_ => {
this.$refs.storeCard.initLeftList();
});
}
this.goodsList = [{ v1: '', f2: [], v2: '', f3: [], v3: [], list: [] }];
// 新增情况下,如果配置了线下门店,默认选中线下门店
if (this.isAdd && this.cardApplyChannelOptions.some(v => v.value === 'offlineStore')) {
......@@ -815,7 +820,8 @@ export default {
}
if (card.cardType == 3) {
this.form.costValueType = card.costValueType; //成本费用0固定成本1门店成本
this.form.costValueProportionFlag = card.costValueProportionFlag || 0; // 卡券成本比例 1:开 0:关
this.form.costValueType = card.costValueType || 0; //成本费用0固定成本1门店成本
this.form.costValueProportion = card.costValueProportion; //成本比例
this.form.costStoreList = (this.isEdit || this.isInfo) && Array.isArray(card.costStoreList) ? card.costStoreList : [];
this.originStoreList = this.form.costStoreList;
......@@ -929,11 +935,15 @@ export default {
this.form.startDay = card.startDay || 0;
this.form.limitDay = card.limitDay || 0;
}
this.uuid = card.storeWidgetKey || '';
this.$nextTick(_ => {
// console.log(this.$refs.storeCard);
this.$refs.storeCard.init();
});
if (this.form.cardType == 3) {
this.storeUuid = card.storeWidgetKey || '';
} else {
this.uuid = card.storeWidgetKey || '';
this.$nextTick(_ => {
// console.log(this.$refs.storeCard);
this.$refs.storeCard.init();
});
}
this.form.verificationType = card.verificationType || 0;
this.$nextTick(() => {
this.$refs.form.clearValidate();
......@@ -1023,17 +1033,17 @@ export default {
}
if (this.form.cardType == 3) {
if (this.form.costValueProportionFlag == 1 && this.form.costValueType == 1) {
if (this.form.costValueProportionFlag == 1) {
if (!Array.isArray(this.originStoreList) || this.originStoreList.length == 0) {
this.$tips({ type: 'warning', message: '请添加卡券适用部分门店' });
this.$tips({ type: 'warning', message: '请选择卡券适用门店' });
const body = document.getElementsByClassName('dm-layout-page')[0];
toTop(body, this.$refs.costValueProportionFlag.$el.offsetTop - body.offsetTop);
toTop(body, this.$refs.useStore.$el.offsetTop - body.offsetTop);
return;
}
if (this.originStoreList.some(el => el.costValueProportion == undefined || el.costValueProportion == null)) {
if (this.form.costValueType == 1 && this.originStoreList.some(el => el.costValueProportion == undefined || el.costValueProportion == null)) {
this.$tips({ type: 'warning', message: '请输入门店成本比例' });
const body = document.getElementsByClassName('dm-layout-page')[0];
toTop(body, this.$refs.costValueProportionFlag.$el.offsetTop - body.offsetTop);
toTop(body, this.$refs.useStore.$el.offsetTop - body.offsetTop);
return;
}
}
......@@ -1185,6 +1195,7 @@ export default {
};
card.costValueType = this.form.costValueType; //成本费用0固定成本1门店成本
card.costValueProportion = this.form.costValueProportion; //成本比例
card.costValueProportionFlag = this.form.costValueProportionFlag;
if (card.costValueType == 0) {
card.costValue = typeof this.form.costValueProportion == 'number' && typeof this.form.cardDenomination == 'number' ? this.form.costValueProportion * this.form.cardDenomination : 0; //成本
card.costStoreList = [];
......@@ -1330,7 +1341,11 @@ export default {
card.applicableMode = 0;
card.storeProMode = 0;
card.storeMode = this.storeMode;
card.storeWidgetKey = this.uuid;
// 如果是商场抵金券,而且开启了卡券成本比例,而且选择了门店成本,storeMode就传0
if (card.cardType == 3 && card.costValueProportionFlag == 1 && card.costValueType == 1) {
card.storeMode = 0;
}
card.storeWidgetKey = card.cardType == 3 ? this.storeUuid : this.uuid;
// 这里判断部分门店是否为空
if (card.storeMode) {
// let data = await this.$refs.storeCard.getRightList();
......
......@@ -6,7 +6,7 @@
<el-radio :label="0">抵金券</el-radio>
<el-radio :label="1">折扣券</el-radio>
<el-radio :label="2">兑换券</el-radio>
<el-radio v-if="$store.getters.getLimitCodeList.every(el => el != 'abc')" :label="3">商场抵金券</el-radio>
<el-radio v-if="$store.getters.getLimitCodeList.every(el => el != 'couponCreate')" :label="3">商场抵金券</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item v-if="form.cardType != 3" label="卡券适用渠道" prop="cardApplyChannel">
......@@ -78,31 +78,32 @@
<!-- 抵金券 -->
<el-form-item prop="cardDenomination" label="减免金额" v-if="form.cardType === 0 || form.cardType == 3"> <el-input-number controls-position="right" :disabled="isEdit || isInfo" v-model="form.cardDenomination" class="200" :precison="0" :min="0" :max="10000000"></el-input-number><span class="fz12 gray">请输入大于0的整数</span> </el-form-item>
<el-form-item v-if="form.cardType == 3" label="卡券成本比例" ref="costValueProportionFlag">
<el-form-item v-if="form.cardType == 3" label="卡券成本比例">
<el-switch v-model="form.costValueProportionFlag" :active-value="1" :inactive-value="0" :disabled="isEdit || isInfo"></el-switch>
<div class="cost-box" v-if="form.costValueProportionFlag == 1">
<div class="cost-box-type">
<span class="cost-box-type-label">成本费用</span>
<el-radio-group v-model="form.costValueType" :disabled="isEdit || isInfo">
<el-radio :label="0" border>固定成本</el-radio>
<el-radio :label="1" border>门店成本</el-radio>
<el-radio :label="0">固定成本</el-radio>
<el-radio :label="1">门店成本</el-radio>
</el-radio-group>
</div>
</div>
</el-form-item>
<el-form-item v-if="form.cardType == 3" label="适用门店" ref="useStore">
<div slot="label">
适用门店
<el-tooltip placement="top" content="仅支持选择账号管辖门店范围内的门店">
<i class="iconfont icon-QuestionCircleOutlined"></i>
</el-tooltip>
</div>
<dm-store-selector :uuid.sync="storeUuid" :options="[5]" @optionsChange="onOptionsChange" @store-change="onStoreChange"></dm-store-selector>
<div v-if="form.costValueProportionFlag == 1" class="cost-box">
<div v-if="form.costValueType == 0" class="fixed-cost">
<el-form-item label="成本比例" prop="costValueProportion" label-width="175px"><el-input-number v-model="form.costValueProportion" :disabled="isEdit || isInfo" :min="0" :max="100" :precision="0" :controls="false" style="margin-right: 10px; width: 130px" placeholder="请输入成本比例"></el-input-number>%</el-form-item>
<el-form-item label="成本金额" label-width="100px"><el-input :value="typeof form.costValueProportion == 'number' && typeof form.cardDenomination == 'number' ? (form.costValueProportion * form.cardDenomination) / 100 : 0" disabled style="margin-right: 10px; width:120px"></el-input></el-form-item>
<el-form-item label="成本比例" prop="costValueProportion" label-width="85px"><el-input-number v-model="form.costValueProportion" :disabled="isEdit || isInfo" :min="0" :max="100" :precision="0" :controls="false" style="margin-right: 10px; width: 130px" placeholder="请输入成本比例"></el-input-number>%</el-form-item>
<!-- <el-form-item label="成本金额" label-width="100px"><el-input :value="typeof form.costValueProportion == 'number' && typeof form.cardDenomination == 'number' ? (form.costValueProportion * form.cardDenomination) / 100 : 0" disabled style="margin-right: 10px; width:120px"></el-input>元</el-form-item> -->
</div>
<div v-if="form.costValueType == 1" class="store-fixed-cost">
<div class="store-cost-title">
<div class="store-cost-title-text">设置门店成本</div>
<div class="store-cost-selector">
<span>适用门店:</span>
<el-tooltip placement="top" content="仅支持选择账号管理门店权限内门店">
<i class="iconfont icon-QuestionCircleOutlined" style="margin-right: 10px"></i>
</el-tooltip>
<dm-store-selector :options="[5]" @store-change="onStoreChange"></dm-store-selector>
</div>
</div>
<div class="store-cost-search">
<el-input v-model="searchStore" placeholder="请输入门店名称/code" prefix-icon="el-icon-search" clearable style="width: 260px"></el-input>
<el-button v-if="!isEdit && !isInfo" @click="importCost.visible = true" type="primary" style="border: none"><i class="iconfont icon-shangc"></i> 成本批量导入</el-button>
......@@ -498,22 +499,7 @@ export default cardForm;
width: 701px;
background: #f5f7fa;
.cost-box-type {
padding: 20px 16px;
border-bottom: 1px solid #ebecf0;
/deep/ .el-radio.is-bordered {
padding: 8px 20px 8px 10px;
margin-right: 20px;
background: #fff;
& + .el-radio.is-bordered {
margin-left: 0;
}
&:last-child {
margin-right: 0;
}
.el-radio__input {
height: 17px;
}
}
padding: 24px 22px;
.cost-box-type-label {
margin-right: 25px;
font-size: 14px;
......@@ -526,44 +512,15 @@ export default cardForm;
display: flex;
justify-content: flex-start;
align-items: center;
padding: 26px 0 34px;
padding: 20px;
}
.store-fixed-cost {
padding: 17px 20px 20px 17px;
.store-cost-title {
display: flex;
justify-content: space-between;
align-items: center;
.store-cost-title-text {
font-size: 14px;
font-weight: 800;
color: #303133;
line-height: 20px;
}
.store-cost-selector {
display: flex;
justify-content: flex-start;
align-items: center;
/deep/ .dm-store-selector {
.el-select:first-child {
margin-right: 0 !important;
}
.dm-new-store__reference {
margin-left: 10px;
margin-right: -1px;
.dm-new-store__inputtag {
margin-top: -1px;
box-sizing: border-box;
}
}
}
}
}
.store-cost-search {
display: flex;
justify-content: space-between;
align-items: center;
margin: 20px 0;
margin-bottom: 20px;
}
}
.store-list {
......
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