return-warehouse.vue 9.0 KB

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