nizongfeng пре 3 година
родитељ
комит
23623cf79a
9 измењених фајлова са 954 додато и 46 уклоњено
  1. +4
    -4
      application/admin/controller/PaymentOrder.php
  2. +22
    -2
      application/admin/service/OrderHotelDao.php
  3. +22
    -2
      application/admin/service/OrderItemDao.php
  4. +7
    -7
      application/admin/service/OrderMainDao.php
  5. +77
    -5
      application/admin/service/PaymentOrderDao.php
  6. +160
    -0
      application/admin/service/PaymentOrderService.php
  7. +1
    -1
      application/admin/service/PurchaseDao.php
  8. +660
    -24
      application/admin/view/payment_order/index.html
  9. +1
    -1
      application/admin/view/receipt_order/index.html

+ 4
- 4
application/admin/controller/PaymentOrder.php Прегледај датотеку

@@ -79,7 +79,7 @@ class PaymentOrder extends Backend
public function addOrderMain(){
$params=$this->request->post();
$service = new PaymentOrderService();
$result = $service->addOrderMain($params['id'],$params['order_id']);
$result = $service->addSubOrder($params);
return json($result);
}

@@ -90,7 +90,7 @@ class PaymentOrder extends Backend
public function removeOrderMain(){
$params=$this->request->post();
$service = new PaymentOrderService();
$result = $service->removeOrderMain($params['order_id']);
$result = $service->removeSubOrder($params);
return json($result);
}

