AuditDetail.vue 22 KB

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