Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
scrm-micro-marketing
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 0b314b9e
authored
Feb 20, 2022
by
周子尧
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'v1.2.0' of
http://192.168.3.233:8090/saas/scrm-micro-marketing
into v1.2.0
2 parents
bb5320df
ffce70f9
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
469 additions
and
85 deletions
src/api/modules/giftBag.js
src/config/index.js
src/views/giftBag/editGift.vue
src/views/giftBag/giftDetail.vue
src/views/giftBag/giftList.vue
src/views/giftBag/selectGiftDialog.vue
src/api/modules/giftBag.js
View file @
0b314b9
...
@@ -76,4 +76,26 @@ const exportGiftInfoApi = params => {
...
@@ -76,4 +76,26 @@ const exportGiftInfoApi = params => {
})
})
}
}
export
default
{
getFollowerStaffListApi
,
getListApi
,
giftExportApi
,
deleteGiftApi
,
getGiftInfoApi
,
getReceivedGiftInfoApi
,
exportGiftInfoApi
}
// 编辑-选择定向礼包列表
const
getDirectionalGiftListApi
=
params
=>
{
params
.
method
=
'scrm.api.coupon.directional.gift.coupon.list'
return
http
({
url
:
'rop-scrm-coupon/router'
,
method
:
'GET'
,
data
:
params
,
sign
:
true
})
}
const
insertGiftApi
=
params
=>
{
params
.
method
=
'scrm.api.coupon.directional.gift.create'
return
http
({
url
:
'rop-scrm-coupon/router'
,
method
:
'POST'
,
data
:
params
,
sign
:
true
,
returnAll
:
true
})
}
export
default
{
getFollowerStaffListApi
,
getListApi
,
giftExportApi
,
deleteGiftApi
,
getGiftInfoApi
,
getReceivedGiftInfoApi
,
exportGiftInfoApi
,
getDirectionalGiftListApi
,
insertGiftApi
}
src/config/index.js
View file @
0b314b9
...
@@ -13,11 +13,11 @@ import { Http } from 'glsx-common'
...
@@ -13,11 +13,11 @@ import { Http } from 'glsx-common'
let
timeout
=
30000
//超时时间
let
timeout
=
30000
//超时时间
export
const
fetchConfig
=
function
(
isEnv
=
true
)
{
export
const
fetchConfig
=
function
(
isEnv
=
true
)
{
// console.log(1111111)
// console.log(1111111)
//
if (isEnv) {
if
(
isEnv
)
{
//
let { request } = cfg
let
{
request
}
=
cfg
//
Object.assign(request, { timeout })
Object
.
assign
(
request
,
{
timeout
})
//
return Promise.resolve(cfg)
return
Promise
.
resolve
(
cfg
)
//
}
}
//return window.fetch('https://', {}).then(res => res.json())
//return window.fetch('https://', {}).then(res => res.json())
// request({ url: 'https://oss-config.test.glsx.com.cn/mock/5be17454f31545347559d499/config/oss_commodity_center', method: 'get' })
// request({ url: 'https://oss-config.test.glsx.com.cn/mock/5be17454f31545347559d499/config/oss_commodity_center', method: 'get' })
return
new
Http
().
get
(
'https://oss-config.test.glsx.com.cn/mock/619c87331072f92988f05a29/marketing/config'
)
return
new
Http
().
get
(
'https://oss-config.test.glsx.com.cn/mock/619c87331072f92988f05a29/marketing/config'
)
...
...
src/views/giftBag/editGift.vue
View file @
0b314b9
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
<div
class=
"gift-content"
>
<div
class=
"gift-content"
>
<div
class=
"gift-item"
v-for=
"(subItem, subIndex) in couponObj[item].list"
:key=
"subIndex"
>
<div
class=
"gift-item"
v-for=
"(subItem, subIndex) in couponObj[item].list"
:key=
"subIndex"
>
<span
:class=
"['circle', subItem.status == '3' ? ' grey' : '']"
></span>
<span
:class=
"['circle', subItem.status == '3' ? ' grey' : '']"
></span>
<p
:class=
"['gift-
info
', subItem.status == '3' ? ' txt-grey' : '']"
>
{{
subItem
.
couponName
}}
×
{{
subItem
.
couponAmount
}}
</p>
<p
:class=
"['gift-
coupon-name
', subItem.status == '3' ? ' txt-grey' : '']"
>
{{
subItem
.
couponName
}}
×
{{
subItem
.
couponAmount
}}
</p>
<p
v-show=
"subItem.status == '3'"
class=
"gift-tips"
>
已失效
</p>
<p
v-show=
"subItem.status == '3'"
class=
"gift-tips"
>
已失效
</p>
<i
class=
"el-icon-delete"
@
click=
"handleGiftDelete(item, subIndex)"
></i>
<i
class=
"el-icon-delete"
@
click=
"handleGiftDelete(item, subIndex)"
></i>
</div>
</div>
...
@@ -42,14 +42,14 @@
...
@@ -42,14 +42,14 @@
<el-button
type=
"default"
@
click=
"handleCancel"
>
取消
</el-button>
<el-button
type=
"default"
@
click=
"handleCancel"
>
取消
</el-button>
<el-button
type=
"primary"
@
click=
"handleConfirm"
>
确定
</el-button>
<el-button
type=
"primary"
@
click=
"handleConfirm"
>
确定
</el-button>
</div>
</div>
<select-gift-dialog></select-gift-dialog>
<select-gift-dialog
v-if=
"isSelectGiftVisible"
:isSelectGiftVisible=
"isSelectGiftVisible"
:selectedGiftList=
"selectedGiftList"
@
handleGiftConfirm=
"handleGiftConfirm"
@
handleGiftClose=
"handleGiftClose"
></select-gift-dialog>
<select-staff-dialog
v-if=
"isMutiSelectVisible"
:isMutiSelectVisible=
"isMutiSelectVisible"
:searchForm=
"searchStaffForm"
:selectedStaffList=
"selectedStaffList"
@
handleMutiSelectConfirm=
"handleMutiSelectConfirm"
@
handleMutiSelectClose=
"handleMutiSelectClose"
></select-staff-dialog>
<select-staff-dialog
v-if=
"isMutiSelectVisible"
:isMutiSelectVisible=
"isMutiSelectVisible"
:searchForm=
"searchStaffForm"
:selectedStaffList=
"selectedStaffList"
@
handleMutiSelectConfirm=
"handleMutiSelectConfirm"
@
handleMutiSelectClose=
"handleMutiSelectClose"
></select-staff-dialog>
</div>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
import
selectStaffDialog
from
'./selectStaffDialog.vue'
import
selectStaffDialog
from
'./selectStaffDialog.vue'
import
selectGiftDialog
from
'./select
Staff
Dialog.vue'
import
selectGiftDialog
from
'./select
Gift
Dialog.vue'
export
default
{
export
default
{
name
:
'editGift'
,
name
:
'editGift'
,
data
()
{
data
()
{
...
@@ -66,6 +66,9 @@ export default {
...
@@ -66,6 +66,9 @@ export default {
isMutiSelectVisible
:
false
,
isMutiSelectVisible
:
false
,
searchStaffForm
:
{},
searchStaffForm
:
{},
selectedStaffList
:
[],
selectedStaffList
:
[],
// 选择定向礼包弹窗
isSelectGiftVisible
:
false
,
selectedGiftList
:
[],
editChildRef
:
'editChildRef'
,
editChildRef
:
'editChildRef'
,
routeInfo
:
{
routeInfo
:
{
// add-新增;edit-编辑;detail-详情
// add-新增;edit-编辑;detail-详情
...
@@ -82,25 +85,26 @@ export default {
...
@@ -82,25 +85,26 @@ export default {
staffList
:
[],
staffList
:
[],
// 优惠券类型(discountType) 1:满减券,2:折扣券,3:代金券,4:兑换券,5:购车代金券,6:商品折扣券,7:会员服务
// 优惠券类型(discountType) 1:满减券,2:折扣券,3:代金券,4:兑换券,5:购车代金券,6:商品折扣券,7:会员服务
// 优惠券状态(status):1:未生效,2:生效中,3:已失效
// 优惠券状态(status):1:未生效,2:生效中,3:已失效
couponList
:
[{
couponList
:
[]
discountType
:
3
,
// couponList: [{
couponName
:
'测试有效期查询券2'
,
// discountType: 3,
couponAmount
:
'1'
,
// couponName: '测试有效期查询券2',
couponAnticipatedCost
:
'10'
,
// couponAmount: '1',
status
:
'2'
// couponAnticipatedCost: '10',
},
{
// status: '2'
discountType
:
3
,
// }, {
couponName
:
'7折代金券'
,
// discountType: 3,
couponAmount
:
'1'
,
// couponName: '7折代金券',
couponAnticipatedCost
:
'20'
,
// couponAmount: '1',
status
:
'3'
// couponAnticipatedCost: '20',
},
{
// status: '3'
discountType
:
3
,
// }, {
couponName
:
'9.9折代金券'
,
// discountType: 3,
couponAmount
:
'5'
,
// couponName: '9.9折代金券',
couponAnticipatedCost
:
'15'
,
// couponAmount: '5',
status
:
'2'
// couponAnticipatedCost: '15',
}]
// status: '2'
// }]
},
},
totalEstimatedCost
:
''
,
totalEstimatedCost
:
''
,
orderShow
:
[
'service'
,
'cash'
,
'discount'
,
'exchange'
],
orderShow
:
[
'service'
,
'cash'
,
'discount'
,
'exchange'
],
...
@@ -236,27 +240,13 @@ export default {
...
@@ -236,27 +240,13 @@ export default {
maxlength
:
50
,
maxlength
:
50
,
width
:
'567px'
width
:
'567px'
}
}
// {
// label: '礼包图片',
// name: 'zoneImg',
// type: 'upload',
// limitSize: 10,
// maxPhotoNum: 1,
// handleUpload: (e, file, targetItem) => {
// const imgFile = e.target.result
// const base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + imgFile.split(',')[1]
// this.$apis.common.uploadImgApi({ file: base64, fileType: 'image' }).then(res => {
// this.editForm[targetItem.name] = res
// this.$refs.editFormRef.$refs[this.editChildRef].validateField(targetItem.name)
// })
// }
// }
]
]
}
}
},
},
components
:
{
components
:
{
selectStaffDialog
selectStaffDialog
,
selectGiftDialog
},
},
watch
:
{
watch
:
{
...
@@ -278,16 +268,20 @@ export default {
...
@@ -278,16 +268,20 @@ export default {
methods
:
{
methods
:
{
getInfo
()
{
getInfo
()
{
this
.
$apis
.
giftBag
.
getGiftInfoApi
({
id
:
this
.
routeInfo
.
id
}).
then
(
res
=>
{
this
.
$apis
.
giftBag
.
getGiftInfoApi
({
id
:
this
.
routeInfo
.
id
})
.
then
(
res
=>
{
this
.
editForm
=
res
.
data
this
.
editForm
=
res
.
data
this
.
editForm
.
receiveWay
=
this
.
editForm
.
receiveWay
+
''
this
.
editForm
.
receiveWay
=
this
.
editForm
.
receiveWay
+
''
this
.
recoveryCoupon
()
this
.
recoveryCoupon
()
this
.
recoveryTotalPrice
()
this
.
recoveryTotalPrice
()
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
this
.
editStatus
=
false
this
.
editStatus
=
false
this
.
loading
=
false
})
})
})
})
.
finally
(()
=>
{
this
.
loading
=
false
})
},
},
recoveryCoupon
()
{
recoveryCoupon
()
{
...
@@ -297,7 +291,6 @@ export default {
...
@@ -297,7 +291,6 @@ export default {
this
.
editForm
.
couponList
.
forEach
(
item
=>
{
this
.
editForm
.
couponList
.
forEach
(
item
=>
{
this
.
couponObj
[
this
.
numToCoupon
[
item
.
discountType
]].
list
.
push
(
item
)
this
.
couponObj
[
this
.
numToCoupon
[
item
.
discountType
]].
list
.
push
(
item
)
})
})
// console.log(this.couponObj)
},
},
receiveWayChange
(
val
)
{
receiveWayChange
(
val
)
{
...
@@ -309,21 +302,47 @@ export default {
...
@@ -309,21 +302,47 @@ export default {
// 计算预估成本
// 计算预估成本
recoveryTotalPrice
()
{
recoveryTotalPrice
()
{
this
.
totalEstimatedCost
=
0
this
.
totalEstimatedCost
=
0
this
.
orderShow
.
forEach
(
it
me
=>
{
this
.
orderShow
.
forEach
(
it
em
=>
{
this
.
couponObj
[
it
me
].
list
.
forEach
(
subItem
=>
{
this
.
couponObj
[
it
em
].
list
.
forEach
(
subItem
=>
{
// 失效券不加入预估成本
// 失效券不加入预估成本
if
(
subItem
.
status
!=
'3'
)
{
if
(
subItem
.
status
!=
'3'
)
{
this
.
totalEstimatedCost
=
this
.
totalEstimatedCost
+
subItem
.
couponAnticipatedCost
*
subItem
.
couponAmount
this
.
totalEstimatedCost
=
this
.
totalEstimatedCost
+
subItem
.
couponAnticipatedCost
*
subItem
.
couponAmount
}
}
})
})
})
})
this
.
totalEstimatedCost
=
(
this
.
totalEstimatedCost
/
100
).
toFixed
(
2
)
},
},
handleGiftAdd
()
{
},
// 礼包
recoveryGiftList
()
{
this
.
editForm
.
couponList
=
[]
this
.
orderShow
.
forEach
(
item
=>
{
this
.
couponObj
[
item
].
list
.
forEach
(
k
=>
{
this
.
editForm
.
couponList
.
push
(
k
)
})
})
},
handleGiftAdd
()
{
this
.
selectedGiftList
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
couponObj
))
this
.
handleGiftClose
()
},
handleGiftConfirm
(
selectedData
)
{
this
.
handleGiftClose
()
this
.
couponObj
=
selectedData
this
.
recoveryTotalPrice
()
this
.
recoveryGiftList
()
},
handleGiftClose
()
{
this
.
isSelectGiftVisible
=
!
this
.
isSelectGiftVisible
},
handleGiftDelete
(
attr
,
idx
)
{
handleGiftDelete
(
attr
,
idx
)
{
this
.
couponObj
[
attr
].
list
.
splice
(
idx
,
1
)
this
.
couponObj
[
attr
].
list
.
splice
(
idx
,
1
)
this
.
recoveryTotalPrice
()
this
.
recoveryTotalPrice
()
this
.
recoveryGiftList
()
},
},
handleStaffRemove
(
val
,
idx
)
{
handleStaffRemove
(
val
,
idx
)
{
...
@@ -351,7 +370,7 @@ export default {
...
@@ -351,7 +370,7 @@ export default {
this
.
editForm
.
staffList
=
[]
this
.
editForm
.
staffList
=
[]
selectedData
.
forEach
(
item
=>
{
selectedData
.
forEach
(
item
=>
{
this
.
editForm
.
staffList
.
push
({
this
.
editForm
.
staffList
.
push
({
staff
Id
:
item
.
userOneId
,
staff
UUID
:
item
.
userOneId
,
staffName
:
item
.
staffName
staffName
:
item
.
staffName
})
})
})
})
...
@@ -363,28 +382,29 @@ export default {
...
@@ -363,28 +382,29 @@ export default {
this
.
$refs
.
editFormRef
.
$refs
[
this
.
editChildRef
].
validate
(
valid
=>
{
this
.
$refs
.
editFormRef
.
$refs
[
this
.
editChildRef
].
validate
(
valid
=>
{
if
(
valid
)
{
if
(
valid
)
{
var
params
=
this
.
$common
.
utils
.
deepClone
(
this
.
editForm
)
var
params
=
this
.
$common
.
utils
.
deepClone
(
this
.
editForm
)
params
.
staffCreateRequests
=
this
.
$common
.
utils
.
deepClone
(
params
.
staffList
)
params
.
couponCreateRequests
=
this
.
$common
.
utils
.
deepClone
(
params
.
couponList
)
delete
params
.
staffList
delete
params
.
couponList
if
(
this
.
routeInfo
.
addOrEdit
==
'edit'
)
{
params
.
id
=
this
.
routeInfo
.
id
}
console
.
log
(
params
)
console
.
log
(
params
)
// if (this.routeInfo.addOrEdit == 'edit') {
this
.
loading
=
true
// params.id = this.routeInfo.id
this
.
$apis
.
giftBag
// }
.
insertGiftApi
(
params
)
// params.merchantList = []
.
then
(
res
=>
{
// this.editForm.merchantList.forEach(item => {
this
.
$message
({
// params.merchantList.push({
message
:
res
.
code
==
'0'
?
'操作成功'
:
res
.
message
,
// merchantId: item.merchantNo,
type
:
res
.
code
==
'0'
?
'success'
:
'error'
// merchantName: item.merchantName,
})
// merchantAccountLevel: item.merchantAccountLevel
if
(
res
.
code
==
'0'
)
{
// })
this
.
cancelJump
()
// })
}
// console.log(params)
})
// this.$apis.zoneList.insertZoneApi(params).then(res => {
.
finally
(()
=>
{
// this.$message({
this
.
loading
=
false
// message: res.code == '0' ? '操作成功' : '操作失败',
})
// type: res.code == '0' ? 'success' : 'error'
// })
// if (res.code == '0') {
// this.cancelJump()
// }
// })
}
}
})
})
},
},
...
@@ -449,7 +469,7 @@ export default {
...
@@ -449,7 +469,7 @@ export default {
.gift-item
{
.gift-item
{
display
:
inline-block
;
display
:
inline-block
;
width
:
50%
;
width
:
50%
;
.gift-
info
{
.gift-
coupon-name
{
display
:
inline-block
;
display
:
inline-block
;
margin
:
0
5px
0
7px
;
margin
:
0
5px
0
7px
;
}
}
...
...
src/views/giftBag/giftDetail.vue
View file @
0b314b9
...
@@ -155,13 +155,15 @@ export default {
...
@@ -155,13 +155,15 @@ export default {
methods
:
{
methods
:
{
getInfo
()
{
getInfo
()
{
this
.
$apis
.
giftBag
.
getGiftInfoApi
({
id
:
this
.
routeInfo
.
id
}).
then
(
res
=>
{
this
.
$apis
.
giftBag
.
getGiftInfoApi
({
id
:
this
.
routeInfo
.
id
})
.
then
(
res
=>
{
this
.
editForm
=
res
.
data
this
.
editForm
=
res
.
data
this
.
recoveryCoupon
()
this
.
recoveryCoupon
()
this
.
recoveryTotalPrice
()
this
.
recoveryTotalPrice
()
this
.
$nextTick
(()
=>
{
this
.
loading
=
false
})
})
.
finally
(()
=>
{
this
.
loading
=
false
})
})
},
},
...
...
src/views/giftBag/giftList.vue
View file @
0b314b9
...
@@ -56,8 +56,8 @@ export default {
...
@@ -56,8 +56,8 @@ export default {
size
:
'small'
,
size
:
'small'
,
url
:
url
,
url
:
url
,
searchForm
:
{
searchForm
:
{
orderCod
e
:
''
,
nam
e
:
''
,
commentStatus
:
''
,
staffName
:
''
,
createDate
:
[]
createDate
:
[]
},
},
tableSearchForm
:
{},
tableSearchForm
:
{},
...
@@ -278,8 +278,8 @@ export default {
...
@@ -278,8 +278,8 @@ export default {
handleReset
()
{
handleReset
()
{
this
.
searchForm
=
{
this
.
searchForm
=
{
orderCod
e
:
''
,
nam
e
:
''
,
commentStatus
:
''
,
staffName
:
''
,
createDate
:
[]
createDate
:
[]
}
}
this
.
handleSearch
()
this
.
handleSearch
()
...
...
src/views/giftBag/selectGiftDialog.vue
View file @
0b314b9
<!-- 选择礼包弹窗 -->
<
template
>
<
template
>
<glsx-dialog
class=
"muti-gift"
title=
"选择礼包内容"
:isVisible
.
sync=
"isSelectGiftVisible"
width=
"70%"
@
confirmDialog=
"handleGiftConfirm"
@
closeDialog=
"handleGiftClose"
v-loading=
"loading"
>
<!--
<div
class=
"nogiftDiv"
v-show=
"!giftList.length && fnCallBack"
>
<img
src=
"@/assets/noPro.png"
/>
<p
class=
"nogiftP"
>
系统暂无已创建的礼包
</p>
</div>
-->
<div
class=
"flex-default"
>
<div
class=
"gift-table flex-grow"
>
<el-tabs
v-model=
"activeName"
@
tab-click=
"handleTabClick"
>
<el-tab-pane
label=
"门店服务"
name=
"service"
></el-tab-pane>
<el-tab-pane
label=
"代金券"
name=
"cash"
></el-tab-pane>
<el-tab-pane
label=
"折扣券"
name=
"discount"
></el-tab-pane>
<el-tab-pane
label=
"兑换券"
name=
"exchange"
></el-tab-pane>
</el-tabs>
<div>
<div>
<glsx-combi-form
class=
"p-16"
style=
"padding-bottom: 0px;"
ref=
"showSearch"
:formObj=
"searchForm"
:formData=
"searchFormData"
>
<span
slot=
"footer"
>
<el-button
:size=
"size"
type=
"primary"
@
click=
"handleSearch"
>
查询
</el-button>
</span>
</glsx-combi-form>
<GLTable
v-loading=
"loading"
ref=
"giftRef"
:tableData=
"giftList"
:noDataImg=
"url"
:tableParams=
"tableParams"
@
refreshTable=
"getList"
@
selectionTable=
"handleSelectionTable"
></GLTable>
</div>
</div>
<div
class=
"selected-list"
>
<p
class=
"list-title p-16"
>
已选(
{{
selectedSum
}}
)
</p>
<div
v-for=
"(item, index) in orderShow"
:key=
"index"
>
<div
class=
"gift-box"
v-show=
"selectedGiftList[item].list.length"
>
<div
class=
"gift-label"
>
{{
selectedGiftList
[
item
].
label
}}
</div>
<div
class=
"gift-content"
>
<div
class=
"gift-item"
v-for=
"(subItem, subIndex) in selectedGiftList[item].list"
:key=
"subIndex"
>
<i
class=
"el-icon-delete"
@
click=
"handleGiftDelete(item, subIndex)"
></i>
<p
:class=
"['gift-coupon-name', 'ellipsis-1', subItem.status == '3' ? ' txt-grey' : '']"
>
{{
subItem
.
couponName
}}
</p>
<div
class=
"gift-sum"
>
<el-input-number
v-if=
"subItem.discountType == 7"
:disabled=
"subItem.status == '3'"
class=
"sum-input"
v-model=
"subItem.couponAmount"
@
change=
"handleChange"
:min=
"1"
:max=
"10"
size=
"mini"
label=
"描述文字"
></el-input-number>
<p
:class=
"[subItem.status == '3' ? ' txt-grey' : '']"
v-else
>
×
{{
subItem
.
couponAmount
}}
</p>
</div>
<!--
<p
v-show=
"subItem.status == '3'"
class=
"gift-tips"
>
已失效
</p>
-->
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</glsx-dialog>
</
template
>
</
template
>
<
script
>
<
script
>
// import { getGoodsList } from '@/api/modules/common'
import
url
from
'@/assets/empty.png'
import
glsxDialog
from
'@/components/glsx-dialog'
export
default
{
export
default
{
name
:
'selectGiftDialog'
,
name
:
'selectGiftDialog'
,
data
()
{
data
()
{
return
{
return
{
// 表格组件
// getListApi: this.$apis.common.getGoodsListApi,
activeName
:
'service'
,
userInfo
:
{},
giftList
:
[],
fnCallBack
:
false
,
url
:
url
,
loading
:
true
,
selectedSum
:
0
,
orderShow
:
[
'service'
,
'cash'
,
'discount'
,
'exchange'
],
numToCoupon
:
{
2
:
'discount'
,
3
:
'cash'
,
4
:
'exchange'
,
7
:
'service'
},
// 搜索
searchForm
:
{
couponName
:
''
},
searchFormData
:
[
{
label
:
'礼包名称'
,
name
:
'couponName'
,
type
:
'input'
,
maxlength
:
30
,
width
:
'415px'
,
placeholder
:
'请输入券/服务名称进行搜索'
,
isClear
:
true
}
],
// pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
// 表格参数
tableParams
:
{
listName
:
'list'
,
// 行数据的key
mutiSelectUniqueKey
:
'id'
,
// 多选ref的名称
mutiSelectName
:
'list'
,
tableColumns
:
[
{
label
:
'名称'
,
prop
:
'couponName'
},
{
label
:
'预估成本/元'
,
prop
:
'anticipatedCost'
,
formatter
:
cellValue
=>
{
return
(
cellValue
.
anticipatedCost
/
100
).
toFixed
(
2
)
}
},
{
label
:
'有效期'
,
prop
:
'followerTypeName'
},
{
label
:
'使用原则'
,
prop
:
'followerTypeName'
},
{
label
:
'剩余库存'
,
prop
:
'residueAmount'
}
]
}
}
},
props
:
{
isSelectGiftVisible
:
{
type
:
Boolean
,
default
:
false
},
selectedGiftList
:
{
type
:
Object
,
default
:
()
=>
{
return
{
// 折扣券
discount
:
{
label
:
'折扣券'
,
discountType
:
2
,
list
:
[]
},
// 代金券
cash
:
{
label
:
'代金券'
,
discountType
:
3
,
list
:
[]
},
// 兑换券
exchange
:
{
label
:
'兑换券'
,
discountType
:
4
,
list
:
[]
},
// 会员服务
service
:
{
label
:
'会员服务'
,
discountType
:
7
,
list
:
[]
}
}
}
}
}
},
},
mounted
()
{
components
:
{
glsxDialog
},
mounted
()
{
this
.
userInfo
=
this
.
$globalState
.
session
this
.
getList
(
true
)
},
},
methods
:
{
methods
:
{
getList
(
isReset
=
false
)
{
var
params
=
{
...
this
.
searchForm
,
discountType
:
this
.
selectedGiftList
[
this
.
activeName
].
discountType
,
pageNum
:
isReset
?
1
:
this
.
$refs
.
giftRef
.
page
.
pageNum
,
pageSize
:
isReset
?
10
:
this
.
$refs
.
giftRef
.
page
.
pageSize
}
this
.
loading
=
true
this
.
$apis
.
giftBag
.
getDirectionalGiftListApi
(
params
)
.
then
(
res
=>
{
this
.
giftList
=
res
.
list
this
.
fnCallBack
=
true
this
.
$refs
.
giftRef
.
tableTotal
=
res
.
total
this
.
recoverySelected
()
this
.
recoveryTotal
()
this
.
$refs
.
giftRef
.
tableHeightValues
=
'50vh'
})
.
finally
(()
=>
{
this
.
loading
=
false
})
},
handleTabClick
()
{
this
.
getList
(
true
)
},
handleSearch
()
{
this
.
getList
(
true
)
},
recoverySelected
()
{
if
(
this
.
selectedGiftList
[
this
.
activeName
].
list
&&
this
.
selectedGiftList
[
this
.
activeName
].
list
.
length
)
{
this
.
selectedGiftList
[
this
.
activeName
].
list
.
forEach
(
row
=>
{
this
.
$refs
.
giftRef
.
$refs
[
this
.
tableParams
.
mutiSelectName
+
'MutiTable'
].
toggleRowSelection
(
row
)
})
}
},
handleGiftDelete
(
attr
,
idx
)
{
this
.
selectedGiftList
[
attr
].
list
.
splice
(
idx
,
1
)
this
.
recoveryTotal
()
},
// 计算已选张数
recoveryTotal
()
{
this
.
selectedSum
=
0
this
.
orderShow
.
forEach
(
itme
=>
{
this
.
selectedGiftList
[
itme
].
list
.
forEach
(
subItem
=>
{
this
.
selectedSum
=
this
.
selectedSum
+
subItem
.
couponAmount
})
})
},
// 选择/取消
handleSelectionTable
(
val
)
{
console
.
log
(
val
)
var
list
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
selectedGiftList
[
this
.
activeName
].
list
))
this
.
selectedGiftList
[
this
.
activeName
].
list
=
[]
val
.
forEach
(
item
=>
{
let
isSelected
=
list
.
find
(
k
=>
k
.
id
==
item
.
id
)
this
.
selectedGiftList
[
this
.
activeName
].
list
.
push
({
id
:
item
.
id
,
discountType
:
item
.
discountType
,
couponName
:
item
.
couponName
,
couponAmount
:
isSelected
?
list
.
find
(
k
=>
k
.
id
==
item
.
id
).
couponAmount
:
'1'
,
couponAnticipatedCost
:
item
.
anticipatedCost
,
status
:
'2'
})
})
list
.
forEach
(
item
=>
{
if
(
item
.
status
==
'3'
)
{
this
.
selectedGiftList
[
this
.
activeName
].
list
.
push
(
item
)
}
})
},
handleGiftConfirm
()
{
// if (!this.giftList.length) {
// var params = {
// addOrEdit: 1,
// groupOrStore: this.userInfo.accountLevel == 4 ? 2 : 1,
// $title: '新建礼包'
// }
// this.$router.push({
// path: '/productGroup/editProduct',
// query: params
// })
// return true
// }
// var selectedData = this.$refs.giftRef.mutiSelectArr[this.tableParams.mutiSelectName]
var
selectedData
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
selectedGiftList
))
this
.
$emit
(
'handleGiftConfirm'
,
selectedData
)
},
handleGiftClose
()
{
this
.
$emit
(
'handleGiftClose'
)
}
}
}
}
}
</
script
>
</
script
>
<
style
lang=
"scss"
>
<
style
scoped
>
.muti-gift
.el-tabs__nav-wrap
:after
{
opacity
:
0
;
}
.muti-gift
.el-tabs__item
{
font-weight
:
400
;
font-size
:
16px
;
color
:
#717171
;
height
:
36px
!important
;
line-height
:
36px
!important
;
}
.muti-gift
.el-tabs__item
:hover
,
.muti-gift
.el-tabs__item.is-active
{
color
:
#5f5efb
;
}
.muti-gift
.m-t-10
{
margin-top
:
10px
;
}
/* .muti-gift .nogiftP {
width: 100%;
height: 20px;
font-family: PingFangSC-Medium;
font-size: 16px;
color: #666666;
line-height: 20px;
font-weight: 500;
text-align: center;
} */
.muti-gift
.gift-table
{
border
:
1px
solid
#eeeeee
;
margin-right
:
10px
;
}
.muti-gift
.p-16
{
padding
:
16px
;
}
.muti-gift
.selected-list
{
width
:
280px
;
border-radius
:
2px
;
border
:
1px
solid
#eeeeee
;
.list-title
{
font-size
:
16px
;
border-bottom
:
1px
solid
#f1f1f1
;
}
.gift-box
{
//
display
:
flex
;
padding
:
16px
;
.gift-label
{
//
width
:
70px
;
color
:
#999999
;
//
text-align
:
right
;
margin-bottom
:
14px
;
}
.gift-content
{
border-bottom
:
1px
solid
#e5e5e5
;
.gift-item
{
display
:
inline-block
;
margin-bottom
:
20px
;
.gift-coupon-name
{
display
:
inline-block
;
width
:
131px
;
margin
:
0
5px
0
7px
;
}
.gift-sum
{
display
:
inline-block
;
width
:
80px
;
text-align
:
right
;
.sum-input
{
display
:
inline-block
;
width
:
80px
;
}
.el-input--mini
.el-input__inner
{
border
:
0px
;
}
.el-input-number--mini
.el-input-number__decrease
,
.el-input-number--mini
.el-input-number__increase
{
width
:
20px
!important
;
border
:
0px
;
background-color
:
#fff
;
}
}
.gift-tips
{
display
:
inline-block
;
font-size
:
12px
;
height
:
18px
;
line-height
:
18px
;
color
:
#999999
;
background-color
:
#eeeded
;
margin-right
:
7px
;
}
}
}
.gift-content
:last-child
{
border-bottom
:
0px
;
}
}
}
</
style
>
</
style
>
Write
Preview
Markdown
is supported
Attach a file
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 post a comment