更新:冲突解决
commit
a47ef3b410
|
@ -74,7 +74,6 @@ class User extends Base
|
||||||
'create_time' => $nowDate,
|
'create_time' => $nowDate,
|
||||||
'login_time' => $nowDate,
|
'login_time' => $nowDate,
|
||||||
'type' => Account::type_consumer, // 默认为普通消费者
|
'type' => Account::type_consumer, // 默认为普通消费者
|
||||||
'state' => Account::state_default,
|
|
||||||
'nick_name' => $params['nick_name'] ?: generateDefaultNickName(),
|
'nick_name' => $params['nick_name'] ?: generateDefaultNickName(),
|
||||||
'avatar_url' => $params['avatar_url'] ?: Account::DEFAULT_AVATAR,
|
'avatar_url' => $params['avatar_url'] ?: Account::DEFAULT_AVATAR,
|
||||||
'gender' => $params['gender'],
|
'gender' => $params['gender'],
|
||||||
|
|
|
@ -4,7 +4,6 @@ namespace app\controller\manager;
|
||||||
|
|
||||||
use app\model\Business as BusinessModel;
|
use app\model\Business as BusinessModel;
|
||||||
use app\model\Log;
|
use app\model\Log;
|
||||||
use app\model\Member;
|
|
||||||
use app\model\Member as MemberModel;
|
use app\model\Member as MemberModel;
|
||||||
use app\repository\BusinessRepository;
|
use app\repository\BusinessRepository;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
@ -49,29 +48,71 @@ class Agency extends Base
|
||||||
return $this->json(4002, '请输入正确的手机号码');
|
return $this->json(4002, '请输入正确的手机号码');
|
||||||
}
|
}
|
||||||
|
|
||||||
$item['roles'] = [Member::ANENT_ROLE_ID];
|
$item['roles'] = MemberModel::STAFF_ROLE_ID;
|
||||||
$item['status'] = Member::COMMON_ON;
|
$item['status'] = MemberModel::COMMON_ON;
|
||||||
|
$item['pid'] = $this->auth["user_id"];
|
||||||
|
$item['business_code'] = $this->auth["business_code"];
|
||||||
|
|
||||||
$roles = [];
|
$roles = [MemberModel::STAFF_ROLE_ID];
|
||||||
if ($item['roles']) {
|
|
||||||
$roles = $item['roles'];
|
|
||||||
$item['roles'] = implode(',', $item['roles']);
|
|
||||||
}
|
|
||||||
|
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
try {
|
try {
|
||||||
|
$item['password'] = md5($item['password'] . $item['username']);
|
||||||
//如果关联商家
|
$member = MemberModel::create($item);
|
||||||
if (!empty($item['business_code'])) {
|
foreach ($roles as $role) {
|
||||||
$Business = BusinessRepository::getInstance()->findOneByWhere(["code" => $item['business_code']]);
|
Enforcer::addRoleForUser($member['id'], $role);
|
||||||
if (empty($Business)) {
|
|
||||||
Db::rollback();
|
|
||||||
return $this->json(4001, "指定商家不存在");
|
|
||||||
}
|
|
||||||
$Business->save(["is_agency" => BusinessModel::COMMON_ON]);
|
|
||||||
}
|
}
|
||||||
|
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']);
|
$item['password'] = md5($item['password'] . $item['username']);
|
||||||
$member = MemberModel::create($item);
|
$member = MemberModel::create($item);
|
||||||
foreach ($roles as $role) {
|
foreach ($roles as $role) {
|
||||||
|
@ -124,42 +165,11 @@ class Agency extends Base
|
||||||
if (!checkMobile($item['mobile'])) {
|
if (!checkMobile($item['mobile'])) {
|
||||||
return $this->json(4002, '请输入正确的手机号码');
|
return $this->json(4002, '请输入正确的手机号码');
|
||||||
}
|
}
|
||||||
$item['roles'] = [Member::ANENT_ROLE_ID];
|
|
||||||
$roles = [];
|
|
||||||
if ($item['roles']) {
|
|
||||||
$roles = $item['roles'];
|
|
||||||
$item['roles'] = implode(',', $item['roles']);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
try {
|
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);
|
$info->save($item);
|
||||||
//删除所有角色
|
|
||||||
Enforcer::deleteRolesForUser($id);
|
|
||||||
//新增角色
|
|
||||||
foreach ($roles as $role) {
|
|
||||||
Enforcer::addRoleForUser($id, $role);
|
|
||||||
}
|
|
||||||
Db::commit();
|
Db::commit();
|
||||||
return $this->json();
|
return $this->json();
|
||||||
} catch (ValidateException $e) {
|
} catch (ValidateException $e) {
|
||||||
|
@ -169,16 +179,85 @@ class Agency extends Base
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->data['item'] = $info;
|
$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();
|
$this->data['business'] = BusinessRepository::getInstance()->getBusinessAll();
|
||||||
|
|
||||||
return $this->view();
|
return $this->view();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 轮播图列表
|
* 工作人员列表
|
||||||
*
|
*
|
||||||
* @return Json|View
|
* @return Json|View
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
|
@ -189,18 +268,86 @@ class Agency extends Base
|
||||||
if ($this->request->isPost()) {
|
if ($this->request->isPost()) {
|
||||||
$page = $this->request->param('page/d', 1);
|
$page = $this->request->param('page/d', 1);
|
||||||
$size = $this->request->param('size/d', 30);
|
$size = $this->request->param('size/d', 30);
|
||||||
|
|
||||||
//只查询拥有渠道商的账号
|
//只查询拥有渠道商的账号
|
||||||
$whereMap = [['roles', "=", Member::ANENT_ROLE_ID], ['id', "<>", 1]];
|
$whereMap = [['roles', "=", MemberModel::STAFF_ROLE_ID], ['id', "<>", 1]];
|
||||||
$orders = ['id' => 'asc'];
|
$orders = ['id' => 'asc'];
|
||||||
|
//如果是渠道商或者工作人员 只查看自己的商家
|
||||||
$list = Member::findList($whereMap, [], $page, $size, null, $orders);
|
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->json(0, 'success', $list);
|
||||||
}
|
}
|
||||||
return $this->view();
|
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, '非法请求');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除
|
* 删除
|
||||||
|
@ -214,6 +361,11 @@ class Agency extends Base
|
||||||
if (empty($ids)) {
|
if (empty($ids)) {
|
||||||
$ids[] = input('post.id/d');
|
$ids[] = input('post.id/d');
|
||||||
}
|
}
|
||||||
|
foreach ($ids as $id) {
|
||||||
|
if ($id == 1) {
|
||||||
|
return $this->json(5000, "错误的删除操作");
|
||||||
|
}
|
||||||
|
}
|
||||||
MemberModel::deleteByIds($ids);
|
MemberModel::deleteByIds($ids);
|
||||||
foreach ($ids as $id) {
|
foreach ($ids as $id) {
|
||||||
Enforcer::deleteRolesForUser($id);
|
Enforcer::deleteRolesForUser($id);
|
||||||
|
@ -225,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, '非法请求!');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改密码
|
* 修改密码
|
||||||
*
|
*
|
||||||
|
|
|
@ -6,6 +6,7 @@ use app\repository\CmsRepository;
|
||||||
|
|
||||||
use app\model\Area as AreaModel;
|
use app\model\Area as AreaModel;
|
||||||
|
|
||||||
|
use think\exception\ValidateException;
|
||||||
use think\response\Json;
|
use think\response\Json;
|
||||||
use think\response\View;
|
use think\response\View;
|
||||||
|
|
||||||
|
@ -36,4 +37,43 @@ class Area extends Base
|
||||||
}
|
}
|
||||||
return $this->view();
|
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 = AreaModel::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, '非法请求');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -3,13 +3,14 @@
|
||||||
namespace app\controller\manager;
|
namespace app\controller\manager;
|
||||||
|
|
||||||
use app\exception\RepositoryException;
|
use app\exception\RepositoryException;
|
||||||
use app\model\BusinessFlow;
|
use app\model\Account;
|
||||||
use app\model\Coupon;
|
use app\model\Coupon;
|
||||||
use app\model\CouponMain;
|
use app\model\CouponMain;
|
||||||
use app\model\Category as CategoryModel;
|
use app\model\Category as CategoryModel;
|
||||||
use app\model\Business as BusinessModel;
|
use app\model\Business as BusinessModel;
|
||||||
use app\model\Member;
|
use app\model\Member;
|
||||||
use app\model\BusinessCircle as BusinessCircleModel ;
|
use app\model\BusinessCircle as BusinessCircleModel ;
|
||||||
|
use app\repository\AccountRepository;
|
||||||
use app\repository\BusinessRepository;
|
use app\repository\BusinessRepository;
|
||||||
use app\repository\RechargeRepository;
|
use app\repository\RechargeRepository;
|
||||||
use app\service\wx\WechatPay;
|
use app\service\wx\WechatPay;
|
||||||
|
@ -33,18 +34,20 @@ class Business extends Base
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
if ($this->request->isPost()) {
|
if ($this->request->isPost()) {
|
||||||
$model = new BusinessFlow();
|
$repo = BusinessRepository::getInstance();
|
||||||
$repo = BusinessRepository::getInstance($model);
|
|
||||||
$keyword = $this->request->param('keyword/s', '');
|
$keyword = $this->request->param('keyword/s', '');
|
||||||
$page = $this->request->param('page/d', 1);
|
$page = $this->request->param('page/d', 1);
|
||||||
$size = $this->request->param('size/d', 30);
|
$size = $this->request->param('size/d', 30);
|
||||||
|
|
||||||
$whereMap = [["c.state", "=", BusinessModel::state_on]];
|
$whereMap = [["a.state", "=", BusinessModel::state_on]];
|
||||||
$orders = ['a.id' => 'desc'];
|
$orders = ['a.id' => 'desc'];
|
||||||
if (!empty($keyword)) {
|
if (!empty($keyword)) {
|
||||||
$whereMap[] = ['b.nick_name|c.business_name', 'like', "%$keyword%"];
|
$whereMap[] = ['b.nick_name|a.business_name', 'like', "%$keyword%"];
|
||||||
|
}
|
||||||
|
//如果是渠道商或者工作人员 只查看自己的下级商家
|
||||||
|
if(Member::is_agency($this->auth['roles'])){
|
||||||
|
$whereMap[] = ['a.agency_code', '=', $this->auth['business_code']];
|
||||||
}
|
}
|
||||||
|
|
||||||
$list = $repo->businessList($whereMap, $page, $size, $orders);
|
$list = $repo->businessList($whereMap, $page, $size, $orders);
|
||||||
$list["list"]->each(function ($item) {
|
$list["list"]->each(function ($item) {
|
||||||
//得到当前商家的所有优惠券
|
//得到当前商家的所有优惠券
|
||||||
|
@ -74,6 +77,9 @@ class Business extends Base
|
||||||
->where("is_verificated", "=", Coupon::is_verificated_on)
|
->where("is_verificated", "=", Coupon::is_verificated_on)
|
||||||
->count();
|
->count();
|
||||||
|
|
||||||
|
//产生的总收益数
|
||||||
|
$item->coupon_profit_count = BusinessRepository::getInstance()->businessProfitTotal( $item->business_code);
|
||||||
|
|
||||||
//商家充值总额
|
//商家充值总额
|
||||||
$item->recharge_total_money = $item->total_recharge;
|
$item->recharge_total_money = $item->total_recharge;
|
||||||
});
|
});
|
||||||
|
@ -185,7 +191,7 @@ class Business extends Base
|
||||||
public function businessDetail()
|
public function businessDetail()
|
||||||
{
|
{
|
||||||
$businessCode = input("business_code/s", "");
|
$businessCode = input("business_code/s", "");
|
||||||
$business = $repo = BusinessRepository::getInstance()->findOneByWhere(['code' => $businessCode]);
|
$business = BusinessRepository::getInstance()->findOneByWhere(['code' => $businessCode]);
|
||||||
if ($this->request->isPost()) {
|
if ($this->request->isPost()) {
|
||||||
if(empty($business)){
|
if(empty($business)){
|
||||||
return $this->json(4001,"商家不存在");
|
return $this->json(4001,"商家不存在");
|
||||||
|
@ -248,16 +254,22 @@ class Business extends Base
|
||||||
public function businessWaitList()
|
public function businessWaitList()
|
||||||
{
|
{
|
||||||
if ($this->request->isPost()) {
|
if ($this->request->isPost()) {
|
||||||
$model = new BusinessFlow();
|
|
||||||
$repo = BusinessRepository::getInstance($model);
|
$repo = BusinessRepository::getInstance();
|
||||||
$keyword = $this->request->param('keyword/s', '');
|
$keyword = $this->request->param('keyword/s', '');
|
||||||
$page = $this->request->param('page/d', 1);
|
$page = $this->request->param('page/d', 1);
|
||||||
$size = $this->request->param('size/d', 30);
|
$size = $this->request->param('size/d', 30);
|
||||||
|
|
||||||
$whereMap = [["business.state", "in", [BusinessModel::state_reviewing, BusinessModel::state_off]]];
|
|
||||||
$orders = ['business.id' => 'desc'];
|
|
||||||
|
$whereMap = [["a.state", "in", [BusinessModel::state_reviewing, BusinessModel::state_off]]];
|
||||||
|
//如果是渠道商或者工作人员 只查看自己的下级商家
|
||||||
|
if(Member::is_agency($this->auth['roles'])){
|
||||||
|
$whereMap[] = ['a.agency_code', '=', $this->auth['business_code']];
|
||||||
|
}
|
||||||
|
$orders = ['a.id' => 'desc'];
|
||||||
if (!empty($keyword)) {
|
if (!empty($keyword)) {
|
||||||
$whereMap[] = ['account.nick_name|business.business_name', 'like', "%$keyword%"];
|
$whereMap[] = ['b.nick_name|a.business_name', 'like', "%$keyword%"];
|
||||||
}
|
}
|
||||||
|
|
||||||
$list = $repo->businessList($whereMap, $page, $size, $orders);
|
$list = $repo->businessList($whereMap, $page, $size, $orders);
|
||||||
|
@ -280,6 +292,10 @@ class Business extends Base
|
||||||
$businessCode = input("business_code/s", "");
|
$businessCode = input("business_code/s", "");
|
||||||
$state = input("state/d", 0);
|
$state = input("state/d", 0);
|
||||||
$reason = input("reason/s", '');
|
$reason = input("reason/s", '');
|
||||||
|
if (!in_array($state, [BusinessModel::state_off, BusinessModel::state_on])) {
|
||||||
|
return $this->json(4001, "错误的审核状态");
|
||||||
|
}
|
||||||
|
|
||||||
$business = BusinessRepository::getInstance()->findOneByWhere(["code" => $businessCode]);
|
$business = BusinessRepository::getInstance()->findOneByWhere(["code" => $businessCode]);
|
||||||
if (empty($business)) {
|
if (empty($business)) {
|
||||||
return $this->json(4001, "商家不存在");
|
return $this->json(4001, "商家不存在");
|
||||||
|
@ -287,12 +303,15 @@ class Business extends Base
|
||||||
if ($business['state'] != BusinessModel::state_reviewing) {
|
if ($business['state'] != BusinessModel::state_reviewing) {
|
||||||
return $this->json(4001, "商家当前状态不可审核");
|
return $this->json(4001, "商家当前状态不可审核");
|
||||||
}
|
}
|
||||||
if (!in_array($state, [BusinessModel::state_off, BusinessModel::state_on])) {
|
$account = AccountRepository::getInstance()->findOneByWhere(["business_code" => $businessCode]);
|
||||||
return $this->json(4001, "错误的审核状态");
|
if (empty($account)) {
|
||||||
|
return $this->json(4001, "关联用户不存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
try {
|
try {
|
||||||
$business->save(["state" => $state, "reason" => $reason]);
|
$business->save(["state" => $state, "reason" => $reason]);
|
||||||
|
$account->save(["type" => Account::type_business]);
|
||||||
Db::commit();
|
Db::commit();
|
||||||
return $this->json();
|
return $this->json();
|
||||||
} catch (RepositoryException $e) {
|
} catch (RepositoryException $e) {
|
||||||
|
|
|
@ -4,6 +4,7 @@ namespace app\controller\manager;
|
||||||
|
|
||||||
use app\model\BusinessCircle as BusinessCircleModel;
|
use app\model\BusinessCircle as BusinessCircleModel;
|
||||||
|
|
||||||
|
use app\repository\BusinessRepository;
|
||||||
use Exception;
|
use Exception;
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
use think\db\exception\DataNotFoundException;
|
use think\db\exception\DataNotFoundException;
|
||||||
|
@ -41,8 +42,14 @@ class BusinessCircle extends Base
|
||||||
if ($this->request->isPost()) {
|
if ($this->request->isPost()) {
|
||||||
$item = input('post.');
|
$item = input('post.');
|
||||||
$validate = $this->validateByApi($item, [
|
$validate = $this->validateByApi($item, [
|
||||||
'sort|标题' => 'require|number',
|
'sort|排序' => 'require|number',
|
||||||
'name|标题' => 'require|max:100',
|
'name|标题' => 'require|max:100',
|
||||||
|
'province|省市区' => 'require',
|
||||||
|
'city|省市区' => 'require',
|
||||||
|
'county|省市区' => 'require',
|
||||||
|
'business_address|详细地址' => 'require',
|
||||||
|
'lng|经度' => 'require',
|
||||||
|
'lat|纬度' => 'require',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($validate !== true) {
|
if ($validate !== true) {
|
||||||
|
@ -82,6 +89,7 @@ class BusinessCircle extends Base
|
||||||
if ($validate !== true) {
|
if ($validate !== true) {
|
||||||
return $validate;
|
return $validate;
|
||||||
}
|
}
|
||||||
|
$item['create_time'] = date("Y-m-d H:i:s");
|
||||||
try {
|
try {
|
||||||
BusinessCircleModel::create($item);
|
BusinessCircleModel::create($item);
|
||||||
return $this->json();
|
return $this->json();
|
||||||
|
@ -104,6 +112,11 @@ class BusinessCircle extends Base
|
||||||
return $this->json(4000, '非法请求');
|
return $this->json(4000, '非法请求');
|
||||||
}
|
}
|
||||||
$ids = $this->request->param('ids/a', []);
|
$ids = $this->request->param('ids/a', []);
|
||||||
|
foreach ($ids as $item){
|
||||||
|
if(count(BusinessRepository::getInstance()->getByCircleId($item)->toArray())){
|
||||||
|
return $this->json("4002","该商圈存在绑定商家 不能删除");
|
||||||
|
}
|
||||||
|
}
|
||||||
BusinessCircleModel::destroy($ids);
|
BusinessCircleModel::destroy($ids);
|
||||||
return $this->json();
|
return $this->json();
|
||||||
}
|
}
|
||||||
|
|
|
@ -180,7 +180,7 @@ class Comment extends Base
|
||||||
$whereMap = [["comment.is_delete", "=", CommentModel::COMMON_OFF]];
|
$whereMap = [["comment.is_delete", "=", CommentModel::COMMON_OFF]];
|
||||||
$orders = ['comment.id' => 'desc'];
|
$orders = ['comment.id' => 'desc'];
|
||||||
if (!empty($keyword)) {
|
if (!empty($keyword)) {
|
||||||
$whereMap[] = ['account.nick_name', 'like', "%$keyword%"];
|
$whereMap[] = ['account.nick_name|comment.comment', 'like', "%$keyword%"];
|
||||||
}
|
}
|
||||||
if ($type >= 0) {
|
if ($type >= 0) {
|
||||||
$whereMap[] = ['comment.type', '=', $type];
|
$whereMap[] = ['comment.type', '=', $type];
|
||||||
|
@ -217,7 +217,7 @@ class Comment extends Base
|
||||||
$size = $this->request->param('size/d', 30);
|
$size = $this->request->param('size/d', 30);
|
||||||
$whereMap = [["comment.is_delete", "=", CommentModel::COMMON_ON]];
|
$whereMap = [["comment.is_delete", "=", CommentModel::COMMON_ON]];
|
||||||
if (!empty($keyword)) {
|
if (!empty($keyword)) {
|
||||||
$whereMap[] = ['account.nick_name', 'like', "%$keyword%"];
|
$whereMap[] = ['account.nick_name|comment.comment', 'like', "%$keyword%"];
|
||||||
}
|
}
|
||||||
$orders = ['comment.id' => 'desc'];
|
$orders = ['comment.id' => 'desc'];
|
||||||
$list = CommentModel::findList($whereMap, [], $page, $size, function ($q) {
|
$list = CommentModel::findList($whereMap, [], $page, $size, function ($q) {
|
||||||
|
|
|
@ -2,23 +2,11 @@
|
||||||
|
|
||||||
namespace app\controller\manager;
|
namespace app\controller\manager;
|
||||||
|
|
||||||
use app\exception\RepositoryException;
|
|
||||||
use app\model\Account;
|
use app\model\Account;
|
||||||
use app\model\BusinessFlow;
|
|
||||||
use app\model\Coupon;
|
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\AccountRepository;
|
||||||
use app\repository\BusinessRepository;
|
|
||||||
use app\repository\CouponRepository;
|
|
||||||
use app\repository\RechargeRepository;
|
|
||||||
use app\service\wx\WechatPay;
|
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
use think\facade\Db;
|
|
||||||
use think\response\Json;
|
use think\response\Json;
|
||||||
use think\response\View;
|
use think\response\View;
|
||||||
|
|
||||||
|
@ -36,11 +24,9 @@ class Consumer extends Base
|
||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$stateArray = Account::allState();
|
|
||||||
if ($this->request->isPost()) {
|
if ($this->request->isPost()) {
|
||||||
$repo = AccountRepository::getInstance();
|
$repo = AccountRepository::getInstance();
|
||||||
$keyword = $this->request->param('keyword/s', '');
|
$keyword = $this->request->param('keyword/s', '');
|
||||||
$state = $this->request->param('state/d', "-1");
|
|
||||||
$page = $this->request->param('page/d', 1);
|
$page = $this->request->param('page/d', 1);
|
||||||
$size = $this->request->param('size/d', 30);
|
$size = $this->request->param('size/d', 30);
|
||||||
|
|
||||||
|
@ -49,9 +35,6 @@ class Consumer extends Base
|
||||||
if (!empty($keyword)) {
|
if (!empty($keyword)) {
|
||||||
$whereMap[] = ['nick_name', 'like', "%$keyword%"];
|
$whereMap[] = ['nick_name', 'like', "%$keyword%"];
|
||||||
}
|
}
|
||||||
if (isset($stateArray[$state])) {
|
|
||||||
$whereMap[] = ['state', '=', $state];
|
|
||||||
}
|
|
||||||
$list = $repo->findList($whereMap, [], $page, $size, function ($q) {
|
$list = $repo->findList($whereMap, [], $page, $size, function ($q) {
|
||||||
return $q->with("tag");
|
return $q->with("tag");
|
||||||
}, $orders);
|
}, $orders);
|
||||||
|
@ -71,7 +54,6 @@ class Consumer extends Base
|
||||||
return $this->json(0, 'success', $list);
|
return $this->json(0, 'success', $list);
|
||||||
|
|
||||||
}
|
}
|
||||||
$this->data["state"] = $stateArray;
|
|
||||||
return $this->view();
|
return $this->view();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,11 +123,11 @@ class Consumer extends Base
|
||||||
*/
|
*/
|
||||||
public function blankList()
|
public function blankList()
|
||||||
{
|
{
|
||||||
$stateArray = Account::allState();
|
|
||||||
if ($this->request->isPost()) {
|
if ($this->request->isPost()) {
|
||||||
$repo = AccountRepository::getInstance();
|
$repo = AccountRepository::getInstance();
|
||||||
$keyword = $this->request->param('keyword/s', '');
|
$keyword = $this->request->param('keyword/s', '');
|
||||||
$state = $this->request->param('state/d', "-1");
|
|
||||||
$page = $this->request->param('page/d', 1);
|
$page = $this->request->param('page/d', 1);
|
||||||
$size = $this->request->param('size/d', 30);
|
$size = $this->request->param('size/d', 30);
|
||||||
|
|
||||||
|
@ -157,9 +139,7 @@ class Consumer extends Base
|
||||||
if (!empty($keyword)) {
|
if (!empty($keyword)) {
|
||||||
$whereMap[] = ['nick_name', 'like', "%$keyword%"];
|
$whereMap[] = ['nick_name', 'like', "%$keyword%"];
|
||||||
}
|
}
|
||||||
if (isset($stateArray[$state])) {
|
|
||||||
$whereMap[] = ['state', '=', $state];
|
|
||||||
}
|
|
||||||
$list = $repo->findList($whereMap, [], $page, $size, null, $orders);
|
$list = $repo->findList($whereMap, [], $page, $size, null, $orders);
|
||||||
$time = time();
|
$time = time();
|
||||||
$list["list"]->each(function ($item) use ($time) {
|
$list["list"]->each(function ($item) use ($time) {
|
||||||
|
@ -183,7 +163,6 @@ class Consumer extends Base
|
||||||
return $this->json(0, 'success', $list);
|
return $this->json(0, 'success', $list);
|
||||||
|
|
||||||
}
|
}
|
||||||
$this->data["state"] = $stateArray;
|
|
||||||
return $this->view();
|
return $this->view();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ namespace app\controller\manager;
|
||||||
use app\exception\RepositoryException;
|
use app\exception\RepositoryException;
|
||||||
|
|
||||||
use app\model\CouponMain;
|
use app\model\CouponMain;
|
||||||
|
use app\model\Member;
|
||||||
use app\repository\BusinessRepository;
|
use app\repository\BusinessRepository;
|
||||||
use app\repository\CouponRepository;
|
use app\repository\CouponRepository;
|
||||||
use app\validate\CouponRelease;
|
use app\validate\CouponRelease;
|
||||||
|
@ -47,7 +48,7 @@ class Coupon extends Base
|
||||||
$size = $this->request->param('size/d', 30);
|
$size = $this->request->param('size/d', 30);
|
||||||
|
|
||||||
$whereMap = [];
|
$whereMap = [];
|
||||||
$orders = ['id' => 'desc'];
|
$orders = ['sort' => 'desc',"id"=>"desc"];
|
||||||
if (!empty($on_shelf) && in_array($on_shelf, [CouponMain::COMMON_ON, CouponMain::COMMON_OFF])) {
|
if (!empty($on_shelf) && in_array($on_shelf, [CouponMain::COMMON_ON, CouponMain::COMMON_OFF])) {
|
||||||
$whereMap[] = ['on_shelf', '=', $on_shelf];
|
$whereMap[] = ['on_shelf', '=', $on_shelf];
|
||||||
}
|
}
|
||||||
|
@ -60,18 +61,35 @@ class Coupon extends Base
|
||||||
if (!empty($keyword)) {
|
if (!empty($keyword)) {
|
||||||
$whereMap[] = ['name', 'like', "%" . $keyword . "%"];
|
$whereMap[] = ['name', 'like', "%" . $keyword . "%"];
|
||||||
}
|
}
|
||||||
|
|
||||||
$list = $repo->findList($whereMap, [], $page, $size, function ($q) {
|
$list = $repo->findList($whereMap, [], $page, $size, function ($q) {
|
||||||
|
|
||||||
if (!empty($keyword)) {
|
if (!empty($keyword)) {
|
||||||
return $q::hasWhere('business', function ($q) use ($keyword) {
|
return $q::hasWhere('business', function ($q) use ($keyword) {
|
||||||
$q->where('business_name', 'like', "%" . $keyword . "%")->field("code,business_name,business_subtitle,type")
|
$q->where('business_name', 'like', "%" . $keyword . "%")
|
||||||
|
//如果是渠道商或者工作人员 只查看自己的下级商家
|
||||||
|
->when(Member::is_agency($this->auth['roles']),function ($q){
|
||||||
|
$q->where( 'agency_code', '=', $this->auth['business_code']);
|
||||||
|
})
|
||||||
|
->field("code,business_name,business_subtitle,type")
|
||||||
->with('category');
|
->with('category');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return $q->with(["business" => function ($query) {
|
|
||||||
$query->field("code,business_name,business_subtitle,type")
|
if(Member::is_agency($this->auth['roles'])){
|
||||||
->with('category');
|
return $q::hasWhere('business', function ($q) {
|
||||||
}]);
|
$q//如果是渠道商或者工作人员 只查看自己的下级商家
|
||||||
|
->where( 'agency_code', '=', $this->auth['business_code'])
|
||||||
|
->field("code,business_name,business_subtitle,type")
|
||||||
|
->with('category');
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
return $q->with(["business" => function ($query) {
|
||||||
|
$query->field("code,business_name,business_subtitle,type")
|
||||||
|
->with('category');
|
||||||
|
}]);
|
||||||
|
}
|
||||||
|
|
||||||
}, $orders);
|
}, $orders);
|
||||||
$time = time();
|
$time = time();
|
||||||
$list['list']->each(function ($item) use ($time) {
|
$list['list']->each(function ($item) use ($time) {
|
||||||
|
@ -88,6 +106,9 @@ class Coupon extends Base
|
||||||
return $this->view();
|
return $this->view();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上架状态 0上架 1下架
|
||||||
|
* */
|
||||||
public function shelf()
|
public function shelf()
|
||||||
{
|
{
|
||||||
$id = input("id/d", 0);
|
$id = input("id/d", 0);
|
||||||
|
|
|
@ -65,7 +65,9 @@ class Index extends Base
|
||||||
$menus[$k]['icon'] = !empty($m['icon']) ? 'fa '.$m['icon'] : '';
|
$menus[$k]['icon'] = !empty($m['icon']) ? 'fa '.$m['icon'] : '';
|
||||||
$menus[$k]['href'] = ltrim($m['href'], '/');
|
$menus[$k]['href'] = ltrim($m['href'], '/');
|
||||||
}
|
}
|
||||||
$menus = CmsRepository::getInstance()->buildMenuChild(0, $menus, 'child');
|
|
||||||
|
$menus = CmsRepository::getInstance()->buildMenuChild(0, $menus, 'child',);
|
||||||
|
|
||||||
$res['menuInfo'] = $menus;
|
$res['menuInfo'] = $menus;
|
||||||
|
|
||||||
return json($res);
|
return json($res);
|
||||||
|
|
|
@ -6,6 +6,7 @@ use app\service\Jwt;
|
||||||
use Exception;
|
use Exception;
|
||||||
use app\model\{Member, AuthRule, LoginLog};
|
use app\model\{Member, AuthRule, LoginLog};
|
||||||
use app\controller\BaseController;
|
use app\controller\BaseController;
|
||||||
|
use tauthz\facade\Enforcer;
|
||||||
use think\response\Json;
|
use think\response\Json;
|
||||||
use think\response\View;
|
use think\response\View;
|
||||||
|
|
||||||
|
@ -41,12 +42,25 @@ class Login extends BaseController
|
||||||
if ($member['status'] != Member::STATUS_NORMAL) {
|
if ($member['status'] != Member::STATUS_NORMAL) {
|
||||||
return $this->json(4004, '账号已被禁用');
|
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 = [
|
$userInfo = [
|
||||||
'user_id' => $member['id'],
|
'user_id' => $member['id'],
|
||||||
'username' => $member['username'],
|
'username' => $member['username'],
|
||||||
'nickname' => $member['nickname'],
|
'nickname' => $member['nickname'],
|
||||||
'business_code' => $member['business_code'],
|
'business_code' => $member['business_code'],
|
||||||
|
'roles' => $member['roles'],
|
||||||
];
|
];
|
||||||
|
|
||||||
$jwtToken = Jwt::generate($userInfo, env('app.expire', 7200));
|
$jwtToken = Jwt::generate($userInfo, env('app.expire', 7200));
|
||||||
|
|
|
@ -143,14 +143,14 @@ class Member extends Base
|
||||||
try {
|
try {
|
||||||
//之前关联的商家不为空 并且已经改变 吧之前的商家 从代理商变成普通商家
|
//之前关联的商家不为空 并且已经改变 吧之前的商家 从代理商变成普通商家
|
||||||
if ($info['business_code'] != $item['business_code']) {
|
if ($info['business_code'] != $item['business_code']) {
|
||||||
if(!empty($info['business_code']) ){
|
if($info['business_code']!="_" ){
|
||||||
$oldBusiness = BusinessRepository::getInstance()->findOneByWhere(["code" => $info['business_code']]);
|
$oldBusiness = BusinessRepository::getInstance()->findOneByWhere(["code" => $info['business_code']]);
|
||||||
if (!empty($oldBusiness)) {
|
if (!empty($oldBusiness)) {
|
||||||
$oldBusiness->save(["is_agency" => BusinessModel::COMMON_OFF]);
|
$oldBusiness->save(["is_agency" => BusinessModel::COMMON_OFF]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//如果改变了关联商家
|
//如果改变了关联商家
|
||||||
if(!empty($item['business_code'])){
|
if($item['business_code']!="_"){
|
||||||
$Business = BusinessRepository::getInstance()->findOneByWhere(["code" => $item['business_code']]);
|
$Business = BusinessRepository::getInstance()->findOneByWhere(["code" => $item['business_code']]);
|
||||||
if (empty($Business)) {
|
if (empty($Business)) {
|
||||||
Db::rollback();
|
Db::rollback();
|
||||||
|
|
|
@ -13,22 +13,11 @@ class Account extends Base
|
||||||
public const type_business = 1;//商家
|
public const type_business = 1;//商家
|
||||||
public const type_staff = 2;//员工
|
public const type_staff = 2;//员工
|
||||||
|
|
||||||
public const state_default = 0;// 未提交
|
|
||||||
public const state_examineing = 1 ;// 1审核中
|
|
||||||
public const state_fail = 2;// 2拒绝
|
|
||||||
public const state_success = 3;// 3审核通过
|
|
||||||
|
|
||||||
// 默认头像
|
// 默认头像
|
||||||
public const DEFAULT_AVATAR = '/static/images/default-avatar.png';
|
public const DEFAULT_AVATAR = '/static/images/default-avatar.png';
|
||||||
|
|
||||||
public static function allState(){
|
|
||||||
return [
|
|
||||||
self::state_default=>"未提交",
|
|
||||||
self::state_examineing=>"审核中",
|
|
||||||
self::state_fail=>"拒绝",
|
|
||||||
self::state_success=>"审核通过",
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function accountTypeDescList(): array
|
public static function accountTypeDescList(): array
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,6 +26,11 @@ class Business extends Base
|
||||||
*/
|
*/
|
||||||
public function agency(): HasOne
|
public function agency(): HasOne
|
||||||
{
|
{
|
||||||
return $this->hasOne(Business::class, 'agency_code',"code");
|
return $this->hasOne(Business::class, 'agency_code', "code");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function account()
|
||||||
|
{
|
||||||
|
return $this->hasOne(Account::class, 'business_code',"code");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
namespace app\model;
|
namespace app\model;
|
||||||
|
|
||||||
//商家和用户的链接表
|
//用户关注的商家
|
||||||
class BusinessFlow extends Base
|
class BusinessFlow extends Base
|
||||||
{
|
{
|
||||||
public function account()
|
public function account()
|
||||||
|
|
|
@ -6,6 +6,7 @@ use think\Collection;
|
||||||
use think\db\exception\DataNotFoundException;
|
use think\db\exception\DataNotFoundException;
|
||||||
use think\db\exception\DbException;
|
use think\db\exception\DbException;
|
||||||
use think\db\exception\ModelNotFoundException;
|
use think\db\exception\ModelNotFoundException;
|
||||||
|
use think\Model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 优惠券主表
|
* 优惠券主表
|
||||||
|
@ -27,4 +28,10 @@ class CouponMain extends Base
|
||||||
{
|
{
|
||||||
return $this->hasOne(CouponType::class, 'id',"type_id");
|
return $this->hasOne(CouponType::class, 'id',"type_id");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function onAfterInsert( $obj)
|
||||||
|
{
|
||||||
|
$obj->sort = $obj->id;
|
||||||
|
$obj->save();
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -15,4 +15,8 @@ use think\db\exception\ModelNotFoundException;
|
||||||
class Deduction extends Base
|
class Deduction extends Base
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public function couponMain()
|
||||||
|
{
|
||||||
|
return $this->hasOne(CouponMain::class,"id","coupon_main_id");
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -3,14 +3,16 @@
|
||||||
namespace app\model;
|
namespace app\model;
|
||||||
|
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
|
use think\Model;
|
||||||
|
|
||||||
class Member extends Base
|
class Member extends Base
|
||||||
{
|
{
|
||||||
public const STATUS_NORMAL = 1;//正常
|
public const STATUS_NORMAL = 1;//正常
|
||||||
public const STATUS_DISABLE = 0;//禁用
|
public const STATUS_DISABLE = 0;//禁用
|
||||||
|
|
||||||
|
public const MANAGER_ROLE_ID = 1;//角色id 2 为管理员
|
||||||
public const ANENT_ROLE_ID = 2;//角色id 2 为代理商
|
public const ANENT_ROLE_ID = 2;//角色id 2 为代理商
|
||||||
|
public const STAFF_ROLE_ID = 3;//角色id 2 为工作人员
|
||||||
|
|
||||||
|
|
||||||
public static function getList($limit = 40)
|
public static function getList($limit = 40)
|
||||||
|
@ -25,23 +27,25 @@ class Member extends Base
|
||||||
/**
|
/**
|
||||||
* 获取所有代理商
|
* 获取所有代理商
|
||||||
* */
|
* */
|
||||||
public static function getAgentAll(){
|
public static function getAgentAll()
|
||||||
|
{
|
||||||
|
|
||||||
$subQuery = Db::name('member')
|
$subQuery = Db::name('member')
|
||||||
->field('id,business_code,nickname')
|
->field('id,business_code,nickname')
|
||||||
->whereRaw('(find_in_set("'.Member::ANENT_ROLE_ID .'", roles))')
|
->whereRaw('(find_in_set("' . Member::ANENT_ROLE_ID . '", roles))')
|
||||||
->buildSql();
|
->buildSql();
|
||||||
|
|
||||||
return Db::table($subQuery . ' a')
|
return Db::table($subQuery . ' a')
|
||||||
->join("business b" ,"a.business_code = b.code")
|
->join("business b", "a.business_code = b.code")
|
||||||
->field("a.*")
|
->field("a.*")
|
||||||
->order('a.id', 'desc')
|
->order('a.id', 'desc')
|
||||||
->select();
|
->select();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据角色分组返回用户
|
* 根据角色分组返回用户
|
||||||
* @param int $groupId 角色分组ID
|
* @param int $groupId 角色分组ID
|
||||||
* @param int $limit 每页数量
|
* @param int $limit 每页数量
|
||||||
*/
|
*/
|
||||||
public static function getListByGroup($groupId, $limit = 40)
|
public static function getListByGroup($groupId, $limit = 40)
|
||||||
{
|
{
|
||||||
|
@ -75,7 +79,41 @@ class Member extends Base
|
||||||
public static function updateCates($id, $cates)
|
public static function updateCates($id, $cates)
|
||||||
{
|
{
|
||||||
$cates = implode(',', $cates);
|
$cates = implode(',', $cates);
|
||||||
$data = ['cates' => $cates];
|
$data = ['cates' => $cates];
|
||||||
self::updateById($id, $data);
|
self::updateById($id, $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证当前用户是否是渠道商
|
||||||
|
* @param string $roles
|
||||||
|
*/
|
||||||
|
public static function is_agency(string $roles)
|
||||||
|
{
|
||||||
|
if (empty($roles)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$roles = explode(",", $roles);
|
||||||
|
|
||||||
|
//包含管理员就返回false
|
||||||
|
if (in_array(self::MANAGER_ROLE_ID, $roles)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array(self::STAFF_ROLE_ID, $roles) || in_array(self::ANENT_ROLE_ID, $roles)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -2,13 +2,8 @@
|
||||||
|
|
||||||
namespace app\repository;
|
namespace app\repository;
|
||||||
|
|
||||||
use app\exception\RepositoryException;
|
|
||||||
use app\model\Business;
|
|
||||||
use app\model\BusinessFlow;
|
|
||||||
use app\model\CouponBill;
|
use app\model\CouponBill;
|
||||||
use app\model\CouponMain;
|
use app\model\Member as MemberModel;
|
||||||
use app\model\Deduction;
|
|
||||||
use app\model\Recharge;
|
|
||||||
use app\service\Repository;
|
use app\service\Repository;
|
||||||
use think\Collection;
|
use think\Collection;
|
||||||
use think\Model;
|
use think\Model;
|
||||||
|
@ -44,25 +39,28 @@ class BillRepository extends Repository
|
||||||
'size' => $size,
|
'size' => $size,
|
||||||
'list' => new Collection(),
|
'list' => new Collection(),
|
||||||
];
|
];
|
||||||
$rep = CouponBill::with([
|
$rep = CouponBill::alias("a")
|
||||||
"business" => function ($query) use ($keyword) {
|
->join("business b","a.business_code = b.code")
|
||||||
$query->field(["code", "business_name"])->when(empty($keyword), function ($q) use ($keyword) {
|
->join("account c","a.user_code = c.user_code")
|
||||||
$q->where("business_name", "like", "%$keyword%");
|
->join("coupon_main d","a.coupon_main_id = d.id")
|
||||||
});
|
|
||||||
},
|
->when(!empty($keyword),function ($q) use($keyword){
|
||||||
"account" => function ($q) {
|
$q->where("b.business_name|c.nick_name|d.name", "like", "%$keyword%");
|
||||||
$q->field(["user_code", "nick_name"]);
|
})
|
||||||
},
|
->when(MemberModel::is_agency(session("auth")['roles']),function ($q) {
|
||||||
"couponMain" => function ($q) {
|
$q->where("b.agency_code", "=", session("auth")['business_code']);
|
||||||
$q->field(["id", "name"]);
|
})
|
||||||
},
|
|
||||||
])
|
|
||||||
->when(!empty($startTime), function ($q) use ($startTime) {
|
->when(!empty($startTime), function ($q) use ($startTime) {
|
||||||
$q->whereTime("create_time", ">=", $startTime);
|
$q->whereTime("a.create_time", ">=", $startTime);
|
||||||
})
|
})
|
||||||
->when(!empty($endTime), function ($q) use ($endTime) {
|
->when(!empty($endTime), function ($q) use ($endTime) {
|
||||||
$q->whereTime("create_time", "<=", $endTime);
|
$q->whereTime("a.create_time", "<=", $endTime);
|
||||||
});
|
})
|
||||||
|
->field("a.*,b.business_name,c.nick_name,c.avatar_url,d.name as coupon_main_name")
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$failData ['total'] = $rep->count();
|
$failData ['total'] = $rep->count();
|
||||||
$failData ['list'] = $rep
|
$failData ['list'] = $rep
|
||||||
|
@ -84,9 +82,13 @@ class BillRepository extends Repository
|
||||||
{
|
{
|
||||||
return CouponBill::when(!empty($start_time), function ($q) use ($start_time) {
|
return CouponBill::when(!empty($start_time), function ($q) use ($start_time) {
|
||||||
$q->whereTime("create_time", ">=", $start_time);
|
$q->whereTime("create_time", ">=", $start_time);
|
||||||
})->when(!empty($end_time), function ($q) use ($end_time) {
|
})
|
||||||
|
->when(!empty($end_time), function ($q) use ($end_time) {
|
||||||
$q->whereTime("create_time", "<=", $end_time);
|
$q->whereTime("create_time", "<=", $end_time);
|
||||||
})
|
})
|
||||||
|
->when(MemberModel::is_agency(session("auth")['roles']),function ($q) {
|
||||||
|
$q->where("agency_code", "=", session("auth")['business_code']);
|
||||||
|
})
|
||||||
->sum($field);
|
->sum($field);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace app\repository;
|
namespace app\repository;
|
||||||
|
|
||||||
use app\exception\RepositoryException;
|
use app\exception\RepositoryException;
|
||||||
use app\model\Business;
|
use app\model\Business;
|
||||||
use app\model\BusinessCircle;
|
|
||||||
use app\model\BusinessFlow;
|
|
||||||
use app\model\CouponMain;
|
use app\model\CouponMain;
|
||||||
use app\model\Deduction;
|
use app\model\Deduction;
|
||||||
use app\model\Recharge;
|
use app\model\Recharge;
|
||||||
use app\service\Repository;
|
use app\service\Repository;
|
||||||
|
use app\traits\CouponBillTrait;
|
||||||
use think\Collection;
|
use think\Collection;
|
||||||
use think\Model;
|
use think\Model;
|
||||||
|
|
||||||
|
@ -21,6 +21,8 @@ use think\Model;
|
||||||
*/
|
*/
|
||||||
class BusinessRepository extends Repository
|
class BusinessRepository extends Repository
|
||||||
{
|
{
|
||||||
|
use CouponBillTrait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据条件查询列表
|
* 根据条件查询列表
|
||||||
*
|
*
|
||||||
|
@ -34,9 +36,15 @@ class BusinessRepository extends Repository
|
||||||
public function businessList(array $where = [], int $page = 1, int $limit = 0, array $order = [])
|
public function businessList(array $where = [], int $page = 1, int $limit = 0, array $order = [])
|
||||||
{
|
{
|
||||||
$q = $this->model->alias("a")
|
$q = $this->model->alias("a")
|
||||||
->join("account b","a.user_code = b.user_code")
|
->join("account b", "a.code = b.business_code")
|
||||||
->join("business c","a.business_code = c.code")
|
->field(["a.code as business_code",
|
||||||
->field(["c.code as business_code","b.avatar_url", "b.nick_name as account_nick_name","c.business_name","c.total_recharge","c.id as basiness_id","c.balance"]);
|
"b.avatar_url",
|
||||||
|
"b.nick_name as account_nick_name",
|
||||||
|
"a.business_name",
|
||||||
|
"a.total_recharge",
|
||||||
|
"a.id as basiness_id",
|
||||||
|
"a.balance"])
|
||||||
|
->group("a.id");
|
||||||
$data = [
|
$data = [
|
||||||
'total' => 0,
|
'total' => 0,
|
||||||
'current' => $page,
|
'current' => $page,
|
||||||
|
@ -93,7 +101,9 @@ class BusinessRepository extends Repository
|
||||||
*/
|
*/
|
||||||
public function businessDeductionList($where, int $page = 1, int $limit = 0, array $order = ["create_time" => "desc", "id" => "desc"])
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -116,26 +126,26 @@ class BusinessRepository extends Repository
|
||||||
/* 获取所有的商家*/
|
/* 获取所有的商家*/
|
||||||
public function getBusinessAll()
|
public function getBusinessAll()
|
||||||
{
|
{
|
||||||
return BusinessFlow::alias("a")
|
return Business::alias("a")
|
||||||
->join("account b","a.user_code = b.user_code")
|
->join("account b", "a.code = b.business_code")
|
||||||
->join("business c","a.business_code = c.code")
|
->field("a.code , a.business_name ")
|
||||||
->field("c.code , c.business_name ")
|
->order("a.id desc")
|
||||||
->order("a.id desc")
|
->group("a.id")
|
||||||
->select();
|
->select();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取单个商家详情
|
* 获取单个商家详情
|
||||||
* @param $businessCode
|
* @param $businessCode
|
||||||
* @param bool $lock
|
* @param bool $lock
|
||||||
* @return BusinessFlow|array|Model|null
|
* @return array|Model|null
|
||||||
* @throws \think\db\exception\DataNotFoundException
|
* @throws \think\db\exception\DataNotFoundException
|
||||||
* @throws \think\db\exception\DbException
|
* @throws \think\db\exception\DbException
|
||||||
* @throws \think\db\exception\ModelNotFoundException
|
* @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);
|
$q->lock(true);
|
||||||
})->find();
|
})->find();
|
||||||
if (empty($Flow) || empty($Flow->account) || empty($Flow->business)) {
|
if (empty($Flow) || empty($Flow->account) || empty($Flow->business)) {
|
||||||
|
@ -171,4 +181,39 @@ class BusinessRepository extends Repository
|
||||||
return arrayKeysFilter($data, $fields);
|
return arrayKeysFilter($data, $fields);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查看指定商圈下的商家
|
||||||
|
* @param $businessCircleId
|
||||||
|
* @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();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 平台商下有多少商家
|
||||||
|
* @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");
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -14,5 +14,10 @@ trait CouponBillTrait
|
||||||
return CouponBill::where("user_code",$userCode)->sum("consumer_money");
|
return CouponBill::where("user_code",$userCode)->sum("consumer_money");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//商家 提供的总收益数
|
||||||
|
public function businessProfitTotal($businessCode)
|
||||||
|
{
|
||||||
|
return CouponBill::where("business_code",$businessCode)->sum("admin_money");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -3,6 +3,7 @@
|
||||||
namespace app\traits\cms;
|
namespace app\traits\cms;
|
||||||
|
|
||||||
use app\model\Menu;
|
use app\model\Menu;
|
||||||
|
use tauthz\facade\Enforcer;
|
||||||
use think\Collection;
|
use think\Collection;
|
||||||
|
|
||||||
trait MenuTrait
|
trait MenuTrait
|
||||||
|
@ -36,7 +37,9 @@ trait MenuTrait
|
||||||
$node[$childName] = $child;
|
$node[$childName] = $child;
|
||||||
$node['has_children'] = true;
|
$node['has_children'] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo 后续此处加上用户的权限判断
|
// todo 后续此处加上用户的权限判断
|
||||||
|
|
||||||
$treeList[] = $node;
|
$treeList[] = $node;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ layui.use(['laytpl', 'table', 'jquery', 'form', 'miniTab', 'xmSelect'], function
|
||||||
layer = layui.layer,
|
layer = layui.layer,
|
||||||
xmSelect = layui.xmSelect,
|
xmSelect = layui.xmSelect,
|
||||||
miniTab = layui.miniTab;
|
miniTab = layui.miniTab;
|
||||||
|
let modifyUrl = $('#row-modify').data('url');
|
||||||
|
|
||||||
/**** index begin ***/
|
/**** index begin ***/
|
||||||
//index页面
|
//index页面
|
||||||
|
@ -60,6 +61,18 @@ layui.use(['laytpl', 'table', 'jquery', 'form', 'miniTab', 'xmSelect'], function
|
||||||
return false;
|
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 **/
|
/** td edit **/
|
||||||
|
|
||||||
table.on('edit(table-container)', function (obj) {
|
table.on('edit(table-container)', function (obj) {
|
||||||
|
|
|
@ -32,17 +32,27 @@ layui.use(['laytpl', 'treeTable', 'jquery', 'iconPickerFa', 'form', 'miniTab', '
|
||||||
},
|
},
|
||||||
cols: [[
|
cols: [[
|
||||||
{type: 'checkbox'},
|
{type: 'checkbox'},
|
||||||
{field: 'title', title: '菜单名称', minWidth: 150, singleLine: true},
|
{field: 'name', title: '名称', minWidth: 150, singleLine: true},
|
||||||
{title: '图标', width: 50, templet: '<div><i class="fa {{ d.icon }}"></i></div>',align: 'center'},
|
{field: 'name', title: '状态'},
|
||||||
{field: 'name', title: '路由标识'},
|
{templet: '#row-status',field: 'status', minWidth: 180,align: 'center', title: '状态'},
|
||||||
|
|
||||||
{templet: '#menu-operate', minWidth: 250, fixed: 'right', align: 'center', title: '操作'}
|
|
||||||
]],
|
]],
|
||||||
done: function () {
|
done: function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
let modifyUrl = $('#row-modify').data('url');
|
||||||
|
|
||||||
|
//监听状态改变
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
//监听工具条 注意区别toolbar和tool toolbar是表头上的工具条 tool是行中的工具条
|
//监听工具条 注意区别toolbar和tool toolbar是表头上的工具条 tool是行中的工具条
|
||||||
treeTable.on('toolbar(menu-table)', function (obj) {
|
treeTable.on('toolbar(menu-table)', function (obj) {
|
||||||
|
|
|
@ -45,24 +45,9 @@ layui.use(['laytpl', 'table', 'jquery', 'form', 'miniTab', 'xmSelect',"laydate"]
|
||||||
page: true,
|
page: true,
|
||||||
cols: [[
|
cols: [[
|
||||||
{type: 'checkbox'},
|
{type: 'checkbox'},
|
||||||
{templet:function(d){
|
{field: "nick_name",title: '用户昵称'},
|
||||||
if( d.account != undefined &&d.account){
|
{field: "business_name", title: '商家名称'},
|
||||||
return d.account.nick_name
|
{field: "coupon_main_name", title: '优惠券名称'},
|
||||||
}
|
|
||||||
return '';
|
|
||||||
}, title: '用户昵称'},
|
|
||||||
{templet:function(d){
|
|
||||||
if( d.business != undefined &&d.business){
|
|
||||||
return d.business.business_name
|
|
||||||
}
|
|
||||||
return '';
|
|
||||||
}, title: '商家名称'},
|
|
||||||
{templet:function(d){
|
|
||||||
if( d.couponMain != undefined &&d.couponMain){
|
|
||||||
return d.couponMain.name
|
|
||||||
}
|
|
||||||
return '';
|
|
||||||
}, title: '优惠券名称'},
|
|
||||||
{templet:"#row-commission", title: '持有比例(渠道商:平台:消费者)'},
|
{templet:"#row-commission", title: '持有比例(渠道商:平台:消费者)'},
|
||||||
{field: 'money', minWidth: 200, title: '金额'},
|
{field: 'money', minWidth: 200, title: '金额'},
|
||||||
{field: 'create_time', minWidth: 200, title: '时间'},
|
{field: 'create_time', minWidth: 200, title: '时间'},
|
||||||
|
|
|
@ -49,6 +49,7 @@ layui.use(['laytpl', 'table', 'jquery', 'form', 'miniTab', 'xmSelect'], function
|
||||||
{field: 'coupon_receive_count', title: '已领取优惠券数量'},
|
{field: 'coupon_receive_count', title: '已领取优惠券数量'},
|
||||||
{field: 'coupon_be_overdue_count', title: '过期未使用优惠券数量'},
|
{field: 'coupon_be_overdue_count', title: '过期未使用优惠券数量'},
|
||||||
{field: 'coupon_used_count', title: '已使用优惠数量'},
|
{field: 'coupon_used_count', title: '已使用优惠数量'},
|
||||||
|
{field: 'coupon_profit_count', title: '为平台提供的总收益'},
|
||||||
|
|
||||||
{field: 'balance',title: '商家余额'},
|
{field: 'balance',title: '商家余额'},
|
||||||
{field: 'recharge_total_money', title: '充值总额'},
|
{field: 'recharge_total_money', title: '充值总额'},
|
||||||
|
|
|
@ -43,6 +43,13 @@ layui.use(['laytpl', 'table', 'jquery', 'form', 'miniTab', 'xmSelect'], function
|
||||||
{field: 'create_time', title: '扣费时间'},
|
{field: 'create_time', title: '扣费时间'},
|
||||||
{field: 'money', title: '扣费金额'},
|
{field: 'money', title: '扣费金额'},
|
||||||
{field: 'reason', title: '扣费原因'},
|
{field: 'reason', title: '扣费原因'},
|
||||||
|
{templet : '#row-other', title: '其他'},
|
||||||
|
{templet : function (d) {
|
||||||
|
if(d.couponMain!=undefined){
|
||||||
|
return d.couponMain.name;
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}, title: '优惠券名称'},
|
||||||
{field: 'balance' , title: '当前余额'},
|
{field: 'balance' , title: '当前余额'},
|
||||||
]],
|
]],
|
||||||
done: function () {
|
done: function () {
|
||||||
|
|
|
@ -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;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
|
@ -34,18 +34,6 @@
|
||||||
</div>
|
</div>
|
||||||
</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-form-item">
|
||||||
<div class="layui-input-block">
|
<div class="layui-input-block">
|
||||||
|
|
|
@ -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>
|
|
@ -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>
|
|
@ -28,17 +28,6 @@
|
||||||
</div>
|
</div>
|
||||||
</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-form-item">
|
||||||
|
|
|
@ -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>
|
|
@ -15,6 +15,15 @@
|
||||||
<a class="layui-btn layui-btn-danger layui-btn-xs" data-href="/manager/menu/status.html" lay-event="status">开启</a>
|
<a class="layui-btn layui-btn-danger layui-btn-xs" data-href="/manager/menu/status.html" lay-event="status">开启</a>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<!-- 编辑单元格提交url -->
|
||||||
|
<input type="hidden" id="row-modify" data-url="/manager/area/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>
|
||||||
|
|
||||||
<!-- toolbar -->
|
<!-- toolbar -->
|
||||||
<script type="text/html" id="toolbar-tpl">
|
<script type="text/html" id="toolbar-tpl">
|
||||||
<a class="layui-btn layui-btn-primary layui-btn-sm" data-table-refresh><i class="fa fa-refresh"></i></a>
|
<a class="layui-btn layui-btn-primary layui-btn-sm" data-table-refresh><i class="fa fa-refresh"></i></a>
|
||||||
|
|
|
@ -69,4 +69,9 @@
|
||||||
</div>
|
</div>
|
||||||
</script>
|
</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>
|
<script src="__MANAGER__/js/business/business_deduction_list.js?v={:mt_rand()}"></script>
|
|
@ -112,9 +112,16 @@
|
||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
<label class="layui-form-label required">审核状态</label>
|
<label class="layui-form-label required">审核状态</label>
|
||||||
<div class="layui-input-block">
|
<div class="layui-input-block">
|
||||||
<input type="radio" disabled {if $item['state']==0 } checked="checked" {/if} name="state" value="0" title="审核中" />
|
<input type="radio" {if $item['state']==0 } checked="checked" {/if} name="state" value="0" title="审核中" />
|
||||||
<input type="radio" disabled {if $item['state']==1 } checked="checked" {/if} name="state" value="1" title="审核通过" />
|
<input type="radio" {if $item['state']==1 } checked="checked" {/if} name="state" value="1" title="审核通过" />
|
||||||
<input type="radio" disabled {if $item['state']==2 } checked="checked" {/if} name="state" value="2" title="拒绝" />
|
<input type="radio" {if $item['state']==2 } checked="checked" {/if} name="state" value="2" title="拒绝" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label ">驳回原因</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<input type="text" name="reason" value="{$item.reason??''}" placeholder="请输入" class="layui-input">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -198,7 +205,6 @@
|
||||||
<script src="__STATIC__/js/iPicker/iPicker.min.js"></script>
|
<script src="__STATIC__/js/iPicker/iPicker.min.js"></script>
|
||||||
<script src="__STATIC__/common/jquery-3.4.1.min.js"></script>
|
<script src="__STATIC__/common/jquery-3.4.1.min.js"></script>
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
let province = $('#input-province').val();
|
let province = $('#input-province').val();
|
||||||
let city = $('#input-city').val();
|
let city = $('#input-city').val();
|
||||||
|
|
|
@ -13,6 +13,42 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- 地址 -->
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label required">地址</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<input type="hidden" id="input-province" name="province" value="{$item.province ?? 0}">
|
||||||
|
<input type="hidden" id="input-city" name="city" value="{$item.city ?? 0}">
|
||||||
|
<input type="hidden" id="input-county" name="county" value="{$item.county ?? 0}">
|
||||||
|
<input type="hidden" id="input-province-text" name="province_text" value="{$item.province_text ?? ''}">
|
||||||
|
<input type="hidden" id="input-city-text" name="city_text" value="{$item.city_text ?? ''}">
|
||||||
|
<input type="hidden" id="input-county-text" name="county_text" value="{$item.county_text ?? ''}">
|
||||||
|
<div id="target" style="z-index: 1111"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label required">详细地址</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<input type="text" name="business_address" lay-verify="required" value="{$item.business_address??''}" placeholder="请输入" class="layui-input">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 经纬度 -->
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label required">经纬度</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<div class="layui-input-inline">
|
||||||
|
<input type="number" name="lng" value="{$item.lng ?? ''}" id="longitude" placeholder="请填写经度" lay-reqtext="经度不能为空" lay-verify="required" autocomplete="off" class="layui-input">
|
||||||
|
</div>
|
||||||
|
<div class="layui-input-inline">
|
||||||
|
<input type="number" name="lat" value="{$item.lat ?? ''}" id="latitude" placeholder="请填写纬度" lay-reqtext="纬度不能为空" lay-verify="required" autocomplete="off" class="layui-input">
|
||||||
|
</div>
|
||||||
|
<div class="layui-input-inline"><button class="layui-btn-normal layui-btn" id="locationBtn">定位</button></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
<div class="layui-input-block">
|
<div class="layui-input-block">
|
||||||
<button class="layui-btn layui-btn-normal" data-url="/manager/business-circle/add" lay-submit lay-filter="saveBtn">确认保存</button>
|
<button class="layui-btn layui-btn-normal" data-url="/manager/business-circle/add" lay-submit lay-filter="saveBtn">确认保存</button>
|
||||||
|
@ -22,3 +58,109 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script src="__MANAGER__/js/business_circle.js?v={:mt_rand()}"></script>
|
<script src="__MANAGER__/js/business_circle.js?v={:mt_rand()}"></script>
|
||||||
|
|
||||||
|
<script src="__STATIC__/js/iPicker/iPicker.min.js"></script>
|
||||||
|
<script src="__STATIC__/common/jquery-3.4.1.min.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
let province = $('#input-province').val();
|
||||||
|
let city = $('#input-city').val();
|
||||||
|
let county = $('#input-county').val();
|
||||||
|
let _width = 200;
|
||||||
|
let _height = 34;
|
||||||
|
|
||||||
|
province = province ? province : '110000';
|
||||||
|
city = city ? city : '110100';
|
||||||
|
county = county ? county : '110101';
|
||||||
|
|
||||||
|
if ($('#target').length > 0) {
|
||||||
|
if ($('#target').data('width') != undefined) {
|
||||||
|
_width = $('#target').data('width');
|
||||||
|
}
|
||||||
|
if ($('#target').data('height') != undefined) {
|
||||||
|
_height = $('#target').data('height');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var picker =iPicker.create("#target", {
|
||||||
|
width: _width,
|
||||||
|
height: _height,
|
||||||
|
data: {
|
||||||
|
|
||||||
|
// 此处以通过 jquery 库获取本地数据源为例
|
||||||
|
//source: Promise.resolve($.getJSON("/static/js/iPicker/area.json"))
|
||||||
|
|
||||||
|
// 此处以通过 jquery 库获取数据为例
|
||||||
|
// 示例代码中使用的 "http://www.abcddcba.com/api/area" 是模拟地址,实际应用中替换成真实地址即可
|
||||||
|
// code 参数值就是相应地区对应的行政区划代码
|
||||||
|
// ----------------------------------------------------------------------------------------------------------
|
||||||
|
// 使用自定义数据源时,必须保证 source 属性值是 Function 类型
|
||||||
|
// iPicker 会自动执行此函数,同时要确保此函数的执行结果返回的是标准的 Promise 对象
|
||||||
|
// iPicker 会自动调用 then 方法,同时要确保 then 方法的参数就是返回的数据(Array 类型)
|
||||||
|
// ----------------------------------------------------------------------------------------------------------
|
||||||
|
// 初始状态下,iPicker 会自动执行一次 source 函数来获取 “省份” 数据,此时传入的 code 参数值为 null
|
||||||
|
// 因此,开发者可能需要给 code 参数设置一个默认值来获取 “省份” 数据(如示例代码中 code 为 null 时默认取零)
|
||||||
|
source: code => $.get( "/api/area/index.html?areaId=" + ( code || 86 ) )
|
||||||
|
|
||||||
|
},
|
||||||
|
onSelect: (code, name, all) => {
|
||||||
|
// 返回参数均为数组形式
|
||||||
|
// console.log( code );
|
||||||
|
// console.log( name );
|
||||||
|
// console.log( all );
|
||||||
|
let len = code.length;
|
||||||
|
if (len === 3) {
|
||||||
|
$('#input-province').val(code[0]);
|
||||||
|
$('#input-city').val(code[1]);
|
||||||
|
$('#input-county').val(code[2]);
|
||||||
|
$('#input-province-text').val(name[0]);
|
||||||
|
$('#input-city-text').val(name[1]);
|
||||||
|
$('#input-county-text').val(name[2]);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
selected: [province, city, county],
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
layui.use(['layer','form','jquery','location'],function(){
|
||||||
|
let $ = layui.jquery;
|
||||||
|
let form = layui.form;
|
||||||
|
let location = layui.location;
|
||||||
|
|
||||||
|
let lng = $('#longitude').val();
|
||||||
|
let lat = $('#latitude').val();
|
||||||
|
|
||||||
|
lng = lng.length > 0 ? lng : '116.404';
|
||||||
|
lat = lat.length > 0 ? lat : '39.915';
|
||||||
|
let locationData = {lng: lng,lat: lat};
|
||||||
|
|
||||||
|
location.render("#locationBtn",{
|
||||||
|
type: 1,
|
||||||
|
apiType: "gaodeMap",
|
||||||
|
coordinate: "gaodeMap",
|
||||||
|
mapType: 0,
|
||||||
|
zoom: 15,
|
||||||
|
title: '区域定位',
|
||||||
|
init: function(){
|
||||||
|
// 打开地图时 延迟一定时间搜索
|
||||||
|
$('body').on('click', '#locationBtn', function () {
|
||||||
|
let address = $("input[name='address']").val();
|
||||||
|
setTimeout(function () {
|
||||||
|
$('#ew-map-select-input-search').val(address).trigger('input');
|
||||||
|
}, 1500)
|
||||||
|
})
|
||||||
|
return {longitude: $("#longitude").val()?$("#longitude").val():locationData.lng,latitude: $("#latitude").val()?$("#latitude").val():locationData.lat};
|
||||||
|
},
|
||||||
|
success: function (data) {
|
||||||
|
$("#longitude").val(data.lng);
|
||||||
|
$("#latitude").val(data.lat);
|
||||||
|
},
|
||||||
|
onClickTip: function (data) {
|
||||||
|
console.log(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
|
@ -19,6 +19,43 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- 地址 -->
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label required">地址</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<input type="hidden" id="input-province" name="province" value="{$item.province ?? 0}">
|
||||||
|
<input type="hidden" id="input-city" name="city" value="{$item.city ?? 0}">
|
||||||
|
<input type="hidden" id="input-county" name="county" value="{$item.county ?? 0}">
|
||||||
|
<input type="hidden" id="input-province-text" name="province_text" value="{$item.province_text ?? ''}">
|
||||||
|
<input type="hidden" id="input-city-text" name="city_text" value="{$item.city_text ?? ''}">
|
||||||
|
<input type="hidden" id="input-county-text" name="county_text" value="{$item.county_text ?? ''}">
|
||||||
|
<div id="target" style="z-index: 1111"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label required">详细地址</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<input type="text" name="business_address" lay-verify="required" value="{$item.business_address??''}" placeholder="请输入" class="layui-input">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 经纬度 -->
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label required">经纬度</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<div class="layui-input-inline">
|
||||||
|
<input type="number" name="lng" value="{$item.lng ?? ''}" id="longitude" placeholder="请填写经度" lay-reqtext="经度不能为空" lay-verify="required" autocomplete="off" class="layui-input">
|
||||||
|
</div>
|
||||||
|
<div class="layui-input-inline">
|
||||||
|
<input type="number" name="lat" value="{$item.lat ?? ''}" id="latitude" placeholder="请填写纬度" lay-reqtext="纬度不能为空" lay-verify="required" autocomplete="off" class="layui-input">
|
||||||
|
</div>
|
||||||
|
<div class="layui-input-inline"><button class="layui-btn-normal layui-btn" id="locationBtn">定位</button></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
<div class="layui-input-block">
|
<div class="layui-input-block">
|
||||||
<button class="layui-btn layui-btn-normal" data-url="/manager/business-circle/edit?id={$item.id}" lay-submit lay-filter="saveBtn">确认保存</button>
|
<button class="layui-btn layui-btn-normal" data-url="/manager/business-circle/edit?id={$item.id}" lay-submit lay-filter="saveBtn">确认保存</button>
|
||||||
|
@ -28,3 +65,109 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script src="__MANAGER__/js/business_circle.js?v={:mt_rand()}"></script>
|
<script src="__MANAGER__/js/business_circle.js?v={:mt_rand()}"></script>
|
||||||
|
|
||||||
|
<script src="__STATIC__/js/iPicker/iPicker.min.js"></script>
|
||||||
|
<script src="__STATIC__/common/jquery-3.4.1.min.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
let province = $('#input-province').val();
|
||||||
|
let city = $('#input-city').val();
|
||||||
|
let county = $('#input-county').val();
|
||||||
|
let _width = 200;
|
||||||
|
let _height = 34;
|
||||||
|
|
||||||
|
province = province ? province : '110000';
|
||||||
|
city = city ? city : '110100';
|
||||||
|
county = county ? county : '110101';
|
||||||
|
|
||||||
|
if ($('#target').length > 0) {
|
||||||
|
if ($('#target').data('width') != undefined) {
|
||||||
|
_width = $('#target').data('width');
|
||||||
|
}
|
||||||
|
if ($('#target').data('height') != undefined) {
|
||||||
|
_height = $('#target').data('height');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var picker =iPicker.create("#target", {
|
||||||
|
width: _width,
|
||||||
|
height: _height,
|
||||||
|
data: {
|
||||||
|
|
||||||
|
// 此处以通过 jquery 库获取本地数据源为例
|
||||||
|
//source: Promise.resolve($.getJSON("/static/js/iPicker/area.json"))
|
||||||
|
|
||||||
|
// 此处以通过 jquery 库获取数据为例
|
||||||
|
// 示例代码中使用的 "http://www.abcddcba.com/api/area" 是模拟地址,实际应用中替换成真实地址即可
|
||||||
|
// code 参数值就是相应地区对应的行政区划代码
|
||||||
|
// ----------------------------------------------------------------------------------------------------------
|
||||||
|
// 使用自定义数据源时,必须保证 source 属性值是 Function 类型
|
||||||
|
// iPicker 会自动执行此函数,同时要确保此函数的执行结果返回的是标准的 Promise 对象
|
||||||
|
// iPicker 会自动调用 then 方法,同时要确保 then 方法的参数就是返回的数据(Array 类型)
|
||||||
|
// ----------------------------------------------------------------------------------------------------------
|
||||||
|
// 初始状态下,iPicker 会自动执行一次 source 函数来获取 “省份” 数据,此时传入的 code 参数值为 null
|
||||||
|
// 因此,开发者可能需要给 code 参数设置一个默认值来获取 “省份” 数据(如示例代码中 code 为 null 时默认取零)
|
||||||
|
source: code => $.get( "/api/area/index.html?areaId=" + ( code || 86 ) )
|
||||||
|
|
||||||
|
},
|
||||||
|
onSelect: (code, name, all) => {
|
||||||
|
// 返回参数均为数组形式
|
||||||
|
// console.log( code );
|
||||||
|
// console.log( name );
|
||||||
|
// console.log( all );
|
||||||
|
let len = code.length;
|
||||||
|
if (len === 3) {
|
||||||
|
$('#input-province').val(code[0]);
|
||||||
|
$('#input-city').val(code[1]);
|
||||||
|
$('#input-county').val(code[2]);
|
||||||
|
$('#input-province-text').val(name[0]);
|
||||||
|
$('#input-city-text').val(name[1]);
|
||||||
|
$('#input-county-text').val(name[2]);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
selected: [province, city, county],
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
layui.use(['layer','form','jquery','location'],function(){
|
||||||
|
let $ = layui.jquery;
|
||||||
|
let form = layui.form;
|
||||||
|
let location = layui.location;
|
||||||
|
|
||||||
|
let lng = $('#longitude').val();
|
||||||
|
let lat = $('#latitude').val();
|
||||||
|
|
||||||
|
lng = lng.length > 0 ? lng : '116.404';
|
||||||
|
lat = lat.length > 0 ? lat : '39.915';
|
||||||
|
let locationData = {lng: lng,lat: lat};
|
||||||
|
|
||||||
|
location.render("#locationBtn",{
|
||||||
|
type: 1,
|
||||||
|
apiType: "gaodeMap",
|
||||||
|
coordinate: "gaodeMap",
|
||||||
|
mapType: 0,
|
||||||
|
zoom: 15,
|
||||||
|
title: '区域定位',
|
||||||
|
init: function(){
|
||||||
|
// 打开地图时 延迟一定时间搜索
|
||||||
|
$('body').on('click', '#locationBtn', function () {
|
||||||
|
let address = $("input[name='address']").val();
|
||||||
|
setTimeout(function () {
|
||||||
|
$('#ew-map-select-input-search').val(address).trigger('input');
|
||||||
|
}, 1500)
|
||||||
|
})
|
||||||
|
return {longitude: $("#longitude").val()?$("#longitude").val():locationData.lng,latitude: $("#latitude").val()?$("#latitude").val():locationData.lat};
|
||||||
|
},
|
||||||
|
success: function (data) {
|
||||||
|
$("#longitude").val(data.lng);
|
||||||
|
$("#latitude").val(data.lat);
|
||||||
|
},
|
||||||
|
onClickTip: function (data) {
|
||||||
|
console.log(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
|
@ -31,15 +31,6 @@
|
||||||
<div class="layui-inline">
|
<div class="layui-inline">
|
||||||
<input type="text" name="keyword" class="layui-input">
|
<input type="text" name="keyword" class="layui-input">
|
||||||
</div>
|
</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">
|
<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>
|
<button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索</button>
|
||||||
|
|
|
@ -34,19 +34,6 @@
|
||||||
</div>
|
</div>
|
||||||
</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">
|
<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>
|
<button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -129,6 +129,14 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label required">排序</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<input type="number" lay-verify="required|number" value="{$item['sort']}" name="item[sort]" lay-reqtext="必须>0,不能为空" placeholder="请输入" class="layui-input">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<fieldset class="layui-elem-field layui-field-title site-title">
|
<fieldset class="layui-elem-field layui-field-title site-title">
|
||||||
<legend><a name="compatibility">请填写完整整数 总和为100</a></legend>
|
<legend><a name="compatibility">请填写完整整数 总和为100</a></legend>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
<label class="layui-form-label">关联商家</label>
|
<label class="layui-form-label">关联商家</label>
|
||||||
<div class="layui-input-block">
|
<div class="layui-input-block">
|
||||||
<select name="business_code" lay-search="" >
|
<select name="business_code" lay-search="" >
|
||||||
<option value=""></option>
|
<option value="_">不绑定</option>
|
||||||
{foreach $business as $bitem}
|
{foreach $business as $bitem}
|
||||||
<option value="{$bitem['code']}" {if $bitem['code']==$item['business_code']} selected {/if} >{$bitem['contact_name']}_{$bitem['business_name']}</option>
|
<option value="{$bitem['code']}" {if $bitem['code']==$item['business_code']} selected {/if} >{$bitem['contact_name']}_{$bitem['business_name']}</option>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
|
|
Loading…
Reference in New Issue