EquityProducts.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539
  1. <template>
  2. <div class="equity-products">
  3. <el-card>
  4. <!-- 搜索区域 -->
  5. <div class="search-section" slot="header">
  6. <div class="search-row">
  7. <el-form :model="searchForm" label-width="80px" inline>
  8. <el-form-item label="权益名称:">
  9. <el-input v-model="searchForm.equityName" placeholder="请输入" style="width: 150px"></el-input>
  10. </el-form-item>
  11. <el-form-item label="权益编号:">
  12. <el-input v-model="searchForm.productId" placeholder="请输入" style="width: 150px"></el-input>
  13. </el-form-item>
  14. <el-form-item label="状态:">
  15. <el-select v-model="searchForm.reviewStatus" placeholder="全部" clearable style="width: 150px">
  16. <el-option
  17. v-for="opt in statusOptions"
  18. :key="opt"
  19. :label="opt"
  20. :value="opt"
  21. />
  22. </el-select>
  23. </el-form-item>
  24. <div class="button-group" style="margin-left: 20px;">
  25. <el-button type="primary" @click="handleSearch">查询</el-button>
  26. <el-button @click="handleReset">重置</el-button>
  27. </div>
  28. </el-form>
  29. </div>
  30. <div style="margin-top: 15px;">
  31. <el-button type="primary" icon="el-icon-plus" @click="createProduct">添加权益</el-button>
  32. </div>
  33. </div>
  34. <!-- 表格区域 -->
  35. <el-table :data="filteredTableData" stripe style="width: 100%">
  36. <el-table-column label="操作" width="240" fixed="left">
  37. <template slot-scope="scope">
  38. <el-button type="text" size="small" @click="handleView(scope.row)">查看</el-button>
  39. <el-button type="text" size="small" @click="handleEdit(scope.row)">编辑</el-button>
  40. <el-button
  41. v-if="scope.row.reviewStatus === '待审核'"
  42. type="text"
  43. size="small"
  44. @click="handleAudit(scope.row)"
  45. >审核</el-button>
  46. <el-button
  47. v-if="scope.row.reviewStatus === '审核通过' || scope.row.reviewStatus === '已上架'"
  48. type="text"
  49. size="small"
  50. @click="handleOffline(scope.row)"
  51. >下架</el-button>
  52. <el-popover
  53. placement="bottom"
  54. trigger="click"
  55. :ref="`morePopover-${scope.$index}`"
  56. >
  57. <div class="more-actions-menu">
  58. <el-popover
  59. placement="left"
  60. trigger="click"
  61. width="240"
  62. @show="onAdjustOrderShow(scope.$index)"
  63. :ref="`adjustPopover-${scope.$index}`"
  64. >
  65. <div class="adjust-order-form">
  66. <div class="adjust-order-title">调整显示顺序</div>
  67. <div class="adjust-order-tip">移动端权益首页和列表页按照该顺序展示</div>
  68. <div class="adjust-order-input">
  69. <span>调整到第</span>
  70. <el-input-number
  71. v-model.number="adjustOrderPosition"
  72. :min="1"
  73. :max="tableData.length"
  74. size="mini"
  75. :controls="false"
  76. style="width: 70px;margin: 0 6px;"
  77. />
  78. <span>位</span>
  79. </div>
  80. <div class="adjust-order-actions">
  81. <el-button size="mini" @click="closeAdjustOrder(scope.$index)">取消</el-button>
  82. <el-button size="mini" type="primary" @click="confirmAdjustOrder(scope.$index)">确定</el-button>
  83. </div>
  84. </div>
  85. <div slot="reference" class="more-actions-item">调整显示顺序</div>
  86. </el-popover>
  87. <div
  88. class="more-actions-item"
  89. @click="openLinkDialogFromMore(scope.row, scope.$index)"
  90. >生成链接</div>
  91. <div
  92. v-if="scope.row.source === '银行自有' && scope.row.productType === '券码'"
  93. class="more-actions-item"
  94. @click="handleImportCouponsFromMore(scope.row, scope.$index)"
  95. >导入券码</div>
  96. <div
  97. v-if="scope.row.source === '银行自有' && scope.row.productType === '券码'"
  98. class="more-actions-item"
  99. @click="handleManageCouponsFromMore(scope.row, scope.$index)"
  100. >券码管理</div>
  101. <div
  102. v-if="scope.row.reviewStatus === '已下架'"
  103. class="more-actions-item more-actions-item-danger"
  104. @click="handleDelete(scope.row, scope.$index)"
  105. >删除</div>
  106. </div>
  107. <el-button slot="reference" type="text" size="small" icon="el-icon-more" style="margin-left: 8px;"></el-button>
  108. </el-popover>
  109. </template>
  110. </el-table-column>
  111. <el-table-column prop="equityName" label="权益名称" width="120"></el-table-column>
  112. <el-table-column label="状态" width="100">
  113. <template slot-scope="scope">
  114. <el-tag
  115. :type="getStatusType(scope.row.reviewStatus)"
  116. size="small"
  117. >{{ scope.row.reviewStatus }}</el-tag>
  118. </template>
  119. </el-table-column>
  120. <el-table-column prop="source" label="权益来源" width="100"></el-table-column>
  121. <el-table-column prop="jumpLink" label="外部权益链接" width="120"></el-table-column>
  122. <el-table-column prop="jumpMethod" label="是否有详情页" width="120"></el-table-column>
  123. <el-table-column prop="productId" label="权益编号" width="100"></el-table-column>
  124. <el-table-column label="显示页面" min-width="220">
  125. <template slot-scope="scope">
  126. <template v-if="visiblePages(scope.row).length">
  127. <el-tag
  128. v-for="page in visiblePages(scope.row)"
  129. :key="page"
  130. size="small"
  131. style="margin-right: 4px;"
  132. >{{ page }}</el-tag>
  133. </template>
  134. <span v-else class="empty-text">-</span>
  135. </template>
  136. </el-table-column>
  137. <el-table-column prop="creator" label="创建人" width="100"></el-table-column>
  138. <el-table-column prop="createTime" label="创建时间" width="180"></el-table-column>
  139. <el-table-column prop="reviewer" label="审核人" width="100"></el-table-column>
  140. <el-table-column prop="reviewTime" label="审核时间" width="180"></el-table-column>
  141. </el-table>
  142. <show-pages-dialog
  143. :visible.sync="showPagesDialogVisible"
  144. :row="showPagesRow"
  145. @confirm="onShowPagesConfirm"
  146. ></show-pages-dialog>
  147. <equity-link-dialog
  148. :visible.sync="linkDialogVisible"
  149. :id="linkTargetId"
  150. path-name="equity/debit"
  151. title="生成借记卡权益链接"
  152. ></equity-link-dialog>
  153. <!-- 分页 -->
  154. <div class="pagination-section">
  155. <span>Total 1000</span>
  156. <el-pagination
  157. layout="prev, pager, next, sizes, jumper"
  158. :page-size="100"
  159. :page-sizes="[100, 200, 500]"
  160. :total="1000"
  161. ></el-pagination>
  162. </div>
  163. </el-card>
  164. </div>
  165. </template>
  166. <script>
  167. import ShowPagesDialog from '@/components/ShowPagesDialog.vue'
  168. import EquityLinkDialog from '@/components/EquityLinkDialog.vue'
  169. export default {
  170. name: 'EquityProducts',
  171. components: { ShowPagesDialog, EquityLinkDialog },
  172. data() {
  173. return {
  174. searchForm: {
  175. equityName: '',
  176. productId: '',
  177. reviewStatus: ''
  178. },
  179. statusOptions: ['待审核', '已上架', '审核拒绝', '已下架'],
  180. adjustOrderPosition: 1,
  181. showPagesDialogVisible: false,
  182. showPagesRow: null,
  183. linkDialogVisible: false,
  184. linkTargetId: '',
  185. tableData: [
  186. {
  187. equityName: '权益A',
  188. reviewStatus: '待审核',
  189. source: '银行自有',
  190. jumpMethod: '-',
  191. jumpLink: '-',
  192. exchangeMethod: '权益平台',
  193. productId: '100001',
  194. skuNo: 'SKU001',
  195. merchantName: '商户A',
  196. productType: '券码',
  197. creator: '李运营',
  198. createTime: '2026-04-10 09:32:15',
  199. reviewer: '',
  200. reviewTime: ''
  201. },
  202. {
  203. equityName: '权益B',
  204. reviewStatus: '待审核',
  205. source: '第三方',
  206. jumpMethod: '没有',
  207. jumpLink: '太古地产',
  208. exchangeMethod: '第三方(列表跳转)',
  209. productId: '100002',
  210. skuNo: 'SKU002',
  211. merchantName: '商户B',
  212. creator: '王运营',
  213. createTime: '2026-04-12 14:08:42',
  214. reviewer: '张三',
  215. reviewTime: '2026-04-15 10:30:00'
  216. },
  217. {
  218. equityName: '权益C',
  219. reviewStatus: '已上架',
  220. source: '第三方',
  221. jumpMethod: '有',
  222. jumpLink: '龙腾',
  223. exchangeMethod: '第三方(详情页跳转)',
  224. productId: '100003',
  225. skuNo: 'SKU003',
  226. merchantName: '商户C',
  227. creator: '李运营',
  228. createTime: '2026-04-08 11:20:05',
  229. reviewer: '王五',
  230. reviewTime: '2026-04-14 16:45:00'
  231. },
  232. {
  233. equityName: '权益D',
  234. reviewStatus: '审核拒绝',
  235. source: '第三方',
  236. jumpMethod: '有',
  237. jumpLink: 'h5链接',
  238. exchangeMethod: '第三方(详情页跳转)',
  239. productId: '100004',
  240. skuNo: 'SKU004',
  241. merchantName: '商户D',
  242. creator: '陈运营',
  243. createTime: '2026-04-05 15:50:18',
  244. reviewer: '赵六',
  245. reviewTime: '2026-04-13 09:15:00'
  246. },
  247. {
  248. equityName: '权益E',
  249. reviewStatus: '已下架',
  250. source: '银行自有',
  251. jumpMethod: '-',
  252. jumpLink: '-',
  253. exchangeMethod: '权益平台',
  254. productId: '100005',
  255. skuNo: 'SKU005',
  256. merchantName: '商户E',
  257. productType: '券码',
  258. creator: '王运营',
  259. createTime: '2026-03-28 09:00:11',
  260. reviewer: '钱七',
  261. reviewTime: '2026-04-12 11:20:00'
  262. }
  263. ]
  264. }
  265. },
  266. computed: {
  267. visiblePages() {
  268. return row => {
  269. const pages = []
  270. if (row.showOnHome === '显示') pages.push("权益首页/列表页")
  271. if (row.showOnAssembly === '显示' && Array.isArray(row.assemblyPages)) {
  272. pages.push(...row.assemblyPages)
  273. }
  274. return pages
  275. }
  276. },
  277. filteredTableData() {
  278. return this.tableData.filter(row => {
  279. const f = this.searchForm
  280. if (f.equityName && !row.equityName.includes(f.equityName)) return false
  281. if (f.productId && !row.productId.includes(f.productId)) return false
  282. if (f.reviewStatus && row.reviewStatus !== f.reviewStatus) return false
  283. return true
  284. })
  285. }
  286. },
  287. methods: {
  288. handleSearch() {
  289. this.$message.success('已搜索')
  290. },
  291. handleReset() {
  292. this.searchForm = {
  293. equityName: '',
  294. productId: '',
  295. reviewStatus: ''
  296. }
  297. },
  298. getPopoverInstance(name) {
  299. const ref = this.$refs[name]
  300. if (!ref) return null
  301. return Array.isArray(ref) ? ref[0] : ref
  302. },
  303. onAdjustOrderShow(index) {
  304. this.adjustOrderPosition = index + 1
  305. const moreRef = this.getPopoverInstance(`morePopover-${index}`)
  306. if (moreRef) {
  307. moreRef.doClose()
  308. }
  309. },
  310. closeAdjustOrder(index) {
  311. const adjustRef = this.getPopoverInstance(`adjustPopover-${index}`)
  312. if (adjustRef) {
  313. adjustRef.doClose()
  314. }
  315. const moreRef = this.getPopoverInstance(`morePopover-${index}`)
  316. if (moreRef) {
  317. moreRef.doClose()
  318. }
  319. },
  320. confirmAdjustOrder(index) {
  321. const target = Number(this.adjustOrderPosition)
  322. if (!target || target < 1 || target > this.tableData.length) {
  323. this.$message.warning('请输入有效的顺序位置')
  324. return
  325. }
  326. const targetIndex = target - 1
  327. if (targetIndex !== index) {
  328. const moved = this.tableData.splice(index, 1)[0]
  329. this.tableData.splice(targetIndex, 0, moved)
  330. }
  331. this.$message.success('顺序已调整')
  332. this.closeAdjustOrder(index)
  333. },
  334. createProduct() {
  335. this.$router.push('/customization/hsbc/equity-products/add')
  336. },
  337. handleView(row) {
  338. this.$router.push(`/customization/hsbc/equity-products/view/${row.productId}`)
  339. },
  340. handleEdit(row) {
  341. this.$router.push(`/customization/hsbc/equity-products/edit/${row.productId}`)
  342. },
  343. handleAudit(row) {
  344. this.$router.push(`/customization/hsbc/equity-products/audit/${row.productId}`)
  345. },
  346. showLinkDialog(row) {
  347. this.linkTargetId = row.productId
  348. this.linkDialogVisible = true
  349. },
  350. openLinkDialogFromMore(row, index) {
  351. const moreRef = this.getPopoverInstance(`morePopover-${index}`)
  352. if (moreRef) {
  353. moreRef.doClose()
  354. }
  355. this.showLinkDialog(row)
  356. },
  357. handleManageCoupons() {
  358. window.open('https://uat.leagpoint.com/sipAdmin/coupon/inboundCouponList', '_blank')
  359. },
  360. handleManageCouponsFromMore(row, index) {
  361. const moreRef = this.getPopoverInstance(`morePopover-${index}`)
  362. if (moreRef) {
  363. moreRef.doClose()
  364. }
  365. this.handleManageCoupons(row)
  366. },
  367. handleImportCoupons() {
  368. window.open('https://uat.leagpoint.com/sipAdmin/coupon/importCoupon', '_blank')
  369. },
  370. handleImportCouponsFromMore(row, index) {
  371. const moreRef = this.getPopoverInstance(`morePopover-${index}`)
  372. if (moreRef) {
  373. moreRef.doClose()
  374. }
  375. this.handleImportCoupons(row)
  376. },
  377. handleOffline(row) {
  378. this.$confirm(`确定要下架权益"${row.equityName}"吗?`, '提示', {
  379. confirmButtonText: '确定',
  380. cancelButtonText: '取消',
  381. type: 'warning'
  382. }).then(() => {
  383. this.$message.success('下架成功')
  384. }).catch(() => {})
  385. },
  386. openShowPagesDialog(row, index) {
  387. const moreRef = this.getPopoverInstance(`morePopover-${index}`)
  388. if (moreRef) {
  389. moreRef.doClose()
  390. }
  391. this.showPagesRow = row
  392. this.showPagesDialogVisible = true
  393. },
  394. onShowPagesConfirm(values) {
  395. if (this.showPagesRow) {
  396. this.$set(this.showPagesRow, 'showOnHome', values.showOnHome)
  397. this.$set(this.showPagesRow, 'showOnAssembly', values.showOnAssembly)
  398. this.$set(this.showPagesRow, 'assemblyPages', [...values.assemblyPages])
  399. this.$message.success('显示页面已更新')
  400. }
  401. },
  402. handleDelete(row, index) {
  403. const moreRef = this.getPopoverInstance(`morePopover-${index}`)
  404. if (moreRef) {
  405. moreRef.doClose()
  406. }
  407. this.$confirm(`确定要删除权益"${row.equityName}"吗?`, '提示', {
  408. confirmButtonText: '确定',
  409. cancelButtonText: '取消',
  410. type: 'warning'
  411. }).then(() => {
  412. this.tableData.splice(index, 1)
  413. this.$message.success('删除成功')
  414. }).catch(() => {})
  415. },
  416. getStatusType(status) {
  417. switch (status) {
  418. case '待审核':
  419. return 'warning'
  420. case '已上架':
  421. return 'success'
  422. case '审核拒绝':
  423. return 'danger'
  424. case '已下架':
  425. return 'info'
  426. default:
  427. return ''
  428. }
  429. }
  430. }
  431. }
  432. </script>
  433. <style scoped>
  434. .equity-products {
  435. padding: 0;
  436. }
  437. .search-section {
  438. display: flex;
  439. flex-direction: column;
  440. }
  441. .search-row {
  442. margin-bottom: 15px;
  443. }
  444. .search-row .el-form {
  445. display: flex;
  446. flex-wrap: wrap;
  447. gap: 0;
  448. }
  449. .search-row .el-form-item {
  450. margin-right: 0;
  451. margin-bottom: 0;
  452. }
  453. .button-group {
  454. display: flex;
  455. gap: 5px;
  456. }
  457. .pagination-section {
  458. display: flex;
  459. justify-content: flex-end;
  460. align-items: center;
  461. gap: 20px;
  462. margin-top: 20px;
  463. }
  464. .empty-text {
  465. color: #c0c4cc;
  466. }
  467. </style>
  468. <style>
  469. .more-actions-menu {
  470. display: flex;
  471. flex-direction: column;
  472. margin: -12px;
  473. }
  474. .more-actions-item {
  475. padding: 8px 16px;
  476. cursor: pointer;
  477. font-size: 14px;
  478. color: #606266;
  479. }
  480. .more-actions-item:hover {
  481. background: #f5f7fa;
  482. color: #409eff;
  483. }
  484. .more-actions-item-danger:hover {
  485. color: #f56c6c;
  486. }
  487. .adjust-order-form {
  488. display: flex;
  489. flex-direction: column;
  490. gap: 12px;
  491. }
  492. .adjust-order-title {
  493. font-size: 14px;
  494. font-weight: 500;
  495. color: #303133;
  496. }
  497. .adjust-order-tip {
  498. font-size: 12px;
  499. color: #909399;
  500. line-height: 1.5;
  501. padding: 8px 10px;
  502. background: #f5f7fa;
  503. border-radius: 4px;
  504. }
  505. .adjust-order-input {
  506. display: flex;
  507. align-items: center;
  508. font-size: 14px;
  509. color: #606266;
  510. }
  511. .adjust-order-actions {
  512. display: flex;
  513. justify-content: flex-end;
  514. gap: 8px;
  515. }
  516. </style>