index.uvue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. <template>
  2. <view class="detail-page">
  3. <scroll-view class="detail-content" :scroll-y="true">
  4. <!-- 基础信息 -->
  5. <view class="info-section">
  6. <view class="section-title">
  7. <text class="section-title-text">基础信息</text>
  8. </view>
  9. <view class="info-card">
  10. <view class="info-item">
  11. <text class="info-label">承包商名称</text>
  12. <text class="info-value">{{ detailData.contractorName }}</text>
  13. </view>
  14. <view class="info-item">
  15. <text class="info-label">统一社会信用代码</text>
  16. <text class="info-value">{{ detailData.creditCode }}</text>
  17. </view>
  18. <view class="info-item">
  19. <text class="info-label">法定代表人</text>
  20. <text class="info-value">{{ detailData.legalRepresentative }}</text>
  21. </view>
  22. <view class="info-item">
  23. <text class="info-label">联系电话</text>
  24. <text class="info-value">{{ detailData.contactPhone }}</text>
  25. </view>
  26. <view class="info-item">
  27. <text class="info-label">公司地址</text>
  28. <text class="info-value">{{ detailData.companyAddress }}</text>
  29. </view>
  30. </view>
  31. </view>
  32. <!-- 资质信息 -->
  33. <view class="info-section">
  34. <view class="section-title">
  35. <text class="section-title-text">资质信息</text>
  36. </view>
  37. <view class="info-card">
  38. <view class="info-item">
  39. <text class="info-label">资质等级</text>
  40. <text class="info-value highlight">{{ detailData.qualificationLevel }}</text>
  41. </view>
  42. <view class="info-item">
  43. <text class="info-label">资质证书号</text>
  44. <text class="info-value">{{ detailData.qualificationCertNo }}</text>
  45. </view>
  46. <view class="info-item full-width">
  47. <text class="info-label">经营范围</text>
  48. <text class="info-value">{{ detailData.businessScope }}</text>
  49. </view>
  50. </view>
  51. </view>
  52. <!-- 银行信息 -->
  53. <view class="info-section">
  54. <view class="section-title">
  55. <text class="section-title-text">银行信息</text>
  56. </view>
  57. <view class="info-card">
  58. <view class="info-item">
  59. <text class="info-label">开户银行</text>
  60. <text class="info-value">{{ detailData.bankName }}</text>
  61. </view>
  62. <view class="info-item">
  63. <text class="info-label">银行账号</text>
  64. <text class="info-value">{{ detailData.bankAccount }}</text>
  65. </view>
  66. </view>
  67. </view>
  68. <!-- 其他信息 -->
  69. <view class="info-section">
  70. <view class="section-title">
  71. <text class="section-title-text">其他信息</text>
  72. </view>
  73. <view class="info-card">
  74. <view class="info-item">
  75. <text class="info-label">创建时间</text>
  76. <text class="info-value">{{ detailData.createTime }}</text>
  77. </view>
  78. <view class="info-item">
  79. <text class="info-label">创建人</text>
  80. <text class="info-value">{{ detailData.createBy }}</text>
  81. </view>
  82. <view class="info-item full-width">
  83. <text class="info-label">备注</text>
  84. <text class="info-value">{{ detailData.remark }}</text>
  85. </view>
  86. </view>
  87. </view>
  88. </scroll-view>
  89. <!-- 加载中状态 -->
  90. <view v-if="loading" class="loading-mask">
  91. <text class="loading-text">加载中...</text>
  92. </view>
  93. </view>
  94. </template>
  95. <script setup lang="uts">
  96. import { ref } from 'vue'
  97. import type { ContractorInfo } from '../../../types/workbench'
  98. import { getContractorById } from '../../../api/workbench/detail'
  99. // 详情数据
  100. const detailData = ref<ContractorInfo>({
  101. id: '',
  102. createBy: '',
  103. createTime: '',
  104. updateBy: null,
  105. updateTime: null,
  106. isDeleted: 0,
  107. remark: '',
  108. creditCode: '',
  109. contractorName: '',
  110. companyAddress: '',
  111. legalRepresentative: '',
  112. contactPhone: '',
  113. qualificationLevel: '',
  114. qualificationCertNo: '',
  115. businessScope: '',
  116. bankName: '',
  117. bankAccount: ''
  118. })
  119. const loading = ref<boolean>(false)
  120. // 加载详情数据
  121. const loadDetail = async (id: string): Promise<void> => {
  122. try {
  123. loading.value = true
  124. const result = await getContractorById(id)
  125. // 提取响应数据
  126. const resultObj = result as UTSJSONObject
  127. const success = resultObj['success'] as boolean
  128. const data = resultObj['data'] as UTSJSONObject | null
  129. if (success && data != null) {
  130. // 转换数据
  131. const contractorInfo: ContractorInfo = {
  132. id: data['id'] as string,
  133. createBy: data['createBy'] as string,
  134. createTime: data['createTime'] as string,
  135. updateBy: data['updateBy'] as string | null,
  136. updateTime: data['updateTime'] as string | null,
  137. isDeleted: data['isDeleted'] as number,
  138. remark: data['remark'] as string,
  139. creditCode: data['creditCode'] as string,
  140. contractorName: data['contractorName'] as string,
  141. companyAddress: data['companyAddress'] as string,
  142. legalRepresentative: data['legalRepresentative'] as string,
  143. contactPhone: data['contactPhone'] as string,
  144. qualificationLevel: data['qualificationLevel'] as string,
  145. qualificationCertNo: data['qualificationCertNo'] as string,
  146. businessScope: data['businessScope'] as string,
  147. bankName: data['bankName'] as string,
  148. bankAccount: data['bankAccount'] as string
  149. }
  150. detailData.value = contractorInfo
  151. } else {
  152. const msg = resultObj['msg'] as string | null
  153. uni.showToast({
  154. title: msg ?? '加载失败',
  155. icon: 'none'
  156. })
  157. }
  158. } catch (e: any) {
  159. uni.showToast({
  160. title: e.message ?? '加载失败',
  161. icon: 'none'
  162. })
  163. } finally {
  164. loading.value = false
  165. }
  166. }
  167. // 页面加载
  168. onLoad((options: any) => {
  169. const params = options as UTSJSONObject
  170. const id = params['id'] as string | null
  171. if (id != null) {
  172. loadDetail(id)
  173. }
  174. })
  175. </script>
  176. <style lang="scss">
  177. .detail-page {
  178. flex: 1;
  179. background-color: #e8f0f9;
  180. }
  181. .detail-content {
  182. flex: 1;
  183. padding: 20rpx 0;
  184. }
  185. .info-section {
  186. margin: 0 30rpx 24rpx;
  187. .section-title {
  188. position: relative;
  189. padding-left: 20rpx;
  190. margin-bottom: 20rpx;
  191. &::before {
  192. // content: '';
  193. position: absolute;
  194. left: 0;
  195. top: 50%;
  196. transform: translateY(-50%);
  197. width: 8rpx;
  198. height: 32rpx;
  199. background-color: #007aff;
  200. border-radius: 4rpx;
  201. }
  202. &-text {
  203. font-size: 32rpx;
  204. font-weight: bold;
  205. color: #333333;
  206. }
  207. }
  208. .info-card {
  209. background-color: #ffffff;
  210. border-radius: 16rpx;
  211. padding: 30rpx;
  212. .info-item {
  213. flex-direction: row;
  214. padding: 20rpx 0;
  215. border-bottom: 1rpx solid #f0f0f0;
  216. &:last-child {
  217. border-bottom: none;
  218. }
  219. &.full-width {
  220. flex-direction: column;
  221. .info-label {
  222. margin-bottom: 12rpx;
  223. }
  224. .info-value {
  225. line-height: 44rpx;
  226. }
  227. }
  228. .info-label {
  229. width: 240rpx;
  230. font-size: 28rpx;
  231. color: #666666;
  232. white-space: nowrap;
  233. }
  234. .info-value {
  235. flex: 1;
  236. font-size: 28rpx;
  237. color: #333333;
  238. text-align: right;
  239. &.highlight {
  240. color: #007aff;
  241. font-weight: bold;
  242. }
  243. }
  244. }
  245. }
  246. }
  247. .loading-mask {
  248. position: absolute;
  249. top: 0;
  250. left: 0;
  251. right: 0;
  252. bottom: 0;
  253. justify-content: center;
  254. align-items: center;
  255. background-color: rgba(0, 0, 0, 0.3);
  256. .loading-text {
  257. padding: 30rpx 60rpx;
  258. background-color: rgba(0, 0, 0, 0.7);
  259. color: #ffffff;
  260. font-size: 28rpx;
  261. border-radius: 12rpx;
  262. }
  263. }
  264. </style>