代理商改名成机构

This commit is contained in:
邓皓元 2020-03-25 17:54:56 +08:00
parent 86d1e1e18d
commit 4e55c38092
17 changed files with 47 additions and 47 deletions

View File

@ -35,11 +35,11 @@ class AgentController extends Controller
$agents->load(['company:id,name']);
return res($agents, '代理商列表', 201);
return res($agents, '机构列表', 201);
}
/**
* 代理商详情.
* 机构详情.
*
* @return \Illuminate\Http\Response
*/
@ -48,12 +48,12 @@ class AgentController extends Controller
$node = app(AgentRepository::class)->find($id);
if (!$node) {
throw new NotExistException('代理商不存在或已删除');
throw new NotExistException('机构不存在或已删除');
}
$node->load(['company:id,name']);
return res($node, '代理商详情', 201);
return res($node, '机构详情', 201);
}

View File

@ -44,14 +44,14 @@ class PropertyController extends Controller
}
/**
* 代理商配置.
* 机构配置.
*
* @return \Illuminate\Http\Response
*/
public function agents()
{
$res = app(AgentService::class)->listGroupByCompanyId();
return res($res, '代理商配置', 201);
return res($res, '机构配置', 201);
}
/**

View File

@ -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/destroy', ['as' => 'company.addresses.destroy', 'uses' => 'CompanyAddressController@destroy']);
// 代理商管理
// 机构管理
$router->get('/agents/index', ['as' => 'agents.index', 'uses' => 'AgentController@index']);
$router->get('/agents/show/{id}', ['as' => 'agents.show', 'uses' => 'AgentController@show']);
$router->post('/agents/create', ['as' => 'agents.create', 'uses' => 'AgentController@create']);

View File

@ -28,7 +28,7 @@ class AgentService extends Service
}
/**
* 代理商列表
* 机构列表
*
* @param array $conditions
* @return mixed
@ -50,7 +50,7 @@ class AgentService extends Service
}
/**
* 存储代理商
* 存储机构
*
* @param array $attributes
* @param Agent $parent
@ -72,9 +72,9 @@ class AgentService extends Service
$message = [
'company_id.required' => '请输入企业ID',
'company_id.exists' => '企业不存在或已删除',
'name.required' => '请输入代理商名称',
'name.between' => '代理商名称长度不合法',
'name.unique' => '代理商名称已经被其他用户所使用',
'name.required' => '请输入机构名称',
'name.between' => '机构名称长度不合法',
'name.unique' => '机构名称已经被其他用户所使用',
'contacts.between' => '联系人长度不合法',
'mobile.cn_phone' => '手机号不合法',
];
@ -96,7 +96,7 @@ class AgentService extends Service
$node = $this->agentServiceRepository->find($attributes['id']);
if (!$node) {
throw new NotExistException('代理商不存在或已删除');
throw new NotExistException('机构不存在或已删除');
}
$this->agentServiceRepository->setModel($node)->update($attributes);

View File

@ -31,7 +31,7 @@ class PropertyService extends Service
'product' => '产品类型',
'package_type' => '套餐类型',
'province' => '省份设置',
'agent' => '代理商设置',
'agent' => '机构设置',
];
public static $default = [
@ -314,22 +314,22 @@ class PropertyService extends Service
$index = [];
foreach ($value['agent'] as $agent) {
if (in_array($agent['company_id'] . '_' . $agent['platform'], $index)) {
throw new InvalidArgumentException('代理商平台重复配置');
throw new InvalidArgumentException('机构平台重复配置');
} else {
array_push($index, $agent['company_id'] . '_' . $agent['platform']);
}
if (!in_array($agent['agent'], array_pluck($itemAgents, 'id'))) {
throw new InvalidArgumentException('代理商配置不正确');
throw new InvalidArgumentException('机构配置不正确');
}
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) {
throw new InvalidArgumentException('代理商百分比配置不正确');
throw new InvalidArgumentException('机构百分比配置不正确');
}
$value['agent'] = json_encode($value['agent'], 256);

View File

@ -7,10 +7,10 @@ use App\Models\CompanyBase;
/**
* App\Models\Virtual\Agent
*
* @property int $id 代理商ID
* @property int $id 机构ID
* @property int $company_id 企业ID
* @property string $sn 代理商编号
* @property string $name 代理商名称
* @property string $sn 机构编号
* @property string $name 机构名称
* @property string $contacts 联系人
* @property string $mobile 手机号
* @property string $address 地址

View File

@ -1,9 +1,9 @@
/**
* 代理商管理
* 机构管理
*/
/**
* [index 代理商列表]
* [index 机构列表]
* @param {[type]} data [description]
* @return {[type]} [description]
*/
@ -14,7 +14,7 @@ export function index(data) {
}
/**
* [show 代理商详情]
* [show 机构详情]
* @param {[type]} id [description]
* @return {[type]} [description]
*/
@ -23,7 +23,7 @@ export function show(id) {
}
/**
* [create 创建代理商]
* [create 创建机构]
* @param {[type]} data [description]
* @return {[type]} [description]
*/
@ -32,7 +32,7 @@ export function create(data) {
}
/**
* [update 修改代理商]
* [update 修改机构]
* @param {[type]} data [description]
* @param {[type]} id [角色id]
* @return {[type]} [description]
@ -42,7 +42,7 @@ export function update(data, id) {
}
/**
* [destroy 删除代理商]
* [destroy 删除机构]
* @param {[type]} data [description]
* @return {[type]} [description]
*/

