增加加盟商

This commit is contained in:
karl 2024-07-31 16:45:54 +08:00
parent dbea950f04
commit 0a5e16bd39
45 changed files with 82 additions and 12 deletions

View File

@ -200,7 +200,7 @@ export const asyncRoutes = [
meta: { meta: {
title: 'QA管理', title: 'QA管理',
icon: 'el-icon-question', icon: 'el-icon-question',
roles: ['order_index', 'editor'] roles: ['order_index', 'editor', 'franchisee']
}, },
children: [ children: [
{ {
@ -209,7 +209,7 @@ export const asyncRoutes = [
name: 'problem', name: 'problem',
meta: { meta: {
title: 'QA常见问题', title: 'QA常见问题',
roles: ['order_pub', 'editor'] roles: ['order_pub', 'editor', 'franchisee']
} }
}, },
{ {
@ -299,7 +299,7 @@ export const asyncRoutes = [
meta: { meta: {
title: '日志记录', title: '日志记录',
icon: 'nested', icon: 'nested',
roles: ['follow_index', 'log_index', 'editor'] roles: ['follow_index', 'log_index', 'editor', 'franchisee']
}, },
children: [ children: [
{ {
@ -308,7 +308,7 @@ export const asyncRoutes = [
name: 'Follow', name: 'Follow',
meta: { meta: {
title: '跟进记录', title: '跟进记录',
roles: ['follow_index', 'editor'] roles: ['follow_index', 'editor', 'franchisee']
} }
}, },
{ {
@ -331,7 +331,7 @@ export const asyncRoutes = [
meta: { meta: {
title: '公告管理', title: '公告管理',
icon: 'el-icon-s-promotion', icon: 'el-icon-s-promotion',
roles: ['follow_index', 'log_index', 'editor'] roles: ['admin']
}, },
children: [ children: [
{ {
@ -340,7 +340,7 @@ export const asyncRoutes = [
name: 'list', name: 'list',
meta: { meta: {
title: '公告列表', title: '公告列表',
roles: ['follow_index', 'editor'] roles: ['admin']
} }
} }
] ]

View File

@ -109,6 +109,21 @@
> >
</el-switch> </el-switch>
</el-form-item> </el-form-item>
<el-form-item label="是否加盟商">
<el-switch
v-model="item.is_franchisee"
active-text="加盟商"
:active-value="1"
inactive-text=""
:inactive-value="0"
>
</el-switch>
</el-form-item>
<el-form-item label="产品ID">
<el-input v-model="item.product_ids" type="textarea" />
<el-label style="color: red;font-size: 11px;">多个用英文逗号隔开例如: 384731,2328</el-label>
</el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="onSave(item)"> </el-button> <el-button type="primary" @click="onSave(item)"> </el-button>

View File

@ -38,7 +38,8 @@ module.exports = {
}, },
proxy: { proxy: {
'/dev-api': { // 接口地址 以 api开头的都走下面的配置 '/dev-api': { // 接口地址 以 api开头的都走下面的配置
target: 'https://www.szjinao.cn', // 代理目标地址为后端服务器地址 127.0.0.1 192.168.1.2 // target: 'https://www.szjinao.cn', // 代理目标地址为后端服务器地址 127.0.0.1 192.168.1.2
target: 'http://0.0.0.0:8787', // 代理目标地址为后端服务器地址 127.0.0.1 192.168.1.2
ws: true, // 是否支持 websocket 请求 支持 ws: true, // 是否支持 websocket 请求 支持
changeOrigin: true, // 是否启用跨域 changeOrigin: true, // 是否启用跨域
pathRewrite: { pathRewrite: {

View File

@ -62,6 +62,8 @@ class AdminController extends base
$password = $request->post('password'); $password = $request->post('password');
$is_order = $request->post('is_order',0); $is_order = $request->post('is_order',0);
$is_anchor = $request->post('is_anchor',0); $is_anchor = $request->post('is_anchor',0);
$is_franchisee = $request->post('is_franchisee',0);
$product_ids = $request->post('product_ids','');
if($id) { if($id) {
$item = (new Admins())->find($id); $item = (new Admins())->find($id);
@ -99,6 +101,8 @@ class AdminController extends base
$item->mobile = $mobile; $item->mobile = $mobile;
$item->is_order = $is_order; $item->is_order = $is_order;
$item->is_anchor = $is_anchor; $item->is_anchor = $is_anchor;
$item->is_franchisee = $is_franchisee;
$item->product_ids = $product_ids;
$back = $item->save(); $back = $item->save();
if($back) if($back)
return $this->success($item->hidden(['password','remember_token'])); return $this->success($item->hidden(['password','remember_token']));

View File

@ -4,6 +4,7 @@ namespace app\admin\controller;
use app\model\Admins; use app\model\Admins;
use app\model\Follows; use app\model\Follows;
use app\model\Orders; use app\model\Orders;
use support\Log;
use support\Request; use support\Request;
class FollowController extends base class FollowController extends base
@ -14,6 +15,11 @@ class FollowController extends base
$self = $request->get('self'); $self = $request->get('self');
$times = $request->get('times'); $times = $request->get('times');
$adminInfo = Admins::where('id', $request->admin->id)->find();
if ($adminInfo->is_franchisee) {
return $this->franchiseeList($request, $adminInfo);
}
$query = Follows::with(['admin','orders'])->order('id', 'desc'); $query = Follows::with(['admin','orders'])->order('id', 'desc');
if($request->admin->is_super == 0 || $self) { if($request->admin->is_super == 0 || $self) {
@ -38,4 +44,40 @@ class FollowController extends base
return $this->success($list->append(['status_name'])); return $this->success($list->append(['status_name']));
} }
public function franchiseeList($request, $adminInfo)
{
$admin = $request->get('admin');
$sn = $request->get('sn');
$times = $request->get('times');
$thirdProductId = explode(',', $adminInfo->product_ids);
if (count($thirdProductId) <= 0) {
return $this->success([]);
}
$query = Follows::with(['admin','orders'])
->join('orders', 'orders.id = follows.order_id')
->order('follows.id', 'desc')
->field('follows.*')
->whereIn('product_id', $thirdProductId);
if(!empty($admin)) {
$admin_id = Admins::where('username', $admin)->value('id');
$query->where('follows.admin_id', $admin_id ?? 0);
}
if(!empty($sn)) {
$order_id = Orders::where('sn', $sn)->value('id');
$query->where('follows.order_id', $order_id ?? 0);
}
if(!empty($times) && count($times)) {
$query->whereBetween('follows.create_time', [strtotime($times[0]),strtotime($times[1])]);
}
$list = $query->paginate($request->get('limit', 30));
return $this->success($list->append(['status_name']));
}
} }

View File

@ -219,11 +219,19 @@ class IndexController extends base
public function Info(Request $request) public function Info(Request $request)
{ {
$info = Admins::where('id', $request->admin->id)->find(); $info = Admins::where('id', $request->admin->id)->find();
$roles = ['editor'];
if ($info->is_super) {
$roles = ['admin'];
}
if ($info->is_franchisee) {
$roles = ['franchisee'];
}
return $this->success([ return $this->success([
'roles' => [$info->is_super ? 'admin' : 'editor'], 'roles' => $roles,
'avatar' => $info->avatar ?? '/avatar.webp', 'avatar' => $info->avatar ?? '/avatar.webp',
'name' => $info->name, 'name' => $info->name,
'is_anchor' => $info->is_anchor ? 1 : 0, 'is_anchor' => $info->is_anchor ? 1 : 0,

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long