fabric-correction.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471
  1. <template>
  2. <view class="checkSubmit">
  3. <view class="commons-title">
  4. 面料信息
  5. </view>
  6. <view class="submit-warp">
  7. <view class="form-text">
  8. 日期
  9. </view>
  10. <view class="form-box">
  11. <view>
  12. <view class="" style="text-align: left;display: flex;justify-content: space-between;">
  13. <picker mode="date" :value="SprayPrintDate" @change="bindDateChange" style="width:100%">
  14. <view class="uni-input">{{SprayPrintDate || '请选择时间'}}</view>
  15. </picker>
  16. <uni-icons type="forward" size="20"></uni-icons>
  17. </view>
  18. </view>
  19. </view>
  20. </view>
  21. <view class="submit-warp" style="margin-top:40rpx">
  22. <view class="form-text">
  23. 喷印人员
  24. </view>
  25. <view class="form-box">
  26. <view>
  27. <view class="" style="text-align: left;display: flex;justify-content: space-between;">
  28. <picker :value="printingWorkers" :range="selectOneList" @change="printingWorkersSelect" range-key="realName" style="width:100%">
  29. <view class="uni-input">{{printingWorkersName || '请选择人员'}}</view>
  30. </picker>
  31. <uni-icons type="forward" size="20"></uni-icons>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. <view class="submit-warp" style="margin-top:40rpx">
  37. <view class="form-text">
  38. 面料
  39. </view>
  40. <view class="form-box">
  41. <view>
  42. <view class="" style="text-align: left;display: flex;justify-content: space-between;">
  43. <view class="" style="color:#999;width:90%" @click="openSelectQd('mianliao')">
  44. {{formData.materialName || '请选择面料 '}}
  45. </view>
  46. <uni-icons @click="openSelectQd(index)" type="forward" size="20"></uni-icons>
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. <view class="submit-warp" style="margin-top:40rpx">
  52. <view class="form-text">
  53. 供应商
  54. </view>
  55. <view class="form-box">
  56. <view>
  57. <view class="" style="text-align: left;display: flex;justify-content: space-between;">
  58. <view class="" style="color:#999;width:90%" @click="openSelectQd('gongyingshang')">
  59. {{formData.supplierName || '请选择供应商 '}}
  60. </view>
  61. <uni-icons @click="openSelectQd(index)" type="forward" size="20"></uni-icons>
  62. </view>
  63. </view>
  64. </view>
  65. </view>
  66. <view class="submit-warp" style="margin-top:40rpx">
  67. <view class="form-text">
  68. 修正面积
  69. </view>
  70. <view class="form-box">
  71. <view style="border:1rpx solid #dcdcdc;">
  72. <input v-model="fixedArea" type="number">
  73. </view>
  74. </view>
  75. </view>
  76. <view class="commons-title">
  77. 修正原因
  78. </view>
  79. <view class="wenti-list">
  80. <view class="list-box" :class="i.active ? 'active' : ''" v-for="(i,index) in wentiList" :key="i.type"
  81. @click="wentiSelect(i,index)">
  82. {{i.name}}
  83. </view>
  84. </view>
  85. <view class="" style="margin: 0 20rpx 20rpx;border:1px solid #dcdcdc;">
  86. <textarea style="width:100%;padding:10rpx 20rpx" v-model="formData.remark" placeholder="备注信息" />
  87. </view>
  88. <view class="submit-btn-warp">
  89. <button @click="checkSubmit(2)" style="background:#EF0000;color:#fff;margin-bottom: 30rpx;">取消</button>
  90. <button @click="checkSubmit(1)" style="background:#1A3AF0; color:#fff;margin-bottom: 30rpx;">提交</button>
  91. </view>
  92. <uni-popup ref="popup2" type="top">
  93. <view class="search-box">
  94. <uni-search-bar @confirm="selectList" v-model="req.search" @cancel="reload">
  95. </uni-search-bar>
  96. <ul>
  97. <li @click="selectMaterialList(i)" v-for="i in range2" :key="i.id">
  98. {{i.name}}
  99. </li>
  100. </ul>
  101. </view>
  102. </uni-popup>
  103. <uni-popup ref="popup" type="top">
  104. <view class="search-box">
  105. <uni-search-bar @confirm="selectList" v-model="req.search" @cancel="reload">
  106. </uni-search-bar>
  107. <ul>
  108. <li @click="selectMaterialList(i)" v-for="i in range" :key="i.id">
  109. {{i.name}}
  110. </li>
  111. </ul>
  112. </view>
  113. </uni-popup>
  114. </view>
  115. </template>
  116. <script>
  117. import {
  118. getInfo
  119. } from "@/util/api.js";
  120. import Vue from 'vue'
  121. // import htzImageUpload from '@/components/htz-image-upload/htz-image-upload.vue'
  122. import {
  123. dateFormat,
  124. getTime
  125. } from '../../util/uitl.js'
  126. export default {
  127. components: {
  128. // htzImageUpload,
  129. },
  130. data() {
  131. return {
  132. fixedArea:null,
  133. showSelectOne:null,
  134. SprayPrintDate: null,
  135. wentiList: [{
  136. type: 1,
  137. name: "短少",
  138. active: false
  139. },
  140. {
  141. type: 2,
  142. name: "抽纱",
  143. active: false
  144. },
  145. {
  146. type: 3,
  147. name: "褶皱",
  148. active: false
  149. },
  150. {
  151. type: 4,
  152. name: "脏污",
  153. active: false
  154. },
  155. {
  156. type: 5,
  157. name: "破洞",
  158. active: false
  159. },
  160. {
  161. type: 6,
  162. name: "缩水",
  163. active: false
  164. }
  165. ],
  166. value: 0,
  167. range: [],
  168. range2: [],
  169. formData: {
  170. supplierId: null,
  171. materialId: null,
  172. problemType: '',
  173. remark: null,
  174. attr: [],
  175. supplierName: null,
  176. },
  177. imgs: [],
  178. option: null,
  179. imgUrl: null,
  180. checkListData: [],
  181. optionCopy: null,
  182. materialIndex: null,
  183. req: {
  184. pageNum: 1,
  185. pageSize: 10,
  186. search: null,
  187. materialCode: null,
  188. },
  189. selectModalType: 'gongyingshang',
  190. selectOneList:[],
  191. printingWorkers:null,
  192. printingWorkersName:null,
  193. }
  194. },
  195. onLoad(option) {
  196. const v = this
  197. v.selectList()
  198. v.getBackUser()
  199. },
  200. methods: {
  201. printingWorkersSelect(e){
  202. console.log(e)
  203. this.printingWorkers = this.selectOneList[e.detail.value].userId
  204. this.printingWorkersName = this.selectOneList[e.detail.value].realName
  205. },
  206. getBackUser(){
  207. this.$post('/stockBack/getBackUser',{}).then(res=>{
  208. this.selectOneList = res.data.A007.concat(res.data.A008,res.data.A012)
  209. console.log(this.selectOneList,123123212)
  210. })
  211. },
  212. bindDateChange: function(e) {
  213. console.log(e)
  214. this.SprayPrintDate = e.detail.value
  215. },
  216. selectMaterialList(i) {
  217. const v = this
  218. if (v.selectModalType == 'gongyingshang') {
  219. v.formData.supplierId = i.id
  220. v.formData.supplierName = i.name
  221. } else {
  222. v.formData.materialId = i.id
  223. v.formData.materialName = i.name
  224. v.req.materialCode = i.id
  225. }
  226. console.log(i)
  227. this.$refs.popup2.close()
  228. this.$refs.popup.close()
  229. },
  230. openSelectQd(modalType) {
  231. const v = this
  232. if (modalType == 'gongyingshang' && v.formData.materialId == null) {
  233. wx.showToast({
  234. title: "请先选择面料!",
  235. icon: "none",
  236. duration: 2000
  237. })
  238. return
  239. }
  240. v.selectModalType = modalType
  241. v.req.search = null
  242. v.selectList()
  243. if (modalType == 'gongyingshang') {
  244. this.$refs.popup2.open('top')
  245. } else {
  246. this.$refs.popup.open('top')
  247. }
  248. },
  249. bindPickerChange(e) {
  250. console.log(e)
  251. const v = this
  252. v.formData.supplierName = v.range[e.detail.value].bankAccoutName
  253. v.formData.supplierId = v.range[e.detail.value].id
  254. },
  255. selectList() {
  256. const v = this
  257. if (v.selectModalType == 'gongyingshang') {
  258. v.$post('/supplier/selectList', v.req).then(res => {
  259. console.log(res)
  260. this.range2 = res.data
  261. })
  262. } else {
  263. v.$post('/material/selectList', v.req).then(res => {
  264. console.log(res)
  265. this.range = res.data
  266. })
  267. }
  268. },
  269. wentiSelect(item, index) {
  270. this.wentiList[index].active = !this.wentiList[index].active
  271. },
  272. checkSubmit(_type) {
  273. const v = this
  274. if (_type == 2) {
  275. wx.reLaunch({
  276. url: '/pages/home'
  277. })
  278. }
  279. if (!this.SprayPrintDate) {
  280. uni.showToast({
  281. title: '请选择喷印日期!',
  282. icon:"none"
  283. })
  284. return
  285. }
  286. if (!this.printingWorkers) {
  287. uni.showToast({
  288. title: '请选择喷印人员!',
  289. icon:"none"
  290. })
  291. return
  292. }
  293. if (!v.formData.materialId) {
  294. uni.showToast({
  295. title: '请选择面料!',
  296. icon:"none"
  297. })
  298. return
  299. }
  300. if (!v.formData.supplierId) {
  301. uni.showToast({
  302. title: '请选择供应商!',
  303. icon:"none"
  304. })
  305. return
  306. }
  307. if (!this.fixedArea) {
  308. uni.showToast({
  309. title: '请输入修正面积!',
  310. icon:"none"
  311. })
  312. return
  313. }
  314. for (var i = 0; i < v.wentiList.length; i++) {
  315. if (v.wentiList[i].active) {
  316. v.formData.problemType = v.formData.problemType + v.wentiList[i].type + ','
  317. }
  318. }
  319. if (v.formData.problemType == '') {
  320. uni.showToast({
  321. title: '请选择问题类型!'
  322. })
  323. return
  324. }
  325. v.formData.problemType = v.formData.problemType.slice(0, v.formData.problemType.length - 1)
  326. uni.showLoading({title: '加载中',mask:true});
  327. v.$post('/stockBack/correctSave', {
  328. correctTime: this.SprayPrintDate + ' 00:00:00',
  329. userId: this.printingWorkers,
  330. materialId: v.formData.materialId,
  331. supplierId: v.formData.supplierId,
  332. correctArea: this.fixedArea,
  333. correctReason: v.formData.problemType,
  334. remarks: this.formData.remark,
  335. }).then(res => {
  336. uni.hideLoading()
  337. if (res.code == 200) {
  338. uni.showToast({
  339. title: '提交成功,跳转中!'
  340. })
  341. setTimeout(() => {
  342. wx.reLaunch({
  343. url: '/pages/home'
  344. })
  345. }, 1000)
  346. }
  347. })
  348. },
  349. select(e) {
  350. console.log(e)
  351. const v = this
  352. v.$post('/wx/common/uploadFile', {
  353. file: e.tempFilePaths[0]
  354. }).then(res => {
  355. })
  356. },
  357. },
  358. }
  359. </script>
  360. <style lang="less" scoped>
  361. .search-box {
  362. background-color: #fff;
  363. ul {
  364. li {
  365. padding: 25rpx 30rpx;
  366. border-bottom: 1rpx solid #dcdcdc;
  367. }
  368. }
  369. }
  370. .submit-btn-warp {
  371. display: flex;
  372. justify-content: space-between;
  373. button {
  374. width: 47%;
  375. }
  376. }
  377. .wenti-list {
  378. overflow: hidden;
  379. .list-box {
  380. width: 28%;
  381. margin: 0 2% 20rpx;
  382. float: left;
  383. height: 60rpx;
  384. line-height: 60rpx;
  385. text-align: center;
  386. border: 1px solid #DDDCDC;
  387. border-radius: 10rpx;
  388. }
  389. .list-box.active {
  390. border: 1px solid #1A3AF0;
  391. background-color: #1A3AF0;
  392. color: #fff;
  393. }
  394. }
  395. .submit-warp {
  396. display: flex;
  397. .form-text {
  398. width: 20%;
  399. text-align: center;
  400. }
  401. .form-box {
  402. width: 80%;
  403. padding: 0 20rpx;
  404. }
  405. }
  406. .imglist {
  407. display: flex;
  408. flex-wrap: wrap;
  409. }
  410. .imglist .item {
  411. width: 150rpx;
  412. height: 150rpx;
  413. margin-right: 22rpx;
  414. margin-bottom: 10rpx;
  415. position: relative;
  416. }
  417. .imglist .last-item {
  418. width: 150rpx;
  419. height: 150rpx;
  420. text-align: center;
  421. line-height: 146rpx;
  422. border: 2rpx dashed #8B97A9;
  423. box-sizing: border-box;
  424. }
  425. .imglist .item image {
  426. width: 100%;
  427. height: 100%;
  428. }
  429. .imglist .item .delete {
  430. width: 30rpx;
  431. height: 30rpx;
  432. position: absolute;
  433. top: -25rpx;
  434. right: -12rpx;
  435. font-size: 40rpx;
  436. font-weight: bold;
  437. }
  438. </style>