Parcourir la source

2024.05.07
- 增加等级分佣页面并对接活动比例相关接口;

zweiqin il y a 11 mois
Parent
commit
d97d4c66bf

+ 55 - 0
src/api/commissionAllocation/gradeCommission.js

@@ -0,0 +1,55 @@
+import request from '@/utils/request'
+
+// 分页查询活动比例
+export function getAllPlatformBeeRule(data) {
+  return request({
+    url: '/platformBeeRule/getAll',
+    method: 'post',
+    data
+  })
+}
+
+// 查询活动比例
+export function getByIdPlatformBeeRule(params) {
+  return request({
+    url: '/platformBeeRule/getById',
+    method: 'get',
+    params
+  })
+}
+
+// 保存活动比例
+export function savePlatformBeeRule(data) {
+  return request({
+    url: '/platformBeeRule/save',
+    method: 'post',
+    data
+  })
+}
+
+// 删除活动比例
+export function deleteIdPlatformBeeRule(data) {
+  return request({
+    url: '/platformBeeRule/deleteId',
+    method: 'post',
+    data
+  })
+}
+
+// 修改活动比例
+export function priceControlUpdatePlan(data) {
+  return request({
+    url: '/platformBeeRule/save',
+    method: 'put',
+    data
+  })
+}
+
+// 查询平台蜜蜂币活动信息表全部
+export function getAllPlatformBeeCurrency(params) {
+  return request({
+    url: '/platformBeeCurrency/getAll',
+    method: 'get',
+    params
+  })
+}

+ 126 - 0
src/views/commissionAllocation/gradeCommission/components/DetailModal.vue

@@ -0,0 +1,126 @@
+<template>
+  <el-dialog
+    :visible.sync="visible"
+    v-bind="modalOptions"
+  >
+    <el-form
+      ref="formData"
+      :model="formData"
+      size="mini"
+      label-position="left"
+      label-suffix=":"
+      label-width="200px"
+    >
+      <!-- 平台交易金活动分佣规则信息 -->
+      <el-form-item label="规则ID" prop="ruleId">
+        {{ formData.ruleId || '--' }}
+      </el-form-item>
+      <el-form-item label="活动ID" prop="activityId">
+        {{ formData.activityId || '--' }}
+      </el-form-item>
+      <el-form-item label="活动类型" prop="activityType">
+        <span v-if="formData.activityType === 1">499</span>
+        <span v-else-if="formData.activityType === 2">商圈</span>
+        <span v-else-if="formData.activityType === 3">爆品</span>
+        <span v-else-if="formData.activityType === 4">交易金</span>
+        <span v-else>--</span>
+      </el-form-item>
+      <el-form-item label="团长规则" prop="leadersRule">
+        <span v-if="formData.leadersRule === 1">比例</span>
+        <span v-else-if="formData.leadersRule === 2">金额</span>
+        <span v-else>--</span>
+      </el-form-item>
+      <el-form-item label="直接团长规则" prop="leadersMoney">
+        {{ formData.leadersMoney || '--' }}
+      </el-form-item>
+      <el-form-item label="间接团长规则" prop="leadersInMoney">
+        {{ formData.leadersInMoney || '--' }}
+      </el-form-item>
+      <el-form-item label="直接合伙人规则" prop="partnerMoney">
+        {{ formData.partnerMoney || '--' }}
+      </el-form-item>
+      <el-form-item label="间接合伙人规则" prop="partnerInMoney">
+        {{ formData.partnerInMoney || '--' }}
+      </el-form-item>
+      <el-form-item label="分佣来源" prop="sourceType">
+        <span v-if="formData.sourceType === 1">订单金额</span>
+        <span v-else-if="formData.sourceType === 2">赠送代金券</span>
+        <span v-else-if="formData.sourceType === 3">交易金</span>
+        <span v-else>--</span>
+      </el-form-item>
+      <el-form-item label="创建时间" prop="createTime">
+        {{ formData.createTime || '--' }}
+      </el-form-item>
+      <el-form-item label="更新时间" prop="updateTime">
+        {{ formData.updateTime || '--' }}
+      </el-form-item>
+    </el-form>
+  </el-dialog>
+</template>
+
+<script>
+import { getByIdPlatformBeeRule } from '@/api/commissionAllocation/gradeCommission'
+
+export default {
+  name: 'DetailModal',
+  data() {
+    return {
+      modalOptions: {
+        closeOnClickModal: false,
+        width: '800px',
+        title: '查看平台交易金活动分佣规则详情'
+      },
+      visible: false,
+      formData: {
+        ruleId: '',
+        activityId: '',
+        activityType: '',
+        leadersRule: '',
+        leadersMoney: '',
+        leadersInMoney: '',
+        partnerRule: '',
+        partnerMoney: '',
+        partnerInMoney: '',
+        sourceType: '',
+        createTime: '',
+        updateTime: ''
+      }
+    }
+  },
+  methods: {
+    handleClose() {
+      this.visible = false
+    },
+    handleOpen(params = {}) {
+      this.formData = Object.assign(this.$options.data().formData, params)
+      if (params.ruleId) {
+        this.getInfo(params.ruleId)
+      }
+      this.visible = true
+    },
+    async getInfo(id) {
+      const loading = this.$loading({ text: '加载中' })
+      try {
+        const res = await getByIdPlatformBeeRule({ id })
+        this.formData = Object.assign(this.$options.data().formData, res.data, {
+          ruleId: res.data.ruleId || '',
+          activityId: res.data.activityId || '',
+          activityType: res.data.activityType || '',
+          leadersRule: res.data.leadersRule || '',
+          leadersMoney: res.data.leadersMoney,
+          leadersInMoney: res.data.leadersInMoney,
+          partnerRule: res.data.partnerRule || '',
+          partnerMoney: res.data.partnerMoney,
+          partnerInMoney: res.data.partnerInMoney,
+          sourceType: res.data.sourceType || '',
+          createTime: res.data.createTime || '',
+          updateTime: res.data.updateTime || ''
+        })
+      } finally {
+        loading.close()
+      }
+    }
+  }
+}
+</script>
+

