return-warehouse.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440
  1. <template>
  2. <div>
  3. <view class="add-header">
  4. 退仓面料: <button @click="openModal">添加物料</button>
  5. </view>
  6. <view class="ul">
  7. <view class="li" v-for="(i,index) in form.backDetailList" :key="i.materialId">
  8. <view class="label">
  9. 物料名称:{{i.name}}
  10. </view>
  11. <view class="lists">
  12. <view class="list-box" v-for="(j,jindex) in i.materialMetersList" :key="jindex">
  13. <view>卷{{jindex + 1}}</view>
  14. <view>
  15. <span>{{j}}</span>
  16. </view>
  17. </view>
  18. </view>
  19. <view class="list-btn-warp">
  20. <button @click="listDelete(index)">删除</button>
  21. <button @click="listUpdate(i,index)">{{i.isEdit ? '确认' : '修改'}}</button>
  22. </view>
  23. </view>
  24. </view>
  25. <view class="footer-btn-warp" style="margin-top: 20rpx;" v-if="form.backDetailList.length != 0">
  26. <button class="cancel" style="background-color:red" @click="backFn">取消</button>
  27. <button class="upload" style="background-color:blue" @click="submitBack()">确定</button>
  28. </view>
  29. <uni-popup ref="addModal" type="bottom">
  30. <view class="addModal-content">
  31. <view class="select-warp">
  32. <view class="label">
  33. 选择面料
  34. </view>
  35. <view class="show-text" @click="openSelectModal">
  36. {{!selectMaterialDtl.name ? '请选择物料' : selectMaterialDtl.name }}
  37. </view>
  38. <view class="add-icon">
  39. +
  40. </view>
  41. </view>
  42. <view style="height:40rpx;border-bottom: 1px solid #ccc;">
  43. </view>
  44. <view class="ul">
  45. <view class="li" v-for="(i,index) in selectMaterialDtl.materialMetersList" :key="index">
  46. <view class="delete-icon" @click="materialMetersListDelete(index)">
  47. -
  48. </view>
  49. <view class="li-label">
  50. 卷{{index + 1}}
  51. </view>
  52. <view class="input">
  53. <input type="number" :value="i" @input="((e)=>inputChange(e,index))">
  54. </view>
  55. </view>
  56. </view>
  57. <button class="add-btn" @click="addList">再添加一卷</button>
  58. <view class="footer-btn-warp" style="margin-top: 20rpx;">
  59. <button class="cancel" style="background-color:red" @click="cancelFn">取消</button>
  60. <button class="upload" style="background-color:blue" @click="pushList">确定</button>
  61. </view>
  62. </view>
  63. </uni-popup>
  64. <uni-popup ref="popup2" type="bottom">
  65. <view class="tabs">
  66. <view class="tab-box" @click="tabChange(0)">
  67. 今日领取的面料
  68. <view class="blue-line" :class="current === 1 ? 'op0':''">
  69. </view>
  70. </view>
  71. <view class="tab-box" @click="tabChange(1)">
  72. 选择其他
  73. <view class="blue-line" :class="current === 0 ? 'op0':''">
  74. </view>
  75. </view>
  76. </view>
  77. <view class="search-box" v-if="current == 0">
  78. <ul style="height: 60vh;overflow-y: scroll;">
  79. <li @click="selectMaterialList(i)" v-for="i in pickingToday" :key="i.id">
  80. {{i.materialName}}
  81. </li>
  82. <view class="no-data" v-if="pickingToday.length == 0">
  83. 暂无今日领取面料数据
  84. </view>
  85. </ul>
  86. </view>
  87. <view class="search-box" v-if="current == 1">
  88. <view class="input-warp">
  89. <input
  90. v-model="req.search"
  91. :searchIcon="true"
  92. :border="true"
  93. placeholder="请输入物料名称或编码"
  94. @input="getSelectMaterialList"
  95. class="search-input"
  96. />
  97. </view>
  98. <ul style="height: 60vh;overflow-y: scroll;">
  99. <li @click="selectMaterialList(i)" v-for="i in materialData" :key="i.id">
  100. {{i.name}}
  101. </li>
  102. <view class="no-data" v-if="materialData.length == 0">
  103. 暂无数据
  104. </view>
  105. </ul>
  106. </view>
  107. </uni-popup>
  108. </div>
  109. </template>
  110. <script>
  111. export default{
  112. name:"xx",
  113. data(){
  114. return{
  115. isEdit:false,
  116. swiperCurrent:0,
  117. current:0,
  118. list: [{
  119. name: '今日领取的面料'
  120. }, {
  121. name: '选择其他'
  122. }],
  123. userInfo:{},
  124. form:{
  125. operatorId:null,
  126. backDetailList:[],
  127. },
  128. req:{
  129. userId:null,
  130. pageNum:1,
  131. pageSize:30,
  132. search:null,
  133. materialCode:null,
  134. },
  135. pickingToday:[],
  136. materialData:[],
  137. selectMaterialDtl:{},
  138. updateIndex:null,
  139. }
  140. },
  141. created(){
  142. const v = this
  143. uni.getStorage({
  144. key:'Authorization',
  145. success:(res=>{
  146. console.log(res)
  147. v.form.operatorId = res.data.account
  148. v.req.userId = res.data.account
  149. v.userInfo = res.data
  150. console.log(v.req,'req')
  151. v.selectList()
  152. v.getSelectMaterialList()
  153. })
  154. })
  155. },
  156. methods:{
  157. backFn(){
  158. uni.navigateBack()
  159. },
  160. cancelFn(){
  161. this.$refs.addModal.close()
  162. },
  163. tabChange(_type){
  164. this.current = _type
  165. },
  166. submitBack(){
  167. const v = this
  168. console.log(v.form)
  169. uni.showLoading({title: '加载中',mask:true});
  170. v.$post('/stockBack/submitBack',v.form).then(res=>{
  171. console.log(res)
  172. uni.hideLoading()
  173. if(res.code == 200){
  174. uni.hideLoading()
  175. uni.showToast({
  176. title: '提交成功,跳转中!'
  177. })
  178. setTimeout(() => {
  179. wx.reLaunch({
  180. url: '/pages/home'
  181. })
  182. }, 2000)
  183. }
  184. })
  185. },
  186. materialMetersListDelete(index){
  187. this.selectMaterialDtl.materialMetersList.splice(index,1)
  188. },
  189. listUpdate(i,index){
  190. this.selectMaterialDtl = i
  191. this.updateIndex = index
  192. this.$refs.addModal.open()
  193. },
  194. listDelete(index){
  195. this.form.backDetailList.splice(index,1)
  196. },
  197. pushList(){
  198. if(this.updateIndex === null){
  199. this.form.backDetailList.push(this.selectMaterialDtl)
  200. }else{
  201. this.form.backDetailList[this.updateIndex] = this.selectMaterialDtl
  202. }
  203. this.selectMaterialDtl = {}
  204. this.$refs.addModal.close()
  205. },
  206. inputChange(e,index){
  207. this.selectMaterialDtl.materialMetersList[index] = e.detail.value
  208. console.log(this.selectMaterialDtl)
  209. },
  210. tabsChange(index) {
  211. this.swiperCurrent = index;
  212. this.current = index;
  213. },
  214. addList(){
  215. if(!this.selectMaterialDtl.name){
  216. this.$msg.showToast('请选择物料!')
  217. return
  218. }
  219. this.selectMaterialDtl.materialMetersList.push(0)
  220. },
  221. selectMaterialList(i){
  222. const v = this
  223. v.selectMaterialDtl = {
  224. materialId:i.id,
  225. materialMetersList:[],
  226. name:i.name,
  227. isEdit:false,
  228. }
  229. this.$refs.popup2.close()
  230. },
  231. openSelectModal(){
  232. this.selectMaterialDtl = {}
  233. this.updateIndex = null
  234. this.$refs.popup2.open()
  235. },
  236. getSelectMaterialList(){
  237. const v = this
  238. v.$post('/material/selectList',v.req).then(res=>{
  239. console.log(res,1231231231)
  240. this.materialData = res.data
  241. })
  242. },
  243. selectList(){
  244. const v = this
  245. v.$post('/stockBack/getPickingToday',v.req).then(res=>{
  246. for (var i = 0; i < res.data.length; i++) {
  247. res.data[i].id = res.data[i].materialId
  248. res.data[i].name = res.data[i].materialName
  249. }
  250. this.pickingToday = res.data
  251. })
  252. },
  253. openModal(){
  254. this.$refs.addModal.open('bottom')
  255. },
  256. },
  257. }
  258. </script>
  259. <style scoped lang="less">
  260. .tabs{
  261. background-color: #fff;
  262. display: flex;
  263. .tab-box {
  264. width: 49%;
  265. text-align: center;
  266. height: 80rpx;
  267. line-height: 80rpx;
  268. position: relative;
  269. color: #000;
  270. .blue-line {
  271. position: absolute;
  272. bottom: 0;
  273. left: 50%;
  274. height: 4rpx;
  275. width: 100rpx;
  276. margin-left: -50rpx;
  277. background-color: blue;
  278. }
  279. .op0{
  280. opacity: 0;
  281. }
  282. }
  283. }
  284. .footer-btn-warp{
  285. display: flex;
  286. padding: 20rpx;
  287. button{
  288. width: 48%;
  289. color: #fff;
  290. }
  291. }
  292. .search-box{
  293. .input-warp{
  294. padding: 40rpx;
  295. }
  296. .search-input {
  297. border:1rpx solid #dcdcdc;
  298. padding: 20rpx;
  299. }
  300. background-color: #fff;
  301. text-align: center;
  302. ul{
  303. li{
  304. padding: 25rpx 30rpx;
  305. border-bottom: 1rpx solid #dcdcdc;
  306. list-style: none;
  307. }
  308. }
  309. .no-data{
  310. padding: 100rpx;
  311. }
  312. }
  313. .addModal-content{
  314. background-color: #fff;
  315. border-top-left-radius:20rpx;
  316. border-top-right-radius:20rpx;
  317. padding-top:40rpx;
  318. .footer-btn-warp{
  319. display: flex;
  320. padding: 20rpx;
  321. button{
  322. width: 48%;
  323. color: #fff;
  324. }
  325. }
  326. .ul{
  327. .li{
  328. display: flex;
  329. justify-content: space-between;
  330. height: 80rpx;
  331. line-height: 80rpx;
  332. margin-top: 20rpx;
  333. .input{
  334. width: 70%;
  335. input{
  336. border:1rpx solid #dcdcdc;
  337. height: 78rpx;
  338. line-height: 78rpx;
  339. padding: 0 20rpx;
  340. }
  341. }
  342. }
  343. .delete-icon{
  344. height: 80rpx;
  345. width: 80rpx;
  346. text-align: center;
  347. line-height: 80rpx;
  348. font-size: 40rpx;
  349. color: #fff;
  350. background-color: #ccc;
  351. }
  352. }
  353. .select-warp{
  354. height: 80rpx;
  355. line-height: 80rpx;
  356. padding: 0 20rpx ;
  357. box-sizing: border-box;
  358. display: flex;
  359. justify-content: space-between;
  360. .show-text{
  361. width: 60%;
  362. border:1rpx solid #dcdcdc;
  363. padding: 0 20rpx;
  364. overflow: hidden;
  365. height: 80rpx;
  366. }
  367. .add-icon{
  368. height: 80rpx;
  369. width: 80rpx;
  370. text-align: center;
  371. line-height: 80rpx;
  372. font-size: 40rpx;
  373. color: #fff;
  374. background-color: #ccc;
  375. }
  376. }
  377. }
  378. .ul{
  379. .li{
  380. background-color: #fff;
  381. border-radius: 5rpx;
  382. margin: 20rpx 20rpx 0;
  383. .label{
  384. height: 100rpx;
  385. line-height: 100rpx;
  386. font-weight: 30rpx;
  387. border-bottom: 1rpx solid #ccc;
  388. padding: 0 20rpx;
  389. overflow: hidden;
  390. }
  391. .lists{
  392. border-bottom: 1rpx solid #ccc;
  393. .list-box{
  394. height: 100rpx;
  395. line-height: 100rpx;
  396. display: flex;
  397. justify-content: space-between;
  398. padding: 0 20rpx;
  399. }
  400. }
  401. .list-btn-warp{
  402. display: flex;
  403. padding: 20rpx;
  404. button{
  405. width: 48%;
  406. }
  407. }
  408. }
  409. }
  410. .add-header{
  411. height: 100rpx;
  412. line-height: 100rpx;
  413. font-size: 30rpx;
  414. font-weight: bold;
  415. overflow: hidden;
  416. padding: 20rpx;
  417. button{
  418. width: 200rpx;
  419. color: #fff;
  420. background-color: red;
  421. float: right;
  422. margin: 14rpx 0;
  423. }
  424. }
  425. </style>