Переглянути джерело

增加订单的快递单号填写,及详情展示

林海涛 1 рік тому
батько
коміт
1503eaa708

+ 121 - 0
app/adminapi/controller/shops/ShopExpressController.php

@@ -0,0 +1,121 @@
+<?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\adminapi\controller\shops;
+
+
+use app\adminapi\controller\BaseAdminController;
+
+use app\adminapi\lists\shops\ShopExpressLists;
+use app\adminapi\logic\shops\ShopCategoryLogic;
+use app\adminapi\logic\shops\ShopExpressLogic;
+use app\adminapi\validate\shops\ShopCategoryValidate;
+use app\adminapi\validate\shops\ShopExpressValidate;
+
+
+
+/**
+ * ShopCategory控制器
+ * Class ShopCategoryController
+ * @package app\adminapi\controller\shops
+ */
+class ShopExpressController extends BaseAdminController
+{
+
+    public array $notNeedLogin = ['lists'];
+    /**
+     * @notes 获取列表
+     * @return \think\response\Json
+     * @author likeadmin
+     * @date 2024/08/04 10:42
+     */
+    public function lists()
+    {   $params = $this->request->get();
+        if(empty($params['admin_type'])){
+            $result = ShopExpressLogic::lists($params);
+            return $this->data($result);
+        }
+        return $this->dataLists(new ShopExpressLists());
+
+    }
+
+
+    /**
+     * @notes 添加
+     * @return \think\response\Json
+     * @author likeadmin
+     * @date 2024/08/04 10:42
+     */
+    public function add()
+    {
+        $params = (new ShopExpressValidate())->post()->goCheck('add');
+        $result = ShopExpressLogic::add($params);
+        if (true === $result) {
+            return $this->success('添加成功', [], 1, 1);
+        }
+        return $this->fail(ShopExpressLogic::getError());
+    }
+
+
+    /**
+     * @notes 编辑
+     * @return \think\response\Json
+     * @author likeadmin
+     * @date 2024/08/04 10:42
+     */
+    public function edit()
+    {
+        $params = (new ShopCategoryValidate())->post()->goCheck('edit');
+        $result = ShopCategoryLogic::edit($params);
+        if (true === $result) {
+            return $this->success('编辑成功', [], 1, 1);
+        }
+        return $this->fail(ShopCategoryLogic::getError());
+    }
+
+
+    /**
+     * @notes 删除
+     * @return \think\response\Json
+     * @author likeadmin
+     * @date 2024/08/04 10:42
+     */
+    public function delete()
+    {
+        $params = (new ShopCategoryValidate())->post()->goCheck('delete');
+        ShopCategoryLogic::delete($params);
+        return $this->success('删除成功', [], 1, 1);
+    }
+
+
+    /**
+     * @notes 获取详情
+     * @return \think\response\Json
+     * @author likeadmin
+     * @date 2024/08/04 10:42
+     */
+    public function detail()
+    {
+        $params = (new ShopCategoryValidate())->goCheck('detail');
+        $result = ShopCategoryLogic::detail($params);
+        return $this->data($result);
+    }
+
+    public function treeData()
+    {
+        $result = ShopCategoryLogic::getTreeData();
+        return $this->data($result);
+    }
+}

+ 16 - 0
app/adminapi/controller/shops/ShopOrdersController.php

@@ -105,4 +105,20 @@ class ShopOrdersController extends BaseAdminController
     }
 
 
+    public function logistic()
+    {
+        $params = (new ShopOrdersValidate())->goCheck('detail');
+        $result = ShopOrdersLogic::logisticInfo($params);
+        return $this->data($result);
+    }
+
+    public function saveLogistic()
+    {
+        $params = (new ShopOrdersValidate())->post()->goCheck('savelogistic');
+        $result = ShopOrdersLogic::saveLogistic($params);
+        if (false === $result) {
+            return $this->fail(ShopOrdersLogic::getError());
+        }
+        return $this->success('成功', [], 1, 1);
+    }
 }

+ 78 - 0
app/adminapi/lists/shops/ShopExpressLists.php

