order.vue 6.8 KB

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