From 73b874c72ad55eb9eef21c36160ac0de58f0189e Mon Sep 17 00:00:00 2001
From: quanwei <419654421@qq.com>
Date: Thu, 05 Feb 2026 10:30:43 +0800
Subject: [PATCH] 优化名片

---
 admin/app/shop/controller/supplier/Supplier.php |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/admin/app/shop/controller/supplier/Supplier.php b/admin/app/shop/controller/supplier/Supplier.php
index 4bd5561..498d9cc 100644
--- a/admin/app/shop/controller/supplier/Supplier.php
+++ b/admin/app/shop/controller/supplier/Supplier.php
@@ -2,6 +2,7 @@
 
 namespace app\shop\controller\supplier;
 
+use app\shop\model\user\UserAddress;
 use app\common\enum\supplier\SupplierType;
 use app\shop\controller\Controller;
 use app\shop\model\supplier\Supplier as SupplierModel;
@@ -24,7 +25,7 @@
      */
     public function index()
     {
-        $typeList = SupplierType::getTypeName();
+        $typeList = SupplierType::getTypeName();// 获取请求的供应商类型参数
         //获取该角色管理的区域 by yj 2023.12.20
         $shop_supplier_ids = SupplierModel::getSupplierIdsByUser($this->store['user']);
         // 供应商列表
@@ -33,8 +34,11 @@
         if(!empty($shop_supplier_ids)){
             $postData["shop_supplier_ids"] = $shop_supplier_ids;
         }
+        $supplier_type=$postData['supplier_type']??SupplierType::PHYSICAL;
+        // 根据供应商类型获取对应的分类
+        $category = CategoryModel::getALL(['category_type'=>$supplier_type]);
         $list = $model->getList($postData);
-        return $this->renderSuccess('', compact('list','typeList'));
+        return $this->renderSuccess('', compact('list','typeList','category'));
     }
 
     /**
@@ -55,8 +59,9 @@
         if($this->request->isGet()){
             return $this->renderSuccess('', compact('category','region','typeList'));
         }
+        $data = $this->postData();
         // 新增记录
-        if ($model->add($this->postData())) {
+        if ($model->add($data)) {
             return $this->renderSuccess('', '添加成功');
         }
         return $this->renderError($model->getError() ?: '添加失败');
@@ -81,7 +86,8 @@
         if($this->request->isGet()){
             return $this->renderSuccess('', compact('model','category','region','areaList'));
         }
-        if ($model->edit($this->postData())) {
+        $data = $this->postData();
+        if ($model->edit($data)) {
             return $this->renderSuccess('', '更新成功');
         }
         return $this->renderError($model->getError() ?: '更新失败');

--
Gitblit v1.9.2