|
|
@@ -438,7 +438,7 @@ class ServiceOrderLogic extends BaseLogic
|
|
|
$order_info = \app\common\model\recharge\RechargeOrder::with(['order_goods'=>function ($query) {
|
|
|
$query->visible(['goods_id','goods_name','goods_image','goods_number','good_unit']);
|
|
|
},'service_work'=>function ($query) {
|
|
|
- $query->visible(['id','work_sn','real_name','mobile','address','service_status','appointment_time','master_worker_id','work_images','explanation','finished_images','finished_time','spare_total','service_work_spare_id','refund_approval','property_activity_id','order_effective_id','external_platform_id'])->append(['service_status_text','user_service_status','user_service_status_text','external_platform_text']);
|
|
|
+ $query->visible(['id','work_sn','real_name','mobile','address','service_status','appointment_time','master_worker_id','work_images','explanation','finished_images','finished_time','spare_total','refund_approval','property_activity_id','order_effective_id','external_platform_id'])->append(['service_status_text','user_service_status','user_service_status_text','external_platform_text']);
|
|
|
}])
|
|
|
->visible(['id','sn','payment_type','order_total','order_amount','paid_amount','pay_status','create_time','title','work_id'])
|
|
|
->where([
|
|
|
@@ -529,17 +529,10 @@ class ServiceOrderLogic extends BaseLogic
|
|
|
// 所有配件
|
|
|
$order_info['spare_total'] = $order_info['service_work']['spare_total']??0;
|
|
|
$order_info['spare_parts'] = [];
|
|
|
- if($order_info['service_work']['service_work_spare_id']){
|
|
|
- $work_spare_parts = json_decode(ServiceWorkSpare::where('id',$order_info['service_work']['service_work_spare_id'])->value('spare_parts'),true);
|
|
|
- $spare_parts = SparePart::where('id','in',array_column($work_spare_parts,'id'))
|
|
|
- ->field(['id', 'goods_category_id', 'spare_name', 'spare_image', 'spare_number', 'spare_unit','spare_status'])
|
|
|
- ->select()
|
|
|
- ->toArray();
|
|
|
- $spare_parts = array_column($spare_parts,null,'id');
|
|
|
- foreach (array_column($work_spare_parts,null,'id') as $k=>&$v){
|
|
|
- $spare_parts[$k] = array_merge($spare_parts[$k],$v);
|
|
|
- }
|
|
|
- $order_info['spare_parts'] = array_values($spare_parts)??[];
|
|
|
+ $order_info['self_spare_parts'] = [];
|
|
|
+ if($order_info['service_work']['spare_total']){
|
|
|
+ $order_info['spare_parts'] = ServiceWorkSpare::getLists($order_info['work_id'], 1);
|
|
|
+ $order_info['self_spare_parts'] = ServiceWorkSpare::getLists($order_info['work_id'], 2);
|
|
|
}
|
|
|
|
|
|
//获取所有的改约记录
|
|
|
@@ -618,7 +611,7 @@ class ServiceOrderLogic extends BaseLogic
|
|
|
$order_info = \app\common\model\recharge\RechargeOrder::with(['order_goods'=>function ($query) {
|
|
|
$query->visible(['goods_id','goods_payment_type','goods_category_id']);
|
|
|
},'service_work'=>function ($query) {
|
|
|
- $query->visible(['service_fee','spare_total','service_work_spare_id','goods_category_id']);
|
|
|
+ $query->visible(['service_fee','spare_total','goods_category_id']);
|
|
|
}])
|
|
|
->visible(['id','pay_status','sn','work_id','coupon_id','coupon_price'])
|
|
|
->where([
|
|
|
@@ -689,17 +682,10 @@ class ServiceOrderLogic extends BaseLogic
|
|
|
// 所有配件
|
|
|
$order_info['spare_total'] = $order_info['service_work']['spare_total']??0;
|
|
|
$order_info['spare_parts'] = [];
|
|
|
- if($order_info['service_work']['service_work_spare_id']){
|
|
|
- $work_spare_parts = json_decode(ServiceWorkSpare::where('id',$order_info['service_work']['service_work_spare_id'])->value('spare_parts'),true);
|
|
|
- $spare_parts = SparePart::where('id','in',array_column($work_spare_parts,'id'))
|
|
|
- ->field(['id', 'goods_category_id', 'spare_name', 'spare_image', 'spare_number', 'spare_unit','spare_status'])
|
|
|
- ->select()
|
|
|
- ->toArray();
|
|
|
- $spare_parts = array_column($spare_parts,null,'id');
|
|
|
- foreach (array_column($work_spare_parts,null,'id') as $k=>&$v){
|
|
|
- $spare_parts[$k] = array_merge($spare_parts[$k],$v);
|
|
|
- }
|
|
|
- $order_info['spare_parts'] = array_values($spare_parts)??[];
|
|
|
+ $order_info['self_spare_parts'] = [];
|
|
|
+ if($order_info['service_work']['spare_total'] > 0){
|
|
|
+ $order_info['spare_parts'] = ServiceWorkSpare::getLists($order_info['work_id'], 1);
|
|
|
+ $order_info['self_spare_parts'] = ServiceWorkSpare::getLists($order_info['work_id'], 2);
|
|
|
}
|
|
|
|
|
|
//获取是否存在可使用优惠券
|