Commit 657f1885 by caoyanzhi

update: 卡券模块接入商品选择器

parent 336b6020
...@@ -6,8 +6,8 @@ import dmUploadImg from '@/components/upload/img'; ...@@ -6,8 +6,8 @@ import dmUploadImg from '@/components/upload/img';
import linktools from '@/components/linktools-fulls/index'; import linktools from '@/components/linktools-fulls/index';
import dmUploadAvatar from '@/components/upload/avatar'; import dmUploadAvatar from '@/components/upload/avatar';
import sendPreview from './partials/send-preview'; import sendPreview from './partials/send-preview';
import { formatDateTimeByType, deepClone, getTimesByReq } from '@/utils/index.js'; import { formatDateTimeByType, /*deepClone,*/ getTimesByReq } from '@/utils/index.js';
import xxSysp_mix from '@/mixins/selector.js'; // 商品选择器方法 // import xxSysp_mix from '@/mixins/selector.js'; // 商品选择器方法
import { listEntepriseWeimobShop, listEntepriseWeimobCoupon } from '@/service/api/commonApi.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 { 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'; import dmGoodsInput from '@/components/goods-input/index.vue';
...@@ -43,6 +43,7 @@ const initForm = { ...@@ -43,6 +43,7 @@ const initForm = {
startDay: 0, startDay: 0,
limitDay: null, limitDay: null,
cardExplain: '', cardExplain: '',
goodsFilterId: '', // 商品选择器id
// image: { // image: {
// imgUrl: '', // imgUrl: '',
// code: '' // code: ''
...@@ -96,7 +97,7 @@ const preventEnter = function(e) { ...@@ -96,7 +97,7 @@ const preventEnter = function(e) {
} }
}; };
export default { export default {
mixins: [xxSysp_mix], // mixins: [xxSysp_mix],
data() { data() {
const checkSendDateTime = (rule, value, callback) => { const checkSendDateTime = (rule, value, callback) => {
const { sendDateTime, cardEffectiveMode, dateTime, putEffectiveMode } = this.form; const { sendDateTime, cardEffectiveMode, dateTime, putEffectiveMode } = this.form;
...@@ -151,6 +152,7 @@ export default { ...@@ -151,6 +152,7 @@ export default {
}; };
const that = this; const that = this;
return { return {
goodsEnable: false,
storeUuid: '', storeUuid: '',
storeUuidCache: '', storeUuidCache: '',
// 商场抵金券适用门店-部分门店列表数据 // 商场抵金券适用门店-部分门店列表数据
...@@ -749,7 +751,7 @@ export default { ...@@ -749,7 +751,7 @@ export default {
// 支持的品牌-商品选择器 // 支持的品牌-商品选择器
if (res.result.goodsEnable) { if (res.result.goodsEnable) {
this.xxSysp.goodsEnable = res.result.goodsEnable; this.goodsEnable = res.result.goodsEnable;
} }
// 新增情况下,如果配置了线下门店,默认选中线下门店 // 新增情况下,如果配置了线下门店,默认选中线下门店
...@@ -886,38 +888,41 @@ export default { ...@@ -886,38 +888,41 @@ export default {
} }
// 线下适用商品 // 线下适用商品
if (card.goodsSearchDetail && card.goodsFilterId) { // if (card.goodsSearchDetail && card.goodsFilterId) {
this.xxSysp.goodsFilterId = card.goodsFilterId; // this.xxSysp.goodsFilterId = card.goodsFilterId;
const goodsSearchDetail = JSON.parse(card.goodsSearchDetail || '{}'); // const goodsSearchDetail = JSON.parse(card.goodsSearchDetail || '{}');
this.xxSysp.conditionList = this.xxSysp.conditionList_copy = goodsSearchDetail.conditionList; // ref selector此时放在modal里并没有渲染,之后赋值 // this.xxSysp.conditionList = this.xxSysp.conditionList_copy = goodsSearchDetail.conditionList; // ref selector此时放在modal里并没有渲染,之后赋值
this.xxSysp.conditionList = goodsSearchDetail.conditionList; // ref selector此时放在modal里并没有渲染,之后赋值 // this.xxSysp.conditionList = goodsSearchDetail.conditionList; // ref selector此时放在modal里并没有渲染,之后赋值
this.xxSysp.conditionList_copy = deepClone(goodsSearchDetail.conditionList || {}); // 备份数据 // this.xxSysp.conditionList_copy = deepClone(goodsSearchDetail.conditionList || {}); // 备份数据
this.xxSysp.filterLogicalOperator = goodsSearchDetail.filterLogicalOperator || []; // this.xxSysp.filterLogicalOperator = goodsSearchDetail.filterLogicalOperator || [];
if (card.gicCouponType == 3 || card.gicCouponType == 4) { // if (card.gicCouponType == 3 || card.gicCouponType == 4) {
const filterAbbrInfo = (goodsSearchDetail.filterAbbrInfo || []).map(el => { // const filterAbbrInfo = (goodsSearchDetail.filterAbbrInfo || []).map(el => {
return el.map((item, index) => { // return el.map((item, index) => {
if (index == 0) { // if (index == 0) {
item.optName = null; // item.optName = null;
} // }
// intersect 或者,union 并且,diff 剔除 // // intersect 或者,union 并且,diff 剔除
switch (item.optName) { // switch (item.optName) {
case 'union': // case 'union':
item.optName = '或者'; // item.optName = '或者';
break; // break;
case 'intersect': // case 'intersect':
item.optName = '并且'; // item.optName = '并且';
break; // break;
case 'diff': // case 'diff':
item.optName = '剔除'; // item.optName = '剔除';
break; // break;
} // }
return item; // return item;
}); // });
}); // });
this.xxSysp.filterAbbrInfo = this.xxSyspLabel(filterAbbrInfo); // this.xxSysp.filterAbbrInfo = this.xxSyspLabel(filterAbbrInfo);
} else { // } else {
this.xxSysp.filterAbbrInfo = goodsSearchDetail.filterAbbrInfo || []; // this.xxSysp.filterAbbrInfo = goodsSearchDetail.filterAbbrInfo || [];
} // }
// }
if (card.goodsFilterId) {
this.form.goodsFilterId = card.goodsFilterId;
} }
this.form.cardLimit = card.cardLimit; this.form.cardLimit = card.cardLimit;
...@@ -1319,14 +1324,17 @@ export default { ...@@ -1319,14 +1324,17 @@ export default {
} }
// 线下适用商品 // 线下适用商品
if (this.xxSysp.goodsEnable && this.xxSysp.goodsFilterId) { // if (this.xxSysp.goodsEnable && this.xxSysp.goodsFilterId) {
card.goodsFilterId = this.xxSysp.goodsFilterId; // card.goodsFilterId = this.xxSysp.goodsFilterId;
if (this.xxSysp.conditionList) { // if (this.xxSysp.conditionList) {
card.goodsSearchDetail = JSON.stringify({ // card.goodsSearchDetail = JSON.stringify({
conditionList: this.isEdit ? this.xxSysp.conditionList_copy : this.xxSysp.conditionList, // 编辑保存备份数据 // conditionList: this.isEdit ? this.xxSysp.conditionList_copy : this.xxSysp.conditionList, // 编辑保存备份数据
filterAbbrInfo: this.xxSysp.filterAbbrInfo // filterAbbrInfo: this.xxSysp.filterAbbrInfo
}); // 反显数据 // }); // 反显数据
} // }
// }
if (this.goodsEnable && this.form.goodsFilterId) {
card.goodsFilterId = this.form.goodsFilterId;
} }
//卡券限制 //卡券限制
......
...@@ -193,16 +193,17 @@ ...@@ -193,16 +193,17 @@
</div> </div>
</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> <span class="inline-block w100 pr10 text-right" style="vertical-align:top">线下适用商品</span>
<div class="sysp__content clearfix inline-block"> <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"> <template v-for="(item, idx) in xxSysp.filterAbbrInfo">
{{ item.optName }} {{ item.optName }}
<span :key="idx" class="item">{{ item.text }}</span> <span :key="idx" class="item">{{ item.text }}</span>
</template> </template>
</div> </div> -->
<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])">
<div v-for="(item, idx) in xxSysp.filterAbbrInfo" :key="idx"> <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> <div class="complex-and" v-if="idx > 0 && (idx < xxSysp.max || xxSysp.isExpand)">【{{ getXxSysFilterText(idx - 1) }}】</div>
<template v-for="(el, i) in item"> <template v-for="(el, i) in item">
...@@ -213,16 +214,21 @@ ...@@ -213,16 +214,21 @@
</template> </template>
</div> </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> <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> </div> -->
<template v-if="gicCouponType != 3 && gicCouponType != 4"> <template v-if="gicCouponType != 3 && gicCouponType != 4">
<template v-if="xxSysp.goodsEnable && (((isEdit || isInfo) && xxSysp.filterAbbrInfo.length) || isAdd || isCopy)"> <template v-if="goodsEnable && (((isEdit || isInfo) && form.goodsFilterId) || isAdd || isCopy)">
<el-button type="primary" @click="handleXxSyspClick" class="fl mt5" size="mini">{{ isEdit || isInfo ? '查看' : '编辑' }}</el-button> <!-- <template v-if="xxSysp.goodsEnable && (((isEdit || isInfo) && xxSysp.filterAbbrInfo.length) || isAdd || isCopy)"> -->
<el-button v-show="xxSysp.filterAbbrInfo.length && !isEdit && !isInfo" @click="handleXxSyspReset" class="fl mt5" size="mini">清空</el-button> <!-- <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" :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> </template>
<p v-else class="fz14 gray">未选择</p> <p v-else class="fz14 gray">未选择</p>
</template> </template>
</div> </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>
<!-- 兑换券 --> <!-- 兑换券 -->
<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> <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 +269,8 @@ ...@@ -263,7 +269,8 @@
</div> </div>
<!-- 只有线下门店展示适用商品折扣 --> <!-- 只有线下门店展示适用商品折扣 -->
<!-- 1: 大于等于 2:大于 3: 等于 4: 小于 5: 小于等于 --> <!-- 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> <el-checkbox v-model="discount_limit.flag" :disabled="isEdit || isInfo">适用商品折扣</el-checkbox>
<div v-if="discount_limit.flag" class="inline-block"> <div v-if="discount_limit.flag" class="inline-block">
<el-select :disabled="isEdit || isInfo" v-model="discount_limit.type" class="w100 ml10"> <el-select :disabled="isEdit || isInfo" v-model="discount_limit.type" class="w100 ml10">
...@@ -467,13 +474,13 @@ ...@@ -467,13 +474,13 @@
</dm-form-bottom> </dm-form-bottom>
</el-form> </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> <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"> <div slot="footer" class="dialog-footer">
<el-button @click="xxSysp.visible = false">{{ isEdit ? '关闭' : '取消' }}</el-button> <el-button @click="xxSysp.visible = false">{{ isEdit ? '关闭' : '取消' }}</el-button>
<el-button v-if="isAdd || isCopy" type="primary" @click="xxSyspConfirm">确定</el-button> <el-button v-if="isAdd || isCopy" type="primary" @click="xxSyspConfirm">确定</el-button>
</div> </div>
</el-dialog> </el-dialog> -->
<el-dialog title="成本批量导入" :visible.sync="importCost.visible" width="720px" @close="onCloseImportCost"> <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> <dm-import-file ref="importFile" style="width:680px" :options="importCost.options" @change="handleFileChange" :echo="fileEcho"></dm-import-file>
<template slot="footer"> <template slot="footer">
......
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