detaiList.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. <template>
  2. <view class="st-detailList-wrap">
  3. <!-- 统计 -->
  4. <view class="panel-box">
  5. <view class="item-box">
  6. <view>查询结果</view>
  7. <u-count-to :end-val="totalNum ? totalNum : 0" separator="," font-size="30"></u-count-to>条
  8. </view>
  9. <view class="item-box">
  10. <view>可用库存数量</view>
  11. <u-count-to :end-val="totalData&&totalData.totalCurrentStockQty ? totalData.totalCurrentStockQty : 0" separator="," font-size="30"></u-count-to>个
  12. </view>
  13. <view class="item-box">
  14. <view>可用库存成本</view>
  15. ¥<u-count-to :end-val="totalData&&totalData.totalCurrentStockCost ? totalData.totalCurrentStockCost : 0" separator="," font-size="30" :decimals="2"></u-count-to>
  16. </view>
  17. </view>
  18. <!-- 查询结果 -->
  19. <scroll-view class="st-detailList-con" scroll-y @scrolltolower="onreachBottom">
  20. <view class="st-detailList-main">
  21. <view class="st-detailList-main-item" v-for="(item, index) in listData" :key="item.id" @click="getDetail(item)">
  22. <view class="st-detailList-tit">
  23. <view class="u-line" :style="{backgroundColor: $config('primaryColor')}"></view>{{item.productName}}
  24. </view>
  25. <view class="st-detailList-item-con flex align_center">
  26. <view class="pimgs">
  27. <u-image :src="item.product&&item.product.productMsg?item.product.productMsg:`../../static/${theme}/def_img@2x.png`" width="128" height="128" border-radius="10"></u-image>
  28. </view>
  29. <view class="flex_1">
  30. <view>产品编码:{{item.productCode}}</view>
  31. <view class="padding_3">原厂编码:{{item.productOrigCode}}</view>
  32. <view class="flex align_center justify_between">
  33. <view class="font_13">
  34. 可用数量:
  35. <u-count-to :end-val="item.currentStockQty ? item.currentStockQty : 0" separator="," font-size="26"></u-count-to>个
  36. </view>
  37. <view class="font_13">
  38. 库存成本:
  39. ¥<u-count-to :end-val="item.currentStockCost ? item.currentStockCost : 0" separator="," font-size="26" :decimals="2"></u-count-to>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. <view v-if="listData && listData.length == 0">
  46. <u-empty :text="noDataText" mode="list" :img-width="200" :margin-top="30"></u-empty>
  47. </view>
  48. </view>
  49. </scroll-view>
  50. </view>
  51. </template>
  52. <script>
  53. import { stockList, stockCount } from '@/api/stock'
  54. export default{
  55. data(){
  56. return {
  57. totalData: null,
  58. totalNum: 0,
  59. listData: [],
  60. pageNo: 1,
  61. pageSize: 6,
  62. params: {},
  63. noDataText: '暂无数据',
  64. theme: ''
  65. }
  66. },
  67. onLoad(option) {
  68. this.theme = getApp().globalData.theme
  69. this.params = option.data ? JSON.parse(option.data) : {}
  70. this.getList()
  71. },
  72. methods: {
  73. // 列表
  74. getList(pageNo){
  75. const _this = this
  76. if (pageNo) {
  77. this.pageNo = pageNo
  78. }
  79. let params = Object.assign(this.params, { pageNo: this.pageNo, pageSize: this.pageSize })
  80. stockList(params).then(res => {
  81. this.getTotal(params)
  82. if (res.status == 200) {
  83. if(this.pageNo>1){
  84. this.listData = this.listData.concat(res.data.list || [])
  85. }else{
  86. this.listData = res.data.list || []
  87. }
  88. this.totalNum = res.data.count || 0
  89. } else {
  90. this.listData = []
  91. this.totalNum = 0
  92. this.noDataText = res.message
  93. }
  94. })
  95. },
  96. // 合计
  97. getTotal (params) {
  98. stockCount(params).then(res => {
  99. if (res.status == 200 && res.data) {
  100. this.totalData = res.data
  101. } else {
  102. this.totalData = null
  103. }
  104. })
  105. },
  106. // scroll-view到底部加载更多
  107. onreachBottom() {
  108. if(this.listData.length < this.totalNum){
  109. this.pageNo += 1
  110. this.getList()
  111. }
  112. },
  113. // 详情
  114. getDetail(data){
  115. uni.navigateTo({ url: "/pages/stock/detaiList?data="+JSON.stringify(data) })
  116. }
  117. }
  118. }
  119. </script>
  120. <style lang="scss">
  121. .st-detailList-wrap{
  122. width: 100%;
  123. height: 100vh;
  124. .panel-box {
  125. background-color: #ffffff;
  126. padding: 20upx 0;
  127. box-shadow: 3upx 2upx 6upx #eee;
  128. margin-bottom: 20upx;
  129. display: flex;
  130. justify-content: space-between;
  131. align-items: center;
  132. .item-box{
  133. text-align: center;
  134. width: 33.33%;
  135. border-right: 1px solid #e4e7ed;
  136. }
  137. .item-box:last-child{
  138. border-right: none;
  139. }
  140. }
  141. .st-detailList-con{
  142. height: calc(100vh - 138upx);
  143. .st-detailList-main{
  144. .st-detailList-main-item{
  145. background: #ffffff;
  146. padding: 20upx;
  147. margin-bottom: 25upx;
  148. border-radius: 25upx;
  149. box-shadow: 1px 1px 3px #EEEEEE;
  150. .st-detailList-tit{
  151. padding-bottom: 20upx;
  152. border-bottom: 1px solid #e4e7ed;
  153. white-space: nowrap;
  154. overflow: hidden;
  155. text-overflow: ellipsis;
  156. .u-line{
  157. display: inline-block;
  158. width: 6upx;
  159. height: 40upx;
  160. background-color: red;
  161. vertical-align: bottom;
  162. margin: 0 20upx 0 10upx;
  163. }
  164. }
  165. .st-detailList-item-con{
  166. padding: 20upx 20upx 6upx;
  167. font-size: 26upx;
  168. .pimgs{
  169. margin-right: 16upx;
  170. }
  171. .font_13{
  172. font-size: 26upx;
  173. }
  174. .padding_3{
  175. padding: 6upx 0;
  176. }
  177. }
  178. }
  179. }
  180. }
  181. }
  182. </style>