appScoreRule.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <template>
  2. <div class="app-container">
  3. <!-- <search-form
  4. :list-loading="listLoading"
  5. @change="searchHandle"
  6. /> -->
  7. <table-list
  8. :list-loading="listLoading"
  9. :data="tableData2"
  10. :columns="listConfig"
  11. :current-page="currentPage"
  12. :page-size="pageSize"
  13. :total-records="totalRecords"
  14. @currentChange="pageHandle"
  15. @sizeChange="sizeChange"
  16. :isAdd="true"
  17. @add="openPopup"
  18. />
  19. <popup-edit
  20. :isShow="isDtlShow"
  21. :curObj="curObj"
  22. @close="closePopup"
  23. />
  24. </div>
  25. </template>
  26. <script>
  27. import { arrToObj } from '@/utils'
  28. // import SearchForm from './components/searchForm/AppSale'
  29. import PopupEdit from './components/popup/ScoreRuleEdit'
  30. import baseTable from '_m/baseTable.js'
  31. export default {
  32. name: 'index',
  33. components: {
  34. // SearchForm,
  35. PopupEdit,
  36. },
  37. provide() {
  38. return {
  39. parentData: this
  40. }
  41. },
  42. mixins: [baseTable],
  43. data() {
  44. return {
  45. apiStr: 'facility.admsalerulelist',
  46. searchForm: null,
  47. isDtlShow: false,
  48. curObj: {},
  49. }
  50. },
  51. computed: {
  52. tableData2() {
  53. const arr = [...this.tableData]
  54. arr.map(item => {
  55. item.rewardNum = item.reward_num == 0 ? '不限' : item.reward_num
  56. })
  57. return arr
  58. }
  59. },
  60. created() {},
  61. mounted() {
  62. this.listConfig = {
  63. rows: [
  64. { label: '类目', prop: 'category' },
  65. { label: '奖励积分', prop: 'reward_point' },
  66. { label: '奖励周期(天)', prop: 'cycle' },
  67. { label: '奖励次数', prop: 'rewardNum' },
  68. { 说明: '说明', prop: 'remark' },
  69. // { label: '更新时间', prop: 'update_at' },
  70. { label: '操作', width: 200, type: 'handle2', operations:
  71. [
  72. { label: '编辑', func: this.openPopup, btnType: 'primary' },
  73. { label: '删除', func: this.delHandle, btnType: 'danger' },
  74. ]
  75. }
  76. ]
  77. }
  78. },
  79. methods: {
  80. delHandle(row) {
  81. this.$msg(`您确定要删除该规则吗?`, 'confirm', () => {
  82. this.$api.facility.admsaleruledel({
  83. id: row.id
  84. }).then(data => {
  85. this.$msgs(`已删除!`)
  86. this.fetchData()
  87. })
  88. }, null, true)
  89. },
  90. openPopup(row) {
  91. if (row && row.id) {
  92. this.curObj = row
  93. } else {
  94. this.curObj = {}
  95. }
  96. this.isDtlShow = true
  97. },
  98. closePopup(obj) {
  99. this.isDtlShow = false
  100. if (obj) {
  101. this.fetchData()
  102. }
  103. }
  104. }
  105. }
  106. </script>