manualCheckBatch.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380
  1. <template>
  2. <!-- 批量盘 -->
  3. <view class="">
  4. <view class="top-title"> 请确认当前物资状态 </view>
  5. <view class="order-list">
  6. <view class="s1">
  7. <view class="b1">
  8. {{ infoData.assetName }}({{ infoData.assetCode }})
  9. </view>
  10. <!-- <view class="b2">
  11. {{infoData.warehouseName}}/{{infoData.reservoirName}}/{{infoData.goodsShelfName}}/{{infoData.goodsAllocationName}}
  12. </view> -->
  13. </view>
  14. <view class="wrap">
  15. <view class="item">
  16. <view class="label"> 牌号 </view>
  17. <view class="value">
  18. {{ infoData.assetBrand }}
  19. </view>
  20. </view>
  21. <view class="item">
  22. <view class="label"> 型号 </view>
  23. <view class="value">
  24. {{ infoData.assetSku }}
  25. </view>
  26. </view>
  27. </view>
  28. <view class="wrap">
  29. <!-- <view class="item">
  30. <view class="label">
  31. 批次
  32. </view>
  33. <view class="value">
  34. {{infoData.batchNum}}
  35. </view>
  36. </view> -->
  37. <view class="item">
  38. <view class="label"> 类型 </view>
  39. <view class="value">
  40. {{ infoData.assetTypeDictDESC }}
  41. </view>
  42. </view>
  43. </view>
  44. <view class="wrap">
  45. <view class="item">
  46. <view class="label"> 最小单元 </view>
  47. <view class="value">
  48. {{ infoData.measurementUnit }} {{ infoData.unit }}/{{
  49. infoData.minPackUnit
  50. }}
  51. </view>
  52. </view>
  53. <view class="item">
  54. <view class="label"> 库存 </view>
  55. <view class="value">
  56. {{ infoData.inventoryNum }}
  57. </view>
  58. </view>
  59. </view>
  60. </view>
  61. <view class="fixed-bottom">
  62. <view class="num-wrap">
  63. <view class="item">
  64. <view class="label"> 正常 </view>
  65. <view class="input-wrap">
  66. <u--input class="input" placeholder="" border="surround" v-model="infoData.normalNum"
  67. type="number"></u--input>
  68. </view>
  69. </view>
  70. <view class="item">
  71. <view class="label"> 丢失 </view>
  72. <view class="input-wrap">
  73. <u--input class="input" placeholder="" border="surround" v-model="infoData.loseNum"
  74. type="number"></u--input>
  75. </view>
  76. </view>
  77. <view class="item">
  78. <view class="label"> 破损 </view>
  79. <view class="input-wrap">
  80. <u--input class="input" placeholder="" border="surround" v-model="infoData.damageNum"
  81. type="number"></u--input>
  82. </view>
  83. </view>
  84. </view>
  85. <textarea class="textarea" v-model="form.describe" placeholder-style="color:#AAAAAA" placeholder="补充描述" />
  86. <view class="sc-wrap">
  87. <view class="title"> 拍照记录 </view>
  88. <uni-file-picker :limit="3" v-model="FileImgList" fileMediatype="image" mode="grid" @select="handlImageSelect"
  89. @delete="handlImagDeletee" />
  90. </view>
  91. <view class="btn-wrap">
  92. <button type="primary" class="qr-btn" @click="submit">确认状态</button>
  93. <button type="primary" class="qx-btn" @click="back">取消</button>
  94. </view>
  95. </view>
  96. </view>
  97. </template>
  98. <script>
  99. import {
  100. postJ
  101. } from '@/utils/api'
  102. export default {
  103. props: ['infoData', 'bizType'],
  104. data() {
  105. return {
  106. form: {
  107. // 上传图片
  108. repairsImg: [],
  109. // 描述
  110. describe: ''
  111. },
  112. // 选择的图片
  113. FileImgList: [],
  114. dict: {
  115. assetTypeDict: {
  116. 1: 'SHENGCHANSHEBEI',
  117. 2: 'ZHOUMIN',
  118. 3: 'WULIAO',
  119. 4: 'CHANPIN',
  120. 5: 'ZHOUZHUANCHE',
  121. 6: 'MOJU',
  122. 7: 'BEIPINBEIJIAN'
  123. }
  124. }
  125. }
  126. },
  127. methods: {
  128. // 选择图片
  129. async handlImageSelect(e) {
  130. let element = e.tempFiles[0]
  131. let url = await this.uploadFiles(element.path)
  132. console.log(url)
  133. if (url) {
  134. element.url = url
  135. this.form.repairsImg.push(element)
  136. }
  137. },
  138. // 图片删除
  139. handlImagDeletee(e) {
  140. let index = this.form.repairsImg.findIndex(n => {
  141. return n.uuid == e.tempFile.uuid
  142. })
  143. if (index !== -1) {
  144. this.form.repairsImg.splice(index, 1)
  145. }
  146. },
  147. // 提交
  148. submit() {
  149. let par = JSON.parse(JSON.stringify(this.infoData))
  150. par.normalNum = Number(par.normalNum)
  151. par.loseNum = Number(par.loseNum)
  152. par.damageNum = Number(par.damageNum)
  153. let sum = Number(par.inventoryNum)
  154. let num = par.normalNum + par.loseNum + par.damageNum
  155. console.log(sum, num)
  156. if (num !== sum) {
  157. uni.showToast({
  158. title: `所填写数量需等于库存(${sum})数量`,
  159. icon: 'none'
  160. })
  161. return
  162. }
  163. par.accessUrl = this.form.repairsImg.map(n => {
  164. return {
  165. url: n.url,
  166. size: n.size,
  167. name: n.name,
  168. type: n.extname
  169. }
  170. })
  171. par.remark = this.form.describe
  172. par.bizType = Number(this.bizType)
  173. postJ(this.apiUrl + '/repertoryCheck/batchSaveOrModify', par).then(
  174. res => {
  175. if (res.success) {
  176. uni.showToast({
  177. title: '操作成功',
  178. icon: 'success',
  179. duration: 2000
  180. })
  181. setTimeout(() => {
  182. this.back()
  183. }, 2000)
  184. }
  185. }
  186. )
  187. },
  188. // 文件上传
  189. uploadFiles(tempFilePaths) {
  190. let that = this
  191. return new Promise((resolve, reject) => {
  192. uni.uploadFile({
  193. url: this.apiUrl + '/data/doc/add', //后端用于处理图片并返回图片地址的接口
  194. filePath: tempFilePaths,
  195. name: 'file',
  196. header: that.header,
  197. formData: {
  198. module: '盘点'
  199. },
  200. success: res => {
  201. let data = JSON.parse(res.data) //返回的是字符串,需要转成对象格式
  202. resolve(data.data.accessUrl)
  203. },
  204. fail: err => {
  205. reject(null)
  206. uni.showToast({
  207. title: '图片上传失败',
  208. icon: 'none'
  209. })
  210. }
  211. })
  212. })
  213. },
  214. // 返回
  215. back() {
  216. uni.navigateBack({
  217. delta: 1
  218. })
  219. }
  220. }
  221. }
  222. </script>
  223. <style lang="scss" scoped>
  224. $cols: 3; // 列数
  225. $marginWidth: 20rpx; // 间隔
  226. .top-title {
  227. padding: 20rpx;
  228. }
  229. .main {
  230. min-height: 100vh;
  231. background-color: #f0f0f0;
  232. }
  233. .order-list {
  234. padding: 30rpx 20rpx;
  235. border-bottom: 1px solid #f2f2f2;
  236. position: relative;
  237. .s1 {
  238. display: flex;
  239. justify-content: space-between;
  240. align-items: center;
  241. .b1 {
  242. color: #555555;
  243. font-size: 30rpx;
  244. }
  245. .b2 {
  246. color: #000000;
  247. font-size: 28rpx;
  248. }
  249. .type {
  250. font-size: 28rpx;
  251. height: 40rpx;
  252. padding: 0 20rpx;
  253. line-height: 40rpx;
  254. &.yc {
  255. background-color: #dacde6;
  256. }
  257. &.ds {
  258. background-color: #feeaeb;
  259. }
  260. &.ps {
  261. background-color: #cbcbcb;
  262. }
  263. }
  264. }
  265. .wrap {
  266. display: flex;
  267. margin-top: 20rpx;
  268. .item {
  269. color: #555555;
  270. font-size: 28rpx;
  271. display: flex;
  272. width: 340rpx;
  273. .label {
  274. margin-right: 20rpx;
  275. }
  276. }
  277. }
  278. }
  279. .fixed-bottom {
  280. background-color: #fff;
  281. width: 100%;
  282. position: absolute;
  283. left: 0;
  284. bottom: 0;
  285. padding: 30rpx;
  286. box-sizing: border-box;
  287. }
  288. .state-wrap {
  289. display: flex;
  290. align-items: center;
  291. .label {
  292. font-size: 28rpx;
  293. }
  294. .value-wrap {
  295. display: flex;
  296. }
  297. }
  298. .textarea {
  299. border: 1px solid #f2f2f2;
  300. width: 100%;
  301. margin-top: 20rpx;
  302. box-sizing: border-box;
  303. }
  304. .sc-wrap {
  305. .title {
  306. margin-bottom: 7px;
  307. font-size: 32rpx;
  308. }
  309. margin-top: 15px;
  310. }
  311. .btn-wrap {
  312. margin-top: 30rpx;
  313. .qr-btn {
  314. background-color: #70b603f3;
  315. }
  316. .qx-btn {
  317. background-color: transparent;
  318. color: #555555;
  319. margin-top: 20rpx;
  320. }
  321. }
  322. .bt {
  323. color: #ff4949;
  324. }
  325. .num-wrap {
  326. display: flex;
  327. width: 100%;
  328. .item {
  329. display: flex;
  330. align-items: center;
  331. width: calc((100% - #{($cols - 1) * $marginWidth}) / #{$cols});
  332. margin-left: $marginWidth;
  333. .label {
  334. white-space: nowrap;
  335. margin-right: 20rpx;
  336. font-size: 28rpx;
  337. }
  338. .input-wrap {
  339. .input {
  340. border: 1px solid #f2f2f2;
  341. }
  342. }
  343. }
  344. .item:nth-of-type(#{$cols}n + 1) {
  345. margin-left: 0;
  346. }
  347. }
  348. </style>