卡详情
This commit is contained in:
parent
bb7a17faff
commit
6db0d98a1c
@ -42,8 +42,9 @@ class OrderService extends Service
|
|||||||
$res = $this->orderRepository->withConditions($conditions)->applyConditions()->paginate($limit);
|
$res = $this->orderRepository->withConditions($conditions)->applyConditions()->paginate($limit);
|
||||||
|
|
||||||
if (!$res->isEmpty()) {
|
if (!$res->isEmpty()) {
|
||||||
$cards = $this->orderCardPartitionRepository->selectRaw('order_id,SUM(counts) as counts')
|
$cards = $this->orderCardPartitionRepository->selectRaw('order_id,SUM(counts) as counts, SUM(CASE virtual_order_id WHEN 0 THEN 0 ELSE counts END) as shipments')
|
||||||
->withConditions(['order_id', $res->pluck('id')->toArray()])->where('virtual_order_id', '<>', 0)->groupBy('order_id')->get()->pluck('counts', 'order_id')->toArray();
|
->withConditions(['order_id', $res->pluck('id')->toArray()])
|
||||||
|
->groupBy('order_id')->get()->keyBy('order_id')->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
$res->map(function ($item) use ($carrierOperators, $cards) {
|
$res->map(function ($item) use ($carrierOperators, $cards) {
|
||||||
@ -55,7 +56,8 @@ class OrderService extends Service
|
|||||||
$item->carrier_operator_name = $carrierOperators[$item->carrier_operator];
|
$item->carrier_operator_name = $carrierOperators[$item->carrier_operator];
|
||||||
$item->unit_price = sprintf('%.02f', $item->unit_price/100);
|
$item->unit_price = sprintf('%.02f', $item->unit_price/100);
|
||||||
$item->total_price = sprintf('%.02f', $item->total_price/100);
|
$item->total_price = sprintf('%.02f', $item->total_price/100);
|
||||||
$item->shipments = $cards[$item->id] ?? 0;
|
$item->shipments = $cards[$item->id]['shipments'] ?? 0;
|
||||||
|
$item->counts = $cards[$item->id]['counts'] ?? 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
return $res->sortByDesc('order_at')->values();
|
return $res->sortByDesc('order_at')->values();
|
||||||
@ -73,10 +75,10 @@ class OrderService extends Service
|
|||||||
ini_set('memory_limit', '4096m');
|
ini_set('memory_limit', '4096m');
|
||||||
ini_set('default_socket_timeout', -1);
|
ini_set('default_socket_timeout', -1);
|
||||||
|
|
||||||
$counts = $this->orderCardPartitionRepository->withConditions($conditions)->count();
|
$counts = $this->orderCardPartitionRepository->withConditions($conditions)->sum('counts');
|
||||||
|
|
||||||
if ($counts > 100000) {
|
if ($counts > 50000) {
|
||||||
throw new NotAllowedException("当前请求总卡量为{$counts}张,数据量过大,请筛选过滤后查询");
|
throw new NotAllowedException("当前请求数据量过大,请筛选过滤后查询");
|
||||||
}
|
}
|
||||||
|
|
||||||
$cards = $this->orderCardPartitionRepository->withVirtual($conditions)->get();
|
$cards = $this->orderCardPartitionRepository->withVirtual($conditions)->get();
|
||||||
|
@ -165,4 +165,18 @@ class OrderController extends Controller
|
|||||||
|
|
||||||
return res(true, '重置成功');
|
return res(true, '重置成功');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卡清单.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function cards()
|
||||||
|
{
|
||||||
|
$conditions = $this->request->all();
|
||||||
|
|
||||||
|
$cards = $this->orderService->cards($conditions);
|
||||||
|
|
||||||
|
return res($cards, '卡清单');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,7 @@ $router->group(['prefix' => 'virtual', 'as' => 'virtual', 'middleware' => ['admi
|
|||||||
$router->post('/orders/update/{id}', ['as' => 'orders.update', 'uses' => 'OrderController@update']);
|
$router->post('/orders/update/{id}', ['as' => 'orders.update', 'uses' => 'OrderController@update']);
|
||||||
$router->post('/orders/destroy', ['as' => 'orders.destroy', 'uses' => 'OrderController@destroy']);
|
$router->post('/orders/destroy', ['as' => 'orders.destroy', 'uses' => 'OrderController@destroy']);
|
||||||
$router->post('/orders/reset', ['as' => 'orders.reset', 'uses' => 'OrderController@reset']);
|
$router->post('/orders/reset', ['as' => 'orders.reset', 'uses' => 'OrderController@reset']);
|
||||||
|
$router->get('/orders/cards', ['as' => 'orders.cards', 'uses' => 'OrderController@cards']);
|
||||||
|
|
||||||
// 客户管理
|
// 客户管理
|
||||||
$router->get('/cards/index', ['as' => 'cards.index', 'uses' => 'CardController@index']);
|
$router->get('/cards/index', ['as' => 'cards.index', 'uses' => 'CardController@index']);
|
||||||
|
@ -424,4 +424,19 @@ class OrderService extends Service
|
|||||||
|
|
||||||
return intval($transactionNo);
|
return intval($transactionNo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单卡查询
|
||||||
|
*
|
||||||
|
* @param array $conditions
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function cards(array $conditions = [])
|
||||||
|
{
|
||||||
|
$conditions['limit'] = $conditions['limit'] ?? 20;
|
||||||
|
|
||||||
|
$cards = $this->orderCardPartitionRepository->select(['sim'])->withConditions($conditions)->orderBy('sim')->paginate($conditions['limit']);
|
||||||
|
|
||||||
|
return $cards;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,16 @@ export function show(id) {
|
|||||||
return service.get(`api/virtual/orders/show/${id}`);
|
return service.get(`api/virtual/orders/show/${id}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [cards 卡清单列表]
|
||||||
|
* @param {[type]} data [description]
|
||||||
|
* @return {[type]} [description]
|
||||||
|
*/
|
||||||
|
export function cards(data) {
|
||||||
|
return service.get('api/virtual/orders/cards', {
|
||||||
|
params: data
|
||||||
|
});
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* [create 创建订单]
|
* [create 创建订单]
|
||||||
* @param {[type]} data [description]
|
* @param {[type]} data [description]
|
||||||
|
@ -146,6 +146,22 @@
|
|||||||
<div class="ui-list-content">{{data.logistics_no}}</div>
|
<div class="ui-list-content">{{data.logistics_no}}</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
<Divider>出库卡清单</Divider>
|
||||||
|
<Table :columns="columns" :data="cards" :loading="loading"></Table>
|
||||||
|
|
||||||
|
<Row justify="center" class="umar-tb10 ta-c">
|
||||||
|
<Page
|
||||||
|
:current="Number(page.page)"
|
||||||
|
:page-size="Number(page.limit)"
|
||||||
|
:page-size-opts="[15, 30, 60, 90]"
|
||||||
|
:total="Number(page.total)"
|
||||||
|
@on-change="changePage"
|
||||||
|
@on-page-size-change="changeLimit"
|
||||||
|
show-total
|
||||||
|
size="small"
|
||||||
|
></Page>
|
||||||
|
</Row>
|
||||||
</div>
|
</div>
|
||||||
</Drawer>
|
</Drawer>
|
||||||
</template>
|
</template>
|
||||||
|
@ -25,10 +25,8 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
filterTotal() {
|
filterTotal() {
|
||||||
return this.filterOrders.filter(el => {
|
return this.filterOrders.reduce((acc, cur) => {
|
||||||
return el.shipments !== el.counts;
|
return acc + cur.counts - cur.shipments;
|
||||||
}).reduce((acc, cur) => {
|
|
||||||
return acc + cur.counts;
|
|
||||||
}, 0);
|
}, 0);
|
||||||
},
|
},
|
||||||
total() {
|
total() {
|
||||||
@ -605,6 +603,10 @@ export default {
|
|||||||
return item.id;
|
return item.id;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (this.filterTotal > 50000) {
|
||||||
|
return this.$Message.error('当前请求数据量过大,请筛选过滤后查询');
|
||||||
|
}
|
||||||
|
|
||||||
this.handleSelectOrder(order_id, true);
|
this.handleSelectOrder(order_id, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import * as API from 'api/virtual/orders';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
show: {
|
show: {
|
||||||
@ -14,14 +16,80 @@ export default{
|
|||||||
watch: {
|
watch: {
|
||||||
show(bool) {
|
show(bool) {
|
||||||
this.my_show = bool;
|
this.my_show = bool;
|
||||||
|
if (bool) {
|
||||||
|
this.index(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
my_show: false
|
loading: false,
|
||||||
|
my_show: false,
|
||||||
|
page: {
|
||||||
|
total: 0,
|
||||||
|
page: 1,
|
||||||
|
limit: 15
|
||||||
|
},
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
title: "SIM卡号",
|
||||||
|
key: "column1",
|
||||||
|
align: 'center'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "SIM卡号",
|
||||||
|
key: "column2",
|
||||||
|
align: 'center'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "SIM卡号",
|
||||||
|
key: "column3",
|
||||||
|
align: 'center'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
cards: []
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
index() {
|
||||||
|
let params = {
|
||||||
|
page: this.page.page,
|
||||||
|
limit: this.page.limit,
|
||||||
|
order_id: this.data.id
|
||||||
|
};
|
||||||
|
|
||||||
|
this.loading = true;
|
||||||
|
API.cards(params).then(res => {
|
||||||
|
this.loading = false;
|
||||||
|
if (res.code === 0) {
|
||||||
|
this.page.total = res.data.total;
|
||||||
|
|
||||||
|
let cards = res.data.data;
|
||||||
|
|
||||||
|
let array = [];
|
||||||
|
|
||||||
|
for (let index = 0; index < cards.length; index = index + 3) {
|
||||||
|
array.push({
|
||||||
|
column1: cards[index] ? cards[index]['sim'] : '',
|
||||||
|
column2: cards[index + 1] ? cards[index + 1]['sim'] : '',
|
||||||
|
column3: cards[index + 2] ? cards[index + 2]['sim'] : ''
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
this.cards = array;
|
||||||
|
|
||||||
|
console.log(this.cards);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
changePage(page) {
|
||||||
|
this.page.page = page;
|
||||||
|
this.index();
|
||||||
|
},
|
||||||
|
changeLimit(limit) {
|
||||||
|
this.page.limit = limit;
|
||||||
|
this.changePage(1);
|
||||||
|
},
|
||||||
visibleChange(bool) {
|
visibleChange(bool) {
|
||||||
this.$emit('update:show', bool);
|
this.$emit('update:show', bool);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user