Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
marketing
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
marketing-web
marketing
Commits
657f1885
Commit
657f1885
authored
Sep 22, 2022
by
caoyanzhi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update: 卡券模块接入商品选择器
parent
336b6020
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
56 deletions
+71
-56
form.js
src/views/card/form.js
+52
-44
form.vue
src/views/card/form.vue
+19
-12
No files found.
src/views/card/form.js
View file @
657f1885
...
...
@@ -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
:
''
,
// 商场抵金券适用门店-部分门店列表数据
...
...
@@ -749,7 +751,7 @@ export default {
// 支持的品牌-商品选择器
if
(
res
.
result
.
goodsEnable
)
{
this
.
xxSysp
.
goodsEnable
=
res
.
result
.
goodsEnable
;
this
.
goodsEnable
=
res
.
result
.
goodsEnable
;
}
// 新增情况下,如果配置了线下门店,默认选中线下门店
...
...
@@ -886,38 +888,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
;
...
...
@@ -1319,14 +1324,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
;
}
//卡券限制
...
...
src/views/card/form.vue
View file @
657f1885
...
...
@@ -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,21 @@
</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>
</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>
<template
v-if=
"goodsEnable && (((isEdit || isInfo) && form.goodsFilterId) || isAdd || isCopy)"
>
<!--
<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"
: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 +269,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 +474,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"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment