Commit e3ce7542 by 李伟康

增加门店活动

1 parent 5ac14245
......@@ -51,7 +51,6 @@ export default {
sendMessage (i) {
const { shopmall_appid } = window.$fetchConfig
let { merchantId, merchantName, userName, sapCode, uuid } = this.getLocalStorage('dj_scrm_userInfo')
console.log(this.getLocalStorage('dj_scrm_userInfo'))
let { tabIndex, entry } = this
let { name } = this.$route
let { userId, id, couponName, activityName, packageName, goodsName, goodsImage, discountType } = i
......@@ -59,129 +58,80 @@ export default {
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]
let title = {
'coupon': couponName,
'activity': activityName,
'merchant': merchantName
}[name]
if (name === 'coupon') { /**卡券 */
let desc = '您的专属服务顾问为您发来了优惠券,请点击领取~'
let imgUrl = 'http://img01.glsx.com.cn/upload/biz/dracMini-yh-10004.png'
if (tabIndex == 0) {
let path = 'packageMine/pages/boutique/gift/gift'
query = `id=${id}&userId=${userId}&employName=${this.toUnicode(i.employeeName)}&${query}`
if (entryType) this.sendChatMessage({
appid: shopmall_appid,
title: couponName,
imgUrl,
page: `/${path}.html?${query}`
})
else wxConfig
.createMiniprogramUrlLink({
path,
query,
appId: shopmall_appid
})
.then(url => {
this.shareAppMessage(url, desc, couponName, imgUrl)
})
} else {
let path = 'packageMall/pages/coupon/coupon'
params.path = 'packageMall/pages/coupon/coupon'
query = `couponId=${id}&${query}&issueName=${this.toUnicode(userName)}&issueDate=${new Date().getTime()}&shareSource=1&shareStaffName=${this.toUnicode(userName)}&shareStaffUuid=${uuid}`
this.couponShare(i, url => {
if (entryType) this.sendChatMessage({
appid: shopmall_appid,
title: `${couponName}(${window.$discountType[discountType]}券)`,
imgUrl,
page: `/${path}.html?${query}`
})
else wxConfig
.createMiniprogramUrlLink({
path,
query,
appId: shopmall_appid
})
.then(url => {
this.shareAppMessage(url, desc, couponName, imgUrl)
})
})
title = `${couponName}(${window.$discountType[discountType]}券)`
this.couponShare(i)
}
} else if (name === 'activity') { /**活动 */
}
if (name === 'activity') { /**活动 */
if (tabIndex == 0) {
let imgUrl = 'http://img01.glsx.com.cn/upload/biz/dracMini-ms-10004.png'
let path = 'packageMall/pages/detail/detail'
query = `isActivity=true&id=${id}&${query}&shareStaffName=${this.toUnicode(userName)}&shareStaffUuid=${uuid}`
if (entryType) this.sendChatMessage({
appid: shopmall_appid,
title: activityName,
imgUrl,
page: `/${path}.html?${query}`
})
else wxConfig
.createMiniprogramUrlLink({
path,
query,
appId: shopmall_appid
})
.then(url => {
this.shareAppMessage(url, '您有一个秒杀活动可参加', activityName, imgUrl)
})
} else {
/**直播 */
}
} else { /**店铺 */
if (tabIndex == 0) {
let path = 'pages/tab/index/index'
const imgUrl = 'https://img01.glsx.com.cn/weapp/resource/scrm-mobile/activity/miniprogram-cover.jpg'
if (entryType) this.sendChatMessage({
appid: shopmall_appid,
title: merchantName,
imgUrl,
page: `/${path}.html?${query}`
})
else wxConfig
.createMiniprogramUrlLink({
path,
query,
appId: shopmall_appid
})
.then(url => {
this.shareAppMessage(url, '', merchantName, imgUrl)
})
} else if (tabIndex == 1) {
let path = 'packageEquity/pages/package/package'
let imgUrl = 'http://img01.glsx.com.cn/upload/biz/dracMini-qy-10004.png'
query = `id=${id}&${query}&shareStaffName=${this.toUnicode(userName)}&shareStaffUuid=${uuid}`
if (entryType) this.sendChatMessage({
appid: shopmall_appid,
title: packageName,
imgUrl,
page: `/${path}.html?${query}`
})
else wxConfig
.createMiniprogramUrlLink({
path,
query,
appId: shopmall_appid
})
.then(url => {
this.shareAppMessage(url, '您的专属客服顾问为您发来了会员套餐,点击查看哦', packageName, imgUrl)
})
} else {
let path = 'packageMall/pages/detail/detail'
query = `id=${id}&${query}&shareStaffName=${this.toUnicode(userName)}&shareStaffUuid=${uuid}`
if (entryType) this.sendChatMessage({
appid: shopmall_appid,
title: goodsName,
imgUrl: goodsImage,
page: `/${path}.html?${query}`
})
else wxConfig
.createMiniprogramUrlLink({
path,
query,
appId: shopmall_appid
})
.then(url => {
this.shareAppMessage(url, '', goodsName, goodsImage)
})
}
if (name === 'merchant') { /**店铺 */
switch (+tabIndex) {
case 2:
params.path = 'packageEquity/pages/package/package'
params.imgUrl = 'http://img01.glsx.com.cn/upload/biz/dracMini-qy-10004.png'
params.desc = '您的专属客服顾问为您发来了会员套餐,点击查看哦'
query = `id=${id}&${query}&shareStaffName=${this.toUnicode(userName)}&shareStaffUuid=${uuid}`
title = packageName
break;
case 3:
params.path = 'packageMall/pages/detail/detail'
params.imgUrl = goodsImage
params.desc = ''
query = `id=${id}&${query}&shareStaffName=${this.toUnicode(userName)}&shareStaffUuid=${uuid}`
title = goodsName
break
default:
break;
}
}
if (entryType) this.sendChatMessage({
appid: shopmall_appid,
title,
imgUrl: params.imgUrl,
page: `/${params.path}.html?${query}`
})
else this.shareAppMessage({
path: params.path,
query,
appId: shopmall_appid
}, {
desc: params.desc,
title,
imgUrl: params.imgUrl
})
},
sendChatMessage (params) {
wxConfig
......@@ -198,19 +148,21 @@ export default {
this.hideLoading()
})
},
shareAppMessage (link, desc, title, imgUrl) {
shareAppMessage (linkParams, messageParams) {
wxConfig
.shareAppMessage({
title,
desc,
link,
imgUrl
})
.then(() => {
this.hideLoading()
})
.catch(() => {
this.hideLoading()
.createMiniprogramUrlLink(linkParams)
.then(link => {
wxConfig
.shareAppMessage({
link,
...messageParams
})
.then(() => {
this.hideLoading()
})
.catch(() => {
this.hideLoading()
})
})
},
toUnicode (chineseStr = '') {
......@@ -220,7 +172,7 @@ export default {
}
return unicodeStr
},
couponShare (item, callBack) {
couponShare (item) {
let { is_contact, id } = item
let obj = {
couponId: id,
......@@ -232,9 +184,6 @@ export default {
}
]
else obj.shareType = 0
couponApi.getCouponShared(obj).then(res => {
callBack(res.url)
})
}
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!