Просмотр исходного кода

add -- 用户扫码确认报价 / 工单尾款价记录

liugc 1 год назад
Родитель
Сommit
4dabcdc35e

+ 12 - 0
app/adminapi/logic/works/ServiceWorkLogic.php

@@ -19,6 +19,7 @@ use app\common\enum\worker\WorkerAccountLogEnum;
 use app\common\logic\ThirdOrderLogic;
 use app\common\logic\WorkerAccountLogLogic;
 use app\common\model\third\ThirdOrders;
+use app\common\model\works\ServiceWorkDeterminedPrice;
 use think\Exception;
 use think\db\Query;
 use think\facade\Db;
@@ -320,6 +321,17 @@ class ServiceWorkLogic extends BaseLogic
                 'opera_log'=>'编号['.$params['user_info']['worker_number'].']'.$params['user_info']['real_name'].'于'.date('y-m-d H:i:s',time()).'于'.date('Y-m-d H:i:s',time()).'提交了报价单',
             ];
             ServiceWorkLogLogic::add($work_log);
+
+            // 添加工单尾款报价记录
+            if(isset($params['price_content'])){
+                !is_array($params['price_content']) && $params['price_content'] = json_decode($params['price_content'], true);
+                ServiceWorkDeterminedPrice::where('work_id',$work->id)->delete();
+                ServiceWorkDeterminedPrice::create([
+                    'work_id'=>$work->id,
+                    'content'=>$params['price_content']??[],
+                ]);
+            }
+
             Db::commit();
 
             // 外部平台工单 - 通知外边平台

+ 41 - 0
app/api/controller/notify/UserConfirmController.php

@@ -4,10 +4,14 @@ namespace app\api\controller\notify;
 
 use app\adminapi\logic\works\ServiceWorkLogic;
 use app\api\controller\BaseApiController;
+use app\api\logic\LoginLogic;
+use app\api\logic\ServiceOrderLogic;
 use app\api\validate\UserConfirmValidate;
 use app\common\enum\ThirdTypeEnum;
 use app\common\logic\ThirdOrderLogic;
 use app\common\model\master_worker\MasterWorker;
+use app\common\model\recharge\RechargeOrder;
+use app\common\model\user\User;
 use app\common\model\works\ServiceWork;
 use think\Exception;
 use think\facade\Log;
@@ -48,4 +52,41 @@ class UserConfirmController extends BaseApiController
         return $this->success('已确认上门');
     }
 
+
+
+    public function confirmPriceDetail()
+    {
+        $params = (new UserConfirmValidate())->post()->goCheck('confirmDoor');
+        try {
+            $work_sn = decrypt($params['code'], \think\facade\Config::get('project.work_sn_key'));
+            $work = ServiceWork::where(['work_sn'=>$work_sn,'mobile'=>$params['phone']])->findOrEmpty();
+            if($work->isEmpty()){
+                throw new Exception('工单不存在');
+            }
+            // 先登录得到用户信息
+            $userInfo = LoginLogic::login(['account'=>$params['phone'],'scene'=>2,'terminal'=>2]);
+            $userId = User::where('mobile',$params['phone'])->value('id');
+            $sn = RechargeOrder::where('work_id',$work->id)->where('user_id',$work->user_id)->value('sn');
+            $result = ServiceOrderLogic::detail([
+                'sn' => $sn,
+                'user_id' => $userId,
+                'user_info' => $userInfo,
+                'domain'=>$this->request->domain()
+            ]);
+            if (false === $result) {
+                throw new Exception(ServiceOrderLogic::getError());
+            }
+            $result['user_info'] =  $userInfo;
+            return $this->data($result);
+        }catch (\Exception $e){
+            return $this->fail($e->getMessage());
+        }
+    }
+
+
+
+
+
+
+
 }

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

@@ -31,6 +31,7 @@ use app\common\model\service_area\ServiceArea;
 use app\common\model\spare_part\SparePart;
 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\workerapi\logic\ServiceWorkLogLogic;
 use think\Exception;
@@ -565,6 +566,12 @@ class ServiceOrderLogic extends BaseLogic
                     $order_info['effective_income_amount'] = \app\adminapi\logic\effective\OrderEffectiveLogLogic::commissionAndAssuranceDeposit($serviceWork);
                 }
             }
+
+            // 尾款报价信息
+            $determinedPrice = ServiceWorkDeterminedPrice::where('work_id',$order_info['service_work']['id'])->findOrEmpty();
+            if(!$determinedPrice->isEmpty()){
+                $order_info['price_content'] = $determinedPrice->toArray()['content'];
+            }
             return $order_info;
         }
         catch (\Exception $e) {

+ 36 - 0
app/common/model/works/ServiceWorkDeterminedPrice.php

@@ -0,0 +1,36 @@
+<?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;
+
+
+
+/**
+ * ServiceWorkDeterminedPrice模型
+ * Class ServiceWorkDeterminedPrice
+ * @package app\common\model
+ */
+class ServiceWorkDeterminedPrice extends BaseModel
+{
+    
+    protected $name = 'service_work_determined_price';
+    
+    public $type = [
+        'content' => 'array'
+    ];
+    
+}