canyin-project/ybcy/views/admin/apply/platform_management.php

463 lines
24 KiB
PHP
Raw Normal View History

2024-11-01 16:07:54 +08:00
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="renderer" content="webkit">
<?php if($this->params['site_image']):?>
<link rel="shortcut icon" type="image/x-icon" href="<?php echo $this->params['site_image'];?>" />
<?php else:?>
<link rel="shortcut icon" type="image/x-icon" href="<?=Yii::$app->request->baseUrl?>/web/favicon.ico" />
<?php endif;?>
<title> <?php if($this->params['site_title']):?>
<?php echo $this->params['site_title']; ?>
<?php else:?>
应用管理后台
<?php endif;?>-平台列表</title>
<link rel="stylesheet" type="text/css" href="<?=Yii::$app->request->baseUrl?>/web/static/css/globle.css"/>
<script src="<?=Yii::$app->request->baseUrl?>/web/static/js/config.js" type="text/javascript" charset="utf-8"></script>
</head>
<style>
.mar_l20b {
margin-left: 20%;
}
.icon_width {
width: 56px;
height: 56px;
}
.main_search_con .elinput {
width: 300px;
}
.search_button .el-button, .tit_button .el-button {
width: 104px;
height: 38px;
}
.tjpt .el-button {
width: 130px;
height: 38px;
}
.namelogo {
width: 40px;
height: 40px;
border-radius: 50%;
}
</style>
<body>
<div class="head">
<div class="publicHeader"><?php echo $this->render('@app/views/admin/public/publicHeader.html');?></div>
</div>
<div class="left">
<div class="publicAside"><?php echo $this->render('@app/views/admin/public/publicAside.html');?></div>
</div>
<div class="yb_body">
<div class="layout" id="platformList" v-cloak v-loading="cardLoading">
<el-container>
<el-container>
<el-main>
<div class="main" style="min-width: 800px">
<?php if($this->params['userLoginType']!==3):?>
<div class="con-top flex">
<div class="flex-grow-1 ba_f mar_r20 bor_rad5 pad_tb_30">
<div class="top-middle flex mar_l20b">
<div class="icon_width mar_r20"><img src="<?=Yii::$app->request->baseUrl?>/web/static/images/platform/ycj.png"
class="image_all"></div>
<div class="t_l">
<div class="fon_14">已创建平台数量<span class="color_9 fon_12">(个)</span></div>
<div class="fon_22 wei mar_t10"><?= $data['created'] ?></div>
</div>
</div>
</div>
<div class="flex-grow-1 ba_f mar_r20 bor_rad5 pad_tb_30">
<div class="top-middle flex mar_l20b">
<div class="icon_width mar_r20"><img src="<?=Yii::$app->request->baseUrl?>/web/static/images/platform/hsz.png"
class="image_all"></div>
<div class="t_l">
<div class="fon_14">回收站<span class="color_9 fon_12">(个)</span></div>
<div class="fon_22 wei mar_t10"><?= $data['recycle'] ?></div>
</div>
</div>
</div>
<div class="flex-grow-1 ba_f mar_r20 bor_rad5 pad_tb_30">
<div class="top-middle flex mar_l20b">
<div class="icon_width mar_r20"><img src="<?=Yii::$app->request->baseUrl?>/web/static/images/platform/ygq.png"
class="image_all"></div>
<div class="t_l">
<div class="fon_14">已过期<span class="color_9 fon_12">(个)</span></div>
<div class="fon_22 wei mar_t10"><?= $data['expire'] ?></div>
</div>
</div>
</div>
<div class="flex-grow-1 ba_f bor_rad5 pad_tb_30" v-show="userType">
<div class="top-middle flex mar_l20b">
<div class="icon_width mar_r20"><img src="<?=Yii::$app->request->baseUrl?>/web/static/images/platform/sy.png"
class="image_all"></div>
<div class="t_l">
<div class="fon_14">剩余平台数量<span class="color_9 fon_12">(个)</span></div>
<div class="fon_22 wei mar_t10"><?= $data['surplus'] ?></div>
</div>
</div>
</div>
</div>
<?php endif;?>
<div class="main-search pad_30 ba_f bor_rad5">
<div class="main_search_tit t_l fon_16 wei">平台列表</div>
<div class="main_search_con fon_14">
<div class="flex pad_tb_20">
<!-- <div class="mar_r30">-->
<!-- <el-select v-model="formInline.apply_type" placeholder="应用类型筛选">-->
<!-- <el-option v-for="item in options" :key="item.id" :label="item.app_name"-->
<!-- :value="item.id"></el-option>-->
<!-- </el-select>-->
<!-- </div>-->
<!-- <div class="mar_r30">-->
<!-- <el-select v-model="formInline.desc" placeholder="创建时间正序">-->
<!-- <el-option v-for="item in options2" :key="item.value" :label="item.label"-->
<!-- :value="item.value"></el-option>-->
<!-- </el-select>-->
<!-- </div>-->
<div class="mar_r30">
<el-input v-model="formInline.apply_name" placeholder="搜索平台名称"
class="elinput"></el-input>
</div>
<!-- <div class="mar_r30">-->
<!-- <el-input v-model="formInline.phone" placeholder="搜索手机号"-->
<!-- class="elinput"></el-input>-->
<!-- </div>-->
<div>日期查询:</div>
<div class="mar_r30">
<el-date-picker v-model="formInline.data" type="daterange"
range-separator="" start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>
</div>
<div class="search_button flex">
<el-button type="primary" @click="search(formInline)">查询</el-button>
<div class="tjpt mar_l20" v-show="userType">
<a href="javascript:void(0)">
<el-button @click.native="toAdd" type="primary">新增平台</el-button>
</a>
</div>
<!-- <el-button>导出</el-button>-->
</div>
</div>
<!-- <div class="flex pad_tb_10">-->
<!-- <div>日期查询:</div>-->
<!-- <div class="mar_r30">-->
<!-- <el-date-picker v-model="formInline.data" type="daterange"-->
<!-- range-separator="" start-placeholder="开始日期"-->
<!-- end-placeholder="结束日期">-->
<!-- </el-date-picker>-->
<!-- </div>-->
<!-- <div class="search_button">-->
<!-- <el-button type="primary" @click="search(formInline)">查询</el-button>-->
<!-- <el-button>导出</el-button>-->
<!-- </div>-->
<!-- </div>-->
</div>
</div>
<div class="main-table pad_30 mar_t20 ba_f bor_rad5">
<div class="table-tit flex-bet">
<div class="flex">
<!--<div class="">-->
<!--<el-checkbox v-model="checked">全选</el-checkbox>-->
<!--</div>-->
<div class="color_9 fon_14">已选择<span class="mar_lr10 color_rb wei">{{lengthNum || 0}}</span>个平台</div>
<div class="mar_l50 tit_button">
<el-button @click="deactivation()" type="danger" plain>停用</el-button>
</div>
</div>
<!-- <div class="tjpt" v-show="userType">
<a href="javascript:void(0)">
<el-button @click.native="toAdd" type="primary">新增平台</el-button>
</a>
</div> -->
</div>
<div class="mar_t30 fon_14 color_3">
<el-table ref="multipleTable" :data="tableData" tooltip-effect="dark"
style="width: 100%" @selection-change="handleSelectionChange" :header-cell-style="{'text-align':'left'}">
<el-table-column type="selection" width="55"></el-table-column>
<el-table-column prop="id" label="平台ID" width="130">
<template slot-scope="scope">
<div class="">{{scope.row.id}}</div>
</template>
</el-table-column>
<el-table-column label="平台名称" prop="image" align="left">
<template slot-scope="scope">
<div class="flex pad_tb_10">
<div class=""><img class="namelogo" :src="scope.row.apply_image"/>
</div>
<div class="flex-col mar_l20">
<div class="overflowlnr">{{scope.row.apply_name}}</div>
<!-- <div class="color_9 fon_12">类型:-->
<!-- <span v-if="scope.row.apply_type=='1'">连锁版</span>-->
<!-- <span v-if="scope.row.apply_type=='2'">O2O版</span>-->
<!-- <span v-if="scope.row.apply_type=='3'">单店版</span>-->
<!-- </div>-->
</div>
</div>
</template>
</el-table-column>
<!-- <el-table-column prop="end_time" label="创建时间">
<template slot-scope="scope">
<div class="">{{scope.row.dt_operdate}}</div>
</template>
</el-table-column> -->
<el-table-column prop="end_time" label="到期时间">
<template slot-scope="scope">
<div class="t_l">
<div v-if="scope.row.time_type=='1'">
<!-- {{scope.row.end_time.substring(0,10)}} -->
{{scope.row.end_time}}
</div>
<div v-else class="color_9">永久</div>
</div>
</template>
</el-table-column>
<el-table-column prop="userName" label="操作员"
show-overflow-tooltip>
<template slot-scope="scope">
<div class="t_l">
<div>{{scope.row.userName}}</div>
<div v-show="scope.row.phone && userType" class="fon_12 color_9">
关联手机号:{{scope.row.phone}}
</div>
</div>
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<div class="textbutton">
<el-button v-if="scope.row.status=='1'" type="text" class="fon_14" @click="tourl(scope.row.id,scope.row.userId)">进入平台</el-button>
<el-button v-if="scope.row.status=='1'" type="text" class="fon_14" @click="tostorelist(scope.row.id)">门店列表</el-button>
<el-button v-else type="text" class="fon_14 color_r">已过期</el-button>
<el-button type="text" class="fon_14" @click="edit(scope.row.id,scope.row.dt_operdate,scope.row.userId)">编辑
</el-button>
<el-button type="text" class="fon_14" @click="del(scope.row.id)">停用
</el-button>
</div>
</template>
</el-table-column>
</el-table>
<div class="t_l">
<el-pagination background layout="prev, pager, next" :total="total"
:page-size="pagesize"
@current-change="current_change">
</el-pagination>
</div>
</div>
</div>
</div>
</el-main>
</el-container>
</el-container>
</div>
</div>
<script>
$(document).ready(function () {
$(".slimScrollDiv ul .main-nav-li a").eq(1).addClass("menu_active");
$(".main-nav .main-nav-li .submenu").eq(1).addClass("block");
$(".main-nav .main-nav-li .submenu").children().children().eq(1).addClass("menu_active2")
// console.log('1233123', $(".main-nav .main-nav-li .submenu").children().children().eq(2).addClass("menu_active2"))
// console.log('1235',$(".main-nav .main-nav-li .submenu").eq(1).addClass("block"))
});
</script>
<script>
new Vue({
el: '#platformList',
created() {
this.init();
},
data: function () {
return {
cardLoading: true,
formInline: {
apply_type: '',
apply_name: '',
phone: '',
desc: '',
data: '',
},
options: [],
options2: [{
value: 'asc',
label: '正序'
},
{
value: 'desc',
label: '倒序'
}
],
checked: true,
tableData: [],
checkId: [],
lengthNum:'',
total: 0,
pagesize: 10,
currentPage: 1,
userType:'',
}
},
methods: {
//初始化
async init() {
var params = {
page: this.currentPage,
}
res = await utils.requestGet({
data: params,
url: "admin/apply/getapplylist"
},this)
// console.log(res)
if (res.code == 1) {
this.cardLoading= false
this.tableData = res.data
this.total = res.count
this.options = res.app
this.userType = res.userType && res.userType!=null?res.userType:''
}
//this.applist()
},
//应用下拉框列表
async applist() {
res = await utils.requestPost({data: '', url: "admin/app/applist"},this)
if (res.code == 1) {
this.options = res.data
// console.log('options',res.data)
}
},
//搜索
async search(formInline) {
console.log(formInline)
let start_time = '';
let end_time = '';
if (this.formInline.data) {
start_time = utils.changeDate(this.formInline.data[0])
end_time = utils.changeDate(this.formInline.data[1])
}
var requstData = {
apply_type: formInline.apply_type,
apply_name: formInline.apply_name,
phone: formInline.phone,
desc: formInline.desc,
start_time: start_time,
end_time: end_time,
}
this.tableData = []
res = await utils.requestPost({
data: requstData,
url: "admin/apply/applybysearch"
},this)
if (res.code == 1) {
this.tableData = res.data
this.total = res.count
}
},
//切换分页
current_change: function (currentPage) {
this.currentPage = currentPage;
this.init()
},
async edit(id,dt_operdate,userId) {
if(!userId){
await utils.showConfirm({content: '该平台暂未设置操作员账号,请先添加操作员账号,再进行管理!'},this)
// this.$message.error('请完善用户信息')
location.href ="<?= Yii::$app->urlManager->createUrl('admin/apply/platform_userm');?>"+"?id="+id;
}else{
if("<?php echo $this->params['userType'];?>") {
location.href = "<?= Yii::$app->urlManager->createUrl('admin/apply/platform_edit');?>" + "?id=" + id + "&dt_operdate=" + dt_operdate + "&userId=" + userId;
}else{
location.href ="<?= Yii::$app->urlManager->createUrl('admin/apply/platform_userm');?>"+"?id="+id+ "&userId=" + userId;
}
}
},
async del(id){
await utils.showConfirm({content: '停用后,该平台则进入回收站,确定?'},this)
var requstData = {
id: id,
status: 2,
}
res = await utils.requestPost({
data: requstData,
url: "admin/apply/delapply"
},this)
if (res.code == 1) {
this.$message({
type: 'success',
message: '操作成功!',
duration: 1000,
onClose: () => {
location.href ="<?= Yii::$app->urlManager->createUrl('admin/apply/platform_management');?>"+"?id="+this.id;
},
});
}
},
async tourl(id,userId) {
if(!userId){
await utils.showConfirm({content: '该平台暂未设置操作员账号,请先添加操作员账号,再进行管理!'},this)
// this.$message.error('请完善用户信息')
location.href ="<?= Yii::$app->urlManager->createUrl('admin/apply/platform_userm');?>"+"?id="+id;
}else{
window.open("<?= Yii::$app->urlManager->createUrl('channel/login/url-redirect');?>"+"?channelUserId="+id)
}
},
async tostorelist(apply_id) {
window.open("<?= Yii::$app->urlManager->createUrl('admin/apply/platform_storelist');?>"+"?id="+apply_id)
},
toAdd(){
if("<?= $data['surplus'] ?>">0||"<?= $data['surplus'] ?>"=="无限"){
location.href = "<?= Yii::$app->urlManager->createUrl('admin/apply/platform_add');?>";
}else{
this.$message({
type: 'error',
message: '测试账户已用完!',
duration: 1000,
});return;
}
},
//表格选择框数据
handleSelectionChange(val) {
console.log(val)
if (val) {
let setctId = []
this.lengthNum = val.length
val.forEach(row => {
setctId.push(row.id);
});
this.checkId = setctId
}
},
//点击停用
async deactivation() {
await utils.showConfirm({content: '此操作将停用该项目, 是否继续?'},this)
var requstData = {
id: this.checkId,
status: 2,
}
res = await utils.requestPost({
data: requstData,
url: "admin/apply/delapply"
},this)
if (res.code == 1) {
this.$message({
type: 'success',
message: '操作成功!',
duration: 1000,
onClose: () => {
location.href ="<?= Yii::$app->urlManager->createUrl('admin/apply/platform_management');?>";
},
});
}
}
}
})
</script>
</body>
</html>