liujq il y a 3 ans
Parent
commit
245a49e6bd

+ 15 - 0
src/api/user.js

@@ -67,4 +67,19 @@ export default {
   admschoolcommentdel: params => { // 学校评论 - 评论删除
     return getRequestNoSort('/adm/school/comment/del', params, 'loading')
   },
+  admintegralrulelist: params => { // 积分规则 - 列表
+    return getRequest('/adm/integral/rule/list', params)
+  },
+  admintegralruleedit: params => { // 积分规则 - 编辑
+    return getRequestNoSort('/adm/integral/rule/edit', params, 'loading')
+  },
+  admintegralruleadd: params => { //  积分规则 - 添加
+    return getRequestNoSort('/adm/integral/rule/add', params, 'loading')
+  },
+  admintegralruledel: params => { //  积分规则 - 删除
+    return getRequestNoSort('/adm/integral/rule/del', params, 'loading')
+  },
+  admintegralruledetail: params => { //  积分规则 - 详情
+    return getRequestNoSort('/adm/integral/rule/detail', params, 'loading')
+  },
 }

+ 0 - 1
src/views/news/components/popup/IndexEditSelf.vue

@@ -137,7 +137,6 @@ export default {
             }
             let apiStr = 'adminformationadd'
             if (newForm.id) apiStr = 'adminformationedit'
