return-warehouse.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  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. type:1,
  128. },
  129. req:{
  130. userId:null,
  131. pageNum:1,
  132. pageSize:30,
  133. search:null,
  134. materialCode:null,
  135. },
  136. pickingToday:[],
  137. materialData:[],
  138. selectMaterialDtl:{},
  139. updateIndex:null,
  140. }
  141. },
  142. created(){
  143. const v = this
  144. uni.getStorage({
  145. key:'Authorization',
  146. success:(res=>{
  147. console.log(res)
  148. v.form.operatorId = res.data.account
  149. v.req.userId = res.data.account
  150. v.userInfo = res.data
  151. console.log(v.req,'req')
  152. v.selectList()
  153. v.getSelectMaterialList()
  154. })
  155. })
  156. },
  157. methods:{
  158. backFn(){
  159. uni.navigateBack()
  160. },
  161. cancelFn(){
  162. this.$refs.addModal.close()
  163. },
  164. tabChange(_type){
  165. this.current = _type
  166. },
  167. submitBack(){
  168. const v = this
  169. console.log(v.form)
  170. uni.showLoading({title: '加载中',mask:true});
  171. v.$post('/stockBack/submitBack',v.form).then(res=>{
  172. console.log(res)
  173. uni.hideLoading()
  174. if(res.code == 200){
  175. uni.hideLoading()
  176. uni.showToast({
  177. title: '提交成功,跳转中!'
  178. })
  179. setTimeout(() => {
  180. wx.reLaunch({
  181. url: '/pages/home'
  182. })
  183. }, 1000)
  184. }
  185. })
  186. },
  187. materialMetersListDelete(index){
  188. this.selectMaterialDtl.materialMetersList.splice(index,1)
  189. },
  190. listUpdate(i,index){
  191. this.selectMaterialDtl = i
  192. this.updateIndex = index
  193. this.$refs.addModal.open()
  194. },
  195. listDelete(index){
  196. this.form.backDetailList.splice(index,1)
  197. },
  198. pushList(){
  199. if(this.updateIndex === null){
  200. this.form.backDetailList.push(this.selectMaterialDtl)
  201. }else{
  202. this.form.backDetailList[this.updateIndex] = this.selectMaterialDtl
  203. }
  204. this.selectMaterialDtl = {}
  205. this.$refs.addModal.close()
  206. },
  207. inputChange(e,index){
  208. this.selectMaterialDtl.materialMetersList[index] = e.detail.value
  209. console.log(this.selectMaterialDtl)
  210. },
  211. tabsChange(index) {
  212. this.swiperCurrent = index;
  213. this.current = index;
  214. },
  215. addList(){
  216. if(!this.selectMaterialDtl.name){
  217. uni.showToast({
  218. title: '请选择物料!',
  219. icon:'none',
  220. duration: 2000
  221. })
  222. return
  223. }
  224. this.selectMaterialDtl.materialMetersList.push(0)
  225. },
  226. selectMaterialList(i){
  227. const v = this
  228. v.selectMaterialDtl = {
  229. materialId:i.id,
  230. materialMetersList:[],
  231. name:i.name,
  232. isEdit:false,
  233. }
  234. this.$refs.popup2.close()
  235. },
  236. openSelectModal(){
  237. this.selectMaterialDtl = {}
  238. this.updateIndex = null
  239. this.$refs.popup2.open()
  240. },
  241. getSelectMaterialList(){
  242. const v = this
  243. v.$post('/material/selectList',v.req).then(res=>{
  244. console.log(res,1231231231)
  245. this.materialData = res.data
  246. })
  247. },
  248. selectList(){
  249. const v = this
  250. v.$post('/stockBack/getPickingToday',v.req).then(res=>{
  251. for (var i = 0; i < res.data.length; i++) {
  252. res.data[i].id = res.data[i].materialId
  253. res.data[i].name = res.data[i].materialName
  254. }
  255. this.pickingToday = res.data
  256. })
  257. },
  258. openModal(){
  259. this.$refs.addModal.open('bottom')
  260. },
  261. },
  262. }
  263. </script>
  264. <style scoped lang="less">
  265. .tabs{
  266. background-color: #fff;
  267. display: flex;
  268. .tab-box {
  269. width: 49%;
  270. text-align: center;
  271. height: 80rpx;
  272. line-height: 80rpx;
  273. position: relative;
  274. color: #000;
  275. .blue-line {
  276. position: absolute;
  277. bottom: 0;
  278. left: 50%;
  279. height: 4rpx;
  280. width: 100rpx;
  281. margin-left: -50rpx;
  282. background-color: blue;
  283. }
  284. .op0{
  285. opacity: 0;
  286. }
  287. }
  288. }
  289. .footer-btn-warp{
  290. display: flex;
  291. padding: 20rpx;
  292. button{
  293. width: 48%;
  294. color: #fff;
  295. }
  296. }
  297. .search-box{
  298. .input-warp{
  299. padding: 40rpx;
  300. }
  301. .search-input {
  302. border:1rpx solid #dcdcdc;
  303. padding: 20rpx;
  304. }
  305. background-color: #fff;
  306. text-align: center;
  307. ul{
  308. li{
  309. padding: 25rpx 30rpx;
  310. border-bottom: 1rpx solid #dcdcdc;
  311. list-style: none;
  312. }
  313. }
  314. .no-data{
  315. padding: 100rpx;
  316. }
  317. }
  318. .addModal-content{
  319. background-color: #fff;
  320. border-top-left-radius:20rpx;
  321. border-top-right-radius:20rpx;
  322. padding-top:40rpx;
  323. .footer-btn-warp{
  324. display: flex;
  325. padding: 20rpx;
  326. button{
  327. width: 48%;
  328. color: #fff;
  329. }
  330. }
  331. .ul{
  332. .li{
  333. display: flex;
  334. justify-content: space-between;
  335. height: 80rpx;
  336. line-height: 80rpx;
  337. margin-top: 20rpx;
  338. .input{
  339. width: 70%;
  340. input{
  341. border:1rpx solid #dcdcdc;
  342. height: 78rpx;
  343. line-height: 78rpx;
  344. padding: 0 20rpx;
  345. }
  346. }
  347. }
  348. .delete-icon{
  349. height: 80rpx;
  350. width: 80rpx;
  351. text-align: center;
  352. line-height: 80rpx;
  353. font-size: 40rpx;
  354. color: #fff;
  355. background-color: #ccc;
  356. }
  357. }
  358. .select-warp{
  359. height: 80rpx;
  360. line-height: 80rpx;
  361. padding: 0 20rpx ;
  362. box-sizing: border-box;
  363. display: flex;
  364. justify-content: space-between;
  365. .show-text{
  366. width: 60%;
  367. border:1rpx solid #dcdcdc;
  368. padding: 0 20rpx;
  369. overflow: hidden;
  370. height: 80rpx;
  371. }
  372. .add-icon{
  373. height: 80rpx;
  374. width: 80rpx;
  375. text-align: center;
  376. line-height: 80rpx;
  377. font-size: 40rpx;
  378. color: #fff;
  379. background-color: #ccc;
  380. }
  381. }
  382. }
  383. .ul{
  384. .li{
  385. background-color: #fff;
  386. border-radius: 5rpx;
  387. margin: 20rpx 20rpx 0;
  388. .label{
  389. height: 100rpx;
  390. line-height: 100rpx;
  391. font-weight: 30rpx;
  392. border-bottom: 1rpx solid #ccc;
  393. padding: 0 20rpx;
  394. overflow: hidden;
  395. }
  396. .lists{
  397. border-bottom: 1rpx solid #ccc;
  398. .list-box{
  399. height: 100rpx;
  400. line-height: 100rpx;
  401. display: flex;
  402. justify-content: space-between;
  403. padding: 0 20rpx;
  404. }
  405. }
  406. .list-btn-warp{
  407. display: flex;
  408. padding: 20rpx;
  409. button{
  410. width: 48%;
  411. }
  412. }
  413. }
  414. }
  415. .add-header{
  416. height: 100rpx;
  417. line-height: 100rpx;
  418. font-size: 30rpx;
  419. font-weight: bold;
  420. overflow: hidden;
  421. padding: 20rpx;
  422. button{
  423. width: 200rpx;
  424. color: #fff;
  425. background-color: red;
  426. float: right;
  427. margin: 14rpx 0;
  428. }
  429. }
  430. </style>