return-warehouse-2.vue 9.9 KB

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