productTeaBaby.vue 3.8 KB

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