文件

289 行
12 KiB
HTML
可执行文件

<!--[1.9.13]-->
<style>
.layout-head {
text-align: center;
flex: 1;
}
</style>
<div id="selectAgent" v-cloak>
<div style="width:100%;display: flex;flex-wrap: wrap;">
<div class="layout-head">
<el-card shadow="always" :body-style="{ padding: '0px' }">
<div style="padding: 14px;">
<span style="color: #999;">总商户</span>
<div class="bottom clearfix">
<span class="time">{$allMerchant}</span>
</div>
</div>
</el-card>
</div>
<div class="layout-head" style="margin: 0 10px">
<el-card shadow="always" :body-style="{ padding: '0px' }">
<div style="padding: 14px;">
<span style="color: #999;">正常商户</span>
<div class="bottom clearfix">
<span class="time">{$normalMerchant}</span>
</div>
</div>
</el-card>
</div>
<div class="layout-head">
<el-card shadow="always" :body-style="{ padding: '0px' }">
<div style="padding: 14px;">
<span style="color: #999;">过期商户</span>
<div class="bottom clearfix">
<span class="time">{$overdueMerchant}</span>
</div>
</div>
</el-card>
</div>
</div>
<el-form style="margin-top: 20px" size="small" inline>
<el-form-item label="商户搜索">
<el-input v-model="keyword" @keydown.enter.exact.native.prevent="search"
placeholder="请输入商户手机号/名称" clearable></el-input>
</el-form-item>
<el-form-item label="代理商查询">
<el-select v-model="agent_id" placeholder="请选择" filterable>
<el-option v-for="item in agentList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
<el-button type="primary" @click="search">查询</el-button>
</el-form-item>
</el-form>
<div v-loading="loading" element-loading-text="查询中,请等待"
element-loading-spinner="el-icon-loading">
<div style="max-width: calc(100vw - 208px);margin-top: 20px;">
<el-table border :data="list" size="mini" max-height="500">
<el-table-column type="index" label="序号" width="50" align="center"></el-table-column>
<el-table-column prop="name" label="商户名称" show-overflow-tooltip min-width="150"></el-table-column>
<el-table-column prop="mobile" label="手机号码" min-width="80" show-overflow-tooltip></el-table-column>
<el-table-column prop="add_time" label="添加时间" min-width="100"
show-overflow-tooltip></el-table-column>
<el-table-column prop="begin_time" label="启用时间" min-width="100"
show-overflow-tooltip></el-table-column>
<el-table-column prop="end_time" label="过期时间" min-width="100"
show-overflow-tooltip></el-table-column>
<el-table-column prop="address" label="地址信息" min-width="100"
show-overflow-tooltip></el-table-column>
<el-table-column prop="meal_name" label="套餐" min-width="80" show-overflow-tooltip></el-table-column>
<el-table-column prop="agent_name" label="所属代理商" min-width="80"
show-overflow-tooltip></el-table-column>
<el-table-column prop="status_name" label="状态" min-width="100"
show-overflow-tooltip></el-table-column>
<el-table-column fixed="right" label="操作" width="280">
<template slot-scope="scope">
<if condition="$authArr['xcxConfig']">
<el-button type="text" @click="xcxConfig(scope.row.id,scope.row.name)" size="mini">
商城配置
</el-button>
</if>
<if condition="$authArr['getMerchantSms'] eq true">
<el-button type="text" @click="smsSet(scope.row.id,scope.row.name)" size="mini">短信功能
</el-button>
</if>
<if condition="$authArr['paySet'] eq true">
<el-button type="text" @click="paySet(scope.row)" size="mini">支付配置</el-button>
</if>
<!--<el-button type="text" @click="cleanUpData(scope.row)" size="mini">清空数据</el-button>-->
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage"
:page-sizes="[10, 15, 20, 25, 30, 35, 40, 45, 50]"
:page-size="100"
layout="total, sizes, prev, pager, next, jumper"
:total="currentLen">
</el-pagination>
</div>
</div>
<el-dialog :title="'短信设置 -- '+sms.name" :append-to-body="true" :visible.sync="showSmsSetDialog" width="450px">
<el-form label-width="120px">
<el-form-item label="总条数">
<el-input type="text" v-model="sms.allnum" disabled size="small"></el-input>
</el-form-item>
<el-form-item label="已用条数">
<el-input type="text" v-model="sms.usenum" disabled size="small"></el-input>
</el-form-item>
<el-form-item label="权限">
<el-switch @change="changeStatus"
v-model="sms.status"
inactive-value="0"
active-value="1">
</el-switch>
</el-form-item>
<el-form-item label="增加条数">
<el-input type="text" v-model="addNum" oninput="value=this.value.replace(/^[0]|\D/,'')"
placeholder="请输入整数" size="small"></el-input>
</el-form-item>
</el-form>
<div class="center">
<el-button type="primary" :disabled="smsLoading" @click="sureSet" size="small">
<span>确定</span>
<i v-if="smsLoading" class="el-icon-loading"></i>
</el-button>
</div>
</el-dialog>
</div>
<script>
var selectAgent = new Vue({
el: '#selectAgent',
data() {
return {
agentList: {$agentname},
agent_id: '',
showSmsSetDialog: false,
currentLen: 0,
currentLimit: 10,
currentPage: 1,
loading: false, // 加载
list: [],
sms: {},
addNum: '',
keyword: '',
smsLoading: false,
}
},
methods: {
handleSizeChange(val) {
this.currentLimit = val;//切换每页数量
this.currentPage = 1;
this.getData();
},
handleCurrentChange(val) {
this.currentPage = val;
this.getData();//切换页数
},
search() {
this.currentPage = 1;
this.getData();
},
smsSet(id, name) {
$.ajax({
url: "{:U('getMerchantSms')}",
type: 'post',
data: {
id: id
},
success: (res) => {
if (res.status == 1) {
this.sms = JSON.parse(JSON.stringify(res.data));
this.sms.name = name;
this.showSmsSetDialog = true;
} else {
this.$message.error(res.msg);
}
}
})
},
changeStatus() {
$.ajax({
url: "{:U('merchantSmsStatusSet')}",
data: {
id: this.sms.id,
status: this.sms.status
},
type: 'post',
success: (res) => {
this.$message.success(res.msg);
if (res.status != 1) {
this.sms.status = this.sms.status == 1 ? 0 : 1;
}
}
})
},
sureSet() {
if (!this.addNum || isNaN(Number(this.addNum)) || this.addNum != parseInt(this.addNum) || this.addNum <= 0) {
return this.$message.error('请输入正确的短信条数');
}
this.$confirm("确定要给该商户增加短信" + this.addNum + '条?', "温馨提示", {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'info'
}).then(() => {
this.smsLoading = true;
$.ajax({
url: "{:U('doAddSmsAllNum')}",
type: "POST",
data: {
id: this.sms.id,
num: this.addNum
},
success: (res) => {
this.smsLoading = false;
if (res.status == 1) {
this.$message.success(res.msg);
this.addNum = '';
this.showSmsSetDialog = false;
} else {
this.$message.error(res.msg);
}
}
})
}).catch(() => {
})
},
paySet(data) {
layer.open({
type: 2,
content: "{:U('paySet')}?merchant_id=" + data.id,
title: "支付设置--" + data.name,
area: ['calc(100% - 160px)', 'calc(100% - 65px)'],
offset: 'rb',
shade: 0,
move: false,
resize: false,
})
},
xcxConfig(id, name) {
layer.open({
type: 2,
content: "{:U('xcxConfig')}?merchant_id=" + id,
title: "商户小程序设置--" + name,
area: ['calc(100% - 160px)', 'calc(100% - 65px)'],
offset: 'rb',
shade: 0,
move: false,
resize: false,
})
},
getData() {
this.loading = true;
$.ajax({
url: "{:U('getMerchant')}",
type: "POST",
data: {
keyword: this.keyword,
page: this.currentPage,
limit: this.currentLimit,
agent_id: this.agent_id,
},
success: (res) => {
this.loading = false;
if (res.status == 1) {
this.list = [];
this.list = res.data;
this.$nextTick(() => {
this.currentLen = res.count;
})
} else {
this.$message.error('数据获取失败');
}
}
})
},
},
created() {
this.getData();
}
});
</script>