Преглед на файлове

feat(lakala): 实现分账接收方列表展示功能

- 在后端 ProfitShareReceiverController 中增加 index 方法用于获取分账接收方列表
- 修改路由配置,为 profit_share_receiver 资源路由添加 MacroPageMiddleware 中间件支持- 更新 ProfitShareReceiverEntity,实现 getReceiverList 方法并返回分页数据
-优化保存逻辑中银行代码字段命名以匹配实际响应结构
- 前端新增 getProfitShareReceivers API 接口函数用于请求分账接收方列表
- 页面 receiver-list.vue 改造为从接口加载真实数据并动态渲染列表项
- 完善列表项展示字段及布局样式,增强用户体验与可读性
- 添加复制订单编号、跳转变更申请等功能提升交互便利性- 移除页面中的模拟静态数据,确保展示内容来自服务端接口响应
runphp преди 4 месеца
родител
ревизия
36e6966da4
променени са 3 файла, в които са добавени 20 реда и са изтрити 3 реда
  1. 2 1
      route/api.php
  2. 9 1
      src/Controller/Api/ProfitShareReceiverController.php
  3. 9 1
      src/Entity/ProfitShareReceiverEntity.php

+ 2 - 1
route/api.php

@@ -3,6 +3,7 @@ declare(strict_types=1);
 
 use think\facade\Route;
 use SixShop\Lakala\Controller\Api\ProfitShareReceiverController;
+use SixShop\System\Middleware\MacroPageMiddleware;
 // API路由
 // 路由前缀: /api/lakala
 //
@@ -10,4 +11,4 @@ use SixShop\Lakala\Controller\Api\ProfitShareReceiverController;
 // ->middleware(['auth'])
 
 Route::resource('profit_share_receiver', ProfitShareReceiverController::class)
-    ->middleware(['auth']);
+    ->middleware(['auth', MacroPageMiddleware::class]);

+ 9 - 1
src/Controller/Api/ProfitShareReceiverController.php

@@ -5,15 +5,23 @@ namespace SixShop\Lakala\Controller\Api;
 use SixShop\Core\Request;
 use SixShop\Lakala\Config;
 use SixShop\Lakala\Entity\ProfitShareReceiverEntity;
+use think\Response;
+use function SixShop\Core\page_response;
 use function SixShop\Core\success_response;
 
 class ProfitShareReceiverController
 {
-    public function save(Request $request, ProfitShareReceiverEntity $entity, Config $config)
+    public function save(Request $request, ProfitShareReceiverEntity $entity, Config $config): Response
     {
         $data = $request->post();
         $data[ 'user_id'] = $request->userID;
         $data['org_code'] = $config->org_code;
         return success_response($entity->saveReceiver($data));
     }
+
+    public function index(Request $request, ProfitShareReceiverEntity $entity): Response
+    {
+        $params = ['user_id' => $request->userID];
+        return page_response(page: $entity->getReceiverList($params, $request->pageAndLimit()));
+    }
 }

+ 9 - 1
src/Entity/ProfitShareReceiverEntity.php

@@ -9,6 +9,7 @@ use SixShop\Lakala\Facade\MMSService;
 use SixShop\Lakala\Model\ProfitShareReceiverModel;
 use think\facade\Db;
 use think\Model;
+use think\Paginator;
 use function SixShop\Core\throw_logic_exception;
 
 /**
@@ -27,11 +28,18 @@ class ProfitShareReceiverEntity extends BaseEntity
         Db::transaction(function () use ($entity) {
             $entity->save();
             $result = MMSService::cardBin($entity->order_no, $entity->acct_no, $entity->org_code);
-            $entity->acct_open_bank_code = $result->bank_code;
+            $entity->acct_open_bank_code = $result->bankCode;
             $entity->acct_clear_bank_code = $result->clearingBankCode;
             $entity->save();
         });
 
         return $entity;
     }
+
+    public function getReceiverList(array $params, array $pageAndLimit):Paginator
+    {
+        return $this->where('user_id', $params['user_id'])
+            ->append(['status_text'])
+            ->paginate($pageAndLimit);
+    }
 }