add.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728
  1. <template>
  2. <view class="mainBox">
  3. <uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="新增拣货" @clickLeft="back">
  4. <template slot="float"></template>
  5. </uni-nav-bar>
  6. <u-form class="baseForm" labelPosition="left" :model="formData" ref="formRef" labelWidth="220"
  7. labelAlign="right">
  8. <u-form-item label="拣货编码" prop="code" borderBottom>
  9. <u-input disableColor="#ffffff" v-model="formData.code" placeholder="请选择" disabled type="text" />
  10. </u-form-item>
  11. <u-form-item class="required-form" label="拣货名称" prop="name" borderBottom>
  12. <u-input disableColor="#ffffff" v-model="formData.name" placeholder="请选择" type="text" />
  13. </u-form-item>
  14. <u-form-item class="required-form" label="关联领料单" prop="documentSource" borderBottom>
  15. <u-input type="text" placeholder="请输入" v-model="formData.sourceBizNo" @click.native="goToRequisition" />
  16. </u-form-item>
  17. </u-form>
  18. <view class="tabs-container">
  19. <view class="tabs">
  20. <view class="tab-item" :class="{ active: activeName === 1 }" @click="activeName = 1">领料产品清单</view>
  21. <view class="tab-item" :class="{ active: activeName === 2 }">
  22. <text @click="activeName = 2" class="label">拣货清单</text>
  23. <u-icon name="scan" size="50" @click="goScanCode"></u-icon>
  24. </view>
  25. </view>
  26. </view>
  27. <view class="tableBox" v-if="activeName == 1">
  28. <u-list v-if="productList.length > 0" class="scrollList">
  29. <u-list-item v-for="(item, index) in productList" :key="index">
  30. <view class="listBox">
  31. <view class="listBox-con">
  32. <view class="listBox-top">
  33. <view class="listBox-name">
  34. {{ item.categoryName }}
  35. </view>
  36. <view class="listBox-code">
  37. {{ item.categoryCode }}
  38. </view>
  39. </view>
  40. <view class="listBox-bottom">
  41. <view>批次号:{{ item.batchNo }}</view>
  42. <view>包装数量:{{ item.packingQuantity }}</view>
  43. <view>包装单位:{{ item.packingUnit }}</view>
  44. <view>计量数量:{{ item.measureQuantity }}</view>
  45. <view>计量单位:{{ item.measuringUnit }}</view>
  46. <view>重量:{{ item.weight }}</view>
  47. <view>重量单位:{{ item.weightUnit }}</view>
  48. <view class="w100">仓库:{{ item.warehouseName }}</view>
  49. </view>
  50. </view>
  51. </view>
  52. </u-list-item>
  53. </u-list>
  54. <view v-else class="no_data">暂无数据</view>
  55. </view>
  56. <view class="tableBox" v-else>
  57. <u-list v-if="tableList.length > 0" class="scrollList">
  58. <u-list-item v-for="(item, index) in tableList" :key="index">
  59. <view class="listBox">
  60. <view class="listBox-con">
  61. <view class="listBox-top">
  62. <view class="listBox-name">
  63. {{ item.categoryName }}
  64. </view>
  65. <view class="listBox-code">
  66. {{ item.categoryCode }}
  67. </view>
  68. </view>
  69. <view class="listBox-bottom">
  70. <view>批次号:{{ item.batchNo }}</view>
  71. <view>包装数量:{{ item.packingQuantity }}</view>
  72. <view>包装单位:{{ item.packingUnit }}</view>
  73. <view>计量数量:{{ item.measureQuantity }}</view>
  74. <view>计量单位:{{ item.measuringUnit }}</view>
  75. <view>重量:{{ item.weight }}</view>
  76. <view>重量单位:{{ item.weightUnit }}</view>
  77. <view class="w100">仓库:{{ item.warehouseName }}</view>
  78. </view>
  79. </view>
  80. </view>
  81. </u-list-item>
  82. </u-list>
  83. <view v-else class="no_data">暂无数据</view>
  84. </view>
  85. <view class="footBox">
  86. <view class="reg" @click="submit">
  87. <uni-icons custom-prefix="iconfont" size="20" color="#fff"></uni-icons>
  88. 提交
  89. </view>
  90. </view>
  91. </view>
  92. </template>
  93. <script>
  94. // import ScanCode from '@/components/ScanCode.vue'
  95. import {
  96. savePickgoods,
  97. getCode
  98. } from '@/api/warehouseManagement'
  99. export default {
  100. data() {
  101. return {
  102. activeName: 1,
  103. formData: {
  104. type: 1, // 入库
  105. bizType: '1', // 入库场景
  106. storageTime: '', // 入库时间
  107. extInfo: {}, // 扩展信息
  108. sourceBizNo: '', // 来源单据编号
  109. fromUser: '', // 送货人
  110. remark: '' // 备注
  111. },
  112. productList: [],
  113. tableList: []
  114. }
  115. },
  116. beforeDestroy() {
  117. uni.$off('setSelectList')
  118. uni.$off('requisitionSelect')
  119. },
  120. onLoad() {
  121. this.getCode()
  122. const userInfo = uni.getStorageSync('userInfo')
  123. this.formData.createUserName = userInfo.name
  124. uni.$on('setSelectList', async data => {
  125. if (data?.length) {
  126. console.log('setSelectList--data------------', data)
  127. this.tableList = this.tableList.concat(data)
  128. setTimeout(() => {
  129. this.detailOpen = !this.detailOpen
  130. this.$refs.collapse && this.$refs.collapse.resize()
  131. }, 0)
  132. }
  133. })
  134. uni.$on('requisitionSelect', async (data, query) => {
  135. console.log(data)
  136. console.log(query)
  137. this.formData.sourceBizNo = query.sourceBizNo
  138. this.productList = data
  139. setTimeout(() => {
  140. this.detailOpen = !this.detailOpen
  141. this.$refs.collapse && this.$refs.collapse.resize()
  142. }, 0)
  143. })
  144. // 明细信息填写
  145. uni.$on('batchNumBack', productList => {
  146. if (productList?.length) {
  147. this.productList = productList
  148. }
  149. })
  150. },
  151. mounted() {
  152. // this.getAddDetails();
  153. },
  154. methods: {
  155. goScanCode() {
  156. uni.navigateTo({
  157. url: '/pages/warehouse/components/scanCodeList'
  158. })
  159. },
  160. async getCode() {
  161. const code = await getCode('transfer_no')
  162. this.formData.code = code
  163. this.$forceUpdate()
  164. },
  165. goToRequisition() {
  166. uni.navigateTo({
  167. url: '/pages/warehouse/components/requisitionList?type=' + 2
  168. })
  169. },
  170. async submit() {
  171. if (!this.formData.name) {
  172. uni.showToast({
  173. title: '请输入拣货名称',
  174. icon: 'none'
  175. })
  176. return
  177. }
  178. if (!this.formData.sourceBizNo) {
  179. uni.showToast({
  180. title: '请选择关联领料单',
  181. icon: 'none'
  182. })
  183. return
  184. }
  185. if (this.tableList.length <= 0) {
  186. uni.showToast({
  187. title: '请扫码录入明细信息',
  188. icon: 'none'
  189. })
  190. return
  191. }
  192. if (this.tableList.length !== this.productList.length) {
  193. uni.showToast({
  194. title: '请检查拣货清单',
  195. icon: 'none'
  196. })
  197. return
  198. } else {
  199. for (let i = 0; i < this.productList.length; i++) {
  200. let obj = this.tableList.find(item => item.categoryCode == this.productList[i].categoryCode)
  201. if (!!obj) {
  202. if (this.productList[i].packingQuantity != obj.packingQuantity || this.productList[i]
  203. .packingUnit != obj.packingUnit) {
  204. uni.showToast({
  205. title: '请检查拣货清单',
  206. icon: 'none'
  207. })
  208. return
  209. }
  210. } else {
  211. uni.showToast({
  212. title: '请检查拣货清单',
  213. icon: 'none'
  214. })
  215. return
  216. }
  217. }
  218. }
  219. uni.showLoading({
  220. title: '保存中...'
  221. })
  222. let params = {
  223. code: this.formData.code,
  224. name: this.formData.name,
  225. sourceNo: this.formData.sourceBizNo,
  226. warehouseId: this.tableList[0].warehouseId,
  227. warehouseName: this.tableList[0].warehouseName,
  228. status: 2, // 出库
  229. info: this.tableList
  230. }
  231. savePickgoods(params)
  232. .then(res => {
  233. uni.hideLoading()
  234. uni.showToast({
  235. icon: 'none',
  236. title: '提交成功',
  237. duration: 2000
  238. })
  239. })
  240. .catch(() => {
  241. uni.hideLoading()
  242. uni.showToast({
  243. icon: 'none',
  244. title: '提交失败',
  245. duration: 2000
  246. })
  247. })
  248. }
  249. }
  250. }
  251. </script>
  252. <style lang="scss" scoped>
  253. .mainBox {
  254. height: 100vh;
  255. display: flex;
  256. flex-direction: column;
  257. /deep/.required-form .u-form-item__body__left__content__label::before {
  258. content: '*';
  259. color: red;
  260. }
  261. }
  262. .required-form-text {
  263. /deep/ .u-form-item__body__right {
  264. overflow: hidden;
  265. .u-form-item__body__right__content {
  266. width: 100%;
  267. display: inline-block !important;
  268. width: 100%;
  269. }
  270. }
  271. }
  272. .tabs-container {
  273. height: 80rpx;
  274. display: flex;
  275. align-items: center;
  276. justify-content: center;
  277. }
  278. .tabs {
  279. display: flex;
  280. width: 100vw;
  281. height: 80rpx;
  282. background-color: #fff;
  283. display: flex;
  284. justify-content: flex-start;
  285. align-items: flex-end;
  286. margin: 20rpx 0;
  287. padding: 0 10rpx;
  288. box-sizing: border-box;
  289. .tab-item {
  290. flex: 1;
  291. display: flex;
  292. justify-content: center;
  293. align-items: center;
  294. padding: 10rpx 0;
  295. box-sizing: border-box;
  296. height: 72rpx;
  297. .label {
  298. margin-right: 10rpx;
  299. }
  300. &.active {
  301. background: linear-gradient(180deg, rgba(75, 121, 2, 1) 0%, rgba(255, 255, 255, 1) 12%);
  302. border-right: 1rpx solid #ccc;
  303. border-left: 1rpx solid #ccc;
  304. border-bottom: 1rpx solid #ccc;
  305. border-radius: 10rpx;
  306. }
  307. }
  308. }
  309. .picList {
  310. display: flex;
  311. align-items: center;
  312. justify-items: flex-start;
  313. flex-wrap: wrap;
  314. }
  315. /deep/.baseForm {
  316. .u-form-item__body {
  317. padding: 4px !important;
  318. }
  319. .assetType_box {
  320. padding: 12rpx 18rpx;
  321. width: 100%;
  322. overflow: hidden;
  323. white-space: nowrap;
  324. text-overflow: ellipsis;
  325. }
  326. }
  327. /deep/.picList .u-image {
  328. margin-right: 10rpx;
  329. margin-bottom: 10rpx;
  330. }
  331. /deep/.cLine .u-line:nth-child(1) {
  332. border-bottom: none !important;
  333. }
  334. .detail-box {
  335. position: relative;
  336. display: flex;
  337. justify-content: space-between;
  338. align-items: center;
  339. /deep/uni-button {
  340. margin: 0 !important;
  341. width: 180rpx;
  342. }
  343. .selectEnterType {
  344. margin-left: 10rpx !important;
  345. }
  346. }
  347. .footBox {
  348. height: 80rpx;
  349. width: 100%;
  350. display: flex;
  351. align-items: center;
  352. justify-content: space-between;
  353. view {
  354. width: 100%;
  355. height: 100%;
  356. text-align: center;
  357. color: #fff;
  358. display: flex;
  359. align-items: center;
  360. justify-content: center;
  361. }
  362. .reg {
  363. background: $u-success-dark;
  364. }
  365. .add {
  366. background: $uni-color-primary;
  367. }
  368. .uni-icons {
  369. margin-right: 8rpx !important;
  370. }
  371. }
  372. .tableBox {
  373. flex: 1;
  374. overflow: hidden;
  375. display: flex;
  376. flex-direction: column;
  377. .scrollList {
  378. flex: 1;
  379. height: 100% !important;
  380. .listBox {
  381. display: flex;
  382. padding: 20rpx;
  383. border-bottom: 2rpx solid #e5e5e5;
  384. .listBox-con {
  385. width: 100%;
  386. align-items: center;
  387. padding: 0 18rpx 0 0;
  388. .listBox-top {
  389. width: 100%;
  390. display: flex;
  391. justify-content: space-between;
  392. padding-bottom: 10rpx;
  393. .listBox-name,
  394. .listBox-code {
  395. display: inline-block;
  396. font-size: $uni-font-size-sm;
  397. font-weight: bold;
  398. }
  399. }
  400. .listBox-bottom {
  401. width: 100%;
  402. display: flex;
  403. justify-content: space-between;
  404. font-size: $uni-font-size-sm;
  405. flex-wrap: wrap;
  406. >view {
  407. width: 50%;
  408. overflow: hidden;
  409. white-space: nowrap;
  410. text-overflow: ellipsis;
  411. line-height: 24px;
  412. }
  413. .input_view {
  414. display: flex;
  415. align-items: center;
  416. justify-content: center;
  417. .u-input {
  418. height: 36rpx;
  419. padding: 0 !important;
  420. margin-right: 10rpx;
  421. border: 1px solid #ddd;
  422. }
  423. }
  424. .w100 {
  425. width: 100%;
  426. }
  427. }
  428. }
  429. }
  430. }
  431. .no_data {
  432. flex: 1;
  433. display: flex;
  434. align-items: center;
  435. justify-content: center;
  436. }
  437. .list {
  438. padding: 20rpx 10rpx;
  439. border-bottom: 1px #f2f2f2 solid;
  440. position: relative;
  441. &.code {
  442. .label {
  443. width: 120rpx !important;
  444. }
  445. }
  446. .listTit {
  447. width: 100%;
  448. display: flex;
  449. justify-content: space-between;
  450. align-items: center;
  451. /deep/uni-button {
  452. margin-right: 20rpx;
  453. width: 100rpx;
  454. &.assets {
  455. width: 180rpx;
  456. }
  457. }
  458. .name {
  459. width: 50%;
  460. margin-left: 10px;
  461. overflow: hidden;
  462. white-space: nowrap;
  463. -o-text-overflow: ellipsis;
  464. text-overflow: ellipsis;
  465. font-size: 30rpx;
  466. }
  467. .btn {
  468. display: flex;
  469. justify-content: flex-end;
  470. }
  471. .weight {
  472. width: 30%;
  473. font-size: 30rpx;
  474. margin-left: auto;
  475. margin-right: 60rpx;
  476. position: relative;
  477. display: flex;
  478. input {
  479. margin-right: 10rpx;
  480. border: 1px solid black;
  481. width: 40%;
  482. height: 20rpx;
  483. }
  484. }
  485. .weight::after {
  486. position: absolute;
  487. right: -30rpx;
  488. top: 50%;
  489. content: '';
  490. background: #eee;
  491. width: 1px;
  492. height: 28rpx;
  493. margin-top: -14rpx;
  494. }
  495. }
  496. .z_list {
  497. max-height: 500rpx;
  498. .material {
  499. margin-top: 10rpx;
  500. .left {
  501. width: 40rpx;
  502. }
  503. .zdy_check {
  504. width: 30rpx;
  505. height: 30rpx;
  506. border: 2rpx solid #c8c9cc;
  507. border-radius: 4rpx;
  508. }
  509. .check_active {
  510. background: $theme-color;
  511. border: 2rpx solid $theme-color;
  512. /deep/ .u-icon__icon {
  513. color: #fff !important;
  514. }
  515. }
  516. .content_table {
  517. width: 670rpx;
  518. border: 2rpx solid $border-color;
  519. .item {
  520. display: flex;
  521. border-bottom: 2rpx solid $border-color;
  522. .lable {
  523. width: 200rpx;
  524. text-align: center;
  525. background-color: #f7f9fa;
  526. font-size: 26rpx;
  527. border-right: 2rpx solid $border-color;
  528. flex-shrink: 0;
  529. }
  530. .ww80 {
  531. width: 80rpx;
  532. }
  533. .content {
  534. width: 500rpx;
  535. min-height: 64rpx;
  536. font-size: 28rpx;
  537. line-height: 28rpx;
  538. font-style: normal;
  539. font-weight: 400;
  540. padding: 18rpx 8rpx;
  541. box-sizing: border-box;
  542. word-wrap: break-word;
  543. flex-grow: 1 !important;
  544. }
  545. .input_box {
  546. padding: 0 !important;
  547. }
  548. .content_num {
  549. display: flex;
  550. align-items: center;
  551. padding: 0 4rpx;
  552. /deep/ .uni-input-input {
  553. width: 200rpx;
  554. border: 2rpx solid #f0f8f2;
  555. background: #f0f8f2;
  556. color: $theme-color;
  557. }
  558. .unit {
  559. padding: 0 4rpx;
  560. font-size: 24rpx;
  561. color: #404446;
  562. }
  563. }
  564. .ww400 {
  565. /deep/ .uni-input-input {
  566. width: 400rpx;
  567. }
  568. }
  569. .pd4 {
  570. padding: 4rpx 8rpx;
  571. }
  572. &:last-child {
  573. border-bottom: none;
  574. }
  575. }
  576. .ww55 {
  577. width: 55%;
  578. }
  579. .ww45 {
  580. width: 45%;
  581. }
  582. .ww50 {
  583. width: 50%;
  584. }
  585. .ww30 {
  586. width: 30%;
  587. }
  588. .ww70 {
  589. width: 70%;
  590. }
  591. .ww80 {
  592. width: 80%;
  593. }
  594. .ww20 {
  595. width: 20%;
  596. }
  597. .check {
  598. width: 30rpx;
  599. height: 30rpx;
  600. }
  601. .tag_box {
  602. padding: 2rpx 10rpx;
  603. margin-right: 12rpx;
  604. background: #e6a23c;
  605. font-size: 22rpx;
  606. color: #fff;
  607. border-radius: 4rpx;
  608. }
  609. }
  610. }
  611. }
  612. .more {
  613. position: absolute;
  614. bottom: 26rpx;
  615. right: 30rpx;
  616. font-size: 28rpx;
  617. color: #666;
  618. }
  619. }
  620. }
  621. .selectTime {
  622. display: flex;
  623. justify-content: flex-end;
  624. margin-bottom: 10rpx;
  625. .timeBox {
  626. display: flex;
  627. width: 500rpx;
  628. .firstBtn {
  629. margin-right: 10rpx;
  630. }
  631. }
  632. }
  633. .textBox {
  634. border: 1px #f2f2f2 solid;
  635. height: 160px;
  636. display: block;
  637. width: auto !important;
  638. }
  639. .saveBtn {
  640. width: 50%;
  641. margin: 40rpx auto;
  642. }
  643. .top-css {
  644. border-bottom: 1px solid rgb(207, 204, 204);
  645. }
  646. </style>