Commit e3ce7542 by 李伟康

增加门店活动

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