import 'package:account_center/account_center.dart';
import 'package:account_center/api/base_model.dart';
import 'package:flutter_clx_base/flutter_clx_base.dart';

import 'join_enterprise_record_state.dart';

class JoinEnterpriseRecordLogic extends GetxController {
  final JoinEnterpriseRecordState state = JoinEnterpriseRecordState();

  void enterpriseRecordListRequest(page, pageSize, success) {
    //"applyNo": 0,
    //   "applyTimeBegin": "",
    //   "applyTimeEnd": "",
    //   "applyType": 0,
    //   "applyUserMobile": "",
    //   "applyUserName": "",
    //   "applyUserNo": 0,
    //   "authStatus": 0,
    //   "page": 1,
    //   "pageSize": 10
    fetchList(Method.post, url: HttpApi.joinEnterpriseRecordList,
        onSuccess: (data) {
      success(data);
    }, params: {
      'page': page,
      'pageSize': pageSize,
    });
  }

  String authStateIcon(int state) {
    switch (state) {
      case 10:
        return 'ic_reviewed'; //审核中
      case 20:
        return 'ic_adopt'; //审核成功
      case 30:
        return 'ic_reject'; //审核失败
      default:
        return '';
    }
  }

  void textUpdate(dynamic item) {
    state.companyName = item['companyName'];
    state.createTime = item['createTime'];
    state.authStatus = item['authStatus'];
    state.applyNo = item['applyNo'];
  }

  void goToEnterpriseSee() {
    //Get.toNamed(RouteConfig.enterpriseSeePage);
  }
}
