CampaignAuditDetail.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. <template>
  2. <div class="campaign-audit-detail" v-if="audit">
  3. <el-card>
  4. <template #header>
  5. <div class="header">
  6. <span class="title">发放计划审核详情</span>
  7. </div>
  8. </template>
  9. <el-card shadow="never" class="section-card">
  10. <template #header>
  11. <div class="section-title">发放计划信息</div>
  12. </template>
  13. <el-descriptions :column="2" border>
  14. <el-descriptions-item label="发放计划 ID">{{ audit.bizId }}</el-descriptions-item>
  15. <el-descriptions-item label="发放计划名称">{{ audit.bizName }}</el-descriptions-item>
  16. <el-descriptions-item label="审核类型">
  17. <el-tag :type="auditTypeTag(audit.auditType)" size="small">
  18. {{ auditTypeLabel(audit.auditType) }}
  19. </el-tag>
  20. </el-descriptions-item>
  21. <el-descriptions-item label="状态">
  22. <el-tag :type="auditStatusTag(audit.auditStatus)" size="small">
  23. {{ auditStatusLabel(audit.auditStatus) }}
  24. </el-tag>
  25. </el-descriptions-item>
  26. <el-descriptions-item label="获取方式">
  27. <el-tag :type="snapshot.grantMode === 'direct' ? 'warning' : 'success'" size="small">
  28. {{ snapshot.grantMode === 'direct' ? '直接发放' : '用户领取' }}
  29. </el-tag>
  30. </el-descriptions-item>
  31. <el-descriptions-item label="单客户权益数量">{{ grantSummary }}</el-descriptions-item>
  32. <el-descriptions-item label="开始时间">{{ snapshot.startTime || '-' }}</el-descriptions-item>
  33. <el-descriptions-item label="结束时间">{{ snapshot.endTime || '-' }}</el-descriptions-item>
  34. <el-descriptions-item label="选择客群" :span="2">
  35. <template v-if="(snapshot.crowdList || []).length">
  36. <el-tag
  37. v-for="cid in snapshot.crowdList"
  38. :key="cid"
  39. size="small"
  40. type="info"
  41. style="margin-right:6px;margin-top:4px"
  42. >{{ crowdLabel(cid) }}</el-tag>
  43. </template>
  44. <span v-else>-</span>
  45. </el-descriptions-item>
  46. <el-descriptions-item label="选择权益" :span="2">
  47. <template v-if="(snapshot.equityList || []).length">
  48. <el-tag
  49. v-for="pid in snapshot.equityList"
  50. :key="pid"
  51. size="small"
  52. style="margin-right:6px;margin-top:4px"
  53. >{{ equityLabel(pid) }}</el-tag>
  54. </template>
  55. <span v-else>-</span>
  56. </el-descriptions-item>
  57. <el-descriptions-item label="权益有效期" :span="2">{{ validitySummary }}</el-descriptions-item>
  58. <el-descriptions-item label="短信通知" :span="2">
  59. <div class="sms-info-row">
  60. <span class="sms-tpl-name">{{ smsTemplateName }}</span>
  61. </div>
  62. <div v-if="snapshot.smsTemplate" class="sms-template-preview">{{ snapshot.smsTemplate }}</div>
  63. </el-descriptions-item>
  64. </el-descriptions>
  65. </el-card>
  66. <el-card shadow="never" class="section-card">
  67. <template #header>
  68. <div class="section-title">提交信息</div>
  69. </template>
  70. <el-descriptions :column="2" border>
  71. <el-descriptions-item label="提交人">{{ audit.submitterName }}</el-descriptions-item>
  72. <el-descriptions-item label="提交时间">{{ audit.submitTime }}</el-descriptions-item>
  73. </el-descriptions>
  74. </el-card>
  75. <div class="action-bar">
  76. <el-button @click="goBack">返回</el-button>
  77. <template v-if="audit.auditStatus === 'pending'">
  78. <el-button type="danger" @click="handleReject">驳回</el-button>
  79. <el-button type="primary" @click="handleApprove">通过</el-button>
  80. </template>
  81. </div>
  82. </el-card>
  83. </div>
  84. </template>
  85. <script>
  86. import request from '@/utils/request'
  87. import { ElMessage, ElMessageBox } from 'element-plus'
  88. import crowdTaskStore from '@/store/crowdTaskStore'
  89. const grantCycleLabelMap = { total: '整个周期', monthly: '每月', quarterly: '每季度', yearly: '每年' }
  90. const SMS_TEMPLATE_NAME_MAP = {
  91. GRANT_SMS_001: '发放成功通用模板',
  92. GRANT_SMS_002: '发放成功-含查看入口',
  93. GRANT_SMS_003: '发放成功-简洁版'
  94. }
  95. export default {
  96. name: 'CampaignAuditDetail',
  97. data() {
  98. return { audit: null, equityOptions: [] }
  99. },
  100. computed: {
  101. crowdOptions() {
  102. return crowdTaskStore.list
  103. },
  104. snapshot() {
  105. return (this.audit && this.audit.snapshot) || {}
  106. },
  107. grantSummary() {
  108. const cycle = grantCycleLabelMap[this.snapshot.grantCycle] || '整个周期'
  109. return `${cycle} ${this.snapshot.grantQuantity || 0} 个`
  110. },
  111. validitySummary() {
  112. const v = this.snapshot.validity
  113. if (!v) return '-'
  114. if (v.type === 'fixed') {
  115. if (!v.fixedRange || v.fixedRange.length !== 2) return '固定日期'
  116. return `${v.fixedRange[0]} 至 ${v.fixedRange[1]}`
  117. }
  118. if (v.type === 'relative') return `自发放起 ${v.relativeDays || 0} 天内有效`
  119. return '-'
  120. },
  121. smsTemplateName() {
  122. return SMS_TEMPLATE_NAME_MAP[this.snapshot.smsTemplateId] || this.snapshot.smsTemplateId || '-'
  123. }
  124. },
  125. async created() {
  126. await this.fetchEquityOptions()
  127. this.loadAudit()
  128. },
  129. methods: {
  130. async fetchEquityOptions() {
  131. const res = await request.get('/api/equity/list', { params: { shelfStatus: '已上架' } })
  132. this.equityOptions = res.data || []
  133. },
  134. equityLabel(productId) {
  135. const m = this.equityOptions.find(i => i.productId === productId)
  136. return m ? `${m.equityName} (${m.productId})` : productId
  137. },
  138. crowdLabel(crowdId) {
  139. const m = this.crowdOptions.find(i => i.id === crowdId)
  140. return m ? `${m.name} (${m.id})` : crowdId
  141. },
  142. loadAudit() {
  143. const id = this.$route.params.id
  144. request.get('/api/campaign-audit/detail', { params: { id } }).then(res => {
  145. this.audit = res.data
  146. if (!this.audit) {
  147. ElMessage.error('审核单不存在')
  148. this.$router.replace('/customization/hsbc/campaign-audit')
  149. }
  150. }).catch(() => {})
  151. },
  152. auditTypeLabel(t) {
  153. return { new: '新增', end: '结束' }[t] || t
  154. },
  155. auditTypeTag(t) {
  156. return { new: 'success', end: 'warning' }[t] || ''
  157. },
  158. auditStatusLabel(s) {
  159. return { pending: '待审核', approved: '已通过', rejected: '已驳回' }[s] || s
  160. },
  161. auditStatusTag(s) {
  162. return { pending: 'warning', approved: 'success', rejected: 'danger' }[s] || ''
  163. },
  164. handleApprove() {
  165. ElMessageBox.confirm('确定通过该发放计划审核吗?', '提示', {
  166. confirmButtonText: '通过',
  167. cancelButtonText: '取消',
  168. type: 'success'
  169. }).then(() => {
  170. request.post('/api/campaign-audit/approve', { id: this.audit.id }).then(() => {
  171. ElMessage.success('审核通过')
  172. this.$router.push('/customization/hsbc/campaign-audit')
  173. }).catch(() => {})
  174. }).catch(() => {})
  175. },
  176. handleReject() {
  177. ElMessageBox.confirm('确定驳回该发放计划审核吗?', '提示', {
  178. confirmButtonText: '驳回',
  179. cancelButtonText: '取消',
  180. type: 'warning'
  181. }).then(() => {
  182. request.post('/api/campaign-audit/reject', { id: this.audit.id }).then(() => {
  183. ElMessage.success('已驳回')
  184. this.$router.push('/customization/hsbc/campaign-audit')
  185. }).catch(() => {})
  186. }).catch(() => {})
  187. },
  188. goBack() {
  189. this.$router.push('/customization/hsbc/campaign-audit')
  190. }
  191. }
  192. }
  193. </script>
  194. <style scoped>
  195. .campaign-audit-detail { padding: 0; }
  196. .header { display: flex; align-items: center; justify-content: center; }
  197. .title { font-size: 16px; font-weight: 600; color: #409EFF; }
  198. .section-card { margin-bottom: 16px; border: none; }
  199. .section-card >>> .el-card__header {
  200. padding: 12px 20px;
  201. background: #fafafa;
  202. border-bottom: 1px solid #ebeef5;
  203. }
  204. .section-title { font-size: 14px; font-weight: 600; color: #303133; }
  205. .sms-info-row { display: flex; align-items: center; gap: 8px; }
  206. .sms-tpl-name { color: #303133; }
  207. .sms-template-preview {
  208. margin-top: 8px;
  209. padding: 10px 12px;
  210. background: #f5f7fa;
  211. border: 1px dashed #dcdfe6;
  212. border-radius: 4px;
  213. font-size: 13px;
  214. color: #606266;
  215. line-height: 1.6;
  216. word-break: break-all;
  217. }
  218. .action-bar {
  219. display: flex;
  220. justify-content: center;
  221. gap: 12px;
  222. margin-top: 20px;
  223. padding-top: 20px;
  224. border-top: 1px solid #ebeef5;
  225. }
  226. </style>