fabric-correction2.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432
  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="correctDate" @change="bindDateChange" style="width:100%">
  14. <view class="uni-input">{{correctDate || '请选择时间'}}</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="correctUser" :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="correctArea" 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' : 'active'" v-for="(i,index) in wentiList" :key="i.type"
  81. >
  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. correctArea:null,
  133. showSelectOne:null,
  134. correctDate: null,
  135. wentiList: [{
  136. type: 1,
  137. name: "布头布尾",
  138. active: false
  139. },
  140. ],
  141. value: 0,
  142. range: [],
  143. range2: [],
  144. formData: {
  145. supplierId: null,
  146. materialId: null,
  147. problemType: '',
  148. remark: null,
  149. attr: [],
  150. supplierName: null,
  151. },
  152. imgs: [],
  153. option: null,
  154. imgUrl: null,
  155. checkListData: [],
  156. optionCopy: null,
  157. materialIndex: null,
  158. req: {
  159. pageNum: 1,
  160. pageSize: 10,
  161. search: null,
  162. materialCode: null,
  163. },
  164. selectModalType: 'gongyingshang',
  165. selectOneList:[],
  166. correctUser:null,
  167. printingWorkersName:null,
  168. }
  169. },
  170. onLoad(option) {
  171. const v = this
  172. v.selectList()
  173. v.getBackUser()
  174. },
  175. methods: {
  176. printingWorkersSelect(e){
  177. console.log(e)
  178. this.correctUser = this.selectOneList[e.detail.value].userId
  179. this.printingWorkersName = this.selectOneList[e.detail.value].realName
  180. },
  181. getBackUser(){
  182. this.$post('/stockBack/getBackUser',{}).then(res=>{
  183. this.selectOneList = res.data.A007.concat(res.data.A008,res.data.A012)
  184. console.log(this.selectOneList,123123212)
  185. })
  186. },
  187. bindDateChange: function(e) {
  188. console.log(e)
  189. this.correctDate = e.detail.value
  190. },
  191. selectMaterialList(i) {
  192. const v = this
  193. if (v.selectModalType == 'gongyingshang') {
  194. v.formData.supplierId = i.id
  195. v.formData.supplierName = i.name
  196. } else {
  197. v.formData.materialId = i.id
  198. v.formData.materialName = i.name
  199. v.req.materialCode = i.id
  200. }
  201. console.log(i)
  202. this.$refs.popup2.close()
  203. this.$refs.popup.close()
  204. },
  205. openSelectQd(modalType) {
  206. const v = this
  207. if (modalType == 'gongyingshang' && v.formData.materialId == null) {
  208. wx.showToast({
  209. title: "请先选择面料!",
  210. icon: "none",
  211. duration: 2000
  212. })
  213. return
  214. }
  215. v.selectModalType = modalType
  216. v.req.search = null
  217. v.selectList()
  218. if (modalType == 'gongyingshang') {
  219. this.$refs.popup2.open('top')
  220. } else {
  221. this.$refs.popup.open('top')
  222. }
  223. },
  224. bindPickerChange(e) {
  225. console.log(e)
  226. const v = this
  227. v.formData.supplierName = v.range[e.detail.value].bankAccoutName
  228. v.formData.supplierId = v.range[e.detail.value].id
  229. },
  230. selectList() {
  231. const v = this
  232. if (v.selectModalType == 'gongyingshang') {
  233. v.$post('/supplier/selectList', v.req).then(res => {
  234. console.log(res)
  235. this.range2 = res.data
  236. })
  237. } else {
  238. v.$post('/material/selectList', v.req).then(res => {
  239. console.log(res)
  240. this.range = res.data
  241. })
  242. }
  243. },
  244. wentiSelect(item, index) {
  245. this.wentiList[index].active = !this.wentiList[index].active
  246. },
  247. checkSubmit(_type) {
  248. const v = this
  249. if (_type == 2) {
  250. wx.reLaunch({
  251. url: '/pages/home'
  252. })
  253. }
  254. if (!this.correctDate) {
  255. uni.showToast({
  256. title: '请选择喷印日期!',
  257. icon:"none"
  258. })
  259. return
  260. }
  261. if (!this.correctUser) {
  262. uni.showToast({
  263. title: '请选择喷印人员!',
  264. icon:"none"
  265. })
  266. return
  267. }
  268. if (!v.formData.materialId) {
  269. uni.showToast({
  270. title: '请选择面料!',
  271. icon:"none"
  272. })
  273. return
  274. }
  275. if (!this.correctArea) {
  276. uni.showToast({
  277. title: '请输入修正面积!',
  278. icon:"none"
  279. })
  280. return
  281. }
  282. v.formData.problemType = v.formData.problemType.slice(0, v.formData.problemType.length - 1)
  283. uni.showLoading({title: '加载中',mask:true});
  284. v.$post('/stockCorrect/add', {
  285. correctDate: this.correctDate + ' 00:00:00',
  286. correctUser: this.correctUser,
  287. materialId: v.formData.materialId,
  288. supplierId: v.formData.supplierId,
  289. correctArea: this.correctArea,
  290. correctReason: v.formData.problemType,
  291. remark: this.formData.remark,
  292. }).then(res => {
  293. uni.hideLoading()
  294. if (res.code == 200) {
  295. uni.showToast({
  296. title: '提交成功,跳转中!'
  297. })
  298. setTimeout(() => {
  299. wx.reLaunch({
  300. url: '/pages/home'
  301. })
  302. }, 1000)
  303. }
  304. })
  305. },
  306. select(e) {
  307. console.log(e)
  308. const v = this
  309. v.$post('/wx/common/uploadFile', {
  310. file: e.tempFilePaths[0]
  311. }).then(res => {
  312. })
  313. },
  314. },
  315. }
  316. </script>
  317. <style lang="less" scoped>
  318. .search-box {
  319. background-color: #fff;
  320. ul {
  321. li {
  322. padding: 25rpx 30rpx;
  323. border-bottom: 1rpx solid #dcdcdc;
  324. }
  325. }
  326. }
  327. .submit-btn-warp {
  328. display: flex;
  329. justify-content: space-between;
  330. button {
  331. width: 47%;
  332. }
  333. }
  334. .wenti-list {
  335. overflow: hidden;
  336. .list-box {
  337. width: 28%;
  338. margin: 0 2% 20rpx;
  339. float: left;
  340. height: 60rpx;
  341. line-height: 60rpx;
  342. text-align: center;
  343. border: 1px solid #DDDCDC;
  344. border-radius: 10rpx;
  345. }
  346. .list-box.active {
  347. border: 1px solid #1A3AF0;
  348. background-color: #1A3AF0;
  349. color: #fff;
  350. }
  351. }
  352. .submit-warp {
  353. display: flex;
  354. .form-text {
  355. width: 20%;
  356. text-align: center;
  357. }
  358. .form-box {
  359. width: 80%;
  360. padding: 0 20rpx;
  361. }
  362. }
  363. .imglist {
  364. display: flex;
  365. flex-wrap: wrap;
  366. }
  367. .imglist .item {
  368. width: 150rpx;
  369. height: 150rpx;
  370. margin-right: 22rpx;
  371. margin-bottom: 10rpx;
  372. position: relative;
  373. }
  374. .imglist .last-item {
  375. width: 150rpx;
  376. height: 150rpx;
  377. text-align: center;
  378. line-height: 146rpx;
  379. border: 2rpx dashed #8B97A9;
  380. box-sizing: border-box;
  381. }
  382. .imglist .item image {
  383. width: 100%;
  384. height: 100%;
  385. }
  386. .imglist .item .delete {
  387. width: 30rpx;
  388. height: 30rpx;
  389. position: absolute;
  390. top: -25rpx;
  391. right: -12rpx;
  392. font-size: 40rpx;
  393. font-weight: bold;
  394. }
  395. </style>