|
@@ -172,26 +172,31 @@ class RefundController extends Curd
|
|
$total = $totalModel->selectRaw("SUM(JSON_UNQUOTE(JSON_EXTRACT(order_return_apply_json,'$.amount'))) as amount,count(orders_return_id) as total")
|
|
$total = $totalModel->selectRaw("SUM(JSON_UNQUOTE(JSON_EXTRACT(order_return_apply_json,'$.amount'))) as amount,count(orders_return_id) as total")
|
|
->first()
|
|
->first()
|
|
->toArray();
|
|
->toArray();
|
|
|
|
+ $total['amount'] = sprintf('%.2f', round($total['amount'], 2));
|
|
$pendingTotalModel = clone $returnModel;
|
|
$pendingTotalModel = clone $returnModel;
|
|
$pendingTotal = $pendingTotalModel->where('order_return_status', 'PENDING')
|
|
$pendingTotal = $pendingTotalModel->where('order_return_status', 'PENDING')
|
|
->selectRaw("SUM(JSON_UNQUOTE(JSON_EXTRACT(order_return_apply_json,'$.amount'))) as amount,count(orders_return_id) as total")
|
|
->selectRaw("SUM(JSON_UNQUOTE(JSON_EXTRACT(order_return_apply_json,'$.amount'))) as amount,count(orders_return_id) as total")
|
|
->first()
|
|
->first()
|
|
->toArray();
|
|
->toArray();
|
|
|
|
+ $pendingTotal['amount'] = sprintf('%.2f', round($pendingTotal['amount'], 2));
|
|
$doingTotalModel = clone $returnModel;
|
|
$doingTotalModel = clone $returnModel;
|
|
$doingTotal = $doingTotalModel->where('order_return_status', 'DOING')
|
|
$doingTotal = $doingTotalModel->where('order_return_status', 'DOING')
|
|
->selectRaw("SUM(JSON_UNQUOTE(JSON_EXTRACT(order_return_apply_json,'$.amount'))) as amount,count(orders_return_id) as total")
|
|
->selectRaw("SUM(JSON_UNQUOTE(JSON_EXTRACT(order_return_apply_json,'$.amount'))) as amount,count(orders_return_id) as total")
|
|
->first()
|
|
->first()
|
|
->toArray();
|
|
->toArray();
|
|
|
|
+ $doingTotal['amount'] = sprintf('%.2f', round($doingTotal['amount'], 2));
|
|
$disagreeTotalModel = clone $returnModel;
|
|
$disagreeTotalModel = clone $returnModel;
|
|
$disagreeTotal = $disagreeTotalModel->where('order_return_status', 'DISAGREE')
|
|
$disagreeTotal = $disagreeTotalModel->where('order_return_status', 'DISAGREE')
|
|
->selectRaw("SUM(JSON_UNQUOTE(JSON_EXTRACT(order_return_apply_json,'$.amount'))) as amount,count(orders_return_id) as total")
|
|
->selectRaw("SUM(JSON_UNQUOTE(JSON_EXTRACT(order_return_apply_json,'$.amount'))) as amount,count(orders_return_id) as total")
|
|
->first()
|
|
->first()
|
|
->toArray();
|
|
->toArray();
|
|
|
|
+ $disagreeTotal['amount'] = sprintf('%.2f', round($disagreeTotal['amount'], 2));
|
|
$doneTotalModel = clone $returnModel;
|
|
$doneTotalModel = clone $returnModel;
|
|
$doneTotal = $doneTotalModel->where('order_return_status', 'DONE')
|
|
$doneTotal = $doneTotalModel->where('order_return_status', 'DONE')
|
|
->selectRaw("SUM(JSON_UNQUOTE(JSON_EXTRACT(order_return_apply_json,'$.amount'))) as amount,count(orders_return_id) as total")
|
|
->selectRaw("SUM(JSON_UNQUOTE(JSON_EXTRACT(order_return_apply_json,'$.amount'))) as amount,count(orders_return_id) as total")
|
|
->first()
|
|
->first()
|
|
->toArray();
|
|
->toArray();
|
|
|
|
+ $doneTotal['amount'] = sprintf('%.2f', round($doneTotal['amount'], 2));
|
|
|
|
|
|
return json_success('success', [
|
|
return json_success('success', [
|
|
'total' => $total,
|
|
'total' => $total,
|
|
@@ -238,7 +243,7 @@ class RefundController extends Curd
|
|
$orderId = $request->get('order_id');
|
|
$orderId = $request->get('order_id');
|
|
$orderSheet = OrderSheet::with([
|
|
$orderSheet = OrderSheet::with([
|
|
'member' => function ($query) {
|
|
'member' => function ($query) {
|
|
- $query->select('member_id', 'member_mobile', 'join_member_role_id', 'member_is_owner', 'member_is_vip', 'member_is_partner', 'member_is_referrer','member_is_franchisee');
|
|
|
|
|
|
+ $query->select('member_id', 'member_mobile', 'join_member_role_id', 'member_is_owner', 'member_is_vip', 'member_is_partner', 'member_is_referrer', 'member_is_franchisee');
|
|
},
|
|
},
|
|
'goods' => function ($query) {
|
|
'goods' => function ($query) {
|
|
$query->select('goods_id', 'goods_name', 'goods_cover', 'goods_market_price', 'goods_sales_price', 'goods_classify');
|
|
$query->select('goods_id', 'goods_name', 'goods_cover', 'goods_market_price', 'goods_sales_price', 'goods_classify');
|
|
@@ -484,7 +489,7 @@ class RefundController extends Curd
|
|
$payDetail = PayDetail::where('join_pay_order_id', $order->order_groupby)
|
|
$payDetail = PayDetail::where('join_pay_order_id', $order->order_groupby)
|
|
->whereJsonContains('join_pay_object_json->order_id', $orderId)
|
|
->whereJsonContains('join_pay_object_json->order_id', $orderId)
|
|
->where('pay_status', 'SUCCESS')
|
|
->where('pay_status', 'SUCCESS')
|
|
- ->where('pay_prepayid','<>','')
|
|
|
|
|
|
+ ->where('pay_prepayid', '<>', '')
|
|
->whereIn('pay_category', ['GOODS', 'SERVICE', 'CHNMED', 'CHNNCD', 'MEALS', 'DISHES', 'VIP', 'PACKAGE'])
|
|
->whereIn('pay_category', ['GOODS', 'SERVICE', 'CHNMED', 'CHNNCD', 'MEALS', 'DISHES', 'VIP', 'PACKAGE'])
|
|
->get()
|
|
->get()
|
|
->toArray();
|
|
->toArray();
|
|
@@ -620,7 +625,7 @@ class RefundController extends Curd
|
|
throw new BusinessException("余额账户异常");
|
|
throw new BusinessException("余额账户异常");
|
|
}
|
|
}
|
|
$account->member_account_surplus = $account->member_account_surplus + $amount;
|
|
$account->member_account_surplus = $account->member_account_surplus + $amount;
|
|
- $account->member_account_expend = $account->member_account_expend - $amount;
|
|
|
|
|
|
+ $account->member_account_expend = $account->member_account_expend - $amount;
|
|
$account->member_account_update_user_id = JwtToken::getCurrentId();
|
|
$account->member_account_update_user_id = JwtToken::getCurrentId();
|
|
$account->member_account_updatetimes = time();
|
|
$account->member_account_updatetimes = time();
|
|
$account->save();
|
|
$account->save();
|
|
@@ -643,7 +648,7 @@ class RefundController extends Curd
|
|
throw new BusinessException("余额账户异常");
|
|
throw new BusinessException("余额账户异常");
|
|
}
|
|
}
|
|
$account->member_account_surplus = $account->member_account_surplus + $amount;
|
|
$account->member_account_surplus = $account->member_account_surplus + $amount;
|
|
- $account->member_account_expend = $account->member_account_expend - $amount;
|
|
|
|
|
|
+ $account->member_account_expend = $account->member_account_expend - $amount;
|
|
$account->member_account_update_user_id = JwtToken::getCurrentId();
|
|
$account->member_account_update_user_id = JwtToken::getCurrentId();
|
|
$account->member_account_updatetimes = time();
|
|
$account->member_account_updatetimes = time();
|
|
$account->save();
|
|
$account->save();
|
|
@@ -666,7 +671,7 @@ class RefundController extends Curd
|
|
throw new BusinessException("余额账户异常");
|
|
throw new BusinessException("余额账户异常");
|
|
}
|
|
}
|
|
$account->member_account_surplus = $account->member_account_surplus + $amount;
|
|
$account->member_account_surplus = $account->member_account_surplus + $amount;
|
|
- $account->member_account_expend = $account->member_account_expend - $amount;
|
|
|
|
|
|
+ $account->member_account_expend = $account->member_account_expend - $amount;
|
|
$account->member_account_update_user_id = JwtToken::getCurrentId();
|
|
$account->member_account_update_user_id = JwtToken::getCurrentId();
|
|
$account->member_account_updatetimes = time();
|
|
$account->member_account_updatetimes = time();
|
|
$account->save();
|
|
$account->save();
|
|
@@ -690,7 +695,7 @@ class RefundController extends Curd
|
|
throw new BusinessException("储值卡账户异常");
|
|
throw new BusinessException("储值卡账户异常");
|
|
}
|
|
}
|
|
$account->member_account_surplus = $account->member_account_surplus + $amount;
|
|
$account->member_account_surplus = $account->member_account_surplus + $amount;
|
|
- $account->member_account_expend = $account->member_account_expend - $amount;
|
|
|
|
|
|
+ $account->member_account_expend = $account->member_account_expend - $amount;
|
|
$account->member_account_update_user_id = JwtToken::getCurrentId();
|
|
$account->member_account_update_user_id = JwtToken::getCurrentId();
|
|
$account->member_account_updatetimes = time();
|
|
$account->member_account_updatetimes = time();
|
|
$account->save();
|
|
$account->save();
|