AuditDetail.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569
  1. <template>
  2. <div class="audit-detail" v-if="audit">
  3. <el-card>
  4. <!-- 步骤条 -->
  5. <el-steps :active="activeStep" simple style="margin-bottom: 20px;">
  6. <el-step title="权益信息">
  7. <template #icon><el-icon><InfoFilled /></el-icon></template>
  8. </el-step>
  9. <el-step title="设置规则">
  10. <template #icon><el-icon><Setting /></el-icon></template>
  11. </el-step>
  12. <el-step title="更多设置">
  13. <template #icon><el-icon><Monitor /></el-icon></template>
  14. </el-step>
  15. </el-steps>
  16. <!-- 步骤 0:权益信息 -->
  17. <div v-show="activeStep === 0">
  18. <el-card shadow="never" class="section-card">
  19. <template #header>
  20. <div class="section-title">基本信息</div>
  21. </template>
  22. <el-form :model="form" label-width="120px" label-position="left">
  23. <el-row :gutter="20">
  24. <el-col :span="8">
  25. <el-form-item label="是否权益平台兑换" label-width="150px">
  26. <el-radio-group v-model="form.isPlatformExchange" disabled>
  27. <el-radio-button label="是"></el-radio-button>
  28. <el-radio-button label="否"></el-radio-button>
  29. </el-radio-group>
  30. </el-form-item>
  31. </el-col>
  32. <el-col :span="8" v-if="form.isPlatformExchange === '是'">
  33. <el-form-item label="商品类型">
  34. <el-radio-group v-model="form.productType" disabled>
  35. <el-radio-button label="券码"></el-radio-button>
  36. <el-radio-button label="微信立减金"></el-radio-button>
  37. </el-radio-group>
  38. </el-form-item>
  39. </el-col>
  40. <el-col :span="8" v-if="form.isPlatformExchange === '是' && form.productType === '微信立减金'">
  41. <el-form-item label="选择权益">
  42. <el-input :value="form.rongshuProduct" readonly></el-input>
  43. </el-form-item>
  44. </el-col>
  45. </el-row>
  46. <el-row :gutter="20">
  47. <el-col :span="8" v-if="form.isPlatformExchange === '否'">
  48. <el-form-item label="外部权益链接">
  49. <el-input :value="form.externalLink" readonly></el-input>
  50. </el-form-item>
  51. </el-col>
  52. <el-col :span="8" v-if="form.isPlatformExchange === '否'">
  53. <el-form-item label="是否有详情页">
  54. <el-radio-group v-model="form.externalJumpMethod" disabled>
  55. <el-radio-button label="没有"></el-radio-button>
  56. <el-radio-button label="有"></el-radio-button>
  57. </el-radio-group>
  58. </el-form-item>
  59. </el-col>
  60. </el-row>
  61. <el-row :gutter="20">
  62. <el-col :span="8">
  63. <el-form-item label="权益名称">
  64. <el-input :value="form.equityName" readonly></el-input>
  65. </el-form-item>
  66. </el-col>
  67. <el-col :span="8">
  68. <el-form-item label="权益副标题">
  69. <el-input :value="form.subTitle" readonly></el-input>
  70. </el-form-item>
  71. </el-col>
  72. <el-col :span="8" v-if="form.isPlatformExchange === '是' && form.productType === '券码'">
  73. <el-form-item label="SIP商品编号">
  74. <el-input :value="form.skuNo" readonly></el-input>
  75. </el-form-item>
  76. </el-col>
  77. </el-row>
  78. <el-row :gutter="20">
  79. <el-col :span="8">
  80. <el-form-item label="权益图标">
  81. <div v-if="form.listIcon && form.listIcon.length" class="image-preview">
  82. <img :src="form.listIcon[0]" class="preview-img" />
  83. </div>
  84. <span v-else class="no-data">暂无图片</span>
  85. </el-form-item>
  86. </el-col>
  87. </el-row>
  88. </el-form>
  89. </el-card>
  90. <el-card v-if="shouldShowDetailCard" shadow="never" class="section-card">
  91. <template #header>
  92. <div class="section-title">详情信息</div>
  93. </template>
  94. <el-form :model="form" label-width="120px" label-position="left">
  95. <el-row :gutter="20">
  96. <el-col :span="8">
  97. <el-form-item label="权益主图">
  98. <div v-if="form.mainImage && form.mainImage.length" class="image-preview">
  99. <img :src="form.mainImage[0]" class="preview-img" />
  100. </div>
  101. <span v-else class="no-data">暂无图片</span>
  102. </el-form-item>
  103. </el-col>
  104. </el-row>
  105. <el-row :gutter="20">
  106. <el-col :span="12">
  107. <el-form-item label="权益介绍">
  108. <el-input :value="form.introduction" type="textarea" :rows="4" readonly></el-input>
  109. </el-form-item>
  110. </el-col>
  111. </el-row>
  112. <el-row :gutter="20">
  113. <el-col :span="12">
  114. <el-form-item label="权益有效期">
  115. <el-input
  116. :value="form.validityType === 'fromGrantPlan' ? '取自发放计划' : (form.validityText || '-')"
  117. readonly
  118. ></el-input>
  119. </el-form-item>
  120. </el-col>
  121. </el-row>
  122. <el-row :gutter="20">
  123. <el-col :span="12">
  124. <el-form-item label="权益内容">
  125. <div class="rich-text-view" v-html="form.overview || '暂无内容'"></div>
  126. </el-form-item>
  127. </el-col>
  128. <el-col :span="12">
  129. <el-form-item label="权益说明">
  130. <div class="rich-text-view" v-html="form.details || '暂无内容'"></div>
  131. </el-form-item>
  132. </el-col>
  133. </el-row>
  134. <el-row :gutter="20" v-if="form.isPlatformExchange === '是' && form.productType === '券码'">
  135. <el-col :span="8">
  136. <el-form-item label="领取成功按钮">
  137. <el-input :value="form.successButtonText" readonly></el-input>
  138. </el-form-item>
  139. </el-col>
  140. </el-row>
  141. </el-form>
  142. </el-card>
  143. </div>
  144. <!-- 步骤 1:规则 -->
  145. <div v-show="activeStep === 1">
  146. <el-card shadow="never" class="section-card">
  147. <template #header>
  148. <div class="section-title">展示规则</div>
  149. </template>
  150. <el-form :model="form" label-width="120px" label-position="left">
  151. <el-form-item label="展示时间限制">
  152. <el-switch v-model="form.showTimeEnabled" disabled></el-switch>
  153. <template v-if="form.showTimeEnabled">
  154. <div class="rule-pane">
  155. <el-input :value="form.showStartTime" readonly style="width: 240px;"></el-input>
  156. <span style="margin: 0 8px;">-</span>
  157. <el-input :value="form.showEndTime" readonly style="width: 240px;"></el-input>
  158. </div>
  159. </template>
  160. </el-form-item>
  161. <el-form-item label="展示客群限制">
  162. <el-switch v-model="form.showGroupEnabled" disabled></el-switch>
  163. <template v-if="form.showGroupEnabled">
  164. <div class="rule-pane">
  165. <el-input :value="(form.showGroupTagIds || []).join('、')" readonly></el-input>
  166. </div>
  167. </template>
  168. </el-form-item>
  169. </el-form>
  170. </el-card>
  171. <el-card shadow="never" class="section-card">
  172. <template #header>
  173. <div class="section-title">领取规则</div>
  174. </template>
  175. <el-form :model="form" label-width="120px" label-position="left">
  176. <el-form-item label="领取时间限制">
  177. <el-switch v-model="form.claimTimeEnabled" disabled></el-switch>
  178. <template v-if="form.claimTimeEnabled">
  179. <div class="rule-pane">
  180. <el-input :value="form.claimStartTime" readonly style="width: 240px;"></el-input>
  181. <span style="margin: 0 8px;">-</span>
  182. <el-input :value="form.claimEndTime" readonly style="width: 240px;"></el-input>
  183. </div>
  184. </template>
  185. </el-form-item>
  186. <el-form-item label="领取客群限制">
  187. <el-switch v-model="form.claimGroupEnabled" disabled></el-switch>
  188. </el-form-item>
  189. </el-form>
  190. </el-card>
  191. </div>
  192. <!-- 步骤 2:更多设置 -->
  193. <div v-show="activeStep === 2">
  194. <el-card shadow="never" class="section-card">
  195. <template #header>
  196. <div class="section-title">显示页面</div>
  197. </template>
  198. <el-form :model="form" label-width="120px" label-position="left">
  199. <el-form-item label="权益首页">
  200. <el-radio-group v-model="form.showOnHome" disabled>
  201. <el-radio label="显示">显示</el-radio>
  202. <el-radio label="不显示">不显示</el-radio>
  203. </el-radio-group>
  204. </el-form-item>
  205. <el-form-item label="组装页">
  206. <el-radio-group v-model="form.showOnAssembly" disabled>
  207. <el-radio label="显示">显示</el-radio>
  208. <el-radio label="不显示">不显示</el-radio>
  209. </el-radio-group>
  210. <div v-if="form.showOnAssembly === '显示'" class="rule-pane">
  211. <el-input :value="(form.assemblyPages || []).join(',')" readonly></el-input>
  212. </div>
  213. </el-form-item>
  214. </el-form>
  215. </el-card>
  216. <el-card shadow="never" class="section-card">
  217. <template #header>
  218. <div class="section-title">分享设置</div>
  219. </template>
  220. <el-form :model="form" label-width="120px" label-position="left">
  221. <el-form-item label="是否支持分享">
  222. <el-switch v-model="form.shareEnabled" disabled></el-switch>
  223. </el-form-item>
  224. </el-form>
  225. </el-card>
  226. </div>
  227. <!-- 步骤导航 -->
  228. <div class="step-navigation">
  229. <el-button v-if="activeStep > 0" @click="prevStep"><el-icon><ArrowLeft /></el-icon>上一步</el-button>
  230. <el-button
  231. v-if="activeStep < 2"
  232. type="primary"
  233. @click="nextStep"
  234. style="margin-left: auto;"
  235. >下一步<el-icon class="el-icon--right"><ArrowRight /></el-icon></el-button>
  236. </div>
  237. <!-- 已审记录 -->
  238. <el-card v-if="audit.auditStatus !== 'pending'" shadow="never" class="section-card audit-action-card">
  239. <template #header>
  240. <div class="section-title">审核记录</div>
  241. </template>
  242. <el-form label-width="120px" label-position="left">
  243. <el-row :gutter="20">
  244. <el-col :span="8">
  245. <el-form-item label="审核人">
  246. <span>{{ audit.auditorName || '-' }}</span>
  247. </el-form-item>
  248. </el-col>
  249. <el-col :span="8">
  250. <el-form-item label="审核时间">
  251. <span>{{ audit.auditTime || '-' }}</span>
  252. </el-form-item>
  253. </el-col>
  254. <el-col :span="8">
  255. <el-form-item label="审核结果">
  256. <el-tag :type="auditStatusTag(audit.auditStatus)" size="small">
  257. {{ auditStatusLabel(audit.auditStatus) }}
  258. </el-tag>
  259. </el-form-item>
  260. </el-col>
  261. </el-row>
  262. </el-form>
  263. </el-card>
  264. <!-- 操作栏 -->
  265. <div class="action-bar">
  266. <el-button @click="goBack">返回</el-button>
  267. <template v-if="canAudit">
  268. <el-button type="danger" @click="handleReject">驳回</el-button>
  269. <el-button type="primary" @click="handleApprove">通过</el-button>
  270. </template>
  271. </div>
  272. </el-card>
  273. </div>
  274. </template>
  275. <script>
  276. import request from '@/utils/request'
  277. import { ElMessage, ElMessageBox } from 'element-plus'
  278. const detailMockMap = {
  279. 'Q100001': {
  280. isPlatformExchange: '是', productType: '券码',
  281. listIcon: [], mainImage: [],
  282. introduction: '权益A 介绍内容示例',
  283. overview: '<p>权益内容内容</p>',
  284. details: '<p>权益说明内容</p>',
  285. successButtonText: '马上去使用',
  286. showTimeEnabled: true,
  287. showStartTime: '2026-01-01 00:00:00',
  288. showEndTime: '2026-12-31 23:59:59',
  289. showGroupEnabled: false,
  290. showGroupTagIds: [],
  291. claimTimeEnabled: true,
  292. claimStartTime: '2026-01-01 00:00:00',
  293. claimEndTime: '2026-12-31 23:59:59',
  294. claimGroupEnabled: false
  295. },
  296. 'Q100002': {
  297. isPlatformExchange: '否', productType: '',
  298. externalJumpMethod: '没有', externalLink: '太古地产',
  299. listIcon: [], mainImage: [], introduction: '',
  300. overview: '', details: '',
  301. successButtonText: '',
  302. showTimeEnabled: false, showStartTime: '', showEndTime: '',
  303. showGroupEnabled: true, showGroupTagIds: ['客群A'],
  304. claimTimeEnabled: true,
  305. claimStartTime: '2026-02-01 00:00:00',
  306. claimEndTime: '2026-11-30 23:59:59',
  307. claimGroupEnabled: true
  308. },
  309. 'Q100003': {
  310. isPlatformExchange: '否', productType: '',
  311. externalJumpMethod: '有', externalLink: '龙腾',
  312. listIcon: [], mainImage: [],
  313. introduction: '权益C 介绍内容示例',
  314. overview: '<p>外部详情页权益内容</p>',
  315. details: '<p>外部详情页权益说明</p>',
  316. showTimeEnabled: false,
  317. claimTimeEnabled: false,
  318. claimGroupEnabled: false
  319. },
  320. 'Q100004': {
  321. isPlatformExchange: '否', productType: '',
  322. externalJumpMethod: '有', externalLink: 'h5链接',
  323. listIcon: [], mainImage: [],
  324. introduction: '权益D 介绍内容示例',
  325. overview: '<p>自定义链接权益内容</p>',
  326. details: '<p>自定义链接权益说明</p>',
  327. showTimeEnabled: false,
  328. claimTimeEnabled: false,
  329. claimGroupEnabled: false
  330. }
  331. }
  332. export default {
  333. name: 'AuditDetail',
  334. data() {
  335. return {
  336. audit: null,
  337. activeStep: 0,
  338. form: {
  339. isPlatformExchange: '是',
  340. source: '银行自有',
  341. productType: '券码',
  342. rongshuProduct: '',
  343. externalJumpMethod: '',
  344. externalLink: '',
  345. equityName: '',
  346. subTitle: '',
  347. skuNo: '',
  348. merchantName: '',
  349. listIcon: [],
  350. mainImage: [],
  351. introduction: '',
  352. validityType: 'fromGrantPlan',
  353. validityText: '',
  354. overview: '',
  355. details: '',
  356. successButtonText: '',
  357. showTimeEnabled: false,
  358. showStartTime: '',
  359. showEndTime: '',
  360. showGroupEnabled: false,
  361. showGroupTagIds: [],
  362. claimTimeEnabled: false,
  363. claimStartTime: '',
  364. claimEndTime: '',
  365. claimGroupEnabled: false,
  366. showOnHome: '不显示',
  367. showOnAssembly: '不显示',
  368. assemblyPages: [],
  369. shareEnabled: false
  370. }
  371. }
  372. },
  373. computed: {
  374. mappedSource() {
  375. if (this.form.isPlatformExchange === '否') return '第三方'
  376. if (this.form.productType === '微信立减金') return '荣数商品'
  377. return '银行自有'
  378. },
  379. shouldShowDetailCard() {
  380. if (this.form.isPlatformExchange === '是') return true
  381. if (this.form.isPlatformExchange === '否' && this.form.externalJumpMethod === '有') return true
  382. return false
  383. },
  384. canAudit() {
  385. if (!this.audit || this.audit.auditStatus !== 'pending') return false
  386. const t = this.audit.auditType
  387. if (t === 'new') return this.activeStep === 2
  388. return true
  389. }
  390. },
  391. created() {
  392. this.loadAudit()
  393. },
  394. methods: {
  395. loadAudit() {
  396. const id = this.$route.params.id
  397. request.get(`/api/audit/detail?id=${id}`).then(res => {
  398. this.audit = res.data
  399. if (this.audit) this.populateForm()
  400. }).catch(() => {})
  401. },
  402. populateForm() {
  403. const bizId = this.audit.bizId
  404. // 1) 先用 mockMap 填充丰富的详情字段
  405. if (detailMockMap[bizId]) {
  406. Object.assign(this.form, detailMockMap[bizId])
  407. }
  408. // 2) 用 audit snapshot 覆盖(变更类型时会包含最新内容)
  409. Object.assign(this.form, this.audit.snapshot || {})
  410. // 3) 根据接口返回的 source 推算 isPlatformExchange 和 productType
  411. if (!this.form.isPlatformExchange || this.form.isPlatformExchange === '') {
  412. if (this.form.source === '第三方') this.form.isPlatformExchange = '否'
  413. else this.form.isPlatformExchange = '是'
  414. }
  415. if (this.form.isPlatformExchange === '是' && (!this.form.productType || this.form.productType === '')) {
  416. this.form.productType = this.form.source === '荣数商品' ? '微信立减金' : '券码'
  417. }
  418. if (this.form.isPlatformExchange === '否') {
  419. this.form.productType = ''
  420. }
  421. // 4) 推导第三方相关字段
  422. if (this.form.isPlatformExchange === '否') {
  423. if (this.form.jumpLink && !this.form.externalLink) this.form.externalLink = this.form.jumpLink
  424. if (this.form.jumpMethod && !this.form.externalJumpMethod) {
  425. this.form.externalJumpMethod = this.form.jumpMethod
  426. }
  427. }
  428. },
  429. auditTypeLabel(t) {
  430. return { new: '新增', offshelf: '下架' }[t] || t
  431. },
  432. auditTypeTag(t) {
  433. return { new: 'success', offshelf: 'danger' }[t] || ''
  434. },
  435. auditStatusLabel(s) {
  436. return { pending: '待审核', approved: '已通过', rejected: '已驳回' }[s] || s
  437. },
  438. auditStatusTag(s) {
  439. return { pending: 'warning', approved: 'success', rejected: 'danger' }[s] || ''
  440. },
  441. nextStep() { if (this.activeStep < 2) this.activeStep++ },
  442. prevStep() { if (this.activeStep > 0) this.activeStep-- },
  443. handleApprove() {
  444. ElMessageBox.confirm('确定通过该审核单吗?', '提示', {
  445. confirmButtonText: '通过',
  446. cancelButtonText: '取消',
  447. type: 'success'
  448. }).then(() => {
  449. request.post('/api/audit/approve', { id: this.audit.id }).then(() => {
  450. ElMessage.success('审核通过')
  451. this.$router.push('/customization/hsbc/audit')
  452. }).catch(() => {})
  453. }).catch(() => {})
  454. },
  455. handleReject() {
  456. ElMessageBox.confirm('确定驳回该审核单吗?', '提示', {
  457. confirmButtonText: '驳回',
  458. cancelButtonText: '取消',
  459. type: 'warning'
  460. }).then(() => {
  461. request.post('/api/audit/reject', { id: this.audit.id }).then(() => {
  462. ElMessage.success('已驳回')
  463. this.$router.push('/customization/hsbc/audit')
  464. }).catch(() => {})
  465. }).catch(() => {})
  466. },
  467. goBack() {
  468. this.$router.push('/customization/hsbc/audit')
  469. }
  470. }
  471. }
  472. </script>
  473. <style scoped>
  474. .audit-detail {
  475. padding: 0;
  476. }
  477. .header-bar {
  478. display: flex;
  479. justify-content: space-between;
  480. align-items: center;
  481. }
  482. .header-left .title {
  483. font-size: 16px;
  484. font-weight: 600;
  485. color: #303133;
  486. }
  487. .section-card {
  488. margin-bottom: 16px;
  489. border: none;
  490. }
  491. .section-card >>> .el-card__header {
  492. padding: 12px 20px;
  493. background: #fafafa;
  494. border-bottom: 1px solid #ebeef5;
  495. }
  496. .section-title {
  497. font-size: 14px;
  498. font-weight: 600;
  499. color: #303133;
  500. }
  501. .offshelf-reason {
  502. color: #f56c6c;
  503. font-weight: 500;
  504. }
  505. .rule-pane {
  506. display: flex;
  507. align-items: center;
  508. width: 600px;
  509. background: #f1f2f5;
  510. padding: 12px 20px;
  511. margin-top: 10px;
  512. }
  513. .image-preview {
  514. width: 80px;
  515. height: 80px;
  516. border: 1px solid #d9d9d9;
  517. border-radius: 4px;
  518. overflow: hidden;
  519. }
  520. .preview-img {
  521. width: 100%;
  522. height: 100%;
  523. object-fit: cover;
  524. }
  525. .no-data {
  526. color: #c0c4cc;
  527. font-size: 13px;
  528. }
  529. .rich-text-view {
  530. border: 1px solid #dcdfe6;
  531. border-radius: 4px;
  532. padding: 8px 12px;
  533. min-height: 80px;
  534. font-size: 14px;
  535. color: #606266;
  536. line-height: 1.6;
  537. }
  538. .step-navigation {
  539. display: flex;
  540. justify-content: space-between;
  541. margin-top: 20px;
  542. padding-top: 20px;
  543. border-top: 1px solid #ebeef5;
  544. }
  545. .audit-action-card {
  546. margin-top: 8px;
  547. }
  548. .action-bar {
  549. display: flex;
  550. justify-content: center;
  551. gap: 12px;
  552. margin-top: 20px;
  553. padding-top: 20px;
  554. border-top: 1px solid #ebeef5;
  555. }
  556. </style>