添加套餐类型功能
This commit is contained in:
parent
550b4424ef
commit
c4ec31ce28
@ -78,6 +78,7 @@ class PackageService extends Service
|
||||
'name' => ['required', 'between:2,32', Rule::unique($this->packageRepository->getTable(), 'name')->ignore($attributes['id'])->whereNUll('deleted_at')],
|
||||
'type' => ['required', 'in:0,2,3'],
|
||||
'carrier_operator' => ['required', 'in:0,1,2,3'],
|
||||
'package_type' => ['required', 'numeric'],
|
||||
'cost_price' => ['numeric', 'min:0'],
|
||||
'guide_price' => ['numeric', 'min:0'],
|
||||
'flows' => ['numeric', 'min:0'],
|
||||
@ -103,6 +104,8 @@ class PackageService extends Service
|
||||
'type.in' => '套餐类型不合法',
|
||||
'carrier_operator.required' => '请选择运营商',
|
||||
'carrier_operator.in' => '运营商不合法',
|
||||
'package_type.required' => '请选择套餐类型',
|
||||
'package_type.numeric' => '套餐类型不合法',
|
||||
'cost_price.numeric' => '套餐价格必须是数字',
|
||||
'guide_price.numeric' => '套餐指导价格必须是数字',
|
||||
'flows.numeric' => '套餐指导价格必须是数字',
|
||||
|
@ -14,6 +14,7 @@ use App\Models\PackageBase;
|
||||
* @property string $name 套餐名称
|
||||
* @property int $type 套餐类型(0:基础套餐 1:续费包 2:加油包)
|
||||
* @property int $carrier_operator 运营商(0:联通 1:移动 2:电信)
|
||||
* @property int $package_type 套餐类型(0:A类套餐 1:B类套餐 2:C类套餐 3:D类套餐)
|
||||
* @property int $cost_price 成本价格
|
||||
* @property int $guide_price 指导价格
|
||||
* @property int $flows 套餐流量(M)
|
||||
@ -71,6 +72,7 @@ class Package extends PackageBase
|
||||
'name',
|
||||
'type',
|
||||
'carrier_operator',
|
||||
'package_type',
|
||||
'cost_price',
|
||||
'guide_price',
|
||||
'flows',
|
||||
|
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddPackageTypeToVirtualPackages extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('virtual_packages', function (Blueprint $table) {
|
||||
$table->tinyInteger('package_type')->unsigned()->default(0)->comment('套餐类型(0:A类套餐 1:B类套餐 2:C类套餐 3:D类套餐)')->after('type');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('virtual_packages');
|
||||
}
|
||||
}
|
@ -46,6 +46,17 @@
|
||||
</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">
|
||||
<Select v-model="params.package_type">
|
||||
<Option :value="k" v-for="(v, k) in settings.package_type" :key="k">{{v}}</Option>
|
||||
</Select>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="ui-list">
|
||||
<div class="ui-list-title">
|
||||
<span class="title-require">*</span>重置周期
|
||||
@ -97,28 +108,28 @@
|
||||
<li class="ui-list" v-if="[0, 2].indexOf(type) !== -1">
|
||||
<div class="ui-list-title">后向套餐</div>
|
||||
<div class="ui-list-content">
|
||||
<Switch :false-value="0" :true-value="1" v-model="params.flowed"/>
|
||||
<Switch :false-value="0" :true-value="1" v-model="params.flowed" />
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="ui-list" v-if="type">
|
||||
<div class="ui-list-title">立即生效</div>
|
||||
<div class="ui-list-content">
|
||||
<Switch :false-value="1" :true-value="0" v-model="params.effect_months"/>
|
||||
<Switch :false-value="1" :true-value="0" v-model="params.effect_months" />
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="ui-list">
|
||||
<div class="ui-list-title">LBS服务</div>
|
||||
<div class="ui-list-content">
|
||||
<Switch :false-value="0" :true-value="1" v-model="params.has_lbs"/>
|
||||
<Switch :false-value="0" :true-value="1" v-model="params.has_lbs" />
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="ui-list">
|
||||
<div class="ui-list-title">短信服务</div>
|
||||
<div class="ui-list-content">
|
||||
<Switch :false-value="0" :true-value="1" v-model="params.has_messages"/>
|
||||
<Switch :false-value="0" :true-value="1" v-model="params.has_messages" />
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
@ -11,7 +11,12 @@
|
||||
</li>
|
||||
<li class="f-r">
|
||||
<div class="handle-item">
|
||||
<Button @click="openEdit(true, null)" icon="md-add" type="primary" v-if="hasPermission('create')">添加套餐</Button>
|
||||
<Button
|
||||
@click="openEdit(true, null)"
|
||||
icon="md-add"
|
||||
type="primary"
|
||||
v-if="hasPermission('create')"
|
||||
>添加套餐</Button>
|
||||
</div>
|
||||
|
||||
<div class="handle-item">
|
||||
@ -97,6 +102,7 @@
|
||||
|
||||
<ui-edit
|
||||
:type="type"
|
||||
:settings="editObj.settings"
|
||||
:data="editObj.data"
|
||||
:show.sync="editObj.show"
|
||||
@add-success="index"
|
||||
|
@ -15,6 +15,12 @@ export default {
|
||||
default() {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
settings: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
@ -27,6 +33,7 @@ export default {
|
||||
sn: '',
|
||||
name: '',
|
||||
carrier_operator: 255,
|
||||
package_type: 255,
|
||||
cost_price: 0,
|
||||
guide_price: 0,
|
||||
flows: 0,
|
||||
@ -74,6 +81,12 @@ export default {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (this.params.package_type === 255) {
|
||||
this.$Message.info('请选择套餐类型');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.params.reset_months) {
|
||||
this.$Message.info('请输入重置周期');
|
||||
return;
|
||||
@ -132,7 +145,7 @@ export default {
|
||||
},
|
||||
|
||||
clear() {
|
||||
let strKeys = ['sn', 'name', 'carrier_operator', 'description'];
|
||||
let strKeys = ['sn', 'name', 'carrier_operator', 'package_type', 'description'];
|
||||
for (let k in this.params) {
|
||||
if (strKeys.indexOf(k) === -1) {
|
||||
this.params[k] = 0;
|
||||
@ -140,7 +153,6 @@ export default {
|
||||
this.params[k] = '';
|
||||
}
|
||||
}
|
||||
|
||||
this.my_show = false;
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,6 @@
|
||||
import * as API from "api/virtual/packages";
|
||||
import * as propsAPI from 'api/virtual/properties';
|
||||
|
||||
export default {
|
||||
name: "Companies",
|
||||
components: {
|
||||
@ -195,7 +197,6 @@ export default {
|
||||
"该套餐已被删除"
|
||||
);
|
||||
}
|
||||
|
||||
if (this.haveJurisdiction("update")) {
|
||||
html.push(
|
||||
h(
|
||||
@ -260,17 +261,48 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
settingsData: {
|
||||
package_type: []
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
window.vmt = this;
|
||||
|
||||
this.type = Number(this.$route.params.type);
|
||||
|
||||
if (this.type == 0) {
|
||||
this.settings();
|
||||
}
|
||||
|
||||
this.index(1);
|
||||
},
|
||||
mounted() {
|
||||
if (this.type == 0) {
|
||||
this.table_titles.splice(5, 0, {
|
||||
title: "套餐类型",
|
||||
key: "",
|
||||
width: 100,
|
||||
render: (h, { row, column, index }) => {
|
||||
let text = this.settingsData.package_type;
|
||||
return h(
|
||||
"Button",
|
||||
{
|
||||
props: {
|
||||
type: "primary",
|
||||
size: "small"
|
||||
}
|
||||
},
|
||||
text[row.package_type]
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (this.type !== 3) {
|
||||
this.table_titles.splice(7, 0, {
|
||||
title: "套餐类型",
|
||||
title: "流量套餐",
|
||||
key: "",
|
||||
width: 100,
|
||||
render: (h, { row, column, index }) => {
|
||||
@ -332,7 +364,8 @@ export default {
|
||||
openEdit(bool, data = null) {
|
||||
this.editObj = {
|
||||
show: bool,
|
||||
data
|
||||
data,
|
||||
settings: this.settingsData
|
||||
};
|
||||
},
|
||||
|
||||
@ -361,6 +394,15 @@ export default {
|
||||
}
|
||||
this.trashed = null;
|
||||
this.index(1);
|
||||
},
|
||||
settings() {
|
||||
if (!this.settingsData.length) {
|
||||
propsAPI.settings().then(res => {
|
||||
if (res.code === 0) {
|
||||
this.settingsData = res.data;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
2
public/css/chunk-42b3944b.68383367.css
Normal file
2
public/css/chunk-42b3944b.68383367.css
Normal file
File diff suppressed because one or more lines are too long
1
public/js/app.b1531160.js
Normal file
1
public/js/app.b1531160.js
Normal file
File diff suppressed because one or more lines are too long
8
public/js/chunk-42b3944b.ac4a95ce.js
Normal file
8
public/js/chunk-42b3944b.ac4a95ce.js
Normal file
File diff suppressed because one or more lines are too long
@ -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-1a1a22d5.6166dab5.css rel=prefetch><link href=/css/chunk-42b3944b.61692546.css rel=prefetch><link href=/js/chunk-1a1a22d5.09fd5492.js rel=prefetch><link href=/js/chunk-29ecfeab.2fbfdf81.js rel=prefetch><link href=/js/chunk-42b3944b.e893f97d.js rel=prefetch><link href=/js/chunk-5b684432.422b14b3.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.e8b91011.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.e8b91011.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-1a1a22d5.6166dab5.css rel=prefetch><link href=/css/chunk-42b3944b.68383367.css rel=prefetch><link href=/js/chunk-1a1a22d5.09fd5492.js rel=prefetch><link href=/js/chunk-29ecfeab.2fbfdf81.js rel=prefetch><link href=/js/chunk-42b3944b.ac4a95ce.js rel=prefetch><link href=/js/chunk-5b684432.422b14b3.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.b1531160.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.b1531160.js></script></body></html>
|
Loading…
x
Reference in New Issue
Block a user