quanwei
2 days ago 04102f7237efefa744090ed7c25f7b5d0807b679
admin/app/shop/controller/supplier/Supplier.php
@@ -2,6 +2,8 @@
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;
use app\shop\model\supplier\Apply as ApplyModel;
@@ -23,6 +25,7 @@
     */
    public function index()
    {
        $typeList = SupplierType::getTypeName();// 获取请求的供应商类型参数
        //获取该角色管理的区域 by yj 2023.12.20
        $shop_supplier_ids = SupplierModel::getSupplierIdsByUser($this->store['user']);
        // 供应商列表
@@ -31,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'));
        return $this->renderSuccess('', compact('list','typeList','category'));
    }
    /**
@@ -41,13 +47,21 @@
    public function add()
    {
        $model = new SupplierModel;
        $category = CategoryModel::getALL();
        $typeList = SupplierType::getTypeName();
        // 获取请求的供应商类型参数
        $supplier_type = $this->request->get('supplier_type', 10); // 默认为10(实物)
        // 根据供应商类型获取对应的分类
        $category = CategoryModel::getALL(['category_type'=>$supplier_type]);
        $region = AreaModel::getALL();
        if($this->request->isGet()){
            return $this->renderSuccess('', compact('category','region'));
            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() ?: '添加失败');
@@ -60,7 +74,7 @@
    public function edit($shop_supplier_id)
    {
        $model = SupplierModel::detail($shop_supplier_id, ['logo', 'business', 'qyQrcode','superUser.user']);
        $category = CategoryModel::getALL();
        $category = CategoryModel::getALL(['category_type'=>$model['supplier_type']]);
        $region = AreaModel::getALL();
      //获取站点设置
      $storeValues=SettingModel::getItem('store');
@@ -72,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() ?: '更新失败');
@@ -97,14 +112,16 @@
    {
        //获取该角色管理的区域 by yj 2023.12.20
        $area_ids = SupplierModel::getAreaIdsByUser($this->store['user']);
        $typeList = SupplierType::getTypeName();
        // 供应商列表
        $model = new ApplyModel;
        $postData = $this->postData();
        if(!empty($area_ids)){
            $postData["area_ids"] = $area_ids;
        }
        $list = $model->getList($postData);
        return $this->renderSuccess('', compact('list'));
        return $this->renderSuccess('', compact('list','typeList'));
    }
    /**
     * 供应商待审核详情