|
@@ -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>
|
|
|
+
|