套餐类型

This commit is contained in:
邓皓元 2019-03-29 09:36:49 +08:00
parent e9c34ae95d
commit e40d67fd0c
11 changed files with 77 additions and 19 deletions

View File

@ -81,6 +81,10 @@ class PackageRepository extends Repository
$this->model = $this->model->where('status', $conditions['status']);
}
if (isset($conditions['flowed'])) {
$this->model = $this->model->where('flowed', $conditions['flowed']);
}
return $this;
}
}

View File

@ -19,8 +19,6 @@ class CreateVirtualOrderCardsTables extends Migration
return;
}
DB::unprepared(File::get(__DIR__ . '/create_virtual_order_cards_func.pgsql'));
Schema::create('virtual_order_cards_partition', function (Blueprint $table) {
$table->increments('id')->comment('自增ID');
$table->tinyInteger('type')->unsigned()->default(0)->comment('订单类型0:基础套餐 1:套餐续费 2续费包 3:加油包 4:可选包 5:附加包)');
@ -70,6 +68,8 @@ class CreateVirtualOrderCardsTables extends Migration
$table->index(['type', 'company_id', 'package_id', 'unit_price']);
$table->index(['service_start_at', 'service_end_at']);
});
DB::unprepared(File::get(__DIR__ . '/create_virtual_order_cards_func.pgsql'));
}
/**

View File

@ -10,7 +10,7 @@ CREATE OR REPLACE VIEW real_virtual_relations AS
FROM real_order_cards_partition as r
JOIN virtual_order_cards as v ON v.id = r.virtual_order_id
WHERE r.virtual_order_id <> 0
GROUP BY r.type,r.company_id,r.package_id,v.company_id,v.package_id
GROUP BY r.type,r.company_id,r.package_id,v.company_id,v.package_id;
CREATE OR REPLACE FUNCTION GET_TIMELINES(INT8[])
RETURNS TABLE

View File

@ -71,10 +71,10 @@ CREATE MATERIALIZED VIEW vd_old_orders AS
END AS service_end_at,
to_timestamp((ckb_custom_handle_log.create_time)::double precision) AS created_at,
count(*) AS counts
FROM ((((vd.ckb_custom_handle_log
LEFT JOIN vd.ckb_custom ON (((ckb_custom.custom_no)::text = (ckb_custom_handle_log.custom_no)::text)))
LEFT JOIN vd.virtual_companies ON ((((virtual_companies.sn)::TEXT = concat('No', lpad((ckb_custom_handle_log.company)::TEXT, 11, '0'::TEXT))) AND (virtual_companies.deleted_at IS NULL))))
LEFT JOIN vd.virtual_packages ON ((((virtual_packages.sn)::text = (ckb_custom_handle_log.content)::text) AND (virtual_packages.deleted_at IS NULL))))
FROM vd.ckb_custom_handle_log
LEFT JOIN vd.ckb_custom ON ckb_custom.custom_no = ckb_custom_handle_log.custom_no
LEFT JOIN vd.virtual_companies ON virtual_companies.sn = concat('No', lpad((ckb_custom_handle_log.company)::text, 11, '0'::text)) AND virtual_companies.deleted_at IS NULL
LEFT JOIN vd.virtual_packages ON virtual_packages.sn =ckb_custom_handle_log.content AND virtual_packages.deleted_at IS NULL
WHERE (ckb_custom_handle_log.type = ANY (ARRAY[11, 13, 14, 15]))
GROUP BY
ckb_custom_handle_log.create_time,

View File

@ -26,7 +26,7 @@
<div class="search-wrap" v-show="search.show">
<ul class="handle-wraper">
<li class="handle-item w-250">
<li class="handle-item w-200">
<Select clearable placeholder="运营商" v-model="params.carrier_operator">
<Option :value="0">联通</Option>
<Option :value="1">移动</Option>
@ -34,26 +34,40 @@
</Select>
</li>
<li class="handle-item w-250">
<li class="handle-item w-200">
<Input clearable placeholder="套餐编号" v-model.trim="params.sn"></Input>
</li>
<li class="handle-item w-250">
<AutoComplete @on-search="handleCompletePackages(type)" icon="ios-search" placeholder="套餐名称" v-model.trim="params.name">
<Option :key="item.id" :value="item.name" v-for="item in completeHandledPackages">{{ item.name }}</Option>
<li class="handle-item w-200">
<AutoComplete
@on-search="handleCompletePackages(type)"
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">
<li class="handle-item w-200">
<Select clearable placeholder="套餐状态" v-model="params.status">
<Option :value="0">已启用</Option>
<Option :value="1">已禁用</Option>
<Option :value="2">已删除</Option>
</Select>
</li>
</ul>
<ul class="handle-wraper">
<li class="handle-item w-200" v-if="type !== 3">
<Select clearable placeholder="套餐类型" v-model="params.flowed">
<Option :value="0">正向套餐</Option>
<Option :value="1">后向套餐</Option>
</Select>
</li>
<li class="f-r">
<div class="handle-item">
<Button @click="index(1)" ghost type="primary">立即搜索</Button>
@ -71,10 +85,23 @@
</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>
<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 :type="type" :data="editObj.data" :show.sync="editObj.show" @add-success="index" @update-success="index(list_data.current_page)"></ui-edit>
<ui-edit
:type="type"
:data="editObj.data"
:show.sync="editObj.show"
@add-success="index"
@update-success="index(list_data.current_page)"
></ui-edit>
</div>
</template>

View File

@ -10,7 +10,8 @@ export default {
name: '',
carrier_operator: '',
sn: '',
status: ''
status: '',
flowed: ''
},
type: 0,
trashed: null,
@ -181,6 +182,26 @@ export default {
this.type = Number(this.$route.params.type);
this.index(1);
},
mounted() {
if (this.type !== 3) {
this.table_titles.splice(7, 0, {
title: '套餐类型',
key: '',
width: 100,
render: (h, { row, column, index }) => {
let type = ['primary', 'warning'];
let text = ['正向套餐', '后向套餐'];
return h('Button', {
props: {
type: type[row.flowed],
size: 'small'
}
}, text[row.flowed]);
}
});
}
},
methods: {
/**
* [index 列表]

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-63ee4df4.78afaf5b.css rel=prefetch><link href=/css/chunk-996b1e80.5cadf3d0.css rel=prefetch><link href=/js/chunk-00ae0766.3874cd10.js rel=prefetch><link href=/js/chunk-07a274ec.c3ad5dec.js rel=prefetch><link href=/js/chunk-63ee4df4.87a99f35.js rel=prefetch><link href=/js/chunk-996b1e80.d3b45e46.js rel=prefetch><link href=/css/app.d71a8195.css rel=preload as=style><link href=/css/chunk-vendors.3c3b2e85.css rel=preload as=style><link href=/js/app.77e8188a.js rel=preload as=script><link href=/js/chunk-vendors.ed6443e8.js rel=preload as=script><link href=/css/chunk-vendors.3c3b2e85.css rel=stylesheet><link href=/css/app.d71a8195.css rel=stylesheet></head><body><noscript><strong>很抱歉如果没有启用JavaScript程序不能正常工作若要继续使用请启用它。</strong></noscript><div id=app></div><script src=/js/chunk-vendors.ed6443e8.js></script><script src=/js/app.77e8188a.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-63ee4df4.78afaf5b.css rel=prefetch><link href=/css/chunk-996b1e80.5cadf3d0.css rel=prefetch><link href=/js/chunk-00ae0766.3874cd10.js rel=prefetch><link href=/js/chunk-07a274ec.c3ad5dec.js rel=prefetch><link href=/js/chunk-63ee4df4.c7a4bc29.js rel=prefetch><link href=/js/chunk-996b1e80.d3b45e46.js rel=prefetch><link href=/css/app.d71a8195.css rel=preload as=style><link href=/css/chunk-vendors.3c3b2e85.css rel=preload as=style><link href=/js/app.7394310b.js rel=preload as=script><link href=/js/chunk-vendors.ed6443e8.js rel=preload as=script><link href=/css/chunk-vendors.3c3b2e85.css rel=stylesheet><link href=/css/app.d71a8195.css rel=stylesheet></head><body><noscript><strong>很抱歉如果没有启用JavaScript程序不能正常工作若要继续使用请启用它。</strong></noscript><div id=app></div><script src=/js/chunk-vendors.ed6443e8.js></script><script src=/js/app.7394310b.js></script></body></html>