diff --git a/assets/image/2x/lv_bi.webp b/assets/image/2x/lv_bi.webp new file mode 100644 index 00000000..cc3b37f6 Binary files /dev/null and b/assets/image/2x/lv_bi.webp differ diff --git a/assets/image/3x/lv_bi.webp b/assets/image/3x/lv_bi.webp new file mode 100644 index 00000000..d372eaed Binary files /dev/null and b/assets/image/3x/lv_bi.webp differ diff --git a/assets/image/lv_bi.webp b/assets/image/lv_bi.webp new file mode 100644 index 00000000..bc47eaab Binary files /dev/null and b/assets/image/lv_bi.webp differ diff --git a/lib/main.dart b/lib/main.dart index 1782a9e2..1d4b307a 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -70,6 +70,7 @@ import 'package:huixiang/store/shopping/shopping_mall_home.dart'; import 'package:huixiang/setting/user_service_page.dart'; import 'package:huixiang/store/store_order.dart'; import 'package:huixiang/settlement/settlement.dart'; +import 'package:huixiang/store/store_view/product_meals_sku.dart'; import 'package:huixiang/test_page.dart'; import 'package:huixiang/union/location_map_page.dart'; import 'package:huixiang/utils/ImgCachePath.dart'; @@ -403,4 +404,6 @@ Map routers = { PlatformPayCodeSuccess(arguments:arguments), '/router/phone_address_page': (context, {arguments}) => PhoneAddressPage(), + '/router/product_meals_sku': (context, {arguments}) => + ProductMealsSku(arguments:arguments), }; diff --git a/lib/order/order_view/order_info.dart b/lib/order/order_view/order_info.dart index eb729efb..5d10ad54 100644 --- a/lib/order/order_view/order_info.dart +++ b/lib/order/order_view/order_info.dart @@ -74,15 +74,9 @@ class _OrderInfoView extends State { case 4: return "平台会员余额支付"; case 5: - return "美团买单"; + return "回乡绿币支付"; case 6: - return "饿了么支付"; - case 7: - return "扫呗支付"; - case 8: - return "微生活"; - case 9: - return "银联支付"; + return "活动余额支付"; } return S.of(context).yue; } diff --git a/lib/order/order_view/order_pay_selected.dart b/lib/order/order_view/order_pay_selected.dart index af338efe..860a7105 100644 --- a/lib/order/order_view/order_pay_selected.dart +++ b/lib/order/order_view/order_pay_selected.dart @@ -118,9 +118,41 @@ class _OrderPaySelected extends State { ), GestureDetector( onTap: () { - // Navigator.of(context).pop(1); + // Navigator.of(context).pop(3); setState(() { checkIndex = 3; + payIndex = 5; + }); + + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Image.asset("assets/image/lv_bi.webp"), + Expanded(child: Padding( + padding: EdgeInsets.only(left: 8.w), + child:Text( + S.of(context).lvbiyue, + style: TextStyle( + fontSize: 14.sp, + color: Color(0xff353535), + fontWeight: MyFontWeight.semi_bold, + ), + ), + ),), + checkView(3), + ], + ), + ), + SizedBox( + height: 10, + ), + GestureDetector( + onTap: () { + // Navigator.of(context).pop(1); + setState(() { + checkIndex = 4; payIndex = 1; }); }, @@ -140,7 +172,7 @@ class _OrderPaySelected extends State { ), ), ),), - checkView(3), + checkView(4), ], ), ), @@ -175,7 +207,7 @@ class _OrderPaySelected extends State { ); } - var checkIndex = 3; + var checkIndex = 4; int payIndex = 1; Widget checkView(var index) { diff --git a/lib/retrofit/data/miNiDetail.dart b/lib/retrofit/data/miNiDetail.dart index 5c2e24bc..9c716055 100644 --- a/lib/retrofit/data/miNiDetail.dart +++ b/lib/retrofit/data/miNiDetail.dart @@ -242,6 +242,7 @@ class ProductSkuVOListBean { dynamic version; dynamic skuAttrCodeDTOList; List skuAttrList; + List productSetMeals; dynamic setMealDTOList; static ProductSkuVOListBean fromJson(Map map) { @@ -272,6 +273,9 @@ class ProductSkuVOListBean { productSkuVOListBean.skuAttrList = []..addAll( (map['skuAttrList'] as List ?? []).map((o) => SkuAttrListBean.fromJson(o)) ); + productSkuVOListBean.productSetMeals = []..addAll( + (map['productSetMeals'] as List ?? []).map((o) => ProductSetMeals.fromJson(o)) + ); productSkuVOListBean.setMealDTOList = map['setMealDTOList']; return productSkuVOListBean; } @@ -357,6 +361,407 @@ class SkuAttrListBean { }; } +/// groupName : "酒水选1" +/// totalNumber : 4 +/// optionalNumber : 1 +/// productInfoList : [{"productId":"1372091668961951744","productName":"白云边12年300ml","productImg":"https://pos.upload.gznl.top/MDAwMA==/2021/03/34cbd11d-402c-4278-b1e3-8d1d780a8ee5.jpg","allSku":true,"skuInfoList":[{"id":"1372091669003894784","skuName":"","productSkuAttrList":[{"id":"1372091669012283392","createTime":"2021-03-17 15:45:21","createUser":"1311123845502992384","updateTime":"2021-03-17 15:45:21","updateUser":"1311123845502992384","skuId":"1372091669003894784","attrId":"1372091668978728960","attrValueId":"1372091668987117568","sortOrder":null,"isDelete":0}]}],"productAttrInfoList":[{"attrId":"1372091668978728960","attrName":"","attrValueList":[{"attrId":"1372091668987117568","attrName":"","attrValueList":null}]}],"number":1},{"productId":"1372091974143705088","productName":"白云边9年250ml","productImg":"https://pos.upload.gznl.top/MDAwMA==/2021/03/333c5280-fe1f-4294-a334-0cf11b0ab7a6.jpg","allSku":true,"skuInfoList":[{"id":"1372091974194036736","skuName":"","productSkuAttrList":[{"id":"1372091974202425344","createTime":"2021-03-17 15:46:34","createUser":"1311123845502992384","updateTime":"2021-03-17 15:46:34","updateUser":"1311123845502992384","skuId":"1372091974194036736","attrId":"1372091974164676608","attrValueId":"1372091974173065216","sortOrder":null,"isDelete":0}]}],"productAttrInfoList":[{"attrId":"1372091974164676608","attrName":"","attrValueList":[{"attrId":"1372091974173065216","attrName":"","attrValueList":null}]}],"number":1},{"productId":"1372092276561412096","productName":"毛铺紫荞酒500ml","productImg":"https://pos.upload.gznl.top/MDAwMA==/2021/03/b8869284-ccb8-4c97-8ba7-88a140ac4b08.jpg","allSku":true,"skuInfoList":[{"id":"1372092276607549440","skuName":"","productSkuAttrList":[{"id":"1372092276615938048","createTime":"2021-03-17 15:47:46","createUser":"1311123845502992384","updateTime":"2021-03-17 15:47:46","updateUser":"1311123845502992384","skuId":"1372092276607549440","attrId":"1372092276582383616","attrValueId":"1372092276594966528","sortOrder":null,"isDelete":0}]}],"productAttrInfoList":[{"attrId":"1372092276582383616","attrName":"","attrValueList":[{"attrId":"1372092276594966528","attrName":"","attrValueList":null}]}],"number":1},{"productId":"1372092499190874112","productName":"毛铺苦荞酒500ml","productImg":"https://pos.upload.gznl.top/MDAwMA==/2021/03/f5a64d71-9b20-43d3-b992-89a5a270895b.jpg","allSku":true,"skuInfoList":[{"id":"1372092499237011456","skuName":"","productSkuAttrList":[{"id":"1372092499249594368","createTime":"2021-03-17 15:48:39","createUser":"1311123845502992384","updateTime":"2021-03-17 15:48:39","updateUser":"1311123845502992384","skuId":"1372092499237011456","attrId":"1372092499211845632","attrValueId":"1372092499224428544","sortOrder":null,"isDelete":0}]}],"productAttrInfoList":[{"attrId":"1372092499211845632","attrName":"","attrValueList":[{"attrId":"1372092499224428544","attrName":"","attrValueList":null}]}],"number":1}] + +class ProductSetMeals { + ProductSetMeals({ + String groupName, + int totalNumber, + int optionalNumber, + List productInfoList,}){ + _groupName = groupName; + _totalNumber = totalNumber; + _optionalNumber = optionalNumber; + _productInfoList = productInfoList; + } + + ProductSetMeals.fromJson(dynamic json) { + _groupName = json['groupName']; + _totalNumber = json['totalNumber']; + _optionalNumber = json['optionalNumber']; + if (json['productInfoList'] != null) { + _productInfoList = []; + json['productInfoList'].forEach((v) { + _productInfoList.add(ProductInfoList.fromJson(v)); + }); + } + } + String _groupName; + int _totalNumber; + int _optionalNumber; + List _productInfoList; + ProductSetMeals copyWith({ String groupName, + int totalNumber, + int optionalNumber, + List productInfoList, + }) => ProductSetMeals( groupName: groupName ?? _groupName, + totalNumber: totalNumber ?? _totalNumber, + optionalNumber: optionalNumber ?? _optionalNumber, + productInfoList: productInfoList ?? _productInfoList, + ); + String get groupName => _groupName; + int get totalNumber => _totalNumber; + int get optionalNumber => _optionalNumber; + List get productInfoList => _productInfoList; + + Map toJson() { + final map = {}; + map['groupName'] = _groupName; + map['totalNumber'] = _totalNumber; + map['optionalNumber'] = _optionalNumber; + if (_productInfoList != null) { + map['productInfoList'] = _productInfoList.map((v) => v.toJson()).toList(); + } + return map; + } + +} + +/// productId : "1372091668961951744" +/// productName : "白云边12年300ml" +/// productImg : "https://pos.upload.gznl.top/MDAwMA==/2021/03/34cbd11d-402c-4278-b1e3-8d1d780a8ee5.jpg" +/// allSku : true +/// skuInfoList : [{"id":"1372091669003894784","skuName":"","productSkuAttrList":[{"id":"1372091669012283392","createTime":"2021-03-17 15:45:21","createUser":"1311123845502992384","updateTime":"2021-03-17 15:45:21","updateUser":"1311123845502992384","skuId":"1372091669003894784","attrId":"1372091668978728960","attrValueId":"1372091668987117568","sortOrder":null,"isDelete":0}]}] +/// productAttrInfoList : [{"attrId":"1372091668978728960","attrName":"","attrValueList":[{"attrId":"1372091668987117568","attrName":"","attrValueList":null}]}] +/// number : 1 + +class ProductInfoList { + ProductInfoList({ + String productId, + String productName, + String productImg, + bool allSku, + List skuInfoList, + List productAttrInfoList, + int number,}){ + _productId = productId; + _productName = productName; + _productImg = productImg; + _allSku = allSku; + _skuInfoList = skuInfoList; + _productAttrInfoList = productAttrInfoList; + _number = number; + } + + ProductInfoList.fromJson(dynamic json) { + _productId = json['productId']; + _productName = json['productName']; + _productImg = json['productImg']; + _allSku = json['allSku']; + if (json['skuInfoList'] != null) { + _skuInfoList = []; + json['skuInfoList'].forEach((v) { + _skuInfoList.add(SkuInfoList.fromJson(v)); + }); + } + if (json['productAttrInfoList'] != null) { + _productAttrInfoList = []; + json['productAttrInfoList'].forEach((v) { + _productAttrInfoList.add(ProductAttrInfoList.fromJson(v)); + }); + } + _number = json['number']; + } + String _productId; + String _productName; + String _productImg; + bool _allSku; + List _skuInfoList; + List _productAttrInfoList; + int _number; + ProductInfoList copyWith({ String productId, + String productName, + String productImg, + bool allSku, + List skuInfoList, + List productAttrInfoList, + int number, + }) => ProductInfoList( productId: productId ?? _productId, + productName: productName ?? _productName, + productImg: productImg ?? _productImg, + allSku: allSku ?? _allSku, + skuInfoList: skuInfoList ?? _skuInfoList, + productAttrInfoList: productAttrInfoList ?? _productAttrInfoList, + number: number ?? _number, + ); + String get productId => _productId; + String get productName => _productName; + String get productImg => _productImg; + bool get allSku => _allSku; + List get skuInfoList => _skuInfoList; + List get productAttrInfoList => _productAttrInfoList; + int get number => _number; + + Map toJson() { + final map = {}; + map['productId'] = _productId; + map['productName'] = _productName; + map['productImg'] = _productImg; + map['allSku'] = _allSku; + if (_skuInfoList != null) { + map['skuInfoList'] = _skuInfoList.map((v) => v.toJson()).toList(); + } + if (_productAttrInfoList != null) { + map['productAttrInfoList'] = _productAttrInfoList.map((v) => v.toJson()).toList(); + } + map['number'] = _number; + return map; + } + +} + +/// attrId : "1372091668978728960" +/// attrName : "" +/// attrValueList : [{"attrId":"1372091668987117568","attrName":"","attrValueList":null}] + +class ProductAttrInfoList { + ProductAttrInfoList({ + String attrId, + String attrName, + List attrValueList,}){ + _attrId = attrId; + _attrName = attrName; + _attrValueList = attrValueList; + } + + ProductAttrInfoList.fromJson(dynamic json) { + _attrId = json['attrId']; + _attrName = json['attrName']; + if (json['attrValueList'] != null) { + _attrValueList = []; + json['attrValueList'].forEach((v) { + _attrValueList.add(AttrValueList.fromJson(v)); + }); + } + } + String _attrId; + String _attrName; + List _attrValueList; + ProductAttrInfoList copyWith({ String attrId, + String attrName, + List attrValueList, + }) => ProductAttrInfoList( attrId: attrId ?? _attrId, + attrName: attrName ?? _attrName, + attrValueList: attrValueList ?? _attrValueList, + ); + String get attrId => _attrId; + String get attrName => _attrName; + List get attrValueList => _attrValueList; + + Map toJson() { + final map = {}; + map['attrId'] = _attrId; + map['attrName'] = _attrName; + if (_attrValueList != null) { + map['attrValueList'] = _attrValueList.map((v) => v.toJson()).toList(); + } + return map; + } + +} + +/// attrId : "1372091668987117568" +/// attrName : "" +/// attrValueList : null + +class AttrValueList { + AttrValueList({ + String attrId, + String attrName, + dynamic attrValueList,}){ + _attrId = attrId; + _attrName = attrName; + _attrValueList = attrValueList; + } + + AttrValueList.fromJson(dynamic json) { + _attrId = json['attrId']; + _attrName = json['attrName']; + _attrValueList = json['attrValueList']; + } + String _attrId; + String _attrName; + dynamic _attrValueList; + AttrValueList copyWith({ String attrId, + String attrName, + dynamic attrValueList, + }) => AttrValueList( attrId: attrId ?? _attrId, + attrName: attrName ?? _attrName, + attrValueList: attrValueList ?? _attrValueList, + ); + String get attrId => _attrId; + String get attrName => _attrName; + dynamic get attrValueList => _attrValueList; + + Map toJson() { + final map = {}; + map['attrId'] = _attrId; + map['attrName'] = _attrName; + map['attrValueList'] = _attrValueList; + return map; + } + +} + +/// id : "1372091669003894784" +/// skuName : "" +/// productSkuAttrList : [{"id":"1372091669012283392","createTime":"2021-03-17 15:45:21","createUser":"1311123845502992384","updateTime":"2021-03-17 15:45:21","updateUser":"1311123845502992384","skuId":"1372091669003894784","attrId":"1372091668978728960","attrValueId":"1372091668987117568","sortOrder":null,"isDelete":0}] + +class SkuInfoList { + SkuInfoList({ + String id, + String skuName, + List productSkuAttrList,}){ + _id = id; + _skuName = skuName; + _productSkuAttrList = productSkuAttrList; + } + + SkuInfoList.fromJson(dynamic json) { + _id = json['id']; + _skuName = json['skuName']; + if (json['productSkuAttrList'] != null) { + _productSkuAttrList = []; + json['productSkuAttrList'].forEach((v) { + _productSkuAttrList.add(ProductSkuAttrList.fromJson(v)); + }); + } + } + String _id; + String _skuName; + List _productSkuAttrList; + SkuInfoList copyWith({ String id, + String skuName, + List productSkuAttrList, + }) => SkuInfoList( id: id ?? _id, + skuName: skuName ?? _skuName, + productSkuAttrList: productSkuAttrList ?? _productSkuAttrList, + ); + String get id => _id; + String get skuName => _skuName; + List get productSkuAttrList => _productSkuAttrList; + + Map toJson() { + final map = {}; + map['id'] = _id; + map['skuName'] = _skuName; + if (_productSkuAttrList != null) { + map['productSkuAttrList'] = _productSkuAttrList.map((v) => v.toJson()).toList(); + } + return map; + } + +} + +/// id : "1372091669012283392" +/// createTime : "2021-03-17 15:45:21" +/// createUser : "1311123845502992384" +/// updateTime : "2021-03-17 15:45:21" +/// updateUser : "1311123845502992384" +/// skuId : "1372091669003894784" +/// attrId : "1372091668978728960" +/// attrValueId : "1372091668987117568" +/// sortOrder : null +/// isDelete : 0 + +class ProductSkuAttrList { + ProductSkuAttrList({ + String id, + String createTime, + String createUser, + String updateTime, + String updateUser, + String skuId, + String attrId, + String attrValueId, + dynamic sortOrder, + int isDelete,}){ + _id = id; + _createTime = createTime; + _createUser = createUser; + _updateTime = updateTime; + _updateUser = updateUser; + _skuId = skuId; + _attrId = attrId; + _attrValueId = attrValueId; + _sortOrder = sortOrder; + _isDelete = isDelete; + } + + ProductSkuAttrList.fromJson(dynamic json) { + _id = json['id']; + _createTime = json['createTime']; + _createUser = json['createUser']; + _updateTime = json['updateTime']; + _updateUser = json['updateUser']; + _skuId = json['skuId']; + _attrId = json['attrId']; + _attrValueId = json['attrValueId']; + _sortOrder = json['sortOrder']; + _isDelete = json['isDelete']; + } + String _id; + String _createTime; + String _createUser; + String _updateTime; + String _updateUser; + String _skuId; + String _attrId; + String _attrValueId; + dynamic _sortOrder; + int _isDelete; + ProductSkuAttrList copyWith({ String id, + String createTime, + String createUser, + String updateTime, + String updateUser, + String skuId, + String attrId, + String attrValueId, + dynamic sortOrder, + int isDelete, + }) => ProductSkuAttrList( id: id ?? _id, + createTime: createTime ?? _createTime, + createUser: createUser ?? _createUser, + updateTime: updateTime ?? _updateTime, + updateUser: updateUser ?? _updateUser, + skuId: skuId ?? _skuId, + attrId: attrId ?? _attrId, + attrValueId: attrValueId ?? _attrValueId, + sortOrder: sortOrder ?? _sortOrder, + isDelete: isDelete ?? _isDelete, + ); + String get id => _id; + String get createTime => _createTime; + String get createUser => _createUser; + String get updateTime => _updateTime; + String get updateUser => _updateUser; + String get skuId => _skuId; + String get attrId => _attrId; + String get attrValueId => _attrValueId; + dynamic get sortOrder => _sortOrder; + int get isDelete => _isDelete; + + Map toJson() { + final map = {}; + map['id'] = _id; + map['createTime'] = _createTime; + map['createUser'] = _createUser; + map['updateTime'] = _updateTime; + map['updateUser'] = _updateUser; + map['skuId'] = _skuId; + map['attrId'] = _attrId; + map['attrValueId'] = _attrValueId; + map['sortOrder'] = _sortOrder; + map['isDelete'] = _isDelete; + return map; + } + +} + /// productId : "1433994980233314304" /// attrName : "�¶�" /// sortOrder : null diff --git a/lib/settlement/settlement_view/pay_method.dart b/lib/settlement/settlement_view/pay_method.dart index 4770543d..919fe110 100644 --- a/lib/settlement/settlement_view/pay_method.dart +++ b/lib/settlement/settlement_view/pay_method.dart @@ -19,6 +19,7 @@ class PayMethod extends StatefulWidget { class _PayMethod extends State { String money = "0"; String balance = "0"; + String mGreenMoney = "0"; @override void initState() { @@ -29,6 +30,7 @@ class _PayMethod extends State { jsonDecode(value.getString("minMember")); balance = memberInfo["balance"]; money = memberInfo["money"]; + mGreenMoney = memberInfo["greenMoney"]; setState(() {}); }); } @@ -157,10 +159,53 @@ class _PayMethod extends State { SizedBox( height: 10, ), + if(mGreenMoney!="0.00") GestureDetector( onTap: () { setState(() { checkIndex = 3; + }); + widget.payChannelCheck(5); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + checkView(3), + Expanded( + child: Container(), + flex: 1, + ), + Text( + "¥$mGreenMoney", + style: TextStyle( + fontSize: 14.sp, + color: Color(0xff353535), + fontWeight: MyFontWeight.semi_bold, + ), + ), + SizedBox( + width: 10, + ), + Text( + S.of(context).lvbiyue, + style: TextStyle( + fontSize: 14.sp, + color: Color(0xff353535), + fontWeight: MyFontWeight.semi_bold, + ), + ), + ], + ), + ), + if(mGreenMoney!="0.00") + SizedBox( + height: 10, + ), + GestureDetector( + onTap: () { + setState(() { + checkIndex = 4; widget.payChannelCheck(1); }); }, @@ -168,7 +213,7 @@ class _PayMethod extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start, children: [ - checkView(3), + checkView(4), Spacer(), Image.asset("assets/image/icon_we_chat.webp"), Padding( @@ -190,7 +235,7 @@ class _PayMethod extends State { ); } - var checkIndex = 3; + var checkIndex = 4; Widget checkView(var index) { return Container( diff --git a/lib/store/store_order.dart b/lib/store/store_order.dart index 8b087992..afcd9e59 100644 --- a/lib/store/store_order.dart +++ b/lib/store/store_order.dart @@ -209,7 +209,17 @@ class _StoreOrderPage extends State @override Widget build(BuildContext context) { - return Container( + return WillPopScope( + onWillPop: () async { + if (dialogShowing) { + debugPrint("ssssasdadsasdadasd"); + SmartDialog.dismiss(); + return false; + } else { + return true; + } + }, + child:Container( color: Colors.white, child: Stack( children: [ @@ -444,7 +454,6 @@ class _StoreOrderPage extends State child: ),*/ ), - // if(count() != 0) Positioned( bottom: 30, left: 0, @@ -547,7 +556,7 @@ class _StoreOrderPage extends State ), ), ], - )); + ))); } ///领取优惠券 diff --git a/lib/store/store_view/product_meals_sku.dart b/lib/store/store_view/product_meals_sku.dart new file mode 100644 index 00000000..6ac406f5 --- /dev/null +++ b/lib/store/store_view/product_meals_sku.dart @@ -0,0 +1,1190 @@ +import 'package:dio/dio.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_easyloading/flutter_easyloading.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; +import 'package:huixiang/generated/l10n.dart'; +import 'package:huixiang/retrofit/data/activity.dart'; +import 'package:huixiang/retrofit/data/base_data.dart'; +import 'package:huixiang/retrofit/data/miNiDetail.dart'; +import 'package:huixiang/retrofit/data/shoppingCart.dart'; +import 'package:huixiang/retrofit/data/store_info.dart'; +import 'package:huixiang/retrofit/min_api.dart'; +import 'package:huixiang/retrofit/retrofit_api.dart'; +import 'package:huixiang/store/store_view/people_num.dart'; +import 'package:huixiang/store/store_view/shop_car.dart'; +import 'package:huixiang/utils/font_weight.dart'; +import 'package:huixiang/view_widget/custom_image.dart'; +import 'package:huixiang/view_widget/round_button.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; +import 'package:shared_preferences/shared_preferences.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +class ProductMealsSku extends StatefulWidget { + final arguments; + + ProductMealsSku({this.arguments}); + + @override + State createState() { + return _ProductMealsSku(); + } +} + + + +class _ProductMealsSku extends State { + ApiService apiService; + MinApiService minService; + final ScrollController scrollController = ScrollController(); + final RefreshController refreshController = RefreshController(); + String id; + MiNiDetail miNiDetail; + ShoppingCart shopCarGoods; + bool dialogShowing = false; + StoreInfo storeInfo; + String parentCode = ""; + int tableId = 0; + String pName; + String pid; + String cName; + String cid; + List selectSkus = []; + List activitys; + int counts = 1; + String selectedPrice = ""; + String storeId; + String parentId; + int numberOfPeople = 0; + List productSetMeals; + + @override + void initState() { + super.initState(); + id = widget.arguments["id"]; + storeId = widget.arguments["storeId"]; + SharedPreferences.getInstance().then((value) { + String minToken = value.getString("minToken"); + String tenant = value.getString("tenant"); + String storeId = value.getString("storeId"); + minService = MinApiService(Dio(), + context: context, + token: minToken, + tenant: tenant, + storeId: storeId, + showLoading: true); + queryMiNiDetail(id); + queryShopCar().then((value) { + this.shopCarGoods = value; + setState(() {}); + }); + }); + queryStoreInfo(); + buildCount(); + } + + ///商品详情 + queryMiNiDetail(id) async { + BaseData baseData = + await minService.miNiDetail(id).catchError((error) { + refreshController.refreshFailed(); + }); + if (baseData != null && baseData.isSuccess) { + setState(() { + miNiDetail = baseData.data; + miNiDetail.attrList.forEach((element) { + selectSkus.add(element.attrValueList[0].attrValue); + }); + productSetMeals = miNiDetail.productSkuVOList[0].productSetMeals; + }); + refreshController.refreshCompleted(); + } else { + refreshController.refreshFailed(); + } + } + + _onRefresh() { + queryMiNiDetail(id); + } + + /// 查询店铺信息 + queryStoreInfo() async { + SharedPreferences value = await SharedPreferences.getInstance(); + if (apiService == null) + apiService = ApiService( + Dio(), + context: context, + token: value.getString("token"), + ); + BaseData baseData = await apiService.queryStoreInfo(storeId).catchError((error) { + debugPrint(error); + }); + if (baseData != null && baseData.isSuccess) { + storeInfo = StoreInfo.fromJson(baseData.data); + activitys = storeInfo.informationVOPageVO.list + .map((e) => Activity.fromJson(e)) + .toList(); + if (mounted) { + setState(() {}); + } + } + EasyLoading.dismiss(); + } + + ///获取父订单(火锅订单加菜前调用) + getParentInfo() async { + BaseData baseData = await minService.getParentInfo("$tableId") + .catchError((error) {debugPrint(error);}); + if (baseData != null && baseData.isSuccess) { + if (baseData.data != null) { + parentId = baseData.data["id"]; + parentCode = baseData.data["parentCode"]; + } else { + ///TODO: 没有父订单, + queryStoreInfo1(); + } + } + } + + ///显示选择人数的弹窗 + showPeopleNum(String tableName) async { + var people = await showDialog( + context: context, + barrierDismissible: false, + builder: (context) { + return PeopleNumView(tableName); + }, + ); + + if (people != null && people > 0) { + setState(() { + this.numberOfPeople = people; + }); + } else { + Navigator.of(context).pop(); + } + } + + ///获取桌子信息 + queryStoreInfo1() async { + BaseData baseData = await minService.queryStoreInfo1({ + "getCoupon": true, + "storeId": storeId, + "tableId": tableId, + }).catchError((error) { + debugPrint(error); + }); + if (baseData != null && baseData.isSuccess) { + StoreInfo storeInfo = StoreInfo.fromJson(baseData.data); + if (storeInfo.storeTable != null) { + showPeopleNum(storeInfo.storeTable.tableName); + } + } + } + + ///计算个数 + int count() { + if (shopCarGoods == null || + shopCarGoods.shoppingCartSkuItemList == null || + shopCarGoods.shoppingCartSkuItemList.length == 0) return 0; + int count = 0; + shopCarGoods.shoppingCartSkuItemList.forEach((element) { + count += element.buyNum; + }); + return count; + } + + ///去下单结算页面 + toDownOrder() async { + int num = count(); + + if (parentId == null || parentId == "") { + if (num == 0) { + SmartDialog.showToast("请先选择您要购买的商品!~"); + return; + } + } + + await Navigator.of(context).pushNamed( + '/router/settlement', + arguments: { + "storeInfo": storeInfo, + "tableId": tableId, + "parentCode": parentCode, + "parentId": parentId, + // "pName": pName, + "pid": pid, + // "cName": cName, + "cid": cid, + "shoppingCart": shopCarGoods, + "numberOfPeople": numberOfPeople, + }, + ); + if (tableId > 0) { + getParentInfo(); + } + queryShopCar().then((value) { + this.shopCarGoods = value; + setState(() {}); + }); + } + + /// 购物车的key,用于刷新UI + GlobalKey shopCartKey = GlobalKey(); + + ///购物车弹窗 + showShoppingCart() { + queryShopCar().then((value) { + this.shopCarGoods = value; + dialogShowing = true; + SmartDialog.show( + widget: ShopCar( + shopCartKey, + this.shopCarGoods, + clearShopCar, + toDownOrder, + shopCartAdd, + shopCartReduce, + ), + onDismiss: () { + dialogShowing = false; + }, + alignmentTemp: Alignment.bottomCenter, + ); + }); + } + + ///清空购物车 + clearShopCar() async { + BaseData baseData = await minService.clearShoppingCart(); + if (baseData.isSuccess) { + shopCarGoods = null; + setState(() {}); + } + } + + ///选规格 + _queryMiNiDetail(String id, int count) async { + EasyLoading.show(status: S.current.zhengzaijiazai); + if(count < 0){ + shopCarGoods.shoppingCartSkuItemList.forEach((element) { + if(element.productId == id){ + shopCartReduce(element); + setState(() { + }); + } + }); + return; + } + BaseData baseData = await minService.miNiDetail(id); + if (baseData != null && baseData.isSuccess) { + showStoreSelector(baseData.data, id, count); + } + } + + ///选规格弹窗 + showStoreSelector(MiNiDetail miNiDetail, String id, int count) async { + if (miNiDetail.attrList != null && + miNiDetail.attrList.length == 1 && + miNiDetail.attrList[0].attrValueList.length == 1) { + _addShopCar(miNiDetail, [], counts); + } else { + showSpanDialog(); + } + } + + ///添加购物车 + Future _addShopCar(MiNiDetail miNiDetail, selectSkus, int count) async { + ProductSkuVOListBean productSku; + if (selectSkus != null && selectSkus.length == 0) { + productSku = miNiDetail.productSkuVOList.first; + } else { + productSku = miNiDetail.productSkuVOList.firstWhere((element) { + bool gg = true; + selectSkus.forEach((element1) { + if (element.skuNameStr.indexOf(element1) < 0) { + gg = false; + return gg; + } + }); + return gg; + }); + } + if (productSku == null) return; + String skuId = productSku.id; + String skuValue = selectSkus + .toString() + .replaceAll("[", "") + .replaceAll("]", "") + .replaceAll(",", ""); + + if (miNiDetail != null) { + BaseData> baseDate = await minService.addShoppingCart({ + "storeId": storeInfo.id, + "storeName": storeInfo.storeName ?? "", + "numberOfPeople": numberOfPeople, + "tableId": tableId, + "parentId": parentId, + "parentCode": parentCode, + "shoppingCartSkuItemList": [ + { + "buyNum": count, + "id": skuId, + "productId": miNiDetail.id, + "productName": miNiDetail.productName, + "skuName": skuValue, + "storeId": storeInfo.id, + "skuPrice": productSku.skuPrice, + "skuStock": productSku.skuStock, + "tableId": tableId, + }, + ], + }); + EasyLoading.dismiss(); + if (baseDate != null && baseDate.isSuccess) { + queryShopCar().then((value) { + this.shopCarGoods = value; + setState(() {}); + }); + } + else { + SmartDialog.showToast(baseDate?.msg, alignment: Alignment.center); + } + } + } + + ///查询购物车 + Future queryShopCar() async { + pName = ""; //活动 + pid = ""; //活动 + cName = ""; //优惠券 + cid = ""; //优惠券 + BaseData> baseDate = + await minService.getShoppingCart(tableId); + if (baseDate != null && + baseDate.isSuccess && + baseDate.data != null && + baseDate.data.length > 0) { + if (baseDate.data[0].selectDiscount == 1) { + baseDate.data[0].couponList.forEach((element) { + if (element.isMaxCoupon) { + // cName = element.promotionName; + cid = element.id; + } + }); + } else if (baseDate.data[0].selectDiscount == 2) { + baseDate.data[0].promotionInfoList.forEach((element) { + if (element.isMaxPromotion) { + // pName = element.name; + pid = element.id; + } + }); + } + return baseDate.data[0]; + } else { + return null; + } + } + + ///购物车➕1 + Future shopCartAdd( + ShoppingCartSkuItemListBean cartSkuItem) async { + Map shopCarTemp = shopCarGoods.toJson(); + cartSkuItem.buyNum += 1; + shopCarTemp["shoppingCartSkuItemList"] = [cartSkuItem.toJson()]; + BaseData> baseDate = + await minService.shoppingCartSingle(shopCarTemp); + if (baseDate.isSuccess) { + this.shopCarGoods = await queryShopCar(); + if (shopCartKey != null) { + shopCartKey.currentState.setState(() {}); + } + setState(() {}); + } + return this.shopCarGoods; + } + + ///购物车➖1 + Future shopCartReduce( + ShoppingCartSkuItemListBean cartSkuItem) async { + Map shopCarTemp = shopCarGoods.toJson(); + cartSkuItem.buyNum -= 1; + shopCarTemp["shoppingCartSkuItemList"] = [cartSkuItem.toJson()]; + BaseData> baseDate = + await minService.shoppingCartSingle(shopCarTemp); + if (baseDate.isSuccess) { + EasyLoading.dismiss(); + this.shopCarGoods = await queryShopCar(); + if (shopCartKey?.currentState != null) { + shopCartKey.currentState.setState(() {}); + } + setState(() { + }); + } + return this.shopCarGoods; + } + + ///商品➕1 + add(MiNiDetail miNiDetail, selectSkus) async { + ProductSkuVOListBean productSku = + miNiDetail.productSkuVOList.firstWhere((element) { + return skuY(element, selectSkus); + }); + + if (productSku == null) return; + String skuId = productSku.id; + if (shopCarGoods == null) { + await _addShopCar(miNiDetail, selectSkus, 2); + return; + } + int shopSkuIndex = shopCarGoods.shoppingCartSkuItemList + .indexWhere((element) => skuId == element.id); + Map shopCarTemp = shopCarGoods.toJson(); + shopCarGoods.tableId = "$tableId"; + + if (shopSkuIndex >= 0) { + shopCarGoods.shoppingCartSkuItemList[shopSkuIndex].buyNum += 1; + ShoppingCartSkuItemListBean cartSkuItem = shopCarGoods + .shoppingCartSkuItemList + .firstWhere((element) => skuId == element.id); + shopCarTemp["shoppingCartSkuItemList"] = [cartSkuItem.toJson()]; + } else { + await _addShopCar(miNiDetail, selectSkus, 2); + return; + } + + BaseData> baseDate = + await minService.shoppingCartSingle(shopCarTemp); + if (baseDate.isSuccess) { + queryShopCar().then((value) { + this.shopCarGoods = value; + setState(() {}); + }); + } + } + + ///商品➖1 + reduce(MiNiDetail miNiDetail, selectSkus) async { + ProductSkuVOListBean productSku = + miNiDetail.productSkuVOList.firstWhere((element) { + return skuY(element, selectSkus); + }); + + if (productSku == null) return; + String skuId = productSku.id; + if (shopCarGoods == null) { + await _addShopCar(miNiDetail, selectSkus, 2); + return; + } + ShoppingCartSkuItemListBean shopSkuItem = shopCarGoods + .shoppingCartSkuItemList + .firstWhere((element) => skuId == element.id); + int shopSkuIndex = shopCarGoods.shoppingCartSkuItemList + .indexWhere((element) => skuId == element.id); + + if (shopSkuItem != null) { + if (shopSkuItem.buyNum > 1) { + shopCarGoods.shoppingCartSkuItemList[shopSkuIndex].buyNum -= 1; + } + } else { + await _addShopCar(miNiDetail, selectSkus, 2); + return; + } + shopCarGoods.tableId = "$tableId"; + + Map shopCarTemp = shopCarGoods.toJson(); + ShoppingCartSkuItemListBean cartSkuItem = shopCarGoods + .shoppingCartSkuItemList + .firstWhere((element) => skuId == element.id); + shopCarTemp["shoppingCartSkuItemList"] = [cartSkuItem.toJson()]; + + BaseData> baseDate = + await minService.shoppingCartSingle(shopCarTemp); + if (baseDate.isSuccess) { + queryShopCar().then((value) { + this.shopCarGoods = value; + setState(() {}); + }); + } + } + + bool skuY(ProductSkuVOListBean productSku, selectSkus) { + bool gg = true; + selectSkus.forEach((element1) { + if (productSku.skuNameStr.indexOf(element1) < 0) { + gg = false; + return gg; + } + }); + return gg; + } + + buildCount() { + counts = 1; + ProductSkuVOListBean productSku; + try { + productSku = miNiDetail.productSkuVOList.firstWhere((element) { + return skuY(element, selectSkus); + }); + }catch(ex){ + return; + } + if (productSku == null) return; + selectedPrice = productSku.skuPrice; + String skuId = productSku.id; + if (shopCarGoods == null || shopCarGoods.shoppingCartSkuItemList == null) return; + int shopSkuIndex = shopCarGoods.shoppingCartSkuItemList.indexWhere((element) => skuId == element.id); + if (shopSkuIndex >= 0) { + counts = shopCarGoods.shoppingCartSkuItemList[shopSkuIndex].buyNum; + } + } + + @override + Widget build(BuildContext context) { + return Container( + color: Colors.white, + child: Stack( + children: [ + Container( + // height: 175.h, + // color: Color(0xFF3A405A), + // width: MediaQuery.of(context).size.width, + decoration: BoxDecoration( + image: DecorationImage( + fit: BoxFit.fill, + image: AssetImage("assets/image/settlement_bg.webp"), + ), + ), + width: double.infinity, + height: 375.h, + ), + Container( + child: Column( + children: [ + Expanded( + child: Container( + child: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Container( + child: Column( + children: [ + GestureDetector( + child: Container( + margin: EdgeInsets.only( + top: 50.h, left: 16.w, right: 16.w), + decoration: BoxDecoration( + color: Colors.transparent, + ), + alignment: Alignment.centerLeft, + child: Image.asset( + "assets/image/integral_return.webp", + width: 24, + height: 24, + ), + ), + onTap: () { + Navigator.of(context).pop(); + }, + ), + Container( + width: double.infinity, + margin: EdgeInsets.only( + left: 16.w, + right: 16.w, + top: 26.h, + bottom: 16.h, + ), + padding: EdgeInsets.only( + left: 10.w, + right: 13.w, + top: 16.h, + bottom: 12.h, + ), + decoration: BoxDecoration( + color: Colors.white, + boxShadow: [ + BoxShadow( + color: Color(0x08203303).withAlpha(12), + offset: Offset(0, 2), + blurRadius: 3, + spreadRadius: 0, + ), + ], + borderRadius: BorderRadius.circular(8), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // ListView.builder( + // itemCount:miNiDetail.productSkuVOList[0].productSetMeals.length, + // scrollDirection: Axis.vertical, + // physics: BouncingScrollPhysics(), + // shrinkWrap: true, + // padding: EdgeInsets.zero, + // itemBuilder: (context, position) { + // return productMealsList(); + // }, + // ), + // // Text( + // // "五选二", + // // style: TextStyle( + // // fontSize: 15.sp, + // // color: Colors.black, + // // fontWeight: FontWeight.w600, + // // ), + // // ), + // SizedBox(height: 8.h,), + ListView.builder( + itemCount:productSetMeals?.length??0, + scrollDirection: Axis.vertical, + physics: BouncingScrollPhysics(), + shrinkWrap: true, + padding: EdgeInsets.zero, + itemBuilder: (context, position) { + return productMealsList(productSetMeals[position]); + }, + ), + ], + ), + ) + ], + ), + ), + ), + ), + flex: 1, + ), + Stack( + alignment: Alignment.bottomLeft, + children: [ + Container( + margin: EdgeInsets.symmetric(horizontal: 14), + height: 45.h, + // color: Color(0xFFFAFAFA), + decoration: BoxDecoration( + color: Color(0xFF383A38), + borderRadius: BorderRadius.circular(100), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox(width:45.w,), + Text.rich( + TextSpan(children: [ + TextSpan( + text: "¥ ", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFFFFFFFF), + fontWeight: MyFontWeight.bold), + ), + TextSpan( + text: + shopCarGoods != null ? shopCarGoods.cartSum : "0.0", + style: TextStyle( + fontSize: 20.sp, + color: Color(0xFFFFFFFF), + fontWeight: MyFontWeight.semi_bold), + ), + ]), + ), + Spacer(), + GestureDetector( + onTap: () { + toDownOrder(); + }, + child: RoundButton( + width: 103.w, + height: 54.h, + text: S.current.jiesuan, + textColor: Colors.white, + fontWeight: MyFontWeight.bold, + backgroup: Color(0xFF32A060), + radius: 100, + fontSize: 16.sp, + padding: EdgeInsets.symmetric(vertical: 5.h), + ), + ), + ], + ), + ), + Stack( + children: [ + InkWell( + onTap: () { + if(count() != 0) + showShoppingCart(); + }, + child: Image.asset( + "assets/image/shopping_bag.webp", + width: 66, + height: 66, + fit: BoxFit.fitWidth, + ), + ), + if(count() != 0) + Positioned( + right: 5, + // top: 14, + child: RoundButton( + width: 17.w, + height: 17.h, + text: "${count()}", + textColor: Colors.white, + fontWeight: MyFontWeight.regular, + backgroup: Color(0xFFF65720), + fontSize: 12.sp, + radius: 100, + ), + ), + ], + ), + ], + ), + ], + ), + ) + ], + ), + ); + } + + Widget productMealsList(ProductSetMeals productSetMeals){ + return Container( + margin: EdgeInsets.symmetric(vertical: 16.h), + child:Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "${productSetMeals.groupName}(${productSetMeals.totalNumber}选${productSetMeals.optionalNumber})", + style: TextStyle( + fontSize: 15.sp, + color: Colors.black, + fontWeight: FontWeight.w600, + ), + ), + SizedBox(height: 8.h,), + ListView.builder( + itemCount:productSetMeals.productInfoList.length, + scrollDirection: Axis.vertical, + physics: BouncingScrollPhysics(), + shrinkWrap: true, + padding: EdgeInsets.zero, + itemBuilder: (context, position) { + return productMealsItem(); + }, + ), + ], + ) + ); + } + + Widget productMealsItem(){ + return Container( + margin: EdgeInsets.symmetric(vertical: 16.h), + child: Row( + children: [ + Image.asset( + "assets/image/hot_list.webp", + height: 70.h, + width: 70.h,), + // MImage( + // "", + // width: 70.h, + // height: 70.h, + // radius: BorderRadius.circular(4), + // fit: BoxFit.cover, + // errorSrc: "assets/image/default_1.webp", + // fadeSrc: "assets/image/default_1.webp", + // ), + SizedBox(width:12.h), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Expanded( + child: Text( + "哈哈哈", + overflow: TextOverflow.ellipsis, + maxLines: 1, + style: TextStyle( + color: Colors.black, + fontSize: 13.sp, + fontWeight: MyFontWeight.semi_bold, + ), + ), + ), + // GestureDetector(child: + Text( + "选规则", + style: TextStyle( + color: Colors.black, + fontSize: 13.sp, + fontWeight: MyFontWeight.regular, + ), + ), + // onTap: showSpanDialog,), + Icon( + Icons.chevron_right, + color: Colors.black, + size: 18, + ), + ], + ), + SizedBox(height:8.h), + Text( + "¥222", + style: TextStyle( + color: Color(0xFFF55620), + fontSize: 16.sp, + fontWeight: MyFontWeight.medium, + ), + ), + SizedBox( + height: 4.h, + ), + Row( + children: [ + Text( + "常温/半分糖/500ml", + overflow: TextOverflow.ellipsis, + maxLines: 1, + style: TextStyle( + color: Color(0xFFA29E9E), + fontSize: 13.sp, + fontWeight: MyFontWeight.regular, + ), + ), + Spacer(), + InkWell( + onTap: () { + }, + child: Image.asset( + "assets/image/reduce.webp", + width: 22, + height: 22.h, + ), + ), + Container( + width: 30, + alignment: Alignment.center, + child: Text( + "0", + style: TextStyle( + color: Colors.black, + fontSize: 14.sp, + fontWeight: MyFontWeight.medium, + ), + ), + ), + GestureDetector( + onTap: () { + }, + child: Image.asset( + "assets/image/add.webp", + width: 22, + height: 22.h, + ), + ), + ], + ), + SizedBox( + height: 4.h, + ), + ], + ), + ), + ], + ), + ); + } + + Widget attrItem(Function fc, AttrListBean attrListBean, position) { + if (attrListBean.attrValueList != null && attrListBean.attrValueList.length > 0) + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only(top: 16, bottom: 16), + child: Text( + attrListBean.attrName, + style: TextStyle( + color: Color(0xFFB3B3B3), + fontSize: 14.sp, + fontWeight: MyFontWeight.regular, + ), + ), + ), + sweetnessStore(fc,attrListBean.attrValueList, position), + // sweetnessStore(fc, attrListBean.attrValueList, position), + ], + ); + else { + return Container(); + } + } + + Widget sweetnessStore(Function fc,List arrays, position){ + return Wrap( + runSpacing: 10.0, + spacing: 10.0, + children: arrays.take(arrays.length).map((AttrValueListBean tag) { + return GestureDetector( + onTap: () { + fc(tag.attrValue); + }, + child:sweetnessItem( + tag.attrValue, + (selectSkus.length > position && tag.attrValue == selectSkus[position]), + )); + }).toList()); + } + + Widget sweetnessItem(String name, bool isCheck) { + return Container( + padding: const EdgeInsets.symmetric(vertical:5.0,horizontal: 12.0), + decoration: BoxDecoration( + color: !isCheck ? Color(0xFFF2F2F2) : Color(0xFFF0FAF4), + border: Border.all( + width: !isCheck ? 0:1, + color: !isCheck ? Color(0xFFF2F2F2):Color(0xFF32A060), + style: BorderStyle.solid, + ), + borderRadius: const BorderRadius.all( + Radius.circular(4.0), + ), + ), + child: Text( + name, + overflow: TextOverflow.ellipsis, + style: TextStyle( + color:!isCheck ? Color(0xFF4D4D4D) : Color(0xFF32A060), + fontSize: 14.sp, + fontWeight: MyFontWeight.regular, + ), + )); + } + + ///选择規格弹窗 + showSpanDialog() { + showDialog( + context: context, + builder: (context) { + return StatefulBuilder(builder: ( + context, + state, + ) + { + return AlertDialog( + content: Container( + width: MediaQuery + .of(context) + .size + .width - 84, + height: 500.h, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ClipRRect( + child: MImage( + miNiDetail.imgs[0], + fit: BoxFit.cover, + width: 70, + height: 70, + errorSrc: "assets/image/default_2_1.webp", + fadeSrc: "assets/image/default_2_1.webp", + ), + borderRadius: BorderRadius.circular(4), + ), + SizedBox( + width: 10.w, + ), + Expanded( + child: Container( + height: 70, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment + .spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + miNiDetail?.productName ?? "", + style: TextStyle( + fontSize: 13.sp, + fontWeight: FontWeight.bold, + color: Color(0xFF000000), + ), + ), + GestureDetector( + onTap: () { + Navigator.of(context).pop(); + }, + child: Image.asset( + "assets/image/cancel.webp", + fit: BoxFit.cover, + height: 24, + width: 24, + ), + ), + ], + ), + Text( + "¥${miNiDetail?.price ?? ""}", + style: TextStyle( + fontSize: 12.sp, + fontWeight: FontWeight.bold, + color: Color(0xFFF65720), + ), + ), + ], + ), + )), + ], + ), + if (miNiDetail.attrList != null && + miNiDetail.attrList.length > 0) + SizedBox( + height: 10, + ), + if (miNiDetail.attrList != null && + miNiDetail.attrList.length > 0) + Expanded( + child: ListView.builder( + itemCount: miNiDetail.attrList.length, + scrollDirection: Axis.vertical, + physics: BouncingScrollPhysics(), + padding: EdgeInsets.zero, + itemBuilder: (context, position) { + return attrItem( + (attrValue) { + state(() { + // if(selectSkus.length > position) + selectSkus[position] = attrValue; + buildCount(); + }); + }, + miNiDetail.attrList[position], + position, + ); + }, + ), + ), + SizedBox( + height: 24, + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Text( + "数量", + style: TextStyle( + color: Color(0xFFB3B3B3), + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + ), + ), + SizedBox(height: 10,), + Row( + children: [ + InkWell( + onTap: () { + state(() { + if (counts > 1) + setState(() { + counts -= 1; + }); + reduce(miNiDetail, selectSkus); + }); + }, + child: Icon( + Icons.remove, + color: Color(0xFF32A060), + size: 24, + ) + // Image.asset( + // "assets/image/reduce.webp", + // width: 22, + // height: 22, + // ), + ), + Padding( + padding: EdgeInsets.only(left: 8, right: 8), + child: Text( + "$counts", + style: TextStyle( + color: Colors.black, + fontSize: 14.sp, + fontWeight: MyFontWeight.medium, + ), + ), + ), + InkWell( + onTap: () { + state(() { + counts += 1; + add(miNiDetail, selectSkus); + }); + }, + child: Icon( + Icons.add, + color: Color(0xFF32A060), + size: 24, + ) + ), + ], + ) + ], + ), + SizedBox( + height: 24, + ), + GestureDetector( + onTap: () { + state(() { + _addShopCar(miNiDetail, selectSkus, counts); + Navigator.of(context).pop(); + }); + }, + child: Container( + width: double.infinity, + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(20), + color: Color(0xFF32A060), + ), + padding: EdgeInsets.symmetric(vertical: 6), + child: Text( + "加入购物车", + style: TextStyle( + fontSize: 15.sp, + fontWeight: MyFontWeight.bold, + color: Color(0xFFFFFFFF), + ), + ), + ), + ) + ], + ), + ), + ); + }); + }, + ); + } + +} diff --git a/lib/store/store_view/shop_goods.dart b/lib/store/store_view/shop_goods.dart index 70c37762..77fe3592 100644 --- a/lib/store/store_view/shop_goods.dart +++ b/lib/store/store_view/shop_goods.dart @@ -237,8 +237,12 @@ class _ShopGoods extends State { (widget.productListBean?.attrStyle ?? 0) == 0) GestureDetector( onTap: () { - widget.add(widget.shoppingCartSkuItemListBean); + Navigator.of(context) + .pushNamed('/router/product_meals_sku', arguments: { + "id":widget.productListBean.id, + "storeId":widget.productListBean.storeId + }); }, child: Image.asset( "assets/image/add.webp", diff --git a/lib/view_widget/update_dialog.dart b/lib/view_widget/update_dialog.dart index d79729bb..f343d9ca 100644 --- a/lib/view_widget/update_dialog.dart +++ b/lib/view_widget/update_dialog.dart @@ -149,7 +149,7 @@ class _UpdateDialog extends State { } updateApp() async { - String url = Platform.isIOS ? "itms-apps://itunes.apple.com/app/id1575124838":"http://application.lotus-wallet.com/huixaing?release_id="; + String url = Platform.isIOS ? "itms-apps://itunes.apple.com/app/id1575124838":"http://application.lotus-wallet.com/huixiang?release_id="; if (await canLaunch(url)) { await launch(url); } else {