OrderGoodsSinglePromotionDetailCell.m 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542
  1. //
  2. // OrderGoodsSinglePromotionDetailCell.m
  3. // IBOSS
  4. //
  5. // Created by 关宏厚 on 2020/9/9.
  6. // Copyright © 2020 elongtian. All rights reserved.
  7. //
  8. #import "OrderGoodsSinglePromotionDetailCell.h"
  9. @implementation OrderGoodsSinglePromotionDetailCell
  10. - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
  11. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  12. return self;
  13. }
  14. -(void)btnGoCheck
  15. {
  16. if([self.delegate respondsToSelector:@selector(btnOrderGoodsSinglePromotionCheckPressed:)])
  17. {
  18. [self.delegate btnOrderGoodsSinglePromotionCheckPressed:self];
  19. }
  20. }
  21. -(void)btnGoOptionCombinationCheck
  22. {
  23. if([self.delegate respondsToSelector:@selector(btnOrderGoodsOptionCombinationCheckPressed:)])
  24. {
  25. [self.delegate btnOrderGoodsOptionCombinationCheckPressed:self];
  26. }
  27. }
  28. - (void) setCheckBackground: (BOOL) checked
  29. {
  30. if(!checked)
  31. {
  32. [_btnCheck setImage:[UIImage imageNamed:@"order_unchecked"] forState:UIControlStateNormal];
  33. }
  34. else
  35. {
  36. [_btnCheck setImage:[UIImage imageNamed:@"order_checked"] forState:UIControlStateNormal];
  37. }
  38. }
  39. -(void)setCombinationBackground:(BOOL) checked
  40. {
  41. if(!checked)
  42. {
  43. [_btnOptionCombinationCheck setImage:[UIImage imageNamed:@"order_unchecked"] forState:UIControlStateNormal];
  44. }
  45. else
  46. {
  47. [_btnOptionCombinationCheck setImage:[UIImage imageNamed:@"order_checked"] forState:UIControlStateNormal];
  48. }
  49. }
  50. -(void)setPromotionGoodsDetailCell:(InventoryListModel*)goodsModel isCanChoose:(BOOL)canChoose
  51. {
  52. CGFloat heightLine = 1;
  53. CGFloat heightRow = 31;
  54. CGFloat lblx = 10;
  55. CGFloat lbly = 0;
  56. CGFloat lblwidth = 70;
  57. CGFloat lblheight = 31;
  58. CGFloat valuey = 0;
  59. CGFloat valueheight = 31;
  60. CGFloat topMargin=8;
  61. NSString *promotionTypeId= goodsModel.promotionTypeDetailId;
  62. UIView *vCode = [UIView new];
  63. vCode.frame=CGRectMake(0,0, Screen_Width,35);
  64. [self.contentView addSubview:vCode];
  65. _btnCheck = [UIButton buttonWithType:UIButtonTypeCustom];
  66. _btnCheck.frame= CGRectMake(lblx,8, 25,25);
  67. [_btnCheck addTarget:self action:@selector(btnGoCheck) forControlEvents:UIControlEventTouchUpInside];
  68. [vCode addSubview:_btnCheck];
  69. UILabel *lblCode = [UILabel new];
  70. lblCode.frame=CGRectMake(CGRectGetMaxX(_btnCheck.frame)+3, 5, Screen_Width-CGRectGetMaxX(_btnCheck.frame), valueheight);
  71. lblCode.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  72. [vCode addSubview:lblCode];
  73. lblCode.text = goodsModel.code;
  74. UIView *viewBackgroud = [UIView new];
  75. viewBackgroud.frame = CGRectMake(0, CGRectGetMaxY(vCode.frame)-1, Screen_Width, 1);
  76. viewBackgroud.backgroundColor = LineBackgroundColor;
  77. [vCode addSubview:viewBackgroud];
  78. CGFloat currentHeight;
  79. currentHeight=CGRectGetMaxY(vCode.frame);
  80. CGFloat leftMargin=0;
  81. if([promotionTypeId intValue]==5)
  82. {
  83. _btnOptionCombinationCheck = [UIButton buttonWithType:UIButtonTypeCustom];
  84. _btnOptionCombinationCheck.frame=CGRectMake(lblx, 0, 25, 25);
  85. [_btnOptionCombinationCheck addTarget:self action:@selector(btnGoOptionCombinationCheck)
  86. forControlEvents:UIControlEventTouchUpInside];
  87. [self.contentView addSubview:_btnOptionCombinationCheck ];
  88. leftMargin=CGRectGetMaxX(_btnOptionCombinationCheck.frame);
  89. UIView *vGoodsCate = [UIView new];
  90. vGoodsCate.frame=CGRectMake(CGRectGetMaxX(_btnOptionCombinationCheck.frame),CGRectGetMaxY(vCode.frame)+10, Screen_Width-leftMargin, heightRow);
  91. UILabel *lblTitleGoodsCateName = [UILabel new];
  92. lblTitleGoodsCateName.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  93. lblTitleGoodsCateName.text = @"自选种类:";
  94. lblTitleGoodsCateName.textColor = [UIColor lightGrayColor];
  95. lblTitleGoodsCateName.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  96. [vGoodsCate addSubview:lblTitleGoodsCateName];
  97. UILabel *lblGoodsCateName = [UILabel new];
  98. lblGoodsCateName.frame=CGRectMake(CGRectGetMaxX(lblTitleGoodsCateName.frame), valuey, Screen_Width-CGRectGetMaxX(lblTitleGoodsCateName.frame), valueheight);
  99. lblGoodsCateName.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  100. [vGoodsCate addSubview:lblGoodsCateName];
  101. lblGoodsCateName.text = goodsModel.goodsCateName;
  102. [self.contentView addSubview:vGoodsCate];
  103. currentHeight=CGRectGetMaxY(vGoodsCate.frame);
  104. }
  105. UIView *vCodeName = [UIView new];
  106. vCodeName.frame=CGRectMake(leftMargin,currentHeight+10, Screen_Width/2-leftMargin, heightRow);
  107. UILabel *lblTitleCodeName = [UILabel new];
  108. lblTitleCodeName.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  109. lblTitleCodeName.text = @"商品名称:";
  110. lblTitleCodeName.textColor = [UIColor lightGrayColor];
  111. lblTitleCodeName.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  112. [vCodeName addSubview:lblTitleCodeName];
  113. UILabel *lblCodeName = [UILabel new];
  114. lblCodeName.frame=CGRectMake(CGRectGetMaxX(lblTitleCodeName.frame), valuey, Screen_Width/2-CGRectGetMaxX(lblTitleCodeName.frame), valueheight);
  115. lblCodeName.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  116. [vCodeName addSubview:lblCodeName];
  117. lblCodeName.text = goodsModel.goodsName;
  118. [self.contentView addSubview:vCodeName];
  119. UIView *vVariety = [UIView new];
  120. vVariety.frame=CGRectMake(Screen_Width/2,CGRectGetMaxY(vCode.frame)+10, Screen_Width/2, heightRow);
  121. UILabel *lblTitleVariety = [UILabel new];
  122. lblTitleVariety.frame=CGRectMake(0, lbly, lblwidth, lblheight);
  123. lblTitleVariety.text = @"商品品种:";
  124. lblTitleVariety.textColor = [UIColor lightGrayColor];
  125. lblTitleVariety.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  126. [vVariety addSubview:lblTitleVariety];
  127. UILabel *lblVariety = [UILabel new];
  128. lblVariety.frame=CGRectMake(CGRectGetMaxX(lblTitleVariety.frame), valuey, Screen_Width/2-CGRectGetMaxX(lblTitleVariety.frame), valueheight);
  129. lblVariety.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  130. [vVariety addSubview:lblVariety];
  131. lblVariety.text =goodsModel.varietyName;
  132. [self.contentView addSubview:vVariety];
  133. UIView *vOnlyCode = [UIView new];
  134. vOnlyCode.frame=CGRectMake(leftMargin,CGRectGetMaxY(vCodeName.frame)+10, Screen_Width/2-leftMargin, heightRow);
  135. UILabel *lblTitleOnlyCode = [UILabel new];
  136. lblTitleOnlyCode.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  137. lblTitleOnlyCode.text = @"唯一编码:";
  138. lblTitleOnlyCode.textColor = [UIColor lightGrayColor];
  139. lblTitleOnlyCode.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  140. [vOnlyCode addSubview:lblTitleOnlyCode];
  141. UILabel *lblOnlyCode = [UILabel new];
  142. lblOnlyCode.frame=CGRectMake(CGRectGetMaxX(lblTitleOnlyCode.frame), valuey, Screen_Width/2-CGRectGetMaxX(lblTitleOnlyCode.frame), valueheight);
  143. lblOnlyCode.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  144. [vOnlyCode addSubview:lblOnlyCode];
  145. lblOnlyCode.text =goodsModel.onlyCode;
  146. [self.contentView addSubview:vOnlyCode];
  147. UIView *vBrand = [UIView new];
  148. vBrand.frame=CGRectMake(Screen_Width/2,CGRectGetMaxY(vCodeName.frame)+10, Screen_Width/2, heightRow);
  149. UILabel *lblTitleBrand = [UILabel new];
  150. lblTitleBrand.frame=CGRectMake(0, lbly, lblwidth, lblheight);
  151. lblTitleBrand.text = @"商品品牌:";
  152. lblTitleBrand.textColor = [UIColor lightGrayColor];
  153. lblTitleBrand.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  154. [vBrand addSubview:lblTitleBrand];
  155. UILabel *lblBrand = [UILabel new];
  156. lblBrand.frame=CGRectMake(CGRectGetMaxX(lblTitleBrand.frame), valuey, Screen_Width/2-CGRectGetMaxX(lblTitleBrand.frame), valueheight);
  157. lblBrand.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  158. [vBrand addSubview:lblBrand];
  159. lblBrand.text = goodsModel.brandName;
  160. [self.contentView addSubview:vBrand];
  161. currentHeight=CGRectGetMaxY(vOnlyCode.frame);
  162. if([promotionTypeId intValue]==2||[promotionTypeId intValue]==5)
  163. {
  164. UIView *vCombinationQuantity = [UIView new];
  165. vCombinationQuantity.frame=CGRectMake(leftMargin,currentHeight+10, Screen_Width-leftMargin, heightRow);
  166. UILabel *lblTitleCombinationQuantity = [UILabel new];
  167. lblTitleCombinationQuantity.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  168. lblTitleCombinationQuantity.text = @"组 合 量:";
  169. lblTitleCombinationQuantity.textColor = [UIColor redColor];
  170. lblTitleCombinationQuantity.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  171. [vCombinationQuantity addSubview:lblTitleCombinationQuantity];
  172. UITextField *txtCombinatonQuantity = [UITextField new];
  173. txtCombinatonQuantity.frame=CGRectMake(CGRectGetMaxX(lblTitleCombinationQuantity.frame), valuey, Screen_Width-CGRectGetMaxX(lblTitleCombinationQuantity.frame), valueheight);
  174. txtCombinatonQuantity.delegate=self;
  175. txtCombinatonQuantity.placeholder=@"请输入组合数量";
  176. txtCombinatonQuantity.tag=1000;
  177. txtCombinatonQuantity.keyboardType = UIKeyboardTypeNumberPad;
  178. txtCombinatonQuantity.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  179. [vCombinationQuantity addSubview:txtCombinatonQuantity];
  180. txtCombinatonQuantity.text =goodsModel.combinationQuantity;
  181. [self.contentView addSubview:vCombinationQuantity];
  182. currentHeight=CGRectGetMaxY(vCombinationQuantity.frame);
  183. }
  184. else{
  185. currentHeight=CGRectGetMaxY(vOnlyCode.frame);
  186. _btnCheck.enabled=YES;
  187. }
  188. UIView *vGoodsQuantity = [UIView new];
  189. vGoodsQuantity.frame=CGRectMake(leftMargin,currentHeight+10, Screen_Width-leftMargin, heightRow);
  190. UILabel *lblTitleGoodsQuantity = [UILabel new];
  191. lblTitleGoodsQuantity.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  192. lblTitleGoodsQuantity.text = @"商品数量:";
  193. lblTitleGoodsQuantity.textColor = [UIColor redColor];
  194. lblTitleGoodsQuantity.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  195. [vGoodsQuantity addSubview:lblTitleGoodsQuantity];
  196. UITextField *txtGoodsQuantity = [UITextField new];
  197. txtGoodsQuantity.frame=CGRectMake(CGRectGetMaxX(lblTitleGoodsQuantity.frame), valuey, Screen_Width-CGRectGetMaxX(lblTitleGoodsQuantity.frame), valueheight);
  198. txtGoodsQuantity.delegate=self;
  199. txtGoodsQuantity.tag=1001;
  200. txtGoodsQuantity.placeholder=@"请输入商品数量";
  201. txtGoodsQuantity.keyboardType = UIKeyboardTypeNumberPad;
  202. txtGoodsQuantity.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  203. [vGoodsQuantity addSubview:txtGoodsQuantity];
  204. txtGoodsQuantity.text =goodsModel.salesQuantity;
  205. [self.contentView addSubview:vGoodsQuantity];
  206. UIView *vColorNumber = [UIView new];
  207. vColorNumber.frame=CGRectMake(leftMargin,CGRectGetMaxY(vGoodsQuantity.frame)+10, Screen_Width/3-leftMargin, heightRow);
  208. UILabel *lblTitleColorNumber = [UILabel new];
  209. lblTitleColorNumber.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  210. lblTitleColorNumber.text = @"色号:";
  211. lblTitleColorNumber.textColor = [UIColor lightGrayColor];
  212. lblTitleColorNumber.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  213. [vColorNumber addSubview:lblTitleColorNumber];
  214. UILabel *lblColorNumber = [UILabel new];
  215. lblColorNumber.frame=CGRectMake(CGRectGetMaxX(lblTitleColorNumber.frame), valuey, Screen_Width/3-CGRectGetMaxX(lblTitleColorNumber.frame), valueheight);
  216. lblColorNumber.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  217. [vColorNumber addSubview:lblColorNumber];
  218. lblColorNumber.text = goodsModel.colorNumber;
  219. [self.contentView addSubview:vColorNumber];
  220. UIView *vSpecification = [UIView new];
  221. vSpecification.frame=CGRectMake(Screen_Width/3,CGRectGetMaxY(vGoodsQuantity.frame)+10, Screen_Width/3, heightRow);
  222. UILabel *lblTitleSpecification = [UILabel new];
  223. lblTitleSpecification.frame=CGRectMake(0, lbly, lblwidth, lblheight);
  224. lblTitleSpecification.text = @"规格:";
  225. lblTitleSpecification.textColor = [UIColor lightGrayColor];
  226. lblTitleSpecification.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  227. [vSpecification addSubview:lblTitleSpecification];
  228. UILabel *lblSpecification = [UILabel new];
  229. lblSpecification.frame=CGRectMake(CGRectGetMaxX(lblTitleSpecification.frame), valuey, Screen_Width/3-CGRectGetWidth(lblTitleSpecification.frame), valueheight);
  230. lblSpecification.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  231. [vSpecification addSubview:lblSpecification];
  232. lblSpecification.text = goodsModel.specification;
  233. [self.contentView addSubview:vSpecification];
  234. UIView *vGrade = [UIView new];
  235. vGrade.frame=CGRectMake(Screen_Width/3*2,CGRectGetMaxY(vGoodsQuantity.frame)+10, Screen_Width/3, heightRow);
  236. UILabel *lblTitleGrade = [UILabel new];
  237. lblTitleGrade.frame=CGRectMake(0, lbly, lblwidth, lblheight);
  238. lblTitleGrade.text = @"等级:";
  239. lblTitleGrade.textColor = [UIColor lightGrayColor];
  240. lblTitleGrade.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  241. [vGrade addSubview:lblTitleGrade];
  242. UILabel *lblGrade = [UILabel new];
  243. lblGrade.frame=CGRectMake(CGRectGetMaxX(lblTitleGrade.frame), valuey, Screen_Width/3-CGRectGetWidth(lblTitleGrade.frame), valueheight);
  244. lblGrade.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  245. [vGrade addSubview:lblGrade];
  246. lblGrade.text = goodsModel.gradeName;
  247. [self.contentView addSubview:vGrade];
  248. UIView *vGiftFlag = [UIView new];
  249. vGiftFlag.frame=CGRectMake(leftMargin,CGRectGetMaxY(vColorNumber.frame)+10, Screen_Width/2-leftMargin, heightRow);
  250. UILabel *lblTitleGiftFlag = [UILabel new];
  251. lblTitleGiftFlag.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  252. lblTitleGiftFlag.text = @"赠品标识:";
  253. lblTitleGiftFlag.textColor = [UIColor lightGrayColor];
  254. lblTitleGiftFlag.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  255. [vGiftFlag addSubview:lblTitleGiftFlag];
  256. UILabel *lblGiftFlag = [UILabel new];
  257. lblGiftFlag.frame=CGRectMake(CGRectGetMaxX(lblTitleGiftFlag.frame), valuey, Screen_Width/2-CGRectGetMaxX(lblTitleGiftFlag.frame), valueheight);
  258. lblGiftFlag.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  259. [vGiftFlag addSubview:lblGiftFlag];
  260. BOOL giftFlag= goodsModel.giftFlag;
  261. NSString *giftFlagStr;
  262. if(giftFlag)
  263. {
  264. giftFlagStr=@"是";
  265. }
  266. else
  267. {
  268. giftFlagStr=@"否";
  269. }
  270. lblGiftFlag.text = giftFlagStr;
  271. [self.contentView addSubview:vGiftFlag];
  272. UIView *vWarehouseArea = [UIView new];
  273. vWarehouseArea.frame=CGRectMake(Screen_Width/2,CGRectGetMaxY(vColorNumber.frame)+10, Screen_Width/2, heightRow);
  274. UILabel *lblTitleWarehouseArea = [UILabel new];
  275. lblTitleWarehouseArea.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  276. lblTitleWarehouseArea.text = @"库区:";
  277. lblTitleWarehouseArea.textColor = [UIColor lightGrayColor];
  278. lblTitleWarehouseArea.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  279. [vWarehouseArea addSubview:lblTitleWarehouseArea];
  280. UILabel *lblWarehouseArea = [UILabel new];
  281. lblWarehouseArea.frame=CGRectMake(CGRectGetMaxX(lblTitleWarehouseArea.frame), valuey, Screen_Width/2-CGRectGetWidth(lblTitleWarehouseArea.frame), valueheight);
  282. lblWarehouseArea.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  283. [vWarehouseArea addSubview:lblWarehouseArea];
  284. lblWarehouseArea.text = goodsModel.wareHouseName;
  285. [self.contentView addSubview:vWarehouseArea];
  286. UIView *vKind = [UIView new];
  287. vKind.frame=CGRectMake(leftMargin,CGRectGetMaxY(vGiftFlag.frame)+10, Screen_Width/2-leftMargin, heightRow);
  288. UILabel *lblTitleKind = [UILabel new];
  289. lblTitleKind.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  290. lblTitleKind.text = @"种类:";
  291. lblTitleKind.textColor = [UIColor lightGrayColor];
  292. lblTitleKind.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  293. [vKind addSubview:lblTitleKind];
  294. UILabel *lblKind = [UILabel new];
  295. lblKind.frame=CGRectMake(CGRectGetMaxX(lblTitleKind.frame), valuey, Screen_Width/2-CGRectGetMaxX(lblTitleKind.frame), valueheight);
  296. lblKind.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  297. [vKind addSubview:lblKind];
  298. lblKind.text = goodsModel.kindName;
  299. [self.contentView addSubview:vKind];
  300. UIView *vSeries = [UIView new];
  301. vSeries.frame=CGRectMake(Screen_Width/2,CGRectGetMaxY(vGiftFlag.frame)+10, Screen_Width/2, heightRow);
  302. UILabel *lblTitleSeires = [UILabel new];
  303. lblTitleSeires.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  304. lblTitleSeires.text = @"系列:";
  305. lblTitleSeires.textColor = [UIColor lightGrayColor];
  306. lblTitleSeires.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  307. [vSeries addSubview:lblTitleSeires];
  308. UILabel *lblSeries = [UILabel new];
  309. lblSeries.frame=CGRectMake(CGRectGetMaxX(lblTitleSeires.frame), valuey, Screen_Width/2-CGRectGetWidth(lblTitleSeires.frame), valueheight);
  310. lblSeries.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  311. [vSeries addSubview:lblSeries];
  312. lblSeries.text = goodsModel.seriesName;
  313. [self.contentView addSubview:vSeries];
  314. UIView *vPromotionPrice = [UIView new];
  315. vPromotionPrice.frame=CGRectMake(leftMargin,CGRectGetMaxY(vKind.frame)+10, Screen_Width/2-leftMargin, heightRow);
  316. UILabel *lblTitlePromotionPrice = [UILabel new];
  317. lblTitlePromotionPrice.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  318. lblTitlePromotionPrice.text = @"促销价:";
  319. lblTitlePromotionPrice.textColor = [UIColor lightGrayColor];
  320. lblTitlePromotionPrice.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  321. [vPromotionPrice addSubview:lblTitlePromotionPrice];
  322. UILabel *lblPromotionPrice = [UILabel new];
  323. lblPromotionPrice.frame=CGRectMake(CGRectGetMaxX(lblTitlePromotionPrice.frame), valuey, Screen_Width/2-CGRectGetMaxX(lblTitlePromotionPrice.frame), valueheight);
  324. lblPromotionPrice.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  325. [vPromotionPrice addSubview:lblPromotionPrice];
  326. lblPromotionPrice.text = goodsModel.salesPrice;
  327. [self.contentView addSubview:vPromotionPrice];
  328. UIView *vMarkedPrice = [UIView new];
  329. vMarkedPrice.frame=CGRectMake(Screen_Width/2,CGRectGetMaxY(vKind.frame)+10, Screen_Width/2, heightRow);
  330. UILabel *lblTitleMarkedPrice= [UILabel new];
  331. lblTitleMarkedPrice.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  332. lblTitleMarkedPrice.text = @"标价:";
  333. lblTitleMarkedPrice.textColor = [UIColor lightGrayColor];
  334. lblTitleMarkedPrice.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  335. [vMarkedPrice addSubview:lblTitleMarkedPrice];
  336. UILabel *lblMarkedPrice = [UILabel new];
  337. lblMarkedPrice.frame=CGRectMake(CGRectGetMaxX(lblTitleMarkedPrice.frame), valuey, Screen_Width/2-CGRectGetWidth(lblTitleMarkedPrice.frame), valueheight);
  338. lblMarkedPrice.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  339. [vMarkedPrice addSubview:lblMarkedPrice];
  340. lblMarkedPrice.text = goodsModel.markedPrice;
  341. [self.contentView addSubview:vMarkedPrice];
  342. UIView *vInventoryQuantity = [UIView new];
  343. vInventoryQuantity.frame=CGRectMake(leftMargin,CGRectGetMaxY(vPromotionPrice.frame)+10, Screen_Width/2-leftMargin, heightRow);
  344. UILabel *lblTitleInventoryQuantity = [UILabel new];
  345. lblTitleInventoryQuantity.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  346. lblTitleInventoryQuantity.text = @"结存量:";
  347. lblTitleInventoryQuantity.textColor = [UIColor lightGrayColor];
  348. lblTitleInventoryQuantity.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  349. [vInventoryQuantity addSubview:lblTitleInventoryQuantity];
  350. UILabel *lblInventoryQuantity = [UILabel new];
  351. lblInventoryQuantity.frame=CGRectMake(CGRectGetMaxX(lblTitleInventoryQuantity.frame), valuey, Screen_Width/2-CGRectGetMaxX(lblTitleInventoryQuantity.frame), valueheight);
  352. lblInventoryQuantity.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  353. [vInventoryQuantity addSubview:lblInventoryQuantity];
  354. lblInventoryQuantity.text = goodsModel.inventoryQuantity;
  355. [self.contentView addSubview:vInventoryQuantity];
  356. UIView *vCanSalesQuantity = [UIView new];
  357. vCanSalesQuantity.frame=CGRectMake(Screen_Width/2,CGRectGetMaxY(vPromotionPrice.frame)+10, Screen_Width/2, heightRow);
  358. UILabel *lblTitleCanSalesQuantity= [UILabel new];
  359. lblTitleCanSalesQuantity.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  360. lblTitleCanSalesQuantity.text = @"可售量:";
  361. lblTitleCanSalesQuantity.textColor = [UIColor lightGrayColor];
  362. lblTitleCanSalesQuantity.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  363. [vCanSalesQuantity addSubview:lblTitleCanSalesQuantity];
  364. UILabel *lblCanSalesQuantity= [UILabel new];
  365. lblCanSalesQuantity.frame=CGRectMake(CGRectGetMaxX(lblTitleCanSalesQuantity.frame), valuey, Screen_Width/2-CGRectGetWidth(lblTitleCanSalesQuantity.frame), valueheight);
  366. lblCanSalesQuantity.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  367. [vCanSalesQuantity addSubview:lblCanSalesQuantity];
  368. lblCanSalesQuantity.text = goodsModel.canSaleQuantity;
  369. [self.contentView addSubview:vCanSalesQuantity];
  370. UIView *bottomSeparator= [UIView new];
  371. bottomSeparator.frame=CGRectMake(0, CGRectGetMaxY(vInventoryQuantity.frame), Screen_Width, 1);
  372. bottomSeparator.backgroundColor = LineBackgroundColor;
  373. [self.contentView addSubview:bottomSeparator];
  374. _height=CGRectGetMaxY(bottomSeparator.frame);
  375. if([promotionTypeId intValue]==2||[promotionTypeId intValue]==5)
  376. {
  377. _btnCheck.enabled=NO;
  378. txtGoodsQuantity.enabled=NO;
  379. if([promotionTypeId intValue]==5)
  380. {
  381. _btnOptionCombinationCheck.frame=CGRectMake(lblx,_height/2-25/2, 25, 25);
  382. }
  383. }
  384. else
  385. {
  386. _btnCheck.enabled=YES;
  387. txtGoodsQuantity.enabled=YES;
  388. if([promotionTypeId intValue]==3)
  389. {
  390. if(canChoose)
  391. {
  392. _btnCheck.enabled=YES;
  393. }
  394. else{
  395. _btnCheck.enabled=NO;
  396. }
  397. txtGoodsQuantity.enabled=NO;
  398. }
  399. }
  400. }
  401. /**
  402. textField失去焦点回调函数
  403. */
  404. - (void) textFieldDidEndEditing:(UITextField *) field
  405. {
  406. [self endEditing:YES];
  407. if(field.tag==1000){
  408. NSString *combinationQuantity=field.text;
  409. if([self.delegate respondsToSelector:@selector(combinationQuantityChanged:position:)])
  410. {
  411. [self.delegate combinationQuantityChanged:combinationQuantity position:_position];
  412. }
  413. }
  414. if(field.tag==1001)
  415. {
  416. NSString *goodsQuantity=field.text;
  417. if([self.delegate respondsToSelector:@selector(goodsQuantityChanged:position:)])
  418. {
  419. [self.delegate goodsQuantityChanged:goodsQuantity position:_position];
  420. }
  421. }
  422. }
  423. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  424. [super setSelected:selected animated:animated];
  425. }
  426. @end