Authored by 肖亚东

用户是否关注有货服务号功能开发

... ... @@ -143,5 +143,19 @@ export default {
}).catch(e => {
console.log('error', e);
});
}
},
/**
* 用户是否关注过有货服务号
* 返回值:"isSubscribe": "Y" 已关注 "N"未关注
*/
getUserWechatRelateInfo(uid) {
return api.get({
url: '',
data: {
method: 'app.passport.userWechatRelateInfo',
uid
}
});
},
};
... ...
... ... @@ -163,22 +163,20 @@ Page(Object.assign({
title: '加载中...',
mask: true,
});
},
setTimeout(() => {
app = app || getApp();
if (this.data.scene) {
this.loadDataFromCode().then(() => {
this.init().then(() => {
this._showRepeat();
});
});
} else {
onShow() {
if (this.data.scene) {
this.loadDataFromCode().then(() => {
this.init().then(() => {
this._showRepeat();
});
}
}, 1000);
});
} else {
this.init().then(() => {
this._showRepeat();
});
}
},
loadDataFromCode() {
... ... @@ -231,12 +229,6 @@ Page(Object.assign({
});
},
onShow() {
this.init().then(() => {
this._showRepeat();
});
},
onShareAppMessage: function(res) {
let params = {
TITLE: this.data.productName,
... ... @@ -393,9 +385,6 @@ Page(Object.assign({
(this.data.originUid && this.data.originUid !== this.data.uid)) {
productSourceType = PRODUCT_SOURCE_TYPE.SHARE;
}
let isFollowedServiceNumber = res.data && res.data.isFollowedServiceNumber ? res.data.isFollowedServiceNumber : false;
this.setData({
productSkn: res.data.productSkn ? res.data.productSkn : '',
productName: res.data.productName ? res.data.productName : '',
... ... @@ -410,7 +399,6 @@ Page(Object.assign({
productDesc,
snapData,
productSourceType,
isFollowedServiceNumber,
isNew: res.data.isNew ? res.data.isNew : '',
currentTime: res.data.currentTime ? res.data.currentTime : '',
oldSaleTime: res.data.oldSaleTime ? res.data.oldSaleTime : '',
... ... @@ -662,11 +650,16 @@ Page(Object.assign({
showCancel: false,
success(res) {
if (res.confirm) {
wx.showToast({
icon: 'none',
title: '公众号“YOHOBUY有货”,已复制成功,打开微信去搜索关注吧!',
duration: 3000
});
wx.setClipboardData({
data: 'YOHOBUY有货',
success(res) {
wx.showToast({
icon: 'none',
title: '公众号“YOHOBUY有货”,已复制成功,打开微信去搜索关注吧!',
duration: 3000
});
}
})
}
}
})
... ... @@ -776,6 +769,8 @@ Page(Object.assign({
}).then(() => {
return this.getAssistInfo();
}).then(() => {
return this.getUserWechatRelateInfo();
}).then(() => {
wx.hideLoading();
});
},
... ... @@ -812,6 +807,21 @@ Page(Object.assign({
}
});
},
//用户是否关注过有货服务号
getUserWechatRelateInfo() {
if (!this.data.uid) {
return Promise.resolve();
}
let uid = this.data.uid;
return detailModel.getUserWechatRelateInfo(uid).then(result => {
if (result.code === 200 && result.data.isSubscribe) {
this.setData({
isSubscribe: result.data.isSubscribe,
});
}
});
},
_showRepeat() {
if (this.data.queueStatus === QUEUE_STATUS.QUEUE_HELP) {
this.setData({
... ...
... ... @@ -200,7 +200,7 @@
<block wx:elif="{{showStatus === 6}}">
<action-bar wx:if="{{productSourceType === 1}}">
<view class="bottom1-action">
<view wx:if="{{isFollowedServiceNumber == 'N'}}" class="as-bottom confirm" bindtap="saleRemind">关注公众号获得发售提醒</view>
<view wx:if="{{isSubscribe == 'N'}}" class="as-bottom confirm" bindtap="saleRemind">关注公众号获得发售提醒</view>
<view wx:else class="as-bottom cancel">即将开售</view>
</view>
</action-bar>
... ...