金诚优选前端代码
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.

101 lines
2.4 KiB

  1. <template>
  2. <view class="health-tips" :style="'margin-bottom: ' + meta.margin_bottom + 'px'">
  3. <view class="title" v-if="title && show">
  4. <span>{{title}}</span>
  5. </view>
  6. <view class="ul-content">
  7. <view class="li-item" v-if="tipsData">
  8. <view class="top-box">
  9. <view class="topic">
  10. {{tipsData.name}}
  11. </view>
  12. <view class="change" @tap="_changeItem">
  13. 换一换
  14. </view>
  15. </view>
  16. <view class="center-box">
  17. {{tipsData.meta.subtitle}}
  18. </view>
  19. <view class="bottom-box">
  20. <view class="item" :data-id="item.associate.id" v-for="(item, index) in tipsData.children" :key="index" @tap="_jumpToDetail">
  21. <view class="info">
  22. <view class="img-box">
  23. <image :src="item.associate.img"></image>
  24. </view>
  25. <view class="name">
  26. {{item.associate.name}}
  27. </view>
  28. <view class="money">
  29. {{item.associate.sell_price}}
  30. <span>{{item.associate.market_price}}</span>
  31. </view>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. </template>
  39. <script>
  40. export default {
  41. data() {
  42. return {
  43. tipsData: '',
  44. tapIndex: 0
  45. };
  46. },
  47. props: {
  48. healthData: {
  49. type: Array,
  50. value: ''
  51. },
  52. title: {
  53. type: String,
  54. value: ''
  55. },
  56. show: {
  57. type: Number,
  58. value: ''
  59. },
  60. meta: {
  61. type: Object,
  62. value: ""
  63. }
  64. },
  65. mounted() {
  66. this.tipsData= this.healthData[0];
  67. } ,
  68. //组件的方法
  69. methods: {
  70. _changeItem(e) {
  71. var index = this.tapIndex;
  72. if (index == this.healthData.length - 1) {
  73. index = 0;
  74. } else {
  75. index++;
  76. }
  77. this.tipsData= this.healthData[0];
  78. this.tapIndex= index;
  79. },
  80. _jumpToDetail(e) {
  81. var id = e.currentTarget.dataset.id;
  82. wx.navigateTo({
  83. url: `/pages/store/detail/detail?id=${id}`
  84. });
  85. },
  86. },
  87. };
  88. </script>
  89. <style rel="stylesheet/less" lang="less">
  90. @import "health-tips";
  91. </style>