Browse Source

订单列表优化

dev
nizongfeng 3 years ago
parent
commit
96f306c856
4 changed files with 145 additions and 14 deletions
  1. +18
    -0
      application/admin/dao/OrderHotelDao.php
  2. +18
    -0
      application/admin/dao/OrderItemDao.php
  3. +34
    -1
      application/admin/service/OrderMainService.php
  4. +75
    -13
      application/admin/view/order_main/index.html

+ 18
- 0
application/admin/dao/OrderHotelDao.php View File

@@ -319,4 +319,22 @@ class OrderHotelDao
return [];
}
}

/**
* 获取订单列表
* @param $orderIds
* @return array
*/
public function getOrderListByOrderIds($orderIds){
$subOrderModel = new OrderHotel();
try {
$subOrderList = $subOrderModel->where(["order_id" => ["in",$orderIds], "del_flag" => 0])->select()->toArray();
if (null == $subOrderList) {
return [];
}
return $subOrderList;
}catch (Exception $e) {
return [];
}
}
}

+ 18
- 0
application/admin/dao/OrderItemDao.php View File

@@ -269,4 +269,22 @@ class OrderItemDao
return [];
}
}

/**
* 获取订单列表
* @param $orderIds
* @return array
*/
public function getOrderListByOrderIds($orderIds){
$subOrderModel = new OrderItem();
try {
$subOrderList = $subOrderModel->where(["order_id" => ["in",$orderIds], "del_flag" => 0])->select()->toArray();
if (null == $subOrderList) {
return [];
}
return $subOrderList;
}catch (Exception $e) {
return [];
}
}
}

+ 34
- 1
application/admin/service/OrderMainService.php View File

@@ -327,6 +327,39 @@ class OrderMainService
if ($param['channel_order_no'] != '') {
$where['channel_order_no'] = $param['channel_order_no'];
}
return $orderMainDao->getOrderListByWhere($where,$param);
$result = $orderMainDao->getOrderListByWhere($where,$param);
if (!$result['flag'] || $result['data']['total']==0) {
return $result;
}
//获取主订单ID
$ids = [];
foreach ($result['data']['list'] as $info){
$ids[] = $info['id'];
}
//获取子订单列表
$orderHotelDao = new OrderHotelDao();
$orderItemDao = new OrderItemDao();
$orderHotelList = $orderHotelDao->getOrderListByOrderIds($ids);
$orderItemList = $orderItemDao->getOrderListByOrderIds($ids);
//设置主订单列表
$orderMainList = [];
foreach ($result['data']['list'] as $order) {
$order['subOrder']=[];
foreach ($orderHotelList as $hotel){
if ($hotel['order_id'] == $order['id']) {
$hotel["type"]="酒店";
$order['subOrder'][] = $hotel;
}
}
foreach ($orderItemList as $item){
if ($item['order_id'] == $order['id']) {
$item["type"]="附加项目";
$order['subOrder'][] = $item;
}
}
$orderMainList[] = $order;
}
$result['data']['list'] = $orderMainList;
return $result;
}
}

+ 75
- 13
application/admin/view/order_main/index.html View File

