checkSubmit.vue 6.1 KB

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