checkSubmit.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. <template>
  2. <view class="checkSubmit">
  3. <view class="dtl">
  4. <view class="">
  5. 物料编码:{{option.materialCode}}
  6. </view>
  7. <view class="">
  8. 二维码编码:{{option.supplierName}}
  9. </view>
  10. <view class="">
  11. 物料名称:{{option.materialName}}
  12. </view>
  13. </view>
  14. <view class="form-box" style="margin:0 30rpx">
  15. <uni-forms ref="baseForm" :modelValue="formData" label-position="top">
  16. <view class="commons-title">
  17. 抽检米数
  18. </view>
  19. <uni-forms-item label="抽检米数">
  20. <uni-easyinput v-model="formData.checkQty" type="number" placeholder="请输入抽检米数" />
  21. </uni-forms-item>
  22. <view class="commons-title">
  23. 质检结果
  24. </view>
  25. <uni-forms-item label="短少" required>
  26. <uni-number-box v-model="formData.lakeNum" :min="0" />
  27. </uni-forms-item>
  28. <uni-forms-item label="抽纱" required>
  29. <uni-number-box v-model="formData.drawnworkNum" :min="0" />
  30. </uni-forms-item>
  31. <uni-forms-item label="褶皱" required>
  32. <uni-number-box v-model="formData.foldNum" :min="0" />
  33. </uni-forms-item>
  34. <uni-forms-item label="脏污" required>
  35. <uni-number-box v-model="formData.dirtNum" :min="0" />
  36. </uni-forms-item>
  37. <uni-forms-item label="破洞" required>
  38. <uni-number-box v-model="formData.potholeNum" :min="0" />
  39. </uni-forms-item>
  40. <uni-forms-item label="缩水" required>
  41. <uni-number-box v-model="formData.shrinkPercent" :min="0" />
  42. </uni-forms-item>
  43. <uni-forms-item label="上传图片" required>
  44. <view class="imglist">
  45. <view class="item" v-for="(item,index) in imgs" :key="item" v-if="!item.loadingType">
  46. <image :src="item" alt=""></image>
  47. <view class='delete' bindtap='deleteImg' @click="imgDelete(index)">
  48. x
  49. </view>
  50. </view>
  51. <view class="item" v-else>
  52. <image src="../../static/loding.gif"></image>
  53. </view>
  54. <view class="last-item" @click="bindUpload">
  55. <text class="sign">+</text>
  56. </view>
  57. </view>
  58. </uni-forms-item>
  59. </uni-forms>
  60. </view>
  61. <view class="submit-box">
  62. <button @click="checkSubmit(2)" style="background: #CE3C39;color:#fff;margin-bottom: 30rpx;">不合格</button>
  63. <button @click="checkSubmit(1)" style="background:#0066CC; color:#fff;margin-bottom: 30rpx;">质检合格</button>
  64. </view>
  65. </view>
  66. </template>
  67. <script>
  68. import {
  69. getInfo
  70. } from "@/util/api.js";
  71. import Vue from 'vue'
  72. // import htzImageUpload from '@/components/htz-image-upload/htz-image-upload.vue'
  73. import {
  74. dateFormat,
  75. getTime
  76. } from '../../util/uitl.js'
  77. export default {
  78. components: {
  79. // htzImageUpload,
  80. },
  81. data() {
  82. return {
  83. formData: {
  84. quantitycheckId: null,
  85. materialId: null,
  86. quantity: null,
  87. qrCode: null,
  88. lakeNum: 0,
  89. drawnworkNum: 0,
  90. foldNum: 0,
  91. dirtNum: 0,
  92. potholeNum: 0,
  93. shrinkPercent: 0,
  94. checkJudgment: null,
  95. checkQty: null,
  96. imageUrl: null,
  97. id: null,
  98. imageUrlAry: [],
  99. hander: {
  100. 'Authorization': '12312312312',
  101. },
  102. },
  103. imgs:[],
  104. option: null,
  105. imgUrl: null,
  106. checkListData: [],
  107. optionCopy:null,
  108. }
  109. },
  110. onLoad(option) {
  111. const v = this
  112. v.userData = Vue.prototype.$userInfo
  113. v.option = JSON.parse(decodeURIComponent(option.data))
  114. v.optionCopy = JSON.parse(JSON.stringify(v.option))
  115. v.formData.quantitycheckId = v.option.id
  116. v.formData.materialId = v.option.materialCode
  117. v.formData.quantity = v.option.quantity
  118. v.formData.checkQty = v.option.quantity
  119. v.formData.qrCode = v.option.qrCode
  120. if(v.option.id2){
  121. v.formData = v.option
  122. v.formData.id = v.option.id2
  123. }
  124. uni.getStorage({
  125. key: "checkListData",
  126. success(_data) {
  127. console.log(_data)
  128. v.checkListData = []
  129. },
  130. fail() {
  131. }
  132. })
  133. console.log(v.formData)
  134. },
  135. methods: {
  136. imgDelete(_index){
  137. const v = this
  138. v.imgs.splice(_index,1)
  139. },
  140. bindUpload() {
  141. const v = this
  142. wx.chooseImage({
  143. count: 1,
  144. sizeType: ["original", "compressed"], // 可以指定是原图还是压缩图,默认二者都有
  145. sourceType: ["album", "camera"], // 可以指定来源是相册还是相机,默认二者都有
  146. success: function(res) {
  147. // 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片
  148. var tempFilePaths = res.tempFilePaths
  149. for (var i = 0; i < tempFilePaths.length; i++) {
  150. v.imgs.push({loadingType:true})
  151. wx.uploadFile({
  152. url: 'https://wmswx.adprintingplus.com/api/wx/common/uploadFile',
  153. filePath: tempFilePaths[i],
  154. name: "file",
  155. header: {
  156. "content-type": "multipart/form-data",
  157. 'Authorization': Vue.prototype.$token,
  158. },
  159. success: function(res) {
  160. console.log(res.data)
  161. res.data = JSON.parse(res.data)
  162. if (res.data.code == 200) {
  163. wx.showToast({
  164. title: "上传成功",
  165. icon: "none",
  166. duration: 1500
  167. })
  168. v.imgs.splice(-1)
  169. v.imgs.push(res.data.data)
  170. }
  171. },
  172. fail: function(err) {
  173. wx.showToast({
  174. title: "上传失败",
  175. icon: "none",
  176. duration: 2000
  177. })
  178. },
  179. complete: function(result) {
  180. console.log(result.errMsg)
  181. }
  182. })
  183. }
  184. }
  185. })
  186. },
  187. zidingyiSuccess() {
  188. },
  189. checkSubmit(_type) {
  190. const v = this
  191. v.formData.checkJudgment = _type
  192. v.$post('/wx/check/temp',v.formData).then(res=>{
  193. if(res.code == 200){
  194. uni.showToast({
  195. title: '提交成功,跳转中!'
  196. })
  197. setTimeout(() => {
  198. wx.reLaunch({
  199. url: '/pages/check/checkDtl?data=' + encodeURIComponent(JSON.stringify(v.optionCopy))
  200. })
  201. }, 2000)
  202. }
  203. })
  204. },
  205. select(e) {
  206. console.log(e)
  207. const v = this
  208. v.$post('/wx/common/uploadFile', {
  209. file: e.tempFilePaths[0]
  210. }).then(res => {
  211. })
  212. },
  213. },
  214. }
  215. </script>
  216. <style lang="less">
  217. .checkSubmit {
  218. .submit-box {
  219. padding: 0 30rpx;
  220. }
  221. .dtl {
  222. padding: 30rpx;
  223. border-bottom: 1rpx solid #dcdcdc;
  224. font-size: 26rpx;
  225. line-height: 40rpx;
  226. }
  227. .addQrcode-list {
  228. height: 80rpx;
  229. display: flex;
  230. justify-content: space-between;
  231. padding: 15rpx;
  232. border-bottom: 1rpx solid #dcdcdc;
  233. font-size: 24rpx;
  234. .fl {
  235. display: flex;
  236. .code {
  237. margin-right: 20rpx;
  238. }
  239. }
  240. .fr {
  241. line-height: 80rpx;
  242. }
  243. }
  244. }
  245. .popup-input-warp {
  246. padding: 30rpx 40rpx;
  247. }
  248. .txt {
  249. margin-bottom: 20rpx;
  250. }
  251. .imglist {
  252. display: flex;
  253. flex-wrap: wrap;
  254. }
  255. .imglist .item {
  256. width: 150rpx;
  257. height: 150rpx;
  258. margin-right: 22rpx;
  259. margin-bottom: 10rpx;
  260. position: relative;
  261. }
  262. .imglist .last-item {
  263. width: 150rpx;
  264. height: 150rpx;
  265. text-align: center;
  266. line-height: 146rpx;
  267. border: 2rpx dashed #8B97A9;
  268. box-sizing: border-box;
  269. }
  270. .imglist .item image {
  271. width: 100%;
  272. height: 100%;
  273. }
  274. .imglist .item .delete {
  275. width: 30rpx;
  276. height: 30rpx;
  277. position: absolute;
  278. top: -25rpx;
  279. right: -12rpx;
  280. font-size: 40rpx;
  281. font-weight: bold;
  282. }
  283. </style>