739 行
46 KiB
HTML
可执行文件
739 行
46 KiB
HTML
可执行文件
<!--[1.8.20]-->
|
||
<style>
|
||
strong {
|
||
padding: 0 5px;
|
||
}
|
||
|
||
input[type=number] {
|
||
-moz-appearance: textfield;
|
||
}
|
||
|
||
input[type=number]::-webkit-inner-spin-button,
|
||
input[type=number]::-webkit-outer-spin-button {
|
||
-webkit-appearance: none;
|
||
}
|
||
|
||
.edui-default .edui-toolbar .edui-combox .edui-combox-body {
|
||
line-height: 14px !important;
|
||
}
|
||
|
||
.edui-default .edui-button-body,
|
||
.edui-splitbutton-body,
|
||
.edui-menubutton-body,
|
||
.edui-combox-body {
|
||
line-height: 14px !important;
|
||
}
|
||
|
||
.setTips {
|
||
float: none;
|
||
display: inline-block;
|
||
margin-left: 30px;
|
||
}
|
||
|
||
.setTips1 {
|
||
float: none;
|
||
display: inline-block;
|
||
margin-left: 212px;
|
||
}
|
||
</style>
|
||
<div id="tabs" style="margin-top:2px;">
|
||
<el-tabs tab-position="left">
|
||
<el-tab-pane label="积分赠送规则">
|
||
<el-tabs type="border-card">
|
||
<el-tab-pane label="常规会员设置">
|
||
<div class="layui-card-header">积分设置</div>
|
||
<div class="layui-card-body">
|
||
<el-form ref="ruleForm" :rules="rules" :model="ruleForm" label-width="160px">
|
||
<el-form-item label="签到(一天)赠送积分" style="width:400px;">
|
||
<el-input v-model="ruleForm.signin_give"></el-input>
|
||
</el-form-item>
|
||
<el-form-item label="完善资料赠送积分" style="width:400px;">
|
||
<el-input v-model="ruleForm.infoscore"></el-input>
|
||
</el-form-item>
|
||
<el-form-item label="消费获得积分">
|
||
<el-switch v-model="ruleForm.percent_state"></el-switch>
|
||
<span class="layui-form-mid layui-word-aux setTips1">开启后会员购买商品则送积分</span>
|
||
</el-form-item>
|
||
<el-form-item v-if="ruleForm.percent_state" label="消费">
|
||
<div style="display: flex">
|
||
<el-form-item :prop="ruleForm.percent_state ? 'flower_price':''">
|
||
<el-input v-model="ruleForm.flower_price" style="width:150px;margin: 0 20px;">
|
||
</el-input>
|
||
</el-form-item>
|
||
元获得
|
||
<el-form-item :prop="ruleForm.percent_state ? 'percent':''">
|
||
<el-input v-model="ruleForm.percent" style="width:150px;margin: 0 20px;">
|
||
</el-input>
|
||
</el-form-item>
|
||
积分
|
||
|
||
<span class="layui-form-mid layui-word-aux setTips">积分换算最后结果为整数</span>
|
||
</div>
|
||
</el-form-item>
|
||
<el-form-item v-if="ruleForm.percent_state" label="余额支付赠送积分">
|
||
<el-switch v-model="ruleForm.vip_pay_integral_state"></el-switch>
|
||
<span class="layui-word-aux setTips1">
|
||
<span>开启后在消费获得积分的前提下会员用余额支付则送积分</span>
|
||
<el-tooltip class="item" effect="dark" content="Top Left 提示文字"
|
||
placement="top-start">
|
||
<template slot="content">
|
||
<p>当商户后台设置了余额支付不赠积分后,假如消费获得积分设置为:1积分=1元,用户购买了</p>
|
||
<p><strong>赠送固定积分的商品</strong>(A:单价5元,购买送10积分;B:单价8元,购买送20积分) 各一个</p>
|
||
<p><strong>不赠送固定积分的商品</strong>(C:单价10元;D:单价15元)各一个(比例积分的金额共<strong>25</strong>元)
|
||
</p>
|
||
<p>①支付方式为非组合支付且没有使用余额支付(或组合支付且组合中没有余额支付)时:</p>
|
||
<p style="text-indent: 30px">用户总花费38元,将获得:30(固定积分)+25(比例积分)= 55积分</p>
|
||
<p>②支付方式为余额支付时:</p>
|
||
<p style="text-indent: 30px">用户将花费38元余额,将获得:30(固定积分)+0(比例积分)=30积分</p>
|
||
<p>③支付方式为组合支付时,且使用了18元现金(或其他非余额支付)+20元余额:</p>
|
||
<p style="text-indent: 30px">由于:25元(比例积分)>18元(非余额支付),则比例积分对应金额为18元</p>
|
||
<p style="text-indent: 30px">将获得:30(固定积分)+18(比例积分)= 48积分</p>
|
||
<p>④支付方式为组合支付,且使用了30元现金(或其他非余额支付)+8元余额:</p>
|
||
<p style="text-indent: 30px">由于:25元(比例积分)<30元(非余额支付),则比例积分对应金额为25元< /p>
|
||
<p style="text-indent: 30px">将获得:30(固定积分)+25(比例积分)= 55积分</p>
|
||
</template>
|
||
<el-button size="mini" type="text" icon="el-icon-question">规则</el-button>
|
||
</el-tooltip>
|
||
</span>
|
||
</el-form-item>
|
||
<el-form-item label="充值获得积分">
|
||
<el-switch v-model="ruleForm.recharge_state"></el-switch>
|
||
<span class="layui-form-mid layui-word-aux setTips1">开启后会员余额充值则送积分</span>
|
||
</el-form-item>
|
||
<el-form-item v-if="ruleForm.recharge_state" label="充值">
|
||
<div style="display: flex">
|
||
<el-form-item :prop="ruleForm.recharge_state?'recharge_price':''">
|
||
<el-input v-model="ruleForm.recharge_price" style="width:150px;margin: 0 20px;">
|
||
</el-input>
|
||
</el-form-item>
|
||
元获得
|
||
<el-form-item :prop="ruleForm.recharge_state?'recharge_integral':''">
|
||
<el-input v-model="ruleForm.recharge_integral"
|
||
style="width:150px;margin: 0 20px;"></el-input>
|
||
</el-form-item>
|
||
积分
|
||
<span class="layui-form-mid layui-word-aux setTips">积分换算最后结果为整数</span>
|
||
</div>
|
||
</el-form-item>
|
||
<el-form-item label="指定商品送积分">
|
||
<el-switch v-model="ruleForm.goods_integral_state"></el-switch>
|
||
<span class="layui-form-mid layui-word-aux setTips1">开启后可对商品设置会员购买送固定积分</span>
|
||
</el-form-item>
|
||
<el-form-item label="详情设置">
|
||
<div>
|
||
<textarea id="editor" type="text/plain" style="width:600px;height: 400px;"
|
||
name="details">{$vipset['vip_detail']}</textarea>
|
||
</div>
|
||
</el-form-item>
|
||
<el-form-item>
|
||
<if condition="$authArr['vipconfigset'] eq true">
|
||
<el-button type="primary" @click="onSubmit('ruleForm')">保存</el-button>
|
||
</if>
|
||
<el-button>取消</el-button>
|
||
</el-form-item>
|
||
</el-form>
|
||
</div>
|
||
</el-tab-pane>
|
||
<el-tab-pane label="Plus会员设置">
|
||
<div class="layui-card-header">积分设置</div>
|
||
<div class="layui-card-body">
|
||
<el-form ref="plusForm" :rules="plusRules" :model="plusForm" label-width="160px">
|
||
<el-form-item label="签到(一天)赠送积分" style="width:400px;">
|
||
<el-input v-model="plusForm.plus_signin_give"></el-input>
|
||
</el-form-item>
|
||
<el-form-item label="完善资料赠送积分" style="width:400px;">
|
||
<el-input v-model="plusForm.plus_infoscore"></el-input>
|
||
</el-form-item>
|
||
<el-form-item label="消费获得积分">
|
||
<template slot="label">
|
||
<el-tooltip class="item" effect="dark" content="Top Left 提示文字"
|
||
placement="top-start">
|
||
<template slot="content">
|
||
<p>由于PLUS权益为最高权益,当PLUS余额支付赠送积分设置关闭时,如果常规会员消费获得积分开启,PLUS会员消费将会获得常规会员设置的相同积分
|
||
</p>
|
||
</template>
|
||
<span>消费获得积分<i class="el-icon-question"></i></span>
|
||
</el-tooltip>
|
||
</template>
|
||
<el-switch v-model="plusForm.plus_percent_state"></el-switch>
|
||
</el-form-item>
|
||
<el-form-item v-if="plusForm.plus_percent_state">
|
||
<div style="display: flex;align-items: center;margin-bottom: 20px">
|
||
<el-radio v-model="plusForm.plus_flower_type" label="1">倍数</el-radio>
|
||
<el-form-item prop="plus_percent"
|
||
v-if="plusForm.plus_percent_state && plusForm.plus_flower_type == 1">
|
||
消费常规会员同样金额获得
|
||
<el-input v-model="plusForm.plus_percent" style="width:80px;margin: 0px 20px;">
|
||
</el-input>
|
||
倍常规会员消费积分
|
||
</el-form-item>
|
||
</div>
|
||
<div style="display: flex;align-items: center;margin-bottom: 20px">
|
||
<el-radio v-model="plusForm.plus_flower_type" label="2">数值</el-radio>
|
||
<div style="display: flex"
|
||
v-if="plusForm.plus_percent_state && plusForm.plus_flower_type == 2">
|
||
消费
|
||
<el-form-item prop="plus_flower_price">
|
||
<el-input v-model="plusForm.plus_flower_price"
|
||
style="width:80px;margin: 0px 20px;"></el-input>
|
||
</el-form-item>
|
||
元获得
|
||
<el-form-item prop="plus_flower_percent">
|
||
<el-input v-model="plusForm.plus_flower_percent"
|
||
style="width:100px;margin: 0px 20px;"></el-input>
|
||
</el-form-item>
|
||
积分
|
||
</div>
|
||
</div>
|
||
</el-form-item>
|
||
<el-form-item v-if="plusForm.plus_percent_state" label="余额支付赠送积分">
|
||
<el-switch v-model="ruleForm.plus_pay_integral_state"></el-switch>
|
||
<span class="layui-word-aux setTips1">
|
||
<span>开启后在消费获得积分的前提下会员用余额支付则送积分</span>
|
||
<el-tooltip class="item" effect="dark" content="Top Left 提示文字"
|
||
placement="top-start">
|
||
<template slot="content">
|
||
<p>当商户后台设置了余额支付不赠积分后,假如消费获得积分设置为:1积分=1元,用户购买了</p>
|
||
<p><strong>赠送固定积分的商品</strong>(A:单价5元,购买送10积分;B:单价8元,购买送20积分) 各一个</p>
|
||
<p><strong>不赠送固定积分的商品</strong>(C:单价10元;D:单价15元)各一个(比例积分的金额共<strong>25</strong>元)
|
||
</p>
|
||
<p>①支付方式为非组合支付且没有使用余额支付(或组合支付且组合中没有余额支付)时:</p>
|
||
<p style="text-indent: 30px">用户总花费38元,将获得:30(固定积分)+25(比例积分)= 55积分</p>
|
||
<p>②支付方式为余额支付时:</p>
|
||
<p style="text-indent: 30px">用户将花费38元余额,将获得:30(固定积分)+0(比例积分)=30积分</p>
|
||
<p>③支付方式为组合支付时,且使用了18元现金(或其他非余额支付)+20元余额:</p>
|
||
<p style="text-indent: 30px">由于:25元(比例积分)>18元(非余额支付),则比例积分对应金额为18元</p>
|
||
<p style="text-indent: 30px">将获得:30(固定积分)+18(比例积分)= 48积分</p>
|
||
<p>④支付方式为组合支付,且使用了30元现金(或其他非余额支付)+8元余额:</p>
|
||
<p style="text-indent: 30px">由于:25元(比例积分)<30元(非余额支付),则比例积分对应金额为25元< /p>
|
||
<p style="text-indent: 30px">将获得:30(固定积分)+25(比例积分)= 55积分</p>
|
||
</template>
|
||
<el-button size="mini" type="text" icon="el-icon-question">规则</el-button>
|
||
</el-tooltip>
|
||
</span>
|
||
</el-form-item>
|
||
<el-form-item label="充值获得积分">
|
||
<template slot="label">
|
||
<el-tooltip class="item" effect="dark" content="Top Left 提示文字"
|
||
placement="top-start">
|
||
<template slot="content">
|
||
<p>由于PLUS权益为最高权益,当PLUS充值获得积分设置关闭时,如果常规会员充值获得积分开启,PLUS会员充值将会获得常规会员设置的相同积分</p>
|
||
</template>
|
||
<span>充值获得积分<i class="el-icon-question"></i></span>
|
||
</el-tooltip>
|
||
</template>
|
||
<el-switch v-model="plusForm.plus_recharge_state"></el-switch>
|
||
</el-form-item>
|
||
<el-form-item v-if="plusForm.plus_recharge_state">
|
||
<div style="display: flex;align-items: center;margin-bottom: 20px">
|
||
<el-radio style="height: 40px;line-height: 40px"
|
||
v-model="plusForm.plus_recharge_type" label="1">倍数
|
||
</el-radio>
|
||
<el-form-item prop="plus_recharge_integral"
|
||
v-if="plusForm.plus_recharge_state && plusForm.plus_recharge_type == 1">
|
||
充值常规会员同样金额获得
|
||
<el-input v-model="plusForm.plus_recharge_integral"
|
||
style="width:80px;margin: 0px 20px;"></el-input>
|
||
倍常规会员充值积分
|
||
</el-form-item>
|
||
</div>
|
||
<div style="display: flex;align-items: center;margin-bottom: 20px">
|
||
<el-radio v-model="plusForm.plus_recharge_type" label="2"
|
||
style="height: 40px;line-height: 40px">数值
|
||
</el-radio>
|
||
<div style="display: flex;"
|
||
v-if="plusForm.plus_recharge_state && plusForm.plus_recharge_type == 2">
|
||
充值
|
||
<el-form-item prop="plus_recharge_price">
|
||
<el-input v-model="plusForm.plus_recharge_price"
|
||
style="width:80px;margin: 0px 20px;"></el-input>
|
||
</el-form-item>
|
||
元获得
|
||
<el-form-item prop="plus_recharge_get_integral">
|
||
<el-input v-model="plusForm.plus_recharge_get_integral"
|
||
style="width:100px;margin: 0px 20px;"></el-input>
|
||
</el-form-item>
|
||
积分
|
||
</div>
|
||
</div>
|
||
</el-form-item>
|
||
<el-form-item label="商品积分" prop="goods_integral_multiple">
|
||
<el-switch v-model="plusForm.goods_integral_plus_state"></el-switch>
|
||
<div>
|
||
<span style="display: inline-block;">指定商品送积分<el-input
|
||
v-model="plusForm.goods_integral_multiple"
|
||
style="width:150px;margin: 0px 20px;"></el-input>倍常规会员商品积分</span>
|
||
</div>
|
||
</el-form-item>
|
||
<el-form-item>
|
||
<if condition="$authArr['plus_vipconfigset'] eq true">
|
||
<el-button type="primary" @click="plus_dosubmit('plusForm')">保存</el-button>
|
||
</if>
|
||
<el-button>取消</el-button>
|
||
</el-form-item>
|
||
</el-form>
|
||
</div>
|
||
</el-tab-pane>
|
||
</el-tabs>
|
||
</el-tab-pane>
|
||
<el-tab-pane label="积分营销规则">
|
||
<el-form label-width="120px" :model="integralForm" :rules="integrals" ref="integralForm">
|
||
<el-form-item label="是否开启" require>
|
||
<el-switch v-model="integral_arrive_cash" inactive-value="0"
|
||
:active-text="integral_arrive_cash==1?'开启':'关闭'" active-value="1">
|
||
</el-switch>
|
||
</el-form-item>
|
||
<template v-if="integral_arrive_cash==1">
|
||
<el-form-item label="积分抵现比例">
|
||
<div style="display: flex;align-content: center;">
|
||
<el-form-item prop="integral_arrive_cash_data">
|
||
<el-input type="text" step="1" size="small"
|
||
oninput="value=this.value.replace(/^[0]|\D/,'')"
|
||
v-model="integralForm.integral_arrive_cash_data" placeholder="1~(整数)"
|
||
style="width: 80px"></el-input>
|
||
</el-form-item>
|
||
<el-form-item prop="integral_arrive_cash_price">
|
||
积分 =
|
||
<el-input type="text" step="1" size="small"
|
||
v-model="integralForm.integral_arrive_cash_price" placeholder="金额"
|
||
style="width: 80px"></el-input>
|
||
元
|
||
</el-form-item>
|
||
</div>
|
||
</el-form-item>
|
||
|
||
<el-form-item label="营销方式">
|
||
<el-radio v-model="marketing_methods" label="1">基于订单</el-radio>
|
||
<el-radio v-model="marketing_methods" label="2">基于商品</el-radio>
|
||
</el-form-item>
|
||
<el-form-item label="整单可抵现比例" prop="integral_arrive_cash_rate" v-if="marketing_methods == 1">
|
||
<el-input type="text" step="0.0001" size="small"
|
||
v-model="integralForm.integral_arrive_cash_rate" placeholder="1~99" style="width: 160px">
|
||
<template slot="append">%</template>
|
||
</el-input>
|
||
<p style="color: #999;font-size: 13px">如100元的订单,整单可抵现比例为10%:</p>
|
||
<p style="color: #999;font-size: 13px">那么此订单中的10元将可使用积分进行抵扣,所需积分根据积分抵现比例进行换算</p>
|
||
</el-form-item>
|
||
|
||
</template>
|
||
<el-form-item>
|
||
<if condition="$authArr['saveIntegralSet'] eq true">
|
||
<el-button type="primary" size="small" @click="saveIntegralSet('integralForm')">
|
||
保存设置
|
||
</el-button>
|
||
</if>
|
||
</el-form-item>
|
||
</el-form>
|
||
</el-tab-pane>
|
||
</el-tabs>
|
||
</div>
|
||
<script>
|
||
UE.delEditor('editor');
|
||
var ue = UE.getEditor('editor');
|
||
</script>
|
||
<script type="text/javascript">
|
||
var integral_arrive_cash_rate = "{$MerchantConfig['integral_arrive_cash_rate']}";
|
||
var integral_arrive_cash_data = "{$MerchantConfig['integral_arrive_cash_data']}";
|
||
var integral_arrive_cash_price = "{$MerchantConfig['integral_arrive_cash_price']}";
|
||
integral_arrive_cash_rate = integral_arrive_cash_rate ? parseFloat(integral_arrive_cash_rate) : '';
|
||
integral_arrive_cash_data = integral_arrive_cash_data ? parseFloat(integral_arrive_cash_data) : '';
|
||
integral_arrive_cash_price = integral_arrive_cash_price ? integral_arrive_cash_price : '';
|
||
var tabs = new Vue({
|
||
el: '#tabs',
|
||
data: function () {
|
||
return {
|
||
ruleForm: {
|
||
signin_give: "{$vipset['signin_give']}",
|
||
infoscore: "{$vipset['infoscore']}",
|
||
percent_state: '{$vipset["percent_state"]}' == 1 ? true : false,
|
||
vip_pay_integral_state: '{$vipset["vip_pay_integral_state"]}' == 1 ? true : false,
|
||
flower_price: '{$vipset["flower_price"]}',
|
||
percent: "{$vipset['percent']}",
|
||
recharge_state: '{$vipset["recharge_state"]}' == 1 ? true : false,
|
||
goods_integral_state: '{$vipset["goods_integral_state"]}' == 1 ? true : false,
|
||
recharge_price: "{$vipset['recharge_price']}",
|
||
recharge_integral: "{$vipset['recharge_integral']}",
|
||
},
|
||
rules: {
|
||
signin_give: [{message: '请输入签到积分', required: false, trigger: 'blur'}, {
|
||
validator: function (rule, value, callback) {
|
||
var reg = /^\+?[1-9][0-9]*$/;
|
||
if (!reg.test(value)) {
|
||
console.log(value);
|
||
callback(new Error("签到积分必须是整数"));
|
||
} else {
|
||
callback();
|
||
}
|
||
if (value < 0) {
|
||
callback(new Error("签到积分不能小于0"));
|
||
} else {
|
||
callback();
|
||
}
|
||
}, trigger: 'blur'
|
||
}],
|
||
infoscore: [{message: '请输入完善资料积分', required: true, trigger: 'blur'}, {
|
||
validator: function (rule, value, callback) {
|
||
var reg = /^\+?[1-9][0-9]*$/;
|
||
if (!reg.test(value)) {
|
||
callback(new Error("完善资料积分必须是整数"));
|
||
} else {
|
||
callback();
|
||
}
|
||
if (value < 0) {
|
||
callback(new Error("完善资料积分不能小于0"));
|
||
} else {
|
||
callback();
|
||
}
|
||
}, trigger: 'blur'
|
||
}],
|
||
flower_price: [{message: '请输入消费金额', required: false, trigger: 'blur'}, {
|
||
validator: function (rule, value, callback) {
|
||
var reg = /^[0-9]+(.[0-9]{1,2})?$/;
|
||
if (!value || !reg.test(value)) {
|
||
callback(new Error("请输入正确消费金额"));
|
||
} else {
|
||
callback();
|
||
}
|
||
}, trigger: 'blur'
|
||
}],
|
||
percent: [{message: '请输入赠送积分', required: false, trigger: 'blur'}, {
|
||
validator: function (rule, value, callback) {
|
||
var reg = /^\+?[1-9][0-9]*$/;
|
||
if (!value || !reg.test(value)) {
|
||
callback(new Error("请输入正确消费赠送积分"));
|
||
} else {
|
||
callback();
|
||
}
|
||
}, trigger: 'blur'
|
||
}],
|
||
recharge_integral: [{message: '请输入充值赠送积分', required: false, trigger: 'blur'}, {
|
||
validator: function (rule, value, callback) {
|
||
var bg = /^\+?[1-9][0-9]*$/;
|
||
if (!bg.test(value) || !value) {
|
||
callback(new Error("请输入正确充值赠送积分"));
|
||
} else {
|
||
callback();
|
||
}
|
||
}, trigger: 'blur'
|
||
}],
|
||
recharge_price: [{message: '请输入充值金额', required: false, trigger: 'blur'}, {
|
||
validator: function (rule, value, callback) {
|
||
var reg = /^[0-9]+(.[0-9]{1,2})?$/;
|
||
if (!value || !reg.test(value)) {
|
||
callback(new Error("请输入正确充值金额"));
|
||
} else {
|
||
callback();
|
||
}
|
||
}, trigger: 'blur'
|
||
}],
|
||
},
|
||
plusForm: {
|
||
plus_signin_give: "{$vipset['plus_signin_give']}",
|
||
plus_infoscore: "{$vipset['plus_infoscore']}",
|
||
plus_percent_state: '{$vipset["plus_percent_state"]}' == 1 ? true : false,
|
||
plus_pay_integral_state: '{$vipset["plus_pay_integral_state"]}' == 1 ? true : false,
|
||
plus_percent: "{$vipset['plus_percent']}",
|
||
plus_recharge_state: '{$vipset["plus_recharge_state"]}' == 1 ? true : false,
|
||
plus_recharge_integral: "{$vipset['plus_recharge_integral']}",
|
||
goods_integral_plus_state: '{$vipset["goods_integral_plus_state"]}' == 1 ? true : false,
|
||
goods_integral_multiple: "{$vipset['goods_integral_multiple']}",
|
||
plus_flower_type: "{$vipset['plus_flower_type']}",
|
||
plus_flower_price: "{$vipset['plus_flower_price']}",
|
||
plus_flower_percent: "{$vipset['plus_flower_percent']}",
|
||
plus_recharge_type: "{$vipset['plus_recharge_type']}",
|
||
plus_recharge_price: "{$vipset['plus_recharge_price']}",
|
||
plus_recharge_get_integral: "{$vipset['plus_recharge_get_integral']}"
|
||
},
|
||
plusRules: {
|
||
plus_signin_give: [{message: '请输入签到积分', required: false, trigger: 'blur'}, {
|
||
validator: function (rule, value, callback) {
|
||
var reg = /^\+?[1-9][0-9]*$/;
|
||
if (!reg.test(value)) {
|
||
callback(new Error("签到积分必须是整数"));
|
||
} else if (value <= 0) {
|
||
callback(new Error("签到积分不能小于0"));
|
||
} else {
|
||
callback();
|
||
}
|
||
}, trigger: 'blur'
|
||
}],
|
||
plus_infoscore: [{message: '请输入完善资料积分', required: true, trigger: 'blur'}, {
|
||
validator: function (rule, value, callback) {
|
||
var reg = /^\+?[1-9][0-9]*$/;
|
||
if (!reg.test(value)) {
|
||
console.log(value);
|
||
callback(new Error("完善资料积分必须是整数"));
|
||
} else if (value <= 0) {
|
||
callback(new Error("完善资料积分不能小于0"));
|
||
} else {
|
||
callback();
|
||
}
|
||
}, trigger: 'blur'
|
||
}],
|
||
plus_percent: [{message: '请输入消费赠送积分倍数', required: true, trigger: 'blur'}, {
|
||
trigger: ['blur', 'change'],
|
||
validator: function (rule, value, callback) {
|
||
var bg = /^\+?[1-9][0-9]*$/;
|
||
if (!bg.test(value)) {
|
||
callback(new Error("请输入正确消费赠送积分倍数"));
|
||
} else if (value <= 0) {
|
||
callback(new Error("请输入正确消费赠送积分倍数"));
|
||
} else {
|
||
callback();
|
||
}
|
||
}
|
||
}],
|
||
plus_flower_price: [{message: '请输入消费金额', required: true, trigger: 'blur'}, {
|
||
trigger: ['blur', 'change'],
|
||
validator: function (rule, value, callback) {
|
||
var reg = /^[0-9]+(.[0-9]{1,2})?$/;
|
||
if (!value || !reg.test(value)) {
|
||
callback(new Error("消费金额有误"));
|
||
} else {
|
||
callback();
|
||
}
|
||
}
|
||
}],
|
||
plus_flower_percent: [{message: '请输入消费获得积分', required: true, trigger: 'blur'}, {
|
||
trigger: ['blur'],
|
||
validator: function (rule, value, callback) {
|
||
var reg = /^\+?[1-9][0-9]*$/;
|
||
if (!value || !reg.test(value)) {
|
||
callback(new Error("消费获得积分有误"));
|
||
} else {
|
||
callback();
|
||
}
|
||
}
|
||
}],
|
||
plus_recharge_integral: [{message: '请输入充值赠送积分倍数', required: true, trigger: 'blur'}, {
|
||
validator: function (rule, value, callback) {
|
||
var bg = /^\+?[1-9][0-9]*$/;
|
||
if (!bg.test(value)) {
|
||
callback(new Error("请输入正确充值赠送积分倍数"));
|
||
} else if (value <= 0) {
|
||
callback(new Error("请输入正确充值赠送积分倍数"));
|
||
} else {
|
||
callback();
|
||
}
|
||
}, trigger: 'blur'
|
||
}],
|
||
goods_integral_multiple: [{message: '请输入倍数', required: true, trigger: 'blur'}, {
|
||
validator: function (rule, value, callback) {
|
||
var reg = /^\+?[1-9][0-9]*$/;
|
||
if (tabs.plusForm.goods_integral_plus_state) {
|
||
if (!reg.test(value)) {
|
||
callback(new Error("倍数必须是整数"));
|
||
} else if (value <= 0) {
|
||
callback(new Error("倍数必须不能小于等于0"));
|
||
} else {
|
||
callback();
|
||
}
|
||
} else {
|
||
callback();
|
||
}
|
||
}, trigger: 'blur'
|
||
}],
|
||
plus_recharge_price: [{message: '请输入充值金额', required: true, trigger: 'blur'}, {
|
||
validator: function (rule, value, callback) {
|
||
var reg = /^[0-9]+(.[0-9]{1,2})?$/;
|
||
if (!value || !reg.test(value)) {
|
||
callback(new Error("消费金额有误"));
|
||
} else {
|
||
callback();
|
||
}
|
||
}, trigger: 'blur'
|
||
}],
|
||
plus_recharge_get_integral: [{message: '请输入充值获得积分', required: true, trigger: 'blur'}, {
|
||
validator: function (rule, value, callback) {
|
||
var reg = /^\+?[1-9][0-9]*$/;
|
||
if (!value || !reg.test(value)) {
|
||
callback(new Error("充值获得积分有误"));
|
||
} else {
|
||
callback();
|
||
}
|
||
}, trigger: 'blur'
|
||
}],
|
||
},
|
||
arriveCashLoading: false,//抵现层loading
|
||
integral_arrive_cash: "{$MerchantConfig['integral_arrive_cash']}",//积分抵现开启关闭状态,
|
||
pay_to_vip_state: "{$MerchantConfig['pay_to_vip_state']}",//积分抵现开启关闭状态,
|
||
marketing_methods: "{$MerchantConfig['marketing_methods']}",
|
||
integralForm: {
|
||
integral_arrive_cash_rate: integral_arrive_cash_rate,
|
||
integral_arrive_cash_data: integral_arrive_cash_data,
|
||
integral_arrive_cash_price: integral_arrive_cash_price,
|
||
},
|
||
integrals: {
|
||
integral_arrive_cash_rate: [{message: '请输入抵现比例', required: false, trigger: 'change'}, {
|
||
validator: function (rule, value, callback) {
|
||
var reg = /^[+]?\d*\.?\d{0,2}$/;
|
||
if ((!reg.test(value) || value < 1 || value > 99) && tabs.integral_arrive_cash == 1) {
|
||
callback(new Error("请输入正确的抵现比例"));
|
||
} else {
|
||
callback();
|
||
}
|
||
}, trigger: 'change'
|
||
}],
|
||
integral_arrive_cash_data: [{message: '请输入积分', required: true, trigger: 'change'}, {
|
||
validator: function (rule, value, callback) {
|
||
var reg = /^([1-9]\d*|[0]{1,1})$/;
|
||
console.log(value < 1);
|
||
if ((reg.test(value) == false || value < 1) && tabs.integral_arrive_cash == 1) {
|
||
callback(new Error("请输入正确的积分"));
|
||
} else {
|
||
callback();
|
||
}
|
||
}, trigger: 'change'
|
||
}],
|
||
integral_arrive_cash_price: [{message: '请输入金额', required: true, trigger: 'change'}, {
|
||
validator: function (rule, value, callback) {
|
||
var reg = /^[0-9]+(.[0-9]{1,2})?$/;
|
||
if ((!reg.test(value)) && tabs.integral_arrive_cash == 1) {
|
||
callback(new Error("请输入正确的金额"));
|
||
} else {
|
||
callback();
|
||
}
|
||
}, trigger: 'change'
|
||
}],
|
||
},
|
||
}
|
||
},
|
||
methods: {
|
||
onSubmit: function (formName) {
|
||
var that = this;
|
||
var details = ue.getContent();
|
||
var percent_state = that.ruleForm.percent_state ? 1 : 2;
|
||
var vip_pay_integral_state = that.ruleForm.vip_pay_integral_state ? 1 : 2;
|
||
var recharge_state = that.ruleForm.recharge_state ? 1 : 2;
|
||
var goods_integral_state = that.ruleForm.goods_integral_state ? 1 : 2;
|
||
this.$refs[formName].validate((valid) => {
|
||
if (valid) {
|
||
that.$confirm("确定提交", {
|
||
confirmButtonText: '继续',
|
||
cancelButtonText: '取消',
|
||
type: 'info'
|
||
}).then(() => {
|
||
$.ajax({
|
||
url: "{:U('vipconfigset')}",
|
||
data: {
|
||
signin_give: that.ruleForm.signin_give,
|
||
infoscore: that.ruleForm.infoscore,
|
||
vip_detail: details,
|
||
percent_state: percent_state,
|
||
vip_pay_integral_state: vip_pay_integral_state,
|
||
flower_price: that.ruleForm.flower_price,
|
||
percent: that.ruleForm.percent,
|
||
recharge_state: recharge_state,
|
||
goods_integral_state: goods_integral_state,
|
||
recharge_price: that.ruleForm.recharge_price,
|
||
recharge_integral: that.ruleForm.recharge_integral,
|
||
},
|
||
type: 'post',
|
||
success: (res) => {
|
||
if (res.status == 1) {
|
||
this.$message({message: res.msg, type: 'success'});
|
||
} else {
|
||
this.$message({message: res.msg, type: 'error'});
|
||
}
|
||
}
|
||
})
|
||
}).catch(() => {
|
||
that.$loading().close();
|
||
})
|
||
} else {
|
||
that.$message({message: '请完善必填项', type: 'error'});
|
||
}
|
||
});
|
||
},
|
||
//plus 会员保存
|
||
plus_dosubmit: function (formName) {
|
||
var that = this;
|
||
var bg = /^[+]{0,1}(\d+)$|^[+]{0,1}(\d+\.\d{0,6})$/;
|
||
var plus_percent_state = that.plusForm.plus_percent_state ? 1 : 2;
|
||
var plus_pay_integral_state = that.plusForm.plus_pay_integral_state ? 1 : 2;
|
||
var plus_recharge_state = that.plusForm.plus_recharge_state ? 1 : 2;
|
||
var goods_integral_plus_state = that.plusForm.goods_integral_plus_state ? 1 : 2;
|
||
console.log(that.plusForm);
|
||
this.$refs[formName].validate((valid) => {
|
||
if (valid) {
|
||
that.$confirm("确定提交", {
|
||
confirmButtonText: '继续',
|
||
cancelButtonText: '取消',
|
||
type: 'info'
|
||
}).then(() => {
|
||
$.ajax({
|
||
url: "{:U('plus_vipconfigset')}",
|
||
data: {
|
||
plus_signin_give: that.plusForm.plus_signin_give,
|
||
plus_infoscore: that.plusForm.plus_infoscore,
|
||
plus_percent_state: plus_percent_state,
|
||
plus_pay_integral_state: plus_pay_integral_state,
|
||
plus_flower_type: that.plusForm.plus_flower_type,
|
||
plus_flower_percent: that.plusForm.plus_flower_percent,
|
||
plus_flower_price: that.plusForm.plus_flower_price,
|
||
plus_percent: that.plusForm.plus_percent,
|
||
plus_recharge_state: plus_recharge_state,
|
||
plus_recharge_integral: that.plusForm.plus_recharge_integral,
|
||
plus_recharge_type: that.plusForm.plus_recharge_type,
|
||
plus_recharge_price: that.plusForm.plus_recharge_price,
|
||
plus_recharge_get_integral: that.plusForm.plus_recharge_get_integral,
|
||
goods_integral_plus_state: goods_integral_plus_state,
|
||
goods_integral_multiple: that.plusForm.goods_integral_multiple,
|
||
},
|
||
type: 'post',
|
||
success: (res) => {
|
||
if (res.status == 1) {
|
||
this.$message({message: res.msg, type: 'success'});
|
||
} else {
|
||
this.$message({message: res.msg, type: 'error'});
|
||
}
|
||
}
|
||
})
|
||
}).catch(() => {
|
||
that.$loading().close();
|
||
})
|
||
} else {
|
||
that.$message({message: '请完善必填项', type: 'error'});
|
||
}
|
||
});
|
||
},
|
||
//积分抵现设置
|
||
saveIntegralSet: function (formName) {
|
||
//提交数据
|
||
var that = this;
|
||
var marketing_methods = that.marketing_methods;
|
||
if (marketing_methods == 2) {
|
||
var integralForm = that.integralForm;
|
||
if (((parseFloat(integralForm.integral_arrive_cash_price) / parseInt(integralForm.integral_arrive_cash_data)).toFixed(12)) != (parseFloat(integralForm.integral_arrive_cash_price) / parseInt(integralForm.integral_arrive_cash_data))) {
|
||
that.$message({
|
||
type: "error",
|
||
message: "金额必须除尽积分",
|
||
duration: 2000
|
||
})
|
||
return false;
|
||
}
|
||
}
|
||
this.$refs[formName].validate((valid) => {
|
||
if (valid) {
|
||
that.arriveCashLoading = true;
|
||
$.post("{:U('saveIntegralSet')}", {
|
||
integral_arrive_cash: that.integral_arrive_cash,
|
||
integral_arrive_cash_rate: that.integralForm.integral_arrive_cash_rate,
|
||
integral_arrive_cash_data: that.integralForm.integral_arrive_cash_data,
|
||
integral_arrive_cash_price: that.integralForm.integral_arrive_cash_price,
|
||
marketing_methods: that.marketing_methods
|
||
}, function (res) {
|
||
that.arriveCashLoading = false;
|
||
if (res.status == 1) {
|
||
that.$message({type: 'success', message: res.msg, duration: 1000});
|
||
} else {
|
||
that.$message({type: 'error', message: res.msg, duration: 3000});
|
||
}
|
||
})
|
||
}
|
||
});
|
||
},
|
||
},
|
||
})
|
||
|
||
</script> |