|
@@ -93,9 +93,9 @@
|
|
|
<view class="section-title" style="margin-top:20rpx">方案结构</view>
|
|
<view class="section-title" style="margin-top:20rpx">方案结构</view>
|
|
|
<view class="section-preview-list">
|
|
<view class="section-preview-list">
|
|
|
<view v-for="(sec, i) in sectionKeys" :key="i" class="section-preview-item">
|
|
<view v-for="(sec, i) in sectionKeys" :key="i" class="section-preview-item">
|
|
|
- <view class="sec-icon">{{ secIcons[i] }}</view>
|
|
|
|
|
|
|
+ <view class="sec-icon">{{ sectionIcons[i] }}</view>
|
|
|
<view class="sec-info">
|
|
<view class="sec-info">
|
|
|
- <text class="sec-title">{{ secTitles[i] }}</text>
|
|
|
|
|
|
|
+ <text class="sec-title">{{ sectionTitles[i] }}</text>
|
|
|
<text class="sec-status" :class="{ done: sections[sec].confirmed }">{{ sections[sec].confirmed ? '已确认' : '待确认' }}</text>
|
|
<text class="sec-status" :class="{ done: sections[sec].confirmed }">{{ sections[sec].confirmed ? '已确认' : '待确认' }}</text>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
@@ -137,7 +137,7 @@
|
|
|
<view class="hint-text">所有板块已确认,点击保存生成最终方案</view>
|
|
<view class="hint-text">所有板块已确认,点击保存生成最终方案</view>
|
|
|
<view class="final-review">
|
|
<view class="final-review">
|
|
|
<view v-for="(sec, i) in sectionKeys" :key="i" class="review-item">
|
|
<view v-for="(sec, i) in sectionKeys" :key="i" class="review-item">
|
|
|
- <text class="review-title">{{ secTitles[i] }}</text>
|
|
|
|
|
|
|
+ <text class="review-title">{{ sectionTitles[i] }}</text>
|
|
|
<text class="review-preview">{{ sections[sec].content.substring(0, 80) }}{{ sections[sec].content.length > 80 ? '...' : '' }}</text>
|
|
<text class="review-preview">{{ sections[sec].content.substring(0, 80) }}{{ sections[sec].content.length > 80 ? '...' : '' }}</text>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
@@ -212,12 +212,14 @@ export default {
|
|
|
// 多人方案结构化数据(common/individual),保存时原样写入 planJson
|
|
// 多人方案结构化数据(common/individual),保存时原样写入 planJson
|
|
|
multiMemberPlanJson: null,
|
|
multiMemberPlanJson: null,
|
|
|
sections: {
|
|
sections: {
|
|
|
- nutrition: { content: '', confirmed: false },
|
|
|
|
|
- diet: { content: '', confirmed: false },
|
|
|
|
|
- exercise: { content: '', confirmed: false }
|
|
|
|
|
|
|
+ nutrition: { content: '', confirmed: false, items: [], tasks: [] },
|
|
|
|
|
+ diet: { content: '', confirmed: false, items: [], tasks: [] },
|
|
|
|
|
+ exercise: { content: '', confirmed: false, items: [], tasks: [] }
|
|
|
},
|
|
},
|
|
|
sectionFeedback: '',
|
|
sectionFeedback: '',
|
|
|
editing: false,
|
|
editing: false,
|
|
|
|
|
+ // 当前正在编辑的板块下标(0=nutrition,1=diet,2=exercise),逐板块确认时递增
|
|
|
|
|
+ editIndex: 0,
|
|
|
// 查看模式
|
|
// 查看模式
|
|
|
viewMode: false,
|
|
viewMode: false,
|
|
|
planDetail: null,
|
|
planDetail: null,
|
|
@@ -248,16 +250,13 @@ export default {
|
|
|
'包含有氧运动、力量训练等运动计划'
|
|
'包含有氧运动、力量训练等运动计划'
|
|
|
]},
|
|
]},
|
|
|
currentSectionKey: function() {
|
|
currentSectionKey: function() {
|
|
|
- var idx = this.step - 3
|
|
|
|
|
- return this.sectionKeys[idx] || ''
|
|
|
|
|
|
|
+ return this.sectionKeys[this.editIndex] || ''
|
|
|
},
|
|
},
|
|
|
currentSectionTitle: function() {
|
|
currentSectionTitle: function() {
|
|
|
- var idx = this.step - 3
|
|
|
|
|
- return this.sectionTitles[idx] || ''
|
|
|
|
|
|
|
+ return this.sectionTitles[this.editIndex] || ''
|
|
|
},
|
|
},
|
|
|
currentSectionHint: function() {
|
|
currentSectionHint: function() {
|
|
|
- var idx = this.step - 3
|
|
|
|
|
- return this.sectionHints[idx] || ''
|
|
|
|
|
|
|
+ return this.sectionHints[this.editIndex] || ''
|
|
|
},
|
|
},
|
|
|
selectedMembers: function() {
|
|
selectedMembers: function() {
|
|
|
var self = this
|
|
var self = this
|
|
@@ -689,7 +688,32 @@ selectedMembers: function() {
|
|
|
var data = res.data
|
|
var data = res.data
|
|
|
// 多人方案:后端返回 {planContent, common, individual} 结构化对象
|
|
// 多人方案:后端返回 {planContent, common, individual} 结构化对象
|
|
|
if (data && typeof data === 'object' && data.common && data.individual) {
|
|
if (data && typeof data === 'object' && data.common && data.individual) {
|
|
|
- self.planData = { overview: data.planContent || '' }
|
|
|
|
|
|
|
+ // 用 common 填充三大板块;再把每位成员的 individual 内容追加到同名板块后
|
|
|
|
|
+ var commonPart = data.common || {}
|
|
|
|
|
+ var commonSections = (commonPart.sections instanceof Array) ? commonPart.sections : []
|
|
|
|
|
+ commonSections.forEach(function(sec) {
|
|
|
|
|
+ if (sec && sec.key && self.sections[sec.key]) {
|
|
|
|
|
+ self.sections[sec.key].content = sec.content || ''
|
|
|
|
|
+ self.sections[sec.key].items = sec.items || []
|
|
|
|
|
+ self.sections[sec.key].tasks = sec.tasks || []
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ var individualPart = data.individual || {}
|
|
|
|
|
+ Object.keys(individualPart).forEach(function(mid) {
|
|
|
|
|
+ var part = individualPart[mid] || {}
|
|
|
|
|
+ var secs = (part.sections instanceof Array) ? part.sections : []
|
|
|
|
|
+ secs.forEach(function(sec) {
|
|
|
|
|
+ if (sec && sec.key && self.sections[sec.key]) {
|
|
|
|
|
+ var block = '### 成员 ' + mid + '\n\n' + (sec.content || '')
|
|
|
|
|
+ var prev = self.sections[sec.key].content
|
|
|
|
|
+ self.sections[sec.key].content = prev ? (prev + '\n\n' + block) : block
|
|
|
|
|
+ if (sec.tasks && sec.tasks.length) {
|
|
|
|
|
+ self.sections[sec.key].tasks = (self.sections[sec.key].tasks || []).concat(sec.tasks)
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+ self.planData = { overview: commonPart.overview || ((commonSections.length || Object.keys(individualPart).length) ? '' : (data.planContent || '')) }
|
|
|
self.multiMemberPlanJson = { common: data.common, individual: data.individual }
|
|
self.multiMemberPlanJson = { common: data.common, individual: data.individual }
|
|
|
self.step = 3
|
|
self.step = 3
|
|
|
} else if (typeof data === 'string') {
|
|
} else if (typeof data === 'string') {
|
|
@@ -735,13 +759,13 @@ selectedMembers: function() {
|
|
|
var level = m.memberLevel || m.levelCode || ''
|
|
var level = m.memberLevel || m.levelCode || ''
|
|
|
if (level && level !== 'FREE') return
|
|
if (level && level !== 'FREE') return
|
|
|
uni.showModal({
|
|
uni.showModal({
|
|
|
- title: '开通 9.9 元/月健康会员',
|
|
|
|
|
- content: '填写健康自检问卷需先开通月度健康会员(9.9 元/月),开通后可填写问卷并生成个性化健康方案。',
|
|
|
|
|
|
|
+ title: '开通 9.9 元/月体验会员',
|
|
|
|
|
+ content: '填写健康自检问卷需先开通体验会员(9.9 元/月),开通后可填写问卷并生成个性化健康方案。',
|
|
|
confirmText: '去开通',
|
|
confirmText: '去开通',
|
|
|
cancelText: '暂不',
|
|
cancelText: '暂不',
|
|
|
success: function(r) {
|
|
success: function(r) {
|
|
|
if (r.confirm) {
|
|
if (r.confirm) {
|
|
|
- uni.navigateTo({ url: '/pages/membership/pay?levelCode=LITE&period=monthly' })
|
|
|
|
|
|
|
+ uni.navigateTo({ url: '/pages/membership/pay?levelCode=BASIC&period=monthly' })
|
|
|
} else {
|
|
} else {
|
|
|
uni.navigateBack({ delta: 1 })
|
|
uni.navigateBack({ delta: 1 })
|
|
|
}
|
|
}
|
|
@@ -801,15 +825,29 @@ selectedMembers: function() {
|
|
|
},
|
|
},
|
|
|
confirmCurrentSection: function() {
|
|
confirmCurrentSection: function() {
|
|
|
var self = this
|
|
var self = this
|
|
|
- self.sections[self.currentSectionKey].confirmed = true
|
|
|
|
|
- self.editing = false
|
|
|
|
|
|
|
+ var key = self.currentSectionKey
|
|
|
|
|
+ if (!key || !self.sections[key]) return
|
|
|
|
|
+ self.sections[key].confirmed = true
|
|
|
self.sectionFeedback = ''
|
|
self.sectionFeedback = ''
|
|
|
- // 检查是否全部确认
|
|
|
|
|
- if (self.allConfirmed) {
|
|
|
|
|
- // 保持在 step 3,显示最终确认区域
|
|
|
|
|
|
|
+ // 定位下一个尚未确认的板块;有则继续编辑,全部确认后退出编辑显示「确认保存」
|
|
|
|
|
+ var nextIdx = -1
|
|
|
|
|
+ for (var i = 0; i < self.sectionKeys.length; i++) {
|
|
|
|
|
+ if (!self.sections[self.sectionKeys[i]].confirmed) { nextIdx = i; break }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (nextIdx >= 0) {
|
|
|
|
|
+ self.editIndex = nextIdx
|
|
|
|
|
+ self.editing = true
|
|
|
|
|
+ } else {
|
|
|
|
|
+ self.editing = false
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
startEdit: function() {
|
|
startEdit: function() {
|
|
|
|
|
+ // 进入编辑:定位第一个未确认的板块(全部已确认时从第一个开始,便于重改)
|
|
|
|
|
+ var idx = 0
|
|
|
|
|
+ for (var i = 0; i < this.sectionKeys.length; i++) {
|
|
|
|
|
+ if (!this.sections[this.sectionKeys[i]].confirmed) { idx = i; break }
|
|
|
|
|
+ }
|
|
|
|
|
+ this.editIndex = idx
|
|
|
this.editing = true
|
|
this.editing = true
|
|
|
this.sectionFeedback = ''
|
|
this.sectionFeedback = ''
|
|
|
},
|
|
},
|