数据修改 配置修改
This commit is contained in:
parent
c286d709cb
commit
4ef06721e1
2
.env.dev
2
.env.dev
@ -23,7 +23,7 @@ DB_REAL_PASSWORD=Lnx6vpIrnPMVVtlO
|
||||
|
||||
DB_VD_OLD_HOST=rm-bp1i7dsf6fi1bc5y2o.mysql.rds.aliyuncs.com
|
||||
DB_VD_OLD_PORT=3306
|
||||
DB_VD_OLD_DATABASE=vd-new-11-08
|
||||
DB_VD_OLD_DATABASE=vd-new
|
||||
DB_VD_OLD_USERNAME=vduser
|
||||
DB_VD_OLD_PASSWORD=fxft@123
|
||||
|
||||
|
@ -23,7 +23,7 @@ DB_REAL_PASSWORD=Lnx6vpIrnPMVVtlO
|
||||
|
||||
DB_VD_OLD_HOST=rm-bp1i7dsf6fi1bc5y2o.mysql.rds.aliyuncs.com
|
||||
DB_VD_OLD_PORT=3306
|
||||
DB_VD_OLD_DATABASE=vd-new-11-08
|
||||
DB_VD_OLD_DATABASE=vd-new
|
||||
DB_VD_OLD_USERNAME=vduser
|
||||
DB_VD_OLD_PASSWORD=fxft@123
|
||||
|
||||
|
@ -45,7 +45,13 @@ class BootstrapController extends Controller
|
||||
*/
|
||||
public function products(ProductService $productService)
|
||||
{
|
||||
$res = $productService->getCompanyProducts($this->account->company_id, $this->request->get('carrier_operator'));
|
||||
$conditions = [
|
||||
'company_id' => $this->account->company_id,
|
||||
'carrier_operator' => $this->request->get('carrier_operator'),
|
||||
];
|
||||
|
||||
$res = $productService->index($conditions);
|
||||
|
||||
return res($res, '企业套餐列表', 201);
|
||||
}
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ class PackageSync extends Command
|
||||
'jxc_package.flows as flows',
|
||||
'jxc_package.voices as voices',
|
||||
'jxc_package.short_msg as messages',
|
||||
'jxc_package.short_msg_on as has_message_switch',
|
||||
'jxc_package.short_msg_on as has_messages',
|
||||
'jxc_package.lbs as has_lbs',
|
||||
'jxc_package.flow_cycle as reset_months',
|
||||
'jxc_package.package_cycle as service_months',
|
||||
@ -111,7 +111,7 @@ class PackageSync extends Command
|
||||
$item->flows = $basePackage['flows'];
|
||||
$item->voices = $basePackage['voices'];
|
||||
$item->messages = $basePackage['messages'];
|
||||
$item->has_message_switch = $basePackage['has_message_switch'];
|
||||
$item->has_messages = $basePackage['has_messages'];
|
||||
$item->has_lbs = $basePackage['has_lbs'];
|
||||
$item->reset_months = $basePackage['reset_months'];
|
||||
});
|
||||
@ -221,7 +221,7 @@ class PackageSync extends Command
|
||||
$package['flows'] = intval($package['flows']);
|
||||
$package['voices'] = intval($package['voices']);
|
||||
$package['messages'] = intval($package['messages']);
|
||||
$package['has_message_switch'] = $package['has_message_switch'] ?? 0;
|
||||
$package['has_messages'] = $package['has_messages'] ?? 0;
|
||||
$package['has_lbs'] = $package['has_lbs'] ?? 0;
|
||||
$package['reset_months'] = $package['reset_months'] ?? 0;
|
||||
$package['service_months'] = $package['service_months'] ?? 0;
|
||||
|
@ -52,6 +52,7 @@ class PackageSync extends Command
|
||||
'flows' => ($item->tag == 10) ? intval($item->package_value) : 0,
|
||||
'voices' => ($item->tag == 11) ? intval($item->package_value) : 0,
|
||||
'messages' => 0,
|
||||
'has_messages' => 0,
|
||||
'has_lbs' => 0,
|
||||
'reset_months' => ($item->unit === 'year') ? $item->value * 12 : $item->value,
|
||||
'service_months' => ($item->cycle_unit === 'year') ? $item->cycle_value * 12 : $item->cycle_value,
|
||||
@ -82,6 +83,7 @@ class PackageSync extends Command
|
||||
'flows' => empty($item->flows) ? 0 : $item->flows,
|
||||
'voices' => empty($item->voice_num) ? 0 : $item->voice_num,
|
||||
'messages' => empty($item->sms_num) ? 0 : $item->sms_num,
|
||||
'has_messages' => empty($item->sms_num) ? 0 : 1,
|
||||
'has_lbs' => ($item->LBS === 10) ? 1 : 0,
|
||||
'reset_months' => $item->flows_cycle,
|
||||
'service_months' => $item->service_cycle,
|
||||
@ -112,6 +114,7 @@ class PackageSync extends Command
|
||||
'flows' => empty($item->flows) ? 0 : $item->flows,
|
||||
'voices' => empty($item->voice_num) ? 0 : $item->voice_num,
|
||||
'messages' => empty($item->sms_num) ? 0 : $item->sms_num,
|
||||
'has_messages' => empty($item->sms_num) ? 0 : 1,
|
||||
'has_lbs' => ($item->LBS === 10) ? 1 : 0,
|
||||
'reset_months' => $item->flows_cycle,
|
||||
'service_months' => $item->service_cycle,
|
||||
|
@ -36,7 +36,7 @@ class ProductSync extends Command
|
||||
$base_price = floatval($value['order_account']) * 100;
|
||||
|
||||
$products[] = [
|
||||
'sn' => $package['sn'] . '_' . $value['company'] . '_' . $base_price,
|
||||
'sn' => strtoupper($package['sn'] . '_' . $value['company'] . '_' . $base_price),
|
||||
'company_id' => $value['company'],
|
||||
'package_id' => $package['id'],
|
||||
'name' => $package['name'] . ' ' . $value['order_account'],
|
||||
|
81
app/Domains/Virtual/Http/Controllers/PackageController.php
Normal file
81
app/Domains/Virtual/Http/Controllers/PackageController.php
Normal file
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
namespace App\Domains\Virtual\Http\Controllers;
|
||||
|
||||
use App\Core\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Exceptions\NotExistException;
|
||||
use App\Domains\Virtual\Services\PackageService;
|
||||
use App\Domains\Virtual\Repositories\PackageRepository;
|
||||
|
||||
class PackageController extends Controller
|
||||
{
|
||||
protected $request;
|
||||
protected $packageService;
|
||||
|
||||
/**
|
||||
* 构造函数,自动注入.
|
||||
*/
|
||||
public function __construct(Request $request, PackageService $packageService)
|
||||
{
|
||||
$this->request = $request;
|
||||
$this->packageService = $packageService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 套餐列表.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$conditions = [];
|
||||
$conditions['limit'] = $this->request->get('limit', 20);
|
||||
|
||||
$packages = $this->packageService->index($conditions);
|
||||
|
||||
return res($packages, '套餐列表', 201);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$attributes = $this->request->all();
|
||||
|
||||
$account = $this->packageService->store($attributes);
|
||||
|
||||
return res($account, '创建成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update($id)
|
||||
{
|
||||
$attributes = $this->request->all();
|
||||
$attributes['id'] = $id;
|
||||
|
||||
$account = $this->packageService->store($attributes);
|
||||
|
||||
return res($account, '修改成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy()
|
||||
{
|
||||
$ids = $this->request->ids();
|
||||
|
||||
$this->packageService->destroy($ids);
|
||||
|
||||
return res(true, '删除成功');
|
||||
}
|
||||
}
|
@ -27,12 +27,11 @@ class ProductController extends Controller
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function getCompanyProducts(Dicts $dicts)
|
||||
public function index(Dicts $dicts)
|
||||
{
|
||||
$companyId = $this->request->get('company_id');
|
||||
$carrierOperator = $this->request->get('carrier_operator');
|
||||
$conditions = $this->request->all();
|
||||
|
||||
$products = $this->productService->getCompanyProducts($companyId, $carrierOperator);
|
||||
$products = $this->productService->index($conditions);
|
||||
|
||||
$carrierOperators = $dicts->get('carrier_operator');
|
||||
|
||||
|
@ -62,6 +62,16 @@ class ProductRepository extends Repository
|
||||
$this->model = $this->model->where('company_id', $conditions['company_id']);
|
||||
}
|
||||
|
||||
if (isset($conditions['name'])) {
|
||||
$this->model = $this->model->where('name', 'like', "%{$conditions['name']}%");
|
||||
}
|
||||
|
||||
if (isset($conditions['package_name'])) {
|
||||
$this->model = $this->model->whereHas('package', function ($relation) use ($conditions) {
|
||||
$relation->where('name', $conditions['package_name']);
|
||||
});
|
||||
}
|
||||
|
||||
if (isset($conditions['carrier_operator'])) {
|
||||
$this->model = $this->model->whereHas('package', function ($relation) use ($conditions) {
|
||||
$relation->where('carrier_operator', $conditions['carrier_operator']);
|
||||
|
@ -10,6 +10,13 @@ $router->group(['prefix' => 'virtual', 'as' => 'virtual', 'middleware' => ['admi
|
||||
$router->get('/fetch/companies', ['as' => 'fetch.companies', 'uses' => 'FetchController@companies']);
|
||||
$router->get('/fetch/packages', ['as' => 'fetch.packages', 'uses' => 'FetchController@packages']);
|
||||
|
||||
// 套餐管理
|
||||
$router->get('/packages/index', ['as' => 'packages.index', 'uses' => 'PackageController@index']);
|
||||
$router->get('/packages/show/{id}', ['as' => 'packages.show', 'uses' => 'PackageController@show']);
|
||||
$router->post('/packages/create', ['as' => 'packages.create', 'uses' => 'PackageController@create']);
|
||||
$router->post('/packages/update/{id}', ['as' => 'packages.update', 'uses' => 'PackageController@update']);
|
||||
$router->post('/packages/destroy', ['as' => 'packages.destroy', 'uses' => 'PackageController@destroy']);
|
||||
|
||||
// 企业管理
|
||||
$router->get('/companies/index', ['as' => 'companies.index', 'uses' => 'CompanyController@index']);
|
||||
$router->get('/companies/show/{id}', ['as' => 'companies.show', 'uses' => 'CompanyController@show']);
|
||||
@ -30,7 +37,7 @@ $router->group(['prefix' => 'virtual', 'as' => 'virtual', 'middleware' => ['admi
|
||||
// $router->post('/company/addresses/destroy', ['as' => 'company.addresses.destroy', 'uses' => 'CompanyAddressController@destroy']);
|
||||
|
||||
// 企业定价管理
|
||||
$router->get('/products/index', ['as' => 'products.index', 'uses' => 'ProductController@getCompanyProducts']);
|
||||
$router->get('/products/index', ['as' => 'products.index', 'uses' => 'ProductController@index']);
|
||||
$router->post('/products/create', ['as' => 'products.create', 'uses' => 'ProductController@create']);
|
||||
$router->post('/products/update/{id}', ['as' => 'products.update', 'uses' => 'ProductController@update']);
|
||||
$router->post('/products/destroy', ['as' => 'products.destroy', 'uses' => 'ProductController@destroy']);
|
||||
|
@ -36,4 +36,21 @@ class CommonService
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成套餐编号
|
||||
*
|
||||
* @param int $type
|
||||
* @param int $carrierOperator
|
||||
* @param int $flow
|
||||
* @param int $serviceMonths
|
||||
* @return string
|
||||
*/
|
||||
public static function generatePackageSn($type, $carrierOperator, $flow, $serviceMonths)
|
||||
{
|
||||
$typeSN = ['BS', 'RW', 'RP', 'FP', 'OP', 'AP'];
|
||||
$carrierOperatorSN = ['LT', 'YD', 'DX', 'QW'];
|
||||
|
||||
return $typeSN[$type] . '_' . $carrierOperatorSN[$carrierOperator] . '_' . $flow . '_' . $serviceMonths;
|
||||
}
|
||||
}
|
||||
|
142
app/Domains/Virtual/Services/PackageService.php
Normal file
142
app/Domains/Virtual/Services/PackageService.php
Normal file
@ -0,0 +1,142 @@
|
||||
<?php
|
||||
namespace App\Domains\Virtual\Services;
|
||||
|
||||
use App\Dicts;
|
||||
use App\Core\Service;
|
||||
use Illuminate\Support\Str;
|
||||
use App\Models\Virtual\Package;
|
||||
use Illuminate\Validation\Rule;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Exceptions\NotExistException;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use App\Domains\Virtual\Services\CommonService;
|
||||
use App\Domains\Virtual\Repositories\PackageRepository;
|
||||
|
||||
class PackageService extends Service
|
||||
{
|
||||
protected $packageRepository;
|
||||
|
||||
/**
|
||||
* 构造函数
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(PackageRepository $packageRepository)
|
||||
{
|
||||
$this->packageRepository = $packageRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* 套餐列表
|
||||
*
|
||||
* @param array $conditions
|
||||
* @return mixed
|
||||
*/
|
||||
public function index(array $conditions = [])
|
||||
{
|
||||
$limit = $conditions['limit'] ?? 20;
|
||||
|
||||
$packages = $this->packageRepository->withConditions($conditions)
|
||||
->applyConditions()->paginate($limit);
|
||||
|
||||
$carrierOperators = app(Dicts::class)->get('carrier_operator');
|
||||
|
||||
$packages->map(function ($item) use ($carrierOperators) {
|
||||
$item->carrier_operator_name = $carrierOperators[$item->carrier_operator];
|
||||
});
|
||||
|
||||
return $packages;
|
||||
}
|
||||
|
||||
/**
|
||||
* 存储套餐
|
||||
*
|
||||
* @param array $attributes
|
||||
* @param Package $parent
|
||||
* @return Package
|
||||
*/
|
||||
public function store(array $attributes = [])
|
||||
{
|
||||
$attributes = array_only($attributes, array_merge(app(Package::class)->getFillable()));
|
||||
|
||||
$attributes['sn'] = $attributes['sn'] ?? CommonService::generatePackageSn($attributes['type'], $attributes['carrier_operator'], $attributes['flows'], $attributes['service_months']);
|
||||
|
||||
$rule = [
|
||||
'sn' => ['required', 'between:2,32', Rule::unique($this->packageRepository->getTable(), 'sn')->ignore($attributes['id'])],
|
||||
'name' => ['required', 'between:2,32', Rule::unique($this->packageRepository->getTable(), 'name')->ignore($attributes['id'])],
|
||||
'type' => ['required', 'in:0,2,3'],
|
||||
'carrier_operator' => ['required', 'in:0,1,2,3'],
|
||||
'cost_price' => ['numeric', 'min:0'],
|
||||
'guide_price' => ['numeric', 'min:0'],
|
||||
'flows' => ['numeric', 'min:0'],
|
||||
'voices' => ['numeric', 'min:0'],
|
||||
'messages' => ['numeric', 'min:0'],
|
||||
'has_messages' => ['in:0,1'],
|
||||
'has_lbs' => ['in:0,1'],
|
||||
'reset_months' => ['numeric', "max:{$attributes['service_months']}", 'min:0'],
|
||||
'service_months' => ['numeric', 'min:0'],
|
||||
'effect_months' => ['numeric', 'min:0'],
|
||||
'delay_months' => ['numeric', 'min:0'],
|
||||
'description' => ['max:255'],
|
||||
];
|
||||
|
||||
$message = [
|
||||
'sn.required' => '请输入套餐编号',
|
||||
'sn.between' => '套餐编号长度不合法',
|
||||
'sn.unique' => '套餐编号已经被其他用户所使用',
|
||||
'name.required' => '请输入套餐编号',
|
||||
'name.between' => '套餐编号长度不合法',
|
||||
'name.unique' => '套餐编号已经被其他用户所使用',
|
||||
'type.required' => '请选择套餐类型',
|
||||
'type.in' => '套餐类型不合法',
|
||||
'carrier_operator.required' => '请选择运营商',
|
||||
'carrier_operator.in' => '运营商不合法',
|
||||
'cost_price.numeric' => '套餐价格必须是数字',
|
||||
'guide_price.numeric' => '套餐指导价格必须是数字',
|
||||
'flows.numeric' => '套餐指导价格必须是数字',
|
||||
];
|
||||
|
||||
Validator::validate($attributes, $rule, $message);
|
||||
|
||||
$attributes['cost_price'] = floatval($attributes['cost_price']) * 100;
|
||||
$attributes['guide_price'] = floatval($attributes['guide_price']) * 100;
|
||||
|
||||
if (!$attributes['id']) {
|
||||
$maxId = Package::withTrashed()->where('type', $attributes['type'])->max('id');
|
||||
$attributes['id'] = $maxId ? $maxId + 1 : 1;
|
||||
$node = $this->packageRepository->create($attributes);
|
||||
}
|
||||
|
||||
if ($attributes['id']) {
|
||||
$node = $this->packageRepository->find($attributes['id']);
|
||||
|
||||
if (!$node) {
|
||||
throw new NotExistException('套餐不存在或已删除');
|
||||
}
|
||||
|
||||
// 不能修改的字段
|
||||
unset($attributes['type']);
|
||||
unset($attributes['sn']);
|
||||
unset($attributes['carrier_operator']);
|
||||
unset($attributes['flows']);
|
||||
|
||||
$this->packageRepository->setModel($node)->update($attributes);
|
||||
}
|
||||
|
||||
return $node;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function destroy($ids)
|
||||
{
|
||||
$ids = is_array($ids) ? $ids : [$ids];
|
||||
|
||||
$this->packageRepository->destroy($ids);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -26,18 +26,13 @@ class ProductService extends Service
|
||||
/**
|
||||
* 获取企业定价列表
|
||||
*
|
||||
* @param int $companyId
|
||||
* @param array $conditions
|
||||
* @return Collection
|
||||
*/
|
||||
public function getCompanyProducts($companyId, $carrierOperator = null)
|
||||
public function index(array $conditions = [])
|
||||
{
|
||||
$conditions = [
|
||||
'company_id' => $companyId,
|
||||
'carrier_operator' => $carrierOperator,
|
||||
];
|
||||
|
||||
$list = $this->productRepository->with(['company:id,name', 'package:id,name,carrier_operator'])
|
||||
->withConditions($conditions)->get();
|
||||
->withConditions($conditions)->applyConditions()->get();
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
@ -41,15 +41,17 @@ class CreateBaseTables extends Migration
|
||||
$table->tinyInteger('carrier_operator')->unsigned()->default(255)->comment('运营商(0:联通 1:移动 2:电信)');
|
||||
$table->integer('cost_price')->unsigned()->default(0)->comment('成本价格');
|
||||
$table->integer('guide_price')->unsigned()->default(0)->comment('指导价格');
|
||||
$table->integer('renewal_cost_price')->unsigned()->default(0)->comment('续费成本价格');
|
||||
$table->integer('renewal_guide_price')->unsigned()->default(0)->comment('续费指导价格');
|
||||
$table->integer('flows')->unsigned()->default(0)->comment('套餐流量(M)');
|
||||
$table->integer('voices')->unsigned()->default(0)->comment('套餐语音(分钟)');
|
||||
$table->integer('messages')->unsigned()->default(0)->comment('套餐短信(条)');
|
||||
$table->tinyInteger('has_message_switch')->unsigned()->default(255)->comment('短信开关(0:无 1:有)');
|
||||
$table->tinyInteger('has_lbs')->unsigned()->default(255)->comment('lbs位置服务(0:无 1:有)');
|
||||
$table->tinyInteger('reset_months')->unsigned()->default(0)->comment('流量周期(月)');
|
||||
$table->tinyInteger('has_messages')->unsigned()->default(255)->comment('是否开通短信服务(0:无 1:有)');
|
||||
$table->tinyInteger('has_lbs')->unsigned()->default(255)->comment('是否开通LBS服务(0:无 1:有)');
|
||||
$table->tinyInteger('reset_months')->unsigned()->default(0)->comment('重置周期(月)');
|
||||
$table->tinyInteger('service_months')->unsigned()->default(0)->comment('套餐周期(月)');
|
||||
$table->tinyInteger('effect_months')->unsigned()->default(0)->comment('生效延迟周期(月)');
|
||||
$table->tinyInteger('delay_months')->unsigned()->default(0)->comment('服务器延长周期(月)');
|
||||
$table->tinyInteger('delay_months')->unsigned()->default(0)->comment('服务延长周期(月)');
|
||||
$table->text('description')->nullable()->comment('描述');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
@ -35,6 +35,7 @@ class CreateVirtualOrdersTable extends Migration
|
||||
$table->string('logistics_no', 64)->default('')->comment('物流单号');
|
||||
$table->tinyInteger('order_status')->unsigned()->default(0)->after('mobile')->comment('订单状态(0:已下单 1:已取消 2:已出库 3:已发货 4:已签收)');
|
||||
$table->tinyInteger('transaction_status')->unsigned()->default(0)->after('order_status')->comment('收款状态(0:未收款 1:已收款)');
|
||||
$table->text('cancel_remark')->nullable()->comment('取消备注');
|
||||
$table->text('logistics_remark')->nullable()->comment('物流备注');
|
||||
$table->text('remark')->nullable()->comment('订单备注');
|
||||
$table->timestamps();
|
||||
|
42
frontend/src/api/virtual/packages.js
Normal file
42
frontend/src/api/virtual/packages.js
Normal file
@ -0,0 +1,42 @@
|
||||
/**
|
||||
* 套餐管理
|
||||
*/
|
||||
|
||||
/**
|
||||
* [index 套餐列表]
|
||||
* @param {[type]} data [description]
|
||||
* @return {[type]} [description]
|
||||
*/
|
||||
export function index(data) {
|
||||
return service.get('api/virtual/packages/index', {
|
||||
params: data
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* [create 创建套餐]
|
||||
* @param {[type]} data [description]
|
||||
* @return {[type]} [description]
|
||||
*/
|
||||
export function create(data) {
|
||||
return serviceForm.post('api/virtual/packages/create', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* [update 修改套餐]
|
||||
* @param {[type]} data [description]
|
||||
* @param {[type]} id [角色id]
|
||||
* @return {[type]} [description]
|
||||
*/
|
||||
export function update(data, id) {
|
||||
return serviceForm.post(`api/virtual/packages/update/${id}`, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* [destroy 删除套餐]
|
||||
* @param {[type]} data [description]
|
||||
* @return {[type]} [description]
|
||||
*/
|
||||
export function destroy(data) {
|
||||
return service.post('api/virtual/packages/destroy', data);
|
||||
}
|
@ -34,9 +34,17 @@ export default {
|
||||
this.initCompleteCompanies();
|
||||
}
|
||||
|
||||
let companies = [];
|
||||
|
||||
if (this.completeCompaniesPinyinEngine) {
|
||||
this.completeHandledCompanies = this.completeCompaniesPinyinEngine.query(value);
|
||||
companies = this.completeCompaniesPinyinEngine.query(value);
|
||||
}
|
||||
|
||||
companies = this.completeCompanies.filter(function(item) {
|
||||
return (item.name.indexOf(value) !== -1) || (companies.find(element => { return element.id === item.id; }));
|
||||
});
|
||||
|
||||
this.completeHandledCompanies = companies;
|
||||
},
|
||||
initCompletePackages() {
|
||||
return new Promise((resolve, reject) => {
|
||||
@ -57,9 +65,17 @@ export default {
|
||||
this.initCompletePackages();
|
||||
}
|
||||
|
||||
let packages = [];
|
||||
|
||||
if (this.completePackagesPinyinEngine) {
|
||||
this.completeHandledPackages = this.completePackagesPinyinEngine.query(value);
|
||||
packages = this.completePackagesPinyinEngine.query(value);
|
||||
}
|
||||
|
||||
packages = this.completePackages.filter(function(item) {
|
||||
return (item.name.indexOf(value) !== -1) || (packages.find(element => { return element.id === item.id; }));
|
||||
});
|
||||
|
||||
this.completeHandledPackages = packages;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -20,7 +20,8 @@ const routes = [
|
||||
{ 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: '/products', name: 'Products', component: load('virtual/products/index'), meta: { title: '定价管理' } },
|
||||
{ path: '/orders', name: 'Orders', component: load('virtual/orders/index'), meta: { title: '订单列表' } }
|
||||
{ path: '/orders', name: 'Orders', component: load('virtual/orders/index'), meta: { title: '订单列表' } },
|
||||
{ path: '/packages', name: 'Packages', component: load('virtual/packages/index'), meta: { title: '套餐管理' } }
|
||||
]
|
||||
},
|
||||
{ path: '*', redirect: { path: '/home' } }
|
||||
|
@ -1,189 +1,208 @@
|
||||
<template>
|
||||
<div>
|
||||
<Modal
|
||||
width="600"
|
||||
v-model="my_show"
|
||||
:title="data?'编辑权限':'添加权限'"
|
||||
:closable="false"
|
||||
:mask-closable="false"
|
||||
@on-visible-change="visibleChange">
|
||||
<div>
|
||||
<Modal :closable="false" :mask-closable="false" :title="'添加权限'" @on-visible-change="visibleChange" v-model="my_show" width="600">
|
||||
<div class="page-edit-wrap uinn-lr20 uinn-tb5">
|
||||
<div class="ui-list">
|
||||
<div class="ui-list-title">类型:</div>
|
||||
<div class="ui-list-content lh-32">
|
||||
<RadioGroup v-model="params.type">
|
||||
<Radio :label="0">
|
||||
<Icon type="ios-list-outline"></Icon>
|
||||
<span>页面菜单</span>
|
||||
</Radio>
|
||||
<Radio :label="1">
|
||||
<Icon type="log-in"></Icon>
|
||||
<span>操作按钮</span>
|
||||
</Radio>
|
||||
</RadioGroup>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="page-edit-wrap uinn-lr20 uinn-tb5">
|
||||
<div class="ui-list">
|
||||
<div class="ui-list-title">类型:</div>
|
||||
<div class="ui-list-content lh-32">
|
||||
<RadioGroup v-model="params.type">
|
||||
<Radio :label="0">
|
||||
<Icon type="ios-list-outline"></Icon>
|
||||
<span>页面菜单</span>
|
||||
</Radio>
|
||||
<Radio :label="1">
|
||||
<Icon type="log-in"></Icon>
|
||||
<span>操作按钮</span>
|
||||
</Radio>
|
||||
</RadioGroup>
|
||||
</div>
|
||||
<div class="ui-list">
|
||||
<div class="ui-list-title">上级权限:</div>
|
||||
<div class="ui-list-content">
|
||||
<treeselect
|
||||
:options="tree"
|
||||
clearValueText="清空"
|
||||
noChildrenText="无下级节点"
|
||||
noOptionsText="无数据"
|
||||
noResultsText="无匹配数据"
|
||||
placeholder
|
||||
v-model="params.parent_id"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ui-list">
|
||||
<div class="ui-list-title">
|
||||
<span class="title-require">*</span>名称:
|
||||
</div>
|
||||
<div class="ui-list-content">
|
||||
<p>
|
||||
<Input :maxlength="15" v-model.trim="params.title"></Input>
|
||||
</p>
|
||||
<ul class="common-tips-wraper umar-t5">
|
||||
<li class="t-title">提示</li>
|
||||
<li class="t-content">长度在1-15之间</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ui-list">
|
||||
<div class="ui-list-title">
|
||||
<span class="title-require">*</span>标识:
|
||||
</div>
|
||||
<div class="ui-list-content">
|
||||
<p>
|
||||
<Input :maxlength="30" v-model.trim="params.name"></Input>
|
||||
</p>
|
||||
<ul class="common-tips-wraper umar-t5">
|
||||
<li class="t-title">提示</li>
|
||||
<li class="t-content">以英文字母开头,长度在1-30之间</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<template v-if="params.type==0">
|
||||
<div class="ui-list">
|
||||
<div class="ui-list-title">
|
||||
<span class="title-require">*</span>描述:
|
||||
</div>
|
||||
|
||||
<div class="ui-list">
|
||||
<div class="ui-list-title">上级权限:</div>
|
||||
<div class="ui-list-content">
|
||||
<treeselect
|
||||
v-model="params.parent_id"
|
||||
:options="tree"
|
||||
placeholder=""
|
||||
noOptionsText="无数据"
|
||||
clearValueText="清空"
|
||||
noResultsText="无匹配数据"
|
||||
noChildrenText="无下级节点"/>
|
||||
</div>
|
||||
<div class="ui-list-content">
|
||||
<Input :maxlength="255" :row="5" type="textarea" v-model.trim="params.description"></Input>
|
||||
<ul class="common-tips-wraper umar-t5">
|
||||
<li class="t-title">提示</li>
|
||||
<li class="t-content">长度在1-255之间</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ui-list">
|
||||
<div class="ui-list-title"><span class="title-require">*</span>名称:</div>
|
||||
<div class="ui-list-content">
|
||||
<p><Input v-model.trim="params.title" :maxlength="15"></Input></p>
|
||||
<ul class="common-tips-wraper umar-t5">
|
||||
<li class="t-title">提示</li>
|
||||
<li class="t-content">长度在1-15之间</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="ui-list">
|
||||
<div class="ui-list-title">
|
||||
<span class="title-require">*</span>路径:
|
||||
</div>
|
||||
|
||||
<div class="ui-list">
|
||||
<div class="ui-list-title"><span class="title-require">*</span>标识:</div>
|
||||
<div class="ui-list-content">
|
||||
<p><Input v-model.trim="params.name" :maxlength="30"></Input></p>
|
||||
<ul class="common-tips-wraper umar-t5">
|
||||
<li class="t-title">提示</li>
|
||||
<li class="t-content">以英文字母开头,长度在1-30之间</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="ui-list-content">
|
||||
<Input v-model.trim="params.path"></Input>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<template v-if="params.type==0">
|
||||
<div class="ui-list">
|
||||
<div class="ui-list-title"><span class="title-require">*</span>描述:</div>
|
||||
<div class="ui-list-content">
|
||||
<Input type="textarea" :row="5" v-model.trim="params.description" :maxlength="255"></Input>
|
||||
<ul class="common-tips-wraper umar-t5">
|
||||
<li class="t-title">提示</li>
|
||||
<li class="t-content">长度在1-255之间</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ui-list">
|
||||
<div class="ui-list-title"><span class="title-require">*</span>路径:</div>
|
||||
<div class="ui-list-content">
|
||||
<Input v-model.trim="params.path"></Input>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ui-list">
|
||||
<div class="ui-list-title">打开方式:</div>
|
||||
<div class="ui-list-content lh-32">
|
||||
<RadioGroup v-model="params.open">
|
||||
<Radio :label="0"><span>iframe窗口</span></Radio>
|
||||
<Radio :label="1"><span>打开新窗口</span></Radio>
|
||||
<Radio :label="2"><span>弹出窗口</span></Radio>
|
||||
<Radio :label="3"><span>vue组件</span></Radio>
|
||||
</RadioGroup>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ui-list">
|
||||
<div class="ui-list-title">窗口高度:</div>
|
||||
<div class="ui-list-content">
|
||||
<p><InputNumber class="w-p-100" :max="1000" :min="window.min" v-model.trim="params.height"></InputNumber></p>
|
||||
<ul class="common-tips-wraper umar-t5">
|
||||
<li class="t-title">提示</li>
|
||||
<li class="t-content">最小值{{window.min}},最大值1000</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ui-list">
|
||||
<div class="ui-list-title">窗口宽度:</div>
|
||||
<div class="ui-list-content">
|
||||
<p><InputNumber class="w-p-100" :max="500" :min="window.min" v-model.trim="params.width"></InputNumber></p>
|
||||
<ul class="common-tips-wraper umar-t5">
|
||||
<li class="t-title">提示</li>
|
||||
<li class="t-content">最小值{{window.min}},最大值500</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ui-list">
|
||||
<div class="ui-list-title"><span class="title-require">*</span>图标:</div>
|
||||
<div class="ui-list-content">
|
||||
<div class="ui-line lh-32">
|
||||
<Button type="primary" ghost class="va-t" @click="openIcon">选择图标</Button>
|
||||
<span class="ui-icon-wrap va-t" v-show="params.icon">
|
||||
<Icon :type="params.icon" class="white-color va-m" size="25"></Icon>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template v-else>
|
||||
<div class="ui-list">
|
||||
<div class="ui-list-title"><span class="title-require">*</span>按钮权限类型:</div>
|
||||
<div class="ui-list-content">
|
||||
<Select v-model="params.description">
|
||||
<Option value="index">查看操作</Option>
|
||||
<Option value="create">添加操作</Option>
|
||||
<Option value="update">编辑操作</Option>
|
||||
<Option value="destroy">删除操作</Option>
|
||||
<Option value="enable">启用操作</Option>
|
||||
<Option value="disable">禁用操作</Option>
|
||||
<Option value="output">导出操作</Option>
|
||||
<Option value="import">导入操作</Option>
|
||||
<Option value="upload">上传文件</Option>
|
||||
<Option value="jurisdiction">分配权限</Option>
|
||||
</Select>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div class="ui-list">
|
||||
<div class="ui-list-title">状态:</div>
|
||||
<div class="ui-list-content">
|
||||
<div class="ui-line lh-32">
|
||||
<Switch size="large" :true-value="1" :false-value="0" v-model="params.status">
|
||||
<span slot="open">启用</span>
|
||||
<span slot="close">禁用</span>
|
||||
</Switch>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui-list">
|
||||
<div class="ui-list-title">打开方式:</div>
|
||||
<div class="ui-list-content lh-32">
|
||||
<RadioGroup v-model="params.open">
|
||||
<Radio :label="0">
|
||||
<span>iframe窗口</span>
|
||||
</Radio>
|
||||
<Radio :label="1">
|
||||
<span>打开新窗口</span>
|
||||
</Radio>
|
||||
<Radio :label="2">
|
||||
<span>弹出窗口</span>
|
||||
</Radio>
|
||||
<Radio :label="3">
|
||||
<span>vue组件</span>
|
||||
</Radio>
|
||||
</RadioGroup>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ui-list">
|
||||
<div class="ui-list-title">排序:</div>
|
||||
<div class="ui-list-content">
|
||||
<div><InputNumber class="w-p-100" :min="0" :max="100" v-model.trim="params.displayorder" @on-blur="numberBlur"></InputNumber></div>
|
||||
<ul class="common-tips-wraper umar-t5">
|
||||
<li class="t-title">提示</li>
|
||||
<li class="t-content">排序值为0-100间的整数(数值越大,排序越靠前)</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="ui-list">
|
||||
<div class="ui-list-title">窗口高度:</div>
|
||||
<div class="ui-list-content">
|
||||
<p>
|
||||
<InputNumber :max="1000" :min="window.min" class="w-p-100" v-model.trim="params.height"></InputNumber>
|
||||
</p>
|
||||
<ul class="common-tips-wraper umar-t5">
|
||||
<li class="t-title">提示</li>
|
||||
<li class="t-content">最小值{{window.min}},最大值1000</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<footer slot="footer" class="ta-c">
|
||||
<Button type="primary" ghost @click="my_show=false" class="w-80">取消</Button>
|
||||
<Button type="primary" :loading="loading" @click="save" class="w-80">保存</Button>
|
||||
</footer>
|
||||
</Modal>
|
||||
<div class="ui-list">
|
||||
<div class="ui-list-title">窗口宽度:</div>
|
||||
<div class="ui-list-content">
|
||||
<p>
|
||||
<InputNumber :max="500" :min="window.min" class="w-p-100" v-model.trim="params.width"></InputNumber>
|
||||
</p>
|
||||
<ul class="common-tips-wraper umar-t5">
|
||||
<li class="t-title">提示</li>
|
||||
<li class="t-content">最小值{{window.min}},最大值500</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ui-icon
|
||||
:show.sync="iconObj.show"
|
||||
:type="iconObj.type"
|
||||
@on-success="selectIconSuccess">
|
||||
</ui-icon>
|
||||
</div>
|
||||
<div class="ui-list">
|
||||
<div class="ui-list-title">
|
||||
<span class="title-require">*</span>图标:
|
||||
</div>
|
||||
<div class="ui-list-content">
|
||||
<div class="ui-line lh-32">
|
||||
<Button @click="openIcon" class="va-t" ghost type="primary">选择图标</Button>
|
||||
<span class="ui-icon-wrap va-t" v-show="params.icon">
|
||||
<Icon :type="params.icon" class="white-color va-m" size="25"></Icon>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template v-else>
|
||||
<div class="ui-list">
|
||||
<div class="ui-list-title">
|
||||
<span class="title-require">*</span>按钮权限类型:
|
||||
</div>
|
||||
<div class="ui-list-content">
|
||||
<Select v-model="params.description">
|
||||
<Option value="index">查看操作</Option>
|
||||
<Option value="create">添加操作</Option>
|
||||
<Option value="update">编辑操作</Option>
|
||||
<Option value="destroy">删除操作</Option>
|
||||
<Option value="enable">启用操作</Option>
|
||||
<Option value="disable">禁用操作</Option>
|
||||
<Option value="output">导出操作</Option>
|
||||
<Option value="import">导入操作</Option>
|
||||
<Option value="upload">上传文件</Option>
|
||||
<Option value="jurisdiction">分配权限</Option>
|
||||
</Select>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div class="ui-list">
|
||||
<div class="ui-list-title">状态:</div>
|
||||
<div class="ui-list-content">
|
||||
<div class="ui-line lh-32">
|
||||
<Switch :false-value="0" :true-value="1" size="large" v-model="params.status">
|
||||
<span slot="open">启用</span>
|
||||
<span slot="close">禁用</span>
|
||||
</Switch>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ui-list">
|
||||
<div class="ui-list-title">排序:</div>
|
||||
<div class="ui-list-content">
|
||||
<div>
|
||||
<InputNumber :max="100" :min="0" @on-blur="numberBlur" class="w-p-100" v-model.trim="params.displayorder"></InputNumber>
|
||||
</div>
|
||||
<ul class="common-tips-wraper umar-t5">
|
||||
<li class="t-title">提示</li>
|
||||
<li class="t-content">排序值为0-100间的整数(数值越大,排序越靠前)</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<footer class="ta-c" slot="footer">
|
||||
<Button @click="my_show=false" class="w-80" ghost type="primary">取消</Button>
|
||||
<Button :loading="loading" @click="save" class="w-80" type="primary">保存</Button>
|
||||
</footer>
|
||||
</Modal>
|
||||
|
||||
<ui-icon :show.sync="iconObj.show" :type="iconObj.type" @on-success="selectIconSuccess"></ui-icon>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script src="./js/edit.js"></script>
|
||||
|
@ -179,7 +179,7 @@
|
||||
<div class="ui-list">
|
||||
<div class="ui-list-title"></div>
|
||||
<div class="ui-list-content">
|
||||
<Button type="primary" class="btn w-80" icon="ios-create" :disabled="id?false:true" :loading="loading" @click="save">修改</Button>
|
||||
<Button type="primary" class="btn w-80 umar-r10" icon="ios-create" :disabled="id?false:true" :loading="loading" @click="save">修改</Button>
|
||||
<Button type="primary" ghost class="btn w-80" @click="clear">重置</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -27,7 +27,7 @@
|
||||
<div class="search-wrap" v-show="search.show">
|
||||
<ul class="handle-wraper">
|
||||
<li class="handle-item w-250">
|
||||
<AutoComplete @on-search="handleCompleteCompanies" clearable icon="ios-search" placeholder="请输入企业名称" v-model.trim="params.name">
|
||||
<AutoComplete @on-search="handleCompleteCompanies" icon="ios-search" placeholder="请输入企业名称" v-model.trim="params.name">
|
||||
<Option :key="item.id" :value="item.name" v-for="item in completeHandledCompanies">{{ item.name }}</Option>
|
||||
</AutoComplete>
|
||||
</li>
|
||||
|
@ -23,7 +23,7 @@
|
||||
<div class="search-wrap" v-show="search.show">
|
||||
<ul class="handle-wraper">
|
||||
<li class="handle-item w-250">
|
||||
<AutoComplete @on-search="handleCompleteCompanies" clearable icon="ios-search" placeholder="请输入企业名称" v-model.trim="params.name">
|
||||
<AutoComplete @on-search="handleCompleteCompanies" icon="ios-search" placeholder="请输入企业名称" v-model.trim="params.name">
|
||||
<Option :key="item.id" :value="item.name" v-for="item in completeHandledCompanies">{{ item.name }}</Option>
|
||||
</AutoComplete>
|
||||
</li>
|
||||
|
@ -31,27 +31,40 @@
|
||||
</li>
|
||||
|
||||
<li class="handle-item w-250">
|
||||
<AutoComplete @on-search="handleCompleteCompanies" clearable icon="ios-search" placeholder="企业名称" v-model.trim="params.company_name">
|
||||
<AutoComplete @on-search="handleCompleteCompanies" icon="ios-search" placeholder="企业名称" v-model.trim="params.company_name">
|
||||
<Option :key="item.id" :value="item.name" v-for="item in completeHandledCompanies">{{ item.name }}</Option>
|
||||
</AutoComplete>
|
||||
</li>
|
||||
|
||||
<li class="handle-item w-250">
|
||||
<AutoComplete @on-search="handleCompletePackages" clearable icon="ios-search" placeholder="套餐名称" v-model.trim="params.package_name">
|
||||
<AutoComplete @on-search="handleCompletePackages" icon="ios-search" placeholder="套餐名称" v-model.trim="params.package_name">
|
||||
<Option :key="item.id" :value="item.name" v-for="item in completeHandledPackages">{{ item.name }}</Option>
|
||||
</AutoComplete>
|
||||
</li>
|
||||
|
||||
<li class="handle-item w-250">
|
||||
<DatePicker :editable="false" placeholder="请选择时间" placement="bottom-start" type="daterange" v-model.trim="params.time"></DatePicker>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class="handle-wraper">
|
||||
<li class="handle-item w-250">
|
||||
<Select clearable placeholder="订单状态" v-model="params.order_status">
|
||||
<Option :value="'0'">已下单</Option>
|
||||
<Option :value="'1'">已取消</Option>
|
||||
<Option :value="'2'">已排单</Option>
|
||||
<Option :value="'2'">已出库</Option>
|
||||
<Option :value="'3'">已发货</Option>
|
||||
<Option :value="'4'">已签收</Option>
|
||||
</Select>
|
||||
</li>
|
||||
|
||||
<li class="handle-item w-250">
|
||||
<Select clearable placeholder="收款状态" v-model="params.transaction_status">
|
||||
<Option :value="'0'">未收款</Option>
|
||||
<Option :value="'1'">已收款</Option>
|
||||
</Select>
|
||||
</li>
|
||||
|
||||
<li class="handle-item w-250">
|
||||
<Select clearable placeholder="运营商" v-model="params.carrier_operator">
|
||||
<Option :value="'0'">联通</Option>
|
||||
@ -60,12 +73,6 @@
|
||||
</Select>
|
||||
</li>
|
||||
|
||||
<li class="handle-item w-250">
|
||||
<DatePicker :editable="false" placeholder="请选择时间" placement="bottom-start" type="daterange" v-model.trim="params.time"></DatePicker>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class="handle-wraper">
|
||||
<li class="f-r">
|
||||
<div class="handle-item">
|
||||
<Button @click="index(1)" ghost type="primary">立即搜索</Button>
|
||||
|
128
frontend/src/views/virtual/packages/edit.vue
Normal file
128
frontend/src/views/virtual/packages/edit.vue
Normal file
@ -0,0 +1,128 @@
|
||||
<template>
|
||||
<Modal :closable="false" :mask-closable="false" :title="data ? '编辑套餐' : '添加套餐'" @on-visible-change="visibleChange" v-model="my_show">
|
||||
<div class="page-edit-wrap uinn-lr20">
|
||||
<ui-loading :show="page_loading.show"></ui-loading>
|
||||
|
||||
<ul>
|
||||
<li class="ui-list">
|
||||
<div class="ui-list-title">套餐编号:</div>
|
||||
<div class="ui-list-content">
|
||||
<p>
|
||||
<Input :disabled="data?true:false" v-model.trim="params.sn"></Input>
|
||||
</p>
|
||||
<ul class="common-tips-wraper umar-t5">
|
||||
<li class="t-title">提示</li>
|
||||
<li class="t-content">仅能输入[A-Z0-9-_]的字符,如未输入将根据规则自动生成</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
<li class="ui-list">
|
||||
<div class="ui-list-title">
|
||||
<span class="title-require">*</span>套餐名称:
|
||||
</div>
|
||||
<div class="ui-list-content">
|
||||
<p>
|
||||
<Input :disabled="data?true:false" v-model.trim="params.name"></Input>
|
||||
</p>
|
||||
<ul class="common-tips-wraper umar-t5">
|
||||
<li class="t-title">提示</li>
|
||||
<li class="t-content">长度在2-32之间</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
<li class="ui-list">
|
||||
<div class="ui-list-title">
|
||||
<span class="title-require">*</span>运营商:
|
||||
</div>
|
||||
<div class="ui-list-content">
|
||||
<p>
|
||||
<Select v-model="params.carrier_operator">
|
||||
<Option :value="'0'">联通</Option>
|
||||
<Option :value="'1'">移动</Option>
|
||||
<Option :value="'2'">电信</Option>
|
||||
</Select>
|
||||
</p>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="ui-list">
|
||||
<div class="ui-list-title">套餐成本价:</div>
|
||||
<div class="ui-list-content">
|
||||
<p>
|
||||
<InputNumber :max="99999" :min="0" :step="0.01" v-model="params.cost_price"></InputNumber>(元)
|
||||
</p>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="ui-list">
|
||||
<div class="ui-list-title">套餐指导价:</div>
|
||||
<div class="ui-list-content">
|
||||
<p>
|
||||
<InputNumber :max="99999" :min="0" :step="0.01" v-model="params.guide_price"></InputNumber>(元)
|
||||
</p>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="ui-list">
|
||||
<div class="ui-list-title">套餐流量</div>
|
||||
<div class="ui-list-content">
|
||||
<p>
|
||||
<InputNumber :formatter="value => Number(value).toFixed(0)" :max="99999" :min="0" :step="1" v-model="params.flows"></InputNumber>(M)
|
||||
</p>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="ui-list">
|
||||
<div class="ui-list-title">套餐语音</div>
|
||||
<div class="ui-list-content">
|
||||
<p>
|
||||
<InputNumber :max="99999" :min="0" :step="1" v-model="params.voices"></InputNumber>(分钟)
|
||||
</p>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="ui-list">
|
||||
<div class="ui-list-title">套餐短信</div>
|
||||
<div class="ui-list-content">
|
||||
<p>
|
||||
<InputNumber :max="99999" :min="0" :step="1" v-model="params.messages"></InputNumber>(分钟)
|
||||
</p>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="ui-list">
|
||||
<div class="ui-list-title">短信服务</div>
|
||||
<div class="ui-list-content">
|
||||
<p>
|
||||
<Switch @on-change="switchChange" v-model="params.has_messages"/>
|
||||
</p>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="ui-list">
|
||||
<div class="ui-list-title">LBS服务</div>
|
||||
<div class="ui-list-content">
|
||||
<p>
|
||||
<Switch @on-change="switchChange" v-model="params.has_lbs"/>
|
||||
</p>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="ui-list">
|
||||
<div class="ui-list-title">备注:</div>
|
||||
<div class="ui-list-content">
|
||||
<p>
|
||||
<Input :maxlength="32" v-model.trim="params.remark"></Input>
|
||||
</p>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<footer class="ta-c" slot="footer">
|
||||
<Button @click="clear" class="w-80" ghost type="primary">取消</Button>
|
||||
<Button :loading="loading" @click="ok" class="w-80" type="primary">提交</Button>
|
||||
</footer>
|
||||
</Modal>
|
||||
</template>
|
||||
|
||||
<script src="./js/edit.js"></script>
|
87
frontend/src/views/virtual/packages/index.vue
Normal file
87
frontend/src/views/virtual/packages/index.vue
Normal file
@ -0,0 +1,87 @@
|
||||
<template>
|
||||
<div class="page-wrap">
|
||||
<ui-loading :show="page_loading.show"></ui-loading>
|
||||
|
||||
<div class="page-handle-wrap">
|
||||
<ul class="handle-wraper bd-b">
|
||||
<li class="f-l">
|
||||
<div class="text-exp">
|
||||
<b>全部信息</b>
|
||||
</div>
|
||||
</li>
|
||||
<li class="f-r">
|
||||
<div class="handle-item">
|
||||
<Button @click="openEdit(true, null)" icon="md-add" type="primary" v-has="'create'">添加套餐</Button>
|
||||
</div>
|
||||
|
||||
<div class="handle-item">
|
||||
<Button @click="search.show=!search.show" ghost icon="ios-search" type="primary">搜索</Button>
|
||||
</div>
|
||||
|
||||
<div class="handle-item">
|
||||
<Button @click="index(1)" icon="md-refresh">刷新</Button>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="search-wrap" v-show="search.show">
|
||||
<ul class="handle-wraper">
|
||||
<li class="handle-item w-250">
|
||||
<Select clearable placeholder="运营商" v-model="params.carrier_operator">
|
||||
<Option :value="'0'">联通</Option>
|
||||
<Option :value="'1'">移动</Option>
|
||||
<Option :value="'2'">电信</Option>
|
||||
</Select>
|
||||
</li>
|
||||
|
||||
<li class="handle-item w-250">
|
||||
<Input clearable placeholder="套餐编号" v-model.trim="params.sn"></Input>
|
||||
</li>
|
||||
|
||||
<li class="handle-item w-250">
|
||||
<AutoComplete @on-search="handleCompletePackages" icon="ios-search" placeholder="套餐名称" v-model.trim="params.name">
|
||||
<Option :key="item.id" :value="item.name" v-for="item in completeHandledPackages">{{ item.name }}</Option>
|
||||
</AutoComplete>
|
||||
</li>
|
||||
|
||||
<li class="handle-item w-250">
|
||||
<Select clearable placeholder="套餐状态" v-model="trashed">
|
||||
<Option :value="'without'">使用中</Option>
|
||||
<Option :value="'only'">已删除</Option>
|
||||
</Select>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class="handle-wraper">
|
||||
<li class="f-r">
|
||||
<div class="handle-item">
|
||||
<Button @click="index(1)" ghost type="primary">立即搜索</Button>
|
||||
</div>
|
||||
<div class="handle-item">
|
||||
<Button @click="resetSearch" ghost type="warning">重置搜索</Button>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="page-list-wrap">
|
||||
<Table :columns="table_titles" :data="list_data ? list_data.data : []"></Table>
|
||||
</div>
|
||||
|
||||
<div class="page-turn-wrap" v-if="list_data">
|
||||
<Page
|
||||
:current="Number(list_data.current_page)"
|
||||
:page-size="Number(list_data.per_page)"
|
||||
:total="Number(list_data.total)"
|
||||
@on-change="index"
|
||||
show-elevator
|
||||
show-total
|
||||
></Page>
|
||||
</div>
|
||||
|
||||
<ui-edit :data="editObj.data" :show.sync="editObj.show" @add-success="index" @update-success="index(list_data.current_page)"></ui-edit>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script src="./js/index.js"></script>
|
105
frontend/src/views/virtual/packages/js/edit.js
Normal file
105
frontend/src/views/virtual/packages/js/edit.js
Normal file
@ -0,0 +1,105 @@
|
||||
import * as API from 'api/virtual/companies';
|
||||
|
||||
export default {
|
||||
props: {
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
data: {
|
||||
type: Object,
|
||||
default () {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
my_show: false,
|
||||
isUpdate: false,
|
||||
loading: false,
|
||||
params: {
|
||||
sn: '',
|
||||
name: '',
|
||||
carrier_operator: '',
|
||||
cost_price: 0,
|
||||
guide_price: 0,
|
||||
flows: 0,
|
||||
voices: 0,
|
||||
messages: 0,
|
||||
has_messages: 0,
|
||||
has_lbs: 0
|
||||
}
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
show(bool) {
|
||||
this.my_show = bool;
|
||||
if (bool) {
|
||||
if (this.data) {
|
||||
for (let k in this.data) {
|
||||
if (k in this.params) {
|
||||
this.params[k] = this.data[k];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
ok() {
|
||||
if (!this.params.name) {
|
||||
this.$Message.info('请填写企业名称');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(/[\s\S]{2,32}/.test(this.params.contacts))) {
|
||||
this.$Message.info('联系人长度在2-32之间');
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.data) {
|
||||
// 编辑
|
||||
API.update(this.params, this.data.id).then(res => {
|
||||
this.loading = false;
|
||||
if (res.code == 0) {
|
||||
this.$emit('update-success');
|
||||
this.$Message.success('更新成功');
|
||||
this.clear();
|
||||
}
|
||||
}).catch(err => {
|
||||
this.loading = false;
|
||||
});
|
||||
} else {
|
||||
// 添加
|
||||
API.create(this.params).then(res => {
|
||||
this.loading = false;
|
||||
if (res.code == 0) {
|
||||
this.$emit('add-success');
|
||||
this.$Message.success('添加成功');
|
||||
this.clear();
|
||||
}
|
||||
}).catch(err => {
|
||||
this.loading = false;
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
visibleChange(bool) {
|
||||
if (!bool) {
|
||||
this.$emit('update:show', false);
|
||||
}
|
||||
},
|
||||
|
||||
clear() {
|
||||
for (let k in this.params) {
|
||||
this.params[k] = '';
|
||||
}
|
||||
|
||||
this.my_show = false;
|
||||
},
|
||||
switchChange(status) {
|
||||
console.log(status);
|
||||
}
|
||||
}
|
||||
};
|
231
frontend/src/views/virtual/packages/js/index.js
Normal file
231
frontend/src/views/virtual/packages/js/index.js
Normal file
@ -0,0 +1,231 @@
|
||||
import * as API from 'api/virtual/packages';
|
||||
export default {
|
||||
name: 'Companies',
|
||||
components: {
|
||||
UiEdit: resolve => require(['views/virtual/packages/edit'], resolve)
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
params: {
|
||||
name: ''
|
||||
},
|
||||
trashed: '',
|
||||
list_data: null,
|
||||
editObj: {
|
||||
show: false,
|
||||
data: null
|
||||
},
|
||||
detailObj: {
|
||||
show: false,
|
||||
data: null
|
||||
},
|
||||
search: {
|
||||
show: false
|
||||
},
|
||||
table_titles: [
|
||||
{
|
||||
type: 'expand',
|
||||
width: 50,
|
||||
render: (h, params) => {
|
||||
let row = params.row;
|
||||
let Col = [];
|
||||
|
||||
Col.push(h('Col', { props: { span: 6 }, class: ['fz-12'] }, '成本价(元): ' + Number(row['cost_price']).toFixed(2)));
|
||||
Col.push(h('Col', { props: { span: 6 }, class: ['fz-12'] }, '指导价(元): ' + Number(row['guide_price']).toFixed(2)));
|
||||
Col.push(h('Col', { props: { span: 6 }, class: ['fz-12'] }, '语音分钟数: ' + row['voices']));
|
||||
Col.push(h('Col', { props: { span: 6 }, class: ['fz-12'] }, '短信条数: ' + row['messages']));
|
||||
Col.push(h('Col', { props: { span: 6 }, class: ['fz-12'] }, '是否开通短信功能: ' + (row['has_message_switch'] ? '有' : '无')));
|
||||
Col.push(h('Col', { props: { span: 6 }, class: ['fz-12'] }, '是否开通LBS功能: ' + (row['has_lbs'] ? '有' : '无')));
|
||||
Col.push(h('Col', { props: { span: 6 }, class: ['fz-12'] }, '重置周期(月): ' + row['reset_months']));
|
||||
Col.push(h('Col', { props: { span: 6 }, class: ['fz-12'] }, '生效周期(月): ' + row['effect_months']));
|
||||
Col.push(h('Col', { props: { span: 6 }, class: ['fz-12'] }, '到期延长(月): ' + row['delay_months']));
|
||||
Col.push(h('Col', { props: { span: 6 }, class: ['fz-12'] }, '套餐说明: ' + row['description']));
|
||||
Col.push(h('Col', { props: { span: 6 }, class: ['fz-12'] }, '创建时间: ' + row['created_at']));
|
||||
Col.push(h('Col', { props: { span: 6 }, class: ['fz-12'] }, '更新时间: ' + row['updated_at']));
|
||||
|
||||
return h('Row', {}, Col);
|
||||
}
|
||||
},
|
||||
{
|
||||
title: 'ID',
|
||||
key: 'id',
|
||||
width: 120
|
||||
},
|
||||
{
|
||||
title: '套餐编号',
|
||||
key: 'sn',
|
||||
width: 300
|
||||
},
|
||||
{
|
||||
title: '套餐名称',
|
||||
key: 'name'
|
||||
},
|
||||
{
|
||||
title: '运营商',
|
||||
key: 'carrier_operator_name'
|
||||
},
|
||||
{
|
||||
title: '流量值(M)',
|
||||
key: 'flows'
|
||||
},
|
||||
{
|
||||
title: '套餐周期(月)',
|
||||
key: 'service_months'
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
key: 'created_at',
|
||||
width: 170
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
render: (h, {
|
||||
row,
|
||||
column,
|
||||
index
|
||||
}) => {
|
||||
let html = [];
|
||||
|
||||
if (row.deleted_at) {
|
||||
return h('Tag', { props: { color: 'default' } }, '该套餐已被删除');
|
||||
}
|
||||
|
||||
if (this.haveJurisdiction('index')) {
|
||||
html.push(h('Button', {
|
||||
props: {
|
||||
type: 'success',
|
||||
size: 'small',
|
||||
disabled: false,
|
||||
icon: 'md-eye'
|
||||
},
|
||||
class: ['btn'],
|
||||
on: {
|
||||
click: (event) => {
|
||||
this.detailObj = {
|
||||
show: true,
|
||||
data: row
|
||||
};
|
||||
}
|
||||
}
|
||||
}, '查看'));
|
||||
}
|
||||
|
||||
if (this.haveJurisdiction('update')) {
|
||||
html.push(h('Button', {
|
||||
props: {
|
||||
type: 'primary',
|
||||
size: 'small',
|
||||
disabled: false,
|
||||
icon: 'ios-create'
|
||||
},
|
||||
class: ['btn'],
|
||||
on: {
|
||||
click: (event) => {
|
||||
this.openEdit(true, row);
|
||||
}
|
||||
}
|
||||
}, '编辑'));
|
||||
}
|
||||
|
||||
if (this.haveJurisdiction('destroy')) {
|
||||
html.push(h('Button', {
|
||||
props: {
|
||||
type: 'error',
|
||||
size: 'small',
|
||||
disabled: false,
|
||||
icon: 'md-trash'
|
||||
},
|
||||
class: ['btn'],
|
||||
on: {
|
||||
click: () => {
|
||||
this.$Modal.confirm({
|
||||
title: '提示',
|
||||
content: '删除后该企业不可使用,请谨慎操作',
|
||||
onOk: () => {
|
||||
API.destroy({
|
||||
ids: row.id
|
||||
}).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.$Message.success('删除成功');
|
||||
this.request();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}, '删除'));
|
||||
}
|
||||
|
||||
if (html.length) {
|
||||
return h('div', html);
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
created() {
|
||||
let type = this.$route.query.type;
|
||||
|
||||
if (typeof(type) === 'undefined') {
|
||||
return this.$Message.error('非法请求');
|
||||
}
|
||||
|
||||
this.index(1, type);
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* [index 列表]
|
||||
* @param {Number} page [description]
|
||||
* @return {[type]} [description]
|
||||
*/
|
||||
index(page = 1, type = 0) {
|
||||
let data = this.searchDataHandle(this.params, { page }, { 'trashed': this.trashed, 'orderBy': 'id', 'sortedBy': 'asc' });
|
||||
this.isShowLoading(true);
|
||||
API.index(data).then(res => {
|
||||
this.isShowLoading(false);
|
||||
if (res.code == 0) {
|
||||
this.list_data = res.data;
|
||||
}
|
||||
}).catch(() => {
|
||||
this.isShowLoading(false);
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* [openEdit 打开编辑弹窗]
|
||||
* @return {[type]} [description]
|
||||
*/
|
||||
openEdit(bool, data = null) {
|
||||
this.editObj = {
|
||||
show: bool,
|
||||
data
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* [request 刷新]
|
||||
* @return {[type]} [description]
|
||||
*/
|
||||
request() {
|
||||
const result = this.list_data;
|
||||
let page = result.current_page;
|
||||
|
||||
if (this.list_data.data.length == 1) {
|
||||
page = this.returnPage(result.total, result.current_page, result.per_page);
|
||||
}
|
||||
|
||||
this.index(page);
|
||||
},
|
||||
|
||||
resetSearch() {
|
||||
for (let k in this.params) {
|
||||
this.params[k] = '';
|
||||
}
|
||||
this.trashed = '';
|
||||
this.index(1);
|
||||
}
|
||||
}
|
||||
};
|
@ -4,7 +4,7 @@
|
||||
<div class="product-content">
|
||||
<div class="nav">
|
||||
<div class="search umar-t5">
|
||||
<AutoComplete @on-change="handleSearchCompanies" placeholder="输入名称进行过滤"></AutoComplete>
|
||||
<AutoComplete @on-search="handleSearchCompanies" placeholder="输入名称进行过滤"></AutoComplete>
|
||||
</div>
|
||||
<div class="box">
|
||||
<CellGroup @on-click="index" v-for="item in companies">
|
||||
@ -17,7 +17,7 @@
|
||||
<ul class="handle-wraper bd-b">
|
||||
<li class="f-l">
|
||||
<div class="text-exp">
|
||||
<b>全部信息</b>
|
||||
<b>{{company.name}}</b>
|
||||
</div>
|
||||
</li>
|
||||
<li class="f-r" v-if="params.company_id">
|
||||
@ -30,7 +30,7 @@
|
||||
</div>
|
||||
|
||||
<div class="handle-item">
|
||||
<Button @click="index(1)" icon="md-refresh">刷新</Button>
|
||||
<Button @click="index()" icon="md-refresh">刷新</Button>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
@ -38,18 +38,28 @@
|
||||
<div class="search-wrap" v-show="search.show">
|
||||
<ul class="handle-wraper">
|
||||
<li class="handle-item w-250">
|
||||
<Select clearable v-model="params.carrier_operator">
|
||||
<Select clearable placeholder="运营商" v-model="params.carrier_operator">
|
||||
<Option :value="'0'">联通</Option>
|
||||
<Option :value="'1'">移动</Option>
|
||||
<Option :value="'2'">电信</Option>
|
||||
</Select>
|
||||
</li>
|
||||
|
||||
<li class="handle-item w-250">
|
||||
<Input clearable placeholder="定价名称" v-model.trim="params.name"></Input>
|
||||
</li>
|
||||
|
||||
<li class="handle-item w-250">
|
||||
<AutoComplete @on-search="handleCompletePackages" icon="ios-search" placeholder="套餐名称" v-model.trim="params.package_name">
|
||||
<Option :key="item.id" :value="item.name" v-for="item in completeHandledPackages">{{ item.name }}</Option>
|
||||
</AutoComplete>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class="handle-wraper">
|
||||
<li class="f-r">
|
||||
<div class="handle-item">
|
||||
<Button @click="index(1)" ghost type="primary">立即搜索</Button>
|
||||
<Button @click="index()" ghost type="primary">立即搜索</Button>
|
||||
</div>
|
||||
<div class="handle-item">
|
||||
<Button @click="resetSearch" ghost type="warning">重置搜索</Button>
|
||||
|
@ -9,7 +9,9 @@ export default {
|
||||
return {
|
||||
params: {
|
||||
company_id: null,
|
||||
carrier_operator: null
|
||||
carrier_operator: null,
|
||||
name: null,
|
||||
package_name: null
|
||||
},
|
||||
trashed: '',
|
||||
editObj: {
|
||||
@ -21,6 +23,7 @@ export default {
|
||||
show: false
|
||||
},
|
||||
companies: [],
|
||||
company: { id: 0, name: '请选择企业' },
|
||||
data: [],
|
||||
columns: [
|
||||
{
|
||||
@ -30,11 +33,13 @@ export default {
|
||||
},
|
||||
{
|
||||
title: '定价名称',
|
||||
key: 'name'
|
||||
key: 'name',
|
||||
width: 150
|
||||
},
|
||||
{
|
||||
title: '套餐名称',
|
||||
key: '',
|
||||
width: 120,
|
||||
render: (h, { row, column, index }) => {
|
||||
if (row.package) {
|
||||
return h('span', row.package.name);
|
||||
@ -44,6 +49,7 @@ export default {
|
||||
{
|
||||
title: '套餐价格',
|
||||
key: '',
|
||||
width: 100,
|
||||
render: (h, { row, column, index }) => {
|
||||
let price = Number(row.base_price / 100);
|
||||
return h('span', price.toFixed(2));
|
||||
@ -52,6 +58,7 @@ export default {
|
||||
{
|
||||
title: '续费价格',
|
||||
key: '',
|
||||
width: 100,
|
||||
render: (h, { row, column, index }) => {
|
||||
let price = Number(row.renewal_price / 100);
|
||||
return h('span', price.toFixed(2));
|
||||
@ -59,7 +66,8 @@ export default {
|
||||
},
|
||||
{
|
||||
title: '运营商',
|
||||
key: 'carrier_operator'
|
||||
key: 'carrier_operator',
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
title: '备注',
|
||||
@ -137,7 +145,6 @@ export default {
|
||||
};
|
||||
},
|
||||
created() {
|
||||
// this.index(1);
|
||||
this.initCompleteCompanies().then(res => {
|
||||
this.companies = res;
|
||||
}).catch(err => {
|
||||
@ -151,8 +158,12 @@ export default {
|
||||
* @return {[type]} [description]
|
||||
*/
|
||||
index(company_id = null) {
|
||||
console.log(company_id);
|
||||
if (company_id) {
|
||||
this.params.company_id = company_id;
|
||||
this.company = this.companies.find(item => {
|
||||
return item.id === company_id;
|
||||
});
|
||||
}
|
||||
|
||||
this.isShowLoading(true);
|
||||
@ -211,6 +222,9 @@ export default {
|
||||
if (this.completeCompaniesPinyinEngine) {
|
||||
this.companies = this.completeCompaniesPinyinEngine.query(value);
|
||||
}
|
||||
},
|
||||
handleSearchPackages(value) {
|
||||
this.params.package_id = value;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user