Commit 2691c8bf authored by 勾芒's avatar 勾芒

debug

parent 0bac9789
......@@ -276,30 +276,29 @@
ConsumerQueryCondition *searchCustomer = [[ConsumerQueryCondition alloc]init];
DataPage *page = [[DataPage alloc]init];
page.page = 1;
page.rows = 10;
page.rows = 99999;
searchCustomer.page = page;
//比较两个NSDate的大小
switch (result) {
case -1://start < end
{
[formater setDateFormat:@"yyyy-MM-dd HH:dd:ss"];
searchCustomer.createTimeBegin = [formater stringFromDate:date];
searchCustomer.createTimeEnd = [formater stringFromDate:date1];
searchCustomer.createTimeBegin = [formater stringFromDate:[self ReturnZeroTime:date]];
searchCustomer.createTimeEnd = [formater stringFromDate:[self ReturnZeroTime:date1]];
}
break;
case 0://start == end
{
[formater setDateFormat:@"yyyy-MM-dd HH:dd:ss"];
searchCustomer.createTimeBegin = [formater stringFromDate:date];
searchCustomer.createTimeEnd = [formater stringFromDate:date1];
searchCustomer.createTimeBegin = [formater stringFromDate:[self ReturnZeroTime:date]];
searchCustomer.createTimeEnd = [formater stringFromDate:[self ReturnZeroTime:date1]];
}
break;
case 1://start > end
{
[formater setDateFormat:@"yyyy-MM-dd HH:dd:ss"];
searchCustomer.createTimeBegin = [formater stringFromDate:date1];
searchCustomer.createTimeEnd = [formater stringFromDate:date];
searchCustomer.createTimeBegin = [formater stringFromDate:[self ReturnZeroTime:date1]];
searchCustomer.createTimeEnd = [formater stringFromDate:[self ReturnZeroTime:date]];
}
break;
......@@ -311,6 +310,19 @@
}
#pragma mark -返回某天零时的时间
- (NSDate *)ReturnZeroTime:(NSDate *)date
{
NSCalendar *calendar = [NSCalendar currentCalendar];
NSDateComponents *components = [calendar components:NSUIntegerMax fromDate:date];
components.hour = 8;
components.minute = 0;
components.second = 0;
NSTimeInterval ts = (double)(int)[[calendar dateFromComponents:components] timeIntervalSince1970];
return [NSDate dateWithTimeIntervalSince1970:ts];
}
#pragma mark -比较两个NSDate的大小
- (int)compareOneDay:(NSDate *)oneDay withAnotherDay:(NSDate *)anotherDay
{
......
......@@ -23,14 +23,14 @@
_goodsAllprice = goodsAllprice;
NSUInteger allNumber = 0;
NSInteger allPrice = 0;
CGFloat allPrice = 0;
for (ShopcarModel *model in _goodsAllprice) {
allNumber += model.goodsNum;
allPrice += [model.goods.costPrice integerValue] *model.goodsNum;
allPrice += [model.goods.costPrice floatValue] *model.goodsNum;
}
self.goodsAllNumber.text = [NSString stringWithFormat:@"%ld",allNumber];
self.goodsAllPrice.text = [NSString stringWithFormat:@"%ld",allPrice];
self.goodsAllPrice.text = [NSString stringWithFormat:@"¥%.2f",allPrice];
}
......@@ -43,15 +43,15 @@
_goodsArray = goodsArray;
NSInteger allNumber = 0;//总数量
NSInteger allPrice = 0;//总价格
CGFloat allPrice = 0;//总价格
for (TOOrderdetailEntity *model in _goodsArray) {
allNumber += [model.goodsNum integerValue];
allPrice += [model.goodsPrice integerValue]*[model.goodsNum intValue];
allPrice += [model.goodsPrice floatValue]*[model.goodsNum intValue];
}
self.goodsAllNumber.text = [NSString stringWithFormat:@"%ld",allNumber];
self.goodsAllPrice.text = [NSString stringWithFormat:@"¥%ld",allPrice];
self.goodsAllPrice.text = [NSString stringWithFormat:@"¥%.2f",allPrice];
}
......
......@@ -63,40 +63,6 @@
if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
self.navigationController.interactivePopGestureRecognizer.enabled = NO;
}
//下拉刷新
MjRefreshHeaderCustom *headerRefresh = [MjRefreshHeaderCustom headerWithRefreshingBlock:^{
ConsumerQueryCondition *condition = [[ConsumerQueryCondition alloc]init];
condition.resellerCodeEquals = [[Shoppersmanager manager].Shoppers.employee.currentDepart orgCode];
DataPage *page = [[DataPage alloc]init];
page.page = 1;
condition.page = page;
page.rows = 10;
self.indexPage = 1;
[self.informationTableview.mj_footer resetNoMoreData];
[self getShoppersAssociatedCustomer:condition isRemoveArray:YES];
}];
headerRefresh.stateLabel.hidden = YES;
headerRefresh.lastUpdatedTimeLabel.hidden = YES;
self.informationTableview.mj_header =headerRefresh;
//进入刷新状态
[self.informationTableview.mj_header beginRefreshing];
//上拉加载
self.informationTableview.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
if (self.indexPage ++ > self.totalPages) {
[self.informationTableview.mj_footer endRefreshingWithNoMoreData];
}else
{
ConsumerQueryCondition *condition = [[ConsumerQueryCondition alloc]init];
DataPage *page = [[DataPage alloc]init];
page.page = self.indexPage ++;
page.rows = 10;
condition.page = page;
[self getShoppersAssociatedCustomer:condition isRemoveArray:NO];
}
}];
}
- (void)viewWillDisappear:(BOOL)animated
......@@ -137,6 +103,42 @@
self.searchPersonInformationField.delegate = self;
//监听键盘落下的通知
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(KeyboadrDismiss) name:UIKeyboardWillHideNotification object:nil];
//下拉刷新
MjRefreshHeaderCustom *headerRefresh = [MjRefreshHeaderCustom headerWithRefreshingBlock:^{
ConsumerQueryCondition *condition = [[ConsumerQueryCondition alloc]init];
condition.resellerCodeEquals = [[Shoppersmanager manager].Shoppers.employee.currentDepart orgCode];
DataPage *page = [[DataPage alloc]init];
page.page = 1;
condition.page = page;
page.rows = 10;
self.indexPage = 1;
[self.informationTableview.mj_footer resetNoMoreData];
[self getShoppersAssociatedCustomer:condition isRemoveArray:YES];
}];
headerRefresh.stateLabel.hidden = YES;
headerRefresh.lastUpdatedTimeLabel.hidden = YES;
self.informationTableview.mj_header =headerRefresh;
//进入刷新状态
[self.informationTableview.mj_header beginRefreshing];
//上拉加载
self.informationTableview.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
if (self.indexPage ++ > self.totalPages) {
[self.informationTableview.mj_footer endRefreshingWithNoMoreData];
}else
{
ConsumerQueryCondition *condition = [[ConsumerQueryCondition alloc]init];
DataPage *page = [[DataPage alloc]init];
page.page = self.indexPage ++;
page.rows = 10;
condition.page = page;
[self getShoppersAssociatedCustomer:condition isRemoveArray:NO];
}
}];
}
......
......@@ -165,7 +165,6 @@
{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"StoryboardwithCYX" bundle:nil];
OrderdetailsViewController *orderdetails = [storyboard instantiateViewControllerWithIdentifier:@"orderdetails"];
TOOrderEntity *model = [[self.orderRecordArray objectAtIndex_opple:indexPath.row] order];
orderdetails.orderCode = model.orderNumber;
orderdetails.sectionTitle = @[@"订单信息",@"客户信息",@"收货信息",@"商品信息",@"附件信息"];
......
......@@ -47,6 +47,15 @@
* 订单详情商品数据源
*/
@property (nonatomic,strong) TOOrderdetailEntity *orderDetailslist;
/**
* 规格
*/
@property (weak, nonatomic) IBOutlet UILabel *specifications;
@end
......@@ -19,15 +19,16 @@
- (void)setModel:(ShopcarModel *)model
{
_model = model;
[self.goodsHeader sd_setImageWithURL:[NSURL URLWithString:_model.goods.pictures] placeholderImage:ReplaceImage];
[self.goodsHeader sd_setImageWithURL:[NSURL URLWithString:_model.goods.pictures] placeholderImage:REPLACEIMAGE];
self.goodsName.text = _model.goods.name;
self.goodsNumber.text = [NSString stringWithFormat:@"数量 X%d",_model.goodsNum];
self.clinchPrice.text = [NSString stringWithFormat:@"成交价 ¥%@",[_model.goods.costPrice stringValue]];
self.specifications.text = [NSString stringWithFormat:@"%@(%@)",_model.goods.productProfile,_model.goods.spec];
self.goodsNumber.text = [NSString stringWithFormat:@"数量 X%d",_model.goodsNum];
self.clinchPrice.text = [NSString stringWithFormat:@"成交价 ¥%.2f",[_model.goods.costPrice floatValue]];
//计算总价格
NSInteger number = _model.goodsNum;
NSInteger price = [_model.goods.costPrice integerValue];
NSInteger allPrice = number*price;
self.totalPrice.text = [NSString stringWithFormat:@"%ld",allPrice];
CGFloat price = [_model.goods.costPrice floatValue];
CGFloat allPrice = number*price;
self.totalPrice.text = [NSString stringWithFormat:@"¥%.2f",allPrice];
}
......@@ -38,10 +39,10 @@
_orderDetailslist = orderDetailslist;
[self.goodsHeader sd_setImageWithURL:[NSURL URLWithString:_orderDetailslist.goodsBrand] placeholderImage:ReplaceImage];
self.goodsNumber.text = [NSString stringWithFormat:@"数量 X%@",_orderDetailslist.goodsNum];
self.clinchPrice.text = [NSString stringWithFormat:@"成交价 ¥%@",[_orderDetailslist.goodsPrice stringValue]];
self.clinchPrice.text = [NSString stringWithFormat:@"成交价 ¥%.2f",[_orderDetailslist.goodsPrice floatValue]];
//小计
NSInteger totalPrice = [_orderDetailslist.goodsNum integerValue] * [_orderDetailslist.goodsPrice integerValue];
self.totalPrice.text = [NSString stringWithFormat:@"¥%ld",totalPrice];
CGFloat totalPrice = [_orderDetailslist.goodsNum integerValue] * [_orderDetailslist.goodsPrice floatValue];
self.totalPrice.text = [NSString stringWithFormat:@"¥%.2f",totalPrice];
self.goodsName.text = _orderDetailslist.goodsSpec;
......
......@@ -29,9 +29,10 @@
[self.consigneeNumber mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.orderAll.mas_left).offset(13);
make.right.equalTo(self.orderAll.mas_right).offset(14);
make.top.equalTo(self.orderAll.mas_bottom).offset(10);
}];
}
#pragma mark -赋值
......
......@@ -334,30 +334,41 @@
*/
- (void)undoOrderButtonClick:(NSInteger)cellindex
{
__weak typeof(self) weakSelf = self;
UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:@"提示" message:@"请确认是否撤销订单" preferredStyle:UIAlertControllerStyleAlert];
[alertVC addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
[weakSelf dismissViewControllerAnimated:YES completion:nil];
}]];
[self CreateMBProgressHUDLoding];
OrderBill *model = [self.datasArray objectAtIndex_opple:cellindex];
[alertVC addAction:[UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
[weakSelf CreateMBProgressHUDLoding];
OrderBill *model = [weakSelf.datasArray objectAtIndex_opple:cellindex];
[[NetworkRequestClassManager Manager] NetworkWithDictionaryRequestWithURL:[NSString stringWithFormat:@"%@%@%@/%@/%@",ServerAddress,@"/order/updateOrderState/",model.order.orderNumber,model.order.orderState,@"005"] WithRequestType:1 WithParameter:nil WithReturnValueBlock:^(id returnValue) {
[self RemoveMBProgressHUDLoding];
[weakSelf dismissViewControllerAnimated:YES completion:nil];
[weakSelf RemoveMBProgressHUDLoding];
if ([returnValue[@"code"] isEqualToNumber:@0]) {
[self SuccessMBProgressView:@"撤销成功"];
[weakSelf SuccessMBProgressView:@"撤销成功"];
model.order.orderState = @"005";
NSIndexPath *indexapath = [NSIndexPath indexPathForRow:cellindex inSection:0];
[self.customerOrderTableView reloadRowsAtIndexPaths:@[indexapath] withRowAnimation:UITableViewRowAnimationLeft];
[weakSelf.customerOrderTableView reloadRowsAtIndexPaths:@[indexapath] withRowAnimation:UITableViewRowAnimationLeft];
}
else
{
[self ErrorMBProgressView:returnValue[@"message"]];
[weakSelf ErrorMBProgressView:returnValue[@"message"]];
}
} WithErrorCodeBlock:^(id errorCodeValue) {
} WithFailureBlock:^(id error) {
[self RemoveMBProgressHUDLoding];
[weakSelf RemoveMBProgressHUDLoding];
}];
}]];
[self presentViewController:alertVC animated:YES completion:nil];
}
......
......@@ -159,7 +159,6 @@
#pragma mark -调出支付框
- (void)PayButtonClick
{
SettlementViewController *settlement = [[SettlementViewController alloc]init];
//支付成功
[settlement setPaySuccessReturnBlock:^{
......@@ -172,14 +171,12 @@
self.DelecteAndPayButtonBlock(_cellindex,@"002");
}
}];
settlement.preferredContentSize = CGSizeMake(380, 500);
settlement.goodsArray = self.orderDetails.orderdetailList;
settlement.orderCode = _orderCode;
settlement.modalPresentationStyle = UIModalPresentationFormSheet;
UIPopoverPresentationController *pop = settlement.popoverPresentationController;
pop.sourceView = settlement.view;
pop.permittedArrowDirections = UIPopoverArrowDirectionAny;
[self presentViewController:settlement animated:YES completion:nil];
}
......
......@@ -42,4 +42,15 @@
* 传入cell下标
*/
@property (nonatomic,assign) NSInteger cellindex;
/**
* 产品规格
*/
@property (weak, nonatomic) IBOutlet UILabel *specifications;
@end
......@@ -139,7 +139,7 @@
<button opaque="NO" tag="101" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="tM7-hf-9rp">
<rect key="frame" x="398" y="328" width="50" height="50"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES"/>
<state key="normal" image="down_arr"/>
<state key="normal" image="矩形-3-副本"/>
</button>
<button opaque="NO" tag="101" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="0ee-HS-ilS">
<rect key="frame" x="398" y="9" width="50" height="50"/>
......@@ -173,8 +173,8 @@
<image name="140046029-MX260-D112-03-星冠-5700K(4)" width="600" height="450"/>
<image name="2" width="45" height="45"/>
<image name="add" width="49" height="45"/>
<image name="down_arr" width="22" height="12"/>
<image name="icon-2" width="25" height="15"/>
<image name="reduce" width="49" height="45"/>
<image name="矩形-3-副本" width="20" height="11"/>
</resources>
</document>
......@@ -20,6 +20,7 @@
- (void)setDatas:(TOGoodsEntity *)datas
{
_datas = datas;
self.brandLabe.text = _datas.company;
self.specificationsLabe.text = _datas.spec;
self.materialLabe.text = _datas.material;
self.temperatureLabe.text = _datas.colorTemperature;
......
......@@ -130,10 +130,10 @@
#pragma mark -header赋值
- (void)HeaderViewAssignment
{
self.headerView.serialNumber.text = self.entity.series;
self.headerView.serialNumber.text = self.entity.code;
self.headerView.nameLabe.text = self.entity.name;
self.headerView.brandName.text = self.entity.brandId;
self.headerView.dorpPriceLabe.text = [self.entity.tagPrice stringValue];
self.headerView.brandName.text = self.entity.company;
self.headerView.dorpPriceLabe.text = [NSString stringWithFormat:@"%.2f",[self.entity.tagPrice floatValue]];
self.imagesArray = [NSMutableArray arrayWithArray:[self.entity.pictures componentsSeparatedByString:@","]];
[self.headerView.goodsImageview sd_setImageWithURL:[self.imagesArray firstObject] placeholderImage:REPLACEIMAGE];
//商品小图
......
......@@ -317,7 +317,9 @@
[cell.productImageView sd_setImageWithURL:[NSURL URLWithString:[imageArray firstObject]] placeholderImage:REPLACEIMAGE];
cell.productPrice.text = [NSString stringWithFormat:@"¥%@",[[[self.datasArray objectAtIndex_opple:indexPath.item] guidePrice] stringValue]];
cell.cellindex = indexPath.item;
cell.productParameter.text = [[self.datasArray objectAtIndex_opple:indexPath.item] spec];
cell.productParameter.text = [[self.datasArray objectAtIndex_opple:indexPath.item] productProfile];
cell.specifications.text = [NSString stringWithFormat:@"%@(%@)",[[self.datasArray objectAtIndex_opple:indexPath.item] series],[[self.datasArray objectAtIndex_opple:indexPath.item] spec]];
//加入购物车
__weak typeof(self) weakSelf = self;
__weak typeof(ProductCollectionViewCell *) weakCell = cell;
......
......@@ -191,7 +191,14 @@
//调用商品控制器
ProductLibraryViewController *productVC = [[self getStoryboardWithName] instantiateViewControllerWithIdentifier:@"productlibrary"];
productVC.selectedCode = [[self.response.list objectAtIndex_opple:indexPath.item] fid];
[self.navigationController pushViewController:productVC animated:YES];
[self.navigationController pushViewController:productVC animated:NO];
}
else if ([collectionView isEqual:self.historyCollectionView])
{
//调用商品控制器
ProductLibraryViewController *productVC = [[self getStoryboardWithName] instantiateViewControllerWithIdentifier:@"productlibrary"];
productVC.selectedCode = [self.localSearchArray objectAtIndex_opple:indexPath.item];
[self.navigationController pushViewController:productVC animated:NO];
}
}
......
......@@ -71,13 +71,13 @@
- (void)setGoodsArray
{
NSInteger goodsAllNumber = 0;//总数量
NSInteger goodAllprice = 0;//总价格
CGFloat goodAllprice = 0;//总价格
for (TOOrderdetailEntity *model in _goodsArray) {
goodsAllNumber += [model.goodsNum integerValue];
goodAllprice += [model.goodsPrice integerValue];
goodAllprice += [model.goodsPrice floatValue];
}
self.goodsAllNumber.text = [NSString stringWithFormat:@"%ld",goodsAllNumber];
self.goodsAllPrice.text = [NSString stringWithFormat:@"%ld元",goodAllprice];
self.goodsAllPrice.text = [NSString stringWithFormat:@"%.2f元",(goodAllprice*goodsAllNumber)];
}
......@@ -147,6 +147,7 @@
sender.selected = !sender.selected;
if (sender.selected) {
[self.showPayQrCodeImageView sd_setImageWithURL:[NSURL URLWithString:self.weiXinLabe] placeholderImage:REPLACEIMAGE];
self.payTreasureButton.selected = NO;
[self.payTypeButton setTitle:@"现金、支票、转账、刷卡" forState:UIControlStateNormal];
}
......@@ -159,6 +160,7 @@
sender.selected = !sender.selected;
if (sender.selected) {
[self.showPayQrCodeImageView sd_setImageWithURL:[NSURL URLWithString:self.zhiFubaoLabe] placeholderImage:REPLACEIMAGE];
self.WeixiPayButton.selected = NO;
[self.payTypeButton setTitle:@"现金、支票、转账、刷卡" forState:UIControlStateNormal];
}
......@@ -242,10 +244,10 @@
{
OrderPayRequest *order = [[OrderPayRequest alloc]init];
order.isbill = self.ISinvoiceButton.currentTitle;
order.orderNumber = _orderCode;
order.fnewstate = @"002";
order.oldstate = @"001";
order.billTitle = self.invoiceHeader.text;
//支付类型
if (self.payTreasureButton.selected) {
......
......@@ -178,7 +178,7 @@
<action selector="invoiceTypeButtonClick:" destination="-1" eventType="touchUpInside" id="glI-Tn-twP"/>
</connections>
</button>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="05产品库-详情_03" id="evA-uJ-YEb">
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" id="evA-uJ-YEb">
<rect key="frame" x="255" y="143.5" width="100" height="100"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
</imageView>
......@@ -227,7 +227,6 @@
</view>
</objects>
<resources>
<image name="05产品库-详情_03" width="500" height="375"/>
<image name="down_arr" width="22" height="12"/>
<image name="wechat1" width="175" height="30"/>
<image name="图层-1" width="175" height="30"/>
......
......@@ -339,6 +339,11 @@
//收货地址
TOOrderEntity *orderReceiver = [[TOOrderEntity alloc]init];
NSArray *Adressarr = [self.datasArray objectAtIndex_opple:1];
//总价格
CGFloat allPrice = 0;
//总数量
NSInteger allNumber = 0;
for (int i=0; i<Adressarr.count; i++) {
if ([[Adressarr objectAtIndex_opple:i] isKindOfClass:[AddressModel class]]) {
......@@ -348,6 +353,7 @@
//收货人信息
orderReceiver.receiverName = model.name;
orderReceiver.orderTime = [self GetCurrenttime];
orderReceiver.receiverMobile = model.miblephone;
orderReceiver.receiverAddress = model.address;
order.order = orderReceiver;
......@@ -372,12 +378,16 @@
orderGoods.goodsUnit = model.goods.unit;
//总价
NSInteger allprice = model.goodsNum *[model.goods.costPrice integerValue];
orderGoods.goodsTotalPrice = [NSNumber numberWithInteger:allprice];
orderReceiver.orderPrice = [NSNumber numberWithInteger:allprice];
allPrice += model.goodsNum *[model.goods.costPrice floatValue];
//总数量
allNumber += model.goodsNum;
orderGoods.goodsTotalPrice = [NSNumber numberWithFloat:model.goodsNum *[model.goods.costPrice floatValue]];
[goodidArr addObject:orderGoods];
}
//总价
orderReceiver.orderPrice = [NSNumber numberWithFloat:allPrice];
//总数量
orderReceiver.goodsNum = [NSString stringWithFormat:@"%ld",allNumber];
order.orderdetailList = (NSArray<TOOrderdetailEntity> *)goodidArr;
[self CreateMBProgressHUDLoding];
[[NetworkRequestClassManager Manager] NetworkRequestWithURL:[NSString stringWithFormat:@"%@%@",ServerAddress,@"/order/save"] WithRequestType:0 WithParameter:order WithReturnValueBlock:^(id returnValue) {
......@@ -419,6 +429,22 @@
}
#pragma mark -获取当前日期
- (NSString *)GetCurrenttime
{
NSDate *date = [[NSDate alloc] init];
//获取一下当前的时区
NSTimeZone *zone=[NSTimeZone timeZoneWithName:@"UTC"];
//根据对应的时区,获取和0时区相差的秒数
NSInteger seconds = [zone secondsFromGMTForDate:date];
//获取当前的时间
NSDate *localDate = [NSDate dateWithTimeIntervalSinceNow:seconds];
NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
[formatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
NSString *datetime = [formatter stringFromDate:localDate];
return datetime;
}
#pragma mark -返回购物车
- (IBAction)BackShoppingBagsButtonClick:(UIButton *)sender {
......
......@@ -100,4 +100,10 @@
*/
@property (nonatomic,copy) void(^promptStringBlock)(NSString *string);
/**
* 商品规格
*/
@property (weak, nonatomic) IBOutlet UILabel *specifications;
@end
......@@ -31,12 +31,13 @@
{
_model = model;
self.selectedButton.selected = _model.isSelected;
[self.goodsImageView sd_setImageWithURL:[NSURL URLWithString:_model.goods.pictures] placeholderImage:ReplaceImage];
[self.goodsImageView sd_setImageWithURL:[NSURL URLWithString:_model.goods.pictures] placeholderImage:REPLACEIMAGE];
self.goodsInformationLabe.text = _model.goods.name;
self.specifications.text = [NSString stringWithFormat:@"%@(%@)",_model.goods.productProfile,_model.goods.spec];
self.tagsPriceLabe.text = [_model.goods.tagPrice stringValue];
self.clinchTextfield.text = [_model.goods.costPrice stringValue];
self.goodsNumbersLabe.text = [NSString stringWithFormat:@"%d",_model.goodsNum];
self.productPriceLabe.text = [NSString stringWithFormat:@"¥%ld",[self.goodsNumbersLabe.text integerValue]*[_model.goods.costPrice integerValue]];;
self.productPriceLabe.text = [NSString stringWithFormat:@"¥%.2f",[self.goodsNumbersLabe.text floatValue]*[_model.goods.costPrice floatValue]];;
}
#pragma mark -增加或者减少商品
......@@ -109,24 +110,25 @@
if (![self isPureInt:textField.text]) {
if (self.promptStringBlock) {
self.promptStringBlock(@"输入格式错误");
return NO;
}
}
//改变价格
self.productPriceLabe.text = [NSString stringWithFormat:@"¥%ld",[self.goodsNumbersLabe.text integerValue]*[textField.text integerValue]];
if ([self.delegate respondsToSelector:@selector(ChangeGoodsNumber:WithcostPrice:Withcellindex:)]) {
[self.delegate ChangeGoodsNumber:[self.goodsNumbersLabe.text intValue] WithcostPrice:[self.clinchTextfield.text intValue]Withcellindex:_cellindex];
}else
{
//改变价格
self.productPriceLabe.text = [NSString stringWithFormat:@"¥%ld",[self.goodsNumbersLabe.text integerValue]*[textField.text integerValue]];
if ([self.delegate respondsToSelector:@selector(ChangeGoodsNumber:WithcostPrice:Withcellindex:)]) {
[self.delegate ChangeGoodsNumber:[self.goodsNumbersLabe.text intValue] WithcostPrice:[self.clinchTextfield.text intValue]Withcellindex:_cellindex];
}
}
return YES;
}
#pragma mark - 判断是否是纯数字
#pragma mark - 判断是否是浮点数
- (BOOL)isPureInt:(NSString*)string{
NSScanner* scan = [NSScanner scannerWithString:string];
int val;
return[scan scanInt:&val] && [scan isAtEnd];
float val;
return[scan scanFloat:&val] && [scan isAtEnd];
}
......
......@@ -162,13 +162,14 @@
cell.delegate = self;
cell.cellindex = indexPath.row;
//cell选中回调
__weak typeof(self) weakSelf = self;
[cell setReturnCellblock:^(NSInteger index) {
[self setSelectedButton:index];
[weakSelf setSelectedButton:index];
}];
//提示框回调
[cell setPromptStringBlock:^(NSString *string) {
[self ErrorMBProgressView:string];
[weakSelf promptCustomerWithString:@"格式不正确"];
}];
return cell;
}
......@@ -313,13 +314,13 @@
#pragma mark -计算选中后的商品总金额
- (void)CalculateSelectedGoodsAllprice
{
NSInteger allPrice = 0;
CGFloat allPrice = 0;
for (ShopcarModel *model in self.shopResponseArray) {
if (model.isSelected) {
allPrice += [model.goods.costPrice integerValue] * model.goodsNum;
allPrice += [model.goods.costPrice floatValue] * model.goodsNum;
}
}
self.totalpriceLabe.text = [NSString stringWithFormat:@"¥%ld",allPrice];
self.totalpriceLabe.text = [NSString stringWithFormat:@"¥%.2f",allPrice];
}
......
......@@ -41,7 +41,7 @@
IQKeyboardManager *manager = [IQKeyboardManager sharedManager];
manager.enable = YES;
manager.shouldResignOnTouchOutside = YES;
manager.enableAutoToolbar = YES;
manager.enableAutoToolbar = NO;
}
......
{
"images" : [
{
"idiom" : "universal",
"filename" : "矩形-3-副本.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "矩形-3-副本@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
......@@ -95,4 +95,10 @@
*/
- (void)QueryShoppingCarNumber;
/**
* 系统提示框
*/
- (void)promptCustomerWithString:(NSString *)message;
@end
......@@ -393,6 +393,21 @@
#pragma mark -系统提示框
- (void)promptCustomerWithString:(NSString *)message
{
UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:@"提示" message:message preferredStyle:UIAlertControllerStyleAlert];
[alertVC addAction:[UIAlertAction actionWithTitle:@"我知道了" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
[self dismissViewControllerAnimated:YES completion:nil];
}]];
[self presentViewController:alertVC animated:YES completion:nil];
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment