DanExecution.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <template>
  2. <div class="dan-execution admin-page">
  3. <el-card>
  4. <div slot="header" class="admin-page-header">
  5. <span class="admin-page-title">DAN测评服务执行管理</span>
  6. <div class="filter-bar">
  7. <el-select v-model="statusFilter" placeholder="执行状态" clearable @change="handleSearch" style="width: 140px; margin-right: 10px;">
  8. <el-option label="全部状态" value="" />
  9. <el-option label="进行中" value="pending" />
  10. <el-option label="已完成" value="completed" />
  11. <el-option label="已确认" value="confirmed" />
  12. </el-select>
  13. <el-button type="primary" icon="el-icon-search" @click="handleSearch">搜索</el-button>
  14. </div>
  15. </div>
  16. <el-table :data="list" v-loading="loading" border stripe empty-text="暂无执行记录">
  17. <el-table-column label="ID" prop="id" width="80" />
  18. <el-table-column label="订单ID" prop="assessmentOrderId" width="100" />
  19. <el-table-column label="家庭ID" prop="familyId" width="100" />
  20. <el-table-column label="孩子ID" prop="childId" width="100" />
  21. <el-table-column label="评估师ID" prop="assessorId" width="100" />
  22. <el-table-column label="评估师状态" width="130">
  23. <template slot-scope="{ row }">
  24. <div class="status-cell">
  25. <i :class="executionIconClass(row.assessorStatus)" :style="{ color: executionIconColor(row.assessorStatus) }"></i>
  26. <el-tag :type="executionStatusType(row.assessorStatus)" size="mini">
  27. {{ executionStatusLabel(row.assessorStatus) }}
  28. </el-tag>
  29. </div>
  30. </template>
  31. </el-table-column>
  32. <el-table-column label="规划师ID" prop="plannerId" width="100" />
  33. <el-table-column label="规划师状态" width="130">
  34. <template slot-scope="{ row }">
  35. <div v-if="row.plannerId" class="status-cell">
  36. <i :class="executionIconClass(row.plannerStatus)" :style="{ color: executionIconColor(row.plannerStatus) }"></i>
  37. <el-tag :type="executionStatusType(row.plannerStatus)" size="mini">
  38. {{ executionStatusLabel(row.plannerStatus) }}
  39. </el-tag>
  40. </div>
  41. <span v-else style="color: #999;">—</span>
  42. </template>
  43. </el-table-column>
  44. <el-table-column label="用户确认" width="110">
  45. <template slot-scope="{ row }">
  46. <div class="status-cell">
  47. <i :class="row.userConfirmed === 1 ? 'el-icon-circle-check' : 'el-icon-time'"
  48. :style="{ color: row.userConfirmed === 1 ? '#67c23a' : '#909399' }"></i>
  49. <el-tag :type="row.userConfirmed === 1 ? 'success' : 'info'" size="mini">
  50. {{ row.userConfirmed === 1 ? '已确认' : '未确认' }}
  51. </el-tag>
  52. </div>
  53. </template>
  54. </el-table-column>
  55. <el-table-column label="创建时间" width="160">
  56. <template slot-scope="{ row }">{{ formatTime(row.createdAt) }}</template>
  57. </el-table-column>
  58. <el-table-column label="操作" width="160" fixed="right">
  59. <template slot-scope="{ row }">
  60. <el-button size="mini" type="primary" icon="el-icon-view" plain @click="viewDetail(row)">详情</el-button>
  61. </template>
  62. </el-table-column>
  63. </el-table>
  64. <el-pagination
  65. @size-change="handleSizeChange"
  66. @current-change="handleCurrentChange"
  67. :current-page="page"
  68. :page-sizes="[10, 20, 50]"
  69. :page-size="size"
  70. :total="total"
  71. layout="total, sizes, prev, pager, next, jumper"
  72. class="pagination-wrap"
  73. />
  74. </el-card>
  75. <!-- 详情 Dialog -->
  76. <el-dialog title="执行记录详情" :visible.sync="detailDialogVisible" width="700px">
  77. <div v-if="currentRecord" v-loading="detailLoading">
  78. <el-descriptions :column="2" border size="small">
  79. <el-descriptions-item label="执行ID">{{ currentRecord.id }}</el-descriptions-item>
  80. <el-descriptions-item label="订单ID">{{ currentRecord.assessmentOrderId }}</el-descriptions-item>
  81. <el-descriptions-item label="家庭ID">{{ currentRecord.familyId }}</el-descriptions-item>
  82. <el-descriptions-item label="孩子ID">{{ currentRecord.childId }}</el-descriptions-item>
  83. <el-descriptions-item label="评估师ID">{{ currentRecord.assessorId }}</el-descriptions-item>
  84. <el-descriptions-item label="评估师状态">
  85. <div class="status-cell">
  86. <i :class="executionIconClass(currentRecord.assessorStatus)" :style="{ color: executionIconColor(currentRecord.assessorStatus) }"></i>
  87. <el-tag :type="executionStatusType(currentRecord.assessorStatus)" size="mini">
  88. {{ executionStatusLabel(currentRecord.assessorStatus) }}
  89. </el-tag>
  90. </div>
  91. </el-descriptions-item>
  92. <el-descriptions-item label="评估师完成时间">{{ formatTime(currentRecord.assessorCompletedAt) }}</el-descriptions-item>
  93. <el-descriptions-item label="评估师备注">{{ currentRecord.assessorNotes || '-' }}</el-descriptions-item>
  94. <el-descriptions-item label="规划师ID">{{ currentRecord.plannerId || '-' }}</el-descriptions-item>
  95. <el-descriptions-item label="规划师状态">
  96. <div v-if="currentRecord.plannerId" class="status-cell">
  97. <i :class="executionIconClass(currentRecord.plannerStatus)" :style="{ color: executionIconColor(currentRecord.plannerStatus) }"></i>
  98. <el-tag :type="executionStatusType(currentRecord.plannerStatus)" size="mini">
  99. {{ executionStatusLabel(currentRecord.plannerStatus) }}
  100. </el-tag>
  101. </div>
  102. <span v-else>无</span>
  103. </el-descriptions-item>
  104. <el-descriptions-item label="规划师完成时间">{{ formatTime(currentRecord.plannerCompletedAt) }}</el-descriptions-item>
  105. <el-descriptions-item label="规划师备注">{{ currentRecord.plannerNotes || '-' }}</el-descriptions-item>
  106. <el-descriptions-item label="用户确认">
  107. <div class="status-cell">
  108. <i :class="currentRecord.userConfirmed === 1 ? 'el-icon-circle-check' : 'el-icon-time'"
  109. :style="{ color: currentRecord.userConfirmed === 1 ? '#67c23a' : '#909399' }"></i>
  110. <el-tag :type="currentRecord.userConfirmed === 1 ? 'success' : 'info'" size="mini">
  111. {{ currentRecord.userConfirmed === 1 ? '已确认' : '未确认' }}
  112. </el-tag>
  113. </div>
  114. </el-descriptions-item>
  115. <el-descriptions-item label="确认时间">{{ formatTime(currentRecord.userConfirmedAt) }}</el-descriptions-item>
  116. <el-descriptions-item label="创建时间">{{ formatTime(currentRecord.createdAt) }}</el-descriptions-item>
  117. <el-descriptions-item label="更新时间">{{ formatTime(currentRecord.updatedAt) }}</el-descriptions-item>
  118. </el-descriptions>
  119. <div v-if="currentRecord.assessorSettlement || currentRecord.plannerSettlement" style="margin-top: 20px;">
  120. <h4>结算信息</h4>
  121. <el-descriptions :column="2" border size="small">
  122. <el-descriptions-item v-if="currentRecord.assessorSettlement" label="评估师结算金额">
  123. ¥{{ (currentRecord.assessorSettlement.commissionAmount / 100).toFixed(2) }}
  124. </el-descriptions-item>
  125. <el-descriptions-item v-if="currentRecord.assessorSettlement" label="评估师结算状态">
  126. <el-tag :type="settlementStatusType(currentRecord.assessorSettlement.status)" size="mini">
  127. {{ settlementStatusLabel(currentRecord.assessorSettlement.status) }}
  128. </el-tag>
  129. </el-descriptions-item>
  130. <el-descriptions-item v-if="currentRecord.plannerSettlement" label="规划师结算金额">
  131. ¥{{ (currentRecord.plannerSettlement.commissionAmount / 100).toFixed(2) }}
  132. </el-descriptions-item>
  133. <el-descriptions-item v-if="currentRecord.plannerSettlement" label="规划师结算状态">
  134. <el-tag :type="settlementStatusType(currentRecord.plannerSettlement.status)" size="mini">
  135. {{ settlementStatusLabel(currentRecord.plannerSettlement.status) }}
  136. </el-tag>
  137. </el-descriptions-item>
  138. </el-descriptions>
  139. </div>
  140. </div>
  141. </el-dialog>
  142. </div>
  143. </template>
  144. <script>
  145. export default {
  146. name: 'DanExecution',
  147. data() {
  148. return {
  149. list: [],
  150. loading: false,
  151. page: 1,
  152. size: 10,
  153. total: 0,
  154. statusFilter: '',
  155. detailDialogVisible: false,
  156. detailLoading: false,
  157. currentRecord: null
  158. }
  159. },
  160. created() {
  161. this.loadData()
  162. },
  163. methods: {
  164. async loadData() {
  165. this.loading = true
  166. try {
  167. // TODO: 调用后端 API 获取执行记录列表
  168. // const res = await this.$axios.post('/api/admin/dan-execution/list', {
  169. // page: this.page,
  170. // size: this.size,
  171. // status: this.statusFilter
  172. // })
  173. // this.list = res.data.data.records
  174. // this.total = res.data.data.total
  175. this.list = []
  176. this.total = 0
  177. } catch (e) {
  178. console.error('加载执行记录失败', e)
  179. this.$message.error('加载失败')
  180. } finally {
  181. this.loading = false
  182. }
  183. },
  184. async viewDetail(row) {
  185. this.detailDialogVisible = true
  186. this.detailLoading = true
  187. try {
  188. const res = await this.$axios.post(`/api/dan-execution/detail/${row.id}`)
  189. if (res.data.code === 200) {
  190. this.currentRecord = res.data.data
  191. } else {
  192. this.$message.error(res.data.message || '加载失败')
  193. }
  194. } catch (e) {
  195. console.error('加载详情失败', e)
  196. this.$message.error('加载失败')
  197. } finally {
  198. this.detailLoading = false
  199. }
  200. },
  201. handleSearch() {
  202. this.page = 1
  203. this.loadData()
  204. },
  205. handleSizeChange(val) {
  206. this.size = val
  207. this.loadData()
  208. },
  209. handleCurrentChange(val) {
  210. this.page = val
  211. this.loadData()
  212. },
  213. formatTime(time) {
  214. if (!time) return '-'
  215. return new Date(time).toLocaleString('zh-CN')
  216. },
  217. executionStatusType(status) {
  218. if (status === 'completed') return 'success'
  219. if (status === 'pending') return 'warning'
  220. if (status === 'rejected') return 'danger'
  221. return 'info'
  222. },
  223. executionStatusLabel(status) {
  224. if (status === 'completed') return '已完成'
  225. if (status === 'pending') return '进行中'
  226. if (status === 'rejected') return '已拒绝'
  227. return status || '-'
  228. },
  229. executionIconClass(status) {
  230. if (status === 'completed') return 'el-icon-circle-check'
  231. if (status === 'pending') return 'el-icon-loading'
  232. if (status === 'rejected') return 'el-icon-circle-close'
  233. return 'el-icon-info'
  234. },
  235. executionIconColor(status) {
  236. if (status === 'completed') return '#67c23a'
  237. if (status === 'pending') return '#e6a23c'
  238. if (status === 'rejected') return '#f56c6c'
  239. return '#909399'
  240. },
  241. settlementStatusType(status) {
  242. if (status === 'settled') return 'success'
  243. if (status === 'pending') return 'warning'
  244. if (status === 'failed') return 'danger'
  245. return 'info'
  246. },
  247. settlementStatusLabel(status) {
  248. if (status === 'settled') return '已结算'
  249. if (status === 'pending') return '待结算'
  250. if (status === 'failed') return '失败'
  251. return status || '-'
  252. }
  253. }
  254. }
  255. </script>
  256. <style scoped>
  257. .admin-page {
  258. padding: 20px;
  259. }
  260. .admin-page-header {
  261. display: flex;
  262. justify-content: space-between;
  263. align-items: center;
  264. }
  265. .admin-page-title {
  266. font-size: 18px;
  267. font-weight: bold;
  268. }
  269. .filter-bar {
  270. display: flex;
  271. align-items: center;
  272. }
  273. .status-cell {
  274. display: flex;
  275. align-items: center;
  276. gap: 6px;
  277. }
  278. .status-cell i {
  279. font-size: 16px;
  280. }
  281. .pagination-wrap {
  282. margin-top: 20px;
  283. text-align: right;
  284. }
  285. </style>