文件

267 行
12 KiB
HTML
可执行文件

<!--[1.2.99]-->
<link rel="stylesheet" href="__PUBLIC__/vue/element-ui.css">
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Retail/css/myscroll.css" />
<style>
[v-cloak] {
display: none;
}
.title-tips {
height: 30px;
line-height: 30px;
border-bottom: 1px solid #e5e5e5;
color: #409EFF;
font-weight: bold;
font-size: 14px;
margin-bottom: 5px;
}
.span-tips {
color: #ec1414;
}
.subject {
margin-left: 50px;
}
.label {
color: #409EFF;
font-weight: bold;
}
.el-form-item {
margin-bottom: 5px;
}
</style>
<div id="app" v-cloak>
<div class="title-tips">清空数据 <span class="span-tips">(清空数据将不可恢复,请谨慎操作!注:建议清空测试数据)</span></div>
<div v-loading="loading" :element-loading-text="loading_text" element-loading-spinner="el-icon-loading">
<el-form :model="delete_form" label-width="120px">
<el-form-item label="门店:" v-if="show_store">
<el-tree
ref="tree"
node-key="id"
show-checkbox
highlight-current
:data="store_list"
:props="defaultProps"
style="margin-top: 6px;">
</el-tree>
</el-form-item>
<el-form-item label="插件:">
<el-checkbox-group v-model="delete_form.plug">
<el-checkbox name="plug" label="1">优惠券</el-checkbox>
<el-checkbox name="plug" label="2">红包</el-checkbox>
<el-checkbox name="plug" label="3">次卡</el-checkbox>
<el-checkbox name="plug" label="4">大转盘</el-checkbox>
<el-checkbox name="plug" label="5">积分商城</el-checkbox>
<el-checkbox name="plug" label="6">礼品卡</el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item label="配置:">
<el-checkbox-group v-model="delete_form.config">
<el-checkbox name="config" label="1">支付设置</el-checkbox>
<el-checkbox name="config" label="2">公众号</el-checkbox>
<el-checkbox name="config" label="3">小程序</el-checkbox>
<el-checkbox name="config" label="4">微信会员卡</el-checkbox>
<el-checkbox name="config" label="5">短信设置</el-checkbox>
<el-checkbox name="config" label="6">公告</el-checkbox>
<el-checkbox name="config" label="7">模板消息</el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item label="角色:">
<el-checkbox-group v-model="delete_form.role">
<el-checkbox name="role" label="1">店长</el-checkbox>
<el-checkbox name="role" label="2">新角色</el-checkbox>
<el-checkbox name="role" label="3">新用户</el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item label="会员:">
<el-checkbox-group v-model="delete_form.vip">
<el-checkbox name="vip" label="1">变更记录</el-checkbox>
<el-checkbox name="vip" label="2">余额记录</el-checkbox>
<el-checkbox name="vip" label="3">消费记录</el-checkbox>
<el-checkbox name="vip" label="4">积分记录</el-checkbox>
<el-checkbox name="vip" label="5">动态码记录</el-checkbox>
<el-checkbox name="vip" label="6">次卡记录</el-checkbox>
<el-checkbox name="vip" label="7">优惠券记录</el-checkbox>
<el-checkbox name="vip" label="8">红包记录</el-checkbox>
<el-checkbox name="vip" label="9">大转盘记录</el-checkbox>
<el-checkbox name="vip" label="10">积分商城记录</el-checkbox>
<el-checkbox name="vip" label="11">plus会员及设置</el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item>
<el-button type="danger" size="small" @click="cleanUpData">清空数据</el-button>
</el-form-item>
</el-form>
</div>
</div>
<script src="__PUBLIC__/jquery/js/jquery-3.2.1.min.js"></script>
<script src="__PUBLIC__/vue/js/vue2.5.16.js"></script>
<script src="__PUBLIC__/vue/element-ui.js"></script>
<script>
var app = new Vue({
el: '#app',
data: function () {
return {
merchant_id:'',
delete_form: {
store: [], // 门店
plug:[], // 插件
config:[], // 配置
role:[], // 角色
vip:[], // 会员
verification_code:'', // 验证码
},
show_store:false, // 显示门店
store_list: [], // 门店树结构
loading:false, // 加载
loading_text:'加载中,请稍后...', // 加载提示
defaultProps: { // 定义树结构域label
label: 'text',
children: 'children'
}
}
},
methods: {
// 获取商户下的门店
getStoreList(){
var that = this;
that.loading_text = '加载中,请稍后...';
that.loading = true;
$.ajax({
url:"{:U('getStoreList')}",
type:"post",
data:{merchant_id:that.merchant_id},
success:function(res){
that.loading = false;
if(res.status == 2){
that.show_store = true;
that.store_list = res.store_list;
}else if(res.status == 1){
that.show_store = false;
that.store_list = [];
}else{
that.show_store = false;
that.store_list = [];
that.$message({
showClose: true,
message: res.msg,
type: 'error'
});
return false;
}
}
})
},
// 清空数据按钮
cleanUpData(){
var that = this;
var determine = false;
// 判断门店
if(that.store_list.length > 0 && this.$refs.tree.getCheckedKeys().length > 0){
that.delete_form.store = this.$refs.tree.getCheckedKeys();
determine = true;
}
// 判断插件
if(that.delete_form.plug.length > 0){
determine = true;
}
// 判断配置
if(that.delete_form.config.length > 0){
determine = true;
}
// 判断角色
if(that.delete_form.role.length > 0){
determine = true;
}
// 判断会员
if(that.delete_form.vip.length > 0){
determine = true;
}
// 判断是否可以提交
if(!determine){
that.$message({
showClose: true,
message: '请先勾选需要清空的数据再提交!',
type: 'error'
});
return false;
}
// 提交
that.$confirm('该操作需向合伙人绑定手机号发送验证码,请确保手机号正常使用!', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
closeOnClickModal:false,
}).then(() => {
// 发送验证码
$.ajax({
url:"{:U('verification')}",
type:"post",
success:function(res){
if(res.status == 1){
// 提交
that.$prompt('请输验证码', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
inputPattern: /^\d{6}$/,
inputErrorMessage: '验证码格式不正确',
closeOnClickModal:false,
}).then(({ value }) => {
that.loading_text = '数据清空中,请不要关闭此页面';
that.loading = true;
that.delete_form.verification_code = value;
$.ajax({
url:"{:U('deleteData')}",
type:"post",
data:{merchant_id:that.merchant_id,delete_data:that.delete_form},
success:function(res2){
that.loading = false;
if(res2.status == 1){
that.$message({
showClose: true,
message: res2.msg,
type: 'success'
});
that.getStoreList();
}else{
that.$message({
showClose: true,
message: res2.msg,
type: 'error'
});
return false;
}
}
});
});
}else{
that.$message({
showClose: true,
message: res.msg,
type: 'error'
});
return false;
}
}
})
});
},
},
created() {
var merchant_id = "{:I('get.merchant_id')}";
if(!merchant_id){
this.$message({
showClose: true,
message: '参数异常,请刷新重试',
type: 'error'
});
return false;
}
this.merchant_id = merchant_id;
this.getStoreList();
},
})
</script>