@@ -113,29 +113,62 @@
<template slot-scope="scope">
<div v-html="'金额:'+scope.row.total_amount"></div>
<div v-html="'成本:'+scope.row.cost_amount"></div>
<div v-html="'利润:'+scope.row.profit_amount"></div>
</template>
</el-table-column>
<el-table-column prop="order_status" label="状态" min-width="40" :formatter="getOrderMainStatus"></el-table-column>
<el-table-column prop="create_time" label="下单时间" min-width="80" ></el-table-column>
<el-table-column prop="create_time" label="结束时间" min-width="90" >
<el-table-column prop="create_time" label="时间" min-width="100" >
<template slot-scope="scope">
<div v-if="scope.row.success_time"><i class="el-icon-success" v-html="scope.row.success_time"></i></div>
<div v-if="scope.row.cancel_time"><i class="el-icon-delete-solid" v-html="scope.row.cancel_time"></i></div>
<div ><i v-html="'下单:'+scope.row.create_time"></i></div>
<div v-if="scope.row.success_time"><i v-html="'成功:'+scope.row.success_time"></i></div>
<div v-if="scope.row.cancel_time"><i v-html="'结束:'+scope.row.cancel_time"></i></div>
</template>
</el-table-column>
<el-table-column prop="receipt_order_name" label="收款单" min-width="80" >
<el-table-column prop="receipt_order_name" label="收款单" min-width="100" >
<template slot-scope="scope">
<div v-if="scope.row.receipt_order_id!=0">
<div v-html="scope.row.receipt_order_id"></div>
<div v-html="scope.row.receipt_order_name"></div>
<div v-html="'ID:'+scope.row.receipt_order_id"></div>
<div v-html="'NAME:'+scope.row.receipt_order_name"></div>
<div v-html="'状态:'+getReceiptOrderStatus(scope.row)" ></div>
</div>
</template>
</el-table-column>
<el-table-column prop="receipt_order_status" label="收款单状态" min-width="50" :formatter="getReceiptOrderStatus">
<el-table-column label="子订单" type="expand">
<template slot-scope="scope">
<div v-if="scope.row.receipt_order_id!=0" >
<div v-html="getReceiptOrderStatus(scope.row)" ></div>
</div>
<el-table ref="multipleTable" :data="scope.row.subOrder" border tooltip-effect="dark"
style="font-size:12px;width: 94%;margin-left: 2%;margin-right: 4%">
<el-table-column prop="id" label="订单ID" min-width="30" ></el-table-column>
<el-table-column prop="type" label="类型" min-width="30" ></el-table-column>
<el-table-column label="名称" min-width="80" >
<template slot-scope="prop">
<div v-if="prop.row.type=='酒店'" v-html="prop.row.hotel_name"></div>
<div v-if="prop.row.type=='附加项目'" v-html="prop.row.item_name"></div>
</template>
</el-table-column>
<el-table-column prop="trade_order_number" label="第三方订单号" min-width="50" ></el-table-column>
<el-table-column prop="total_price" label="金额" min-width="30" ></el-table-column>
<el-table-column prop="total_cost" label="成本" min-width="30" ></el-table-column>
<el-table-column prop="prod_num" label="数量" min-width="20" ></el-table-column>
<el-table-column prop="customer_name" label="出游人姓名" min-width="40" ></el-table-column>
<el-table-column label="发单状态" min-width="30" :formatter="confirmStatusName"></el-table-column>
<el-table-column prop="create_time" label="子订单生成时间" min-width="60" ></el-table-column>
<el-table-column prop="payment_order_name" label="付款单" min-width="40" >
<template slot-scope="scope">
<div v-if="scope.row.payment_order_id" v-html="scope.row.payment_order_id"></div>
<div v-if="scope.row.payment_order_id" v-html="scope.row.payment_order_name"></div>
</template>
</el-table-column>
<el-table-column label="付款单状态" min-width="40" :formatter="paymentOrderStatus" ></el-table-column>
<el-table-column prop="id" label="时间" min-width="30" >
<template slot-scope="prop">
<div v-if="prop.row.type=='酒店'" >
<div v-html="prop.row.check_in_date"></div>
<div v-html="prop.row.check_out_date"></div>
</div>
<div v-if="prop.row.type=='附加项目'" v-html="prop.row.check_in_date"></div>
</template>
</el-table-column>
</el-table>
</template>
</el-table-column>
<el-table-column prop="receipt_order_name" label="备注" min-width="80" >
@@ -257,8 +290,18 @@
],
userList: [],
channelList:[],
multipleSelection: []

multipleSelection: [],
confirmStatusList:[
{id:1,name:"未发单"},
{id:2,name:"已发单"},
{id:3,name:"已确认"},
{id:4,name:"已取消"}
],
paymentOrderStatusList:[
{"id": 0, 'value': "未付款"},
{"id": 1, 'value': "付款中"},
{"id": 2, 'value': "已付款"}
]
}
},
created() {
@@ -320,6 +363,25 @@
},
},
methods: {
paymentOrderStatus(info){
if (info.payment_order_id ==0) {
return "-"
}
for (let i = 0; i < this.paymentOrderStatusList.length; i++) {
if (this.paymentOrderStatusList[i].id == info.payment_order_status) {
return this.paymentOrderStatusList[i].value
}
}
return "-"
},
confirmStatusName(info){
for (let i = 0; i < this.confirmStatusList.length; i++) {
if (this.confirmStatusList[i].id == info.confirm_status) {
return this.confirmStatusList[i].name
}
}
return "-"
},
getReceiptOrderStatus(info){
for (let i = 0; i < this.receiptStatus.length; i++) {
if (this.receiptStatus[i].id == info.receipt_order_status) {


Loading…
Cancel
Save