From a7440a3c1eeb110e8bd95e38dffb89f18b561c3e Mon Sep 17 00:00:00 2001 From: w-R <953969641@qq.com> Date: Sat, 16 Oct 2021 11:55:44 +0800 Subject: [PATCH 1/5] =?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/home/home_view/featured_acticvity.dart | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/home/home_view/featured_acticvity.dart b/lib/home/home_view/featured_acticvity.dart index 057a0056..938bc807 100644 --- a/lib/home/home_view/featured_acticvity.dart +++ b/lib/home/home_view/featured_acticvity.dart @@ -32,7 +32,7 @@ class _FeaturedActivity extends State { Container( child: stackItem(18.sp), margin: EdgeInsets.symmetric(horizontal: 5.w), - width: (MediaQuery.of(context).size.width - 42) / 2, + width: (MediaQuery.of(context).size.width - 42) /2, height: 180.h, decoration: BoxDecoration( borderRadius: BorderRadius.circular(4), @@ -52,7 +52,7 @@ class _FeaturedActivity extends State { Container( child: stackItem(14.sp), margin: EdgeInsets.symmetric(horizontal: 5.w), - width: (MediaQuery.of(context).size.width - 42) / 2, + width: (MediaQuery.of(context).size.width - 42) /2, height: 170.h / 2, decoration: BoxDecoration( borderRadius: BorderRadius.circular(4), @@ -65,9 +65,7 @@ class _FeaturedActivity extends State { ), ), ), - SizedBox( - height: 10.h, - ), + Container( child: stackItem(14.sp), margin: EdgeInsets.symmetric(horizontal: 5.w), From 3d3723b76f32116d210bc80b954dc8adbca49642 Mon Sep 17 00:00:00 2001 From: w-R <953969641@qq.com> Date: Sat, 16 Oct 2021 13:36:02 +0800 Subject: [PATCH 2/5] =?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/store/store_view/settlement.dart | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/store/store_view/settlement.dart b/lib/store/store_view/settlement.dart index 8bd6918b..29e8e7b1 100644 --- a/lib/store/store_view/settlement.dart +++ b/lib/store/store_view/settlement.dart @@ -3,11 +3,8 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:huixiang/generated/l10n.dart'; -import 'package:huixiang/order/order_view/order_commodity.dart'; -import 'package:huixiang/order/order_view/order_info.dart'; import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/coupon.dart'; -import 'package:huixiang/retrofit/data/order_info.dart'; import 'package:huixiang/retrofit/data/settleOrderInfo.dart'; import 'package:huixiang/retrofit/data/store_info.dart'; import 'package:huixiang/retrofit/min_api.dart'; @@ -66,8 +63,7 @@ class _Settlement extends State { "addressId": null, "isTake": 0, "memberCouponId": null, - // "orderId": widget.arguments["orderId"], - "orderId": "1449199929208602624", + "orderId": 0, "promotionId": null }); if (baseData != null && baseData.isSuccess) { From c63f8d707df135425d01e5d46f9c36c732ce9282 Mon Sep 17 00:00:00 2001 From: w-R <953969641@qq.com> Date: Sat, 16 Oct 2021 14:03:45 +0800 Subject: [PATCH 3/5] =?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/retrofit/data/settleOrderInfo.dart | 453 ------------------ lib/retrofit/min_api.dart | 5 - lib/retrofit/min_api.g.dart | 23 +- lib/store/store_view/settlement.dart | 22 +- .../settlement_order_commodity.dart | 17 +- 5 files changed, 12 insertions(+), 508 deletions(-) delete mode 100644 lib/retrofit/data/settleOrderInfo.dart diff --git a/lib/retrofit/data/settleOrderInfo.dart b/lib/retrofit/data/settleOrderInfo.dart deleted file mode 100644 index 7e62c6b7..00000000 --- a/lib/retrofit/data/settleOrderInfo.dart +++ /dev/null @@ -1,453 +0,0 @@ - -class SettleOrderInfo { - int orderNum; - int productNum; - int mins; - dynamic memberVO; - String postAge; - String price; - String orderSum; - String discountAmount; - List promotionInfoList; - List couponList; - String threshold; - String freePostAge; - List orderProductList; - - static SettleOrderInfo fromJson(Map map) { - if (map == null) return null; - SettleOrderInfo settleOrderInfoBean = SettleOrderInfo(); - settleOrderInfoBean.orderNum = map['orderNum']; - settleOrderInfoBean.productNum = map['productNum']; - settleOrderInfoBean.mins = map['mins']; - settleOrderInfoBean.memberVO = map['memberVO']; - settleOrderInfoBean.postAge = map['postAge']; - settleOrderInfoBean.price = map['price']; - settleOrderInfoBean.orderSum = map['orderSum']; - settleOrderInfoBean.discountAmount = map['discountAmount']; - settleOrderInfoBean.promotionInfoList = List()..addAll( - (map['promotionInfoList'] as List ?? []).map((o) => PromotionInfoListBean.fromJson(o)) - ); - settleOrderInfoBean.couponList = List()..addAll( - (map['couponList'] as List ?? []).map((o) => CouponListBean.fromJson(o)) - ); - settleOrderInfoBean.threshold = map['threshold']; - settleOrderInfoBean.freePostAge = map['freePostAge']; - settleOrderInfoBean.orderProductList = List()..addAll( - (map['orderProductList'] as List ?? []).map((o) => OrderProductListBean.fromJson(o)) - ); - return settleOrderInfoBean; - } - - Map toJson() => { - "orderNum": orderNum, - "productNum": productNum, - "mins": mins, - "memberVO": memberVO, - "postAge": postAge, - "price": price, - "orderSum": orderSum, - "discountAmount": discountAmount, - "promotionInfoList": promotionInfoList, - "couponList": couponList, - "threshold": threshold, - "freePostAge": freePostAge, - "orderProductList": orderProductList, - }; -} - -/// id : null -/// createTime : null -/// createUser : null -/// updateTime : null -/// updateUser : null -/// tenantCode : null -/// storeId : null -/// orderId : null -/// actInfo : null -/// productId : "1426095718614958080" -/// productName : "ɣ�������̸�" -/// skuId : "1426095718740787200" -/// skuNameStr : "ɳ�� ������ 700ml" -/// skuImg : null -/// buyNum : 1 -/// refundNum : null -/// type : null -/// reason : null -/// weight : 0.0 -/// applyPrice : "28.00" -/// sellPrice : "28.00" -/// postPay : null -/// isDelete : null -/// discountAmount : null -/// discountPercent : null -/// status : null -/// batch : null - -class OrderProductListBean { - dynamic id; - dynamic createTime; - dynamic createUser; - dynamic updateTime; - dynamic updateUser; - dynamic tenantCode; - dynamic storeId; - dynamic orderId; - dynamic actInfo; - String productId; - String productName; - String skuId; - String skuNameStr; - dynamic skuImg; - int buyNum; - dynamic refundNum; - dynamic type; - dynamic reason; - double weight; - String applyPrice; - String sellPrice; - dynamic postPay; - dynamic isDelete; - dynamic discountAmount; - dynamic discountPercent; - dynamic status; - dynamic batch; - - static OrderProductListBean fromJson(Map map) { - if (map == null) return null; - OrderProductListBean orderProductListBean = OrderProductListBean(); - orderProductListBean.id = map['id']; - orderProductListBean.createTime = map['createTime']; - orderProductListBean.createUser = map['createUser']; - orderProductListBean.updateTime = map['updateTime']; - orderProductListBean.updateUser = map['updateUser']; - orderProductListBean.tenantCode = map['tenantCode']; - orderProductListBean.storeId = map['storeId']; - orderProductListBean.orderId = map['orderId']; - orderProductListBean.actInfo = map['actInfo']; - orderProductListBean.productId = map['productId']; - orderProductListBean.productName = map['productName']; - orderProductListBean.skuId = map['skuId']; - orderProductListBean.skuNameStr = map['skuNameStr']; - orderProductListBean.skuImg = map['skuImg']; - orderProductListBean.buyNum = map['buyNum']; - orderProductListBean.refundNum = map['refundNum']; - orderProductListBean.type = map['type']; - orderProductListBean.reason = map['reason']; - orderProductListBean.weight = map['weight']; - orderProductListBean.applyPrice = map['applyPrice']; - orderProductListBean.sellPrice = map['sellPrice']; - orderProductListBean.postPay = map['postPay']; - orderProductListBean.isDelete = map['isDelete']; - orderProductListBean.discountAmount = map['discountAmount']; - orderProductListBean.discountPercent = map['discountPercent']; - orderProductListBean.status = map['status']; - orderProductListBean.batch = map['batch']; - return orderProductListBean; - } - - Map toJson() => { - "id": id, - "createTime": createTime, - "createUser": createUser, - "updateTime": updateTime, - "updateUser": updateUser, - "tenantCode": tenantCode, - "storeId": storeId, - "orderId": orderId, - "actInfo": actInfo, - "productId": productId, - "productName": productName, - "skuId": skuId, - "skuNameStr": skuNameStr, - "skuImg": skuImg, - "buyNum": buyNum, - "refundNum": refundNum, - "type": type, - "reason": reason, - "weight": weight, - "applyPrice": applyPrice, - "sellPrice": sellPrice, - "postPay": postPay, - "isDelete": isDelete, - "discountAmount": discountAmount, - "discountPercent": discountPercent, - "status": status, - "batch": batch, - }; -} - -/// id : "1448907890034212864" -/// storeId : "1333246101343436800" -/// bizType : 1 -/// fullAmount : "10.00" -/// discountAmount : "8.00" -/// fullNumber : 1 -/// discountPercent : 100 -/// bizId : "" -/// publishStartTime : "2021-10-01" -/// publishEndTime : "2021-10-29" -/// useStartTime : "2021-10-02" -/// useEndTime : "2021-10-31" -/// promotionId : "0" -/// mid : "1438443365845696512" -/// couponId : "1448902034085380096" -/// receiveTime : "2021-10-15" -/// useTime : null -/// status : 1 -/// tenantCode : "1175" -/// type : 1 -/// promotionName : "��10-8" -/// usable : true -/// allProduct : true -/// productList : null - -class CouponListBean { - String id; - String storeId; - int bizType; - String fullAmount; - String discountAmount; - int fullNumber; - int discountPercent; - String bizId; - String publishStartTime; - String publishEndTime; - String useStartTime; - String useEndTime; - String promotionId; - String mid; - String couponId; - String receiveTime; - dynamic useTime; - int status; - String tenantCode; - int type; - String promotionName; - bool usable; - bool allProduct; - dynamic productList; - - static CouponListBean fromJson(Map map) { - if (map == null) return null; - CouponListBean couponListBean = CouponListBean(); - couponListBean.id = map['id']; - couponListBean.storeId = map['storeId']; - couponListBean.bizType = map['bizType']; - couponListBean.fullAmount = map['fullAmount']; - couponListBean.discountAmount = map['discountAmount']; - couponListBean.fullNumber = map['fullNumber']; - couponListBean.discountPercent = map['discountPercent']; - couponListBean.bizId = map['bizId']; - couponListBean.publishStartTime = map['publishStartTime']; - couponListBean.publishEndTime = map['publishEndTime']; - couponListBean.useStartTime = map['useStartTime']; - couponListBean.useEndTime = map['useEndTime']; - couponListBean.promotionId = map['promotionId']; - couponListBean.mid = map['mid']; - couponListBean.couponId = map['couponId']; - couponListBean.receiveTime = map['receiveTime']; - couponListBean.useTime = map['useTime']; - couponListBean.status = map['status']; - couponListBean.tenantCode = map['tenantCode']; - couponListBean.type = map['type']; - couponListBean.promotionName = map['promotionName']; - couponListBean.usable = map['usable']; - couponListBean.allProduct = map['allProduct']; - couponListBean.productList = map['productList']; - return couponListBean; - } - - Map toJson() => { - "id": id, - "storeId": storeId, - "bizType": bizType, - "fullAmount": fullAmount, - "discountAmount": discountAmount, - "fullNumber": fullNumber, - "discountPercent": discountPercent, - "bizId": bizId, - "publishStartTime": publishStartTime, - "publishEndTime": publishEndTime, - "useStartTime": useStartTime, - "useEndTime": useEndTime, - "promotionId": promotionId, - "mid": mid, - "couponId": couponId, - "receiveTime": receiveTime, - "useTime": useTime, - "status": status, - "tenantCode": tenantCode, - "type": type, - "promotionName": promotionName, - "usable": usable, - "allProduct": allProduct, - "productList": productList, - }; -} - -/// id : "1437254523520286720" -/// createTime : "2021-09-13 11:19:16" -/// createUser : "1333246101196636160" -/// updateTime : "2021-09-13 17:30:00" -/// updateUser : "0" -/// storeId : "1433719074906439680" -/// name : "�����ŵ�" -/// image : "https://pos.upload.gznl.top/1175/2021/09/44d60dab-0ae3-4d07-b624-50b8ab99d0fc.jpg" -/// description : "1" -/// status : 4 -/// applyStartTime : "2021-09-13 11:19:16" -/// applyEndTime : "2021-09-13 11:19:16" -/// activityStartTime : "2021-09-01 00:00:00" -/// activityEndTime : "2021-10-30 00:00:00" -/// doStartTime : null -/// doEndTime : null -/// isNeedSecurityDeposit : 0 -/// securityDeposit : "0" -/// tag : "11" -/// promotionType : 1 -/// promotionPlan : 0 -/// promotionDetail : [{"limitTime":"0","discountRate":"0","discountAmount":"0","fullAmount":"0","collageNumber":"0","fullNumber":"1"}] -/// channels : ["MINI","POS"] -/// isVip : false -/// isDelete : 0 -/// tenantCode : "1175" -/// canPartake : true -/// promotionProuctList : null - -class PromotionInfoListBean { - String id; - String createTime; - String createUser; - String updateTime; - String updateUser; - String storeId; - String name; - String image; - String description; - int status; - String applyStartTime; - String applyEndTime; - String activityStartTime; - String activityEndTime; - dynamic doStartTime; - dynamic doEndTime; - int isNeedSecurityDeposit; - String securityDeposit; - String tag; - int promotionType; - int promotionPlan; - List promotionDetail; - List channels; - bool isVip; - int isDelete; - String tenantCode; - bool canPartake; - dynamic promotionProuctList; - - static PromotionInfoListBean fromJson(Map map) { - if (map == null) return null; - PromotionInfoListBean promotionInfoListBean = PromotionInfoListBean(); - promotionInfoListBean.id = map['id']; - promotionInfoListBean.createTime = map['createTime']; - promotionInfoListBean.createUser = map['createUser']; - promotionInfoListBean.updateTime = map['updateTime']; - promotionInfoListBean.updateUser = map['updateUser']; - promotionInfoListBean.storeId = map['storeId']; - promotionInfoListBean.name = map['name']; - promotionInfoListBean.image = map['image']; - promotionInfoListBean.description = map['description']; - promotionInfoListBean.status = map['status']; - promotionInfoListBean.applyStartTime = map['applyStartTime']; - promotionInfoListBean.applyEndTime = map['applyEndTime']; - promotionInfoListBean.activityStartTime = map['activityStartTime']; - promotionInfoListBean.activityEndTime = map['activityEndTime']; - promotionInfoListBean.doStartTime = map['doStartTime']; - promotionInfoListBean.doEndTime = map['doEndTime']; - promotionInfoListBean.isNeedSecurityDeposit = map['isNeedSecurityDeposit']; - promotionInfoListBean.securityDeposit = map['securityDeposit']; - promotionInfoListBean.tag = map['tag']; - promotionInfoListBean.promotionType = map['promotionType']; - promotionInfoListBean.promotionPlan = map['promotionPlan']; - promotionInfoListBean.promotionDetail = List()..addAll( - (map['promotionDetail'] as List ?? []).map((o) => PromotionDetailBean.fromJson(o)) - ); - promotionInfoListBean.channels = List()..addAll( - (map['channels'] as List ?? []).map((o) => o.toString()) - ); - promotionInfoListBean.isVip = map['isVip']; - promotionInfoListBean.isDelete = map['isDelete']; - promotionInfoListBean.tenantCode = map['tenantCode']; - promotionInfoListBean.canPartake = map['canPartake']; - promotionInfoListBean.promotionProuctList = map['promotionProuctList']; - return promotionInfoListBean; - } - - Map toJson() => { - "id": id, - "createTime": createTime, - "createUser": createUser, - "updateTime": updateTime, - "updateUser": updateUser, - "storeId": storeId, - "name": name, - "image": image, - "description": description, - "status": status, - "applyStartTime": applyStartTime, - "applyEndTime": applyEndTime, - "activityStartTime": activityStartTime, - "activityEndTime": activityEndTime, - "doStartTime": doStartTime, - "doEndTime": doEndTime, - "isNeedSecurityDeposit": isNeedSecurityDeposit, - "securityDeposit": securityDeposit, - "tag": tag, - "promotionType": promotionType, - "promotionPlan": promotionPlan, - "promotionDetail": promotionDetail, - "channels": channels, - "isVip": isVip, - "isDelete": isDelete, - "tenantCode": tenantCode, - "canPartake": canPartake, - "promotionProuctList": promotionProuctList, - }; -} - -/// limitTime : "0" -/// discountRate : "0" -/// discountAmount : "0" -/// fullAmount : "0" -/// collageNumber : "0" -/// fullNumber : "1" - -class PromotionDetailBean { - String limitTime; - String discountRate; - String discountAmount; - String fullAmount; - String collageNumber; - String fullNumber; - - static PromotionDetailBean fromJson(Map map) { - if (map == null) return null; - PromotionDetailBean promotionDetailBean = PromotionDetailBean(); - promotionDetailBean.limitTime = map['limitTime']; - promotionDetailBean.discountRate = map['discountRate']; - promotionDetailBean.discountAmount = map['discountAmount']; - promotionDetailBean.fullAmount = map['fullAmount']; - promotionDetailBean.collageNumber = map['collageNumber']; - promotionDetailBean.fullNumber = map['fullNumber']; - return promotionDetailBean; - } - - Map toJson() => { - "limitTime": limitTime, - "discountRate": discountRate, - "discountAmount": discountAmount, - "fullAmount": fullAmount, - "collageNumber": collageNumber, - "fullNumber": fullNumber, - }; -} \ No newline at end of file diff --git a/lib/retrofit/min_api.dart b/lib/retrofit/min_api.dart index e97d7c93..97beb501 100644 --- a/lib/retrofit/min_api.dart +++ b/lib/retrofit/min_api.dart @@ -13,7 +13,6 @@ import 'package:retrofit/retrofit.dart'; import 'data/findMiNiGroupList.dart'; import 'data/miNiDetail.dart'; -import 'data/settleOrderInfo.dart'; import 'data/shoppingCart.dart'; part 'min_api.g.dart'; @@ -132,10 +131,6 @@ abstract class MinApiService { Future> shoppingCart( @Body() Map param,Map header); - ///订单结算信息 - @POST("order/getOrderInfo") - Future> getOrderInfo( - @Body() Map param); diff --git a/lib/retrofit/min_api.g.dart b/lib/retrofit/min_api.g.dart index 0ca13580..8c8ee6cc 100644 --- a/lib/retrofit/min_api.g.dart +++ b/lib/retrofit/min_api.g.dart @@ -86,26 +86,5 @@ class _MinApiService implements MinApiService { return value; } - @override - Future> getOrderInfo(param) async { - ArgumentError.checkNotNull(param, 'param'); - const _extra = {}; - final queryParameters = {}; - final _data = {}; - _data.addAll(param ?? {}); - final _result = await _dio.request>( - 'order/getOrderInfo', - queryParameters: queryParameters, - options: RequestOptions( - method: 'POST', - headers: {}, - extra: _extra, - baseUrl: baseUrl), - data: _data); - final value = BaseData.fromJson( - _result.data, - (json) => SettleOrderInfo.fromJson(json), - ); - return value; - } + } diff --git a/lib/store/store_view/settlement.dart b/lib/store/store_view/settlement.dart index 29e8e7b1..7b2e5abc 100644 --- a/lib/store/store_view/settlement.dart +++ b/lib/store/store_view/settlement.dart @@ -3,9 +3,8 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.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/coupon.dart'; -import 'package:huixiang/retrofit/data/settleOrderInfo.dart'; +import 'package:huixiang/retrofit/data/order_info.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'; @@ -33,6 +32,7 @@ class _Settlement extends State { MinApiService minService; int selectedBtn = 0; Coupon coupon; + OrderInfo orderInfo; Function(int type) callback; GestureTapCallback callbackEx; int isSelected = 0; @@ -50,27 +50,11 @@ class _Settlement extends State { token: minToken, tenant: tenant, ); - queryOrderInfo(); }); } StoreInfo storeInfo; - SettleOrderInfo settleOrderInfo; - ///订单结算信息 - queryOrderInfo() async { - BaseData baseData = await minService.getOrderInfo({ - "addressId": null, - "isTake": 0, - "memberCouponId": null, - "orderId": 0, - "promotionId": null - }); - if (baseData != null && baseData.isSuccess) { - settleOrderInfo = baseData.data; - setState(() {}); - } - } @override Widget build(BuildContext context) { @@ -108,7 +92,7 @@ class _Settlement extends State { ), ///订单商品 - SettlementOrderCommodity(settleOrderInfo, 0), + SettlementOrderCommodity(orderInfo,0), // if (payStatus == 0) couponRemarks(), /*(payStatus == 0) ? paySelector() : */ diff --git a/lib/store/store_view/settlement_order_commodity.dart b/lib/store/store_view/settlement_order_commodity.dart index fdd9bbc5..224e703d 100644 --- a/lib/store/store_view/settlement_order_commodity.dart +++ b/lib/store/store_view/settlement_order_commodity.dart @@ -4,14 +4,13 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/retrofit/data/order_info.dart'; -import 'package:huixiang/retrofit/data/settleOrderInfo.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/separator.dart'; class SettlementOrderCommodity extends StatefulWidget { final int isTakeOut; - final SettleOrderInfo orderInfo; + final OrderInfo orderInfo; SettlementOrderCommodity(this.orderInfo,this.isTakeOut); @@ -70,9 +69,9 @@ class _SettlementOrderCommodity extends State { List commodityList() { if (widget.orderInfo == null) return []; List widgets = []; - if (widget.orderInfo.orderProductList != null) { + if (widget.orderInfo.productList != null) { widgets - .addAll(widget.orderInfo.orderProductList.map((e) => commodityItem(e)).toList()); + .addAll(widget.orderInfo.productList.map((e) => commodityItem(e)).toList()); } widgets.add(SizedBox(height: 20.h)); @@ -84,7 +83,7 @@ class _SettlementOrderCommodity extends State { ? S.of(context).peisongfei : S.of(context).yunfei, "", - "+${widget.orderInfo.postAge}")); + "+${widget.orderInfo.productList}")); } widgets.add(Container( @@ -102,7 +101,7 @@ class _SettlementOrderCommodity extends State { return widgets; } - Widget commodityItem(OrderProductListBean productList) { + Widget commodityItem(ProductList productList) { return Container( margin: EdgeInsets.only(top: 8.h, bottom: 8.h), child: Row( @@ -313,8 +312,8 @@ class _SettlementOrderCommodity extends State { Expanded( child: Text( S.of(context).gongjijianshangpin( - (widget.orderInfo != null && widget.orderInfo.orderProductList != null) - ? widget.orderInfo.orderProductList.length + (widget.orderInfo != null && widget.orderInfo.productList != null) + ? widget.orderInfo.productList.length : "0"), style: TextStyle( fontSize: 10.sp, @@ -354,7 +353,7 @@ class _SettlementOrderCommodity extends State { String totalPrice() { if (widget.orderInfo == null) return ""; double totalPrice = (double.tryParse(widget.orderInfo.orderSum) + - double.tryParse(widget.orderInfo.postAge)); + double.tryParse(widget.orderInfo.postFee)); return "$totalPrice"; } From 9495bb8ad68987b541459ab10d4b10c0d1e62160 Mon Sep 17 00:00:00 2001 From: w-R <953969641@qq.com> Date: Sat, 16 Oct 2021 14:44:04 +0800 Subject: [PATCH 4/5] =?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/retrofit/data/settleOrderInfo.dart | 453 +++++++++++++++++++++++++ lib/retrofit/min_api.dart | 5 + lib/retrofit/min_api.g.dart | 23 +- lib/store/store_order.dart | 2 +- 4 files changed, 481 insertions(+), 2 deletions(-) create mode 100644 lib/retrofit/data/settleOrderInfo.dart diff --git a/lib/retrofit/data/settleOrderInfo.dart b/lib/retrofit/data/settleOrderInfo.dart new file mode 100644 index 00000000..7e62c6b7 --- /dev/null +++ b/lib/retrofit/data/settleOrderInfo.dart @@ -0,0 +1,453 @@ + +class SettleOrderInfo { + int orderNum; + int productNum; + int mins; + dynamic memberVO; + String postAge; + String price; + String orderSum; + String discountAmount; + List promotionInfoList; + List couponList; + String threshold; + String freePostAge; + List orderProductList; + + static SettleOrderInfo fromJson(Map map) { + if (map == null) return null; + SettleOrderInfo settleOrderInfoBean = SettleOrderInfo(); + settleOrderInfoBean.orderNum = map['orderNum']; + settleOrderInfoBean.productNum = map['productNum']; + settleOrderInfoBean.mins = map['mins']; + settleOrderInfoBean.memberVO = map['memberVO']; + settleOrderInfoBean.postAge = map['postAge']; + settleOrderInfoBean.price = map['price']; + settleOrderInfoBean.orderSum = map['orderSum']; + settleOrderInfoBean.discountAmount = map['discountAmount']; + settleOrderInfoBean.promotionInfoList = List()..addAll( + (map['promotionInfoList'] as List ?? []).map((o) => PromotionInfoListBean.fromJson(o)) + ); + settleOrderInfoBean.couponList = List()..addAll( + (map['couponList'] as List ?? []).map((o) => CouponListBean.fromJson(o)) + ); + settleOrderInfoBean.threshold = map['threshold']; + settleOrderInfoBean.freePostAge = map['freePostAge']; + settleOrderInfoBean.orderProductList = List()..addAll( + (map['orderProductList'] as List ?? []).map((o) => OrderProductListBean.fromJson(o)) + ); + return settleOrderInfoBean; + } + + Map toJson() => { + "orderNum": orderNum, + "productNum": productNum, + "mins": mins, + "memberVO": memberVO, + "postAge": postAge, + "price": price, + "orderSum": orderSum, + "discountAmount": discountAmount, + "promotionInfoList": promotionInfoList, + "couponList": couponList, + "threshold": threshold, + "freePostAge": freePostAge, + "orderProductList": orderProductList, + }; +} + +/// id : null +/// createTime : null +/// createUser : null +/// updateTime : null +/// updateUser : null +/// tenantCode : null +/// storeId : null +/// orderId : null +/// actInfo : null +/// productId : "1426095718614958080" +/// productName : "ɣ�������̸�" +/// skuId : "1426095718740787200" +/// skuNameStr : "ɳ�� ������ 700ml" +/// skuImg : null +/// buyNum : 1 +/// refundNum : null +/// type : null +/// reason : null +/// weight : 0.0 +/// applyPrice : "28.00" +/// sellPrice : "28.00" +/// postPay : null +/// isDelete : null +/// discountAmount : null +/// discountPercent : null +/// status : null +/// batch : null + +class OrderProductListBean { + dynamic id; + dynamic createTime; + dynamic createUser; + dynamic updateTime; + dynamic updateUser; + dynamic tenantCode; + dynamic storeId; + dynamic orderId; + dynamic actInfo; + String productId; + String productName; + String skuId; + String skuNameStr; + dynamic skuImg; + int buyNum; + dynamic refundNum; + dynamic type; + dynamic reason; + double weight; + String applyPrice; + String sellPrice; + dynamic postPay; + dynamic isDelete; + dynamic discountAmount; + dynamic discountPercent; + dynamic status; + dynamic batch; + + static OrderProductListBean fromJson(Map map) { + if (map == null) return null; + OrderProductListBean orderProductListBean = OrderProductListBean(); + orderProductListBean.id = map['id']; + orderProductListBean.createTime = map['createTime']; + orderProductListBean.createUser = map['createUser']; + orderProductListBean.updateTime = map['updateTime']; + orderProductListBean.updateUser = map['updateUser']; + orderProductListBean.tenantCode = map['tenantCode']; + orderProductListBean.storeId = map['storeId']; + orderProductListBean.orderId = map['orderId']; + orderProductListBean.actInfo = map['actInfo']; + orderProductListBean.productId = map['productId']; + orderProductListBean.productName = map['productName']; + orderProductListBean.skuId = map['skuId']; + orderProductListBean.skuNameStr = map['skuNameStr']; + orderProductListBean.skuImg = map['skuImg']; + orderProductListBean.buyNum = map['buyNum']; + orderProductListBean.refundNum = map['refundNum']; + orderProductListBean.type = map['type']; + orderProductListBean.reason = map['reason']; + orderProductListBean.weight = map['weight']; + orderProductListBean.applyPrice = map['applyPrice']; + orderProductListBean.sellPrice = map['sellPrice']; + orderProductListBean.postPay = map['postPay']; + orderProductListBean.isDelete = map['isDelete']; + orderProductListBean.discountAmount = map['discountAmount']; + orderProductListBean.discountPercent = map['discountPercent']; + orderProductListBean.status = map['status']; + orderProductListBean.batch = map['batch']; + return orderProductListBean; + } + + Map toJson() => { + "id": id, + "createTime": createTime, + "createUser": createUser, + "updateTime": updateTime, + "updateUser": updateUser, + "tenantCode": tenantCode, + "storeId": storeId, + "orderId": orderId, + "actInfo": actInfo, + "productId": productId, + "productName": productName, + "skuId": skuId, + "skuNameStr": skuNameStr, + "skuImg": skuImg, + "buyNum": buyNum, + "refundNum": refundNum, + "type": type, + "reason": reason, + "weight": weight, + "applyPrice": applyPrice, + "sellPrice": sellPrice, + "postPay": postPay, + "isDelete": isDelete, + "discountAmount": discountAmount, + "discountPercent": discountPercent, + "status": status, + "batch": batch, + }; +} + +/// id : "1448907890034212864" +/// storeId : "1333246101343436800" +/// bizType : 1 +/// fullAmount : "10.00" +/// discountAmount : "8.00" +/// fullNumber : 1 +/// discountPercent : 100 +/// bizId : "" +/// publishStartTime : "2021-10-01" +/// publishEndTime : "2021-10-29" +/// useStartTime : "2021-10-02" +/// useEndTime : "2021-10-31" +/// promotionId : "0" +/// mid : "1438443365845696512" +/// couponId : "1448902034085380096" +/// receiveTime : "2021-10-15" +/// useTime : null +/// status : 1 +/// tenantCode : "1175" +/// type : 1 +/// promotionName : "��10-8" +/// usable : true +/// allProduct : true +/// productList : null + +class CouponListBean { + String id; + String storeId; + int bizType; + String fullAmount; + String discountAmount; + int fullNumber; + int discountPercent; + String bizId; + String publishStartTime; + String publishEndTime; + String useStartTime; + String useEndTime; + String promotionId; + String mid; + String couponId; + String receiveTime; + dynamic useTime; + int status; + String tenantCode; + int type; + String promotionName; + bool usable; + bool allProduct; + dynamic productList; + + static CouponListBean fromJson(Map map) { + if (map == null) return null; + CouponListBean couponListBean = CouponListBean(); + couponListBean.id = map['id']; + couponListBean.storeId = map['storeId']; + couponListBean.bizType = map['bizType']; + couponListBean.fullAmount = map['fullAmount']; + couponListBean.discountAmount = map['discountAmount']; + couponListBean.fullNumber = map['fullNumber']; + couponListBean.discountPercent = map['discountPercent']; + couponListBean.bizId = map['bizId']; + couponListBean.publishStartTime = map['publishStartTime']; + couponListBean.publishEndTime = map['publishEndTime']; + couponListBean.useStartTime = map['useStartTime']; + couponListBean.useEndTime = map['useEndTime']; + couponListBean.promotionId = map['promotionId']; + couponListBean.mid = map['mid']; + couponListBean.couponId = map['couponId']; + couponListBean.receiveTime = map['receiveTime']; + couponListBean.useTime = map['useTime']; + couponListBean.status = map['status']; + couponListBean.tenantCode = map['tenantCode']; + couponListBean.type = map['type']; + couponListBean.promotionName = map['promotionName']; + couponListBean.usable = map['usable']; + couponListBean.allProduct = map['allProduct']; + couponListBean.productList = map['productList']; + return couponListBean; + } + + Map toJson() => { + "id": id, + "storeId": storeId, + "bizType": bizType, + "fullAmount": fullAmount, + "discountAmount": discountAmount, + "fullNumber": fullNumber, + "discountPercent": discountPercent, + "bizId": bizId, + "publishStartTime": publishStartTime, + "publishEndTime": publishEndTime, + "useStartTime": useStartTime, + "useEndTime": useEndTime, + "promotionId": promotionId, + "mid": mid, + "couponId": couponId, + "receiveTime": receiveTime, + "useTime": useTime, + "status": status, + "tenantCode": tenantCode, + "type": type, + "promotionName": promotionName, + "usable": usable, + "allProduct": allProduct, + "productList": productList, + }; +} + +/// id : "1437254523520286720" +/// createTime : "2021-09-13 11:19:16" +/// createUser : "1333246101196636160" +/// updateTime : "2021-09-13 17:30:00" +/// updateUser : "0" +/// storeId : "1433719074906439680" +/// name : "�����ŵ�" +/// image : "https://pos.upload.gznl.top/1175/2021/09/44d60dab-0ae3-4d07-b624-50b8ab99d0fc.jpg" +/// description : "1" +/// status : 4 +/// applyStartTime : "2021-09-13 11:19:16" +/// applyEndTime : "2021-09-13 11:19:16" +/// activityStartTime : "2021-09-01 00:00:00" +/// activityEndTime : "2021-10-30 00:00:00" +/// doStartTime : null +/// doEndTime : null +/// isNeedSecurityDeposit : 0 +/// securityDeposit : "0" +/// tag : "11" +/// promotionType : 1 +/// promotionPlan : 0 +/// promotionDetail : [{"limitTime":"0","discountRate":"0","discountAmount":"0","fullAmount":"0","collageNumber":"0","fullNumber":"1"}] +/// channels : ["MINI","POS"] +/// isVip : false +/// isDelete : 0 +/// tenantCode : "1175" +/// canPartake : true +/// promotionProuctList : null + +class PromotionInfoListBean { + String id; + String createTime; + String createUser; + String updateTime; + String updateUser; + String storeId; + String name; + String image; + String description; + int status; + String applyStartTime; + String applyEndTime; + String activityStartTime; + String activityEndTime; + dynamic doStartTime; + dynamic doEndTime; + int isNeedSecurityDeposit; + String securityDeposit; + String tag; + int promotionType; + int promotionPlan; + List promotionDetail; + List channels; + bool isVip; + int isDelete; + String tenantCode; + bool canPartake; + dynamic promotionProuctList; + + static PromotionInfoListBean fromJson(Map map) { + if (map == null) return null; + PromotionInfoListBean promotionInfoListBean = PromotionInfoListBean(); + promotionInfoListBean.id = map['id']; + promotionInfoListBean.createTime = map['createTime']; + promotionInfoListBean.createUser = map['createUser']; + promotionInfoListBean.updateTime = map['updateTime']; + promotionInfoListBean.updateUser = map['updateUser']; + promotionInfoListBean.storeId = map['storeId']; + promotionInfoListBean.name = map['name']; + promotionInfoListBean.image = map['image']; + promotionInfoListBean.description = map['description']; + promotionInfoListBean.status = map['status']; + promotionInfoListBean.applyStartTime = map['applyStartTime']; + promotionInfoListBean.applyEndTime = map['applyEndTime']; + promotionInfoListBean.activityStartTime = map['activityStartTime']; + promotionInfoListBean.activityEndTime = map['activityEndTime']; + promotionInfoListBean.doStartTime = map['doStartTime']; + promotionInfoListBean.doEndTime = map['doEndTime']; + promotionInfoListBean.isNeedSecurityDeposit = map['isNeedSecurityDeposit']; + promotionInfoListBean.securityDeposit = map['securityDeposit']; + promotionInfoListBean.tag = map['tag']; + promotionInfoListBean.promotionType = map['promotionType']; + promotionInfoListBean.promotionPlan = map['promotionPlan']; + promotionInfoListBean.promotionDetail = List()..addAll( + (map['promotionDetail'] as List ?? []).map((o) => PromotionDetailBean.fromJson(o)) + ); + promotionInfoListBean.channels = List()..addAll( + (map['channels'] as List ?? []).map((o) => o.toString()) + ); + promotionInfoListBean.isVip = map['isVip']; + promotionInfoListBean.isDelete = map['isDelete']; + promotionInfoListBean.tenantCode = map['tenantCode']; + promotionInfoListBean.canPartake = map['canPartake']; + promotionInfoListBean.promotionProuctList = map['promotionProuctList']; + return promotionInfoListBean; + } + + Map toJson() => { + "id": id, + "createTime": createTime, + "createUser": createUser, + "updateTime": updateTime, + "updateUser": updateUser, + "storeId": storeId, + "name": name, + "image": image, + "description": description, + "status": status, + "applyStartTime": applyStartTime, + "applyEndTime": applyEndTime, + "activityStartTime": activityStartTime, + "activityEndTime": activityEndTime, + "doStartTime": doStartTime, + "doEndTime": doEndTime, + "isNeedSecurityDeposit": isNeedSecurityDeposit, + "securityDeposit": securityDeposit, + "tag": tag, + "promotionType": promotionType, + "promotionPlan": promotionPlan, + "promotionDetail": promotionDetail, + "channels": channels, + "isVip": isVip, + "isDelete": isDelete, + "tenantCode": tenantCode, + "canPartake": canPartake, + "promotionProuctList": promotionProuctList, + }; +} + +/// limitTime : "0" +/// discountRate : "0" +/// discountAmount : "0" +/// fullAmount : "0" +/// collageNumber : "0" +/// fullNumber : "1" + +class PromotionDetailBean { + String limitTime; + String discountRate; + String discountAmount; + String fullAmount; + String collageNumber; + String fullNumber; + + static PromotionDetailBean fromJson(Map map) { + if (map == null) return null; + PromotionDetailBean promotionDetailBean = PromotionDetailBean(); + promotionDetailBean.limitTime = map['limitTime']; + promotionDetailBean.discountRate = map['discountRate']; + promotionDetailBean.discountAmount = map['discountAmount']; + promotionDetailBean.fullAmount = map['fullAmount']; + promotionDetailBean.collageNumber = map['collageNumber']; + promotionDetailBean.fullNumber = map['fullNumber']; + return promotionDetailBean; + } + + Map toJson() => { + "limitTime": limitTime, + "discountRate": discountRate, + "discountAmount": discountAmount, + "fullAmount": fullAmount, + "collageNumber": collageNumber, + "fullNumber": fullNumber, + }; +} \ No newline at end of file diff --git a/lib/retrofit/min_api.dart b/lib/retrofit/min_api.dart index 97beb501..e97d7c93 100644 --- a/lib/retrofit/min_api.dart +++ b/lib/retrofit/min_api.dart @@ -13,6 +13,7 @@ import 'package:retrofit/retrofit.dart'; import 'data/findMiNiGroupList.dart'; import 'data/miNiDetail.dart'; +import 'data/settleOrderInfo.dart'; import 'data/shoppingCart.dart'; part 'min_api.g.dart'; @@ -131,6 +132,10 @@ abstract class MinApiService { Future> shoppingCart( @Body() Map param,Map header); + ///订单结算信息 + @POST("order/getOrderInfo") + Future> getOrderInfo( + @Body() Map param); diff --git a/lib/retrofit/min_api.g.dart b/lib/retrofit/min_api.g.dart index 8c8ee6cc..0ca13580 100644 --- a/lib/retrofit/min_api.g.dart +++ b/lib/retrofit/min_api.g.dart @@ -86,5 +86,26 @@ class _MinApiService implements MinApiService { return value; } - + @override + Future> getOrderInfo(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>( + 'order/getOrderInfo', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => SettleOrderInfo.fromJson(json), + ); + return value; + } } diff --git a/lib/store/store_order.dart b/lib/store/store_order.dart index ed3c23de..eb51c564 100644 --- a/lib/store/store_order.dart +++ b/lib/store/store_order.dart @@ -537,7 +537,7 @@ class _StoreOrderPage extends State addsShoppingCart() async { BaseData baseDate = await apiService.creditOrder({ "parentId": widget.arguments["parentId"], - "skuImg": widget.arguments["skuImg"], + "skuImg": null, "skuNameStr": widget.arguments["skuNameStr"], "skuPrice": widget.arguments["skuPrice"], "skuStock": widget.arguments["skuStock"], From ee45331df039416cddd31faa8b89f629630ab084 Mon Sep 17 00:00:00 2001 From: w-R <953969641@qq.com> Date: Sat, 16 Oct 2021 18:33:38 +0800 Subject: [PATCH 5/5] =?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/home/home_view/featured_acticvity.dart | 7 +- lib/retrofit/min_api.dart | 37 +++++---- lib/store/store_order.dart | 3 +- lib/store/store_view/settlement.dart | 61 +++++++++------ .../settlement_order_commodity.dart | 77 ++++++++++--------- lib/store/store_view/store_order_list.dart | 72 ++++++++--------- 6 files changed, 141 insertions(+), 116 deletions(-) diff --git a/lib/home/home_view/featured_acticvity.dart b/lib/home/home_view/featured_acticvity.dart index 938bc807..e9be0578 100644 --- a/lib/home/home_view/featured_acticvity.dart +++ b/lib/home/home_view/featured_acticvity.dart @@ -26,13 +26,13 @@ class _FeaturedActivity extends State { height: 10.h, ), Container( - margin: EdgeInsets.symmetric(horizontal: 11.w), + margin: EdgeInsets.symmetric(horizontal: 9.w), child: Row( children: [ Container( child: stackItem(18.sp), margin: EdgeInsets.symmetric(horizontal: 5.w), - width: (MediaQuery.of(context).size.width - 42) /2, + width: (MediaQuery.of(context).size.width - 42) / 2, height: 180.h, decoration: BoxDecoration( borderRadius: BorderRadius.circular(4), @@ -52,7 +52,7 @@ class _FeaturedActivity extends State { Container( child: stackItem(14.sp), margin: EdgeInsets.symmetric(horizontal: 5.w), - width: (MediaQuery.of(context).size.width - 42) /2, + width: (MediaQuery.of(context).size.width - 42) / 2, height: 170.h / 2, decoration: BoxDecoration( borderRadius: BorderRadius.circular(4), @@ -65,7 +65,6 @@ class _FeaturedActivity extends State { ), ), ), - Container( child: stackItem(14.sp), margin: EdgeInsets.symmetric(horizontal: 5.w), diff --git a/lib/retrofit/min_api.dart b/lib/retrofit/min_api.dart index e97d7c93..e2c9400d 100644 --- a/lib/retrofit/min_api.dart +++ b/lib/retrofit/min_api.dart @@ -15,13 +15,18 @@ import 'data/findMiNiGroupList.dart'; import 'data/miNiDetail.dart'; import 'data/settleOrderInfo.dart'; import 'data/shoppingCart.dart'; + part 'min_api.g.dart'; // const base_url = "https://pos.platform.lotus-wallet.com/app/"; ///正式 // const baseUrl = "https://pos.platform.lotus-wallet.com/app/"; ///正式 -const base_url = "http://192.168.10.236:8765/app/"; ///费韬 -const baseUrl = "http://192.168.10.236:8765/app/"; ///费韬 +const base_url = "http://192.168.10.236:8765/app/"; + +///费韬 +const baseUrl = "http://192.168.10.236:8765/app/"; + +///费韬 // const base_url = "http://192.168.10.37:8766/app/"; // const baseUrl = "http://192.168.10.37:8766/app/"; @@ -29,7 +34,8 @@ const baseUrl = "http://192.168.10.236:8765/app/"; ///费韬 ///调用小程序的接口 @RestApi(baseUrl: baseUrl) abstract class MinApiService { - factory MinApiService(Dio dio, { + factory MinApiService( + Dio dio, { String baseUrl, BuildContext context, String token, @@ -38,7 +44,7 @@ abstract class MinApiService { bool pay = false, }) { Map headers = - (token == null || token == "") ? {} : {'token': "Bearer $token"}; + (token == null || token == "") ? {} : {'token': "Bearer $token"}; if (tenant != null && tenant != "") { headers["tenant"] = tenant; } @@ -53,7 +59,8 @@ abstract class MinApiService { ); dio.interceptors.add( InterceptorsWrapper(onRequest: (RequestOptions options) { - debugPrint("\n======================= Min_请求数据 ======================="); + debugPrint( + "\n======================= Min_请求数据 ======================="); debugPrint("method = ${options.method.toString()}"); debugPrint("url = ${options.uri.toString()}"); debugPrint("headers = ${options.headers}"); @@ -68,14 +75,16 @@ abstract class MinApiService { } debugPrint("params queryParameters = ${options.queryParameters}"); }, onResponse: (Response response) { - debugPrint("\n======================= Min_响应数据开始 ======================="); + debugPrint( + "\n======================= Min_响应数据开始 ======================="); if (showLoading && EasyLoading.isShow) { EasyLoading.dismiss(); } debugPrint("code = ${response.statusCode}"); // p(jsonEncode(response.data)); - debugPrint(jsonEncode(response.data), wrapWidth: response.data.toString().length); + debugPrint(jsonEncode(response.data), + wrapWidth: response.data.toString().length); Map map = response.data; if (map["code"] != 0) { @@ -90,12 +99,14 @@ abstract class MinApiService { ///高德地图的poi服务请求不需要toast SmartDialog.showToast(map["msg"], alignment: Alignment.center); } - debugPrint("======================= Min_响应数据结束 =======================\n"); + debugPrint( + "======================= Min_响应数据结束 =======================\n"); }, onError: (DioError e) { if (EasyLoading.isShow) { EasyLoading.dismiss(); } - debugPrint("\n======================= Min_错误响应数据 ======================="); + debugPrint( + "\n======================= Min_错误响应数据 ======================="); debugPrint("type = ${e.type}"); debugPrint("message = ${e.message}"); debugPrint("\n"); @@ -122,7 +133,6 @@ abstract class MinApiService { Future>> findMiNiGroupList( @Body() Map param); - ///小程序查询商品详情/規格选择 @GET("/product/queryMiNiProductDetail?id={id}") Future> miNiDetail(@Path("id") String id); @@ -130,13 +140,10 @@ abstract class MinApiService { ///添加购物车 @POST("shoppingcart") Future> shoppingCart( - @Body() Map param,Map header); + @Body() Map param, Map header); ///订单结算信息 @POST("order/getOrderInfo") Future> getOrderInfo( @Body() Map param); - - - -} \ No newline at end of file +} diff --git a/lib/store/store_order.dart b/lib/store/store_order.dart index eb51c564..7c80989c 100644 --- a/lib/store/store_order.dart +++ b/lib/store/store_order.dart @@ -420,7 +420,7 @@ class _StoreOrderPage extends State toDownOrder() { if (shopCarGoods == null || shopCarGoods.length == 0) { SmartDialog.showToast("请选择要购买的商品~"); - return ; + return; } getShopCarGoods(); @@ -494,7 +494,6 @@ class _StoreOrderPage extends State ///购物车弹窗 showShoppingCart() { - getShopCarGoods(); showModalBottomSheet( diff --git a/lib/store/store_view/settlement.dart b/lib/store/store_view/settlement.dart index 91e5be3d..f736db94 100644 --- a/lib/store/store_view/settlement.dart +++ b/lib/store/store_view/settlement.dart @@ -5,10 +5,9 @@ import 'package:flutter/services.dart'; 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/order/order_view/order_commodity.dart'; -import 'package:huixiang/order/order_view/order_info.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/settleOrderInfo.dart'; import 'package:huixiang/retrofit/data/store_info.dart'; @@ -16,8 +15,6 @@ import 'package:huixiang/retrofit/min_api.dart'; import 'package:huixiang/store/store_view/settlement_order_commodity.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; -import 'package:huixiang/view_widget/rename_dialog.dart'; -import 'package:huixiang/view_widget/rename_dialog_content.dart'; import 'package:huixiang/view_widget/round_button.dart'; import 'package:huixiang/view_widget/separator.dart'; import 'package:shared_preferences/shared_preferences.dart'; @@ -42,7 +39,10 @@ class _Settlement extends State { GestureTapCallback callbackEx; int isSelected = 0; StoreInfo storeInfo; + List shopCar = []; + List> shopCarGoods = []; SettleOrderInfo settleOrderInfo; + int selectedCouponIndex = -1; TextEditingController _vc; List addressBgs = [ @@ -55,6 +55,8 @@ class _Settlement extends State { void initState() { super.initState(); storeInfo = widget.arguments["storeInfo"]; + shopCar = widget.arguments["shopProduct"]; + shopCarGoods = widget.arguments["shopGoods"]; _vc = TextEditingController( text: storeInfo != null ? storeInfo.headMobile : ""); @@ -78,18 +80,27 @@ class _Settlement extends State { "addressId": null, "isTake": 0, "memberCouponId": null, - // "orderId": widget.arguments["orderId"], - "orderId": "1449199929208602624", + "orderId": 0, "promotionId": null }); if (baseData != null && baseData.isSuccess) { - settleOrderInfo = baseData.data; - setState(() {}); + setState(() { + settleOrderInfo = baseData.data; + }); } } bool isEdit = false; + String totalPrice() { + if (shopCarGoods == null) return ""; + double totalPrice = 0; + shopCarGoods.forEach((element) { + totalPrice += double.tryParse(element["price"]) * element["count"]; + }); + return "$totalPrice"; + } + @override Widget build(BuildContext context) { return Stack( @@ -176,7 +187,8 @@ class _Settlement extends State { color: Color(0xFF4C4C4C), ), textAlign: TextAlign.right, - textAlignVertical: TextAlignVertical.center, + textAlignVertical: + TextAlignVertical.center, keyboardType: TextInputType.phone, decoration: InputDecoration( errorBorder: InputBorder.none, @@ -222,15 +234,15 @@ class _Settlement extends State { padding: EdgeInsets.all(8), child: isEdit ? Icon( - Icons.check, - size: 14.w, - color: Color(0xFF32A060), - ) + Icons.check, + size: 14.w, + color: Color(0xFF32A060), + ) : Image.asset( - "assets/image/pen.png", - height: 14.h, - width: 14.w, - ), + "assets/image/pen.png", + height: 14.h, + width: 14.w, + ), ), ), ], @@ -238,7 +250,7 @@ class _Settlement extends State { ), ///订单商品 - SettlementOrderCommodity(settleOrderInfo, 0), + SettlementOrderCommodity(shopCar, 0,shopCarGoods,settleOrderInfo), // if (payStatus == 0) couponRemarks(), /*(payStatus == 0) ? paySelector() : */ @@ -255,11 +267,11 @@ class _Settlement extends State { ), left: 0, right: 0, - top: 0, - bottom: 0, + top:0, + bottom:0, ), Positioned( - bottom: 0, + bottom:0, left: 0, right: 0, child: Container( @@ -278,7 +290,7 @@ class _Settlement extends State { ), ), Text( - "¥19.00", + totalPrice(), style: TextStyle( fontSize: 20.sp, fontWeight: MyFontWeight.semi_bold, @@ -613,7 +625,10 @@ class _Settlement extends State { ), ), Text( - "满30减10", + (settleOrderInfo?.couponList == null || settleOrderInfo.couponList.length == 0) + ? "暂无可用优惠券" : (selectedCouponIndex == -1 + ? "拥有${settleOrderInfo.couponList.length}张优惠券": + settleOrderInfo.couponList[selectedCouponIndex].promotionName), textAlign: TextAlign.end, style: TextStyle( fontSize: 14.sp, diff --git a/lib/store/store_view/settlement_order_commodity.dart b/lib/store/store_view/settlement_order_commodity.dart index 224e703d..9b7f9d93 100644 --- a/lib/store/store_view/settlement_order_commodity.dart +++ b/lib/store/store_view/settlement_order_commodity.dart @@ -1,24 +1,24 @@ - - import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:huixiang/generated/l10n.dart'; -import 'package:huixiang/retrofit/data/order_info.dart'; +import 'package:huixiang/retrofit/data/findMiNiGroupList.dart'; +import 'package:huixiang/retrofit/data/settleOrderInfo.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/separator.dart'; class SettlementOrderCommodity extends StatefulWidget { final int isTakeOut; - final OrderInfo orderInfo; + final List orderInfo; + final List> shopCarGood; + final SettleOrderInfo settleOrderInfo; - SettlementOrderCommodity(this.orderInfo,this.isTakeOut); + SettlementOrderCommodity(this.orderInfo, this.isTakeOut,this.shopCarGood,this.settleOrderInfo); @override State createState() { return _SettlementOrderCommodity(); } - } class _SettlementOrderCommodity extends State { @@ -65,13 +65,12 @@ class _SettlementOrderCommodity extends State { ); } - List commodityList() { if (widget.orderInfo == null) return []; List widgets = []; - if (widget.orderInfo.productList != null) { - widgets - .addAll(widget.orderInfo.productList.map((e) => commodityItem(e)).toList()); + if (widget.orderInfo != null) { + widgets.addAll( + widget.orderInfo.map((e) => commodityItem(e)).toList()); } widgets.add(SizedBox(height: 20.h)); @@ -83,7 +82,8 @@ class _SettlementOrderCommodity extends State { ? S.of(context).peisongfei : S.of(context).yunfei, "", - "+${widget.orderInfo.productList}")); + "+${widget.settleOrderInfo?.postAge??"0"}" + )); } widgets.add(Container( @@ -101,13 +101,20 @@ class _SettlementOrderCommodity extends State { return widgets; } - Widget commodityItem(ProductList productList) { + Widget commodityItem(ProductListBean productList) { + Map goodsBuyInfo; + widget.shopCarGood.forEach((element) { + if(element["id"] == productList.id){ + goodsBuyInfo = element; + return; + } + }); return Container( margin: EdgeInsets.only(top: 8.h, bottom: 8.h), child: Row( children: [ MImage( - productList.skuImg, + productList.imgPath, width: 44.w, height: 44, fit: BoxFit.cover, @@ -138,7 +145,7 @@ class _SettlementOrderCommodity extends State { ), ), Text( - "x${productList.buyNum}", + "x${goodsBuyInfo["count"]}", style: TextStyle( fontSize: 12.sp, color: Color(0xFF727272), @@ -164,7 +171,7 @@ class _SettlementOrderCommodity extends State { ), ), Text( - S.of(context).yuan_(productList.sellPrice), + S.of(context).yuan_(productList.price), style: TextStyle( fontWeight: FontWeight.bold, fontSize: 12.sp, @@ -311,15 +318,14 @@ class _SettlementOrderCommodity extends State { children: [ Expanded( child: Text( - S.of(context).gongjijianshangpin( - (widget.orderInfo != null && widget.orderInfo.productList != null) - ? widget.orderInfo.productList.length - : "0"), + S.of(context).gongjijianshangpin((widget.orderInfo != null && + widget.orderInfo != null) + ? widget.orderInfo.length + : "0"), style: TextStyle( - fontSize: 10.sp, - color: Color(0xFFA29E9E), - fontWeight: MyFontWeight.semi_bold - ), + fontSize: 10.sp, + color: Color(0xFFA29E9E), + fontWeight: MyFontWeight.semi_bold), ), flex: 1, ), @@ -327,10 +333,9 @@ class _SettlementOrderCommodity extends State { child: Text( S.of(context).jiesuanjine, style: TextStyle( - fontSize: 12.sp, - color: Color(0xFF353535), - fontWeight:MyFontWeight.semi_bold - ), + fontSize: 12.sp, + color: Color(0xFF353535), + fontWeight: MyFontWeight.semi_bold), ), ), SizedBox( @@ -340,10 +345,9 @@ class _SettlementOrderCommodity extends State { totalPrice(), textAlign: TextAlign.end, style: TextStyle( - fontSize:14.sp, - color: Color(0xFF32A060), - fontWeight: MyFontWeight.semi_bold - ), + fontSize: 14.sp, + color: Color(0xFF32A060), + fontWeight: MyFontWeight.semi_bold), ) ], ), @@ -351,10 +355,11 @@ class _SettlementOrderCommodity extends State { } String totalPrice() { - if (widget.orderInfo == null) return ""; - double totalPrice = (double.tryParse(widget.orderInfo.orderSum) + - double.tryParse(widget.orderInfo.postFee)); + if (widget.shopCarGood == null) return ""; + double totalPrice = 0; + widget.shopCarGood.forEach((element) { + totalPrice += double.tryParse(element["price"]) * element["count"]; + }); return "$totalPrice"; } - -} \ No newline at end of file +} diff --git a/lib/store/store_view/store_order_list.dart b/lib/store/store_view/store_order_list.dart index 02d02cd3..695b7874 100644 --- a/lib/store/store_view/store_order_list.dart +++ b/lib/store/store_view/store_order_list.dart @@ -86,42 +86,40 @@ class _StoreOrderListPage extends State { @override Widget build(BuildContext context) { return Container( - width: MediaQuery.of(context).size.width, - height: MediaQuery.of(context).size.height - (kToolbarHeight + 38 + 54.h), - margin: EdgeInsets.only( - top: (MediaQuery.of(context).padding.top + 38 + kToolbarHeight), - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ - Container( - width: 100.w, - child: ListView.builder( - itemCount: - appletProducts == null ? 0 : appletProducts.length, - controller: controller1, - physics: BouncingScrollPhysics(), - padding: EdgeInsets.only(top: 0, bottom: 25), - itemBuilder: (context, position) { - return orderItem(appletProducts[position], position); - }, - ), + width: MediaQuery.of(context).size.width, + height: MediaQuery.of(context).size.height - (kToolbarHeight + 38 + 54.h), + margin: EdgeInsets.only( + top: (MediaQuery.of(context).padding.top + 38 + kToolbarHeight), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + Container( + width: 100.w, + child: ListView.builder( + itemCount: appletProducts == null ? 0 : appletProducts.length, + controller: controller1, + physics: BouncingScrollPhysics(), + padding: EdgeInsets.only(top: 0, bottom: 25), + itemBuilder: (context, position) { + return orderItem(appletProducts[position], position); + }, ), - Container( - width: MediaQuery.of(context).size.width - 100.w, - child: ListView.builder( - itemCount: productListBeans == null - ? 0 : productListBeans.length, - physics: BouncingScrollPhysics(), - padding: EdgeInsets.zero, - itemBuilder: (context, position) { - return goodsItem(position); - }, - ), + ), + Container( + width: MediaQuery.of(context).size.width - 100.w, + child: ListView.builder( + itemCount: productListBeans == null ? 0 : productListBeans.length, + physics: BouncingScrollPhysics(), + padding: EdgeInsets.zero, + itemBuilder: (context, position) { + return goodsItem(position); + }, ), - ], - ), + ), + ], + ), ); } @@ -226,8 +224,10 @@ class _StoreOrderListPage extends State { double singlePrice = double.tryParse(element2["price"]); allCount += element2["count"]; - AiDecimalAccuracy aiDecimalAccuracy = AiDecimalAccuracy.fromInt(element2["count"]); - AiDecimalAccuracy aiPrice = AiDecimalAccuracy.tryParse("$singlePrice"); + AiDecimalAccuracy aiDecimalAccuracy = + AiDecimalAccuracy.fromInt(element2["count"]); + AiDecimalAccuracy aiPrice = + AiDecimalAccuracy.tryParse("$singlePrice"); allPrice += (aiPrice * aiDecimalAccuracy); }