|
|
@@ -721,6 +721,51 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <!-- 在这里添加等级返利设置 -->
|
|
|
+ <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
|
|
|
+ <div class="grid-demo grid-demo-bg1">
|
|
|
+ <div class="layui-form-item">
|
|
|
+ <label class="layui-form-label">等级返利设置</label>
|
|
|
+ <div class="layui-input-block">
|
|
|
+ <input type="radio" name="level_set" lay-filter="level_set" value="1"
|
|
|
+ title="开启"
|
|
|
+ :checked="formData.level_set == 1 ? true : false">
|
|
|
+ <input type="radio" name="level_set" lay-filter="level_set" value="0"
|
|
|
+ title="关闭"
|
|
|
+ :checked="formData.level_set == 0 ? true : false">
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="layui-col-xs12 layui-col-sm12 layui-col-md12" v-if="formData.level_set == 1">
|
|
|
+ <div class="grid-demo grid-demo-bg1">
|
|
|
+ <div class="layui-form-item">
|
|
|
+ <label class="layui-form-label">等级返利比例(%)</label>
|
|
|
+ <div class="layui-input-block">
|
|
|
+ <table class="layui-table">
|
|
|
+ <thead>
|
|
|
+ <tr>
|
|
|
+ <th width="20%">等级名称</th>
|
|
|
+ <th width="20%">返利比例(%)</th>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ <tbody>
|
|
|
+ <tr v-for="(item, index) in level_radio" :key="index">
|
|
|
+ <td>{{ item.level_name }}</td>
|
|
|
+ <td>
|
|
|
+ <input type="number" v-model="item.ratio" class="layui-input"
|
|
|
+ placeholder="请输入返利比例" step="0.01" min="0" max="100">
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ <span class="info">设置每个等级对应的返利百分比</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
<div class="layui-col-xs12 layui-col-sm4 layui-col-md4">
|
|
|
<div class="grid-demo grid-demo-bg1">
|
|
|
<div class="layui-form-item">
|
|
|
@@ -1048,6 +1093,7 @@
|
|
|
upload: {
|
|
|
videoIng: false
|
|
|
},
|
|
|
+
|
|
|
formData: {
|
|
|
cate_id: [],
|
|
|
temp_id: 0,
|
|
|
@@ -1128,7 +1174,19 @@
|
|
|
activity: {'秒杀': '#1E9FFF', '砍价': '#189688', '拼团': '#FEB900'},
|
|
|
attr: [],//临时属性
|
|
|
newRule: false,//是否添加新规则
|
|
|
- radioRule: ['store_type', 'is_sub', 'is_show', 'is_hot', 'is_benefit', 'is_new', 'is_good', 'is_best','is_wholesale', 'spec_type'],//radio 当选规则
|
|
|
+ // ... 其他已有数据保持不变
|
|
|
+ level_set: 0,
|
|
|
+ level_radio: [
|
|
|
+ { level_name: '青源客', ratio: '' },
|
|
|
+ { level_name: '青润使', ratio: '' },
|
|
|
+ { level_name: '青金团', ratio: '' },
|
|
|
+ { level_name: '青玉团', ratio: '' },
|
|
|
+ { level_name: '青谷团', ratio: '' }
|
|
|
+ ],
|
|
|
+ // 添加level_set到radioRule数组中
|
|
|
+ radioRule: ['store_type', 'is_sub', 'is_show', 'is_hot', 'is_benefit', 'is_new', 'is_good', 'is_best','is_wholesale', 'spec_type', 'level_set'],
|
|
|
+ // ... 其他数据保持不变
|
|
|
+ // radioRule: ['store_type', 'is_sub', 'is_show', 'is_hot', 'is_benefit', 'is_new', 'is_good', 'is_best','is_wholesale', 'spec_type'],//radio 当选规则
|
|
|
rule: { //多图选择规则
|
|
|
slider_image: {
|
|
|
maxLength: 5
|
|
|
@@ -1165,6 +1223,10 @@
|
|
|
// this.formData.attr.pic = n;
|
|
|
// }
|
|
|
// }
|
|
|
+ // ... 其他watch保持不变
|
|
|
+ 'formData.level_set': function(n) {
|
|
|
+ // 处理level_set变化
|
|
|
+ },
|
|
|
},
|
|
|
methods: {
|
|
|
back: function () {
|
|
|
@@ -1274,6 +1336,29 @@
|
|
|
a: 'get_product_info',
|
|
|
q: {id: that.id}
|
|
|
})).then(function (res) {
|
|
|
+ // ... 原有的数据处理代码保持不变
|
|
|
+
|
|
|
+ var productInfo = res.data.productInfo || {};
|
|
|
+ if (productInfo.id && that.id) {
|
|
|
+ that.$set(that, 'formData', productInfo);
|
|
|
+ // 处理等级返利数据
|
|
|
+ if (productInfo.level_radio && productInfo.level_radio.length > 0) {
|
|
|
+ that.$set(that, 'level_radio', productInfo.level_radio);
|
|
|
+ that.formData.level_set = 1;
|
|
|
+ } else {
|
|
|
+ // 如果没有数据,重置为初始值
|
|
|
+ that.$set(that, 'level_radio', [
|
|
|
+ { level_name: '青源客', ratio: '' },
|
|
|
+ { level_name: '青润使', ratio: '' },
|
|
|
+ { level_name: '青金团', ratio: '' },
|
|
|
+ { level_name: '青玉团', ratio: '' },
|
|
|
+ { level_name: '青谷团', ratio: '' }
|
|
|
+ ]);
|
|
|
+ that.formData.level_set = 0;
|
|
|
+ }
|
|
|
+ that.generate();
|
|
|
+ }
|
|
|
+ // ... 后续代码保持不变
|
|
|
that.$set(that, 'cateList', res.data.cateList);
|
|
|
that.$set(that, 'tempList', res.data.tempList);
|
|
|
that.$set(that, 'merList', res.data.merList);
|
|
|
@@ -1624,6 +1709,25 @@
|
|
|
},
|
|
|
handleSubmit: function () {
|
|
|
var that = this, cate_id = $('input[name="cate_id"]').val();
|
|
|
+ // ... 原有的验证代码保持不变
|
|
|
+
|
|
|
+ // 处理等级返利数据
|
|
|
+ if (that.formData.level_set == 1) {
|
|
|
+ // 验证等级返利数据
|
|
|
+ for (var i = 0; i < that.level_radio.length; i++) {
|
|
|
+ var ratio = parseFloat(that.level_radio[i].ratio);
|
|
|
+ if (isNaN(ratio) || ratio < 0 || ratio > 100) {
|
|
|
+ return that.showMsg('请正确填写等级返利比例(0-100之间)');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 将level_radio赋值给formData
|
|
|
+ that.formData.level_radio = that.level_radio;
|
|
|
+ } else {
|
|
|
+ // 关闭时清空数据
|
|
|
+ that.formData.level_radio = [];
|
|
|
+ }
|
|
|
+
|
|
|
+ // ... 后续原有的提交代码保持不变
|
|
|
if (cate_id != '') {
|
|
|
this.formData.cate_id = cate_id.split(',');
|
|
|
}
|