order.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. <template>
  2. <!-- 单号 -->
  3. <view class="main-wrap">
  4. <uni-nav-bar fixed="true" statusBar="true" left-icon="back" :title="'单号 ' + bizNum" @clickLeft="back">
  5. </uni-nav-bar>
  6. <uni-search-bar class="uni-search-bar" @confirm="search" :focus="true" v-model="searchValue" @input="search"
  7. cancelButton="none" placeholder="搜索关键字">
  8. </uni-search-bar>
  9. <view class="list-wrap" v-if="type !== '调拨'">
  10. <uni-table border stripe emptyText="暂无更多数据">
  11. <!-- 表头行 -->
  12. <uni-tr>
  13. <uni-th align="left" width="240rpx">物品</uni-th>
  14. <block v-if="!isUnpack">
  15. <uni-th align="left" width="170rpx" :sortable="true">最小单元</uni-th>
  16. </block>
  17. <uni-th align="left" width="170rpx" :sortable="true" @sort-change="sortChange('bzsl', $event)">
  18. 生产日期/采购日期</uni-th>
  19. <uni-th align="left" width="170rpx" :sortable="true" @sort-change="sortChange('bzsl', $event)">过期时间</uni-th>
  20. </uni-tr>
  21. <!-- 表格数据行 -->
  22. <uni-tr v-for="(item, index) in listData" :key="index">
  23. <uni-td>{{ item.onlyCode }}</uni-td>
  24. <uni-td v-if="!isUnpack">{{ item.measurementUnit }}{{ item.unit }}/{{
  25. item.minPackUnit
  26. }}</uni-td>
  27. <uni-td>{{ item.manufactureTime || item.procurementTime }}</uni-td>
  28. <uni-td>{{ item.expirationTime }}</uni-td>
  29. </uni-tr>
  30. </uni-table>
  31. </view>
  32. <view class="order-list" v-else>
  33. <view class="item" v-for="(item, index) in listData" :key="index">
  34. <!-- <view class="title">
  35. <view class="s1">
  36. 条码号
  37. </view>
  38. <view class="s2">
  39. </view>
  40. </view> -->
  41. <view class="main">
  42. <view class="row">
  43. <view class="row-item">
  44. <text class="t1">最小单元</text>
  45. <text class="t2"></text>
  46. </view>
  47. <view class="row-item">
  48. <text class="t1"></text>
  49. <text class="t2">{{ item.measurementUnit }}{{ item.unit }}/{{
  50. item.minPackUnit
  51. }}</text>
  52. </view>
  53. </view>
  54. <view class="row">
  55. <view class="row-item">
  56. <text class="t1">生产日期/采购日期</text>
  57. <text class="t2"></text>
  58. </view>
  59. <view class="row-item">
  60. <text class="t1"></text>
  61. <text class="t2">{{
  62. item.manufactureTime || item.procurementTime
  63. }}</text>
  64. </view>
  65. </view>
  66. <view class="row">
  67. <view class="row-item">
  68. <text class="t1">过期时间</text>
  69. <text class="t2"></text>
  70. </view>
  71. <view class="row-item">
  72. <text class="t1"></text>
  73. <text class="t2">{{ item.expireTime }}</text>
  74. </view>
  75. </view>
  76. <view class="row">
  77. <view class="row-item">
  78. <text class="t1">调出货位</text>
  79. <text class="t2"></text>
  80. </view>
  81. <view class="row-item">
  82. <text class="t1"></text>
  83. <text class="t2">{{ item.warehouseName }}/{{ item.outWarehouseAreaName }}/{{
  84. item.outWarehouseAreaGoodsCode
  85. }}/{{ item.outGoodsAllocationCode }}</text>
  86. </view>
  87. </view>
  88. <view class="row">
  89. <view class="row-item">
  90. <text class="t1">调入货位</text>
  91. <text class="t2"></text>
  92. </view>
  93. <view class="row-item">
  94. <text class="t1"></text>
  95. <text class="t2">{{ item.inWarehouseName }}/{{ item.inWarehouseAreaName }}/{{
  96. item.inWarehouseAreaGoodsCode
  97. }}/{{ item.inGoodsAllocationCode }}</text>
  98. </view>
  99. </view>
  100. </view>
  101. </view>
  102. </view>
  103. <u-loadmore :status="status" style="margin-top: 20rpx" />
  104. </view>
  105. </template>
  106. <script>
  107. let [page, size, isEnd] = [1, 20, true]
  108. import {
  109. post,
  110. get
  111. } from '@/utils/api.js'
  112. export default {
  113. data() {
  114. return {
  115. listData: [],
  116. status: 'loading',
  117. searchValue: '',
  118. // 单号
  119. bizNum: '',
  120. // 批次号
  121. batchNum: '',
  122. // 单号类型
  123. type: '',
  124. isUnpack: false
  125. }
  126. },
  127. onLoad(option) {
  128. this.bizNum = option.bizNum
  129. this.isUnpack = option.isUnpack === 'false' ? false : true
  130. this.batchNum = option.batchNum
  131. this.type = option.type
  132. this.getData()
  133. },
  134. onReachBottom() {
  135. console.log('触底')
  136. if (isEnd) {
  137. return
  138. }
  139. this.getMoreLists()
  140. },
  141. methods: {
  142. sortChange(type, e) {
  143. console.log(type, e)
  144. let order = e.order
  145. this.listData.sort((a, b) => {
  146. switch (order) {
  147. // 下降
  148. case 'descending':
  149. return a[type] - b[type]
  150. break
  151. // 上降
  152. case 'ascending':
  153. return b[type] - a[type]
  154. break
  155. // 正常
  156. case null:
  157. break
  158. default:
  159. break
  160. }
  161. })
  162. },
  163. getData() {
  164. let par = {
  165. page,
  166. size
  167. }
  168. let url = ''
  169. switch (this.type) {
  170. case '入库':
  171. par.batchNum = this.batchNum
  172. par.bizNum = this.bizNum
  173. par.bizStatus = 1
  174. url = '/InventoryBook/select/getWarehouseSceneDetail?'
  175. break
  176. case '出库':
  177. par.batchNum = this.batchNum
  178. par.bizNum = this.bizNum
  179. par.bizStatus = 2
  180. url = '/InventoryBook/select/getWarehouseSceneDetail?'
  181. break
  182. case '调拨':
  183. par.batchNum = this.batchNum
  184. par.bizNum = this.bizNum
  185. url = '/InventoryBook/select/getTransferDetail?'
  186. break
  187. default:
  188. break
  189. }
  190. if (this.searchValue !== '') {
  191. par.name = this.searchValue
  192. }
  193. par = this.URLSearchParams(par)
  194. post(this.apiUrl + url + par).then(res => {
  195. if (res.success) {
  196. this.listData = [...this.listData, ...res.data]
  197. let pages = res.data.pages
  198. if (page < pages) {
  199. isEnd = false
  200. } else {
  201. isEnd = true
  202. this.status = 'nomore'
  203. }
  204. }
  205. })
  206. },
  207. getMoreLists() {
  208. page++
  209. this.getData()
  210. },
  211. search() {
  212. this.page = 1
  213. this.listData = []
  214. this.status = 'loading'
  215. this.getData()
  216. }
  217. }
  218. }
  219. </script>
  220. <style lang="scss" scoped>
  221. .main-wrap {
  222. height: calc(100% - 176rpx);
  223. }
  224. .scroll-Y {
  225. height: calc(100% - 112rpx);
  226. }
  227. .order-list {
  228. .item {
  229. background-color: #fff;
  230. margin-bottom: 30rpx;
  231. margin-bottom: 30rpx;
  232. .title {
  233. display: flex;
  234. padding: 20rpx;
  235. justify-content: space-between;
  236. align-items: center;
  237. border-bottom: 1px solid #dedede;
  238. .s1 {
  239. color: #333333;
  240. font-size: 28rpx;
  241. font-weight: bold;
  242. }
  243. .s2 {
  244. font-size: 28rpx;
  245. font-weight: bold;
  246. color: #333333;
  247. }
  248. }
  249. .main {
  250. padding: 0 30rpx;
  251. .row {
  252. display: flex;
  253. align-items: center;
  254. justify-content: space-between;
  255. padding: 20rpx 0;
  256. border-bottom: 1px dashed #dedede;
  257. .row-item {
  258. .t1 {
  259. font-weight: bold;
  260. font-size: 28rpx;
  261. color: #333333;
  262. margin-right: 20rpx;
  263. }
  264. .t2 {
  265. font-size: 28rpx;
  266. color: #333333;
  267. }
  268. }
  269. }
  270. .ckmx {
  271. color: #70b603;
  272. font-size: 28rpx;
  273. font-weight: bold;
  274. padding: 20rpx;
  275. display: flex;
  276. justify-content: flex-end;
  277. }
  278. }
  279. }
  280. }
  281. </style>