contrast - 副本 (4).vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649
  1. <template>
  2. <view class="user-setting-box">
  3. <uni-nav-bar :status-bar="false" :shadow="false" :border="false" :fixed="true" color="#333" background-color=""
  4. height="88px" leftWidth="0" rightWidth="0">
  5. <view class="nav-bg">
  6. <view class="status-bar"></view>
  7. <view class="nav-title">
  8. <view class="left">
  9. <IconText style="padding: 5px;" @click.native="handleBack" color="#666" :code="`\ue709`"
  10. size="16" />
  11. <IconText style="padding: 5px;" @click.native="handleFront" color="#333" :code="`\ue8a0`"
  12. size="18" />
  13. </view>
  14. <view class="title">比奶粉</view>
  15. <view class="right"></view>
  16. </view>
  17. </view>
  18. </uni-nav-bar>
  19. <view class="content">
  20. <!-- <view class="left-fixed">
  21. <view class="info">
  22. </view>
  23. </view> -->
  24. <view class="top-goods-box">
  25. <view>
  26. <view class="left">
  27. <view class="info"></view>
  28. </view>
  29. <view class="goods-list">
  30. <view class="good-item" v-for="(item, index) in goodsList" :key="index">
  31. <image :src="item.masterPic" class="pic" mode="aspectFill">
  32. </image>
  33. <view class="name">{{item.name}}</view>
  34. <view class="price-box">参考价:<view class="price">¥{{item.price}}</view>
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. <view class="bottom-info-box">
  41. <view class="left">
  42. <view class="title"
  43. :style="{backgroundImage: `url(${staticUrl ? staticUrl + 'title-bg.png' : ''})`}">基础概况</view>
  44. <view class="table">
  45. <view class="row" v-for="(item, index) in baseInfo" :key="index">
  46. <view class="ceil">
  47. {{item.name}}
  48. <view class="hidden-box">
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. <view class="title"
  54. :style="{backgroundImage: `url(${staticUrl ? staticUrl + 'title-bg.png' : ''})`}">综合对比</view>
  55. <view class="table">
  56. <view class="row" v-for="(item, index) in comprehensiveInfo" :key="index">
  57. <view class="ceil">
  58. {{item.name}}
  59. </view>
  60. </view>
  61. </view>
  62. <view class="title"
  63. :style="{backgroundImage: `url(${staticUrl ? staticUrl + 'title-bg.png' : ''})`}">营养成分</view>
  64. <view class="table">
  65. <view class="row">
  66. <view class="ceil head-ceil">基础营养</view>
  67. </view>
  68. <view class="row" v-for="(item, index) in componentInfo1" :key="index">
  69. <view class="ceil ceil2">
  70. {{item.name}}
  71. </view>
  72. </view>
  73. </view>
  74. <view class="table">
  75. <view class="row">
  76. <view class="ceil head-ceil">基础营养</view>
  77. </view>
  78. <view class="row" v-for="(item, index) in componentInfo2" :key="index">
  79. <view class="ceil ceil2">
  80. {{item.name}}
  81. </view>
  82. </view>
  83. </view>
  84. </view>
  85. <view class="right">
  86. <view class="title"></view>
  87. <view class="table">
  88. <view class="row" v-for="(item, index) in baseInfo" :key="index">
  89. <view class="ceil" v-for="(ceil, ceilIndex) in goodsList" :key="ceilIndex">
  90. {{ceil[item.key] || '-'}}
  91. </view>
  92. </view>
  93. </view>
  94. <view class="title"></view>
  95. <view class="table">
  96. <view class="row" v-for="(item, index) in comprehensiveInfo" :key="index">
  97. <view class="ceil" v-for="(ceil, ceilIndex) in goodsList" :key="ceilIndex">
  98. <view v-if="item.type === 'list'">
  99. <view v-if="ceil[item.key] && ceil[item.key].length" class="ceil-list">
  100. <view v-for="(i,j) in ceil[item.key]" :key="j" class="ceil-list-item">
  101. {{i.labelName}}
  102. </view>
  103. </view>
  104. <view v-else>
  105. -
  106. </view>
  107. </view>
  108. <view v-else>
  109. {{ceil[item.key] || '-'}}
  110. </view>
  111. </view>
  112. </view>
  113. </view>
  114. <view class="title"></view>
  115. <view class="table">
  116. <view class="row">
  117. <view class="ceil head-ceil" v-for="(ceil, ceilIndex) in goodsList" :key="ceilIndex">
  118. 每100g
  119. </view>
  120. </view>
  121. <view class="row" v-for="(item, index) in componentInfo1" :key="index">
  122. <view class="ceil ceil2" v-for="(ceil, ceilIndex) in goodsList" :key="ceilIndex">
  123. {{item.name}}
  124. </view>
  125. </view>
  126. </view>
  127. <view class="table">
  128. <view class="row">
  129. <view class="ceil head-ceil" v-for="(ceil, ceilIndex) in goodsList" :key="ceilIndex">
  130. 每100g
  131. </view>
  132. </view>
  133. <view class="row" v-for="(item, index) in componentInfo2" :key="index">
  134. <view class="ceil ceil2" v-for="(ceil, ceilIndex) in goodsList" :key="ceilIndex">
  135. {{item.name}}
  136. </view>
  137. </view>
  138. </view>
  139. </view>
  140. </view>
  141. </view>
  142. <!-- <TabBar></TabBar> -->
  143. </view>
  144. </template>
  145. <script lang="ts">
  146. import {
  147. Component,
  148. Mixins
  149. } from 'vue-property-decorator';
  150. import loginMixin from '@/common/mixins/loginMixin.ts';
  151. import {
  152. types
  153. } from '@/common/store/index';
  154. import {
  155. namespace
  156. } from 'vuex-class';
  157. const baseModule = namespace('base');
  158. @Component({})
  159. export default class SelectBaby extends Mixins(loginMixin) {
  160. // @baseModule.Getter('_userInfo') _userInfo: any;
  161. @baseModule.Mutation(types.SET_TABBARINDEX) setTabBarIndex : any;
  162. staticUrl : string = this.$oss_url; //oss地址\
  163. goodsList : any = []
  164. baseInfo : any = [
  165. {
  166. name: '品牌',
  167. key: 'brandName'
  168. },
  169. {
  170. name: '产地',
  171. key: 'milkOriginName'
  172. },
  173. {
  174. name: '版本',
  175. key: 'milkVersionName'
  176. },
  177. {
  178. name: '类别',
  179. key: 'milkCategoryName'
  180. },
  181. {
  182. name: '奶源',
  183. key: 'milkSourceName'
  184. },
  185. {
  186. name: '价格',
  187. key: 'price'
  188. },
  189. {
  190. name: '段位',
  191. key: 'milkStageName'
  192. },
  193. {
  194. name: '规格',
  195. key: 'milkSpecificationName'
  196. },
  197. {
  198. name: '适用年龄',
  199. key: 'milkRecommendedAgeName'
  200. },
  201. ];
  202. comprehensiveInfo : any = [
  203. {
  204. name: '优点',
  205. key: 'advantageLabels',
  206. type: 'list'
  207. },
  208. {
  209. name: '常规配方',
  210. key: 'normalLabels',
  211. type: 'list'
  212. },
  213. {
  214. name: '强化配方',
  215. key: 'fortifyLabels',
  216. type: 'list'
  217. },
  218. // {
  219. // name: '注意',
  220. // key: 'a'
  221. // },
  222. {
  223. name: '奶源分析',
  224. key: 'sourceReview'
  225. },
  226. {
  227. name: '原料分析',
  228. key: 'materialReview'
  229. },
  230. ];
  231. componentInfo1 : any = [
  232. {
  233. name: '能量(kJ)',
  234. key: 'a'
  235. },
  236. {
  237. name: '蛋白质(g)',
  238. key: 'a'
  239. },
  240. {
  241. name: '脂肪(g)',
  242. key: 'a'
  243. },
  244. {
  245. name: '亚油酸(g)',
  246. key: 'a'
  247. },
  248. {
  249. name: 'α-亚麻酸(mg)',
  250. key: 'a'
  251. },
  252. {
  253. name: '碳水化合物(g)',
  254. key: 'a'
  255. },
  256. ];
  257. componentInfo2 : any = [
  258. {
  259. name: '维生素A(μgRE)',
  260. key: 'a'
  261. },
  262. {
  263. name: '维生素D(μg)',
  264. key: 'a'
  265. },
  266. {
  267. name: '维生素E(mgα-TE)',
  268. key: 'a'
  269. },
  270. {
  271. name: '牛磺酸(mg)',
  272. key: 'a'
  273. },
  274. {
  275. name: '左旋肉碱(mg)',
  276. key: 'a'
  277. },
  278. {
  279. name: 'DHA(mg)',
  280. key: 'a'
  281. },
  282. {
  283. name: 'ARA/AA(mg)',
  284. key: 'a'
  285. },
  286. {
  287. name: '低聚半乳糖(g)',
  288. key: 'a'
  289. },
  290. {
  291. name: '低聚果糖(g)',
  292. key: 'a'
  293. },
  294. {
  295. name: 'OPO(g)',
  296. key: 'a'
  297. },
  298. {
  299. name: '叶黄素(μg)',
  300. key: 'a'
  301. },
  302. {
  303. name: '核苷酸(mg)',
  304. key: 'a'
  305. },
  306. {
  307. name: '乳铁蛋白(mg)',
  308. key: 'a'
  309. },
  310. {
  311. name: 'HMO(g)',
  312. key: 'a'
  313. },
  314. ];
  315. scrollLeft : any = 0;
  316. scrollTop : any = 0;
  317. ids : any = [];
  318. onShow() {
  319. console.log(this.$Route.query.ids)
  320. this.ids = [21, 19, 20];
  321. let promise = this.ids.map((item : any) => {
  322. return this.getGoodDetail(item);
  323. });
  324. Promise.all(promise).then((res : any) => {
  325. this.goodsList = res;
  326. })
  327. }
  328. getGoodDetail(id : any) {
  329. return this.$http
  330. .get({
  331. url: this.$api.getGoodInfo,
  332. data: {
  333. id
  334. }
  335. })
  336. .then((res : any) => {
  337. return res;
  338. }, (err : any) => {
  339. console.log(err);
  340. });
  341. }
  342. handleBack() {
  343. this.$Router.back(1);
  344. }
  345. handleFront() {
  346. this.$Router.pushTab({
  347. path: '/pages/front/front'
  348. })
  349. }
  350. scrollInfo(e : any) {
  351. console.log(e)
  352. this.scrollTop = e.detail.scrollTop;
  353. this.scrollLeft = e.detail.scrollLeft;
  354. }
  355. }
  356. </script>
  357. <style lang="scss" scoped>
  358. page {
  359. background: #f5f5f5;
  360. }
  361. /deep/.uni-navbar__header {
  362. padding: 0 !important;
  363. .uni-navbar__header-container {
  364. padding: 0 !important;
  365. }
  366. }
  367. .user-setting-box {
  368. height: 100vh;
  369. @include flex-y(flex-start);
  370. .nav-bg {
  371. width: 100%;
  372. background: #fff;
  373. @include flex-y(flex-start);
  374. background: linear-gradient(180deg, #FFD9F9 0%, #F1E6FF 67.19%, #F1E9FE 82.84%, #FBF6FC 100%);
  375. .status-bar {
  376. // height: var(--status-bar-height);
  377. height: 44px;
  378. }
  379. .nav-title {
  380. width: 100%;
  381. box-sizing: border-box;
  382. height: 40px;
  383. padding: 0 vw(3);
  384. @include flex-x();
  385. @include word-vw(16, #000);
  386. .left,
  387. .right {
  388. width: vw(60);
  389. @include flex-x(flex-satrt);
  390. }
  391. .title {
  392. flex: 1;
  393. @include flex-x(center);
  394. }
  395. }
  396. }
  397. .content {
  398. width: 100%;
  399. height: 100%;
  400. overflow: auto;
  401. // padding: 0 vw(15);
  402. box-sizing: border-box;
  403. @include flex-y(flex-start, flex-start);
  404. &::-webkit-scrollbar {
  405. width: 0px;
  406. height: 0px;
  407. }
  408. .left-fixed {
  409. box-sizing: border-box;
  410. position: sticky;
  411. left: 0;
  412. top: 0;
  413. // top: 88px;
  414. // left: 0;
  415. z-index: 999;
  416. padding-top: vw(16);
  417. background: #F6F8FB;
  418. .info {
  419. width: vw(110);
  420. height: vw(144);
  421. border: vw(1) solid #EBEBEB;
  422. background: #fff;
  423. box-sizing: border-box;
  424. }
  425. }
  426. // padding-bottom: vw(50);
  427. .top-goods-box {
  428. width: 100%;
  429. height: vw(160);
  430. padding-top: vw(16);
  431. background: #F6F8FB;
  432. @include flex-x(flex-start, flex-end);
  433. box-sizing: border-box;
  434. position: sticky;
  435. top: 0;
  436. background: #F6F8FB;
  437. z-index: 100;
  438. .left {
  439. width: vw(110);
  440. padding-top: 16px;
  441. height: vw(160);
  442. flex-shrink: 0;
  443. box-sizing: border-box;
  444. position: sticky;
  445. left: 0;
  446. top: 0;
  447. .info {
  448. width: vw(110);
  449. height: vw(144);
  450. background: #fff;
  451. border: vw(1) solid #EBEBEB;
  452. border-left-width: 0;
  453. box-sizing: border-box;
  454. }
  455. // top: 104px;
  456. }
  457. .goods-list {
  458. @include flex-x(flex-start);
  459. padding-top: 16px;
  460. background: #F6F8FB;
  461. padding-left: vw(110);
  462. .good-item {
  463. width: vw(100);
  464. height: vw(144);
  465. border: vw(1) solid #EBEBEB;
  466. border-left-width: 0;
  467. box-sizing: border-box;
  468. flex-shrink: 0;
  469. @include flex-y(flex-start);
  470. background: #fff;
  471. .pic {
  472. @include wh(64, 64);
  473. margin-top: vw(16);
  474. background: red;
  475. }
  476. .name {
  477. @include flex-x(center);
  478. text-align: center;
  479. @include word-vw(10, #333);
  480. margin-top: vw(5);
  481. padding: 0 vw(3);
  482. box-sizing: border-box;
  483. font-weight: bold;
  484. @include multi(2);
  485. }
  486. .price-box {
  487. @include word-vw(10, #999);
  488. @include flex-x(center);
  489. margin-top: vw(5);
  490. .price {
  491. @include word-vw(12, #FF5733);
  492. }
  493. }
  494. }
  495. }
  496. }
  497. .title {
  498. // width: vw(98);
  499. background: #F6F8FB;
  500. @include word-vw(14, #333);
  501. font-weight: bold;
  502. height: vw(35);
  503. @include flex-x(flex-start);
  504. background-size: auto vw(6);
  505. background-position: vw(12) vw(22);
  506. background-repeat: no-repeat;
  507. // margin-left: vw(12);
  508. padding-left: vw(18);
  509. box-sizing: border-box;
  510. }
  511. .table {
  512. border-bottom: vw(1) solid #EBEBEB;
  513. .row {
  514. @include flex-x(flex-start);
  515. align-items: stretch;
  516. .ceil {
  517. width: vw(100);
  518. min-height: vw(32);
  519. // height: 100%;
  520. flex: 1;
  521. border-top: vw(1) solid #EBEBEB;
  522. border-right: vw(1) solid #EBEBEB;
  523. box-sizing: border-box;
  524. @include word-vw(12, #999);
  525. @include flex-x(center);
  526. flex-shrink: 0;
  527. background: #fff;
  528. &.ceil2 {
  529. min-height: vw(40);
  530. }
  531. &.head-ceil {
  532. min-height: vw(40);
  533. background: #6389FF;
  534. border: vw(1) solid #618AFF;
  535. box-sizing: border-box;
  536. @include word-vw(12, #fff);
  537. }
  538. .ceil-list{
  539. @include flex-y(flex-start);
  540. }
  541. .ceil-list-item{
  542. width: vw(86);
  543. background: #FFEEDE;
  544. @include word-vw(12, #FF7E33);
  545. border-radius: vw(5);
  546. height: vw(22);
  547. @include flex-x(center);
  548. margin: vw(3) 0;
  549. }
  550. }
  551. }
  552. }
  553. .bottom-info-box {
  554. // width: 100vw;
  555. // flex: 1;
  556. // overflow: auto;
  557. // padding-bottom: 80px;
  558. box-sizing: border-box;
  559. @include flex-x(flex-start, flex-start);
  560. .bottom-info-scroll {
  561. // width: vw(110);
  562. width: 100%;
  563. height: 100%;
  564. &::-webkit-scrollbar {
  565. width: 0px;
  566. height: 0px;
  567. }
  568. }
  569. .bottom-info-a {
  570. @include flex-x(flex-start);
  571. }
  572. .left {
  573. width: vw(110);
  574. position: sticky;
  575. left: 0;
  576. .ceil {
  577. width: vw(110);
  578. @include flex-x(center);
  579. .hidden-box{
  580. width: 0;
  581. }
  582. }
  583. .title {
  584. width: vw(110);
  585. }
  586. }
  587. .right {
  588. // flex:1;
  589. .ceil {
  590. width: vw(100);
  591. }
  592. .title {
  593. width: vw(100);
  594. }
  595. }
  596. }
  597. }
  598. }
  599. </style>