requisitionList.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525
  1. <template>
  2. <view class="mainBox">
  3. <view class="main">
  4. <uni-nav-bar fixed="true" statusBar="true" left-icon="back" :title="`选择出入库申请单`" @clickLeft="backAdd"></uni-nav-bar>
  5. <view class="searchBox">
  6. <input v-model="searchVal" placeholder="请输入编码" class="searchInput" />
  7. <u-button type="icon-shixiangxinzeng" size="30" @click="doSearch" data-icon="Search" class="searchBtn">
  8. <view class="iconfont icon-sousuo"></view>
  9. <view class="text">搜索</view>
  10. </u-button>
  11. </view>
  12. <view class="wrapper">
  13. <u-list @scrolltolower="scrolltolower" class="listContent">
  14. <radio-group @change="e => selectVal(e)">
  15. <label v-for="(item, index) in listData">
  16. <view class="listBox">
  17. <view class="listBox-sel">
  18. <radio :value="item.id" color="#fff" :disabled="item.disabled" :checked="item.id === (curItem && curItem.id)" />
  19. </view>
  20. <view class="listBox-con">
  21. <view class="listBox-top">
  22. <view class="listBox-name">
  23. {{ item.code }}
  24. </view>
  25. </view>
  26. <view class="listBox-top">
  27. <view class="listBox-code">
  28. {{ item.categoryNames }}
  29. </view>
  30. </view>
  31. <view class="listBox-bottom">
  32. <view>牌号:{{ item.brandNum }}</view>
  33. <view>型号:{{ item.modelType }}</view>
  34. <view>规格:{{ item.specification }}</view>
  35. <view>出入库类型:{{ sourceTypeLabel(item.sourceType) }}</view>
  36. <view>审核人:{{ item.approvalUserName }}</view>
  37. <view>申请人:{{ item.createUserName }}</view>
  38. <view>状态:{{ statusOpt[item.status] }}</view>
  39. <view class="w100">创建时间:{{ item.createTime }}</view>
  40. </view>
  41. </view>
  42. </view>
  43. </label>
  44. </radio-group>
  45. <u-empty class="noDate" style="margin-top: 20vh" v-if="!listData.length"></u-empty>
  46. </u-list>
  47. </view>
  48. <view class="footer">
  49. <u-button type="success" size="small" class="u-reset-button" :disabled="!curItem" @click="jumpAdd">
  50. <view class="selBtn">选择</view>
  51. </u-button>
  52. </view>
  53. </view>
  54. </view>
  55. </template>
  56. <script>
  57. import {
  58. getTreeByIds,
  59. getPackingList,
  60. getWarehouseList,
  61. getProductList,
  62. getBatchList,
  63. getHierarchyList,
  64. getHierarchyFifo,
  65. getApplystoragedetail,
  66. getCode,
  67. getinboundRequestsList
  68. } from '@/api/warehouseManagement'
  69. import { sceneState, outputSceneState } from '../common'
  70. export default {
  71. data() {
  72. return {
  73. type: null,
  74. statusOpt: ['待处理', '已处理', '已撤销'],
  75. curItem: null, //当前选中项
  76. page: 1,
  77. size: 20,
  78. sceneState,
  79. outputSceneState,
  80. isEnd: true,
  81. searchVal: '',
  82. listData: [] //列表数据
  83. }
  84. },
  85. onLoad({ type }) {
  86. this.type = type
  87. },
  88. onShow() {
  89. this.getList()
  90. },
  91. methods: {
  92. sourceTypeLabel(sourceType) {
  93. switch (this.type) {
  94. case '1':
  95. // 入库
  96. return this.sceneState.filter(item => item.value == sourceType)[0].text
  97. case '2':
  98. // 出库
  99. return this.outputSceneState.filter(item => item.value == sourceType)[0].text
  100. }
  101. },
  102. scrolltolower() {
  103. if (this.isEnd) {
  104. return
  105. }
  106. // 显示加载图标
  107. uni.showLoading({
  108. title: '数据加载中'
  109. })
  110. //获取更多数据
  111. this.page++
  112. this.getList()
  113. },
  114. //列表数据
  115. async getList() {
  116. this.isEnd = false
  117. this._getClassifyList()
  118. },
  119. async _getClassifyList() {
  120. uni.showLoading({
  121. title: '数据加载中'
  122. })
  123. const params = {
  124. pageNum: this.page,
  125. size: this.size,
  126. keyWord: this.searchVal,
  127. status: 0,
  128. type: this.type
  129. }
  130. let res = await getinboundRequestsList(params)
  131. uni.hideLoading()
  132. if (this.page == 1) {
  133. this.listData = []
  134. }
  135. this.listData = this.listData.concat(res.list)
  136. this.isEnd = this.listData.length >= res.count
  137. },
  138. doSearch() {
  139. this.page = 1
  140. this.getList()
  141. },
  142. // 单选
  143. selectVal({ detail }) {
  144. this.curItem = this.listData.find(i => i.id === detail?.value)
  145. console.log(this.curItem)
  146. },
  147. //跳转回添加页面
  148. async jumpAdd() {
  149. getApplystoragedetail({ applyId: this.curItem.id }).then(async res => {
  150. if (this.type == 2) {
  151. // 出库
  152. let data = await getHierarchyFifo({
  153. type: 1,
  154. builders: res.map(item => {
  155. return {
  156. categoryId: item.categoryId,
  157. num: item.measureQuantity
  158. }
  159. })
  160. })
  161. if (data?.length > 0) {
  162. uni.$emit('requisitionSelect', data, {
  163. sourceBizNo: this.curItem.code,
  164. bizType: this.curItem.sourceType,
  165. assetType: res.map(item => item.rootCategoryLevelId).join(',')
  166. })
  167. uni.navigateBack()
  168. } else {
  169. uni.showToast({
  170. icon: 'none',
  171. title: '该出库申请单无库存'
  172. })
  173. }
  174. } else {
  175. // 入库
  176. const batchNo = await getCode('lot_number_code')
  177. let data = res.map((item, index) => {
  178. return {
  179. ...item,
  180. index,
  181. packingQuantity: 1,
  182. minPackingQuantity: item.measureQuantity,
  183. measureUnit: item.measuringUnit,
  184. batchNo,
  185. id: '',
  186. warehouseIds: [item.warehouseId],
  187. warehouseNames: [item.warehouseName]
  188. }
  189. })
  190. uni.$emit('requisitionSelect', data, {
  191. sourceBizNo: this.curItem.code,
  192. bizType: this.curItem.sourceType,
  193. assetType: res.map(item => item.rootCategoryLevelId).join(',')
  194. })
  195. uni.navigateBack()
  196. }
  197. })
  198. // let selectionList = this.listData.filter(item => item.checked)
  199. // if (this.dimension == 1) {
  200. // let boolen = selectionList.every(item => item.outboundNum > 0)
  201. // if (!boolen) {
  202. // uni.showToast({
  203. // icon: 'none',
  204. // title: '请输入出库数量',
  205. // duration: 2000
  206. // })
  207. // return
  208. // }
  209. // }
  210. // let data = null
  211. // if (this.dimension != 1) {
  212. // data = await getHierarchyList({
  213. // ids: selectionList.map(item => item.id).join(','),
  214. // type: this.dimension
  215. // })
  216. // } else {
  217. // data = await getHierarchyFifo({
  218. // type: this.dimension,
  219. // builders: selectionList.map(item => {
  220. // return {
  221. // categoryId: item.categoryId,
  222. // num: item.outboundNum
  223. // }
  224. // })
  225. // })
  226. // }
  227. // console.log('data-------------------', data)
  228. // uni.$emit('setSelectList', data)
  229. // uni.navigateBack()
  230. },
  231. //返回添加页
  232. backAdd() {
  233. uni.navigateBack()
  234. }
  235. }
  236. }
  237. </script>
  238. <style lang="scss" scoped>
  239. .mainBox {
  240. height: 100vh;
  241. .main {
  242. height: 100%;
  243. display: flex;
  244. flex-direction: column;
  245. }
  246. .wrapper {
  247. flex: 1;
  248. overflow: hidden;
  249. }
  250. .searchBox {
  251. padding: 10rpx 0;
  252. box-sizing: border-box;
  253. background-color: #dedede;
  254. height: 90rpx;
  255. width: 100%;
  256. line-height: 90rpx;
  257. display: flex;
  258. justify-content: space-around;
  259. align-items: center;
  260. input {
  261. height: 78rpx;
  262. width: 65%;
  263. background: #f9f9f9 !important;
  264. margin: 0 10rpx;
  265. padding: 0 10rpx;
  266. box-sizing: border-box;
  267. border-radius: 5rpx;
  268. }
  269. .searchBtn {
  270. height: 80rpx;
  271. background: #f9f9f9 !important;
  272. color: #676767;
  273. font-size: 28rpx;
  274. padding: 0 42rpx;
  275. box-sizing: border-box;
  276. outline: none;
  277. border: none;
  278. width: 260rpx;
  279. .icon-sousuo {
  280. font-size: 22px;
  281. }
  282. .text {
  283. font-size: 16px;
  284. margin-left: 10px;
  285. }
  286. }
  287. .search-icon {
  288. display: flex;
  289. align-items: center;
  290. justify-content: space-around;
  291. font-size: 28rpx;
  292. white-space: nowrap;
  293. margin-left: 10rpx;
  294. image {
  295. width: 30rpx;
  296. height: 30rpx;
  297. }
  298. }
  299. }
  300. .tab-title {
  301. position: fixed;
  302. top: 190rpx;
  303. z-index: 99;
  304. width: 100%;
  305. display: flex;
  306. justify-content: space-between;
  307. align-items: center;
  308. height: $tab-height;
  309. line-height: $tab-height;
  310. background-color: #ffffff;
  311. border-bottom: 2rpx solid #f2f2f2;
  312. box-sizing: border-box;
  313. .tab-item {
  314. width: 25%;
  315. text-align: center;
  316. font-size: 32rpx;
  317. color: $uni-text-color-grey;
  318. }
  319. .tab-item.active {
  320. color: $j-primary-border-green;
  321. border-bottom: 1px solid $j-primary-border-green;
  322. font-weight: bold;
  323. }
  324. .tab-item.filter {
  325. flex: 1;
  326. padding: 0px 30rpx;
  327. .uni-icons {
  328. display: flex;
  329. padding-top: 5px;
  330. }
  331. }
  332. .screenIcon {
  333. display: flex;
  334. width: 80px;
  335. justify-content: center;
  336. .screenText {
  337. font-size: 32rpx;
  338. color: $uni-text-color-grey;
  339. }
  340. }
  341. }
  342. .listContent {
  343. height: 100% !important;
  344. .listBox {
  345. display: flex;
  346. // height: 180rpx;
  347. padding: 20rpx 0;
  348. border-bottom: 2rpx solid #e5e5e5;
  349. .listBox-sel {
  350. height: 90rpx;
  351. width: 80rpx;
  352. // line-height: 90rpx;
  353. text-align: center;
  354. checkbox {
  355. transform: scale(1.2);
  356. }
  357. }
  358. .listBox-con {
  359. width: 100%;
  360. // display: flex;
  361. // flex-wrap: wrap;
  362. // justify-content: space-between;
  363. align-items: center;
  364. padding: 0 18rpx 0 0;
  365. .listBox-top {
  366. width: 100%;
  367. display: flex;
  368. justify-content: space-between;
  369. padding-bottom: 10rpx;
  370. .listBox-name,
  371. .listBox-code {
  372. display: inline-block;
  373. font-size: $uni-font-size-sm;
  374. font-weight: bold;
  375. }
  376. }
  377. .listBox-bottom {
  378. width: 100%;
  379. display: flex;
  380. justify-content: space-between;
  381. font-size: $uni-font-size-sm;
  382. flex-wrap: wrap;
  383. > view {
  384. width: 50%;
  385. overflow: hidden;
  386. white-space: nowrap;
  387. text-overflow: ellipsis;
  388. }
  389. .input_view {
  390. display: flex;
  391. align-items: center;
  392. justify-content: center;
  393. .u-input {
  394. height: 36rpx;
  395. padding: 0 !important;
  396. margin-right: 10rpx;
  397. border: 1px solid #ddd;
  398. }
  399. }
  400. .w100 {
  401. width: 100%;
  402. }
  403. }
  404. }
  405. }
  406. .noDate {
  407. height: 100%;
  408. }
  409. }
  410. //底部按钮
  411. .footer {
  412. height: 90rpx;
  413. position: relative;
  414. display: flex;
  415. justify-content: space-between;
  416. align-items: center;
  417. bottom: 0;
  418. width: 100%;
  419. height: 100rpx;
  420. border-top: 1rpx solid #eeecec;
  421. background-color: #ffffff;
  422. z-index: 999;
  423. .bottom {
  424. margin-left: 10rpx;
  425. }
  426. .u-reset-button {
  427. position: absolute;
  428. right: 10rpx;
  429. top: 20rpx;
  430. width: 150rpx;
  431. }
  432. }
  433. .search-container {
  434. width: 70vw;
  435. padding: 30rpx 36rpx;
  436. .footer {
  437. position: absolute;
  438. bottom: 0;
  439. left: 0;
  440. width: 100%;
  441. display: flex;
  442. box-shadow: 0 10rpx 30rpx 0 #000;
  443. .btn {
  444. width: 50%;
  445. height: 80rpx;
  446. border-radius: 0 !important;
  447. flex: 1;
  448. display: flex;
  449. justify-content: center;
  450. align-items: center;
  451. &.reset {
  452. color: $j-primary-border-green;
  453. }
  454. &.search {
  455. color: #fff;
  456. background-color: $j-primary-border-green;
  457. }
  458. }
  459. }
  460. .title {
  461. font-weight: bold;
  462. font-size: 30rpx;
  463. }
  464. .status-wrapper {
  465. display: flex;
  466. align-items: center;
  467. justify-content: space-between;
  468. view {
  469. background-color: rgba(242, 242, 242, 1);
  470. height: 60rpx;
  471. border-radius: 30rpx;
  472. line-height: 60rpx;
  473. text-align: center;
  474. width: 160rpx;
  475. border: 1rpx solid rgba(242, 242, 242, 1);
  476. &.active {
  477. color: #157a2c;
  478. border-color: rgba(21, 122, 44, 1);
  479. }
  480. }
  481. }
  482. /deep/.uni-date {
  483. .uni-icons {
  484. display: none;
  485. }
  486. .uni-date-x {
  487. padding: 0;
  488. view {
  489. margin: 0 20rpx;
  490. }
  491. }
  492. }
  493. /deep/.uni-date__x-input,
  494. /deep/.uni-easyinput__content-input {
  495. height: 60rpx;
  496. border-radius: 30rpx;
  497. overflow: hidden;
  498. background-color: rgba(242, 242, 242, 1);
  499. }
  500. }
  501. }
  502. </style>