scanCheck.vue 7.9 KB

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