View File

@ -14,7 +14,7 @@ export function settings(data) {
}
/**
* [agents 代理商设置]
* [agents 机构设置]
* @param {[type]} data [description]
* @return {[type]} [description]
*/

View File

@ -19,7 +19,7 @@ const routes = [
{ path: '/iframe', name: 'Iframe', component: load('iframe/index'), meta: { title: 'iframe' } },
{ 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: '/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: '/products/:type', name: 'Products', component: load('virtual/products/index'), meta: { title: '定价管理' } },
{ path: '/properties', name: 'Properties', component: load('virtual/properties/index'), meta: { title: '属性管理' } },

View File

@ -3,7 +3,7 @@
:footer-hide="true"
:mask-closable="false"
@on-visible-change="visibleChange"
title="代理商详情"
title="机构详情"
v-model="my_show"
width="900"
>
@ -13,7 +13,7 @@
<Divider>基础信息</Divider>
<ul>
<li class="ui-list">
<div class="ui-list-title">代理商编号:</div>
<div class="ui-list-title">机构编号:</div>
<div class="ui-list-content">{{data.id}}</div>
</li>
@ -23,7 +23,7 @@
</li>
<li class="ui-list">
<div class="ui-list-title">代理商名称:</div>
<div class="ui-list-title">机构名称:</div>
<div class="ui-list-content">{{data.name}}</div>
</li>

View File

@ -2,7 +2,7 @@
<Modal
:closable="false"
:mask-closable="false"
:title="data?'编辑代理商':'添加代理商'"
:title="data?'编辑机构':'添加机构'"
@on-visible-change="visibleChange"
v-model="my_show"
>
@ -28,7 +28,7 @@
<li class="ui-list">
<div class="ui-list-title">
<span class="title-require">*</span>代理商名称
<span class="title-require">*</span>机构名称
</div>
<div class="ui-list-content">
<p>

View File

@ -16,7 +16,7 @@
icon="md-add"
type="primary"
v-if="hasPermission('create')"
>添加代理商</Button>
>添加机构</Button>
</div>
<div class="handle-item">
@ -35,7 +35,7 @@
<AutoComplete
@on-search="handleCompleteCompanies"
icon="ios-search"
placeholder="请输入代理商名称"
placeholder="请输入机构名称"
v-model.trim="params.name"
>
<Option

View File

@ -62,12 +62,12 @@ export default {
},
ok() {
if (!this.params.company_id) {
this.$Message.info('请选择代理商');
this.$Message.info('请选择机构');
return;
}
if (!this.params.name) {
this.$Message.info('请填写代理商名称');
this.$Message.info('请填写机构名称');
return;
}

View File

@ -31,7 +31,7 @@ export default {
width: 80
},
{
title: "代理商名称",
title: "机构名称",
key: "name",
width: 300
},
@ -92,7 +92,7 @@ export default {
return h(
"Tag",
{ props: { color: "default" } },
"该代理商已被删除"
"该机构已被删除"
);
}
@ -161,7 +161,7 @@ export default {
click: () => {
this.$Modal.confirm({
title: "提示",
content: "删除后该代理商不可使用,请谨慎操作",
content: "删除后该机构不可使用,请谨慎操作",
onOk: () => {
API.destroy({
ids: row.id

View File

@ -2,7 +2,7 @@
<Drawer
:mask-closable="false"
@on-visible-change="visibleChange"
title="代理商设置"
title="机构设置"
v-model="my_show"
width="900"
>

View File

@ -36,7 +36,7 @@ export default {
dataAgent: [],
columns: [
{
title: '代理商',
title: '机构',
key: 'agent',
minWidth: 180,
render: (h, context) => {
@ -172,7 +172,7 @@ export default {
const element = this.dataAgent[key];
if (element.agent === undefined) {
return this.$Message.error('请选择代理商');
return this.$Message.error('请选择机构');
}
if (element.platform === undefined) {
@ -208,7 +208,7 @@ export default {
},
add() {
if (!this.agents.length) {
return this.$Message.error('请先添加代理商');
return this.$Message.error('请先添加机构');
}
if (!this.platforms.length) {

View File

@ -174,7 +174,7 @@ export default {
}
},
{
title: '代理商',
title: '机构',
key: 'action',
width: 150,
render: (h, {
@ -201,7 +201,7 @@ export default {
html.push(h('Tooltip', {
props: {
content: row.agent ? '已设置' : '代理商未设置'
content: row.agent ? '已设置' : '机构未设置'
}
}, [button]));
}