productWholesale.vue 4.0 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">{{item.price}}元+{{item.trade_num}}批发券+{{item.cha_bao}}茶宝</view>
  9. <view class="info_btn_con flex_r flex_je">
  10. <view class="info_btn flex_r flex_ac flex_jc">购买</view>
  11. </view>
  12. </view>
  13. </view>
  14. <!-- 批发专区-end -->
  15. </view>
  16. </template>
  17. <script>
  18. let page = 1;
  19. let app = getApp();
  20. var appEv = app.$vm.$options;
  21. import { post } from "@/request/api.js";
  22. export default {
  23. data() {
  24. return {
  25. who_list: [], // 批发商品列表
  26. type: '',
  27. };
  28. },
  29. onLoad(e) {
  30. this.type = e.type
  31. },
  32. onShow() {
  33. page = 1;
  34. this.who_list = []
  35. this.loadData()
  36. },
  37. methods: {
  38. loadData() {
  39. let that = this;
  40. uni.showLoading({ mask: true })
  41. let data = {
  42. page: page,
  43. type: this.type
  44. }
  45. post("goods/goodsList", data).then(res => {
  46. uni.hideLoading()
  47. if (res.code === 0) {
  48. let obj = res.data.data
  49. if (page == 1) that.who_list = []
  50. if (obj.length > 0) {
  51. obj.forEach(e => {
  52. that.who_list.push(e)
  53. });
  54. } else {
  55. page = -1;
  56. appEv.errTips('暂无更多')
  57. }
  58. } else {
  59. page = -1;
  60. appEv.errTips('暂无更多')
  61. }
  62. })
  63. },
  64. // 跳转到商品详情页
  65. NavToGoodsDetail: function(id) {
  66. uni.navigateTo({
  67. url: '/pages/product/p_details?id=' + id + '&type=' + this.type
  68. })
  69. }
  70. },
  71. onShareAppMessage: function() {
  72. let userinfo = uni.getStorageSync('userinfo');
  73. var path = '/pages/product/productWholesale?agentId=1';
  74. if (userinfo.user_id) {
  75. path = '/pages/product/productWholesale?agentId=' + userinfo.user_id;
  76. }
  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>