Commit bd5afcff by 李伟康

commit

1 parent 8338349e
...@@ -2,7 +2,9 @@ import { shopmallApi, activityApi, couponApi, liveApi, boutiquecouponApi, equity ...@@ -2,7 +2,9 @@ import { shopmallApi, activityApi, couponApi, liveApi, boutiquecouponApi, equity
const { environment } = window.$fetchConfig const { environment } = window.$fetchConfig
export default { export default {
data() { data() {
return {} return {
entry: ''
}
}, },
mounted() { mounted() {
if (this.$route.meta.isTab) this.wxInit() if (this.$route.meta.isTab) this.wxInit()
...@@ -13,11 +15,12 @@ export default { ...@@ -13,11 +15,12 @@ export default {
wxConfig.init(['shareAppMessage', 'sendChatMessage', 'getCurExternalContact', 'getContext']).then(() => { wxConfig.init(['shareAppMessage', 'sendChatMessage', 'getCurExternalContact', 'getContext']).then(() => {
wxConfig.getContext().then(({ entry }) => { wxConfig.getContext().then(({ entry }) => {
_this.$parent.entry = entry _this.$parent.entry = entry
_this.entry = entry
}) })
}) })
}, },
showShareModel(i) { showShareModel(i) {
let { tabIndex } = this let { tabIndex, entry } = this
if (tabIndex == 0 && i.remainAmount < 1) return if (tabIndex == 0 && i.remainAmount < 1) return
if (tabIndex == 1 && i.residueAmount < 1) return if (tabIndex == 1 && i.residueAmount < 1) return
wxConfig wxConfig
...@@ -27,15 +30,15 @@ export default { ...@@ -27,15 +30,15 @@ export default {
i.is_contact = res i.is_contact = res
this.sendMessage(i) this.sendMessage(i)
}) })
.catch(err => { .catch(() => {
this.sendMessage(i) this.sendMessage(i)
}) })
}, },
sendMessage(i) { sendMessage(i) {
let { merchantId } = this.getLocalStorage('dj_scrm_userInfo') let { merchantId } = this.getLocalStorage('dj_scrm_userInfo')
let { tabIndex } = this let { tabIndex, entry } = this
let { name } = this.$route let { name } = this.$route
let { is_contact, userId, id, couponName, activityName, packageName, goodsName, goodsImage } = i let { userId, id, couponName, activityName, packageName, goodsName, goodsImage } = i
let shopmall_appId = environment == 'beta' ? 'wx9f91c1ec493eb425' : 'wxe10067a63c1856ac' let shopmall_appId = environment == 'beta' ? 'wx9f91c1ec493eb425' : 'wxe10067a63c1856ac'
let dj_appId = 'wx06d1198e751435d1' let dj_appId = 'wx06d1198e751435d1'
this.showLoading() this.showLoading()
...@@ -46,7 +49,7 @@ export default { ...@@ -46,7 +49,7 @@ export default {
let desc = '您的专属服务顾问为您发来了优惠券,请点击领取~' let desc = '您的专属服务顾问为您发来了优惠券,请点击领取~'
let imgUrl = 'http://img01.glsx.com.cn/upload/biz/dracMini-yh-10004.png' let imgUrl = 'http://img01.glsx.com.cn/upload/biz/dracMini-yh-10004.png'
if (tabIndex == 0) { if (tabIndex == 0) {
if (is_contact) if (entry != 'normal')
this.sendChatMessage({ this.sendChatMessage({
appid: dj_appId, appid: dj_appId,
title: couponName, title: couponName,
...@@ -60,7 +63,7 @@ export default { ...@@ -60,7 +63,7 @@ export default {
} }
} else { } else {
this.couponShare(i, res => { this.couponShare(i, res => {
if (is_contact) if (entry != 'normal')
this.sendChatMessage({ this.sendChatMessage({
appid: shopmall_appId, appid: shopmall_appId,
title: packageName, title: packageName,
...@@ -77,7 +80,7 @@ export default { ...@@ -77,7 +80,7 @@ export default {
case 'activity': { case 'activity': {
if (tabIndex == 0) { if (tabIndex == 0) {
let imgUrl = 'http://img01.glsx.com.cn/upload/biz/dracMini-ms-10004.png' let imgUrl = 'http://img01.glsx.com.cn/upload/biz/dracMini-ms-10004.png'
if (is_contact) if (entry != 'normal')
this.sendChatMessage({ this.sendChatMessage({
appid: shopmall_appId, appid: shopmall_appId,
title: activityName, title: activityName,
...@@ -97,7 +100,7 @@ export default { ...@@ -97,7 +100,7 @@ export default {
case 'merchant': { case 'merchant': {
if (tabIndex == 0) { if (tabIndex == 0) {
let imgUrl = 'http://img01.glsx.com.cn/upload/biz/dracMini-qy-10004.png' let imgUrl = 'http://img01.glsx.com.cn/upload/biz/dracMini-qy-10004.png'
if (is_contact) if (entry != 'normal')
this.sendChatMessage({ this.sendChatMessage({
appid: shopmall_appId, appid: shopmall_appId,
title: packageName, title: packageName,
...@@ -110,7 +113,7 @@ export default { ...@@ -110,7 +113,7 @@ export default {
}) })
} }
} else { } else {
if (is_contact) if (entry != 'normal')
this.sendChatMessage({ this.sendChatMessage({
appid: shopmall_appId, appid: shopmall_appId,
title: goodsName, title: goodsName,
...@@ -164,15 +167,15 @@ export default { ...@@ -164,15 +167,15 @@ export default {
return unicodeStr return unicodeStr
}, },
couponShare(item, callBack) { couponShare(item, callBack) {
let { userId, id } = item let { is_contact, id } = item
let obj = { let obj = {
couponId: id, couponId: id,
shareType: 1 shareType: 1
} }
if (userId) if (is_contact)
obj.userList = [ obj.userList = [
{ {
userId userId: is_contact
} }
] ]
else obj.shareType = 0 else obj.shareType = 0
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!