invSearchDetail.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <template>
  2. <view class="container">
  3. <u-navbar leftIconColor="#fff" titleStyle="color:#fff;fontSize:36rpx;" :autoBack="true" bgColor="#2C6FF3"
  4. :placeholder="true" :title="title"></u-navbar>
  5. <view class="content">
  6. <scroll-view class="scrollview" :scroll-with-animation="true" scroll-y lower-threshold="100"
  7. @scrolltolower="scrolltolower" :style="{height:fullHeight}">
  8. <view v-if="list.length>0">
  9. <block v-for="(item,index) in list" :key="index">
  10. <view class="equipment-container" @click="details(item)">
  11. <view class="flex align-center justify-between">
  12. <view class="title" v-if="type==0">
  13. {{item.deviceName}}<text>{{item.deviceId}}</text>
  14. </view>
  15. <view class="title" v-else>{{item.goodsName}}</view>
  16. </view>
  17. <view class="flex align-center">
  18. <view class="" v-if="type==1" style="margin-right: 30rpx;margin-top: 20rpx;">
  19. <u--image width="110rpx" height="110rpx" :src="item.cover" mode="widthFix" :lazy-lord="true">
  20. </u--image>
  21. </view>
  22. <view class="">
  23. <view class="order-detail-item">
  24. <view>缺货:</view>{{item.lackSum}}
  25. </view>
  26. <view class="order-detail-item">
  27. <view>库存:</view>{{item.stockSum}}
  28. </view>
  29. <view class="order-detail-item">
  30. <view>容量:</view>{{item.capacitySum}}
  31. </view>
  32. <view class="order-detail-item percent">
  33. <view>缺货占比:</view>{{item.percent}}%
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. </block>
  39. </view>
  40. <view v-else class='empty'>
  41. <u-empty mode="data" text="数据为空"></u-empty>
  42. </view>
  43. </scroll-view>
  44. </view>
  45. </view>
  46. </template>
  47. <script>
  48. import {
  49. stockByGoodsDetail,
  50. stockByDeviceDetail
  51. } from '@/api/replenishment/replenishment.js'
  52. export default {
  53. data() {
  54. return {
  55. fullHeight: 0,
  56. id: null,
  57. type: null,
  58. list: {},
  59. title:null
  60. }
  61. },
  62. onLoad(o) {
  63. let _this = this;
  64. const query = uni.createSelectorQuery().in(this);
  65. query.select(".scrollview").boundingClientRect((data) => {
  66. uni.getSystemInfo({
  67. success(res) {
  68. // 针对iPhone X等机型底部安全距离做适配
  69. const model = res.model;
  70. const modelInclude = [
  71. "iPhone X",
  72. 'iPhone XR',
  73. "iPhone XS",
  74. "iPhone XS MAX",
  75. "iPhone 12/13 mini",
  76. "iPhone 12/13 (Pro)",
  77. "iPhone 12/13 Pro Max",
  78. "iPhone 14 Pro Max"
  79. ];
  80. let safeDistance = modelInclude.includes(model)
  81. //动态设置商品区域高度
  82. console.log(res.windowHeight, data.top)
  83. if (safeDistance) {
  84. _this.fullHeight = res.windowHeight - data.top - 40 + 'px';
  85. } else {
  86. _this.fullHeight = res.windowHeight - data.top + 'px';
  87. }
  88. },
  89. });
  90. }).exec();
  91. this.id = o.id
  92. this.type = o.type
  93. this.title=o.title
  94. if (this.type == 0) {
  95. this.getDetailByGoods()
  96. } else {
  97. this.getDetailByDev()
  98. }
  99. },
  100. methods: {
  101. getDetailByGoods() {
  102. stockByGoodsDetail({
  103. goodsId: this.id
  104. }).then(res => {
  105. this.list = res.data
  106. })
  107. },
  108. getDetailByDev() {
  109. stockByDeviceDetail({
  110. deviceId: this.id
  111. }).then(res => {
  112. this.list = res.data
  113. })
  114. }
  115. }
  116. }
  117. </script>
  118. <style scoped lang="scss">
  119. .container {
  120. .content {
  121. .equipment-container {
  122. margin: 13rpx 13rpx 0;
  123. padding: 12rpx 20rpx 24rpx;
  124. border-radius: 14rpx;
  125. background-color: #fff;
  126. box-shadow: 0px 0px 10rpx 0px rgba(174, 201, 255, 0.2);
  127. position: relative;
  128. .sb-box {
  129. padding: 24rpx 18rpx;
  130. background-color: #f5f8fb;
  131. border-radius: 8rpx;
  132. margin-top: 12rpx;
  133. }
  134. .title {
  135. height: 60rpx;
  136. line-height: 60rpx;
  137. font-size: 32rpx;
  138. font-weight: bold;
  139. color: #333;
  140. >text {
  141. font-size: 24rpx;
  142. color: #333;
  143. }
  144. }
  145. .order-detail-item {
  146. font-size: 28rpx;
  147. margin-top: 12rpx;
  148. color: #777;
  149. >view {
  150. display: inline-block;
  151. width: 170rpx;
  152. }
  153. }
  154. .percent {
  155. position: absolute;
  156. right: 40rpx;
  157. bottom: 20rpx;
  158. line-height: 140rpx;
  159. color: red;
  160. >view {
  161. color: #777;
  162. width: 150rpx;
  163. }
  164. }
  165. }
  166. }
  167. }
  168. </style>