123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259 |
- //
- // TrainPriceDetail.m
- // LN_School
- //
- // Created by EchoShacolee on 2017/4/19.
- // Copyright © 2017年 Danson. All rights reserved.
- //
- #import "TrainPriceDetail.h"
- #import "EditPriceVC.h"
- @interface TrainPriceDetail ()
- @end
- @implementation TrainPriceDetail
- - (void)viewDidLoad {
- [super viewDidLoad];
-
- self.navigationItem.title = @"培训价格详情";
-
- [self setSegmentControllWithTitles:@[@"基本信息"] isBttomBar:YES];
- [self createBottomBarWithtoolTitles:@[@"删除",@"修改"]];
-
- [self getData];
-
- }
- -(void)setData{
-
- _keysArr = @[
- @[@"所属机构",@"JXMC"],
- @[@"培训车型",@"CSI_VEHICLETYPE"],
- @[@"收费模式",@"CSI_CHARGEMODE"],
- @[@"培训时段",@"CSI_TRAINNINGTIME"],
- @[@"付费模式",@"CSI_PAYMODE"],
- @[@"金额",@"CSI_PRICE"],
- @[@"班型名称",@"CSI_CLASSCURR"],
- @[@"培训模式",@"CSI_TRAINNINGMODE"],
- @[@"培训部分及方式 ",@"CSI_SUBJECT"],
- @[@"服务内容",@"CSI_SERVICE"],
- @[@"编号",@"CSI_SEQ"],
- @[@"备案时间",@"CSI_RECORD_DATE"],
- ];
-
- [super setData];
- }
- #pragma mark 创建BottomBarButton
- -(void)createBottomBarWithtoolTitles:(NSArray *)toolTitles{
-
- float widthBtn = (kSize.width-1*toolTitles.count+1)/toolTitles.count;
- float HeightBth = JOb_DETAIL_BOTTOMBAR_HEIGHT;
- for (int i=0; i<toolTitles.count; i++) {
- UIButton * button = [UIButton buttonWithType:UIButtonTypeSystem];
- button.frame = CGRectMake(i*(widthBtn+1), kSize.height-HeightBth-kNavOffSet-kSafeAreaBottomHeight, widthBtn, HeightBth);
- [button setTitle:toolTitles[i] forState:UIControlStateNormal];
- button.backgroundColor = RQMianColor;
- [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
- [button addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
- button.tag = 10+i;
-
- [self.view addSubview:button];
- }
- }
- -(void)btnClick:(UIButton *)sender{
-
- switch (sender.tag) {
- case 10:
- {
- //删除培训价格
- [RQ_SHARE_FUNCTION showAlertWithTitle:nil message:@"您确定要删除吗?" alertControllerStyle:UIAlertControllerStyleAlert cancelButtonTitle:@"取消" otherButtonTitles:@[@"确定"] otherButtonStyles:nil completion:^(NSUInteger selectedOtherButtonIndex) {
- if (selectedOtherButtonIndex == 0) {
- [self delPrice];
- }
- }];
- }
- break;
- case 11:
- {
- [self willEditPrice];//修改培训价格
- }
- break;
-
- default:
- break;
- }
- }
- #pragma mark 重写代理方法
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
- if (self.dataSource.allKeys.count == 0) {
- return 0;
- }
- return [_keysArr count];
- }
- -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- {
-
- UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"cellId"];
-
- if (!cell) {
- cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"cellId"];
- }
- cell.textLabel.text = _keysArr[indexPath.row][0];
-
- if ([_statusArr[indexPath.row] isEqualToNumber:@1]) {
- cell.detailTextLabel.numberOfLines = 0;
- cell.detailTextLabel.textAlignment = NSTextAlignmentLeft;
- }else{
- cell.detailTextLabel.numberOfLines = 1;
- cell.detailTextLabel.textAlignment = NSTextAlignmentRight;
- }
-
- NSString * key = _keysArr[indexPath.row][1];
- if ([key isEqualToString:@"CSI_CHARGEMODE"]){
- NSString *status = [NSString stringWithFormat:@"%@",self.dataSource[key]];
- //@"一次性收费",@"计时收费",@"分段式收费",@"其他"
- switch ([status integerValue]) {
- case 1:
- cell.detailTextLabel.text = @"一次性收费";
- break;
- case 2:
- cell.detailTextLabel.text = @"计时收费";
- break;
- case 3:
- cell.detailTextLabel.text = @"分段式收费";
- break;
- case 9:
- cell.detailTextLabel.text = @"其它";
- break;
- default:
- break;
- }
- }else if ([key isEqualToString:@"CSI_TRAINNINGTIME"]){
- NSString *status = [NSString stringWithFormat:@"%@",self.dataSource[key]];
- //@"普通时段",@"高峰时段",@"节假日时段"
- switch ([status integerValue]) {
- case 1:
- cell.detailTextLabel.text = @"普通时段";
- break;
- case 2:
- cell.detailTextLabel.text = @"高峰时段";
- break;
- case 3:
- cell.detailTextLabel.text = @"节假日时段";
- break;
- default:
- break;
- }
- }else if ([key isEqualToString:@"CSI_PAYMODE"]){
- NSString *status = [NSString stringWithFormat:@"%@",self.dataSource[key]];
- //@"先学后付",@"先付后学",@"其它"
- switch ([status integerValue]) {
- case 1:
- cell.detailTextLabel.text = @"先学后付";
- break;
- case 2:
- cell.detailTextLabel.text = @"先付后学";
- break;
- case 9:
- cell.detailTextLabel.text = @"其它";
- break;
- default:
- break;
- }
- }else if ([key isEqualToString:@"CSI_TRAINNINGMODE"]){
- NSString *status = [NSString stringWithFormat:@"%@",self.dataSource[key]];
- //@[@"定时培训",@"预约培训",@"c"]
- switch ([status integerValue]) {
- case 1:
- cell.detailTextLabel.text = @"定时培训";
- break;
- case 2:
- cell.detailTextLabel.text = @"预约培训";
- break;
- case 9:
- cell.detailTextLabel.text = @"其它";
- break;
- default:
- break;
- }
- }else if ([key isEqualToString:@"CSI_SUBJECT"]){
- NSString *status = [NSString stringWithFormat:@"%@",self.dataSource[key]];
- NSArray * arr = @[@"第一部份集中教学",@"第一部份网络教学",@"第四部份集中教学",@"第四部份网络教学",@"模拟器教学",@"第二部份普通教学",@"第二部份智能教学",@"第三部份普通教学",@"第三部份智能教学"];
- if ([status integerValue] == 0) {
- cell.detailTextLabel.text = @"";
- }else{
- cell.detailTextLabel.text = arr[[status integerValue]-1];
- }
-
- }else if ([key isEqualToString:@"CSI_SERVICE"]){
- NSString *status = [NSString stringWithFormat:@"%@",self.dataSource[key]];
- if ([status isEqualToString:@"<null>"]) {
- status = @"";
- }
- cell.detailTextLabel.text = status;
- }else{
- cell.detailTextLabel.text = [NSString stringWithFormat:@"%@",self.dataSource[_keysArr[indexPath.row][1]]];
- }
-
- return cell;
- }
- #pragma mark 数据请求
- -(void)getData{
-
- NSMutableDictionary *dic = [NSMutableDictionary dictionary];
- [dic setObject:_theId forKey:@"id"];
-
- [self getDataWithDic:dic method:@"viewPrice" block:^(NSDictionary *successDic) {
- self.dataSource = successDic[@"body"];
- [_tableViews[0] reloadData];
- }];
- }
- -(void)delPrice{
-
- NSMutableDictionary *dic = [NSMutableDictionary dictionary];
- [dic setObject:_theId forKey:@"ids"];
- [dic setObject:defUser.userDict[@"id"] forKey:@"userId"];
-
- [self getDataWithDic:dic method:@"delPrice" block:^(NSDictionary *successDic) {
- ShowMsg(@"删除成功!");
- [self.navigationController popViewControllerAnimated:YES];
- }];
- }
- -(void)willEditPrice{
- EditPriceVC * vc = [[EditPriceVC alloc]init];
- vc.theDic = self.dataSource;
- vc.type = @"2";
- vc.blcok = ^{
- [self getData];
- };
- [self navPushHideTabbarToVC:vc];
- }
- - (void)didReceiveMemoryWarning {
- [super didReceiveMemoryWarning];
- // Dispose of any resources that can be recreated.
- }
- /*
- #pragma mark - Navigation
- // In a storyboard-based application, you will often want to do a little preparation before navigation
- - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
- // Get the new view controller using [segue destinationViewController].
- // Pass the selected object to the new view controller.
- }
- */
- @end
|