@@ -99,10 +99,10 @@ class PaymentOrder extends Backend
* 获取订单列表
* @return \think\response\Json
*/
public function getOrderMainList(){
public function getSubOrderList(){
$params=$this->request->post();
$service = new PaymentOrderService();
$result = $service->getOrderMainList($params);
$result = $service->getSubOrderList($params);
return json($result);
}



+ 22
- 2
application/admin/service/OrderHotelDao.php Прегледај датотеку

@@ -243,7 +243,7 @@ class OrderHotelDao
* @param $orderIds
* @return array
*/
public function addOrderMainInPayment($paymentOrder,$orderIds){
public function addSubOrderInPayment($paymentOrder,$orderIds){
try{
$data = [
"payment_order_id"=>$paymentOrder['id'],
@@ -263,7 +263,7 @@ class OrderHotelDao
* @param $orderIds
* @return array
*/
public function removeOrderMainFormPayment($orderIds){
public function removeSubOrderFormPayment($orderIds){
try{
$data = [
"payment_order_id"=>0,
@@ -277,4 +277,24 @@ class OrderHotelDao
return Util::returnArrEr("将酒店订单从付款单下移除失败".$e->getMessage());
}
}

/**
* 删除采购单
* @param $id
* @return array
*/
public function delPaymentOrder($id){
try{
$data = [
"payment_order_id"=>0,
"payment_order_status"=>0,
"payment_order_name"=>""
];
$model = new OrderHotel();
$model->save($data,["payment_order_id"=>$id]);
return Util::returnArrSu();
}catch (Exception $e){
return Util::returnArrEr("将酒店订单从付款单下移除失败".$e->getMessage());
}
}
}

+ 22
- 2
application/admin/service/OrderItemDao.php Прегледај датотеку

@@ -193,7 +193,7 @@ class OrderItemDao
* @param $orderIds
* @return array
*/
public function addOrderMainInPayment($paymentOrder,$orderIds){
public function addSubOrderInPayment($paymentOrder,$orderIds){
try{
$data = [
"payment_order_id"=>$paymentOrder['id'],
@@ -213,7 +213,7 @@ class OrderItemDao
* @param $orderIds
* @return array
*/
public function removeOrderMainFormPayment($orderIds){
public function removeSubOrderFormPayment($orderIds){
try{
$data = [
"payment_order_id"=>0,
@@ -227,4 +227,24 @@ class OrderItemDao
return Util::returnArrEr("将附加项目订单从付款单下移除失败".$e->getMessage());
}
}

/**
* 删除采购单
* @param $id
* @return array
*/
public function delPaymentOrder($id){
try{
$data = [
"payment_order_id"=>0,
"payment_order_status"=>0,
"payment_order_name"=>""
];
$model = new OrderItem();
$model->save($data,["payment_order_id"=>$id]);
return Util::returnArrSu();
}catch (Exception $e){
return Util::returnArrEr("将附加项目订单从付款单下移除失败".$e->getMessage());
}
}
}

+ 7
- 7
application/admin/service/OrderMainDao.php Прегледај датотеку

@@ -143,7 +143,7 @@ class OrderMainDao
}

/**
* 更新采购单下的订单信息
* 更新收款单下的订单信息
* @param $receiptOrderId
* @param $status
* @return array
@@ -159,7 +159,7 @@ class OrderMainDao
}

/**
* 添加主订单到采购单下
* 添加主订单到收款单下
* @param $receiptOrder
* @param $orderIds
* @return array
@@ -175,12 +175,12 @@ class OrderMainDao
$model->save($data,["id"=>["in",$orderIds]]);
return Util::returnArrSu();
}catch (Exception $e){
return Util::returnArrEr("添加主订单到采购单下失败".$e->getMessage());
return Util::returnArrEr("添加主订单到收款单下失败".$e->getMessage());
}
}

/**
* 将主订单从采购单下移除
* 将主订单从收款单下移除
* @param $orderIds
* @return array
*/
@@ -195,7 +195,7 @@ class OrderMainDao
$model->save($data,["id"=>["in",$orderIds]]);
return Util::returnArrSu();
}catch (Exception $e){
return Util::returnArrEr("将主订单从采购单下移除失败".$e->getMessage());
return Util::returnArrEr("将主订单从收款单下移除失败".$e->getMessage());
}
}

@@ -218,7 +218,7 @@ class OrderMainDao
}

/**
* 删除采购
* 删除收款
* @param $id
* @return array
*/
@@ -233,7 +233,7 @@ class OrderMainDao
$model->save($data,["receipt_order_id"=>$id]);
return Util::returnArrSu();
}catch (Exception $e){
return Util::returnArrEr("将主订单从采购单下移除失败".$e->getMessage());
return Util::returnArrEr("将主订单从收款单下移除失败".$e->getMessage());
}
}
}

+ 77
- 5
application/admin/service/PaymentOrderDao.php Прегледај датотеку

@@ -11,6 +11,7 @@ namespace app\admin\service;

use app\admin\command\Util;
use app\admin\model\PaymentOrder;
use think\Db;
use think\Exception;

class PaymentOrderDao
@@ -131,16 +132,16 @@ class PaymentOrderDao
->alias("a")
->group("a.id")
->where($where)->count();

$list = $receiptOrder
->alias("a")
->join('hbp_order_hotel b', 'a.id = b.receipt_order_id', 'left')
->join('hbp_order_item c', 'a.id = c.receipt_order_id', 'left')
->field("a.*,GROUP_CONCAT(b.id ORDER BY b.id DESC) hotel_ids,sum(b.total_amount) hotel_amount,GROUP_CONCAT(c.id ORDER BY c.id DESC) hotel_ids,sum(c.total_amount) hotel_amount")
->join('hbp_order_hotel b', 'a.id = b.payment_order_id', 'left')
->join('hbp_order_item c', 'a.id = c.payment_order_id', 'left')
->field("a.*,ifnull(GROUP_CONCAT(b.id ORDER BY b.id DESC),'-') hotel_ids,ifnull(sum(b.total_price),'-') hotel_amount,
ifnull(GROUP_CONCAT(c.id ORDER BY c.id DESC),'-') item_ids,ifnull(sum(c.total_price),'-') item_amount")
->group("a.id")
->where($where)
->limit($offset, $param['pageSize'])
->order("id","DESC")->select();
->order("a.id","DESC")->select();
$data = ["total" => $total, "list" => $list->toArray()];
return Util::returnArrSu("", $data);
} catch (Exception $e) {
@@ -163,4 +164,75 @@ class PaymentOrderDao
return Util::returnArrEr("修改状态失败" . $e->getMessage());
}
}

/**
* 获取子订单列表
* @param $hotel_where
* @param $item_where
* @param $where
* @param $param
* @return array
*/
public function getSubOrderListByWhere($hotel_where,$item_where,$where,$param):array {
$limit = $param['pageSize'];
$offset = ($param['pageNum']-1)*$param['pageSize'];
$sqlCnt = "SELECT count(1) cnt
from (
(
SELECT a.order_id,a.id,d.supplier_name,a.trade_order_number,a.item_type 'hotel_name',a.item_name 'room_name',
a.item_unit 'plan_name',
a.check_in_date,a.check_in_date 'check_out_date',d.count,a.create_time,'item' as 'prod_type'
,a.payment_order_name,a.payment_order_status,a.payment_order_id,a.customer_name,a.total_cost,a.total_price,a.confirm_status
from hbp_order_item a
INNER JOIN hbp_purchase d on a.id = d.order_detail_id and d.prod_type='item'
where
$item_where
order by a.create_time desc
)
UNION
(
SELECT b.order_id,b.id,c.supplier_name,b.trade_order_number,b.hotel_name ,b.room_name ,b.plan_name,
b.check_in_date,b.check_out_date,c.count,b.create_time,'hotel' as 'prod_type'
,b.payment_order_name,b.payment_order_status,b.payment_order_id,b.customer_name,b.total_cost,b.total_price,b.confirm_status
from hbp_order_hotel b
INNER JOIN hbp_purchase c on b.id=c.order_detail_id and c.prod_type='hotel'
where
$hotel_where
order by b.create_time desc
)
) x
$where
ORDER BY x.create_time desc";
$totalRe = Db::query($sqlCnt);
$sql = "SELECT x.*
from (
(
SELECT a.order_id,a.id,d.supplier_name,a.trade_order_number,a.item_type 'hotel_name',a.item_name 'room_name',
a.item_unit 'plan_name',
a.check_in_date,a.check_in_date 'check_out_date',d.count,a.create_time,'item' as 'prod_type'
,a.payment_order_name,a.payment_order_status,a.payment_order_id,a.customer_name,a.total_cost,a.total_price,a.confirm_status
from hbp_order_item a
INNER JOIN hbp_purchase d on a.id = d.order_detail_id and d.prod_type='item'
where
$item_where
order by a.create_time desc
)
UNION
(
SELECT b.order_id,b.id,c.supplier_name,b.trade_order_number,b.hotel_name ,b.room_name ,b.plan_name,
b.check_in_date,b.check_out_date,c.count,b.create_time,'hotel' as 'prod_type'
,b.payment_order_name,b.payment_order_status,b.payment_order_id,b.customer_name,b.total_cost,b.total_price,b.confirm_status
from hbp_order_hotel b
INNER JOIN hbp_purchase c on b.id=c.order_detail_id and c.prod_type='hotel'
where
$hotel_where
order by b.create_time desc
)
) x
ORDER BY x.create_time desc
limit $limit offset $offset";
$list = Db::query($sql);
$result = ["list"=>$list,"total"=>$totalRe[0]['cnt']];
return Util::returnArrSu("",$result);
}
}

+ 160
- 0
application/admin/service/PaymentOrderService.php Прегледај датотеку

@@ -71,4 +71,164 @@ class PaymentOrderService
Db::commit();
return Util::returnArrSu();
}


/**
* 添加子订单到付款单
* @param $param
* @return array
*/
public function addSubOrder($param){
$model = new PaymentOrderDao();
$infoRe = $model->getInfoById($param['id']);
if (!$infoRe['flag']) {
return $infoRe;
}
if (isset($param['hotel_id']) && count($param['hotel_id'])>0) {
$orderMainDao = new OrderHotelDao();
$addRe = $orderMainDao->addSubOrderInPayment($infoRe['data'],$param['hotel_id']);
if (!$addRe['flag']) {
return $addRe;
}
}
if (isset($param['item_id']) && count($param['item_id'])>0) {
$orderMainDao = new OrderItemDao();
$addRe = $orderMainDao->addSubOrderInPayment($infoRe['data'],$param['item_id']);
if (!$addRe['flag']) {
return $addRe;
}
}
return Util::returnArrSu();
}

/**
* 移除子订单
* @param $param
* @return array
*/
public function removeSubOrder($param){
if (isset($param['hotel_id']) && count($param['hotel_id'])>0) {
$orderMainDao = new OrderHotelDao();
$addRe = $orderMainDao->removeSubOrderFormPayment($param['hotel_id']);
if (!$addRe['flag']) {
return $addRe;
}
}
if (isset($param['item_id']) && count($param['item_id'])>0) {
$orderMainDao = new OrderItemDao();
$addRe = $orderMainDao->removeSubOrderFormPayment($param['item_id']);
if (!$addRe['flag']) {
return $addRe;
}
}
return Util::returnArrSu("");
}

/**
* 获取子订单列表
* @param $param
* @return array
*/
public function getSubOrderList($param){
$dao = new PaymentOrderDao();
$item_where_arr = ["d.del_flag=0","a.del_flag=0"];
$hotel_where_arr = ["c.del_flag=0","b.del_flag=0"];
$where_arr = [];
if ($param['prod_type']=='hotel'){
$item_where_arr[] = " a.id = 0 ";
}else{
$hotel_where_arr[]=" b.id = 0 ";
}
if (!empty($param['order_id'])) {
$item_where_arr[] = " a.id = {$param["order_id"]} ";
$hotel_where_arr[]=" b.id = {$param['order_id']} ";
}
if (!empty($param['supplier_id'])) {
$item_where_arr[] = " d.supplier_id = {$param["supplier_id"]} ";
$hotel_where_arr[]=" c.supplier_id = {$param['supplier_id']} ";
}
if (!empty($param['confirm_status'])) {
$item_where_arr[] = " a.confirm_status = {$param["confirm_status"]} ";
$hotel_where_arr[]=" b.confirm_status = {$param['confirm_status']} ";
}
if (!empty($param['customer_name'])) {
$item_where_arr[] = " a.customer_name like %{$param["customer_name"]}% ";
$hotel_where_arr[]=" b.customer_name like %{$param['customer_name']}% ";
}
if (!empty($param['item_id'])) {
$item_where_arr[] = " a.item_id = {$param["item_id"]} ";
}
if (!empty($param['hotel_id'])) {
$item_where_arr[] = " a.hotel_id = {$param["hotel_id"]} ";
}

switch ($param['inPayment']) {
case 1:
$item_where_arr[] = " a.payment_order_id = {$param["payment_order_id"]} ";
$hotel_where_arr[]=" b.payment_order_id = {$param['payment_order_id']} ";
break;
case 2:
$item_where_arr[] = " a.payment_order_id != {$param["payment_order_id"]} ";
$hotel_where_arr[]=" b.payment_order_id != {$param['payment_order_id']} ";
break;
case 3:
$item_where_arr[] = " a.payment_order_id = '' ";
$hotel_where_arr[]=" b.payment_order_id = '' ";
}

//金额区间查询
if (!empty($param['startMoney'])) {
$item_where_arr[] = " a.total_cost >= {$param["startMoney"]} ";
$hotel_where_arr[]=" b.total_cost >= {$param['startMoney']} ";
}
if (!empty($param['endMoney'])) {
$item_where_arr[] = " a.total_cost <= {$param["endMoney"]} ";
$hotel_where_arr[]=" b.total_cost <= {$param['endMoney']} ";
}

//时间区间查询
if (!empty($param['startTime']) ) {
$item_where_arr[] = " a.create_time >= {$param["startTime"]} 00:00:00 ";
$hotel_where_arr[]=" b.create_time >= {$param['startTime']} 00:00:00 ";
}
if (!empty($param['endTime'])) {
$item_where_arr[] = " a.create_time <= {$param["endTime"]} 23:59:59 ";
$hotel_where_arr[]=" b.create_time <= {$param['endTime']} 23:59:59 ";
}

return $dao->getSubOrderListByWhere(join(" and ",$hotel_where_arr),join(" and ",$item_where_arr),join(" and ",$where_arr),$param);
}

/**
* 删除付款单
* @param $id
* @return array
*/
public function delAll($id){
Db::startTrans();
//1.删除付款单下的附加项目订单
$itemDao = new OrderItemDao();
$itemRe = $itemDao->delPaymentOrder($id);
if (!$itemRe['flag']) {
Db::rollback();
return $itemRe;
}
//1.删除付款单下的酒店订单
$hotelDao = new OrderHotelDao();
$hotelRe = $hotelDao->delPaymentOrder($id);
if (!$hotelRe['flag']) {
Db::rollback();
return $hotelRe;
}
//2.删除付款单
$model = new PaymentOrderDao();
$delRe = $model->del($id);
if (!$delRe['flag']) {
Db::rollback();
return $delRe;
}
Db::commit();
return Util::returnArrSu();
}

}

