Browse Source

骨架屏网络请求异常显示更改;

首页新增商家端-用户端切换功能;
上下架板块新增确定弹窗;
商家端登录-改成可手机号可用户名登录,输入框改成文本输入法,适配中英文用户名密码;
商家端流程更改为-如果登录了商家端应用,就直接进入商家端版本,如果没有登录就进入app版本;如果推出商家端登录就显示app版本;
app订单结算页面更改;
wr_2023_business
wurong 1 year ago
parent
commit
b5e0d228d5
  1. BIN
      assets/image/2x/bs_user_switch.webp
  2. BIN
      assets/image/3x/bs_user_switch.webp
  3. BIN
      assets/image/bs_user_switch.webp
  4. 80
      lib/business_system/goods/goods_search_page.dart
  5. 241
      lib/business_system/goods/off_shelf/off_shelf_page.dart
  6. 79
      lib/business_system/goods/on_sale/batch_shelf.dart
  7. 78
      lib/business_system/goods/on_sale/on_sale_page.dart
  8. 118
      lib/business_system/home/business_home_page.dart
  9. 4
      lib/business_system/home/home_view/home_sideslip_dialog.dart
  10. 3
      lib/business_system/home/select_shop.dart
  11. 21
      lib/business_system/login/business_login_page.dart
  12. 53
      lib/login/new_login_page.dart
  13. 13
      lib/mine/mine_view/mine_item.dart
  14. 289
      lib/settlement/settlement.dart

BIN
assets/image/2x/bs_user_switch.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
assets/image/3x/bs_user_switch.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
assets/image/bs_user_switch.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 716 B

80
lib/business_system/goods/goods_search_page.dart

