master
wangxinglong 2021-11-30 18:31:58 +08:00
parent 1093db06f5
commit c7d77f4ca6
22 changed files with 629 additions and 152 deletions

View File

@ -48,31 +48,71 @@ class Agency extends Base
return $this->json(4002, '请输入正确的手机号码');
}
$item['roles'] = [MemberModel::STAFF_ROLE_ID];
$item['roles'] = MemberModel::STAFF_ROLE_ID;
$item['status'] = MemberModel::COMMON_ON;
$item['pid'] = $this->auth["user_id"];
$item['business_code'] = $this->auth["business_code"];
$item['pid'] = $this->auth["user_id"];
$item['business_code'] = $this->auth["business_code"];
$roles = [];
if ($item['roles']) {
$roles = $item['roles'];
$item['roles'] = implode(',', $item['roles']);
}
$roles = [MemberModel::STAFF_ROLE_ID];
Db::startTrans();
try {
//如果关联商家
if (!empty($item['business_code'])) {
$Business = BusinessRepository::getInstance()->findOneByWhere(["code" => $item['business_code']]);
if (empty($Business)) {
Db::rollback();
return $this->json(4001, "指定商家不存在");
}
$Business->save(["is_agency" => BusinessModel::COMMON_ON]);
$item['password'] = md5($item['password'] . $item['username']);
$member = MemberModel::create($item);
foreach ($roles as $role) {
Enforcer::addRoleForUser($member['id'], $role);
}
Db::commit();
return $this->json();
} catch (ValidateException $e) {
Db::rollback();
return $this->json(4001, $e->getError());
}
}
$this->data['roleJson'] = $this->roleJson();
$this->data['business'] = BusinessRepository::getInstance()->getBusinessAll();
return $this->view();
}
/**
* 添加平台商
*
* @return Json|View
* @throws Exception
*/
public function addChannel()
{
if ($this->request->isPost()) {
$item = input('post.');
$validate = $this->validateByApi($item, [
'username|用户名' => 'require|alphaDash|min:4|max:16|unique:member',
'mobile|手机号' => 'require|unique:member',
'nickname|昵称' => 'require|chsAlphaNum|min:2|max:10',
'password|密码' => 'require|min:4|max:16',
'remark|备注信息' => 'max:255',
]);
if ($validate !== true) {
return $validate;
}
if (!checkMobile($item['mobile'])) {
return $this->json(4002, '请输入正确的手机号码');
}
$item['roles'] = MemberModel::ANENT_ROLE_ID;
$item['status'] = MemberModel::COMMON_ON;
$item['pid'] = 0;
$roles = [MemberModel::ANENT_ROLE_ID];
Db::startTrans();
try {
$item['password'] = md5($item['password'] . $item['username']);
$member = MemberModel::create($item);
foreach ($roles as $role) {
@ -125,42 +165,11 @@ class Agency extends Base
if (!checkMobile($item['mobile'])) {
return $this->json(4002, '请输入正确的手机号码');
}
$item['roles'] = [MemberModel::STAFF_ROLE_ID];
$roles = [];
if ($item['roles']) {
$roles = $item['roles'];
$item['roles'] = implode(',', $item['roles']);
}
Db::startTrans();
try {
//之前关联的商家不为空 并且已经改变 吧之前的商家 从代理商变成普通商家
if ($info['business_code'] != $item['business_code']) {
if (!empty($info['business_code'])) {
$oldBusiness = BusinessRepository::getInstance()->findOneByWhere(["code" => $info['business_code']]);
if (!empty($oldBusiness)) {
$oldBusiness->save(["is_agency" => BusinessModel::COMMON_OFF]);
}
}
//如果改变了关联商家
if (!empty($item['business_code'])) {
$Business = BusinessRepository::getInstance()->findOneByWhere(["code" => $item['business_code']]);
if (empty($Business)) {
Db::rollback();
return $this->json(4001, "指定商家不存在");
}
$Business->save(["is_agency" => BusinessModel::COMMON_ON]);
}
}
$info->save($item);
//删除所有角色
Enforcer::deleteRolesForUser($id);
//新增角色
foreach ($roles as $role) {
Enforcer::addRoleForUser($id, $role);
}
Db::commit();
return $this->json();
} catch (ValidateException $e) {
@ -170,16 +179,85 @@ class Agency extends Base
}
$this->data['item'] = $info;
$this->data['roleJson'] = $this->roleJson(explode(',', $info['roles']));
return $this->view();
}
/**
* 编辑
*
* @return Json|View
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
* @throws Exception
*/
public function editChannel()
{
$id = input('id/d', 0);
if (!$info = MemberModel::findById($id)) {
return $this->json(4001, '记录不存在');
}
if ($this->request->isPost()) {
$item = input('post.');
$validate = $this->validateByApi($item, [
'mobile|手机号' => 'require|unique:member,mobile,' . $id,
'nickname|昵称' => 'require|chsAlphaNum|min:2|max:10',
'remark|备注信息' => 'max:255',
]);
if ($validate !== true) {
return $validate;
}
if (!checkMobile($item['mobile'])) {
return $this->json(4002, '请输入正确的手机号码');
}
Db::startTrans();
try {
//之前关联的商家不为空 并且已经改变 吧之前的商家 从代理商变成普通商家
if ($info['business_code'] != $item['business_code']) {
if($info['business_code']!="_" ){
$oldBusiness = BusinessRepository::getInstance()->findOneByWhere(["code" => $info['business_code']]);
if (!empty($oldBusiness)) {
$oldBusiness->save(["is_agency" => BusinessModel::COMMON_OFF]);
}
}
//如果改变了关联商家
if($item['business_code']!="_"){
$Business = BusinessRepository::getInstance()->findOneByWhere(["code" => $item['business_code']]);
if (empty($Business)) {
Db::rollback();
return $this->json(4001, "指定商家不存在");
}
$Business->save(["is_agency" => BusinessModel::COMMON_ON]);
}
//修改下级工作人员的平台商号
BusinessModel::where("pid",$info['id'])->update(["business_code"=>$item['business_code']]);
}
$info->save($item);
Db::commit();
return $this->json();
} catch (ValidateException $e) {
Db::rollback();
return $this->json(4001, $e->getError());
}
}
$this->data['item'] = $info;
$this->data['business'] = BusinessRepository::getInstance()->getBusinessAll();
return $this->view();
}
/**
* 列表
* 工作人员列表
*
* @return Json|View
* @throws Exception
@ -190,23 +268,86 @@ class Agency extends Base
if ($this->request->isPost()) {
$page = $this->request->param('page/d', 1);
$size = $this->request->param('size/d', 30);
//只查询拥有渠道商的账号
$whereMap = [['roles', "=", MemberModel::STAFF_ROLE_ID], ['id', "<>", 1]];
$orders = ['id' => 'asc'];
//如果是渠道商或者工作人员 只查看自己的商家
if (MemberModel::is_agency($this->auth['roles'])){
if (MemberModel::is_agency($this->auth['roles'])) {
$whereMap[] = ["pid", "=", $this->auth['user_id']];
}
$list = MemberModel::findList($whereMap, [], $page, $size, null, $orders);
return $this->json(0, 'success', $list);
}
return $this->view();
}
/**
* 渠道商列表
*
* @return Json|View
* @throws Exception
*/
public function channelList()
{
if ($this->request->isPost()) {
$page = $this->request->param('page/d', 1);
$size = $this->request->param('size/d', 30);
//只查询拥有渠道商的账号
$whereMap = [['roles', "=", MemberModel::ANENT_ROLE_ID], ['id', "<>", 1]];
$orders = ['id' => 'asc'];
$list = MemberModel::findList($whereMap, [], $page, $size, null, $orders);
$list["list"]->each(function ($item) {
//管理的商家数
$item->business_count = BusinessRepository::getInstance()->agencyHasBusinessCount($item['business_code']);
//管理的商家的优惠券数
$item->coupon_count = BusinessRepository::getInstance()->agencyHasCouponCount($item['business_code']);
});
return $this->json(0, 'success', $list);
}
return $this->view();
}
/**
* 单个字段编辑
*
* @return Json
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
* @throws Exception
*/
public function modify(): Json
{
if ($this->request->isPost()) {
$item = input('post.');
$validate = $this->validateByApi($item, [
'field' => 'require',
'value' => 'require',
]);
if ($validate !== true) {
return $validate;
}
if (!$info = MemberModel::findById($item['id'])) {
return $this->json(4001, '记录不存在');
}
$update = [$item['field'] => $item['value']];
try {
$info->save($update);
return $this->json();
} catch (ValidateException $e) {
return $this->json(4001, $e->getError());
}
}
return $this->json(4000, '非法请求');
}
/**
* 删除
@ -220,6 +361,11 @@ class Agency extends Base
if (empty($ids)) {
$ids[] = input('post.id/d');
}
foreach ($ids as $id) {
if ($id == 1) {
return $this->json(5000, "错误的删除操作");
}
}
MemberModel::deleteByIds($ids);
foreach ($ids as $id) {
Enforcer::deleteRolesForUser($id);
@ -231,6 +377,36 @@ class Agency extends Base
}
/**
* 删除
*
* @return Json
*/
public function delChannel(): Json
{
if ($this->request->isPost()) {
$ids = input('post.ids/a', []);
if (empty($ids)) {
$ids[] = input('post.id/d');
}
foreach ($ids as $id) {
if ($id == 1) {
return $this->json(5000, "错误的删除操作");
}
if(MemberModel::hasStaff($id)){
return $this->json(5000, "还存在员工,不能删除");
}
}
MemberModel::deleteByIds($ids);
foreach ($ids as $id) {
Enforcer::deleteRolesForUser($id);
}
Log::write(get_class() . 'Del', 'del', '涉及到的ID为' . implode(',', $ids));
return $this->json();
}
return $this->json(4001, '非法请求!');
}
/**
* 修改密码
*

View File

@ -12,7 +12,6 @@ use app\model\Member;
use app\model\BusinessCircle as BusinessCircleModel ;
use app\repository\AccountRepository;
use app\repository\BusinessRepository;
use app\repository\CouponRepository;
use app\repository\RechargeRepository;
use app\service\wx\WechatPay;
use Exception;

View File

@ -180,7 +180,7 @@ class Comment extends Base
$whereMap = [["comment.is_delete", "=", CommentModel::COMMON_OFF]];
$orders = ['comment.id' => 'desc'];
if (!empty($keyword)) {
$whereMap[] = ['account.nick_name', 'like', "%$keyword%"];
$whereMap[] = ['account.nick_name|comment.comment', 'like', "%$keyword%"];
}
if ($type >= 0) {
$whereMap[] = ['comment.type', '=', $type];
@ -217,7 +217,7 @@ class Comment extends Base
$size = $this->request->param('size/d', 30);
$whereMap = [["comment.is_delete", "=", CommentModel::COMMON_ON]];
if (!empty($keyword)) {
$whereMap[] = ['account.nick_name', 'like', "%$keyword%"];
$whereMap[] = ['account.nick_name|comment.comment', 'like', "%$keyword%"];
}
$orders = ['comment.id' => 'desc'];
$list = CommentModel::findList($whereMap, [], $page, $size, function ($q) {

View File

@ -2,23 +2,11 @@
namespace app\controller\manager;
use app\exception\RepositoryException;
use app\model\Account;
use app\model\BusinessFlow;
use app\model\Coupon;
use app\model\CouponMain;
use app\model\Recharge;
use app\model\Business as BusinessModel;
use app\model\Member;
use app\model\Tag;
use app\repository\AccountRepository;
use app\repository\BusinessRepository;
use app\repository\CouponRepository;
use app\repository\RechargeRepository;
use app\service\wx\WechatPay;
use Exception;
use think\facade\Db;
use think\response\Json;
use think\response\View;
@ -36,11 +24,9 @@ class Consumer extends Base
*/
public function index()
{
$stateArray = Account::allState();
if ($this->request->isPost()) {
$repo = AccountRepository::getInstance();
$keyword = $this->request->param('keyword/s', '');
$state = $this->request->param('state/d', "-1");
$page = $this->request->param('page/d', 1);
$size = $this->request->param('size/d', 30);
@ -49,9 +35,6 @@ class Consumer extends Base
if (!empty($keyword)) {
$whereMap[] = ['nick_name', 'like', "%$keyword%"];
}
if (isset($stateArray[$state])) {
$whereMap[] = ['state', '=', $state];
}
$list = $repo->findList($whereMap, [], $page, $size, function ($q) {
return $q->with("tag");
}, $orders);
@ -71,7 +54,6 @@ class Consumer extends Base
return $this->json(0, 'success', $list);
}
$this->data["state"] = $stateArray;
return $this->view();
}
@ -141,11 +123,11 @@ class Consumer extends Base
*/
public function blankList()
{
$stateArray = Account::allState();
if ($this->request->isPost()) {
$repo = AccountRepository::getInstance();
$keyword = $this->request->param('keyword/s', '');
$state = $this->request->param('state/d', "-1");
$page = $this->request->param('page/d', 1);
$size = $this->request->param('size/d', 30);
@ -157,9 +139,7 @@ class Consumer extends Base
if (!empty($keyword)) {
$whereMap[] = ['nick_name', 'like', "%$keyword%"];
}
if (isset($stateArray[$state])) {
$whereMap[] = ['state', '=', $state];
}
$list = $repo->findList($whereMap, [], $page, $size, null, $orders);
$time = time();
$list["list"]->each(function ($item) use ($time) {
@ -183,7 +163,6 @@ class Consumer extends Base
return $this->json(0, 'success', $list);
}
$this->data["state"] = $stateArray;
return $this->view();
}

View File

@ -6,6 +6,7 @@ use app\service\Jwt;
use Exception;
use app\model\{Member, AuthRule, LoginLog};
use app\controller\BaseController;
use tauthz\facade\Enforcer;
use think\response\Json;
use think\response\View;
@ -41,6 +42,18 @@ class Login extends BaseController
if ($member['status'] != Member::STATUS_NORMAL) {
return $this->json(4004, '账号已被禁用');
}
if($member['pid']){
$parentNumber = Member::getById($member['pid']);
if(empty($parentNumber)){
return $this->json(4004, '平台商账号不存在');
}
if ($parentNumber['status'] != Member::STATUS_NORMAL) {
return $this->json(4004, '所属平台商账号已被禁用');
}
}
$userInfo = [
'user_id' => $member['id'],

View File

@ -7,8 +7,13 @@ class Business extends Base
const state_reviewing = 0;
const state_on = 1;
const state_off = 2;
public function category()
{
return $this->hasOne(Category::class, 'id',"type");
}
public function account()
{
return $this->hasOne(Account::class, 'business_code',"code");
}
}

View File

@ -2,7 +2,7 @@
namespace app\model;
//商家和用户的链接表
//用户关注的商家
class BusinessFlow extends Base
{
public function account()

View File

@ -15,4 +15,8 @@ use think\db\exception\ModelNotFoundException;
class Deduction extends Base
{
public function couponMain()
{
return $this->hasOne(CouponMain::class,"id","coupon_main_id");
}
}

View File

@ -3,6 +3,7 @@
namespace app\model;
use think\facade\Db;
use think\Model;
class Member extends Base
{
@ -104,4 +105,15 @@ class Member extends Base
}
return false;
}
public static function onAfterInsert ($obj)
{
$obj->create_time = date("Y-m-d H:i:s");
$obj->save();
}
public static function hasStaff($id)
{
return self::where("pid",$id)->count();
}
}

View File

@ -2,14 +2,8 @@
namespace app\repository;
use app\exception\RepositoryException;
use app\model\Business;
use app\model\BusinessFlow;
use app\model\CouponBill;
use app\model\CouponMain;
use app\model\Deduction;
use app\model\Member as MemberModel;
use app\model\Recharge;
use app\service\Repository;
use think\Collection;
use think\Model;

View File

@ -1,10 +1,9 @@
<?php
namespace app\repository;
use app\exception\RepositoryException;
use app\model\Business;
use app\model\BusinessCircle;
use app\model\BusinessFlow;
use app\model\CouponMain;
use app\model\Deduction;
use app\model\Recharge;
@ -23,6 +22,7 @@ use think\Model;
class BusinessRepository extends Repository
{
use CouponBillTrait;
/**
* 根据条件查询列表
*
@ -36,7 +36,7 @@ class BusinessRepository extends Repository
public function businessList(array $where = [], int $page = 1, int $limit = 0, array $order = [])
{
$q = $this->model->alias("a")
->join("account b","a.code = b.business_code")
->join("account b", "a.code = b.business_code")
->field(["a.code as business_code",
"b.avatar_url",
"b.nick_name as account_nick_name",
@ -44,7 +44,7 @@ class BusinessRepository extends Repository
"a.total_recharge",
"a.id as basiness_id",
"a.balance"])
->group("a.id");
->group("a.id");
$data = [
'total' => 0,
'current' => $page,
@ -101,7 +101,9 @@ class BusinessRepository extends Repository
*/
public function businessDeductionList($where, int $page = 1, int $limit = 0, array $order = ["create_time" => "desc", "id" => "desc"])
{
return Deduction::findList($where, [], $page, $limit, null, $order);
return Deduction::findList($where, [], $page, $limit, function ($q) {
return $q->with("couponMain");
}, $order);
}
/**
@ -124,26 +126,26 @@ class BusinessRepository extends Repository
/* 获取所有的商家*/
public function getBusinessAll()
{
return BusinessFlow::alias("a")
->join("account b","a.user_code = b.user_code")
->join("business c","a.business_code = c.code")
->field("c.code , c.business_name ")
->order("a.id desc")
->select();
return Business::alias("a")
->join("account b", "a.code = b.business_code")
->field("a.code , a.business_name ")
->order("a.id desc")
->group("a.id")
->select();
}
/**
* 获取单个商家详情
* @param $businessCode
* @param bool $lock
* @return BusinessFlow|array|Model|null
* @return array|Model|null
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getBusinessAccount($businessCode,bool $lock = false)
public function getBusinessAccount($businessCode, bool $lock = false)
{
$Flow = BusinessFlow::with(["account", "business"])->where("business_code", $businessCode)->when($lock,function ($q){
$Flow = Business::with(["account"])->where("code", $businessCode)->when($lock, function ($q) {
$q->lock(true);
})->find();
if (empty($Flow) || empty($Flow->account) || empty($Flow->business)) {
@ -155,10 +157,36 @@ class BusinessRepository extends Repository
/**
* 查看指定商圈下的商家
* @param $businessCircleId
* @return Business
* @return Business[]|array|Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getByCircleId($businessCircleId)
{
return Business::where("business_circle_id",$businessCircleId)->select();
return Business::where("business_circle_id", $businessCircleId)->select();
}
/**
* 平台商下有多少商家
* @param $agencyCode
* @return int
*/
public function agencyHasBusinessCount($agencyCode)
{
return Business::where("agency_code", $agencyCode)->count();
}
/**
* 平台商下商家 所持有的优惠券数量
* @param $agencyCode
* @return int
*/
public function agencyHasCouponCount($agencyCode)
{
return Business::alias("a")
->join("coupon_main b", "a.code =b.business_code")
->where("a.agency_code", $agencyCode)
->sum("b.count");
}
}

View File

@ -5,6 +5,7 @@ layui.use(['laytpl', 'table', 'jquery', 'form', 'miniTab', 'xmSelect'], function
layer = layui.layer,
xmSelect = layui.xmSelect,
miniTab = layui.miniTab;
let modifyUrl = $('#row-modify').data('url');
/**** index begin ***/
//index页面
@ -60,6 +61,18 @@ layui.use(['laytpl', 'table', 'jquery', 'form', 'miniTab', 'xmSelect'], function
return false;
});
//监听状态改变
form.on('switch(changeStatus)', function(obj){
let val = obj.elem.checked ? 1 : 0;
$.post(modifyUrl, {id: this.value, field: this.name, value: val}, function (res) {
layer.msg(res.msg)
if (res.code === 0) {
setTimeout(function () {
insTb.reload();
}, 1000)
}
})
});
/** td edit **/
table.on('edit(table-container)', function (obj) {

View File

@ -43,6 +43,13 @@ layui.use(['laytpl', 'table', 'jquery', 'form', 'miniTab', 'xmSelect'], function
{field: 'create_time', title: '扣费时间'},
{field: 'money', title: '扣费金额'},
{field: 'reason', title: '扣费原因'},
{templet : '#row-other', title: '其他'},
{templet : function (d) {
if(d.couponMain!=undefined){
return d.couponMain.name;
}
return '';
}, title: '优惠券名称'},
{field: 'balance' , title: '当前余额'},
]],
done: function () {

View File

@ -0,0 +1,119 @@
layui.use(['laytpl', 'table', 'jquery', 'form', 'miniTab', 'xmSelect'], function () {
let $ = layui.jquery,
form = layui.form,
table = layui.table,
layer = layui.layer,
xmSelect = layui.xmSelect,
miniTab = layui.miniTab;
let modifyUrl = $('#row-modify').data('url');
/**** index begin ***/
//index页面
if ($('.location-index-page').length > 0) {
miniTab.listen();
// 渲染表格
let listUrl = $('#table-container').data('url');
let insTb = table.render({
elem: '#table-container',
toolbar: '#toolbar-tpl',
defaultToolbar: [null],
url: listUrl,
method: 'post',
even: true,
limits: [10,20,50,100,200,500,1000],
request: {
pageName: 'page',
limitName: 'size',
},
parseData: function (res) {
return {
"code": res.code, //解析接口状态
"msg": res.msg, //解析提示文本
"count": res.data.total, //解析数据长度
"data": res.data.list //解析数据列表
};
},
page: true,
cols: [[
{type: 'checkbox'},
{field: 'id', width: 80, title: 'ID'},
{field: 'nickname', title: '昵称'},
{field: 'business_count', title: '下属商家数'},
{field: 'coupon_count', title: '下属优惠券数'},
{field: 'create_time', title: '注册时间'},
{templet: '#row-status', title: '状态'},
{templet: '#row-operate', minWidth: 150, field: 'right', align: 'center', title: '操作', fixed: 'right'}
]],
done: function () {
Tools.setInsTb(insTb);
}
});
// 监听搜索操作
form.on('submit(data-search-btn)', function (data) {
//执行搜索重载
table.reload('table-container', {
page: {curr: 1}
, where: data.field
}, 'data');
return false;
});
//监听状态改变
form.on('switch(changeStatus)', function(obj){
let val = obj.elem.checked ? 1 : 0;
$.post(modifyUrl, {id: this.value, field: this.name, value: val}, function (res) {
layer.msg(res.msg)
if (res.code === 0) {
setTimeout(function () {
insTb.reload();
}, 1000)
}
})
});
/** td edit **/
table.on('edit(table-container)', function (obj) {
let id = obj.data.id;
if (obj.field == 'sort') {
$.ajax('/manager/slide/sort', {
data: {
"sort": obj.value,
"id": id
}
,dataType : 'json'
,type: 'POST'
})
.done(function () {
insTb.reload();
})
}
});
}
/*** index end ***/
/** add and edit **/
if ($('.location-operate-page').length > 0) {
//监听提交
form.on('submit(saveMember)', function (data) {
let url = $(data.elem).data('url');
$.post(url, data.field, function (res) {
layer.msg(res.msg);
if (res.code === 0) {
//刷新父级列表
parent.layui.$('[data-table-refresh]').trigger("click");
setTimeout(function () {
//关闭当前弹出层
let iframeIndex = parent.layer.getFrameIndex(window.name);
parent.layer.close(iframeIndex);
}, 1000)
}
});
return false;
});
}
});

View File

@ -34,18 +34,6 @@
</div>
</div>
<div class="layui-form-item layui-form-text" style="display: none">
<label class="layui-form-label">关联商家</label>
<div class="layui-input-block">
<select name="business_code" lay-search="" >
<option value=""></option>
<!-- { foreach $business as $bitem}-->
<!-- <option value="{ $bitem['code']}" >{$ bitem['contact_name']}_{ $bitem['business_name']}</option>-->
<!-- { /foreach}-->
</select>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">

View File

@ -0,0 +1,58 @@
{layout name="manager/layout" /}
<div class="layuimini-container location-operate-page">
<div class="layuimini-main">
<div class="layui-form layuimini-form">
<div class="layui-form-item">
<label class="layui-form-label required">昵称</label>
<div class="layui-input-block">
<input type="text" name="nickname" lay-verify="required" lay-reqtext="昵称不能为空" placeholder="请输入昵称" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label required">手机号</label>
<div class="layui-input-block">
<input type="text" name="mobile" lay-verify="required" lay-reqtext="手机号不能为空" placeholder="请输入手机号" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label required">用户名</label>
<div class="layui-input-block">
<input type="text" name="username" lay-verify="required" lay-reqtext="用户名不能为空" placeholder="请输入用户名" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label required">密码</label>
<div class="layui-input-block">
<input type="password" name="password" lay-verify="required" lay-reqtext="密码不能为空" placeholder="请输入密码" class="layui-input">
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">备注信息</label>
<div class="layui-input-block">
<textarea name="remark" class="layui-textarea" placeholder="请输入备注信息"></textarea>
</div>
</div>
<div class="layui-form-item layui-form-text" >
<label class="layui-form-label">关联商家</label>
<div class="layui-input-block">
<select name="business_code" lay-search="" >
<option value=""></option>
{foreach $business as $bitem}
<option value="{$bitem['code']}" >{$bitem['contact_name']}_{$bitem['business_name']}</option>
{/foreach}
</select>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn layui-btn-normal" data-url="/manager/agency/add-channel" lay-submit lay-filter="saveMember">确认保存</button>
</div>
</div>
</div>
</div>
</div>
<script src="__MANAGER__/js/agency.js?v={:mt_rand()}"></script>

View File

@ -0,0 +1,58 @@
{layout name="manager/layout" /}
<style>
.layui-table-cell{
height: auto;
white-space: normal;
}
.layui-table .layui-layer-photos {height: 90px;}
.layui-table img{
max-height: 100%;
object-fit: cover;
margin-left: auto;
margin-right: auto;
display: block;
max-width: 150px;
vertical-align: middle;
border: 0;
}
</style>
<div class="layui-row layui-col-space12">
<div class="layui-col-xs12 layui-col-md12">
<div id="echarts-records" style="background-color:#ffffff;min-height:600px;">
<div class="layuimini-container location-index-page">
<div class="layuimini-main">
<div>
<table id="table-container" class="layui-table" data-url="/manager/agency/channel-list" lay-filter="table-container"></table>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- 操作列 -->
<script type="text/html" id="row-operate">
<a class="layui-btn layui-btn-warm layui-btn-xs" data-href="/manager/agency/password.html?id={{d.id}}" data-title="修改密码" lay-event="password">改密</a>
<a class="layui-btn layui-btn-primary layui-btn-xs" data-href="/manager/agency/edit-channel.html?id={{d.id}}" data-title="编辑" lay-event="edit">编辑</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" data-href="/manager/agency/del-channel.html" lay-event="del">删除</a>
</script>
<!-- toolbar -->
<script type="text/html" id="toolbar-tpl">
<a class="layui-btn layui-btn-primary layui-btn-sm" data-table-refresh lay-event="refresh"><i class="fa fa-refresh"></i></a>
<a class="layui-btn layui-btn-normal layui-btn-sm" data-href="/manager/agency/add-channel.html" data-title="添加" lay-event="add">添加</a>
</script>
<!-- 编辑单元格提交url -->
<input type="hidden" id="row-modify" data-url="/manager/agency/modify">
<!---状态变更 -->
<script type="text/html" id="row-status">
<input type="checkbox" name="status" value="{{d.id}}" lay-skin="switch" lay-text="正常|禁用" lay-filter="changeStatus" {{ d.status == 1 ? 'checked' : '' }}>
</script>
<script src="__MANAGER__/js/channel.js?v={:mt_rand()}"></script>

View File

@ -28,18 +28,6 @@
</div>
</div>
<!-- <div class="layui-form-item layui-form-text" style="display:none;">-->
<!-- <label class="layui-form-label">关联商家</label>-->
<!-- <div class="layui-input-block">-->
<!-- <select name="business_code" lay-search="" >-->
<!-- <option value=""></option>-->
<!-- { foreach $ business as $bitem}-->
<!-- <option value="{ $bitem['code']}" { if $bitem['code']== $item['business_code']} selected { /if} >{ $bitem['contact_name']}_-->
<!-- {$ bitem['business_name']}</option>-->
<!-- { /foreach}-->
<!-- </select>-->
<!-- </div>-->
<!-- </div>-->
<div class="layui-form-item">

View File

@ -0,0 +1,53 @@
{layout name="manager/layout" /}
<div class="layuimini-container location-operate-page">
<div class="layuimini-main">
<div class="layui-form layuimini-form">
<div class="layui-form-item">
<label class="layui-form-label">用户名</label>
<div class="layui-input-block">
<input type="text" class="layui-input disabled" disabled value="{$item.username ?? ''}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label required">昵称</label>
<div class="layui-input-block">
<input type="text" name="nickname" lay-verify="required" lay-reqtext="昵称不能为空" placeholder="请输入昵称" value="{$item.nickname ?? ''}" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label required">手机号</label>
<div class="layui-input-block">
<input type="text" name="mobile" lay-verify="required" lay-reqtext="手机号不能为空" placeholder="请输入手机号" value="{$item.mobile ?? ''}" class="layui-input">
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">备注信息</label>
<div class="layui-input-block">
<textarea name="remark" class="layui-textarea" placeholder="请输入备注信息">{$item.remark ?? ''}</textarea>
</div>
</div>
<div class="layui-form-item layui-form-text" >
<label class="layui-form-label">关联商家</label>
<div class="layui-input-block">
<select name="business_code" lay-search="" >
<option value=""></option>
{foreach $business as $bitem}
<option value="{$bitem['code']}" {if $bitem['code']== $item['business_code']} selected {/if} > {$bitem['contact_name']}_{$bitem['business_name']}</option>
{/foreach}
</select>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn layui-btn-normal" data-url="/manager/agency/edit?id={$item.id}" lay-submit lay-filter="saveMember">确认保存</button>
</div>
</div>
</div>
</div>
</div>
<script src="__MANAGER__/js/agency.js?v={:mt_rand()}"></script>

View File

@ -69,4 +69,9 @@
</div>
</script>
<!-- 列 轮播图 -->
<script type="text/html" id="row-other">
经纬度:{{ d.lng }},{{ d.lat }}
</script>
<script src="__MANAGER__/js/business/business_deduction_list.js?v={:mt_rand()}"></script>

View File

@ -31,15 +31,6 @@
<div class="layui-inline">
<input type="text" name="keyword" class="layui-input">
</div>
<label class="layui-form-label">状态</label>
<div class="layui-inline">
<select name="state" id="">
<option value=""></option>
{foreach $state as $key=> $sitem }
<option value="{$key}">{$sitem}</option>
{/foreach}
</select>
</div>
<div class="layui-inline">
<button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索</button>

View File

@ -34,19 +34,6 @@
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">状态</label>
<div class="layui-inline">
<select name="state" id="">
<option value=""></option>
{foreach $state as $key=> $sitem }
<option value="{$key}">{$sitem}</option>
{/foreach}
</select>
</div>
</div>
<div class="layui-inline">
<button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索</button>
</div>