+ 1
- 1
application/admin/service/PurchaseDao.php Прегледај датотеку

@@ -88,7 +88,7 @@ class PurchaseDao
}
$data = [
"order_id" => $itemOrder['order_id'],
"prod_type" => 'hotel',
"prod_type" => 'item',
"order_detail_id" => $itemOrder['id'],
"group_id" => $param['group_id'],
"item_name" => $itemOrder['item_name'],


+ 660
- 24
application/admin/view/payment_order/index.html Прегледај датотеку

@@ -1,4 +1,3 @@

<!DOCTYPE html>
<html>
<head>
@@ -7,44 +6,681 @@
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
</head>
<body>
<div id="app">
<div style="margin: 10px;">
<span>名称:</span>
<el-input v-model="search.name" style="width: 150px;" placeholder="请输入内容"></el-input>
<span>状态</span>
<el-select v-model="search.status" placeholder="请选择" clearable>
<el-option
v-for="item in status"
:key="item.id"
:label="item.value"
:value="item.id">
</el-option>
</el-select>
<el-button type="primary"icon="el-icon-search" :disabled="isApi===true" >搜索</el-button>
<div id="app" class="table">
<div>
<div class="header-search">
<span>名称:</span>
<el-input v-model="search.name" style="width: 120px;" placeholder="请输入内容"></el-input>
<span>状态</span>
<el-select v-model="search.status" placeholder="请选择" clearable>
<el-option
v-for="item in status"
:key="item.id"
:label="item.value"
:value="item.id">
</el-option>
</el-select>
<el-button type="primary" icon="el-icon-search" @click="getData(1)">搜索</el-button>
<el-button type="primary" icon="el-icon-plus" @click="edit(null)">新增付款单</el-button>
</div>

<el-table ref="multipleTable" :data="tableData" border tooltip-effect="dark"
style="font-size:12px;width: 100%;margin-top: 12px">
<el-table-column prop="create_id" label="创建人" min-width="70" :formatter="getUserName"></el-table-column>
<el-table-column prop="id" label="付款单号" min-width="50"></el-table-column>
<el-table-column prop="name" label="付款单名称" min-width="120"></el-table-column>
<el-table-column prop="status" label="付款单状态" :formatter="getStatusName" min-width="150">
<template slot-scope="scope">
<el-radio-group v-model="scope.row.status" size="mini" @change="setStatus(scope.row)">
<el-radio-button label="0">未付款</el-radio-button>
<el-radio-button label="1">付款中</el-radio-button>
<el-radio-button label="2">已付款</el-radio-button>
</el-radio-group>
</template>
</el-table-column>
<el-table-column prop="order_ids" label="订单" min-width="130">
<template slot-scope="scope">
<div v-html="'酒店:'+scope.row.hotel_ids"></div>
<div v-html="'附加项目:'+scope.row.item_ids"></div>
</template>
</el-table-column>
<el-table-column prop="total_amount" label="金额" min-width="130">
<template slot-scope="scope">
<div v-html="'酒店:'+scope.row.hotel_amount"></div>
<div v-html="'附加项目:'+scope.row.item_amount"></div>
</template>
</el-table-column>
<el-table-column prop="create_time" label="创建时间" min-width="80"></el-table-column>
<el-table-column prop="update_time" label="更新时间" min-width="80"></el-table-column>
<el-table-column label="操作" min-width="180">
<template slot-scope="scope">
<el-button-group>
<el-button type="primary" size="mini" @click="edit(scope.row)" icon="el-icon-edit">编辑</el-button>
<el-button type="primary" size="mini" @click="editOrderDivShow(scope.row)" icon="el-icon-share">订单</el-button>
<el-button type="primary" size="mini" icon="el-icon-delete" @click="delAll(scope.row.id)">删除</el-button>
</el-button-group>
</template>
</el-table-column>
</el-table>
<el-pagination
:page-size="search.pageSize"
:pager-count="11"
layout="total, sizes, prev, pager, next, jumper"
:total="total"
:current-page="search.pageNum"
:page-sizes="[10, 20, 30, 40, 50]"
@size-change="sizeChange"
@current-change="getData"
@prev-click="getData"
@next-click="getData"
></el-pagination>
</div>


<transition name="bounce" v-if="editShow">
<el-dialog title="付款单详情" :visible.sync="editShow" width="90%" top="15px">
<el-form ref="form" label-width="100px" style="width: 100%;padding-bottom: 20px">
<div style="display: flex;width: 100%">
<el-form-item v-if="editType" label="付款单ID:" style="width: 80%">
<div v-html="editData.id"></div>
</el-form-item>
</div>
<div>
<el-form-item label="付款单名称:" style="width: 80%">
<el-input v-model="editData.name" style="width: 120px;" placeholder="请输入内容"></el-input>
</el-form-item>
</div>
<div>
<el-form-item v-if="editType" label="付款单状态:" style="width: 80%">
<el-radio-group v-model="editData.status" size="mini">
<el-radio-button label="0">未付款</el-radio-button>
<el-radio-button label="1">付款中</el-radio-button>
<el-radio-button label="2">已付款</el-radio-button>
</el-radio-group>
</el-form-item>
</div>
<div>
<el-button type="primary" @click="editDoing()" >保存</el-button>
</div>
</el-form>
</el-dialog>
</transition>


<transition name="bounce" v-if="editOrderShow">
<el-dialog title="详情" :visible.sync="editOrderShow" width="100%" top="15px">
<el-form ref="form" label-width="100px" style="width: 100%;padding-bottom: 10px">
<div style="display: flex;width: 100%">
<el-form-item label="付款单ID:" style="width: 80%">
<div v-html="editOrder.id"></div>
</el-form-item>
<el-form-item label="付款单名称:" style="width: 80%">
<div v-html="editOrder.name"></div>
</el-form-item>
<el-form-item label="付款单状态:" style="width: 80%">
<el-radio-group v-model="editOrder.status" size="mini" disabled>
<el-radio-button label="0">未付款</el-radio-button>
<el-radio-button label="1">付款中</el-radio-button>
<el-radio-button label="2">已付款</el-radio-button>
</el-radio-group>
</el-form-item>
</div>
</el-form>
<div>
<div class="header-search" style="width: 100%;margin-bottom: 10px">
<span>订单类型:</span>
<el-select v-model="orderMainListSearch.prod_type" style="width: 120px;" placeholder="请选择" >
<el-option
v-for="item in prodTypeList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
<span>子订单ID:</span>
<el-input v-model="orderMainListSearch.order_id" style="width: 120px;" placeholder="请输入内容"></el-input>
<span>用户名</span>
<el-input v-model="orderMainListSearch.customer_name" style="width: 120px;" placeholder="请输入内容" clearable></el-input>

</el-input>
<span>确认单状态:</span>
<el-select v-model="orderMainListSearch.confirm_status" style="width: 120px;" placeholder="请选择" clearable>
<el-option
v-for="item in confirmStatusList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
<span>付款单状态</span>
<el-select v-model="orderMainListSearch.inPayment" style="width: 120px;" placeholder="请选择" clearable>
<el-option
v-for="item in inPaymentList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
<span>供应商:</span>
<el-select v-model="orderMainListSearch.supplier_id" style="width: 120px;" placeholder="请选择" clearable>
<el-option
v-for="item in supplierList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</div>
<div class="header-search" style="width: 100%;margin-bottom: 10px">
<span>成本</span>
<el-input-number v-model="orderMainListSearch.startMoney" style="width: 120px;" placeholder="请输入内容" clearable></el-input-number>
~
<el-input-number v-model="orderMainListSearch.endMoney" style="width: 120px;" placeholder="请输入内容" clearable></el-input-number>
<span>时间</span>
<el-date-picker
style="width: 120px;"
v-model="orderMainListSearch.startTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择日期">
</el-date-picker>
~
<el-date-picker
style="width: 120px;"
v-model="orderMainListSearch.endTime"
value-format="yyyy-MM-dd"
type="date"
placeholder="选择日期">
</el-date-picker>
<span>附加项目</span>
<el-select v-model="orderMainListSearch.item_id" style="width: 120px;" placeholder="请选择" clearable>
<el-option
v-for="item in itemList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
<span>酒店</span>
<el-select v-model="orderMainListSearch.hotel_id" style="width: 120px;" placeholder="请选择" clearable>
<el-option
v-for="item in hotelList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
<el-button type="primary" icon="el-icon-search" @click="getOrderMainData(1)">搜索</el-button>
</div>
<div>
<el-table ref="multipleTable" :data="orderMainList" border tooltip-effect="dark" style="font-size:12px;width: 100%;margin-top: 12px" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="30" :selectable="checkSelect"></el-table-column>
<el-table-column prop="order_id" label="主订单ID" min-width="20" ></el-table-column>
<el-table-column prop="id" label="子订单ID" min-width="20" ></el-table-column>
<el-table-column label="订单类型" min-width="30" :formatter="getProdTypeName" ></el-table-column>
<el-table-column prop="supplier_name" label="供应商" min-width="40" ></el-table-column>
<el-table-column prop="trade_order_number" label="第三方订单号" min-width="40" ></el-table-column>
<el-table-column prop="hotel_name" label="酒店/附加项目" min-width="60" ></el-table-column>
<el-table-column prop="room_name" label="房型/附加项目" min-width="60" ></el-table-column>
<el-table-column prop="plan_name" label="价格方案/计价单位" min-width="40" ></el-table-column>
<el-table-column prop="check_in_date" label="时间" min-width="40" >
<template slot-scope="scope">
<div v-html="scope.row.check_in_date"></div>
<div v-html="scope.row.check_out_date"></div>
</template>
</el-table-column>
<el-table-column prop="count" label="数量" min-width="20" ></el-table-column>
<el-table-column prop="customer_name" label="出游人姓名" min-width="40" ></el-table-column>
<el-table-column prop="total_cost" 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-html="scope.row.payment_order_id"></div>
<div v-html="scope.row.payment_order_name"></div>
</template>
</el-table-column>
<el-table-column label="操作" >
<template slot-scope="scope">
<el-button-group>
<el-button type="primary" size="mini" v-if="scope.row.payment_order_id==0 && editOrder.status==0" @click="addOrderInfo(scope.row)" icon="el-icon-edit">添加</el-button>
<el-button type="primary" size="mini" v-if="scope.row.payment_order_id==editOrder.id && editOrder.status==0" @click="removeOrderMain(scope.row)" icon="el-icon-delete">移除</el-button>
</el-button-group>
</template>
</el-table-column>

</el-table>
<div style="margin-top: 5px">
<el-button type="primary" icon="el-icon-circle-plus" @click="addOrderAll()" :disabled="multipleSelection.length==0">添加到采购单</el-button>
</div>
<el-pagination
:page-size="orderMainListSearch.pageSize"
:pager-count="11"
layout="total, sizes, prev, pager, next, jumper"
:total="orderMainTotal"
:current-page="orderMainListSearch.pageNum"
:page-sizes="[10, 20, 30, 40, 50]"
@size-change="sizeOrderMainChange"
@current-change="getOrderMainData"
@prev-click="getOrderMainData"
@next-click="getOrderMainData"
></el-pagination>
</div>
</div>
</el-dialog>
</transition>
</div>
</body>
<!-- import Vue before Element -->
<script src="/assets/js/vue/vue.js"></script>
<!-- import JavaScript -->
<script src="/assets/js/vue/index.js"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script>
new Vue({
el: '#app',
data: function() {
data: function () {
return {
isApi:false,
search: {
outRequestNo:"",
couponCode:""
name: "",
status: "all",
pageSize: 10,
pageNum: 1
},
status: [
{"id": "all", "value": "请选择"},
{"id": 0, 'value': "未付款"},
{"id": 1, 'value': "付款中"},
{"id": 2, 'value': "已付款"}
],
total: 0,
tableData: [],
userList: [],
info: {
id: null,
name: "",
status: 0,
list: []
},
status:[
{"id":0,'value':"未付款"},
{"id":1,'value':"付款中"},
{"id":2,'value':"已付款"}
]
editShow: false,
editType: false,
editData: {},
editOrderShow:false,
editOrder:{},
orderMainListSearch:{
"payment_order_id":"",
"order_id":"",
"prod_type":"hotel",
"supplier_id":"",
"inPayment":"",
"confirm_status":"",
"customer_name":"",
"startMoney":"",
"endMoney":"",
"startTime":"",
"endTime":"",
"pageNum":1,
"pageSize":10,
"item_id":"",
"hotel_id":"",
"room_id":"",
"plan_id":""
},
orderMainTotal:0,
orderMainList:[],
inPaymentList:[
{id:1,name:"在此付款单中"},
{id:2,name:"不在此付款单中"},
{id:3,name:"不在任何付款单中"}
],
//1、未发单/ 2已发单、3已确认、4已取消
confirmStatusList:[
{id:1,name:"未发单"},
{id:2,name:"已发单"},
{id:3,name:"已确认"},
{id:4,name:"已取消"}
],
prodTypeList:[
{id:"hotel",name:"酒店"},
{id:"item",name:"附加项目"}
],
supplierList:[],
multipleSelection: [],
hotelList:[],
itemList:[]
}
},
created() {
this.getAdminUser();
this.getSupplierList();
this.getData(1)
this.getHotelList()
this.getItemList()

},
methods: {
getProdTypeName(info){
for (let i = 0; i < this.prodTypeList.length; i++) {
if (this.prodTypeList[i].id == info.prod_type) {
return this.prodTypeList[i].name
}
}
return "-"
},
getHotelList(){
axios.post("/hotel.php/cf_hotel_info/getHotelList", this.search).then((response) => {
console.log(response)
let data = response.data;
this.hotelList = data.list;
}).catch(function (error) {
console.log(error);
});
},
getItemList(){
axios.post("/hotel.php/cf_item/getList", this.search).then((response) => {
console.log(response)
let data = response.data;
this.itemList = data.list;
}).catch(function (error) {
console.log(error);
});
},
checkSelect(row,index){
if (this.editOrder.status != 0) {
return false;
}
if (row.payment_order_id ==0) {
return true;
}
return false;
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
getSupplierList(){
axios.post("/hotel.php/cf_suplier_info/getList", this.search).then((response) => {
console.log(response)
let data = response.data;
this.supplierList = data.list;
}).catch(function (error) {
console.log(error);
});
},
getStatusName(info) {
for (let i = 0; i < this.status.length; i++) {
if (this.status[i].id == info.status) {
return this.status[i].value
}
}
return "-"
},
getUserName(info) {
for (let i = 0; i < this.userList.length; i++) {
if (this.userList[i].id == info.create_id) {
return this.userList[i].name
}
}
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 "-"
},
sizeChange(pageSize) {
this.search.pageSize = pageSize;
this.getData(this.search.pageNum)
},
sizeOrderMainChange(pageSize) {
this.orderMainListSearch.pageSize = pageSize;
this.getOrderMainData(this.orderMainListSearch.pageNum)
},
//獲取列表
getData(page) {
this.search.pageNum = page;
axios.post("/hotel.php/payment_order/getList", this.search).then((response) => {
let data = response.data;
console.log(this.tableData);
if (data.flag) {
this.tableData = data.data.list;
this.total = data.data.total;
console.log(this.tableData);
} else {
this.$message.error(response.msg);
}
}).catch(function (error) {
console.log(error);
});
},
getAdminUser() {
axios.post("/hotel.php/auth/admin/getList", this.search).then((response) => {
this.userList = response.data.list;
}).catch(function (error) {
console.log(error);
});
},
edit(info) {
if (info == null) {
this.editType = false;
this.editData = {
name: ""
}
} else {
this.editType = true;
this.editData = {
id:info.id,
name: info.name,
status:info.status
}
}
this.editShow = true;
},
editDoing(){
axios.post("/hotel.php/payment_order/save", this.editData).then( (response)=> {
let data = response.data;
console.log(this.tableData);
if (data.flag) {
this.$message({
message: '保存成功!',
type: 'success'
});
this.editShow = false;
this.getData(1);
} else {
this.$message.error(data.msg);
}
}).catch(function (error) {
this.$message.error("保存失败");
console.log(error);
});
},
setStatus(info){
this.$confirm('确定修改状态?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
axios.post("/hotel.php/payment_order/setStatus", info).then( (response)=> {
let data = response.data;
if (data.flag) {
this.$message({
message: '设置成功!',
type: 'success'
});
} else {
this.$message.error(data.msg);
}
}).catch(function (error) {
this.$message.error("保存失败");
console.log(error);
});
}).catch(() => {

this.$message({
type: 'info',
message: '已取消'
});
}).finally(()=>{
this.getData(this.search.pageNum)
})

},
editOrderDivShow(info){
console.log(info);
this.editOrder = info;
this.orderMainListSearch.payment_order_id = info.id;
this.orderMainList=[];
this.getOrderMainData(1);
this.editOrderShow = true;
},
getOrderMainData(page){
this.orderMainListSearch.pageNum = page;
axios.post("/hotel.php/payment_order/getSubOrderList", this.orderMainListSearch).then((response) => {
let data = response.data;
console.log(this.tableData);
if (data.flag) {
this.orderMainList = data.data.list;
this.orderMainTotal = data.data.total;
console.log(this.orderMainList);
} else {
this.$message.error(data.msg);
}
}).catch(function (error) {
console.log(error);
});
},
addOrderInfo(info){
let param = {
hotel_id:[],
item_id:[],
id:this.editOrder.id
}
if (info.prod_type=='hotel') {
param.hotel_id.push(info.id)
}else{
param.item_id.push(info.id)
}
this.addOrderMain(param)
},
addOrderMain(param){
axios.post("/hotel.php/payment_order/addOrderMain", param).then((response) => {
let data = response.data;
if (data.flag) {
this.$message({
message: '添加成功!',
type: 'success'
});
this.getOrderMainData(this.orderMainListSearch.pageNum)
this.getData(this.search.pageNum)
} else {
this.$message.error(data.msg);
}
}).catch(function (error) {
console.log(error);
});
},
addOrderAll(){
let param = {
hotel_id:[],
item_id:[],
id:this.editOrder.id
}
let length = this.multipleSelection.length;
for (var k = 0; k < length; k++) {
if (this.multipleSelection[k].prod_type=='hotel'){
param.hotel_id.push(this.multipleSelection[k].id)
}else{
param.item_id.push(this.multipleSelection[k].id)
}
}
this.addOrderMain(param);
},
removeOrderMain(info){
let param = {
hotel_id:[],
item_id:[],
id:this.editOrder.id
}
if (info.prod_type=='hotel') {
param.hotel_id.push(info.id)
}else{
param.item_id.push(info.id)
}
axios.post("/hotel.php/payment_order/removeOrderMain", param).then((response) => {
let data = response.data;
if (data.flag) {
this.$message({
message: '移除成功!',
type: 'success'
});
this.getOrderMainData(this.orderMainListSearch.pageNum)
this.getData(this.search.pageNum)
} else {
this.$message.error(data.msg);
}
}).catch(function (error) {
console.log(error);
});
},
delAll(id){
let param = {
id:id
}
this.$confirm('确定删除采购单?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
axios.post("/hotel.php/payment_order/delAll", param).then((response) => {
let data = response.data;
if (data.flag) {
this.$message({
message: '移除成功!',
type: 'success'
});
this.getData(this.search.pageNum)
} else {
this.$message.error(data.msg);
}
}).catch(function (error) {
console.log(error);
});
}).catch(() => {
this.$message({
type: 'info',
message: '已取消'
});
});
}

}
})
</script>
<style lang="scss" scoped>
.el-table thead {
background-color: #5a5e66 !important;
}

.header-search {
font-size: 14px;
font-weight: 900;
}

body {
background-color: white;
}

.table {
width: 100%;
font-size: 12px;
margin-top: 12px;
background-color: white;
}
.el-form-item{
margin-bottom: 5px !important;
}
</style>
</html>

+ 1
- 1
application/admin/view/receipt_order/index.html Прегледај датотеку

@@ -129,7 +129,7 @@
:value="item.id">
</el-option>
</el-select>
<span>收单状态</span>
<span>收单状态</span>
<el-select v-model="orderMainListSearch.inReceipt" style="width: 150px;" placeholder="请选择" clearable>
<el-option
v-for="item in inReceipt"


Loading…
Откажи
Сачувај