ApplyRefundVC.m 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487
  1. //
  2. // ApplyRefundVC.m
  3. // yunbaolive
  4. //
  5. // Created by ybRRR on 2020/3/18.
  6. // Copyright © 2020 cat. All rights reserved.
  7. //
  8. #import "ApplyRefundVC.h"
  9. #import "TZImagePickerController.h"
  10. #import <Qiniu/QiniuSDK.h>
  11. @interface ApplyRefundVC ()<UIPickerViewDelegate,UIPickerViewDataSource,UITextViewDelegate,TZImagePickerControllerDelegate>{
  12. UIScrollView *_backScroll;
  13. UIButton *returnGoodsBtn;
  14. UIButton *refundBtn;
  15. UIButton *imageBtn;
  16. UITextField *reasonField;
  17. UILabel *priceLb;
  18. UILabel *wordCountLb;
  19. MyTextView *contentText;
  20. NSArray *reasonArr;
  21. UIView *reasonPickBack;
  22. UIPickerView *reasonPicker;
  23. NSString *selReasonStr;
  24. NSString *selReasonID;
  25. NSInteger selRow;
  26. NSString *refundtype;
  27. NSMutableArray *imageArray;
  28. UIButton *delBtn;
  29. NSString *picThumbsStr;
  30. }
  31. @property (nonatomic, strong)UIImageView *orderImg;
  32. @property (nonatomic, strong)UILabel *orderTitleLb;
  33. @property (nonatomic, strong)UILabel *orderContentLb;
  34. @property (nonatomic, strong)UILabel *orderPriceLb;
  35. @property (nonatomic, strong)UILabel *orderCountLb;
  36. @end
  37. @implementation ApplyRefundVC
  38. -(void)requestReason{
  39. NSString *url = [purl stringByAppendingFormat:@"?service=Buyer.getRefundReason"];
  40. NSDictionary *dic = @{
  41. @"uid":[Config getOwnID],
  42. @"token":[Config getOwnToken],
  43. };
  44. [YBNetworking postWithUrl:@"Buyer.getRefundReason" Dic:dic Suc:^(int code, id info, NSString *msg) {
  45. if (code ==0) {
  46. reasonArr = info;
  47. }else{
  48. [MBProgressHUD showError:msg];
  49. }
  50. } Fail:^(id fail) {
  51. }];
  52. }
  53. - (UIStatusBarStyle)preferredStatusBarStyle {
  54. if (@available(iOS 13.0,*)) {
  55. return UIStatusBarStyleDarkContent;
  56. }
  57. return UIStatusBarStyleDefault;
  58. }
  59. - (void)viewDidLoad {
  60. [super viewDidLoad];
  61. self.titleL.text = YZMsg(@"退款申请");
  62. self.subNavi.backgroundColor = UIColor.whiteColor;
  63. self.titleL.textColor = UIColor.blackColor;
  64. [self.leftBtn setImage:[UIImage imageNamed:@"pub_back_black"] forState:0];
  65. self.naviLine.hidden = NO;
  66. self.naviLine.backgroundColor = RGB(245, 245, 245);
  67. reasonArr = [NSArray array];
  68. imageArray = [NSMutableArray array];
  69. selReasonID = @"";
  70. refundtype = @"0";
  71. picThumbsStr = @"";
  72. _backScroll = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 64+statusbarHeight, _window_width, _window_height-64-statusbarHeight-40)];
  73. _backScroll.backgroundColor = UIColor.whiteColor;
  74. [self.view addSubview:_backScroll];
  75. [self createUI];
  76. UIButton *submitBtn = [UIButton buttonWithType:0];
  77. submitBtn.frame = CGRectMake(0, _window_height-40-ShowDiff, _window_width, 40);
  78. [submitBtn setTitle:YZMsg(@"提交申请") forState:0];
  79. [submitBtn setTitleColor:[UIColor whiteColor] forState:0];
  80. submitBtn.titleLabel.font =[UIFont systemFontOfSize:14];
  81. [submitBtn setBackgroundColor:Pink_Cor];
  82. [submitBtn addTarget:self action:@selector(submitBtnClick) forControlEvents:UIControlEventTouchUpInside];
  83. [self.view addSubview:submitBtn];
  84. [self requestReason];
  85. }
  86. -(void)createUI{
  87. _orderImg = [[UIImageView alloc]init];
  88. _orderImg.frame = CGRectMake(15, 15, 90, 90);
  89. _orderImg.backgroundColor = [UIColor lightGrayColor];
  90. _orderImg.layer.cornerRadius = 5;
  91. _orderImg.layer.masksToBounds = YES;
  92. _orderImg.contentMode = UIViewContentModeScaleAspectFill;
  93. [_orderImg sd_setImageWithURL:[NSURL URLWithString:self.models.orderspec_thumb_format]];
  94. [_backScroll addSubview:_orderImg];
  95. _orderTitleLb = [[UILabel alloc]init];
  96. _orderTitleLb.textColor = [UIColor blackColor];
  97. _orderTitleLb.font = [UIFont systemFontOfSize:14];
  98. _orderTitleLb.text = self.models.order_goods_name;
  99. [_backScroll addSubview:_orderTitleLb];
  100. [_orderTitleLb mas_makeConstraints:^(MASConstraintMaker *make) {
  101. make.left.equalTo(_orderImg.mas_right).offset(5);
  102. make.top.equalTo(_orderImg).offset(8);
  103. make.height.mas_equalTo(18);
  104. }];
  105. _orderPriceLb = [[UILabel alloc]init];
  106. _orderPriceLb.textColor = [UIColor blackColor];
  107. _orderPriceLb.font = [UIFont systemFontOfSize:14];
  108. _orderPriceLb.text = self.models.order_price;
  109. _orderPriceLb.textAlignment = NSTextAlignmentRight;
  110. [_backScroll addSubview:_orderPriceLb];
  111. [_orderPriceLb mas_makeConstraints:^(MASConstraintMaker *make) {
  112. make.right.equalTo(self.view).offset(-10);
  113. make.centerY.height.equalTo(_orderTitleLb);
  114. }];
  115. _orderContentLb = [[UILabel alloc]init];
  116. _orderContentLb.textColor = Normal_TextColor;
  117. _orderContentLb.font = [UIFont systemFontOfSize:14];
  118. _orderContentLb.text =self.models.order_spec_name;// @"麻辣鲜香味";
  119. [_backScroll addSubview:_orderContentLb];
  120. [_orderContentLb mas_makeConstraints:^(MASConstraintMaker *make) {
  121. make.left.equalTo(_orderTitleLb);
  122. make.top.equalTo(_orderTitleLb.mas_bottom).offset(5);
  123. make.height.equalTo(_orderTitleLb);
  124. }];
  125. _orderCountLb = [[UILabel alloc]init];
  126. _orderCountLb.textColor = Normal_TextColor;
  127. _orderCountLb.font = [UIFont systemFontOfSize:14];
  128. _orderCountLb.text =[NSString stringWithFormat:@"x%@",self.models.order_nums];
  129. _orderCountLb.textAlignment = NSTextAlignmentRight;
  130. [_backScroll addSubview:_orderCountLb];
  131. [_orderCountLb mas_makeConstraints:^(MASConstraintMaker *make) {
  132. make.right.equalTo(self.view).offset(-10);
  133. make.centerY.height.equalTo(_orderContentLb);
  134. }];
  135. [PublicObj lineViewWithFrame:CGRectMake(0, _orderImg.bottom+5, _window_width, 5) andColor:RGB(245, 245, 245) andView:_backScroll];
  136. NSArray *arr = @[YZMsg(@"退款方式"),YZMsg(@"退款原因"),YZMsg(@"退款金额")];
  137. for (int i = 0; i < arr.count; i ++) {
  138. UILabel *titleLb = [[UILabel alloc]init];
  139. titleLb.frame = CGRectMake(15, _orderImg.bottom+10 + i*40, 80, 40);
  140. titleLb.font = [UIFont systemFontOfSize:14];
  141. titleLb.textColor = Normal_TextColor;
  142. titleLb.text = arr[i];
  143. [_backScroll addSubview:titleLb];
  144. if (i == 0) {
  145. //['status'] 订单状态 -1 已关闭 0 待付款 1 待发货 2 待收货 3 待评价 4 已评价 5 退款
  146. refundBtn = [UIButton buttonWithType:0];
  147. refundBtn.frame = CGRectMake(titleLb.right+10, _orderImg.bottom+10 + i*40, 80+15, 40);
  148. [refundBtn setTitleColor:Normal_TextColor forState:0];
  149. [refundBtn setTitleColor:Pink_Cor forState:UIControlStateSelected];
  150. [refundBtn setTitle:YZMsg(@"仅退款") forState:0];
  151. refundBtn.titleLabel.font = [UIFont systemFontOfSize:14];
  152. [refundBtn setImage:[UIImage imageNamed:@"refund_未选"] forState:UIControlStateNormal];
  153. [refundBtn setImage:[UIImage imageNamed:@"refund_已选"] forState:UIControlStateSelected];
  154. refundBtn.imageEdgeInsets = UIEdgeInsetsMake(0, -10, 0, 0);
  155. refundBtn.tag = 20000;
  156. [refundBtn addTarget:self action:@selector(refundTypeClick:) forControlEvents:UIControlEventTouchUpInside];
  157. [_backScroll addSubview:refundBtn];
  158. refundBtn.selected = YES;
  159. if ([self.models.order_status isEqual:@"2"] ||[self.models.order_status isEqual:@"3"]) {
  160. returnGoodsBtn = [UIButton buttonWithType:0];
  161. returnGoodsBtn.frame = CGRectMake(refundBtn.right+20, _orderImg.bottom+10 + i*40, 80, 40);
  162. if ([lagType isEqual:EN]) {
  163. returnGoodsBtn.frame = CGRectMake(refundBtn.right+20, _orderImg.bottom+10 + i*40, 80+35, 40);
  164. }
  165. [returnGoodsBtn setTitleColor:Normal_TextColor forState:0];
  166. [returnGoodsBtn setTitleColor:Pink_Cor forState:UIControlStateSelected];
  167. [returnGoodsBtn setTitle:YZMsg(@"退货退款") forState:0];
  168. returnGoodsBtn.titleLabel.font = [UIFont systemFontOfSize:14];
  169. [returnGoodsBtn setImage:[UIImage imageNamed:@"refund_未选"] forState:UIControlStateNormal];
  170. [returnGoodsBtn setImage:[UIImage imageNamed:@"refund_已选"] forState:UIControlStateSelected];
  171. returnGoodsBtn.tag = 20001;
  172. returnGoodsBtn.imageEdgeInsets = UIEdgeInsetsMake(0, -10, 0, 0);
  173. [returnGoodsBtn addTarget:self action:@selector(refundTypeClick:) forControlEvents:UIControlEventTouchUpInside];
  174. [_backScroll addSubview:returnGoodsBtn];
  175. returnGoodsBtn.selected = NO;
  176. }
  177. }else if (i == 1){
  178. reasonField = [[UITextField alloc]init];
  179. reasonField.frame = CGRectMake(titleLb.right+10, _orderImg.bottom+10 + i*40, 200, 40);
  180. // reasonField.placeholder = YZMsg(@"请选择");
  181. reasonField.font = [UIFont systemFontOfSize:14];
  182. reasonField.userInteractionEnabled = NO;
  183. reasonField.textColor = Normal_TextColor;
  184. NSAttributedString *attrString = [[NSAttributedString alloc] initWithString:YZMsg(@"请选择") attributes:@{NSForegroundColorAttributeName:Normal_TextColor,
  185. NSFontAttributeName:reasonField.font
  186. }];
  187. reasonField.attributedPlaceholder = attrString;
  188. [_backScroll addSubview:reasonField];
  189. UIImageView *rightImg = [[UIImageView alloc]init];
  190. rightImg.frame = CGRectMake(_window_width-40, _orderImg.bottom+20 + i*40, 20, 20);
  191. rightImg.image = [UIImage imageNamed:@"shop_right"];
  192. [_backScroll addSubview:rightImg];
  193. UIButton *select = [UIButton buttonWithType:0];
  194. select.frame = CGRectMake(titleLb.right+10, _orderImg.bottom+10 + i*40, _window_width, 40);
  195. [select addTarget:self action:@selector(selectReason) forControlEvents:UIControlEventTouchUpInside];
  196. [_backScroll addSubview:select];
  197. }else{
  198. priceLb = [[UILabel alloc]init];
  199. priceLb.frame = CGRectMake(titleLb.right+10, _orderImg.bottom+10 + i*40, 200, 40);
  200. priceLb.font = [UIFont systemFontOfSize:14];
  201. priceLb.textColor = Pink_Cor;
  202. priceLb.text = self.models.order_total;
  203. [_backScroll addSubview:priceLb];
  204. }
  205. }
  206. UILabel *line = [[UILabel alloc]init];
  207. line.frame = CGRectMake(0, priceLb.bottom+5, _window_width, 5);
  208. line.backgroundColor = RGB(245, 245, 245);
  209. [_backScroll addSubview:line];
  210. contentText = [[MyTextView alloc]init];
  211. contentText.frame = CGRectMake(10, line.bottom+5, _window_width-20, 150);
  212. contentText.placeholderColor = Normal_TextColor;
  213. contentText.placeholder =YZMsg(@"请填写10个字以上的问题描述以便我们提供更好的帮助");
  214. contentText.font = [UIFont systemFontOfSize:14];
  215. contentText.delegate = self;
  216. contentText.backgroundColor = RGB(245, 245, 245);
  217. contentText.textColor = [UIColor blackColor];
  218. [_backScroll addSubview:contentText];
  219. // --原来有上传图片功能,现在去掉了
  220. imageBtn = [UIButton buttonWithType:0];
  221. imageBtn.frame = CGRectMake(15, _backScroll.height-80, 70, 70);
  222. [imageBtn setBackgroundImage:[UIImage imageNamed:getImagename(@"refund_upimg")] forState:0];
  223. [imageBtn addTarget:self action:@selector(uploadImage) forControlEvents:UIControlEventTouchUpInside];
  224. // [_backScroll addSubview:imageBtn];
  225. delBtn = [UIButton buttonWithType:0];
  226. delBtn.frame = CGRectMake(imageBtn.width-25, 5, 20, 20);
  227. [delBtn setBackgroundImage:[UIImage imageNamed:@"comm_del"] forState:0];
  228. [delBtn addTarget:self action:@selector(delVideoClick) forControlEvents:UIControlEventTouchUpInside];
  229. // [imageBtn addSubview:delBtn];
  230. delBtn.hidden = YES;
  231. wordCountLb = [[UILabel alloc]init];
  232. wordCountLb.frame = CGRectMake(_window_width-100, contentText.bottom+10, 90, 20);
  233. // wordCountLb.centerY = imageBtn.centerY;
  234. wordCountLb.font = [UIFont systemFontOfSize:14];
  235. wordCountLb.textColor = Normal_TextColor;
  236. wordCountLb.text = @"0/300";
  237. wordCountLb.textAlignment = NSTextAlignmentRight;
  238. [_backScroll addSubview:wordCountLb];
  239. }
  240. -(void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
  241. {
  242. [self.view endEditing:YES];
  243. }
  244. -(void)refundTypeClick:(UIButton *)sender{
  245. if (sender.tag == 20000) {
  246. refundBtn.selected = YES;
  247. returnGoodsBtn.selected = NO;
  248. refundtype = @"0";
  249. }else{
  250. refundBtn.selected = NO;
  251. returnGoodsBtn.selected = YES;
  252. refundtype = @"1";
  253. }
  254. }
  255. //选择图片
  256. -(void)uploadImage{
  257. TZImagePickerController *imagePC = [[TZImagePickerController alloc]initWithMaxImagesCount:1-imageArray.count delegate:self];
  258. imagePC.preferredLanguage = [lagType isEqual:ZH_CN] ? @"zh-Hans":@"en";
  259. imagePC.modalPresentationStyle = 0;
  260. imagePC.showSelectBtn = YES;
  261. imagePC.allowCrop = NO;
  262. imagePC.allowPickingOriginalPhoto = NO;
  263. imagePC.oKButtonTitleColorNormal = Pink_Cor;
  264. imagePC.allowTakePicture = YES;
  265. imagePC.allowTakeVideo = NO;
  266. imagePC.allowPickingVideo = NO;
  267. imagePC.allowPickingMultipleVideo = NO;
  268. [[[YBBaseAppDelegate sharedAppDelegate] topViewController]presentViewController:imagePC animated:YES completion:nil];
  269. }
  270. -(void)delVideoClick{
  271. delBtn.hidden = YES;
  272. [imageArray removeAllObjects];
  273. [imageBtn setBackgroundImage:[UIImage imageNamed:getImagename(@"refund_upimg")] forState:0];
  274. }
  275. #pragma mark------选择原因-------
  276. -(void)selectReason{
  277. [self.view endEditing:YES];
  278. if (!reasonPickBack) {
  279. reasonPickBack = [[UIView alloc]initWithFrame:CGRectMake(0, 0, _window_width, _window_height)];
  280. reasonPickBack.backgroundColor = RGB_COLOR(@"#000000", 0.3);
  281. [self.view addSubview:reasonPickBack];
  282. UIView *titleView = [[UIView alloc]initWithFrame:CGRectMake(0, _window_height-240, _window_width, 40)];
  283. titleView.backgroundColor = [UIColor whiteColor];
  284. [reasonPickBack addSubview:titleView];
  285. [PublicObj lineViewWithFrame:CGRectMake(0, titleView.height-1, _window_width, 1) andColor:RGB(250, 250, 250) andView:titleView];
  286. UIButton *cancleBtn = [UIButton buttonWithType:0];
  287. cancleBtn.frame = CGRectMake(10, 0, 80, 40);
  288. cancleBtn.tag = 100;
  289. [cancleBtn setTitle:YZMsg(@"取消") forState:0];
  290. [cancleBtn setTitleColor:[UIColor blackColor] forState:0];
  291. cancleBtn.titleLabel.font = [UIFont systemFontOfSize:16];
  292. [cancleBtn addTarget:self action:@selector(cityCancleOrSure:) forControlEvents:UIControlEventTouchUpInside];
  293. [titleView addSubview:cancleBtn];
  294. UIButton *sureBtn = [UIButton buttonWithType:0];
  295. sureBtn.frame = CGRectMake(_window_width-90, 0, 80, 40);
  296. sureBtn.tag = 101;
  297. [sureBtn setTitle:YZMsg(@"完成") forState:0];
  298. [sureBtn setTitleColor:[UIColor blackColor] forState:0];
  299. sureBtn.titleLabel.font = [UIFont systemFontOfSize:16];
  300. [sureBtn addTarget:self action:@selector(cityCancleOrSure:) forControlEvents:UIControlEventTouchUpInside];
  301. [titleView addSubview:sureBtn];
  302. UILabel *titlelb = [[UILabel alloc]init];
  303. titlelb.frame = CGRectMake(_window_width/2-40, 0, 80, 40);
  304. titlelb.font = [UIFont systemFontOfSize:15];
  305. titlelb.text = YZMsg(@"退款原因");
  306. titlelb.textColor = [UIColor blackColor];
  307. [titleView addSubview:titlelb];
  308. reasonPicker = [[UIPickerView alloc]initWithFrame:CGRectMake(0, _window_height-200, _window_width, 200)];
  309. reasonPicker.backgroundColor = [UIColor whiteColor];
  310. reasonPicker.delegate = self;
  311. reasonPicker.dataSource = self;
  312. reasonPicker.showsSelectionIndicator = YES;
  313. [reasonPicker selectRow: 0 inComponent: 0 animated: YES];
  314. [reasonPickBack addSubview:reasonPicker];
  315. }else{
  316. reasonPickBack.hidden = NO;
  317. }
  318. }
  319. - (void)cityCancleOrSure:(UIButton *)button{
  320. if (button.tag == 100) {
  321. //return;
  322. }else{
  323. reasonField.text = selReasonStr;
  324. }
  325. reasonPickBack.hidden = YES;
  326. }
  327. #pragma mark--- Picker Data Source Methods-----
  328. - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView {
  329. return 1;
  330. }
  331. - (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component {
  332. return reasonArr.count;
  333. }
  334. - (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component {
  335. return [reasonArr[row] valueForKey:@"name"];
  336. }
  337. - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component{
  338. selReasonStr = [reasonArr[row] valueForKey:@"name"];
  339. selReasonID =minstr([reasonArr[row] valueForKey:@"id"]) ;
  340. selRow = row;
  341. [reasonPicker reloadAllComponents];
  342. }
  343. - (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view {
  344. UILabel* pickerLabel = (UILabel*)view;
  345. if (!pickerLabel){
  346. pickerLabel = [[UILabel alloc] init];
  347. pickerLabel.adjustsFontSizeToFitWidth = YES;
  348. [pickerLabel setTextAlignment:NSTextAlignmentCenter];
  349. [pickerLabel setBackgroundColor:[UIColor clearColor]];
  350. pickerLabel.font = [UIFont systemFontOfSize:15];
  351. }
  352. if (row == selRow) {
  353. pickerLabel.textColor = Pink_Cor;
  354. selReasonStr =[reasonArr[selRow] valueForKey:@"name"];
  355. selReasonID =[reasonArr[row] valueForKey:@"id"];
  356. }
  357. pickerLabel.text=[self pickerView:pickerView titleForRow:row forComponent:component];
  358. return pickerLabel;
  359. }
  360. - (void)imagePickerController:(TZImagePickerController *)picker didFinishPickingPhotos:(NSArray<UIImage *> *)photos sourceAssets:(NSArray *)assets isSelectOriginalPhoto:(BOOL)isSelectOriginalPhoto{
  361. NSLog(@"------多选择图片--:%@",photos);
  362. [imageArray addObjectsFromArray:photos];
  363. [imageBtn setBackgroundImage:photos[0] forState:0];
  364. delBtn.hidden = NO;
  365. }
  366. #pragma mark - UITextViewDelegate
  367. - (void)textViewDidChange:(UITextView*)textView {
  368. NSString *toBeString = textView.text;
  369. NSString *lang = [[[UITextInputMode activeInputModes]firstObject] primaryLanguage]; // 键盘输入模式
  370. if ([lang isEqualToString:@"zh-Hans"]) { // 简体中文输入,包括简体拼音,健体五笔,简体手写
  371. UITextRange *selectedRange = [textView markedTextRange];//获取高亮部分
  372. UITextPosition *position = [textView positionFromPosition:selectedRange.start offset:0];
  373. //没有高亮选择的字,则对已输入的文字进行字数统计和限制
  374. if (!position) {
  375. if (toBeString.length > 300) {
  376. textView.text = [toBeString substringToIndex:300];
  377. wordCountLb.text = [NSString stringWithFormat:@"%lu/300",textView.text.length];
  378. }else{
  379. wordCountLb.text = [NSString stringWithFormat:@"%lu/300",toBeString.length];
  380. }
  381. }else{
  382. //有高亮选择的字符串,则暂不对文字进行统计和限制
  383. }
  384. }else{
  385. // 中文输入法以外的直接对其统计限制即可,不考虑其他语种情况
  386. if (toBeString.length > 300) {
  387. textView.text = [toBeString substringToIndex:300];
  388. wordCountLb.text = [NSString stringWithFormat:@"%lu/300",textView.text.length];
  389. }else{
  390. wordCountLb.text = [NSString stringWithFormat:@"%lu/300",toBeString.length];
  391. }
  392. }
  393. }
  394. #pragma mark------提交----------
  395. -(void)submitBtnClick{
  396. [self uploadService];
  397. }
  398. -(void)uploadService{
  399. if (selReasonID.length < 1) {
  400. [MBProgressHUD showError:YZMsg(@"请选择退款原因")];
  401. return;
  402. }
  403. NSString *url = [purl stringByAppendingFormat:@"?service=Buyer.applyRefundGoodsOrder"];
  404. NSDictionary *signdic = @{@"uid":[Config getOwnID],@"token":[Config getOwnToken],@"orderid":self.models.order_id, @"time":[NSNumber numberWithLong: (long)[[NSDate date] timeIntervalSince1970]]};
  405. NSString *sign = [PublicObj sortString:signdic];
  406. NSDictionary *dic = @{
  407. @"uid":[Config getOwnID],
  408. @"token":[Config getOwnToken],
  409. @"orderid":self.models.order_id,
  410. @"reasonid":selReasonID,
  411. @"content":contentText.text,
  412. @"type":refundtype,
  413. @"time":[NSNumber numberWithLong: (long)[[NSDate date] timeIntervalSince1970]],
  414. @"sign":sign
  415. };
  416. [YBNetworking postWithUrl:@"Buyer.applyRefundGoodsOrder" Dic:dic Suc:^(int code, id info, NSString *msg) {
  417. if (code ==0) {
  418. [MBProgressHUD showError:msg];
  419. [[YBBaseAppDelegate sharedAppDelegate]popViewController:YES];
  420. }else{
  421. [MBProgressHUD showError:msg];
  422. }
  423. } Fail:^(id fail) {
  424. }];
  425. }
  426. @end