add.vue 15 KB

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