h5_market_user_1103

This commit is contained in:
dengbw
2022-11-03 15:51:18 +08:00
committed by lccsw
parent b2a81ca2ac
commit 9ce7219a04
8 changed files with 560 additions and 56 deletions
+3 -3
View File
@@ -407,10 +407,10 @@
onclick="del_img('data','destory_img','')">x
</div>
<a target="_blank" class="pic">
<img alt="实销凭证" onclick="showViewer('viewer-wx_img')"
<img alt="实名认证资料" onclick="showViewer('viewer-wx_img')"
src="<?= $info['imgs_status']['destory_img']['imgs'][0] ?>"/>
</a>
<div class="f12 tc">实销凭证</div>
<div class="f12 tc">实名认证资料</div>
</li>
<? } else { ?>
<li>
@@ -420,7 +420,7 @@
onchange="upImg('destory_img',this)">
<div></div>
</a>
<div class="tc f12">实销凭证</div>
<div class="tc f12">实名认证资料</div>
</li>
<? } ?>
</ul>
+1 -1
View File
@@ -606,7 +606,7 @@ class Cusorder extends Wxapp{
throw new Exception('先上传企业微多对一图片', ERR_PARAMS_ERROR);
}
if(!$order_data['destory_img']){
throw new Exception('请先上传实销凭证', ERR_PARAMS_ERROR);
throw new Exception('请先上传实名认证资料', ERR_PARAMS_ERROR);
}
if(!$order_data['ins_img'] && !$order_data['insurance_img'] && !$order_data['business_img']){
throw new Exception('请先上传保单', ERR_PARAMS_ERROR);
@@ -84,7 +84,7 @@ class Order_datas_entity{
'delivery_ck_img' => ['text'=>'交车合照','type'=>6,'up_status'=>0,'status'=>0,'status_cn'=>'未审核','imgs'=>[]], //交车确认图片
'wx_img' => ['text'=>'企业微','type'=>7,'up_status'=>0,'status'=>0,'status_cn'=>'未审核','imgs'=>[]], //企业微图片
'mut_wx_img' => ['text'=>'企业微多对一','type'=>7,'up_status'=>0,'status'=>0,'status_cn'=>'未审核','imgs'=>[]], //企业微多对一图片
'destory_img' => ['text'=>'实销凭证','type'=>7,'up_status'=>0,'status'=>0,'status_cn'=>'未审核','imgs'=>[]], //实销凭证图片
'destory_img' => ['text'=>'实名认证资料','type'=>7,'up_status'=>0,'status'=>0,'status_cn'=>'未审核','imgs'=>[]], //实名认证资料图片
];
}else{
$result = [
@@ -98,7 +98,7 @@ class Order_datas_entity{
'delivery_ck_img' => ['text'=>'交车合照','type'=>6,'up_status'=>0,'status'=>0,'status_cn'=>'未审核','imgs'=>[]], //交车确认图片
'wx_img' => ['text'=>'企业微','type'=>7,'up_status'=>0,'status'=>0,'status_cn'=>'未审核','imgs'=>[]], //企业微图片
'mut_wx_img' => ['text'=>'企业微多对一','type'=>7,'up_status'=>0,'status'=>0,'status_cn'=>'未审核','imgs'=>[]], //企业微多对一图片
'destory_img' => ['text'=>'实销凭证','type'=>7,'up_status'=>0,'status'=>0,'status_cn'=>'未审核','imgs'=>[]], //实销凭证图片
'destory_img' => ['text'=>'实名认证资料','type'=>7,'up_status'=>0,'status'=>0,'status_cn'=>'未审核','imgs'=>[]], //实名认证资料图片
];
}
$where = [
+163
View File
@@ -0,0 +1,163 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
require_once 'Common.php';
class User extends Admin
{
private $group_id;
private $biz_id;
public function __construct()
{
parent::__construct();
$this->load->model('market/Market_sylive_organization_model', 'mdSyliveOrganization');
$this->load->library('market/sylive_entity');
$this->group_id = $this->sylive_entity->get_level($this->session['org_id']);
$biz_id = intval($this->input->get('biz_id'));
!$biz_id && $biz_id = intval($this->input->post('biz_id'));
$this->group_id == 2 && $biz_id = $this->session['org_id'];
$this->biz_id = $biz_id;
}
public function index()
{
if ($this->group_id > 2) {
throw new Hd_exception('权限不足', 400);
}
$row = $this->market_sylive_organization_model->get(['organizationId' => $this->biz_id]);
$this->data['headimg'] = Sylive_entity::DF_IMG;
$this->data['biz_name'] = $row['organizationName'];
$this->data['biz_id'] = $this->biz_id;
//微信分享
$wx_info = $this->share_info();
$this->data['sign_package'] = $wx_info['sign_package'];
$this->show_view('h5/market/sylive/user/index');
}
public function lists()
{
if ($this->group_id > 2) {
$this->show_json('', 400, '权限不足');
}
$keyWord = $this->input->get('keyWord');
$page = intval($this->input->get('page'));
$size = intval($this->input->get('size'));
!$page && $page = 1;
!$size && $size = 10;
$where = [
'status<>' => -1,
"organizationId in (select organizationId from lc_market_sylive_organization where parentId={$this->biz_id})" => null
];
$keyWord && $where["uname like '%{$keyWord}%'"] = null;
$total = $this->user_model->count($where);
$lists = [];
if ($total) {
$res = $this->user_model->select($where, 'userId desc', $page, $size, 'userId,mobile,uname,nickname,headimg,status');
foreach ($res as $val) {
$temp = [
'userId' => $val['userId'],
'status' => $val['status'],
'uname' => $val['uname'],
'mobile' => $val['mobile'],
'wxuname' => $val['nickname'],
'wxheadimg' => $val['headimg']
];
$lists[] = $temp;
}
}
$data['list'] = $lists;
$data['total'] = $total;
$this->show_json($data, 200);
}
public function add()
{
if ($this->group_id > 2) {
$this->show_json('', 400, '权限不足');
}
$uname = $this->input->post('uname');
$mobile = $this->input->post('mobile');
if (!$uname) {
$this->show_json('', 400, '请输入顾问姓名');
}
if (!mobile_valid($mobile)) {
$this->show_json('', 400, '请输入正确手机号');
}
$re_org = $this->market_sylive_organization_model->get(['parentId' => $this->biz_id, 'organizationType' => 4
, 'status' => 0]);
if (!$re_org) {
$this->show_json('', 400, '门店未添加顾问类型,请联系管理员');
}
$organizationId = $re_org['organizationId'];
$re = $this->user_model->get(['mobile' => $mobile]);
if ($re && $re['status'] != -1) {
if ($re['teamId'] || $re['organizationId']) {
$this->show_json('', 400, '手机号已存在');
}
}
$addDate = ['organizationId' => $organizationId, 'uname' => $uname, 'status' => 0, 'teamId' => 0];
if ($re['userId']) {
$this->user_model->update($addDate, ['userId' => $re['userId']]);
$this->show_json('', 200, '绑定用户成功');
} else {
$addDate['mobile'] = $mobile;
$addDate['createTime'] = date('Y-m-d H:i:s');
$id = $this->user_model->add($addDate);
if (!$id) {
$this->show_json('', 400, '添加用户失败');
}
$this->show_json('', 200, '操作成功');
}
}
public function edit()
{
if ($this->group_id > 2) {
$this->show_json('', 400, '权限不足');
}
$uname = $this->input->post('uname');
$mobile = $this->input->post('mobile');
$userId = intval($this->input->post('userId'));
if (!$userId) {
$this->show_json('', 400, '参数错误');
}
if (!$uname) {
$this->show_json('', 400, '请输入顾问姓名');
}
if (!mobile_valid($mobile)) {
$this->show_json('', 400, '请输入正确手机号');
}
$re = $this->user_model->get(['userId' => $userId]);
if (!$re) {
$this->show_json('', 400, '无此顾问');
}
if ($re['mobile'] == $mobile) {
$uppDate = ['uname' => $uname];
} else {
$re = $this->user_model->get(['mobile' => $mobile]);
if ($re && $re['status'] != -1) {
if ($re['teamId'] || $re['organizationId']) {
$this->show_json('', 400, '手机号已存在');
}
}
$uppDate = ['uname' => $uname, 'mobile' => $mobile];
}
$this->user_model->update($uppDate, ['userId' => $re['userId']]);
$this->show_json('', 200, '操作成功');
}
public function status()
{
if ($this->group_id > 2) {
$this->show_json('', 400, '权限不足');
}
$userId = intval($this->input->post('userId'));
$status = intval($this->input->post('status'));
if (!$userId) {
$this->show_json('', 400, '参数错误');
}
$this->user_model->update(['status' => $status], ['userId' => $userId]);
$this->show_json('', 200, '操作成功');
}
}
+65 -48
View File
@@ -1,50 +1,65 @@
<body class="bg-f6">
<div id="app" ref="app">
<div class="container relative bg-no-repeat bg-size-fullwidth bg-pos-top pb50" style="background-image:url(https://qs.haodian.cn/web/images/project/H5-ShiYu/theme-bg.png?v=221008)">
<div class="container relative bg-no-repeat bg-size-fullwidth bg-pos-top pb50"
style="background-image:url(https://qs.haodian.cn/web/images/project/H5-ShiYu/theme-bg.png?v=221008)">
<div class="pt30 pb60">
<div class="relative pl30 pr30 fn-clear">
<?if($group_id<2){?>
<a class="fn-fr font-22 color-fff bg-000-op50 ulib-r750 pt5 pb5 pl10 pr10" href="/h5/market/sylive/biz/lists?area_id=<?=$area_id?>">
<i class="iconfont icon-qiehuan text-middle"></i><span class="text-middle ml10">切换门店</span>
</a>
<?}?>
<?if($group_id==3 || $group_id==2){?>
<a class="fn-fr font-22 color-fff bg-000-op50 ulib-r750 pt5 pb5 pl10 pr10" href="javascript:;" @click="logout()">
<span class="text-middle ml10">退出</span>
</a>
<?}?>
<? if ($group_id < 2) { ?>
<a class="fn-fl font-22 bg-fff ulib-r750 pt5 pb5 pl15 pr15"
href="/h5/market/sylive/biz/lists?area_id=<?= $area_id ?>">
<i class="iconfont icon-qiehuan text-middle"></i><span class="text-middle ml10">切换门店</span></a>
<? } ?>
<? if ($group_id == 3 || $group_id == 2) { ?>
<a class="fn-fl font-22 bg-fff ulib-r750 pt5 pb5 pl15 pr15" href="javascript:void(0);"
@click="logout()"><i class="iconfont icon-tuichu text-middle"></i><span
class="text-middle ml10">退出</span></a>
<? } ?>
<? if ($group_id <= 2) { ?>
<a class="fn-fr font-22 bg-fff ulib-r750 pt5 pb5 pl15 pr15" href="/h5/market/sylive/user?biz_id=<?= $biz_id ?>"><i
class="iconfont icon-guanli text-middle"></i><span class="text-middle ml10">顾问管理</span></a>
<? } ?>
</div>
</div>
<div class="relative bg-fff mt10 ml30 mr30 inner30 ulib-r20 box-shadow-darkGray" style="min-height:75vh;">
<img class="absolute top--60 box-center bds-1-fff imgsize-120X120 ulib-r750 z-index-1" :src="info.logo" alt="#" />
<img class="absolute top--60 box-center bds-1-fff imgsize-120X120 ulib-r750 z-index-1" :src="info.logo"
alt="#"/>
<div class="pt50 font-36 text-center">{{info.title}}</div>
<div class="pt50">
<!--活动列表列表-->
<div :class="['relative mb30 bg-f9 pt20 pb20 pl30 ulib-r20 ',item.pay_status == 0 ? 'pr200' : 'pr100']" v-for="(item,index) in list">
<div :class="['relative mb30 bg-f9 pt20 pb20 pl30 ulib-r20 ',item.pay_status == 0 ? 'pr200' : 'pr100']"
v-for="(item,index) in list">
<div class="space-nowrap">
<a class="inline-block actitle font-32" href="javascript:;" @click="gourl(item.url)">{{item.title}}</a>
<a class="inline-block vertical10" href="javascript:;" @click="gourl(item.stat_url)">
<div class="inline-block pl20 pr20 line-height-15 text-middle ulib-r750 font-22 color-fff bg-fe9538"><i class="iconfont icon-shuju text-middle"></i><span class="text-middle ml5">数据</span></div>
<div class="inline-block pl20 pr20 line-height-15 text-middle ulib-r750 font-22 color-fff bg-fe9538">
<i class="iconfont icon-shuju text-middle"></i><span class="text-middle ml5">数据</span>
</div>
</a>
</div>
<a class="block mt10 font-22 color-999" href="javascript:;" @click="gourl(item.url)">
{{item.time}}
<a v-if="item.pay_status == 0" href="javascript:;" @click="gourl(item['stat_url'])" class="absolute right-0 mr20 box-middle inline-block pt5 pb5 pl20 pr20 line-height-15 text-middle ulib-r750 font-22 color-fff bg-ff5a5a">开通</a>
<a v-else-if="item.pay_status == 1" :href="item.url" class="absolute right-0 mr20 box-middle iconfont icon-gengduo font-26 color-666"></a>
<a v-if="item.pay_status == 0" href="javascript:;" @click="gourl(item['stat_url'])"
class="absolute right-0 mr20 box-middle inline-block pt5 pb5 pl20 pr20 line-height-15 text-middle ulib-r750 font-22 color-fff bg-ff5a5a">开通</a>
<a v-else-if="item.pay_status == 1" :href="item.url"
class="absolute right-0 mr20 box-middle iconfont icon-gengduo font-26 color-666"></a>
</a>
</div>
<!--end活动列表-->
</div>
<mugen-scroll :handler="fetchData" :should-handle="!loading" scroll-container="app">
<div class="pt100 pb100 text-center color-ccc" v-if="isNoData"></i><span class="text-middle font-22">暂无数据</span></div>
<div class="pt20 pb20 text-center color-ccc" v-else-if="loading"><i class="iconfont icon-jiazai text-middle"></i><span class="text-middle font-22">请稍等...</span></div>
<div class="pt20 pb20 text-center font-22 color-ccc" v-else-if="isDataEnd && list.length>10">我们是有底线的</div>
<div class="pt100 pb100 text-center color-ccc" v-if="isNoData"></i><span class="text-middle font-22">暂无数据</span>
</div>
<div class="pt20 pb20 text-center color-ccc" v-else-if="loading"><i
class="iconfont icon-jiazai text-middle"></i><span class="text-middle font-22">请稍等...</span>
</div>
<div class="pt20 pb20 text-center font-22 color-ccc" v-else-if="isDataEnd && list.length>10">我们是有底线的
</div>
</mugen-scroll>
</div>
</div>
<?if($group_id<2){?>
<?$this->load->view('h5/market/sylive/nav')?>
<?}?>
<? if ($group_id < 2) { ?>
<? $this->load->view('h5/market/sylive/nav') ?>
<? } ?>
</div>
<script>
@@ -52,20 +67,18 @@
var app = new Vue({
el: '#app',
data: {
info:'',//基础信息
info: '',//基础信息
loading: false,
isDataEnd: false,
isNoData: false,
page: 1, //页数
size: 10, //每页取多少个数据
list:[],
list: [],
},
created(){
},
computed: {
created() {
},
computed: {},
mounted() {
this.getInfo()
},
@@ -73,31 +86,35 @@
},
//离开页面时
destroyed () {
destroyed() {
},
methods: {
//获取基础信息
getInfo(){
getInfo() {
this.info = {
title:"<?=$biz_name?>",
logo:"<?=$headimg?>",
title: "<?=$biz_name?>",
logo: "<?=$headimg?>",
}
},
//拉取数据
fetchData: function() {
fetchData: function () {
this.getActivityList()
},
//获取大区列表
getActivityList(){
let that=this;
getActivityList() {
let that = this;
if (!that.isNoData && !that.isDataEnd && !that.loading) {
that.loading = true;
//请求接口
//请求接口
$.get('/h5/market/sylive/biz/act_list',{'biz_id':<?=$biz_id ? $biz_id : 0?>,'area_id':<?=$area_id ? $area_id : 0?>,'page':that.page},function (result) {
$.get('/h5/market/sylive/biz/act_list', {
'biz_id':<?=$biz_id ? $biz_id : 0?>,
'area_id':<?=$area_id ? $area_id : 0?>,
'page': that.page
}, function (result) {
that.loading = false;
that.page = that.page + 1;
that.list = that.list.concat(result.data.list);
@@ -106,33 +123,33 @@
} else if (that.list.length == result.data.total) {
that.isDataEnd = true;
}
},'json')
}, 'json')
}
},
logout(){
$.get('/h5/market/sylive/login/logout',function (response) {
if(response.code==200){
logout() {
$.get('/h5/market/sylive/login/logout', function (response) {
if (response.code == 200) {
mDialog.msg({
duration: 250,
pause: 2000,
content: response.msg,
onClose:function(){
onClose: function () {
window.location = '/h5/market/sylive/login'
}
});
}else{
} else {
mDialog.msg({
duration: 250,
pause: 2000,
content: response.msg
});
}
},'json')
}, 'json')
},
gourl(url){
if(url){
window.location = url
}else{
gourl(url) {
if (url) {
window.location = url
} else {
mDialog.msg({
duration: 250,
pause: 2000,
@@ -143,5 +160,5 @@
},
})
</script>
<?=$this->load->view('h5/market/sylive/hidden_wx_share')?>
<?= $this->load->view('h5/market/sylive/hidden_wx_share') ?>
</body>
+1 -1
View File
@@ -7,7 +7,7 @@
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title><?=$_title?></title>
<link rel="stylesheet" href="/css/h5/market/sylive/h5.css?2022102420">
<link rel="stylesheet" href="/css/h5/market/sylive/h5.css?20221103">
<link rel="stylesheet" href="https://qs.haodian.cn/web/javascript/swiper/css/swiper.min.css">
<script type="text/javascript" src="https://qs.haodian.cn/web/javascript/jquery.3.4.1.min.js"></script>
<script type="text/javascript" src="https://qs.haodian.cn/web/javascript/vue.2.6.10.min.js"></script>
+324
View File
@@ -0,0 +1,324 @@
<body class="bg-f6">
<div id="app" ref="app">
<div class="container relative bg-no-repeat bg-size-fullwidth bg-pos-top pb150">
<div class="inner30 fn-flex">
<div class="fn-flex-item wp50 mr20">
<div class="mt10 text-nowrap">
<img class="text-middle imgsize-40X40 ulib-r750" :src="info.logo" alt="#"/>
<span class="text-middle font-28">{{info.title}}</span>
</div>
</div>
<div class="fn-flex-item wp50 relative pt10 pb10 pl50 pr20 bg-ddd ulib-r750">
<div class="absolute box-middle left-0 font-24 color-999 pl15 pr10 brs-1-999"><i
class="iconfont icon-sousuo"></i></div>
<input class="wp90 bg-ddd bds-1-ddd font-22 ulib-r750" type="search" class="ipt-seach"
placeholder="请输入顾问姓名" v-model="keyWord" @input="searchHandler"/>
</div>
</div>
<div class="relative bg-fff ml30 mr30 inner30 ulib-r20 box-shadow-darkGray" style="min-height:75vh;">
<div>
<!--顾问列表-->
<div class="relative mb30 bg-f9 pt20 pb20 pl30 pr200 ulib-r20" v-for="(item,index) in list">
<div>
<div class="font-28">{{item.uname}}·{{item.mobile}}</div>
<div class="mt10 font-22 color-999" v-if="item.wxuname">
<img class="text-middle imgsize-30X30 ulib-r750" :src="item.wxheadimg" alt="#"/>
<span class="text-middle">{{item.wxuname}}</span>
</div>
<div class="mt10 font-22 color-999" v-else>暂未绑定微信</div>
</div>
<div class="absolute box-middle right-0 mr30 space-nowrap font-26">
<a class="text-middle" href="javascript:void(0);" v-if="!item.wxuname" @click="showForm(index)">修改</a>
<span class="text-middle font-22 pl5 pr5" v-if="!item.wxuname">|</span>
<a class="text-middle" href="javascript:void(0);" @click="showDel(index)">删除</a>
<span class="text-middle font-22 pl5 pr5">|</span>
<a class="text-middle color-ffa85a" href="javascript:void(0);" v-if="item.status==1"
@click=showAble(index)>启用</a>
<a class="text-middle color-ffa85a" href="javascript:void(0);" v-else-if="item.status==0"
@click=showAble(index)>禁用</a>
</div>
</div>
<!--end活动列表-->
</div>
<mugen-scroll :handler="fetchData" :should-handle="!loading" scroll-container="app">
<div class="pt100 pb100 text-center color-ccc" v-if="isNoData"><span
class="text-middle font-22">暂无数据</span></div>
<div class="pt20 pb20 text-center color-ccc" v-else-if="loading"><i
class="iconfont icon-jiazai text-middle"></i><span class="text-middle font-22">请稍等...</span>
</div>
<div class="pt20 pb20 text-center font-22 color-ccc" v-else-if="isDataEnd&&list.length>10">我们是有底线的</div>
</mugen-scroll>
</div>
</div>
<div class="fixed left-0 bottom-0 right-0 inner30 pt15 bg-fff z-index-2">
<div class="pb15 text-center font-22 color-999">
<i class="iconfont icon-xinxi text-middle"></i>
<span class="text-middle">绑定微信后,信息无法修改</span>
</div>
<a class="block bg-1a1a1a pt25 pb25 text-center font-36 color-fff ulib-r10" @click="showForm(-1)"
href="javascript:void(0)">新增顾问</a>
</div>
<? if ($group_id < 2) { ?>
<? $this->load->view('h5/market/sylive/nav') ?>
<? } ?>
<div class="msg fn-hide" :style="isShowForm?'display:block':'display:none'" v-if="isShowForm">
<div class="msgBg" @click="closeOpt"></div>
<div class="msgMain">
<div class="content">
<div class="word">
<div class="relative bg-f6 ulib-r10">
<input class="wp100 inner30 font-30 bg-f6 border-none ulib-r10" type="text" v-model="uname"
placeholder="请输入顾问姓名"/>
</div>
<div class="mt30 relative bg-f6 ulib-r10">
<input class="wp100 inner30 font-30 bg-f6 border-none ulib-r10" type="tel" v-model="mobile"
placeholder="请输入手机号"/>
</div>
</div>
<div class="mt30">
<a class="block pt25 pb25 bg-1a1a1a text-center font-32 color-fff ulib-r10" @click="submit()">{{formIndex>-1?'修改':'新增'}}</a>
</div>
</div>
</div>
</div>
<div class="msg fn-hide" :style="isShowDel?'display:block':'display:none'" v-if="isShowDel">
<div class="msgBg" @click="closeOpt"></div>
<div class="msgMain">
<div class="content" style="padding:0;">
<div class="pt60 pb60 pl40 pr40 text-center font-32">确认删除{{list[delIndex].uname}}"吗?"</div>
<div class="fn-flex bts-1-eee text-center font-28">
<a class="fn-flex-item pt30 pb30" href="javascript:void(0);" @click="delOpt()">确定</a>
<a class="fn-flex-item pt30 pb30 bls-1-eee color-999" href="javascript:void(0);" @click="closeOpt">取消</a>
</div>
</div>
</div>
</div>
<div class="msg fn-hide" :style="isShowAble?'display:block':'display:none'" v-if="isShowAble">
<div class="msgBg" @click="closeOpt"></div>
<div class="msgMain">
<div class="content" style="padding:0;">
<div class="pt60 pb60 pl40 pr40 text-center font-32">
{{list[ableIndex].status==1?'确认启用':'确认禁用'}}{{list[ableIndex].uname}}"吗?"
</div>
<div class="fn-flex bts-1-eee text-center font-28">
<a class="fn-flex-item pt30 pb30" href="javascript:void(0);" @click="ableOpt()">确定</a>
<a class="fn-flex-item pt30 pb30 bls-1-eee color-999" href="javascript:void(0);" @click="closeOpt">取消</a>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
function _Debounce(fn, t) {
let delay = t || 500;
let timer;
return function () {
let args = arguments;
if (timer) {
clearTimeout(timer);
}
timer = setTimeout(() => {
timer = null;
fn.apply(this, args);
}, delay);
}
}
var app = new Vue({
el: '#app',
data: {
keyWord: '',
info: {},
loading: false,
isDataEnd: false,
isNoData: false,
page: 1, //页数
size: 10, //每页取多少个数据
list: [],
uname: '',
mobile: '',
isSubmiting: false,
isRefresh: false,//是否是刷新列表,用于操作后刷新列表
isShowForm: false,
isShowDel: false,
isShowAble: false,
formIndex: -1,
delIndex: -1,
ableIndex: -1,
},
mounted() {
this.getInfo()
},
methods: {
//获取基础信息
getInfo() {
this.info = {
title: "<?=$biz_name?>",
logo: "<?=$headimg?>",
}
},
//拉取数据
fetchData: function () {
this.getStaffList()
},
//顾问列表
searchHandler: _Debounce(function () {
this.loading = false;
this.isDataEnd = false;
this.isNoData = false;
this.page = 1;
this.list = [];
this.getStaffList()
}, 250),
//顾问列表
getStaffList() {
let that = this;
if (!that.isNoData && !that.isDataEnd && !that.loading) {
that.loading = true;
//请求参数
let params = {};
params['keyWord'] = that.keyWord;
params['biz_id'] = <?=$biz_id?>;
if (this.isRefresh) {//刷新列表参数
this.page = this.page - 1;
params['page'] = 1;
params['size'] = this.page * this.size;
} else {
params['page'] = this.page;
params['size'] = this.size;
}
//请求接口
$.get('/h5/market/sylive/user/lists', params, function (result) {
that.loading = false;
that.isRefresh = false;
if (result.code == 200) {
that.page = that.page + 1;
that.list = that.list.concat(result.data.list);
if (result.data.total == 0) {
that.isNoData = true;
} else if (that.list.length == result.data.total) {
that.isDataEnd = true;
}
} else {
mDialog.msg({content: result.msg});
}
}, 'json');
}
},
//关闭弹框
closeOpt: function () {
this.isShowForm = false;
this.isShowDel = false;
this.isShowAble = false;
},
//显示新增编辑弹框
showForm(index) {
this.formIndex = index;
this.isShowForm = true;
if (index > -1) {
this.uname = this.list[index].uname;
this.mobile = this.list[index].mobile;
}
},
//提交新增编辑弹框
submit() {
let that = this;
if (that.isSubmiting) return;
if (!that.uname) {
mDialog.msg({
duration: 250,
pause: 2000,
content: "请输入顾问姓名"
});
} else if (!/^1[3456789]\d{9}$/.test(that.mobile)) {
mDialog.msg({
duration: 250,
pause: 2000,
content: "请输入正确手机号"
});
} else {
that.isSubmiting = true;
let url = '/h5/market/sylive/user/add';
let params = {};
params['uname'] = that.uname;
params['mobile'] = that.mobile;
params['biz_id'] = <?=$biz_id?>;
if (that.formIndex > -1) {
url = '/h5/market/sylive/user/edit';
params['userId'] = this.list[that.formIndex].userId;
}
$.post(url, params, function (response) {
mDialog.msg({content: response.msg});
that.isSubmiting = false;
if (response.code == 200) {
that.isShowForm = false;
that.uname = '';
that.mobile = '';
that.loading = false;
that.isDataEnd = false;
that.isNoData = false;
that.page = 1;
that.list = [];
that.getStaffList();
}
}, 'json');
}
},
//显示启用禁用确认框
showAble(index) {
this.ableIndex = index;
this.isShowAble = true;
},
//启用禁用
ableOpt() {
//请求参数delOpt
let that = this;
let params = {};
params['userId'] = that.list[that.ableIndex].userId;
params['status'] = that.list[that.ableIndex].status == 1 ? 0 : 1;
//执行接口
$.post('/h5/market/sylive/user/status', params, function (response) {
mDialog.msg({content: response.msg});
if (response.code == 200) {
that.list[that.ableIndex].status = that.list[that.ableIndex].status == 1 ? 0 : 1;
that.isShowAble = false;
}
}, 'json');
},
//删除确认框
showDel(index) {
this.delIndex = index;
this.isShowDel = true;
},
//删除
delOpt() {
let that = this;
//请求参数
let params = {};
params['userId'] = that.list[that.delIndex].userId;
params['status'] = -1;
$.post('/h5/market/sylive/user/status', params, function (response) {
mDialog.msg({content: response.msg});
if (response.code == 200) {
that.isShowDel = false;
that.isRefresh = true;
that.loading = false;
that.isDataEnd = false;
that.isNoData = false;
that.list = [];
that.getStaffList();
}
}, 'json');
},
},
})
</script>
<?= $this->load->view('h5/market/sylive/hidden_wx_share') ?>
</body>
File diff suppressed because one or more lines are too long