quanwei
18 hours ago c441dea81bd86bdfb12dff35821fed51f4cc91c2
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() ?: '更新失败');