reviewDtl.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597
  1. <template>
  2. <div>
  3. <uni-nav-bar title="退仓复核-详情" :status-bar="true" background-color="#3F92F9" color="#FFF">
  4. <view slot="left">
  5. <u-icon name="account-fill" color="#FFF" size="35"></u-icon>
  6. <span style="padding: 0 5rpx;color: #FFFFFF;">{{ userInfo.name }}</span>
  7. </view>
  8. <view slot="right" @tap="$utils.openNew(`/pages/warehouse/review`)">
  9. <span style="color: #FFFFFF;">返回</span>
  10. </view>
  11. </uni-nav-bar>
  12. <ul class="review-ul">
  13. <li v-for="(i,index) in dtlData.checkDetailsInfoList" :key="i.materialId">
  14. <view class="title">
  15. 物料名称:{{i.materialName}}
  16. </view>
  17. <view class="lists">
  18. <view class="list-box" v-for="(j,jindex) in i.stockBackDetailsList" :key="i.id">
  19. <view class="col">
  20. 卷{{jindex + 1}}
  21. </view>
  22. <view class="col" style="padding: 0 10rpx;">
  23. {{j.materialMeters}}
  24. </view style="padding: 0 10rpx;">
  25. <view class="col" style="min-height:10rpx" @click="openRfidModal(j.rfid)">
  26. {{j.rfid ? j.rfid : ' '}}
  27. </view>
  28. <view class="col">
  29. <button @click="sacnFn(index,jindex)">扫描</button>
  30. </view>
  31. <view class="col">
  32. <button @click="tagFn(index,jindex)">生成</button>
  33. </view>
  34. </view>
  35. <view class="footer-btn-warp" style="margin-top: 20rpx;">
  36. <button class="cancel" style="color:#333" @click="dtlDataListDlt(index)">删除</button>
  37. <button class="upload" style="color:#333" @click="listUpdate(i,index)">修改</button>
  38. </view>
  39. </view>
  40. </li>
  41. </ul>
  42. <view class="footer-btn-warp" style="margin-top: 20rpx;">
  43. <button class="cancel" style="background-color:red" @tap="$utils.back()">取消</button>
  44. <button class="upload" style="background-color:blue" @click="submitCheck">确定</button>
  45. </view>
  46. <uni-popup ref="addModal" type="bottom">
  47. <view class="addModal-content">
  48. <view class="select-warp">
  49. <view class="label">
  50. 选择面料
  51. </view>
  52. <view class="show-text" @click="openSelectModal">
  53. {{!selectMaterialDtl.materialName ? '请选择物料' : selectMaterialDtl.materialName }}
  54. </view>
  55. <view class="add-icon">
  56. +
  57. </view>
  58. </view>
  59. <view style="height:40rpx;border-bottom: 1px solid #ccc;">
  60. </view>
  61. <view class="ul">
  62. <view class="li" v-for="(i,index) in selectMaterialDtl.stockBackDetailsList">
  63. <view class="delete-icon" @click="materialMetersListDelete(index)">
  64. -
  65. </view>
  66. <view class="li-label">
  67. 卷{{index + 1}}
  68. </view>
  69. <view class="input">
  70. <input type="number" :value="i.materialMeters" @input="((e)=>inputChange(e,index))">
  71. </view>
  72. </view>
  73. </view>
  74. <!-- <button class="add-btn" @click="addList">在添加一卷</button> -->
  75. <view class="footer-btn-warp" style="margin-top: 20rpx;">
  76. <button class="cancel" style="background-color:red" @click="closeaddModal">取消</button>
  77. <button class="upload" style="background-color:blue" @click="closeaddModal">确定</button>
  78. </view>
  79. </view>
  80. </uni-popup>
  81. <uni-popup ref="popup2" type="bottom">
  82. <u-tabs-swiper ref="uTabs" :list="list" :current="current" @change="tabsChange" :is-scroll="false"
  83. swiperWidth="750"></u-tabs-swiper>
  84. <view class="search-box" v-if="current == 0">
  85. <ul>
  86. <li @click="selectMaterialList(i)" v-for="i in pickingToday" :key="i.id">
  87. {{i.name}}
  88. </li>
  89. <view class="no-data" v-if="pickingToday.length == 0">
  90. 暂无今日领取面料数据
  91. </view>
  92. </ul>
  93. </view>
  94. <view class="search-box" v-if="current == 1">
  95. <view class="input-warp">
  96. <u-input v-model="req.search" :searchIcon="true" :border="true" placeholder="请输入物料名称或编码"
  97. @search="getSelectMaterialList" class="search-input" />
  98. </view>
  99. <ul>
  100. <li @click="selectMaterialList(i)" v-for="i in materialData" :key="i.id">
  101. {{i.name}}
  102. </li>
  103. <view class="no-data" v-if="materialData.length == 0">
  104. 暂无数据
  105. </view>
  106. </ul>
  107. </view>
  108. </uni-popup>
  109. <uni-popup ref="alertDialog" type="dialog">
  110. <view style="color:#fff;font-size: 34rpx;">
  111. {{showModalId}}
  112. </view>
  113. </uni-popup>
  114. </div>
  115. </template>
  116. <script>
  117. import scan from './scan'
  118. export default {
  119. name: "xx",
  120. components: {
  121. scan
  122. },
  123. data() {
  124. return {
  125. dtlData: {},
  126. isEdit: false,
  127. swiperCurrent: 0,
  128. current: 0,
  129. list: [{
  130. name: '今日领取的面料'
  131. }, {
  132. name: '选择其他'
  133. }],
  134. userInfo: this.$storage.getStorageSync('userInfo'),
  135. form: {
  136. operatorId: this.$storage.getStorageSync('userInfo').id,
  137. backDetailList: [],
  138. },
  139. req: {
  140. userId: this.$storage.getStorageSync('userInfo').id,
  141. pageNum: 1,
  142. pageSize: 10,
  143. search: null,
  144. materialCode: null,
  145. },
  146. pickingToday: [],
  147. materialData: [],
  148. selectMaterialDtl: {},
  149. updateIndex: null,
  150. showModalId: null,
  151. }
  152. },
  153. onLoad(option) {
  154. const v = this
  155. uni.getStorage({
  156. key: 'reviewDtl',
  157. success: function(res) {
  158. console.log(res)
  159. v.dtlData = res.data
  160. },
  161. fail(err) {
  162. v.getDtl(option.id)
  163. }
  164. });
  165. },
  166. created() {
  167. this.selectList()
  168. this.getSelectMaterialList()
  169. },
  170. methods: {
  171. dialogClose(){
  172. this.$refs.alertDialog.close()
  173. },
  174. openRfidModal(id) {
  175. this.showModalId = id
  176. this.$refs.alertDialog.open()
  177. },
  178. closeaddModal() {
  179. this.$refs.addModal.close()
  180. },
  181. submitCheck() {
  182. uni.showLoading({
  183. title: '正在提交'
  184. })
  185. const v = this
  186. var rfidItems = []
  187. for (var i = 0; i < v.dtlData.checkDetailsInfoList.length; i++) {
  188. const element = v.dtlData.checkDetailsInfoList[i]
  189. for (var j = 0; j < element.stockBackDetailsList.length; j++) {
  190. const jelement = element.stockBackDetailsList[j]
  191. if (!jelement.rfid) {
  192. this.$msg.showToast('请扫描或生成所有面料!')
  193. return
  194. } else {
  195. rfidItems.push(jelement.rfid)
  196. }
  197. }
  198. }
  199. const obj = {
  200. "userId": v.req.userId,
  201. "plcCode": "1",
  202. "rfidItems": rfidItems,
  203. "stockChangeType": "16",
  204. "remark": "退仓复合"
  205. }
  206. uni.request({
  207. url: 'http://120.79.80.64:8050' + '/cloudApi/stockBack/submitCheck',
  208. method: 'POST',
  209. header: {
  210. 'Content-Type': 'application/json',
  211. },
  212. data: v.dtlData,
  213. success: res => {
  214. console.log(res)
  215. if (res.data.code == 200) {
  216. this.$http.HandleMacStockInOut(obj).then(res => {
  217. console.log(res)
  218. if (res.code === 0) {
  219. this.$msg.showToast(res.msg || '操作成功!')
  220. this.timer = setTimeout(() => {
  221. this.$utils.openNew(`/pages/warehouse/review`)
  222. }, 2000)
  223. }
  224. })
  225. }
  226. uni.hideLoading()
  227. },
  228. fail() {
  229. uni.hideLoading()
  230. }
  231. });
  232. },
  233. tagFn(index, jindex) {
  234. const v = this
  235. v.dtlData.index = index
  236. v.dtlData.jindex = jindex
  237. uni.setStorage({
  238. key: 'reviewDtl',
  239. data: v.dtlData,
  240. success: function() {
  241. v.$utils.open('/pages/warehouse/tag')
  242. }
  243. });
  244. },
  245. sacnFn(index, jindex) {
  246. const v = this
  247. v.dtlData.index = index
  248. v.dtlData.jindex = jindex
  249. uni.setStorage({
  250. key: 'reviewDtl',
  251. data: v.dtlData,
  252. success: function() {
  253. v.$utils.open('/pages/warehouse/scan')
  254. }
  255. });
  256. },
  257. getDtl(_id) {
  258. console.log(_id)
  259. const v = this
  260. uni.request({
  261. url: 'http://120.79.80.64:8050' + '/cloudApi/stockBack/checkDetails',
  262. method: 'POST',
  263. header: {
  264. 'Content-Type': 'application/json',
  265. },
  266. data: {
  267. stockBackId: _id
  268. },
  269. success: res => {
  270. this.dtlData = res.data.data
  271. v.dtlData.checkerId = this.$storage.getStorageSync('userInfo').id
  272. console.log(this.dtlData)
  273. },
  274. });
  275. },
  276. submitBack() {
  277. const v = this
  278. console.log(v.form)
  279. uni.request({
  280. url: 'http://120.79.80.64:8050' + '/cloudApi/stockBack/submitBack',
  281. method: 'POST',
  282. header: {
  283. 'Content-Type': 'application/json',
  284. },
  285. data: v.form,
  286. success: res => {
  287. console.log(res)
  288. if (res.data.code == 200) {
  289. this.$msg.showToast('操作成功!')
  290. this.$utils.back()
  291. }
  292. },
  293. });
  294. },
  295. dtlDataListDlt(index) {
  296. this.dtlData.checkDetailsInfoList.splice(index, 1)
  297. },
  298. materialMetersListDelete(index) {
  299. this.dtlData.checkDetailsInfoList[this.updateIndex].stockBackDetailsList.splice(index, 1)
  300. },
  301. listUpdate(i, index) {
  302. console.log(i)
  303. this.selectMaterialDtl = i
  304. this.updateIndex = index
  305. this.$refs.addModal.open()
  306. },
  307. listDelete(index) {
  308. this.form.backDetailList.splice(index, 1)
  309. },
  310. pushList() {
  311. if (this.updateIndex === null) {
  312. this.form.backDetailList.push(this.selectMaterialDtl)
  313. } else {
  314. this.form.backDetailList[this.updateIndex] = this.selectMaterialDtl
  315. }
  316. this.selectMaterialDtl = {}
  317. this.$refs.addModal.close()
  318. },
  319. inputChange(e, index) {
  320. this.selectMaterialDtl.stockBackDetailsList[index].materialMeters = e.detail.value
  321. console.log(this.selectMaterialDtl)
  322. },
  323. tabsChange(index) {
  324. this.swiperCurrent = index;
  325. this.current = index;
  326. },
  327. addList() {
  328. this.selectMaterialDtl.materialMetersList.push({
  329. "id": "1565274397500047361",
  330. "stockBackId": "1565274397445521410",
  331. "materialId": "01.002.0043",
  332. "materialMeters": 0,
  333. "oldMaterialMeters": 0,
  334. "rfid": ""
  335. })
  336. },
  337. selectMaterialList(i) {
  338. const v = this
  339. this.dtlData.checkDetailsInfoList[this.updateIndex].materialId = i.code
  340. this.dtlData.checkDetailsInfoList[this.updateIndex].materialName = i.name
  341. console.log(i)
  342. console.log(this.updateIndex)
  343. },
  344. openSelectModal() {
  345. this.$refs.popup2.open()
  346. },
  347. getSelectMaterialList() {
  348. const v = this
  349. uni.request({
  350. url: 'http://120.79.80.64:8050' + '/cloudApi/material/selectList',
  351. method: 'POST',
  352. header: {
  353. 'Content-Type': 'application/json',
  354. },
  355. data: v.req,
  356. success: res => {
  357. console.log(res)
  358. this.materialData = res.data.data
  359. },
  360. });
  361. },
  362. selectList() {
  363. const v = this
  364. uni.request({
  365. url: 'http://120.79.80.64:8050' + '/cloudApi/stockBack/getPickingToday',
  366. method: 'POST',
  367. header: {
  368. 'Content-Type': 'application/json',
  369. },
  370. data: v.req,
  371. success: res => {
  372. console.log(res)
  373. this.pickingToday = res.data.data
  374. },
  375. });
  376. },
  377. openModal() {
  378. this.$refs.addModal.open('bottom')
  379. },
  380. },
  381. }
  382. </script>
  383. <style scoped lang="less">
  384. .review-ul {
  385. padding: 0 20rpx;
  386. li {
  387. background-color: #fff;
  388. border-radius: 6rpx;
  389. list-style: none;
  390. margin-top: 20rpx;
  391. .title {
  392. height: 100rpx;
  393. line-height: 100rpx;
  394. font-size: 30rpx;
  395. border-bottom: 1px solid #dcdcdc;
  396. padding: 0 20rpx;
  397. }
  398. .lists {
  399. .list-box {
  400. overflow: hidden;
  401. line-height: 80rpx;
  402. .col {
  403. float: left;
  404. width: 20%;
  405. text-align: center;
  406. overflow: hidden;
  407. button {
  408. width: 80%;
  409. }
  410. }
  411. }
  412. }
  413. }
  414. }
  415. .footer-btn-warp {
  416. display: flex;
  417. padding: 20rpx;
  418. button {
  419. width: 48%;
  420. color: #fff;
  421. }
  422. }
  423. .search-box {
  424. .input-warp {
  425. padding: 40rpx;
  426. }
  427. .search-input {}
  428. background-color: #fff;
  429. text-align: center;
  430. ul {
  431. li {
  432. padding: 25rpx 30rpx;
  433. border-bottom: 1rpx solid #dcdcdc;
  434. list-style: none;
  435. }
  436. }
  437. .no-data {
  438. padding: 100rpx;
  439. }
  440. }
  441. .addModal-content {
  442. background-color: #fff;
  443. border-top-left-radius: 20rpx;
  444. border-top-right-radius: 20rpx;
  445. padding-top: 40rpx;
  446. .footer-btn-warp {
  447. display: flex;
  448. padding: 20rpx;
  449. button {
  450. width: 48%;
  451. color: #fff;
  452. }
  453. }
  454. .ul {
  455. .li {
  456. display: flex;
  457. justify-content: space-between;
  458. height: 80rpx;
  459. line-height: 80rpx;
  460. margin-top: 20rpx;
  461. .input {
  462. width: 70%;
  463. input {
  464. border: 1rpx solid #dcdcdc;
  465. height: 78rpx;
  466. line-height: 78rpx;
  467. padding: 0 20rpx;
  468. }
  469. }
  470. }
  471. .delete-icon {
  472. height: 80rpx;
  473. width: 80rpx;
  474. text-align: center;
  475. line-height: 80rpx;
  476. font-size: 40rpx;
  477. color: #fff;
  478. background-color: #ccc;
  479. }
  480. }
  481. .select-warp {
  482. height: 80rpx;
  483. line-height: 80rpx;
  484. padding: 0 20rpx;
  485. box-sizing: border-box;
  486. display: flex;
  487. justify-content: space-between;
  488. .show-text {
  489. width: 70%;
  490. border: 1rpx solid #dcdcdc;
  491. padding: 0 20rpx;
  492. }
  493. .add-icon {
  494. height: 80rpx;
  495. width: 80rpx;
  496. text-align: center;
  497. line-height: 80rpx;
  498. font-size: 40rpx;
  499. color: #fff;
  500. background-color: #ccc;
  501. }
  502. }
  503. }
  504. .ul {
  505. .li {
  506. background-color: #fff;
  507. border-radius: 5rpx;
  508. margin: 20rpx 20rpx 0;
  509. .label {
  510. height: 100rpx;
  511. line-height: 100rpx;
  512. font-weight: 30rpx;
  513. border-bottom: 1rpx solid #ccc;
  514. padding: 0 20rpx;
  515. }
  516. .lists {
  517. border-bottom: 1rpx solid #ccc;
  518. .list-box {
  519. height: 100rpx;
  520. line-height: 100rpx;
  521. display: flex;
  522. justify-content: space-between;
  523. padding: 0 20rpx;
  524. }
  525. }
  526. .list-btn-warp {
  527. display: flex;
  528. padding: 20rpx;
  529. button {
  530. width: 48%;
  531. }
  532. }
  533. }
  534. }
  535. .add-header {
  536. height: 100rpx;
  537. line-height: 100rpx;
  538. font-size: 30rpx;
  539. font-weight: bold;
  540. overflow: hidden;
  541. padding: 20rpx;
  542. button {
  543. width: 200rpx;
  544. color: #fff;
  545. background-color: red;
  546. float: right;
  547. margin: 14rpx 0;
  548. }
  549. }
  550. </style>