supplier.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <template>
  2. <view v-if="isShow">
  3. <view class="top" :style="'height:' + systems.barHeight +'rpx;'">
  4. <navigator open-type="navigateBack" hover-class="none" class="back" :style="'height:' + systems.navigationHeight +'rpx;top:' + systems.ktxStatusHeight + 'rpx;'"><image src="../static/product/image/back.png"></image></navigator>
  5. <view class="title" :style="'height:' + systems.navigationHeight +'rpx;top:' + systems.ktxStatusHeight + 'rpx;line-height:' + systems.navigationHeight +'rpx;'">{{detail.name}}</view>
  6. </view>
  7. <image :src="picUrlss + 'wdbg1.png'" mode="aspectFill" class="sup-pic"></image>
  8. <view class="con">
  9. <view class="info">
  10. <view class="name">{{detail.name}}</view>
  11. <view class="fanweis">
  12. <view :class="'fanwei' + (viewMore?' f-height':'')" v-if="detail.businessScope">
  13. 经营范围:{{detail.businessScope}}
  14. </view>
  15. <view class="more" v-if="viewMore" @click="viewMores()"><image src="../static/product/image/moreico.png"></image></view>
  16. </view>
  17. <view class="sup-shi dflex">
  18. <view class="li">
  19. <image src="../static/product/image/sup_ico1.png"></image>
  20. <view>实力商家</view>
  21. </view>
  22. <view class="li">
  23. <image src="../static/product/image/sup_ico2.png"></image>
  24. <view>深度认证</view>
  25. </view>
  26. <view class="li">
  27. <image src="../static/product/image/sup_ico3.png"></image>
  28. <view>信誉担保</view>
  29. </view>
  30. <view class="li">
  31. <image src="../static/product/image/sup_ico4.png"></image>
  32. <view>品牌证书</view>
  33. </view>
  34. <view class="li">
  35. <image src="../static/product/image/sup_ico5.png"></image>
  36. <view>一件代发</view>
  37. </view>
  38. </view>
  39. </view>
  40. <view class="datas dflex">
  41. <view class="li">资质类型:<text>{{detail.haveLicenseNo == 1?'企业':'个人'}}</text></view>
  42. <view class="li">是否审核:<text>已审核</text></view>
  43. <view class="li">编号:<text v-if="detail.number">{{detail.number}}</text></view>
  44. <view class="li">所在区域:<text>{{detail.areaAdd}}</text></view>
  45. </view>
  46. </view>
  47. <view class="prolist dflex" v-if="pageList.length > 0">
  48. <navigator hover-class="none" class="li" v-for="(item,index) in pageList" :key="index">
  49. <image :src="item.pic" mode="aspectFill"></image>
  50. <view class="infos">
  51. <view class="proname">{{item.title}}</view>
  52. <view class="sta dflex">
  53. <view class="price" v-if="item.maxSalePrice > item.minSalePrice"><text>¥</text>{{item.minSalePrice}} - {{item.maxSalePrice}}</view>
  54. <view class="price" v-else><text>¥</text>{{item.minSalePrice}}</view>
  55. <view class="stock">月成交{{item.sellStock}}件</view>
  56. </view>
  57. </view>
  58. </navigator>
  59. </view>
  60. <view class="nodata" v-else>
  61. <image :src="picUrlss+'empty_sp.png'"></image>
  62. <text>暂无商品</text>
  63. </view>
  64. </view>
  65. </template>
  66. <script>
  67. const req = require('../../utils/request.js');
  68. export default {
  69. data() {
  70. return {
  71. picUrlss: req.public.picUrls,
  72. isShow: false,
  73. systems: '',
  74. options: {},
  75. detail: {},
  76. pageList: [],
  77. form:{
  78. page:1,
  79. limit:10
  80. },
  81. isLoad:true,
  82. viewMore: false,
  83. fHeight: 48
  84. };
  85. },
  86. onLoad: function(options) {
  87. this.options = options;
  88. this.getList();
  89. },
  90. async onShow(){
  91. await this.getDetail();
  92. },
  93. onReachBottom(){
  94. this.form.page ++;
  95. this.getList()
  96. },
  97. methods: {
  98. monitor() {
  99. let that = this;
  100. let system = uni.getSystemInfoSync();
  101. console.log(system);
  102. let query = uni.createSelectorQuery();
  103. query.select('.fanwei').boundingClientRect(data=>{
  104. let height = data.height;
  105. console.log(height)
  106. if(height > 48) {
  107. this.viewMore = true
  108. }
  109. }).exec();
  110. },
  111. viewMores(){
  112. this.viewMore = false;
  113. },
  114. getDetail(){
  115. return new Promise((resolve,reject)=>{
  116. req.getRequest('/api/supplier/detail',{id:this.options.id},res=>{
  117. this.detail = res;
  118. if(res.fanwei){
  119. setTimeout(() => {
  120. this.monitor();
  121. },200);
  122. }
  123. this.isShow = true;
  124. })
  125. })
  126. },
  127. getList(){
  128. let that = this;
  129. if(!that.isLoad) return false;
  130. that.isLoad = false;
  131. that.form.supplierId = that.options.id;
  132. req.getRequest('/api/product/list',that.form,res=>{
  133. console.log('供应商商品列表==' + res)
  134. if (res && res.length >= 10) that.isLoad = true;
  135. if (that.form.page > 1) res = that.pageList.concat(res);
  136. that.pageList = res;
  137. })
  138. }
  139. },
  140. mounted() {
  141. const systemInfo = uni.getSystemInfoSync();
  142. // px转换到rpx的比例
  143. let pxToRpxScale = 750 / systemInfo.windowWidth;
  144. let systems = {
  145. ktxStatusHeight: systemInfo.statusBarHeight * pxToRpxScale, // 状态栏的高度
  146. navigationHeight: 44 * pxToRpxScale // 导航栏的高度
  147. };
  148. systems.barHeight = systems.ktxStatusHeight + systems.navigationHeight;
  149. this.systems = systems;
  150. },
  151. };
  152. </script>
  153. <style>
  154. @import "./supplier.css";
  155. </style>