Commit f797d320 by dingdang

Merge branch 'feature/商品选择器'

parents fb3485f1 e9a59b84
......@@ -6,8 +6,8 @@ import dmUploadImg from '@/components/upload/img';
import linktools from '@/components/linktools-fulls/index';
import dmUploadAvatar from '@/components/upload/avatar';
import sendPreview from './partials/send-preview';
import { formatDateTimeByType, deepClone, getTimesByReq } from '@/utils/index.js';
import xxSysp_mix from '@/mixins/selector.js'; // 商品选择器方法
import { formatDateTimeByType, /*deepClone,*/ getTimesByReq } from '@/utils/index.js';
// import xxSysp_mix from '@/mixins/selector.js'; // 商品选择器方法
import { listEntepriseWeimobShop, listEntepriseWeimobCoupon } from '@/service/api/commonApi.js';
import { getCardDetail, saveUpdateCard, copyCardDetailService, getCardManualSetting, getCategoryList, getPropertyList, getLatestReptileTime, getPropertyValueList, getWeimobCouponBindCount, getCardEffectiveMode, getStoreWidgetStore, getStoreByCode, importCostStore } from '@/service/api/cardApi.js';
import dmGoodsInput from '@/components/goods-input/index.vue';
......@@ -43,6 +43,7 @@ const initForm = {
startDay: 0,
limitDay: null,
cardExplain: '',
goodsFilterId: '', // 商品选择器id
// image: {
// imgUrl: '',
// code: ''
......@@ -96,7 +97,7 @@ const preventEnter = function(e) {
}
};
export default {
mixins: [xxSysp_mix],
// mixins: [xxSysp_mix],
data() {
const checkSendDateTime = (rule, value, callback) => {
const { sendDateTime, cardEffectiveMode, dateTime, putEffectiveMode } = this.form;
......@@ -151,6 +152,7 @@ export default {
};
const that = this;
return {
goodsEnable: false,
storeUuid: '',
storeUuidCache: '',
// 商场抵金券适用门店-部分门店列表数据
......@@ -748,7 +750,7 @@ export default {
// 支持的品牌-商品选择器
if (res.result.goodsEnable) {
this.xxSysp.goodsEnable = res.result.goodsEnable;
this.goodsEnable = res.result.goodsEnable;
}
// 新增情况下,如果配置了线下门店,默认选中线下门店
......@@ -885,38 +887,41 @@ export default {
}
// 线下适用商品
if (card.goodsSearchDetail && card.goodsFilterId) {
this.xxSysp.goodsFilterId = card.goodsFilterId;
const goodsSearchDetail = JSON.parse(card.goodsSearchDetail || '{}');
this.xxSysp.conditionList = this.xxSysp.conditionList_copy = goodsSearchDetail.conditionList; // ref selector此时放在modal里并没有渲染,之后赋值
this.xxSysp.conditionList = goodsSearchDetail.conditionList; // ref selector此时放在modal里并没有渲染,之后赋值
this.xxSysp.conditionList_copy = deepClone(goodsSearchDetail.conditionList || {}); // 备份数据
this.xxSysp.filterLogicalOperator = goodsSearchDetail.filterLogicalOperator || [];
if (card.gicCouponType == 3 || card.gicCouponType == 4) {
const filterAbbrInfo = (goodsSearchDetail.filterAbbrInfo || []).map(el => {
return el.map((item, index) => {
if (index == 0) {
item.optName = null;
}
// intersect 或者,union 并且,diff 剔除
switch (item.optName) {
case 'union':
item.optName = '或者';
break;
case 'intersect':
item.optName = '并且';
break;
case 'diff':
item.optName = '剔除';
break;
}
return item;
});
});
this.xxSysp.filterAbbrInfo = this.xxSyspLabel(filterAbbrInfo);
} else {
this.xxSysp.filterAbbrInfo = goodsSearchDetail.filterAbbrInfo || [];
}
// if (card.goodsSearchDetail && card.goodsFilterId) {
// this.xxSysp.goodsFilterId = card.goodsFilterId;
// const goodsSearchDetail = JSON.parse(card.goodsSearchDetail || '{}');
// this.xxSysp.conditionList = this.xxSysp.conditionList_copy = goodsSearchDetail.conditionList; // ref selector此时放在modal里并没有渲染,之后赋值
// this.xxSysp.conditionList = goodsSearchDetail.conditionList; // ref selector此时放在modal里并没有渲染,之后赋值
// this.xxSysp.conditionList_copy = deepClone(goodsSearchDetail.conditionList || {}); // 备份数据
// this.xxSysp.filterLogicalOperator = goodsSearchDetail.filterLogicalOperator || [];
// if (card.gicCouponType == 3 || card.gicCouponType == 4) {
// const filterAbbrInfo = (goodsSearchDetail.filterAbbrInfo || []).map(el => {
// return el.map((item, index) => {
// if (index == 0) {
// item.optName = null;
// }
// // intersect 或者,union 并且,diff 剔除
// switch (item.optName) {
// case 'union':
// item.optName = '或者';
// break;
// case 'intersect':
// item.optName = '并且';
// break;
// case 'diff':
// item.optName = '剔除';
// break;
// }
// return item;
// });
// });
// this.xxSysp.filterAbbrInfo = this.xxSyspLabel(filterAbbrInfo);
// } else {
// this.xxSysp.filterAbbrInfo = goodsSearchDetail.filterAbbrInfo || [];
// }
// }
if (card.goodsFilterId) {
this.form.goodsFilterId = card.goodsFilterId;
}
this.form.cardLimit = card.cardLimit;
......@@ -1322,14 +1327,17 @@ export default {
}
// 线下适用商品
if (this.xxSysp.goodsEnable && this.xxSysp.goodsFilterId) {
card.goodsFilterId = this.xxSysp.goodsFilterId;
if (this.xxSysp.conditionList) {
card.goodsSearchDetail = JSON.stringify({
conditionList: this.isEdit ? this.xxSysp.conditionList_copy : this.xxSysp.conditionList, // 编辑保存备份数据
filterAbbrInfo: this.xxSysp.filterAbbrInfo
}); // 反显数据
}
// if (this.xxSysp.goodsEnable && this.xxSysp.goodsFilterId) {
// card.goodsFilterId = this.xxSysp.goodsFilterId;
// if (this.xxSysp.conditionList) {
// card.goodsSearchDetail = JSON.stringify({
// conditionList: this.isEdit ? this.xxSysp.conditionList_copy : this.xxSysp.conditionList, // 编辑保存备份数据
// filterAbbrInfo: this.xxSysp.filterAbbrInfo
// }); // 反显数据
// }
// }
if (this.goodsEnable && this.form.goodsFilterId) {
card.goodsFilterId = this.form.goodsFilterId;
}
//卡券限制
......
......@@ -193,16 +193,17 @@
</div>
</div>
<!-- 线下适用商品 -->
<div v-if="(form.cardType === 0 || form.cardType === 1) && form.cardApplyChannel.indexOf('offlineStore') !== -1 && xxSysp.goodsEnable">
<!-- <div v-if="(form.cardType === 0 || form.cardType === 1) && form.cardApplyChannel.indexOf('offlineStore') !== -1 && xxSysp.goodsEnable"> -->
<div v-if="(form.cardType === 0 || form.cardType === 1) && form.cardApplyChannel.indexOf('offlineStore') !== -1 && goodsEnable">
<span class="inline-block w100 pr10 text-right" style="vertical-align:top">线下适用商品</span>
<div class="sysp__content clearfix inline-block">
<div class="fl" v-if="xxSysp.filterAbbrInfo.length && !Array.isArray(xxSysp.filterAbbrInfo[0])">
<!-- <div class="fl" v-if="xxSysp.filterAbbrInfo.length && !Array.isArray(xxSysp.filterAbbrInfo[0])">
<template v-for="(item, idx) in xxSysp.filterAbbrInfo">
{{ item.optName }}
<span :key="idx" class="item">{{ item.text }}</span>
</template>
</div>
<div class="fl" v-if="xxSysp.filterAbbrInfo.length && Array.isArray(xxSysp.filterAbbrInfo[0])">
</div> -->
<!-- <div class="fl" v-if="xxSysp.filterAbbrInfo.length && Array.isArray(xxSysp.filterAbbrInfo[0])">
<div v-for="(item, idx) in xxSysp.filterAbbrInfo" :key="idx">
<div class="complex-and" v-if="idx > 0 && (idx < xxSysp.max || xxSysp.isExpand)">【{{ getXxSysFilterText(idx - 1) }}】</div>
<template v-for="(el, i) in item">
......@@ -213,16 +214,23 @@
</template>
</div>
<el-button v-if="xxSysp.filterAbbrInfo.length > xxSysp.max" type="text" @click="xxSysp.isExpand = !xxSysp.isExpand">{{ xxSysp.isExpand ? '收起' : '展开' }}<i class="el-icon-arrow-down" :class="{ 'is-expand': xxSysp.isExpand }"></i></el-button>
</div>
<template v-if="gicCouponType != 3 && gicCouponType != 4">
<template v-if="xxSysp.goodsEnable && (((isEdit || isInfo) && xxSysp.filterAbbrInfo.length) || isAdd || isCopy)">
<el-button type="primary" @click="handleXxSyspClick" class="fl mt5" size="mini">{{ isEdit || isInfo ? '查看' : '编辑' }}</el-button>
<el-button v-show="xxSysp.filterAbbrInfo.length && !isEdit && !isInfo" @click="handleXxSyspReset" class="fl mt5" size="mini">清空</el-button>
</div> -->
<!-- 新增时,外部券不显示商品选择器 -->
<!-- 编辑时,都显示商品选择器 -->
<template v-if="((isEdit || isInfo) && form.goodsFilterId) || ((isAdd || isCopy) && gicCouponType != 3 && gicCouponType != 4)">
<template v-if="goodsEnable">
<!-- <template v-if="xxSysp.goodsEnable && (((isEdit || isInfo) && xxSysp.filterAbbrInfo.length) || isAdd || isCopy)"> -->
<!-- <el-button type="primary" @click="handleXxSyspClick" class="fl mt5" size="mini">{{ isEdit || isInfo ? '查看' : '编辑' }}</el-button>
<el-button v-show="xxSysp.filterAbbrInfo.length && !isEdit && !isInfo" @click="handleXxSyspReset" class="fl mt5" size="mini">清空</el-button> -->
<dm-goods-selector ref="goodsSelector" mode="dialog" scene-code="productCoupons" is-coupon :projectName="requestProject" :disabled="isEdit" :widget-id.sync="form.goodsFilterId">
<el-button slot="trigger" type="primary" class="fl mt5" size="mini" @click="$refs.goodsSelector.showGoodsSelector()">编辑</el-button>
</dm-goods-selector>
</template>
<p v-else class="fz14 gray">未选择</p>
</template>
</div>
<div v-if="xxSysp.goodsEnable && (((isEdit || isInfo) && xxSysp.filterAbbrInfo.length) || isAdd || isCopy)" class="tips fz12 gray"><span class="w100 pr10 inline-block"></span>* 仅支持第三方api接口核销卡券时使用</div>
<div v-if="goodsEnable && (((isEdit || isInfo) && form.goodsFilterId) || isAdd || isCopy)" class="tips fz12 gray"><span class="w100 pr10 inline-block"></span>* 仅支持第三方api接口核销卡券时使用</div>
<!-- <div v-if="xxSysp.goodsEnable && (((isEdit || isInfo) && xxSysp.filterAbbrInfo.length) || isAdd || isCopy)" class="tips fz12 gray"><span class="w100 pr10 inline-block"></span>* 仅支持第三方api接口核销卡券时使用</div> -->
</div>
<!-- 兑换券 -->
<div v-show="form.cardType === 2" class="mb10"><el-checkbox :disabled="isEdit || isInfo" v-model="sale_limit.flag">消费条件</el-checkbox> <span class="fz12 gray">(至少填写一项)</span></div>
......@@ -263,7 +271,8 @@
</div>
<!-- 只有线下门店展示适用商品折扣 -->
<!-- 1: 大于等于 2:大于 3: 等于 4: 小于 5: 小于等于 -->
<div v-if="form.cardApplyChannel.indexOf('offlineStore') !== -1 && form.cardType !== 2 && form.cardType != 3 && xxSysp.goodsEnable">
<div v-if="form.cardApplyChannel.indexOf('offlineStore') !== -1 && form.cardType !== 2 && form.cardType != 3 && goodsEnable">
<!-- <div v-if="form.cardApplyChannel.indexOf('offlineStore') !== -1 && form.cardType !== 2 && form.cardType != 3 && xxSysp.goodsEnable"> -->
<el-checkbox v-model="discount_limit.flag" :disabled="isEdit || isInfo">适用商品折扣</el-checkbox>
<div v-if="discount_limit.flag" class="inline-block">
<el-select :disabled="isEdit || isInfo" v-model="discount_limit.type" class="w100 ml10">
......@@ -467,13 +476,13 @@
</dm-form-bottom>
</el-form>
<el-dialog title="适用商品" :visible.sync="xxSysp.visible" width="700px">
<!-- <el-dialog title="适用商品" :visible.sync="xxSysp.visible" width="700px">
<vue-gic-goods-selector style="max-height:500px;overflow-y:auto;overflow-x:hidden" ref="selector" :projectName="requestProject" isCoupon></vue-gic-goods-selector>
<div slot="footer" class="dialog-footer">
<el-button @click="xxSysp.visible = false">{{ isEdit ? '关闭' : '取消' }}</el-button>
<el-button v-if="isAdd || isCopy" type="primary" @click="xxSyspConfirm">确定</el-button>
</div>
</el-dialog>
</el-dialog> -->
<el-dialog title="成本批量导入" :visible.sync="importCost.visible" width="720px" @close="onCloseImportCost">
<dm-import-file ref="importFile" style="width:680px" :options="importCost.options" @change="handleFileChange" :echo="fileEcho"></dm-import-file>
<template slot="footer">
......
......@@ -4,16 +4,16 @@ import { getEcmInfo, saveEcmInfo, getUseStoredFalg, getXsxsFalg, gicPaymentList
import { getCardManualSetting } from '@/service/api/cardApi.js';
import { listTemplateVariables } from '@/service/api/msgApi.js';
import { klflStrategy } from '@/service/api/gameApi.js'; // 会员等级列表接口
import xxSysp_mix from '@/mixins/selector.js'; // 商品选择器方法mixins
// import xxSysp_mix from '@/mixins/selector.js'; // 商品选择器方法mixins
import marketingEvent from './marketing-event/index.vue';
import { formatDateTimeByType, deepClone } from '@/utils/index.js';
import { formatDateTimeByType /*deepClone*/ } from '@/utils/index.js';
import { isEmpty, numOfDecimal } from '@/utils/strlen.js';
import itemCard from './partials/item-card.vue';
import varDialog from './partials/variables.vue';
import Vue from 'vue';
export default {
name: 'ecm-manage',
mixins: [xxSysp_mix],
// mixins: [xxSysp_mix],
data() {
return {
onlineStatus: 0,
......@@ -40,6 +40,7 @@ export default {
couponAutoGetFlag: 0, // 1开启自动领取 0关闭
couponAutoGetStock: 0, // 自动领取最大库存数
enterpriseId: '',
goodsEnable: false,
form: {
memberType: 0,
ecmPlanName: '',
......@@ -88,6 +89,7 @@ export default {
order_store_new: '',
storedLowest: 0,
storedMax: 0,
goods_filter_id: '', // 商品选择器id
consum_type: 1,
gift_flag: 0,
consumer_store_type: 0,
......@@ -436,7 +438,8 @@ export default {
const commonScene = res.result.commonScene;
const consumTrigger = res.result.consumTrigger;
this.enabledMessageState = res.result.enabledMessageState || 0;
this.xxSysp.goodsEnable = res.result.goodsEnable || false; // 是否支持商品选择器
// this.xxSysp.goodsEnable = res.result.goodsEnable || false; // 是否支持商品选择器
this.goodsEnable = res.result.goodsEnable || false; // 是否支持商品选择器
if (result && !this.isInit) {
this.onlineStatus = result.onlineStatus;
this.creatorId = res.result.ecmDTO.creatorId;
......@@ -540,15 +543,16 @@ export default {
}
// 消费商品
if (res.result.goodsEnable && consumTrigger.goods_filter_id) {
this.xxSysp.goodsFilterId = consumTrigger.goods_filter_id || '';
this.form.goods_filter_id = consumTrigger.goods_filter_id || '';
// this.xxSysp.goodsFilterId = consumTrigger.goods_filter_id || '';
this.consumeChecked.good = !!consumTrigger.goods_filter_id || false;
if (res.result.goodsSearchDetail.detail) {
const goodsSearchDetail = JSON.parse(res.result.goodsSearchDetail.detail);
this.xxSysp.conditionList = goodsSearchDetail.conditionList; // ref selector此时放在modal里并没有渲染,之后赋值
this.xxSysp.conditionList_copy = deepClone(goodsSearchDetail.conditionList); // 备份数据
this.xxSysp.filterAbbrInfo = goodsSearchDetail.filterAbbrInfo || [];
this.xxSysp.filterLogicalOperator = goodsSearchDetail.filterLogicalOperator || [];
}
// if (res.result.goodsSearchDetail.detail) {
// const goodsSearchDetail = JSON.parse(res.result.goodsSearchDetail.detail);
// this.xxSysp.conditionList = goodsSearchDetail.conditionList; // ref selector此时放在modal里并没有渲染,之后赋值
// this.xxSysp.conditionList_copy = deepClone(goodsSearchDetail.conditionList); // 备份数据
// this.xxSysp.filterAbbrInfo = goodsSearchDetail.filterAbbrInfo || [];
// this.xxSysp.filterLogicalOperator = goodsSearchDetail.filterLogicalOperator || [];
// }
this.form.gift_flag = consumTrigger.gift_flag;
}
......@@ -836,7 +840,8 @@ export default {
}
}
// 校验勾选
if (this.consumeChecked.good && !this.xxSysp.goodsFilterId) {
if (this.consumeChecked.good && !this.form.goods_filter_id) {
// if (this.consumeChecked.good && !this.xxSysp.goodsFilterId) {
this.$tips({ type: 'warning', message: '请选择指定消费商品' });
return;
}
......@@ -998,12 +1003,14 @@ export default {
order_store: this.consumeChecked.store ? (this.form.consumerStoreType === 0 ? this.form.order_store : this.form.order_store_new) : ''
};
// 勾选消费商品
if (this.consumeChecked.good && this.xxSysp.goodsFilterId) {
consumeObj.goods_filter_id = this.xxSysp.goodsFilterId;
consumeObj.goodsSearchDetail = JSON.stringify({
conditionList: this.isEdit ? this.xxSysp.conditionList_copy : this.xxSysp.conditionList, // 编辑保存备份数据
filterAbbrInfo: this.xxSysp.filterAbbrInfo
});
if (this.consumeChecked.good && this.form.goods_filter_id) {
// if (this.consumeChecked.good && this.xxSysp.goodsFilterId) {
consumeObj.goods_filter_id = this.form.goods_filter_id;
// consumeObj.goods_filter_id = this.xxSysp.goodsFilterId;
// consumeObj.goodsSearchDetail = JSON.stringify({
// conditionList: this.isEdit ? this.xxSysp.conditionList_copy : this.xxSysp.conditionList, // 编辑保存备份数据
// filterAbbrInfo: this.xxSysp.filterAbbrInfo
// });
consumeObj.gift_flag = this.form.gift_flag;
}
......
......@@ -171,14 +171,15 @@
</div>
</div>
</el-form-item>
<el-form-item v-if="xxSysp.goodsEnable">
<el-form-item v-if="goodsEnable">
<!-- <el-form-item v-if="xxSysp.goodsEnable"> -->
<div class="no_label_form_label">
<el-checkbox class="el-form-item__label align-left" :disabled="!isAdd" v-model="consumeChecked.good">消费商品</el-checkbox>
<div>
<span class="fz14 gray" v-show="!consumeChecked.good && form.consum_type == 1">所有消费商品</span>
<div class="fz14 gray" v-show="!consumeChecked.good && form.consum_type !== 1">勾选后,满足条件的订单中在所选商品范围内的商品金额才会进行统计</div>
<div class="sysp__content clearfix" v-show="consumeChecked.good">
<div class="fl" v-if="xxSysp.filterAbbrInfo.length && !Array.isArray(xxSysp.filterAbbrInfo[0])">
<!-- <div class="fl" v-if="xxSysp.filterAbbrInfo.length && !Array.isArray(xxSysp.filterAbbrInfo[0])">
<template v-for="(item, idx) in xxSysp.filterAbbrInfo">
{{ item.optName }}
<span :key="idx" class="item">{{ item.text }}</span>
......@@ -197,7 +198,10 @@
<el-button v-if="xxSysp.filterAbbrInfo.length > xxSysp.max" type="text" @click="xxSysp.isExpand = !xxSysp.isExpand">{{ xxSysp.isExpand ? '收起' : '展开' }}<i class="el-icon-arrow-down" :class="{ 'is-expand': xxSysp.isExpand }"></i></el-button>
</div>
<el-button type="primary" @click="handleXxSyspClick" class="fl mt5" size="mini">{{ !isAdd ? '查看' : '编辑' }}</el-button>
<el-button v-show="xxSysp.filterAbbrInfo.length && isAdd" @click="handleXxSyspReset" class="fl mt5" size="mini">清空</el-button>
<el-button v-show="xxSysp.filterAbbrInfo.length && isAdd" @click="handleXxSyspReset" class="fl mt5" size="mini">清空</el-button> -->
<dm-goods-selector ref="goodsSelector" mode="dialog" scene-code="productEcm" :projectName="projectName" :disabled="!isAdd" :widget-id.sync="form.goods_filter_id">
<el-button slot="trigger" type="primary" @click="$refs.goodsSelector.showGoodsSelector()" class="fl mt5" size="mini">编辑</el-button>
</dm-goods-selector>
</div>
<div v-show="consumeChecked.good">
<span style="margin-left: 38px;">是否剔除“赠品”类型商品</span>
......@@ -643,13 +647,13 @@
</el-form>
<!-- 消费商品dialog -->
<el-dialog title="适用商品" :visible.sync="xxSysp.visible" width="690px">
<!-- <el-dialog title="适用商品" :visible.sync="xxSysp.visible" width="690px">
<vue-gic-goods-selector ref="selector" :projectName="projectName"></vue-gic-goods-selector>
<div slot="footer" class="dialog-footer">
<el-button @click="xxSysp.visible = false">{{ !isAdd ? '关闭' : '取消' }}</el-button>
<el-button v-if="isAdd" type="primary" @click="xxSyspConfirm">确定</el-button>
</div>
</el-dialog>
</el-dialog> -->
</div>
</template>
<script>
......
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