detail.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479
  1. <template>
  2. <view class="detail-container">
  3. <uni-nav-bar
  4. fixed="true"
  5. statusBar="true"
  6. left-icon="back"
  7. title="详情"
  8. background-color="#157A2C"
  9. color="#fff"
  10. @clickLeft="back"
  11. ></uni-nav-bar>
  12. <scroll-view scroll-y class="detail-content">
  13. <!-- 基本信息 -->
  14. <view class="section">
  15. <view class="section-title">基本信息</view>
  16. <view class="info-row">
  17. <text class="label">编码:</text>
  18. <text class="value highlight">{{ detail.code }}</text>
  19. </view>
  20. <view class="info-row">
  21. <text class="label">类型:</text>
  22. <text class="value">{{ getTypeText(detail.type) }}</text>
  23. </view>
  24. <view class="info-row">
  25. <text class="label">名称:</text>
  26. <text class="value">{{ detail.name }}</text>
  27. </view>
  28. <view class="info-row">
  29. <text class="label">紧急程度:</text>
  30. <text class="value">{{
  31. detail.priority == 1 ? "一般" : "紧急"
  32. }}</text>
  33. </view>
  34. <view class="info-row">
  35. <text class="label">请托部门:</text>
  36. <text class="value">{{ detail.applyDeptName }}</text>
  37. </view>
  38. <view class="info-row">
  39. <text class="label">请托人:</text>
  40. <text class="value">{{ detail.createUserName }}</text>
  41. </view>
  42. <view class="info-row">
  43. <text class="label">所属工厂:</text>
  44. <text class="value">{{ detail.applyFactoriesName }}</text>
  45. </view>
  46. <view class="info-row">
  47. <text class="label">受托工厂:</text>
  48. <text class="value">{{ detail.beEntrustedFactoriesName }}</text>
  49. </view>
  50. <view class="info-row">
  51. <text class="label">受托部门:</text>
  52. <text class="value">{{ detail.beEntrustedDeptName }}</text>
  53. </view>
  54. <view class="info-row">
  55. <text class="label">执行人:</text>
  56. <text class="value">{{ detail.executeUserName }}</text>
  57. </view>
  58. <view class="info-row">
  59. <text class="label">是否尾工序:</text>
  60. <text class="value">{{ detail.isLast == 1 ? "是" : "否" }}</text>
  61. </view>
  62. <view class="info-row">
  63. <text class="label">状态:</text>
  64. <text class="status-tag" :class="getStatusClass(detail.status)">
  65. {{ getStatusText(detail.status) }}
  66. </text>
  67. </view>
  68. <view class="info-row">
  69. <text class="label">审批状态:</text>
  70. <text
  71. class="status-tag"
  72. :class="getApprovalStatusClass(detail.approvalStatus)"
  73. >
  74. {{ getApprovalStatusText(detail.approvalStatus) }}
  75. </text>
  76. </view>
  77. <view class="info-row">
  78. <text class="label">发货状态:</text>
  79. <text
  80. class="status-tag"
  81. :class="getSendStatusClass(detail.sendStatus)"
  82. >
  83. {{ getSendStatusText(detail.sendStatus) }}
  84. </text>
  85. </view>
  86. <view class="info-row">
  87. <text class="label">创建时间:</text>
  88. <text class="value">{{ detail.createTime }}</text>
  89. </view>
  90. </view>
  91. <!-- 产品信息 -->
  92. <view class="section">
  93. <view class="section-title">产品信息</view>
  94. <view class="info-row">
  95. <text class="label">产品名称:</text>
  96. <text class="value">{{ detail.categoryName }}</text>
  97. </view>
  98. <view class="info-row">
  99. <text class="label">产品编码:</text>
  100. <text class="value">{{ detail.categoryCode }}</text>
  101. </view>
  102. <view class="info-row">
  103. <text class="label">请托数量:</text>
  104. <text class="value"
  105. >{{ detail.totalCount }}{{ detail.measuringUnit }}</text
  106. >
  107. </view>
  108. <view class="info-row">
  109. <text class="label">牌号:</text>
  110. <text class="value">{{ detail.brandNum }}</text>
  111. </view>
  112. <view class="info-row">
  113. <text class="label">批次号:</text>
  114. <text class="value">{{ detail.batchNo }}</text>
  115. </view>
  116. <view class="info-row">
  117. <text class="label">规格:</text>
  118. <text class="value">{{ detail.specification }}</text>
  119. </view>
  120. <view class="info-row">
  121. <text class="label">型号:</text>
  122. <text class="value">{{ detail.modelType }}</text>
  123. </view>
  124. <view class="info-row">
  125. <text class="label">计划编号:</text>
  126. <text class="value">{{ detail.productionPlanCode }}</text>
  127. </view>
  128. <view class="info-row">
  129. <text class="label">生产工单号:</text>
  130. <text class="value">{{ detail.workOrderCode }}</text>
  131. </view>
  132. <view class="info-row">
  133. <text class="label">工艺路线:</text>
  134. <text class="value">{{ detail.produceRoutingName }}</text>
  135. </view>
  136. <view class="info-row">
  137. <text class="label">BOM分类:</text>
  138. <text class="value">{{ getBomTypeText(detail.bomType) }}</text>
  139. </view>
  140. <view class="info-row">
  141. <text class="label">BOM版本:</text>
  142. <text class="value">{{ getBomVersion(detail) }}</text>
  143. </view>
  144. <view class="info-row">
  145. <text class="label">计划开始时间:</text>
  146. <text class="value">{{ detail.planStartTime }}</text>
  147. </view>
  148. <view class="info-row">
  149. <text class="label">计划结束时间:</text>
  150. <text class="value">{{ detail.planCompleteTime }}</text>
  151. </view>
  152. <view class="info-row">
  153. <text class="label">完成时间:</text>
  154. <text class="value">{{ detail.planDeliveryTime }}</text>
  155. </view>
  156. <view class="info-row">
  157. <text class="label">需求描述:</text>
  158. <text class="value">{{ detail.describes }}</text>
  159. </view>
  160. <view v-if="detail.beReason" class="info-row">
  161. <text class="label">原因:</text>
  162. <text class="value danger">{{ detail.beReason }}</text>
  163. </view>
  164. </view>
  165. </scroll-view>
  166. <!-- 底部操作按钮 -->
  167. <view class="footer-btns">
  168. <button class="btn-back" @click="handleBack">返回</button>
  169. <button v-if="canSend" class="btn-send" @click="handleSend">发货</button>
  170. <button v-if="canReceive" class="btn-receive" @click="handleReceive">
  171. 收货
  172. </button>
  173. <button
  174. v-if="canViewSendDetail"
  175. class="btn-detail"
  176. @click="handleSendDetail"
  177. >
  178. 发货详情
  179. </button>
  180. </view>
  181. </view>
  182. </template>
  183. <script>
  184. import { pleaseEntrustDetail } from "@/api/entrust/index";
  185. export default {
  186. data() {
  187. return {
  188. id: "",
  189. detail: {},
  190. };
  191. },
  192. computed: {
  193. canSend() {
  194. return (
  195. this.detail.approvalStatus == 2 &&
  196. (this.detail.sendStatus == 0 ||
  197. !this.detail.sendStatus ||
  198. this.detail.sendStatus == 5)
  199. );
  200. },
  201. canReceive() {
  202. return this.detail.approvalStatus == 2 && this.detail.sendStatus == 3;
  203. },
  204. canViewSendDetail() {
  205. return (
  206. this.detail.approvalStatus == 2 &&
  207. this.detail.sendStatus != 0 &&
  208. this.detail.sendStatus &&
  209. this.detail.sendStatus != 5
  210. );
  211. },
  212. },
  213. onLoad(options) {
  214. this.id = options.id;
  215. this.getDetail();
  216. },
  217. methods: {
  218. async getDetail() {
  219. try {
  220. const res = await pleaseEntrustDetail(this.id);
  221. this.detail = res || {};
  222. } catch (error) {
  223. uni.showToast({
  224. title: "加载失败",
  225. icon: "none",
  226. });
  227. }
  228. },
  229. getTypeText(type) {
  230. const typeMap = { 1: "加工", 2: "装配" };
  231. return typeMap[type] || "";
  232. },
  233. getStatusText(status) {
  234. const map = { 0: "未提交", 1: "已提交", 2: "已发布" };
  235. return map[status] || "";
  236. },
  237. getStatusClass(status) {
  238. const map = {
  239. 0: "status-default",
  240. 1: "status-warning",
  241. 2: "status-success",
  242. };
  243. return map[status] || "status-default";
  244. },
  245. getSendStatusText(sendStatus) {
  246. const map = {
  247. 0: "未发货",
  248. 1: "已发货",
  249. 2: "已收货",
  250. 3: "受托已发",
  251. 4: "请托已收",
  252. 5: "受托拒收",
  253. 6: "请托拒收",
  254. };
  255. return map[sendStatus] || "未发货";
  256. },
  257. getSendStatusClass(sendStatus) {
  258. if (!sendStatus || sendStatus == 0) return "status-default";
  259. if (sendStatus == 5 || sendStatus == 6) return "status-danger";
  260. return "status-success";
  261. },
  262. getApprovalStatusText(approvalStatus) {
  263. const map = { 0: "未提交", 1: "审核中", 2: "审核通过", 3: "审核不通过" };
  264. return map[approvalStatus] || "未提交";
  265. },
  266. getApprovalStatusClass(approvalStatus) {
  267. const map = {
  268. 0: "status-default",
  269. 1: "status-warning",
  270. 2: "status-success",
  271. 3: "status-danger",
  272. };
  273. return map[approvalStatus] || "status-default";
  274. },
  275. getBomTypeText(bomType) {
  276. const map = { 1: "产品(PBOM)", 2: "加工(MBOM)", 3: "装配(ABOM)" };
  277. return map[bomType] || "";
  278. },
  279. getBomVersion(data) {
  280. if (data.bomCategoryName) {
  281. return `${data.bomCategoryName} (V${data.bomCategoryVersions}.0)`;
  282. }
  283. return "";
  284. },
  285. handleBack() {
  286. uni.navigateBack();
  287. },
  288. handleSend() {
  289. uni.navigateTo({
  290. url: `/pages/pda/entrust/goods/goods?id=${this.id}&type=add`,
  291. });
  292. },
  293. handleReceive() {
  294. uni.navigateTo({
  295. url: `/pages/pda/entrust/goods/goods?id=${this.id}&type=receipt`,
  296. });
  297. },
  298. handleSendDetail() {
  299. uni.navigateTo({
  300. url: `/pages/pda/entrust/goods/goods?id=${this.id}&type=detail`,
  301. });
  302. },
  303. },
  304. };
  305. </script>
  306. <style lang="scss" scoped>
  307. .detail-container {
  308. display: flex;
  309. flex-direction: column;
  310. height: 100vh;
  311. background-color: #f5f5f5;
  312. }
  313. .detail-content {
  314. flex: 1;
  315. padding: 20rpx;
  316. }
  317. .section {
  318. background-color: #fff;
  319. border-radius: 12rpx;
  320. padding: 24rpx;
  321. margin-bottom: 20rpx;
  322. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.08);
  323. .section-title {
  324. font-size: 32rpx;
  325. font-weight: bold;
  326. color: #333;
  327. margin-bottom: 24rpx;
  328. padding-bottom: 16rpx;
  329. border-bottom: 2rpx solid #f0f0f0;
  330. }
  331. }
  332. .info-row {
  333. display: flex;
  334. align-items: flex-start;
  335. margin-bottom: 20rpx;
  336. font-size: 28rpx;
  337. .label {
  338. color: #999;
  339. min-width: 200rpx;
  340. }
  341. .value {
  342. flex: 1;
  343. color: #333;
  344. word-break: break-all;
  345. &.highlight {
  346. color: #1890ff;
  347. font-weight: bold;
  348. }
  349. &.danger {
  350. color: #ff4d4f;
  351. }
  352. }
  353. }
  354. .status-tag {
  355. display: inline-block;
  356. padding: 4rpx 16rpx;
  357. border-radius: 4rpx;
  358. font-size: 24rpx;
  359. &.status-default {
  360. background-color: #f0f0f0;
  361. color: #666;
  362. }
  363. &.status-warning {
  364. background-color: #fff7e6;
  365. color: #faad14;
  366. }
  367. &.status-success {
  368. background-color: #f6ffed;
  369. color: #52c41a;
  370. }
  371. &.status-danger {
  372. background-color: #fff1f0;
  373. color: #ff4d4f;
  374. }
  375. }
  376. .footer-btns {
  377. display: flex;
  378. gap: 20rpx;
  379. padding: 20rpx;
  380. background-color: #fff;
  381. box-shadow: 0 -2rpx 8rpx rgba(0, 0, 0, 0.08);
  382. button {
  383. flex: 1;
  384. height: 80rpx;
  385. line-height: 80rpx;
  386. font-size: 30rpx;
  387. border-radius: 12rpx;
  388. }
  389. .btn-back {
  390. background-color: #fff;
  391. color: #666;
  392. border: 1rpx solid #e0e0e0;
  393. }
  394. .btn-send {
  395. background-color: #faad14;
  396. color: #fff;
  397. }
  398. .btn-receive {
  399. background-color: #722ed1;
  400. color: #fff;
  401. }
  402. .btn-detail {
  403. background-color: #1890ff;
  404. color: #fff;
  405. }
  406. }
  407. </style>