details.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591
  1. <template>
  2. <view class="main">
  3. <uni-nav-bar
  4. fixed="true"
  5. statusBar="true"
  6. left-icon="back"
  7. @clickLeft="back"
  8. title="盘点详情"
  9. >
  10. </uni-nav-bar>
  11. <view class="info-wrap">
  12. <view class="list">
  13. <view class="item">
  14. <view class="label"> 盘点单号 </view>
  15. <view class="value">
  16. {{ infoData.workOrderCode }}
  17. </view>
  18. </view>
  19. <view class="item">
  20. <view class="label"> 盘点仓库 </view>
  21. <view class="value">
  22. {{ infoData.bizTypeName }}
  23. </view>
  24. </view>
  25. <view class="item">
  26. <view class="label"> 盘点人 </view>
  27. <view class="value">
  28. {{ infoData.executeUserName }}/{{ infoData.executorDeptName }}
  29. </view>
  30. </view>
  31. <view class="item">
  32. <view class="label"> 盘点时间 </view>
  33. <view class="value">
  34. {{ infoData.createTime }} - {{ infoData.planFinishTime }}
  35. </view>
  36. </view>
  37. <view class="item">
  38. <view class="label"> 盘点异常数 </view>
  39. <view class="value">
  40. {{ infoData.abnormalCount }}
  41. </view>
  42. </view>
  43. </view>
  44. <view class="state">
  45. {{ infoData.status && infoData.status.descp }}
  46. </view>
  47. </view>
  48. <view
  49. class="fixed-bottom"
  50. v-if="
  51. isExecute &&
  52. infoData.status &&
  53. (infoData.status.code == 1 || infoData.status.code == 6)
  54. "
  55. >
  56. <view class="tjsp" @click="handlTjsp"> 提交 </view>
  57. </view>
  58. <view
  59. class="fixed-bottom"
  60. v-else-if="isSpr && infoData.status && infoData.status.code == 2"
  61. >
  62. <view class="bhtg">
  63. <view class="item" @click="handlExamine(false)"> 驳回 </view>
  64. <view class="item s1" @click="handlExamine(true)"> 通过 </view>
  65. </view>
  66. </view>
  67. <view class="tab-warp">
  68. <view class="tab-title-wrap">
  69. <view class="tab-title">
  70. <view
  71. class="item"
  72. v-for="[key, item] in Object.entries(tabList)"
  73. :key="key"
  74. :class="{ avtive: key == type }"
  75. @click="changeTab(key)"
  76. >
  77. {{ item.name }}
  78. </view>
  79. </view>
  80. </view>
  81. <view class="tab-main">
  82. <view class="tbai"> 盘点项全览 </view>
  83. <u-collapse :value="['1']">
  84. <template v-if="tabList[type].list.length > 0">
  85. <u-collapse-item
  86. :title="`${item.assetName}(${item.assetCode})`"
  87. name="1"
  88. v-for="(item, index) in tabList[type].list"
  89. :key="index"
  90. >
  91. <view slot="value" class="u-page__item__title__slot-title">
  92. <template v-if="item.equStatus !== 3">
  93. <view class="text" v-if="item.equStatus == 0"> 待盘 </view>
  94. <template v-else>
  95. <text
  96. :style="styleClass(el.type)"
  97. class="text"
  98. v-for="el in ycEquStatus(item)"
  99. >
  100. {{ dict.equStatus[el.type] }}({{ el.num }})
  101. </text>
  102. </template>
  103. </template>
  104. <view class="text" v-else style="color: #f59a23bc">
  105. 溢出({{ item.inventoryNum }})
  106. </view>
  107. </view>
  108. <view class="u-collapse-content">
  109. <view class="collapse-list">
  110. <view class="item" v-if="item.equStatus == 3">
  111. <view class="s1"> 批次 </view>
  112. <view class="s2">
  113. {{ item.batchNum }}
  114. </view>
  115. </view>
  116. <view class="item">
  117. <view class="s1"> 牌号 </view>
  118. <view class="s2">
  119. {{ item.assetBrand }}
  120. </view>
  121. </view>
  122. <view class="item">
  123. <view class="s1"> 型号 </view>
  124. <view class="s2">
  125. {{ item.assetSku }}
  126. </view>
  127. </view>
  128. <view class="item">
  129. <view class="s1"> 单位 </view>
  130. <view class="s2">
  131. {{ item.isUnpack ? item.unit : item.minPackUnit }}
  132. </view>
  133. </view>
  134. <view class="item" v-if="item.equStatus !== 3">
  135. <view class="s1"> 库存量 </view>
  136. <view class="s2">
  137. {{ item.inventoryNum }}
  138. </view>
  139. </view>
  140. <view class="item">
  141. <view class="s1"> 实盘量 </view>
  142. <view class="s2" v-if="item.equStatus == 3">
  143. {{ item.inventoryNum }}
  144. </view>
  145. <view class="s2" v-else>
  146. {{ item.yetNum }}
  147. </view>
  148. </view>
  149. </view>
  150. </view>
  151. </u-collapse-item>
  152. </template>
  153. <u-empty style="padding-top: 20rpx" v-else> </u-empty>
  154. </u-collapse>
  155. </view>
  156. <examineApprove
  157. ref="examineApprove"
  158. @submit="cbExamineApprove"
  159. ></examineApprove>
  160. </view>
  161. </view>
  162. </template>
  163. <script>
  164. import examineApprove from '../components/examineApprove.vue'
  165. import { get, postJ } from '@/utils/api'
  166. let [page, size, isEnd] = [1, 20, false]
  167. export default {
  168. components: {
  169. examineApprove
  170. },
  171. data () {
  172. return {
  173. workOrderId: '',
  174. // 待办id
  175. myHandleId: '',
  176. type: 0,
  177. tabList: {
  178. 0: {
  179. name: '全部',
  180. list: [],
  181. type: []
  182. },
  183. 1: {
  184. name: '盘盈',
  185. list: [],
  186. type: [3]
  187. },
  188. 2: {
  189. name: '盘亏',
  190. list: [],
  191. type: [1, 5, 6]
  192. },
  193. 3: {
  194. name: '破损',
  195. list: [],
  196. type: [2, 5, 7]
  197. }
  198. },
  199. infoData: '',
  200. dict: {
  201. status: {
  202. 0: '待接收',
  203. 1: '执行中',
  204. 2: '待审核',
  205. 3: '完成',
  206. 4: '已撤回',
  207. 5: '待验收',
  208. 6: '已驳回',
  209. 7: '未修复',
  210. 8: '已派单'
  211. },
  212. equStatus: {
  213. 0: '待盘',
  214. 1: '盘亏',
  215. 2: '破损',
  216. 3: '盘盈',
  217. 4: '正常'
  218. }
  219. }
  220. }
  221. },
  222. onLoad (option) {
  223. this.workOrderId = option.workOrderId
  224. this.myHandleId = option.myHandleId
  225. this.initPagination()
  226. this.getdata()
  227. },
  228. computed: {
  229. // 当前是否为执行人
  230. isSpr () {
  231. let userInfo = uni.getStorageSync('userInfo')
  232. // 当前登录人id
  233. let userId = userInfo.id
  234. console.log()
  235. // 审批人id
  236. let executeUserId = this.infoData.accraditationUserId
  237. if (executeUserId == userId) {
  238. return true
  239. } else {
  240. return false
  241. }
  242. },
  243. // 当前是否为执行人
  244. isExecute () {
  245. let userInfo = uni.getStorageSync('userInfo')
  246. // 当前登录人id
  247. let userId = userInfo.id
  248. console.log()
  249. // 审批人id
  250. let executeUserId = this.infoData.executeUserId
  251. if (executeUserId == userId) {
  252. return true
  253. } else {
  254. return false
  255. }
  256. }
  257. },
  258. onReachBottom () {
  259. console.log('触底')
  260. if (isEnd) {
  261. return
  262. }
  263. this.getMoreLists()
  264. },
  265. methods: {
  266. changeTab (key) {
  267. this.type = key
  268. this.initPagination()
  269. this.getdata()
  270. },
  271. getdata () {
  272. uni.showLoading({
  273. title: '加载中'
  274. })
  275. let par = {
  276. workOrderId: this.workOrderId,
  277. equStatusList: this.tabList[this.type].type
  278. }
  279. let paging = this.URLSearchParams({
  280. page,
  281. size
  282. })
  283. postJ(this.apiUrl + '/repertoryCheck/getCheckDetail?' + paging, par)
  284. .then(res => {
  285. if (res.success) {
  286. this.infoData = res.data
  287. let pageTotal = res.data.pages
  288. let data = res.data.planInventoryDetailList.records
  289. if (page === 1) {
  290. this.tabList[this.type].list = data
  291. } else {
  292. data.forEach(element => {
  293. this.tabList[this.type].list.push(element)
  294. })
  295. }
  296. page < pageTotal ? (isEnd = false) : (isEnd = true)
  297. }
  298. })
  299. .finally(() => {
  300. uni.stopPullDownRefresh()
  301. uni.hideLoading()
  302. })
  303. },
  304. getMoreLists () {
  305. page++
  306. this.getdata()
  307. },
  308. // 初始化分页
  309. initPagination () {
  310. this.tabList[this.type].list = []
  311. page = 1
  312. isEnd = false
  313. },
  314. // 打开选人员
  315. handlTjsp () {
  316. this.$refs.examineApprove.open()
  317. },
  318. cbExamineApprove (currentUser) {
  319. let par = {
  320. workOrderId: this.workOrderId
  321. }
  322. if (currentUser) {
  323. ;(par.accraditationUserId = currentUser.userId),
  324. (par.accraditationUserName = currentUser.trueName)
  325. }
  326. postJ(this.apiUrl + '/repertoryCheck/submit', par).then(res => {
  327. if (res?.success) {
  328. uni.showToast({
  329. title: '操作成功'
  330. })
  331. this.getdata()
  332. }
  333. })
  334. },
  335. // 审批
  336. handlExamine (val) {
  337. let text = ''
  338. if (val) {
  339. text = '是否通过审批?'
  340. } else {
  341. text = '是否驳回审批?'
  342. }
  343. uni.showModal({
  344. content: text,
  345. success: res => {
  346. if (res.confirm) {
  347. let par = {
  348. checked: val,
  349. id: this.workOrderId,
  350. myHandleId: this.myHandleId,
  351. type: 4,
  352. handleType: 1
  353. }
  354. postJ(this.apiUrl + '/plan/info/audit', par).then(res => {
  355. if (res?.success) {
  356. uni.showToast({
  357. title: '操作成功'
  358. })
  359. this.getdata()
  360. }
  361. })
  362. }
  363. }
  364. })
  365. },
  366. // 异常的显示
  367. ycEquStatus (item) {
  368. let list = []
  369. if (item.loseNum) {
  370. list.push({
  371. type: 1,
  372. num: item.loseNum
  373. })
  374. }
  375. if (item.damageNum) {
  376. list.push({
  377. type: 2,
  378. num: item.damageNum
  379. })
  380. }
  381. if (item.normalNum) {
  382. list.push({
  383. type: 4,
  384. num: item.normalNum
  385. })
  386. }
  387. console.log('asd', list)
  388. return list
  389. },
  390. styleClass (type) {
  391. switch (Number(type)) {
  392. case 0:
  393. case 4:
  394. return 'color: #70B603;'
  395. break
  396. case 1:
  397. return 'color: #FF0000;'
  398. break
  399. case 2:
  400. return 'color: #555;'
  401. break
  402. case 3:
  403. return 'color: #dacde6;'
  404. break
  405. default:
  406. break
  407. }
  408. }
  409. }
  410. }
  411. </script>
  412. <style lang="scss" scoped>
  413. .main {
  414. min-height: 100vh;
  415. background-color: #f0f0f0;
  416. }
  417. .info-wrap {
  418. background-color: #fff;
  419. padding: 30rpx;
  420. position: relative;
  421. .list {
  422. .item {
  423. display: flex;
  424. font-size: 28rpx;
  425. color: #555555;
  426. & + .item {
  427. margin-top: 20rpx;
  428. }
  429. .label {
  430. width: 200rpx;
  431. }
  432. .value {
  433. flex: 1;
  434. }
  435. }
  436. }
  437. .state {
  438. background-color: #f59a23bc;
  439. color: #fff;
  440. font-size: 28rpx;
  441. height: 50rpx;
  442. line-height: 1;
  443. display: flex;
  444. justify-content: center;
  445. align-items: center;
  446. padding: 0 20rpx;
  447. border-radius: 50rpx;
  448. position: absolute;
  449. top: 20rpx;
  450. right: 20rpx;
  451. }
  452. }
  453. .tab-warp {
  454. background-color: #fff;
  455. margin-top: 20rpx;
  456. .tab-title-wrap {
  457. display: flex;
  458. justify-content: flex-end;
  459. }
  460. .tab-title {
  461. display: flex;
  462. padding: 20rpx;
  463. .item {
  464. font-size: 28rpx;
  465. color: #555555;
  466. &.avtive {
  467. color: #157a2c;
  468. }
  469. & + .item {
  470. margin-left: 40rpx;
  471. }
  472. }
  473. }
  474. .tab-main {
  475. .tbai {
  476. background-color: #d7d7d7;
  477. color: #333333;
  478. font-size: 28rpx;
  479. padding: 20rpx;
  480. }
  481. }
  482. .red {
  483. color: #ff0000;
  484. }
  485. .green {
  486. color: #157a2c;
  487. }
  488. .yellow {
  489. color: #b8741a;
  490. }
  491. .text {
  492. font-size: 28rpx;
  493. margin-right: 10rpx;
  494. }
  495. }
  496. .collapse-list {
  497. display: flex;
  498. flex-wrap: wrap;
  499. .item {
  500. display: flex;
  501. width: 50%;
  502. margin-bottom: 20rpx;
  503. .s1 {
  504. margin-right: 20rpx;
  505. }
  506. }
  507. }
  508. ::v-deep .u-collapse-item {
  509. .u-cell__body {
  510. background-color: #f2f2f2;
  511. }
  512. }
  513. .fixed-bottom {
  514. position: fixed;
  515. z-index: 99;
  516. left: 0;
  517. bottom: 0;
  518. width: 100%;
  519. height: 80rpx;
  520. display: flex;
  521. border: 1px solid #157a2c;
  522. box-sizing: border-box;
  523. .tjsp {
  524. background-color: #157a2c;
  525. flex: 1;
  526. display: flex;
  527. justify-content: center;
  528. align-items: center;
  529. color: #fff;
  530. }
  531. & + .tab-warp {
  532. padding-bottom: 82rpx;
  533. }
  534. .bhtg {
  535. width: 100%;
  536. display: flex;
  537. justify-content: space-between;
  538. align-items: center;
  539. box-sizing: border-box;
  540. background: #fff;
  541. .item {
  542. box-sizing: border-box;
  543. flex: 1;
  544. font-size: 28rpx;
  545. display: flex;
  546. justify-content: center;
  547. align-items: center;
  548. height: 80rpx;
  549. &.s1 {
  550. background-color: #157a2c;
  551. color: #fff;
  552. }
  553. }
  554. }
  555. }
  556. </style>