+ 216 - 0
src/views/commissionAllocation/gradeCommission/components/EditModal.vue

@@ -0,0 +1,216 @@
+<template>
+  <el-dialog
+    :visible.sync="visible"
+    v-bind="modalOptions"
+  >
+    <el-form
+      ref="formData"
+      :model="formData"
+      :rules="formRules"
+      size="mini"
+      label-suffix=":"
+      label-width="150px"
+    >
+      <el-form-item label="关联活动" prop="activityId">
+        <el-select v-model="formData.activityId" size="mini" placeholder="请选择关联活动" filterable>
+          <el-option v-for="(item, index) in activityList" :key="item.currencyId" :label="`${item.currencyName}(${item.currencyId})`" :value="item.currencyId" />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="活动类型" prop="activityType">
+        <el-select v-model="formData.activityType" size="mini" placeholder="请选择活动类型">
+          <el-option label="499" :value="1" />
+          <el-option label="商圈" :value="2" />
+          <el-option label="爆品" :value="3" />
+          <el-option label="交易金" :value="4" />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="团长规则" prop="leadersRule">
+        <el-select v-model="formData.leadersRule" size="mini" placeholder="请选择团长规则">
+          <el-option label="比例" :value="1" />
+          <el-option label="金额" :value="2" />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="直接团长规则" prop="leadersMoney">
+        <el-input v-model="formData.leadersMoney" placeholder="请输入直接团长规则" style="width: 150px;">
+          <template #append>
+            <div v-if="formData.leadersRule === 1">:1</div>
+          </template>
+        </el-input>
+      </el-form-item>
+      <el-form-item label="间接团长规则" prop="leadersInMoney">
+        <el-input v-model="formData.leadersInMoney" placeholder="请输入间接团长规则" style="width: 150px;">
+          <template #append>
+            <div v-if="formData.leadersRule === 1">:1</div>
+          </template>
+        </el-input>
+      </el-form-item>
+      <el-form-item label="合伙人规则" prop="partnerRule">
+        <el-select v-model="formData.partnerRule" size="mini" placeholder="请选择合伙人规则">
+          <el-option label="比例" :value="1" />
+          <el-option label="金额" :value="2" />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="直接合伙人规则" prop="partnerMoney">
+        <el-input v-model="formData.partnerMoney" placeholder="请输入直接合伙人规则" style="width: 150px;">
+          <template #append>
+            <div v-if="formData.partnerRule === 1">:1</div>
+          </template>
+        </el-input>
+      </el-form-item>
+      <el-form-item label="间接合伙人规则" prop="partnerInMoney">
+        <el-input v-model="formData.partnerInMoney" placeholder="请输入间接合伙人规则" style="width: 150px;">
+          <template #append>
+            <div v-if="formData.partnerRule === 1">:1</div>
+          </template>
+        </el-input>
+      </el-form-item>
+      <el-form-item label="分佣来源" prop="sourceType">
+        <el-select v-model="formData.sourceType" size="mini" placeholder="请选择分佣来源">
+          <el-option label="订单金额" :value="1" />
+          <el-option label="赠送代金券" :value="2" />
+          <el-option label="交易金" :value="3" />
+        </el-select>
+      </el-form-item>
+    </el-form>
+    <template #footer>
+      <span class="dialog-footer">
+        <el-button size="mini" @click="handleClose">取 消</el-button>
+        <el-button type="primary" size="mini" @click="handleSubmit">确 定</el-button>
+      </span>
+    </template>
+  </el-dialog>
+</template>
+
+<script>
+import { getAllPlatformBeeCurrency, getByIdPlatformBeeRule, savePlatformBeeRule, priceControlUpdatePlan } from '@/api/commissionAllocation/gradeCommission'
+
+export default {
+  name: 'EditModal',
+  components: {
+  },
+  data() {
+    return {
+      modalOptions: {
+        closeOnClickModal: false,
+        width: '820px',
+        title: ''
+      },
+      visible: false,
+      activityList: [],
+      formData: {
+        ruleId: '',
+        activityId: '',
+        activityType: '',
+        leadersRule: '',
+        leadersMoney: '',
+        leadersInMoney: '',
+        partnerRule: '',
+        partnerMoney: '',
+        partnerInMoney: '',
+        sourceType: ''
+      },
+      formRules: {
+        activityId: [
+          { required: true, message: '缺少活动' }
+        ],
+        activityType: [
+          { required: true, message: '请选择活动' }
+        ],
+        leadersRule: [
+          { required: true, message: '请选择团长规则' }
+        ],
+        leadersMoney: [
+          { required: false, message: '请输入直接团长规则' },
+          { pattern: /^0\.\d{0,2}$|^[1-9]\d*\.\d{0,2}$|^[1-9]\d*$/, message: '数值有误' } // >0的数字, 最多2位小数正则
+        ],
+        leadersInMoney: [
+          { required: false, message: '请输入间接团长规则' },
+          { pattern: /^0\.\d{0,2}$|^[1-9]\d*\.\d{0,2}$|^[1-9]\d*$/, message: '数值有误' }
+        ],
+        partnerRule: [
+          { required: true, message: '请选择合伙人规则' }
+        ],
+        partnerMoney: [
+          { required: false, message: '请输入直接合伙人规则' },
+          { pattern: /^0\.\d{0,2}$|^[1-9]\d*\.\d{0,2}$|^[1-9]\d*$/, message: '数值有误' }
+        ],
+        partnerInMoney: [
+          { required: false, message: '请输入间接合伙人规则' },
+          { pattern: /^0\.\d{0,2}$|^[1-9]\d*\.\d{0,2}$|^[1-9]\d*$/, message: '数值有误' }
+        ],
+        sourceType: [
+          { required: true, message: '请选择分佣来源' }
+        ]
+      }
+    }
+  },
+  methods: {
+    handleClose() {
+      this.visible = false
+    },
+    async initList() {
+      const res = await getAllPlatformBeeCurrency({})
+      this.activityList = res.data
+    },
+    handleOpen(params = {}) {
+      this.modalOptions.title = params.ruleId ? '编辑平台交易金活动分佣规则' : '添加平台交易金活动分佣规则'
+      this.visible = true
+      this.initList()
+      if (params.ruleId) {
+        this.getInfo(params.ruleId)
+      } else {
+        this.$refs.formData && this.$refs.formData.resetFields()
+      }
+    },
+    async getInfo(id) {
+      const loading = this.$loading({ text: '加载中' })
+      try {
+        const res = await getByIdPlatformBeeRule({ id })
+        this.formData = Object.assign(this.$options.data().formData, res.data, {
+          ruleId: res.data.ruleId || '',
+          activityId: res.data.activityId || '',
+          activityType: res.data.activityType || '',
+          leadersRule: res.data.leadersRule || '',
+          leadersMoney: res.data.leadersMoney,
+          leadersInMoney: res.data.leadersInMoney,
+          partnerRule: res.data.partnerRule || '',
+          partnerMoney: res.data.partnerMoney,
+          partnerInMoney: res.data.partnerInMoney,
+          sourceType: res.data.sourceType || ''
+        })
+        this.$nextTick(() => {
+          this.$refs.formData && this.$refs.formData.validate()
+        })
+      } finally {
+        loading.close()
+      }
+    },
+    handleSubmit() {
+      this.$refs.formData.validate(async (valid) => {
+        if (valid) {
+          const loading = this.$loading({ text: '提交中,请稍候……' })
+          try {
+            const { ...otps } = this.formData
+            const params = {
+              ...otps
+            }
+            this.formData.ruleId ? await priceControlUpdatePlan(params) : await savePlatformBeeRule(params)
+            loading.close()
+            this.$message({ message: `${this.formData.ruleId ? '编辑' : '添加'}成功!`, type: 'success' })
+            this.$emit('success')
+            this.visible = false
+          } catch (e) {
+            loading.close()
+          } finally {
+            loading.close()
+          }
+        } else {
+          this.$message({ message: '请输入相关信息', type: 'warning' })
+          return false
+        }
+      })
+    }
+  }
+}
+</script>
+

