AuditDetail.vue 20 KB

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