代理商改名成机构
This commit is contained in:
parent
86d1e1e18d
commit
4e55c38092
@ -35,11 +35,11 @@ class AgentController extends Controller
|
|||||||
|
|
||||||
$agents->load(['company:id,name']);
|
$agents->load(['company:id,name']);
|
||||||
|
|
||||||
return res($agents, '代理商列表', 201);
|
return res($agents, '机构列表', 201);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 代理商详情.
|
* 机构详情.
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\Response
|
* @return \Illuminate\Http\Response
|
||||||
*/
|
*/
|
||||||
@ -48,12 +48,12 @@ class AgentController extends Controller
|
|||||||
$node = app(AgentRepository::class)->find($id);
|
$node = app(AgentRepository::class)->find($id);
|
||||||
|
|
||||||
if (!$node) {
|
if (!$node) {
|
||||||
throw new NotExistException('代理商不存在或已删除');
|
throw new NotExistException('机构不存在或已删除');
|
||||||
}
|
}
|
||||||
|
|
||||||
$node->load(['company:id,name']);
|
$node->load(['company:id,name']);
|
||||||
|
|
||||||
return res($node, '代理商详情', 201);
|
return res($node, '机构详情', 201);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,14 +44,14 @@ class PropertyController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 代理商配置.
|
* 机构配置.
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\Response
|
* @return \Illuminate\Http\Response
|
||||||
*/
|
*/
|
||||||
public function agents()
|
public function agents()
|
||||||
{
|
{
|
||||||
$res = app(AgentService::class)->listGroupByCompanyId();
|
$res = app(AgentService::class)->listGroupByCompanyId();
|
||||||
return res($res, '代理商配置', 201);
|
return res($res, '机构配置', 201);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -36,7 +36,7 @@ $router->group(['prefix' => 'virtual', 'as' => 'virtual', 'middleware' => ['admi
|
|||||||
// $router->post('/company/addresses/update/{id}', ['as' => 'company.addresses.update', 'uses' => 'CompanyAddressController@update']);
|
// $router->post('/company/addresses/update/{id}', ['as' => 'company.addresses.update', 'uses' => 'CompanyAddressController@update']);
|
||||||
// $router->post('/company/addresses/destroy', ['as' => 'company.addresses.destroy', 'uses' => 'CompanyAddressController@destroy']);
|
// $router->post('/company/addresses/destroy', ['as' => 'company.addresses.destroy', 'uses' => 'CompanyAddressController@destroy']);
|
||||||
|
|
||||||
// 代理商管理
|
// 机构管理
|
||||||
$router->get('/agents/index', ['as' => 'agents.index', 'uses' => 'AgentController@index']);
|
$router->get('/agents/index', ['as' => 'agents.index', 'uses' => 'AgentController@index']);
|
||||||
$router->get('/agents/show/{id}', ['as' => 'agents.show', 'uses' => 'AgentController@show']);
|
$router->get('/agents/show/{id}', ['as' => 'agents.show', 'uses' => 'AgentController@show']);
|
||||||
$router->post('/agents/create', ['as' => 'agents.create', 'uses' => 'AgentController@create']);
|
$router->post('/agents/create', ['as' => 'agents.create', 'uses' => 'AgentController@create']);
|
||||||
|
@ -28,7 +28,7 @@ class AgentService extends Service
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 代理商列表
|
* 机构列表
|
||||||
*
|
*
|
||||||
* @param array $conditions
|
* @param array $conditions
|
||||||
* @return mixed
|
* @return mixed
|
||||||
@ -50,7 +50,7 @@ class AgentService extends Service
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 存储代理商
|
* 存储机构
|
||||||
*
|
*
|
||||||
* @param array $attributes
|
* @param array $attributes
|
||||||
* @param Agent $parent
|
* @param Agent $parent
|
||||||
@ -72,9 +72,9 @@ class AgentService extends Service
|
|||||||
$message = [
|
$message = [
|
||||||
'company_id.required' => '请输入企业ID',
|
'company_id.required' => '请输入企业ID',
|
||||||
'company_id.exists' => '企业不存在或已删除',
|
'company_id.exists' => '企业不存在或已删除',
|
||||||
'name.required' => '请输入代理商名称',
|
'name.required' => '请输入机构名称',
|
||||||
'name.between' => '代理商名称长度不合法',
|
'name.between' => '机构名称长度不合法',
|
||||||
'name.unique' => '代理商名称已经被其他用户所使用',
|
'name.unique' => '机构名称已经被其他用户所使用',
|
||||||
'contacts.between' => '联系人长度不合法',
|
'contacts.between' => '联系人长度不合法',
|
||||||
'mobile.cn_phone' => '手机号不合法',
|
'mobile.cn_phone' => '手机号不合法',
|
||||||
];
|
];
|
||||||
@ -96,7 +96,7 @@ class AgentService extends Service
|
|||||||
$node = $this->agentServiceRepository->find($attributes['id']);
|
$node = $this->agentServiceRepository->find($attributes['id']);
|
||||||
|
|
||||||
if (!$node) {
|
if (!$node) {
|
||||||
throw new NotExistException('代理商不存在或已删除');
|
throw new NotExistException('机构不存在或已删除');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->agentServiceRepository->setModel($node)->update($attributes);
|
$this->agentServiceRepository->setModel($node)->update($attributes);
|
||||||
|
@ -31,7 +31,7 @@ class PropertyService extends Service
|
|||||||
'product' => '产品类型',
|
'product' => '产品类型',
|
||||||
'package_type' => '套餐类型',
|
'package_type' => '套餐类型',
|
||||||
'province' => '省份设置',
|
'province' => '省份设置',
|
||||||
'agent' => '代理商设置',
|
'agent' => '机构设置',
|
||||||
];
|
];
|
||||||
|
|
||||||
public static $default = [
|
public static $default = [
|
||||||
@ -314,22 +314,22 @@ class PropertyService extends Service
|
|||||||
$index = [];
|
$index = [];
|
||||||
foreach ($value['agent'] as $agent) {
|
foreach ($value['agent'] as $agent) {
|
||||||
if (in_array($agent['company_id'] . '_' . $agent['platform'], $index)) {
|
if (in_array($agent['company_id'] . '_' . $agent['platform'], $index)) {
|
||||||
throw new InvalidArgumentException('代理商平台重复配置');
|
throw new InvalidArgumentException('机构平台重复配置');
|
||||||
} else {
|
} else {
|
||||||
array_push($index, $agent['company_id'] . '_' . $agent['platform']);
|
array_push($index, $agent['company_id'] . '_' . $agent['platform']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!in_array($agent['agent'], array_pluck($itemAgents, 'id'))) {
|
if (!in_array($agent['agent'], array_pluck($itemAgents, 'id'))) {
|
||||||
throw new InvalidArgumentException('代理商配置不正确');
|
throw new InvalidArgumentException('机构配置不正确');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!in_array($agent['platform'], array_keys($settings['platform']))) {
|
if (!in_array($agent['platform'], array_keys($settings['platform']))) {
|
||||||
throw new InvalidArgumentException('代理商平台配置不正确');
|
throw new InvalidArgumentException('机构平台配置不正确');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (array_sum(array_pluck($value['agent'], 'percentages')) != 0 && sprintf("%.2f", array_sum(array_pluck($value['agent'], 'percentages'))) != 100) {
|
if (array_sum(array_pluck($value['agent'], 'percentages')) != 0 && sprintf("%.2f", array_sum(array_pluck($value['agent'], 'percentages'))) != 100) {
|
||||||
throw new InvalidArgumentException('代理商百分比配置不正确');
|
throw new InvalidArgumentException('机构百分比配置不正确');
|
||||||
}
|
}
|
||||||
|
|
||||||
$value['agent'] = json_encode($value['agent'], 256);
|
$value['agent'] = json_encode($value['agent'], 256);
|
||||||
|
@ -7,10 +7,10 @@ use App\Models\CompanyBase;
|
|||||||
/**
|
/**
|
||||||
* App\Models\Virtual\Agent
|
* App\Models\Virtual\Agent
|
||||||
*
|
*
|
||||||
* @property int $id 代理商ID
|
* @property int $id 机构ID
|
||||||
* @property int $company_id 企业ID
|
* @property int $company_id 企业ID
|
||||||
* @property string $sn 代理商编号
|
* @property string $sn 机构编号
|
||||||
* @property string $name 代理商名称
|
* @property string $name 机构名称
|
||||||
* @property string $contacts 联系人
|
* @property string $contacts 联系人
|
||||||
* @property string $mobile 手机号
|
* @property string $mobile 手机号
|
||||||
* @property string $address 地址
|
* @property string $address 地址
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
/**
|
/**
|
||||||
* 代理商管理
|
* 机构管理
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [index 代理商列表]
|
* [index 机构列表]
|
||||||
* @param {[type]} data [description]
|
* @param {[type]} data [description]
|
||||||
* @return {[type]} [description]
|
* @return {[type]} [description]
|
||||||
*/
|
*/
|
||||||
@ -14,7 +14,7 @@ export function index(data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [show 代理商详情]
|
* [show 机构详情]
|
||||||
* @param {[type]} id [description]
|
* @param {[type]} id [description]
|
||||||
* @return {[type]} [description]
|
* @return {[type]} [description]
|
||||||
*/
|
*/
|
||||||
@ -23,7 +23,7 @@ export function show(id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [create 创建代理商]
|
* [create 创建机构]
|
||||||
* @param {[type]} data [description]
|
* @param {[type]} data [description]
|
||||||
* @return {[type]} [description]
|
* @return {[type]} [description]
|
||||||
*/
|
*/
|
||||||
@ -32,7 +32,7 @@ export function create(data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [update 修改代理商]
|
* [update 修改机构]
|
||||||
* @param {[type]} data [description]
|
* @param {[type]} data [description]
|
||||||
* @param {[type]} id [角色id]
|
* @param {[type]} id [角色id]
|
||||||
* @return {[type]} [description]
|
* @return {[type]} [description]
|
||||||
@ -42,7 +42,7 @@ export function update(data, id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [destroy 删除代理商]
|
* [destroy 删除机构]
|
||||||
* @param {[type]} data [description]
|
* @param {[type]} data [description]
|
||||||
* @return {[type]} [description]
|
* @return {[type]} [description]
|
||||||
*/
|
*/
|
||||||
|
@ -14,7 +14,7 @@ export function settings(data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [agents 代理商设置]
|
* [agents 机构设置]
|
||||||
* @param {[type]} data [description]
|
* @param {[type]} data [description]
|
||||||
* @return {[type]} [description]
|
* @return {[type]} [description]
|
||||||
*/
|
*/
|
||||||
|
@ -19,7 +19,7 @@ const routes = [
|
|||||||
{ path: '/iframe', name: 'Iframe', component: load('iframe/index'), meta: { title: 'iframe' } },
|
{ path: '/iframe', name: 'Iframe', component: load('iframe/index'), meta: { title: 'iframe' } },
|
||||||
{ path: '/companies', name: 'Companies', component: load('virtual/companies/index'), meta: { title: '企业管理' } },
|
{ path: '/companies', name: 'Companies', component: load('virtual/companies/index'), meta: { title: '企业管理' } },
|
||||||
{ path: '/company/accounts', name: 'CompanyAccounts', component: load('virtual/company_accounts/index'), meta: { title: '账号管理' } },
|
{ path: '/company/accounts', name: 'CompanyAccounts', component: load('virtual/company_accounts/index'), meta: { title: '账号管理' } },
|
||||||
{ path: '/agents', name: 'Agents', component: load('virtual/agents/index'), meta: { title: '代理商管理' } },
|
{ path: '/agents', name: 'Agents', component: load('virtual/agents/index'), meta: { title: '机构管理' } },
|
||||||
{ path: '/packages/:type', name: 'Packages', component: load('virtual/packages/index'), meta: { title: '套餐管理' } },
|
{ path: '/packages/:type', name: 'Packages', component: load('virtual/packages/index'), meta: { title: '套餐管理' } },
|
||||||
{ path: '/products/:type', name: 'Products', component: load('virtual/products/index'), meta: { title: '定价管理' } },
|
{ path: '/products/:type', name: 'Products', component: load('virtual/products/index'), meta: { title: '定价管理' } },
|
||||||
{ path: '/properties', name: 'Properties', component: load('virtual/properties/index'), meta: { title: '属性管理' } },
|
{ path: '/properties', name: 'Properties', component: load('virtual/properties/index'), meta: { title: '属性管理' } },
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
:footer-hide="true"
|
:footer-hide="true"
|
||||||
:mask-closable="false"
|
:mask-closable="false"
|
||||||
@on-visible-change="visibleChange"
|
@on-visible-change="visibleChange"
|
||||||
title="代理商详情"
|
title="机构详情"
|
||||||
v-model="my_show"
|
v-model="my_show"
|
||||||
width="900"
|
width="900"
|
||||||
>
|
>
|
||||||
@ -13,7 +13,7 @@
|
|||||||
<Divider>基础信息</Divider>
|
<Divider>基础信息</Divider>
|
||||||
<ul>
|
<ul>
|
||||||
<li class="ui-list">
|
<li class="ui-list">
|
||||||
<div class="ui-list-title">代理商编号:</div>
|
<div class="ui-list-title">机构编号:</div>
|
||||||
<div class="ui-list-content">{{data.id}}</div>
|
<div class="ui-list-content">{{data.id}}</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
@ -23,7 +23,7 @@
|
|||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li class="ui-list">
|
<li class="ui-list">
|
||||||
<div class="ui-list-title">代理商名称:</div>
|
<div class="ui-list-title">机构名称:</div>
|
||||||
<div class="ui-list-content">{{data.name}}</div>
|
<div class="ui-list-content">{{data.name}}</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<Modal
|
<Modal
|
||||||
:closable="false"
|
:closable="false"
|
||||||
:mask-closable="false"
|
:mask-closable="false"
|
||||||
:title="data?'编辑代理商':'添加代理商'"
|
:title="data?'编辑机构':'添加机构'"
|
||||||
@on-visible-change="visibleChange"
|
@on-visible-change="visibleChange"
|
||||||
v-model="my_show"
|
v-model="my_show"
|
||||||
>
|
>
|
||||||
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
<li class="ui-list">
|
<li class="ui-list">
|
||||||
<div class="ui-list-title">
|
<div class="ui-list-title">
|
||||||
<span class="title-require">*</span>代理商名称:
|
<span class="title-require">*</span>机构名称:
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-list-content">
|
<div class="ui-list-content">
|
||||||
<p>
|
<p>
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
icon="md-add"
|
icon="md-add"
|
||||||
type="primary"
|
type="primary"
|
||||||
v-if="hasPermission('create')"
|
v-if="hasPermission('create')"
|
||||||
>添加代理商</Button>
|
>添加机构</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="handle-item">
|
<div class="handle-item">
|
||||||
@ -35,7 +35,7 @@
|
|||||||
<AutoComplete
|
<AutoComplete
|
||||||
@on-search="handleCompleteCompanies"
|
@on-search="handleCompleteCompanies"
|
||||||
icon="ios-search"
|
icon="ios-search"
|
||||||
placeholder="请输入代理商名称"
|
placeholder="请输入机构名称"
|
||||||
v-model.trim="params.name"
|
v-model.trim="params.name"
|
||||||
>
|
>
|
||||||
<Option
|
<Option
|
||||||
|
@ -62,12 +62,12 @@ export default {
|
|||||||
},
|
},
|
||||||
ok() {
|
ok() {
|
||||||
if (!this.params.company_id) {
|
if (!this.params.company_id) {
|
||||||
this.$Message.info('请选择代理商');
|
this.$Message.info('请选择机构');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.params.name) {
|
if (!this.params.name) {
|
||||||
this.$Message.info('请填写代理商名称');
|
this.$Message.info('请填写机构名称');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ export default {
|
|||||||
width: 80
|
width: 80
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "代理商名称",
|
title: "机构名称",
|
||||||
key: "name",
|
key: "name",
|
||||||
width: 300
|
width: 300
|
||||||
},
|
},
|
||||||
@ -92,7 +92,7 @@ export default {
|
|||||||
return h(
|
return h(
|
||||||
"Tag",
|
"Tag",
|
||||||
{ props: { color: "default" } },
|
{ props: { color: "default" } },
|
||||||
"该代理商已被删除"
|
"该机构已被删除"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,7 +161,7 @@ export default {
|
|||||||
click: () => {
|
click: () => {
|
||||||
this.$Modal.confirm({
|
this.$Modal.confirm({
|
||||||
title: "提示",
|
title: "提示",
|
||||||
content: "删除后该代理商不可使用,请谨慎操作",
|
content: "删除后该机构不可使用,请谨慎操作",
|
||||||
onOk: () => {
|
onOk: () => {
|
||||||
API.destroy({
|
API.destroy({
|
||||||
ids: row.id
|
ids: row.id
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<Drawer
|
<Drawer
|
||||||
:mask-closable="false"
|
:mask-closable="false"
|
||||||
@on-visible-change="visibleChange"
|
@on-visible-change="visibleChange"
|
||||||
title="代理商设置"
|
title="机构设置"
|
||||||
v-model="my_show"
|
v-model="my_show"
|
||||||
width="900"
|
width="900"
|
||||||
>
|
>
|
||||||
|
@ -36,7 +36,7 @@ export default {
|
|||||||
dataAgent: [],
|
dataAgent: [],
|
||||||
columns: [
|
columns: [
|
||||||
{
|
{
|
||||||
title: '代理商',
|
title: '机构',
|
||||||
key: 'agent',
|
key: 'agent',
|
||||||
minWidth: 180,
|
minWidth: 180,
|
||||||
render: (h, context) => {
|
render: (h, context) => {
|
||||||
@ -172,7 +172,7 @@ export default {
|
|||||||
const element = this.dataAgent[key];
|
const element = this.dataAgent[key];
|
||||||
|
|
||||||
if (element.agent === undefined) {
|
if (element.agent === undefined) {
|
||||||
return this.$Message.error('请选择代理商');
|
return this.$Message.error('请选择机构');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (element.platform === undefined) {
|
if (element.platform === undefined) {
|
||||||
@ -208,7 +208,7 @@ export default {
|
|||||||
},
|
},
|
||||||
add() {
|
add() {
|
||||||
if (!this.agents.length) {
|
if (!this.agents.length) {
|
||||||
return this.$Message.error('请先添加代理商');
|
return this.$Message.error('请先添加机构');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.platforms.length) {
|
if (!this.platforms.length) {
|
||||||
|
@ -174,7 +174,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '代理商',
|
title: '机构',
|
||||||
key: 'action',
|
key: 'action',
|
||||||
width: 150,
|
width: 150,
|
||||||
render: (h, {
|
render: (h, {
|
||||||
@ -201,7 +201,7 @@ export default {
|
|||||||
|
|
||||||
html.push(h('Tooltip', {
|
html.push(h('Tooltip', {
|
||||||
props: {
|
props: {
|
||||||
content: row.agent ? '已设置' : '代理商未设置'
|
content: row.agent ? '已设置' : '机构未设置'
|
||||||
}
|
}
|
||||||
}, [button]));
|
}, [button]));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user