ReportLoss.vue 7.2 KB

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