quality-detail.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  1. <!-- 订单详情 -->
  2. <template>
  3. <view class="container-wrap">
  4. <uni-nav-bar title="订单详情" :status-bar="true" background-color="#3F92F9" color="#FFF">
  5. <view slot="left">
  6. <u-icon name="account-fill" color="#FFF" size="35"></u-icon>
  7. <span style="padding: 0 5rpx;color: #FFFFFF;">{{ userInfo.name }}</span>
  8. </view>
  9. <view slot="right" @tap="$utils.back()">
  10. <span style="color: #FFFFFF;">返回</span>
  11. </view>
  12. </uni-nav-bar>
  13. <view class="container">
  14. <div class="top">
  15. <view class="info">
  16. <view class="row">
  17. <view class="col">
  18. <view class="label">合同号:</view>
  19. <view class="value">{{ option.purchaseBillNo }}</view>
  20. </view>
  21. </view>
  22. <view class="row">
  23. <view class="col">
  24. <view class="label">批次号:</view>
  25. <view class="value">{{ option.batchNo }}</view>
  26. </view>
  27. </view>
  28. <view class="row">
  29. <view class="col">
  30. <view class="label">供应商:</view>
  31. <view class="value">{{ option.supplier }}</view>
  32. </view>
  33. </view>
  34. <view class="row">
  35. <view class="col">
  36. <view class="label">物料名称:</view>
  37. <view class="value">{{ option.materialName }}</view>
  38. </view>
  39. </view>
  40. <view class="row">
  41. <view class="col">
  42. <view class="label">物料规格:</view>
  43. <view class="value">{{ option.spec }}</view>
  44. </view>
  45. </view>
  46. <view class="row">
  47. <view class="col">
  48. <view class="label">到货时间:</view>
  49. <view class="value">{{ option.arriveTime }}</view>
  50. </view>
  51. </view>
  52. <view class="row">
  53. <view class="col">
  54. <view class="label">申购数量:</view>
  55. <view class="value">{{ option.purchaseCount }}</view>
  56. </view>
  57. <view class="col">
  58. <view class="label">到货数量:</view>
  59. <view class="value">{{ option.inStockQty }}</view>
  60. </view>
  61. </view>
  62. </view>
  63. <view class="title">质检记录</view>
  64. <view class="sub-title">共有{{ option.checkNum }}个物料待质检</view>
  65. </div>
  66. <view class="list">
  67. <view class="item" v-for="(item, index) in list" :key="item.checkDetailId">
  68. <view class="row">
  69. <view class="col">
  70. <view class="label">标签值:</view>
  71. <view class="value">{{ item.rfidCode }}</view>
  72. </view>
  73. </view>
  74. <view class="row">
  75. <view class="col">
  76. <view class="label">物料名称:</view>
  77. <view class="value">{{ item.materialName }}</view>
  78. </view>
  79. </view>
  80. <view class="row border">
  81. <view class="col">
  82. <view class="label">物料数量:</view>
  83. <view class="value">{{ item.quantity }}</view>
  84. </view>
  85. </view>
  86. <view class="row border" style="justify-content: center;padding-bottom: 20rpx;">
  87. <span>质检结论:</span>
  88. <span
  89. :class="item.checkJudgment === 0 ? 'orange' : item.checkJudgment === 1 ? 'blue' : 'red'"
  90. >
  91. {{ item.checkJudgment === 0 ? '目测合格' : item.checkJudgment === 1 ? '合格' : '不合格' }}
  92. </span>
  93. </view>
  94. <view class="row" style="justify-content: center;">
  95. <span style="color: red;font-weight: bold;" @tap="del(index)">删除</span>
  96. </view>
  97. </view>
  98. </view>
  99. <view class="btn" v-if="option.stockBatchNum === 0">
  100. <u-button v-if="option.hasExemptInspec" disabled throttleTime="300" type="primary" style="width: 100%;">免检审批中</u-button>
  101. <u-button v-else throttleTime="300" type="primary" plain style="width: 100%;" @click="toNoChack">申请免检</u-button>
  102. </view>
  103. <view class="btn" v-else-if="option.stockBatchNum >= option.checkNum">
  104. <u-button v-if="option.checkNum === list.length" throttleTime="300" type="primary" style="width: 100%;" @click="(cfmShow = true) && (isNoCheck = false)">结束质检</u-button>
  105. <u-button v-else throttleTime="300" type="primary" style="width: 100%;" @click="bind">开始质检</u-button>
  106. </view>
  107. <view class="btn" v-else>
  108. <u-button v-if="(option.stockBatchNum === list.length) && (option.hasExemptInspec)" disabled type="primary" style="width: 100%;">免检审批中</u-button>
  109. <u-button v-if="(option.stockBatchNum === list.length) && (!option.hasExemptInspec)" throttleTime="300" type="primary" style="width: 100%;" @click="(cfmShow = true) && (isNoCheck = true)">结束质检</u-button>
  110. <u-button v-if="option.stockBatchNum !== list.length" throttleTime="300" type="primary" style="width: 100%;" @click="bind">开始质检</u-button>
  111. </view>
  112. <!-- 物料修正 -->
  113. <u-modal
  114. v-model="show"
  115. :show-title="false"
  116. :show-confirm-button="false"
  117. :show-cancel-button="false"
  118. >
  119. <view class="modal">
  120. <view class="img">
  121. <image :src="error" mode="widthFix"></image>
  122. </view>
  123. <view class="content">
  124. 质检出现布料短少记录<br/>
  125. 将自动发起数量修正
  126. </view>
  127. <view class="btn">
  128. <u-button throttleTime="300" type="primary" size="medium" style="width: 250rpx;" @click="toChange">确认</u-button>
  129. </view>
  130. </view>
  131. </u-modal>
  132. <u-modal
  133. v-model="delShow"
  134. :show-confirm-button="true"
  135. :show-cancel-button="true"
  136. @confirm="delCfm"
  137. >
  138. <view class="modal">
  139. <view class="content">
  140. 是否删除?
  141. </view>
  142. </view>
  143. </u-modal>
  144. <my-dialog v-model="cfmShow" title="本次质检结果为:" :closeOnClickOverlay="true"
  145. @cancelClick="cfmShow = false" @cfmClick="over">
  146. <view slot="content" style="width: 100%;padding: 0 20rpx;">
  147. <view class="row">
  148. <view class="col" style="justify-content: center;">
  149. <view class="label" style="width: 160rpx;font-size: 32rpx;font-weight: bold;color: #19BE6B;">合格:</view>
  150. <view class="value" style="flex: 0;font-size: 32rpx;font-weight: bold;color: #19BE6B;">
  151. {{ list.filter(item => item.checkJudgment === 1).length }}
  152. </view>
  153. </view>
  154. </view>
  155. <view class="row">
  156. <view class="col" style="justify-content: center;">
  157. <view class="label" style="width: 160rpx;font-size: 32rpx;font-weight: bold;color: #834100;">目测合格:</view>
  158. <view class="value" style="flex: 0;font-size: 32rpx;font-weight: bold;color: #834100;">
  159. {{ list.filter(item => item.checkJudgment === 0).length }}
  160. </view>
  161. </view>
  162. </view>
  163. <view class="row">
  164. <view class="col" style="justify-content: center;">
  165. <view class="label" style="width: 160rpx;font-size: 32rpx;font-weight: bold;color: #d50000;">不合格:</view>
  166. <view class="value" style="flex: 0;font-size: 32rpx;font-weight: bold;color: #d50000;">
  167. {{ list.filter(item => item.checkJudgment === 2).length }}
  168. </view>
  169. </view>
  170. </view>
  171. </view>
  172. </my-dialog>
  173. </view>
  174. </view>
  175. </template>
  176. <script>
  177. import error from '../../../static/images/error.png'
  178. export default {
  179. data() {
  180. return {
  181. index: '',
  182. error,
  183. cfmShow: false,
  184. delShow: false,
  185. show: false,
  186. option: {},
  187. list: [],
  188. changeData: {},
  189. isNoCheck: false, // 是否免检
  190. isCfm: false, // 是否已结束质检
  191. };
  192. },
  193. methods: {
  194. /* 申请免检 */
  195. toNoChack () {
  196. this.$utils.open(`/pages/store-in-manage/quality/quality-no-check?data=${this.$utils.object2Code(this.option)}`)
  197. },
  198. delCfm() {
  199. this.list.splice(this.index, 1)
  200. this.$storage.setStorage(this.option.stockQuantityCheckId, this.list)
  201. this.index = ''
  202. },
  203. /* 删除质检记录 */
  204. del(index) {
  205. this.index = index
  206. this.delShow = true
  207. },
  208. /* 跳转数量修正 */
  209. toChange() {
  210. let data = {
  211. ...this.changeData,
  212. ...this.option
  213. }
  214. this.$utils.open(`/pages/store-in-manage/quality/quality-update?data=${this.$utils.object2Code(data)}`)
  215. },
  216. /* 结束质检 跳转数量修正 */
  217. over() {
  218. if(this.isNoCheck && this.option.hasQtyAdjust) {
  219. /* 如果结束质检需要免检 且已数量修正 */
  220. return this.$utils.open(`/pages/store-in-manage/quality/quality-no-check?data=${this.$utils.object2Code(this.option)}`)
  221. } else if(this.isNoCheck && this.isCfm) {
  222. /* 如果结束质检需要免检 且已结束质检 */
  223. if(this.option.hasQtyAdjust) {
  224. /* 已提交且已数量修正 */
  225. return this.$utils.open(`/pages/store-in-manage/quality/quality-no-check?data=${this.$utils.object2Code(this.option)}`)
  226. } else {
  227. this.$http.GetQuantityCheckLake({
  228. stockQuantityCheckId: this.option.stockQuantityCheckId
  229. }).then(res => {
  230. if(res.code === 0) {
  231. this.changeData = {
  232. ...res.result,
  233. isNoCheck: true
  234. }
  235. this.cfmShow = false
  236. this.show = true
  237. }
  238. })
  239. return
  240. }
  241. }
  242. console.log('over')
  243. console.log(this.list)
  244. this.$http.SubmitStockCheck({
  245. dataItems: this.list,
  246. uniqueCode: this.option.stockQuantityCheckId
  247. }).then(res => {
  248. console.log(res)
  249. if(res.code === 0) {
  250. this.cfmShow = false
  251. this.$http.GetQuantityCheckLake({
  252. stockQuantityCheckId: this.option.stockQuantityCheckId
  253. }).then(res => {
  254. console.log(res)
  255. if(res.code === 0) {
  256. if(this.isNoCheck) {
  257. /* 需要数量修正 且需要免检 */
  258. this.changeData = {
  259. ...res.result,
  260. isNoCheck: true
  261. }
  262. } else {
  263. this.changeData = {
  264. ...res.result
  265. }
  266. }
  267. this.show = true
  268. } else {
  269. /* 如果结束质检 不需要数量修正 */
  270. if(this.isNoCheck) {
  271. /* 需要免检 */
  272. return this.$utils.open(`/pages/store-in-manage/quality/quality-no-check?data=${this.$utils.object2Code(this.option)}`)
  273. } else {
  274. this.$storage.removeStorageSync(this.option.stockQuantityCheckId)
  275. this.$utils.back()
  276. }
  277. }
  278. })
  279. }
  280. })
  281. },
  282. /* 绑定标签 */
  283. bind() {
  284. this.$utils.open(`/pages/store-in-manage/quality/quality-scan?id=${this.option.stockQuantityCheckId}`)
  285. },
  286. /* 获取质检列表 */
  287. getList() {
  288. this.$http.GetStockCheckRecord({
  289. stockQuantityCheckId: this.option.stockQuantityCheckId
  290. }).then(res => {
  291. console.log(res)
  292. if(res.code === 0) {
  293. this.list = res.result
  294. if (this.list.length === 0) {
  295. this.list = this.$storage.getStorageSync(this.option.stockQuantityCheckId) || []
  296. console.log('?????list')
  297. console.log(this.list)
  298. } else {
  299. /* 如果接口列表有数据则代表该质检单已提交过 */
  300. this.isCfm = true
  301. }
  302. }
  303. })
  304. }
  305. },
  306. onLoad(option) {
  307. this.option = this.$utils.code2Object(option.data)
  308. this.getList()
  309. uni.$on('getScanData', res => {
  310. let data = this.$utils.code2Object(res)
  311. console.log(data)
  312. let findObj = this.list.find(item => item.rfidCode === data.rfidCode)
  313. if (findObj) {
  314. this.$msg.showToast('物料已质检!')
  315. } else {
  316. this.list.push(this.$utils.code2Object(res))
  317. this.$storage.setStorage(this.option.stockQuantityCheckId, this.list)
  318. }
  319. })
  320. },
  321. onShow() {
  322. // this.getList()
  323. },
  324. onUnload() {
  325. uni.$off('getScanData')
  326. }
  327. }
  328. </script>
  329. <style lang="scss" scoped>
  330. .container-wrap {
  331. overflow: hidden;
  332. .container {
  333. padding: 10rpx;
  334. height: calc(100vh - var(--status-bar-height) - 44px);
  335. overflow: hidden;
  336. display: flex;
  337. flex-direction: column;
  338. .top {
  339. .info {
  340. padding: 10rpx 20rpx;
  341. font-size: 32rpx;
  342. }
  343. .title {
  344. margin-top: 20rpx;
  345. font-size: 36rpx;
  346. font-weight: bold;
  347. text-align: center;
  348. }
  349. .sub-title {
  350. padding: 10rpx 0;
  351. font-size: 24rpx;
  352. text-align: center;
  353. color: #7f7f7f;
  354. }
  355. }
  356. .list {
  357. padding: 10rpx 0;
  358. margin-bottom: 10rpx;
  359. flex: 1;
  360. overflow: auto;
  361. background-color: #FFFFFF;
  362. .item {
  363. padding: 20rpx;
  364. margin-bottom: 10rpx;
  365. background-color: #FFFFFF;
  366. border: 1rpx solid rgba(215, 215, 215, 1);
  367. border-radius: 10rpx;
  368. .row {
  369. &.border {
  370. border-bottom: 1px solid rgba(215, 215, 215, 1);
  371. }
  372. .orange {
  373. color: rgb(245, 154, 35);
  374. }
  375. .blue {
  376. color: #02A7F0;
  377. }
  378. .red {
  379. color: red;
  380. }
  381. }
  382. }
  383. }
  384. }
  385. }
  386. .modal {
  387. padding: 40rpx 0;
  388. text-align: center;
  389. .img {
  390. margin: auto;
  391. width: 200rpx;
  392. }
  393. .content {
  394. padding: 30rpx 0;
  395. font-size: 36rpx;
  396. font-weight: bold;
  397. }
  398. }
  399. </style>