This commit is contained in:
邓皓元 2019-02-11 18:26:30 +08:00
parent 3dcfce36ea
commit a39e984aa0
11 changed files with 24 additions and 10 deletions

View File

@ -51,6 +51,7 @@ class OrderDetailExport extends AbstractExport implements FromQuery, WithHeading
'套餐周期', '套餐周期',
'支付方式', '支付方式',
'价格', '价格',
'数量',
'订单时间', '订单时间',
]; ];
} }
@ -73,6 +74,7 @@ class OrderDetailExport extends AbstractExport implements FromQuery, WithHeading
$item['service_months'], $item['service_months'],
$item['pay_channel_name'], $item['pay_channel_name'],
$item['unit_price'], $item['unit_price'],
$item['counts'],
$item['order_at'], $item['order_at'],
]; ];
}); });

View File

@ -64,7 +64,7 @@ class OrderService extends Service
$orders = $this->orderRepository->select($select)->withConditions($conditions)->applyConditions() $orders = $this->orderRepository->select($select)->withConditions($conditions)->applyConditions()
->groupBy(['company_id', 'package_id', 'product_id', 'unit_price', 'pay_channel'])->paginate($conditions['limit']); ->groupBy(['company_id', 'package_id', 'product_id', 'unit_price', 'pay_channel'])->paginate($conditions['limit']);
$orders->map(function ($item) use ($companies, $packages) { $orders->map(function ($item) use ($companies, $packages) {
$item->unit_price = sprintf('%.02f', $item->unit_price/100); $item->unit_price = sprintf('%.02f', $item->unit_price/100);
$item->custom_price = sprintf('%.02f', $item->custom_price/100); $item->custom_price = sprintf('%.02f', $item->custom_price/100);

View File

@ -21,7 +21,8 @@ BEGIN
virtual_order_cards_partition.created_at, virtual_order_cards_partition.created_at,
virtual_packages.service_months, virtual_packages.service_months,
virtual_packages.effect_months, virtual_packages.effect_months,
virtual_packages.delay_months virtual_packages.delay_months,
virtual_order_cards_partition.counts
FROM FROM
vd.virtual_order_cards_partition vd.virtual_order_cards_partition
JOIN vd.virtual_packages ON virtual_order_cards_partition.package_id = virtual_packages."id" JOIN vd.virtual_packages ON virtual_order_cards_partition.package_id = virtual_packages."id"
@ -112,7 +113,7 @@ DECLARE
BEGIN BEGIN
timelines_json := vd.TIMELINES_JSON(sim); timelines_json := vd.TIMELINES_JSON(sim);
FOR item IN SELECT * FROM json_array_elements(timelines_json::JSON) LOOP FOR item IN SELECT * FROM json_array_elements(timelines_json::JSON) LOOP
IF item->>'id'::INT = id THEN IF (item->>'id')::INT = id THEN
temp_months = (TO_CHAR((item->>'service_end_at')::TIMESTAMP, 'YYYY')::INT - TO_CHAR((item->>'service_start_at')::TIMESTAMP, 'YYYY')::INT) * 12 temp_months = (TO_CHAR((item->>'service_end_at')::TIMESTAMP, 'YYYY')::INT - TO_CHAR((item->>'service_start_at')::TIMESTAMP, 'YYYY')::INT) * 12
+ (TO_CHAR((item->>'service_end_at')::TIMESTAMP, 'MM')::INT - TO_CHAR((item->>'service_start_at')::TIMESTAMP, 'MM')::INT); + (TO_CHAR((item->>'service_end_at')::TIMESTAMP, 'MM')::INT - TO_CHAR((item->>'service_start_at')::TIMESTAMP, 'MM')::INT);
i := 0; i := 0;

View File

@ -61,6 +61,11 @@ export default {
key: 'unit_price', key: 'unit_price',
width: 120 width: 120
}, },
{
title: '数量',
key: 'counts',
width: 75
},
{ {
title: '订单时间', title: '订单时间',
key: 'order_at', key: 'order_at',

View File

@ -77,9 +77,9 @@ INSERT INTO virtual_orders ("type", sn, "source", company_id, package_id, produc
MIN(product_id), MIN(product_id),
MIN(pay_channel), MIN(pay_channel),
MIN(unit_price), MIN(unit_price),
COUNT(*) AS counts, SUM(counts) AS counts,
MIN(unit_price) * COUNT(*) AS total_price, MIN(unit_price) * SUM(counts) AS total_price,
MIN(unit_price) * COUNT(*) AS custom_price, MIN(unit_price) * SUM(counts) AS custom_price,
MIN(created_at) AS order_at, MIN(created_at) AS order_at,
4, 4,
1, 1,

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-7b1dff40.ca5cf5af.css rel=prefetch><link href=/js/chunk-00ae0766.9e6b7bf3.js rel=prefetch><link href=/js/chunk-7b1dff40.5edb4c7e.js rel=prefetch><link href=/css/app.36043160.css rel=preload as=style><link href=/css/chunk-vendors.3c3b2e85.css rel=preload as=style><link href=/js/app.254f6ec9.js rel=preload as=script><link href=/js/chunk-vendors.02a4e5bc.js rel=preload as=script><link href=/css/chunk-vendors.3c3b2e85.css rel=stylesheet><link href=/css/app.36043160.css rel=stylesheet></head><body><noscript><strong>很抱歉如果没有启用JavaScript程序不能正常工作若要继续使用请启用它。</strong></noscript><div id=app></div><script src=/js/chunk-vendors.02a4e5bc.js></script><script src=/js/app.254f6ec9.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-7b1dff40.ca5cf5af.css rel=prefetch><link href=/js/chunk-00ae0766.9e6b7bf3.js rel=prefetch><link href=/js/chunk-7b1dff40.bf6341a0.js rel=prefetch><link href=/css/app.36043160.css rel=preload as=style><link href=/css/chunk-vendors.3c3b2e85.css rel=preload as=style><link href=/js/app.6cdb2633.js rel=preload as=script><link href=/js/chunk-vendors.02a4e5bc.js rel=preload as=script><link href=/css/chunk-vendors.3c3b2e85.css rel=stylesheet><link href=/css/app.36043160.css rel=stylesheet></head><body><noscript><strong>很抱歉如果没有启用JavaScript程序不能正常工作若要继续使用请启用它。</strong></noscript><div id=app></div><script src=/js/chunk-vendors.02a4e5bc.js></script><script src=/js/app.6cdb2633.js></script></body></html>

View File

@ -20,7 +20,7 @@ class PostgresGrammar extends Grammar
public function compileUpdateBatch(QueryBuilder $query, array $values, $filed = 'id') public function compileUpdateBatch(QueryBuilder $query, array $values, $filed = 'id')
{ {
$as = 'as_table'; $as = 'as_table';
$table = $this->wrapTable($query->from); $table = $this->wrapTable($query->from);
if (! is_array(reset($values))) { if (! is_array(reset($values))) {
@ -85,7 +85,7 @@ class PostgresGrammar extends Grammar
$field = "COALESCE($field, '1970-01-01 08:00:00'::timestamp)"; $field = "COALESCE($field, '1970-01-01 08:00:00'::timestamp)";
} }
} }
$reference = implode(',', $fields); $reference = implode(',', $fields);
// excluded fields are all fields except $unique one that will be updated // excluded fields are all fields except $unique one that will be updated
@ -105,7 +105,7 @@ class PostgresGrammar extends Grammar
$update = join(', ', array_map(function ($e) { $update = join(', ', array_map(function ($e) {
return "\"$e\" = \"excluded\".\"$e\""; return "\"$e\" = \"excluded\".\"$e\"";
}, $excluded)); }, $excluded));
return "$insert on conflict ($reference) do update set $update"; return "$insert on conflict ($reference) do update set $update";
} }
} }