后台等级设置优化

main
ztt 8 months ago
parent b4e4b863de
commit c14c817698
  1. 7
      application/admin/controller/shopro/commission/Level.php
  2. 8
      application/admin/view/shopro/commission/level/add.html
  3. 16
      application/admin/view/shopro/commission/level/index.html
  4. 19
      public/assets/js/backend/shopro/commission/level.js

@ -78,6 +78,13 @@ class Level extends Common
$params = $this->request->only(['level', 'name', 'image', 'commission_rules', 'upgrade_type', 'upgrade_rules', 'coupon_rules', 'total_consume']); $params = $this->request->only(['level', 'name', 'image', 'commission_rules', 'upgrade_type', 'upgrade_rules', 'coupon_rules', 'total_consume']);
// dd($params);
if ($params['level'] != 1) {
if (empty($params['coupon_rules']['programme_1'])) $this->error('请选择方案一');
if (empty($params['coupon_rules']['programme_2'])) $this->error('请选择方案二');
}
$result = Db::transaction(function () use ($id, $params) { $result = Db::transaction(function () use ($id, $params) {
$this->svalidate($params); $this->svalidate($params);

@ -95,12 +95,12 @@
<el-form-item label="消费门槛"> <el-form-item label="消费门槛">
<el-input class="sa-w-360" v-model="form.model.total_consume" placeholder="请输入消费门槛"></el-input> <el-input class="sa-w-360" v-model="form.model.total_consume" placeholder="请输入消费门槛"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="方案一" prop="coupon_rules.programme_1" :rules="form.rules.commission_rules.programme_1"> <el-form-item v-if="form.model.level > 1" label="方案一" prop="coupon_rules.programme_1" :rules="form.rules.coupon_rules.programme_1">
<el-button type="primary" link <el-button type="primary" link
@click="onSelectCoupon1">选择商品券 @click="onSelectCoupon1">选择商品券
</el-button> </el-button>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item v-if="form.model.level > 1">
<div class="sa-template-wrap"> <div class="sa-template-wrap">
<template v-if="form.model.coupon_rules.programme_1.length > 0"> <template v-if="form.model.coupon_rules.programme_1.length > 0">
<div class="header sa-flex"> <div class="header sa-flex">
@ -122,12 +122,12 @@
</el-form-item> </el-form-item>
<el-form-item label="方案二" prop="coupon_rules.programme_2" :rules="form.rules.commission_rules.programme_2"> <el-form-item v-if="form.model.level > 1" label="方案二" prop="coupon_rules.programme_2" :rules="form.rules.coupon_rules.programme_2">
<el-button type="primary" link <el-button type="primary" link
@click="onSelectCoupon2">选择商品券 @click="onSelectCoupon2">选择商品券
</el-button> </el-button>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item v-if="form.model.level > 1">
<div class="sa-template-wrap"> <div class="sa-template-wrap">
<template v-if="form.model.coupon_rules.programme_2.length > 0"> <template v-if="form.model.coupon_rules.programme_2.length > 0">
<div class="header sa-flex"> <div class="header sa-flex">

@ -55,14 +55,14 @@
{if $auth->check('shopro/commission/level/edit')} {if $auth->check('shopro/commission/level/edit')}
<el-button type="primary" link @click="onEdit(scope.row.level)">编辑</el-button> <el-button type="primary" link @click="onEdit(scope.row.level)">编辑</el-button>
{/if} {/if}
<el-popconfirm v-if="scope.row.level != 1" width="fit-content" confirm-button-text="确认" <!-- <el-popconfirm v-if="scope.row.level != 1" width="fit-content" confirm-button-text="确认"-->
cancel-button-text="取消" title="确认删除这条记录?" @confirm="onDelete(scope.row.level)"> <!-- cancel-button-text="取消" title="确认删除这条记录?" @confirm="onDelete(scope.row.level)">-->
<template #reference> <!-- <template #reference>-->
{if $auth->check('shopro/commission/level/delete')} <!-- {if $auth->check('shopro/commission/level/delete')}-->
<el-button type="danger" link>删除</el-button> <!-- <el-button type="danger" link>删除</el-button>-->
{/if} <!-- {/if}-->
</template> <!-- </template>-->
</el-popconfirm> <!-- </el-popconfirm>-->
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>

@ -120,8 +120,23 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
level: [{ required: true, message: '请选择分销商等级', trigger: 'blur' }], level: [{ required: true, message: '请选择分销商等级', trigger: 'blur' }],
}, },
coupon_rules: [{ coupon_rules: [{
programme_1:[{ required: true, message: '方案一', trigger: 'blur' }], programme_1:[{
programme_2:[{ required: true, message: '方案二', trigger: 'blur' }], validator: (rule, value, callback) => {
console.log(value)
if (isEmpty(value)) {
callback(new Error('请选择方案一'));
} else {
callback();
}
}, trigger: 'blur' }],
programme_2:[{
validator: (rule, value, callback) => {
if (isEmpty(value)) {
callback(new Error('请选择方案二'));
} else {
callback();
}
}, trigger: 'blur' }],
}] }]
}, },
}) })

Loading…
Cancel
Save