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. 47
      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. 116
      lib/business_system/home/business_home_page.dart
  9. 4
      lib/business_system/home/home_view/home_sideslip_dialog.dart
  10. 1
      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. 73
      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 '../../utils/business_instance.dart';
import '../../utils/flutter_utils.dart';
import '../../view_widget/border_text.dart';
import '../../view_widget/custom_image.dart';
import '../../view_widget/my_appbar.dart';
import '../../view_widget/my_footer.dart';
import '../../view_widget/no_data_view.dart';
import '../../view_widget/round_button.dart';
class GoodsSearchPage extends StatefulWidget {
final Map<String, dynamic> arguments;
@ -398,7 +400,7 @@ class _GoodsSearchPage extends State<GoodsSearchPage>
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
queryGoodsUpdate(adminProductVoList.id ?? "");
showGoodsStateDialog(adminProductVoList.id ?? "");
},
child: Container(
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() {
return Container(
decoration: BoxDecoration(

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

@ -41,6 +41,7 @@ class _OffShelfPage extends State<OffShelfPage> {
List<AdminProductVoList> adminProductVoList = [];
String networkError = "";
int networkStatus = 0;
int dialogIndex = 0;
@override
void dispose() {
@ -200,7 +201,9 @@ class _OffShelfPage extends State<OffShelfPage> {
),
),
Expanded(
child: networkStatus == -1?noNetwork():Container(
child: networkStatus == -1
? noNetwork()
: Container(
child: SmartRefresher(
controller: _refreshController,
enablePullDown: true,
@ -225,8 +228,9 @@ class _OffShelfPage extends State<OffShelfPage> {
},
child: Container(
color: Colors.white,
child: networkStatus == 0 ?ListView.builder(
itemCount:10,
child: networkStatus == 0
? ListView.builder(
itemCount: 10,
physics: BouncingScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, position) {
@ -235,29 +239,31 @@ class _OffShelfPage extends State<OffShelfPage> {
child: shelfGoodsItemSm(),
);
},
):
((adminProductVoList == null ||
)
: ((adminProductVoList == null ||
adminProductVoList.length == 0)
? NoDataView(
src: "assets/image/bs_no data_logo.webp",
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,
itemCount:
adminProductVoList?.length ?? 0,
physics: BouncingScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {},
child: shelfGoodsItem(
adminProductVoList[position]),
adminProductVoList[
position]),
);
},
))
)),
)))),
),
),
SizedBox(
@ -273,15 +279,14 @@ class _OffShelfPage extends State<OffShelfPage> {
onTap: () {
List<dynamic> productIds = [];
adminProductVoList.forEach((element) {
if (element.isSelect)
productIds.add(element.id);
if (element.isSelect) productIds.add(element.id);
});
if (productIds.length == 0) {
SmartDialog.showToast("请选择要上架的商品",
alignment: Alignment.center);
return;
} else {
queryGoodsUpdate(productIds);
showDelGoodsDialog(productIds, 1);
}
},
child: Container(
@ -308,15 +313,14 @@ class _OffShelfPage extends State<OffShelfPage> {
onTap: () {
List<dynamic> productIds = [];
adminProductVoList.forEach((element) {
if (element.isSelect)
productIds.add(element.id);
if (element.isSelect) productIds.add(element.id);
});
if (productIds.length == 0) {
SmartDialog.showToast("请选择要删除的商品",
alignment: Alignment.center);
return;
} else {
showDelGoodsDialog(productIds);
showDelGoodsDialog(productIds, 2);
}
},
child: Container(
@ -389,8 +393,8 @@ class _OffShelfPage extends State<OffShelfPage> {
);
}
///
showDelGoodsDialog(productIds) {
////
showDelGoodsDialog(productIds, index) {
showDialog(
context: context,
builder: (context) {
@ -403,7 +407,7 @@ class _OffShelfPage extends State<OffShelfPage> {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
"选中数据将被永久删除, 是否继续?",
"选中数据将被${index == 1 ? "上架" : "永久删除"}, 是否继续?",
style: TextStyle(
color: Color(0xFFF4524D),
fontSize: 16.sp,
@ -449,6 +453,9 @@ class _OffShelfPage extends State<OffShelfPage> {
),
onTap: () {
Navigator.of(context).pop();
if (index == 1)
queryGoodsUpdate(productIds);
else
queryDelProduct(productIds);
},
),
@ -685,7 +692,7 @@ class _OffShelfPage extends State<OffShelfPage> {
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
networkError.substring(0,4),
networkError.substring(0, 4),
style: TextStyle(
fontSize: 14.sp,
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/flutter_utils.dart';
import '../../../utils/font_weight.dart';
import '../../../view_widget/border_text.dart';
import '../../../view_widget/classic_header.dart';
import '../../../view_widget/custom_image.dart';
import '../../../view_widget/my_footer.dart';
import '../../../view_widget/no_data_view.dart';
import '../../../view_widget/round_button.dart';
class BatchShelf extends StatefulWidget {
final Map<String, dynamic> arguments;
@ -207,7 +209,7 @@ class _BatchShelf extends State<BatchShelf> {
alignment: Alignment.center);
return;
} else {
queryGoodsUpdate();
showGoodsStateDialog();
}
},
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
Widget shelfLeftItem(Records records, index){
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/flutter_utils.dart';
import '../../../utils/font_weight.dart';
import '../../../view_widget/border_text.dart';
import '../../../view_widget/custom_image.dart';
import '../../../view_widget/no_data_view.dart';
import '../../../view_widget/round_button.dart';
class OnSalePage extends StatefulWidget {
final String storeId;
@ -600,7 +602,7 @@ class _OnSalePage extends State<OnSalePage> {
)),
GestureDetector(
onTap: () {
queryGoodsUpdate(adminProductVoList.id ?? "");
showOffShelfDialog(adminProductVoList.id ?? "");
},
child: Container(
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() {
return Container(
alignment: Alignment.center,

116
lib/business_system/home/business_home_page.dart

@ -73,20 +73,22 @@ class _BusinessHomePage extends State<BusinessHomePage>
super.dispose();
}
_onRefresh({int index,isLoading = true}) async {
if(isLoading)
_onRefresh({int index, isLoading = true}) async {
if (isLoading)
EasyLoading.show(
status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black);
status: S.current.zhengzaijiazai,
maskType: EasyLoadingMaskType.black);
SharedPreferences.getInstance().then((value) {
businessService = BusinessApiService(Dio(),
context: context,
token: BusinessInstance.instance.businessToken,
tenant: BusinessInstance.instance.businessTenant,
storeId: widget.businessLoginInfo.storeList[index??widget.selectStoreIndex]
.name ==
storeId: widget.businessLoginInfo
.storeList[index ?? widget.selectStoreIndex].name ==
"所有门店"
? "0"
: widget.businessLoginInfo.storeList[index??widget.selectStoreIndex].id);
: widget.businessLoginInfo
.storeList[index ?? widget.selectStoreIndex].id);
queryDayAmount();
queryPopularList(isSing: false);
queryOrderTrend();
@ -218,7 +220,7 @@ class _BusinessHomePage extends State<BusinessHomePage>
return MyFooter(mode);
},
),
onRefresh:(){
onRefresh: () {
_onRefresh(isLoading: false);
},
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(
behavior: HitTestBehavior.opaque,
onTap: () {
@ -313,7 +329,7 @@ class _BusinessHomePage extends State<BusinessHomePage>
],
),
Container(
margin: EdgeInsets.only(top:14.h),
margin: EdgeInsets.only(top: 14.h),
padding: EdgeInsets.symmetric(vertical: 12.h),
decoration: BoxDecoration(
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() {
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) {
value.setString("account", "");
value.setString("password", "");
Navigator.of(context).pop(-1);
// Navigator.of(context).pop(-1);
Navigator.of(context)
.pushNamedAndRemoveUntil('/router/main_page',(route) => false,);
});
},
child: Container(

1
lib/business_system/home/select_shop.dart

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

21
lib/business_system/login/business_login_page.dart

@ -100,17 +100,16 @@ class _BusinessLoginPage extends State<BusinessLoginPage> {
BusinessInstance.instance.businessToken = businessLoginInfo.token;
sharedPreferences.setString('account', _userPhoneController.text);
sharedPreferences.setString('password', _passwordController.text);
sharedPreferences.setString('identitySwitch', "1");
if (businessLoginInfo.storeList.length > 1) {
Navigator.of(context)
.pushReplacementNamed('/router/select_shop', arguments: {
.popAndPushNamed('/router/select_shop', arguments: {
"businessLoginInfo": businessLoginInfo,
"routeSource":"登录",
});
} else {
Navigator.of(context)
.pushReplacementNamed('/router/business_page', arguments: {
"businessLoginInfo": businessLoginInfo,
});
.popAndPushNamed('/router/business_page', arguments: {"businessLoginInfo": businessLoginInfo});
}
} else {
if (baseData.msg != null)
@ -166,7 +165,7 @@ class _BusinessLoginPage extends State<BusinessLoginPage> {
height: 15.h,
),
SizedBox(width: 4.w),
Text("手机号码",
Text("手机号码/用户名",
style: TextStyle(
fontSize: 14.sp,
color: Color(0xD9000000),
@ -177,13 +176,13 @@ class _BusinessLoginPage extends State<BusinessLoginPage> {
margin: EdgeInsets.only(top: 13.h, bottom: 24.h),
child: TextField(
controller: _userPhoneController,
keyboardType: TextInputType.phone,
keyboardType: TextInputType.text,
style: TextStyle(
fontSize: 14.sp,
color: Color(0xFF000000),
fontWeight: MyFontWeight.regular),
decoration: InputDecoration(
hintText: "请输入手机号码",
hintText: "请输入手机号码或用户名",
hintStyle: TextStyle(
fontSize: 14.sp,
color: Color(0xFF262626),
@ -204,9 +203,9 @@ class _BusinessLoginPage extends State<BusinessLoginPage> {
}
refresh();
},
inputFormatters: [
LengthLimitingTextInputFormatter(11)
],
// inputFormatters: [
// LengthLimitingTextInputFormatter(11)
// ],
),
),
Row(
@ -228,7 +227,7 @@ class _BusinessLoginPage extends State<BusinessLoginPage> {
margin: EdgeInsets.only(top: 12.h, bottom: 75.h),
child: TextField(
controller: _passwordController,
keyboardType: TextInputType.phone,
keyboardType: TextInputType.text,
style: TextStyle(
fontSize: 14.sp,
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 '../main.dart';
import '../retrofit/business_api.dart';
import '../retrofit/data/business_login_info.dart';
import '../retrofit/data/channels_list.dart';
import '../utils/business_instance.dart';
import 'captcha/block_puzzle_captcha.dart';
class NewLoginPage extends StatefulWidget {
@ -260,7 +263,6 @@ class _NewLoginPage extends State<NewLoginPage> {
isLogin() async {
SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
if (sharedPreferences.getBool("isShowPrivacyPolicy") == null ||
!sharedPreferences.getBool("isShowPrivacyPolicy")) {
showAlertDialog();
@ -271,7 +273,14 @@ class _NewLoginPage extends State<NewLoginPage> {
sharedPreferences.getString("token") != "") {
ExamineInstance.instance.isExamine =
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 {
apiService = ApiService(Dio(), context: context);
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
void dispose() {
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/data/base_data.dart';
import '../../retrofit/data/business_login_info.dart';
import '../../retrofit/data/examine_instance.dart';
import '../../utils/business_instance.dart';
class MineItem extends StatefulWidget {
@ -26,6 +27,7 @@ class _MineItem extends State<MineItem> {
var isShowMore = false;
login(account, password) async {
SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
var param = {
"grantType": "password",
"account": account,
@ -48,14 +50,15 @@ class _MineItem extends State<MineItem> {
}
BusinessInstance.instance.businessTenant = businessLoginInfo.tenantCode;
BusinessInstance.instance.businessToken = businessLoginInfo.token;
sharedPreferences.setString('identitySwitch', "1");
if (businessLoginInfo.storeList.length > 1) {
Navigator.of(context)
.pushNamed('/router/select_shop', arguments: {
.popAndPushNamed('/router/select_shop', arguments: {
"businessLoginInfo": businessLoginInfo,
});
} else {
Navigator.of(context)
.pushNamed('/router/business_page', arguments: {
.popAndPushNamed('/router/business_page', arguments: {
"businessLoginInfo": businessLoginInfo,
});
}
@ -69,7 +72,6 @@ class _MineItem extends State<MineItem> {
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.fromLTRB(16.w, 0.h, 16.w, 30.h),
// padding: EdgeInsets.fromLTRB(20.w, 12.h, 20.w, 12.h),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
@ -350,13 +352,12 @@ class _MineItem extends State<MineItem> {
///
Expanded(
child: InkWell(
child: ExamineInstance.instance.isExamine ? Container():InkWell(
onTap: () {
SharedPreferences.getInstance().then((value) {
if (value.getString("account") == "" ||
value.getString("password") == "") {
Navigator.of(context)
.pushNamed('/router/business_login_page');
Navigator.of(context).pushNamed('/router/business_login_page');
} else {
login(value.getString("account"),
value.getString("password"));

73
lib/settlement/settlement.dart

@ -140,7 +140,9 @@ class _Settlement extends State<Settlement> {
storeId: storeId,
showLoading: false);
queryMemberInfo();
if (widget.arguments["pid"] != null && widget.arguments["pid"] != "" && tableId <= 0) {
if (widget.arguments["pid"] != null &&
widget.arguments["pid"] != "" &&
tableId <= 0) {
queryOrderInfo(
address != null ? address.id : null,
((storeInfo?.pickupType?.dineInTakeStatus ?? false) == true &&
@ -161,7 +163,9 @@ class _Settlement extends State<Settlement> {
count1,
payChannel,
tableId);
} else if ( widget.arguments["cid"] != null && widget.arguments["cid"] != "" && tableId <= 0) {
} else if (widget.arguments["cid"] != null &&
widget.arguments["cid"] != "" &&
tableId <= 0) {
queryOrderInfo(
address != null ? address.id : null,
((storeInfo?.pickupType?.dineInTakeStatus ?? false) == true &&
@ -170,7 +174,7 @@ class _Settlement extends State<Settlement> {
selectedBtn != 2)
? diningStatus
: selectedBtn,
widget.arguments["cid"]??0,
widget.arguments["cid"] ?? 0,
0,
productId ?? 0,
productSkuId ?? "",
@ -228,7 +232,9 @@ class _Settlement extends State<Settlement> {
payChannel,
tableId) async {
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({
"addressId": addressId,
@ -329,7 +335,8 @@ class _Settlement extends State<Settlement> {
///
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({
"id": pageType != null ? widget.arguments["orderId"] : id ?? parentId,
}).catchError((error) {});
@ -557,6 +564,10 @@ class _Settlement extends State<Settlement> {
///
queryPlaceOrderFirst() async {
try {
EasyLoading.show(
status: S.current.zhengzaijiazai,
maskType: EasyLoadingMaskType.black);
// for (int i = 0; i < settleOrderInfo.orderProductList.length; i++) {
// settleOrderInfo.orderProductList.forEach((element1) {
// if (settleOrderInfo.orderProductList[i].productId ==
@ -608,10 +619,12 @@ class _Settlement extends State<Settlement> {
// : 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.promotionInfoDTO.discountType =
(!placeOrder) ? "AUTO" : settleOrderInfo?.discountType ?? "";
placeOrderFirst.recMobile =
(mobile == null || mobile == "") ? mobile : storeInfo.headMobile;
placeOrderFirst.shoppingCartSkuItemList = settleOrderInfo.orderProductList;
placeOrderFirst.shoppingCartSkuItemList =
settleOrderInfo.orderProductList;
placeOrderFirst.skuItemDTOList = [];
placeOrderFirst.source = 1;
placeOrderFirst.storeId = storeInfo.id;
@ -632,10 +645,12 @@ class _Settlement extends State<Settlement> {
print("error: $error");
});
if (baseData != null && baseData.isSuccess) {
EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black);
// EasyLoading.show(
// status: S.current.zhengzaijiazai,
// maskType: EasyLoadingMaskType.black);
placeOrder = true;
this.downOrder = DownOrder.fromJson(baseData.data);
querySettlement();
await querySettlement();
} else {
// orderButton = false;
SmartDialog.showToast(baseData?.msg, alignment: Alignment.center);
@ -676,10 +691,14 @@ class _Settlement extends State<Settlement> {
SmartDialog.showToast(baseData?.msg, alignment: Alignment.center);
}
}
} finally {
// EasyLoading.dismiss();
}
}
///
querySettlement() async {
try{
placeOrderFirst.id = ((parentId != "") ? parentId : downOrder.id);
placeOrderFirst.orderProductVOList = ((downOrder == null)
? minOrderInfo.orderProductVOList
@ -716,10 +735,10 @@ class _Settlement extends State<Settlement> {
timeStamp: int.tryParse(wxPay.timeStamp),
sign: wxPay.sign,
);
}else{
} else {
EasyLoading.dismiss();
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
Future.delayed(Duration(seconds:2), () {
Future.delayed(Duration(seconds: 2), () {
toOrderDetails(placeOrderFirst.id);
});
}
@ -743,6 +762,8 @@ class _Settlement extends State<Settlement> {
text: "${baseData?.msg}",
));
}
}}finally{
EasyLoading.dismiss();
}
}
@ -950,7 +971,9 @@ class _Settlement extends State<Settlement> {
///
if ((settleOrderInfo != null ||
minOrderInfo != null) && (placeOrder && tableId <= 0 &&
minOrderInfo != null) &&
(placeOrder &&
tableId <= 0 &&
!(settleOrderInfo?.isRaise ?? false)))
VipDiscountsSelect(
vipSelectCheck,
@ -1534,13 +1557,19 @@ class _Settlement extends State<Settlement> {
selectedBtn != 2)
? diningStatus
: 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,
((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 ?? "",
actProductId ?? "",
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,
// useBenefitSelect,
count1,
@ -1574,13 +1603,21 @@ class _Settlement extends State<Settlement> {
selectedBtn != 2)
? diningStatus
: 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,
(((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 ?? "",
actProductId ?? "",
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,
// useBenefitSelect,
count1,

Loading…
Cancel
Save