Browse Source

1.套餐样式更改;

2.购买商品时增加库存判断;(分别更改点单页,详情页,多规格选择弹窗页;)
3.小程序商品分组增加新字段(isSetMeal),用于判断该商品是否是套餐;
4.套餐内容选择ui更改,如果是唯一项选择(比如:1选1,或者3选3这种类型),默认数量为1,减少多于操作;
5.订单结算页增加套餐内容明细显示;
6.发表动态,异步加载样式更改;(异步加载时,如若发表的是图文,加载圈底部则会显示第一张图片共同加载,发表视频则,也显示视频的首图用于底部加载,文字,则会将文字内容用于底部加载);
7.积分兑换板块,增加集换卡兑换,在原有的基础上,增加集换卡兑换(oneBean);
8.积分兑换板块,样式逻辑更改;使用顺序:集换卡-积分-积分+现金-纯现金;
9.创建积分订单接口,原:isPoints废弃;改用:payType,传积分类型(1=积分 2=集卡券 3=人民币混用);
10.应付金额优化,做部分调整;
new_revision_app
wurong 2 years ago
parent
commit
e60ceb5c7f
  1. 2
      lib/community/release_dynamic.dart
  2. 3
      lib/home/points_mall_view/points_goods_view.dart
  3. 20
      lib/integral_store/integral_store_details_page.dart
  4. 264
      lib/main_page.dart
  5. 998
      lib/order/exchange_order_page.dart
  6. 3
      lib/retrofit/data/findMiNiGroupList.dart
  7. 6
      lib/retrofit/data/goods.dart
  8. 2
      lib/retrofit/min_api.dart
  9. 2
      lib/retrofit/min_api.g.dart
  10. 2
      lib/retrofit/retrofit_api.dart
  11. 202
      lib/settlement/settlement_view/settlement_order_commodity.dart
  12. 20
      lib/store/shop_details_page.dart
  13. 13
      lib/store/store_order.dart
  14. 264
      lib/store/store_view/product_meals_sku.dart
  15. 42
      lib/store/store_view/product_sku.dart
  16. 166
      lib/store/store_view/shop_goods.dart
  17. 504
      lib/store/store_view/shop_goods_car.dart
  18. 1
      lib/store/store_view/store_order_list.dart
  19. 58
      lib/utils/upload_async.dart
  20. 2
      pubspec.yaml

2
lib/community/release_dynamic.dart