@ -14,10 +14,12 @@ import '../../retrofit/data/base_data.dart';
import '../../retrofit/data/business_goods.dart'; import '../../retrofit/data/business_goods.dart';
import '../../utils/business_instance.dart'; import '../../utils/business_instance.dart';
import '../../utils/flutter_utils.dart'; import '../../utils/flutter_utils.dart';
import '../../view_widget/border_text.dart';
import '../../view_widget/custom_image.dart'; import '../../view_widget/custom_image.dart';
import '../../view_widget/my_appbar.dart'; import '../../view_widget/my_appbar.dart';
import '../../view_widget/my_footer.dart'; import '../../view_widget/my_footer.dart';
import '../../view_widget/no_data_view.dart'; import '../../view_widget/no_data_view.dart';
import '../../view_widget/round_button.dart';
class GoodsSearchPage extends StatefulWidget { class GoodsSearchPage extends StatefulWidget {
final Map<String, dynamic> arguments; final Map<String, dynamic> arguments;
@ -398,7 +400,7 @@ class _GoodsSearchPage extends State<GoodsSearchPage>
GestureDetector( GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: () { onTap: () {
queryGoodsUpdate(adminProductVoList.id ?? ""); showGoodsStateDialog(adminProductVoList.id ?? "");
}, },
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
@ -429,6 +431,82 @@ class _GoodsSearchPage extends State<GoodsSearchPage>
); );
} }
///
showGoodsStateDialog(productIds) {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
content: Container(
width: MediaQuery.of(context).size.width - 84,
height: 139.h,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
"选中数据将被${widget.arguments["onSaleStatus"] == "1" ? "下架" : "上架"}, 是否继续?",
style: TextStyle(
color: Color(0xFFF4524D),
fontSize: 16.sp,
fontWeight: MyFontWeight.regular,
),
),
SizedBox(
height: 35.h,
),
Row(
children: [
Expanded(
child: InkWell(
child: BorderText(
text: S.of(context).quxiao,
textColor: Color(0xFF30415B),
fontSize: 16.sp,
fontWeight: FontWeight.bold,
borderColor: Color(0xFF30415B),
radius: 4,
padding: EdgeInsets.all(12),
borderWidth: 1,
),
onTap: () {
Navigator.of(context).pop();
},
),
flex: 1,
),
SizedBox(
width: 16.w,
),
Expanded(
child: InkWell(
child: RoundButton(
text: S.of(context).queren,
textColor: Colors.white,
radius: 4,
padding: EdgeInsets.all(12),
backgroup: Color(0xFF30415B),
fontSize: 16.sp,
fontWeight: FontWeight.bold,
),
onTap: () {
Navigator.of(context).pop();
queryGoodsUpdate(productIds ?? "");
},
),
flex: 1,
),
],
)
],
),
),
);
},
);
}
Widget searchGoodsItemSm() { Widget searchGoodsItemSm() {
return Container( return Container(
decoration: BoxDecoration( decoration: BoxDecoration(

241
lib/business_system/goods/off_shelf/off_shelf_page.dart

@ -41,6 +41,7 @@ class _OffShelfPage extends State<OffShelfPage> {
List<AdminProductVoList> adminProductVoList = []; List<AdminProductVoList> adminProductVoList = [];
String networkError = ""; String networkError = "";
int networkStatus = 0; int networkStatus = 0;
int dialogIndex = 0;
@override @override
void dispose() { void dispose() {
@ -200,65 +201,70 @@ class _OffShelfPage extends State<OffShelfPage> {
), ),
), ),
Expanded( Expanded(
child: networkStatus == -1?noNetwork():Container( child: networkStatus == -1
child: SmartRefresher( ? noNetwork()
controller: _refreshController, : Container(
enablePullDown: true, child: SmartRefresher(
enablePullUp: true, controller: _refreshController,
header: MyHeader( enablePullDown: true,
color: Color(0xFF30415B), enablePullUp: true,
), header: MyHeader(
physics: BouncingScrollPhysics(), color: Color(0xFF30415B),
footer: CustomFooter( ),
builder: (context, mode) { physics: BouncingScrollPhysics(),
return MyFooter(mode); footer: CustomFooter(
}, builder: (context, mode) {
return MyFooter(mode);
},
),
onRefresh: () {
_pageIndex = 1;
adminProductVoList.clear();
_onRefresh(isShowLoad: false);
},
onLoading: () {
_pageIndex++;
_onRefresh(isShowLoad: false);
},
child: Container(
color: Colors.white,
child: networkStatus == 0
? ListView.builder(
itemCount: 10,
physics: BouncingScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {},
child: shelfGoodsItemSm(),
);
},
)
: ((adminProductVoList == null ||
adminProductVoList.length == 0)
? NoDataView(
src:
"assets/image/bs_no data_logo.webp",
isShowBtn: false,
text: "暂无下架商品",
fontSize: 16.sp,
margin: EdgeInsets.all(20.h),
)
: ListView.builder(
itemCount:
adminProductVoList?.length ?? 0,
physics: BouncingScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {},
child: shelfGoodsItem(
adminProductVoList[
position]),
);
},
)))),
), ),
onRefresh: () {
_pageIndex = 1;
adminProductVoList.clear();
_onRefresh(isShowLoad: false);
},
onLoading: () {
_pageIndex++;
_onRefresh(isShowLoad: false);
},
child: Container(
color: Colors.white,
child: networkStatus == 0 ?ListView.builder(
itemCount:10,
physics: BouncingScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {},
child: shelfGoodsItemSm(),
);
},
):
((adminProductVoList == null ||
adminProductVoList.length == 0)
? NoDataView(
src: "assets/image/bs_no data_logo.webp",
isShowBtn: false,
text: "暂无下架商品",
fontSize: 16.sp,
margin: EdgeInsets.all(20.h),
)
: ListView.builder(
itemCount: adminProductVoList?.length ?? 0,
physics: BouncingScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {},
child: shelfGoodsItem(
adminProductVoList[position]),
);
},
))
)),
),
), ),
SizedBox( SizedBox(
height: 60.h, height: 60.h,
@ -273,15 +279,14 @@ class _OffShelfPage extends State<OffShelfPage> {
onTap: () { onTap: () {
List<dynamic> productIds = []; List<dynamic> productIds = [];
adminProductVoList.forEach((element) { adminProductVoList.forEach((element) {
if (element.isSelect) if (element.isSelect) productIds.add(element.id);
productIds.add(element.id);
}); });
if (productIds.length == 0) { if (productIds.length == 0) {
SmartDialog.showToast("请选择要上架的商品", SmartDialog.showToast("请选择要上架的商品",
alignment: Alignment.center); alignment: Alignment.center);
return; return;
} else { } else {
queryGoodsUpdate(productIds); showDelGoodsDialog(productIds, 1);
} }
}, },
child: Container( child: Container(
@ -308,15 +313,14 @@ class _OffShelfPage extends State<OffShelfPage> {
onTap: () { onTap: () {
List<dynamic> productIds = []; List<dynamic> productIds = [];
adminProductVoList.forEach((element) { adminProductVoList.forEach((element) {
if (element.isSelect) if (element.isSelect) productIds.add(element.id);
productIds.add(element.id);
}); });
if (productIds.length == 0) { if (productIds.length == 0) {
SmartDialog.showToast("请选择要删除的商品", SmartDialog.showToast("请选择要删除的商品",
alignment: Alignment.center); alignment: Alignment.center);
return; return;
} else { } else {
showDelGoodsDialog(productIds); showDelGoodsDialog(productIds, 2);
} }
}, },
child: Container( child: Container(
@ -389,8 +393,8 @@ class _OffShelfPage extends State<OffShelfPage> {
); );
} }
/// ////
showDelGoodsDialog(productIds) { showDelGoodsDialog(productIds, index) {
showDialog( showDialog(
context: context, context: context,
builder: (context) { builder: (context) {
@ -403,7 +407,7 @@ class _OffShelfPage extends State<OffShelfPage> {
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Text( Text(
"选中数据将被永久删除, 是否继续?", "选中数据将被${index == 1 ? "上架" : "永久删除"}, 是否继续?",
style: TextStyle( style: TextStyle(
color: Color(0xFFF4524D), color: Color(0xFFF4524D),
fontSize: 16.sp, fontSize: 16.sp,
@ -449,7 +453,10 @@ class _OffShelfPage extends State<OffShelfPage> {
), ),
onTap: () { onTap: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
queryDelProduct(productIds); if (index == 1)
queryGoodsUpdate(productIds);
else
queryDelProduct(productIds);
}, },
), ),
flex: 1, flex: 1,
@ -608,56 +615,39 @@ class _OffShelfPage extends State<OffShelfPage> {
), ),
Expanded( Expanded(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Padding( Padding(
padding: EdgeInsets.only(bottom: 11.h, top: 2.h), padding: EdgeInsets.only(bottom: 11.h, top: 2.h),
child: Shimmer.fromColors( child: Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8), baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8), highlightColor: Color(0XFFD8D8D8),
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color(0XFFD8D8D8), color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2), borderRadius: BorderRadius.circular(2),
),
width: 112.w,
height: 20.h,
),
), ),
width: 112.w,
height: 20.h,
), ),
Row( ),
children: [ ),
Shimmer.fromColors( Row(
baseColor: Color(0XFFD8D8D8), children: [
highlightColor: Color(0XFFD8D8D8), Shimmer.fromColors(
child: Container( baseColor: Color(0XFFD8D8D8),
decoration: BoxDecoration( highlightColor: Color(0XFFD8D8D8),
color: Color(0XFFD8D8D8), child: Container(
borderRadius: BorderRadius.circular(2), decoration: BoxDecoration(
), color: Color(0XFFD8D8D8),
width: 43.w, borderRadius: BorderRadius.circular(2),
height: 18.h,
),
),
SizedBox(
width: 8.w,
),
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 43.w,
height: 18.h,
),
), ),
], width: 43.w,
height: 18.h,
),
), ),
SizedBox( SizedBox(
height: 7.h, width: 8.w,
), ),
Shimmer.fromColors( Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8), baseColor: Color(0XFFD8D8D8),
@ -667,12 +657,29 @@ class _OffShelfPage extends State<OffShelfPage> {
color: Color(0XFFD8D8D8), color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2), borderRadius: BorderRadius.circular(2),
), ),
width: 28.w, width: 43.w,
height: 20.h, height: 18.h,
), ),
), ),
], ],
)), ),
SizedBox(
height: 7.h,
),
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 28.w,
height: 20.h,
),
),
],
)),
], ],
), ),
); );
@ -685,7 +692,7 @@ class _OffShelfPage extends State<OffShelfPage> {
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Text( Text(
networkError.substring(0,4), networkError.substring(0, 4),
style: TextStyle( style: TextStyle(
fontSize: 14.sp, fontSize: 14.sp,
color: Color(0xFF0D0D0D), color: Color(0xFF0D0D0D),

79
lib/business_system/goods/on_sale/batch_shelf.dart

@ -16,10 +16,12 @@ import '../../../retrofit/data/product_group_list.dart';
import '../../../utils/business_instance.dart'; import '../../../utils/business_instance.dart';
import '../../../utils/flutter_utils.dart'; import '../../../utils/flutter_utils.dart';
import '../../../utils/font_weight.dart'; import '../../../utils/font_weight.dart';
import '../../../view_widget/border_text.dart';
import '../../../view_widget/classic_header.dart'; import '../../../view_widget/classic_header.dart';
import '../../../view_widget/custom_image.dart'; import '../../../view_widget/custom_image.dart';
import '../../../view_widget/my_footer.dart'; import '../../../view_widget/my_footer.dart';
import '../../../view_widget/no_data_view.dart'; import '../../../view_widget/no_data_view.dart';
import '../../../view_widget/round_button.dart';
class BatchShelf extends StatefulWidget { class BatchShelf extends StatefulWidget {
final Map<String, dynamic> arguments; final Map<String, dynamic> arguments;
@ -207,7 +209,7 @@ class _BatchShelf extends State<BatchShelf> {
alignment: Alignment.center); alignment: Alignment.center);
return; return;
} else { } else {
queryGoodsUpdate(); showGoodsStateDialog();
} }
}, },
child: Container( child: Container(
@ -325,6 +327,81 @@ class _BatchShelf extends State<BatchShelf> {
); );
} }
///
showGoodsStateDialog() {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
content: Container(
width: MediaQuery.of(context).size.width - 84,
height: 139.h,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
"选中数据将被下架, 是否继续?",
style: TextStyle(
color: Color(0xFFF4524D),
fontSize: 16.sp,
fontWeight: MyFontWeight.regular,
),
),
SizedBox(
height: 35.h,
),
Row(
children: [
Expanded(
child: InkWell(
child: BorderText(
text: S.of(context).quxiao,
textColor: Color(0xFF30415B),
fontSize: 16.sp,
fontWeight: FontWeight.bold,
borderColor: Color(0xFF30415B),
radius: 4,
padding: EdgeInsets.all(12),
borderWidth: 1,
),
onTap: () {
Navigator.of(context).pop();
},
),
flex: 1,
),
SizedBox(
width: 16.w,
),
Expanded(
child: InkWell(
child: RoundButton(
text: S.of(context).queren,
textColor: Colors.white,
radius: 4,
padding: EdgeInsets.all(12),
backgroup: Color(0xFF30415B),
fontSize: 16.sp,
fontWeight: FontWeight.bold,
),
onTap: () {
Navigator.of(context).pop();
queryGoodsUpdate();
},
),
flex: 1,
),
],
)
],
),
),
);
},
);
}
///list ///list
Widget shelfLeftItem(Records records, index){ Widget shelfLeftItem(Records records, index){
return Container( return Container(

78
lib/business_system/goods/on_sale/on_sale_page.dart

@ -18,8 +18,10 @@ import '../../../retrofit/data/product_group_list.dart';
import '../../../utils/business_instance.dart'; import '../../../utils/business_instance.dart';
import '../../../utils/flutter_utils.dart'; import '../../../utils/flutter_utils.dart';
import '../../../utils/font_weight.dart'; import '../../../utils/font_weight.dart';
import '../../../view_widget/border_text.dart';
import '../../../view_widget/custom_image.dart'; import '../../../view_widget/custom_image.dart';
import '../../../view_widget/no_data_view.dart'; import '../../../view_widget/no_data_view.dart';
import '../../../view_widget/round_button.dart';
class OnSalePage extends StatefulWidget { class OnSalePage extends StatefulWidget {
final String storeId; final String storeId;
@ -600,7 +602,7 @@ class _OnSalePage extends State<OnSalePage> {
)), )),
GestureDetector( GestureDetector(
onTap: () { onTap: () {
queryGoodsUpdate(adminProductVoList.id ?? ""); showOffShelfDialog(adminProductVoList.id ?? "");
}, },
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
@ -632,6 +634,80 @@ class _OnSalePage extends State<OnSalePage> {
); );
} }
showOffShelfDialog(productIds) {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
content: Container(
width: MediaQuery.of(context).size.width - 84,
height: 139.h,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
"选中数据将被下架, 是否继续?",
style: TextStyle(
color: Color(0xFFF4524D),
fontSize: 16.sp,
fontWeight: MyFontWeight.regular,
),
),
SizedBox(
height: 35.h,
),
Row(
children: [
Expanded(
child: InkWell(
child: BorderText(
text: S.of(context).quxiao,
textColor: Color(0xFF30415B),
fontSize: 16.sp,
fontWeight: FontWeight.bold,
borderColor: Color(0xFF30415B),
radius: 4,
padding: EdgeInsets.all(12),
borderWidth: 1,
),
onTap: () {
Navigator.of(context).pop();
},
),
flex: 1,
),
SizedBox(
width: 16.w,
),
Expanded(
child: InkWell(
child: RoundButton(
text: S.of(context).queren,
textColor: Colors.white,
radius: 4,
padding: EdgeInsets.all(12),
backgroup: Color(0xFF30415B),
fontSize: 16.sp,
fontWeight: FontWeight.bold,
),
onTap: () {
Navigator.of(context).pop();
queryGoodsUpdate(productIds ?? "");
},
),
flex: 1,
),
],
)
],
),
),
);
},
);
}
Widget leftItemSm() { Widget leftItemSm() {
return Container( return Container(
alignment: Alignment.center, alignment: Alignment.center,

118
lib/business_system/home/business_home_page.dart

@ -73,20 +73,22 @@ class _BusinessHomePage extends State<BusinessHomePage>
super.dispose(); super.dispose();
} }
_onRefresh({int index,isLoading = true}) async { _onRefresh({int index, isLoading = true}) async {
if(isLoading) if (isLoading)
EasyLoading.show( EasyLoading.show(
status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black); status: S.current.zhengzaijiazai,
maskType: EasyLoadingMaskType.black);
SharedPreferences.getInstance().then((value) { SharedPreferences.getInstance().then((value) {
businessService = BusinessApiService(Dio(), businessService = BusinessApiService(Dio(),
context: context, context: context,
token: BusinessInstance.instance.businessToken, token: BusinessInstance.instance.businessToken,
tenant: BusinessInstance.instance.businessTenant, tenant: BusinessInstance.instance.businessTenant,
storeId: widget.businessLoginInfo.storeList[index??widget.selectStoreIndex] storeId: widget.businessLoginInfo
.name == .storeList[index ?? widget.selectStoreIndex].name ==
"所有门店" "所有门店"
? "0" ? "0"
: widget.businessLoginInfo.storeList[index??widget.selectStoreIndex].id); : widget.businessLoginInfo
.storeList[index ?? widget.selectStoreIndex].id);
queryDayAmount(); queryDayAmount();
queryPopularList(isSing: false); queryPopularList(isSing: false);
queryOrderTrend(); queryOrderTrend();
@ -218,7 +220,7 @@ class _BusinessHomePage extends State<BusinessHomePage>
return MyFooter(mode); return MyFooter(mode);
}, },
), ),
onRefresh:(){ onRefresh: () {
_onRefresh(isLoading: false); _onRefresh(isLoading: false);
}, },
child: SingleChildScrollView( child: SingleChildScrollView(
@ -291,6 +293,20 @@ class _BusinessHomePage extends State<BusinessHomePage>
], ],
), ),
)), )),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
showIdentitySwitchDialog();
},
child: Container(
padding: EdgeInsets.symmetric(horizontal: 10.w),
child: Image.asset(
"assets/image/bs_user_switch.webp",
width: 25.h,
height: 25.h,
color: Colors.white,
),
)),
GestureDetector( GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: () { onTap: () {
@ -313,7 +329,7 @@ class _BusinessHomePage extends State<BusinessHomePage>
], ],
), ),
Container( Container(
margin: EdgeInsets.only(top:14.h), margin: EdgeInsets.only(top: 14.h),
padding: EdgeInsets.symmetric(vertical: 12.h), padding: EdgeInsets.symmetric(vertical: 12.h),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
@ -508,6 +524,90 @@ class _BusinessHomePage extends State<BusinessHomePage>
} }
} }
///
showIdentitySwitchDialog() async {
SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
showDialog(
context: context,
builder: (context) {
return AlertDialog(
content: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
sharedPreferences.setString('identitySwitch', "1");
Navigator.of(context).pop();
},
child: Padding(
padding: EdgeInsets.only(top: 10.h, bottom: 10.h),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
"assets/image/bs_shop_logo.webp",
width: 28.h,
height: 28.h,
color: Color(0xFF30415B),
),
SizedBox(
width: 10.w,
),
Text(
"商家端",
style: TextStyle(
color: Color(0xFF0D0D0D),
fontSize: 15.sp,
fontWeight: MyFontWeight.bold,
),
),
],
),
),
),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
sharedPreferences.setString('identitySwitch', "2");
Navigator.of(context).pushNamedAndRemoveUntil(
'/router/main_page',
(route) => false,
);
},
child: Padding(
padding: EdgeInsets.only(top: 10.h, bottom: 10.h),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
Icons.person,
size: 28.sp,
color: Color(0xFF30415B),
),
SizedBox(
width: 10.w,
),
Text(
"用户端",
style: TextStyle(
color: Color(0xFF0D0D0D),
fontSize: 15.sp,
fontWeight: MyFontWeight.bold,
),
),
],
),
))
],
),
);
},
);
}
/// ///
Widget tradeOverview() { Widget tradeOverview() {
return Container( return Container(

4
lib/business_system/home/home_view/home_sideslip_dialog.dart

@ -184,7 +184,9 @@ class _HomeSideslipDialog extends State<HomeSideslipDialog>
SharedPreferences.getInstance().then((value) { SharedPreferences.getInstance().then((value) {
value.setString("account", ""); value.setString("account", "");
value.setString("password", ""); value.setString("password", "");
Navigator.of(context).pop(-1); // Navigator.of(context).pop(-1);
Navigator.of(context)
.pushNamedAndRemoveUntil('/router/main_page',(route) => false,);
}); });
}, },
child: Container( child: Container(

3
lib/business_system/home/select_shop.dart

@ -41,7 +41,8 @@ class _SelectShop extends State<SelectShop> {
appBar: MyAppBar( appBar: MyAppBar(
title: "选择门店", title: "选择门店",
titleColor: Colors.black, titleColor: Colors.black,
leadingColor: Colors.black, leading: (widget.arguments["routeSource"] == "门店设置")?true:false,
leadingColor: Colors.black,
brightness: Brightness.dark, brightness: Brightness.dark,
), ),
body: SmartRefresher( body: SmartRefresher(

21
lib/business_system/login/business_login_page.dart

@ -100,17 +100,16 @@ class _BusinessLoginPage extends State<BusinessLoginPage> {
BusinessInstance.instance.businessToken = businessLoginInfo.token; BusinessInstance.instance.businessToken = businessLoginInfo.token;
sharedPreferences.setString('account', _userPhoneController.text); sharedPreferences.setString('account', _userPhoneController.text);
sharedPreferences.setString('password', _passwordController.text); sharedPreferences.setString('password', _passwordController.text);
sharedPreferences.setString('identitySwitch', "1");
if (businessLoginInfo.storeList.length > 1) { if (businessLoginInfo.storeList.length > 1) {
Navigator.of(context) Navigator.of(context)
.pushReplacementNamed('/router/select_shop', arguments: { .popAndPushNamed('/router/select_shop', arguments: {
"businessLoginInfo": businessLoginInfo, "businessLoginInfo": businessLoginInfo,
"routeSource":"登录", "routeSource":"登录",
}); });
} else { } else {
Navigator.of(context) Navigator.of(context)
.pushReplacementNamed('/router/business_page', arguments: { .popAndPushNamed('/router/business_page', arguments: {"businessLoginInfo": businessLoginInfo});
"businessLoginInfo": businessLoginInfo,
});
} }
} else { } else {
if (baseData.msg != null) if (baseData.msg != null)
@ -166,7 +165,7 @@ class _BusinessLoginPage extends State<BusinessLoginPage> {
height: 15.h, height: 15.h,
), ),
SizedBox(width: 4.w), SizedBox(width: 4.w),
Text("手机号码", Text("手机号码/用户名",
style: TextStyle( style: TextStyle(
fontSize: 14.sp, fontSize: 14.sp,
color: Color(0xD9000000), color: Color(0xD9000000),
@ -177,13 +176,13 @@ class _BusinessLoginPage extends State<BusinessLoginPage> {
margin: EdgeInsets.only(top: 13.h, bottom: 24.h), margin: EdgeInsets.only(top: 13.h, bottom: 24.h),
child: TextField( child: TextField(
controller: _userPhoneController, controller: _userPhoneController,
keyboardType: TextInputType.phone, keyboardType: TextInputType.text,
style: TextStyle( style: TextStyle(
fontSize: 14.sp, fontSize: 14.sp,
color: Color(0xFF000000), color: Color(0xFF000000),
fontWeight: MyFontWeight.regular), fontWeight: MyFontWeight.regular),
decoration: InputDecoration( decoration: InputDecoration(
hintText: "请输入手机号码", hintText: "请输入手机号码或用户名",
hintStyle: TextStyle( hintStyle: TextStyle(
fontSize: 14.sp, fontSize: 14.sp,
color: Color(0xFF262626), color: Color(0xFF262626),
@ -204,9 +203,9 @@ class _BusinessLoginPage extends State<BusinessLoginPage> {
} }
refresh(); refresh();
}, },
inputFormatters: [ // inputFormatters: [
LengthLimitingTextInputFormatter(11) // LengthLimitingTextInputFormatter(11)
], // ],
), ),
), ),
Row( Row(
@ -228,7 +227,7 @@ class _BusinessLoginPage extends State<BusinessLoginPage> {
margin: EdgeInsets.only(top: 12.h, bottom: 75.h), margin: EdgeInsets.only(top: 12.h, bottom: 75.h),
child: TextField( child: TextField(
controller: _passwordController, controller: _passwordController,
keyboardType: TextInputType.phone, keyboardType: TextInputType.text,
style: TextStyle( style: TextStyle(
fontSize: 14.sp, fontSize: 14.sp,
color: Color(0xFF000000), color: Color(0xFF000000),

53
lib/login/new_login_page.dart

@ -25,7 +25,10 @@ import 'package:shared_preferences/shared_preferences.dart';
import 'package:sharesdk_plugin/sharesdk_interface.dart'; import 'package:sharesdk_plugin/sharesdk_interface.dart';
import '../main.dart'; import '../main.dart';
import '../retrofit/business_api.dart';
import '../retrofit/data/business_login_info.dart';
import '../retrofit/data/channels_list.dart'; import '../retrofit/data/channels_list.dart';
import '../utils/business_instance.dart';
import 'captcha/block_puzzle_captcha.dart'; import 'captcha/block_puzzle_captcha.dart';
class NewLoginPage extends StatefulWidget { class NewLoginPage extends StatefulWidget {
@ -260,7 +263,6 @@ class _NewLoginPage extends State<NewLoginPage> {
isLogin() async { isLogin() async {
SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
if (sharedPreferences.getBool("isShowPrivacyPolicy") == null || if (sharedPreferences.getBool("isShowPrivacyPolicy") == null ||
!sharedPreferences.getBool("isShowPrivacyPolicy")) { !sharedPreferences.getBool("isShowPrivacyPolicy")) {
showAlertDialog(); showAlertDialog();
@ -271,7 +273,14 @@ class _NewLoginPage extends State<NewLoginPage> {
sharedPreferences.getString("token") != "") { sharedPreferences.getString("token") != "") {
ExamineInstance.instance.isExamine = ExamineInstance.instance.isExamine =
sharedPreferences.getString("mobile") == "13800138000"; sharedPreferences.getString("mobile") == "13800138000";
Navigator.of(context).popAndPushNamed('/router/main_page'); if (sharedPreferences.getString("identitySwitch") == null || sharedPreferences.getString("identitySwitch") == "2" || (sharedPreferences.getString("account")== "" ||
sharedPreferences.getString("password")== "")) {
Navigator.of(context)
.popAndPushNamed('/router/main_page');
} else {
businessLogin(sharedPreferences.getString("account"),
sharedPreferences.getString("password"));
}
} else { } else {
apiService = ApiService(Dio(), context: context); apiService = ApiService(Dio(), context: context);
initController(); initController();
@ -280,6 +289,46 @@ class _NewLoginPage extends State<NewLoginPage> {
} }
} }
businessLogin(account, password) async {
var param = {
"grantType": "password",
"account": account,
"password": password,
};
EasyLoading.show(
status: S.of(context).zhengzaijiazai,
maskType: EasyLoadingMaskType.black);
BusinessApiService businessService =
BusinessApiService(Dio(), context: context);
BaseData baseData =
await businessService.annoToken(param).catchError((error) {
print(error.message);
});
if (baseData != null && baseData.isSuccess) {
var businessLoginInfo = BusinessLoginInfo.fromJson(baseData.data);
if(businessLoginInfo.storeList.length > 1) {
businessLoginInfo.storeList.insert(0, StoreList(name: "所有门店"));
}
BusinessInstance.instance.businessTenant = businessLoginInfo.tenantCode;
BusinessInstance.instance.businessToken = businessLoginInfo.token;
if (businessLoginInfo.storeList.length > 1) {
Navigator.of(context)
.popAndPushNamed('/router/select_shop', arguments: {
"businessLoginInfo": businessLoginInfo,
});
} else {
Navigator.of(context)
.popAndPushNamed('/router/business_page', arguments: {
"businessLoginInfo": businessLoginInfo,
});
}
} else {
Navigator.of(context).popAndPushNamed('/router/business_login_page');
}
EasyLoading.dismiss();
}
@override @override
void dispose() { void dispose() {
if (_timer != null && _timer.isActive) _timer.cancel(); if (_timer != null && _timer.isActive) _timer.cancel();

13
lib/mine/mine_view/mine_item.dart

@ -13,6 +13,7 @@ import 'package:url_launcher/url_launcher.dart';
import '../../retrofit/business_api.dart'; import '../../retrofit/business_api.dart';
import '../../retrofit/data/base_data.dart'; import '../../retrofit/data/base_data.dart';
import '../../retrofit/data/business_login_info.dart'; import '../../retrofit/data/business_login_info.dart';
import '../../retrofit/data/examine_instance.dart';
import '../../utils/business_instance.dart'; import '../../utils/business_instance.dart';
class MineItem extends StatefulWidget { class MineItem extends StatefulWidget {
@ -26,6 +27,7 @@ class _MineItem extends State<MineItem> {
var isShowMore = false; var isShowMore = false;
login(account, password) async { login(account, password) async {
SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
var param = { var param = {
"grantType": "password", "grantType": "password",
"account": account, "account": account,
@ -48,14 +50,15 @@ class _MineItem extends State<MineItem> {
} }
BusinessInstance.instance.businessTenant = businessLoginInfo.tenantCode; BusinessInstance.instance.businessTenant = businessLoginInfo.tenantCode;
BusinessInstance.instance.businessToken = businessLoginInfo.token; BusinessInstance.instance.businessToken = businessLoginInfo.token;
sharedPreferences.setString('identitySwitch', "1");
if (businessLoginInfo.storeList.length > 1) { if (businessLoginInfo.storeList.length > 1) {
Navigator.of(context) Navigator.of(context)
.pushNamed('/router/select_shop', arguments: { .popAndPushNamed('/router/select_shop', arguments: {
"businessLoginInfo": businessLoginInfo, "businessLoginInfo": businessLoginInfo,
}); });
} else { } else {
Navigator.of(context) Navigator.of(context)
.pushNamed('/router/business_page', arguments: { .popAndPushNamed('/router/business_page', arguments: {
"businessLoginInfo": businessLoginInfo, "businessLoginInfo": businessLoginInfo,
}); });
} }
@ -69,7 +72,6 @@ class _MineItem extends State<MineItem> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
margin: EdgeInsets.fromLTRB(16.w, 0.h, 16.w, 30.h), margin: EdgeInsets.fromLTRB(16.w, 0.h, 16.w, 30.h),
// padding: EdgeInsets.fromLTRB(20.w, 12.h, 20.w, 12.h),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
@ -350,13 +352,12 @@ class _MineItem extends State<MineItem> {
/// ///
Expanded( Expanded(
child: InkWell( child: ExamineInstance.instance.isExamine ? Container():InkWell(
onTap: () { onTap: () {
SharedPreferences.getInstance().then((value) { SharedPreferences.getInstance().then((value) {
if (value.getString("account") == "" || if (value.getString("account") == "" ||
value.getString("password") == "") { value.getString("password") == "") {
Navigator.of(context) Navigator.of(context).pushNamed('/router/business_login_page');
.pushNamed('/router/business_login_page');
} else { } else {
login(value.getString("account"), login(value.getString("account"),
value.getString("password")); value.getString("password"));

289
lib/settlement/settlement.dart

@ -140,7 +140,9 @@ class _Settlement extends State<Settlement> {
storeId: storeId, storeId: storeId,
showLoading: false); showLoading: false);
queryMemberInfo(); queryMemberInfo();
if (widget.arguments["pid"] != null && widget.arguments["pid"] != "" && tableId <= 0) { if (widget.arguments["pid"] != null &&
widget.arguments["pid"] != "" &&
tableId <= 0) {
queryOrderInfo( queryOrderInfo(
address != null ? address.id : null, address != null ? address.id : null,
((storeInfo?.pickupType?.dineInTakeStatus ?? false) == true && ((storeInfo?.pickupType?.dineInTakeStatus ?? false) == true &&
@ -161,7 +163,9 @@ class _Settlement extends State<Settlement> {
count1, count1,
payChannel, payChannel,
tableId); tableId);
} else if ( widget.arguments["cid"] != null && widget.arguments["cid"] != "" && tableId <= 0) { } else if (widget.arguments["cid"] != null &&
widget.arguments["cid"] != "" &&
tableId <= 0) {
queryOrderInfo( queryOrderInfo(
address != null ? address.id : null, address != null ? address.id : null,
((storeInfo?.pickupType?.dineInTakeStatus ?? false) == true && ((storeInfo?.pickupType?.dineInTakeStatus ?? false) == true &&
@ -170,7 +174,7 @@ class _Settlement extends State<Settlement> {
selectedBtn != 2) selectedBtn != 2)
? diningStatus ? diningStatus
: selectedBtn, : selectedBtn,
widget.arguments["cid"]??0, widget.arguments["cid"] ?? 0,
0, 0,
productId ?? 0, productId ?? 0,
productSkuId ?? "", productSkuId ?? "",
@ -228,7 +232,9 @@ class _Settlement extends State<Settlement> {
payChannel, payChannel,
tableId) async { tableId) async {
try { try {
EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black); EasyLoading.show(
status: S.current.zhengzaijiazai,
maskType: EasyLoadingMaskType.black);
BaseData<SettleOrderInfo> baseData = await minService.getOrderInfo({ BaseData<SettleOrderInfo> baseData = await minService.getOrderInfo({
"addressId": addressId, "addressId": addressId,
@ -329,7 +335,8 @@ class _Settlement extends State<Settlement> {
/// ///
queryOrderDetails(id) async { queryOrderDetails(id) async {
EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black); EasyLoading.show(
status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black);
BaseData<MinOrderInfo> baseData = await minService.getOrderDetails({ BaseData<MinOrderInfo> baseData = await minService.getOrderDetails({
"id": pageType != null ? widget.arguments["orderId"] : id ?? parentId, "id": pageType != null ? widget.arguments["orderId"] : id ?? parentId,
}).catchError((error) {}); }).catchError((error) {});
@ -557,129 +564,141 @@ class _Settlement extends State<Settlement> {
/// ///
queryPlaceOrderFirst() async { queryPlaceOrderFirst() async {
// for (int i = 0; i < settleOrderInfo.orderProductList.length; i++) { try {
// settleOrderInfo.orderProductList.forEach((element1) { EasyLoading.show(
// if (settleOrderInfo.orderProductList[i].productId == status: S.current.zhengzaijiazai,
// element1.productId) { maskType: EasyLoadingMaskType.black);
// settleOrderInfo.orderProductList[i].skuId = element1.skuId; // for (int i = 0; i < settleOrderInfo.orderProductList.length; i++) {
// } // settleOrderInfo.orderProductList.forEach((element1) {
// }); // if (settleOrderInfo.orderProductList[i].productId ==
// } // element1.productId) {
// settleOrderInfo.orderProductList[i].skuId = element1.skuId;
placeOrderFirst = PlaceOrderFirst(); // }
placeOrderFirst.cartNum = settleOrderInfo.orderNum; // });
placeOrderFirst.cartSum = settleOrderInfo.price; // }
placeOrderFirst.addressId = address == null ? null : address.id;
placeOrderFirst.isSubscribe =
((subscribeParam?.isEnableSubscribe ?? false) == true)
? true
: false; //
placeOrderFirst.isTakeOut =
((storeInfo?.pickupType?.dineInTakeStatus ?? false) == true &&
(subscribeParam?.isEnableSubscribe ?? false) == false &&
selectedBtn != 1 &&
selectedBtn != 2)
? diningStatus
: selectedBtn;
placeOrderFirst.notes = remakers +
(reservationTime ?? "") +
((subscribeParam?.isEnableSubscribe ?? false) == true
? "预约门店:${((subscribeParam?.stores?.length ?? 0) == 1 ? (subscribeParam.stores[0]) : (subscribeStoresName ?? ""))}"
: "");
placeOrderFirst.numberOfPeople = "$numberOfPeople";
placeOrderFirst.orderSource = 2;
placeOrderFirst.orderType = "0";
placeOrderFirst.orderTypeId = 0;
placeOrderFirst.parentCode = parentCode; //
placeOrderFirst.parentId = parentId; //
placeOrderFirst.payChannel = ((placeOrderFirst.cartSum == "0.00")
? payChannel = 0
: ((tableId > 0
? (minOrderInfo?.isRaise ?? false)
: (settleOrderInfo?.isRaise ?? false))
? 7
: payChannel));
placeOrderFirst.promotionInfoDTO = PromotionInfoDTOBean();
placeOrderFirst.promotionInfoDTO.promotionId =
(promotion != null && tableId <= 0) ? promotion.id : "";
// : widget.arguments["pid"] ?? "";
placeOrderFirst.promotionInfoDTO.couponId =
(couponListBean != null && tableId <= 0) ? couponListBean.id : "";
// : widget.arguments["cid"] ?? "";
// placeOrderFirst.promotionInfoDTO.useVipPrice = (settleOrderInfo.isRaise || payChannel == 5 || ((payChannel == 4 && (settleOrderInfo.usePlateMoney == false))) ) ? false : useVipPriceSelect;
// placeOrderFirst.promotionInfoDTO.useBenefit = (settleOrderInfo.isRaise || payChannel == 5 || ((payChannel == 4 && settleOrderInfo.usePlateMoney == false))) ? false : useBenefitSelect;
placeOrderFirst.promotionInfoDTO.discountType = (!placeOrder) ? "AUTO" :settleOrderInfo?.discountType ?? "";
placeOrderFirst.recMobile =
(mobile == null || mobile == "") ? mobile : storeInfo.headMobile;
placeOrderFirst.shoppingCartSkuItemList = settleOrderInfo.orderProductList;
placeOrderFirst.skuItemDTOList = [];
placeOrderFirst.source = 1;
placeOrderFirst.storeId = storeInfo.id;
placeOrderFirst.subcribeTime = subTime ?? ""; //
placeOrderFirst.tableId = "$tableId";
for (int i = 0;
i < (shopCarGoods?.shoppingCartSkuItemList?.length ?? 0);
i++) {
placeOrderFirst.shoppingCartSkuItemList[i].setMealDataList =
shopCarGoods.shoppingCartSkuItemList[i].setMealDataList;
}
if (tableId == 0) { placeOrderFirst = PlaceOrderFirst();
/// placeOrderFirst.cartNum = settleOrderInfo.orderNum;
BaseData<dynamic> baseData = await minService placeOrderFirst.cartSum = settleOrderInfo.price;
.placeOrderFirst(placeOrderFirst.toJson()) placeOrderFirst.addressId = address == null ? null : address.id;
.catchError((error) { placeOrderFirst.isSubscribe =
print("error: $error"); ((subscribeParam?.isEnableSubscribe ?? false) == true)
}); ? true
if (baseData != null && baseData.isSuccess) { : false; //
EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black); placeOrderFirst.isTakeOut =
placeOrder = true; ((storeInfo?.pickupType?.dineInTakeStatus ?? false) == true &&
this.downOrder = DownOrder.fromJson(baseData.data); (subscribeParam?.isEnableSubscribe ?? false) == false &&
querySettlement(); selectedBtn != 1 &&
} else { selectedBtn != 2)
// orderButton = false; ? diningStatus
SmartDialog.showToast(baseData?.msg, alignment: Alignment.center); : selectedBtn;
placeOrderFirst.notes = remakers +
(reservationTime ?? "") +
((subscribeParam?.isEnableSubscribe ?? false) == true
? "预约门店:${((subscribeParam?.stores?.length ?? 0) == 1 ? (subscribeParam.stores[0]) : (subscribeStoresName ?? ""))}"
: "");
placeOrderFirst.numberOfPeople = "$numberOfPeople";
placeOrderFirst.orderSource = 2;
placeOrderFirst.orderType = "0";
placeOrderFirst.orderTypeId = 0;
placeOrderFirst.parentCode = parentCode; //
placeOrderFirst.parentId = parentId; //
placeOrderFirst.payChannel = ((placeOrderFirst.cartSum == "0.00")
? payChannel = 0
: ((tableId > 0
? (minOrderInfo?.isRaise ?? false)
: (settleOrderInfo?.isRaise ?? false))
? 7
: payChannel));
placeOrderFirst.promotionInfoDTO = PromotionInfoDTOBean();
placeOrderFirst.promotionInfoDTO.promotionId =
(promotion != null && tableId <= 0) ? promotion.id : "";
// : widget.arguments["pid"] ?? "";
placeOrderFirst.promotionInfoDTO.couponId =
(couponListBean != null && tableId <= 0) ? couponListBean.id : "";
// : widget.arguments["cid"] ?? "";
// placeOrderFirst.promotionInfoDTO.useVipPrice = (settleOrderInfo.isRaise || payChannel == 5 || ((payChannel == 4 && (settleOrderInfo.usePlateMoney == false))) ) ? false : useVipPriceSelect;
// placeOrderFirst.promotionInfoDTO.useBenefit = (settleOrderInfo.isRaise || payChannel == 5 || ((payChannel == 4 && settleOrderInfo.usePlateMoney == false))) ? false : useBenefitSelect;
placeOrderFirst.promotionInfoDTO.discountType =
(!placeOrder) ? "AUTO" : settleOrderInfo?.discountType ?? "";
placeOrderFirst.recMobile =
(mobile == null || mobile == "") ? mobile : storeInfo.headMobile;
placeOrderFirst.shoppingCartSkuItemList =
settleOrderInfo.orderProductList;
placeOrderFirst.skuItemDTOList = [];
placeOrderFirst.source = 1;
placeOrderFirst.storeId = storeInfo.id;
placeOrderFirst.subcribeTime = subTime ?? ""; //
placeOrderFirst.tableId = "$tableId";
for (int i = 0;
i < (shopCarGoods?.shoppingCartSkuItemList?.length ?? 0);
i++) {
placeOrderFirst.shoppingCartSkuItemList[i].setMealDataList =
shopCarGoods.shoppingCartSkuItemList[i].setMealDataList;
} }
} else {
/// if (tableId == 0) {
BaseData<dynamic> baseData; ///
if (placeOrder) { BaseData<dynamic> baseData = await minService
// .placeOrderFirst(placeOrderFirst.toJson())
querySettlement(); .catchError((error) {
return; print("error: $error");
} else { });
if (parentId == "") { if (baseData != null && baseData.isSuccess) {
// // EasyLoading.show(
baseData = await minService // status: S.current.zhengzaijiazai,
.placeOrderFirst(placeOrderFirst.toJson()) // maskType: EasyLoadingMaskType.black);
.catchError((error) { placeOrder = true;
print("error: $error"); this.downOrder = DownOrder.fromJson(baseData.data);
}); await querySettlement();
} else { } else {
// // orderButton = false;
baseData = await minService SmartDialog.showToast(baseData?.msg, alignment: Alignment.center);
.addOrder(placeOrderFirst.toJson())
.catchError((error) {
print("error: $error");
});
} }
}
// orderButton = false;
if (baseData != null && baseData.isSuccess) {
placeOrder = true;
this.downOrder = DownOrder.fromJson(baseData.data);
parentId = this.downOrder.id ?? this.downOrder.parentId;
queryOrderDetails(parentId);
setState(() {});
} else { } else {
///
BaseData<dynamic> baseData;
if (placeOrder) {
//
querySettlement();
return;
} else {
if (parentId == "") {
//
baseData = await minService
.placeOrderFirst(placeOrderFirst.toJson())
.catchError((error) {
print("error: $error");
});
} else {
//
baseData = await minService
.addOrder(placeOrderFirst.toJson())
.catchError((error) {
print("error: $error");
});
}
}
// orderButton = false; // orderButton = false;
SmartDialog.showToast(baseData?.msg, alignment: Alignment.center); if (baseData != null && baseData.isSuccess) {
placeOrder = true;
this.downOrder = DownOrder.fromJson(baseData.data);
parentId = this.downOrder.id ?? this.downOrder.parentId;
queryOrderDetails(parentId);
setState(() {});
} else {
// orderButton = false;
SmartDialog.showToast(baseData?.msg, alignment: Alignment.center);
}
} }
} finally {
// EasyLoading.dismiss();
} }
} }
/// ///
querySettlement() async { querySettlement() async {
try{
placeOrderFirst.id = ((parentId != "") ? parentId : downOrder.id); placeOrderFirst.id = ((parentId != "") ? parentId : downOrder.id);
placeOrderFirst.orderProductVOList = ((downOrder == null) placeOrderFirst.orderProductVOList = ((downOrder == null)
? minOrderInfo.orderProductVOList ? minOrderInfo.orderProductVOList
@ -716,10 +735,10 @@ class _Settlement extends State<Settlement> {
timeStamp: int.tryParse(wxPay.timeStamp), timeStamp: int.tryParse(wxPay.timeStamp),
sign: wxPay.sign, sign: wxPay.sign,
); );
}else{ } else {
EasyLoading.dismiss(); EasyLoading.dismiss();
SmartDialog.showToast(baseData.msg, alignment: Alignment.center); SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
Future.delayed(Duration(seconds:2), () { Future.delayed(Duration(seconds: 2), () {
toOrderDetails(placeOrderFirst.id); toOrderDetails(placeOrderFirst.id);
}); });
} }
@ -743,6 +762,8 @@ class _Settlement extends State<Settlement> {
text: "${baseData?.msg}", text: "${baseData?.msg}",
)); ));
} }
}}finally{
EasyLoading.dismiss();
} }
} }
@ -950,8 +971,10 @@ class _Settlement extends State<Settlement> {
/// ///
if ((settleOrderInfo != null || if ((settleOrderInfo != null ||
minOrderInfo != null) && (placeOrder && tableId <= 0 && minOrderInfo != null) &&
!(settleOrderInfo?.isRaise ?? false))) (placeOrder &&
tableId <= 0 &&
!(settleOrderInfo?.isRaise ?? false)))
VipDiscountsSelect( VipDiscountsSelect(
vipSelectCheck, vipSelectCheck,
settleOrderInfo, settleOrderInfo,
@ -1534,13 +1557,19 @@ class _Settlement extends State<Settlement> {
selectedBtn != 2) selectedBtn != 2)
? diningStatus ? diningStatus
: selectedBtn, : selectedBtn,
((couponBean?.id??0) == 0 && (promotion?.id ?? productId ?? 0) !=0) ? 0: couponBean?.id, ((couponBean?.id ?? 0) == 0 && (promotion?.id ?? productId ?? 0) != 0)
? 0
: couponBean?.id,
0, 0,
((couponBean?.id??0) == 0 && (promotion?.id ?? productId ?? 0) !=0) ? promotion?.id ?? productId :0, ((couponBean?.id ?? 0) == 0 && (promotion?.id ?? productId ?? 0) != 0)
? promotion?.id ?? productId
: 0,
productSkuId ?? "", productSkuId ?? "",
actProductId ?? "", actProductId ?? "",
actProductSkuId ?? "", actProductSkuId ?? "",
(couponBean?.id ?? 0) == 0 ? ((promotion?.id ?? productId ?? 0) !=0 ? "ACTIVITY":"AUTO") : "COUPON", (couponBean?.id ?? 0) == 0
? ((promotion?.id ?? productId ?? 0) != 0 ? "ACTIVITY" : "AUTO")
: "COUPON",
// useVipPriceSelect, // useVipPriceSelect,
// useBenefitSelect, // useBenefitSelect,
count1, count1,
@ -1574,13 +1603,21 @@ class _Settlement extends State<Settlement> {
selectedBtn != 2) selectedBtn != 2)
? diningStatus ? diningStatus
: selectedBtn, : selectedBtn,
(((pro?.id ?? 0) ?? (productId ?? 0)) == 0 && (couponListBean?.id ??0) != 0)?couponListBean?.id:0, (((pro?.id ?? 0) ?? (productId ?? 0)) == 0 &&
(couponListBean?.id ?? 0) != 0)
? couponListBean?.id
: 0,
0, 0,
(((pro?.id ?? 0) ?? (productId ?? 0)) == 0 && (couponListBean?.id ??0) != 0) ? 0 :((pro?.id ?? 0) ?? productId), (((pro?.id ?? 0) ?? (productId ?? 0)) == 0 &&
(couponListBean?.id ?? 0) != 0)
? 0
: ((pro?.id ?? 0) ?? productId),
productSkuId ?? "", productSkuId ?? "",
actProductId ?? "", actProductId ?? "",
actProductSkuId ?? "", actProductSkuId ?? "",
(((pro?.id ?? 0) ?? (productId ?? 0)) == 0 ? ((couponListBean?.id ??0) != 0 ? "COUPON":"AUTO") : "ACTIVITY"), (((pro?.id ?? 0) ?? (productId ?? 0)) == 0
? ((couponListBean?.id ?? 0) != 0 ? "COUPON" : "AUTO")
: "ACTIVITY"),
// useVipPriceSelect, // useVipPriceSelect,
// useBenefitSelect, // useBenefitSelect,
count1, count1,

Loading…
Cancel
Save