@@ -0,0 +1,78 @@
+<?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\adminapi\lists\shops;
+
+
+use app\adminapi\lists\BaseAdminDataLists;
+use app\common\model\shops\ShopExpress;
+use app\common\lists\ListsSearchInterface;
+
+
+/**
+ * ShopExpress列表
+ * Class ShopExpressLists
+ * @package app\adminapi\listsshops
+ */
+class ShopExpressLists extends BaseAdminDataLists implements ListsSearchInterface
+{
+
+
+    /**
+     * @notes 设置搜索条件
+     * @return \string[][]
+     * @author likeadmin
+     * @date 2024/08/18 16:08
+     */
+    public function setSearch(): array
+    {
+        return [
+            '=' => ['code', 'kdn_code', 'name', 'status'],
+
+        ];
+    }
+
+
+    /**
+     * @notes 获取列表
+     * @return array
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @author likeadmin
+     * @date 2024/08/18 16:08
+     */
+    public function lists(): array
+    {
+        return ShopExpress::where($this->searchWhere)
+            ->field(['id', 'code', 'kdn_code', 'name', 'weight', 'status'])
+            ->limit($this->limitOffset, $this->limitLength)
+            ->order(['id' => 'desc'])
+            ->select()
+            ->toArray();
+    }
+
+
+    /**
+     * @notes 获取数量
+     * @return int
+     * @author likeadmin
+     * @date 2024/08/18 16:08
+     */
+    public function count(): int
+    {
+        return ShopExpress::where($this->searchWhere)->count();
+    }
+
+}

+ 122 - 0
app/adminapi/logic/shops/ShopExpressLogic.php

@@ -0,0 +1,122 @@
+<?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\adminapi\logic\shops;
+
+
+use app\common\logic\BaseLogic;
+use app\common\model\shops\ShopExpress;
+use think\facade\Db;
+
+
+/**
+ * ShopExpress逻辑
+ * Class ShopExpressLogic
+ * @package app\adminapi\logic\shops
+ */
+class ShopExpressLogic extends BaseLogic
+{
+
+    public static function lists($params): array
+    {
+        $where = [];
+        if(isset($params['status'])){
+            $where[] = ['status', '=', $params['status']];
+        }
+        return ShopExpress::where($where)->select()->toArray();
+    }
+
+    /**
+     * @notes 添加
+     * @param array $params
+     * @return bool
+     * @author likeadmin
+     * @date 2024/08/04 10:42
+     */
+    public static function add(array $params): bool
+    {
+        Db::startTrans();
+        try {
+            ShopExpress::create([
+                'code' => $params['code'],
+                'kdn_code' => $params['kdn_code'],
+                'name' => $params['name'],
+                'status' => $params['status'],
+                'weight' => $params['weight'],
+            ]);
+            Db::commit();
+            return true;
+        } catch (\Exception $e) {
+            Db::rollback();
+            self::setError($e->getMessage());
+            return false;
+        }
+    }
+
+
+    /**
+     * @notes 编辑
+     * @param array $params
+     * @return bool
+     * @author likeadmin
+     * @date 2024/08/04 10:42
+     */
+    public static function edit(array $params): bool
+    {
+        Db::startTrans();
+        try {
+            ShopExpress::where('id', $params['id'])->update([
+                'code' => $params['code'],
+                'kdn_code' => $params['kdn_code'],
+                'name' => $params['name'],
+                'status' => $params['status'],
+                'weight' => $params['weight'],
+            ]);
+
+            Db::commit();
+            return true;
+        } catch (\Exception $e) {
+            Db::rollback();
+            self::setError($e->getMessage());
+            return false;
+        }
+    }
+
+
+    /**
+     * @notes 删除
+     * @param array $params
+     * @return bool
+     * @author likeadmin
+     * @date 2024/08/04 10:42
+     */
+    public static function delete(array $params): bool
+    {
+        return ShopExpress::destroy($params['id']);
+    }
+
+
+    /**
+     * @notes 获取详情
+     * @param $params
+     * @return array
+     * @author likeadmin
+     * @date 2024/08/04 10:42
+     */
+    public static function detail($params): array
+    {
+        return ShopExpress::findOrEmpty($params['id'])->toArray();
+    }
+
+}

+ 96 - 0
app/adminapi/logic/shops/ShopOrdersLogic.php

@@ -15,8 +15,10 @@
 namespace app\adminapi\logic\shops;
 
 
+use app\common\model\shops\ShopOrderLogistic;
 use app\common\model\shops\ShopOrders;
 use app\common\logic\BaseLogic;
+use app\workerapi\logic\shops\ShopOrderLogic;
 use think\db\Query;
 use think\facade\Db;
 
