fabric-correction.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  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.open(`/pages/index/index`)">
  9. <span style="color: #FFFFFF;">返回</span>
  10. </view>
  11. </uni-nav-bar>
  12. <view class="container">
  13. <view style="display: flex; padding: 4px; height: 50px">
  14. <view style="width: 90px">喷印日期:</view>
  15. <view @click="showDate = true">{{ SprayPrintDate ? SprayPrintDate : '点此选择时间' }}
  16. </view>
  17. <u-picker mode="time" end-year="2030" v-model="showDate" :params="params" @confirm="confirmEnd">
  18. </u-picker>
  19. </view>
  20. <view style="display: flex; padding: 4px; height: 50px">
  21. <view style="width: 90px">喷印人员:</view>
  22. <view @click="showSelectOne = true">
  23. {{ printingWorkers ? printingWorkers : '点此选择状态' }}
  24. </view>
  25. <u-select v-model="showSelectOne" :default-value="[0]" :list="selectOneList" @cancel="showSelect=false"
  26. @confirm="selectWorkers"></u-select>
  27. </view>
  28. <view style="display: flex; padding: 4px; height: 50px">
  29. <view style="width: 90px">面料:</view>
  30. <view @click="showSelectTwo = true">
  31. {{ fabric ? fabric : '点此选择面料' }}
  32. </view>
  33. <u-select v-model="showSelectTwo" :default-value="[0]" :list="selectTwoList" @cancel="showSelect=false"
  34. @confirm="selectFabric"></u-select>
  35. </view>
  36. <view style="display: flex; padding: 4px; height: 50px">
  37. <view style="width: 90px">供应商:</view>
  38. <view @click="showSelectThree = true">
  39. {{ supplier ? supplier : '点此选择供应商' }}
  40. </view>
  41. <u-select v-model="showSelectThree" :default-value="[0]" :list="selectThreeList"
  42. @cancel="showSelect=false" @confirm="selectSupplier"></u-select>
  43. </view>
  44. <view style="display: flex; padding: 4px; height: 50px">
  45. <view style="width: 90px">修正面积:</view>
  46. <u-input v-model="fixedArea" :type="number" :border="true" />
  47. </view>
  48. <view style="display: flex; padding: 4px; height: 50px">
  49. <view style="width: 90px">修正原因</view>
  50. </view>
  51. <view class="wenti-list">
  52. <view class="list-box" :class="i.active ? 'active' : ''" v-for="(i,index) in whyList" :key="i.type"
  53. @click="wentiSelect(i,index)">
  54. {{i.name}}
  55. </view>
  56. </view>
  57. <view>
  58. <u-input v-model="remark" :type="textarea" placeholder="备注信息" :border="true" :height="100"
  59. :auto-height="true" />
  60. </view>
  61. <my-fixed-button :customClick="true" @click="cfm" text="提交"></my-fixed-button>
  62. </view>
  63. </div>
  64. </template>
  65. <script>
  66. export default {
  67. name: "xx",
  68. data() {
  69. return {
  70. SprayPrintDate: '',
  71. params: {
  72. year: true,
  73. month: true,
  74. day: true
  75. },
  76. showDate: false,
  77. showSelectOne: false,
  78. showSelectTwo: false,
  79. showSelectThree: false,
  80. printingWorkers: '',
  81. printingWorkersId: '',
  82. fabric: '',
  83. fabricId: '',
  84. supplier: '',
  85. supplierId: '',
  86. fixedArea: null,
  87. selectOneList: [],
  88. selectTwoList: [],
  89. selectThreeList: [],
  90. whyList: [{
  91. type: 1,
  92. name: "短少",
  93. active: false
  94. },
  95. {
  96. type: 2,
  97. name: "抽纱",
  98. active: false
  99. },
  100. {
  101. type: 3,
  102. name: "褶皱",
  103. active: false
  104. },
  105. {
  106. type: 4,
  107. name: "脏污",
  108. active: false
  109. },
  110. {
  111. type: 5,
  112. name: "破洞",
  113. active: false
  114. },
  115. {
  116. type: 6,
  117. name: "缩水",
  118. active: false
  119. }
  120. ],
  121. number: 'number',
  122. textarea: 'textarea',
  123. remark: '',
  124. }
  125. },
  126. created() {
  127. this.selectList()
  128. },
  129. methods: {
  130. toDtl(_id) {
  131. const v = this
  132. uni.removeStorage({
  133. key: 'reviewDtl',
  134. success: function(res) {
  135. v.$utils.open(`/pages/warehouse/reviewDtl?id=${_id}`)
  136. },
  137. fail() {
  138. v.$utils.open(`/pages/warehouse/reviewDtl?id=${_id}`)
  139. }
  140. });
  141. },
  142. confirmEnd(e) {
  143. var endDate = ''
  144. if (this.params.year) endDate += e.year
  145. if (this.params.month) endDate += '-' + e.month
  146. if (this.params.day) endDate += '-' + e.day
  147. this.SprayPrintDate = endDate
  148. },
  149. selectList() {
  150. uni.request({
  151. url: 'http://120.79.80.64:8050' + '/cloudApi/supplier/selectList',
  152. method: 'POST',
  153. header: {
  154. 'Content-Type': 'application/json',
  155. },
  156. data: {
  157. pageNum: 1,
  158. pageSize: 9999,
  159. },
  160. success: res => {
  161. this.selectThreeList = res.data.data.map(item => {
  162. return {
  163. ...item,
  164. value: item.id,
  165. label: item.name,
  166. }
  167. })
  168. },
  169. });
  170. uni.request({
  171. url: 'http://120.79.80.64:8050' + '/cloudApi/material/selectList',
  172. method: 'POST',
  173. header: {
  174. 'Content-Type': 'application/json',
  175. },
  176. data: {
  177. pageNum: 1,
  178. pageSize: 9999,
  179. },
  180. success: res => {
  181. this.selectTwoList = res.data.data.map(item => {
  182. return {
  183. ...item,
  184. value: item.id,
  185. label: item.name,
  186. }
  187. })
  188. },
  189. });
  190. this.$http.GetUserPageList({
  191. pageIndex: 1,
  192. pageSize: 9999,
  193. takeUser: true
  194. }).then(res => {
  195. if (res.code == 0) {
  196. let list = res.result.list.map(item => {
  197. return {
  198. label: item.realName,
  199. value: item.id
  200. }
  201. })
  202. this.selectOneList = list
  203. }
  204. })
  205. },
  206. selectWorkers(val) {
  207. if (val && val.length > 0) {
  208. this.printingWorkersId = val[0].value
  209. this.printingWorkers = val[0].label
  210. }
  211. },
  212. selectFabric(val) {
  213. if (val && val.length > 0) {
  214. this.fabricId = val[0].value
  215. this.fabric = val[0].label
  216. }
  217. },
  218. selectSupplier(val) {
  219. if (val && val.length > 0) {
  220. this.supplierId = val[0].value
  221. this.supplier = val[0].label
  222. }
  223. },
  224. wentiSelect(item, index) {
  225. this.whyList[index].active = !this.whyList[index].active
  226. },
  227. cfm() {
  228. if (!this.SprayPrintDate) {
  229. this.$msg.showToast('请选择喷印日期')
  230. return
  231. }
  232. if (!this.printingWorkers) {
  233. this.$msg.showToast('请选择喷印人员')
  234. return
  235. }
  236. if (!this.fabric) {
  237. this.$msg.showToast('请选择面料')
  238. return
  239. }
  240. if (!this.supplier) {
  241. this.$msg.showToast('请选择供应商')
  242. return
  243. }
  244. if (!this.fixedArea) {
  245. this.$msg.showToast('请输入修正面积')
  246. return
  247. }
  248. let data = this.whyList.filter(item => item.active)
  249. if (!(data && data.length > 0)) {
  250. this.$msg.showToast('请输入修正原因')
  251. return
  252. }
  253. uni.request({
  254. url: 'http://120.79.80.64:8050' + '/cloudApi/stockBack/correctSave',
  255. method: 'POST',
  256. header: {
  257. 'Content-Type': 'application/json',
  258. },
  259. data: {
  260. correctTime: this.SprayPrintDate + ' 00:00:00',
  261. userId: this.printingWorkersId,
  262. materialId: this.fabricId,
  263. supplierId: this.supplierId,
  264. correctArea: this.fixedArea,
  265. correctReason: data.map(item => {
  266. return item.type
  267. }).join(","),
  268. remarks: this.remark,
  269. },
  270. success: res => {
  271. console.log(res)
  272. if (res.data.code === 200) {
  273. this.$msg.showToast(res.data.msg || '操作成功!')
  274. this.timer = setTimeout(() => {
  275. this.$utils.back()
  276. }, 1000)
  277. } else {
  278. this.$msg.showToast(res.data.msg)
  279. }
  280. },
  281. });
  282. }
  283. },
  284. }
  285. </script>
  286. <style scoped lang="less">
  287. .container {
  288. padding: 20rpx;
  289. height: calc(100vh - var(--status-bar-height) - 44px);
  290. overflow: auto;
  291. padding-bottom: 100rpx;
  292. }
  293. .wenti-list {
  294. overflow: hidden;
  295. .list-box {
  296. width: 28%;
  297. margin: 0 2% 20rpx;
  298. float: left;
  299. height: 60rpx;
  300. line-height: 60rpx;
  301. text-align: center;
  302. border: 1px solid #DDDCDC;
  303. border-radius: 10rpx;
  304. }
  305. .list-box.active {
  306. border: 1px solid #1A3AF0;
  307. background-color: #1A3AF0;
  308. color: #fff;
  309. }
  310. }
  311. </style>