diff --git a/lib/mine/recharge_page.dart b/lib/mine/recharge_page.dart index ffb33f3b..55a6cc8b 100644 --- a/lib/mine/recharge_page.dart +++ b/lib/mine/recharge_page.dart @@ -207,9 +207,9 @@ class _RechargePage extends State { } int amount = int.tryParse(money); if (checkIndex == 1) { - if (amount < 10) { - SmartDialog.showToast(S.of(context).chongzhizuixiaojine(10), alignment: Alignment.center); + SmartDialog.showToast(S.of(context).chongzhizuixiaojine(10), + alignment: Alignment.center); return; } @@ -220,21 +220,24 @@ class _RechargePage extends State { await Min.initialize(); } - BaseData baseData = await apiService.recharge({"amount": amount, "rechargeType": 2}); + BaseData baseData = + await apiService.recharge({"amount": amount, "rechargeType": 2}); if (baseData != null && baseData.isSuccess) { WxPay wxPay = baseData.data; await registerWxApi( - appId: wxPay.appId, - doOnAndroid: true, - universalLink: "https://hx.lotus-wallet.com/app/"); + appId: wxPay.appId, + doOnAndroid: true, + universalLink: "https://hx.lotus-wallet.com/app/", + ); payWithWeChat( - appId: wxPay.appId, - partnerId: wxPay.partnerId, - prepayId: wxPay.prepayId, - packageValue: wxPay.packageValue, - nonceStr: wxPay.nonceStr, - timeStamp: int.tryParse(wxPay.timeStamp), - sign: wxPay.sign); + appId: wxPay.appId, + partnerId: wxPay.partnerId, + prepayId: wxPay.prepayId, + packageValue: wxPay.packageValue, + nonceStr: wxPay.nonceStr, + timeStamp: int.tryParse(wxPay.timeStamp), + sign: wxPay.sign, + ); weChatResponseEventHandler.listen((event) async { print("payCallback: ${event.errCode}"); }); diff --git a/lib/mine/vip_detail_page.dart b/lib/mine/vip_detail_page.dart index 9efd6443..d6e0794a 100644 --- a/lib/mine/vip_detail_page.dart +++ b/lib/mine/vip_detail_page.dart @@ -4,7 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/retrofit/data/base_data.dart'; -import 'package:huixiang/retrofit/data/order_info.dart'; +import 'package:huixiang/retrofit/data/product.dart'; import 'package:huixiang/retrofit/data/vip_card.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/utils/font_weight.dart'; diff --git a/lib/order/order_detail_page.dart b/lib/order/order_detail_page.dart index 727e2725..9a2acd07 100644 --- a/lib/order/order_detail_page.dart +++ b/lib/order/order_detail_page.dart @@ -8,6 +8,8 @@ import 'package:huixiang/order/order_view/order_info.dart'; import 'package:huixiang/order/order_view/order_status.dart'; import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/order_info.dart'; +import 'package:huixiang/retrofit/data/placeOrderFirst.dart'; +import 'package:huixiang/retrofit/min_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/view_widget/icon_text.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; @@ -27,6 +29,7 @@ class OrderDetailPage extends StatefulWidget { class _OrderDetailPage extends State { ApiService apiService; + MinApiService minService; @override void initState() { @@ -38,10 +41,40 @@ class _OrderDetailPage extends State { context: context, token: value.getString("token"), ); + minLogin(); queryDetails(); }); } + /// 小程序登录 + minLogin() async { + apiService + .minLogin(widget.arguments["id"]) + .catchError((onError) {}) + .then((baseData) { + if (baseData != null && baseData.isSuccess) { + Map minStoreInfo = baseData.data; + String minToken = minStoreInfo["token"]; + String tenant = widget.arguments["tenant"]; + String storeId = widget.arguments["id"]; + SharedPreferences.getInstance().then( + (value) => { + value.setString('minToken', minToken), + value.setString('tenant', tenant), + value.setString('storeId', storeId), + }, + ); + minService = MinApiService( + Dio(), + context: context, + token: minToken, + tenant: tenant, + storeId: storeId, + ); + } + }); + } + OrderInfo orderInfo; int payStatus = 0; int orderStatus = 0; @@ -52,8 +85,9 @@ class _OrderDetailPage extends State { // String storeType = "NORMALSTORE"; //NORMALSTORE FASTSTORE RETAILSTORE queryDetails() async { - BaseData baseData = - await apiService.orderDetail(widget.arguments["id"]); + BaseData baseData = await apiService + .orderDetail(widget.arguments["id"]) + .catchError((error) {}); if (baseData != null && baseData.isSuccess) { orderInfo = baseData.data; payStatus = orderInfo.payStatus; @@ -70,7 +104,6 @@ class _OrderDetailPage extends State { if (mounted) setState(() { statusTitle(); - }); } } @@ -100,49 +133,42 @@ class _OrderDetailPage extends State { titleColor: Colors.white, background: Colors.transparent, leadingColor: Colors.white, - // toolbarHeight: (orderStatus >= 4 ? 118.h : 118.h) + - // MediaQuery.of(context).padding.top + - // kToolbarHeight, brightness: Brightness.dark, - // bottom: PreferredSize( - // preferredSize: Size( - // double.infinity, - // orderStatus >= 4 ? 118.h : 118, - // ), - // child: - // ), ), body: Container( - child: - /*Column( - children: [ - Expanded( - child:*/ - SingleChildScrollView( + child: SingleChildScrollView( physics: BouncingScrollPhysics(), child: Container( child: Column( children: [ ///订单状态显示 - OrderStatus(orderStatus, isTakeOut, sendStatus, payStatus, - refundStatus, title, center, orderInfo), + OrderStatus( + orderStatus, + isTakeOut, + sendStatus, + payStatus, + refundStatus, + title, + center, + orderInfo, + ), ///订单取货地址,或, 收货地址 OrderAddress( - orderStatus, - isTakeOut, - sendStatus, - payStatus, - refundStatus, - title, - center, - _orderCancel, - orderInfo), + orderStatus, + isTakeOut, + sendStatus, + payStatus, + refundStatus, + title, + center, + carryOnPay, + _orderCancel, + orderInfo, + ), ///订单商品 OrderCommodity(orderInfo), - // if (payStatus == 0) couponRemarks(), - /*(payStatus == 0) ? paySelector() : */ ///显示订单信息 OrderInfoView(orderInfo), @@ -154,19 +180,13 @@ class _OrderDetailPage extends State { ), ), ), - // flex: 1, - // ), - // if (payStatus == 0) - // bottomPay(), - // ], - // ), ), ), left: 0, right: 0, top: 0, bottom: 0, - ) + ), ], ); } @@ -174,6 +194,36 @@ class _OrderDetailPage extends State { String title = ""; String center = ""; + carryOnPay() { + PlaceOrderFirst placeOrderFirst = PlaceOrderFirst(); + placeOrderFirst.addressId = orderInfo.addressExt.addressId; + placeOrderFirst.isSubscribe = orderInfo.isSubscribe; + placeOrderFirst.isTakeOut = orderInfo.isTakeOut; + placeOrderFirst.notes = orderInfo.notes; + placeOrderFirst.id = orderInfo.id; + placeOrderFirst.orderProductVOList = orderInfo.orderDetail.orderProductList; + placeOrderFirst.numberOfPeople = "0"; + placeOrderFirst.orderSource = orderInfo.orderSource; + placeOrderFirst.orderType = orderInfo.orderType; + placeOrderFirst.orderTypeId = 0; + placeOrderFirst.parentCode = orderInfo.parentCode; // 火锅加菜 + placeOrderFirst.parentId = orderInfo.parentId; // 火锅加菜 + placeOrderFirst.payChannel = orderInfo.payChannel; + placeOrderFirst.promotionInfoDTO = PromotionInfoDTOBean(); + placeOrderFirst.promotionInfoDTO.promotionId = orderInfo.promotionId; + placeOrderFirst.promotionInfoDTO.couponId = orderInfo.couponId; + placeOrderFirst.recMobile = ""; + placeOrderFirst.shoppingCartSkuItemList = []; + placeOrderFirst.skuItemDTOList = []; + placeOrderFirst.source = 1; + placeOrderFirst.storeId = orderInfo.storeId; + placeOrderFirst.subcribeTime = null; + placeOrderFirst.tableId = orderInfo.tableId; + + + + } + statusTitle() { if (isTakeOut == 0) { if (payStatus == 0) { @@ -261,7 +311,6 @@ class _OrderDetailPage extends State { } } - Widget couponRemarks() { return Container( margin: EdgeInsets.only(left: 16.w, right: 16.w, top: 8.h, bottom: 2.h), diff --git a/lib/order/order_history_page.dart b/lib/order/order_history_page.dart index a78061cf..a57f32aa 100644 --- a/lib/order/order_history_page.dart +++ b/lib/order/order_history_page.dart @@ -4,7 +4,9 @@ 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/order_info.dart'; +import 'package:huixiang/retrofit/data/order_product_vo.dart'; import 'package:huixiang/retrofit/data/page.dart'; +import 'package:huixiang/retrofit/data/product.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/utils/status_utils.dart'; import 'package:huixiang/view_widget/classic_header.dart'; @@ -528,7 +530,7 @@ class _OrderHistoryList extends State return "$totalPrice"; } - List goodsItem(List products) { + List goodsItem(List products) { if (products == null) return []; if (products.length > 3) { products = products.sublist(0, 3); diff --git a/lib/order/order_view/order_address.dart b/lib/order/order_view/order_address.dart index 94618ef2..ac601059 100644 --- a/lib/order/order_view/order_address.dart +++ b/lib/order/order_view/order_address.dart @@ -19,6 +19,7 @@ class OrderAddress extends StatefulWidget { final String title; final String center; final Function orderCancel; + final Function carryOnPay; final OrderInfo orderInfo; OrderAddress( @@ -29,8 +30,9 @@ class OrderAddress extends StatefulWidget { this.refundStatus, this.title, this.center, + this.carryOnPay, this.orderCancel, - this.orderInfo); + this.orderInfo,); @override State createState() { @@ -195,7 +197,7 @@ class _OrderAddress extends State { GestureDetector( onTap: () { if (widget.payStatus == 0) { - carryOnPay(); + widget.carryOnPay(); } else { String storeId = (widget.orderInfo != null && widget.orderInfo.storeVO != null) @@ -258,77 +260,77 @@ class _OrderAddress extends State { arguments: {"id": storeId, "storeName": storeName}); } - carryOnPay() async { - showDialog( - context: context, - builder: (context) { - return AlertDialog( - content: Container( - width: MediaQuery.of(context).size.width - 84.w, - height: 140.h, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Text( - "app暂不支持支付,\n请前往对应小程序处理", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 16.sp, - fontWeight: FontWeight.bold, - color: Colors.black, - ), - ), - SizedBox( - height: 30.h, - ), - Row( - children: [ - Expanded( - child: InkWell( - child: BorderText( - text: "取消", - textColor: Color(0xFF32A060), - fontSize: 16.sp, - fontWeight: FontWeight.bold, - borderColor: Color(0xFF32A060), - radius: 4, - padding: EdgeInsets.all(12), - borderWidth: 1, - ), - onTap: () { - Navigator.of(context).pop(); - }, - ), - flex: 1, - ), - SizedBox( - width: 16.w, - ), - Expanded( - child: InkWell( - child: RoundButton( - text: "好的", - textColor: Colors.white, - radius: 4, - padding: EdgeInsets.all(12), - backgroup: Color(0xFF32A060), - fontSize: 16.sp, - fontWeight: FontWeight.bold, - ), - onTap: () { - Navigator.of(context).pop(); - }, - ), - flex: 1, - ), - ], - ), - ], - ), - ), - ); - }, - ); - } + // carryOnPay() async { + // showDialog( + // context: context, + // builder: (context) { + // return AlertDialog( + // content: Container( + // width: MediaQuery.of(context).size.width - 84.w, + // height: 140.h, + // child: Column( + // mainAxisAlignment: MainAxisAlignment.center, + // crossAxisAlignment: CrossAxisAlignment.center, + // children: [ + // Text( + // "app暂不支持支付,\n请前往对应小程序处理", + // textAlign: TextAlign.center, + // style: TextStyle( + // fontSize: 16.sp, + // fontWeight: FontWeight.bold, + // color: Colors.black, + // ), + // ), + // SizedBox( + // height: 30.h, + // ), + // Row( + // children: [ + // Expanded( + // child: InkWell( + // child: BorderText( + // text: "取消", + // textColor: Color(0xFF32A060), + // fontSize: 16.sp, + // fontWeight: FontWeight.bold, + // borderColor: Color(0xFF32A060), + // radius: 4, + // padding: EdgeInsets.all(12), + // borderWidth: 1, + // ), + // onTap: () { + // Navigator.of(context).pop(); + // }, + // ), + // flex: 1, + // ), + // SizedBox( + // width: 16.w, + // ), + // Expanded( + // child: InkWell( + // child: RoundButton( + // text: "好的", + // textColor: Colors.white, + // radius: 4, + // padding: EdgeInsets.all(12), + // backgroup: Color(0xFF32A060), + // fontSize: 16.sp, + // fontWeight: FontWeight.bold, + // ), + // onTap: () { + // Navigator.of(context).pop(); + // }, + // ), + // flex: 1, + // ), + // ], + // ), + // ], + // ), + // ), + // ); + // }, + // ); + // } } diff --git a/lib/order/order_view/order_commodity.dart b/lib/order/order_view/order_commodity.dart index c677350b..3e41e806 100644 --- a/lib/order/order_view/order_commodity.dart +++ b/lib/order/order_view/order_commodity.dart @@ -1,16 +1,15 @@ - - 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/order_product_vo.dart'; +import 'package:huixiang/retrofit/data/product.dart'; +import 'package:huixiang/retrofit/data/settlement_bean.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/separator.dart'; class OrderCommodity extends StatefulWidget { - - final OrderInfo orderInfo; OrderCommodity(this.orderInfo); @@ -19,7 +18,6 @@ class OrderCommodity extends StatefulWidget { State createState() { return _OrderCommodity(); } - } class _OrderCommodity extends State { @@ -66,38 +64,57 @@ class _OrderCommodity 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()); + widgets.addAll( + widget.orderInfo.productList.map((e) => commodityItem(e)).toList()); } widgets.add(SizedBox(height: 20.h)); if (widget.orderInfo.isTakeOut != 0) { // 配送费 - widgets.add(discountItem( + widgets.add( + discountItem( Color(0xFFFF7A1A), widget.orderInfo.isTakeOut == 1 ? S.of(context).peisongfei : S.of(context).yunfei, "", - "+${widget.orderInfo.postFee}")); + "+${widget.orderInfo.postFee}", + ), + ); } if (widget.orderInfo.orderDetail != null && widget.orderInfo.orderDetail.couponDTO != null) { // 配送费 - widgets.add(discountItem( + widgets.add( + discountItem( Color(0xFFFF7A1A), S.of(context).youhuiquan, widget.orderInfo.orderDetail.couponDTO.name, - widget.orderInfo.orderDetail.couponDTO.money)); + widget.orderInfo.orderDetail.couponDTO.money, + ), + ); + } + if (widget.orderInfo.orderDetail != null && + widget.orderInfo.orderDetail.activityPrice != null && + double.tryParse(widget.orderInfo.orderDetail.activityPrice ?? "0") > 0) { + // 配送费 + widgets.add( + discountItem( + Color(0xFFFF7A1A), + "活动", + widget.orderInfo.orderDetail.promotionName, + "- ${widget.orderInfo.orderDetail.activityPrice}", + ), + ); } - if (widget.orderInfo.storeVO != null && widget.orderInfo.storeVO.couponVO != null) { + if (widget.orderInfo.storeVO != null && + widget.orderInfo.storeVO.couponVO != null) { // widgets.add(discountItem(Color(0xFF32A060), // orderInfo.storeVO.couponVO.storeName, // S.of(context).huodongjianmianpeisongfei(orderInfo.storeVO.couponVO.discountAmount), @@ -119,7 +136,7 @@ class _OrderCommodity extends State { return widgets; } - Widget commodityItem(ProductList productList) { + Widget commodityItem(OrderProductVOList productList) { return Container( margin: EdgeInsets.only(top: 8.h, bottom: 8.h), child: Row( @@ -171,8 +188,8 @@ class _OrderCommodity extends State { Expanded( flex: 1, child: Text( - productList.weight != null - ? "${productList.weight}kg" + productList.skuNameStr != null + ? "${productList.skuNameStr}" : "", overflow: TextOverflow.ellipsis, style: TextStyle( @@ -329,39 +346,50 @@ class _OrderCommodity 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.productList != null) + ? widget.orderInfo.productList.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, ), Container( child: Text( - S.of(context).jiesuanjine, + "已优惠:¥${widget.orderInfo.orderDetail.activityPrice}", style: TextStyle( fontSize: 12.sp, - color: Color(0xFF353535), - fontWeight:MyFontWeight.semi_bold + color: Color(0xFF7B7B7B), + fontWeight: MyFontWeight.medium, ), ), ), + SizedBox( + width: 15.w, + ), + Container( + child: Text( + S.of(context).jiesuanjine, + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF353535), + fontWeight: MyFontWeight.semi_bold), + ), + ), SizedBox( width: 5.w, ), Text( - totalPrice(), + "${widget.orderInfo.orderDetail.paySumPrice}" + /*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), ) ], ), @@ -374,9 +402,9 @@ class _OrderCommodity extends State { double.tryParse(widget.orderInfo.postFee)); if (widget.orderInfo.orderDetail != null && widget.orderInfo.orderDetail.couponDTO != null) { - totalPrice -= double.tryParse(widget.orderInfo.orderDetail.couponDTO.money); + totalPrice -= + double.tryParse(widget.orderInfo.orderDetail.couponDTO.money); } return "$totalPrice"; } - -} \ No newline at end of file +} diff --git a/lib/retrofit/data/down_order.dart b/lib/retrofit/data/down_order.dart new file mode 100644 index 00000000..3c5d84bc --- /dev/null +++ b/lib/retrofit/data/down_order.dart @@ -0,0 +1,135 @@ +import 'package:huixiang/retrofit/data/order_product_vo.dart'; + +class DownOrder { + DownOrder({ + String id, + String orderCode, + dynamic storeId, + dynamic storeName, + dynamic orderStatus, + dynamic returnType, + dynamic shipperCode, + dynamic logisticsNum, + String orderSum, + dynamic accountPay, + dynamic discountAmount, + dynamic postFee, + dynamic paySum, + dynamic overTime, + List orderProductVOList, + dynamic moneyReturnList, + dynamic goodsReturnList, + dynamic tablePrice, + dynamic parentCode, + String parentId, + dynamic peopleNum, + int orderSource, + }) { + this.id = id; + this.orderCode = orderCode; + this.storeId = storeId; + this.storeName = storeName; + this.orderStatus = orderStatus; + this.returnType = returnType; + this.shipperCode = shipperCode; + this.logisticsNum = logisticsNum; + this.orderSum = orderSum; + this.accountPay = accountPay; + this.discountAmount = discountAmount; + this.postFee = postFee; + this.paySum = paySum; + this.overTime = overTime; + this.orderProductVOList = orderProductVOList; + this.moneyReturnList = moneyReturnList; + this.goodsReturnList = goodsReturnList; + this.tablePrice = tablePrice; + this.parentCode = parentCode; + this.parentId = parentId; + this.peopleNum = peopleNum; + this.orderSource = orderSource; + } + + DownOrder.fromJson(dynamic json) { + this.id = json['id']; + this.orderCode = json['orderCode']; + this.storeId = json['storeId']; + this.storeName = json['storeName']; + this.orderStatus = json['orderStatus']; + this.returnType = json['returnType']; + this.shipperCode = json['shipperCode']; + this.logisticsNum = json['logisticsNum']; + this.orderSum = json['orderSum']; + this.accountPay = json['accountPay']; + this.discountAmount = json['discountAmount']; + this.postFee = json['postFee']; + this.paySum = json['paySum']; + this.overTime = json['overTime']; + if (json['orderProductVOList'] != null) { + this.orderProductVOList = []; + json['orderProductVOList'].forEach((v) { + this.orderProductVOList.add(OrderProductVOList.fromJson(v)); + }); + } + this.moneyReturnList = json['moneyReturnList']; + this.goodsReturnList = json['goodsReturnList']; + this.tablePrice = json['tablePrice']; + this.parentCode = json['parentCode']; + this.parentId = json['parentId']; + this.peopleNum = json['peopleNum']; + this.orderSource = json['orderSource']; + } + + String id; + String orderCode; + dynamic storeId; + dynamic storeName; + dynamic orderStatus; + dynamic returnType; + dynamic shipperCode; + dynamic logisticsNum; + String orderSum; + dynamic accountPay; + dynamic discountAmount; + dynamic postFee; + dynamic paySum; + dynamic overTime; + List orderProductVOList; + dynamic moneyReturnList; + dynamic goodsReturnList; + dynamic tablePrice; + dynamic parentCode; + String parentId; + dynamic peopleNum; + int orderSource; + + Map toJson() { + final map = {}; + map['id'] = this.id; + map['orderCode'] = this.orderCode; + map['storeId'] = this.storeId; + map['storeName'] = this.storeName; + map['orderStatus'] = this.orderStatus; + map['returnType'] = this.returnType; + map['shipperCode'] = this.shipperCode; + map['logisticsNum'] = this.logisticsNum; + map['orderSum'] = this.orderSum; + map['accountPay'] = this.accountPay; + map['discountAmount'] = this.discountAmount; + map['postFee'] = this.postFee; + map['paySum'] = this.paySum; + map['overTime'] = this.overTime; + if (this.orderProductVOList != null) { + map['orderProductVOList'] = + this.orderProductVOList.map((v) => v.toJson()).toList(); + } + map['moneyReturnList'] = this.moneyReturnList; + map['goodsReturnList'] = this.goodsReturnList; + map['tablePrice'] = this.tablePrice; + map['parentCode'] = this.parentCode; + map['parentId'] = this.parentId; + map['peopleNum'] = this.peopleNum; + map['orderSource'] = this.orderSource; + return map; + } +} + diff --git a/lib/retrofit/data/order_info.dart b/lib/retrofit/data/order_info.dart index 20a0757e..12628ffe 100644 --- a/lib/retrofit/data/order_info.dart +++ b/lib/retrofit/data/order_info.dart @@ -1,4 +1,8 @@ +import 'package:huixiang/retrofit/data/down_order.dart'; +import 'package:huixiang/retrofit/data/order_product_vo.dart'; +import 'package:huixiang/retrofit/data/shoppingCart.dart'; + /// id : "1408358257373741056" /// createTime : "2021-06-25 17:35:49" /// createUser : "1404743858104827904" @@ -73,6 +77,7 @@ class OrderInfo { String _parentId; String _parentCode; String _orderCode; + String _orderType; String _dayFlowCode; int _orderStatus; int _sendStatus; @@ -118,7 +123,7 @@ class OrderInfo { int _orderSource; StoreVO _storeVO; OrderDetail _orderDetail; - List _productList; + List _productList; String get id => _id; @@ -145,6 +150,7 @@ class OrderInfo { String get parentCode => _parentCode; String get orderCode => _orderCode; + String get orderType => _orderType; String get dayFlowCode => _dayFlowCode; @@ -236,68 +242,68 @@ class OrderInfo { OrderDetail get orderDetail => _orderDetail; - List get productList => _productList; + List get productList => _productList; OrderInfo( {String id, - String createTime, - String createUser, - String updateTime, - String updateUser, - String tenantCode, - String storeId, - String storeName, - String tableId, - String mid, - String parentId, - String parentCode, - String orderCode, - String dayFlowCode, - int orderStatus, - int sendStatus, - int payStatus, - String memberAccount, - String logisticsId, - String shipperCode, - String logisticsName, - String logisticsNum, - dynamic logisticsCase, - int refundStatus, - AddressExt addressExt, - String postFee, - String orderSum, - String paySum, - String paySumSub, - String accountPay, - String couponSubPrice, - String customPrice, - String removeDecimal, - bool isSubscribe, - dynamic subcribeTime, - dynamic sendTime, - dynamic confirmTime, - dynamic returnMoneyTime, - String notes, - dynamic prepayId, - String payTime, - int payChannel, - String payNum, - String promotionId, - String couponId, - int isDelete, - int isTakeOut, - int batch, - String orderDiscountPrice, - String dishesDiscountPrice, - String orderPercentPrice, - String finalPayPrice, - String activityNoPrice, - String activityDiscountPrice, - String totalDiscountPrice, - int orderSource, - StoreVO storeVO, - OrderDetail orderDetail, - List productList}) { + String createTime, + String createUser, + String updateTime, + String updateUser, + String tenantCode, + String storeId, + String storeName, + String tableId, + String mid, + String parentId, + String parentCode, + String orderCode, + String dayFlowCode, + int orderStatus, + int sendStatus, + int payStatus, + String memberAccount, + String logisticsId, + String shipperCode, + String logisticsName, + String logisticsNum, + dynamic logisticsCase, + int refundStatus, + AddressExt addressExt, + String postFee, + String orderSum, + String paySum, + String paySumSub, + String accountPay, + String couponSubPrice, + String customPrice, + String removeDecimal, + bool isSubscribe, + dynamic subcribeTime, + dynamic sendTime, + dynamic confirmTime, + dynamic returnMoneyTime, + String notes, + dynamic prepayId, + String payTime, + int payChannel, + String payNum, + String promotionId, + String couponId, + int isDelete, + int isTakeOut, + int batch, + String orderDiscountPrice, + String dishesDiscountPrice, + String orderPercentPrice, + String finalPayPrice, + String activityNoPrice, + String activityDiscountPrice, + String totalDiscountPrice, + int orderSource, + StoreVO storeVO, + OrderDetail orderDetail, + List< OrderProductVOList> productList}) { _id = id; _createTime = createTime; _createUser = createUser; @@ -311,6 +317,7 @@ class OrderInfo { _parentId = parentId; _parentCode = parentCode; _orderCode = orderCode; + _orderType = orderType; _dayFlowCode = dayFlowCode; _orderStatus = orderStatus; _sendStatus = sendStatus; @@ -373,6 +380,7 @@ class OrderInfo { _parentId = json["parentId"]; _parentCode = json["parentCode"]; _orderCode = json["orderCode"]; + _orderType = json["orderType"]; _dayFlowCode = json["dayFlowCode"]; _orderStatus = json["orderStatus"]; _sendStatus = json["sendStatus"]; @@ -419,14 +427,14 @@ class OrderInfo { _totalDiscountPrice = json["totalDiscountPrice"]; _orderSource = json["orderSource"]; _storeVO = - json["storeVO"] != null ? StoreVO.fromJson(json["storeVO"]) : null; + json["storeVO"] != null ? StoreVO.fromJson(json["storeVO"]) : null; _orderDetail = json["orderDetail"] != null ? OrderDetail.fromJson(json["orderDetail"]) : null; if (json["productList"] != null) { _productList = []; json["productList"].forEach((v) { - _productList.add(ProductList.fromJson(v)); + _productList.add( OrderProductVOList.fromJson(v)); }); } } @@ -446,6 +454,7 @@ class OrderInfo { map["parentId"] = _parentId; map["parentCode"] = _parentCode; map["orderCode"] = _orderCode; + map["orderType"] = _orderType; map["dayFlowCode"] = _dayFlowCode; map["orderStatus"] = _orderStatus; map["sendStatus"] = _sendStatus; @@ -529,187 +538,6 @@ class OrderInfo { /// status : true /// batch : 1 -class ProductList { - String _id; - String _createTime; - String _createUser; - String _updateTime; - String _updateUser; - dynamic _tenantCode; - String _storeId; - String _orderId; - String _productId; - String _productName; - String _skuId; - String _skuNameStr; - String _skuImg; - int _buyNum; - int _refundNum; - double _weight; - String _applyPrice; - String _sellPrice; - String _postPay; - int _isDelete; - String _discountAmount; - int _discountPercent; - bool _status; - int _batch; - - String get id => _id; - - String get createTime => _createTime; - - String get createUser => _createUser; - - String get updateTime => _updateTime; - - String get updateUser => _updateUser; - - dynamic get tenantCode => _tenantCode; - - String get storeId => _storeId; - - String get orderId => _orderId; - - String get productId => _productId; - - String get productName => _productName; - - String get skuId => _skuId; - - String get skuNameStr => _skuNameStr; - - String get skuImg => _skuImg; - - int get buyNum => _buyNum; - - int get refundNum => _refundNum; - - double get weight => _weight; - - String get applyPrice => _applyPrice; - - String get sellPrice => _sellPrice; - - String get postPay => _postPay; - - int get isDelete => _isDelete; - - String get discountAmount => _discountAmount; - - int get discountPercent => _discountPercent; - - bool get status => _status; - - int get batch => _batch; - - ProductList( - {String id, - String createTime, - String createUser, - String updateTime, - String updateUser, - dynamic tenantCode, - String storeId, - String orderId, - String productId, - String productName, - String skuId, - String skuNameStr, - String skuImg, - int buyNum, - int refundNum, - double weight, - String applyPrice, - String sellPrice, - String postPay, - int isDelete, - String discountAmount, - int discountPercent, - bool status, - int batch}) { - _id = id; - _createTime = createTime; - _createUser = createUser; - _updateTime = updateTime; - _updateUser = updateUser; - _tenantCode = tenantCode; - _storeId = storeId; - _orderId = orderId; - _productId = productId; - _productName = productName; - _skuId = skuId; - _skuNameStr = skuNameStr; - _skuImg = skuImg; - _buyNum = buyNum; - _refundNum = refundNum; - _weight = weight; - _applyPrice = applyPrice; - _sellPrice = sellPrice; - _postPay = postPay; - _isDelete = isDelete; - _discountAmount = discountAmount; - _discountPercent = discountPercent; - _status = status; - _batch = batch; - } - - ProductList.fromJson(dynamic json) { - _id = json["id"]; - _createTime = json["createTime"]; - _createUser = json["createUser"]; - _updateTime = json["updateTime"]; - _updateUser = json["updateUser"]; - _tenantCode = json["tenantCode"]; - _storeId = json["storeId"]; - _orderId = json["orderId"]; - _productId = json["productId"]; - _productName = json["productName"]; - _skuId = json["skuId"]; - _skuNameStr = json["skuNameStr"]; - _skuImg = json["skuImg"]; - _buyNum = json["buyNum"]; - _refundNum = json["refundNum"]; - _weight = json["weight"]; - _applyPrice = json["applyPrice"]; - _sellPrice = json["sellPrice"]; - _postPay = json["postPay"]; - _isDelete = json["isDelete"]; - _discountAmount = json["discountAmount"]; - _discountPercent = json["discountPercent"]; - _status = json["status"]; - _batch = json["batch"]; - } - - Map toJson() { - var map = {}; - map["id"] = _id; - map["createTime"] = _createTime; - map["createUser"] = _createUser; - map["updateTime"] = _updateTime; - map["updateUser"] = _updateUser; - map["tenantCode"] = _tenantCode; - map["storeId"] = _storeId; - map["orderId"] = _orderId; - map["productId"] = _productId; - map["productName"] = _productName; - map["skuId"] = _skuId; - map["skuNameStr"] = _skuNameStr; - map["skuImg"] = _skuImg; - map["buyNum"] = _buyNum; - map["refundNum"] = _refundNum; - map["weight"] = _weight; - map["applyPrice"] = _applyPrice; - map["sellPrice"] = _sellPrice; - map["postPay"] = _postPay; - map["isDelete"] = _isDelete; - map["discountAmount"] = _discountAmount; - map["discountPercent"] = _discountPercent; - map["status"] = _status; - map["batch"] = _batch; - return map; - } -} /// orderProductList : [{"id":"1408358257390518272","platterList":null,"tenantCode":"1177","storeId":"1344490596986781696","orderId":"1408358257373741056","productId":"1404742074535772160","productName":"商品1","skuId":"1404744485652398080","skuNameStr":"中","skuImg":"","buyNum":2,"refundNum":0,"weight":0,"applyPrice":"0.00","sellPrice":"10.00","postPay":"0.00","isDelete":0,"discountAmount":"2.20","discountPercent":100}] /// discountName : null @@ -738,7 +566,7 @@ class ProductList { /// predictTime : null class OrderDetail { - List _orderProductList; + List< OrderProductVOList> _orderProductList; dynamic _discountName; dynamic _discountMoney; dynamic _discountNumber; @@ -748,6 +576,7 @@ class OrderDetail { String _paySumPrice; String _activityNoPrice; String _activityPrice; + String _promotionName; List _dishesList; String _customPrice; String _nextPerson; @@ -764,7 +593,7 @@ class OrderDetail { int _mins; dynamic _predictTime; - List get orderProductList => _orderProductList; + List< OrderProductVOList> get orderProductList => _orderProductList; dynamic get discountName => _discountName; @@ -783,6 +612,7 @@ class OrderDetail { String get activityNoPrice => _activityNoPrice; String get activityPrice => _activityPrice; + String get promotionName => _promotionName; List get dishesList => _dishesList; @@ -815,31 +645,32 @@ class OrderDetail { dynamic get predictTime => _predictTime; OrderDetail( - {List orderProductList, - dynamic discountName, - dynamic discountMoney, - dynamic discountNumber, - dynamic activityName, - CouponDTO couponDTO, - String orderSumPrice, - String paySumPrice, - String activityNoPrice, - String activityPrice, - List dishesList, - String customPrice, - String nextPerson, - int isTakeOut, - dynamic memberRec, - dynamic isSubscribe, - dynamic subcribeTime, - String postFee, - String shipperCode, - String logisticsName, - String logisticsNum, - int orderNum, - int productNum, - int mins, - dynamic predictTime}) { + {List< OrderProductVOList> orderProductList, + dynamic discountName, + dynamic discountMoney, + dynamic discountNumber, + dynamic activityName, + CouponDTO couponDTO, + String orderSumPrice, + String paySumPrice, + String activityNoPrice, + String activityPrice, + String promotionName, + List dishesList, + String customPrice, + String nextPerson, + int isTakeOut, + dynamic memberRec, + dynamic isSubscribe, + dynamic subcribeTime, + String postFee, + String shipperCode, + String logisticsName, + String logisticsNum, + int orderNum, + int productNum, + int mins, + dynamic predictTime}) { _orderProductList = orderProductList; _discountName = discountName; _discountMoney = discountMoney; @@ -850,6 +681,7 @@ class OrderDetail { _paySumPrice = paySumPrice; _activityNoPrice = activityNoPrice; _activityPrice = activityPrice; + _promotionName = promotionName; _dishesList = dishesList; _customPrice = customPrice; _nextPerson = nextPerson; @@ -871,7 +703,7 @@ class OrderDetail { if (json["orderProductList"] != null) { _orderProductList = []; json["orderProductList"].forEach((v) { - _orderProductList.add(ProductList.fromJson(v)); + _orderProductList.add( OrderProductVOList.fromJson(v)); }); } _discountName = json["discountName"]; @@ -883,6 +715,7 @@ class OrderDetail { _paySumPrice = json["paySumPrice"]; _activityNoPrice = json["activityNoPrice"]; _activityPrice = json["activityPrice"]; + _promotionName = json["promotionName"]; if (json["dishesList"] != null) { _dishesList = []; json["dishesList"].forEach((v) { @@ -1070,36 +903,36 @@ class StoreVO { StoreVO( {String id, - String storeName, - String nickName, - String businessService, - String businessType, - String logo, - String openStartTime, - String openEndTime, - String shipAddress, - dynamic remark, - String mobile, - dynamic refundAddress, - dynamic refundTel, - dynamic refundContact, - int isAutoSendRefundAddress, - dynamic soldNum, - dynamic storeTemplateConfig, - dynamic storeTable, - dynamic threshold, - dynamic freePostAge, - dynamic logisticsThreshold, - dynamic logisticsFreePostAge, - String longitude, - String latitude, - dynamic deliveryDistance, - dynamic couponVO, - PosType posType, - dynamic banners, - dynamic tips, - dynamic storeBrandImg, - dynamic defaultPostAge}) { + String storeName, + String nickName, + String businessService, + String businessType, + String logo, + String openStartTime, + String openEndTime, + String shipAddress, + dynamic remark, + String mobile, + dynamic refundAddress, + dynamic refundTel, + dynamic refundContact, + int isAutoSendRefundAddress, + dynamic soldNum, + dynamic storeTemplateConfig, + dynamic storeTable, + dynamic threshold, + dynamic freePostAge, + dynamic logisticsThreshold, + dynamic logisticsFreePostAge, + String longitude, + String latitude, + dynamic deliveryDistance, + dynamic couponVO, + PosType posType, + dynamic banners, + dynamic tips, + dynamic storeBrandImg, + dynamic defaultPostAge}) { _id = id; _storeName = storeName; _nickName = nickName; @@ -1161,7 +994,7 @@ class StoreVO { _deliveryDistance = json["deliveryDistance"]; _couponVO = json["couponVO"]; _posType = - json["posType"] != null ? PosType.fromJson(json["posType"]) : null; + json["posType"] != null ? PosType.fromJson(json["posType"]) : null; _banners = json["banners"]; _tips = json["tips"]; _storeBrandImg = json["storeBrandImg"]; @@ -1297,19 +1130,19 @@ class AddressExt { AddressExt( {dynamic addressId, - dynamic country, - dynamic countryId, - String province, - dynamic provinceId, - String city, - dynamic cityId, - String district, - dynamic districtId, - String address, - dynamic recName, - dynamic recMobile, - String longitude, - String latitude}) { + dynamic country, + dynamic countryId, + String province, + dynamic provinceId, + String city, + dynamic cityId, + String district, + dynamic districtId, + String address, + dynamic recName, + dynamic recMobile, + String longitude, + String latitude}) { _addressId = addressId; _country = country; _countryId = countryId; diff --git a/lib/retrofit/data/order_product_vo.dart b/lib/retrofit/data/order_product_vo.dart new file mode 100644 index 00000000..5b150446 --- /dev/null +++ b/lib/retrofit/data/order_product_vo.dart @@ -0,0 +1,685 @@ + +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, + String 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; + String _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; + String 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(String value) { + _skuId = value; + } + + set skuImg(String value) { + _skuImg = value; + } + + set skuNameStr(String value) { + _skuNameStr = 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; + } +} + +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; + } +} + +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; + } +} diff --git a/lib/retrofit/data/placeOrderFirst.dart b/lib/retrofit/data/placeOrderFirst.dart index d93ab4a6..da05b643 100644 --- a/lib/retrofit/data/placeOrderFirst.dart +++ b/lib/retrofit/data/placeOrderFirst.dart @@ -1,491 +1,135 @@ +import 'package:huixiang/retrofit/data/down_order.dart'; +import 'package:huixiang/retrofit/data/order_product_vo.dart'; 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; + int cartNum; + String cartSum; + String addressId; + bool isSubscribe; + num isTakeOut; + String notes; + String id; + String numberOfPeople; + num orderSource; + String orderType; + num orderTypeId; + String parentCode; + String parentId; + num payChannel; + PromotionInfoDTOBean promotionInfoDTO; + String recMobile; + List orderProductVOList; + List shoppingCartSkuItemList; + List skuItemDTOList; + num source; + String storeId; + String subcribeTime; + String tableId; + + PlaceOrderFirst( + { + this.cartNum, + this.cartSum, + this.addressId, + this.isSubscribe, + this.isTakeOut, + this.notes, + this.id, + this.numberOfPeople, + this.orderSource, + this.orderType, + this.orderTypeId, + this.parentCode, + this.parentId, + this.payChannel, + this.promotionInfoDTO, + this.recMobile, + this.orderProductVOList, + this.shoppingCartSkuItemList, + this.skuItemDTOList, + this.source, + this.storeId, + this.subcribeTime, + this.tableId}); + + static PlaceOrderFirst fromJson(Map json) { + if (json == null) return null; + PlaceOrderFirst placeOrderFirst = PlaceOrderFirst(); + placeOrderFirst.cartNum = json['cartNum']; + placeOrderFirst.cartSum = json['cartSum']; + placeOrderFirst.addressId = json['addressId']; + placeOrderFirst.isSubscribe = json['isSubscribe']; + placeOrderFirst.isTakeOut = json['isTakeOut']; + placeOrderFirst.notes = json['notes']; + placeOrderFirst.id = json['id']; + placeOrderFirst.numberOfPeople = json['numberOfPeople']; + placeOrderFirst.orderSource = json['orderSource']; + placeOrderFirst.orderType = json['orderType']; + placeOrderFirst.orderTypeId = json['orderTypeId']; + placeOrderFirst.parentCode = json['parentCode']; + placeOrderFirst.parentId = json['parentId']; + placeOrderFirst.payChannel = json['payChannel']; + placeOrderFirst.promotionInfoDTO = + PromotionInfoDTOBean.fromJson(json['promotionInfoDTO']); + placeOrderFirst.recMobile = json['recMobile']; + placeOrderFirst.shoppingCartSkuItemList = []..addAll( + (json['shoppingCartSkuItemList'] as List ?? []) + .map((o) => ShoppingCartSkuItemListBean.fromJson(o))); + placeOrderFirst.orderProductVOList = []..addAll( + (json['orderProductVOList'] as List ?? []) + .map((o) => OrderProductVOList.fromJson(o))); + placeOrderFirst.skuItemDTOList = json['skuItemDTOList']; + placeOrderFirst.source = json['source']; + placeOrderFirst.storeId = json['storeId']; + placeOrderFirst.subcribeTime = json['subcribeTime']; + placeOrderFirst.tableId = json['tableId']; + return placeOrderFirst; + } + + Map toJson() => { + "cartNum": cartNum, + "cartSum": cartSum, + "addressId": addressId, + "isSubscribe": isSubscribe, + "isTakeOut": isTakeOut, + "notes": notes, + "id": id, + "numberOfPeople": numberOfPeople, + "orderSource": orderSource, + "orderType": orderType, + "orderTypeId": orderTypeId, + "parentCode": parentCode, + "parentId": parentId, + "payChannel": payChannel, + "promotionInfoDTO": promotionInfoDTO == null ? null : promotionInfoDTO.toJson(), + "recMobile": recMobile, + "shoppingCartSkuItemList": shoppingCartSkuItemList == null ? null : shoppingCartSkuItemList.map((e) => e.toJson()).toList(), + "orderProductVOList": orderProductVOList == null ? null : orderProductVOList.map((e) => e.toJson()).toList(), + "skuItemDTOList": skuItemDTOList, + "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; - } +class PromotionInfoDTOBean { + String couponId; + String promotionId; - 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; - } + PromotionInfoDTOBean({this.couponId, this.promotionId}); - set promotionInfoDTO(PlaceOrderFirstPromotionInfoDTO value) { - _promotionInfoDTO = value; + static PromotionInfoDTOBean fromJson(Map json) { + if (json == null) return null; + PromotionInfoDTOBean promotionInfoDTOBean = PromotionInfoDTOBean(); + promotionInfoDTOBean.couponId = json['couponId']; + promotionInfoDTOBean.promotionId = json['promotionId']; + return promotionInfoDTOBean; } - 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; - } + Map toJson() => { + "couponId": couponId, + "promotionId": promotionId, + }; } - -/// 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/product.dart b/lib/retrofit/data/product.dart new file mode 100644 index 00000000..afd86b87 --- /dev/null +++ b/lib/retrofit/data/product.dart @@ -0,0 +1,182 @@ + +class ProductList { + String _id; + String _createTime; + String _createUser; + String _updateTime; + String _updateUser; + dynamic _tenantCode; + String _storeId; + String _orderId; + String _productId; + String _productName; + String _skuId; + String _skuNameStr; + String _skuImg; + int _buyNum; + int _refundNum; + double _weight; + String _applyPrice; + String _sellPrice; + String _postPay; + int _isDelete; + String _discountAmount; + int _discountPercent; + bool _status; + int _batch; + + String get id => _id; + + String get createTime => _createTime; + + String get createUser => _createUser; + + String get updateTime => _updateTime; + + String get updateUser => _updateUser; + + dynamic get tenantCode => _tenantCode; + + String get storeId => _storeId; + + String get orderId => _orderId; + + String get productId => _productId; + + String get productName => _productName; + + String get skuId => _skuId; + + String get skuNameStr => _skuNameStr; + + String get skuImg => _skuImg; + + int get buyNum => _buyNum; + + int get refundNum => _refundNum; + + double get weight => _weight; + + String get applyPrice => _applyPrice; + + String get sellPrice => _sellPrice; + + String get postPay => _postPay; + + int get isDelete => _isDelete; + + String get discountAmount => _discountAmount; + + int get discountPercent => _discountPercent; + + bool get status => _status; + + int get batch => _batch; + + ProductList( + {String id, + String createTime, + String createUser, + String updateTime, + String updateUser, + dynamic tenantCode, + String storeId, + String orderId, + String productId, + String productName, + String skuId, + String skuNameStr, + String skuImg, + int buyNum, + int refundNum, + double weight, + String applyPrice, + String sellPrice, + String postPay, + int isDelete, + String discountAmount, + int discountPercent, + bool status, + int batch}) { + _id = id; + _createTime = createTime; + _createUser = createUser; + _updateTime = updateTime; + _updateUser = updateUser; + _tenantCode = tenantCode; + _storeId = storeId; + _orderId = orderId; + _productId = productId; + _productName = productName; + _skuId = skuId; + _skuNameStr = skuNameStr; + _skuImg = skuImg; + _buyNum = buyNum; + _refundNum = refundNum; + _weight = weight; + _applyPrice = applyPrice; + _sellPrice = sellPrice; + _postPay = postPay; + _isDelete = isDelete; + _discountAmount = discountAmount; + _discountPercent = discountPercent; + _status = status; + _batch = batch; + } + + ProductList.fromJson(dynamic json) { + _id = json["id"]; + _createTime = json["createTime"]; + _createUser = json["createUser"]; + _updateTime = json["updateTime"]; + _updateUser = json["updateUser"]; + _tenantCode = json["tenantCode"]; + _storeId = json["storeId"]; + _orderId = json["orderId"]; + _productId = json["productId"]; + _productName = json["productName"]; + _skuId = json["skuId"]; + _skuNameStr = json["skuNameStr"]; + _skuImg = json["skuImg"]; + _buyNum = json["buyNum"]; + _refundNum = json["refundNum"]; + _weight = json["weight"]; + _applyPrice = json["applyPrice"]; + _sellPrice = json["sellPrice"]; + _postPay = json["postPay"]; + _isDelete = json["isDelete"]; + _discountAmount = json["discountAmount"]; + _discountPercent = json["discountPercent"]; + _status = json["status"]; + _batch = json["batch"]; + } + + Map toJson() { + var map = {}; + map["id"] = _id; + map["createTime"] = _createTime; + map["createUser"] = _createUser; + map["updateTime"] = _updateTime; + map["updateUser"] = _updateUser; + map["tenantCode"] = _tenantCode; + map["storeId"] = _storeId; + map["orderId"] = _orderId; + map["productId"] = _productId; + map["productName"] = _productName; + map["skuId"] = _skuId; + map["skuNameStr"] = _skuNameStr; + map["skuImg"] = _skuImg; + map["buyNum"] = _buyNum; + map["refundNum"] = _refundNum; + map["weight"] = _weight; + map["applyPrice"] = _applyPrice; + map["sellPrice"] = _sellPrice; + map["postPay"] = _postPay; + map["isDelete"] = _isDelete; + map["discountAmount"] = _discountAmount; + map["discountPercent"] = _discountPercent; + map["status"] = _status; + map["batch"] = _batch; + return map; + } +} diff --git a/lib/retrofit/data/settlement_bean.dart b/lib/retrofit/data/settlement_bean.dart index d612b14d..c932fbe7 100644 --- a/lib/retrofit/data/settlement_bean.dart +++ b/lib/retrofit/data/settlement_bean.dart @@ -1,3 +1,5 @@ +import 'package:huixiang/retrofit/data/order_product_vo.dart'; + /// addressId : 0 /// buyNum : 0 /// id : 0 @@ -139,743 +141,3 @@ class PromotionInfoDTO { } } -/// 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, - String 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; - String _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; - String 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(String 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/min_api.dart b/lib/retrofit/min_api.dart index 59c1a1e8..0bee7037 100644 --- a/lib/retrofit/min_api.dart +++ b/lib/retrofit/min_api.dart @@ -9,8 +9,10 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/retrofit/data/address.dart'; import 'package:huixiang/retrofit/data/base_data.dart'; +import 'package:huixiang/retrofit/data/down_order.dart'; import 'package:huixiang/retrofit/data/placeOrderFirst.dart'; import 'package:huixiang/retrofit/data/settlement_bean.dart'; +import 'package:huixiang/retrofit/data/wx_pay.dart'; import 'package:huixiang/view_widget/login_tips_dialog.dart'; import 'package:retrofit/retrofit.dart'; @@ -45,7 +47,6 @@ abstract class MinApiService { String tenant, String storeId, bool showLoading = true, - bool pay = false, }) { Map headers = (token == null || token == "") ? {} : {'token': "Bearer $token"}; @@ -55,9 +56,7 @@ abstract class MinApiService { if (storeId != null && storeId != "") { headers["store_id"] = storeId; } - if (pay) { - headers["Environment"] = "app"; - } + headers["Environment"] = "app"; dio.options = BaseOptions( connectTimeout: 60000, receiveTimeout: 60000, @@ -173,7 +172,11 @@ abstract class MinApiService { ///小程序下单 @POST("order/placeOrderFirst") - Future placeOrderFirst(@Body() Map param); + Future> placeOrderFirst(@Body() Map param); + + /// 结算 + @POST("order/settlement") + Future> settlementWx(@Body() Map param); /// 结算 @POST("order/settlement") diff --git a/lib/retrofit/min_api.g.dart b/lib/retrofit/min_api.g.dart index 1d33c8eb..f233b182 100644 --- a/lib/retrofit/min_api.g.dart +++ b/lib/retrofit/min_api.g.dart @@ -226,7 +226,7 @@ class _MinApiService implements MinApiService { } @override - Future> placeOrderFirst(param) async { + Future> placeOrderFirst(param) async { ArgumentError.checkNotNull(param, 'param'); const _extra = {}; final queryParameters = {}; @@ -241,9 +241,31 @@ class _MinApiService implements MinApiService { extra: _extra, baseUrl: baseUrl), data: _data); - final value = BaseData.fromJson( + final value = BaseData.fromJson( _result.data, - (json) => json as dynamic, + (json) => DownOrder.fromJson(json), + ); + return value; + } + + @override + Future> settlementWx(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) => WxPay.fromJson(json), ); return value; } diff --git a/lib/settlement/settlement.dart b/lib/settlement/settlement.dart index fa5be140..efaf677f 100644 --- a/lib/settlement/settlement.dart +++ b/lib/settlement/settlement.dart @@ -4,13 +4,17 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'; import 'package:flutter_baidu_mapapi_utils/flutter_baidu_mapapi_utils.dart'; +import 'package:fluwx/fluwx.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/retrofit/data/address.dart'; import 'package:huixiang/retrofit/data/base_data.dart'; +import 'package:huixiang/retrofit/data/down_order.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/data/wx_pay.dart'; import 'package:huixiang/retrofit/min_api.dart'; import 'package:huixiang/settlement/settlement_view/activity_coupon_remarks.dart'; import 'package:huixiang/settlement/settlement_view/distribution.dart'; @@ -20,6 +24,7 @@ import 'package:huixiang/settlement/settlement_view/settlement_activity.dart'; import 'package:huixiang/settlement/settlement_view/settlement_coupon.dart'; import 'package:huixiang/settlement/settlement_view/settlement_order_commodity.dart'; import 'package:huixiang/utils/font_weight.dart'; +import 'package:huixiang/utils/min.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/round_button.dart'; import 'package:shared_preferences/shared_preferences.dart'; @@ -40,9 +45,14 @@ class _Settlement extends State { MinApiService minService; Function(int type) callback; StoreInfo storeInfo; + ShoppingCart shopCarGoods; SettleOrderInfo settleOrderInfo; int selectedBtn = 0; + String remakers = ""; + int payChannel = 4; + String tableId = "0"; + Address address; CouponListBean couponListBean; PromotionInfoListBean promotion; String mobile; @@ -51,6 +61,7 @@ class _Settlement extends State { void initState() { super.initState(); storeInfo = widget.arguments["storeInfo"]; + shopCarGoods = widget.arguments["shoppingCart"]; SharedPreferences.getInstance().then((value) { String minToken = value.getString("minToken"); @@ -76,7 +87,7 @@ class _Settlement extends State { "memberCouponId": memberCouponId, "orderId": orderId, "promotionId": promotionId - }); + }).catchError((error){}); if (baseData != null && baseData.isSuccess) { setState(() { settleOrderInfo = baseData.data; @@ -84,8 +95,6 @@ class _Settlement extends State { } } - Address address; - queryAddress(int selectedBtn) async { this.selectedBtn = selectedBtn; if (address != null) { @@ -134,53 +143,92 @@ class _Settlement extends State { ///小程序下单 queryPlaceOrderFirst() async { + + for(int i = 0; i < shopCarGoods.shoppingCartSkuItemList.length; i ++) { + settleOrderInfo.orderProductList.forEach((element1) { + if (shopCarGoods.shoppingCartSkuItemList[i].productId == element1.productId) { + shopCarGoods.shoppingCartSkuItemList[i].skuId = element1.skuId; + } + }); + } + PlaceOrderFirst placeOrderFirst = PlaceOrderFirst(); - placeOrderFirst.addressId = null; + placeOrderFirst.cartNum = settleOrderInfo.orderNum; + placeOrderFirst.cartSum = settleOrderInfo.price; + placeOrderFirst.addressId = address == null ? null : address.id; placeOrderFirst.isSubscribe = false; - placeOrderFirst.isTakeOut = 0; - placeOrderFirst.notes = ""; - placeOrderFirst.numberOfPeople = null; - placeOrderFirst.orderSource = 0; - placeOrderFirst.orderType = 0; + placeOrderFirst.isTakeOut = selectedBtn; + placeOrderFirst.notes = remakers; + placeOrderFirst.numberOfPeople = "0"; + placeOrderFirst.orderSource = 2; + 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.parentCode = ""; // 火锅加菜 + placeOrderFirst.parentId = "0"; // 火锅加菜 + placeOrderFirst.payChannel = payChannel; + placeOrderFirst.promotionInfoDTO = PromotionInfoDTOBean(); + placeOrderFirst.promotionInfoDTO.promotionId = promotion != null ? promotion.id : ""; + placeOrderFirst.promotionInfoDTO.couponId = couponListBean != null ? couponListBean.id : ""; + placeOrderFirst.recMobile = (mobile == null || mobile == "") ? mobile : storeInfo.headMobile; + placeOrderFirst.shoppingCartSkuItemList = shopCarGoods.shoppingCartSkuItemList; placeOrderFirst.skuItemDTOList = []; - placeOrderFirst.source = 1; placeOrderFirst.storeId = storeInfo.id; placeOrderFirst.subcribeTime = null; - placeOrderFirst.tableId = 0; - BaseData baseData = await minService.placeOrderFirst(placeOrderFirst.toJson()) + placeOrderFirst.tableId = tableId; + BaseData baseData = await minService.placeOrderFirst(placeOrderFirst.toJson()) .catchError((error) {}); if (baseData != null && baseData.isSuccess) { - querySettlement(); + querySettlement(placeOrderFirst, baseData.data); } } ///结算 - querySettlement() async { - SettlementBean settlementBean = SettlementBean(); - settlementBean.addressId = 0; - settlementBean.buyNum = 0; - settlementBean.id = 0; - settlementBean.isLogistics = true; - settlementBean.orderProductVOList = []; + querySettlement(PlaceOrderFirst placeOrderFirst, DownOrder downOrder) async { + placeOrderFirst.id = downOrder.id; + placeOrderFirst.orderProductVOList = downOrder.orderProductVOList; + if (placeOrderFirst.payChannel == 1) { + if (!(await Min.isInitialize())) { + // 小程序的微信支付和app的充值支付使用同一个WXPayEntryActivity回调, + // 然而充值时小程序未初始化会导致回调内部代码调用getPackage空指针, + // 故而在此初始化一下 + await Min.initialize(); + } + BaseData baseData = await minService.settlementWx(placeOrderFirst.toJson()).catchError((error) {}); + if (baseData != null && baseData.isSuccess) { + WxPay wxPay = baseData.data; + await registerWxApi( + appId: wxPay.appId, + doOnAndroid: true, + universalLink: "https://hx.lotus-wallet.com/app/"); + payWithWeChat( + appId: wxPay.appId, + partnerId: wxPay.partnerId, + prepayId: wxPay.prepayId, + packageValue: wxPay.packageValue, + nonceStr: wxPay.nonceStr, + timeStamp: int.tryParse(wxPay.timeStamp), + sign: wxPay.sign); + weChatResponseEventHandler.listen((event) async { + print("payCallback: ${event.errCode}"); + toOrderDetails(placeOrderFirst.id); + }); + } + } else { + BaseData baseData = await minService.settlementApi(placeOrderFirst.toJson()).catchError((error) {}); + if (baseData != null && baseData.isSuccess) { + toOrderDetails(placeOrderFirst.id); + } + } + } + + toOrderDetails(String orderId) { + //1451130052983914496 + //202110211815390002 + Navigator.of(context).popAndPushNamed('/router/order_details', arguments: { + "id": orderId, + }); - 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) {} } @override @@ -251,7 +299,7 @@ class _Settlement extends State { ), ///支付方式 - PayMethod(), + PayMethod(payChannelCheck), ], ), ), @@ -296,7 +344,9 @@ class _Settlement extends State { padding: EdgeInsets.symmetric( vertical: 5.h, ), - callback: () {}, + callback: () { + queryPlaceOrderFirst(); + }, ), ], ), @@ -314,6 +364,10 @@ class _Settlement extends State { ); } + payChannelCheck(int payChannel) { + this.payChannel = payChannel; + } + mobileChange(String mobile) { this.mobile = mobile; } diff --git a/lib/settlement/settlement_view/pay_method.dart b/lib/settlement/settlement_view/pay_method.dart index d1598eee..5cf2be66 100644 --- a/lib/settlement/settlement_view/pay_method.dart +++ b/lib/settlement/settlement_view/pay_method.dart @@ -6,6 +6,10 @@ import 'package:huixiang/utils/font_weight.dart'; class PayMethod extends StatefulWidget { + final Function(int payChannel) payChannelCheck; + + PayMethod(this.payChannelCheck); + @override State createState() { return _PayMethod(); @@ -61,6 +65,7 @@ class _PayMethod extends State { setState(() { checkIndex = 1; }); + widget.payChannelCheck(4); }, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -85,6 +90,7 @@ class _PayMethod extends State { setState(() { checkIndex = 2; }); + widget.payChannelCheck(3); }, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -109,6 +115,7 @@ class _PayMethod extends State { onTap: () { setState(() { checkIndex = 3; + widget.payChannelCheck(1); }); }, child: Row( diff --git a/lib/store/store_order.dart b/lib/store/store_order.dart index bc340880..c058f887 100644 --- a/lib/store/store_order.dart +++ b/lib/store/store_order.dart @@ -68,17 +68,6 @@ class _StoreOrderPage extends State queryStoreInfo(); } - _fc(int count, String productId, int allCount, double allPrice) { - // if (count == 0) { - // int index = shopCarGoods.indexWhere((element) => element.id == productId); - // shopCarGoods.removeAt(index); - // } - // setState(() { - // this.allCount = allCount; - // this.allPrice = allPrice; - // }); - } - /// 小程序登录 minLogin() async { final SharedPreferences value = await SharedPreferences.getInstance(); @@ -316,7 +305,6 @@ class _StoreOrderPage extends State shopCarGoods, controller, _queryMiNiDetail, - _fc, ), ///星店活动, @@ -449,7 +437,7 @@ class _StoreOrderPage extends State } ///去下单结算页面 - toDownOrder() { + toDownOrder() async { int num = count(); if (num == 0) { @@ -457,12 +445,17 @@ class _StoreOrderPage extends State return; } - Navigator.of(context).pushNamed( + await Navigator.of(context).pushNamed( '/router/settlement', arguments: { "storeInfo": storeInfo, + "shoppingCart": shopCarGoods, }, ); + queryShopCar().then((value) { + this.shopCarGoods = value; + setState(() {}); + }); } Widget buildSwiper() { diff --git a/lib/store/store_view/store_order_list.dart b/lib/store/store_view/store_order_list.dart index aacfef32..83817f88 100644 --- a/lib/store/store_view/store_order_list.dart +++ b/lib/store/store_view/store_order_list.dart @@ -19,9 +19,7 @@ class StoreOrderListPage extends StatefulWidget { final List activitys; final StoreInfo storeInfo; final ScrollController controller; - final Function(int count, String productId, int allCount, double allPrice) fc; final Function(String id) queryMiNiDetail; - // final Function(List appletProducts) productListResult; ShoppingCart shopCarGoods; StoreOrderListPage( @@ -30,9 +28,7 @@ class StoreOrderListPage extends StatefulWidget { this.storeInfo, this.shopCarGoods, this.controller, - this.queryMiNiDetail, - // this.productListResult, - this.fc); + this.queryMiNiDetail,); @override State createState() {