|
@@ -408,7 +408,7 @@ class WholeController extends Curd
|
|
|
} else {
|
|
|
$item['skus'] = [];
|
|
|
}
|
|
|
- if (in_array($item['goods']['goods_classify'], ['SERVICE', 'CHNMED', 'CHNNCD', 'PACKAGE']) && $order->order_status_system == 'DONE') {
|
|
|
+ if (in_array($item['goods']['goods_classify'], ['SERVICE', 'CHNMED', 'CHNNCD'])) {
|
|
|
$item['appontment'] = [];
|
|
|
$appontments = Appointment::where('join_appointment_order_id', $orderId)
|
|
|
->where('appointment_status', 'DONE')
|
|
@@ -544,7 +544,7 @@ class WholeController extends Curd
|
|
|
$classify = CouponService::couponClassifyInfo($coupon->coupon_classify, $coupon->coupon_category, $coupon->coupon_value, $coupon->coupon_minimum_limit);
|
|
|
$discount['coupon_name'] .= $coupon->coupon_classify . ':' . $coupon->coupon_name . '(优惠¥' . sprintf("%.2f", $discountItem['coupon_value']) . '), ';
|
|
|
}
|
|
|
- if ($discountItem['coupon_classify'] == '退款'){
|
|
|
+ if ($discountItem['coupon_classify'] == '退款') {
|
|
|
continue;
|
|
|
}
|
|
|
if (empty($discountItem['coupon_id']) && !empty($discountItem['coupon_classify'])) {
|
|
@@ -885,7 +885,7 @@ class WholeController extends Curd
|
|
|
$order->order_status_system = $systemStatus;
|
|
|
$order->order_status_payment = 'SUCCESS';
|
|
|
}
|
|
|
- } else if ($params['pay_category'] == 'VIP') { // 余额支付
|
|
|
+ } else if ($params['pay_category'] == 'VIP') { // 余额支付
|
|
|
$account = MemberAccount::where('join_account_member_id', $params['join_order_member_id'])
|
|
|
->where('member_account_classify', 'VIP')
|
|
|
->where('member_account_status', 'ACTIVED')
|
|
@@ -1148,7 +1148,7 @@ class WholeController extends Curd
|
|
|
$payData['pay_prepayid'] = $params['join_order_member_id'] . '-CASH';
|
|
|
} else if ($params['pay_category'] == 'WELFARE') {
|
|
|
$payData['pay_prepayid'] = $params['join_order_member_id'] . '-WELFARE';
|
|
|
- } else if ($params['pay_category'] == 'VIP') {
|
|
|
+ } else if ($params['pay_category'] == 'VIP') {
|
|
|
$payData['pay_prepayid'] = $params['join_order_member_id'] . '-VIP';
|
|
|
} else if ($params['pay_category'] == 'CARD') {
|
|
|
$payData['pay_prepayid'] = $params['card_nbr'];
|
|
@@ -1213,11 +1213,11 @@ class WholeController extends Curd
|
|
|
foreach ($params['goodsContentList'] as $goods) {
|
|
|
$params['join_sheet_goods_id'] = $goods['goods_id'];
|
|
|
if (isset($goods['goods_classify']) && in_array($goods['goods_classify'], ['SERVICE', 'CHNMED', 'CHNNCD'])) {
|
|
|
- $params['benefitId'] = 'BF' . date('ymdH') . random_string(6, 'up');
|
|
|
+ $params['benefitId'] = 'BF' . date('ymdHi') . random_string(4, 'up');
|
|
|
$params['order_sheet_num'] = $goods['nbr'];
|
|
|
// 预约表
|
|
|
for ($i = 0; $i < intval($params['order_sheet_num']); $i++) {
|
|
|
- $params['appointmentId'] = 'AP' . date('ymdH') . random_string(6, 'up');
|
|
|
+ $params['appointmentId'] = 'AP' . date('ymdHi') . random_string(4, 'up');
|
|
|
// 入预约记录
|
|
|
$this->insertAppointment($params, $writeOffDate, $applyData);
|
|
|
}
|
|
@@ -1237,10 +1237,10 @@ class WholeController extends Curd
|
|
|
foreach ($components as $component) {
|
|
|
$componentJson = json_decode($component['goods_component_json'], true);
|
|
|
$params['join_sheet_goods_sku_id'] = $componentJson['sku_id'];
|
|
|
- $params['benefitId'] = 'BF' . date('ymdH') . random_string(6, 'up');
|
|
|
+ $params['benefitId'] = 'BF' . date('ymdHi') . random_string(4, 'up');
|
|
|
$params['order_sheet_num'] = $goods['nbr'] * $componentJson['nbr'];
|
|
|
for ($i = 0; $i < intval($params['order_sheet_num']); $i++) {
|
|
|
- $params['appointmentId'] = 'AP' . date('ymdH') . random_string(6, 'up');
|
|
|
+ $params['appointmentId'] = 'AP' . date('ymdHi') . random_string(4, 'up');
|
|
|
// 入预约记录
|
|
|
$this->insertAppointment($params, $writeOffDate);
|
|
|
}
|
|
@@ -1658,11 +1658,11 @@ class WholeController extends Curd
|
|
|
foreach ($params['goodsContentList'] as $goods) {
|
|
|
$params['join_sheet_goods_id'] = $goods['goods_id'];
|
|
|
if (isset($goods['goods_classify']) && in_array($goods['goods_classify'], ['SERVICE', 'CHNMED', 'CHNNCD'])) {
|
|
|
- $params['benefitId'] = 'BF' . date('ymdH') . random_string(6, 'up');
|
|
|
+ $params['benefitId'] = 'BF' . date('ymdHi') . random_string(4, 'up');
|
|
|
$params['order_sheet_num'] = $goods['nbr'];
|
|
|
// 预约表
|
|
|
for ($i = 0; $i < intval($params['order_sheet_num']); $i++) {
|
|
|
- $params['appointmentId'] = 'AP' . date('ymdH') . random_string(6, 'up');
|
|
|
+ $params['appointmentId'] = 'AP' . date('ymdHi') . random_string(4, 'up');
|
|
|
// 入预约记录
|
|
|
$this->insertAppointment($params, $writeOffDate, $applyData);
|
|
|
}
|
|
@@ -1682,10 +1682,10 @@ class WholeController extends Curd
|
|
|
foreach ($components as $component) {
|
|
|
$componentJson = json_decode($component['goods_component_json'], true);
|
|
|
$params['join_sheet_goods_sku_id'] = $componentJson['sku_id'];
|
|
|
- $params['benefitId'] = 'BF' . date('ymdH') . random_string(6, 'up');
|
|
|
+ $params['benefitId'] = 'BF' . date('ymdHi') . random_string(4, 'up');
|
|
|
$params['order_sheet_num'] = $goods['nbr'] * $componentJson['nbr'];
|
|
|
for ($i = 0; $i < intval($params['order_sheet_num']); $i++) {
|
|
|
- $params['appointmentId'] = 'AP' . date('ymdH') . random_string(6, 'up');
|
|
|
+ $params['appointmentId'] = 'AP' . date('ymdHi') . random_string(4, 'up');
|
|
|
// 入预约记录
|
|
|
$this->insertAppointment($params, $writeOffDate);
|
|
|
}
|
|
@@ -1946,7 +1946,7 @@ class WholeController extends Curd
|
|
|
}
|
|
|
}
|
|
|
// 余额、福利、储值卡 验证短信
|
|
|
- if ($params['settlement_now'] == 'Y' && $params['pay_constitute'] == 'N' && in_array($params['pay_category'], ['CASH', 'CARD', 'WELFARE','VIP'])) {
|
|
|
+ if ($params['settlement_now'] == 'Y' && $params['pay_constitute'] == 'N' && in_array($params['pay_category'], ['CASH', 'CARD', 'WELFARE', 'VIP'])) {
|
|
|
$code = $params['sms_code'];
|
|
|
if (!$code) {
|
|
|
throw new BusinessException('验证码错误,请重新输入');
|
|
@@ -1972,7 +1972,7 @@ class WholeController extends Curd
|
|
|
if (Member::where('member_mobile', $params['mobile'])->exists()) {
|
|
|
throw new BusinessException('会员已存在');
|
|
|
}
|
|
|
- $params['join_order_member_id'] = $params['member_id'] = 'MR' . date('ymdH') . random_string(6, 'up');
|
|
|
+ $params['join_order_member_id'] = $params['member_id'] = 'MR' . date('ymdHi') . random_string(4, 'up');
|
|
|
// 创建会员
|
|
|
MemberService::createMember($params);
|
|
|
} else if (empty($params['join_order_member_id']) && empty($params['mobile'])) {
|
|
@@ -1983,8 +1983,8 @@ class WholeController extends Curd
|
|
|
}
|
|
|
|
|
|
$qrcodePayAmount = 0;
|
|
|
- $params['orderId'] = 'OD' . date('ymdH') . random_string(6, 'up');
|
|
|
- $params['orderGroupId'] = 'OD' . date('ymdH') . random_string(6, 'up');
|
|
|
+ $params['orderId'] = 'OD' . date('ymdHi') . random_string(4, 'up');
|
|
|
+ $params['orderGroupId'] = 'OD' . date('ymdHi') . random_string(4, 'up');
|
|
|
|
|
|
$systemStatus = 'SENDING'; // 待发货
|
|
|
// 立即结算
|
|
@@ -2366,13 +2366,13 @@ class WholeController extends Curd
|
|
|
foreach ($params['goodsContentList'] as $goods) {
|
|
|
$params['join_sheet_goods_id'] = $goods['goods_id'];
|
|
|
if (isset($goods['goods_classify']) && in_array($goods['goods_classify'], ['SERVICE', 'CHNMED', 'CHNNCD'])) {
|
|
|
- $params['benefitId'] = 'BF' . date('ymdH') . random_string(6, 'up');
|
|
|
+ $params['benefitId'] = 'BF' . date('ymdHi') . random_string(4, 'up');
|
|
|
$params['join_sheet_goods_sku_id'] = $goods['sku_id'];
|
|
|
$params['goods_id'] = $goods['goods_id'];
|
|
|
$params['order_sheet_num'] = $goods['nbr'];
|
|
|
// 预约表
|
|
|
for ($i = 0; $i < intval($params['order_sheet_num']); $i++) {
|
|
|
- $params['appointmentId'] = 'AP' . date('ymdH') . random_string(6, 'up');
|
|
|
+ $params['appointmentId'] = 'AP' . date('ymdHi') . random_string(4, 'up');
|
|
|
// 入预约记录
|
|
|
$this->insertAppointment($params, $writeOffDate, $applyData);
|
|
|
}
|
|
@@ -2392,10 +2392,10 @@ class WholeController extends Curd
|
|
|
foreach ($components as $component) {
|
|
|
$componentJson = json_decode($component['goods_component_json'], true);
|
|
|
$params['join_sheet_goods_sku_id'] = $componentJson['sku_id'];
|
|
|
- $params['benefitId'] = 'BF' . date('ymdH') . random_string(6, 'up');
|
|
|
+ $params['benefitId'] = 'BF' . date('ymdHi') . random_string(4, 'up');
|
|
|
$params['order_sheet_num'] = $goods['nbr'] * $componentJson['nbr'];
|
|
|
for ($i = 0; $i < intval($params['order_sheet_num']); $i++) {
|
|
|
- $params['appointmentId'] = 'AP' . date('ymdH') . random_string(6, 'up');
|
|
|
+ $params['appointmentId'] = 'AP' . date('ymdHi') . random_string(4, 'up');
|
|
|
// 入预约记录
|
|
|
$this->insertAppointment($params, $writeOffDate);
|
|
|
}
|
|
@@ -2577,7 +2577,7 @@ class WholeController extends Curd
|
|
|
if (Member::where('member_mobile', $params['mobile'])->exists()) {
|
|
|
throw new BusinessException("会员已存在");
|
|
|
}
|
|
|
- $params['join_order_member_id'] = $params['member_id'] = 'MR' . date('ymdH') . random_string(6, 'up');
|
|
|
+ $params['join_order_member_id'] = $params['member_id'] = 'MR' . date('ymdHi') . random_string(4, 'up');
|
|
|
// 创建会员
|
|
|
MemberService::createMember($params);
|
|
|
} else if (empty($params['join_order_member_id']) && empty($params['mobile'])) {
|
|
@@ -2588,9 +2588,9 @@ class WholeController extends Curd
|
|
|
}
|
|
|
|
|
|
$qrcodePayAmount = 0;
|
|
|
- $params['orderId'] = 'OD' . date('ymdH') . random_string(6, 'up');
|
|
|
- $params['orderGroupId'] = 'OD' . date('ymdH') . random_string(6, 'up');
|
|
|
- $params['benefitId'] = 'BF' . date('ymdH') . random_string(6, 'up');
|
|
|
+ $params['orderId'] = 'OD' . date('ymdHi') . random_string(4, 'up');
|
|
|
+ $params['orderGroupId'] = 'OD' . date('ymdHi') . random_string(4, 'up');
|
|
|
+ $params['benefitId'] = 'BF' . date('ymdHi') . random_string(4, 'up');
|
|
|
|
|
|
$systemStatus = 'SENDING'; // 待发货
|
|
|
// 立即结算
|
|
@@ -2850,13 +2850,13 @@ class WholeController extends Curd
|
|
|
foreach ($params['goodsContentList'] as $goods) {
|
|
|
$params['join_sheet_goods_id'] = $goods['goods_id'];
|
|
|
if (isset($goods['goods_classify']) && in_array($goods['goods_classify'], ['SERVICE', 'CHNMED', 'CHNNCD'])) {
|
|
|
- $params['benefitId'] = 'BF' . date('ymdH') . random_string(6, 'up');
|
|
|
+ $params['benefitId'] = 'BF' . date('ymdHi') . random_string(4, 'up');
|
|
|
$params['join_sheet_goods_sku_id'] = $goods['sku_id'];
|
|
|
$params['goods_id'] = $goods['goods_id'];
|
|
|
$params['order_sheet_num'] = $goods['nbr'];
|
|
|
// 预约表
|
|
|
for ($i = 0; $i < intval($params['order_sheet_num']); $i++) {
|
|
|
- $params['appointmentId'] = 'AP' . date('ymdH') . random_string(6, 'up');
|
|
|
+ $params['appointmentId'] = 'AP' . date('ymdHi') . random_string(4, 'up');
|
|
|
// 入预约记录
|
|
|
$this->insertAppointment($params, $writeOffDate, $applyData);
|
|
|
}
|
|
@@ -2876,10 +2876,10 @@ class WholeController extends Curd
|
|
|
foreach ($components as $component) {
|
|
|
$componentJson = json_decode($component['goods_component_json'], true);
|
|
|
$params['join_sheet_goods_sku_id'] = $componentJson['sku_id'];
|
|
|
- $params['benefitId'] = 'BF' . date('ymdH') . random_string(6, 'up');
|
|
|
+ $params['benefitId'] = 'BF' . date('ymdHi') . random_string(4, 'up');
|
|
|
$params['order_sheet_num'] = $goods['nbr'] * $componentJson['nbr'];
|
|
|
for ($i = 0; $i < intval($params['order_sheet_num']); $i++) {
|
|
|
- $params['appointmentId'] = 'AP' . date('ymdH') . random_string(6, 'up');
|
|
|
+ $params['appointmentId'] = 'AP' . date('ymdHi') . random_string(4, 'up');
|
|
|
// 入预约记录
|
|
|
$this->insertAppointment($params, $writeOffDate);
|
|
|
}
|
|
@@ -4610,6 +4610,71 @@ class WholeController extends Curd
|
|
|
return json_success("success", ['pay_amount' => $amountBalance['pay_amount']]);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Desc 订单的核销记录
|
|
|
+ * @Author Gorden
|
|
|
+ * @Date 2024/9/13 14:28
|
|
|
+ *
|
|
|
+ * @param Request $request
|
|
|
+ * @return Response
|
|
|
+ */
|
|
|
+ public function writeOffList(Request $request)
|
|
|
+ {
|
|
|
+ $orderId = $request->get('order_id');
|
|
|
+ $page = $request->get('page', 1);
|
|
|
+ $pageSize = $request->get('pageSize', 20);
|
|
|
+ if (!$orderId) {
|
|
|
+ return json_fail("参数异常");
|
|
|
+ }
|
|
|
+
|
|
|
+ $appointments = Appointment::with([
|
|
|
+ 'member' => function ($query) {
|
|
|
+ $query->select('member_id', 'member_mobile');
|
|
|
+ },
|
|
|
+ 'memberInfo',
|
|
|
+ 'cert',
|
|
|
+ 'goods' => function ($query) {
|
|
|
+ $query->select('goods_id', 'goods_name');
|
|
|
+ }
|
|
|
+ ])->where('join_appointment_order_id', $orderId)
|
|
|
+ ->where('appointment_status', 'DONE')
|
|
|
+ ->select('join_appointment_member_id', 'join_appointment_goods_id','appointment_done_datetime','appointment_done_json');
|
|
|
+ $total = $appointments->count();
|
|
|
+ $rows = $appointments->forPage($page, $pageSize)
|
|
|
+ ->orderBy('appointment_done_datetime', 'DESC')
|
|
|
+ ->get();
|
|
|
+ foreach ($rows as &$item){
|
|
|
+ $memberMobile = '';
|
|
|
+ if (!empty($item['member']) && !empty($item['member']['member_mobile'])){
|
|
|
+ $memberMobile = $item['member']['member_mobile'];
|
|
|
+ }
|
|
|
+ $memberNickname = '';
|
|
|
+ if (!empty($item['member_info']) && !empty($item['member_info']['member_info_nickname'])){
|
|
|
+ $memberNickname = $item['member_info']['member_info_nickname'];
|
|
|
+ }
|
|
|
+ $memberName = '';
|
|
|
+ if (!empty($item['cert']) && !empty($item['cert']['member_cert_name'])){
|
|
|
+ $memberName = $item['cert']['member_cert_name'];
|
|
|
+ }
|
|
|
+ unset($item['member'],$item['member_info'],$item['cert']);
|
|
|
+ $item['member_name'] = MemberService::getMemberName($memberMobile,$memberName,$memberNickname);
|
|
|
+ if (!empty($item['appointment_done_json'])){
|
|
|
+ $doneJson = json_decode($item['appointment_done_json'],true);
|
|
|
+ if (isset($doneJson['charge']) && !empty($doneJson['charge']['charge_user_id'])){
|
|
|
+ $item['username'] = SysUser::where('user_id',$doneJson['charge']['charge_user_id'])->value('user_name');
|
|
|
+ }
|
|
|
+ if (isset($doneJson['charge']) && !empty($doneJson['charge']['charge_premises'])){
|
|
|
+ $item['premise'] = $doneJson['charge']['charge_premises'];
|
|
|
+ }
|
|
|
+ $item['nbr'] = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return json_success('', compact('rows', 'page', 'pageSize', 'total'));
|
|
|
+ }
|
|
|
+
|
|
|
public static $goodsClassify = [
|
|
|
// goodsClassify: {GOODS:"健康产品订单",SERVICE:"服务订单",DEVICE:"设备订单",SPECIAL:"专题业务订单",PACKAGE:"套餐订单",RECHARGE:"充值订单",OTHER:"其他订单"},
|
|
|
|