+ 193 - 0
src/views/commissionAllocation/gradeCommission/index.vue

@@ -0,0 +1,193 @@
+<template>
+  <div class="app-container">
+    <!-- 查询和其他操作 -->
+    <div class="filter-container">
+      <el-select
+        v-model="listQuery.activityType" clearable size="mini" class="filter-item"
+        style="width: 200px;margin-left: 10px;" placeholder="请选择活动类型"
+      >
+        <el-option label="499" :value="1" />
+        <el-option label="商圈" :value="2" />
+        <el-option label="爆品" :value="3" />
+        <el-option label="交易金" :value="4" />
+      </el-select>
+      <el-button
+        size="mini" class="filter-item" type="primary" icon="el-icon-search"
+        style="margin-left:10px;"
+        @click="handleSearch"
+      >
+        查找
+      </el-button>
+      <br />
+      <el-button
+        size="mini" type="primary" icon="el-icon-plus"
+        @click="$refs.EditModal && $refs.EditModal.handleOpen({ ruleId: '' })"
+      >
+        添加
+      </el-button>
+    </div>
+
+    <!-- 查询结果 -->
+    <div v-tableHeight>
+      <el-table
+        v-loading="listLoading" height="100%" element-loading-text="正在查询中。。。" :data="list"
+        v-bind="{ stripe: true, size: 'small', border: true, fit: true, highlightCurrentRow: true }"
+      >
+        <el-table-column align="center" width="100" label="规则ID" prop="ruleId" fixed="left" />
+        <el-table-column align="center" width="150" label="活动ID" prop="activityId" fixed="left" show-overflow-tooltip />
+        <el-table-column align="center" label="活动类型" prop="activityType">
+          <template slot-scope="{ row }">
+            <el-tag v-if="row.activityType === 1" effect="plain">499</el-tag>
+            <el-tag v-else-if="row.activityType === 2" effect="plain">商圈</el-tag>
+            <el-tag v-else-if="row.activityType === 3" effect="plain">爆品</el-tag>
+            <el-tag v-else-if="row.activityType === 4" effect="plain">交易金</el-tag>
+            <span v-else>--</span>
+          </template>
+        </el-table-column>
+        <el-table-column align="center" label="团长规则" prop="leadersRule">
+          <template slot-scope="{ row }">
+            <el-tag v-if="row.leadersRule === 1" type="success">比例</el-tag>
+            <el-tag v-else-if="row.leadersRule === 2" type="warning">金额</el-tag>
+            <span v-else>--</span>
+          </template>
+        </el-table-column>
+        <el-table-column align="center" width="120" label="直接团长规则" prop="leadersMoney" show-overflow-tooltip />
+        <el-table-column align="center" width="120" label="间接团长规则" prop="leadersInMoney" show-overflow-tooltip />
+        <el-table-column align="center" label="合伙人规则" prop="partnerRule">
+          <template slot-scope="{ row }">
+            <el-tag v-if="row.partnerRule === 1" type="success">比例</el-tag>
+            <el-tag v-else-if="row.partnerRule === 2" type="warning">金额</el-tag>
+            <span v-else>--</span>
+          </template>
+        </el-table-column>
+        <el-table-column align="center" width="120" label="直接合伙人规则" prop="partnerMoney" show-overflow-tooltip />
+        <el-table-column align="center" width="120" label="间接合伙人规则" prop="partnerInMoney" show-overflow-tooltip />
+        <el-table-column align="center" label="分佣来源" prop="sourceType">
+          <template slot-scope="{ row }">
+            <el-tag v-if="row.sourceType === 1">订单金额</el-tag>
+            <el-tag v-else-if="row.sourceType === 2">赠送代金券</el-tag>
+            <el-tag v-else-if="row.sourceType === 3">交易金</el-tag>
+            <span v-else>--</span>
+          </template>
+        </el-table-column>
+        <el-table-column align="center" width="150" label="创建时间" prop="createTime" />
+        <el-table-column align="center" label="操作" width="220" fixed="right" class-name="small-padding fixed-width">
+          <template slot-scope="{ row }">
+            <el-button type="warning" size="mini" @click="handleDetail(row)">
+              详情
+            </el-button>
+            <el-button size="mini" @click="handleEdit(row)">
+              编辑
+            </el-button>
+            <el-button type="danger" size="mini" @click="handleDelete(row)">
+              删除
+            </el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+    </div>
+
+    <div>
+      <el-pagination
+        :current-page="listQuery.page" :page-sizes="[10, 20, 50, 100]" :page-size="listQuery.pageSize"
+        layout="total, sizes, prev, pager, next, jumper" :total="total"
+        @size-change="(val) => ((listQuery.pageSize = val) && getList())"
+        @current-change="(val) => ((listQuery.page = val) && getList())"
+      />
+    </div>
+
+    <!-- 新增编辑 -->
+    <EditModal ref="EditModal" @success="getList" />
+    <!-- 查看详情 -->
+    <DetailModal ref="DetailModal" @success="getList" />
+  </div>
+</template>
+
+<script>
+import EditModal from './components/EditModal'
+import DetailModal from './components/DetailModal'
+import { getAllPlatformBeeRule, deleteIdPlatformBeeRule } from '@/api/commissionAllocation/gradeCommission'
+
+export default {
+  name: 'GradeCommission',
+  components: {
+    EditModal,
+    DetailModal
+  },
+  data() {
+    return {
+      list: [],
+      total: 0,
+      listLoading: true,
+      listQuery: {
+        page: 1,
+        pageSize: 20,
+        activityType: ''
+      }
+    }
+  },
+  created() {
+    this.getList()
+  },
+  methods: {
+    async getList() {
+      this.listLoading = true
+      try {
+        const res = await getAllPlatformBeeRule(this.listQuery)
+        this.list = res.data.list
+        this.total = res.data.total
+      } finally {
+        this.listLoading = false
+      }
+    },
+    handleSearch() {
+      this.listQuery.page = 1
+      this.getList()
+    },
+    handleDetail(row) {
+      this.$refs.DetailModal && this.$refs.DetailModal.handleOpen(row)
+    },
+    handleEdit(row) {
+      this.$refs.EditModal && this.$refs.EditModal.handleOpen(row)
+    },
+    handleDelete(row) {
+      this.$confirm('确定删除此项?')
+        .then(async () => {
+          await deleteIdPlatformBeeRule({ id: row.ruleId })
+          this.$message({ message: '删除成功!', type: 'success' })
+          this.handleSearch()
+        })
+        .catch(() => {})
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.app-container {
+	padding: 20px;
+	display: flex;
+	flex-direction: column;
+
+	.filter-container {
+		.filter-item {
+			display: inline-block;
+			vertical-align: middle;
+			margin-bottom: 10px;
+		}
+	}
+
+	.small-padding {
+		.cell {
+			padding-left: 5px;
+			padding-right: 5px;
+		}
+	}
+
+	.fixed-width {
+		.el-button--mini {
+			padding: 7px 10px;
+		}
+	}
+}
+</style>

+ 3 - 3
vue.config.js

@@ -41,7 +41,7 @@ module.exports = {
     // before: require('./mock/mock-server.js'),
     proxy: {
       '/api': {
-        target: 'https://nsadminapi.tuanfengkeji.cn', // 测试
+        target: 'https://nsadminapitest.tuanfengkeji.cn', // 测试
         // target: 'http://192.168.0.91:9103', // 平台端
         // target: 'http://192.168.0.91:9003', // 商家端
         changeOrigin: true,
@@ -50,7 +50,7 @@ module.exports = {
         }
       },
       '/adminapi': {
-        target: 'https://nsadminapi.tuanfengkeji.cn', // 测试
+        target: 'https://nsadminapitest.tuanfengkeji.cn', // 测试
         // target: 'http://192.168.0.91:9103', // 平台端
         // target: 'http://192.168.0.91:9003', // 商家端
         changeOrigin: true,
@@ -59,7 +59,7 @@ module.exports = {
         }
       },
       '/': {
-        target: 'https://nsadminapi.tuanfengkeji.cn', // 测试
+        target: 'https://nsadminapitest.tuanfengkeji.cn', // 测试
         // target: 'http://192.168.0.91:9103', // 平台端
         // target: 'http://192.168.0.91:9003', // 商家端
         changeOrigin: true