MerchantBankInfoView.m 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610
  1. //
  2. // MerchantBankInfoView.m
  3. // merchant
  4. //
  5. // Created by qitewei on 2025/8/14.
  6. // Copyright © 2025 xfg. All rights reserved.
  7. //
  8. #import "MerchantBankInfoView.h"
  9. #import "UIView+Extention.h"
  10. @implementation MerchantBankInfoView
  11. - (instancetype)initWithFrame:(CGRect)frame
  12. {
  13. self = [super initWithFrame:frame];
  14. if (self) {
  15. [self setupUI];
  16. [self setupConstraints];
  17. }
  18. return self;
  19. }
  20. - (void)setupUI {
  21. self.backgroundColor = [UIColor clearColor];
  22. // 添加提示信息区域
  23. [self setupWarningSection];
  24. // 添加账户名称区域
  25. [self setupAccountNameSection];
  26. // 添加账户号码区域
  27. [self setupAccountNumberSection];
  28. // 添加开户行区域
  29. [self setupBankNameSection];
  30. // 添加银行卡上传区域
  31. [self setupBankCardSection];
  32. }
  33. - (void)setupWarningSection {
  34. [self.contentView addSubview:self.warningView];
  35. [self.warningView addSubview:self.warningIcon];
  36. [self.warningView addSubview:self.warningLabel];
  37. }
  38. - (void)setupAccountNameSection {
  39. [self.contentView addSubview:self.accountNameLabel];
  40. [self.contentView addSubview:self.accountNameTextField];
  41. }
  42. - (void)setupAccountNumberSection {
  43. [self.contentView addSubview:self.accountNumberLabel];
  44. [self.contentView addSubview:self.accountNumberTextField];
  45. }
  46. - (void)setupBankNameSection {
  47. [self.contentView addSubview:self.bankNameLabel];
  48. [self.contentView addSubview:self.bankNameTextField];
  49. }
  50. - (void)setupBankCardSection {
  51. [self.contentView addSubview:self.uploadBankCardLabel];
  52. [self.contentView addSubview:self.frontCardView];
  53. [self.contentView addSubview:self.backCardView];
  54. // 正面
  55. [self.frontCardView addSubview:self.frontCardTitleLabel];
  56. [self.frontCardView addSubview:self.frontCardSubtitleLabel];
  57. [self.frontCardView addSubview:self.frontCardImageView];
  58. // 反面
  59. [self.backCardView addSubview:self.backCardTitleLabel];
  60. [self.backCardView addSubview:self.backCardSubtitleLabel];
  61. [self.backCardView addSubview:self.backCardImageView];
  62. }
  63. - (void)setupConstraints {
  64. // 提示信息
  65. [self.warningView mas_makeConstraints:^(MASConstraintMaker *make) {
  66. make.left.equalTo(self.contentView).offset(kRealValue(24));
  67. make.right.equalTo(self.contentView).offset(-kRealValue(24));
  68. make.top.equalTo(self.contentView).offset(kRealValue(20));
  69. make.height.mas_equalTo(kRealValue(44));
  70. }];
  71. [self.warningIcon mas_makeConstraints:^(MASConstraintMaker *make) {
  72. make.left.equalTo(self.warningView).offset(kRealValue(12));
  73. make.centerY.equalTo(self.warningView);
  74. make.size.mas_equalTo(CGSizeMake(kRealValue(16), kRealValue(16)));
  75. }];
  76. [self.warningLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  77. make.left.equalTo(self.warningIcon.mas_right).offset(kRealValue(8));
  78. make.right.equalTo(self.warningView).offset(-kRealValue(12));
  79. make.centerY.equalTo(self.warningView);
  80. }];
  81. // 账户名称
  82. [self.accountNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  83. make.left.equalTo(self.contentView).offset(kRealValue(24));
  84. make.top.equalTo(self.warningView.mas_bottom).offset(kRealValue(24));
  85. }];
  86. [self.accountNameTextField mas_makeConstraints:^(MASConstraintMaker *make) {
  87. make.left.equalTo(self.accountNameLabel);
  88. make.right.equalTo(self.contentView).offset(-kRealValue(24));
  89. make.top.equalTo(self.accountNameLabel.mas_bottom).offset(kRealValue(12));
  90. make.height.mas_equalTo(kRealValue(48));
  91. }];
  92. // 账户号码
  93. [self.accountNumberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  94. make.left.equalTo(self.accountNameLabel);
  95. make.top.equalTo(self.accountNameTextField.mas_bottom).offset(kRealValue(24));
  96. }];
  97. [self.accountNumberTextField mas_makeConstraints:^(MASConstraintMaker *make) {
  98. make.left.equalTo(self.accountNumberLabel);
  99. make.right.equalTo(self.contentView).offset(-kRealValue(24));
  100. make.top.equalTo(self.accountNumberLabel.mas_bottom).offset(kRealValue(12));
  101. make.height.mas_equalTo(kRealValue(48));
  102. }];
  103. // 开户行
  104. [self.bankNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  105. make.left.equalTo(self.accountNameLabel);
  106. make.top.equalTo(self.accountNumberTextField.mas_bottom).offset(kRealValue(24));
  107. }];
  108. [self.bankNameTextField mas_makeConstraints:^(MASConstraintMaker *make) {
  109. make.left.equalTo(self.bankNameLabel);
  110. make.right.equalTo(self.contentView).offset(-kRealValue(24));
  111. make.top.equalTo(self.bankNameLabel.mas_bottom).offset(kRealValue(12));
  112. make.height.mas_equalTo(kRealValue(48));
  113. }];
  114. // 请上传银行卡
  115. [self.uploadBankCardLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  116. make.left.equalTo(self.accountNameLabel);
  117. make.top.equalTo(self.bankNameTextField.mas_bottom).offset(kRealValue(24));
  118. }];
  119. // 正面
  120. [self.frontCardView mas_makeConstraints:^(MASConstraintMaker *make) {
  121. make.left.equalTo(self.uploadBankCardLabel);
  122. make.right.equalTo(self.bankNameTextField);
  123. make.top.equalTo(self.uploadBankCardLabel.mas_bottom).offset(kRealValue(12));
  124. make.height.mas_equalTo(kRealValue(152));
  125. }];
  126. [self.frontCardTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  127. make.left.equalTo(self.frontCardView).offset(kRealValue(12));
  128. make.top.equalTo(self.frontCardView).offset(kRealValue(12));
  129. }];
  130. [self.frontCardSubtitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  131. make.left.equalTo(self.frontCardTitleLabel);
  132. make.right.equalTo(self.frontCardImageView.mas_left).mas_offset(-8);
  133. make.top.equalTo(self.frontCardTitleLabel.mas_bottom).offset(kRealValue(4));
  134. }];
  135. [self.frontCardImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  136. make.right.equalTo(self.frontCardView).inset(kRealValue(16));
  137. make.centerY.equalTo(self.frontCardView);
  138. make.height.mas_equalTo(kRealValue(120));
  139. make.width.mas_equalTo(kRealValue(185));
  140. }];
  141. // 反面
  142. [self.backCardView mas_makeConstraints:^(MASConstraintMaker *make) {
  143. make.left.right.equalTo(self.frontCardView);
  144. make.top.equalTo(self.frontCardView.mas_bottom).offset(kRealValue(16));
  145. make.height.mas_equalTo(kRealValue(152));
  146. make.bottom.equalTo(self.contentView).offset(-kRealValue(20));
  147. }];
  148. [self.backCardTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  149. make.left.equalTo(self.backCardView).offset(kRealValue(12));
  150. make.top.equalTo(self.backCardView).offset(kRealValue(12));
  151. }];
  152. [self.backCardSubtitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  153. make.left.equalTo(self.backCardTitleLabel);
  154. make.right.equalTo(self.backCardImageView.mas_left).mas_offset(-8);
  155. make.top.equalTo(self.backCardTitleLabel.mas_bottom).offset(kRealValue(4));
  156. }];
  157. [self.backCardImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  158. make.right.equalTo(self.backCardView).inset(kRealValue(16));
  159. make.centerY.equalTo(self.backCardView);
  160. make.size.mas_equalTo(self.frontCardImageView);
  161. }];
  162. }
  163. #pragma mark - Validation
  164. - (BOOL)validateForm {
  165. // 验证账户名称
  166. if (self.accountNameTextField.text.length == 0) {
  167. [self makeToast:self.accountNameTextField.placeholder];
  168. return NO;
  169. }
  170. // 验证账户号码
  171. if (self.accountNumberTextField.text.length == 0) {
  172. [self makeToast:self.accountNumberTextField.placeholder];
  173. return NO;
  174. }
  175. // 验证开户行
  176. if (self.bankNameTextField.text.length == 0) {
  177. [self makeToast:self.bankNameTextField.placeholder];
  178. return NO;
  179. }
  180. // 验证银行卡正面照片
  181. if (self.frontURL.length == 0) {
  182. [self makeToast:self.frontCardSubtitleLabel.text];
  183. return NO;
  184. }
  185. // 验证银行卡反面照片
  186. if (self.backURL.length == 0) {
  187. [self makeToast:self.backCardSubtitleLabel.text];
  188. return NO;
  189. }
  190. return YES;
  191. }
  192. #pragma mark - Public Methods
  193. - (BOOL)canGoNext {
  194. return [self validateForm];
  195. }
  196. - (void)goNext {
  197. if ([self validateForm]) {
  198. [super goNext];
  199. }
  200. }
  201. #pragma mark - Actions
  202. - (void)frontCardTapped:(UITapGestureRecognizer *)gesture {
  203. WeakSelf
  204. [self pickImageWithCompletion:^(UIImage *image) {
  205. weakSelf.frontCardImageView.image = image;
  206. // 上传图片到服务器
  207. [weakSelf uploadImage:image completion:^(NSString *url) {
  208. weakSelf.frontURL = url;
  209. }];
  210. }];
  211. }
  212. - (void)backCardTapped:(UITapGestureRecognizer *)gesture {
  213. WeakSelf
  214. [self pickImageWithCompletion:^(UIImage *image) {
  215. weakSelf.backCardImageView.image = image;
  216. // 上传图片到服务器
  217. [weakSelf uploadImage:image completion:^(NSString *url) {
  218. weakSelf.backURL = url;
  219. }];
  220. }];
  221. }
  222. #pragma mark - MerchantEnrollParametersDataSource
  223. - (NSDictionary *)getMerchantEnrollParameters {
  224. return @{
  225. @"bank_card_number": self.accountNumberTextField.text ?: @"",
  226. @"bank_card_name": self.accountNameTextField.text ?: @"",
  227. @"bank_opening_account": self.bankNameTextField.text ?: @"",
  228. @"bank_front_photo": self.frontURL ?: @"",
  229. @"bank_back_photo": self.backURL ?: @"",
  230. };
  231. }
  232. #pragma mark - MerchantEnrollDataFillDelegate
  233. - (void)fillWithData:(NSDictionary *)data {
  234. if (!data) {
  235. return;
  236. }
  237. // 填充文本字段
  238. self.accountNameTextField.text = data[@"bank_card_name"] ?: @"";
  239. self.accountNumberTextField.text = data[@"bank_card_number"] ?: @"";
  240. self.bankNameTextField.text = data[@"bank_opening_account"] ?: @"";
  241. // 填充图片URL
  242. self.frontURL = data[@"bank_front_photo"] ?: @"";
  243. self.backURL = data[@"bank_back_photo"] ?: @"";
  244. // 如果有图片URL,可以考虑异步加载图片
  245. if (self.frontURL.length > 0) {
  246. [self loadImageFromURL:self.frontURL forImageView:self.frontCardImageView];
  247. }
  248. if (self.backURL.length > 0) {
  249. [self loadImageFromURL:self.backURL forImageView:self.backCardImageView];
  250. }
  251. }
  252. - (void)loadImageFromURL:(NSString *)urlString forImageView:(UIImageView *)imageView {
  253. if (urlString.length == 0) {
  254. return;
  255. }
  256. NSURL *url = [NSURL URLWithString:urlString];
  257. if (!url) {
  258. return;
  259. }
  260. [imageView setImageURL:url];
  261. }
  262. #pragma mark - Lazy Loading
  263. - (UIView *)warningView {
  264. if (!_warningView) {
  265. _warningView = [[UIView alloc] init];
  266. _warningView.backgroundColor = [UIColor colorWithHexString:@"#FFF8E1"];
  267. _warningView.layer.cornerRadius = kRealValue(8);
  268. _warningView.layer.borderWidth = 1;
  269. _warningView.layer.borderColor = [UIColor colorWithHexString:@"#FFD54F"].CGColor;
  270. }
  271. return _warningView;
  272. }
  273. - (UIImageView *)warningIcon {
  274. if (!_warningIcon) {
  275. _warningIcon = [[UIImageView alloc] init];
  276. // 使用系统内置的警告图标,如果找不到自定义图标
  277. UIImage *warningImage = [UIImage imageNamed:@"store_bank_tips"];
  278. _warningIcon.image = warningImage;
  279. _warningIcon.contentMode = UIViewContentModeScaleAspectFit;
  280. _warningIcon.tintColor = [UIColor colorWithHexString:@"#F57C00"];
  281. }
  282. return _warningIcon;
  283. }
  284. - (UILabel *)warningLabel {
  285. if (!_warningLabel) {
  286. _warningLabel = [[UILabel alloc] init];
  287. _warningLabel.text = ASLocalizedString(@"用于收款和缴保证金,请确认账户可以正常交易。");
  288. _warningLabel.font = [UIFont systemFontOfSize:12];
  289. _warningLabel.textColor = [UIColor colorWithHexString:@"#F57C00"];
  290. _warningLabel.numberOfLines = 0;
  291. }
  292. return _warningLabel;
  293. }
  294. - (UILabel *)accountNameLabel {
  295. if (!_accountNameLabel) {
  296. _accountNameLabel = [[UILabel alloc] init];
  297. _accountNameLabel.text = ASLocalizedString(@"账户名称");
  298. _accountNameLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
  299. _accountNameLabel.textColor = [UIColor blackColor];
  300. // 添加红色星号
  301. NSMutableAttributedString *attributedText = [[NSMutableAttributedString alloc] initWithString:_accountNameLabel.text];
  302. NSAttributedString *redStar = [[NSAttributedString alloc] initWithString:@" *" attributes:@{
  303. NSForegroundColorAttributeName: [UIColor redColor],
  304. NSFontAttributeName: [UIFont systemFontOfSize:16 weight:UIFontWeightMedium]
  305. }];
  306. [attributedText appendAttributedString:redStar];
  307. _accountNameLabel.attributedText = attributedText;
  308. }
  309. return _accountNameLabel;
  310. }
  311. - (UITextField *)accountNameTextField {
  312. if (!_accountNameTextField) {
  313. _accountNameTextField = [[UITextField alloc] init];
  314. _accountNameTextField.placeholder = ASLocalizedString(@"请输入账户名称");
  315. _accountNameTextField.font = [UIFont systemFontOfSize:16];
  316. _accountNameTextField.textColor = [UIColor blackColor];
  317. _accountNameTextField.backgroundColor = [UIColor whiteColor];
  318. _accountNameTextField.layer.cornerRadius = kRealValue(8);
  319. _accountNameTextField.layer.borderWidth = 1;
  320. _accountNameTextField.layer.borderColor = [UIColor colorWithHexString:@"#E5E5E5"].CGColor;
  321. // 设置内边距
  322. UIView *leftView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kRealValue(16), kRealValue(48))];
  323. _accountNameTextField.leftView = leftView;
  324. _accountNameTextField.leftViewMode = UITextFieldViewModeAlways;
  325. UIView *rightView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kRealValue(16), kRealValue(48))];
  326. _accountNameTextField.rightView = rightView;
  327. _accountNameTextField.rightViewMode = UITextFieldViewModeAlways;
  328. // 设置键盘返回键类型
  329. _accountNameTextField.returnKeyType = UIReturnKeyNext;
  330. _accountNameTextField.clearButtonMode = UITextFieldViewModeWhileEditing;
  331. }
  332. return _accountNameTextField;
  333. }
  334. - (UILabel *)accountNumberLabel {
  335. if (!_accountNumberLabel) {
  336. _accountNumberLabel = [[UILabel alloc] init];
  337. _accountNumberLabel.text = ASLocalizedString(@"账户号码");
  338. _accountNumberLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
  339. _accountNumberLabel.textColor = [UIColor blackColor];
  340. // 添加红色星号
  341. NSMutableAttributedString *attributedText = [[NSMutableAttributedString alloc] initWithString:_accountNumberLabel.text];
  342. NSAttributedString *redStar = [[NSAttributedString alloc] initWithString:@" *" attributes:@{
  343. NSForegroundColorAttributeName: [UIColor redColor],
  344. NSFontAttributeName: [UIFont systemFontOfSize:16 weight:UIFontWeightMedium]
  345. }];
  346. [attributedText appendAttributedString:redStar];
  347. _accountNumberLabel.attributedText = attributedText;
  348. }
  349. return _accountNumberLabel;
  350. }
  351. - (UITextField *)accountNumberTextField {
  352. if (!_accountNumberTextField) {
  353. _accountNumberTextField = [[UITextField alloc] init];
  354. _accountNumberTextField.placeholder = ASLocalizedString(@"请输入账户号码");
  355. _accountNumberTextField.font = [UIFont systemFontOfSize:16];
  356. _accountNumberTextField.textColor = [UIColor blackColor];
  357. _accountNumberTextField.backgroundColor = [UIColor whiteColor];
  358. _accountNumberTextField.layer.cornerRadius = kRealValue(8);
  359. _accountNumberTextField.layer.borderWidth = 1;
  360. _accountNumberTextField.layer.borderColor = [UIColor colorWithHexString:@"#E5E5E5"].CGColor;
  361. _accountNumberTextField.keyboardType = UIKeyboardTypeDecimalPad;
  362. // 设置内边距
  363. UIView *leftView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kRealValue(16), kRealValue(48))];
  364. _accountNumberTextField.leftView = leftView;
  365. _accountNumberTextField.leftViewMode = UITextFieldViewModeAlways;
  366. UIView *rightView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kRealValue(16), kRealValue(48))];
  367. _accountNumberTextField.rightView = rightView;
  368. _accountNumberTextField.rightViewMode = UITextFieldViewModeAlways;
  369. _accountNumberTextField.clearButtonMode = UITextFieldViewModeWhileEditing;
  370. }
  371. return _accountNumberTextField;
  372. }
  373. - (UILabel *)bankNameLabel {
  374. if (!_bankNameLabel) {
  375. _bankNameLabel = [[UILabel alloc] init];
  376. _bankNameLabel.text = ASLocalizedString(@"开户行");
  377. _bankNameLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
  378. _bankNameLabel.textColor = [UIColor blackColor];
  379. // 添加红色星号
  380. NSMutableAttributedString *attributedText = [[NSMutableAttributedString alloc] initWithString:_bankNameLabel.text];
  381. NSAttributedString *redStar = [[NSAttributedString alloc] initWithString:@" *" attributes:@{
  382. NSForegroundColorAttributeName: [UIColor redColor],
  383. NSFontAttributeName: [UIFont systemFontOfSize:16 weight:UIFontWeightMedium]
  384. }];
  385. [attributedText appendAttributedString:redStar];
  386. _bankNameLabel.attributedText = attributedText;
  387. }
  388. return _bankNameLabel;
  389. }
  390. - (UITextField *)bankNameTextField {
  391. if (!_bankNameTextField) {
  392. _bankNameTextField = [[UITextField alloc] init];
  393. _bankNameTextField.placeholder = ASLocalizedString(@"请输入开户行");
  394. _bankNameTextField.font = [UIFont systemFontOfSize:16];
  395. _bankNameTextField.textColor = [UIColor blackColor];
  396. _bankNameTextField.backgroundColor = [UIColor whiteColor];
  397. _bankNameTextField.layer.cornerRadius = kRealValue(8);
  398. _bankNameTextField.layer.borderWidth = 1;
  399. _bankNameTextField.layer.borderColor = [UIColor colorWithHexString:@"#E5E5E5"].CGColor;
  400. // 设置内边距
  401. UIView *leftView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kRealValue(16), kRealValue(48))];
  402. _bankNameTextField.leftView = leftView;
  403. _bankNameTextField.leftViewMode = UITextFieldViewModeAlways;
  404. UIView *rightView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kRealValue(16), kRealValue(48))];
  405. _bankNameTextField.rightView = rightView;
  406. _bankNameTextField.rightViewMode = UITextFieldViewModeAlways;
  407. // 设置键盘返回键类型
  408. _bankNameTextField.returnKeyType = UIReturnKeyDone;
  409. _bankNameTextField.clearButtonMode = UITextFieldViewModeWhileEditing;
  410. }
  411. return _bankNameTextField;
  412. }
  413. - (UILabel *)uploadBankCardLabel {
  414. if (!_uploadBankCardLabel) {
  415. _uploadBankCardLabel = [[UILabel alloc] init];
  416. _uploadBankCardLabel.text = ASLocalizedString(@"请上传银行卡");
  417. _uploadBankCardLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
  418. _uploadBankCardLabel.textColor = [UIColor blackColor];
  419. // 添加红色星号
  420. NSMutableAttributedString *attributedText = [[NSMutableAttributedString alloc] initWithString:_uploadBankCardLabel.text];
  421. NSAttributedString *redStar = [[NSAttributedString alloc] initWithString:@" *" attributes:@{
  422. NSForegroundColorAttributeName: [UIColor redColor],
  423. NSFontAttributeName: [UIFont systemFontOfSize:16 weight:UIFontWeightMedium]
  424. }];
  425. [attributedText appendAttributedString:redStar];
  426. _uploadBankCardLabel.attributedText = attributedText;
  427. }
  428. return _uploadBankCardLabel;
  429. }
  430. - (UIView *)frontCardView {
  431. if (!_frontCardView) {
  432. _frontCardView = [[UIView alloc] init];
  433. _frontCardView.backgroundColor = [UIColor whiteColor];
  434. _frontCardView.layer.cornerRadius = kRealValue(8);
  435. _frontCardView.layer.borderWidth = 1;
  436. _frontCardView.layer.borderColor = [UIColor colorWithHexString:@"#E5E5E5"].CGColor;
  437. // 添加点击手势
  438. UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(frontCardTapped:)];
  439. [_frontCardView addGestureRecognizer:tapGesture];
  440. }
  441. return _frontCardView;
  442. }
  443. - (UILabel *)frontCardTitleLabel {
  444. if (!_frontCardTitleLabel) {
  445. _frontCardTitleLabel = [[UILabel alloc] init];
  446. _frontCardTitleLabel.text = ASLocalizedString(@"正面");
  447. _frontCardTitleLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium];
  448. _frontCardTitleLabel.textColor = [UIColor blackColor];
  449. }
  450. return _frontCardTitleLabel;
  451. }
  452. - (UILabel *)frontCardSubtitleLabel {
  453. if (!_frontCardSubtitleLabel) {
  454. _frontCardSubtitleLabel = [[UILabel alloc] init];
  455. _frontCardSubtitleLabel.text = ASLocalizedString(@"上传银行卡正面");
  456. _frontCardSubtitleLabel.font = [UIFont systemFontOfSize:12];
  457. _frontCardSubtitleLabel.textColor = [UIColor colorWithHexString:@"#999999"];
  458. _frontCardSubtitleLabel.numberOfLines = 2;
  459. }
  460. return _frontCardSubtitleLabel;
  461. }
  462. - (UIImageView *)frontCardImageView {
  463. if (!_frontCardImageView) {
  464. _frontCardImageView = [[UIImageView alloc] init];
  465. // 使用身份证图片作为银行卡示例,或者创建占位图
  466. UIImage *cardImage = [UIImage imageNamed:@"store_bank_front"];
  467. _frontCardImageView.image = cardImage;
  468. _frontCardImageView.contentMode = UIViewContentModeScaleAspectFit;
  469. }
  470. return _frontCardImageView;
  471. }
  472. - (UIView *)backCardView {
  473. if (!_backCardView) {
  474. _backCardView = [[UIView alloc] init];
  475. _backCardView.backgroundColor = [UIColor whiteColor];
  476. _backCardView.layer.cornerRadius = kRealValue(8);
  477. _backCardView.layer.borderWidth = 1;
  478. _backCardView.layer.borderColor = [UIColor colorWithHexString:@"#E5E5E5"].CGColor;
  479. // 添加点击手势
  480. UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(backCardTapped:)];
  481. [_backCardView addGestureRecognizer:tapGesture];
  482. }
  483. return _backCardView;
  484. }
  485. - (UILabel *)backCardTitleLabel {
  486. if (!_backCardTitleLabel) {
  487. _backCardTitleLabel = [[UILabel alloc] init];
  488. _backCardTitleLabel.text = ASLocalizedString(@"反面");
  489. _backCardTitleLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium];
  490. _backCardTitleLabel.textColor = [UIColor blackColor];
  491. }
  492. return _backCardTitleLabel;
  493. }
  494. - (UILabel *)backCardSubtitleLabel {
  495. if (!_backCardSubtitleLabel) {
  496. _backCardSubtitleLabel = [[UILabel alloc] init];
  497. _backCardSubtitleLabel.text = ASLocalizedString(@"上传银行卡反面");
  498. _backCardSubtitleLabel.font = [UIFont systemFontOfSize:12];
  499. _backCardSubtitleLabel.textColor = [UIColor colorWithHexString:@"#999999"];
  500. _backCardSubtitleLabel.numberOfLines = 2;
  501. }
  502. return _backCardSubtitleLabel;
  503. }
  504. - (UIImageView *)backCardImageView {
  505. if (!_backCardImageView) {
  506. _backCardImageView = [[UIImageView alloc] init];
  507. // 使用上传图标作为银行卡反面示例,或者创建占位图
  508. UIImage *cardImage = [UIImage imageNamed:@"store_bank_back"];
  509. _backCardImageView.image = cardImage;
  510. _backCardImageView.contentMode = UIViewContentModeScaleAspectFit;
  511. }
  512. return _backCardImageView;
  513. }
  514. @end