detail.vue 11 KB

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