transferComposite.vue 11 KB

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