//套餐新增流量套餐类型字段相关查询

//数据统计-用户月报表新增流量套餐类型关联查询
This commit is contained in:
zhouhq@fxft.net 2020-03-30 16:43:49 +08:00
parent 0cdb46a86e
commit b43e214553
19 changed files with 74 additions and 32 deletions

View File

@ -20,7 +20,7 @@ class Dicts extends Repository
'weekIso' => ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
'pay_channel' => ['银行转账' => ['bank'], '余额支付' => ['account'], '微信支付' => ['wx', 'wx_pub', 'wx_pub_qr', 'wx_pub_scan', 'wx_wap', 'wx_lite'], '支付宝' => ['alipay', 'alipay_wap', 'alipay_qr', 'alipay_scan', 'alipay_pc_direct'], '天猫续费' => ['tmall']],
'carrier_operator' => ['联通', '移动', '电信', '全网'],
'fType' => ['流量','硬件'],
'flow_type' => ['流量','硬件'],
'service_type' => ['套餐开通', '套餐续费', '套餐更换', '套餐销售'],
'card_status' => ['测试期', '沉默期', '服务期', '服务到期', '已注销'],
'package_type' => ['基础套餐', '续费包', '加油包', '可选包', '附加包'],

View File

@ -31,7 +31,7 @@ class CompanyReportController extends Controller
public function index()
{
$conditions = $this->request->all();
$conditions['type'] = $this->request->ids('type');
$conditions['virtual_order_cards_partition.type'] = $this->request->ids('type');
$res = $this->companyReportService->index($conditions);

View File

@ -27,6 +27,15 @@ trait OrderCardConcern
$orgModel = $this->getModel();
$this->model = $this->model->where(function ($query) use ($conditions, $orgModel) {
//套餐表的流量套餐类型
if (isset($conditions['flow_type'])){
$hasRaw = sprintf("exists (SELECT id FROM virtual_packages WHERE %s.package_id = virtual_packages.id AND virtual_packages.flow_type = %d)",
$orgModel->getTable(),
$conditions['flow_type']);
$query->whereRaw($hasRaw);
}
if (isset($conditions['id'])) {
$conditions['id'] = array_wrap($conditions['id']);
$query->whereIn('id', $conditions['id']);

View File

@ -77,6 +77,11 @@ class PackageRepository extends Repository
$this->model = $this->model->where('carrier_operator', $conditions['carrier_operator']);
}
//流量套餐类型,0流量,1硬件
if (isset($conditions['flow_type'])) {
$this->model = $this->model->where('flow_type',$conditions['flow_type']);
}
if (isset($conditions['status'])) {
$this->model = $this->model->where('status', $conditions['status']);
}

View File

@ -43,14 +43,15 @@ class PackageService extends Service
$carrierOperators = app(Dicts::class)->get('carrier_operator');
//流量套餐[0流量1硬件]
$fTypeName = app(Dicts::class)->get('fType');
$flowTypeName = app(Dicts::class)->get('flow_type');
$packages->map(function ($item) use ($carrierOperators,$fTypeName){
$packages->map(function ($item) use ($carrierOperators,$flowTypeName){
$item->cost_price = sprintf('%.02f', $item->cost_price/100);
$item->guide_price = sprintf('%.02f', $item->guide_price/100);
$item->carrier_operator_name = $carrierOperators[$item->carrier_operator];
//显示对应的中文名称-流量套餐
$item->ftype = $fTypeName[$item->ftype];
$item->flow_type = $item->flow_type;
$item->flow_type_name = $flowTypeName[$item->flow_type];
$item->status = $item->deleted_at ? 2 : $item->status;
$item->created_at = Carbon::parse($item->created_at)->format('Y-m-d');
$item->updated_at = Carbon::parse($item->updated_at)->format('Y-m-d');
@ -82,7 +83,7 @@ class PackageService extends Service
'sn' => ['required', 'between:2,32', Rule::unique($this->packageRepository->getTable(), 'sn')->ignore($attributes['id'])->whereNUll('deleted_at')],
'name' => ['required', 'between:2,32', Rule::unique($this->packageRepository->getTable(), 'name')->ignore($attributes['id'])->whereNUll('deleted_at')],
'type' => ['required', 'in:0,2,3'],
'fType' => ['required', 'in:0,1'],
'flow_type' => ['required', 'in:0,1'],
'carrier_operator' => ['required', 'in:0,1,2,3'],
// 'package_type' => ['required', 'numeric'],
'cost_price' => ['numeric', 'min:0'],
@ -107,8 +108,9 @@ class PackageService extends Service
'name.between' => '套餐名称长度不合法',
'name.unique' => '套餐名称已经被其他用户所使用',
'type.required' => '请选择套餐类型',
'fType.required' => '请选择流量套餐类型',
'type.in' => '套餐类型不合法',
'flow_type.required' => '请选择流量套餐类型',
'flow_type.in' => '流量套餐类型不合法',
'carrier_operator.required' => '请选择运营商',
'carrier_operator.in' => '运营商不合法',
'package_type.required' => '请选择套餐类型',
@ -123,6 +125,7 @@ class PackageService extends Service
$attributes['cost_price'] = intval($attributes['cost_price'] * 100);
$attributes['guide_price'] = intval($attributes['guide_price'] * 100);
$attributes['package_type'] = intval($attributes['package_type']);
$attributes['flow_type'] = intval($attributes['flow_type']);
if (!$attributes['id']) {
$maxId = Package::withTrashed()->max('id');

View File

@ -72,6 +72,7 @@ class Package extends PackageBase
'name',
'type',
'carrier_operator',
'flow_type',
'package_type',
'cost_price',
'guide_price',

View File

@ -3,7 +3,8 @@ var CONFIG = {
login_background: '/assets/login_background.jpg',
logo_big: '/assets/logo_big.png',
logo_small: '/assets/logo_small.png',
url: (window.location.hostname === 'localhost') ? 'http://127.0.0.1:8000/' : '/'
url: (window.location.hostname === 'localhost') ? 'http://vd.dipp.ink/' : '/'
};
//http://vd.dipp.ink/
//http://127.0.0.1:8000/
window.CONFIG = CONFIG;

View File

@ -41,6 +41,13 @@
</AutoComplete>
</li>
<li class="handle-item w-200">
<Select clearable placeholder="流量套餐类型" v-model="params.flow_type">
<Option :value="0">流量</Option>
<Option :value="1">硬件</Option>
</Select>
</li>
<li class="handle-item w-250">
<AutoComplete
@on-search="handleCompletePackages(options.type, $event)"

View File

@ -209,8 +209,10 @@ export default {
this.options.type = this.types;
}
this.options.month = this.moment(this.options.month).format("YYYY-MM");
let params = {
limit: 0,
type: this.options.type,
@ -219,6 +221,11 @@ export default {
package_name: this.options.package_name
};
//流量套餐类型
if (this.params.flow_type != undefined){
params.flow_type = this.params.flow_type;
}
return params;
},

View File

@ -46,6 +46,19 @@
</div>
</li>
<li class="ui-list" v-if="type == 0">
<div class="ui-list-title">
<span class="title-require">*</span>流量套餐类型:
</div>
<div class="ui-list-content">
{{params.flow_type}}
<Select v-model="params.flow_type">
<Option :value="0">流量</Option>
<Option :value="1">硬件</Option>
</Select>
</div>
</li>
<li class="ui-list" v-if="type == 0">
<div class="ui-list-title">
<span class="title-require">*</span>套餐类型:

View File

@ -39,6 +39,13 @@
</Select>
</li>
<li class="handle-item w-200">
<Select clearable placeholder="流量套餐类型" v-model="params.flow_type">
<Option :value="0">流量</Option>
<Option :value="1">硬件</Option>
</Select>
</li>
<li class="handle-item w-200">
<Input clearable placeholder="套餐编号" v-model.trim="params.sn"></Input>
</li>

View File

@ -33,6 +33,7 @@ export default {
sn: '',
name: '',
carrier_operator: 255,
flow_type: 255,
package_type: 255,
cost_price: 0,
guide_price: 0,
@ -81,6 +82,11 @@ export default {
return;
}
if (this.params.flow_type === 255) {
this.$Message.info('请选择流量套餐类型');
return;
}
if (this.type == 0 && this.params.package_type === 255) {
this.$Message.info('请选择套餐类型');
return;

View File

@ -140,8 +140,8 @@ export default {
},
{
title: "流量套餐类型",
key: "fType",
width: 100
key: "flow_type_name",
width: 120
},
{
title: "流量值M",

View File

@ -3,7 +3,8 @@ var CONFIG = {
login_background: '/assets/login_background.jpg',
logo_big: '/assets/logo_big.png',
logo_small: '/assets/logo_small.png',
url: (window.location.hostname === 'localhost') ? 'http://127.0.0.1:8000/' : '/'
url: (window.location.hostname === 'localhost') ? 'http://vd.dipp.ink/' : '/'
};
//http://vd.dipp.ink/
//http://127.0.0.1:8000/
window.CONFIG = CONFIG;

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

View File

@ -1 +1 @@
<!DOCTYPE html><html><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=\favicon.ico><script src=\config.js></script><title></title><link href=/css/chunk-4f69bb43.6166dab5.css rel=prefetch><link href=/css/chunk-8330d1da.643b3261.css rel=prefetch><link href=/js/chunk-29ecfeab.2fbfdf81.js rel=prefetch><link href=/js/chunk-4f69bb43.d3443aef.js rel=prefetch><link href=/js/chunk-6c007037.1f00a06a.js rel=prefetch><link href=/js/chunk-8330d1da.f8f3e53e.js rel=prefetch><link href=/css/app.42353d5a.css rel=preload as=style><link href=/css/chunk-vendors.a38c182d.css rel=preload as=style><link href=/js/app.08f99a6c.js rel=preload as=script><link href=/js/chunk-vendors.a5156fe1.js rel=preload as=script><link href=/css/chunk-vendors.a38c182d.css rel=stylesheet><link href=/css/app.42353d5a.css rel=stylesheet></head><body><noscript><strong>很抱歉如果没有启用JavaScript程序不能正常工作若要继续使用请启用它。</strong></noscript><div id=app></div><script src=/js/chunk-vendors.a5156fe1.js></script><script src=/js/app.08f99a6c.js></script></body></html>
<!DOCTYPE html><html><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=\favicon.ico><script src=\config.js></script><title></title><link href=/css/chunk-32dc2093.0a9d0eac.css rel=prefetch><link href=/css/chunk-624487b2.53360862.css rel=prefetch><link href=/js/chunk-32dc2093.0b501d42.js rel=prefetch><link href=/js/chunk-624487b2.9da5cd34.js rel=prefetch><link href=/js/chunk-b20d0e82.5c8b410b.js rel=prefetch><link href=/js/chunk-ca4982dc.eec683e1.js rel=prefetch><link href=/css/app.ee4d4ff9.css rel=preload as=style><link href=/css/chunk-vendors.5db34889.css rel=preload as=style><link href=/js/app.f966d8b8.js rel=preload as=script><link href=/js/chunk-vendors.fc944f3e.js rel=preload as=script><link href=/css/chunk-vendors.5db34889.css rel=stylesheet><link href=/css/app.ee4d4ff9.css rel=stylesheet></head><body><noscript><strong>很抱歉如果没有启用JavaScript程序不能正常工作若要继续使用请启用它。</strong></noscript><div id=app></div><script src=/js/chunk-vendors.fc944f3e.js></script><script src=/js/app.f966d8b8.js></script></body></html>