return-warehouse.vue 9.4 KB

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