Explorar o código

Merge branch 'group_0313'

dongxiaoqin hai 10 meses
pai
achega
02cf65e86c

+ 8 - 9
app/adminapi/logic/works/ServiceWorkLogic.php

@@ -54,7 +54,6 @@ use app\common\model\master_worker\MasterWorkerRetentionMoneyLog;
 use app\common\model\master_commission\MasterWorkerCommissionRatio;
 use app\common\model\master_commission\MasterWorkerCommissionConfig;
 use app\common\model\service_area\ServiceArea;
-use app\common\model\works\ServiceWorkSpareAudit;
 
 /**
  * ServiceWork逻辑
@@ -299,7 +298,8 @@ class ServiceWorkLogic extends BaseLogic
                         'original_price' => 0,
                         'spare_number' => $item['spare_number'],
                         'spare_part_id' => 0,
-                        'brand' => $item['brand']
+                        'brand' => $item['brand'],
+                        'status' => 0,
                     ];
                     if (current($spare_parts_ids)) {
                         //修改
@@ -418,18 +418,17 @@ class ServiceWorkLogic extends BaseLogic
             if($work->isEmpty()){
                 throw new Exception('工单不存在');
             }
-            $audit = ServiceWorkSpareAudit::where(['service_work_id'=>$work['id']])->findOrEmpty();
+            $audit = ServiceWorkSpare::where(['id' => $params['id'],'service_work_id'=>$work['id']])->findOrEmpty();
             if(!$audit->isEmpty() && ($audit['status']!=0 && $audit['status']!=2) ){
                 throw new Exception('当前工单配件不允许修改');
             }
             
-            foreach ($params['self_spare_parts'] as $item){
-                if (empty($item['spare_image'])){
-                    throw new Exception('请上传配件图片');
-                }
-                //修改
-                ServiceWorkSpare::where("id",$item['id'])->where('service_worker_id', $work['id'])->update(['spare_image' => $item['spare_image']]);
+            if (empty($params['spare_image'])){
+                throw new Exception('请上传配件图片');
             }
+            //修改
+            ServiceWorkSpare::where("id",$params['id'])->where('service_worker_id', $work['id'])->update(['spare_image' => $params['spare_image']]);
+            
             Db::commit();
             return true;
         } catch (\Exception $e) {

+ 0 - 5
app/api/logic/ServiceOrderLogic.php

@@ -34,7 +34,6 @@ use app\common\model\works\ServiceWork;
 use app\common\model\works\ServiceWorkAppointmentLog;
 use app\common\model\works\ServiceWorkDeterminedPrice;
 use app\common\model\works\ServiceWorkSpare;
-use app\common\model\works\ServiceWorkSpareAudit;
 use app\workerapi\logic\ServiceWorkLogLogic;
 use think\Exception;
 use think\facade\Db;
@@ -537,13 +536,9 @@ class ServiceOrderLogic extends BaseLogic
             $order_info['spare_total'] = $order_info['service_work']['spare_total']??0;
             $order_info['spare_parts'] = [];
             $order_info['self_spare_parts'] = [];
-            $order_info['spare_parts_audit_status'] = 0;//自选配件审核状态
             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);
-                if ($order_info['self_spare_parts']) {
-                    $order_info['spare_parts_audit_status'] = (int)ServiceWorkSpareAudit::where(['service_work_id' => $order_info['work_id']])->value('status');
-                }
             }
 
             //获取所有的改约记录

+ 1 - 1
app/common/model/works/ServiceWorkSpare.php

@@ -45,7 +45,7 @@ class ServiceWorkSpare extends BaseModel
         
         $lists = self::where('service_work_id', $service_work_id)
                     ->where($where)
-                    ->field("id,spare_part_id, spare_name, spare_image, company_price, original_price, offering_price, spare_number,spare_unit,brand")
+                    ->field("id,spare_part_id, spare_name, spare_image, company_price, original_price, offering_price, spare_number,spare_unit,brand,status,remark")
                     ->select()
                     ->toArray();
         return $lists;

+ 0 - 33
app/common/model/works/ServiceWorkSpareAudit.php

@@ -1,33 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | likeadmin快速开发前后端分离管理后台(PHP版)
-// +----------------------------------------------------------------------
-// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
-// | 开源版本可自由商用,可去除界面版权logo
-// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
-// | github下载:https://github.com/likeshop-github/likeadmin
-// | 访问官网:https://www.likeadmin.cn
-// | likeadmin团队 版权所有 拥有最终解释权
-// +----------------------------------------------------------------------
-// | author: likeadminTeam
-// +----------------------------------------------------------------------
-
-namespace app\common\model\works;
-
-
-use app\common\model\BaseModel;
-
-
-
-/**
- * ServiceWorkSpare模型
- * Class ServiceWorkSpare
- * @package app\common\model
- */
-class ServiceWorkSpareAudit extends BaseModel
-{
-    
-    protected $name = 'service_work_spare_audit';
-
-    
-}

+ 16 - 0
app/workerapi/controller/WorksController.php

@@ -427,5 +427,21 @@ class WorksController extends BaseApiController
         return $this->success('抢单成功', [], 1, 1);
     }
 
+    /**
+     * 工程师修改自选配件信息
+     * @return \think\response\Json
+     * @author liugc <466014217@qq.com>
+     * @date 2025/5/7 15:08
+     */
+    public function selfSparePart()
+    {
+        $params = (new ServiceWorkValidate())->post()->goCheck('sparepart');
+        $result = ServiceWorkLogic::selfSparePart($params);
+        if (false === $result) {
+            return $this->fail(ServiceWorkLogic::getError());
+        }
+        return $this->success('修改成功', [], 1, 1);
+    }
+
 
 }

+ 7 - 1
app/workerapi/validate/ServiceWorkValidate.php

@@ -39,6 +39,7 @@ class ServiceWorkValidate extends BaseValidate
         'amount'=>'require',
         'finished_images'=>'require',
         'work_images'=>'require',
+        'spare_image'  => 'require',
     ];
 
 
@@ -67,7 +68,8 @@ class ServiceWorkValidate extends BaseValidate
         'order_sn'=>'未获取到扫码信息',
         'amount'=>'报价',
         'finished_images'=>'完结服务拍照',
-        'work_images'=>'工作拍照'
+        'work_images'=>'工作拍照',
+        'spare_image'  =>'配件图片',
     ];
 
     /**
@@ -142,4 +144,8 @@ class ServiceWorkValidate extends BaseValidate
     {
         return $this->only(['id']);
     }
+    public function sceneSparepart()
+    {
+        return $this->only(['id','work_sn','spare_image']);
+    }
 }