|
@@ -247,6 +247,15 @@ class KangyangCityController extends Curd
|
|
|
$qrcodePayAmount = 0;
|
|
|
$params['orderId'] = 'OD' . date('ymdH') . random_string(6, 'up');
|
|
|
$params['orderGroupId'] = 'OD' . date('ymdH') . random_string(6, 'up');
|
|
|
+ // 查询是否有未完全支付订单
|
|
|
+ $paidOrder = Order::where('join_order_member_id', $params['join_order_member_id'])
|
|
|
+ ->where('order_category', 'VIP')
|
|
|
+ ->where('order_status_system', 'PAYING')
|
|
|
+ ->first();
|
|
|
+ if (!empty($paidOrder)) {
|
|
|
+ $paidOrder->order_groupby = $params['orderGroupId'];
|
|
|
+ $params['orderId'] = $paidOrder->order_id;
|
|
|
+ }
|
|
|
|
|
|
$systemStatus = 'SENDING'; // 待发货
|
|
|
// 立即结算
|
|
@@ -331,11 +340,6 @@ class KangyangCityController extends Curd
|
|
|
// ]);
|
|
|
}
|
|
|
$params['order_config_json'] = json_encode($orderConfigJson);
|
|
|
- // 查询是否有未完全支付订单
|
|
|
- $paidOrder = Order::where('join_order_member_id', $params['join_order_member_id'])
|
|
|
- ->where('order_category', 'VIP')
|
|
|
- ->where('order_status_system', 'PAYING')
|
|
|
- ->first();
|
|
|
|
|
|
if (empty($paidOrder)) {
|
|
|
// 写入主订单
|
|
@@ -352,7 +356,7 @@ class KangyangCityController extends Curd
|
|
|
$paidOrder->order_status_system = 'DONE';
|
|
|
$paidOrder->order_status_payment = 'SUCCESS';
|
|
|
// 更新sheet
|
|
|
- OrderSheet::where('join_sheet_order_id', $paidOrder->order_id)->update(['order_sheet_status'=>'DONE']);
|
|
|
+ OrderSheet::where('join_sheet_order_id', $paidOrder->order_id)->update(['order_sheet_status' => 'DONE']);
|
|
|
}
|
|
|
$paidOrder->save();
|
|
|
|
|
@@ -418,7 +422,9 @@ class KangyangCityController extends Curd
|
|
|
}
|
|
|
|
|
|
$params['orderId'] = $params['order_id'];
|
|
|
- $params['orderGroupId'] = $order->order_groupby;
|
|
|
+
|
|
|
+ $params['orderGroupId'] = 'OD' . date('ymdH') . random_string(6, 'up');
|
|
|
+ $order->order_groupby = $params['orderGroupId'];
|
|
|
|
|
|
$goods = Goods::where('goods_id', $params['join_sheet_goods_id'])
|
|
|
->select('goods_id', 'goods_name', 'goods_classify')
|
|
@@ -526,9 +532,9 @@ class KangyangCityController extends Curd
|
|
|
// sheet
|
|
|
if ($order->order_status_payment == 'SUCCESS') {
|
|
|
$data = [
|
|
|
- 'order_sheet_status'=>$systemStatus
|
|
|
+ 'order_sheet_status' => $systemStatus
|
|
|
];
|
|
|
- if (floatval($order->order_amount_paid) < $order->order_amount_total){
|
|
|
+ if (floatval($order->order_amount_paid) < $order->order_amount_total) {
|
|
|
$data['order_sheet_status'] = 'BEING';
|
|
|
}
|
|
|
OrderSheet::where('join_sheet_order_id', $params['order_id'])->update($data);
|
|
@@ -573,10 +579,6 @@ class KangyangCityController extends Curd
|
|
|
$payData['pay_addtimes'] = time();
|
|
|
|
|
|
PayDetail::insert($payData);
|
|
|
-// } else {
|
|
|
-// // 更新非微信支付宝的支付记录
|
|
|
-// PayDetail::where('join_pay_order_id', $order->order_groupby)->where('pay_category', '<>', 'WXPAY')->where('pay_category', '<>', 'ALIPAY')->update($payData);
|
|
|
-// }
|
|
|
|
|
|
// 2.4W 康养城
|
|
|
if ($params['goods_classify'] == 'VIP' && $order->order_status_payment == 'SUCCESS' && floatval($order->order_amount_paid) >= $order->order_amount_total) {
|
|
@@ -693,10 +695,10 @@ class KangyangCityController extends Curd
|
|
|
$extendJson['table'] = null;
|
|
|
}
|
|
|
$orderSheetStatus = 'PAYING';
|
|
|
- if ($params['settlement_now'] == 'Y' && $params['order_status_payment'] == 'SUCCESS'){
|
|
|
- if (floatval($params['order_amount_pay']) >= floatval($params['order_amount_total'])){
|
|
|
+ if ($params['settlement_now'] == 'Y' && $params['order_status_payment'] == 'SUCCESS') {
|
|
|
+ if (floatval($params['order_amount_pay']) >= floatval($params['order_amount_total'])) {
|
|
|
$orderSheetStatus = 'DONE';
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
$orderSheetStatus = 'BEING';
|
|
|
}
|
|
|
}
|
|
@@ -705,7 +707,7 @@ class KangyangCityController extends Curd
|
|
|
'join_sheet_order_id' => $params['orderId'],
|
|
|
'join_sheet_goods_id' => $goods['goods_id'],
|
|
|
'join_sheet_goods_sku_id' => $goods['sku_id'],
|
|
|
- 'order_sheet_status' => $orderSheetStatus,
|
|
|
+ 'order_sheet_status' => $orderSheetStatus,
|
|
|
'order_sheet_category' => (isset($params['submit_goods_classify']) && $params['submit_goods_classify'] == 'MEALS') ? 'DISHES' : 'NORMAL',
|
|
|
'order_sheet_num' => $goods['nbr'],
|
|
|
'order_sheet_price' => $goods['goods_sales_price'],
|
|
@@ -964,7 +966,7 @@ class KangyangCityController extends Curd
|
|
|
}
|
|
|
$order->sheet_amount = number_format($sheetAmount, 2);
|
|
|
|
|
|
- $payDetails = PayDetail::where('join_pay_order_id', $order->order_groupby)
|
|
|
+ $payDetails = PayDetail::whereJsonContains('join_pay_object_json->order_id', $order->order_id)
|
|
|
->where('pay_category', 'VIP')
|
|
|
->where('pay_status', 'SUCCESS')
|
|
|
->select('pay_id', 'pay_category', 'pay_prepayid', 'pay_paytimes', 'pay_status', 'pay_amount', 'pay_extend_json')
|
|
@@ -1094,16 +1096,16 @@ class KangyangCityController extends Curd
|
|
|
public function getPaidOrder(Request $request)
|
|
|
{
|
|
|
$memberId = $request->get('member_id');
|
|
|
- if (!$memberId){
|
|
|
+ if (!$memberId) {
|
|
|
return json_fail('参数异常');
|
|
|
}
|
|
|
|
|
|
- $order = Order::where('join_order_member_id',$memberId)
|
|
|
- ->where('order_category','VIP')
|
|
|
- ->where('order_status_system','PAYING')
|
|
|
- ->select('order_id','order_amount_total','order_amount_paid','order_amount_pay')
|
|
|
+ $order = Order::where('join_order_member_id', $memberId)
|
|
|
+ ->where('order_category', 'VIP')
|
|
|
+ ->where('order_status_system', 'PAYING')
|
|
|
+ ->select('order_id', 'order_amount_total', 'order_amount_paid', 'order_amount_pay')
|
|
|
->first();
|
|
|
|
|
|
- return json_success('',$order);
|
|
|
+ return json_success('', $order);
|
|
|
}
|
|
|
}
|