1092 行
48 KiB
HTML
可执行文件
1092 行
48 KiB
HTML
可执行文件
<!--[1.8.73]-->
|
||
<style>
|
||
.content-table {
|
||
width: 100%;
|
||
height: 40px;
|
||
line-height: 40px;
|
||
border-bottom: 1px solid #e5e5e5;
|
||
color: #409EFF;
|
||
font-weight: bold;
|
||
font-size: 15px;
|
||
margin-bottom: 10px;
|
||
}
|
||
|
||
.seek-div {
|
||
display: flex;
|
||
padding-bottom: 10px;
|
||
flex-wrap: wrap;
|
||
}
|
||
|
||
.seek {
|
||
margin-right: 10px;
|
||
margin-top: 10px;
|
||
white-space: nowrap;
|
||
}
|
||
|
||
.seek-button {
|
||
display: flex;
|
||
text-align: center;
|
||
}
|
||
|
||
.table-div {
|
||
border: 1px solid #e6e6e6;
|
||
max-width: calc(100vw - 208px);
|
||
}
|
||
|
||
.tips {
|
||
color: #FE0200;
|
||
font-size: 12px;
|
||
margin-left: 20px;
|
||
}
|
||
|
||
.tips-right {
|
||
/*margin-left:100px;*/
|
||
}
|
||
|
||
.add_form-input {
|
||
width: 220px;
|
||
}
|
||
|
||
.add_from_all {
|
||
box-sizing: border-box;
|
||
background: #f5f7fa;
|
||
width: 80%;
|
||
border-radius: 10px 20px;
|
||
padding-left: 20px;
|
||
}
|
||
|
||
.add_from_prompt {
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
line-height: 30px;
|
||
}
|
||
|
||
.el-form-item {
|
||
margin-bottom: 5px;
|
||
}
|
||
|
||
.el-table__header-wrapper .cell {
|
||
text-align: center;
|
||
}
|
||
|
||
.el-button--mini, .el-button--mini.is-round {
|
||
padding: 3px 10px;
|
||
}
|
||
</style>
|
||
<div class="goodsBox" id="newVipRecharge" v-cloak>
|
||
<div class="content-table">充值管理</div>
|
||
<!-- 搜索 -->
|
||
<div class="seek-div">
|
||
<div class="seek">
|
||
<select-store :store-id.sync="seek_data.rechargeStoreId"
|
||
:store-status="3"
|
||
:show-status="true"></select-store>
|
||
</div>
|
||
<div class="seek">
|
||
<el-select v-model="seek_data.rechargeRole" size="small" clearable placeholder="请选择角色"
|
||
@change="changeRechargeRole">
|
||
<el-option label="普通会员" value="3"></el-option>
|
||
<el-option label="plus会员" value="2"></el-option>
|
||
</el-select>
|
||
</div>
|
||
<div class="seek" v-if="seek_data.rechargeRole == 3">
|
||
<el-select v-model="seek_data.rechargeScene" size="small" clearable placeholder="请选择场景">
|
||
<el-option label="常规活动" value="1"></el-option>
|
||
<el-option label="开通plus" value="2"></el-option>
|
||
</el-select>
|
||
</div>
|
||
<div class="seek" v-if="seek_data.rechargeRole == 2">
|
||
<el-select v-model="seek_data.rechargeScene" size="small" clearable placeholder="请选择场景">
|
||
<el-option label="常规活动" value="1"></el-option>
|
||
<el-option label="续费plus" value="3"></el-option>
|
||
</el-select>
|
||
</div>
|
||
<div class="seek seek-button">
|
||
<el-button type="primary" @click="rechargeInfo" size="small">查询</el-button>
|
||
<el-button type="primary" @click="showRechargeSet" size="small">设置</el-button>
|
||
<if condition="$authArr['viprechargeset'] eq true">
|
||
<el-button type="primary" @click="addRecharge" size="small">创建</el-button>
|
||
</if>
|
||
</div>
|
||
</div>
|
||
<!-- 列表 -->
|
||
<div class="table-div" v-loading="loading" element-loading-text="数据加载中,请等待"
|
||
element-loading-spinner="el-icon-loading">
|
||
<el-table border :data="rechargeList" size="mini">
|
||
<el-table-column type="index" label="序号" width="50"></el-table-column>
|
||
<el-table-column prop="storetag" label="门店" :show-overflow-tooltip="true"></el-table-column>
|
||
<el-table-column label="充值" align="center">
|
||
<el-table-column prop="role" label="角色" :show-overflow-tooltip="true"></el-table-column>
|
||
<el-table-column prop="scene" label="类型" :show-overflow-tooltip="true"></el-table-column>
|
||
</el-table-column>
|
||
<el-table-column label="状态" align="center" min-width="132px">
|
||
<el-table-column prop="line_state" label="线下" min-width="66px">
|
||
<template slot-scope="scope">
|
||
<el-switch
|
||
v-model="scope.row.line_state"
|
||
active-value="1"
|
||
inactive-value="0"
|
||
:disabled="updateStateDisabled"
|
||
@change="updateLineState(scope.row.id,scope.row.line_state)">
|
||
</el-switch>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column prop="online_state" label="线上" min-width="66px">
|
||
<template slot-scope="scope">
|
||
<el-switch
|
||
v-model="scope.row.online_state"
|
||
active-value="1"
|
||
inactive-value="0"
|
||
:disabled="updateStateDisabled"
|
||
@change="updateOnlineState(scope.row.id,scope.row.online_state)">
|
||
</el-switch>
|
||
</template>
|
||
</el-table-column>
|
||
</el-table-column>
|
||
<el-table-column label="金额" align="center">
|
||
<el-table-column prop="recharge_money" label="充值金额" :show-overflow-tooltip="true"></el-table-column>
|
||
<el-table-column prop="give_money" label="赠送金额" :show-overflow-tooltip="true"></el-table-column>
|
||
</el-table-column>
|
||
<el-table-column label="数量" align="center">
|
||
<el-table-column prop="stock" label="总数量" :show-overflow-tooltip="true"></el-table-column>
|
||
<el-table-column prop="surplus" label="剩余数量" :show-overflow-tooltip="true"></el-table-column>
|
||
</el-table-column>
|
||
<el-table-column label="活动" align="center">
|
||
<el-table-column prop="coupon_type_name" label="类型" :show-overflow-tooltip="true"></el-table-column>
|
||
<el-table-column prop="coupon_name" label="活动名称" :show-overflow-tooltip="true"></el-table-column>
|
||
</el-table-column>
|
||
<el-table-column prop="limit_num" label="会员次数限制" :show-overflow-tooltip="true"></el-table-column>
|
||
<el-table-column prop="time_slot" label="有效时间" width="200" :show-overflow-tooltip="true"></el-table-column>
|
||
<el-table-column prop="add_time" label="创建时间" width="150" :show-overflow-tooltip="true"></el-table-column>
|
||
<el-table-column label="状态" min-width="66px">
|
||
<template slot-scope="scope">
|
||
<el-switch
|
||
v-model="scope.row.state"
|
||
active-value="1"
|
||
inactive-value="0"
|
||
:disabled="updateStateDisabled"
|
||
@change="updateState(scope.row.id,scope.row.state)">
|
||
</el-switch>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="操作" width="220">
|
||
<template slot-scope="scope">
|
||
<if condition="$authArr['coupon_activity'] eq true">
|
||
<el-button type="primary" size="mini" @click="getUpdateData(scope.row.id)">编辑</el-button>
|
||
</if>
|
||
<if condition="$authArr['rechargerecord'] eq true">
|
||
<el-button type="primary" size="mini" @click="rechargeRecord(scope.row.id)">记录</el-button>
|
||
</if>
|
||
<if condition="$authArr['Viprechargdel'] eq true">
|
||
<el-button size="mini" @click="deleteActivity(scope.row.id)">删除</el-button>
|
||
</if>
|
||
</template>
|
||
</el-table-column>
|
||
</el-table>
|
||
<el-pagination
|
||
@size-change="rechargeSizeChange"
|
||
@current-change="rechargeCurrentChange"
|
||
:pager-count="5"
|
||
:page-sizes="[10,20,30,40,50,60,70,80,90,100]"
|
||
:page-size="10"
|
||
layout="total,sizes, prev, pager, next, jumper"
|
||
:total="rechargeLen">
|
||
</el-pagination>
|
||
</div>
|
||
<!-- 弹出层(充值设置) -->
|
||
<el-dialog title="充值设置" :modal-append-to-body="false" :visible.sync="showSetting" :close-on-click-modal="false">
|
||
<el-form :model="setting" size="mini" label-width="300px">
|
||
<if condition="$authArr['setinputrecharge'] eq true">
|
||
<el-form-item label="自定义金额充值:">
|
||
<el-switch
|
||
v-model="setting.inputrecharge"
|
||
active-value="1"
|
||
inactive-value="2"
|
||
:active-text="setting.inputrecharge == 1 ? '开启' : '关闭'">
|
||
</el-switch>
|
||
</el-form-item>
|
||
</if>
|
||
<if condition="$authArr['setauto_read_recharge_grade'] eq true">
|
||
<el-form-item label="自定义金额充值,默认赠送最大充值优惠:">
|
||
<el-switch
|
||
v-model="setting.auto_read_recharge_grade"
|
||
active-value="1"
|
||
inactive-value="2"
|
||
:active-text="setting.auto_read_recharge_grade == 1 ? '开启' : '关闭'">
|
||
</el-switch>
|
||
</el-form-item>
|
||
</if>
|
||
<el-form-item label="充值赠送金额分期到账:">
|
||
<el-switch
|
||
v-model="setting.aging_repay"
|
||
active-value="1"
|
||
inactive-value="0"
|
||
:active-text="setting.aging_repay == 1 ? '开启' : '关闭'">
|
||
</el-switch>
|
||
</el-form-item>
|
||
<el-form-item label="分期周期:" v-if="setting.aging_repay == 1">
|
||
<el-radio v-model="setting.aging_cycle" label="0">按天结</el-radio>
|
||
<el-radio v-model="setting.aging_cycle" label="1">按月结</el-radio>
|
||
</el-form-item>
|
||
<el-form-item v-if="setting.aging_repay == 1">
|
||
<el-select v-model="setting.aging_time" placeholder="请选择期数">
|
||
<el-option
|
||
v-for="item in 48"
|
||
:key="item"
|
||
:label="item"
|
||
:value="item" clearable filterable>
|
||
</el-option>
|
||
</el-select>
|
||
</el-form-item>
|
||
<el-form-item>
|
||
<el-button type="primary" size="small" @click="updateRechargeSet">立即提交</el-button>
|
||
</el-form-item>
|
||
</el-form>
|
||
</el-dialog>
|
||
<!-- 弹出层添加编辑(充值活动) -->
|
||
<el-dialog title="充值活动设置" :modal-append-to-body="false" :visible.sync="addvipRecharge" width="60%" height="500" top="7vh"
|
||
:before-close="clearAddVipRecharge" :close-on-click-modal="false">
|
||
<el-form :model="add_form" size="mini" label-width="170px" label-suffix=":">
|
||
<el-form-item label="门店">
|
||
<select-store-multiple
|
||
:store-id-arr.sync="add_form.store_id"
|
||
:show-status="true"
|
||
:is-disabled="add_form.id && add_form.id != '' ? true : false"></select-store-multiple>
|
||
<span class="tips">选择参与活动的门店,可多选</span>
|
||
</el-form-item>
|
||
<el-form-item label="角色">
|
||
<el-select class="add_form-input" v-model="add_form.role_type" clearable placeholder="请选择角色"
|
||
@change="roleTypeCahnge">
|
||
<el-option label="普通会员" value="3"></el-option>
|
||
<el-option label="plus会员" value="2"></el-option>
|
||
</el-select>
|
||
<span class="tips">选择角色类型</span>
|
||
</el-form-item>
|
||
<el-form-item label="类型" v-if="add_form.role_type == 3">
|
||
<el-select class="add_form-input" v-model="add_form.scene_type" clearable placeholder="请选择场景">
|
||
<el-option label="常规活动" value="1"></el-option>
|
||
<el-option label="开通plus" value="2"></el-option>
|
||
</el-select>
|
||
<span class="tips">选择场景类型</span>
|
||
</el-form-item>
|
||
<el-form-item label="类型" v-if="add_form.role_type == 2">
|
||
<el-select class="add_form-input" v-model="add_form.scene_type" clearable placeholder="请选择场景">
|
||
<el-option label="常规活动" value="1"></el-option>
|
||
<el-option label="续费plus" value="3"></el-option>
|
||
</el-select>
|
||
<span class="tips">选择场景类型</span>
|
||
</el-form-item>
|
||
<template
|
||
v-if="add_form.role_type == 3&&add_form.scene_type==2||add_form.role_type == 2&&add_form.scene_type==3">
|
||
<el-form-item label="Plus会员时长">
|
||
<el-input class="add_form-input" v-model="add_form.time" clearable placeholder="请输入Plus会员时长"
|
||
oninput="value=this.value.replace(/^[0]|\D/,'')"></el-input>
|
||
<span class="tips">Plus会员的有效时间,以天为单位</span>
|
||
</el-form-item>
|
||
</template>
|
||
<el-form-item label="线下是否开启">
|
||
<el-switch
|
||
v-model="add_form.line_state"
|
||
active-value="1"
|
||
inactive-value="0"
|
||
:active-text="add_form.line_state == 1 ? '开启' : '关闭'">
|
||
</el-switch>
|
||
<span class="tips tips-right">在线下是否开启该充值活动</span>
|
||
</el-form-item>
|
||
<el-form-item label="线上是否开启">
|
||
<el-switch
|
||
v-model="add_form.online_state"
|
||
active-value="1"
|
||
inactive-value="0"
|
||
:active-text="add_form.online_state == 1 ? '开启' : '关闭'">
|
||
</el-switch>
|
||
<span class="tips tips-right">在线上是否开启该充值活动</span>
|
||
</el-form-item>
|
||
<el-form-item label="支付金额">
|
||
<el-input class="add_form-input" v-model="add_form.recharge_money" clearable placeholder="请输入支付金额"
|
||
onkeyup="value=value.replace(/[^\d|.]/g,'')"></el-input>
|
||
<span class="tips">用户支付金额</span>
|
||
</el-form-item>
|
||
<el-form-item label="赠送金额">
|
||
<el-input class="add_form-input" v-model="add_form.give_money" clearable placeholder="请输入赠送金额"
|
||
onkeyup="value=value.replace(/[^\d|.]/g,'')"></el-input>
|
||
<span class="tips">赠送用户金额,默认0为不赠送</span>
|
||
</el-form-item>
|
||
<el-form-item label="充值赠送金额分期到账">
|
||
<el-switch
|
||
v-model="add_form.aging_repay"
|
||
active-value="1"
|
||
inactive-value="2"
|
||
:active-text="add_form.aging_repay == 1 ? '开启' : '关闭'">
|
||
</el-switch>
|
||
</el-form-item>
|
||
<el-form-item label="分期数" v-if="add_form.aging_repay == 1">
|
||
<el-select v-model="add_form.aging_time" placeholder="请选择期数">
|
||
<el-option
|
||
v-for="item in 48"
|
||
:key="item"
|
||
:label="item"
|
||
:value="item"
|
||
filterable clearable
|
||
>
|
||
</el-option>
|
||
</el-select>
|
||
</el-form-item>
|
||
<el-form-item label="活动总数量">
|
||
<el-input class="add_form-input" v-model="add_form.stock" clearable placeholder="请输入总数量"
|
||
onkeyup="value=value.replace(/[^\d]/g,'')"></el-input>
|
||
<span class="tips">默认0为不限数量</span>
|
||
</el-form-item>
|
||
<el-form-item label="会员次数限制">
|
||
<el-input class="add_form-input" v-model="add_form.limit_num" clearable placeholder="请输入会员次数限制"
|
||
onkeyup="value=value.replace(/[^\d]/g,'')"></el-input>
|
||
<span class="tips">会员可充值该活动的次数,默认0为不限制</span>
|
||
</el-form-item>
|
||
<el-form-item label="开始时间">
|
||
<el-date-picker
|
||
v-model="add_form.start_time"
|
||
type="date"
|
||
:editable="false"
|
||
placeholder="选择时间"
|
||
format="yyyy 年 MM 月 dd 日"
|
||
value-format="yyyy-MM-dd">
|
||
</el-date-picker>
|
||
<span class="tips">留空默认当前时间开始有效</span>
|
||
</el-form-item>
|
||
<el-form-item label="结束时间">
|
||
<el-date-picker
|
||
v-model="add_form.end_time"
|
||
type="date"
|
||
:editable="false"
|
||
placeholder="选择时间"
|
||
format="yyyy 年 MM 月 dd 日"
|
||
value-format="yyyy-MM-dd">
|
||
</el-date-picker>
|
||
<span class="tips">留空默认不限制结束时间</span>
|
||
</el-form-item>
|
||
<el-form-item label="状态">
|
||
<el-switch
|
||
class="add_form-input"
|
||
v-model="add_form.state"
|
||
active-value="1"
|
||
inactive-value="0"
|
||
:active-text="add_form.state == 1 ? '开启' : '关闭'">
|
||
</el-switch>
|
||
<span class="tips tips-right">活动状态,默认开启</span>
|
||
</el-form-item>
|
||
<el-form-item label="优惠活动类型">
|
||
<el-radio-group v-model="add_form.coupon_type" size="mini" @change="couponTypeChange">
|
||
<el-radio label="0">无活动</el-radio>
|
||
<el-radio label="1">优惠券</el-radio>
|
||
<el-radio label="2">券包</el-radio>
|
||
</el-radio-group>
|
||
</el-form-item>
|
||
<el-form-item label="优惠活动"
|
||
v-if="add_form.coupon_type == 1 || add_form.coupon_type == '1' || add_form.coupon_type == 2 || add_form.coupon_type == '2'">
|
||
<el-select class="add_form-input" v-model="add_form.coupon_id" clearable :loading="loading2"
|
||
placeholder="请选择活动" @change="couponTypeCahnge">
|
||
<el-option v-for="val in coupon_list" :value="val.id" :label="val.name" :key="val.id"></el-option>
|
||
</el-select>
|
||
</el-form-item>
|
||
<el-form-item v-if="add_form.coupon_id && (add_form.coupon_type == 1 || add_form.coupon_type == '1')">
|
||
<div class="add_from_all">
|
||
<div class="add_from_prompt">
|
||
<span>优惠券名称:{{ coupon_data.name }}</span>
|
||
</div>
|
||
<div class="add_from_prompt">
|
||
<span>有效日期:{{ coupon_data.use_time }}</span>
|
||
</div>
|
||
<div class="add_from_prompt">
|
||
<span>总数量:{{ coupon_data.all_num }}</span>
|
||
</div>
|
||
<div class="add_from_prompt">
|
||
<span>剩余数量:{{ coupon_data.num }}</span>
|
||
</div>
|
||
<div class="add_from_prompt">
|
||
<span>优惠门槛:{{ coupon_data.need_money }}</span>
|
||
</div>
|
||
<div class="add_from_prompt">
|
||
<span>优惠金额:{{ coupon_data.reduce_money }}</span>
|
||
</div>
|
||
</div>
|
||
</el-form-item>
|
||
<el-form-item v-if="add_form.coupon_id && (add_form.coupon_type == 2 || add_form.coupon_type == '2')">
|
||
<div class="add_from_all">
|
||
<div class="add_from_prompt">
|
||
<span>券包名称:{{ coupon_data.name }}</span>
|
||
</div>
|
||
<div class="add_from_prompt">
|
||
<span>总数量:{{ coupon_data.all_num }}</span>
|
||
</div>
|
||
<div class="add_from_prompt">
|
||
<span>剩余数量:{{ coupon_data.num }}</span>
|
||
</div>
|
||
<div class="add_from_prompt">
|
||
<span>券包金额:{{ coupon_data.money }}</span>
|
||
</div>
|
||
<div class="add_from_prompt">
|
||
<span>创建时间:{{ coupon_data.add_time }}</span>
|
||
</div>
|
||
</div>
|
||
</el-form-item>
|
||
<el-form-item>
|
||
<el-button type="primary" size="small" @click="submitActivity">立即提交</el-button>
|
||
</el-form-item>
|
||
</el-form>
|
||
</el-dialog>
|
||
<!-- 弹出层(充值记录) -->
|
||
<el-dialog title="充值记录" :modal-append-to-body="false" :visible.sync="showVipRechargeRecord" width="60%" :before-close="clearVipRechargeRecord"
|
||
:close-on-click-modal="false">
|
||
<el-table border :data="viprechargeRecord" size="mini" max-height="500">
|
||
<el-table-column type="index" label="序号" width="50"></el-table-column>
|
||
<el-table-column label="会员" align="center">
|
||
<el-table-column prop="name" label="名称" :show-overflow-tooltip="true"></el-table-column>
|
||
<el-table-column prop="nickname" label="昵称" :show-overflow-tooltip="true"></el-table-column>
|
||
<el-table-column prop="mobile_phone" label="手机号" :show-overflow-tooltip="true"></el-table-column>
|
||
</el-table-column>
|
||
<el-table-column prop="money" label="支付金额" :show-overflow-tooltip="true"></el-table-column>
|
||
<el-table-column prop="all_money" label="到账金额" :show-overflow-tooltip="true"></el-table-column>
|
||
<el-table-column prop="add_time" label="充值时间" :show-overflow-tooltip="true"></el-table-column>
|
||
</el-table>
|
||
<el-pagination
|
||
@size-change="recordSizeChange"
|
||
@current-change="recordCurrentChange"
|
||
:pager-count="5"
|
||
:page-sizes="[10,20,30,40,50,60,70,80,90,100]"
|
||
:page-size="10"
|
||
layout="total,sizes, prev, pager, next, jumper"
|
||
:total="recordLen">
|
||
</el-pagination>
|
||
</el-dialog>
|
||
</div>
|
||
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/Retail/common/js/select-store.js"></script>
|
||
<script type="text/javascript">
|
||
var newVipRecharge = new Vue({
|
||
el: '#newVipRecharge',
|
||
data: {
|
||
updateStateDisabled: "{$authArr['updateState']}" == 1 ? false : true,
|
||
seek_data: {
|
||
rechargeStoreId: '', // 门店
|
||
rechargeRole: '', // 角色
|
||
rechargeScene: '', // 场景
|
||
},
|
||
loading: false, // 加载
|
||
rechargeList: [], // 活动列表
|
||
rechargeLen: 0, // 统计
|
||
rechargePage: 1, // 分页
|
||
rechargeLimit: 10, // 数量
|
||
showSetting: false, // 显示设置
|
||
setting: {
|
||
inputrecharge: '1', // 自定义金额充值
|
||
auto_read_recharge_grade: '1', // 自定义金额充值,默认赠送最大充值优惠
|
||
aging_repay: '1', //充值分期1开启
|
||
aging_cycle: '0', //1按天结算 2按月结算
|
||
aging_time: '', //周期
|
||
},
|
||
addvipRecharge: false, // 创建活动弹出层
|
||
add_form: {
|
||
id: '', // id(编辑判断)
|
||
store_id: [], // 门店
|
||
role_type: '', // 角色
|
||
scene_type: '', // 场景
|
||
recharge_money: '', // 支付金额
|
||
give_money: 0, // 赠送金额
|
||
aging_repay: '', //分期开关
|
||
aging_cycle:'0', //期数类型
|
||
stage_num: '', //期数
|
||
stock: 0, // 用户充值总次数
|
||
num: 0, // (编辑判断)
|
||
surplus: '-1', // 用户剩余次数,(修改使用)
|
||
limit_num: 0, // 限制次数
|
||
line_state: '0', // 线下状态 0.关闭 1.开启
|
||
online_state: '0', // 线上状态 0.关闭 1.开启
|
||
start_time: '', // 开始时间
|
||
end_time: '', // 截止时间
|
||
state: '1', // 状态 0.关闭 1.启用
|
||
coupon_type: '0', // 优惠券类型 1.优惠券 2.券包
|
||
coupon_id: '', // 关联优惠id
|
||
time: '', // plus会员的时长(天)
|
||
},
|
||
loading2: false, // 优惠券活动加载
|
||
coupon_data: {
|
||
name: '', // 优惠券或券包名称
|
||
use_time: '', // 使用时间
|
||
all_num: '', // 总数量
|
||
num: '', // 剩余数量
|
||
need_money: '', // 优惠门槛
|
||
reduce_money: '', // 优惠金额
|
||
money: '', // 券包金额
|
||
add_time: '', // 时间
|
||
},
|
||
coupon_list: [], // 优惠活动
|
||
showVipRechargeRecord: false, // 显示充值记录
|
||
recharge_id: '', // 充值活动id(记录分页)
|
||
viprechargeRecord: [], // 充值记录列表
|
||
recordPage: 1, // 充值列表 分页
|
||
recordLimit: 10, // 充值列表 数量
|
||
recordLen: 0, // 充值数量 总数
|
||
},
|
||
|
||
methods: {
|
||
/**
|
||
* 角色搜索改变时,清空场景搜索
|
||
*/
|
||
changeRechargeRole(val) {
|
||
this.seek_data.rechargeScene = '';
|
||
},
|
||
/**
|
||
* 获取活动列表
|
||
*/
|
||
rechargeInfo() {
|
||
var that = this;
|
||
that.loading = true;
|
||
$.ajax({
|
||
url: "{:U('getVipRechargeActivity')}",
|
||
type: "post",
|
||
data: {seek_data: that.seek_data, page: that.rechargePage, limit: that.rechargeLimit},
|
||
success: function (res) {
|
||
that.loading = false;
|
||
if (res.status == 1) {
|
||
that.rechargeList = res.rechargeList;
|
||
that.rechargeLen = res.rechargeLen;
|
||
} else {
|
||
that.rechargeList = [];
|
||
that.rechargeLen = 0;
|
||
}
|
||
}
|
||
});
|
||
},
|
||
|
||
/**
|
||
* 充值活动列表分页
|
||
* @param val string 选中的值
|
||
*/
|
||
rechargeCurrentChange(val) {
|
||
this.rechargePage = val;
|
||
this.rechargeInfo();
|
||
},
|
||
|
||
/**
|
||
* 充值活动选择数量
|
||
* @param val string 选中的值
|
||
*/
|
||
rechargeSizeChange(val) {
|
||
this.rechargeLimit = val;
|
||
this.rechargePage = 1;
|
||
this.rechargeInfo();
|
||
},
|
||
|
||
/**
|
||
* 显示活动设置,获取商户设置
|
||
*/
|
||
showRechargeSet() {
|
||
var that = this;
|
||
$.ajax({
|
||
url: "{:U('getRechargeSet')}",
|
||
type: "post",
|
||
success: function (res) {
|
||
if (res.status == 1) {
|
||
that.showSetting = true;
|
||
that.setting = res.setting;
|
||
} else {
|
||
that.$message({
|
||
type: 'error',
|
||
message: res.msg,
|
||
});
|
||
}
|
||
}
|
||
})
|
||
},
|
||
|
||
/**
|
||
* 修改充值设置
|
||
*/
|
||
updateRechargeSet() {
|
||
var that = this;
|
||
var setting = that.setting;
|
||
var aging_repay = setting.aging_repay;
|
||
var aging_cycle = setting.aging_cycle;
|
||
var aging_time = setting.aging_time;
|
||
var reg = /^\+?[1-9][0-9]*$/;
|
||
if(aging_repay == 1){
|
||
if(aging_cycle != 0 && aging_cycle != 1){
|
||
that.$message({
|
||
type:"error",
|
||
message:"请选择周期类型"
|
||
})
|
||
return false;
|
||
}
|
||
if(!reg.test(aging_time)){
|
||
that.$message({
|
||
type:"error",
|
||
message:"请输入正确周期数"
|
||
})
|
||
return false;
|
||
}
|
||
}
|
||
$.ajax({
|
||
url: "{:U('updateRechargeSet')}",
|
||
type: "post",
|
||
data: {setting: that.setting},
|
||
success: function (res) {
|
||
if (res.status == 1) {
|
||
that.$message({
|
||
type: 'success',
|
||
message: res.msg,
|
||
});
|
||
that.showSetting = false;
|
||
} else {
|
||
that.$message({
|
||
type: 'error',
|
||
message: res.msg,
|
||
});
|
||
}
|
||
}
|
||
})
|
||
},
|
||
|
||
/**
|
||
* 创建活动
|
||
*/
|
||
addRecharge() {
|
||
this.addvipRecharge = true;
|
||
},
|
||
|
||
/**
|
||
* 角色类型改变时回调,清除场景选中
|
||
* @param val string 选中的值
|
||
*/
|
||
roleTypeCahnge(val) {
|
||
// 清除场景选中
|
||
this.add_form.scene_type = '';
|
||
},
|
||
|
||
/**
|
||
* 绑定活动
|
||
* @param val string 选中的值
|
||
*/
|
||
couponTypeChange(val) {
|
||
this.add_form.coupon_id = '';
|
||
this.unsetCouponList();
|
||
if (val && val != '0') {
|
||
this.getCouponOrCouponGroup(val);
|
||
}
|
||
},
|
||
|
||
/**
|
||
* 获取优惠券或券包
|
||
* @param type string 类型 1.优惠券 2.券包
|
||
*/
|
||
getCouponOrCouponGroup(type) {
|
||
var that = this;
|
||
that.loading2 = true;
|
||
$.ajax({
|
||
url: "{:U('getCouponOrCouponGroup')}",
|
||
type: "post",
|
||
data: {type: type},
|
||
success: function (res) {
|
||
that.loading2 = false;
|
||
if (res.status == 1) {
|
||
that.coupon_list = res.coupon_list;
|
||
} else {
|
||
that.coupon_list = [];
|
||
}
|
||
}
|
||
})
|
||
},
|
||
|
||
/**
|
||
* 优惠活动改变
|
||
* @param val string 选中的值
|
||
*/
|
||
couponTypeCahnge(val) {
|
||
var coupon_list = this.coupon_list;
|
||
for (var i = 0; i < coupon_list.length; i++) {
|
||
if (coupon_list[i].id == val) {
|
||
// 判断优惠券券包
|
||
if (parseInt(this.add_form.coupon_type) == 1) {
|
||
// 优惠券
|
||
this.coupon_data.name = coupon_list[i].coupon_name;
|
||
this.coupon_data.use_time = coupon_list[i].use_time;
|
||
this.coupon_data.all_num = coupon_list[i].coupon_allnum;
|
||
this.coupon_data.num = coupon_list[i].coupon_num;
|
||
this.coupon_data.need_money = coupon_list[i].needmoney;
|
||
this.coupon_data.reduce_money = coupon_list[i].reducemoney;
|
||
} else {
|
||
this.coupon_data.name = coupon_list[i].coupon_group_name;
|
||
this.coupon_data.all_num = coupon_list[i].coupon_group_allnum;
|
||
this.coupon_data.num = coupon_list[i].coupon_group_num;
|
||
this.coupon_data.money = coupon_list[i].coupon_group_money;
|
||
this.coupon_data.add_time = coupon_list[i].addtime;
|
||
}
|
||
}
|
||
}
|
||
},
|
||
|
||
/**
|
||
* 清空优惠列表
|
||
*/
|
||
unsetCouponList() {
|
||
var coupon_data = {
|
||
name: '',
|
||
use_time: '',
|
||
all_num: '',
|
||
num: '',
|
||
need_money: '',
|
||
reduce_money: '',
|
||
money: '',
|
||
add_time: '',
|
||
};
|
||
this.coupon_data = coupon_data;
|
||
},
|
||
|
||
/**
|
||
* 提交活动
|
||
*/
|
||
submitActivity() {
|
||
var that = this;
|
||
var reg = /^\+?[1-9][0-9]*$/;
|
||
// 判断门店
|
||
if (that.add_form.store_id.length <= 0) {
|
||
that.$message({
|
||
type: 'error',
|
||
message: "请选择门店",
|
||
});
|
||
return false;
|
||
}
|
||
// 判断角色
|
||
if (!that.add_form.role_type) {
|
||
that.$message({
|
||
type: 'error',
|
||
message: "请选择角色",
|
||
});
|
||
return false;
|
||
}
|
||
// 判断场景
|
||
if (!that.add_form.scene_type) {
|
||
that.$message({
|
||
type: 'error',
|
||
message: "请选择场景",
|
||
});
|
||
return false;
|
||
}
|
||
if (that.add_form.role_type == 3 && that.add_form.scene_type == 2 || that.add_form.role_type == 2 && that.add_form.scene_type == 3) {
|
||
if (!that.add_form.time) {
|
||
that.$message({
|
||
type: 'error',
|
||
message: "请输入Plus会员有效时间",
|
||
});
|
||
return false;
|
||
}
|
||
}
|
||
// 判断支付金额
|
||
if (!that.add_form.recharge_money) {
|
||
that.$message({
|
||
type: 'error',
|
||
message: "请设置用户支付金额",
|
||
});
|
||
return false;
|
||
}
|
||
if(that.add_form.aging_repay == 1){
|
||
if(!reg.test(that.add_form.aging_time)){
|
||
that.$message({
|
||
type: 'error',
|
||
message: "请输入正确期数",
|
||
});
|
||
return false;
|
||
}
|
||
}
|
||
// 总数量
|
||
if (that.add_form.id && that.add_form.num && that.add_form.surplus != '-1') {
|
||
if (that.add_form.stock < (that.add_form.num * 100 - that.add_form.surplus * 100) / 100) {
|
||
that.$message({
|
||
type: 'error',
|
||
message: "该活动已充值" + (that.add_form.num * 100 - that.add_form.surplus * 100) / 100 + "次,总数量不能小于此数值",
|
||
});
|
||
return false;
|
||
}
|
||
}
|
||
// 判断优惠活动类型
|
||
if (parseInt(that.add_form.coupon_type) == 1 || parseInt(that.add_form.coupon_type) == 2) {
|
||
// 判断是否选择优惠活动
|
||
if (that.add_form.coupon_id == '') {
|
||
that.$message({
|
||
type: 'error',
|
||
message: "请选择优惠活动",
|
||
});
|
||
return false;
|
||
}
|
||
}
|
||
$.ajax({
|
||
url: "{:U('submitActivity')}",
|
||
type: "post",
|
||
data: {data: that.add_form},
|
||
success: function (res) {
|
||
if (res.status == 1) {
|
||
that.clearAddVipRecharge();
|
||
that.rechargeInfo();
|
||
that.$message({
|
||
type: 'success',
|
||
message: res.msg,
|
||
})
|
||
} else if (res.status == 2) {
|
||
that.clearAddVipRecharge();
|
||
that.rechargeInfo();
|
||
that.$message({
|
||
type: 'warning',
|
||
message: res.msg,
|
||
})
|
||
} else {
|
||
that.$message({
|
||
type: 'error',
|
||
message: res.msg,
|
||
})
|
||
}
|
||
}
|
||
})
|
||
},
|
||
|
||
/**
|
||
* 编辑活动,获取活动数据
|
||
* @param id string 活动id
|
||
*/
|
||
getUpdateData(id) {
|
||
var that = this;
|
||
that.loading = true;
|
||
$.ajax({
|
||
url: "{:U('getUpdateData')}",
|
||
type: "post",
|
||
data: {id: id},
|
||
success: function (res) {
|
||
that.loading = false;
|
||
if (res.status == 1) {
|
||
that.add_form = res.add_form;
|
||
that.coupon_data = res.coupon_data;
|
||
that.coupon_list = res.coupon_list;
|
||
that.addvipRecharge = true;
|
||
} else {
|
||
that.$message({
|
||
type: 'error',
|
||
message: res.msg,
|
||
})
|
||
}
|
||
}
|
||
});
|
||
},
|
||
|
||
/**
|
||
* 关闭创建修改活动弹出层
|
||
*/
|
||
clearAddVipRecharge() {
|
||
var add_form = {
|
||
id: '',
|
||
store_id: [],
|
||
role_type: '',
|
||
scene_type: '',
|
||
line_state: '0',
|
||
online_state: '0',
|
||
recharge_money: '',
|
||
give_money: 0,
|
||
stock: 0,
|
||
num: 0,
|
||
surplus: '-1',
|
||
limit_num: 0,
|
||
start_time: '',
|
||
end_time: '',
|
||
state: '1',
|
||
coupon_type: '0',
|
||
coupon_id: '',
|
||
time: '',
|
||
};
|
||
var coupon_data = {
|
||
name: '',
|
||
use_time: '',
|
||
all_num: '',
|
||
num: '',
|
||
need_money: '',
|
||
reduce_money: '',
|
||
money: '',
|
||
add_time: '',
|
||
state: ''
|
||
};
|
||
this.add_form = add_form;
|
||
this.coupon_data = coupon_data;
|
||
this.coupon_list = [];
|
||
this.addvipRecharge = false;
|
||
},
|
||
|
||
/**
|
||
* 充值记录
|
||
*/
|
||
rechargeRecord(id) {
|
||
this.recharge_id = id;
|
||
this.getVipRechargeRecord();
|
||
},
|
||
|
||
/**
|
||
* 获取充值记录
|
||
*/
|
||
getVipRechargeRecord() {
|
||
var that = this;
|
||
$.ajax({
|
||
url: "{:U('getVipRechargeRecord')}",
|
||
type: "post",
|
||
data: {id: that.recharge_id, page: that.recordPage, limit: that.recordLimit},
|
||
success: function (res) {
|
||
if (res.status == 1) {
|
||
// 判断记录弹出层
|
||
if (!that.showVipRechargeRecord || that.showVipRechargeRecord == false) {
|
||
that.showVipRechargeRecord = true;
|
||
}
|
||
that.viprechargeRecord = res.viprechargeRecord;
|
||
that.recordLen = res.recordLen;
|
||
} else {
|
||
that.$message({
|
||
type: 'error',
|
||
message: res.msg,
|
||
})
|
||
}
|
||
}
|
||
});
|
||
},
|
||
|
||
/**
|
||
* 充值记录 分页
|
||
*/
|
||
recordCurrentChange(val) {
|
||
this.recordPage = val;
|
||
this.getVipRechargeRecord();
|
||
},
|
||
|
||
/**
|
||
* 充值记录 数量
|
||
*/
|
||
recordSizeChange(val) {
|
||
this.recordPage = 1;
|
||
this.recordLimit = val;
|
||
this.getVipRechargeRecord();
|
||
},
|
||
|
||
/**
|
||
* 关闭充值记录
|
||
*/
|
||
clearVipRechargeRecord() {
|
||
this.viprechargeRecord = [];
|
||
this.recordLen = 0;
|
||
this.recharge_id = '';
|
||
this.showVipRechargeRecord = false;
|
||
},
|
||
|
||
/**
|
||
* 删除活动
|
||
*/
|
||
deleteActivity(id) {
|
||
var that = this;
|
||
that.$confirm('此操作将删除该活动, 是否继续?', '提示', {
|
||
confirmButtonText: '继续',
|
||
cancelButtonText: '取消',
|
||
type: 'warning'
|
||
}).then(() => {
|
||
$.ajax({
|
||
url: "{:U('deleteActivity')}",
|
||
type: "post",
|
||
data: {id: id},
|
||
success: function (res) {
|
||
if (res.status == 1) {
|
||
that.rechargeInfo();
|
||
that.$message({
|
||
type: 'success',
|
||
message: res.msg,
|
||
});
|
||
} else {
|
||
that.$message({
|
||
type: 'error',
|
||
message: res.msg,
|
||
});
|
||
}
|
||
}
|
||
});
|
||
});
|
||
},
|
||
/**
|
||
* 开启,关闭活动
|
||
*/
|
||
updateState(id, state) {
|
||
var that = this;
|
||
$.ajax({
|
||
url: "{:U('updateState')}",
|
||
type: "post",
|
||
data: {id: id, state: state},
|
||
success: function (res) {
|
||
if (res.status == 1) {
|
||
that.$message({
|
||
type: 'success',
|
||
message: res.msg,
|
||
});
|
||
} else {
|
||
that.rechargeInfo();
|
||
that.$message({
|
||
type: 'error',
|
||
message: res.msg,
|
||
});
|
||
}
|
||
}
|
||
});
|
||
},
|
||
/**
|
||
* 开启,关闭线下活动状态
|
||
*/
|
||
updateLineState(id, state) {
|
||
var that = this;
|
||
$.ajax({
|
||
url: "{:U('updateLineState')}",
|
||
type: "post",
|
||
data: {id: id, state: state},
|
||
success: function (res) {
|
||
if (res.status == 1) {
|
||
that.$message({
|
||
type: 'success',
|
||
message: res.msg,
|
||
});
|
||
} else {
|
||
that.rechargeInfo();
|
||
that.$message({
|
||
type: 'error',
|
||
message: res.msg,
|
||
});
|
||
}
|
||
}
|
||
});
|
||
},
|
||
/**
|
||
* 开启,关闭线上活动状态
|
||
*/
|
||
updateOnlineState(id, state) {
|
||
var that = this;
|
||
$.ajax({
|
||
url: "{:U('updateOnlineState')}",
|
||
type: "post",
|
||
data: {id: id, state: state},
|
||
success: function (res) {
|
||
if (res.status == 1) {
|
||
that.$message({
|
||
type: 'success',
|
||
message: res.msg,
|
||
});
|
||
} else {
|
||
that.rechargeInfo();
|
||
that.$message({
|
||
type: 'error',
|
||
message: res.msg,
|
||
});
|
||
}
|
||
}
|
||
});
|
||
},
|
||
},
|
||
|
||
created() {
|
||
this.rechargeInfo(); // 获取充值列表
|
||
},
|
||
});
|
||
</script> |