Browse Source

Merge branch 'refs/heads/wr_2023_new_business_new' into wr_202303

# Conflicts:
#	lib/generated/intl/messages_en.dart
#	lib/generated/intl/messages_zh_CN.dart
#	lib/generated/intl/messages_zh_Hans_CN.dart
#	lib/generated/intl/messages_zh_Hant_CN.dart
#	lib/generated/intl/messages_zh_TW.dart
#	lib/view_widget/my_appbar.dart
dart3_last
wurong 4 months ago
parent
commit
d8330e2c43
  1. BIN
      assets/image/2x/add.webp
  2. BIN
      assets/image/2x/reduce.webp
  3. BIN
      assets/image/3x/add.webp
  4. BIN
      assets/image/3x/reduce.webp
  5. BIN
      assets/image/add.webp
  6. BIN
      assets/image/reduce.webp
  7. 2
      lib/generated/l10n.dart
  8. 27
      lib/mine/fans_page.dart
  9. 29
      lib/mine/follow_page.dart
  10. 48
      lib/mine/vip_pay_code.dart
  11. 203
      lib/order/order_view/order_commodity.dart
  12. 3
      lib/retrofit/data/findMiNiGroupList.dart
  13. 28
      lib/retrofit/data/miNiDetail.dart
  14. 136
      lib/retrofit/data/order_info.dart
  15. 3
      lib/retrofit/data/shoppingCart.dart
  16. 2
      lib/retrofit/min_api.g.dart
  17. 28
      lib/setting/permission_setting_page.dart
  18. 5
      lib/settlement/settlement.dart
  19. 2
      lib/settlement/settlement_view/activity_coupon_remarks.dart
  20. 1
      lib/settlement/settlement_view/pay_method.dart
  21. 3
      lib/settlement/settlement_view/settlement_order_commodity.dart
  22. 2
      lib/settlement/settlement_view/vip_discounts_select.dart
  23. 549
      lib/store/shop_details_page.dart
  24. 91
      lib/store/store_order.dart
  25. 1377
      lib/store/store_view/product_meals_sku.dart
  26. 377
      lib/store/store_view/product_sku.dart
  27. 83
      lib/store/store_view/red_dot_page.dart
  28. 30
      lib/store/store_view/shop_car.dart
  29. 345
      lib/store/store_view/shop_goods.dart
  30. 125
      lib/store/store_view/shop_goods_car.dart
  31. 9
      lib/store/store_view/store_order_list.dart
  32. 450
      lib/union/union_list.dart
  33. 4
      lib/view_widget/coupon_details_dialog.dart
  34. 2
      lib/view_widget/my_appbar.dart
  35. 2
      lib/view_widget/recharge_details_dialog.dart
  36. 2
      lib/view_widget/selector_store_dialog.dart

BIN
assets/image/2x/add.webp

Binary file not shown.

Before

Width:  |  Height:  |  Size: 228 B

After

Width:  |  Height:  |  Size: 486 B

BIN
assets/image/2x/reduce.webp

Binary file not shown.

Before

Width:  |  Height:  |  Size: 248 B

After

Width:  |  Height:  |  Size: 516 B

BIN
assets/image/3x/add.webp

Binary file not shown.

Before

Width:  |  Height:  |  Size: 358 B

After

Width:  |  Height:  |  Size: 952 B

BIN
assets/image/3x/reduce.webp

Binary file not shown.

Before

Width:  |  Height:  |  Size: 446 B

After

Width:  |  Height:  |  Size: 878 B

BIN
assets/image/add.webp

Binary file not shown.

Before

Width:  |  Height:  |  Size: 154 B

After

Width:  |  Height:  |  Size: 362 B

BIN
assets/image/reduce.webp

Binary file not shown.

Before

Width:  |  Height:  |  Size: 162 B

After

Width:  |  Height:  |  Size: 314 B

2
lib/generated/l10n.dart

