Browse Source

积分商城兑换成功显示更改,

平台余额显示更改
ff_new
w-R 3 years ago
parent
commit
6bcabaf14d
  1. 2
      lib/community/headlines/article_page.dart
  2. 3
      lib/integral_store/integral_store_details_page.dart
  3. 280
      lib/order/exchange_order_page.dart
  4. 28
      lib/settlement/settlement.dart
  5. 16
      lib/store/store_order.dart

2
lib/community/headlines/article_page.dart

@ -217,7 +217,7 @@ class _ArticlePage extends State<ArticlePage>
List<Widget> classChildItem() { List<Widget> classChildItem() {
var widgets = <Widget>[ var widgets = <Widget>[
///banner ///banner
HeadlinesBanner(bannerData,), HeadlinesBanner(bannerData,),
SizedBox(height: 28), SizedBox(height: 28),

3
lib/integral_store/integral_store_details_page.dart

@ -298,7 +298,8 @@ class _IntegralStoreDetailsPage extends State<IntegralStoreDetailsPage> {
: Image.network( : Image.network(
goods.viceImgPaths.elementAt(position), goods.viceImgPaths.elementAt(position),
fit: BoxFit.cover, fit: BoxFit.cover,
); )
;
}, },
itemCount: (goods == null || goods.viceImgPaths == null) itemCount: (goods == null || goods.viceImgPaths == null)
? 1 ? 1

280
lib/order/exchange_order_page.dart

@ -9,8 +9,10 @@ import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/user_info.dart'; import 'package:huixiang/retrofit/data/user_info.dart';
import 'package:huixiang/retrofit/data/wx_pay.dart'; import 'package:huixiang/retrofit/data/wx_pay.dart';
import 'package:huixiang/retrofit/min_api.dart';
import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/custom_image.dart';
import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:huixiang/view_widget/receiving_method_dialog.dart'; import 'package:huixiang/view_widget/receiving_method_dialog.dart';
import 'package:huixiang/view_widget/round_button.dart'; import 'package:huixiang/view_widget/round_button.dart';
@ -31,33 +33,33 @@ class ExchangeOrderPage extends StatefulWidget {
class _ExchangeOrderPage extends State<ExchangeOrderPage> { class _ExchangeOrderPage extends State<ExchangeOrderPage> {
ApiService apiService; ApiService apiService;
String money = "0";
String balance = "0";
int buyNum = 1; int buyNum = 1;
var checkIndex = 1; var checkIndex = 1;
UserInfo userInfo;
dynamic mBalance = 0;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
SharedPreferences.getInstance().then((value) {
if(value.getString("minMember") == null){
return;
}
Map<String, dynamic> memberInfo =
jsonDecode(value.getString("minMember"));
balance = memberInfo["balance"];
money = memberInfo["money"];
setState(() {});
});
SharedPreferences.getInstance().then((value) => { SharedPreferences.getInstance().then((value) => {
apiService = ApiService(Dio(), apiService = ApiService(Dio(),
context: context, token: value.getString("token")), context: context, token: value.getString("token")),
points = points =
UserInfo.fromJson(jsonDecode(value.getString('user'))).points, UserInfo.fromJson(jsonDecode(value.getString('user'))).points,
queryUserBalance(),
}); });
} }
queryUserBalance() async {
BaseData<UserInfo> baseData = await apiService.queryInfo().catchError((onError) {});
if (baseData != null && baseData.isSuccess) {
userInfo = baseData.data;
mBalance = double.tryParse(userInfo.money);
if (mounted) setState(() {});
}
}
String points; String points;
@override @override
@ -70,15 +72,16 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
background: Color(0xFFFAFAFA), background: Color(0xFFFAFAFA),
leadingColor: Colors.black, leadingColor: Colors.black,
), ),
body: Stack(children: [ body: Stack(
children: [
SingleChildScrollView( SingleChildScrollView(
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
child: Column( child: Column(
children: [ children: [
widget.arguments["useTyped"] == 1? widget.arguments["useTyped"] == 1
Container( ? Container(
margin: margin: EdgeInsets.only(
EdgeInsets.only(left: 16, right: 16, top: 26, bottom: 8), left: 16, right: 16, top: 26, bottom: 8),
padding: EdgeInsets.all(20), padding: EdgeInsets.all(20),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
@ -90,7 +93,8 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
spreadRadius: 0, spreadRadius: 0,
) )
], ],
borderRadius: BorderRadius.all(Radius.circular(8)), borderRadius:
BorderRadius.all(Radius.circular(8)),
), ),
child: Column( child: Column(
children: [ children: [
@ -114,7 +118,8 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
SizedBox( SizedBox(
height: 18.h, height: 18.h,
), ),
GestureDetector(onTap: (){ GestureDetector(
onTap: () {
setState(() { setState(() {
showAlertDialog(); showAlertDialog();
}); });
@ -131,7 +136,8 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
SizedBox( SizedBox(
width: 12.w, width: 12.w,
), ),
Expanded(child:Text( Expanded(
child: Text(
widget.arguments["useTyped"] == 1 widget.arguments["useTyped"] == 1
? S.of(context).ziti ? S.of(context).ziti
: widget.arguments["useTyped"] == 2 : widget.arguments["useTyped"] == 2
@ -148,7 +154,8 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
color: Color(0xFF32A060), color: Color(0xFF32A060),
), ),
], ],
),), ),
),
Visibility( Visibility(
child: SizedBox( child: SizedBox(
height: 13.h, height: 13.h,
@ -174,23 +181,34 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
toAddressPicker(); toAddressPicker();
}, },
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment:
crossAxisAlignment: CrossAxisAlignment.end, MainAxisAlignment.end,
crossAxisAlignment:
CrossAxisAlignment.end,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Expanded( Expanded(
child: Text( child: Text(
(address != null && address != "") (address != null &&
address != "")
? address ? address
: widget.arguments["useTyped"] == 1 : widget.arguments[
? S.of(context).qingxuanzhemendian "useTyped"] ==
: widget.arguments["useTyped"] == 1
? S
.of(context)
.qingxuanzhemendian
: widget.arguments[
"useTyped"] ==
2 2
? S ? S
.of(context) .of(context)
.qingxuanzeshouhuodizhi .qingxuanzeshouhuodizhi
: S.of(context).xuni, : S
overflow: TextOverflow.ellipsis, .of(context)
.xuni,
overflow:
TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
fontSize: 14.sp, fontSize: 14.sp,
color: Color(0xFF32A060), color: Color(0xFF32A060),
@ -218,28 +236,34 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
Row( Row(
children: [ children: [
Visibility( Visibility(
visible: widget.arguments["useTyped"] != 3, visible:
widget.arguments["useTyped"] != 3,
child: Text( child: Text(
S.of(context).zitishijian, S.of(context).zitishijian,
style: TextStyle( style: TextStyle(
fontSize: 14.sp, color: Color(0xFF353535)), fontSize: 14.sp,
color: Color(0xFF353535)),
), ),
), ),
Visibility( Visibility(
visible: widget.arguments["useTyped"] != 3, visible:
widget.arguments["useTyped"] != 3,
child: SizedBox( child: SizedBox(
width: 12.w, width: 12.w,
), ),
), ),
Text( Text(
widget.arguments["useTyped"] == 1 widget.arguments["useTyped"] == 1
? S.of(context).duihuanhouwugegongzuori ? S
.of(context)
.duihuanhouwugegongzuori
: widget.arguments["useTyped"] == 2 : widget.arguments["useTyped"] == 2
? S.of(context).duihuanhoufahuo ? S.of(context).duihuanhoufahuo
: S.of(context).feishiwushangpin, : S.of(context).feishiwushangpin,
style: TextStyle( style: TextStyle(
fontSize: 14.sp, fontSize: 14.sp,
color: widget.arguments["useTyped"] == 3 color:
widget.arguments["useTyped"] == 3
? Color(0xFF32A060) ? Color(0xFF32A060)
: Color(0xFF353535)), : Color(0xFF353535)),
), ),
@ -247,7 +271,8 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
), ),
], ],
), ),
): )
:
// Container( // Container(
// margin: // margin:
// EdgeInsets.only(left: 16, right: 16, top: 26, bottom: 8), // EdgeInsets.only(left: 16, right: 16, top: 26, bottom: 8),
@ -328,8 +353,8 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
// ), // ),
// ), // ),
Container( Container(
margin: margin: EdgeInsets.only(
EdgeInsets.only(left: 16, right: 16, top: 26, bottom: 8), left: 16, right: 16, top: 26, bottom: 8),
padding: EdgeInsets.all(20), padding: EdgeInsets.all(20),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
@ -341,7 +366,8 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
spreadRadius: 0, spreadRadius: 0,
) )
], ],
borderRadius: BorderRadius.all(Radius.circular(8)), borderRadius:
BorderRadius.all(Radius.circular(8)),
), ),
child: Column( child: Column(
children: [ children: [
@ -365,7 +391,8 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
SizedBox( SizedBox(
height: 18.h, height: 18.h,
), ),
GestureDetector(onTap: (){ GestureDetector(
onTap: () {
setState(() { setState(() {
showAlertDialog(); showAlertDialog();
}); });
@ -382,7 +409,8 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
SizedBox( SizedBox(
width: 12.w, width: 12.w,
), ),
Expanded(child:Text( Expanded(
child: Text(
widget.arguments["useTyped"] == 1 widget.arguments["useTyped"] == 1
? S.of(context).ziti ? S.of(context).ziti
: widget.arguments["useTyped"] == 2 : widget.arguments["useTyped"] == 2
@ -399,7 +427,8 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
color: Color(0xFF32A060), color: Color(0xFF32A060),
), ),
], ],
),), ),
),
Visibility( Visibility(
child: SizedBox( child: SizedBox(
height: 13.h, height: 13.h,
@ -425,23 +454,34 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
toAddressPicker(); toAddressPicker();
}, },
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment:
crossAxisAlignment: CrossAxisAlignment.end, MainAxisAlignment.end,
crossAxisAlignment:
CrossAxisAlignment.end,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Expanded( Expanded(
child: Text( child: Text(
(address != null && address != "") (address != null &&
address != "")
? address ? address
: widget.arguments["useTyped"] == 1 : widget.arguments[
? S.of(context).qingxuanzhemendian "useTyped"] ==
: widget.arguments["useTyped"] == 1
? S
.of(context)
.qingxuanzhemendian
: widget.arguments[
"useTyped"] ==
2 2
? S ? S
.of(context) .of(context)
.qingxuanzeshouhuodizhi .qingxuanzeshouhuodizhi
: S.of(context).xuni, : S
overflow: TextOverflow.ellipsis, .of(context)
.xuni,
overflow:
TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
fontSize: 14.sp, fontSize: 14.sp,
color: Color(0xFF32A060), color: Color(0xFF32A060),
@ -470,8 +510,8 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
), ),
), ),
Container( Container(
margin: margin: EdgeInsets.only(
EdgeInsets.only(left: 16, right: 16, top: 8, bottom: 16), left: 16, right: 16, top: 8, bottom: 16),
padding: EdgeInsets.all(20), padding: EdgeInsets.all(20),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
@ -513,19 +553,13 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
children: [ children: [
if (widget.arguments["image"] != null) MImage(
Image.network( widget?.arguments["image"] ?? "",
widget.arguments["image"],
fit: BoxFit.cover,
width: 80, width: 80,
height: 80, height: 80,
)
else
Image.asset(
"assets/image/default_1.png",
fit: BoxFit.cover, fit: BoxFit.cover,
width: 80, errorSrc: "assets/image/default_1.png",
height: 80, fadeSrc: "assets/image/default_1.png",
), ),
Expanded( Expanded(
child: Container( child: Container(
@ -537,6 +571,8 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
children: [ children: [
Text( Text(
widget.arguments["name"], widget.arguments["name"],
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
fontSize: 14.sp, fontSize: 14.sp,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -567,23 +603,31 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
children: [ children: [
Text( Text(
"应付数额", "应付数额",
style: style: TextStyle(
TextStyle(fontSize: 14, color: Color(0xFF353535),fontWeight: MyFontWeight.regular), fontSize: 14,
color: Color(0xFF353535),
fontWeight: MyFontWeight.regular),
), ),
SizedBox( SizedBox(
width: 12, width: 12,
), ),
Text( Text(
widget.arguments["payType"] == 1 ? "${double.parse(widget.arguments["onePrice"])*buyNum}积分": widget.arguments["payType"] == 1
((widget.arguments["price"] == null || widget.arguments["price"] == "0" ? "${double.parse(widget.arguments["onePrice"]) * buyNum}积分"
: ((widget.arguments["price"] == null ||
widget.arguments["price"] == "0"
? "" ? ""
: "${double.parse(widget.arguments["price"]) * buyNum}积分") + : "${double.parse(widget.arguments["price"]) * buyNum}积分") +
(widget.arguments["money"] == null || widget.arguments["money"] == "0.00" (widget.arguments["money"] == null ||
widget.arguments["money"] ==
"0.00"
? "" ? ""
: " + ${double.parse(widget.arguments["money"]) * buyNum}")), : " + ${double.parse(widget.arguments["money"]) * buyNum}")),
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
decoration:(widget.arguments["payType"] == 3) ? TextDecoration.lineThrough:TextDecoration.none, decoration: (widget.arguments["payType"] == 3)
? TextDecoration.lineThrough
: TextDecoration.none,
color: Color(0xFF32A060), color: Color(0xFF32A060),
), ),
), ),
@ -599,8 +643,10 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
children: [ children: [
Text( Text(
"现金抵扣积分", "现金抵扣积分",
style: style: TextStyle(
TextStyle(fontSize: 14, color: Color(0xFF353535),fontWeight: MyFontWeight.regular), fontSize: 14,
color: Color(0xFF353535),
fontWeight: MyFontWeight.regular),
), ),
SizedBox( SizedBox(
width: 12, width: 12,
@ -624,7 +670,9 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
Text( Text(
"合计", "合计",
style: TextStyle( style: TextStyle(
fontSize: 14.sp, color: Color(0xFF353535),fontWeight: MyFontWeight.regular), fontSize: 14.sp,
color: Color(0xFF353535),
fontWeight: MyFontWeight.regular),
), ),
SizedBox( SizedBox(
width: 12.w, width: 12.w,
@ -640,8 +688,7 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
), ),
), ),
Container( Container(
margin: margin: EdgeInsets.only(left: 16, right: 16, bottom: 8),
EdgeInsets.only(left: 16, right: 16, bottom: 8),
padding: EdgeInsets.all(20), padding: EdgeInsets.all(20),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
@ -659,7 +706,8 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
children: [ children: [
Row( Row(
children: [ children: [
Expanded(child: Text( Expanded(
child: Text(
"兑换数量", "兑换数量",
style: TextStyle( style: TextStyle(
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
@ -669,8 +717,7 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
InkWell( InkWell(
onTap: () { onTap: () {
setState(() { setState(() {
if(buyNum > 1) if (buyNum > 1) buyNum -= 1;
buyNum -= 1;
}); });
}, },
child: Image.asset( child: Image.asset(
@ -694,13 +741,20 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
InkWell( InkWell(
onTap: () { onTap: () {
setState(() { setState(() {
if(widget.arguments["payType"] == 1 ? if (widget.arguments["payType"] == 1
(double.parse(widget.arguments["onePrice"])*(buyNum+1)) ? (double.parse(widget
> double.parse(points): .arguments["onePrice"]) *
(widget.arguments["price"] == null || widget.arguments["price"] == "0" (buyNum + 1)) >
double.parse(points)
: (widget.arguments["price"] == null ||
widget.arguments["price"] == "0"
? false ? false
: (double.parse(widget.arguments["price"])*(buyNum+1)) > double.parse(points))){ : (double.parse(widget
SmartDialog.showToast("您的积分不足", alignment: Alignment.center); .arguments["price"]) *
(buyNum + 1)) >
double.parse(points))) {
SmartDialog.showToast("您的积分不足",
alignment: Alignment.center);
return; return;
} }
buyNum += 1; buyNum += 1;
@ -777,7 +831,7 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
flex: 1, flex: 1,
), ),
Text( Text(
"¥$money", "¥$mBalance",
style: TextStyle( style: TextStyle(
fontSize: 14.sp, fontSize: 14.sp,
color: Color(0xff353535), color: Color(0xff353535),
@ -848,7 +902,8 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
}); });
}, },
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment:
MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
checkPayView(3), checkPayView(3),
@ -874,14 +929,16 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
SizedBox(height: 40) SizedBox(height: 40)
], ],
)), )),
Align(alignment: Alignment.bottomCenter,child: Align(
Container( alignment: Alignment.bottomCenter,
child: Container(
height: 54.h, height: 54.h,
color: Colors.white, color: Colors.white,
child: Row( child: Row(
children: [ children: [
Spacer(), Spacer(),
Padding(padding: EdgeInsets.only(top: 7,right: 16), Padding(
padding: EdgeInsets.only(top: 7, right: 16),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
@ -893,7 +950,8 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
color: Colors.black, color: Colors.black,
), ),
), ),
Text(handleNeedPay(), Text(
handleNeedPay(),
style: TextStyle( style: TextStyle(
fontSize: 16.sp, fontSize: 16.sp,
fontWeight: MyFontWeight.medium, fontWeight: MyFontWeight.medium,
@ -912,8 +970,9 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
height: 54.h, height: 54.h,
text: widget.arguments["payType"] == 3 || text: widget.arguments["payType"] == 3 ||
(widget.arguments["payType"] == 2 && (widget.arguments["payType"] == 2 &&
widget.arguments["money"] != "0.00") ? widget.arguments["money"] != "0.00")
S.current.jiesuan : S.current.duihuan, ? S.current.jiesuan
: S.current.duihuan,
textColor: Colors.white, textColor: Colors.white,
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
backgroup: Color(0xFF32A060), backgroup: Color(0xFF32A060),
@ -925,8 +984,8 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
], ],
), ),
)) ))
],) ],
); ));
} }
/// ///
@ -945,12 +1004,18 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
} }
String handleNeedPay() { String handleNeedPay() {
return widget.arguments["payType"] == 1 ? return widget.arguments["payType"] == 1
"${double.parse(widget.arguments["onePrice"])*buyNum}积分".toString() : (widget.arguments["payType"] == 2 ? "${double.parse(widget.arguments["onePrice"]) * buyNum}积分".toString()
? ((widget.arguments["price"] == null || widget.arguments["price"] == "0" : (widget.arguments["payType"] == 2
? "" : "${double.parse(widget.arguments["price"]) * buyNum}积分") + ? ((widget.arguments["price"] == null ||
(widget.arguments["money"] == null || widget.arguments["money"] == "0.00" widget.arguments["price"] == "0"
? "" : " + ${double.parse(widget.arguments["money"])*buyNum}")):"${double.parse(widget.arguments["oneMoney"])*buyNum}"); ? ""
: "${double.parse(widget.arguments["price"]) * buyNum}积分") +
(widget.arguments["money"] == null ||
widget.arguments["money"] == "0.00"
? ""
: " + ${double.parse(widget.arguments["money"]) * buyNum}"))
: "${double.parse(widget.arguments["oneMoney"]) * buyNum}");
} }
Widget checkPayView(var index) { Widget checkPayView(var index) {
@ -1008,11 +1073,13 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
"isPoints": !handleNeedPay().contains(""), "isPoints": !handleNeedPay().contains(""),
"number": buyNum, "number": buyNum,
"useTyped": widget.arguments["useTyped"], "useTyped": widget.arguments["useTyped"],
"payChannel":handleNeedPay().contains("") ? (checkIndex == 3?"1":"4") : "0", "payChannel":
handleNeedPay().contains("") ? (checkIndex == 3 ? "1" : "4") : "0",
if (widget.arguments["useTyped"] == 1) "storeId": storeId, if (widget.arguments["useTyped"] == 1) "storeId": storeId,
if (widget.arguments["useTyped"] == 2) "userAddressId": userAddressId, if (widget.arguments["useTyped"] == 2) "userAddressId": userAddressId,
}); });
if (baseDate.isSuccess) { if (baseDate.isSuccess) {
String realPay = handleNeedPay();
if ((widget.arguments["payType"] == 3 || if ((widget.arguments["payType"] == 3 ||
(widget.arguments["payType"] == 2 && (widget.arguments["payType"] == 2 &&
widget.arguments["money"] != "0.00")) && widget.arguments["money"] != "0.00")) &&
@ -1045,13 +1112,9 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
'/router/exchange_order_success_page', '/router/exchange_order_success_page',
arguments: { arguments: {
"id": widget.arguments["goodsId"], "id": widget.arguments["goodsId"],
"price": (widget.arguments["payType"] == 1 ? "price": realPay.contains("积分") ? realPay.substring(0,realPay.indexOf("积分")) : "0",
(double.parse(widget.arguments["onePrice"])*buyNum).toString():
(widget.arguments["price"] == null || widget.arguments["price"] == "0"
? "0"
: (double.parse(widget.arguments["price"])*buyNum).toString())),
"points": points, "points": points,
"realPay":handleNeedPay(), "realPay": realPay,
"payChannel": widget.arguments["payChannel"], "payChannel": widget.arguments["payChannel"],
}, },
); );
@ -1059,18 +1122,13 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
SmartDialog.showToast("支付失败", alignment: Alignment.center); SmartDialog.showToast("支付失败", alignment: Alignment.center);
return; return;
} }
}); });
return; return;
} }
await Navigator.of(context) await Navigator.of(context)
.pushNamed('/router/exchange_order_success_page', arguments: { .pushNamed('/router/exchange_order_success_page', arguments: {
"price": (widget.arguments["payType"] == 1 ? "price": realPay.contains("积分") ? realPay.substring(0,realPay.indexOf("积分")) : "0",
(double.parse(widget.arguments["onePrice"])*buyNum).toString(): "realPay": realPay,
(widget.arguments["price"] == null || widget.arguments["price"] == "0"
? "0"
: (double.parse(widget.arguments["price"])*buyNum).toString())),
"realPay":handleNeedPay(),
"points": points, "points": points,
"payChannel": widget.arguments["payChannel"], "payChannel": widget.arguments["payChannel"],
"id": baseDate.data "id": baseDate.data

28
lib/settlement/settlement.dart

@ -1,3 +1,5 @@
import 'dart:io';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -72,8 +74,8 @@ class _Settlement extends State<Settlement> {
parentId = widget.arguments["parentId"] ?? ""; parentId = widget.arguments["parentId"] ?? "";
storeInfo = widget.arguments["storeInfo"]; storeInfo = widget.arguments["storeInfo"];
numberOfPeople = widget.arguments["numberOfPeople"] ?? 0; numberOfPeople = widget.arguments["numberOfPeople"] ?? 0;
promotions=widget.arguments["pid"]??""; promotions=widget.arguments["pName"]??"";
coupons=widget.arguments["cid"]??""; coupons=widget.arguments["cName"]??"";
if (tableId == 0) { if (tableId == 0) {
placeOrder = true; placeOrder = true;
} }
@ -89,6 +91,24 @@ class _Settlement extends State<Settlement> {
tenant: tenant, tenant: tenant,
storeId: storeId, storeId: storeId,
); );
if(promotions != null && promotions != ""){
queryOrderInfo(
address != null ? address.id : null,
selectedBtn,
null,
0,
widget.arguments["pid"],
);
}else if(coupons != null && coupons != ""){
queryOrderInfo(
address != null ? address.id : null,
selectedBtn,
widget.arguments["cid"],
0,
null,
);
}
else
queryOrderInfo(null, selectedBtn, null, 0, null); queryOrderInfo(null, selectedBtn, null, 0, null);
}); });
} }
@ -209,9 +229,9 @@ class _Settlement extends State<Settlement> {
placeOrderFirst.payChannel = payChannel; placeOrderFirst.payChannel = payChannel;
placeOrderFirst.promotionInfoDTO = PromotionInfoDTOBean(); placeOrderFirst.promotionInfoDTO = PromotionInfoDTOBean();
placeOrderFirst.promotionInfoDTO.promotionId = placeOrderFirst.promotionInfoDTO.promotionId =
promotion != null ? promotion.id : ""; promotion != null ? promotion.id : widget.arguments["pid"]??"";
placeOrderFirst.promotionInfoDTO.couponId = placeOrderFirst.promotionInfoDTO.couponId =
couponListBean != null ? couponListBean.id : ""; couponListBean != null ? couponListBean.id : widget.arguments["cid"]??"";
placeOrderFirst.recMobile = placeOrderFirst.recMobile =
(mobile == null || mobile == "") ? mobile : storeInfo.headMobile; (mobile == null || mobile == "") ? mobile : storeInfo.headMobile;
placeOrderFirst.shoppingCartSkuItemList = settleOrderInfo.orderProductList; placeOrderFirst.shoppingCartSkuItemList = settleOrderInfo.orderProductList;

16
lib/store/store_order.dart

@ -62,7 +62,9 @@ class _StoreOrderPage extends State<StoreOrderPage>
int numberOfPeople = 0; int numberOfPeople = 0;
///token ///token
String minToken; String minToken;
String pName;
String pid; String pid;
String cName;
String cid; String cid;
@override @override
@ -554,7 +556,9 @@ class _StoreOrderPage extends State<StoreOrderPage>
"tableId": tableId, "tableId": tableId,
"parentCode": parentCode, "parentCode": parentCode,
"parentId": parentId, "parentId": parentId,
"pName":pName,
"pid":pid, "pid":pid,
"cName":cName,
"cid":cid, "cid":cid,
"shoppingCart": shopCarGoods, "shoppingCart": shopCarGoods,
"numberOfPeople": numberOfPeople, "numberOfPeople": numberOfPeople,
@ -733,8 +737,10 @@ class _StoreOrderPage extends State<StoreOrderPage>
/// ///
Future<ShoppingCart> queryShopCar() async { Future<ShoppingCart> queryShopCar() async {
pid=""; pName="";//
cid=""; pid="";//
cName="";//
cid="";//
BaseData<List<ShoppingCart>> baseDate = BaseData<List<ShoppingCart>> baseDate =
await minService.getShoppingCart(tableId); await minService.getShoppingCart(tableId);
if (baseDate != null && if (baseDate != null &&
@ -744,13 +750,15 @@ class _StoreOrderPage extends State<StoreOrderPage>
if( baseDate.data[0].selectDiscount ==1){ if( baseDate.data[0].selectDiscount ==1){
baseDate.data[0].couponList.forEach((element) { baseDate.data[0].couponList.forEach((element) {
if(element.isMaxCoupon){ if(element.isMaxCoupon){
cid = element.promotionName; cName = element.promotionName;
cid = element.id;
} }
}); });
}else if(baseDate.data[0].selectDiscount==2){ }else if(baseDate.data[0].selectDiscount==2){
baseDate.data[0].promotionInfoList.forEach((element) { baseDate.data[0].promotionInfoList.forEach((element) {
if(element.isMaxPromotion){ if(element.isMaxPromotion){
pid=element.name; pName=element.name;
pid=element.id;
} }
}); });
} }

Loading…
Cancel
Save