|
|
@@ -488,6 +488,14 @@ selectedMembers: function() {
|
|
|
}
|
|
|
},
|
|
|
onShow: function() {
|
|
|
+ var self = this
|
|
|
+ // 从购买/开通页返回:自动继续生成方案
|
|
|
+ if (uni.getStorageSync('PLAN_RESUME_AFTER_PURCHASE') === '1') {
|
|
|
+ uni.removeStorageSync('PLAN_RESUME_AFTER_PURCHASE')
|
|
|
+ if (this.selectedMemberIds && this.selectedMemberIds.length > 0 && !this.viewMode) {
|
|
|
+ setTimeout(function() { self.doAutoExecute() }, 800)
|
|
|
+ }
|
|
|
+ }
|
|
|
if (this.needReloadMembers) {
|
|
|
this.needReloadMembers = false
|
|
|
if (this.$refs.memberPicker && this.$refs.memberPicker.reload) {
|
|
|
@@ -894,25 +902,32 @@ selectedMembers: function() {
|
|
|
} else {
|
|
|
uni.showToast({ title: '生成失败,请重试', icon: 'none' })
|
|
|
}
|
|
|
- } else if (res.code === 4001) {
|
|
|
- // 付费墙:未购买健康启航计划体验包,提示购买
|
|
|
- uni.showModal({
|
|
|
- title: '需要购买体验会员',
|
|
|
- content: '生成健康方案需先购买「健康启航计划体验会员」(¥199/7天),是否前往购买?',
|
|
|
- confirmText: '去购买',
|
|
|
- cancelText: '暂不',
|
|
|
- success: function(modalRes) {
|
|
|
- if (modalRes.confirm) {
|
|
|
- uni.navigateTo({ url: '/pages/purchase/index' })
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
} else {
|
|
|
uni.showToast({ title: res && res.message ? res.message : '生成失败', icon: 'none' })
|
|
|
}
|
|
|
- }).catch(function() {
|
|
|
+ }).catch(function(err) {
|
|
|
self.loading = false
|
|
|
- uni.showToast({ title: '请求失败,请检查网络', icon: 'none' })
|
|
|
+ // 付费墙:家庭会员或健康启航计划均未开通(request 封装对非 200 code 统一 reject,此处拿到 err.code)
|
|
|
+ if (err && err.code === 4001) {
|
|
|
+ self.showPaywallSheet()
|
|
|
+ } else {
|
|
|
+ uni.showToast({ title: '请求失败,请检查网络', icon: 'none' })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 付费墙引导:三选一(购买家庭会员 / 购买健康启航计划 / 取消)
|
|
|
+ showPaywallSheet: function() {
|
|
|
+ uni.showActionSheet({
|
|
|
+ itemList: ['购买家庭会员', '购买健康启航计划'],
|
|
|
+ success: function(sheetRes) {
|
|
|
+ if (sheetRes.tapIndex === 0) {
|
|
|
+ uni.setStorageSync('PLAN_RESUME_AFTER_PURCHASE', '1')
|
|
|
+ uni.navigateTo({ url: '/pages/membership/upgrade' })
|
|
|
+ } else if (sheetRes.tapIndex === 1) {
|
|
|
+ uni.setStorageSync('PLAN_RESUME_AFTER_PURCHASE', '1')
|
|
|
+ uni.navigateTo({ url: '/pages/purchase/index' })
|
|
|
+ }
|
|
|
+ }
|
|
|
})
|
|
|
},
|
|
|
doAutoExecute: function() {
|