@@ -137,6 +139,100 @@ class ShopOrdersLogic extends BaseLogic
                 $query->field("id,worker_number,real_name");
             },'orderGoods'=>function(Query $query){
                 $query->field("id,sn,shop_goods_id,goods_name,goods_image,goods_banners,description,specs_type,custom_attribute_items,specs,number,service_total,service_fee")->append(['spec_arr']);
+            },'orderlogistic'=>function (Query $query) {
+                $query->field("id,order_id,shop_goods_id,express_id,logistic_number,logistic_status,create_time,update_time")->append(['logistic_status_text']);
+                $query->with('express');
             }])->findOrEmpty($params['id'])->toArray();
     }
+
+    public static function logisticInfo($params):array
+    {
+        $detail = ShopOrders::with(['orderlogistic'=>function (Query $query) {
+            $query->field("id,order_id,shop_goods_id,express_id,logistic_number,logistic_status")->append(['logistic_status_text']);
+        },'orderGoods'=>function(Query $query){
+            $query->field("id,sn,shop_goods_id,goods_name,goods_image,goods_banners,description,specs_type,custom_attribute_items,specs,number,service_total,service_fee")->append(['spec_arr']);
+        }])->findOrEmpty($params['id'])->toArray();
+        $orderGoods = [];
+        if(isset($detail['orderGoods'])){
+            foreach ($detail['orderGoods'] as $orderGood){
+                $orderGoods[$orderGood['shop_goods_id']] = $orderGood;
+            }
+        }
+        $detail['goods'] = $orderGoods;
+        return $detail;
+    }
+
+    public static function saveLogistic($params)
+    {
+        try{
+            Db::startTrans();
+            $orderModel = ShopOrders::with(['orderlogistic'=>function (Query $query) {
+                $query->field("id,order_id,shop_goods_id,express_id,logistic_number,logistic_status");
+            }])->findOrEmpty($params['id']);
+
+            if($orderModel->isEmpty()){
+                throw  new \Exception('订单不存在');
+            }
+            if(!in_array($orderModel->shop_order_type,[2,3,4])){
+                throw  new \Exception('订单类型不支持');
+            }
+            $existIds = $orderModel->orderlogistic()->column('id');
+            $takeOverFlag = true;
+            $deliverGoodsFlag = true;
+            $saveLogisticArr = [];
+            $updateLogisticArr = [];
+            foreach ($params['logistic_data'] as $logistic){
+                if(intval($logistic['logistic_status']) ===  0){
+                    $takeOverFlag = false;
+                }
+                if(intval($logistic['logistic_status'])!== 3){
+                    $deliverGoodsFlag = false;
+                }
+                if(!empty($logistic['id']) && in_array($logistic['id'],$existIds)){
+                    $updateLogisticArr[$logistic['id']] = [
+                        'shop_goods_id' => $logistic['shop_goods_id'],
+                        'express_id' => $logistic['express_id'],
+                        'logistic_number' => $logistic['logistic_number'],
+                        'logistic_status' => $logistic['logistic_status'],
+                        'update_time' => time(),
+                    ];
+                    array_splice($existIds,array_search($logistic['id'], $existIds),1);
+                    continue;
+                }
+                $saveLogisticArr[] = [
+                    'order_id' => $orderModel->id,
+                    'shop_goods_id' => $logistic['shop_goods_id'],
+                    'express_id' => $logistic['express_id'],
+                    'logistic_number' => $logistic['logistic_number'],
+                    'logistic_status' => $logistic['logistic_status'],
+                    'create_time' => time(),
+                    'update_time' => time(),
+                ];
+            }
+            if(!empty($updateLogisticArr)){
+                ShopOrderLogistic::updateWhenCase($updateLogisticArr);
+            }
+            if(!empty($saveLogisticArr)){
+                ShopOrderLogistic::insertAll($saveLogisticArr);
+            }
+            if(!empty($existIds)){
+                ShopOrderLogistic::destroy($existIds);
+            }
+            if($takeOverFlag && $orderModel->shop_order_type !== 3){
+                $orderModel->shop_order_type = 2;
+                $orderModel->save();
+            }
+            if($deliverGoodsFlag && $orderModel->shop_order_type !== 3){
+                $orderModel->shop_order_type = 4;
+                $orderModel->save();
+            }
+            Db::commit();
+            return true;
+        } catch(\Exception $e){
+            Db::rollback();
+            self::setError($e->getMessage());
+            return false;
+        }
+
+    }
 }

+ 100 - 0
app/adminapi/validate/shops/ShopExpressValidate.php

