Brak opisu

PindanDetailViewModel.m 19KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613
  1. //
  2. // PdDetailViewModel.m
  3. // FirstLink
  4. //
  5. // Created by 王孝道 on 15/6/8.
  6. // Copyright (c) 2015年 FirstLink. All rights reserved.
  7. //
  8. #import "PindanDetailViewModel.h"
  9. #import "ProductShowItem.h"
  10. #import "PdCommentCell.h"
  11. #import "DetailTalkCell.h"
  12. #import "PdProductShowCell.h"
  13. #import "DetailMainImgCell.h"
  14. #import "DetailPriceExplainCell.h"
  15. #import "DetailTransitHeaderCell.h"
  16. #import "DetailTransitCommonCell.h"
  17. #import "DetailAuthorityCell.h"
  18. #import "DetailProductHeaderCell.h"
  19. #import "DetailFeatureCell.h"
  20. #import "DetailSourceCell.h"
  21. #import "DetailCommentHeadCell.h"
  22. #import "DetailNoCommentCell.h"
  23. #import "DetailMoreCommentCell.h"
  24. #import "FKDetailRequest.h"
  25. @implementation PindanDetailViewModel
  26. - (instancetype)init {
  27. self = [super init];
  28. if (self) {
  29. _showPriceExplain = NO;
  30. }
  31. return self;
  32. }
  33. #pragma mark - Make Request Info
  34. - (NSDictionary *)infoForRequestType:(kRequestType)type withInfo:(NSDictionary *)dict{
  35. switch (type) {
  36. case kRequestTypeDetail:
  37. case kRequestTypeRefreshComment:
  38. case kRequestTypeRefreshCommentScroll:
  39. case kRequestTypeAddCollect:
  40. case kRequestTypeRemoveCollect:
  41. case kRequestTypeAddLike:
  42. case kRequestTypeRemoveLike:
  43. case kRequestTypeShareUrlCircle:
  44. case kRequestTypeShareUrlFriend:
  45. return [self commonInfoForRequest];
  46. case kRequestTypeAddSelfComment:{
  47. NSMutableDictionary *dictM = [NSMutableDictionary dictionaryWithDictionary:[self commonInfoForRequest]];
  48. [dictM addEntriesFromDictionary:dict];
  49. return dictM;
  50. }
  51. case kRequestTypeAddOtherComment:{
  52. NSMutableDictionary *dictM = [NSMutableDictionary dictionaryWithDictionary:[self commonInfoForRequest]];
  53. [dictM addEntriesFromDictionary:dict];
  54. return dictM;
  55. }
  56. case kRequestTypeRemoveComment:
  57. return dict;
  58. default:
  59. return nil;
  60. break;
  61. }
  62. }
  63. - (NSDictionary *)commonInfoForRequest{
  64. if (self.postID.length > 0 && self.userID.length > 0) {
  65. return @{DETAIL_POSTID_KEY : self.postID, DETAIL_USERID_KEY : self.userID};
  66. }
  67. return nil;
  68. }
  69. #pragma mark - Store Data
  70. - (void)saveIntoDataSource:(PindanDetailItem *)item {
  71. _pindanDetailItem = item;
  72. }
  73. - (PindanDetailItem *)pindanDetailItem {
  74. return _pindanDetailItem;
  75. }
  76. - (CGFloat)cellHeightForIndexPath:(NSIndexPath *)indexPath
  77. {
  78. kDetailCellType cellType = [self cellTypeForIndexPath:indexPath];
  79. switch (cellType) {
  80. case kDetailCellTypeMainImg:
  81. return UISCREENWIDTH;
  82. case kDetailCellTypePriceExplain:
  83. if (self.showPriceExplain) return 107;
  84. return 77;
  85. case kDetailCellTypeAuthority:
  86. return 23;
  87. case kDetailCellTypeTalk:
  88. return [DetailTalkCell cellHeightForTitleText:[self pindanDetailItem].introduceText];
  89. case kDetailCellTypeProductHeader:
  90. return 55;
  91. case kDetailCellTypeProductShow:{
  92. ProductShowItem *showItem = [[self pindanDetailItem] showItemAtIndex:indexPath.row - 1];
  93. CGFloat imgHeight = 0;
  94. if (showItem) imgHeight = [showItem realImgSize].height;
  95. CGFloat reslut =[PdProductShowCell cellHeightForText:showItem.describString withImgHeight:imgHeight];
  96. return reslut;
  97. }
  98. case kDetailCellTypeFeature:
  99. return 140;
  100. case kDetailCellTypePriceDetailHeader:
  101. case kDetailCellTypeTransitHeader:
  102. return 45;
  103. case kDetailCellTypeNationalPrice:
  104. case kDetailCellTypeNationalPostage:
  105. case kDetailCellTypeCountryInPrice:
  106. case kDetailCellTypeTransitSource:
  107. case kDetailCellTypeTransitLink:
  108. case kDetailCellTypeTransitTime:
  109. case kDetailCellTypeSpecGuige:
  110. case kDetailCellTypeSpecComment:
  111. return 40;
  112. case kDetailCellTypeComment:{
  113. CommentItem *model = [self pindanDetailItem].commentModelArray[indexPath.row - 1];
  114. if (model){
  115. return [PdCommentCell cellHeightForCommentText:model.content];
  116. }
  117. return 40;
  118. }
  119. case kDetailCellTypeMoreComment:
  120. return 88;
  121. case kDetailCellTypeNoComment:
  122. return 200;
  123. default:
  124. break;
  125. }
  126. return 0;
  127. }
  128. - (NSInteger)numberOfRowsInSection:(NSInteger)section {
  129. if (section == 0) return [self showAuthority] ? 3 : 2;
  130. if (section == 1) return 1;
  131. if (section == 2) return ([self pindanDetailItem].productShowArray.count + 2); // 加个header 和 source
  132. if (section == 3) return 8;
  133. if (section == 4 && [self hasSpecs]) return 1;
  134. if (section == 5 - ([self hasSpecs] ? 0 : 1)) {
  135. if ([self pindanDetailItem].commentModelArray.count == 0) return 2;
  136. return [self pindanDetailItem].commentModelArray.count + ([[self pindanDetailItem] hasMoreComment] ? 2 : 1);
  137. }
  138. return 0;
  139. }
  140. - (NSString *)cellIdentifyForIndexPath:(NSIndexPath *)indexPath{
  141. kDetailCellType cellType = [self cellTypeForIndexPath:indexPath];
  142. NSString *identifyStr = nil;
  143. switch (cellType) {
  144. case kDetailCellTypeMainImg:
  145. identifyStr = NSStringFromClass([DetailMainImgCell class]);
  146. break;
  147. case kDetailCellTypePriceExplain:
  148. identifyStr = NSStringFromClass([DetailPriceExplainCell class]);
  149. break;
  150. case kDetailCellTypeAuthority:
  151. identifyStr = NSStringFromClass([DetailAuthorityCell class]);
  152. break;
  153. case kDetailCellTypeTalk:
  154. identifyStr = NSStringFromClass([DetailTalkCell class]);
  155. break;
  156. case kDetailCellTypeProductHeader:
  157. identifyStr = NSStringFromClass([DetailProductHeaderCell class]);
  158. break;
  159. case kDetailCellTypeProductShow:
  160. identifyStr = NSStringFromClass([PdProductShowCell class]);
  161. break;
  162. case kDetailCellTypeFeature:
  163. identifyStr = NSStringFromClass([DetailFeatureCell class]);
  164. break;
  165. case kDetailCellTypePriceDetailHeader:
  166. case kDetailCellTypeTransitHeader:
  167. identifyStr = NSStringFromClass([DetailTransitHeaderCell class]);
  168. break;
  169. case kDetailCellTypeTransitLink:
  170. case kDetailCellTypeSpecGuige:
  171. identifyStr = NSStringFromClass([DetailSourceCell class]);
  172. break;
  173. case kDetailCellTypeNationalPrice:
  174. case kDetailCellTypeNationalPostage:
  175. case kDetailCellTypeCountryInPrice:
  176. case kDetailCellTypeTransitSource:
  177. case kDetailCellTypeTransitTime:
  178. identifyStr = NSStringFromClass([DetailTransitCommonCell class]);
  179. break;
  180. case kDetailCellTypeSpecComment:
  181. identifyStr = NSStringFromClass([DetailCommentHeadCell class]);
  182. break;
  183. case kDetailCellTypeComment:
  184. identifyStr = NSStringFromClass([PdCommentCell class]);
  185. break;
  186. case kDetailCellTypeNoComment:
  187. identifyStr = NSStringFromClass([DetailNoCommentCell class]);
  188. break;
  189. case kDetailCellTypeMoreComment:
  190. identifyStr = NSStringFromClass([DetailMoreCommentCell class]);
  191. break;
  192. default:
  193. break;
  194. }
  195. return identifyStr;
  196. }
  197. - (kDetailCellType)cellTypeForIndexPath:(NSIndexPath *)indexPath {
  198. if (indexPath.section == 0) {
  199. if (indexPath.row == 0) return kDetailCellTypeMainImg;
  200. if (indexPath.row == 1 && [self showAuthority]) return kDetailCellTypeAuthority;
  201. return kDetailCellTypePriceExplain;
  202. } else if (indexPath.section == 1){
  203. return kDetailCellTypeTalk;
  204. } else if (indexPath.section == 2){
  205. if (indexPath.row == 0) return kDetailCellTypeProductHeader;
  206. if (indexPath.row == [self pindanDetailItem].productShowArray.count + 1) return kDetailCellTypeFeature; // 最后一行
  207. return kDetailCellTypeProductShow;
  208. } else if (indexPath.section == 3){
  209. if (indexPath.row == 0) return kDetailCellTypePriceDetailHeader;
  210. if (indexPath.row == 1) return kDetailCellTypeNationalPrice;
  211. if (indexPath.row == 2) return kDetailCellTypeNationalPostage;
  212. if (indexPath.row == 3) return kDetailCellTypeCountryInPrice;
  213. if (indexPath.row == 4) return kDetailCellTypeTransitHeader;
  214. if (indexPath.row == 5) return kDetailCellTypeTransitSource;
  215. if (indexPath.row == 6) return kDetailCellTypeTransitLink;
  216. if (indexPath.row == 7) return kDetailCellTypeTransitTime;
  217. } else if (indexPath.section == 4 && [self hasSpecs]){
  218. return kDetailCellTypeSpecGuige;
  219. } else if (indexPath.section == 5 - ([self hasSpecs] ? 0 : 1)){
  220. NSInteger rowCount = [self numberOfRowsInSection:indexPath.section];
  221. if (indexPath.row == 0) return kDetailCellTypeSpecComment;
  222. if (indexPath.row == rowCount - 1 && [self pindanDetailItem].commentModelArray.count == 0) return kDetailCellTypeNoComment; // 没有评论提示
  223. if (indexPath.row == rowCount - 1 && [[self pindanDetailItem] hasMoreComment]) return kDetailCellTypeMoreComment;
  224. if (indexPath.row > 0) return kDetailCellTypeComment;
  225. }
  226. return kDetailCellTypeUnknown;
  227. }
  228. - (CGFloat)translateImgSizeToHeight:(CGSize)size
  229. {
  230. if (size.width == 0 || size.height == 0) return UISCREENWIDTH * 7 / 9;
  231. return UISCREENWIDTH * size.height / size.width;
  232. }
  233. - (BOOL)isCommentBySelfForRow:(NSInteger)row
  234. {
  235. CommentItem *commentItem = [self commentModelForIndex:row];
  236. if (commentItem) {
  237. if ([commentItem.buyerID isEqualToString:[FKUserManager sharedManager].user.userID]) return YES;
  238. }
  239. return NO;
  240. }
  241. - (NSString *)getCommentPlaceHolderWithIndex:(NSInteger)index
  242. {
  243. if (index < 0) return @"";
  244. if (![self isCommentBySelfForRow:index]){
  245. CommentItem *commentItem = [self commentModelForIndex:index];
  246. return [NSString stringWithFormat:@"回复 %@", commentItem.buyerNickName];
  247. }
  248. return @"";
  249. }
  250. - (CommentItem *)commentModelForIndex:(NSInteger)index
  251. {
  252. if (index >= [self pindanDetailItem].commentModelArray.count || index < 0) {
  253. return nil;
  254. }
  255. return [self pindanDetailItem].commentModelArray[index];
  256. }
  257. - (BOOL)showAuthority {
  258. return ([self pindanDetailItem].authorityItem.onlyVIP
  259. || [self pindanDetailItem].authorityItem.onlyNew
  260. || [self pindanDetailItem].isPostageFree);
  261. }
  262. - (BOOL)hasSpecs {
  263. // 是否有规格
  264. if ([self pindanDetailItem].specsArray
  265. && [self pindanDetailItem].specsArray.count > 0) {
  266. return YES;
  267. }
  268. return NO;
  269. }
  270. - (CommentItem *)commentItemForIndex:(NSInteger)index{
  271. if (index >= 0 && index < [self pindanDetailItem].commentModelArray.count) {
  272. return [self pindanDetailItem].commentModelArray[index];
  273. }
  274. return nil;
  275. }
  276. - (BOOL)isProductStateEnd {
  277. BOOL timeOut = [self pindanDetailItem].timeInterval <= 0;
  278. BOOL isBegin = [self pindanDetailItem].isPindanBegin;
  279. BOOL isNormal = [self pindanDetailItem].productState == kProductStateNormal;
  280. if ((timeOut && isBegin) || !isNormal){
  281. return YES;
  282. }
  283. return NO;
  284. }
  285. - (BOOL)isProductStateSaleDone{
  286. NSString *stock = [self pindanDetailItem].stock;
  287. BOOL stockEmpty = NO; // 库存是否为0
  288. if ([stock isKindOfClass:[NSString class]] && stock.integerValue == 0) stockEmpty = YES;
  289. if (stockEmpty && [self pindanDetailItem].productState == kProductStateNormal) return YES;
  290. return NO;
  291. }
  292. - (NSInteger)numberOfSectionsInTableView {
  293. if (![self pindanDetailItem].priceDetailItem) return 0; // 还未加载数据
  294. NSInteger section = 6;
  295. if (![self hasSpecs]) section = 5;
  296. return section;
  297. }
  298. - (NSIndexPath *)lastIndexPath
  299. {
  300. NSInteger rows = [self numberOfRowsInSection:([self numberOfSectionsInTableView] - 1)];
  301. if (rows >= 1) return [NSIndexPath indexPathForRow:rows - 1 inSection:([self numberOfSectionsInTableView] - 1)];
  302. return [NSIndexPath indexPathForRow:0 inSection:([self numberOfSectionsInTableView] - 1)];
  303. }
  304. #pragma mark - Purchase Cache
  305. - (FKPurchaseCache *)saveDataIntoCache:(FKPurchaseCache *)cache orderType:(kOrderType)orderType {
  306. cache.postID = self.postID;
  307. cache.userID = self.userID;
  308. cache.descString = self.title;
  309. cache.limiteAmount = self.limiteNum;
  310. cache.postageState = [self pindanDetailItem].postageFreeState;
  311. cache.unitWeight = [self pindanDetailItem].priceDetailItem.singleWeight;
  312. cache.internationalPostage = [self pindanDetailItem].priceDetailItem.international_postage;
  313. cache.orderType = orderType;
  314. cache.userLevel = self.userLevel;
  315. cache.isPindanNeedIDCard = [self isNeedIDCard];
  316. // 解析规格
  317. NSMutableArray *selectedSpecArray = [NSMutableArray array];
  318. if (self.specsArray && self.specsArray.count > 0) {
  319. for (PindanSpecItem *item in self.specsArray) {
  320. if (item.selectedAmount > 0) {
  321. [selectedSpecArray addObject:item];
  322. }
  323. }
  324. } else {
  325. // 没有子类规格
  326. PindanSpecItem *noSpeItem = [[PindanSpecItem alloc]init];
  327. noSpeItem.postID = self.postID;
  328. noSpeItem.userID = self.userID;
  329. if (kOrderTypeGroup == orderType) {
  330. noSpeItem.price = [self pindanDetailItem].priceDetailItem.group_price;
  331. } else {
  332. noSpeItem.price = [self pindanDetailItem].priceDetailItem.estimate_price;
  333. if (self.userLevel == kUserLevelVIP
  334. && [self pindanDetailItem].priceDetailItem.vip_price.length > 0) {
  335. noSpeItem.vipPrice = [self pindanDetailItem].priceDetailItem.vip_price;
  336. }
  337. }
  338. noSpeItem.imgUrl = self.firstPic;
  339. noSpeItem.selectedAmount = 1;
  340. [selectedSpecArray addObject:noSpeItem];
  341. }
  342. cache.specArray = selectedSpecArray;
  343. return cache;
  344. }
  345. #pragma mark Setter & Getter
  346. - (void)setIsFavorite:(BOOL)favorite {
  347. [self pindanDetailItem].isFavorite = favorite;
  348. }
  349. - (BOOL)isFavorite {
  350. return [self pindanDetailItem].isFavorite;
  351. }
  352. - (void)setShareURL:(NSString *)shareURL {
  353. [self pindanDetailItem].shareUrl = shareURL;
  354. }
  355. - (NSString *)shareURL {
  356. return [self pindanDetailItem].shareUrl;
  357. }
  358. - (void)setCommentArray:(NSArray *)commentArray {
  359. [self pindanDetailItem].commentModelArray = commentArray;
  360. }
  361. - (NSArray *)commentArray {
  362. return [self pindanDetailItem].commentModelArray;
  363. }
  364. - (void)setCommentCount:(NSString *)count {
  365. [self pindanDetailItem].commentCount = count;
  366. }
  367. - (NSString *)commentCount {
  368. return [self pindanDetailItem].commentCount;
  369. }
  370. - (NSInteger)orderCount {
  371. return [self pindanDetailItem].orderCount;
  372. }
  373. - (NSInteger)userOrderCount {
  374. return [self pindanDetailItem].userOrderCount;
  375. }
  376. - (NSString *)title {
  377. return [self pindanDetailItem].title;
  378. }
  379. - (NSString *)firstPic {
  380. return [self pindanDetailItem].firstPic;
  381. }
  382. - (kUserLevel)userLevel {
  383. return [self pindanDetailItem].userLevel;
  384. }
  385. - (NSString *)webURL {
  386. return [self pindanDetailItem].webURL;
  387. }
  388. - (NSAttributedString *)totalPriceAttributedString {
  389. return [self pindanDetailItem].priceDetailItem.totalPriceAttString;
  390. }
  391. - (NSString *)totalPrice {
  392. return [self pindanDetailItem].priceDetailItem.totalPrice;
  393. }
  394. - (NSString *)referPrice {
  395. return [self pindanDetailItem].priceDetailItem.refer_price;
  396. }
  397. - (NSString *)vipPrice {
  398. return [self pindanDetailItem].priceDetailItem.vipPrice;
  399. }
  400. - (NSString *)estimatePrice {
  401. return [self pindanDetailItem].priceDetailItem.estimate_price;
  402. }
  403. - (NSString *)internationalPostage {
  404. NSString *postage = [self pindanDetailItem].priceDetailItem.international_postage;
  405. if ([postage isKindOfClass:[NSString class]]) {
  406. return postage;
  407. }
  408. return @"-.--";
  409. }
  410. - (NSTimeInterval)timeInterval {
  411. return [self pindanDetailItem].timeInterval;
  412. }
  413. - (void)setTimeInterval:(NSTimeInterval)time {
  414. [self pindanDetailItem].timeInterval = time;
  415. }
  416. - (BOOL)isPostageFree {
  417. return [self pindanDetailItem].isPostageFree;
  418. }
  419. - (BOOL)isOnlyVIP {
  420. return [self pindanDetailItem].authorityItem.onlyVIP;
  421. }
  422. - (BOOL)isOnlyNew {
  423. return [self pindanDetailItem].authorityItem.onlyNew;
  424. }
  425. - (NSString *)nickname {
  426. return [self pindanDetailItem].nickname;
  427. }
  428. - (NSString *)introduceText {
  429. return [self pindanDetailItem].introduceText;
  430. }
  431. - (NSString *)headURL {
  432. return [self pindanDetailItem].headURL;
  433. }
  434. - (NSString *)serviceUserID {
  435. return [self pindanDetailItem].serveUserItem.userId;
  436. }
  437. - (NSString *)serviceNickname {
  438. return [self pindanDetailItem].serveUserItem.nickName;
  439. }
  440. - (NSString *)serviceHeadURL {
  441. return [self pindanDetailItem].serveUserItem.headerPic;
  442. }
  443. - (NSArray *)specsArray {
  444. return [self pindanDetailItem].specsArray;
  445. }
  446. - (NSInteger)limiteNum {
  447. return [self pindanDetailItem].limiteNum;
  448. }
  449. - (NSString *)firstSpecImgURL {
  450. return [[self pindanDetailItem] getFirstImgUrl];
  451. }
  452. - (NSArray *)productShowArray {
  453. return [self pindanDetailItem].productShowArray;
  454. }
  455. - (NSArray *)allProductIMGURLArray {
  456. return [self pindanDetailItem].allProductImgUrlArray;
  457. }
  458. - (ProductShowItem *)showItemAtIndex:(int)index {
  459. return [[self pindanDetailItem] showItemAtIndex:index];
  460. }
  461. - (NSString *)buyChannel {
  462. return [self pindanDetailItem].priceDetailItem.buyChannel;
  463. }
  464. - (NSString *)source {
  465. return [self pindanDetailItem].priceDetailItem.source;
  466. }
  467. - (NSString *)arrivalTime {
  468. return [self pindanDetailItem].priceDetailItem.arrival_time;
  469. }
  470. - (BOOL)isRemind {
  471. if ([[self pindanDetailItem].isLike isKindOfClass:[NSString class]]) {
  472. return [self pindanDetailItem].isLike.boolValue;
  473. }
  474. return NO;
  475. }
  476. - (BOOL)isVIP {
  477. if ([self pindanDetailItem].userLevel == kUserLevelVIP) {
  478. return YES;
  479. }
  480. return NO;
  481. }
  482. - (BOOL)isNeedIDCard {
  483. return [self pindanDetailItem].isNeedIDCard;
  484. }
  485. - (BOOL)isHasShowIDCardAlert {
  486. NSString *ret = [[UserDefaultManager sharedManager] getUserDefaultObject:ID_CARD_ALERT_SHOW_KEY];
  487. if (ret && [ret isEqualToString:@"1"]) {
  488. return YES;
  489. }
  490. return NO;
  491. }
  492. - (void)setHasShowIDCardAlert {
  493. [[UserDefaultManager sharedManager] setUserDefaultObject:@"1" key:ID_CARD_ALERT_SHOW_KEY];
  494. }
  495. - (kPindanState)pindanState {
  496. kPindanState pindanState = kPindanStateNormal;
  497. if (!self.pindanDetailItem.isPindanBegin) {
  498. pindanState = kPindanStateWaitBegin;
  499. }else if ([self isProductStateEnd] || [self isProductStateSaleDone]){
  500. pindanState = [self isRemind] ? kPindanStateCancelRemind : kPindanStateRemind;
  501. } else {
  502. if ([self pindanDetailItem].authorityItem.onlyNew == YES && [self pindanDetailItem].userOrderCount > 0) {
  503. pindanState = kPindanStateOnlyNew;
  504. }
  505. if ([self pindanDetailItem].authorityItem.onlyVIP == YES && [self pindanDetailItem].userLevel != kUserLevelVIP) {
  506. pindanState = kPindanStateOnlyVIP;
  507. }
  508. }
  509. return pindanState;
  510. }
  511. - (ProductState)productState {
  512. ProductState state = ProductStateNormal;
  513. if ([self isProductStateEnd]) {
  514. state = ProductStateOver;
  515. } else if ([self isProductStateSaleDone]){
  516. state = ProductStateSaleDone;
  517. }
  518. return state;
  519. }
  520. //- (SubmitOrderItem *)submitModelWithSpecArray:(NSArray *)specArray orderType:(kOrderType)orderType {
  521. // return [[self pindanDetailItem] submitModelWithSpecArray:specArray orderType:orderType];
  522. //}
  523. @end