return-warehouse-2.vue 10 KB

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