Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx
/
dj-scrm-wx-work-attachment-activity
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 3b59f0da
authored
Aug 10, 2022
by
chenwq
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
活动门店-秒杀+众筹,分享
1 parent
2e17c52e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
130 additions
and
93 deletions
src/api/activityApi.js
src/mixins/shareMixin.js
src/views/activity/index.vue
src/api/activityApi.js
View file @
3b59f0d
...
...
@@ -3,7 +3,10 @@ export default {
/** 分页查询活动 */
getActivityList
(
currentPage
)
{
let
data
=
{
method
:
'scrm.api.shopmall.activity.page'
,
// 秒杀活动
// method: 'scrm.api.shopmall.activity.page',
// 秒杀+众筹
method
:
'scrm.api.shopmall.wechat.crowdfunding.activity.page'
,
pageSize
:
10
,
currentPage
}
...
...
@@ -20,4 +23,4 @@ export default {
data
})
},
}
\ No newline at end of file
}
src/mixins/shareMixin.js
View file @
3b59f0d
import
{
wxConfig
,
bigdatautilApi
}
from
'@/api'
export
default
{
data
()
{
data
()
{
return
{
entry
:
'normal'
}
},
mounted
()
{
mounted
()
{
if
(
this
.
$route
.
meta
.
isTab
||
this
.
$route
.
meta
.
isIndex
)
this
.
wxInit
()
// wxConfig
// .createMiniprogramUrlLink({
...
...
@@ -19,7 +19,7 @@ export default {
// })
},
methods
:
{
wxInit
()
{
wxInit
()
{
let
_this
=
this
wxConfig
.
init
([
'shareAppMessage'
,
'sendChatMessage'
,
'getCurExternalContact'
,
'getContext'
]).
then
(()
=>
{
wxConfig
.
getContext
().
then
(({
entry
})
=>
{
...
...
@@ -28,7 +28,7 @@ export default {
})
})
},
showShareModel
(
i
=
{})
{
showShareModel
(
i
=
{})
{
let
{
tabIndex
,
$route
:
{
name
}
...
...
@@ -48,40 +48,44 @@ export default {
this
.
sendMessage
(
i
)
})
},
sendMessage
(
i
)
{
const
{
shopmall_appid
,
request
:
{
baseURL
}
}
=
window
.
$fetchConfig
sendMessage
(
i
)
{
const
{
shopmall_appid
,
request
:
{
baseURL
}
}
=
window
.
$fetchConfig
let
{
merchantId
,
merchantName
,
userName
,
sapCode
,
uuid
}
=
this
.
getLocalStorage
(
'dj_scrm_userInfo'
)
let
{
tabIndex
,
entry
}
=
this
let
{
name
}
=
this
.
$route
let
{
userId
,
id
,
couponName
,
activityName
,
packageName
,
goodsName
,
goodsImage
,
discountType
,
shareType
}
=
i
let
{
userId
,
id
,
couponName
,
activityName
,
packageName
,
goodsName
,
goodsImage
,
discountType
,
shareType
,
marketingType
}
=
i
let
query
=
`merchantId=
${
merchantId
}
&shareTime=
${
Date
.
now
()}
`
if
(
sapCode
)
query
=
`
${
query
}
&storeCode=
${
sapCode
}
`
const
entryType
=
entry
!=
'normal'
this
.
showLoading
()
let
params
=
{
'coupon'
:
{
path
:
'packageMine/pages/boutique/gift/gift'
,
desc
:
'您的专属服务顾问为您发来了优惠券,请点击领取~'
,
imgUrl
:
'http://img01.glsx.com.cn/upload/biz/dracMini-yh-10004.png'
},
'activity'
:
{
path
:
'packageMall/pages/detail/detail'
,
desc
:
'您有一个秒杀活动可参加'
,
imgUrl
:
'http://img01.glsx.com.cn/upload/biz/dracMini-ms-10004.png'
},
'merchant'
:
{
path
:
'pages/tab/index/index'
,
desc
:
''
,
imgUrl
:
'https://img01.glsx.com.cn/weapp/resource/scrm-mobile/activity/miniprogram-cover.jpg'
}
}[
name
],
coupon
:
{
path
:
'packageMine/pages/boutique/gift/gift'
,
desc
:
'您的专属服务顾问为您发来了优惠券,请点击领取~'
,
imgUrl
:
'http://img01.glsx.com.cn/upload/biz/dracMini-yh-10004.png'
},
activity
:
{
path
:
'packageMall/pages/detail/detail'
,
desc
:
'您有一个秒杀活动可参加'
,
imgUrl
:
'http://img01.glsx.com.cn/upload/biz/dracMini-ms-10004.png'
},
merchant
:
{
path
:
'pages/tab/index/index'
,
desc
:
''
,
imgUrl
:
'https://img01.glsx.com.cn/weapp/resource/scrm-mobile/activity/miniprogram-cover.jpg'
}
}[
name
],
title
=
{
'coupon'
:
couponName
,
'activity'
:
activityName
,
'merchant'
:
merchantName
coupon
:
couponName
,
activity
:
activityName
,
merchant
:
merchantName
}[
name
],
h5Params
=
{}
if
(
name
===
'coupon'
)
{
/**卡券 */
if
(
name
===
'coupon'
)
{
/**卡券 */
if
(
tabIndex
==
0
)
{
query
=
`id=
${
id
}
&userId=
${
userId
}
&employName=
${
this
.
toUnicode
(
i
.
employeeName
)}
&
${
query
}
`
}
else
{
...
...
@@ -91,14 +95,39 @@ export default {
this
.
couponShare
(
i
)
}
}
if
(
name
===
'activity'
)
{
/**活动 */
if
(
tabIndex
==
0
)
{
query
=
`isActivity=true&id=
${
id
}
&
${
query
}
&shareStaffName=
${
this
.
toUnicode
(
userName
)}
&shareStaffUuid=
${
uuid
}
`
}
else
{
/**直播 */
if
(
name
===
'activity'
)
{
/**活动 */
// if (tabIndex == 0) {
// 1-普通秒杀;2-直播间秒杀;3-众筹
switch
(
marketingType
)
{
case
1
:
query
=
`isActivity=true&id=
${
id
}
&
${
query
}
&shareStaffName=
${
this
.
toUnicode
(
userName
)}
&shareStaffUuid=
${
uuid
}
`
break
case
2
:
/** 直播 */
break
case
3
:
shareType
=
'h5'
let
{
corpId
,
agentId
}
=
this
.
getLocalStorage
(
'dj_scrm_corpId'
)
let
link
=
`
${
baseURL
}
/scrm-wx-merchant-activity/#/`
link
=
`
${
link
}
?
${
query
}
&id=
${
i
.
id
}
&shareStaffUuid=
${
uuid
}
&shareStaffName=
${
this
.
toUnicode
(
userName
)}
&shareStaffType=2&corpId=
${
corpId
}
`
if
(
agentId
)
link
=
`
${
link
}
&agentId=
${
agentId
}
`
h5Params
=
{
imgUrl
:
i
.
posterImg
||
i
.
activityImg
,
desc
:
`限时大型众筹,活动时间
${
new
Date
(
i
.
startTime
).
format
(
'yyyy/M/d'
)}
-
${
new
Date
(
i
.
endTime
).
format
(
'yyyy/M/d'
)}
`
,
title
:
i
.
forwardTitle
||
i
.
activityName
,
link
}
break
default
:
break
}
// } else {
// /**直播 */
// }
}
if
(
name
===
'merchant'
)
{
/**店铺 */
if
(
name
===
'merchant'
)
{
/**店铺 */
switch
(
+
tabIndex
)
{
case
1
:
let
isjt
=
i
.
packageType
==
2
...
...
@@ -110,7 +139,7 @@ export default {
params
.
desc
=
'您的专属客服顾问为您发来了会员套餐,点击查看哦'
query
=
`id=
${
id
}
&
${
query
}
&shareStaffName=
${
this
.
toUnicode
(
userName
)}
&shareStaffUuid=
${
uuid
}
&packageType=
${
i
.
packageType
}
`
title
=
packageName
break
;
break
case
2
:
params
.
path
=
'packageMall/pages/detail/detail'
params
.
imgUrl
=
goodsImage
...
...
@@ -131,43 +160,49 @@ export default {
}
break
default
:
break
;
break
}
}
if
(
shareType
==
'h5'
)
{
console
.
log
(
h5Params
)
if
(
entryType
)
this
.
sendChatMessage
(
h5Params
,
'news'
,
()
=>
{
bigdatautilApi
.
reportTrack
(
i
.
id
)
})
else
wxConfig
.
shareAppMessage
(
h5Params
)
.
then
(()
=>
{
this
.
hideLoading
()
if
(
entryType
)
this
.
sendChatMessage
(
h5Params
,
'news'
,
()
=>
{
bigdatautilApi
.
reportTrack
(
i
.
id
)
})
.
catch
(()
=>
{
this
.
hideLoading
()
})
else
wxConfig
.
shareAppMessage
(
h5Params
)
.
then
(()
=>
{
this
.
hideLoading
()
bigdatautilApi
.
reportTrack
(
i
.
id
)
})
.
catch
(()
=>
{
this
.
hideLoading
()
})
}
else
{
if
(
entryType
)
this
.
sendChatMessage
({
appid
:
shopmall_appid
,
title
,
imgUrl
:
params
.
imgUrl
,
page
:
`/
${
params
.
path
}
.html?
${
query
}
`
})
else
this
.
shareAppMessage
({
path
:
params
.
path
,
query
,
appId
:
i
.
packageType
==
2
?
'wxfe82b8d65d07808f'
:
shopmall_appid
},
{
desc
:
params
.
desc
,
title
,
imgUrl
:
params
.
imgUrl
})
if
(
entryType
)
this
.
sendChatMessage
({
appid
:
shopmall_appid
,
title
,
imgUrl
:
params
.
imgUrl
,
page
:
`/
${
params
.
path
}
.html?
${
query
}
`
})
else
this
.
shareAppMessage
(
{
path
:
params
.
path
,
query
,
appId
:
i
.
packageType
==
2
?
'wxfe82b8d65d07808f'
:
shopmall_appid
},
{
desc
:
params
.
desc
,
title
,
imgUrl
:
params
.
imgUrl
}
)
}
},
sendChatMessage
(
params
,
msgtype
=
'miniprogram'
,
callBack
)
{
sendChatMessage
(
params
,
msgtype
=
'miniprogram'
,
callBack
)
{
wxConfig
.
sendChatMessage
({
msgtype
,
...
...
@@ -183,41 +218,40 @@ export default {
this
.
hideLoading
()
})
},
shareAppMessage
(
linkParams
,
messageParams
)
{
wxConfig
.
createMiniprogramUrlLink
(
linkParams
)
.
then
(
link
=>
{
wxConfig
.
shareAppMessage
({
link
,
...
messageParams
})
.
then
(()
=>
{
this
.
hideLoading
()
})
.
catch
(()
=>
{
this
.
hideLoading
()
})
})
shareAppMessage
(
linkParams
,
messageParams
)
{
wxConfig
.
createMiniprogramUrlLink
(
linkParams
).
then
(
link
=>
{
wxConfig
.
shareAppMessage
({
link
,
...
messageParams
})
.
then
(()
=>
{
this
.
hideLoading
()
})
.
catch
(()
=>
{
this
.
hideLoading
()
})
})
},
toUnicode
(
chineseStr
=
''
)
{
toUnicode
(
chineseStr
=
''
)
{
let
unicodeStr
=
''
for
(
let
i
=
0
,
iLength
=
chineseStr
.
length
;
i
<
iLength
;
i
++
)
{
unicodeStr
+=
'@'
+
chineseStr
.
charCodeAt
(
i
).
toString
(
16
)
}
return
unicodeStr
},
couponShare
(
item
)
{
couponShare
(
item
)
{
let
{
is_contact
,
id
}
=
item
let
obj
=
{
couponId
:
id
,
shareType
:
1
}
if
(
is_contact
)
obj
.
userList
=
[
{
userId
:
is_contact
}
]
if
(
is_contact
)
obj
.
userList
=
[
{
userId
:
is_contact
}
]
else
obj
.
shareType
=
0
}
}
...
...
src/views/activity/index.vue
View file @
3b59f0d
...
...
@@ -32,7 +32,7 @@
</div>
<div
class=
"info"
>
<div
class=
"title text-hide"
>
{{
i
.
activityName
}}
</div>
<div
class=
"time"
>
时间:
{{
i
.
startTime
}}
~
{{
i
.
endTime
}}
</div>
<div
class=
"time"
>
时间:
{{
i
.
startTime
Txt
}}
~
{{
i
.
endTimeTxt
}}
</div>
<div
class=
"price flex"
>
<template
v-if=
"i.priceType == 1"
>
<div
class=
"old"
>
原价:¥
{{
i
.
price1
}}
</div>
...
...
@@ -58,7 +58,7 @@
</div>
<div
class=
"info"
>
<div
class=
"title text-hide"
>
{{
i
.
name
}}
</div>
<div
class=
"time"
>
直播时间:
{{
i
.
startTime
}}
</div>
<div
class=
"time"
>
直播时间:
{{
i
.
startTime
Txt
}}
</div>
<div
class=
"zhubo flex"
>
主播:
{{
i
.
anchorName
}}
<div
...
...
@@ -92,7 +92,7 @@ export default {
mixins
:
[
shareMixin
,
pageMixin
],
data
()
{
return
{
tabList
:
[
'
秒杀
活动'
]
tabList
:
[
'
门店
活动'
]
}
},
methods
:
{
...
...
@@ -104,8 +104,8 @@ export default {
console
.
log
(
tabIndex
==
0
?
'活动列表'
:
'直播列表'
,
res
)
if
(
tabIndex
==
0
)
{
res
.
list
.
map
(
e
=>
{
if
(
e
.
startTime
)
e
.
startTime
=
new
Date
(
this
.
iosTimeFormat
(
e
.
startTime
)).
format
(
'yyyy年M月d日'
)
if
(
e
.
endTime
)
e
.
endTime
=
new
Date
(
this
.
iosTimeFormat
(
e
.
endTime
)).
format
(
'yyyy年M月d日'
)
if
(
e
.
startTime
)
e
.
startTime
Txt
=
new
Date
(
this
.
iosTimeFormat
(
e
.
startTime
)).
format
(
'yyyy年M月d日'
)
if
(
e
.
endTime
)
e
.
endTime
Txt
=
new
Date
(
this
.
iosTimeFormat
(
e
.
endTime
)).
format
(
'yyyy年M月d日'
)
e
.
price1
=
this
.
centsToyuan
(
e
.
price1
||
0
)
e
.
price2
=
this
.
centsToyuan
(
e
.
price2
||
0
)
})
...
...
@@ -237,4 +237,4 @@ export default {
}
}
}
</
style
>
\ No newline at end of file
</
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