-            console.log(this.content)
             if (this.content) {
               newForm.content = this.content
             } else {

+ 82 - 0
src/views/user/components/popup/IREdit.vue

@@ -0,0 +1,82 @@
+<template>
+  <div>
+    <el-dialog
+      v-loading="loading"
+      :show-close="false"
+      :close-on-click-modal="false"
+      :visible.sync="isShow"
+      :title="this.curObj && this.curObj.id ? '编辑规则' : '添加规则'"
+      :fullscreen="false"
+      width="470px"
+      custom-class="xl-dialog"
+      center
+    >
+      <base-form ref="ruleForm" :data="formData" :is-inline="false" label-width="110px">
+        <div slot="footer">
+          <el-button class="xl-form-btn t2" @click="close">关 闭</el-button>
+          <el-button class="xl-form-btn t1" @click="close('confirm')">确定</el-button>
+        </div>
+      </base-form>
+    </el-dialog>
+  </div>
+</template>
+<script>
+export default {
+  components: {},
+  mixins: [...mixins],
+  props: {
+    isShow: Boolean,
+    curObj: Object
+  },
+  inject: ['parentData'],
+  data() {
+    return {
+      formData: [],
+      loading: true,
+      cObj: {},
+      isShowMap: false
+    }
+  },
+  watch: {
+    isShow: function(val) {
+      if (val) {
+        this.getDef()
+      }
+    },
+  },
+  methods: {
+    getDef() {
+      const params = { ...this.curObj }
+      this.formData = [
+        { label: '标题', key: 'title', rules: 1 },
+        { label: '分类', key: 'type', rules: 1 },
+        { label: '奖励积分', key: 'reward_point', class: 'c-2', rules: 1 },
+        { label: '奖励次数', key: 'reward_num', class: 'c-2', rules: 1 },
+        { label: '奖励周期(天)', key: 'cycle', rules: 1},
+      ]
+      this.setDefaultValue(params)
+    },
+    close(str) {
+      if (str === 'confirm') {
+        this.$refs['ruleForm'].$refs['baseForm'].validate((valid) => {
+          if (valid) {
+            const oldform = this.$refs.ruleForm.baseForm
+            let newForm = { ...oldform }
+            let apiStr = 'admintegralruleadd'
+            if (newForm.id) apiStr = 'admintegralruleedit'
+            this.$api.user[apiStr](newForm).then(data => {
+              this.$msgs(newForm.id ? '编辑成功' : '新增成功')
+              this.$emit('close', newForm)
+            })
+          }
+        })
+      } else {
+        this.$emit('close')
+        this.setDefaultValue()
+      }
+    },
+  }
+}
+</script>
+<style lang="scss" scoped>
+</style>

+ 31 - 0
src/views/user/components/searchForm/IntegralRule.vue

@@ -0,0 +1,31 @@
+<template>
+  <base-form slot="content" ref="ruleForm" :data="searchData">
+    <div slot="footer">
+      <el-button :loading="listLoading" icon="el-icon-search" class="xl-form-btn bgc1" @click="searchHandle">查询</el-button>
+      <!-- <el-button :loading="listLoading" icon="el-icon-document" class="xl-form-btn bgc2" @click="toExportExcel">导出{{ this.$route.meta.title }}信息</el-button> -->
+    </div>
+  </base-form>
+</template>
+<script>
+export default {
+  mixins: [],
+  props: {
+    listLoading: Boolean
+  },
+  inject: ['parentData'],
+  data() {
+    return {
+      searchData: [
+        { label: '标题', key: 'title' },
+      ]
+    }
+  },
+  methods: {
+    searchHandle() {
+      const oldform = this.$refs.ruleForm.baseForm
+      const newForm = { ...oldform }
+      this.$emit('change', newForm)
+    }
+  }
+}
+</script>

+ 107 - 0
src/views/user/integralRule.vue

@@ -0,0 +1,107 @@
+<template>
+  <div class="app-container">
+    <search-form
+      :list-loading="listLoading"
+      @change="searchHandle"
+    />
+    <table-list
+      :list-loading="listLoading"
+      :data="tableData2"
+      :columns="listConfig"
+      :current-page="currentPage"
+      :page-size="pageSize"
+      :total-records="totalRecords"
+      @currentChange="pageHandle"
+      :isAdd="true"
+      @add="openPopup"
+    />
+    <popup-edit
+      :isShow="isDtlShow"
+      :curObj="curObj"
+      @close="closePopup"
+    />
+  </div>
+</template>
+<script>
+import { arrToObj } from '@/utils'
+import SearchForm from './components/searchForm/IntegralRule'
+import PopupEdit from './components/popup/IREdit'
+import baseTable from '_m/baseTable.js'
+import xData from './mixin'
+export default {
+  name: 'index',
+  components: {
+    SearchForm,
+    PopupEdit,
+  },
+  provide() {
+    return {
+      parentData: this
+    }
+  },
+  mixins: [baseTable],
+  data() {
+    return {
+      apiStr: 'user.admintegralrulelist',
+      searchForm: null,
+      isDtlShow: false,
+      curObj: {},
+      ...xData
+    }
+  },
+  computed: {
+    tableData2() {
+      const arr = [...this.tableData]
+      arr.map(item => {
+      })
+      return arr
+    }
+  },
+  created() {},
+  mounted() {
+    this.listConfig = {
+      rows: [
+        { label: '标题', prop: 'title' },
+        { label: '分类', prop: 'type' },
+        { label: '奖励积分', prop: 'reward_point' },
+        { label: '奖励周期(天)', prop: 'cycle'},
+        { label: '奖励次数', prop: 'reward_num' },
+        { label: '更新人', prop: 'update_by' },
+        { label: '更新时间', prop: 'update_at' },
+        { label: '操作', width: 200, type: 'handle2', operations:
+          [
+            { label: '编辑', func: this.openPopup, btnType: 'primary' },
+            { label: '删除', func: this.delHandle, btnType: 'danger' },
+          ]
+        }
+      ]
+    }
+  },
+  methods: {
+    delHandle(row) {
+      this.$msg(`您确定要删除该规则吗?`, 'confirm', () => {
+        this.$api.user.admintegralruledel({
+          id: row.id
+        }).then(data => {
+          this.$msgs(`已删除!`)
+          this.fetchData()
+        })
+      }, null, true)
+    },
+    openPopup(row) {
+      if (row && row.id) {
+        this.curObj = row
+      } else {
+        this.curObj = {}
+      }
+      this.isDtlShow = true
+    },
+    closePopup(obj) {
+      this.isDtlShow = false
+      if (obj) {
+        this.fetchData()
+      }
+    }
+  }
+}
+</script>