@@ -0,0 +1,100 @@
+<?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\adminapi\validate\shops;
+
+
+use app\common\validate\BaseValidate;
+
+
+/**
+ * ShopGoods验证器
+ * Class ShopGoodsValidate
+ * @package app\adminapi\validate\shops
+ */
+class ShopExpressValidate extends BaseValidate
+{
+
+     /**
+      * 设置校验规则
+      * @var string[]
+      */
+    protected $rule = [
+        'id' => 'require',
+        'code' => 'require',
+        'kdn_code' => 'require',
+        'name' => 'require',
+    ];
+
+
+    /**
+     * 参数描述
+     * @var string[]
+     */
+    protected $field = [
+        'id' => 'id',
+        'code' => '快递编码',
+        'kdn_code' => '快递简码',
+        'name' => '名称',
+    ];
+
+
+    /**
+     * @notes 添加场景
+     * @return ShopExpressValidate
+     * @author likeadmin
+     * @date 2024/08/04 11:07
+     */
+    public function sceneAdd()
+    {
+        return $this->only(['code','kdn_code','name']);
+    }
+
+
+    /**
+     * @notes 编辑场景
+     * @return ShopExpressValidate
+     * @author likeadmin
+     * @date 2024/08/04 11:07
+     */
+    public function sceneEdit()
+    {
+        return $this->only(['code','kdn_code','name']);
+    }
+
+
+    /**
+     * @notes 删除场景
+     * @return ShopExpressValidate
+     * @author likeadmin
+     * @date 2024/08/04 11:07
+     */
+    public function sceneDelete()
+    {
+        return $this->only(['id']);
+    }
+
+
+    /**
+     * @notes 详情场景
+     * @return ShopGoodsValidate
+     * @author likeadmin
+     * @date 2024/08/04 11:07
+     */
+    public function sceneDetail()
+    {
+        return $this->only(['id']);
+    }
+
+}

+ 114 - 109
app/adminapi/validate/shops/ShopOrdersValidate.php

