reviewDtl.vue 13 KB

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