@@ -16,6 +16,7 @@ use think\exception\ValidateException; | |||
*/ | |||
class OrderMain extends Backend | |||
{ | |||
protected $noNeedLogin = ['save']; | |||
/** | |||
* OrderMain模型对象 | |||
@@ -36,7 +36,7 @@ class CfHotelInfo extends Model | |||
}elseif($name){ | |||
$this->where(['hotel_name'=>['like','%'.$name.'%']]); | |||
} | |||
return $this->select(); | |||
return $this->select()->toArray(); | |||
} | |||
@@ -10,7 +10,9 @@ namespace app\admin\service; | |||
use app\admin\command\Util; | |||
use app\admin\model\CfHotelInfo; | |||
use app\admin\model\CfRoomInfo; | |||
use app\admin\model\CfRoomPlan; | |||
use app\admin\model\OrderHotel; | |||
use app\admin\model\Purchase; | |||
use think\Exception; | |||
@@ -44,16 +46,16 @@ class OrderHotelDao | |||
"hotel_id" => $param['hotel_id'], | |||
"hotel_name" => $hotelInfo['data']['hotel_name'], | |||
"hotel_phone" => $hotelInfo['data']['hotel_phone'], | |||
"country_name" => $hotelInfo['data']['country_name'], | |||
"province_name" => $hotelInfo['data']['province_name'], | |||
"city_name" => $hotelInfo['data']['city_name'], | |||
"area_name" => $hotelInfo['data']['area_name'], | |||
"detail_address" => $hotelInfo['data']['detail_address'], | |||
//房型 | |||
"room_id" => $param['data']['room_id'], | |||
"room_id" => $param['room_id'], | |||
"room_name" => $roomInfo['data']['room_name'], | |||
"room_memo" => $roomInfo['data']['room_memo'], | |||
//价格方案 | |||
"plan_id" => $param['data']['plan_id'], | |||
"plan_id" => $param['plan_id'], | |||
"plan_name" => $roomPlan['data']['plan_name'], | |||
"plan_memo" => $roomPlan['data']['plan_memo'], | |||
//其他 | |||
@@ -62,23 +64,21 @@ class OrderHotelDao | |||
"confirm_status" => $param['confirm_status'], | |||
"confirm_no" => $param['confirm_no'], | |||
"customer_name" => $param['customer_name'], | |||
"customer_comments" => $param['customer_comments'], | |||
"customer_comments" => empty($param['customer_comments'])?"":$param['customer_comments'], | |||
"trade_order_number" => $param['trade_order_number'], | |||
"res_person" => $param['res_person'], | |||
"res_person_id" => $param['res_person_id'], | |||
"del_flag"=>0 | |||
]; | |||
$orderHotelModel = new OrderHotel(); | |||
if (empty($param['id'])) { | |||
$id = $orderHotelModel->insertGetId($data); | |||
return Util::returnArrSu($id); | |||
return Util::returnArrSu("", $id); | |||
}else { | |||
$orderHotelModel->save($data, ["id" => $param['id']]); | |||
return Util::returnArrSu($param['id']); | |||
return Util::returnArrSu("", $param['id']); | |||
} | |||
}catch (Exception $e){ | |||
return Util::returnArrEr("更新酒店子订单失败".$e->getMessage()); | |||
return Util::returnArrEr("更新酒店子订单失败:".$e->getMessage()); | |||
} | |||
} | |||
@@ -90,14 +90,14 @@ class OrderHotelDao | |||
public function getHotelInfo($id) | |||
{ | |||
try { | |||
$model = new OrderHotel(); | |||
$result = $model->where(["id" => $id])->find(); | |||
$model = new CfHotelInfo(); | |||
$result = $model->where(["id" => $id])->find()->toArray(); | |||
if ($result == null) { | |||
return Util::returnArrEr("获取酒店信息失败" . $id); | |||
return Util::returnArrEr("获取酒店信息失败:" . $id); | |||
} | |||
return Util::returnArrSu($result); | |||
return Util::returnArrSu("",$result); | |||
} catch (Exception $e) { | |||
return Util::returnArrEr("获取酒店信息失败" . $id); | |||
return Util::returnArrEr("获取酒店信息失败:" . $id); | |||
} | |||
} | |||
@@ -110,13 +110,13 @@ class OrderHotelDao | |||
{ | |||
try { | |||
$model = new CfRoomInfo(); | |||
$result = $model->where(["id" => $id])->find(); | |||
$result = $model->where(["id" => $id])->find()->toArray(); | |||
if ($result == null) { | |||
return Util::returnArrEr("获取房型信息失败" . $id); | |||
return Util::returnArrEr("获取房型信息失败:" . $id); | |||
} | |||
return Util::returnArrSu($result); | |||
return Util::returnArrSu("", $result); | |||
} catch (Exception $e) { | |||
return Util::returnArrEr("获取房型信息失败" . $id); | |||
return Util::returnArrEr("获取房型信息失败:" . $id); | |||
} | |||
} | |||
@@ -128,14 +128,14 @@ class OrderHotelDao | |||
public function getRoomPlan($id) | |||
{ | |||
try { | |||
$model = new CfRoomInfo(); | |||
$result = $model->where(["id" => $id])->find(); | |||
$model = new CfRoomPlan(); | |||
$result = $model->where(["id" => $id])->find()->toArray(); | |||
if ($result == null) { | |||
return Util::returnArrEr("获取价格方案信息失败" . $id); | |||
return Util::returnArrEr("获取价格方案信息失败:" . $id); | |||
} | |||
return Util::returnArrSu($result); | |||
return Util::returnArrSu("",$result); | |||
} catch (Exception $e) { | |||
return Util::returnArrEr("获取价格方案信息失败" . $id); | |||
return Util::returnArrEr("获取价格方案信息失败:" . $id); | |||
} | |||
} | |||
@@ -147,7 +147,7 @@ class OrderHotelDao | |||
public function setSubOrderAmount( int $subOrderId) { | |||
try{ | |||
$purchaseModel = new Purchase(); | |||
$purchaseList = $purchaseModel->where(["order_detail_id"=>$subOrderId,"del_flag"=>0])->select(); | |||
$purchaseList = $purchaseModel->where(["order_detail_id"=>$subOrderId,"del_flag"=>0])->select()->toArray(); | |||
$cost = 0; | |||
$amount = 0; | |||
$count = 0; | |||
@@ -156,10 +156,11 @@ class OrderHotelDao | |||
$amount += $purchase['total_price']; | |||
$count += $purchase['count']; | |||
} | |||
OrderHotel::update(["total_price"=>$amount,"total_cost"=>$cost,"count"=>$count])->where(["id"=>$subOrderId]); | |||
$orderHotel = new OrderHotel(); | |||
$orderHotel->save(["total_price"=>$amount,"total_cost"=>$cost,"prod_num"=>$count, "profit"=>$amount-$cost],["id"=>$subOrderId]); | |||
return Util::returnArrSu(); | |||
}catch (Exception $e){ | |||
return Util::returnArrEr("更新酒店订单子表金额失败".$subOrderId); | |||
return Util::returnArrEr("更新酒店订单子表金额失败:".$subOrderId); | |||
} | |||
} | |||
@@ -172,13 +173,13 @@ class OrderHotelDao | |||
public function getInfoById($id) { | |||
try { | |||
$model = new OrderHotel(); | |||
$result = $model->where(["id" => $id])->find(); | |||
$result = $model->where(["id" => $id])->find()->toArray(); | |||
if ($result == null) { | |||
return Util::returnArrEr("获取子订单信息失败" . $id); | |||
return Util::returnArrEr("获取子订单信息失败:" . $id); | |||
} | |||
return Util::returnArrSu($result); | |||
return Util::returnArrSu("",$result); | |||
} catch (Exception $e) { | |||
return Util::returnArrEr("获取子订单信息失败" . $id); | |||
return Util::returnArrEr("获取子订单信息失败:" . $id); | |||
} | |||
} | |||
@@ -208,13 +209,13 @@ class OrderHotelDao | |||
public function getListByOrderId($orderId){ | |||
$subOrderModel = new OrderHotel(); | |||
try { | |||
$subOrderList = $subOrderModel->where(["order_id" => $orderId, "del_flag" => 0])->select(); | |||
$subOrderList = $subOrderModel->where(["order_id" => $orderId, "del_flag" => 0])->select()->toArray(); | |||
if (null == $subOrderList) { | |||
return Util::returnArrEr([]); | |||
return Util::returnArrSu("",[]); | |||
} | |||
return Util::returnArrSu($subOrderList); | |||
return Util::returnArrSu("", $subOrderList); | |||
}catch (Exception $e) { | |||
return Util::returnArrEr("获取酒店订单列表异常".$e->getMessage()); | |||
return Util::returnArrEr("获取酒店订单列表异常:".$e->getMessage()); | |||
} | |||
} | |||
} |
@@ -42,7 +42,7 @@ class OrderItemDao | |||
"item_name"=>$itemInfo['data']['item_name'], | |||
"item_memo"=>$itemInfo['data']['item_memo'], | |||
"item_unit"=>$itemInfo['data']['item_unit'], | |||
"country_name" => $itemInfo['data']['country_name'], | |||
"area_name" => $itemInfo['data']['area_name'], | |||
"province_name" => $itemInfo['data']['province_name'], | |||
"city_name" => $itemInfo['data']['city_name'], | |||
"detail_address" => $itemInfo['data']['detail_address'], | |||
@@ -51,22 +51,20 @@ class OrderItemDao | |||
"confirm_status" => $param['confirm_status'], | |||
"confirm_no" => $param['confirm_no'], | |||
"customer_name" => $param['customer_name'], | |||
"customer_comments" => $param['customer_comments'], | |||
"customer_comments" => empty($param['customer_comments'])?"":$param['customer_comments'], | |||
"trade_order_number" => $param['trade_order_number'], | |||
"res_person" => $param['res_person'], | |||
"res_person_id" => $param['res_person_id'], | |||
"del_flag"=>0 | |||
]; | |||
$orderHotelModel = new OrderHotel(); | |||
if (empty($param['id'])) { | |||
$id = $orderHotelModel->insertGetId($data); | |||
return Util::returnArrSu($id); | |||
return Util::returnArrSu("",$id); | |||
}else { | |||
$orderHotelModel->save($data,["id"=>$param['id']]); | |||
return Util::returnArrSu($param['id']); | |||
return Util::returnArrSu("",$param['id']); | |||
} | |||
}catch (Exception $e){ | |||
return Util::returnArrEr("更新附加项目子订单失败".$e->getMessage()); | |||
return Util::returnArrEr("更新附加项目子订单失败:".$e->getMessage()); | |||
} | |||
} | |||
@@ -80,13 +78,13 @@ class OrderItemDao | |||
{ | |||
try { | |||
$model = new CfItem(); | |||
$result = $model->where(["id" => $id])->find(); | |||
$result = $model->where(["id" => $id])->find()->toArray(); | |||
if ($result == null) { | |||
return Util::returnArrEr("获取附加项目信息失败" . $id); | |||
return Util::returnArrEr("获取附加项目信息失败:" . $id); | |||
} | |||
return Util::returnArrSu($result); | |||
return Util::returnArrSu("",$result); | |||
} catch (Exception $e) { | |||
return Util::returnArrEr("获取附加项目信息失败" . $id); | |||
return Util::returnArrEr("获取附加项目信息失败:" . $id); | |||
} | |||
} | |||
@@ -109,10 +107,10 @@ class OrderItemDao | |||
} | |||
//更新数据 | |||
$oderItem = new OrderItem(); | |||
$oderItem->update(["total_price"=>$amount,"total_cost"=>$cost,"count"=>$count])->where(["id"=>$subOrderId]); | |||
$oderItem->save(["total_price"=>$amount,"total_cost"=>$cost,"prod_num"=>$count,"profit"=>$amount-$cost])->where(["id"=>$subOrderId]); | |||
return Util::returnArrSu(); | |||
}catch (Exception $e){ | |||
return Util::returnArrEr("更新附加项目订单子表金额失败".$subOrderId); | |||
return Util::returnArrEr("更新附加项目订单子表金额失败:".$subOrderId); | |||
} | |||
} | |||
@@ -125,13 +123,13 @@ class OrderItemDao | |||
public function getInfoById($id) { | |||
try { | |||
$model = new OrderItem(); | |||
$result = $model->where(["id" => $id])->find(); | |||
$result = $model->where(["id" => $id])->find()->toArray(); | |||
if ($result == null) { | |||
return Util::returnArrEr("获取子订单信息失败" . $id); | |||
return Util::returnArrEr("获取子订单信息失败:" . $id); | |||
} | |||
return Util::returnArrSu($result); | |||
return Util::returnArrSu("", $result); | |||
} catch (Exception $e) { | |||
return Util::returnArrEr("获取子订单信息失败" . $id); | |||
return Util::returnArrEr("获取子订单信息失败:" . $id); | |||
} | |||
} | |||
@@ -163,9 +161,9 @@ class OrderItemDao | |||
try { | |||
$subOrderList = $subOrderModel->where(["order_id" => $orderId, "del_flag" => 0])->select(); | |||
if (null == $subOrderList) { | |||
return Util::returnArrEr([]); | |||
return Util::returnArrSu("",[]); | |||
} | |||
return Util::returnArrSu($subOrderList); | |||
return Util::returnArrSu("", $subOrderList); | |||
}catch (Exception $e) { | |||
return Util::returnArrEr("获取附加项目订单列表异常".$e->getMessage()); | |||
} | |||
@@ -26,7 +26,7 @@ class OrderMainDao | |||
public function save($param) { | |||
try{ | |||
$data = [ | |||
"commissioner_id"=>$param['commissioner_id'], | |||
"commissioner_id"=>empty($param['commissioner_id'])?0:$param['commissioner_id'], | |||
"commissioner"=>$param["commissioner"], | |||
"channel_id"=>$param["channel_id"], | |||
"channel_name"=>$param["channel_name"], | |||
@@ -38,13 +38,13 @@ class OrderMainDao | |||
$orderMain = new OrderMain(); | |||
if (empty($param['id'])) { | |||
$id = $orderMain->insertGetId($data); | |||
return Util::returnArrSu($id); | |||
return Util::returnArrSu("", $id); | |||
} else { | |||
$orderMain->save($data,['id'=>$param['id']]); | |||
return Util::returnArrSu($param['id']); | |||
return Util::returnArrSu("", $param['id']); | |||
} | |||
}catch (Exception $e){ | |||
return Util::returnArrEr("更新主订单失败".$e->getMessage()); | |||
return Util::returnArrEr("更新主订单失败:".$e->getMessage()); | |||
} | |||
} | |||
@@ -58,8 +58,8 @@ class OrderMainDao | |||
try { | |||
$itemModel = new OrderItem(); | |||
$hotelModel = new OrderHotel(); | |||
$itemList = $itemModel->where(["order_id" => $orderId])->select(); | |||
$hotelList = $hotelModel->where(["order_id" => $orderId])->select(); | |||
$itemList = $itemModel->where(["order_id" => $orderId])->select()->toArray(); | |||
$hotelList = $hotelModel->where(["order_id" => $orderId])->select()->toArray(); | |||
$amount = 0; | |||
$cost = 0; | |||
foreach ($itemList as $item) { | |||
@@ -71,10 +71,11 @@ class OrderMainDao | |||
$cost += $hotel["total_cost"]; | |||
} | |||
//更新金额 | |||
OrderMain::update(["total_amount" => $amount, "cost_amount" => $cost])->where(["id" => $orderId]); | |||
$orderMain = new OrderMain(); | |||
$orderMain->save(["total_amount" => $amount, "cost_amount" => $cost,"profit_amount"=>$amount-$cost],["id" => $orderId]); | |||
return Util::returnArrSu(); | |||
}catch (Exception $e){ | |||
return Util::returnArrEr("更新主表订单金额失败".$orderId); | |||
return Util::returnArrEr("更新主表订单金额失败:".$e->getMessage()); | |||
} | |||
} | |||
@@ -86,13 +87,13 @@ class OrderMainDao | |||
public function getInfoById($id) { | |||
try { | |||
$orderMainModel = new OrderMain(); | |||
$orderMain = $orderMainModel->where(["id" => $id])->find(); | |||
$orderMain = $orderMainModel->where(["id" => $id])->find()->toArray(); | |||
if (null == $orderMain) { | |||
return Util::returnArrEr("订单查询失败".$id); | |||
return Util::returnArrEr("订单查询失败:".$id); | |||
} | |||
return Util::returnArrSu($orderMain); | |||
return Util::returnArrSu("",$orderMain); | |||
}catch (Exception $e) { | |||
return Util::returnArrEr("订单查询失败".$e->getMessage()); | |||
return Util::returnArrEr("订单查询失败:".$e->getMessage()); | |||
} | |||
} | |||
@@ -105,11 +106,12 @@ class OrderMainDao | |||
*/ | |||
public function setSubOrderShow($purchaseShow,$orderHotel,$orderItem){ | |||
$result = []; | |||
foreach ($orderItem as $item) { | |||
$item['prod_type'] = 'item'; | |||
foreach ($purchaseShow as $key=> $purchase) { | |||
if ($item['id'] == $key) { | |||
array_merge($item,$purchase); | |||
$item = array_merge($item,$purchase); | |||
} | |||
} | |||
$result[] = $item; | |||
@@ -118,11 +120,11 @@ class OrderMainDao | |||
$hotel['prod_type'] = 'hotel'; | |||
foreach ($purchaseShow as $key=> $purchase) { | |||
if ($hotel['id'] == $key) { | |||
array_merge($hotel,$purchase); | |||
$hotel = array_merge($hotel,$purchase); | |||
} | |||
} | |||
$result[] = $hotel; | |||
} | |||
return Util::returnArrSu($result); | |||
return Util::returnArrSu("",$result); | |||
} | |||
} |
@@ -48,7 +48,7 @@ class OrderMainService | |||
/** | |||
* 2.添加子订单 有则激活更新、无则添加 | |||
*/ | |||
if ($subOrderParam['prodType'] == 'hotel') { | |||
if ($subOrderParam['prod_type'] == 'hotel') { | |||
$subOrderDao = $orderHotelDao; | |||
} else { | |||
$subOrderDao = $orderItemDao; | |||
@@ -59,21 +59,22 @@ class OrderMainService | |||
} | |||
$subOrderId = $addSubOrder['data']; | |||
$subOrderInfo = $subOrderDao->getInfoById($subOrderId); | |||
if (!$subOrderInfo['flag']) { | |||
return $subOrderInfo; | |||
} | |||
/** | |||
* 2.1添加子订单下的采购单 有则更新激活、无则添加 | |||
*/ | |||
$purchaseDao = new PurchaseDao(); | |||
if ($subOrderParam['prod_type'] == 'hotel') { | |||
$addPurchase = $purchaseDao->saveHotelPurchase($subOrderParam, $subOrderInfo); | |||
$addPurchase = $purchaseDao->saveHotelPurchase($subOrderParam, $subOrderInfo['data']); | |||
} else { | |||
$addPurchase = $purchaseDao->saveItemPurchase($subOrderParam, $subOrderInfo); | |||
$addPurchase = $purchaseDao->saveItemPurchase($subOrderParam, $subOrderInfo['data']); | |||
} | |||
if (!$addPurchase['flag']) { | |||
return $addPurchase; | |||
} | |||
$purchaseId = $addPurchase['id']; | |||
$purchaseId = $addPurchase['data']; | |||
/** | |||
* 2.1.1添加采购单的每日价格 先删除、后添加激活 | |||
@@ -107,7 +108,7 @@ class OrderMainService | |||
if (!$setOrderMainRe['flag']) { | |||
return $setOrderMainRe; | |||
} | |||
return Util::returnArrSu($orderId); | |||
return Util::returnArrSu("",$orderId); | |||
} | |||
/** | |||
@@ -122,7 +123,7 @@ class OrderMainService | |||
/** | |||
* 2.添加子订单 | |||
*/ | |||
if ($subOrderParam['prodType'] == 'hotel') { | |||
if ($subOrderParam['prod_type'] == 'hotel') { | |||
$subOrderDao = new OrderHotelDao(); | |||
} else { | |||
$subOrderDao = new OrderItemDao(); | |||
@@ -180,7 +181,7 @@ class OrderMainService | |||
if (!$setOrderMainRe['flag']) { | |||
return $setOrderMainRe; | |||
} | |||
return Util::returnArrSu($subOrderId); | |||
return Util::returnArrSu("",$subOrderId); | |||
} | |||
/** | |||
@@ -190,7 +191,7 @@ class OrderMainService | |||
*/ | |||
public function delSubOrder($param){ | |||
try { | |||
if ($param['prodType'] == 'hotel') { | |||
if ($param['prod_type'] == 'hotel') { | |||
$subOrderDao = new OrderHotelDao(); | |||
} else { | |||
$subOrderDao = new OrderItemDao(); | |||
@@ -204,7 +205,7 @@ class OrderMainService | |||
$purchasePriceDao->deleteBySubOrderId($param['id']); | |||
return Util::returnArrSu(); | |||
}catch (Exception $e){ | |||
return Util::returnArrEr("删除子订单失败".$e->getMessage()); | |||
return Util::returnArrEr("删除子订单失败:".$e->getMessage()); | |||
} | |||
} | |||
@@ -254,6 +255,6 @@ class OrderMainService | |||
return $subOrderList; | |||
} | |||
$orderMain["subOrderList"]=$subOrderList['data']; | |||
return Util::returnArrSu($orderMain); | |||
return Util::returnArrSu("",$orderMain); | |||
} | |||
} |
@@ -28,28 +28,29 @@ class PurchaseDao | |||
"order_id" => $hotelOrder['order_id'], | |||
"prod_type" => 'hotel', | |||
"order_detail_id" => $hotelOrder['id'], | |||
"group_id" => $param['group_id'], | |||
"group_id" => empty($param['group_id']), | |||
"pro_name" => $hotelOrder['hotel_name'], | |||
"item_name" => $hotelOrder['room_name'], | |||
"item_unit" => $hotelOrder['plan_name'], | |||
"check_in_date" => $param['check_in_date'], | |||
"check_out_date" => $param['check_out_date'], | |||
"supplier_id" => $param['supplier_id'], | |||
"supplier_name" => $param['supplier_name'], | |||
"purchase_user_id" => $param['purchase_user_id'], | |||
"purchase_user" => $param['purchase_user'], | |||
"supplier_id" => empty($param['supplier_id'])?0:$param['supplier_id'], | |||
"supplier_name" => empty($param['supplier_name'])?"":$param['supplier_name'], | |||
"purchase_user_id" => empty($param['purchase_user_id'])?0:$param['purchase_user_id'], | |||
"purchase_user" => empty($param['purchase_user'])?"":$param['purchase_user'], | |||
"del_flag"=>0 | |||
]; | |||
$model = new Purchase(); | |||
if (empty($param['purchase_id'])) { | |||
$id = $model->insertGetId($data); | |||
return Util::returnArrSu($id); | |||
return Util::returnArrSu("", $id); | |||
}else { | |||
$model->save($data,["id"=>$param['purchase_id']]); | |||
return Util::returnArrSu($param['purchase_id']); | |||
return Util::returnArrSu("", $param['purchase_id']); | |||
} | |||
}catch (Exception $e){ | |||
return Util::returnArrEr("新增采购都失败".$e->getMessage()); | |||
return Util::returnArrEr("新增采购单失败:".$e->getMessage()); | |||
} | |||
} | |||
@@ -80,13 +81,13 @@ class PurchaseDao | |||
$model = new Purchase(); | |||
if (empty($param['purchase_id'])) { | |||
$id = $model->insertGetId($data); | |||
return Util::returnArrSu($id); | |||
return Util::returnArrSu("", $id); | |||
}else { | |||
$model->save($data,["id"=>$param['purchase_id']]); | |||
return Util::returnArrSu($param['purchase_id']); | |||
return Util::returnArrSu("", $param['purchase_id']); | |||
} | |||
}catch (Exception $e){ | |||
return Util::returnArrEr("新增采购都失败".$e->getMessage()); | |||
return Util::returnArrEr("新增采购都失败:".$e->getMessage()); | |||
} | |||
} | |||
@@ -103,14 +104,15 @@ class PurchaseDao | |||
$amount = 0; | |||
$cnt = 0; | |||
foreach ($purchasePriceList as $price) { | |||
$cost += $price['cost'] * $price["cnt"]; | |||
$amount += $price['price'] * $price["cnt"]; | |||
$cnt += $price['cnt']; | |||
$cost += $price['cost'] * $price["count"]; | |||
$amount += $price['price'] * $price["count"]; | |||
$cnt += $price['count']; | |||
} | |||
Purchase::update(["total_price"=>$amount,"total_cost"=>$cost,"count"=>$cnt])->where(["id"=>$purchaseId]); | |||
$purchase = new Purchase(); | |||
$purchase->save(["total_price"=>$amount,"total_cost"=>$cost,"count"=>$cnt,"profit"=>$amount-$cost],["id"=>$purchaseId]); | |||
return Util::returnArrSu(); | |||
}catch (Exception $e){ | |||
return Util::returnArrEr("更新采购单金额失败".$e->getMessage()); | |||
return Util::returnArrEr("更新采购单金额失败:".$e->getMessage()); | |||
} | |||
} | |||
@@ -141,13 +143,13 @@ class PurchaseDao | |||
public function getListByOrderId($orderId) { | |||
$model = new Purchase(); | |||
try { | |||
$list = $model->where(["order_id" => $orderId, "del_flag" => 0])->select(); | |||
$list = $model->where(["order_id" => $orderId, "del_flag" => 0])->select()->toArray(); | |||
if (null == $list) { | |||
return Util::returnArrSu([]); | |||
return Util::returnArrSu("",[]); | |||
} | |||
return Util::returnArrSu($list); | |||
return Util::returnArrSu("",$list); | |||
}catch (Exception $e) { | |||
return Util::returnArrEr("获取订单的采购单列表失败".$e->getMessage()); | |||
return Util::returnArrEr("获取订单的采购单列表失败:".$e->getMessage()); | |||
} | |||
} | |||
@@ -180,11 +182,8 @@ class PurchaseDao | |||
$purchaseShow["purchasePriceList"][]=$priceShow; | |||
} | |||
} | |||
if (null == $result[$purchase['order_detail_id']]) { | |||
$result[$purchase['order_detail_id']] = []; | |||
} | |||
$result[$purchase['order_detail_id']][]= $purchaseShow; | |||
$result[$purchase['order_detail_id']]= $purchaseShow; | |||
} | |||
return Util::returnArrSu($result); | |||
return Util::returnArrSu("", $result); | |||
} | |||
} |
@@ -52,7 +52,7 @@ class PurchasePriceDao | |||
} | |||
return Util::returnArrSu(); | |||
} catch (Exception $e) { | |||
return Util::returnArrEr("添加/更新采购单每日价格失败" . $e->getMessage()); | |||
return Util::returnArrEr("添加/更新采购单每日价格失败:" . $e->getMessage()); | |||
} | |||
} | |||
@@ -83,11 +83,11 @@ class PurchasePriceDao | |||
public function getPurchasePriceListByOrderId($orderId) { | |||
$model = new PurchasePrice(); | |||
try { | |||
$list = $model->where(["order_id" => $orderId, "del_flag" => $orderId])->select(); | |||
$list = $model->where(["order_id" => $orderId, "del_flag" => 0])->select()->toArray(); | |||
if (null == $list) { | |||
return Util::returnArrSu([]); | |||
return Util::returnArrSu("", []); | |||
} | |||
return Util::returnArrSu($list); | |||
return Util::returnArrSu("", $list); | |||
}catch (Exception $e) { | |||
return Util::returnArrEr("获取采购单金额异常".$e->getMessage()); | |||
} | |||
@@ -1,4 +1,4 @@ | |||
<script> | |||
window.type = 'add' | |||
window.id = '' | |||
</script> | |||
<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><title>single</title><link href=/static/css/app.96d8ca953119e6bf3089010d0b52faac.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=/static/js/manifest.2ae2e69a05c33dfc65f8.js></script><script type=text/javascript src=/static/js/vendor.d74fe6c76e290fa6381b.js></script><script type=text/javascript src=/static/js/app.54bea408cdbd8067836f.js></script></body></html> | |||
<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><title>single</title><link href=/static/css/app.0fcb56ff5456d5f2f8dde70db7844776.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=/static/js/manifest.2ae2e69a05c33dfc65f8.js></script><script type=text/javascript src=/static/js/vendor.accdcfe0d08d2846f7d5.js></script><script type=text/javascript src=/static/js/app.36d97fd15740fcdbab33.js></script></body></html> |
@@ -1,4 +1,7 @@ | |||
<input id="c-id" type="hidden" value="{$row.id}"> | |||
<script> | |||
window.type = 'edit' | |||
window.id = document.getElementById('c-id').value | |||
console.log(id) | |||
</script> | |||
<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><title>single</title><link href=/static/css/app.96d8ca953119e6bf3089010d0b52faac.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=/static/js/manifest.2ae2e69a05c33dfc65f8.js></script><script type=text/javascript src=/static/js/vendor.d74fe6c76e290fa6381b.js></script><script type=text/javascript src=/static/js/app.54bea408cdbd8067836f.js></script></body></html> | |||
<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><title>single</title><link href=/static/css/app.0fcb56ff5456d5f2f8dde70db7844776.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=/static/js/manifest.2ae2e69a05c33dfc65f8.js></script><script type=text/javascript src=/static/js/vendor.accdcfe0d08d2846f7d5.js></script><script type=text/javascript src=/static/js/app.36d97fd15740fcdbab33.js></script></body></html> |
@@ -46,7 +46,7 @@ return [ | |||
// 是否严格检查字段是否存在 | |||
'fields_strict' => true, | |||
// 数据集返回类型 | |||
'resultset_type' => 'array', | |||
'resultset_type' => 'collection', | |||
// 自动写入时间戳字段 | |||
'auto_timestamp' => false, | |||
// 时间字段取出后的默认时间格式,默认为Y-m-d H:i:s | |||
@@ -2,6 +2,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | |||
var Controller = { | |||
index: function () { | |||
$(".btn-add").data("area",["100%","100%"]); | |||
$(".btn-edit").data("area",["100%","100%"]); | |||
// 初始化表格参数配置 | |||
Table.api.init({ | |||
extend: { | |||
@@ -16,7 +18,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | |||
}); | |||
var table = $("#table"); | |||
table.on('post-body.bs.table',function(){ | |||
$(".btn-editone").data("area",["100%","100%"]); | |||
}); | |||
// 初始化表格 | |||
table.bootstrapTable({ | |||
url: $.fn.bootstrapTable.defaults.extend.index_url, | |||
@@ -37,7 +41,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | |||
{field: 'order_memo', title: __('Order_memo'), operate: 'LIKE'}, | |||
{field: 'success_time', title: __('Success_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, | |||
{field: 'create_time', title: __('下单时间'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, | |||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} | |||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}, | |||
] | |||
] | |||
}); | |||