普兆健康管家前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

359 lines
8.2 KiB

  1. <template>
  2. <view class="page__view">
  3. <navbar title="详情报告" leftClick @leftClick="$utils.navigateBack" color="#191919" bgColor="#FFFFFF" />
  4. <view class="main">
  5. <reportCard>
  6. <view class="section header">
  7. <view>营养师基于你生活习惯和营养目标推荐</view>
  8. <view class="highlight">量身定制的营养方案</view>
  9. </view>
  10. <view class="section" v-for="(step, index) in list" :key="step.key">
  11. <view class="flex section-header">
  12. <view class="section-header-index">
  13. <text>{{ index + 1 }}</text>
  14. <image class="section-header-index-icon" :src="step.url" mode="widthFix"></image>
  15. </view>
  16. <view class="section-header-title">
  17. <view class="section-header-title-name">{{ step.name }}</view>
  18. <view class="section-header-title-desc">{{ step.desc }}</view>
  19. </view>
  20. </view>
  21. <view class="section-content">
  22. <view class="card" v-for="(item, idx) in step.children" :key="item.key" >
  23. <productCard :data="item" @select="onSelect(index, idx, $event)" ></productCard>
  24. </view>
  25. </view>
  26. </view>
  27. <view class="section tips">
  28. *以上是根据你的营养目标以及饮食运动作息状况给出的针对性健康建议可以辅助你达成营养目标同时养成良好的生活习惯
  29. </view>
  30. </reportCard>
  31. </view>
  32. <view class="flex bottom">
  33. <view class="left">
  34. <button class="btn btn-comment">
  35. <view>查看评价</view>
  36. <view class="flex"><text class="highlight">{{ `${comment}` }}</text><uv-icon name="arrow-right" color="#C6C6C6" size="28rpx"></uv-icon></view>
  37. </button>
  38. </view>
  39. <view class="flex right">
  40. <button
  41. class="flex btn btn-cart"
  42. :disabled="!selectedCount"
  43. :class="[selectedCount ? '' : 'is-disabled']"
  44. @click="onAddCart"
  45. >
  46. <text>加入购物车</text>
  47. </button>
  48. <button
  49. class="flex btn btn-settle"
  50. :class="[selectedCount ? '' : 'is-disabled']"
  51. :disabled="!selectedCount"
  52. @click="onSettle"
  53. >
  54. <text>结算</text>
  55. <text v-if="selectedCount">{{ `(${selectedCount})` }}</text>
  56. </button>
  57. </view>
  58. </view>
  59. </view>
  60. </template>
  61. <script>
  62. import reportCard from '@/pages_order/components/reportCard.vue';
  63. import productCard from './productCard.vue';
  64. export default {
  65. components: {
  66. reportCard,
  67. productCard,
  68. },
  69. data() {
  70. return {
  71. list: [],
  72. comment: 0,
  73. }
  74. },
  75. computed: {
  76. selectedCount() {
  77. let count = 0
  78. this.list.forEach(step => {
  79. step.children.forEach(item => {
  80. item.selected && count++
  81. })
  82. })
  83. return count
  84. },
  85. },
  86. onLoad() {
  87. const detectionList = [
  88. {
  89. id: '0011',
  90. url: '/pages_order/static/report/detection-eyes.png',
  91. name: '眼科检查',
  92. desc: '早期发现眼部疾病',
  93. originalPrice: 168,
  94. price: 68.00,
  95. unit: '次',
  96. count: 1,
  97. selected: false,
  98. },
  99. ]
  100. const baseList = [
  101. {
  102. id: '0021',
  103. url: '/pages_order/static/index/medicine-1.png',
  104. name: '全株印度人参',
  105. desc: '安享睡眠情绪舒展',
  106. originalPrice: 688,
  107. price: 1664,
  108. unit: '月',
  109. count: 1,
  110. selected: false,
  111. customized: true,
  112. },
  113. {
  114. id: '0022',
  115. url: '/pages_order/static/index/medicine-2.png',
  116. name: '御氧虾青素',
  117. desc: '安享睡眠情绪舒展',
  118. originalPrice: 688,
  119. price: 1664,
  120. unit: '月',
  121. count: 1,
  122. selected: false,
  123. customized: true,
  124. },
  125. {
  126. id: '0023',
  127. url: '/pages_order/static/index/medicine-3.png',
  128. name: '全株印度人参',
  129. desc: '安享睡眠情绪舒展',
  130. originalPrice: 688,
  131. price: 1664,
  132. unit: '月',
  133. count: 1,
  134. selected: false,
  135. customized: true,
  136. },
  137. {
  138. id: '0024',
  139. url: '/pages_order/static/index/medicine-4.png',
  140. name: '全株印度人参',
  141. desc: '安享睡眠情绪舒展',
  142. originalPrice: 688,
  143. price: 1664,
  144. unit: '月',
  145. count: 1,
  146. selected: false,
  147. customized: true,
  148. },
  149. ]
  150. this.list = [
  151. {
  152. id: '001',
  153. name: '检测方案',
  154. desc: '刚开始健康检测?专家推荐先做这几项',
  155. url: '/pages_order/static/report/report-nutrition-1.png',
  156. children: detectionList
  157. },
  158. {
  159. id: '002',
  160. name: '基础方案',
  161. desc: `刚开始吃维生素?营养师建议从这${baseList.length}颗开始`,
  162. url: '/pages_order/static/report/report-nutrition-2.png',
  163. children: baseList
  164. },
  165. ]
  166. this.comment = 23898
  167. },
  168. methods: {
  169. onSelect(stepIdx, childIdx, selected) {
  170. console.log('onSelect', stepIdx, childIdx, selected)
  171. this.list[stepIdx].children[childIdx].selected = selected
  172. // todo
  173. },
  174. onAddCart() {
  175. console.log('onAddCart')
  176. // todo
  177. },
  178. onSettle() {
  179. console.log('onSettle')
  180. // todo
  181. },
  182. },
  183. }
  184. </script>
  185. <style scoped lang="scss">
  186. .page__view {
  187. width: 100vw;
  188. min-height: 100vh;
  189. background-color: $uni-bg-color;
  190. position: relative;
  191. /deep/ .nav-bar__view {
  192. position: fixed;
  193. top: 0;
  194. left: 0;
  195. }
  196. }
  197. .main {
  198. padding: calc(var(--status-bar-height) + 152rpx) 32rpx 272rpx 32rpx;
  199. }
  200. .section {
  201. & + & {
  202. margin-top: 48rpx;
  203. padding-top: 12rpx;
  204. border-top: 2rpx dashed #989898;
  205. }
  206. &-header {
  207. justify-content: flex-start;
  208. &-index {
  209. position: relative;
  210. font-family: HarmonyOS Sans;
  211. font-weight: 700;
  212. font-size: 96rpx;
  213. line-height: 1.4;
  214. color: #D9D9D9;
  215. &-icon {
  216. position: absolute;
  217. left: 34rpx;
  218. top: 70rpx;
  219. width: 40rpx;
  220. height: 40rpx;
  221. }
  222. }
  223. &-title {
  224. margin-left: 32rpx;
  225. font-family: PingFang SC;
  226. line-height: 1.4;
  227. color: #252545;
  228. &-name {
  229. font-weight: 600;
  230. font-size: 40rpx;
  231. }
  232. &-desc {
  233. font-weight: 400;
  234. font-size: 26rpx;
  235. }
  236. }
  237. }
  238. &-content {
  239. padding-top: 18rpx;
  240. }
  241. }
  242. .section.header {
  243. font-family: PingFang SC;
  244. font-weight: 400;
  245. font-size: 36rpx;
  246. line-height: 1.2;
  247. color: #252545CC;
  248. .highlight {
  249. font-size: 48rpx;
  250. line-height: 1.4;
  251. font-weight: 600;
  252. font-family: PingFang SC;
  253. color: transparent;
  254. background-image: linear-gradient(to right, #4B348F, #845CFA);
  255. background-clip: text;
  256. display: inline-block;
  257. }
  258. }
  259. .card {
  260. & + & {
  261. margin-top: 32rpx;
  262. }
  263. }
  264. .bottom {
  265. width: 100%;
  266. position: fixed;
  267. left: 0;
  268. bottom: 0;
  269. padding: 24rpx 40rpx 92rpx 40rpx;
  270. box-sizing: border-box;
  271. background: #FFFFFF;
  272. column-gap: 16rpx;
  273. .left {
  274. }
  275. .right {
  276. flex: 1;
  277. column-gap: 32rpx;
  278. }
  279. .btn {
  280. &-comment {
  281. display: inline-block;
  282. width: auto;
  283. text-align: left;
  284. font-family: PingFang SC;
  285. font-weight: 400;
  286. font-size: 24rpx;
  287. line-height: 1.4;
  288. color: #626262;
  289. .highlight {
  290. margin-right: 4rpx;
  291. font-family: 600;
  292. font-size: 30rpx;
  293. color: #252545;
  294. }
  295. }
  296. &-cart {
  297. flex: 1;
  298. padding: 14rpx 0;
  299. font-family: PingFang SC;
  300. font-size: 36rpx;
  301. font-weight: 500;
  302. line-height: 1;
  303. color: #252545;
  304. border: 2rpx solid #252545;
  305. border-radius: 41rpx;
  306. }
  307. &-settle {
  308. flex: 1;
  309. padding: 16rpx 0;
  310. font-family: PingFang SC;
  311. font-size: 36rpx;
  312. font-weight: 500;
  313. line-height: 1;
  314. color: #FFFFFF;
  315. background-image: linear-gradient(to right, #4B348F, #845CFA);
  316. border-radius: 41rpx;
  317. }
  318. &.is-disabled {
  319. opacity: 0.5;
  320. }
  321. }
  322. }
  323. </style>