BondViewController.m 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. //
  2. // BondViewController.m
  3. // yunbaolive
  4. //
  5. // Created by ybRRR on 2020/2/29.
  6. // Copyright © 2020 cat. All rights reserved.
  7. //
  8. #import "BondViewController.h"
  9. #import "YBRechargeVC.h"
  10. @interface BondViewController ()
  11. {
  12. UILabel *priceLb;
  13. UIButton *payBtn;
  14. }
  15. @end
  16. @implementation BondViewController
  17. - (void)viewDidLoad {
  18. [super viewDidLoad];
  19. self.titleL.text = YZMsg(@"开店保证金");
  20. self.view.backgroundColor =RGB(24, 21, 43);
  21. UIView *tback = [[UIView alloc]init];
  22. tback.frame = CGRectMake(0, 64+statusbarHeight, _window_width, 50);
  23. tback.backgroundColor = RGB(24, 21, 43);
  24. [self.view addSubview:tback];
  25. UILabel *title = [[UILabel alloc]init];
  26. title.text = YZMsg(@"需要缴纳金额");
  27. title.font = [UIFont systemFontOfSize:14];
  28. title.textColor = Normal_TextColor;
  29. [tback addSubview:title];
  30. [title mas_makeConstraints:^(MASConstraintMaker *make) {
  31. make.left.equalTo(tback).offset(12);
  32. make.centerY.equalTo(tback.mas_centerY);
  33. }];
  34. UIImageView *rightImg = [[UIImageView alloc]init];
  35. rightImg.image = [UIImage imageNamed:@"logFirst_钻石"];
  36. [tback addSubview:rightImg];
  37. [rightImg mas_makeConstraints:^(MASConstraintMaker *make) {
  38. make.right.equalTo(tback).offset(-15);
  39. make.width.height.mas_equalTo(16);
  40. make.centerY.equalTo(tback.mas_centerY);
  41. }];
  42. priceLb = [[UILabel alloc]init];
  43. priceLb.font = [UIFont boldSystemFontOfSize:14];
  44. priceLb.textColor = Normal_TextColor;
  45. [tback addSubview:priceLb];
  46. [priceLb mas_makeConstraints:^(MASConstraintMaker *make) {
  47. make.right.equalTo(rightImg.mas_left).offset(-5);
  48. make.centerY.equalTo(tback.mas_centerY);
  49. }];
  50. priceLb.text = minstr([_infoDic valueForKey:@"shop_bond"]);
  51. [PublicObj lineViewWithFrame:CGRectMake(0, tback.bottom, _window_width, 5) andColor:RGB(17, 13, 35) andView:self.view];
  52. UILabel *infoTitle = [[UILabel alloc]init];
  53. infoTitle.text = YZMsg(@"保证金说明");
  54. infoTitle.font = [UIFont systemFontOfSize:14];
  55. infoTitle.textColor = Normal_TextColor;
  56. [self.view addSubview:infoTitle];
  57. [infoTitle mas_makeConstraints:^(MASConstraintMaker *make) {
  58. make.left.equalTo(self.view).offset(12);
  59. make.top.equalTo(tback.mas_bottom).offset(15);
  60. make.height.mas_equalTo(20);
  61. }];
  62. NSString *str2 = [NSString stringWithFormat:YZMsg(@"2、用户撤销%@时,可申请退还保证金。"),[common shop_system_name]];//YZMsg(@"2、用户撤销云豹小店时,可申请退还保证金。保证金说明")
  63. UILabel *contentLb = [[UILabel alloc]init];
  64. contentLb.font = [UIFont systemFontOfSize:13];
  65. contentLb.textColor = Normal_TextColor;
  66. contentLb.numberOfLines = 0;
  67. contentLb.lineBreakMode = NSLineBreakByWordWrapping;
  68. contentLb.text = [NSString stringWithFormat:@"%@\n%@\n%@\n%@",YZMsg(@"1、保证金由商户交由平台暂时保管,用于约束商户行为,保障消 费者权益。"),str2,YZMsg(@"3、当用户开通店铺后,若存在欺骗消费者、售卖假冒伪劣产品等一切违反国家法律法规以及平台规定的等行为,平台有权强制关闭店铺,保证金不予退还。"),YZMsg(@"4、店铺保证金最终解释权归平台所有。")];
  69. [self.view addSubview:contentLb];
  70. [contentLb mas_makeConstraints:^(MASConstraintMaker *make) {
  71. make.left.equalTo(self.view).offset(12);
  72. make.top.equalTo(infoTitle.mas_bottom).offset(5);
  73. make.right.equalTo(self.view).offset(-12);
  74. }];
  75. payBtn = [UIButton buttonWithType:0];
  76. [payBtn setBackgroundColor:Pink_Cor];
  77. [payBtn setTitle:YZMsg(@"确认缴纳") forState:0];
  78. [payBtn setTitleColor:[UIColor whiteColor] forState:0];
  79. payBtn.titleLabel.font = [UIFont systemFontOfSize:14];
  80. payBtn.layer.cornerRadius = 5;
  81. payBtn.layer.masksToBounds = YES;
  82. [payBtn addTarget:self action:@selector(payBtnClick) forControlEvents:UIControlEventTouchUpInside];
  83. [self.view addSubview:payBtn];
  84. [payBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  85. make.left.equalTo(self.view).offset(15);
  86. make.right.equalTo(self.view).offset(-15);
  87. make.top.equalTo(contentLb.mas_bottom).offset(30);
  88. make.height.mas_equalTo(40);
  89. }];
  90. // [self requstBondStatus];
  91. }
  92. -(void)payBtnClick{
  93. NSDictionary *signdic = @{@"uid":[Config getOwnID],@"token":[Config getOwnToken], @"time":[NSNumber numberWithLong: (long)[[NSDate date] timeIntervalSince1970]]};
  94. NSString *sign = [PublicObj sortString:signdic];
  95. NSDictionary *dic = @{
  96. @"uid":[Config getOwnID],
  97. @"token":[Config getOwnToken],
  98. @"time":[NSNumber numberWithLong: (long)[[NSDate date] timeIntervalSince1970]],
  99. @"sign":sign
  100. };
  101. [YBNetworking postWithUrl:@"Shop.deductBond" Dic:dic Suc:^(int code, id info, NSString *msg) {
  102. if (code ==0) {
  103. [MBProgressHUD showError:msg];
  104. [self.navigationController popViewControllerAnimated:YES];
  105. }else if (code ==1004){
  106. UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:nil message:YZMsg(@"开通店铺保证金不足\n请先进行充值") preferredStyle:UIAlertControllerStyleAlert];
  107. UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:YZMsg(@"取消") style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  108. }];
  109. UIAlertAction *sureAction = [UIAlertAction actionWithTitle:YZMsg(@"立刻充值") style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  110. YBRechargeVC *chargeVC = [[YBRechargeVC alloc]init];
  111. [[YBBaseAppDelegate sharedAppDelegate]pushViewController:chargeVC animated:YES];
  112. }];
  113. [cancelAction setValue:[UIColor lightGrayColor] forKey:@"_titleTextColor"];
  114. [sureAction setValue:Normal_Color forKey:@"_titleTextColor"];
  115. [alertControl addAction:cancelAction];
  116. [alertControl addAction:sureAction];
  117. [self.navigationController presentViewController:alertControl animated:YES completion:nil];
  118. } else{
  119. [MBProgressHUD showError:msg];
  120. }
  121. } Fail:^(id fail) {
  122. }];
  123. }
  124. @end