@@ -1,110 +1,115 @@
-<?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\adminapi\validate\shops;
-
-
-use app\common\validate\BaseValidate;
-
-
-/**
- * ShopOrders验证器
- * Class ShopOrdersValidate
- * @package app\adminapi\validate\shops
- */
-class ShopOrdersValidate extends BaseValidate
-{
-
-     /**
-      * 设置校验规则
-      * @var string[]
-      */
-    protected $rule = [
-        'id' => 'require',
-        'shop_order_type' => 'require',
-        'worker_id' => 'require',
-        'sn' => 'require',
-        'real_name' => 'require',
-        'mobile' => 'require',
-        'address' => 'require',
-        'pay_status' => 'require',
-        'amount' => 'require',

-    ];
-
-
-    /**
-     * 参数描述
-     * @var string[]
-     */
-    protected $field = [
-        'id' => 'id',
-        'shop_order_type' => '订单类型',
-        'worker_id' => '师傅ID',
-        'sn' => '订单编号',
-        'real_name' => '姓名',
-        'mobile' => '手机号',
-        'address' => '地址',
-        'pay_status' => '支付方式',
-        'amount' => '实际结算金额',

-    ];
-
-
-    /**
-     * @notes 添加场景
-     * @return ShopOrdersValidate
-     * @author likeadmin
-     * @date 2024/08/04 13:49
-     */
-    public function sceneAdd()
-    {
-        return $this->only(['shop_order_type','worker_id','sn','real_name','mobile','address','pay_status','amount']);
-    }
-
-
-    /**
-     * @notes 编辑场景
-     * @return ShopOrdersValidate
-     * @author likeadmin
-     * @date 2024/08/04 13:49
-     */
-    public function sceneEdit()
-    {
-        return $this->only(['id','shop_order_type','worker_id','sn','real_name','mobile','address','pay_status','amount']);
-    }
-
-
-    /**
-     * @notes 删除场景
-     * @return ShopOrdersValidate
-     * @author likeadmin
-     * @date 2024/08/04 13:49
-     */
-    public function sceneDelete()
-    {
-        return $this->only(['id']);
-    }
-
-
-    /**
-     * @notes 详情场景
-     * @return ShopOrdersValidate
-     * @author likeadmin
-     * @date 2024/08/04 13:49
-     */
-    public function sceneDetail()
-    {
-        return $this->only(['id']);
-    }
-
+<?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\adminapi\validate\shops;
+
+
+use app\common\validate\BaseValidate;
+
+
+/**
+ * ShopOrders验证器
+ * Class ShopOrdersValidate
+ * @package app\adminapi\validate\shops
+ */
+class ShopOrdersValidate extends BaseValidate
+{
+
+     /**
+      * 设置校验规则
+      * @var string[]
+      */
+    protected $rule = [
+        'id' => 'require',
+        'shop_order_type' => 'require',
+        'worker_id' => 'require',
+        'sn' => 'require',
+        'real_name' => 'require',
+        'mobile' => 'require',
+        'address' => 'require',
+        'pay_status' => 'require',
+        'amount' => 'require',
+        'logistic_data' => 'require'
+    ];
+
+
+    /**
+     * 参数描述
+     * @var string[]
+     */
+    protected $field = [
+        'id' => 'id',
+        'shop_order_type' => '订单类型',
+        'worker_id' => '师傅ID',
+        'sn' => '订单编号',
+        'real_name' => '姓名',
+        'mobile' => '手机号',
+        'address' => '地址',
+        'pay_status' => '支付方式',
+        'amount' => '实际结算金额',
+
+    ];
+
+
+    /**
+     * @notes 添加场景
+     * @return ShopOrdersValidate
+     * @author likeadmin
+     * @date 2024/08/04 13:49
+     */
+    public function sceneAdd()
+    {
+        return $this->only(['shop_order_type','worker_id','sn','real_name','mobile','address','pay_status','amount']);
+    }
+
+
+    /**
+     * @notes 编辑场景
+     * @return ShopOrdersValidate
+     * @author likeadmin
+     * @date 2024/08/04 13:49
+     */
+    public function sceneEdit()
+    {
+        return $this->only(['id','shop_order_type','worker_id','sn','real_name','mobile','address','pay_status','amount']);
+    }
+
+
+    /**
+     * @notes 删除场景
+     * @return ShopOrdersValidate
+     * @author likeadmin
+     * @date 2024/08/04 13:49
+     */
+    public function sceneDelete()
+    {
+        return $this->only(['id']);
+    }
+
+
+    /**
+     * @notes 详情场景
+     * @return ShopOrdersValidate
+     * @author likeadmin
+     * @date 2024/08/04 13:49
+     */
+    public function sceneDetail()
+    {
+        return $this->only(['id']);
+    }
+
+    public function sceneSaveLogistic(){
+        return $this->only(['logistic_data','id']);
+    }
 }

+ 13 - 0
app/common/model/shops/ShopExpress.php

@@ -0,0 +1,13 @@
+<?php
+
+namespace app\common\model\shops;
+
+use app\common\model\BaseModel;
+use think\model\concern\SoftDelete;
+
+class ShopExpress  extends BaseModel
+{
+    protected $name = 'shop_express';
+    use SoftDelete;
+    protected $deleteTime = 'delete_time';
+}

+ 28 - 0
app/common/model/shops/ShopOrderLogistic.php

@@ -0,0 +1,28 @@
+<?php
+
+namespace app\common\model\shops;
+
+use app\common\model\BaseModel;
+use app\common\model\dict\DictData;
+use think\facade\Cache;
+
+class ShopOrderLogistic extends BaseModel
+{
+    protected $name = 'shop_order_logistic';
+
+    public function express(){
+        return $this->belongsTo(ShopExpress::class, 'express_id', 'id');
+    }
+
+    public function getLogisticStatusTextAttr($value,$data)
+    {
+        $default = Cache::get('LOGISTIC_STATUS');
+        if (!$default) {
+            $status = DictData::whereIn('type_value', 'logistic_status')->column('name','value');
+            Cache::set('LOGISTIC_STATUS', json_encode($status,true),5);
+        } else {
+            $status = json_decode($default,true);
+        }
+        return $status[$data['logistic_status']] ?? '';
+    }
+}

+ 5 - 0
app/common/model/shops/ShopOrders.php

@@ -54,4 +54,9 @@ class ShopOrders extends BaseModel
         ];
         return $status[$data['refund_status']] ?? '';
     }
+
+    public function orderlogistic()
+    {
+        return $this->hasMany(ShopOrderLogistic::class, 'order_id', 'id');
+    }
 }

+ 1 - 2
app/workerapi/lists/HistoryWorkLists.php

@@ -27,9 +27,8 @@ class HistoryWorkLists extends BaseWorkerDataLists
         $where = [
             'master_worker_id'=>$this->userId,
             'approval'=>1,//派单的时候默认审核了
-            'service_status'=>$this->params['service_status']?3:4,
+            'service_status'=>$this->params['service_status'] ?? 3,
         ];
-
         //查询月数
         $create_month = !empty($this->params['create_month'])?$this->params['create_month']:date('Y-m');
         $list = ServiceWork::where($where)