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

102 lines
2.4 KiB

  1. <template>
  2. <view class="preview-box">
  3. <view class="category_mask" :hidden="!show" @tap="clone"></view>
  4. <view class="group-list" :hidden="!show">
  5. <view class="group-box">
  6. <view class="group-item" :data-id="item.goods_id" v-for="(item, index) in list" :key="index" @tap="jump">
  7. <view class="group-item-content">
  8. <view class="group-img-box">
  9. <image mode="widthFix" :src="item.goods_img" alt></image>
  10. </view>
  11. <view class="goods-name">
  12. {{item.goods_name}}
  13. </view>
  14. <view class="goods-money">
  15. ¥{{item.goods_sell_price}}
  16. </view>
  17. </view>
  18. </view>
  19. <view class="group-item" v-if="list.length % 2 != 0" @tap="go">
  20. <view class="group-item-content">
  21. <view class="more-box">
  22. 查看更多
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. <view class="close">
  28. <image mode="widthFix" src=".../../../static/the-close.png" alt></image>
  29. </view>
  30. </view>
  31. </view>
  32. </template>
  33. <script>
  34. export default {
  35. data() {
  36. return {};
  37. },
  38. components: {},
  39. props: {
  40. show: {
  41. type: Boolean,
  42. value: false
  43. },
  44. list: {
  45. type: Array,
  46. value: []
  47. }
  48. },
  49. methods: {
  50. clone() {
  51. this.setData({
  52. show: false
  53. });
  54. this.$emit('clone');
  55. },
  56. jump(e) {
  57. var id = e.currentTarget.dataset.id;
  58. wx.navigateTo({
  59. url: `/pages/store/detail/detail?id=${id}`
  60. });
  61. this.$emit('clone');
  62. },
  63. go() {
  64. wx.navigateTo({
  65. url: "/pages/store/list/list"
  66. });
  67. this.$emit('clone');
  68. },
  69. setData: function (obj) {
  70. let that = this;
  71. let keys = [];
  72. let val, data;
  73. Object.keys(obj).forEach(function (key) {
  74. keys = key.split('.');
  75. val = obj[key];
  76. data = that.$data;
  77. keys.forEach(function (key2, index) {
  78. if (index + 1 == keys.length) {
  79. that.$set(data, key2, val);
  80. } else {
  81. if (!data[key2]) {
  82. that.$set(data, key2, {});
  83. }
  84. }
  85. data = data[key2];
  86. });
  87. });
  88. }
  89. },
  90. computed: {},
  91. watch: {}
  92. };
  93. </script>
  94. <style rel="stylesheet/less" lang="less">
  95. @import "preview";
  96. </style>