detail.uvue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469
  1. <template>
  2. <uni-navbar-lite @leftClick="handleBack" :show-right=false title="出库单详情"></uni-navbar-lite>
  3. <view class="page-container">
  4. <scroll-view class="page-content" :scroll-y="true">
  5. <!-- 出库单信息 -->
  6. <view class="section">
  7. <view class="info-card">
  8. <view class="info-row">
  9. <text class="info-label">出库单号</text>
  10. <text class="info-value">{{ salseCode }}</text>
  11. </view>
  12. <view class="info-row">
  13. <text class="info-label">状态</text>
  14. <text class="info-value status-text" :class="'status-' + status">{{ statusText }}</text>
  15. </view>
  16. <view class="info-row">
  17. <text class="info-label">创建人</text>
  18. <text class="info-value">{{ createBy }}</text>
  19. </view>
  20. <view class="info-row">
  21. <text class="info-label">领用人</text>
  22. <text class="info-value">{{ receiverUser }}</text>
  23. </view>
  24. <view class="info-row">
  25. <text class="info-label">创建时间</text>
  26. <text class="info-value">{{ createTime }}</text>
  27. </view>
  28. </view>
  29. </view>
  30. <!-- 物料明细 -->
  31. <view class="section">
  32. <view class="section-header">
  33. <view class="section-indicator"></view>
  34. <text class="section-title">物料明细</text>
  35. </view>
  36. <view class="material-list">
  37. <view v-if="lineList.length === 0" class="empty-tip">
  38. <text class="empty-tip-text">暂无物料</text>
  39. </view>
  40. <view
  41. v-else
  42. v-for="(item, index) in lineList"
  43. :key="index"
  44. class="material-item"
  45. >
  46. <view class="material-header">
  47. <text class="material-name">{{ getItemName(item) }}</text>
  48. <text class="material-status" :class="getLineStatus(item) == 'Y' ? 'status-received' : 'status-pending'">
  49. {{ getLineStatusText(item) }}
  50. </text>
  51. </view>
  52. <view class="material-spec" v-if="getSpecification(item)">
  53. <text class="spec-label">规格:</text>
  54. <text class="spec-value">{{ getSpecification(item) }}</text>
  55. </view>
  56. <view class="material-divider"></view>
  57. <view class="material-footer">
  58. <view class="quantity-info">
  59. <view class="detail-row">
  60. <text class="quantity-label">领料人:</text>
  61. <text class="quantity-value">{{ getReceiverUser(item) }}</text>
  62. </view>
  63. <view class="detail-row">
  64. <text class="quantity-label">签收人:</text>
  65. <text class="quantity-value">{{ getReceiverSigner(item) }}</text>
  66. </view>
  67. </view>
  68. <view class="right-info">
  69. <text class="quantity-num">{{ getQuantity(item) }} {{ getMeasureName(item) }}</text>
  70. </view>
  71. <view v-if="status == 'FINISHED' && getLineStatus(item) != 'Y'" class="receive-btn-wrap">
  72. <button v-if="checkPermissions(['mes:wm:productsalse:sign', 'mes:wm:productsalse:personsign'])" class="receive-btn" @click="handleSignReceive(item)">签收</button>
  73. </view>
  74. </view>
  75. </view>
  76. </view>
  77. </view>
  78. </scroll-view>
  79. </view>
  80. </template>
  81. <script setup lang="uts">
  82. import { ref, computed } from 'vue'
  83. import { getProductSalseById, signReceiveLine } from '../../api/out/index'
  84. import { getUserInfo } from '../../utils/storage'
  85. import { checkPermissions } from '../../utils/permission'
  86. const salseId = ref<string>("")
  87. const salseCode = ref<string>("")
  88. const status = ref<string>("")
  89. const createBy = ref<string>("")
  90. const receiverUser = ref<string>("")
  91. const createTime = ref<string>("")
  92. const lineList = ref<UTSJSONObject[]>([])
  93. let currentUserId: string = ''
  94. const statusText = computed((): string => {
  95. const s = status.value
  96. switch (s) {
  97. case 'PREPARE': return '待确认'
  98. case 'CONFIRMED': return '已确认'
  99. case 'EXECUTING': return '执行中'
  100. case 'FINISHED': return '已完成'
  101. case 'CANCEL': return '已取消'
  102. default: return s
  103. }
  104. })
  105. const getItemName = (item: UTSJSONObject): string => {
  106. if (item == null) return ''
  107. const val = item['itemName']
  108. return val != null ? val.toString() : ''
  109. }
  110. const getSpecification = (item: UTSJSONObject): string => {
  111. if (item == null) return ''
  112. const val = item['specification']
  113. return val != null ? val.toString() : ''
  114. }
  115. const getQuantity = (item: UTSJSONObject): string => {
  116. if (item == null) return '0'
  117. const val = item['quantitySalse']
  118. return val != null ? val.toString() : '0'
  119. }
  120. const getMeasureName = (item: UTSJSONObject): string => {
  121. if (item == null) return ''
  122. const val = item['measureName']
  123. return val != null ? val.toString() : ''
  124. }
  125. const getLineStatus = (item: UTSJSONObject): string => {
  126. if (item == null) return ''
  127. const val = item['receiverStatus']
  128. return val != null ? val.toString() : ''
  129. }
  130. const getReceiverUser = (item: UTSJSONObject): string => {
  131. if (item == null) return ''
  132. const val = item['receiverUser']
  133. return val != null ? val.toString() : ''
  134. }
  135. const getReceiverSigner = (item: UTSJSONObject): string => {
  136. if (item == null) return ''
  137. const val = item['receiverSigner']
  138. return val != null ? val.toString() : ''
  139. }
  140. const getLineStatusText = (item: UTSJSONObject): string => {
  141. const s = getLineStatus(item)
  142. if (s == 'Y') return '已签收'
  143. if (s == 'N') return '待签收'
  144. return s
  145. }
  146. const loadDetail = (): void => {
  147. const len = salseId.value.length as number
  148. if (len === 0) return
  149. getProductSalseById(salseId.value).then((res: any) => {
  150. const resData = res as UTSJSONObject
  151. const data = resData["data"] as UTSJSONObject
  152. salseCode.value = data['salseCode'] != null ? data['salseCode'].toString() : ''
  153. status.value = data['status'] != null ? data['status'].toString() : ''
  154. createBy.value = data['createNickName'] != null ? data['createNickName'].toString() : ''
  155. receiverUser.value = data['receiverUser'] != null ? data['receiverUser'].toString() : ''
  156. createTime.value = data['createTime'] != null ? data['createTime'].toString() : ''
  157. const lines = data['wmProductSalseLineList']
  158. if (lines != null) {
  159. lineList.value = lines as UTSJSONObject[]
  160. } else {
  161. lineList.value = []
  162. }
  163. }).catch((e) => {
  164. const error = e as UTSError
  165. const errMsg = error?.message
  166. uni.showToast({ title: errMsg.toString(), icon: 'none' })
  167. })
  168. }
  169. const handleSignReceive = (item: UTSJSONObject): void => {
  170. const lineId = item['lineId']
  171. if (lineId == null) {
  172. uni.showToast({ title: '明细ID不存在', icon: 'none' })
  173. return
  174. }
  175. uni.showModal({
  176. title: '提示',
  177. content: '确认签收该物料?',
  178. success: (res) => {
  179. if (res.confirm) {
  180. signReceiveLine(lineId.toString()).then((res: any) => {
  181. uni.showToast({ title: '签收成功', icon: 'success' })
  182. loadDetail()
  183. }).catch((e) => {
  184. const error = e as UTSError
  185. const errMsg = error?.message
  186. uni.showToast({ title: errMsg.toString(), icon: 'none' })
  187. })
  188. }
  189. }
  190. })
  191. }
  192. const handleBack = (): void => {
  193. uni.navigateBack()
  194. }
  195. onLoad((options: any) => {
  196. const params = options as UTSJSONObject
  197. if (params != null && params['id'] != null) {
  198. salseId.value = params['id'].toString()
  199. const userInfo = getUserInfo()
  200. if (userInfo != null) {
  201. const userId = userInfo['userId']
  202. currentUserId = userId != null ? userId.toString() : ''
  203. }
  204. loadDetail()
  205. }
  206. })
  207. </script>
  208. <style lang="scss">
  209. .page-container {
  210. flex: 1;
  211. background-color: #e8f0f9;
  212. }
  213. .page-content {
  214. flex: 1;
  215. padding: 20rpx;
  216. }
  217. .section {
  218. margin-bottom: 20rpx;
  219. background: #ffffff;
  220. border-radius: 16rpx;
  221. padding: 20rpx;
  222. }
  223. .section-header {
  224. flex-direction: row;
  225. align-items: center;
  226. margin-bottom: 20rpx;
  227. }
  228. .section-indicator {
  229. width: 6rpx;
  230. height: 32rpx;
  231. background-color: #007aff;
  232. border-radius: 3rpx;
  233. margin-right: 12rpx;
  234. }
  235. .section-title {
  236. font-size: 32rpx;
  237. color: #333333;
  238. font-weight: bold;
  239. }
  240. .info-card {
  241. background-color: #f8f9fa;
  242. border-radius: 8rpx;
  243. padding: 20rpx;
  244. }
  245. .info-row {
  246. flex-direction: row;
  247. justify-content: space-between;
  248. margin-bottom: 16rpx;
  249. &:last-child {
  250. margin-bottom: 0;
  251. }
  252. }
  253. .info-label {
  254. font-size: 28rpx;
  255. color: #666666;
  256. }
  257. .info-value {
  258. font-size: 28rpx;
  259. color: #333333;
  260. }
  261. .status-text {
  262. &.status-PREPARE {
  263. color: #faad14;
  264. }
  265. &.status-CONFIRMED {
  266. color: #1890ff;
  267. }
  268. &.status-EXECUTING {
  269. color: #722ed1;
  270. }
  271. &.status-FINISHED {
  272. color: #52c41a;
  273. }
  274. &.status-CANCEL {
  275. color: #ff4d4f;
  276. }
  277. &.status-received {
  278. color: #52c41a;
  279. }
  280. &.status-pending {
  281. color: #faad14;
  282. }
  283. }
  284. .material-list {
  285. background-color: #f8f9fa;
  286. border-radius: 8rpx;
  287. padding: 20rpx;
  288. }
  289. .empty-tip {
  290. align-items: center;
  291. padding: 40rpx;
  292. }
  293. .empty-tip-text {
  294. color: #999999;
  295. font-size: 28rpx;
  296. }
  297. .material-item {
  298. background-color: #ffffff;
  299. border-radius: 12rpx;
  300. padding: 28rpx;
  301. margin-bottom: 20rpx;
  302. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.08);
  303. &:last-child {
  304. margin-bottom: 0;
  305. }
  306. }
  307. .material-header {
  308. flex-direction: row;
  309. justify-content: space-between;
  310. align-items: flex-start;
  311. margin-bottom: 16rpx;
  312. }
  313. .material-name {
  314. font-size: 32rpx;
  315. color: #333333;
  316. font-weight: bold;
  317. flex: 1;
  318. margin-right: 16rpx;
  319. line-height: 44rpx;
  320. }
  321. .material-status {
  322. font-size: 24rpx;
  323. padding: 8rpx 20rpx;
  324. border-radius: 12rpx;
  325. &.status-received {
  326. background-color: #f6ffed;
  327. color: #52c41a;
  328. }
  329. &.status-pending {
  330. background-color: #fff7e6;
  331. color: #fa8c16;
  332. }
  333. }
  334. .material-spec {
  335. flex-direction: row;
  336. margin-bottom: 16rpx;
  337. }
  338. .spec-label {
  339. font-size: 26rpx;
  340. color: #999999;
  341. margin-right: 8rpx;
  342. }
  343. .spec-value {
  344. font-size: 26rpx;
  345. color: #666666;
  346. flex: 1;
  347. }
  348. .material-divider {
  349. height: 2rpx;
  350. background-color: #f0f0f0;
  351. margin: 16rpx 0;
  352. }
  353. .material-footer {
  354. flex-direction: row;
  355. justify-content: space-between;
  356. align-items: center;
  357. }
  358. .quantity-info {
  359. flex-direction: column;
  360. flex: 1;
  361. }
  362. .right-info {
  363. justify-content: center;
  364. margin-right: 24rpx;
  365. }
  366. .quantity-num {
  367. font-size: 32rpx;
  368. color: #007aff;
  369. font-weight: bold;
  370. }
  371. .detail-row {
  372. flex-direction: row;
  373. margin-bottom: 8rpx;
  374. &:last-child {
  375. margin-bottom: 0;
  376. }
  377. }
  378. .quantity-label {
  379. font-size: 26rpx;
  380. color: #999999;
  381. width: 120rpx;
  382. }
  383. .quantity-value {
  384. font-size: 26rpx;
  385. color: #007aff;
  386. font-weight: bold;
  387. flex: 1;
  388. }
  389. .receive-btn-wrap {
  390. margin-left: 24rpx;
  391. }
  392. .receive-btn {
  393. padding: 14rpx 36rpx;
  394. background-color: #007aff;
  395. color: #ffffff;
  396. font-size: 26rpx;
  397. border-radius: 8rpx;
  398. border: none;
  399. font-weight: bold;
  400. &:active {
  401. background-color: #0056b3;
  402. }
  403. }
  404. .material-detail {
  405. flex-direction: row;
  406. justify-content: space-between;
  407. }
  408. .detail-row {
  409. flex-direction: row;
  410. }
  411. </style>