|
@@ -255,6 +255,10 @@ class WholeController extends Curd
|
|
|
$item['payWay'] = '付款码';
|
|
|
} else if (!empty($payWay[0]) && $payWay[0] == 'OFFLINE') {
|
|
|
$item['payWay'] = '线下支付';
|
|
|
+ } else if (!empty($payWay[0]) && $payWay[0] == 'OFFLINE_ALIPAY') {
|
|
|
+ $item['payWay'] = '线下支付-支付宝';
|
|
|
+ } else if (!empty($payWay[0]) && $payWay[0] == 'OFFLINE_WXPAY') {
|
|
|
+ $item['payWay'] = '线下支付-微信';
|
|
|
} else if (!empty($payWay[0]) && $payWay[0] == 'WXPAY') {
|
|
|
$item['payWay'] = '微信支付';
|
|
|
} else if (!empty($payWay[0]) && $payWay[0] == 'ALIPAY') {
|
|
@@ -311,13 +315,6 @@ class WholeController extends Curd
|
|
|
if ($express && $express->order_express_type == '自提') {
|
|
|
$premises = $express->order_express_company;
|
|
|
}
|
|
|
- // if (!empty($express->order_express_code)){
|
|
|
- // $expressCode = explode(':',$express->order_express_code);
|
|
|
- // if(count($expressCode) == 2){
|
|
|
- // $express->order_express_company = $expressCode[0];
|
|
|
- // $express->order_express_code = $expressCode[1];
|
|
|
- // }
|
|
|
- // }
|
|
|
$sheetAmount = 0;
|
|
|
foreach ($orderSheet as &$item) {
|
|
|
$sheetAmount += $item['order_sheet_amount'];
|
|
@@ -417,42 +414,6 @@ class WholeController extends Curd
|
|
|
'appointment_status' => $appontment['appointment_status'],
|
|
|
];
|
|
|
}
|
|
|
- // $benifits = MemberBenefit::where('join_benefit_member_id', $item['join_sheet_member_id'])
|
|
|
- // ->where('join_benefit_order_id', $orderId)
|
|
|
- // ->get();
|
|
|
- // if (!empty($benifits)) {
|
|
|
- // $item['appontment'] = [];
|
|
|
- // foreach($benifits as $benifit){
|
|
|
- // $item['benefit'] = [
|
|
|
- // 'total' => intval($benifit->member_benefit_limit_count),
|
|
|
- // 'used' => intval($benifit->member_benefit_used_count),
|
|
|
- // 'cut' => $benifit->member_benefit_limit_count - $benifit->member_benefit_used_count,
|
|
|
- // ];
|
|
|
- // $appontments = Appointment::where('join_appointment_member_benefit_id', $benifit->member_benefit_id)
|
|
|
- // ->where('appointment_status', 'DONE')
|
|
|
- // ->select('appointment_id', 'appointment_done_datetime', 'appointment_done_json')
|
|
|
- // ->get()
|
|
|
- // ->toArray();
|
|
|
- // foreach ($appontments as $appontment) {
|
|
|
- // $doneJson = [];
|
|
|
- // $username = '';
|
|
|
- // if (!empty($appontment['appointment_done_json'])) {
|
|
|
- // $doneJson = json_decode($appontment['appointment_done_json'], true);
|
|
|
- // if (isset($doneJson['charge'])) {
|
|
|
- // $username = SysUser::where('user_id', $doneJson['charge']['charge_user_id'])->value('user_name');
|
|
|
- // }
|
|
|
- // }
|
|
|
- // $item['appontment'][] = [
|
|
|
- // 'member' => ($item['cert'] ? $item['cert']['member_cert_name'] . '-' : '') . ($item['member'] ? $item['member']['member_mobile'] : ''),
|
|
|
- // 'goods_name' => $item['goods']['goods_name'].'-'.$benifit->member_benefit_name,
|
|
|
- // 'premisses' => isset($doneJson['charge']) ? $doneJson['charge']['charge_premises'] : '',
|
|
|
- // 'username' => $username,
|
|
|
- // 'nbr' => 1,
|
|
|
- // 'done_time' => $appontment['appointment_done_datetime']
|
|
|
- // ];
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
}
|
|
|
if (!empty($item['order_sheet_extend_json']) && !$express) {
|
|
|
$extendJson = json_decode($item['order_sheet_extend_json'], true);
|
|
@@ -494,21 +455,9 @@ class WholeController extends Curd
|
|
|
$categoryArray = explode('-', $payDetail->pay_prepayid);
|
|
|
if (isset($categoryArray[1])) {
|
|
|
$payDetail->pay_category = $categoryArray[1];
|
|
|
- } else if (in_array($categoryArray[0], ['WXPAY', 'ALIPAY'])) {
|
|
|
- $payDetail->pay_category = $categoryArray[0];
|
|
|
- } else if ($categoryArray[0] == 'OFFLINE') {
|
|
|
- $payDetail->pay_category = $categoryArray[0];
|
|
|
- } else if ($categoryArray[0] == 'MONEY') {
|
|
|
+ } else if (in_array($categoryArray[0], ['WXPAY', 'ALIPAY', 'OFFLINE', 'OFFLINE_ALIPAY', 'OFFLINE_WXPAY', 'MONEY'])) {
|
|
|
$payDetail->pay_category = $categoryArray[0];
|
|
|
- } else {
|
|
|
- if (MemberAccount::where('member_account_nbr', $categoryArray[0])->where('member_account_classify', 'CARD')->exists()) {
|
|
|
- $payDetail->pay_category = 'CARD';
|
|
|
- } else {
|
|
|
- $payDetail->pay_category = 'CASH';
|
|
|
- }
|
|
|
}
|
|
|
- } else if (!empty($payDetail)) {
|
|
|
- $payDetail->pay_category = 'CASH';
|
|
|
}
|
|
|
$refund = OrderReturn::where('join_return_order_id', $orderId)
|
|
|
->select('order_return_status', 'order_return_apply_datetime', 'order_return_apply_json', 'order_return_accept_datetime', 'order_return_refund_json', 'order_return_extend_json')
|
|
@@ -548,6 +497,28 @@ class WholeController extends Curd
|
|
|
$orderExtendJson = json_decode($order->order_extend_json, true);
|
|
|
$order->referee = $orderExtendJson['referee'] ?? '';
|
|
|
}
|
|
|
+ $discount = ['coupon_name' => '', 'classify' => '', 'value' => 0];
|
|
|
+ if (!empty($order->order_discount_json)) {
|
|
|
+ $orderDiscountJson = json_decode($order->order_discount_json, true);
|
|
|
+ foreach ($orderDiscountJson as $discountItem) {
|
|
|
+ if (!empty($discountItem['coupon_id'])) {
|
|
|
+ $discount['coupon_name'] .= Coupon::where('coupon_id', $discountItem['coupon_id'])->value('coupon_name') . ', ';
|
|
|
+ }
|
|
|
+ if (empty($discountItem['coupon_id']) && !empty($discountItem['coupon_classify'])){
|
|
|
+ $discount['classify'] .= $discountItem['coupon_classify'].'('.round($discountItem['coupon_value'],2).'), ';
|
|
|
+ }
|
|
|
+ if (!empty($discountItem['coupon_value'])){
|
|
|
+ $discount['value'] += $discountItem['coupon_value'];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!empty($discount['coupon_name'])){
|
|
|
+ $discount['coupon_name'] = rtrim($discount['coupon_name'],', ');
|
|
|
+ }
|
|
|
+ if (!empty($discount['classify'])){
|
|
|
+ $discount['classify'] = rtrim($discount['classify'],', ');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $order->discount = $discount;
|
|
|
|
|
|
$order->premises = $order->premises ?? $premises;
|
|
|
$data = [
|
|
@@ -807,6 +778,9 @@ class WholeController extends Curd
|
|
|
if ($params['pay_category'] == 'OFFLINE' || $params['pay_category'] == 'MONEY') {
|
|
|
$order->order_status_system = $systemStatus;
|
|
|
$order->order_status_payment = 'SUCCESS';
|
|
|
+ if ($params['pay_category'] == 'OFFLINE' && !empty($params['pay_category_sub'])) {
|
|
|
+ $params['pay_category'] = $params['pay_category_sub'];
|
|
|
+ }
|
|
|
} else if ($params['pay_category'] == 'CASH') { // 余额支付
|
|
|
$account = MemberAccount::where('join_account_member_id', $params['join_order_member_id'])
|
|
|
->where('member_account_classify', 'CASH')
|
|
@@ -1083,6 +1057,10 @@ class WholeController extends Curd
|
|
|
$payData['pay_prepayid'] = $params['card_nbr'];
|
|
|
} else if ($params['pay_category'] == 'OFFLINE') {
|
|
|
$payData['pay_prepayid'] = 'OFFLINE';
|
|
|
+ } else if ($params['pay_category'] == 'OFFLINE_ALIPAY') {
|
|
|
+ $payData['pay_prepayid'] = 'OFFLINE_ALIPAY';
|
|
|
+ } else if ($params['pay_category'] == 'OFFLINE_WXPAY') {
|
|
|
+ $payData['pay_prepayid'] = 'OFFLINE_WXPAY';
|
|
|
} else if ($params['pay_category'] == 'MONEY') {
|
|
|
$payData['pay_prepayid'] = 'MONEY';
|
|
|
}
|
|
@@ -1340,7 +1318,7 @@ class WholeController extends Curd
|
|
|
if (!empty($params['pay_category_constitute']) && in_array('OFFLINE', $params['pay_category_constitute'])) { //线下付款
|
|
|
$order->order_status_system = $systemStatus;
|
|
|
$order->order_status_payment = 'SUCCESS';
|
|
|
- $params['pay_category'] = 'OFFLINE';
|
|
|
+ $params['pay_category'] = $params['pay_category_sub'] ?? 'OFFLINE';
|
|
|
|
|
|
// 线下支付金额
|
|
|
if (isset($constituteList['OFFLINE'])) {
|
|
@@ -1350,7 +1328,7 @@ class WholeController extends Curd
|
|
|
}
|
|
|
$params['order_amount_pay'] = $orderAmountPay;
|
|
|
}
|
|
|
- if (!empty($params['pay_category_constitute']) && in_array('MONEY', $params['pay_category_constitute'])) { //线下付款
|
|
|
+ if (!empty($params['pay_category_constitute']) && in_array('MONEY', $params['pay_category_constitute'])) { //现金付款
|
|
|
$order->order_status_system = $systemStatus;
|
|
|
$order->order_status_payment = 'SUCCESS';
|
|
|
$params['pay_category'] = 'MONEY';
|
|
@@ -1787,7 +1765,7 @@ class WholeController extends Curd
|
|
|
}
|
|
|
|
|
|
if ($params['settlement_now'] == 'Y' && ($params['pay_category'] == 'OFFLINE' || $params['pay_category'] == 'MONEY')) {
|
|
|
- if ($params['pay_category'] == 'OFFLINE' && !empty($params['pay_category_sub'])){
|
|
|
+ if ($params['pay_category'] == 'OFFLINE' && !empty($params['pay_category_sub'])) {
|
|
|
$params['pay_category'] = $params['pay_category_sub'];
|
|
|
}
|
|
|
$params['order_status_system'] = $systemStatus;
|
|
@@ -2347,7 +2325,7 @@ class WholeController extends Curd
|
|
|
if (!empty($params['pay_category_constitute']) && in_array('OFFLINE', $params['pay_category_constitute'])) { // 线下支付
|
|
|
$params['order_status_system'] = $systemStatus;
|
|
|
$params['order_status_payment'] = 'SUCCESS';
|
|
|
- $params['pay_category'] = 'OFFLINE';
|
|
|
+ $params['pay_category'] = $params['pay_category_sub'] ?? 'OFFLINE';
|
|
|
|
|
|
// 线下支付金额
|
|
|
if (isset($constituteList['OFFLINE'])) {
|
|
@@ -2902,7 +2880,7 @@ class WholeController extends Curd
|
|
|
$payPrepayid = 'OFFLINE_ALIPAY';
|
|
|
} else if ($params['pay_category'] == 'OFFLINE_WXPAY') {
|
|
|
$payPrepayid = 'OFFLINE_WXPAY';
|
|
|
- } else if ($params['pay_category'] == 'MONEY') {
|
|
|
+ } else if ($params['pay_category'] == 'MONEY') {
|
|
|
$payPrepayid = 'MONEY';
|
|
|
} else {
|
|
|
$payPrepayid = $params['join_order_member_id'] . '-' . $params['pay_category'];
|
|
@@ -4100,7 +4078,7 @@ class WholeController extends Curd
|
|
|
}
|
|
|
$payDetails = PayDetail::where('join_pay_order_id', $item['order_groupby'])
|
|
|
->where('pay_status', 'SUCCESS')
|
|
|
- ->where('pay_category','<>','REFUND')
|
|
|
+ ->where('pay_category', '<>', 'REFUND')
|
|
|
->get()
|
|
|
->toArray();
|
|
|
if (count($payDetails) > 1) {
|