YMWithdrawalAccountListCellViewModel.m 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. //
  2. // YMWithdrawalAccountListCellViewModel.m
  3. // MSYOUPAI
  4. //
  5. // Created by YoMi on 2024/3/6.
  6. // Copyright © 2024 MS. All rights reserved.
  7. //
  8. #import "YMWithdrawalAccountListCellViewModel.h"
  9. #import "YMWithdrawalAccountModel.h"
  10. @interface YMWithdrawalAccountListCellViewModel ()
  11. /// 提现账号Id
  12. @property (nonatomic, assign, readwrite) NSInteger withdrawalAccountId;
  13. /// 提现账号类型
  14. @property (nonatomic, assign, readwrite) NSInteger withdrawalAccountType;
  15. /// 提现账号类型名称
  16. @property (nonatomic, strong, readwrite) NSString *withdrawalAccountTypeName;
  17. /// 提现账号持有人
  18. @property (nonatomic, strong, readwrite) NSString *withdrawalAccountHolder;
  19. /// 提现账号
  20. @property (nonatomic, strong, readwrite) NSString *withdrawalAccount;
  21. /// 是否隐藏编辑按钮
  22. @property (nonatomic, assign, readwrite) BOOL isHideEditButton;
  23. @end
  24. @implementation YMWithdrawalAccountListCellViewModel
  25. - (void)ym_initialize{
  26. [super ym_initialize];
  27. if ([self.params[ParamsModel] isKindOfClass:[YMWithdrawalAccountModel class]]) {
  28. YMWithdrawalAccountModel *model = self.params[ParamsModel];
  29. self.withdrawalAccountId = model.withdrawal_account_id;
  30. self.withdrawalAccountType = model.type;
  31. self.withdrawalAccountTypeName = model.bank;
  32. self.withdrawalAccountHolder = model.card_name;
  33. self.withdrawalAccount = model.card_account;
  34. self.isHideEditButton = model.status == 0 ? NO : YES;
  35. }
  36. }
  37. - (void)gotoBindWithdrawalAccount{
  38. YMBindWithdrawalAccountViewModel *bindWithdrawalAccountVM = [[YMBindWithdrawalAccountViewModel alloc]initWithParams:@{
  39. ParamsCategoryType:@(YMBindWithdrawalAccountTypeEdit),
  40. @"withdrawalAccountId":@(self.withdrawalAccountId),
  41. @"withdrawalAccountType":@(self.withdrawalAccountType),
  42. @"withdrawalAccountHolder":self.withdrawalAccountHolder,
  43. @"withdrawalAccount":self.withdrawalAccount,
  44. }];
  45. WS(weakSelf)
  46. bindWithdrawalAccountVM.bindWithdrawalAccountBlock = ^{
  47. /// 编辑绑定提现账号成功后回调之前的提现接口
  48. if (weakSelf.refreshWithdrawalAccountListBlock) {
  49. weakSelf.refreshWithdrawalAccountListBlock();
  50. }
  51. };
  52. [YMRouter openURL:stringFormat(@"%@%@", YM_ROUTER_URL_PREFIX, YM_ROUTER_BIND_WITHDRAWAL_ACCOUNT) withUserInfo:@{
  53. RouterViewModel:bindWithdrawalAccountVM
  54. } completion:nil];
  55. }
  56. @end