From 896e9d6ed04e47acf89d60367dce837cfb735757 Mon Sep 17 00:00:00 2001 From: w-R <953969641@qq.com> Date: Tue, 19 Oct 2021 11:39:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/main.dart | 2 +- lib/retrofit/data/placeOrderFirst.dart | 491 ++++++++++++++ lib/retrofit/data/settleOrderInfo.dart | 3 + lib/retrofit/data/settlement_bean.dart | 880 +++++++++++++++++++++++++ lib/retrofit/data/shoppingCart.dart | 7 +- lib/retrofit/min_api.dart | 12 + lib/retrofit/min_api.g.dart | 47 ++ lib/store/store_order.dart | 15 + lib/store/store_view/product_sku.dart | 8 + lib/store/store_view/settlement.dart | 243 +++++-- 10 files changed, 1661 insertions(+), 47 deletions(-) create mode 100644 lib/retrofit/data/placeOrderFirst.dart create mode 100644 lib/retrofit/data/settlement_bean.dart diff --git a/lib/main.dart b/lib/main.dart index fce7add2..63efb090 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -52,7 +52,7 @@ import 'package:huixiang/setting/help_feedback_page.dart'; import 'package:huixiang/setting/permission_setting_page.dart'; import 'package:huixiang/setting/setting_page.dart'; import 'package:huixiang/setting/treaty_page.dart'; -// import 'package:huixiang/store/settlement.dart'; +// import 'package:huixiang/store/settlement_bean.dart'; import 'package:huixiang/store/store_order.dart'; import 'package:huixiang/store/store_view/settlement.dart'; import 'package:huixiang/test_page.dart'; diff --git a/lib/retrofit/data/placeOrderFirst.dart b/lib/retrofit/data/placeOrderFirst.dart new file mode 100644 index 00000000..d93ab4a6 --- /dev/null +++ b/lib/retrofit/data/placeOrderFirst.dart @@ -0,0 +1,491 @@ +import 'package:huixiang/retrofit/data/shoppingCart.dart'; + +/// addressId : 0 +/// isSubscribe : true +/// isTakeOut : 0 +/// notes : "" +/// numberOfPeople : 0 +/// orderSource : 0 +/// orderType : 0 +/// orderTypeId : 0 +/// parentCode : "" +/// parentId : 0 +/// payChannel : 0 +/// promotionInfoDTO : {"couponId":0,"promotionId":0} +/// recMobile : "" +/// shoppingCartSkuItemList : [] +/// skuItemDTOList : [{"buyNum":0,"couponId":0,"couponName":"","discountPercent":0,"orderId":0,"orderProductId":0,"platterList":[{"deleted":true,"id":0,"productId":0,"required":true,"skuId":0}],"promotionId":0,"promotionName":"","refundNum":0,"skuId":0}] +/// source : 0 +/// storeId : 0 +/// subcribeTime : "" +/// tableId : 0 + +class PlaceOrderFirst { + PlaceOrderFirst({ + String addressId, + bool isSubscribe, + int isTakeOut, + String notes, + String numberOfPeople, + int orderSource, + int orderType, + int orderTypeId, + String parentCode, + int parentId, + int payChannel, + PlaceOrderFirstPromotionInfoDTO promotionInfoDTO, + String recMobile, + List shoppingCartSkuItemList, + List skuItemDTOList, + int source, + String storeId, + String subcribeTime, + int tableId,}){ + _addressId = addressId; + _isSubscribe = isSubscribe; + _isTakeOut = isTakeOut; + _notes = notes; + _numberOfPeople = numberOfPeople; + _orderSource = orderSource; + _orderType = orderType; + _orderTypeId = orderTypeId; + _parentCode = parentCode; + _parentId = parentId; + _payChannel = payChannel; + _promotionInfoDTO = promotionInfoDTO; + _recMobile = recMobile; + _skuItemDTOList = skuItemDTOList; + _shoppingCartSkuItemList = shoppingCartSkuItemList; + _source = source; + _storeId = storeId; + _subcribeTime = subcribeTime; + _tableId = tableId; +} + + PlaceOrderFirst.fromJson(dynamic json) { + _addressId = json['addressId']; + _isSubscribe = json['isSubscribe']; + _isTakeOut = json['isTakeOut']; + _notes = json['notes']; + _numberOfPeople = json['numberOfPeople']; + _orderSource = json['orderSource']; + _orderType = json['orderType']; + _orderTypeId = json['orderTypeId']; + _parentCode = json['parentCode']; + _parentId = json['parentId']; + _payChannel = json['payChannel']; + _promotionInfoDTO = json['promotionInfoDTO'] != null ? PlaceOrderFirstPromotionInfoDTO.fromJson(json['promotionInfoDTO']) : null; + _recMobile = json['recMobile']; + if (json['skuItemDTOList'] != null) { + _skuItemDTOList = []; + json['skuItemDTOList'].forEach((v) { + _skuItemDTOList.add(SkuItemDTOList.fromJson(v)); + }); + } + if (json['shoppingCartSkuItemList'] != null) { + _shoppingCartSkuItemList = []; + json['shoppingCartSkuItemList'].forEach((v) { + _shoppingCartSkuItemList.add(ShoppingCartSkuItemListBean.fromJson(v)); + }); + } + _source = json['source']; + _storeId = json['storeId']; + _subcribeTime = json['subcribeTime']; + _tableId = json['tableId']; + } + String _addressId; + bool _isSubscribe; + int _isTakeOut; + String _notes; + String _numberOfPeople; + int _orderSource; + int _orderType; + int _orderTypeId; + String _parentCode; + int _parentId; + int _payChannel; + PlaceOrderFirstPromotionInfoDTO _promotionInfoDTO; + String _recMobile; + List _skuItemDTOList; + List _shoppingCartSkuItemList; + int _source; + String _storeId; + String _subcribeTime; + int _tableId; + + set addressId(String value) { + _addressId = value; + } + + String get addressId => _addressId; + bool get isSubscribe => _isSubscribe; + int get isTakeOut => _isTakeOut; + String get notes => _notes; + String get numberOfPeople => _numberOfPeople; + int get orderSource => _orderSource; + int get orderType => _orderType; + int get orderTypeId => _orderTypeId; + String get parentCode => _parentCode; + int get parentId => _parentId; + int get payChannel => _payChannel; + PlaceOrderFirstPromotionInfoDTO get promotionInfoDTO => _promotionInfoDTO; + String get recMobile => _recMobile; + List get skuItemDTOList => _skuItemDTOList; + List get shoppingCartSkuItemList => _shoppingCartSkuItemList; + int get source => _source; + String get storeId => _storeId; + String get subcribeTime => _subcribeTime; + int get tableId => _tableId; + + Map toJson() { + final map = {}; + map['addressId'] = _addressId; + map['isSubscribe'] = _isSubscribe; + map['isTakeOut'] = _isTakeOut; + map['notes'] = _notes; + map['numberOfPeople'] = _numberOfPeople; + map['orderSource'] = _orderSource; + map['orderType'] = _orderType; + map['orderTypeId'] = _orderTypeId; + map['parentCode'] = _parentCode; + map['parentId'] = _parentId; + map['payChannel'] = _payChannel; + if (_promotionInfoDTO != null) { + map['promotionInfoDTO'] = _promotionInfoDTO.toJson(); + } + map['recMobile'] = _recMobile; + if (_skuItemDTOList != null) { + map['skuItemDTOList'] = _skuItemDTOList.map((v) => v.toJson()).toList(); + } + if (_shoppingCartSkuItemList != null) { + map['shoppingCartSkuItemList'] = _shoppingCartSkuItemList.map((v) => v.toJson()).toList(); + } + map['source'] = _source; + map['storeId'] = _storeId; + map['subcribeTime'] = _subcribeTime; + map['tableId'] = _tableId; + return map; + } + + set isSubscribe(bool value) { + _isSubscribe = value; + } + + set isTakeOut(int value) { + _isTakeOut = value; + } + + set notes(String value) { + _notes = value; + } + + set numberOfPeople(String value) { + _numberOfPeople = value; + } + + set orderSource(int value) { + _orderSource = value; + } + + set orderType(int value) { + _orderType = value; + } + + set orderTypeId(int value) { + _orderTypeId = value; + } + + set parentCode(String value) { + _parentCode = value; + } + + set parentId(int value) { + _parentId = value; + } + + set payChannel(int value) { + _payChannel = value; + } + + set promotionInfoDTO(PlaceOrderFirstPromotionInfoDTO value) { + _promotionInfoDTO = value; + } + + set recMobile(String value) { + _recMobile = value; + } + + set skuItemDTOList(List value) { + _skuItemDTOList = value; + } + + set shoppingCartSkuItemList(List value) { + _shoppingCartSkuItemList = value; + } + + set source(int value) { + _source = value; + } + + set storeId(String value) { + _storeId = value; + } + + set subcribeTime(String value) { + _subcribeTime = value; + } + + set tableId(int value) { + _tableId = value; + } +} + +/// buyNum : 0 +/// couponId : 0 +/// couponName : "" +/// discountPercent : 0 +/// orderId : 0 +/// orderProductId : 0 +/// platterList : [{"deleted":true,"id":0,"productId":0,"required":true,"skuId":0}] +/// promotionId : 0 +/// promotionName : "" +/// refundNum : 0 +/// skuId : 0 + +class SkuItemDTOList { + SkuItemDTOList({ + int buyNum, + int couponId, + String couponName, + int discountPercent, + int orderId, + int orderProductId, + List platterList, + int promotionId, + String promotionName, + int refundNum, + String skuId,}){ + _buyNum = buyNum; + _couponId = couponId; + _couponName = couponName; + _discountPercent = discountPercent; + _orderId = orderId; + _orderProductId = orderProductId; + _platterList = platterList; + _promotionId = promotionId; + _promotionName = promotionName; + _refundNum = refundNum; + _skuId = skuId; +} + + SkuItemDTOList.fromJson(dynamic json) { + _buyNum = json['buyNum']; + _couponId = json['couponId']; + _couponName = json['couponName']; + _discountPercent = json['discountPercent']; + _orderId = json['orderId']; + _orderProductId = json['orderProductId']; + if (json['platterList'] != null) { + _platterList = []; + json['platterList'].forEach((v) { + _platterList.add(PlatterList.fromJson(v)); + }); + } + _promotionId = json['promotionId']; + _promotionName = json['promotionName']; + _refundNum = json['refundNum']; + _skuId = json['skuId']; + } + int _buyNum; + int _couponId; + String _couponName; + int _discountPercent; + int _orderId; + int _orderProductId; + List _platterList; + int _promotionId; + String _promotionName; + int _refundNum; + String _skuId; + + int get buyNum => _buyNum; + int get couponId => _couponId; + String get couponName => _couponName; + int get discountPercent => _discountPercent; + int get orderId => _orderId; + int get orderProductId => _orderProductId; + List get platterList => _platterList; + int get promotionId => _promotionId; + String get promotionName => _promotionName; + int get refundNum => _refundNum; + String get skuId => _skuId; + + set buyNum(int value) { + _buyNum = value; + } + + Map toJson() { + final map = {}; + map['buyNum'] = _buyNum; + map['couponId'] = _couponId; + map['couponName'] = _couponName; + map['discountPercent'] = _discountPercent; + map['orderId'] = _orderId; + map['orderProductId'] = _orderProductId; + if (_platterList != null) { + map['platterList'] = _platterList.map((v) => v.toJson()).toList(); + } + map['promotionId'] = _promotionId; + map['promotionName'] = _promotionName; + map['refundNum'] = _refundNum; + map['skuId'] = _skuId; + return map; + } + + set couponId(int value) { + _couponId = value; + } + + set couponName(String value) { + _couponName = value; + } + + set discountPercent(int value) { + _discountPercent = value; + } + + set orderId(int value) { + _orderId = value; + } + + set orderProductId(int value) { + _orderProductId = value; + } + + set platterList(List value) { + _platterList = value; + } + + set promotionId(int value) { + _promotionId = value; + } + + set promotionName(String value) { + _promotionName = value; + } + + set refundNum(int value) { + _refundNum = value; + } + + set skuId(String value) { + _skuId = value; + } +} + +/// deleted : true +/// id : 0 +/// productId : 0 +/// required : true +/// skuId : 0 + +class PlatterList { + PlatterList({ + bool deleted, + int id, + String productId, + bool required, + String skuId,}){ + _deleted = deleted; + _id = id; + _productId = productId; + _required = required; + _skuId = skuId; +} + + PlatterList.fromJson(dynamic json) { + _deleted = json['deleted']; + _id = json['id']; + _productId = json['productId']; + _required = json['required']; + _skuId = json['skuId']; + } + bool _deleted; + int _id; + String _productId; + bool _required; + String _skuId; + + bool get deleted => _deleted; + int get id => _id; + String get productId => _productId; + bool get required => _required; + String get skuId => _skuId; + + set deleted(bool value) { + _deleted = value; + } + + Map toJson() { + final map = {}; + map['deleted'] = _deleted; + map['id'] = _id; + map['productId'] = _productId; + map['required'] = _required; + map['skuId'] = _skuId; + return map; + } + + set id(int value) { + _id = value; + } + + set productId(String value) { + _productId = value; + } + + set required(bool value) { + _required = value; + } + + set skuId(String value) { + _skuId = value; + } +} + +/// couponId : 0 +/// promotionId : 0 + +class PlaceOrderFirstPromotionInfoDTO { + PlaceOrderFirstPromotionInfoDTO({ + String couponId, + String promotionId,}){ + _couponId = couponId; + _promotionId = promotionId; +} + + PlaceOrderFirstPromotionInfoDTO.fromJson(dynamic json) { + _couponId = json['couponId']; + _promotionId = json['promotionId']; + } + String _couponId; + String _promotionId; + + set couponId(String value) { + _couponId = value; + } + + String get couponId => _couponId; + String get promotionId => _promotionId; + + Map toJson() { + final map = {}; + map['couponId'] = _couponId; + map['promotionId'] = _promotionId; + return map; + } + + set promotionId(String value) { + _promotionId = value; + } +} \ No newline at end of file diff --git a/lib/retrofit/data/settleOrderInfo.dart b/lib/retrofit/data/settleOrderInfo.dart index 7e62c6b7..ba8b2f93 100644 --- a/lib/retrofit/data/settleOrderInfo.dart +++ b/lib/retrofit/data/settleOrderInfo.dart @@ -227,6 +227,8 @@ class CouponListBean { bool usable; bool allProduct; dynamic productList; + bool isEx; + static CouponListBean fromJson(Map map) { if (map == null) return null; @@ -283,6 +285,7 @@ class CouponListBean { "usable": usable, "allProduct": allProduct, "productList": productList, + }; } diff --git a/lib/retrofit/data/settlement_bean.dart b/lib/retrofit/data/settlement_bean.dart new file mode 100644 index 00000000..8315b8b5 --- /dev/null +++ b/lib/retrofit/data/settlement_bean.dart @@ -0,0 +1,880 @@ +/// addressId : 0 +/// buyNum : 0 +/// id : 0 +/// is_logistics : true +/// orderProductVOList : [{"actInfo":{"couponDiscountAmount":0,"couponDiscountRate":0,"couponId":0,"couponType":0,"discountAmount":0,"discountRate":0,"promotionId":0,"promotionType":0},"additionalComment":{"bizType":0,"commentImgs":"","commentImgsFlag":true,"commentStar":0,"commentText":"","descStar":0,"hideFlag":true,"id":0,"isDelete":true,"likeNum":0,"logisticsStar":0,"mid":0,"orderProductId":0,"parentId":0,"productId":0,"sensitiveFlag":true,"serviceStar":0,"storeId":0},"buyNum":0,"canApplyIntervention":0,"comment":{"bizType":0,"commentImgs":"","commentImgsFlag":true,"commentStar":0,"commentText":"","descStar":0,"hideFlag":true,"id":0,"isDelete":true,"likeNum":0,"logisticsStar":0,"mid":0,"orderProductId":0,"parentId":0,"productId":0,"sensitiveFlag":true,"serviceStar":0,"storeId":0},"commentStatus":0,"discountAmount":0,"id":0,"productId":0,"productName":"","returnCode":"","returnStatus":0,"returnType":0,"sellPrice":0,"skuId":0,"skuImg":"","skuNameStr":""}] +/// payChannel : 0 +/// promotionInfoDTO : {"couponId":0,"promotionId":0} + +class SettlementBean { + SettlementBean({ + int addressId, + int buyNum, + int id, + bool isLogistics, + List orderProductVOList, + int payChannel, + PromotionInfoDTO promotionInfoDTO,}){ + _addressId = addressId; + _buyNum = buyNum; + _id = id; + _isLogistics = isLogistics; + _orderProductVOList = orderProductVOList; + _payChannel = payChannel; + _promotionInfoDTO = promotionInfoDTO; +} + + SettlementBean.fromJson(dynamic json) { + _addressId = json['addressId']; + _buyNum = json['buyNum']; + _id = json['id']; + _isLogistics = json['is_logistics']; + if (json['orderProductVOList'] != null) { + _orderProductVOList = []; + json['orderProductVOList'].forEach((v) { + _orderProductVOList.add(OrderProductVOList.fromJson(v)); + }); + } + _payChannel = json['payChannel']; + _promotionInfoDTO = json['promotionInfoDTO'] != null ? PromotionInfoDTO.fromJson(json['promotionInfoDTO']) : null; + } + int _addressId; + int _buyNum; + int _id; + bool _isLogistics; + List _orderProductVOList; + int _payChannel; + PromotionInfoDTO _promotionInfoDTO; + + int get addressId => _addressId; + int get buyNum => _buyNum; + int get id => _id; + bool get isLogistics => _isLogistics; + List get orderProductVOList => _orderProductVOList; + int get payChannel => _payChannel; + PromotionInfoDTO get promotionInfoDTO => _promotionInfoDTO; + + + Map toJson() { + final map = {}; + map['addressId'] = _addressId; + map['buyNum'] = _buyNum; + map['id'] = _id; + map['is_logistics'] = _isLogistics; + if (_orderProductVOList != null) { + map['orderProductVOList'] = _orderProductVOList.map((v) => v.toJson()).toList(); + } + map['payChannel'] = _payChannel; + if (_promotionInfoDTO != null) { + map['promotionInfoDTO'] = _promotionInfoDTO.toJson(); + } + return map; + } + + set addressId(int value) { + _addressId = value; + } + + set buyNum(int value) { + _buyNum = value; + } + + set id(int value) { + _id = value; + } + + set isLogistics(bool value) { + _isLogistics = value; + } + + set orderProductVOList(List value) { + _orderProductVOList = value; + } + + set payChannel(int value) { + _payChannel = value; + } + + set promotionInfoDTO(PromotionInfoDTO value) { + _promotionInfoDTO = value; + } +} + +/// couponId : 0 +/// promotionId : 0 + +class PromotionInfoDTO { + PromotionInfoDTO({ + int couponId, + int promotionId,}){ + _couponId = couponId; + _promotionId = promotionId; +} + + PromotionInfoDTO.fromJson(dynamic json) { + _couponId = json['couponId']; + _promotionId = json['promotionId']; + } + int _couponId; + int _promotionId; + + int get couponId => _couponId; + int get promotionId => _promotionId; + + + set couponId(int value) { + _couponId = value; + } + + Map toJson() { + final map = {}; + map['couponId'] = _couponId; + map['promotionId'] = _promotionId; + return map; + } + + set promotionId(int value) { + _promotionId = value; + } +} + +/// actInfo : {"couponDiscountAmount":0,"couponDiscountRate":0,"couponId":0,"couponType":0,"discountAmount":0,"discountRate":0,"promotionId":0,"promotionType":0} +/// additionalComment : {"bizType":0,"commentImgs":"","commentImgsFlag":true,"commentStar":0,"commentText":"","descStar":0,"hideFlag":true,"id":0,"isDelete":true,"likeNum":0,"logisticsStar":0,"mid":0,"orderProductId":0,"parentId":0,"productId":0,"sensitiveFlag":true,"serviceStar":0,"storeId":0} +/// buyNum : 0 +/// canApplyIntervention : 0 +/// comment : {"bizType":0,"commentImgs":"","commentImgsFlag":true,"commentStar":0,"commentText":"","descStar":0,"hideFlag":true,"id":0,"isDelete":true,"likeNum":0,"logisticsStar":0,"mid":0,"orderProductId":0,"parentId":0,"productId":0,"sensitiveFlag":true,"serviceStar":0,"storeId":0} +/// commentStatus : 0 +/// discountAmount : 0 +/// id : 0 +/// productId : 0 +/// productName : "" +/// returnCode : "" +/// returnStatus : 0 +/// returnType : 0 +/// sellPrice : 0 +/// skuId : 0 +/// skuImg : "" +/// skuNameStr : "" + +class OrderProductVOList { + OrderProductVOList({ + ActInfo actInfo, + AdditionalComment additionalComment, + int buyNum, + int canApplyIntervention, + Comment comment, + int commentStatus, + int discountAmount, + int id, + int productId, + String productName, + String returnCode, + int returnStatus, + int returnType, + int sellPrice, + int skuId, + String skuImg, + String skuNameStr,}){ + _actInfo = actInfo; + _additionalComment = additionalComment; + _buyNum = buyNum; + _canApplyIntervention = canApplyIntervention; + _comment = comment; + _commentStatus = commentStatus; + _discountAmount = discountAmount; + _id = id; + _productId = productId; + _productName = productName; + _returnCode = returnCode; + _returnStatus = returnStatus; + _returnType = returnType; + _sellPrice = sellPrice; + _skuId = skuId; + _skuImg = skuImg; + _skuNameStr = skuNameStr; +} + + OrderProductVOList.fromJson(dynamic json) { + _actInfo = json['actInfo'] != null ? ActInfo.fromJson(json['actInfo']) : null; + _additionalComment = json['additionalComment'] != null ? AdditionalComment.fromJson(json['additionalComment']) : null; + _buyNum = json['buyNum']; + _canApplyIntervention = json['canApplyIntervention']; + _comment = json['comment'] != null ? Comment.fromJson(json['comment']) : null; + _commentStatus = json['commentStatus']; + _discountAmount = json['discountAmount']; + _id = json['id']; + _productId = json['productId']; + _productName = json['productName']; + _returnCode = json['returnCode']; + _returnStatus = json['returnStatus']; + _returnType = json['returnType']; + _sellPrice = json['sellPrice']; + _skuId = json['skuId']; + _skuImg = json['skuImg']; + _skuNameStr = json['skuNameStr']; + } + ActInfo _actInfo; + AdditionalComment _additionalComment; + int _buyNum; + int _canApplyIntervention; + Comment _comment; + int _commentStatus; + int _discountAmount; + int _id; + int _productId; + String _productName; + String _returnCode; + int _returnStatus; + int _returnType; + int _sellPrice; + int _skuId; + String _skuImg; + String _skuNameStr; + + ActInfo get actInfo => _actInfo; + AdditionalComment get additionalComment => _additionalComment; + int get buyNum => _buyNum; + int get canApplyIntervention => _canApplyIntervention; + Comment get comment => _comment; + int get commentStatus => _commentStatus; + int get discountAmount => _discountAmount; + int get id => _id; + int get productId => _productId; + String get productName => _productName; + String get returnCode => _returnCode; + int get returnStatus => _returnStatus; + int get returnType => _returnType; + int get sellPrice => _sellPrice; + int get skuId => _skuId; + String get skuImg => _skuImg; + String get skuNameStr => _skuNameStr; + + + set actInfo(ActInfo value) { + _actInfo = value; + } + + Map toJson() { + final map = {}; + if (_actInfo != null) { + map['actInfo'] = _actInfo.toJson(); + } + if (_additionalComment != null) { + map['additionalComment'] = _additionalComment.toJson(); + } + map['buyNum'] = _buyNum; + map['canApplyIntervention'] = _canApplyIntervention; + if (_comment != null) { + map['comment'] = _comment.toJson(); + } + map['commentStatus'] = _commentStatus; + map['discountAmount'] = _discountAmount; + map['id'] = _id; + map['productId'] = _productId; + map['productName'] = _productName; + map['returnCode'] = _returnCode; + map['returnStatus'] = _returnStatus; + map['returnType'] = _returnType; + map['sellPrice'] = _sellPrice; + map['skuId'] = _skuId; + map['skuImg'] = _skuImg; + map['skuNameStr'] = _skuNameStr; + return map; + } + + set additionalComment(AdditionalComment value) { + _additionalComment = value; + } + + set buyNum(int value) { + _buyNum = value; + } + + set canApplyIntervention(int value) { + _canApplyIntervention = value; + } + + set comment(Comment value) { + _comment = value; + } + + set commentStatus(int value) { + _commentStatus = value; + } + + set discountAmount(int value) { + _discountAmount = value; + } + + set id(int value) { + _id = value; + } + + set productId(int value) { + _productId = value; + } + + set productName(String value) { + _productName = value; + } + + set returnCode(String value) { + _returnCode = value; + } + + set returnStatus(int value) { + _returnStatus = value; + } + + set returnType(int value) { + _returnType = value; + } + + set sellPrice(int value) { + _sellPrice = value; + } + + set skuId(int value) { + _skuId = value; + } + + set skuImg(String value) { + _skuImg = value; + } + + set skuNameStr(String value) { + _skuNameStr = value; + } +} + +/// bizType : 0 +/// commentImgs : "" +/// commentImgsFlag : true +/// commentStar : 0 +/// commentText : "" +/// descStar : 0 +/// hideFlag : true +/// id : 0 +/// isDelete : true +/// likeNum : 0 +/// logisticsStar : 0 +/// mid : 0 +/// orderProductId : 0 +/// parentId : 0 +/// productId : 0 +/// sensitiveFlag : true +/// serviceStar : 0 +/// storeId : 0 + +class Comment { + Comment({ + int bizType, + String commentImgs, + bool commentImgsFlag, + int commentStar, + String commentText, + int descStar, + bool hideFlag, + int id, + bool isDelete, + int likeNum, + int logisticsStar, + int mid, + int orderProductId, + int parentId, + int productId, + bool sensitiveFlag, + int serviceStar, + int storeId,}){ + _bizType = bizType; + _commentImgs = commentImgs; + _commentImgsFlag = commentImgsFlag; + _commentStar = commentStar; + _commentText = commentText; + _descStar = descStar; + _hideFlag = hideFlag; + _id = id; + _isDelete = isDelete; + _likeNum = likeNum; + _logisticsStar = logisticsStar; + _mid = mid; + _orderProductId = orderProductId; + _parentId = parentId; + _productId = productId; + _sensitiveFlag = sensitiveFlag; + _serviceStar = serviceStar; + _storeId = storeId; +} + + Comment.fromJson(dynamic json) { + _bizType = json['bizType']; + _commentImgs = json['commentImgs']; + _commentImgsFlag = json['commentImgsFlag']; + _commentStar = json['commentStar']; + _commentText = json['commentText']; + _descStar = json['descStar']; + _hideFlag = json['hideFlag']; + _id = json['id']; + _isDelete = json['isDelete']; + _likeNum = json['likeNum']; + _logisticsStar = json['logisticsStar']; + _mid = json['mid']; + _orderProductId = json['orderProductId']; + _parentId = json['parentId']; + _productId = json['productId']; + _sensitiveFlag = json['sensitiveFlag']; + _serviceStar = json['serviceStar']; + _storeId = json['storeId']; + } + int _bizType; + String _commentImgs; + bool _commentImgsFlag; + int _commentStar; + String _commentText; + int _descStar; + bool _hideFlag; + int _id; + bool _isDelete; + int _likeNum; + int _logisticsStar; + int _mid; + int _orderProductId; + int _parentId; + int _productId; + bool _sensitiveFlag; + int _serviceStar; + int _storeId; + + int get bizType => _bizType; + String get commentImgs => _commentImgs; + bool get commentImgsFlag => _commentImgsFlag; + int get commentStar => _commentStar; + String get commentText => _commentText; + int get descStar => _descStar; + bool get hideFlag => _hideFlag; + int get id => _id; + bool get isDelete => _isDelete; + int get likeNum => _likeNum; + int get logisticsStar => _logisticsStar; + int get mid => _mid; + int get orderProductId => _orderProductId; + int get parentId => _parentId; + int get productId => _productId; + bool get sensitiveFlag => _sensitiveFlag; + int get serviceStar => _serviceStar; + int get storeId => _storeId; + + + set bizType(int value) { + _bizType = value; + } + + Map toJson() { + final map = {}; + map['bizType'] = _bizType; + map['commentImgs'] = _commentImgs; + map['commentImgsFlag'] = _commentImgsFlag; + map['commentStar'] = _commentStar; + map['commentText'] = _commentText; + map['descStar'] = _descStar; + map['hideFlag'] = _hideFlag; + map['id'] = _id; + map['isDelete'] = _isDelete; + map['likeNum'] = _likeNum; + map['logisticsStar'] = _logisticsStar; + map['mid'] = _mid; + map['orderProductId'] = _orderProductId; + map['parentId'] = _parentId; + map['productId'] = _productId; + map['sensitiveFlag'] = _sensitiveFlag; + map['serviceStar'] = _serviceStar; + map['storeId'] = _storeId; + return map; + } + + set commentImgs(String value) { + _commentImgs = value; + } + + set commentImgsFlag(bool value) { + _commentImgsFlag = value; + } + + set commentStar(int value) { + _commentStar = value; + } + + set commentText(String value) { + _commentText = value; + } + + set descStar(int value) { + _descStar = value; + } + + set hideFlag(bool value) { + _hideFlag = value; + } + + set id(int value) { + _id = value; + } + + set isDelete(bool value) { + _isDelete = value; + } + + set likeNum(int value) { + _likeNum = value; + } + + set logisticsStar(int value) { + _logisticsStar = value; + } + + set mid(int value) { + _mid = value; + } + + set orderProductId(int value) { + _orderProductId = value; + } + + set parentId(int value) { + _parentId = value; + } + + set productId(int value) { + _productId = value; + } + + set sensitiveFlag(bool value) { + _sensitiveFlag = value; + } + + set serviceStar(int value) { + _serviceStar = value; + } + + set storeId(int value) { + _storeId = value; + } +} + +/// bizType : 0 +/// commentImgs : "" +/// commentImgsFlag : true +/// commentStar : 0 +/// commentText : "" +/// descStar : 0 +/// hideFlag : true +/// id : 0 +/// isDelete : true +/// likeNum : 0 +/// logisticsStar : 0 +/// mid : 0 +/// orderProductId : 0 +/// parentId : 0 +/// productId : 0 +/// sensitiveFlag : true +/// serviceStar : 0 +/// storeId : 0 + +class AdditionalComment { + AdditionalComment({ + int bizType, + String commentImgs, + bool commentImgsFlag, + int commentStar, + String commentText, + int descStar, + bool hideFlag, + int id, + bool isDelete, + int likeNum, + int logisticsStar, + int mid, + int orderProductId, + int parentId, + int productId, + bool sensitiveFlag, + int serviceStar, + int storeId,}){ + _bizType = bizType; + _commentImgs = commentImgs; + _commentImgsFlag = commentImgsFlag; + _commentStar = commentStar; + _commentText = commentText; + _descStar = descStar; + _hideFlag = hideFlag; + _id = id; + _isDelete = isDelete; + _likeNum = likeNum; + _logisticsStar = logisticsStar; + _mid = mid; + _orderProductId = orderProductId; + _parentId = parentId; + _productId = productId; + _sensitiveFlag = sensitiveFlag; + _serviceStar = serviceStar; + _storeId = storeId; +} + + AdditionalComment.fromJson(dynamic json) { + _bizType = json['bizType']; + _commentImgs = json['commentImgs']; + _commentImgsFlag = json['commentImgsFlag']; + _commentStar = json['commentStar']; + _commentText = json['commentText']; + _descStar = json['descStar']; + _hideFlag = json['hideFlag']; + _id = json['id']; + _isDelete = json['isDelete']; + _likeNum = json['likeNum']; + _logisticsStar = json['logisticsStar']; + _mid = json['mid']; + _orderProductId = json['orderProductId']; + _parentId = json['parentId']; + _productId = json['productId']; + _sensitiveFlag = json['sensitiveFlag']; + _serviceStar = json['serviceStar']; + _storeId = json['storeId']; + } + int _bizType; + String _commentImgs; + bool _commentImgsFlag; + int _commentStar; + String _commentText; + int _descStar; + bool _hideFlag; + int _id; + bool _isDelete; + int _likeNum; + int _logisticsStar; + int _mid; + int _orderProductId; + int _parentId; + int _productId; + bool _sensitiveFlag; + int _serviceStar; + int _storeId; + + int get bizType => _bizType; + String get commentImgs => _commentImgs; + bool get commentImgsFlag => _commentImgsFlag; + int get commentStar => _commentStar; + String get commentText => _commentText; + int get descStar => _descStar; + bool get hideFlag => _hideFlag; + int get id => _id; + bool get isDelete => _isDelete; + int get likeNum => _likeNum; + int get logisticsStar => _logisticsStar; + int get mid => _mid; + int get orderProductId => _orderProductId; + int get parentId => _parentId; + int get productId => _productId; + bool get sensitiveFlag => _sensitiveFlag; + int get serviceStar => _serviceStar; + int get storeId => _storeId; + + + set bizType(int value) { + _bizType = value; + } + + Map toJson() { + final map = {}; + map['bizType'] = _bizType; + map['commentImgs'] = _commentImgs; + map['commentImgsFlag'] = _commentImgsFlag; + map['commentStar'] = _commentStar; + map['commentText'] = _commentText; + map['descStar'] = _descStar; + map['hideFlag'] = _hideFlag; + map['id'] = _id; + map['isDelete'] = _isDelete; + map['likeNum'] = _likeNum; + map['logisticsStar'] = _logisticsStar; + map['mid'] = _mid; + map['orderProductId'] = _orderProductId; + map['parentId'] = _parentId; + map['productId'] = _productId; + map['sensitiveFlag'] = _sensitiveFlag; + map['serviceStar'] = _serviceStar; + map['storeId'] = _storeId; + return map; + } + + set commentImgs(String value) { + _commentImgs = value; + } + + set commentImgsFlag(bool value) { + _commentImgsFlag = value; + } + + set commentStar(int value) { + _commentStar = value; + } + + set commentText(String value) { + _commentText = value; + } + + set descStar(int value) { + _descStar = value; + } + + set hideFlag(bool value) { + _hideFlag = value; + } + + set id(int value) { + _id = value; + } + + set isDelete(bool value) { + _isDelete = value; + } + + set likeNum(int value) { + _likeNum = value; + } + + set logisticsStar(int value) { + _logisticsStar = value; + } + + set mid(int value) { + _mid = value; + } + + set orderProductId(int value) { + _orderProductId = value; + } + + set parentId(int value) { + _parentId = value; + } + + set productId(int value) { + _productId = value; + } + + set sensitiveFlag(bool value) { + _sensitiveFlag = value; + } + + set serviceStar(int value) { + _serviceStar = value; + } + + set storeId(int value) { + _storeId = value; + } +} + +/// couponDiscountAmount : 0 +/// couponDiscountRate : 0 +/// couponId : 0 +/// couponType : 0 +/// discountAmount : 0 +/// discountRate : 0 +/// promotionId : 0 +/// promotionType : 0 + +class ActInfo { + ActInfo({ + int couponDiscountAmount, + int couponDiscountRate, + int couponId, + int couponType, + int discountAmount, + int discountRate, + int promotionId, + int promotionType,}){ + _couponDiscountAmount = couponDiscountAmount; + _couponDiscountRate = couponDiscountRate; + _couponId = couponId; + _couponType = couponType; + _discountAmount = discountAmount; + _discountRate = discountRate; + _promotionId = promotionId; + _promotionType = promotionType; +} + + ActInfo.fromJson(dynamic json) { + _couponDiscountAmount = json['couponDiscountAmount']; + _couponDiscountRate = json['couponDiscountRate']; + _couponId = json['couponId']; + _couponType = json['couponType']; + _discountAmount = json['discountAmount']; + _discountRate = json['discountRate']; + _promotionId = json['promotionId']; + _promotionType = json['promotionType']; + } + int _couponDiscountAmount; + int _couponDiscountRate; + int _couponId; + int _couponType; + int _discountAmount; + int _discountRate; + int _promotionId; + int _promotionType; + + int get couponDiscountAmount => _couponDiscountAmount; + int get couponDiscountRate => _couponDiscountRate; + int get couponId => _couponId; + int get couponType => _couponType; + int get discountAmount => _discountAmount; + int get discountRate => _discountRate; + int get promotionId => _promotionId; + int get promotionType => _promotionType; + + + set couponDiscountAmount(int value) { + _couponDiscountAmount = value; + } + + Map toJson() { + final map = {}; + map['couponDiscountAmount'] = _couponDiscountAmount; + map['couponDiscountRate'] = _couponDiscountRate; + map['couponId'] = _couponId; + map['couponType'] = _couponType; + map['discountAmount'] = _discountAmount; + map['discountRate'] = _discountRate; + map['promotionId'] = _promotionId; + map['promotionType'] = _promotionType; + return map; + } + + set couponDiscountRate(int value) { + _couponDiscountRate = value; + } + + set couponId(int value) { + _couponId = value; + } + + set couponType(int value) { + _couponType = value; + } + + set discountAmount(int value) { + _discountAmount = value; + } + + set discountRate(int value) { + _discountRate = value; + } + + set promotionId(int value) { + _promotionId = value; + } + + set promotionType(int value) { + _promotionType = value; + } +} \ No newline at end of file diff --git a/lib/retrofit/data/shoppingCart.dart b/lib/retrofit/data/shoppingCart.dart index 72673c63..fb69d382 100644 --- a/lib/retrofit/data/shoppingCart.dart +++ b/lib/retrofit/data/shoppingCart.dart @@ -62,14 +62,15 @@ class ShoppingCartSkuItemListBean { int groupId; int id; List platterList; - int productId; + String productId; String productName; + String skuId; int selected; String skuImg; String skuName; int skuPrice; int skuStock; - int storeId; + String storeId; int tableId; static ShoppingCartSkuItemListBean fromJson(Map map) { @@ -83,6 +84,7 @@ class ShoppingCartSkuItemListBean { (map['platterList'] as List ?? []).map((o) => PlatterListBean.fromJson(o)) ); shoppingCartSkuItemListBean.productId = map['productId']; + shoppingCartSkuItemListBean.skuId = map['skuId']; shoppingCartSkuItemListBean.productName = map['productName']; shoppingCartSkuItemListBean.selected = map['selected']; shoppingCartSkuItemListBean.skuImg = map['skuImg']; @@ -101,6 +103,7 @@ class ShoppingCartSkuItemListBean { "id": id, "platterList": platterList, "productId": productId, + "skuId": skuId, "productName": productName, "selected": selected, "skuImg": skuImg, diff --git a/lib/retrofit/min_api.dart b/lib/retrofit/min_api.dart index e2c9400d..53d6ccc9 100644 --- a/lib/retrofit/min_api.dart +++ b/lib/retrofit/min_api.dart @@ -8,6 +8,8 @@ import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/retrofit/data/base_data.dart'; +import 'package:huixiang/retrofit/data/placeOrderFirst.dart'; +import 'package:huixiang/retrofit/data/settlement_bean.dart'; import 'package:huixiang/view_widget/login_tips_dialog.dart'; import 'package:retrofit/retrofit.dart'; @@ -146,4 +148,14 @@ abstract class MinApiService { @POST("order/getOrderInfo") Future> getOrderInfo( @Body() Map param); + + + ///小程序下单 + @POST("order/placeOrderFirst") + Future placeOrderFirst(@Body() Map param); + + + /// 结算 + @POST("order/settlement") + Future settlementApi(@Body() Map param); } diff --git a/lib/retrofit/min_api.g.dart b/lib/retrofit/min_api.g.dart index 0ca13580..dbd499fb 100644 --- a/lib/retrofit/min_api.g.dart +++ b/lib/retrofit/min_api.g.dart @@ -108,4 +108,51 @@ class _MinApiService implements MinApiService { ); return value; } + + @override + Future> placeOrderFirst(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>( + 'order/placeOrderFirst', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => json as dynamic, + ); + return value; + } + + @override + Future> settlementApi(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>( + 'order/settlement', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => json as dynamic, + ); + return value; + } + } diff --git a/lib/store/store_order.dart b/lib/store/store_order.dart index 7c80989c..6c341117 100644 --- a/lib/store/store_order.dart +++ b/lib/store/store_order.dart @@ -554,6 +554,21 @@ class _StoreOrderPage extends State }, ); if (result != null) { + result["name"] = miNiDetail.productName; + miNiDetail.productSkuVOList.forEach((e0) { + String attr1 = ""; + String attr2 = ""; + e0.skuAttrList.forEach((e2) { + attr1 += e2.attrValueId; + }); + (result["attr"] as List).forEach((e1) { + attr2 += e1["attrValue"]; + }); + if(attr1 == attr2){ + result["skuId"] = e0.id; + return; + } + }); if (shopCarGoods == null || shopCarGoods.length == 0) { shopCarGoods = []; shopCarGoods.add(result); diff --git a/lib/store/store_view/product_sku.dart b/lib/store/store_view/product_sku.dart index a29793d4..92706b81 100644 --- a/lib/store/store_view/product_sku.dart +++ b/lib/store/store_view/product_sku.dart @@ -152,6 +152,14 @@ class _ProductSku extends State { if (tempSelected["attr"] == null) { tempSelected["attr"] = []; } + bool flag = false; + (tempSelected["attr"] as List).forEach((e0) { + if(e0["attrId"] == widget.miNiDetail.attrList[position].id){ + e0["attrValue"] = widget.miNiDetail.attrList[position].attrValueList[index].id; + flag = true; + } + }); + if(!flag) (tempSelected["attr"] as List).add({ "attrId": "${widget.miNiDetail.attrList[position].id}", "attrValue": "${widget.miNiDetail.attrList[position].attrValueList[index].id}", diff --git a/lib/store/store_view/settlement.dart b/lib/store/store_view/settlement.dart index f736db94..26fd33a2 100644 --- a/lib/store/store_view/settlement.dart +++ b/lib/store/store_view/settlement.dart @@ -6,10 +6,11 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/retrofit/data/base_data.dart'; -import 'package:huixiang/retrofit/data/coupon.dart'; import 'package:huixiang/retrofit/data/findMiNiGroupList.dart'; -import 'package:huixiang/retrofit/data/order_info.dart'; +import 'package:huixiang/retrofit/data/placeOrderFirst.dart'; import 'package:huixiang/retrofit/data/settleOrderInfo.dart'; +import 'package:huixiang/retrofit/data/settlement_bean.dart'; +import 'package:huixiang/retrofit/data/shoppingCart.dart'; import 'package:huixiang/retrofit/data/store_info.dart'; import 'package:huixiang/retrofit/min_api.dart'; import 'package:huixiang/store/store_view/settlement_order_commodity.dart'; @@ -34,10 +35,7 @@ class Settlement extends StatefulWidget { class _Settlement extends State { MinApiService minService; int selectedBtn = 0; - Coupon coupon; Function(int type) callback; - GestureTapCallback callbackEx; - int isSelected = 0; StoreInfo storeInfo; List shopCar = []; List> shopCarGoods = []; @@ -90,15 +88,151 @@ class _Settlement extends State { } } + ///小程序下单 + queryPlaceOrderFirst() async { + PlaceOrderFirst placeOrderFirst = PlaceOrderFirst(); + placeOrderFirst.addressId = null; + placeOrderFirst.isSubscribe = false; + placeOrderFirst.isTakeOut = 0; + placeOrderFirst.notes = ""; + placeOrderFirst.numberOfPeople = null; + placeOrderFirst.orderSource = 0; + placeOrderFirst.orderType = 0; + placeOrderFirst.orderTypeId = 0; + placeOrderFirst.parentCode = ""; + placeOrderFirst.parentId = 0; + placeOrderFirst.payChannel = 1; + placeOrderFirst.promotionInfoDTO = PlaceOrderFirstPromotionInfoDTO(); + placeOrderFirst.promotionInfoDTO.couponId = selectedCouponIndex == -1?null : settleOrderInfo.couponList[selectedCouponIndex].couponId; + placeOrderFirst.promotionInfoDTO.promotionId = "0"; + placeOrderFirst.recMobile = storeInfo.headMobile; + placeOrderFirst.shoppingCartSkuItemList = []; + placeOrderFirst.skuItemDTOList = []; + shopCarGoods.forEach((e0) { + SkuItemDTOList skuItemDTOListBean = SkuItemDTOList(); + skuItemDTOListBean.skuId = e0["skuId"]; + skuItemDTOListBean.buyNum = e0["count"]; + PlatterList platterListBean = PlatterList(); + platterListBean.skuId = e0["skuId"]; + platterListBean.productId = e0["id"]; + skuItemDTOListBean.platterList = []; + skuItemDTOListBean.platterList.add(platterListBean); + placeOrderFirst.skuItemDTOList.add(skuItemDTOListBean); + ShoppingCartSkuItemListBean shoppingCartSkuItemListBean = ShoppingCartSkuItemListBean(); + shoppingCartSkuItemListBean.buyNum = e0["count"]; + shoppingCartSkuItemListBean.productId = e0["id"]; + shoppingCartSkuItemListBean.productName = e0["name"]; + shoppingCartSkuItemListBean.skuId = e0["skuId"]; + placeOrderFirst.shoppingCartSkuItemList.add(shoppingCartSkuItemListBean); + }); + placeOrderFirst.source = 1; + placeOrderFirst.storeId = storeInfo.id; + placeOrderFirst.subcribeTime = null; + placeOrderFirst.tableId = 0; + BaseData baseData = await minService.placeOrderFirst( + placeOrderFirst.toJson()).catchError((error) {}); + if (baseData != null && baseData.isSuccess) { + querySettlement(); + } + } + + ///结算 + querySettlement() async { + SettlementBean settlementBean = SettlementBean(); + settlementBean.addressId = 0; + settlementBean.buyNum = 0; + settlementBean.id = 0; + settlementBean.isLogistics = true; + settlementBean.orderProductVOList = []; + shopCarGoods.forEach((e0) { + OrderProductVOList orderProductVOListBean = OrderProductVOList(); + orderProductVOListBean.skuId = e0["skuId"]; + orderProductVOListBean.buyNum = e0["count"]; + ActInfo actInfoBean = ActInfo(); + actInfoBean.couponDiscountAmount = 0; + actInfoBean.couponDiscountRate = 0; + actInfoBean.couponId = 0; + actInfoBean.couponType = 0; + actInfoBean.discountAmount = 0; + actInfoBean.discountRate = 0; + actInfoBean.promotionId = 0; + actInfoBean.promotionType = 0; + AdditionalComment additionalCommentBean = AdditionalComment(); + additionalCommentBean.bizType = 0; + additionalCommentBean.commentImgs = ""; + additionalCommentBean.commentImgsFlag = false; + additionalCommentBean.commentStar = 0; + additionalCommentBean.commentText = ""; + additionalCommentBean.descStar = 0; + additionalCommentBean.hideFlag = true; + additionalCommentBean.id = 0; + additionalCommentBean.isDelete = true; + additionalCommentBean.likeNum = 0; + additionalCommentBean.logisticsStar = 0; + additionalCommentBean.mid = 0; + additionalCommentBean.orderProductId = 0; + additionalCommentBean.parentId = 0; + additionalCommentBean.productId = 0; + additionalCommentBean.sensitiveFlag = true; + additionalCommentBean.serviceStar = 0; + additionalCommentBean.storeId = 0; + settlementBean.buyNum = 0; + Comment commentBean = Comment(); + commentBean.bizType = 0; + commentBean.commentImgs = ""; + commentBean.commentImgsFlag = true; + commentBean.commentStar = 0; + commentBean.commentText = ""; + commentBean.descStar = 0; + commentBean.hideFlag = true; + commentBean.id = 0; + commentBean.isDelete = true; + commentBean.logisticsStar = 0; + commentBean.mid = 0; + commentBean.orderProductId = 0; + commentBean.parentId = 0; + commentBean.productId = 0; + commentBean.sensitiveFlag = true; + commentBean.serviceStar = 0; + commentBean.storeId = 0; + orderProductVOListBean.commentStatus = 0; + orderProductVOListBean.discountAmount = 0; + orderProductVOListBean.id = 0; + orderProductVOListBean.productId = 0; + orderProductVOListBean.productName = ""; + orderProductVOListBean.returnCode = ""; + orderProductVOListBean.returnStatus = 0; + orderProductVOListBean.returnType = 0; + orderProductVOListBean.sellPrice = 0; + orderProductVOListBean.skuId = 0; + orderProductVOListBean.skuImg = ""; + orderProductVOListBean.skuNameStr = ""; + settlementBean.orderProductVOList.add(orderProductVOListBean); + }); + settlementBean.payChannel = 0; + settlementBean.promotionInfoDTO = PromotionInfoDTO(); + settlementBean.promotionInfoDTO.couponId = 0; + settlementBean.promotionInfoDTO.promotionId = 0; + BaseData baseData = await minService.settlementApi({ + }).catchError((error) {}); + if (baseData != null && baseData.isSuccess) { + + } + } + bool isEdit = false; - String totalPrice() { + String totalPrice(bool discountFlag) { if (shopCarGoods == null) return ""; double totalPrice = 0; shopCarGoods.forEach((element) { totalPrice += double.tryParse(element["price"]) * element["count"]; }); - return "$totalPrice"; + if(selectedCouponIndex != -1 && discountFlag){ + double discountA = double.parse(settleOrderInfo.couponList[selectedCouponIndex].discountAmount); + totalPrice -= discountA; + } + return totalPrice.toStringAsFixed(2); } @override @@ -268,7 +402,7 @@ class _Settlement extends State { left: 0, right: 0, top:0, - bottom:0, + bottom:55, ), Positioned( bottom:0, @@ -290,7 +424,7 @@ class _Settlement extends State { ), ), Text( - totalPrice(), + totalPrice(true), style: TextStyle( fontSize: 20.sp, fontWeight: MyFontWeight.semi_bold, @@ -301,7 +435,9 @@ class _Settlement extends State { width: 28, ), GestureDetector( - onTap: () {}, + onTap: () { + queryPlaceOrderFirst(); + }, child: RoundButton( width: 103.w, height: 54.h, @@ -552,10 +688,16 @@ class _Settlement extends State { color: Color(0xFF4C4C4C), ), ), - ), - Icon( - Icons.keyboard_arrow_right, - size: 24, + ), InkWell( + onTap: () { + setState(() { + Navigator.of(context).popAndPushNamed('/router/manage_address_page'); + }); + }, + child:Icon( + Icons.keyboard_arrow_right, + size: 24, + ), ), ], ), @@ -864,20 +1006,12 @@ class _Settlement extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - "可用优惠券", - style: TextStyle( - color: Color(0xFF000000), - fontSize: 14.sp, - fontWeight: MyFontWeight.medium, - ), - ), - SizedBox( - width: 4, - ), Expanded( child: Text( - "(1)", + (settleOrderInfo?.couponList == null || settleOrderInfo.couponList.length == 0) + ? "暂无可用优惠券" : (selectedCouponIndex == -1 + ? "拥有${settleOrderInfo.couponList.length}张优惠券": + settleOrderInfo.couponList[selectedCouponIndex].promotionName), style: TextStyle( color: Color(0xFF000000), fontSize: 14.sp, @@ -906,13 +1040,13 @@ class _Settlement extends State { right: 16, ), child: ListView.builder( - itemCount: 5, + itemCount:settleOrderInfo == null ? 0 : settleOrderInfo.couponList.length, physics: BouncingScrollPhysics(), itemBuilder: (context, position) { // return shoppGoodsItem(); return GestureDetector( onTap: () {}, - child: couponItem(position), + child: couponItem(settleOrderInfo.couponList[position],position), ); }, ), @@ -927,7 +1061,7 @@ class _Settlement extends State { } ///优惠券列表 - Widget couponItem(int index) { + Widget couponItem(CouponListBean couponList,int index) { return StatefulBuilder(builder: (context1, state) { return Container( height: 170, @@ -979,7 +1113,7 @@ class _Settlement extends State { height: 4.h, ), Text( - "5", + couponList.discountAmount, style: TextStyle( fontSize: 40.sp, fontWeight: MyFontWeight.semi_bold, @@ -990,7 +1124,7 @@ class _Settlement extends State { ), ), Text( - S.of(context).manyuankeyong(30), + S.of(context).manyuankeyong(couponList.fullAmount), style: TextStyle( fontSize: 12.sp, fontWeight: MyFontWeight.semi_bold, @@ -1033,7 +1167,7 @@ class _Settlement extends State { ), Expanded( child: Text( - "百年川椒火锅店", + storeInfo.storeName, overflow: TextOverflow.ellipsis, style: TextStyle( fontSize: 16.sp, @@ -1046,7 +1180,7 @@ class _Settlement extends State { ], ), Text( - "#新客户满减优惠#", + couponList.promotionName, overflow: TextOverflow.ellipsis, style: TextStyle( fontSize: 14.sp, @@ -1068,12 +1202,27 @@ class _Settlement extends State { margin: EdgeInsets.only(right: 23.w), child: GestureDetector( onTap: () { - state(() { - isSelected = index; + setState(() { + // if (!couponList.usable){ + // SmartDialog.showToast("当前优惠券不可用", alignment: Alignment.center); + // return; + // } + double toPrice = double.parse(totalPrice(false)); + double amount = double.parse(couponList.fullAmount); + if(toPrice <= amount){ + SmartDialog.showToast("当前金额不够使用优惠券", alignment: Alignment.center); + return; + } + state(() { + if(selectedCouponIndex == index) + selectedCouponIndex = -1; + else {selectedCouponIndex = index;} + }); + Navigator.of(context).pop(); }); }, child: Image.asset( - isSelected != index + selectedCouponIndex != index ? "assets/image/icon_radio_unselected.png" : "assets/image/icon_radio_selected.png", width: 24, @@ -1089,7 +1238,7 @@ class _Settlement extends State { ], ), ), - flex: (coupon != null && coupon.isEx) ? 97 : 97, + flex: (couponList?.isEx??false) ? 97 : 97, ), Container( padding: EdgeInsets.symmetric(horizontal: 23.w), @@ -1100,7 +1249,7 @@ class _Settlement extends State { ), ), Expanded( - flex: (coupon != null && coupon.isEx) ? 56 : 42, + flex: (couponList?.isEx??false) ? 56 : 42, child: Container( margin: EdgeInsets.symmetric(horizontal: 23.w, vertical: 8.h), child: Column( @@ -1119,17 +1268,23 @@ class _Settlement extends State { ), GestureDetector( child: Icon( - (coupon != null && !coupon.isEx) + (!(couponList?.isEx??false)) ? Icons.keyboard_arrow_down : Icons.keyboard_arrow_up, color: Colors.black, size: 18, ), //点击按钮布局 - onTap: callbackEx, + onTap: (){ + setState(() { + state((){ + this.settleOrderInfo.couponList[index].isEx = !(this.settleOrderInfo.couponList[index].isEx??false); + }); + }); + }, ), ], ), - if (coupon != null && coupon.isEx) + if (couponList?.isEx??false) Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -1141,10 +1296,10 @@ class _Settlement extends State { ), ), Text( - (coupon.useStartTime == null && - coupon.useEndTime == null) + (couponList.useStartTime == null && + couponList.useEndTime == null) ? S.of(context).quantian - : "${coupon.useStartTime.replaceAll("-", ".").split(" ")[0]} - ${coupon.useEndTime.replaceAll("-", ".").split(" ")[0]}", + : "${couponList.useStartTime.replaceAll("-", ".").split(" ")[0]} - ${couponList.useEndTime.replaceAll("-", ".").split(" ")[0]}", style: TextStyle( color: Color(0xFF353535), fontSize: 10.sp,