|
@@ -721,7 +721,7 @@ class RechargeController extends Curd
|
|
|
$query->select('member_id', 'member_mobile', 'member_is_owner', 'join_member_role_id', 'member_is_vip', 'member_is_partner', 'member_is_referrer');
|
|
|
},
|
|
|
'goods' => function ($query) {
|
|
|
- $query->select('goods_id', 'goods_name', 'goods_cover', 'goods_market_price', 'goods_sales_price', 'goods_classify', 'goods_if_express');
|
|
|
+ $query->select('goods_id', 'goods_name', 'goods_cover', 'goods_market_price', 'goods_sales_price', 'goods_classify', 'goods_if_express', 'goods_attribute_json');
|
|
|
},
|
|
|
'memberInfo',
|
|
|
'cert',
|
|
@@ -745,6 +745,7 @@ class RechargeController extends Curd
|
|
|
$premises = $express->order_express_company;
|
|
|
}
|
|
|
$sheetAmount = 0;
|
|
|
+ $coupons = [];
|
|
|
foreach ($orderSheet as &$item) {
|
|
|
$sheetAmount += $item['order_sheet_amount'];
|
|
|
$item['goods']['goods_cover'] = getenv('STORAGE_DOMAIN') . $item['goods']['goods_cover'];
|
|
@@ -810,38 +811,23 @@ class RechargeController extends Curd
|
|
|
} else {
|
|
|
$item['skus'] = [];
|
|
|
}
|
|
|
- if (in_array($item['goods']['goods_classify'], ['SERVICE', 'CHNMED', 'CHNNCD', 'PACKAGE']) && $order->order_status_system == 'DONE') {
|
|
|
- $item['appontment'] = [];
|
|
|
- $appontments = Appointment::where('join_appointment_order_id', $orderId)
|
|
|
- ->where('appointment_status', 'DONE')
|
|
|
- ->select('appointment_status', 'appointment_id', 'appointment_done_datetime', 'appointment_done_json', 'appointment_apply_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');
|
|
|
+ // 产品携带的优惠券
|
|
|
+ if (!empty($item['goods']['goods_attribute_json'])) {
|
|
|
+ $goodsAttributeJson = json_decode($item['goods']['goods_attribute_json'], true);
|
|
|
+ if (isset($goodsAttributeJson['coupon'])) {
|
|
|
+ $couponIds = array_keys($goodsAttributeJson['coupon']);
|
|
|
+ $coupons = Coupon::whereIn('coupon_id', $couponIds)
|
|
|
+ ->select('coupon_id', 'coupon_name', 'coupon_classify', 'coupon_is_period', 'coupon_period_json', 'coupon_addtimes')
|
|
|
+ ->get()
|
|
|
+ ->toArray();
|
|
|
+ foreach ($coupons as &$coupon) {
|
|
|
+ if (isset($goodsAttributeJson['coupon'][$coupon['coupon_id']])) {
|
|
|
+ $coupon['num'] = $goodsAttributeJson['coupon'][$coupon['coupon_id']]['num'];
|
|
|
}
|
|
|
}
|
|
|
- $person = 1;
|
|
|
- if (!empty($appontment->appointment_apply_json)) {
|
|
|
- $applyJson = json_decode($appontment->appointment_apply_json, true);
|
|
|
- if (isset($applyJson['person'])) {
|
|
|
- $person = $applyJson['person'];
|
|
|
- }
|
|
|
- }
|
|
|
- $item['appontment'][] = [
|
|
|
- 'member' => ($item['cert'] ? $item['cert']['member_cert_name'] . '-' : '') . ($item['member'] ? $item['member']['member_mobile'] : ''),
|
|
|
- 'goods_name' => $item['goods']['goods_name'],
|
|
|
- 'premisses' => isset($doneJson['charge']) ? $doneJson['charge']['charge_premises'] : '',
|
|
|
- 'username' => $username,
|
|
|
- 'nbr' => $person,
|
|
|
- 'done_time' => $appontment['appointment_done_datetime'],
|
|
|
- 'appointment_status' => $appontment['appointment_status'],
|
|
|
- ];
|
|
|
+ }
|
|
|
+ if (isset($goodsAttributeJson['added'])){
|
|
|
+ $item['goods']['added_rate'] = floatval($goodsAttributeJson['added']['nbr']) * 100;
|
|
|
}
|
|
|
}
|
|
|
if (!empty($item['order_sheet_extend_json']) && !$express) {
|
|
@@ -982,6 +968,7 @@ class RechargeController extends Curd
|
|
|
|
|
|
$order->premises = $order->premises ?? $premises;
|
|
|
$data = [
|
|
|
+ 'coupons' => $coupons,
|
|
|
'order' => $order,
|
|
|
'refund' => json_decode(json_encode($refund)),
|
|
|
'sheet' => json_decode(json_encode($orderSheet)),
|