productTeaBaby.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <template>
  2. <view class="container">
  3. <!-- 批发专区 -->
  4. <view class="who_list flex_r" v-for="(item, index) in who_list" :key="index" @tap="NavToGoodsDetail(item.id)">
  5. <image class="list_img" :src="item.original_img"></image>
  6. <view class="list_info flex_c flex_jb">
  7. <view class="info_name">{{ item.goods_name }}</view>
  8. <view class="info_msg">
  9. <view></view>
  10. <span v-if="Number(item.price) != 0">{{ item.price }}元</span>
  11. <span v-if="Number(item.cha_bao_price) != 0 && Number(item.price) != 0">+</span>
  12. <span v-if="Number(item.cha_bao_price) != 0">{{ item.cha_bao_price }}茶宝</span>
  13. </view>
  14. <view class="info_btn_con flex_r flex_je">
  15. <view class="info_btn flex_r flex_ac flex_jc">兑换</view>
  16. </view>
  17. </view>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. let page = 1;
  23. import { post } from "@/request/api.js";
  24. export default {
  25. data() {
  26. return {
  27. who_list: [], // 茶宝兑换商品列表
  28. type: "",
  29. };
  30. },
  31. onLoad(e) {
  32. this.type = e.type;
  33. },
  34. onShow() {
  35. page = 1;
  36. this.who_list = [];
  37. this.loadData();
  38. },
  39. methods: {
  40. loadData() {
  41. let that = this;
  42. uni.showLoading({ mask: true });
  43. let data = {
  44. page: page,
  45. type: this.type,
  46. };
  47. post("v1/goods/goodsList", data).then((res) => {
  48. uni.hideLoading();
  49. if (res.code === 0) {
  50. let obj = res.data.data;
  51. if (page == 1) that.who_list = [];
  52. if (obj.length > 0) {
  53. obj.forEach((e) => {
  54. that.who_list.push(e);
  55. });
  56. } else {
  57. page = -1;
  58. this.$toast("暂无更多");
  59. }
  60. } else {
  61. page = -1;
  62. this.$toast("暂无更多");
  63. }
  64. });
  65. },
  66. // 跳转到商品详情页
  67. NavToGoodsDetail: function(id) {
  68. uni.navigateTo({
  69. url: "/pages/product/p_details?id=" + id + "&type=" + this.type,
  70. });
  71. },
  72. },
  73. onShareAppMessage() {
  74. let userinfo = uni.getStorageSync("userinfo");
  75. var path = "/pages/product/productWholesale";
  76. if (userinfo.invite) path = "/pages/product/productWholesale?invite=" + userinfo.invite;
  77. var title = `好生活,茶付宝!`;
  78. return {
  79. title: title,
  80. path: path,
  81. };
  82. },
  83. /**
  84. * 页面上拉触底事件的处理函数
  85. */
  86. onReachBottom: function() {
  87. if (page != -1) {
  88. var that = this;
  89. setTimeout(function() {
  90. ++page;
  91. that.loadData();
  92. }, 800);
  93. }
  94. },
  95. };
  96. </script>
  97. <style lang="scss">
  98. // 页面配置
  99. page {
  100. background: #f5f5f5;
  101. }
  102. .container {
  103. padding: 18rpx 30rpx 0;
  104. box-sizing: border-box;
  105. }
  106. // 页面配置-end
  107. // 批发商品列表
  108. .info_btn_con {
  109. width: 100%;
  110. overflow: hidden;
  111. }
  112. .list_info {
  113. width: calc(100% - 200rpx);
  114. overflow: hidden;
  115. }
  116. .list_img {
  117. width: 200rpx;
  118. height: 180rpx;
  119. margin-right: 35rpx;
  120. border-radius: 12rpx;
  121. }
  122. .info_btn {
  123. width: 134rpx;
  124. height: 50rpx;
  125. background: #2db48a;
  126. font-size: 30rpx;
  127. color: #fff;
  128. border-radius: 12rpx;
  129. }
  130. .info_msg {
  131. width: 100%;
  132. overflow: hidden;
  133. font-size: 28rpx;
  134. color: #18bb88;
  135. font-family: "SourceHanSansCN-Medium";
  136. font-weight: 500;
  137. }
  138. .info_name {
  139. width: 100%;
  140. overflow: hidden;
  141. font-size: 34rpx;
  142. color: #1b1b1b;
  143. font-family: "SourceHanSansCN-Bold";
  144. font-weight: bold;
  145. }
  146. .who_list {
  147. width: 100%;
  148. overflow: hidden;
  149. background: #fff;
  150. padding: 20rpx 16rpx;
  151. box-sizing: border-box;
  152. border-radius: 12rpx;
  153. margin-bottom: 18rpx;
  154. align-items: initial;
  155. }
  156. // 批发商品列表-end
  157. </style>