@ -381,6 +381,8 @@ class _ReleaseDynamic extends State<ReleaseDynamic> {
maxLines: 5,
style: TextStyle(
fontSize: 14.sp,
height: 1.3,
letterSpacing:1,
fontWeight: MyFontWeight.medium,
color: Color(0xFF4C4C4C),
),

3
lib/home/points_mall_view/points_goods_view.dart

@ -22,6 +22,9 @@ class PointGoods extends StatefulWidget {
class _PointGoods extends State<PointGoods> {
String pointPrice(Goods goods) {
if (goods == null) return "";
if (goods?.oneBean != null && goods?.oneBean != "0") {
return "${goods?.oneBean}印章";
}
if (goods?.onePrice != null && goods?.onePrice != "0") {
return S.of(context).jifen_(goods?.onePrice);
} else if ((goods?.onePrice == null || goods?.onePrice == "0") &&

20
lib/integral_store/integral_store_details_page.dart

@ -62,15 +62,18 @@ class _IntegralStoreDetailsPage extends State<IntegralStoreDetailsPage> {
if (baseData != null && baseData.isSuccess) {
setState(() {
goods = baseData.data;
if(goods != null && points != null && double.tryParse(goods.onePrice)
!= 0 && double.tryParse(goods.onePrice) <= double.tryParse(points)){
if(goods != null && points != null && double.tryParse(goods?.oneBean ?? "0")
!= 0 && double.tryParse(goods?.oneBean ?? "0") <= double.tryParse(points)){
payType = 1;
} else if(goods != null && points != null && double.tryParse(goods.onePrice)
!= 0 && double.tryParse(goods.onePrice) <= double.tryParse(points)){
payType = 2;
} else if (goods != null && points != null && double.tryParse(goods.price) != 0 && double.tryParse(goods.price)
<= double.tryParse(points) && double.tryParse(goods.money) != 0.00){
payType = 2;
payType = 3;
} else if (goods != null && points != null
&& double.tryParse(goods.oneMoney) != 0.00){
payType = 3;
payType = 4;
}
refreshController.refreshCompleted();
});
@ -82,7 +85,9 @@ class _IntegralStoreDetailsPage extends State<IntegralStoreDetailsPage> {
String pointPrice(){
if(goods == null)
return "";
if(goods?.onePrice!=null && goods?.onePrice!="0"){
if(goods?.oneBean!=null && goods?.oneBean!="0"){
return "${goods?.oneBean}印章";
}else if(goods?.onePrice!=null && goods?.onePrice!="0"){
return S.of(context).jifen_(goods?.onePrice);
}else if((goods?.onePrice == null || goods?.onePrice == "0") && ((goods?.price != null && goods?.price != "0") || (goods?.money != null && goods?.money != "0.00"))){
return (goods?.price== "0"|| goods?.price == null ? "" : S.of(context).jifen_(goods?.price)) + (goods?.money== "0"|| goods?.money == null ? "" : " + ${AppUtils.calculateDouble(double.tryParse(goods?.money) ?? 0)}");
@ -168,7 +173,7 @@ class _IntegralStoreDetailsPage extends State<IntegralStoreDetailsPage> {
if(payType > 0){
toExchangeOrder();
}else{
SmartDialog.showToast("您的积分不足!", alignment: Alignment.center);
SmartDialog.showToast(pointPrice().contains("印章")?"您的印章数量不足!" : "您的积分不足!", alignment: Alignment.center);
return;
}
},
@ -187,7 +192,7 @@ class _IntegralStoreDetailsPage extends State<IntegralStoreDetailsPage> {
child: Text(
(payType > 0)
? "立即兑换"
: S.of(context).jifenbuzu,
: pointPrice().contains("印章")?"您的印章数量不足" :S.of(context).jifenbuzu,
// "兑换功能暂未开放",
style: TextStyle(
fontSize: 16.sp,
@ -211,6 +216,7 @@ class _IntegralStoreDetailsPage extends State<IntegralStoreDetailsPage> {
"money": goods.money,
"onePrice":goods.onePrice,
"oneMoney":goods.oneMoney,
"oneBean":goods.oneBean,
"price": goods.price,
"image": goods.mainImgPath,
"payType":payType,

264
lib/main_page.dart

@ -55,6 +55,7 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver {
final GlobalKey minePageKey = GlobalKey();
final GlobalKey unionPageKey = GlobalKey();
final GlobalKey vipPageKey = GlobalKey();
// List<String> iconn;
ApiService apiService;
int lastTime = DateTime.now().millisecondsSinceEpoch;
@ -73,11 +74,11 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver {
break;
case AppLifecycleState.resumed: //
pushRoute();
if(DateTime.now().millisecondsSinceEpoch - lastTime > 420000)
if (DateTime.now().millisecondsSinceEpoch - lastTime > 420000)
Navigator.of(context).popAndPushNamed('/router/start_page');
break;
case AppLifecycleState.paused: //
lastTime = DateTime.now().millisecondsSinceEpoch;
lastTime = DateTime.now().millisecondsSinceEpoch;
break;
case AppLifecycleState.detached: // APP结束时调用
break;
@ -87,8 +88,12 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver {
@override
void initState() {
super.initState();
pageController = PageController(initialPage: widget.arguments != null && widget.arguments["index"] != null ? widget.arguments["index"]:0);
if(widget.arguments != null && widget.arguments["index"] != null)
pageController = PageController(
initialPage:
widget.arguments != null && widget.arguments["index"] != null
? widget.arguments["index"]
: 0);
if (widget.arguments != null && widget.arguments["index"] != null)
clickIndex = widget.arguments["index"];
WidgetsBinding.instance.addObserver(this);
EasyLoading.instance
@ -103,7 +108,6 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver {
..userInteractions = false
..dismissOnTap = false;
initSdk();
pushRoute();
@ -112,32 +116,43 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver {
var interviewCouponList;
var firstLoginCouponList;
if(widget.arguments != null && (widget.arguments["invite"]??"") != ""
&& widget.arguments["interviewCouponList"] != null ){
if (widget.arguments != null &&
(widget.arguments["invite"] ?? "") != "" &&
widget.arguments["interviewCouponList"] != null) {
invite = widget.arguments["invite"];
interviewCouponList = widget.arguments["interviewCouponList"];
}
if(widget.arguments != null && widget.arguments["firstLoginCouponList"] != null ){
if (widget.arguments != null &&
widget.arguments["firstLoginCouponList"] != null) {
firstLoginCouponList = widget.arguments["firstLoginCouponList"];
}
_widgetOptions = <Widget>[
// BrandPage(),
HomePage(homePageKey,(index,jpIndex) {
if(index == 1){
if(unionPageKey?.currentState != null) {
UnionPageState state = unionPageKey.currentState;
state.jumpIndex(jpIndex);
}else _widgetOptions[1] = UnionPage(unionPageKey,jpIndex);
}
setState(() {
pageController.jumpToPage(index);
});
},invite:invite,interviewCouponList:interviewCouponList,firstLoginCouponList:firstLoginCouponList,),
HomePage(
homePageKey,
(index, jpIndex) {
if (index == 1) {
if (unionPageKey?.currentState != null) {
UnionPageState state = unionPageKey.currentState;
state.jumpIndex(jpIndex);
} else
_widgetOptions[1] = UnionPage(unionPageKey, jpIndex);
}
setState(() {
pageController.jumpToPage(index);
});
},
invite: invite,
interviewCouponList: interviewCouponList,
firstLoginCouponList: firstLoginCouponList,
),
// MainHomePage(),
UnionPage(unionPageKey,0),
UnionPage(unionPageKey, 0),
VipPage(vipPageKey),
Platform.isAndroid ? (ExamineInstance.instance.isExamine?OrderPage():CommunityPage()) :CommunityPage(),
Platform.isAndroid
? (ExamineInstance.instance.isExamine ? OrderPage() : CommunityPage())
: CommunityPage(),
// CommunityPage(),
MinePage(minePageKey),
];
@ -167,9 +182,12 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver {
///App自动更新
appAutoUpdate();
}
final XgFlutterPlugin xgFlutterPlugin = XgFlutterPlugin();
initSdk() async {
xgFlutterPlugin.stopXg();
///ios startXg前需要调用此方法
xgFlutterPlugin.configureClusterDomainName("tpns.sh.tencent.com");
xgFlutterPlugin.setEnableDebug(true);
@ -217,7 +235,7 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver {
if (Platform.isAndroid) {
xgFlutterPlugin.getXgAndroidApi().addNativeEventHandler(
MyNativeEventHandler(
(String title, String message, String customContent, int type) {
(String title, String message, String customContent, int type) {
print("xgPushClickAction2: $customContent");
SharedPreferences.getInstance().then((value) {
value.setString("pushData", customContent);
@ -234,7 +252,7 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver {
if (Platform.isAndroid
? (event["actionType"] == 0)
: (event["xg"]["msgtype"] == 1) &&
event[Platform.isAndroid ? "customMessage" : "custom"] != null) {
event[Platform.isAndroid ? "customMessage" : "custom"] != null) {
SharedPreferences.getInstance().then((value) {
value.setString("pushData",
event[Platform.isAndroid ? "customMessage" : "custom"]);
@ -249,15 +267,15 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver {
}
return event;
}, onReceiveNotificationResponse: (event) async {
try{
if(jsonDecode(event["customMessage"])["typed"] == 6){
try {
if (jsonDecode(event["customMessage"])["typed"] == 6) {
// HomePageState state = homePageKey.currentState;
// state.queryMsgStats();
MinePageState state = minePageKey.currentState;
state.queryMsgStats();
}
}catch(ex){}
} catch (ex) {}
print("onReceiveNotificationResponse: ${event.toString()}");
return event;
}, onReceiveMessage: (event) async {
@ -277,7 +295,7 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver {
if (sharedPreferences.getString("token") == null ||
sharedPreferences.getString("token") == "") return;
String startIntent;
if(Platform.isAndroid) startIntent= await Bridge.getStartIntent();
if (Platform.isAndroid) startIntent = await Bridge.getStartIntent();
print("intent:$startIntent");
String pushData = "";
if (startIntent != null && startIntent != "") {
@ -292,37 +310,45 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver {
String routeName = "";
Map<String, dynamic> params = {};
switch (pushMap["typed"].toString()) {
case "1":case "ARTICLE":
case "1":
case "ARTICLE":
routeName = "/router/web_page";
params["articleId"] = pushMap["info"];
break;
case "2":case "ACTIVITY":
case "2":
case "ACTIVITY":
routeName = "/router/web_page";
params["activityId"] = pushMap["info"];
break;
case "3":case "SHOP":
case "3":
case "SHOP":
routeName = "/router/store_order";
params["id"] = pushMap["info"];
params["tenant"] = pushMap["tenant"];
params["storeName"] = pushMap["storeName"];
break;
case "4":case "CREDIT_GOODS":
case "4":
case "CREDIT_GOODS":
routeName = "/router/integral_store_page";
params["goodsId"] = pushMap["info"];
break;
case "5":case "ORDER":
case "5":
case "ORDER":
routeName = "/router/order_details";
params["id"] = pushMap["info"];
break;
case "6":case "MEMBER":
case "6":
case "MEMBER":
routeName = "/router/community_details";
params["businessId"] = pushMap["info"];
break;
case "8":case "WALLET":
case "8":
case "WALLET":
routeName = "/router/mine_wallet";
params["id"] = pushMap["info"];
break;
case "9":case "WELFARE":
case "9":
case "WELFARE":
routeName = "/router/welfare_page";
params["id"] = pushMap["info"];
break;
@ -366,35 +392,37 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver {
SharedPreferences value = await SharedPreferences.getInstance();
if (apiService == null) {
apiService = ApiService(
Dio(),
context: context,
token: value.getString("token"),
Dio(),
context: context,
token: value.getString("token"),
);
}
PackageInfo packageInfo = await PackageInfo.fromPlatform();
BaseData<AppUpdate> baseData = await apiService.appVersion().catchError((onError) {});
BaseData<AppUpdate> baseData =
await apiService.appVersion().catchError((onError) {});
if (baseData != null && baseData.isSuccess) {
// baseData.data.appLastVersion = "2.0.17";
// baseData.data.appLastVersionUp = "1.0.1";
if(AppUtils.versionCompare(packageInfo.version,baseData.data?.appLastVersion)
&& AppUtils.versionCompare(value.getString("appLastVersion")??"1.0.0",baseData.data?.appLastVersion)){
if (AppUtils.versionCompare(
packageInfo.version, baseData.data?.appLastVersion) &&
AppUtils.versionCompare(value.getString("appLastVersion") ?? "1.0.0",
baseData.data?.appLastVersion)) {
showDialog(
context: context,
barrierDismissible: false,
builder: (BuildContext context) {
return WillPopScope(
child:UpdateDialog(packageInfo.version,baseData.data),
child: UpdateDialog(packageInfo.version, baseData.data),
onWillPop: () async {
return Future.value(false);
});
},
);
}else{
} else {
return;
}
}else{
SmartDialog.showToast(baseData.msg,
alignment: Alignment.center);
} else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
Navigator.of(context).pop();
}
}
@ -443,7 +471,13 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver {
bottomNavigationItem(S.of(context).main_menu2, 1),
// bottomNavigationItem(S.of(context).main_menu3 , 2),
bottomNavigationItem(S.of(context).main_menu5, 2),
bottomNavigationItem(Platform.isAndroid ? (ExamineInstance.instance.isExamine?"订单":S.of(context).main_menu3) :S.of(context).main_menu3, 3),
bottomNavigationItem(
Platform.isAndroid
? (ExamineInstance.instance.isExamine
? "订单"
: S.of(context).main_menu3)
: S.of(context).main_menu3,
3),
bottomNavigationItem(S.of(context).main_menu4, 4),
],
),
@ -525,72 +559,72 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver {
);
}
// Widget bottomNavigationBigItem(text, index) {
// var isSelected = index == clickIndex;
// return Expanded(
// child: InkWell(
// onTap: () {
// setState(() {
// clickIndex = index;
// pageController.jumpToPage(clickIndex);
// });
// },
// child: Container(
// width: 45.w,
// alignment: Alignment.center,
// child: AnimatedCrossFade(
// firstCurve: Curves.easeIn,
// secondCurve: Curves.ease,
// sizeCurve: Curves.easeInOut,
// duration: Duration(milliseconds: 50),
// firstChild: Container(
// padding: EdgeInsets.all(4),
// height: 82.h,
// alignment:
// Platform.isAndroid ? Alignment.center : Alignment.topCenter,
// child: Image.asset(
// icons[index],
// width: 45,
// height: 45,
// fit: BoxFit.contain,
// ),
// ),
// secondChild: Column(
// mainAxisAlignment: Platform.isAndroid
// ? MainAxisAlignment.center
// : MainAxisAlignment.start,
// crossAxisAlignment: CrossAxisAlignment.center,
// children: [
// if (Platform.isIOS)
// SizedBox(
// height: 4.h,
// ),
// Image.asset(
// iconn[index],
// width: 30,
// height: 30,
// fit: BoxFit.contain,
// ),
// SizedBox(
// height: 1.h,
// ),
// Text(
// text,
// style: TextStyle(
// fontSize: 10.sp,
// fontWeight: MyFontWeight.semi_bold,
// color: Color(isSelected ? 0xFF4C4C4C : 0xFFA29E9E),
// ),
// ),
// ],
// ),
// crossFadeState: isSelected
// ? CrossFadeState.showFirst
// : CrossFadeState.showSecond,
// ),
// ),
// ),
// flex: 1,
// );
// }
// Widget bottomNavigationBigItem(text, index) {
// var isSelected = index == clickIndex;
// return Expanded(
// child: InkWell(
// onTap: () {
// setState(() {
// clickIndex = index;
// pageController.jumpToPage(clickIndex);
// });
// },
// child: Container(
// width: 45.w,
// alignment: Alignment.center,
// child: AnimatedCrossFade(
// firstCurve: Curves.easeIn,
// secondCurve: Curves.ease,
// sizeCurve: Curves.easeInOut,
// duration: Duration(milliseconds: 50),
// firstChild: Container(
// padding: EdgeInsets.all(4),
// height: 82.h,
// alignment:
// Platform.isAndroid ? Alignment.center : Alignment.topCenter,
// child: Image.asset(
// icons[index],
// width: 45,
// height: 45,
// fit: BoxFit.contain,
// ),
// ),
// secondChild: Column(
// mainAxisAlignment: Platform.isAndroid
// ? MainAxisAlignment.center
// : MainAxisAlignment.start,
// crossAxisAlignment: CrossAxisAlignment.center,
// children: [
// if (Platform.isIOS)
// SizedBox(
// height: 4.h,
// ),
// Image.asset(
// iconn[index],
// width: 30,
// height: 30,
// fit: BoxFit.contain,
// ),
// SizedBox(
// height: 1.h,
// ),
// Text(
// text,
// style: TextStyle(
// fontSize: 10.sp,
// fontWeight: MyFontWeight.semi_bold,
// color: Color(isSelected ? 0xFF4C4C4C : 0xFFA29E9E),
// ),
// ),
// ],
// ),
// crossFadeState: isSelected
// ? CrossFadeState.showFirst
// : CrossFadeState.showSecond,
// ),
// ),
// ),
// flex: 1,
// );
// }
}

998
lib/order/exchange_order_page.dart

File diff suppressed because it is too large Load Diff

3
lib/retrofit/data/findMiNiGroupList.dart

@ -103,6 +103,7 @@ class ProductListBean {
String printerFlag;
dynamic markProductNone;
SubscribeParam subscribeParam;
bool isSetMeal;
static ProductListBean fromJson(Map<String, dynamic> map) {
if (map == null) return null;
@ -137,6 +138,7 @@ class ProductListBean {
productListBean.printerFlag = map['printerFlag'];
productListBean.markProductNone = map['markProductNone'];
productListBean.subscribeParam = SubscribeParam.fromJson(map['subscribeParam']);
productListBean.isSetMeal = map['isSetMeal'];
return productListBean;
}
@ -171,6 +173,7 @@ class ProductListBean {
"printerFlag": printerFlag,
"markProductNone": markProductNone,
"subscribeParam": subscribeParam,
"isSetMeal": isSetMeal,
};
}

6
lib/retrofit/data/goods.dart

@ -42,6 +42,7 @@ class Goods {
String money,
String onePrice,
String oneMoney,
String oneBean,
String orderId,
int stock,
int sales,
@ -69,6 +70,7 @@ class Goods {
_money = money;
_onePrice = onePrice;
_oneMoney = oneMoney;
_oneBean = oneBean;
_orderId = orderId;
_stock = stock;
_sales = sales;
@ -99,6 +101,7 @@ class Goods {
_money = json['money'];
_onePrice = json['onePrice'];
_oneMoney = json['oneMoney'];
_oneBean = json['oneBean'];
_orderId = json['orderId'];
_stock = json['stock'];
_sales = json['sales'];
@ -127,6 +130,7 @@ class Goods {
String _money;
String _onePrice;
String _oneMoney;
String _oneBean;
String _orderId;
int _stock;
int _sales;
@ -155,6 +159,7 @@ class Goods {
String get money => _money;
String get onePrice => _onePrice;
String get oneMoney => _oneMoney;
String get oneBean => _oneBean;
String get orderId => _orderId;
int get stock => _stock;
int get sales => _sales;
@ -185,6 +190,7 @@ class Goods {
map['money'] = _money;
map['onePrice'] = _onePrice;
map['oneMoney'] = _oneMoney;
map['oneBean'] = _oneBean;
map['orderId'] = _orderId;
map['stock'] = _stock;
map['sales'] = _sales;

2
lib/retrofit/min_api.dart

@ -26,7 +26,7 @@ import 'data/shopping_home_config.dart';
part 'min_api.g.dart';
const localBaseUrl = "http://192.168.10.78:8765/app/";///
const localBaseUrl = "http://192.168.10.129:8765/app/";///
// const localBaseUrl = "https://2946-27-19-77-115.jp.ngrok.io/app/";///
const serviceBaseUrl = "https://pos.api.lotus-wallet.com/app/";///线

2
lib/retrofit/min_api.g.dart

@ -194,7 +194,7 @@ class _MinApiService implements MinApiService {
data: _data);
final value = BaseData<List<ShoppingCart>>.fromJson(
_result.data,
(json) => (json as List<dynamic>)
(json) => ((json??"") == "")?null:(json as List<dynamic>)
.map<ShoppingCart>(
(i) => ShoppingCart.fromJson(i as Map<String, dynamic>))
.toList());

2
lib/retrofit/retrofit_api.dart

@ -66,7 +66,7 @@ import 'data/wx_pay.dart';
part 'retrofit_api.g.dart';
const localBaseUrl = "http://192.168.10.78:8766/app/";///
const localBaseUrl = "http://192.168.10.129:8766/app/";///
// const localBaseUrl = "https://2946-27-19-77-115.jp.ngrok.io/app/";///
const serviceBaseUrl = "https://pos.platform.lotus-wallet.com/app/";///线

202
lib/settlement/settlement_view/settlement_order_commodity.dart

@ -10,6 +10,8 @@ import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/custom_image.dart';
import 'package:huixiang/view_widget/separator.dart';
import '../../retrofit/data/shoppingCart.dart';
class SettlementOrderCommodity extends StatefulWidget {
final int isTakeOut;
final int tableId;
@ -181,89 +183,149 @@ class _SettlementOrderCommodity extends State<SettlementOrderCommodity> {
Widget commodityItem(OrderProductVOList productList) {
return Container(
margin: EdgeInsets.only(top: 8.h, bottom: 8.h),
child: Row(
child: Column(
children: [
MImage(
productList.skuImg,
width: 55,
height: 55,
fit: BoxFit.cover,
radius: BorderRadius.circular(4),
errorSrc: "assets/image/default_1.webp",
fadeSrc: "assets/image/default_1.webp",
),
Expanded(
flex: 1,
child: Container(
margin: EdgeInsets.only(
left: 8.w,
Row(
children: [
MImage(
productList.skuImg,
width: 55,
height: 55,
fit: BoxFit.cover,
radius: BorderRadius.circular(4),
errorSrc: "assets/image/default_1.webp",
fadeSrc: "assets/image/default_1.webp",
),
// height: 44.h,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
productList.productName,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.sp,
color: Color(0xFF353535),
),
),
SizedBox(
height: 4.h,
Expanded(
flex: 1,
child: Container(
margin: EdgeInsets.only(
left: 8.w,
),
Text(
productList.skuNameStr != null
? "${productList.skuNameStr ?? ""}"
: "",
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 10.sp,
color: Color(0xFFA29E9E),
),
// height: 44.h,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
productList.productName,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.sp,
color: Color(0xFF353535),
),
),
SizedBox(
height: 4.h,
),
Text(
productList.skuNameStr != null
? "${productList.skuNameStr ?? ""}"
: "",
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 10.sp,
color: Color(0xFFA29E9E),
),
),
Text(
"x${productList.buyNum}",
style: TextStyle(
fontSize: 12.sp,
color: Color(0xFF727272),
),
),
],
),
),
),
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
"x${productList.buyNum}",
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"))),
style: TextStyle(
fontSize: 12.sp,
color: Color(0xFF727272),
fontWeight: MyFontWeight.medium,
fontSize: 14.sp,
color: Color(0xFF4C4C4C),
),
),
if (productList.discountAmount != null && productList.discountAmount != "0")
Text(
S.of(context).yuan_(productList.sellPrice),
style: TextStyle(
fontWeight: MyFontWeight.regular,
fontSize: 12.sp,
fontFamily: 'JDZhengHT',
decoration: TextDecoration.lineThrough,
color: Color(0xFFA29E9E),
),
)
],
),
],
),
if(productList.setMealDataList.length != 0)
ListView.builder(
itemCount: productList.setMealDataList.length,
scrollDirection: Axis.vertical,
physics: BouncingScrollPhysics(),
shrinkWrap: true,
padding: EdgeInsets.zero,
itemBuilder: (context, index) {
return orderMealsItem(productList.setMealDataList[index]);
},
),
],
),
);
}
Widget orderMealsItem(SetMealDataList setMealDataList) {
return Container(
margin: EdgeInsets.symmetric(vertical:10.h,),
child: Row(
children: [
Expanded(
flex:2,
child: Text(
setMealDataList.productInfoList[0].productName,
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: TextStyle(
color: Color(0xffA29E9E),
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
),
),
),
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.end,
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"))),
style: TextStyle(
fontWeight: MyFontWeight.medium,
fontSize: 14.sp,
color: Color(0xFF4C4C4C),
),
Expanded(flex:3,
child: Text(
"${(setMealDataList.productInfoList[0].skuName == "") ? "": setMealDataList.productInfoList[0].skuName}",
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: TextStyle(
color: Color(0xffA29E9E),
fontSize: 13.sp,
fontWeight: MyFontWeight.regular,
),
if (productList.discountAmount != null && productList.discountAmount != "0")
Text(
S.of(context).yuan_(productList.sellPrice),
style: TextStyle(
fontWeight: MyFontWeight.regular,
fontSize: 12.sp,
fontFamily: 'JDZhengHT',
decoration: TextDecoration.lineThrough,
color: Color(0xFFA29E9E),
),
)
],
)
),
),
Text(
"x${setMealDataList.productInfoList[0].buyNumber.toString()}",
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: TextStyle(
color: Color(0xffFF7A1A),
fontSize: 13.sp,
fontWeight: MyFontWeight.regular,
),
),
],
),
);

20
lib/store/shop_details_page.dart

@ -64,12 +64,14 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
String parentId;
int numberOfPeople = 0;
int index;
bool isSetMeal;
@override
void initState() {
super.initState();
id = widget.arguments["id"];
storeId = widget.arguments["storeId"];
isSetMeal = widget.arguments["isSetMeal"] ?? false;
// SharedPreferences.getInstance().then((value) {
// String minToken = value.getString("minToken");
// String tenant = value.getString("tenant");
@ -841,10 +843,22 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
),
)),
GestureDetector(
onTap: () {
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);
}
@ -875,7 +889,9 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
false) ==
true)
? S.of(context).lijiyuyue
: "加入购物车",
: (isSetMeal ?? false) == true
? "选套餐"
: "加入购物车",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,

13
lib/store/store_order.dart

@ -426,6 +426,7 @@ class _StoreOrderPage extends State<StoreOrderPage>
];
},
body:
///
TabBarView(
physics: NeverScrollableScrollPhysics(),
@ -656,9 +657,9 @@ class _StoreOrderPage extends State<StoreOrderPage>
"cid": cid,
"shoppingCart": shopCarGoods,
"numberOfPeople": numberOfPeople,
"distance":widget.arguments["distance"],
"vipLevelName":memberVo.memberRankVo.rankName,
"isVips":memberVo.isVip,
"distance": widget.arguments["distance"],
"vipLevelName": memberVo.memberRankVo.rankName,
"isVips": memberVo.isVip,
"distance": widget.arguments["distance"],
"subscribeParam": miNiDetail?.subscribeParam,
},
@ -693,7 +694,7 @@ class _StoreOrderPage extends State<StoreOrderPage>
color: Colors.white.withAlpha(76),
),
),
autoplay: (storeInfo?.bannerList?.length ?? 0) == 0 ? false :true,
autoplay: (storeInfo?.bannerList?.length ?? 0) == 0 ? false : true,
duration: 1000,
autoplayDelay: 2000,
itemBuilder: (context, position) {
@ -969,6 +970,8 @@ class _StoreOrderPage extends State<StoreOrderPage>
this.shopCarGoods = await queryShopCar();
debugPrint("count.toString()");
setState(() {});
} else {
SmartDialog.showToast(baseDate.msg, alignment: Alignment.center);
}
}
@ -1014,6 +1017,8 @@ class _StoreOrderPage extends State<StoreOrderPage>
this.shopCarGoods = value;
setState(() {});
});
} else {
SmartDialog.showToast(baseDate.msg, alignment: Alignment.center);
}
}

264
lib/store/store_view/product_meals_sku.dart

@ -316,6 +316,7 @@ class _ProductMealsSku extends State<ProductMealsSku> {
return Container(
margin: EdgeInsets.symmetric(vertical: 16.h),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
MImage(
productSetMeals[position].productInfoList[index].productImg ?? "",
@ -332,60 +333,63 @@ class _ProductMealsSku extends State<ProductMealsSku> {
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Expanded(
child: Text(
productSetMeals[position]
.productInfoList[index]
.productName ??
"",
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: TextStyle(
color: Colors.black,
fontSize: 13.sp,
fontWeight: MyFontWeight.semi_bold,
),
),
),
if (productSetMeals[position]
.productInfoList[index]
.productAttrInfoList[0]
.attrName !=
"")
GestureDetector(
Padding(
padding: EdgeInsets.symmetric(vertical: 8.h),
child: Row(
children: [
Expanded(
child: Text(
S.of(context).xuanguige,
productSetMeals[position]
.productInfoList[index]
.productName ??
"",
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: TextStyle(
color: Colors.black,
fontSize: 13.sp,
fontWeight: MyFontWeight.regular,
fontWeight: MyFontWeight.semi_bold,
),
),
onTap: () {
showSkuDialog(position, index);
},
),
if (productSetMeals[position]
.productInfoList[index]
.productAttrInfoList[0]
.attrName !=
"")
GestureDetector(
onTap: () {
showSkuDialog(position, index);
},
child: Icon(
Icons.chevron_right,
color: Colors.black,
size: 18,
if (productSetMeals[position]
.productInfoList[index]
.productAttrInfoList[0]
.attrName !=
"")
GestureDetector(
child: Text(
S.of(context).xuanguige,
style: TextStyle(
color: Colors.black,
fontSize: 13.sp,
fontWeight: MyFontWeight.regular,
),
),
onTap: () {
showSkuDialog(position, index);
},
),
)
],
if (productSetMeals[position]
.productInfoList[index]
.productAttrInfoList[0]
.attrName !=
"")
GestureDetector(
onTap: () {
showSkuDialog(position, index);
},
child: Icon(
Icons.chevron_right,
color: Colors.black,
size: 18,
),
)
],
),
),
SizedBox(height: 8.h),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
if (productSetMeals[position]
.productInfoList[index]
@ -410,77 +414,123 @@ class _ProductMealsSku extends State<ProductMealsSku> {
),
),
Spacer(),
InkWell(
onTap: () {
setState(() {
if (productSetMeals[position]
.productInfoList[index]
.count >=
1)
productSetMeals[position]
.productInfoList[index]
.count -= 1;
});
},
child: Image.asset(
"assets/image/reduce.webp",
width: 22,
height: 22.h,
),
),
Container(
width: 30,
alignment: Alignment.center,
child: Text(
productSetMeals[position]
if (productSetMeals[position]
.productInfoList[index]
.count
.toString(),
style: TextStyle(
color: Colors.black,
fontSize: 14.sp,
fontWeight: MyFontWeight.medium,
.skuInfoList
.where((element) => element.isSelected)
.isNotEmpty &&
productSetMeals[position].productInfoList[index].count >
0)
Padding(
padding: EdgeInsets.only(right: 4.w),
child: Text(
"x${productSetMeals[position].productInfoList[index].count}",
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: TextStyle(
color: Color(0xffFF7A1A),
fontSize: 13.sp,
fontWeight: MyFontWeight.regular,
),
),
),
),
GestureDetector(
onTap: () {
setState(() {
if (productSetMeals[position]
if (productSetMeals[position]
.productInfoList[index]
.productAttrInfoList[0]
.attrName ==
"")
InkWell(
onTap: () {
setState(() {
if (productSetMeals[position]
.productInfoList[index]
.count >=
1)
productSetMeals[position]
.productInfoList[index]
.productAttrInfoList[0]
.attrName !=
"") {
showSkuDialog(position, index);
return;
}
int total = 0;
productSetMeals[position]
.productInfoList
.forEach((element) {
total += element.count;
.count -= 1;
});
if (total >=
productSetMeals[position].optionalNumber) {
SmartDialog.showToast("抱歉,无法加购更多",
alignment: Alignment.center);
return;
}
if (productSetMeals[position]
},
child: Image.asset(
"assets/image/reduce.webp",
width: 22,
height: 22.h,
),
),
if (productSetMeals[position]
.productInfoList[index]
.productAttrInfoList[0]
.attrName ==
"")
Container(
width: 30,
alignment: Alignment.center,
child: Text(
(productSetMeals[position].totalNumber > 1 &&
productSetMeals[position].totalNumber !=
productSetMeals[position].optionalNumber)
? productSetMeals[position]
.productInfoList[index]
.count ==
0)
.count
.toString()
: (productSetMeals[position]
.productInfoList[index]
.count = 1)
.toString(),
style: TextStyle(
color: Colors.black,
fontSize: 14.sp,
fontWeight: MyFontWeight.medium,
),
),
),
if (productSetMeals[position]
.productInfoList[index]
.productAttrInfoList[0]
.attrName ==
"")
GestureDetector(
onTap: () {
setState(() {
if (productSetMeals[position]
.productInfoList[index]
.productAttrInfoList[0]
.attrName !=
"") {
showSkuDialog(position, index);
return;
}
int total = 0;
productSetMeals[position]
.productInfoList[index]
.count += 1;
});
},
child: Image.asset(
"assets/image/add.webp",
width: 22,
height: 22.h,
.productInfoList
.forEach((element) {
total += element.count;
});
if (total >=
productSetMeals[position].optionalNumber ||
productSetMeals[position]
.productInfoList[index]
.count >=
1) {
SmartDialog.showToast("抱歉,无法加购更多",
alignment: Alignment.center);
return;
}
if (productSetMeals[position]
.productInfoList[index]
.count ==
0)
productSetMeals[position]
.productInfoList[index]
.count += 1;
});
},
child: Image.asset(
"assets/image/add.webp",
width: 22,
height: 22.h,
),
),
),
],
),
SizedBox(

42
lib/store/store_view/product_sku.dart

@ -1,5 +1,6 @@
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:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/retrofit/data/miNiDetail.dart';
@ -237,9 +238,11 @@ class _ProductSku extends State<ProductSku> {
),
InkWell(
onTap: () async {
if(count == 1)
return;
if((widget?.miNiDetail?.subscribeParam?.isEnableSubscribe ?? false) == false){
if (count == 1) return;
if ((widget?.miNiDetail?.subscribeParam
?.isEnableSubscribe ??
false) ==
false) {
_isTapEd = true;
EasyLoading.show(status: S.current.zhengzaijiazai);
await widget.reduce(widget.miNiDetail, selectSkus);
@ -267,7 +270,10 @@ class _ProductSku extends State<ProductSku> {
),
InkWell(
onTap: () async {
if((widget?.miNiDetail?.subscribeParam?.isEnableSubscribe ?? false) == false){
if ((widget?.miNiDetail?.subscribeParam
?.isEnableSubscribe ??
false) ==
false) {
_isTapEd = true;
EasyLoading.show(status: S.current.zhengzaijiazai);
if (count == 1 && realCount == 0)
@ -276,7 +282,16 @@ class _ProductSku extends State<ProductSku> {
else
await widget.add(widget.miNiDetail, selectSkus);
}
count += 1;
if ((widget?.miNiDetail?.oversold ?? 0) == 0 &&
count >=
(widget?.miNiDetail?.productSkuVOList[0]
?.skuStock ??
0)) {
SmartDialog.showToast("库存不足",
alignment: Alignment.center);
} else {
count += 1;
}
setState(() {});
EasyLoading.dismiss();
},
@ -295,7 +310,12 @@ class _ProductSku extends State<ProductSku> {
RoundButton(
width: double.infinity,
height: 54.h,
text: (widget?.miNiDetail?.subscribeParam?.isEnableSubscribe ?? false) == true ? S.of(context).lijiyuyue:"加入购物车",
text:
(widget?.miNiDetail?.subscribeParam?.isEnableSubscribe ??
false) ==
true
? S.of(context).lijiyuyue
: "加入购物车",
textColor: Colors.white,
fontWeight: MyFontWeight.semi_bold,
radius: 27,
@ -305,7 +325,15 @@ class _ProductSku extends State<ProductSku> {
Navigator.of(context).pop();
// SmartDialog.dismiss();
if (!_isTapEd)
widget.addShopCar(widget.miNiDetail, selectSkus,((widget?.miNiDetail?.subscribeParam?.isEnableSubscribe ?? false) == false) ? 1 : count);
widget.addShopCar(
widget.miNiDetail,
selectSkus,
((widget?.miNiDetail?.subscribeParam
?.isEnableSubscribe ??
false) ==
false)
? 1
: count);
},
),
if (widget.buttonType == 1)

166
lib/store/store_view/shop_goods.dart

@ -1,6 +1,7 @@
import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/findMiNiGroupList.dart';
import 'package:huixiang/retrofit/data/shoppingCart.dart';
@ -232,7 +233,8 @@ class _ShopGoods extends State<ShopGoods> {
(widget.productListBean?.attrStyle ?? 0) == 1 &&
!(widget?.productListBean?.subscribeParam
?.isEnableSubscribe ??
false))
false) &&
!(widget?.productListBean?.isSetMeal ?? false))
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () async {
@ -249,58 +251,57 @@ class _ShopGoods extends State<ShopGoods> {
0);
}
},
child: Container(
// padding: EdgeInsets.only(right: 16.w),
child: Stack(
children: [
Container(
padding: EdgeInsets.only(
left: 35.w,
top: 4.h,
bottom: 4.h,
),
margin: EdgeInsets.only(right:8.w,top: 4.h),
child: RoundButton(
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, horizontal: 3.w),
),
child: Stack(
children: [
Container(
padding: EdgeInsets.only(
left: 35.w,
top: 4.h,
bottom: 4.h,
),
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,
),
margin: EdgeInsets.only(right: 8.w, top: 4.h),
child: RoundButton(
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, horizontal: 3.w),
),
),
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 &&
!(widget?.productListBean?.subscribeParam
?.isEnableSubscribe ??
false))
false) &&
!(widget?.productListBean?.isSetMeal ?? false))
Spacer(),
if (widget.isShopCart ||
(widget.productListBean?.attrStyle ?? 0) == 0 &&
!(widget?.productListBean?.subscribeParam
?.isEnableSubscribe ??
false))
false) &&
!(widget?.productListBean?.isSetMeal ?? false))
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () async {
@ -324,7 +325,8 @@ class _ShopGoods extends State<ShopGoods> {
(widget.productListBean?.attrStyle ?? 0) == 0 &&
!(widget?.productListBean?.subscribeParam
?.isEnableSubscribe ??
false))
false) &&
!(widget?.productListBean?.isSetMeal ?? false))
Container(
alignment: Alignment.center,
child: Text(
@ -340,7 +342,8 @@ class _ShopGoods extends State<ShopGoods> {
(widget.productListBean?.attrStyle ?? 0) == 0 &&
!(widget?.productListBean?.subscribeParam
?.isEnableSubscribe ??
false))
false) &&
!(widget?.productListBean?.isSetMeal ?? false))
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () async {
@ -348,7 +351,14 @@ class _ShopGoods extends State<ShopGoods> {
widget.tableId == 0) {
showDeleteDialog();
} else {
if (_jumpType == -1)
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);
@ -364,7 +374,7 @@ class _ShopGoods extends State<ShopGoods> {
}
},
child: Container(
padding: EdgeInsets.only(left: 6.w, right:9.w),
padding: EdgeInsets.only(left: 6.w, right: 9.w),
child: Image.asset(
"assets/image/add.webp",
width: 22,
@ -401,7 +411,7 @@ class _ShopGoods extends State<ShopGoods> {
top: 4.h,
bottom: 4.h,
),
margin: EdgeInsets.only(right:8.w,top: 4),
margin: EdgeInsets.only(right: 8.w, top: 4),
child: RoundButton(
text: S.of(context).lijiyuyue,
textColor: Colors.white,
@ -413,6 +423,72 @@ class _ShopGoods extends State<ShopGoods> {
vertical: 5.h, horizontal: 3.w),
),
)),
if ((widget.productListBean.isSetMeal ?? false) == true)
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 {
await Navigator.of(context).pushNamed(
'/router/product_meals_sku',
arguments: {
"id": widget.productListBean.id,
"storeId": widget.productListBean.storeId,
"tableId": widget.tableId
});
widget.queryShoppingCart();
}
},
child: Stack(
children: [
Container(
padding: EdgeInsets.only(
left: 35.w,
top: 4.h,
bottom: 4.h,
),
margin: EdgeInsets.only(right: 8.w, top: 4.h),
child: RoundButton(
text: "选套餐",
textColor: Colors.white,
fontWeight: MyFontWeight.medium,
radius: 3,
backgroup: Color(0xFF32A060),
fontSize: 11.sp,
padding: EdgeInsets.symmetric(
vertical: 5.h, horizontal: 3.w),
),
),
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,
),
),
),
],
))
],
),
SizedBox(

504
lib/store/store_view/shop_goods_car.dart

@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/findMiNiGroupList.dart';
import 'package:huixiang/retrofit/data/shoppingCart.dart';
@ -12,21 +13,21 @@ class ShopGoodsCar extends StatefulWidget {
final Function(String id, int count) queryMiNiDetail;
final Function(ShoppingCartSkuItemListBean shoppingCartSkuItemListBean) add;
final Function(ShoppingCartSkuItemListBean shoppingCartSkuItemListBean)
reduce;
reduce;
final ProductListBean productListBean;
final ShoppingCartSkuItemListBean shoppingCartSkuItemListBean;
final int count;
final bool isShopCart;
ShopGoodsCar(
this.add,
this.reduce, {
this.productListBean,
this.count = 0,
this.isShopCart = false,
this.queryMiNiDetail,
this.shoppingCartSkuItemListBean,
});
this.add,
this.reduce, {
this.productListBean,
this.count = 0,
this.isShopCart = false,
this.queryMiNiDetail,
this.shoppingCartSkuItemListBean,
});
@override
State<StatefulWidget> createState() {
@ -38,260 +39,283 @@ class _ShopGoodsCar extends State<ShopGoodsCar> {
@override
Widget build(BuildContext context) {
return Container(
color: Colors.white,
padding: EdgeInsets.only(
right: 16.w,
// bottom: 20.h,
),
child:Column(
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
children: [
SizedBox(width: 12.w),
MImage(
widget.productListBean != null
? widget.productListBean.imgPath
: (widget.shoppingCartSkuItemListBean != null
? widget.shoppingCartSkuItemListBean.skuImg
: ""),
width: 70.h,
height: 70.h,
radius: BorderRadius.circular(4),
fit: BoxFit.cover,
errorSrc: "assets/image/default_1.webp",
fadeSrc: "assets/image/default_1.webp",
),
SizedBox(
width: 10,
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Expanded(
child: Text(
widget.productListBean != null
? widget.productListBean.productName
: widget.shoppingCartSkuItemListBean.productName,
overflow: TextOverflow.ellipsis,
maxLines: 2,
style: TextStyle(
color: Colors.black,
fontSize: 13.sp,
fontWeight: MyFontWeight.medium,
),
),
),
// Image.asset(
// "assets/image/green_leaf.webp",
// fit: BoxFit.cover,
// width: 12,
// height: 12,
// ),
// Text(
// "X300",
// style: TextStyle(
// color: Color(0xFF55BC51),
// fontSize: 10.sp,
// fontWeight: MyFontWeight.semi_bold,
// ),
// ),
],
),
SizedBox(
height: 2.h,
),
Row(
children: [
Expanded(
child: Text(
(widget.productListBean != null
? widget.productListBean.shortName
: ((widget.shoppingCartSkuItemListBean.skuName == "0") ? "": widget.shoppingCartSkuItemListBean.skuName ) ?? ""),
overflow: TextOverflow.ellipsis,
maxLines: 2,
style: TextStyle(
color: Color(0xFF4C4C4C),
fontSize: 10.sp,
fontWeight: MyFontWeight.regular,
),
),
),
SizedBox(
width: 10,
),
],
),
SizedBox(
height: 7.h,
),
Row(
children: [
Row(
children: [
Text(
"¥${AppUtils.calculateDouble(double.tryParse(widget.isShopCart ? widget.shoppingCartSkuItemListBean.skuPrice : widget.productListBean.price) ?? 0)}",
color: Colors.white,
padding: EdgeInsets.only(
right: 16.w,
// bottom: 20.h,
),
child: Column(
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
children: [
SizedBox(width: 12.w),
MImage(
widget.productListBean != null
? widget.productListBean.imgPath
: (widget.shoppingCartSkuItemListBean != null
? widget.shoppingCartSkuItemListBean.skuImg
: ""),
width: 70.h,
height: 70.h,
radius: BorderRadius.circular(4),
fit: BoxFit.cover,
errorSrc: "assets/image/default_1.webp",
fadeSrc: "assets/image/default_1.webp",
),
SizedBox(
width: 10,
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Expanded(
child: Text(
widget.productListBean != null
? widget.productListBean.productName
: widget
.shoppingCartSkuItemListBean.productName,
overflow: TextOverflow.ellipsis,
maxLines: 2,
style: TextStyle(
color: Color(0xFFFF7A1A),
fontSize: 16.sp,
fontFamily: 'JDZhengHT',
color: Colors.black,
fontSize: 13.sp,
fontWeight: MyFontWeight.medium,
),
),
SizedBox(
width: 2.w,
),
// Image.asset(
// "assets/image/green_leaf.webp",
// fit: BoxFit.cover,
// width: 12,
// height: 12,
// ),
// Text(
// "X300",
// style: TextStyle(
// color: Color(0xFF55BC51),
// fontSize: 10.sp,
// fontWeight: MyFontWeight.semi_bold,
// ),
// ),
],
),
SizedBox(
height: 2.h,
),
Row(
children: [
Expanded(
child: Text(
(widget.productListBean != null
? widget.productListBean.shortName
: ((widget.shoppingCartSkuItemListBean
.skuName ==
"0")
? ""
: widget.shoppingCartSkuItemListBean
.skuName) ??
""),
overflow: TextOverflow.ellipsis,
maxLines: 2,
style: TextStyle(
color: Color(0xFF4C4C4C),
fontSize: 10.sp,
fontWeight: MyFontWeight.regular,
),
),
// 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,
// ),
// ),
// ),
],
),
Spacer(),
if (!widget.isShopCart &&
(widget.productListBean?.attrStyle ?? 0) == 1)
Stack(
),
SizedBox(
width: 10,
),
],
),
SizedBox(
height: 7.h,
),
Row(
children: [
Row(
children: [
Container(
margin: EdgeInsets.only(right: 8, top: 4),
child: RoundButton(
width: 49.w,
text: S.of(context).xuanguige,
textColor: Colors.white,
Text(
"¥${AppUtils.calculateDouble(double.tryParse(widget.isShopCart ? widget.shoppingCartSkuItemListBean.skuPrice : widget.productListBean.price) ?? 0)}",
style: TextStyle(
color: Color(0xFFFF7A1A),
fontSize: 16.sp,
fontFamily: 'JDZhengHT',
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,
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,
// ),
// ),
// ),
],
),
Spacer(),
if (!widget.isShopCart &&
(widget.productListBean?.attrStyle ?? 0) == 1)
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(
onTap: () {
widget
.reduce(widget.shoppingCartSkuItemListBean);
},
child: Image.asset(
"assets/image/reduce.webp",
width: 22,
height: 22.h,
),
],
),
if (widget.isShopCart ||
(widget.productListBean?.attrStyle ?? 0) == 0)
InkWell(
onTap: () {
widget.reduce(widget.shoppingCartSkuItemListBean);
},
child: Image.asset(
"assets/image/reduce.webp",
width: 22,
height: 22.h,
),
),
if (widget.isShopCart ||
(widget.productListBean?.attrStyle ?? 0) == 0)
Container(
width: 30,
alignment: Alignment.center,
child: Text(
"${widget.count}",
style: TextStyle(
color: Colors.black,
fontSize: 14.sp,
fontWeight: MyFontWeight.medium,
if (widget.isShopCart ||
(widget.productListBean?.attrStyle ?? 0) == 0)
Container(
width: 30,
alignment: Alignment.center,
child: Text(
"${widget.count}",
style: TextStyle(
color: Colors.black,
fontSize: 14.sp,
fontWeight: MyFontWeight.medium,
),
),
),
),
if (widget.isShopCart ||
(widget.productListBean?.attrStyle ?? 0) == 0)
GestureDetector(
onTap: () {
widget.add(widget.shoppingCartSkuItemListBean);
},
child: Image.asset(
"assets/image/add.webp",
width: 22,
height: 22.h,
if (widget.isShopCart ||
(widget.productListBean?.attrStyle ?? 0) == 0)
GestureDetector(
onTap: () {
if ((widget?.productListBean?.oversold ?? 0) ==
0 &&
widget.count >=
(widget?.shoppingCartSkuItemListBean
?.skuStock ??
0)) {
SmartDialog.showToast("库存不足",
alignment: Alignment.center);
} else {
widget
.add(widget.shoppingCartSkuItemListBean);
}
},
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(
color: Color(0xFFA29E9E),
fontSize: 12.sp,
fontFamily: 'JDZhengHT',
decoration: TextDecoration.lineThrough,
fontWeight: MyFontWeight.regular,
],
),
),
],
SizedBox(
height: 4.h,
),
Text(
"${AppUtils.calculateDouble(double.tryParse(widget.isShopCart ? widget.shoppingCartSkuItemListBean.skuPrice : widget.productListBean.applyPrice) ?? 0)}",
style: TextStyle(
color: Color(0xFFA29E9E),
fontSize: 12.sp,
fontFamily: 'JDZhengHT',
decoration: TextDecoration.lineThrough,
fontWeight: MyFontWeight.regular,
),
),
],
),
),
),
],
),
if(widget.shoppingCartSkuItemListBean.setMealDataList.length != 0)
ListView.builder(
itemCount: widget.shoppingCartSkuItemListBean.setMealDataList.length,
scrollDirection: Axis.vertical,
physics: BouncingScrollPhysics(),
shrinkWrap: true,
padding: EdgeInsets.zero,
itemBuilder: (context, index) {
return shopCarMealsItem(widget.shoppingCartSkuItemListBean.setMealDataList[index]);
},
],
),
SizedBox(height:15.h,)
],
)
);
if (widget.shoppingCartSkuItemListBean.setMealDataList.length != 0)
ListView.builder(
itemCount:
widget.shoppingCartSkuItemListBean.setMealDataList.length,
scrollDirection: Axis.vertical,
physics: BouncingScrollPhysics(),
shrinkWrap: true,
padding: EdgeInsets.zero,
itemBuilder: (context, index) {
return shopCarMealsItem(widget
.shoppingCartSkuItemListBean.setMealDataList[index]);
},
),
SizedBox(
height: 15.h,
)
],
));
}
Widget shopCarMealsItem(SetMealDataList setMealDataList) {
return Container(
margin: EdgeInsets.symmetric(vertical:10.h,horizontal: 16.w),
margin: EdgeInsets.symmetric(vertical: 10.h, horizontal: 16.w),
child: Row(
children: [
Expanded(
flex:2,
flex: 2,
child: Text(
setMealDataList.productInfoList[0].productName,
overflow: TextOverflow.ellipsis,
@ -303,9 +327,10 @@ class _ShopGoodsCar extends State<ShopGoodsCar> {
),
),
),
Expanded(flex:3,
Expanded(
flex: 3,
child: Text(
"${(setMealDataList.productInfoList[0].skuName == "") ? "默认": setMealDataList.productInfoList[0].skuName}",
"${(setMealDataList.productInfoList[0].skuName == "") ? "默认" : setMealDataList.productInfoList[0].skuName}",
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: TextStyle(
@ -316,7 +341,7 @@ class _ShopGoodsCar extends State<ShopGoodsCar> {
),
),
Text(
setMealDataList.productInfoList[0].buyNumber.toString(),
"x${setMealDataList.productInfoList[0].buyNumber.toString()}",
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: TextStyle(
@ -329,5 +354,4 @@ class _ShopGoodsCar extends State<ShopGoodsCar> {
),
);
}
}

1
lib/store/store_view/store_order_list.dart

@ -189,6 +189,7 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
.pushNamed('/router/shop_details_page', arguments: {
"id": e.id,
"storeId": e.storeId,
"isSetMeal":e.isSetMeal
});
widget.queryShoppingCart();
}

58
lib/utils/upload_async.dart

@ -5,6 +5,7 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:image_pickers/image_pickers.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:thumbnails/thumbnails.dart';
@ -12,23 +13,56 @@ import '../community/release_dynamic.dart';
import '../retrofit/data/base_data.dart';
import '../retrofit/data/upload_result.dart';
import '../retrofit/retrofit_api.dart';
import '../view_widget/custom_image.dart';
import 'font_weight.dart';
class UploadAsync {
static void upload(int dynamicType, List<Medias> mediaPaths,
String addressText, String dynamicText) async {
SmartDialog.show(
widget: Container(
alignment: Alignment.centerRight,
margin: EdgeInsets.only(
right: 10.w,
),
child: CircularProgressIndicator(
strokeWidth: 4.0,
backgroundColor: Colors.green,
// value: 0.4,
valueColor: new AlwaysStoppedAnimation<Color>(Colors.grey),
),
widget: Container(
alignment: Alignment.centerRight,
margin: EdgeInsets.only(
right: 10.w,
),
child: Stack(
alignment: Alignment.center,
children: [
Container(
width: 50.h,
height: 70.h,
decoration: BoxDecoration(
color: Colors.grey, borderRadius: BorderRadius.circular(2)),
child: dynamicType == 0
? Text(
dynamicText,
style: TextStyle(
fontWeight: MyFontWeight.semi_bold,
fontSize: 10.sp,
color: Color(0xFFCDCCCC),
),
)
: ClipRRect(
borderRadius: BorderRadius.circular(2),
child: Image.file(
File(mediaPaths[0].galleryMode == GalleryMode.video
? mediaPaths[0].thumbPath
: mediaPaths[0].path),
fit: BoxFit.cover,
width: double.infinity,
height: double.infinity,
),
),
),
CircularProgressIndicator(
strokeWidth: 3.0,
backgroundColor: Colors.white,
// value: 0.4,
valueColor: new AlwaysStoppedAnimation<Color>(Colors.grey),
),
],
),
),
maskWidgetTemp: SizedBox(),
);
var sp = await SharedPreferences.getInstance();
@ -162,7 +196,7 @@ class UploadInstance {
return _instance;
}
void notifyAllObservers(){
void notifyAllObservers() {
_uploadObserverList.forEach((element) {
element.onUploadFinish();
});

2
pubspec.yaml

@ -3,7 +3,7 @@ description: 一心回乡.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 3.2.13+57
version: 3.2.14+58
environment:
sdk: ">=2.7.0 <3.0.0"

Loading…
Cancel
Save