@ -3563,7 +3563,7 @@ class S {
/// `使使`
String get weilekaipaizhaoxuanzhetouxiang {
return Intl.message(
'为了您可以在使用过程中更换头像,扫码,请您开启相机使用权限',
'为了您可以在使用过程中更换头像,请您开启相机使用权限',
name: 'weilekaipaizhaoxuanzhetouxiang',
desc: '',
args: [],

27
lib/mine/fans_page.dart

@ -149,15 +149,26 @@ class _FansPage extends State<FansPage>
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
MImage(
list != null ? (list.avatar ?? "") : "",
width: 44,
height: 44,
isCircle: true,
fit: BoxFit.cover,
errorSrc: "assets/image/default_1.webp",
fadeSrc: "assets/image/default_1.webp",
GestureDetector(
onTap:(){
Navigator.of(context)
.pushNamed('/router/personal_page', arguments: {
"memberId": list.mid ?? "",
});},
child: Padding(
padding: EdgeInsets.only(right: 8.w),
child: MImage(
list != null ? (list.avatar ?? "") : "",
width: 44,
height: 44,
isCircle: true,
fit: BoxFit.cover,
errorSrc: "assets/image/default_1.webp",
fadeSrc: "assets/image/default_1.webp",
),
),
),
SizedBox(
width: 8,
),

29
lib/mine/follow_page.dart

@ -143,17 +143,24 @@ class _FollowPage extends State<FollowPage> with SingleTickerProviderStateMixin,
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment:CrossAxisAlignment.center,
children: [
MImage(
list != null ? (list.avatar ?? "") : "",
width: 44,
height: 44,
isCircle: true,
fit: BoxFit.cover,
errorSrc: "assets/image/default_1.webp",
fadeSrc: "assets/image/default_1.webp",
),
SizedBox(
width:8,
GestureDetector(
onTap:(){
Navigator.of(context)
.pushNamed('/router/personal_page', arguments: {
"memberId": list.mid ?? "",
});},
child: Padding(
padding: EdgeInsets.only(right: 8.w),
child: MImage(
list != null ? (list.avatar ?? "") : "",
width: 44,
height: 44,
isCircle: true,
fit: BoxFit.cover,
errorSrc: "assets/image/default_1.webp",
fadeSrc: "assets/image/default_1.webp",
),
),
),
Expanded(child:Text(
list != null ? (list.nickname ?? "") : "",

48
lib/mine/vip_pay_code.dart

@ -2,6 +2,7 @@ import 'dart:async';
import 'dart:convert';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/font_weight.dart';
@ -27,7 +28,9 @@ class _VipPayCode extends State<VipPayCode> {
@override
void dispose() {
super.dispose();
refreshController.dispose();
refreshController?.dispose();
_timer?.cancel();
isDispose = true;
}
@override
@ -44,40 +47,47 @@ class _VipPayCode extends State<VipPayCode> {
///
queryUser() async {
try{
SharedPreferences value = await SharedPreferences.getInstance();
SharedPreferences prefs;
try {
prefs = await SharedPreferences.getInstance();
if (prefs.getString("bannerData") != null) {
userInfo = UserInfo.fromJson(jsonDecode(prefs.getString('userInfo')));
setState(() {});
}
if (apiService == null)
apiService = ApiService(
Dio(),
context: context,
token: value.getString("token"),
Dio(),
context: context,
token: prefs.getString("token"),
showLoading: true
);
BaseData<UserInfo> baseData =
await apiService.queryInfo().catchError((onError) {
refreshController.refreshFailed();});
BaseData<UserInfo> baseData = await apiService.queryInfo().catchError((onError) {
refreshController.refreshFailed();
});
if (baseData != null && baseData.isSuccess) {
userInfo = baseData.data;
SharedPreferences.getInstance().then((value) => {
value.setString('user', jsonEncode(baseData.data)),
});
prefs.setString('userInfo', jsonEncode(baseData.data));
setState(() {});
refreshController.refreshCompleted();
}else{
} else {
refreshController.refreshFailed();
}
}finally{
} finally {
refreshCode();
EasyLoading.dismiss();
}
}
refreshCode(){
if (_timer != null) return;
const oneSec = const Duration(minutes: 2);
var callback = ((timer) {
if (isDispose) return;
_timer = Timer.periodic(oneSec, (timer) {
if (isDispose) {
timer.cancel();
return;
}
queryUser();
});
_timer = Timer.periodic(oneSec, callback);
}
@override
@ -132,9 +142,7 @@ class _VipPayCode extends State<VipPayCode> {
),
SizedBox(height: 30.h,),
QrImage(
data: userInfo != null
? (userInfo?.vipScanNo ?? "")
: "",
data:userInfo?.vipScanNo ?? "622868c3c2c5a02508ed7064c7c27387a1c2c0cb2052ba344d82266a64feb1cfc75014532616b2fb179024c83a6066757cf2639efca8f2731c54a24859e200ca",
version: QrVersions.auto,
size: 200.w,
gapless: true,

203
lib/order/order_view/order_commodity.dart

@ -76,7 +76,9 @@ class _OrderCommodity extends State<OrderCommodity> {
}
widgets.add(SizedBox(height: 20.h));
if (widget.orderInfo.isTakeOut != 0 && widget.orderInfo.isTakeOut != 3 && widget.orderInfo.isTakeOut != 4) {
if (widget.orderInfo.isTakeOut != 0 &&
widget.orderInfo.isTakeOut != 3 &&
widget.orderInfo.isTakeOut != 4) {
//
widgets.add(
discountItem(
@ -113,7 +115,6 @@ class _OrderCommodity extends State<OrderCommodity> {
);
}
if (widget.orderInfo.orderDetail != null &&
widget.orderInfo.orderDetail.couponDTO != null) {
//
@ -129,7 +130,8 @@ class _OrderCommodity extends State<OrderCommodity> {
if (widget.orderInfo.orderDetail != null &&
widget.orderInfo.orderDetail.activityPrice != null &&
double.tryParse(widget.orderInfo.orderDetail.activityPrice ?? "0") > 0) {
double.tryParse(widget.orderInfo.orderDetail.activityPrice ?? "0") >
0) {
//
widgets.add(
discountItem(
@ -141,7 +143,6 @@ class _OrderCommodity extends State<OrderCommodity> {
);
}
if (widget.orderInfo.orderDetail != null &&
widget.orderInfo.vipDiscountPrice != null &&
double.tryParse(widget.orderInfo.vipDiscountPrice ?? "0") > 0) {
@ -151,7 +152,7 @@ class _OrderCommodity extends State<OrderCommodity> {
Color(0xFFFF7A1A),
"VIP优惠",
"",
"- ${widget.orderInfo.vipDiscountPrice??""}",
"- ${widget.orderInfo.vipDiscountPrice ?? ""}",
),
);
}
@ -179,7 +180,6 @@ class _OrderCommodity extends State<OrderCommodity> {
return widgets;
}
Widget commodityItem(OrderProductVOList productList) {
return Container(
margin: EdgeInsets.only(top: 8.h, bottom: 8.h),
@ -248,15 +248,23 @@ class _OrderCommodity extends State<OrderCommodity> {
children: [
Text(
productList.buyNum > 1
? S.of(context).yuan_(AppUtils.calculateDouble(double.tryParse(productList.sellPrice ?? "0") - AppUtils.stringAsFixedDouble2((double.tryParse(productList.discountAmount ?? "0") / productList.buyNum))))
: S.of(context).yuan_(AppUtils.calculateDouble(double.tryParse(productList.sellPrice ?? "0") - double.tryParse(productList.discountAmount ?? "0"))),
? S.of(context).yuan_(AppUtils.calculateDouble(
double.tryParse(productList.sellPrice ?? "0") -
AppUtils.stringAsFixedDouble2((double.tryParse(
productList.discountAmount ?? "0") /
productList.buyNum))))
: S.of(context).yuan_(AppUtils.calculateDouble(
double.tryParse(productList.sellPrice ?? "0") -
double.tryParse(
productList.discountAmount ?? "0"))),
style: TextStyle(
fontWeight: MyFontWeight.medium,
fontSize: 14.sp,
color: Color(0xFF4C4C4C),
),
),
if (productList.discountAmount != null && productList.discountAmount != "0")
if (productList.discountAmount != null &&
productList.discountAmount != "0")
Text(
S.of(context).yuan_(productList.sellPrice),
style: TextStyle(
@ -288,53 +296,55 @@ class _OrderCommodity extends State<OrderCommodity> {
}
Widget orderMealsItem(SetMealDataList setMealDataList) {
return Column(children: setMealDataList.productInfoList.map((e) {
return Container(
margin: EdgeInsets.symmetric(
vertical: 10.h,
),
child: Row(
children: [
Expanded(
flex: 2,
child: Text(
e.productName,
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: TextStyle(
color: Color(0xffA29E9E),
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
return Column(
children: setMealDataList.productInfoList.map((e) {
return Container(
margin: EdgeInsets.symmetric(
vertical: 10.h,
),
child: Row(
children: [
Expanded(
flex: 2,
child: Text(
e.productName,
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: TextStyle(
color: Color(0xffA29E9E),
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
),
),
),
),
Expanded(
flex: 3,
child: Text(
"${(e.skuName == "") ? "" : e.skuName}",
Expanded(
flex: 3,
child: Text(
"${(e.skuName == "") ? "" : e.skuName}",
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: TextStyle(
color: Color(0xffA29E9E),
fontSize: 13.sp,
fontWeight: MyFontWeight.regular,
),
),
),
Text(
"x${e.buyNumber.toString()}",
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: TextStyle(
color: Color(0xffA29E9E),
color: Color(0xffFF7A1A),
fontSize: 13.sp,
fontWeight: MyFontWeight.regular,
),
),
),
Text(
"x${e.buyNumber.toString()}",
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: TextStyle(
color: Color(0xffFF7A1A),
fontSize: 13.sp,
fontWeight: MyFontWeight.regular,
),
),
],
),
);
}).toList(),);
],
),
);
}).toList(),
);
}
Widget discountItem(Color color, textName, condition, amount) {
@ -386,7 +396,7 @@ class _OrderCommodity extends State<OrderCommodity> {
);
}
Widget vipItem(Color color, textName,amount) {
Widget vipItem(Color color, textName, amount) {
return Container(
margin: EdgeInsets.only(top: 9.h, bottom: 9.h),
child: Row(
@ -497,9 +507,9 @@ class _OrderCommodity extends State<OrderCommodity> {
);
}
String buyNumAllGoods(){
String buyNumAllGoods() {
int count = 0;
if(widget.orderInfo != null){
if (widget.orderInfo != null) {
widget.orderInfo.productList.forEach((element) {
count += element.buyNum;
});
@ -512,7 +522,7 @@ class _OrderCommodity extends State<OrderCommodity> {
margin: EdgeInsets.only(top: 7.h, bottom: 11.h),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.baseline,
crossAxisAlignment: CrossAxisAlignment.start,
textBaseline: TextBaseline.alphabetic,
children: [
Expanded(
@ -538,27 +548,76 @@ class _OrderCommodity extends State<OrderCommodity> {
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(
"${widget.orderInfo.orderDetail.paySumPrice}"
/*totalPrice()*/,
textAlign: TextAlign.end,
style: TextStyle(
fontSize: 14.sp,
color: Color(0xFF32A060),
fontFamily: 'JDZhengHT',
fontWeight: MyFontWeight.semi_bold),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Container(
margin: EdgeInsets.only(bottom:8.h),
child: Text(
"${S.of(context).jiesuanjine}:",
style: TextStyle(
fontSize: 12.sp,
color: Color(0xFF353535),
fontWeight: MyFontWeight.medium),
),
),
if(widget.orderInfo.orderDetail.payRecords != null)
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: widget.orderInfo.orderDetail.payRecords.map((e) {
return Container(
margin:EdgeInsets.only(bottom:5.h),
child: Text(
"${e?.countName ?? ""}:",
style: TextStyle(
fontSize: 12.sp,
color: Color(0xFF727272),
fontWeight: MyFontWeight.regular),
));
}).toList(),
),
],
),
SizedBox(
width: 5.w,
),
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Container(margin:EdgeInsets.only(bottom:7.5.h),
child: Text(
"${widget.orderInfo.orderDetail.paySumPrice}" /*totalPrice()*/,
textAlign: TextAlign.end,
style: TextStyle(
fontSize: 13.sp,
color: Color(0xFF32A060),
fontFamily: 'JDZhengHT',
fontWeight: MyFontWeight.semi_bold),
)),
if(widget.orderInfo.orderDetail.payRecords != null)
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: widget.orderInfo.orderDetail.payRecords.map((e) {
return Container(
margin:EdgeInsets.only(bottom:4.h),
child: Text(
"${e?.amount ?? "0.00"}",
textAlign: TextAlign.end,
style: TextStyle(
fontSize: 12.sp,
color: Color(0xFF32A060),
fontFamily: 'JDZhengHT',
fontWeight: MyFontWeight.regular),
),
);
}).toList(),
),
],
),
],
)
],
),

3
lib/retrofit/data/findMiNiGroupList.dart

@ -104,6 +104,7 @@ class ProductListBean {
dynamic markProductNone;
SubscribeParam subscribeParam;
bool isSetMeal;
int minQty;
static ProductListBean fromJson(Map<String, dynamic> map) {
if (map == null) return null;
@ -139,6 +140,7 @@ class ProductListBean {
productListBean.markProductNone = map['markProductNone'];
productListBean.subscribeParam = SubscribeParam.fromJson(map['subscribeParam']);
productListBean.isSetMeal = map['isSetMeal'];
productListBean.minQty = map['minQty'];
return productListBean;
}
@ -174,6 +176,7 @@ class ProductListBean {
"markProductNone": markProductNone,
"subscribeParam": subscribeParam,
"isSetMeal": isSetMeal,
"minQty": minQty,
};
}

28
lib/retrofit/data/miNiDetail.dart

@ -87,6 +87,7 @@ class MiNiDetail {
dynamic namePinyin;
dynamic nameInitials;
SubscribeParam subscribeParam;
int minQty;
static MiNiDetail fromJson(Map<String, dynamic> map) {
if (map == null) return null;
@ -142,6 +143,7 @@ class MiNiDetail {
miNiDetailBean.nameInitials = map['nameInitials'];
miNiDetailBean.subscribeParam =
SubscribeParam.fromJson(map['subscribeParam']);
miNiDetailBean.minQty = map['minQty'];
return miNiDetailBean;
}
@ -192,6 +194,7 @@ class MiNiDetail {
"namePinyin": namePinyin,
"nameInitials": nameInitials,
"subscribeParam": subscribeParam,
"minQty": minQty
};
}
@ -229,6 +232,7 @@ class ProductSkuVOListBean {
String storeId;
String skuCode;
String skuNameStr;
int _minQty;
String productId;
String skuPrice;
String applyPrice;
@ -246,6 +250,19 @@ class ProductSkuVOListBean {
List<SkuAttrListBean> skuAttrList;
List<ProductSetMeals> productSetMeals;
dynamic setMealDTOList;
int _count;
int get minQty => _minQty??0;
set minQty(int value) {
_minQty = value;
}
int get count => _count??1;
set count(int value) {
_count = value;
}
static ProductSkuVOListBean fromJson(Map<String, dynamic> map) {
if (map == null) return null;
@ -258,6 +275,7 @@ class ProductSkuVOListBean {
productSkuVOListBean.storeId = map['storeId'];
productSkuVOListBean.skuCode = map['skuCode'];
productSkuVOListBean.skuNameStr = map['skuNameStr'];
productSkuVOListBean._minQty = map['minQty'];
productSkuVOListBean.productId = map['productId'];
productSkuVOListBean.skuPrice = map['skuPrice'];
productSkuVOListBean.applyPrice = map['applyPrice'];
@ -291,6 +309,7 @@ class ProductSkuVOListBean {
"storeId": storeId,
"skuCode": skuCode,
"skuNameStr": skuNameStr,
"minQty": _minQty,
"productId": productId,
"skuPrice": skuPrice,
"applyPrice": applyPrice,
@ -397,6 +416,7 @@ class ProductSetMeals {
int _totalNumber;
int _optionalNumber;
List<ProductInfoList> _productInfoList;
int checkIndex = 0;
ProductSetMeals copyWith({
String groupName,
@ -667,16 +687,19 @@ class SkuInfoList {
SkuInfoList({
String id,
String skuName,
String skuPrice,
List<ProductSkuAttrList> productSkuAttrList,
}) {
_id = id;
_skuName = skuName;
_skuPrice = skuPrice;
_productSkuAttrList = productSkuAttrList;
}
SkuInfoList.fromJson(dynamic json) {
_id = json['id'];
_skuName = json['skuName'];
_skuPrice = json['skuPrice'];
if (json['productSkuAttrList'] != null) {
_productSkuAttrList = [];
json['productSkuAttrList'].forEach((v) {
@ -687,17 +710,20 @@ class SkuInfoList {
String _id;
String _skuName;
String _skuPrice;
bool _isSelected = false;
List<ProductSkuAttrList> _productSkuAttrList;
SkuInfoList copyWith({
String id,
String skuName,
String skuPrice,
List<ProductSkuAttrList> productSkuAttrList,
}) =>
SkuInfoList(
id: id ?? _id,
skuName: skuName ?? _skuName,
skuPrice: skuPrice ?? _skuPrice,
productSkuAttrList: productSkuAttrList ?? _productSkuAttrList,
);
@ -705,6 +731,8 @@ class SkuInfoList {
String get skuName => _skuName;
String get skuPrice => _skuPrice;
List<ProductSkuAttrList> get productSkuAttrList => _productSkuAttrList;
bool get isSelected => _isSelected;

136
lib/retrofit/data/order_info.dart

@ -433,6 +433,7 @@ class OrderDetail {
String shipperCode;
String logisticsName;
String logisticsNum;
List<PayRecords> payRecords;
int orderNum;
int productNum;
int mins;
@ -461,6 +462,7 @@ class OrderDetail {
String shipperCode,
String logisticsName,
String logisticsNum,
List<PayRecords> payRecords,
int orderNum,
int productNum,
int mins,
@ -487,6 +489,7 @@ class OrderDetail {
this.shipperCode = shipperCode;
this.logisticsName = logisticsName;
this.logisticsNum = logisticsNum;
this.payRecords = payRecords;
this.orderNum = orderNum;
this.productNum = productNum;
this.mins = mins;
@ -526,6 +529,12 @@ class OrderDetail {
this.shipperCode = json["shipperCode"];
this.logisticsName = json["logisticsName"];
this.logisticsNum = json["logisticsNum"];
if (json["payRecords"] != null) {
this.payRecords = [];
json["payRecords"].forEach((v) {
this.payRecords.add(PayRecords.fromJson(v));
});
}
this.orderNum = json["orderNum"];
this.productNum = json["productNum"];
this.mins = json["mins"];
@ -560,6 +569,9 @@ class OrderDetail {
map["shipperCode"] = this.shipperCode;
map["logisticsName"] = this.logisticsName;
map["logisticsNum"] = this.logisticsNum;
if (this.payRecords != null) {
map["payRecords"] = this.payRecords.map((v) => v.toJson()).toList();
}
map["orderNum"] = this.orderNum;
map["productNum"] = this.productNum;
map["mins"] = this.mins;
@ -891,3 +903,127 @@ class CouponDTO {
return map;
}
}
/// id : "1828720860895117312"
/// orderId : "1828720033405075456"
/// countName : "商户活动余额支付"
/// type : 8
/// amount : "10.00"
/// refundAmount : "0.00"
/// createTime : "2024-08-28 17:06:44"
/// refId : "1828720859515191296"
/// memberName : "soon"
/// memberBalance : "3551.19"
/// memberPhone : "13052919193"
/// isDiscount : false
class PayRecords {
PayRecords({
String id,
String orderId,
String countName,
int type,
String amount,
String refundAmount,
String createTime,
String refId,
String memberName,
String memberBalance,
String memberPhone,
bool isDiscount,}){
_id = id;
_orderId = orderId;
_countName = countName;
_type = type;
_amount = amount;
_refundAmount = refundAmount;
_createTime = createTime;
_refId = refId;
_memberName = memberName;
_memberBalance = memberBalance;
_memberPhone = memberPhone;
_isDiscount = isDiscount;
}
PayRecords.fromJson(dynamic json) {
_id = json['id'];
_orderId = json['orderId'];
_countName = json['countName'];
_type = json['type'];
_amount = json['amount'];
_refundAmount = json['refundAmount'];
_createTime = json['createTime'];
_refId = json['refId'];
_memberName = json['memberName'];
_memberBalance = json['memberBalance'];
_memberPhone = json['memberPhone'];
_isDiscount = json['isDiscount'];
}
String _id;
String _orderId;
String _countName;
int _type;
String _amount;
String _refundAmount;
String _createTime;
String _refId;
String _memberName;
String _memberBalance;
String _memberPhone;
bool _isDiscount;
PayRecords copyWith({ String id,
String orderId,
String countName,
int type,
String amount,
String refundAmount,
String createTime,
String refId,
String memberName,
String memberBalance,
String memberPhone,
bool isDiscount,
}) => PayRecords( id: id ?? _id,
orderId: orderId ?? _orderId,
countName: countName ?? _countName,
type: type ?? _type,
amount: amount ?? _amount,
refundAmount: refundAmount ?? _refundAmount,
createTime: createTime ?? _createTime,
refId: refId ?? _refId,
memberName: memberName ?? _memberName,
memberBalance: memberBalance ?? _memberBalance,
memberPhone: memberPhone ?? _memberPhone,
isDiscount: isDiscount ?? _isDiscount,
);
String get id => _id;
String get orderId => _orderId;
String get countName => _countName;
int get type => _type;
String get amount => _amount;
String get refundAmount => _refundAmount;
String get createTime => _createTime;
String get refId => _refId;
String get memberName => _memberName;
String get memberBalance => _memberBalance;
String get memberPhone => _memberPhone;
bool get isDiscount => _isDiscount;
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['id'] = _id;
map['orderId'] = _orderId;
map['countName'] = _countName;
map['type'] = _type;
map['amount'] = _amount;
map['refundAmount'] = _refundAmount;
map['createTime'] = _createTime;
map['refId'] = _refId;
map['memberName'] = _memberName;
map['memberBalance'] = _memberBalance;
map['memberPhone'] = _memberPhone;
map['isDiscount'] = _isDiscount;
return map;
}
}

3
lib/retrofit/data/shoppingCart.dart

@ -88,6 +88,7 @@ class ShoppingCartSkuItemListBean {
int skuStock;
String storeId;
String tableId;
int minQty;
static ShoppingCartSkuItemListBean fromJson(Map<String, dynamic> map) {
if (map == null) return null;
@ -112,6 +113,7 @@ class ShoppingCartSkuItemListBean {
shoppingCartSkuItemListBean.skuStock = map['skuStock'];
shoppingCartSkuItemListBean.storeId = map['storeId'];
shoppingCartSkuItemListBean.tableId = map['tableId'];
shoppingCartSkuItemListBean.minQty = map['minQty'];
return shoppingCartSkuItemListBean;
}
@ -132,6 +134,7 @@ class ShoppingCartSkuItemListBean {
"skuStock": skuStock,
"storeId": storeId,
"tableId": tableId,
"minQty": minQty,
};
}

2
lib/retrofit/min_api.g.dart

@ -78,7 +78,7 @@ class _MinApiService implements MinApiService {
data: _data);
final value = BaseData<MiNiDetail>.fromJson(
_result.data,
(json) => MiNiDetail.fromJson(json),
(json) => ((json??"") == "")? null :MiNiDetail.fromJson(json),
);
return value;
}

28
lib/setting/permission_setting_page.dart

@ -15,14 +15,20 @@ class PermissionSettingPage extends StatefulWidget {
}
}
class _PermissionSettingPage extends State<PermissionSettingPage> {
class _PermissionSettingPage extends State<PermissionSettingPage> with WidgetsBindingObserver {
@override
void initState() {
super.initState();
WidgetsBinding.instance.addObserver(this);
queryPermission();
}
@override
void dispose() {
super.dispose();
WidgetsBinding.instance.removeObserver(this);
}
List<String> title = [
S.current.dingwei,
S.current.tongzhi,
@ -75,14 +81,24 @@ class _PermissionSettingPage extends State<PermissionSettingPage> {
];
queryPermission() async {
await permissions.forEach((element) async {
if (await element.isGranted) {
permissionSwitch[element] = true;
for(var it in permissions){
if (await it.isGranted) {
permissionSwitch[it] = true;
}
});
}
setState(() {});
}
@override
void didChangeAppLifecycleState(AppLifecycleState state) {
if (state == AppLifecycleState.resumed) {
//
queryPermission();
} else if (state == AppLifecycleState.paused) {
//
}
}
@override
Widget build(BuildContext context) {
return Scaffold(

5
lib/settlement/settlement.dart

@ -1011,11 +1011,10 @@ class _Settlement extends State<Settlement> {
subscribeStoresName,
),
///
if (settleOrderInfo != null &&
placeOrder &&
joinA != JoinActivity.BargainBug)
///
PayMethod(
payChannelCheck,
coupons,
@ -1146,7 +1145,7 @@ class _Settlement extends State<Settlement> {
],
borderRadius: BorderRadius.circular(8),
),
margin: EdgeInsets.only(left: 16.w, right: 16.w, top: 6.h, bottom: 6.h),
margin: EdgeInsets.only(left: 16.w, right: 16.w,bottom: 16.h),
padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 10.h),
child: Row(
children: [

2
lib/settlement/settlement_view/activity_coupon_remarks.dart

@ -84,7 +84,7 @@ class _ActivityCouponRemarks extends State<ActivityCouponRemarks> {
],
borderRadius: BorderRadius.circular(8),
),
margin: EdgeInsets.only(left: 16.w, right: 16.w, top: 14.h, bottom: 14.h),
margin: EdgeInsets.only(left: 16.w, right: 16.w,bottom: 16.h),
padding: EdgeInsets.only(
left: 16.w,
right: 16.w,

1
lib/settlement/settlement_view/pay_method.dart

@ -54,7 +54,6 @@ class _PayMethod extends State<PayMethod> {
margin: EdgeInsets.only(
left: 16.w,
right: 16.w,
top: 8.h,
bottom: 16.h,
),
padding: EdgeInsets.only(

3
lib/settlement/settlement_view/settlement_order_commodity.dart

@ -52,8 +52,7 @@ class _SettlementOrderCommodity extends State<SettlementOrderCommodity> {
margin: EdgeInsets.only(
left: 16.w,
right: 16.w,
top: 16.h,
bottom: 8.h,
bottom: 16.h,
),
padding: EdgeInsets.only(
left: 20.w,

2
lib/settlement/settlement_view/vip_discounts_select.dart

@ -41,7 +41,7 @@ class _VipDiscountsSelect extends State<VipDiscountsSelect> {
],
borderRadius: BorderRadius.circular(8),
),
margin: EdgeInsets.only(left: 16.w, right: 16.w, top: 14.h, bottom: 14.h),
margin: EdgeInsets.only(left: 16.w, right: 16.w,bottom: 16.h),
padding: EdgeInsets.only(
left: 16.w,
right: 16.w,

549
lib/store/shop_details_page.dart

@ -16,6 +16,7 @@ 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/red_dot_page.dart';
import 'package:huixiang/store/store_view/shop_car.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/classic_header.dart';
@ -28,6 +29,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:shared_preferences/shared_preferences.dart';
import '../view_widget/border_text.dart';
import '../view_widget/request_permission.dart';
import '../view_widget/settlement_tips_dialog.dart';
class ShopDetailsPage extends StatefulWidget {
final Map<String, dynamic> arguments;
@ -68,13 +70,20 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
int index;
bool isSetMeal;
int scIndex = 0;
int skuMinQty = 0;
int singleNum = 0;
String goodsSkuId;
bool isCounts = false;
GlobalKey _key = GlobalKey();
Offset _endOffset;
double rightOffset = 23.0;
int _jumpType = -1;
@override
void initState() {
super.initState();
id = widget.arguments["id"];
storeId = widget.arguments["storeId"];
isSetMeal = widget.arguments["isSetMeal"] ?? false;
scrollController.addListener(() {
if(scIndex == 0 && scrollController.offset > (MediaQuery.of(context).size.height >= 750 ? 392.h : 400.h)){
setState(() {
@ -86,6 +95,12 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
});
}
});
WidgetsBinding.instance.addPostFrameCallback((c) {
//
_endOffset = (_key.currentContext.findRenderObject() as RenderBox)
.localToGlobal(Offset.zero)+
Offset(rightOffset, 0.0);
});
// SharedPreferences.getInstance().then((value) {
// String minToken = value.getString("minToken");
// String tenant = value.getString("tenant");
@ -191,6 +206,11 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
miNiDetail = baseData.data;
miNiDetail.attrList.forEach((element) {
selectSkus.add(element.attrValueList[0].attrValue);
if (baseData.data.productSkuVOList[0].productSetMeals.length == 0) {
_jumpType = 0;
} else {
_jumpType = 1;
}
});
});
SharedPreferences.getInstance().then(
@ -325,20 +345,36 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
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,
);
//使showModalBottomSheet加载弹窗才有效
showModalBottomSheet(
backgroundColor: Colors.transparent,
context: context,
//
// isDismissible: true,
builder: (_) {
return ShopCar(
shopCartKey,
this.shopCarGoods,
clearShopCar,
toDownOrder,
shopCartAdd,
shopCartReduce,
);
});
// SmartDialog.show(
// widget: ShopCar(
// shopCartKey,
// this.shopCarGoods,
// clearShopCar,
// toDownOrder,
// shopCartAdd,
// shopCartReduce,
// ),
// onDismiss: () {
// dialogShowing = false;
// },
// alignmentTemp: Alignment.bottomCenter,
// );
});
}
@ -347,14 +383,15 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
BaseData<bool> baseData = await minService.clearShoppingCart(storeId);
if (baseData.isSuccess) {
shopCarGoods = null;
singleNum = 0;
setState(() {});
}
}
///
_queryMiNiDetail(String id, int count) async {
EasyLoading.show(
status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black);
//线
// EasyLoading.show( status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black);
if (count < 0) {
shopCarGoods.shoppingCartSkuItemList.forEach((element) {
if (element.productId == id) {
@ -367,8 +404,10 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
BaseData<MiNiDetail> baseData = await minService.miNiDetail(id);
if (baseData != null && baseData.isSuccess) {
showStoreSelector(baseData.data, id, count);
}else{
SmartDialog.showToast(baseData.msg);
}
EasyLoading.dismiss();
// EasyLoading.dismiss();
}
///
@ -376,9 +415,11 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
if (miNiDetail.attrList != null &&
miNiDetail.attrList.length == 1 &&
miNiDetail.attrList[0].attrValueList.length == 1) {
_addShopCar(miNiDetail, [], counts);
_addShopCar(miNiDetail, [], count);
} else {
// showSpanDialog();
setState(() {
buildCount();
});
selectSpecsShowBottomSheet();
}
}
@ -443,8 +484,13 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
setState(() {});
});
} else {
SmartDialog.showToast(baseDate?.msg, alignment: Alignment.center);
}
SmartDialog.show(
widget: SettlementTips(
() {},
text: "${baseDate.msg.replaceAll("~", ",") + "请重新加购商品"}",
),
);
}
}
}
@ -475,6 +521,17 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
}
});
}
baseDate.data[0].shoppingCartSkuItemList.forEach((element) {
if((goodsSkuId == element.id)){
singleNum = element.buyNum;
}else{
if(id == element.productId){
singleNum = element.buyNum;
}else{
singleNum = 0;
}
}
});
return baseDate.data[0];
} else {
return null;
@ -501,9 +558,9 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
///1
Future<ShoppingCart> shopCartReduce(
ShoppingCartSkuItemListBean cartSkuItem) async {
ShoppingCartSkuItemListBean cartSkuItem,{int count = 1}) async {
Map<String, dynamic> shopCarTemp = shopCarGoods.toJson();
cartSkuItem.buyNum -= 1;
cartSkuItem.buyNum -= (count>0) ? ((cartSkuItem.minQty>1 && cartSkuItem.buyNum == cartSkuItem.minQty) ? cartSkuItem.minQty: count) : -count;
shopCarTemp["shoppingCartSkuItemList"] = [cartSkuItem.toJson()];
BaseData<List<ShoppingCart>> baseDate =
await minService.shoppingCartSingle(shopCarTemp);
@ -578,7 +635,7 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
if (shopSkuItem != null) {
if (shopSkuItem.buyNum > 1) {
shopCarGoods.shoppingCartSkuItemList[shopSkuIndex].buyNum -= 1;
shopCarGoods.shoppingCartSkuItemList[shopSkuIndex].buyNum -= (skuMinQty > 1 && skuMinQty ==shopSkuItem.buyNum) ? skuMinQty:1;
}
} else {
await _addShopCar(miNiDetail, selectSkus, 2);
@ -626,6 +683,7 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
if (productSku == null) return;
selectedPrice = productSku.skuPrice;
String skuId = productSku.id;
skuMinQty = productSku.minQty;
if (shopCarGoods == null || shopCarGoods.shoppingCartSkuItemList == null)
return;
int shopSkuIndex = shopCarGoods.shoppingCartSkuItemList
@ -795,9 +853,10 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
},
child: Image.asset(
"assets/image/shopping_bag.webp",
width: 66,
height: 66,
width: 57.w,
height: 57.w,
fit: BoxFit.fitWidth,
key: _key,
),
),
if (count() != 0)
@ -848,8 +907,7 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
SizedBox(
width: 2.w,
),
Expanded(
child: Text(
Text(
miNiDetail?.applyPrice ?? "",
style: TextStyle(
fontSize: 16.sp,
@ -858,66 +916,115 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
fontWeight: MyFontWeight.regular,
color: Color(0xFFA29E9E),
),
)),
GestureDetector(
onTap: () async {
if (storeInfo.posType.code == "NORMALSTORE" &&
tableId == 0) {
showDeleteDialog();
} else if (isSetMeal == true) {
await Navigator.of(context)
.pushNamed('/router/product_meals_sku', arguments: {
"id": id,
"storeId": storeId,
"tableId": tableId
});
queryShopCar().then((value) {
this.shopCarGoods = value;
setState(() {});
});
} else {
_queryMiNiDetail(id, counts);
}
},
child: Container(
width: 92.w,
height: 32.h,
),
if((widget?.arguments["minQty"] ?? 0).toInt() > 1)
Container(
height: 20.h,
padding: EdgeInsets.symmetric(horizontal:6.w),
margin: EdgeInsets.only(left: 16.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
color: Color(0xFF32A060),
borderRadius:
BorderRadius.circular(2),
border: Border.all(
width: 1,
color: Color(0xFFF65720),
style: BorderStyle.solid,
),
),
margin: EdgeInsets.only(bottom: 8),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Image.asset(
"assets/image/goods_shopp.webp",
fit: BoxFit.fill,
width: 18,
height: 18,
),
SizedBox(
width: 2,
),
Text(
((miNiDetail?.subscribeParam?.isEnableSubscribe ??
false) ==
true)
? S.of(context).lijiyuyue
: (isSetMeal ?? false) == true
? "选套餐"
: "加入购物车",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFFFFFFFF),
),
),
],
alignment: Alignment.center,
child: Text(
"${widget?.arguments["minQty"] ?? 0 ?? "0"}份起购",
style: TextStyle(
color: Color(0xFFF65720),
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
),
),
),
)
Spacer(),
Builder(
builder: (context) {
return GestureDetector(
onTap: () async {
if (storeInfo.posType.code == "NORMALSTORE" &&
tableId == 0) {
showDeleteDialog();
} else if (_jumpType == 1) {
await Navigator.of(context).pushNamed(
'/router/product_meals_sku',
arguments: {
"id": id,
"storeId": storeId,
"tableId": tableId
});
queryShopCar().then((value) {
this.shopCarGoods = value;
setState(() {});
});
} else {
if (miNiDetail.attrList != null &&
miNiDetail.attrList.length == 1 &&
miNiDetail.attrList[0].attrValueList.length == 1){
/// widget overlayEntry
var _overlayEntry = OverlayEntry(builder: (_) {
RenderBox box = context.findRenderObject();
var offset = box.localToGlobal(Offset.zero);
return RedDotPage(
startPosition: offset,
endPosition: _endOffset,
);
});
// Overlay
Overlay.of(context).insert(_overlayEntry);
//
Future.delayed(Duration(milliseconds: 800), () {
_overlayEntry.remove();
_overlayEntry = null;
});
}
_queryMiNiDetail(id,(skuMinQty > 1 ? counts : ((widget.arguments["minQty"]??0) > 1 && singleNum==0)
? (widget.arguments["minQty"]??0):counts));
}
},
child: Container(
width: 92.w,
height: 32.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
color: Color(0xFF32A060),
),
margin: EdgeInsets.only(bottom: 8),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Image.asset(
"assets/image/goods_shopp.webp",
fit: BoxFit.fill,
width: 18,
height: 18,
),
SizedBox(
width: 2,
),
Text(
((miNiDetail?.subscribeParam?.isEnableSubscribe ??
false) ==
true)
? S.of(context).lijiyuyue
: (isSetMeal ?? false) == true
? "选套餐"
: "加入购物车",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFFFFFFFF),
),
),
],
),
),
);},)
],
),
)
@ -968,8 +1075,7 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
SizedBox(
width: 2.w,
),
Expanded(
child: Text(
Text(
miNiDetail?.applyPrice ?? "",
style: TextStyle(
fontSize: 16.sp,
@ -978,67 +1084,114 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
fontWeight: MyFontWeight.regular,
color: Color(0xFFA29E9E),
),
)),
GestureDetector(
onTap: () async {
if (storeInfo.posType.code == "NORMALSTORE" &&
tableId == 0) {
showDeleteDialog();
} else if (isSetMeal == true) {
await Navigator.of(context).pushNamed(
'/router/product_meals_sku',
arguments: {
"id": id,
"storeId": storeId,
"tableId": tableId
});
queryShopCar().then((value) {
this.shopCarGoods = value;
setState(() {});
});
} else {
_queryMiNiDetail(id, counts);
}
},
child: Container(
width: 92.w,
height: 32.h,
),
if((widget?.arguments["minQty"] ?? 0).toInt() > 1)
Container(
padding: EdgeInsets.symmetric(horizontal:6.w,vertical: 2.h),
margin: EdgeInsets.only(left: 16.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
color: Color(0xFF32A060),
borderRadius:
BorderRadius.circular(2),
border: Border.all(
width: 1,
color: Color(0xFFF65720),
style: BorderStyle.solid,
),
),
margin: EdgeInsets.only(bottom: 8),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Image.asset(
"assets/image/goods_shopp.webp",
fit: BoxFit.fill,
width: 18,
height: 18,
),
SizedBox(
width: 2,
alignment: Alignment.center,
child: Text(
"${widget?.arguments["minQty"] ?? 0}份起购",
style: TextStyle(
color: Color(0xFFF65720),
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
),
),
),
Spacer(),
Builder(
builder: (context) {
return GestureDetector(
onTap: () async {
if (storeInfo.posType.code == "NORMALSTORE" &&
tableId == 0) {
showDeleteDialog();
} else if (_jumpType == 1) {
await Navigator.of(context).pushNamed(
'/router/product_meals_sku',
arguments: {
"id": id,
"storeId": storeId,
"tableId": tableId
});
queryShopCar().then((value) {
this.shopCarGoods = value;
setState(() {});
});
} else {
if (miNiDetail.attrList != null &&
miNiDetail.attrList.length == 1 &&
miNiDetail.attrList[0].attrValueList.length == 1){
/// widget overlayEntry
var _overlayEntry = OverlayEntry(builder: (_) {
RenderBox box = context.findRenderObject();
var offset = box.localToGlobal(Offset.zero);
return RedDotPage(
startPosition: offset,
endPosition: _endOffset,
);
});
// Overlay
Overlay.of(context).insert(_overlayEntry);
//
Future.delayed(Duration(milliseconds: 800), () {
_overlayEntry.remove();
_overlayEntry = null;
});
}
_queryMiNiDetail(id,(skuMinQty > 1 ? counts : ((widget.arguments["minQty"]??0) > 1 && singleNum==0)
? (widget.arguments["minQty"]??0):counts));
}
},
child: Container(
width: 92.w,
height: 32.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
color: Color(0xFF32A060),
),
Text(
((miNiDetail?.subscribeParam?.isEnableSubscribe ??
false) ==
margin: EdgeInsets.only(bottom: 8),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Image.asset(
"assets/image/goods_shopp.webp",
fit: BoxFit.fill,
width: 18,
height: 18,
),
SizedBox(
width: 2,
),
Text(
((miNiDetail?.subscribeParam?.isEnableSubscribe ??
false) ==
true)
? S.of(context).lijiyuyue
: (isSetMeal ?? false) == true
? S.of(context).lijiyuyue
: (isSetMeal ?? false) == true
? "选套餐"
: "加入购物车",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFFFFFFFF),
),
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFFFFFFFF),
),
),
],
),
],
),
),
)
),
);},),
],
),
Text(
@ -1191,6 +1344,31 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
),
],
),
if(skuMinQty > 1)
Row(children: [
Container(
padding: EdgeInsets.symmetric(horizontal:4.w),
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(2),
border: Border.all(
width: 1,
color: Color(0xFFF65720),
style: BorderStyle.solid,
),
),
alignment: Alignment.center,
child: Text(
"${skuMinQty}份起购",
style: TextStyle(
color: Color(0xFFF65720),
fontSize: 10.sp,
fontWeight: MyFontWeight.regular,
),
),
),
Spacer()
]),
Text(
"${miNiDetail?.price ?? ""}",
style: TextStyle(
@ -1237,7 +1415,7 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
// mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
S.of(context).shuliang,
@ -1247,28 +1425,59 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
fontWeight: MyFontWeight.regular,
),
),
SizedBox(
height: 10,
),
if(skuMinQty > 1 && (counts ==1 || counts ==0))
Row(
children: [
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () async {
state(() {
isCounts = true;
counts += skuMinQty-1;
_addShopCar(miNiDetail, selectSkus, counts);
});
},
child:Container(
margin: EdgeInsets.only(right: 8.w, top: 14.h,bottom: 24.h),
child: RoundButton(
text:"${skuMinQty}份起购",
textColor: Colors.white,
fontWeight: MyFontWeight.medium,
radius: 3,
backgroup: Color(0xFF32A060),
fontSize: 11.sp,
padding: EdgeInsets.symmetric(
vertical: 5.h, horizontal: 3.w),
),
)),
Spacer()
],
),
if((skuMinQty > 1 && counts !=1) || skuMinQty == 0 || skuMinQty == 1)
Row(
children: [
InkWell(
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
state(() {
if (counts > 1)
setState(() {
counts -= 1;
counts -= (skuMinQty > 1 && skuMinQty == counts) ? (skuMinQty - 1) : 1;
});
// reduce(miNiDetail, selectSkus);
isCounts = true;
reduce(miNiDetail, selectSkus);
});
},
child: Icon(
child: Container(
padding:EdgeInsets.only(right:8.w,top: 10.h,bottom: 24.h),
child: Icon(
Icons.remove,
color: Color(0xFF32A060),
size: 24,
)),
))),
Padding(
padding: EdgeInsets.only(left: 8, right: 8),
padding: EdgeInsets.only(right: 8.w,bottom: 14.h),
child: Text(
"$counts",
style: TextStyle(
@ -1278,25 +1487,27 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
),
),
),
InkWell(
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
state(() {
counts += 1;
// add(miNiDetail, selectSkus);
isCounts = true;
add(miNiDetail, selectSkus);
});
},
child: Icon(
Icons.add,
color: Color(0xFF32A060),
size: 24,
child: Container(
padding:EdgeInsets.only(right:20.w,top: 10.h,bottom: 24.h),
child: Icon(
Icons.add,
color: Color(0xFF32A060),
size: 24,
),
)),
],
)
],
),
SizedBox(
height: 24,
),
RoundButton(
width: double.infinity,
height: 54.h,
@ -1308,12 +1519,24 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
textColor: Colors.white,
fontWeight: MyFontWeight.semi_bold,
radius: 27,
backgroup: Color(0xFF32A060),
backgroup:Color(0xFF32A060),
fontSize: 16.sp,
callback: () {
state(() {
_addShopCar(miNiDetail, selectSkus, counts);
counts = 1;
if(skuMinQty > 1 && counts == 1){
SmartDialog.show(
widget: SettlementTips(
() {},
text: "请选择购买数量",
),
);
return;
}
if(!isCounts || counts == 1){
_addShopCar(miNiDetail, selectSkus,1);
counts = 1;
isCounts = false;
}
Navigator.of(context).pop();
});
},

91
lib/store/store_order.dart

@ -18,6 +18,7 @@ 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/product_sku.dart';
import 'package:huixiang/store/store_view/red_dot_page.dart';
import 'package:huixiang/store/store_view/shop_car.dart';
import 'package:huixiang/store/store_view/store_info.dart';
import 'package:huixiang/store/store_view/store_order_list.dart';
@ -32,6 +33,7 @@ import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:shared_preferences/shared_preferences.dart';
import '../retrofit/data/settleOrderInfo.dart';
import '../view_widget/settlement_tips_dialog.dart';
class StoreOrderPage extends StatefulWidget {
final Map<String, dynamic> arguments;
@ -73,6 +75,10 @@ class _StoreOrderPage extends State<StoreOrderPage>
String cName;
String cid;
GlobalKey _key = GlobalKey();
Offset _endOffset;
double rightOffset = 23.0;
@override
void initState() {
super.initState();
@ -80,6 +86,12 @@ class _StoreOrderPage extends State<StoreOrderPage>
tableId = widget.arguments["tableId"] ?? 0;
tenant = widget.arguments["tenant"];
storeId = widget.arguments["id"];
WidgetsBinding.instance.addPostFrameCallback((c) {
//
_endOffset = (_key.currentContext.findRenderObject() as RenderBox)
.localToGlobal(Offset.zero)+
Offset(rightOffset, 0.0);
});
debugPrint(
"store_param tableId:$tableId tenant:$tenant storeId:$storeId");
@ -457,6 +469,7 @@ class _StoreOrderPage extends State<StoreOrderPage>
minToken,
tenant,
tableId,
_endOffset,
_queryMiNiDetail, () {
queryShopCar().then((value) {
this.shopCarGoods = value;
@ -562,21 +575,21 @@ class _StoreOrderPage extends State<StoreOrderPage>
),
),
Stack(
children: [
children: <Widget>[
InkWell(
onTap: () {
if (count() != 0) showShoppingCart();
},
child: Image.asset(
"assets/image/shopping_bag.webp",
width: 66,
height: 66,
width: 57.w,
height: 57.h,
fit: BoxFit.fitWidth,
),
),
if (count() != 0)
Positioned(
right: 5,
right: 0,
// top: 14,
child: RoundButton(
width: 17.w,
@ -590,6 +603,7 @@ class _StoreOrderPage extends State<StoreOrderPage>
),
),
],
key: _key,
),
],
),
@ -744,25 +758,42 @@ class _StoreOrderPage extends State<StoreOrderPage>
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,
);
//使showModalBottomSheet加载弹窗才有效
showModalBottomSheet(
backgroundColor: Colors.transparent,
context: context,
//
// isDismissible: true,
builder: (_) {
return ShopCar(
shopCartKey,
this.shopCarGoods,
clearShopCar,
toDownOrder,
shopCartAdd,
shopCartReduce,
);
});
// SmartDialog.show(
// widget: ShopCar(
// shopCartKey,
// this.shopCarGoods,
// clearShopCar,
// toDownOrder,
// shopCartAdd,
// shopCartReduce,
// ),
// onDismiss: () {
// dialogShowing = false;
// },
// alignmentTemp: Alignment.bottomCenter,
// );
});
}
///
clearShopCar() async {
// EasyLoading.show(status: S.current.zhengzaijiazai);
BaseData<bool> baseData = await minService.clearShoppingCart(storeId);
if (baseData.isSuccess) {
shopCarGoods = null;
@ -772,19 +803,19 @@ class _StoreOrderPage extends State<StoreOrderPage>
///
_queryMiNiDetail(String id, int count) async {
EasyLoading.show(
status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black);
//线
// EasyLoading.show(status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black);
if (count < 0) {
shopCarGoods.shoppingCartSkuItemList.forEach((element) async {
if (element.productId == id) {
await shopCartReduce(element);
await shopCartReduce(element,count: count);
setState(() {});
}
});
return;
}
BaseData<MiNiDetail> baseData = await minService.miNiDetail(id);
EasyLoading.dismiss();
// EasyLoading.dismiss();
if (baseData != null && baseData.isSuccess) {
miNiDetail = baseData.data;
showStoreSelector(baseData.data, id, count);
@ -873,7 +904,12 @@ class _StoreOrderPage extends State<StoreOrderPage>
toDownOrder();
setState(() {});
} else {
SmartDialog.showToast(baseDate?.msg, alignment: Alignment.center);
SmartDialog.show(
widget: SettlementTips(
() {},
text: "${baseDate.msg.replaceAll("~", ",") + "请重新加购商品"}",
),
);
}
}
}
@ -947,9 +983,9 @@ class _StoreOrderPage extends State<StoreOrderPage>
///1
Future<ShoppingCart> shopCartReduce(
ShoppingCartSkuItemListBean cartSkuItem) async {
ShoppingCartSkuItemListBean cartSkuItem,{int count = 1}) async {
Map<String, dynamic> shopCarTemp = shopCarGoods.toJson();
cartSkuItem.buyNum -= 1;
cartSkuItem.buyNum -= (count>0) ? ((cartSkuItem.minQty>1 && cartSkuItem.buyNum == cartSkuItem.minQty) ? cartSkuItem.minQty: count) : -count;
shopCarTemp["shoppingCartSkuItemList"] = [cartSkuItem.toJson()];
BaseData<List<ShoppingCart>> baseDate =
await minService.shoppingCartSingle(shopCarTemp);
@ -1004,10 +1040,13 @@ class _StoreOrderPage extends State<StoreOrderPage>
}
}
int countMinQty = 1;
///1
reduce(MiNiDetail miNiDetail, selectSkus) async {
ProductSkuVOListBean productSku =
miNiDetail.productSkuVOList.firstWhere((element) {
countMinQty = element.minQty;
return skuY(element, selectSkus);
});
@ -1025,7 +1064,7 @@ class _StoreOrderPage extends State<StoreOrderPage>
if (shopSkuItem != null) {
if (shopSkuItem.buyNum > 1) {
shopCarGoods.shoppingCartSkuItemList[shopSkuIndex].buyNum -= 1;
shopCarGoods.shoppingCartSkuItemList[shopSkuIndex].buyNum -= (countMinQty > 1 && countMinQty ==shopSkuItem.buyNum) ? countMinQty:1;
}
} else {
await _addShopCar(miNiDetail, selectSkus, 1);

1377
lib/store/store_view/product_meals_sku.dart

File diff suppressed because it is too large Load Diff

377
lib/store/store_view/product_sku.dart

@ -9,6 +9,8 @@ import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/custom_image.dart';
import 'package:huixiang/view_widget/round_button.dart';
import '../../view_widget/settlement_tips_dialog.dart';
class ProductSku extends StatefulWidget {
final MiNiDetail miNiDetail;
final String productId;
@ -31,43 +33,56 @@ class ProductSku extends StatefulWidget {
class _ProductSku extends State<ProductSku> {
List<String> selectSkus = [];
int count = 1, realCount = 0;
String selectedPrice = "";
bool _isTapEd = false;
int _currentSkuIndex;
@override
void initState() {
super.initState();
if (widget.shopCarGoods != null && widget.shopCarGoods.shoppingCartSkuItemList != null) {
widget.shopCarGoods.shoppingCartSkuItemList.forEach((e1) {
if (widget.miNiDetail != null && widget.miNiDetail.productSkuVOList != null && widget.miNiDetail.productSkuVOList.isNotEmpty) {
try {
widget.miNiDetail.productSkuVOList.firstWhere((e2) => e1.id == e2.id).count = e1.buyNum;
} catch (e) {
return;
}
}
});
}
widget.miNiDetail.attrList.forEach((element) {
selectSkus.add(element.attrValueList[0].attrValue);
});
buildCount();
_currentSkuIndex = widget.miNiDetail.productSkuVOList.indexWhere((element) {
return skuY(element, selectSkus);
});
}
buildCount() {
count = 1;
ProductSkuVOListBean productSku;
try {
productSku = widget.miNiDetail.productSkuVOList.firstWhere((element) {
return skuY(element, selectSkus);
});
} catch (ex) {
return;
}
if (productSku == null) return;
selectedPrice = productSku.vipPrice ?? productSku.skuPrice ?? "";
String skuId = productSku.id;
if (widget.shopCarGoods == null ||
widget.shopCarGoods.shoppingCartSkuItemList == null) return;
int shopSkuIndex = widget.shopCarGoods.shoppingCartSkuItemList
.indexWhere((element) => skuId == element.id);
if (shopSkuIndex >= 0) {
count = widget.shopCarGoods.shoppingCartSkuItemList[shopSkuIndex].buyNum;
realCount = count;
}
}
// buildCount() {
// count = 1;
// ProductSkuVOListBean productSku;
// try {
// productSku = widget.miNiDetail.productSkuVOList.firstWhere((element) {
// return skuY(element, selectSkus);
// });
// } catch (ex) {
// return;
// }
// if (productSku == null) return;
// selectedPrice = productSku.vipPrice ?? productSku.skuPrice ?? "";
// String skuId = productSku.id;
// widget.miNiDetail.productSkuVOList[_currentSkuIndex].minQty = productSku.minQty;
// if (widget.shopCarGoods == null ||
// widget.shopCarGoods.shoppingCartSkuItemList == null) return;
// int shopSkuIndex = widget.shopCarGoods.shoppingCartSkuItemList
// .indexWhere((element) => skuId == element.id);
// if (shopSkuIndex >= 0) {
// count = widget.shopCarGoods.shoppingCartSkuItemList[shopSkuIndex].buyNum;
// realCount = count;
// }
// }
bool skuY(ProductSkuVOListBean productSku, selectSkus) {
bool gg = true;
@ -140,11 +155,7 @@ class _ProductSku extends State<ProductSku> {
Padding(
padding: EdgeInsets.only(top: 4, bottom: 7),
child: Text(
"已选: " +
(selectSkus
.map((e) => "$e")
.toList()
.toString()),
"已选: " + selectSkus.join(" "),
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
@ -154,6 +165,7 @@ class _ProductSku extends State<ProductSku> {
),
),
),
///
// Row(
// children: [
@ -175,6 +187,34 @@ class _ProductSku extends State<ProductSku> {
// ),
// ],
// ),
Row(
children: [
if (widget.miNiDetail
.productSkuVOList[_currentSkuIndex].minQty >
1)
Container(
padding: EdgeInsets.symmetric(horizontal: 4.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(2),
border: Border.all(
width: 1,
color: Color(0xFFF65720),
style: BorderStyle.solid,
),
),
alignment: Alignment.center,
child: Text(
"${widget.miNiDetail.productSkuVOList[_currentSkuIndex].minQty}份起购",
style: TextStyle(
color: Color(0xFFF65720),
fontSize: 10.sp,
fontWeight: MyFontWeight.regular,
),
),
),
Spacer()
],
)
],
)),
InkWell(
@ -210,7 +250,11 @@ class _ProductSku extends State<ProductSku> {
(attrValue) {
state(() {
selectSkus[position] = attrValue;
buildCount();
_currentSkuIndex = widget
.miNiDetail.productSkuVOList
.indexWhere((element) {
return skuY(element, selectSkus);
});
});
},
widget.miNiDetail.attrList[position],
@ -237,71 +281,197 @@ class _ProductSku extends State<ProductSku> {
),
),
),
InkWell(
onTap: () async {
if (count == 1) return;
if ((widget?.miNiDetail?.subscribeParam
?.isEnableSubscribe ??
false) ==
false) {
_isTapEd = true;
EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black);
await widget.reduce(widget.miNiDetail, selectSkus);
}
count -= 1;
setState(() {});
EasyLoading.dismiss();
},
child: Image.asset(
"assets/image/reduce.webp",
width: 22,
height: 22,
if (widget.miNiDetail.productSkuVOList[_currentSkuIndex]
.minQty >
1 &&
widget.miNiDetail.productSkuVOList[_currentSkuIndex]
.count ==
1)
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () async {
if ((widget?.miNiDetail?.subscribeParam
?.isEnableSubscribe ??
false) ==
false) {
_isTapEd = true;
EasyLoading.show(
status: S.current.zhengzaijiazai,
maskType: EasyLoadingMaskType.black);
if (widget
.miNiDetail
.productSkuVOList[_currentSkuIndex]
.count ==
1)
await widget.addShopCar(
widget.miNiDetail,
selectSkus,
widget.miNiDetail.productSkuVOList[ _currentSkuIndex].minQty > 1
? widget
.miNiDetail
.productSkuVOList[_currentSkuIndex]
.minQty
: 2);
else
await widget.add(widget.miNiDetail, selectSkus);
}
if ((widget?.miNiDetail?.oversold ?? 0) == 0 &&
widget.miNiDetail.productSkuVOList[_currentSkuIndex] .count >=
(widget?.miNiDetail?.productSkuVOList[0]?.skuStock ?? 0)) {
SmartDialog.showToast("库存不足",
alignment: Alignment.center);
} else {
if (widget.miNiDetail.productSkuVOList[_currentSkuIndex].minQty > 1) {
widget
.miNiDetail
.productSkuVOList[_currentSkuIndex]
.count += widget
.miNiDetail
.productSkuVOList[_currentSkuIndex]
.minQty - 1;
} else {
widget
.miNiDetail
.productSkuVOList[_currentSkuIndex]
.count += 1;
}
}
setState(() {});
EasyLoading.dismiss();
},
child: Container(
margin: EdgeInsets.only(right: 8.w, top: 4.h),
child: RoundButton(
text:
"${widget.miNiDetail.productSkuVOList[_currentSkuIndex].minQty}份起购",
textColor: Colors.white,
fontWeight: MyFontWeight.medium,
radius: 3,
backgroup: Color(0xFF32A060),
fontSize: 11.sp,
padding: EdgeInsets.symmetric(
vertical: 5.h, horizontal: 3.w),
),
)),
if ((widget.miNiDetail.productSkuVOList[_currentSkuIndex]
.minQty >
1 &&
widget.miNiDetail.productSkuVOList[_currentSkuIndex]
.count !=
1) ||
widget.miNiDetail.productSkuVOList[_currentSkuIndex]
.minQty ==
0 ||
widget.miNiDetail.productSkuVOList[_currentSkuIndex]
.minQty ==
1)
InkWell(
onTap: () async {
if (widget.miNiDetail.productSkuVOList[_currentSkuIndex]
.count ==
1) return;
if ((widget?.miNiDetail?.subscribeParam
?.isEnableSubscribe ??
false) ==
false) {
_isTapEd = true;
EasyLoading.show(
status: S.current.zhengzaijiazai,
maskType: EasyLoadingMaskType.black);
await widget.reduce(widget.miNiDetail, selectSkus);
}
if (widget.miNiDetail.productSkuVOList[_currentSkuIndex]
.minQty ==
widget.miNiDetail.productSkuVOList[_currentSkuIndex]
.count) {
widget.miNiDetail.productSkuVOList[_currentSkuIndex]
.count -= (widget.miNiDetail
.productSkuVOList[_currentSkuIndex].minQty);
} else {
widget.miNiDetail.productSkuVOList[_currentSkuIndex]
.count -= 1;
}
setState(() {});
EasyLoading.dismiss();
},
child: Image.asset(
"assets/image/reduce.webp",
width: 22,
height: 22,
),
),
),
Padding(
padding: EdgeInsets.only(left: 8, right: 8),
child: Text(
"$count",
style: TextStyle(
color: Colors.black,
fontSize: 14.sp,
fontWeight: MyFontWeight.medium,
if ((widget.miNiDetail.productSkuVOList[_currentSkuIndex]
.minQty >
1 &&
widget.miNiDetail.productSkuVOList[_currentSkuIndex]
.count !=
1) ||
widget.miNiDetail.productSkuVOList[_currentSkuIndex]
.minQty ==
0 ||
widget.miNiDetail.productSkuVOList[_currentSkuIndex]
.minQty ==
1)
Padding(
padding: EdgeInsets.only(left: 8, right: 8),
child: Text(
"${widget.miNiDetail.productSkuVOList[_currentSkuIndex].count}",
style: TextStyle(
color: Colors.black,
fontSize: 14.sp,
fontWeight: MyFontWeight.medium,
),
),
),
),
InkWell(
onTap: () async {
if ((widget?.miNiDetail?.subscribeParam
?.isEnableSubscribe ??
false) ==
false) {
_isTapEd = true;
EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black);
if (count == 1 && realCount == 0)
await widget.addShopCar(
widget.miNiDetail, selectSkus, 2);
else
await widget.add(widget.miNiDetail, selectSkus);
}
if ((widget?.miNiDetail?.oversold ?? 0) == 0 &&
count >=
(widget?.miNiDetail?.productSkuVOList[0]
?.skuStock ??
0)) {
SmartDialog.showToast("库存不足",
alignment: Alignment.center);
} else {
count += 1;
}
setState(() {});
EasyLoading.dismiss();
},
child: Image.asset(
"assets/image/add.webp",
width: 22,
height: 22,
if ((widget.miNiDetail.productSkuVOList[_currentSkuIndex]
.minQty >
1 &&
widget.miNiDetail.productSkuVOList[_currentSkuIndex]
.count !=
1) ||
widget.miNiDetail.productSkuVOList[_currentSkuIndex]
.minQty ==
0 ||
widget.miNiDetail.productSkuVOList[_currentSkuIndex]
.minQty ==
1)
InkWell(
onTap: () async {
if ((widget?.miNiDetail?.subscribeParam
?.isEnableSubscribe ??
false) ==
false) {
_isTapEd = true;
EasyLoading.show(
status: S.current.zhengzaijiazai,
maskType: EasyLoadingMaskType.black);
if (widget.miNiDetail.productSkuVOList[_currentSkuIndex].count == 1)
await widget.addShopCar(
widget.miNiDetail, selectSkus,2);
else
await widget.add(widget.miNiDetail, selectSkus);
}
if ((widget?.miNiDetail?.oversold ?? 0) == 0 &&
widget.miNiDetail.productSkuVOList[_currentSkuIndex]
.count >=
(widget?.miNiDetail?.productSkuVOList[0]
?.skuStock ??
0)) {
SmartDialog.showToast("库存不足",
alignment: Alignment.center);
} else {
widget.miNiDetail.productSkuVOList[_currentSkuIndex]
.count += 1;
}
setState(() {});
EasyLoading.dismiss();
},
child: Image.asset(
"assets/image/add.webp",
width: 22,
height: 22,
),
),
),
],
),
SizedBox(
@ -320,9 +490,19 @@ class _ProductSku extends State<ProductSku> {
textColor: Colors.white,
fontWeight: MyFontWeight.semi_bold,
radius: 27,
backgroup: Color(0xFF32A060),
backgroup:Color(0xFF32A060),
fontSize: 16.sp,
callback: () {
if(widget.miNiDetail.productSkuVOList[_currentSkuIndex].minQty > 1 && widget.miNiDetail
.productSkuVOList[_currentSkuIndex].count ==1){
SmartDialog.show(
widget: SettlementTips(
() {},
text: "请选择购买数量",
),
);
return;
}
Navigator.of(context).pop();
// SmartDialog.dismiss();
if (!_isTapEd)
@ -334,7 +514,8 @@ class _ProductSku extends State<ProductSku> {
false) ==
false)
? 1
: count);
: widget.miNiDetail
.productSkuVOList[_currentSkuIndex].count);
},
),
if (widget.buttonType == 1)
@ -350,7 +531,11 @@ class _ProductSku extends State<ProductSku> {
callback: () {
Navigator.of(context).pop();
// SmartDialog.dismiss();
widget.addShopCar(widget.miNiDetail, selectSkus, count);
widget.addShopCar(
widget.miNiDetail,
selectSkus,
widget.miNiDetail.productSkuVOList[_currentSkuIndex]
.count);
},
),

83
lib/store/store_view/red_dot_page.dart

@ -0,0 +1,83 @@
import 'dart:math';
import 'package:flutter/material.dart';
class RedDotPage extends StatefulWidget {
final Offset startPosition;
final Offset endPosition;
const RedDotPage({Key key, this.startPosition, this.endPosition})
: super(key: key);
@override
_RedDotPageState createState() => _RedDotPageState();
}
class _RedDotPageState extends State<RedDotPage>
with SingleTickerProviderStateMixin {
AnimationController _controller; // controller
Animation<double> _animation; //
double left; // left
double top; // right
@override
void initState() {
super.initState();
_controller =
AnimationController(duration: Duration(milliseconds: 800), vsync: this);
_animation = Tween(begin: 0.0, end: 1.0).animate(_controller);
// 线
var x0 = widget.startPosition.dx;
var y0 = widget.startPosition.dy;
var x1 = widget.startPosition.dx - 250;
var y1 = widget.startPosition.dy - 100;
var x2 = widget.endPosition.dx;
var y2 = widget.endPosition.dy;
_animation.addListener(() {
// t
var t = _animation.value;
if (mounted)
setState(() {
left = pow(1 - t, 2) * x0 + 2 * t * (1 - t) * x1 + pow(t, 2) * x2;
top = pow(1 - t, 2) * y0 + 2 * t * (1 - t) * y1 + pow(t, 2) * y2;
});
});
//
left = widget.startPosition.dx;
top = widget.startPosition.dy;
//
_controller.forward();
}
@override
Widget build(BuildContext context) {
// Stack -> Positioned
return Stack(
children: <Widget>[
Positioned(
left: left,
top: top,
child: ClipOval(
child: Container(
width: 14,
height: 14,
color: Colors.red,
),
),
)
],
);
}
@override
void dispose() {
_controller.dispose();
super.dispose();
}
}

30
lib/store/store_view/shop_car.dart

@ -1,4 +1,5 @@
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/shoppingCart.dart';
@ -38,8 +39,9 @@ class _ShopCar extends State<ShopCar> {
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: () async {
debugPrint("ssssasdadsasdadasd");
SmartDialog.dismiss();
// debugPrint("ssssasdadsasdadasd");
// SmartDialog.dismiss();
Navigator.of(context).pop();
return true;
},
child: StatefulBuilder(
@ -79,12 +81,15 @@ class _ShopCar extends State<ShopCar> {
),
),
InkWell(
onTap: () {
onTap: () async{
if (widget.shopingCar.shoppingCartSkuItemList != null) {
EasyLoading.show(status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black);
widget.shopingCar.shoppingCartSkuItemList.clear();
}
await widget.clearShopCar();
EasyLoading.dismiss();
Navigator.of(context).pop();
state(() {});
widget.clearShopCar();
},
child: Image.asset(
"assets/image/delete.webp",
@ -117,10 +122,13 @@ class _ShopCar extends State<ShopCar> {
widget.shopingCar =
await widget.shopCartAdd(cart);
setState(() {});
},
},
(ShoppingCartSkuItemListBean cart) async {
widget.shopingCar =
await widget.shopCartReduce(cart);
if(widget.shopingCar?.shoppingCartSkuItemList == null){
Navigator.of(context).pop();
}
setState(() {});
},
isShopCart: true,
@ -175,7 +183,8 @@ class _ShopCar extends State<ShopCar> {
Spacer(),
GestureDetector(
onTap: () {
SmartDialog.dismiss();
// SmartDialog.dismiss();
Navigator.of(context).pop();
widget.toDownOrder();
},
child: RoundButton(
@ -197,13 +206,14 @@ class _ShopCar extends State<ShopCar> {
children: [
InkWell(
onTap: () {
// Navigator.of(context).pop();
SmartDialog.dismiss();
Navigator.of(context).pop();
// SmartDialog.dismiss();
},
child: Image.asset(
"assets/image/shopping_bag.webp",
width: 66,
height: 66,
width: 57.w,
height: 57.h,
fit: BoxFit.fitWidth,
),
),
Positioned(

345
lib/store/store_view/shop_goods.dart

@ -5,6 +5,7 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/findMiNiGroupList.dart';
import 'package:huixiang/retrofit/data/shoppingCart.dart';
import 'package:huixiang/store/store_view/red_dot_page.dart';
import 'package:huixiang/utils/flutter_utils.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -30,6 +31,7 @@ class ShopGoods extends StatefulWidget {
final ShoppingCartSkuItemListBean shoppingCartSkuItemListBean;
final int count;
final int tableId;
final Offset endOffset;
final bool isShopCart;
final StoreInfo storeInfo;
@ -40,6 +42,7 @@ class ShopGoods extends StatefulWidget {
this.count = 0,
this.isShopCart = false,
this.tableId,
this.endOffset,
this.queryShoppingCart,
this.queryMiNiDetail,
this.shoppingCartSkuItemListBean,
@ -114,8 +117,8 @@ class _ShopGoods extends State<ShopGoods> {
: (widget.shoppingCartSkuItemListBean != null
? widget.shoppingCartSkuItemListBean.skuImg
: ""),
width: 70.h,
height: 70.h,
width: 102.h,
height: 102.h,
radius: BorderRadius.circular(4),
fit: BoxFit.cover,
errorSrc: "assets/image/default_1.webp",
@ -127,9 +130,9 @@ class _ShopGoods extends State<ShopGoods> {
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
children:[
Padding(
padding: EdgeInsets.only(right: 16.w),
padding: EdgeInsets.only(right: 16.w,bottom:7.h),
child: Row(
children: [
Expanded(
@ -140,9 +143,9 @@ class _ShopGoods extends State<ShopGoods> {
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: TextStyle(
color: Colors.black,
fontSize: 13.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFF282828),
fontSize: 16.sp,
fontWeight:MyFontWeight.semi_bold,
),
),
),
@ -163,72 +166,140 @@ class _ShopGoods extends State<ShopGoods> {
],
),
),
SizedBox(
height: 2.h,
),
Padding(
padding: EdgeInsets.only(right: 16.w),
child: Row(
children: [
Expanded(
child: Text(
(widget.productListBean != null
? widget.productListBean.shortName
: widget.shoppingCartSkuItemListBean.skuName ??
""),
overflow: TextOverflow.ellipsis,
maxLines: 2,
style: TextStyle(
color: Color(0xFF4C4C4C),
fontSize: 10.sp,
fontWeight: MyFontWeight.regular,
),
padding: EdgeInsets.only(right: 16.w,bottom:7.h),
child:Text(
(widget.productListBean != null
? widget.productListBean.shortName
: widget.shoppingCartSkuItemListBean.skuName ??
""),
overflow: TextOverflow.ellipsis,
maxLines: 2,
style: TextStyle(
color: Color(0xFF4C4C4C),
fontSize: 10.sp,
fontWeight: MyFontWeight.regular,
),
),),
((widget.productListBean?.minQty ?? 0).toInt() > 1)?
Row(
children: [
Container(
padding: EdgeInsets.symmetric(horizontal:4.w),
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(2),
border: Border.all(
width: 1,
color: Color(0xFFF65720),
style: BorderStyle.solid,
),
),
SizedBox(
width: 10.w,
alignment: Alignment.center,
child: Text(
"${widget.productListBean?.minQty ?? 0}份起购",
style: TextStyle(
color: Color(0xFFF65720),
fontSize: 10.sp,
fontWeight: MyFontWeight.regular,
),
),
],
)),
SizedBox(
height: 7.h,
),
),
Spacer(),
],
):SizedBox(height:23.h),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Text(
"¥${AppUtils.calculateDouble(double.tryParse(widget.isShopCart ? widget.shoppingCartSkuItemListBean.skuPrice : widget.productListBean.price) ?? 0)}",
style: TextStyle(
color: Color(0xFFFF4500),
fontSize: 16.sp,
fontFamily: 'JDZhengHT',
Expanded(child:Text(
"¥${AppUtils.calculateDouble(double.tryParse(widget.isShopCart ? widget.shoppingCartSkuItemListBean.skuPrice : widget.productListBean.price) ?? 0)}",
style: TextStyle(
color: Color(0xFFFF4500),
fontSize: 16.sp,
fontFamily: 'JDZhengHT',
fontWeight: MyFontWeight.medium,
),
)),
// SizedBox(
// width:5.w,
// ),
// Container(
// width: 44.w,
// height: 18.h,
// decoration: BoxDecoration(
// color: Color(0xFFFF4500),
// borderRadius: BorderRadius.circular(2),
// ),
// alignment: Alignment.center,
// child: Text(
// "APP专享",
// style: TextStyle(
// color: Color(0xFFFFFFFF),
// fontSize: 10.sp,
// fontWeight: MyFontWeight.medium,
// ),
// ),
// ),
///
if((widget.productListBean?.minQty ?? 0).toInt() > 1 && widget.count == 0 && (widget.productListBean?.attrStyle ?? 0) != 1)
Builder(
builder: (context) {
return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () async {
if (widget.storeInfo.posType.code == "NORMALSTORE" &&
widget.tableId == 0) {
showDeleteDialog();
} else {
/// widget overlayEntry
var _overlayEntry = OverlayEntry(builder: (_) {
RenderBox box = context.findRenderObject();
var offset = box.localToGlobal(Offset.zero);
return RedDotPage(
startPosition: offset,
endPosition: widget.endOffset,
);
});
// Overlay
Overlay.of(context).insert(_overlayEntry);
//
Future.delayed(Duration(milliseconds: 800), () {
_overlayEntry.remove();
_overlayEntry = null;
});
if (_jumpType == -1)
queryMiNiDetail(widget.productListBean.id);
else if (_jumpType == 0)
widget.add(widget.shoppingCartSkuItemListBean);
else if (_jumpType == 1)
await Navigator.of(context).pushNamed(
'/router/product_meals_sku',
arguments: {
"id": widget.productListBean.id,
"storeId": widget.productListBean.storeId,
"tableId": widget.tableId
});
widget.queryShoppingCart();
}
},
child:Container(
padding: EdgeInsets.only(
// left:48.w,
top: 4.h,
bottom: 4.h,
),
margin: EdgeInsets.only(right: 8.w, top: 4.h),
child: RoundButton(
text:"${widget?.productListBean?.minQty ?? 0}份起购",
textColor: Colors.white,
fontWeight: MyFontWeight.medium,
radius: 11,
backgroup: Color(0xFF32A060),
fontSize: 11.sp,
padding: EdgeInsets.symmetric(
vertical:2.h, horizontal:6.w),
),
),
SizedBox(
width: 2.w,
),
// Container(
// width: 44.w,
// height: 18.h,
// decoration: BoxDecoration(
// color: Color(0xFFFF4500),
// borderRadius: BorderRadius.circular(2),
// ),
// alignment: Alignment.center,
// child: Text(
// "APP专享",
// style: TextStyle(
// color: Color(0xFFFFFFFF),
// fontSize: 10.sp,
// fontWeight: MyFontWeight.medium,
// ),
// ),
// ),
],
),
));},),
///
if (!widget.isShopCart &&
(widget.productListBean?.attrStyle ?? 0) == 1 &&
!(widget?.productListBean?.subscribeParam
@ -239,15 +310,15 @@ class _ShopGoods extends State<ShopGoods> {
behavior: HitTestBehavior.opaque,
onTap: () async {
if (widget.storeInfo.posType.code ==
"NORMALSTORE" &&
"NORMALSTORE" &&
widget.tableId == 0) {
showDeleteDialog();
} else {
widget.queryMiNiDetail(
await widget.queryMiNiDetail(
widget.productListBean != null
? widget.productListBean.id
: widget.shoppingCartSkuItemListBean
.productId,
.productId,
0);
}
},
@ -255,7 +326,6 @@ class _ShopGoods extends State<ShopGoods> {
children: [
Container(
padding: EdgeInsets.only(
left: 35.w,
top: 4.h,
bottom: 4.h,
),
@ -264,11 +334,11 @@ class _ShopGoods extends State<ShopGoods> {
text: S.of(context).xuanguige,
textColor: Colors.white,
fontWeight: MyFontWeight.medium,
radius: 3,
radius: 11,
backgroup: Color(0xFF32A060),
fontSize: 11.sp,
padding: EdgeInsets.symmetric(
vertical: 5.h, horizontal: 3.w),
vertical:3.h, horizontal:6.w),
),
),
Positioned(
@ -289,19 +359,14 @@ class _ShopGoods extends State<ShopGoods> {
),
],
)),
///-
if (widget.isShopCart ||
(widget.productListBean?.attrStyle ?? 0) == 0 &&
!(widget?.productListBean?.subscribeParam
?.isEnableSubscribe ??
false) &&
!(widget?.productListBean?.isSetMeal ?? false))
Spacer(),
if (widget.isShopCart ||
(widget.productListBean?.attrStyle ?? 0) == 0 &&
(widget.productListBean?.attrStyle ?? 0) == 0 && (((widget.productListBean?.minQty ?? 0).toInt() > 1 && widget.count != 0)
|| (widget.productListBean?.minQty ?? 0).toInt() == 0) &&
!(widget?.productListBean?.subscribeParam
?.isEnableSubscribe ??
false) &&
!(widget?.productListBean?.isSetMeal ?? false))
!(widget?.productListBean?.isSetMeal ?? false) && widget.count != 0)
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () async {
@ -316,17 +381,19 @@ class _ShopGoods extends State<ShopGoods> {
padding: EdgeInsets.only(left: 15.w, right: 6.w),
child: Image.asset(
"assets/image/reduce.webp",
width: 22,
width: 22.h,
height: 22.h,
),
),
),
///
if (widget.isShopCart ||
(widget.productListBean?.attrStyle ?? 0) == 0 &&
(widget.productListBean?.attrStyle ?? 0) == 0 && (((widget.productListBean?.minQty ?? 0).toInt() > 1 && widget.count != 0)
|| (widget.productListBean?.minQty ?? 0).toInt() == 0) &&
!(widget?.productListBean?.subscribeParam
?.isEnableSubscribe ??
false) &&
!(widget?.productListBean?.isSetMeal ?? false))
!(widget?.productListBean?.isSetMeal ?? false) && widget.count != 0)
Container(
alignment: Alignment.center,
child: Text(
@ -338,51 +405,77 @@ class _ShopGoods extends State<ShopGoods> {
),
),
),
///+
if (widget.isShopCart ||
(widget.productListBean?.attrStyle ?? 0) == 0 &&
(widget.productListBean?.attrStyle ?? 0) == 0 &&(((widget.productListBean?.minQty ?? 0).toInt() > 1 && widget.count != 0)
|| (widget.productListBean?.minQty ?? 0).toInt() == 0) &&
!(widget?.productListBean?.subscribeParam
?.isEnableSubscribe ??
false) &&
!(widget?.productListBean?.isSetMeal ?? false))
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () async {
if (widget.storeInfo.posType.code == "NORMALSTORE" &&
widget.tableId == 0) {
showDeleteDialog();
} else {
// if ((widget?.productListBean?.oversold ?? 0) == 0 &&
// widget.count >=
// (widget?.shoppingCartSkuItemListBean
// ?.skuStock ??
// 0)) {
// SmartDialog.showToast("库存不足",
// alignment: Alignment.center);
// } else
if (_jumpType == -1)
queryMiNiDetail(widget.productListBean.id);
else if (_jumpType == 0)
widget.add(widget.shoppingCartSkuItemListBean);
else if (_jumpType == 1)
await Navigator.of(context).pushNamed(
'/router/product_meals_sku',
arguments: {
"id": widget.productListBean.id,
"storeId": widget.productListBean.storeId,
"tableId": widget.tableId
Builder(
builder: (context) {
return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () async {
if (widget.storeInfo.posType.code == "NORMALSTORE" &&
widget.tableId == 0) {
showDeleteDialog();
} else {
// if ((widget?.productListBean?.oversold ?? 0) == 0 &&
// widget.count >=
// (widget?.shoppingCartSkuItemListBean
// ?.skuStock ??
// 0)) {
// SmartDialog.showToast("库存不足",
// alignment: Alignment.center);
// } else
if(_jumpType != 1){
/// widget overlayEntry
var _overlayEntry = OverlayEntry(builder: (_) {
RenderBox box = context.findRenderObject();
var offset = box.localToGlobal(Offset.zero);
return RedDotPage(
startPosition: offset,
endPosition: widget.endOffset,
);
});
widget.queryShoppingCart();
}
// Overlay
Overlay.of(context).insert(_overlayEntry);
//
Future.delayed(Duration(milliseconds: 800), () {
_overlayEntry.remove();
_overlayEntry = null;
});
}
if (_jumpType == -1)
queryMiNiDetail(widget.productListBean.id);
else if (_jumpType == 0)
widget.add(widget.shoppingCartSkuItemListBean);
else if (_jumpType == 1)
await Navigator.of(context).pushNamed(
'/router/product_meals_sku',
arguments: {
"id": widget.productListBean.id,
"storeId": widget.productListBean.storeId,
"tableId": widget.tableId
});
widget.queryShoppingCart();
}
// Navigator.of(context).pushNamed('/router/goods_list_page');
},
child: Container(
padding: EdgeInsets.only(left: 6.w, right: 5.5.w),
child: Image.asset(
"assets/image/add.webp",
width: 22.h,
height: 22.h,
),
),
);
},
child: Container(
padding: EdgeInsets.only(left: 6.w, right: 9.w),
child: Image.asset(
"assets/image/add.webp",
width: 22,
height: 22.h,
),
),
),
///
if ((widget.productListBean.subscribeParam
.isEnableSubscribe ??
false) ==
@ -408,7 +501,6 @@ class _ShopGoods extends State<ShopGoods> {
},
child: Container(
padding: EdgeInsets.only(
left: 35.w,
top: 4.h,
bottom: 4.h,
),
@ -417,13 +509,14 @@ class _ShopGoods extends State<ShopGoods> {
text: S.of(context).lijiyuyue,
textColor: Colors.white,
fontWeight: MyFontWeight.medium,
radius: 3,
radius: 11,
backgroup: Color(0xFF32A060),
fontSize: 11.sp,
padding: EdgeInsets.symmetric(
vertical: 5.h, horizontal: 3.w),
vertical:3.h, horizontal:6.w),
),
)),
///
if ((widget.productListBean.isSetMeal ?? false) == true)
GestureDetector(
behavior: HitTestBehavior.opaque,
@ -458,7 +551,6 @@ class _ShopGoods extends State<ShopGoods> {
children: [
Container(
padding: EdgeInsets.only(
left: 35.w,
top: 4.h,
bottom: 4.h,
),
@ -467,11 +559,11 @@ class _ShopGoods extends State<ShopGoods> {
text: "选套餐",
textColor: Colors.white,
fontWeight: MyFontWeight.medium,
radius: 3,
radius: 11,
backgroup: Color(0xFF32A060),
fontSize: 11.sp,
padding: EdgeInsets.symmetric(
vertical: 5.h, horizontal: 3.w),
vertical:3.h, horizontal:6.w),
),
),
Positioned(
@ -497,7 +589,6 @@ class _ShopGoods extends State<ShopGoods> {
SizedBox(
height: 4.h,
),
///VIP价格
// if (widget.productListBean.vipPrice != null)
// Row(

125
lib/store/store_view/shop_goods_car.dart

@ -40,10 +40,10 @@ class _ShopGoodsCar extends State<ShopGoodsCar> {
Widget build(BuildContext context) {
return Container(
color: Colors.white,
padding: EdgeInsets.only(
right: 16.w,
// bottom: 20.h,
),
// padding: EdgeInsets.only(
// right: 16.w,
// // bottom: 20.h,
// ),
child: Column(
children: [
Row(
@ -135,12 +135,10 @@ class _ShopGoodsCar extends State<ShopGoodsCar> {
),
],
),
SizedBox(
height: 7.h,
),
Row(
children: [
Row(
Padding(padding:EdgeInsets.only(top: 7.h,bottom: 4.h),
child: Row(
children: [
Text(
"¥${AppUtils.calculateDouble(double.tryParse(widget.isShopCart ? widget.shoppingCartSkuItemListBean.skuPrice : widget.productListBean.price) ?? 0)}",
@ -172,70 +170,76 @@ class _ShopGoodsCar extends State<ShopGoodsCar> {
// ),
// ),
],
),
),),
Spacer(),
if (!widget.isShopCart &&
(widget.productListBean?.attrStyle ?? 0) == 1)
Stack(
children: [
Container(
margin: EdgeInsets.only(right: 8, top: 4),
child: RoundButton(
width: 49.w,
text: S.of(context).xuanguige,
textColor: Colors.white,
fontWeight: MyFontWeight.medium,
radius: 3,
backgroup: Color(0xFF32A060),
fontSize: 11.sp,
padding:
EdgeInsets.symmetric(vertical: 5.h),
callback: () {
widget.queryMiNiDetail(
widget.productListBean != null
? widget.productListBean.id
: widget
.shoppingCartSkuItemListBean
.productId,
0);
},
),
),
Positioned(
right: 0,
child: Visibility(
visible: widget.count > 0,
Container(
padding:EdgeInsets.only(top: 7.h,bottom: 4.h),
child: Stack(
children: [
Container(
margin: EdgeInsets.only(right: 8, top: 4),
child: RoundButton(
width: 17,
height: 17.h,
text: "${widget.count}",
textColor: Color(0xFF32A060),
fontWeight: MyFontWeight.regular,
backgroup: Colors.white,
fontSize: 12.sp,
radius: 100,
width: 49.w,
text: S.of(context).xuanguige,
textColor: Colors.white,
fontWeight: MyFontWeight.medium,
radius: 3,
backgroup: Color(0xFF32A060),
fontSize: 11.sp,
padding:
EdgeInsets.symmetric(vertical: 5.h),
callback: () {
widget.queryMiNiDetail(
widget.productListBean != null
? widget.productListBean.id
: widget
.shoppingCartSkuItemListBean
.productId,
0);
},
),
),
),
],
Positioned(
right: 0,
child: Visibility(
visible: widget.count > 0,
child: RoundButton(
width: 17,
height: 17.h,
text: "${widget.count}",
textColor: Color(0xFF32A060),
fontWeight: MyFontWeight.regular,
backgroup: Colors.white,
fontSize: 12.sp,
radius: 100,
),
),
),
],
),
),
if (widget.isShopCart ||
(widget.productListBean?.attrStyle ?? 0) == 0)
InkWell(
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
widget
.reduce(widget.shoppingCartSkuItemListBean);
widget.reduce(widget.shoppingCartSkuItemListBean);
},
child: Image.asset(
child: Container(
padding: EdgeInsets.only(top: 7.h,bottom: 4.h,left:20.w),
child: Image.asset(
"assets/image/reduce.webp",
width: 22,
height: 22.h,
),
)),
),
if (widget.isShopCart ||
(widget.productListBean?.attrStyle ?? 0) == 0)
Container(
width: 30,
padding: EdgeInsets.only(top: 7.h,bottom: 4.h),
alignment: Alignment.center,
child: Text(
"${widget.count}",
@ -249,20 +253,21 @@ class _ShopGoodsCar extends State<ShopGoodsCar> {
if (widget.isShopCart ||
(widget.productListBean?.attrStyle ?? 0) == 0)
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
widget.add(widget.shoppingCartSkuItemListBean);
},
child: Image.asset(
"assets/image/add.webp",
width: 22,
height: 22.h,
child: Container(
padding: EdgeInsets.only(right: 16.w,top: 7.h,bottom: 4.h),
child: Image.asset(
"assets/image/add.webp",
width: 22,
height: 22.h,
),
),
),
],
),
SizedBox(
height: 4.h,
),
Text(
"${AppUtils.calculateDouble(double.tryParse(widget.isShopCart ? widget.shoppingCartSkuItemListBean.skuPrice : widget.productListBean.applyPrice) ?? 0)}",
style: TextStyle(

9
lib/store/store_view/store_order_list.dart

@ -27,6 +27,7 @@ class StoreOrderListPage extends StatefulWidget {
final String minToken;
final String tenant;
final int tableId;
final Offset _endOffset;
final Function(String id, int count) queryMiNiDetail;
final Function queryShoppingCart;
final ScrollPhysics scrollPhysics;
@ -42,6 +43,7 @@ class StoreOrderListPage extends StatefulWidget {
this.minToken,
this.tenant,
this.tableId,
this._endOffset,
this.queryMiNiDetail,
this.queryShoppingCart,
this.scrollPhysics);
@ -211,7 +213,7 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
.pushNamed('/router/shop_details_page', arguments: {
"id": e.id,
"storeId": e.storeId,
"isSetMeal":e.isSetMeal
"minQty":e.minQty,
});
widget.queryShoppingCart();
}
@ -367,15 +369,16 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
}
return ShopGoods(
(ShoppingCartSkuItemListBean shoppingCartSkuItemListBean) {
widget.queryMiNiDetail(e.id, 1);
widget.queryMiNiDetail(e.id, ((e.minQty?? 0).toInt()>1 && count == 0)? (e.minQty??0):1);
},
(ShoppingCartSkuItemListBean shoppingCartSkuItemListBean) {
if (count > 0) widget.queryMiNiDetail(e.id, -1);
if (count > 0) widget.queryMiNiDetail(e.id, ((e.minQty?? 0).toInt()>1 && count==(e.minQty??0) )? -(e.minQty??0):-1);
},
productListBean: e,
count: count,
isShopCart: false,
tableId: widget.tableId,
endOffset: widget._endOffset,
queryShoppingCart: widget.queryShoppingCart,
queryMiNiDetail: widget.queryMiNiDetail,
shoppingCartSkuItemListBean: shoppingCartSkuItemListBean,

450
lib/union/union_list.dart

@ -107,10 +107,7 @@ class _UnionList extends State<UnionList> with AutomaticKeepAliveClientMixin {
physics: BouncingScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {},
child: buildStoreItemSm(),
);
return buildStoreItemSm();
},
):((storeList == null || storeList.length == 0)
? NoDataView(
@ -128,7 +125,8 @@ class _UnionList extends State<UnionList> with AutomaticKeepAliveClientMixin {
bottom: 100.h,
),
itemBuilder: (context, position) {
return InkWell(
return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
{
// if (storeList[position].storeName == "一心回乡商城") {
@ -228,8 +226,8 @@ class _UnionList extends State<UnionList> with AutomaticKeepAliveClientMixin {
Widget buildStoreItem(Store store, position) {
return Container(
margin: EdgeInsets.fromLTRB(16.w, 8.h, 16.w, 12.h),
padding: EdgeInsets.symmetric(horizontal:12.w,vertical: 12.h),
margin: EdgeInsets.fromLTRB(14.w, 16.h, 14.w, 12.h),
padding: EdgeInsets.symmetric(vertical: 12.h,horizontal: 12.w),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(6)),
@ -242,128 +240,149 @@ class _UnionList extends State<UnionList> with AutomaticKeepAliveClientMixin {
)
]),
width: double.infinity,
child: Row(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Stack(
children: [
MImage(
store.facade,
width: 74.h,
height: 74.h,
fit: BoxFit.cover,
radius: BorderRadius.circular(6),
errorSrc: "assets/image/default_1.webp",
fadeSrc: "assets/image/default_1.webp",
),
Container(
decoration: BoxDecoration(
color: Color(0xFF32A060),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(6),
bottomRight: Radius.circular(6),
topRight: Radius.circular(2),
bottomLeft: Radius.circular(2)),
),
padding: EdgeInsets.symmetric(horizontal: 3.w, vertical: 2.h),
child: Text(
"品牌",
style: TextStyle(
color: Colors.white,
fontSize: 10.sp,
fontWeight: MyFontWeight.regular,
),
),
)
],
),
SizedBox(
width: 12.w,
),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
store?.storeName ?? "",
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Color(0xFF0D0D0D),
fontSize: 14.sp,
fontWeight: MyFontWeight.bold,
),
),
SizedBox(height: 6.h),
Row(
Stack(
children: [
if(store.perCapitaConsumption != null && (store?.perCapitaConsumption ?? "0") != "0")
Padding(padding: EdgeInsets.only(right: 22.w),child:Text(
S.of(context).ren(
store?.perCapitaConsumption ?? "",
),
style: TextStyle(
color: Color(0xFF4D4D4D),
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
),
),),
if (store.distance != null)
Image.asset(
"assets/image/icon_union_location_black.webp",
fit: BoxFit.fill,
height: 12,
width: 12,
MImage(
store.facade,
width: 74.h,
height: 74.h,
fit: BoxFit.cover,
radius: BorderRadius.circular(6),
errorSrc: "assets/image/default_1.webp",
fadeSrc: "assets/image/default_1.webp",
),
SizedBox(width: 4.w),
if (store.distance != null)
Text(
(store.distance ?? 0) > 1000
? S.of(context).gongli(
((store.distance ?? 0) / 1000 * 100).toInt() /
100.0)
: S
.of(context)
.mi(((store.distance ?? 0) * 100).toInt() / 100.0),
style: TextStyle(
color: Color(0xFF4D4D4D),
fontSize: 12.sp,
Container(
decoration: BoxDecoration(
color: Color(0xFF32A060),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(6),
bottomRight: Radius.circular(6),
topRight: Radius.circular(2),
bottomLeft: Radius.circular(2)),
),
),
padding: EdgeInsets.symmetric(horizontal: 3.w, vertical: 2.h),
child: Text(
"品牌",
style: TextStyle(
color: Colors.white,
fontSize: 10.sp,
fontWeight: MyFontWeight.regular,
),
),
)
],
),
SizedBox(height: 10.h),
Row(
children: []..addAll(
itemServer(store != null ? store.businessService : "")),
SizedBox(
width: 11.w,
),
if (storeList[position].productShow != null)
SizedBox(height: store.businessService == "" ? 40.h : 23.h),
if (storeList[position].productShow != null)
Container(
height: 100.h,
child: ListView.builder(
padding: EdgeInsets.zero,
itemCount:
(storeList[position].productShow?.length ?? 0) > 3
? 3
: storeList[position].productShow?.length ?? 0,
scrollDirection: Axis.horizontal,
shrinkWrap: true,
physics:BouncingScrollPhysics(),
itemBuilder: (context, index) {
return GestureDetector(
onTap: () {},
child: unionGoodsItem(
storeList[position].productShow[index]),
);
},
),
),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
store?.storeName ?? "",
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Color(0xFF0D0D0D),
fontSize: 14.sp,
fontWeight: MyFontWeight.bold,
),
),
Padding(padding:EdgeInsets.only(left:2.w,top:8.h,bottom:10.h),
child: Row(
children: [
if(store.perCapitaConsumption != null && (store?.perCapitaConsumption ?? "0") != "0")
Padding(padding: EdgeInsets.only(right: 22.w),child:Text(
S.of(context).ren(
store?.perCapitaConsumption ?? "",
),
style: TextStyle(
color: Color(0xFF4D4D4D),
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
),
),),
if (store.distance != null)
Image.asset(
"assets/image/icon_union_location_black.webp",
fit: BoxFit.fill,
height: 12,
width: 12,
),
SizedBox(width: 4.w),
if (store.distance != null)
Text(
(store.distance ?? 0) > 1000
? S.of(context).gongli(
((store.distance ?? 0) / 1000 * 100).toInt() /
100.0)
: S
.of(context)
.mi(((store.distance ?? 0) * 100).toInt() / 100.0),
style: TextStyle(
color: Color(0xFF4D4D4D),
fontSize: 12.sp,
),
),
],
),),
Row(
children: []..addAll(
itemServer(store != null ? store.businessService : "")),
),
if (storeList[position].productShow != null)
SizedBox(height: store.businessService == "" ? 40.h : 23.h),
],
))
],
))
],
),
),
if (storeList[position].productShow != null)
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(child: unionItem(position,0)),
SizedBox(width:16.w),
Expanded(child: unionItem(position,1)),
SizedBox(width:16.w),
Expanded(child: unionItem(position,2)),
],
)
// Container(
// height: 150.h,
// child: ListView.builder(
// padding: EdgeInsets.zero,
// itemCount:
// (storeList[position].productShow?.length ?? 0) > 3
// ? 3
// : storeList[position].productShow?.length ?? 0,
// scrollDirection: Axis.horizontal,
// shrinkWrap: true,
// physics:BouncingScrollPhysics(),
// itemBuilder: (context, index) {
// return GestureDetector(
// onTap: () {Navigator.of(context).pushNamed(
// '/router/store_order',
// arguments: {
// "id": storeList[position].id,
// "tenant": storeList[position].tenantCode,
// "storeName": storeList[position].storeName,
// "distance": storeList[position].distance
// },
// );},
// child: unionGoodsItem(
// storeList[position].productShow[index]),
// );
// },
// ),
// ),
],),
);
}
@ -388,38 +407,177 @@ class _UnionList extends State<UnionList> with AutomaticKeepAliveClientMixin {
))
.toList();
}
Widget unionGoodsItem(ProductShow productShow) {
return Container(
width: 74.h,
margin: EdgeInsets.only(right: 8.w),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
MImage(
productShow?.imgs[0] ?? "",
width: 74.h,
height: 74.h,
fit: BoxFit.cover,
radius: BorderRadius.circular(4),
errorSrc: "assets/image/default_1.webp",
fadeSrc: "assets/image/default_1.webp",
Widget unionItem(int position,int unionIndex) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
MImage(
storeList[position].productShow[unionIndex]?.imgs[0] ?? "",
width:double.infinity,
height:97.w,
fit: BoxFit.cover,
radius: BorderRadius.circular(4),
errorSrc: "assets/image/default_1.webp",
fadeSrc: "assets/image/default_1.webp",
),
Padding(
padding: EdgeInsets.only(top: 8.h,bottom:6.h),
child: Text(
storeList[position].productShow[unionIndex]?.productName ?? "",
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Color(0xFF0D0D0D),
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
),
),
Padding(
padding: EdgeInsets.only(top: 8.h),
child: Text(
productShow?.productName ?? "",
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Color(0xFFA29E9E),
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Padding(padding:EdgeInsets.only(right:2.w),
child: Text.rich(
TextSpan(
children: [
TextSpan(
text: "",
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize:12.sp,
color: Color(0xFFF65720),
),
),
TextSpan(
text:"${(storeList[position].productShow[unionIndex]?.price ?? "").split(".")[0]}",
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 16.sp,
color: Color(0xFFF65720),
),
),
if(storeList[position].productShow[unionIndex].price.contains("."))
TextSpan(
text:".",
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 16.sp,
color: Color(0xFFF65720),
),
),
if(storeList[position].productShow[unionIndex].price.contains("."))
TextSpan(
text:(storeList[position].productShow[unionIndex]?.price ?? "").split(".")[1],
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize:12.sp,
color: Color(0xFFF65720),
),
),
],
),
textDirection: TextDirection.ltr,
),),
Text(
"${storeList[position].productShow[unionIndex]?.applyPrice ?? ""}",
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Color(0xFFA29E9E),
fontSize: 10.sp,
fontWeight: MyFontWeight.regular,
decoration: TextDecoration.lineThrough,
decorationColor: Color(0xFFA29E9E),
),
),
])
],
);
}
Widget unionGoodsItem(ProductShow productShow) {
return Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
MImage(
productShow?.imgs[0] ?? "",
width: 97.h,
height: 97.h,
fit: BoxFit.cover,
radius: BorderRadius.circular(4),
errorSrc: "assets/image/default_1.webp",
fadeSrc: "assets/image/default_1.webp",
),
Padding(
padding: EdgeInsets.only(top: 8.h,bottom:6.h),
child: Text(
productShow?.productName ?? "",
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Color(0xFF0D0D0D),
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
),
),
],
),
),
Expanded(child:Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Padding(padding:EdgeInsets.only(right:2.w),
child: Text.rich(
TextSpan(
children: [
TextSpan(
text: "",
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize:12.sp,
color: Color(0xFFF65720),
),
),
TextSpan(
text:"${(productShow?.price ?? "").split(".")[0]}",
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 16.sp,
color: Color(0xFFF65720),
),
),
if(productShow.price.contains("."))
TextSpan(
text:".",
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 16.sp,
color: Color(0xFFF65720),
),
),
if(productShow.price.contains("."))
TextSpan(
text:(productShow?.price ?? "").split(".")[1],
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize:12.sp,
color: Color(0xFFF65720),
),
),
],
),
textDirection: TextDirection.ltr,
),),
Text(
"${productShow?.applyPrice ?? ""}",
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Color(0xFFA29E9E),
fontSize: 10.sp,
fontWeight: MyFontWeight.regular,
decoration: TextDecoration.lineThrough,
decorationColor: Color(0xFFA29E9E),
),
),
]))
],
);
}

4
lib/view_widget/coupon_details_dialog.dart

@ -41,13 +41,13 @@ class _CouponDetailsWidget extends State<CouponDetailsWidget> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: Container(
alignment: Alignment.center,
margin: EdgeInsets.symmetric(vertical: 12),
margin: EdgeInsets.only(top: 12.h,bottom: 12.h,left:32.w),
child: Text(
S.of(context).shiyongxiangqing,
style: TextStyle(

2
lib/view_widget/my_appbar.dart

@ -93,7 +93,7 @@ class MyAppBar extends StatelessWidget implements PreferredSizeWidget {
},
child: Container(
width: double.infinity,
margin: EdgeInsets.only(right:actions.length == 0 ? 34.w:0),
margin: EdgeInsets.only(right:50.w),
padding: EdgeInsets.all(10),
alignment: Alignment.center,
child: Text(

2
lib/view_widget/recharge_details_dialog.dart

@ -38,7 +38,7 @@ class _RechargeWidget extends State<RechargeWidget> {
children: [
Expanded(child:
Container(
margin: EdgeInsets.symmetric(vertical: 12.h),
margin: EdgeInsets.only(top: 12.h,bottom: 12.h,left: 32.w),
alignment: Alignment.center,
child: Text(
"充值说明",

2
lib/view_widget/selector_store_dialog.dart

@ -56,7 +56,7 @@ class _SelectorStoreWidget extends State<SelectorStoreWidget> {
Expanded(
child: Container(
alignment: Alignment.center,
margin: EdgeInsets.symmetric(vertical: 12),
margin: EdgeInsets.only(top: 12.h,bottom: 12.h,left: 32.w),
child: Text(
S.of(context).qingxuanzeshiyongmendian,
style: TextStyle(

Loading…
Cancel
Save