ReportLoss.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. <template>
  2. <!-- 报损报溢 -->
  3. <view class="main-wrap">
  4. <uni-search-bar class="uni-search-bar" @confirm="search" v-model="searchValue" @input="inputChange" cancelButton="none" placeholder="关键字"></uni-search-bar>
  5. <view class="scroll_box">
  6. <scroll-view scroll-y="true" class="scroll-Y" @scrolltolower="lower">
  7. <view class="order-list">
  8. <u-collapse @change="change" @close="close" @open="open">
  9. <u-collapse-item v-for="(item, index) in listData" :key="index" :title="item.onlyCode" name="Docs guide">
  10. <template slot="title">
  11. <view style="display: flex; justify-content: space-between">
  12. {{ item.planProfitLossCode }}
  13. </view>
  14. </template>
  15. <view class="item">
  16. <view class="main">
  17. <view class="row">
  18. <view class="row-item">
  19. <text class="t1">批次号</text>
  20. <text class="t2">{{ item.batchNo }}</text>
  21. </view>
  22. </view>
  23. <view class="row">
  24. <view class="row-item">
  25. <text class="t1">盘点工单号</text>
  26. <text class="t2">{{ item.planOrderCode }}</text>
  27. </view>
  28. </view>
  29. <view class="row">
  30. <view class="row-item">
  31. <text class="t1">盘点人</text>
  32. <text class="t2">{{ item.planOrderUserName }}</text>
  33. </view>
  34. </view>
  35. <view class="row">
  36. <view class="row-item">
  37. <text class="t1">盈/损/亏</text>
  38. <text class="t2">{{ statusOpt[item.status] }}</text>
  39. </view>
  40. <view class="row-item">
  41. <text class="t1">数量</text>
  42. <text class="t2">{{ item[countKey[item.status]] }}</text>
  43. </view>
  44. </view>
  45. <view class="row">
  46. <view class="row-item">
  47. <text class="t1">报损报溢人</text>
  48. <text class="t2">{{ item.planProfitLossUserName }}</text>
  49. </view>
  50. </view>
  51. <view class="row">
  52. <view class="row-item">
  53. <text class="t1">审核时间</text>
  54. <text class="t2">{{ item.auditTime }}</text>
  55. </view>
  56. </view>
  57. </view>
  58. </view>
  59. </u-collapse-item>
  60. </u-collapse>
  61. </view>
  62. <u-loadmore :status="status" fontSize="32" iconSize="36" style="margin: 20rpx 0" />
  63. </scroll-view>
  64. </view>
  65. </view>
  66. </template>
  67. <script>
  68. import { getPlandetails } from '@/api/warehouseManagement'
  69. import { debounce } from 'lodash'
  70. export default {
  71. props: ['categoryCode', 'categoryId', 'dimension'],
  72. data() {
  73. return {
  74. page: 1,
  75. size: 10,
  76. isEnd: true,
  77. listData: [],
  78. status: 'loading',
  79. searchValue: '',
  80. dict: {
  81. reportType: {
  82. 0: '盘亏-',
  83. 1: '盘盈+'
  84. }
  85. },
  86. countKey: {
  87. 2: 'surplusQuantity',
  88. 3: 'loseQuantity',
  89. 4: 'wornQuantity'
  90. },
  91. statusOpt: {
  92. 2: '盘盈',
  93. 3: '盘亏',
  94. 4: '盘损'
  95. },
  96. statusColor: {
  97. 2: 'red',
  98. 3: '#70B603',
  99. 4: ''
  100. },
  101. timerId: null
  102. }
  103. },
  104. created() {
  105. this.getData()
  106. this.search = debounce(this.search, 1000)
  107. },
  108. methods: {
  109. inputChange() {
  110. // 清除timer对应的延时器
  111. clearTimeout(this.timerId)
  112. // 重新启动一个延时器,并把timerId赋值给this.timer
  113. this.timerId = setTimeout(() => {
  114. // 如果500毫秒内,没有触发新的输入事件,则为搜索关键词赋值
  115. this.search()
  116. }, 500)
  117. },
  118. // 触底
  119. lower() {
  120. if (this.isEnd) {
  121. return
  122. }
  123. this.getMoreLists()
  124. },
  125. getData() {
  126. uni.showLoading({
  127. title: '加载中'
  128. })
  129. let par = {
  130. pageNum: this.page,
  131. size: this.size,
  132. keyWord: this.searchValue,
  133. categoryId: this.categoryId
  134. }
  135. getPlandetails(par)
  136. .then(res => {
  137. this.listData = this.listData.concat(res.list)
  138. let length = res.count
  139. if (this.listData.length < length) {
  140. this.isEnd = false
  141. } else {
  142. this.isEnd = true
  143. this.status = 'nomore'
  144. }
  145. })
  146. .finally(() => {
  147. uni.hideLoading()
  148. })
  149. },
  150. getMoreLists() {
  151. this.page++
  152. this.getData()
  153. },
  154. search() {
  155. this.page = 1
  156. this.listData = []
  157. this.status = 'loading'
  158. this.getData()
  159. }
  160. }
  161. }
  162. </script>
  163. <style lang="scss" scoped>
  164. .main-wrap {
  165. height: 100%;
  166. display: flex;
  167. flex-direction: column;
  168. overflow: hidden;
  169. }
  170. .scroll_box {
  171. flex: 1;
  172. overflow: hidden;
  173. }
  174. .scroll-Y {
  175. height: 100%;
  176. background-color: #fafafa;
  177. }
  178. .order-list {
  179. .item {
  180. background-color: #fff;
  181. margin-bottom: 30rpx;
  182. margin-bottom: 30rpx;
  183. .title {
  184. display: flex;
  185. padding: 20rpx;
  186. justify-content: space-between;
  187. align-items: center;
  188. border-bottom: 1px solid #dedede;
  189. .s1 {
  190. color: #333333;
  191. font-size: 28rpx;
  192. font-weight: bold;
  193. }
  194. .s2 {
  195. font-size: 28rpx;
  196. font-weight: bold;
  197. color: #333333;
  198. }
  199. }
  200. .main {
  201. padding: 0 30rpx;
  202. .row {
  203. display: flex;
  204. align-items: center;
  205. justify-content: space-between;
  206. padding: 20rpx 0;
  207. border-bottom: 1px dashed #dedede;
  208. .row-item {
  209. .t1 {
  210. font-weight: bold;
  211. font-size: 28rpx;
  212. color: #333333;
  213. margin-right: 20rpx;
  214. }
  215. .t2 {
  216. font-size: 28rpx;
  217. color: #333333;
  218. }
  219. }
  220. }
  221. .ckmx {
  222. color: #70b603;
  223. font-size: 28rpx;
  224. font-weight: bold;
  225. padding: 20rpx;
  226. display: flex;
  227. justify-content: flex-end;
  228. }
  229. }
  230. }
  231. }
  232. </style>