You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

902 lines
30 KiB

import 'dart:io';
import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
3 years ago
import 'package:flutter/services.dart';
3 years ago
import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart';
import 'package:flutter_baidu_mapapi_utils/flutter_baidu_mapapi_utils.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
3 years ago
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
3 years ago
import 'package:fluwx/fluwx.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/activity_details.dart';
3 years ago
import 'package:huixiang/retrofit/data/address.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
3 years ago
import 'package:huixiang/retrofit/data/down_order.dart';
import 'package:huixiang/retrofit/data/launch_join_act.dart';
3 years ago
import 'package:huixiang/retrofit/data/min_order_info.dart';
3 years ago
import 'package:huixiang/retrofit/data/placeOrderFirst.dart';
3 years ago
import 'package:huixiang/retrofit/data/settleOrderInfo.dart';
3 years ago
import 'package:huixiang/retrofit/data/store_info.dart';
3 years ago
import 'package:huixiang/retrofit/data/wx_pay.dart';
3 years ago
import 'package:huixiang/retrofit/min_api.dart';
3 years ago
import 'package:huixiang/settlement/settlement_model.dart';
3 years ago
import 'package:huixiang/settlement/settlement_view/activity_coupon_remarks.dart';
import 'package:huixiang/settlement/settlement_view/distribution.dart';
import 'package:huixiang/settlement/settlement_view/pay_method.dart';
import 'package:huixiang/settlement/settlement_view/settlement_activity.dart';
import 'package:huixiang/settlement/settlement_view/settlement_coupon.dart';
3 years ago
import 'package:huixiang/settlement/settlement_view/settlement_order_commodity.dart';
import 'package:huixiang/utils/font_weight.dart';
3 years ago
import 'package:huixiang/utils/min.dart';
import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:huixiang/view_widget/round_button.dart';
3 years ago
import 'package:huixiang/view_widget/tips_dialog.dart';
3 years ago
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class Settlement extends StatefulWidget {
final arguments;
3 years ago
Settlement({this.arguments});
@override
State<StatefulWidget> createState() {
return _Settlement();
}
}
class _Settlement extends State<Settlement> {
3 years ago
MinApiService minService;
3 years ago
Function(int type) callback;
3 years ago
StoreInfo storeInfo;
SettleOrderInfo settleOrderInfo;
3 years ago
MinOrderInfo minOrderInfo;
3 years ago
int selectedBtn = 0;
String remakers = "";
3 years ago
String parentCode = "";
String parentId = "";
int payChannel = 1;
3 years ago
int tableId = 0;
3 years ago
int numberOfPeople = 0;
String pageType;
3 years ago
Address address;
3 years ago
CouponListBean couponListBean;
PromotionInfoListBean promotion;
String mobile;
3 years ago
bool placeOrder = false;
String actProductId;
String actProductSkuId;
ActivityDetails activityDetails;
3 years ago
BargainType bargainType = BargainType.BargainZBug;
LaunchJoinAct launchJoinAct;
String skuPrice1;
3 years ago
JoinActivity joinA = JoinActivity.GoJoin;
String bargainOrderId;
String productSkuId;
int count1 = 0;
String productId;
3 years ago
@override
void initState() {
super.initState();
3 years ago
tableId = widget.arguments["tableId"] ?? 0;
parentCode = widget.arguments["parentCode"] ?? "";
parentId = widget.arguments["parentId"] ?? "";
3 years ago
storeInfo = widget.arguments["storeInfo"];
3 years ago
numberOfPeople = widget.arguments["numberOfPeople"] ?? 0;
promotions = widget.arguments["pName"] ?? "";
coupons = widget.arguments["cName"] ?? "";
3 years ago
pageType = widget.arguments["pageType"];
actProductId = widget.arguments["actProductId"];
actProductSkuId = widget.arguments["actProductSkuId"];
activityDetails = widget.arguments["activityDetails"];
bargainType = widget.arguments["bargainType"];
skuPrice1 = widget.arguments["skuPrice1"];
joinA = widget.arguments["joinA"];
3 years ago
bargainOrderId = widget.arguments["bargainOrderId"];
productSkuId = widget.arguments["productSkuId"];
count1 = widget.arguments["buyNum"];
productId = widget.arguments["productId"];
3 years ago
if (tableId == 0) {
placeOrder = true;
}
3 years ago
SharedPreferences.getInstance().then((value) {
3 years ago
String minToken = value.getString("minToken");
String tenant = value.getString("tenant");
3 years ago
String storeId = value.getString("storeId");
minService = MinApiService(Dio(),
context: context,
token: minToken,
tenant: tenant,
storeId: storeId,
showLoading: true);
if (promotions != null && promotions != "" && tableId <= 0) {
queryOrderInfo(
3 years ago
address != null ? address.id : null,
selectedBtn,
null,
0,
widget.arguments["pid"] ?? (productId ?? ""),
productSkuId ?? "",
actProductId ?? "",
actProductSkuId ?? "",
count1,
3 years ago
payChannel,
tableId);
} else if (coupons != null && coupons != "" && tableId <= 0) {
queryOrderInfo(
3 years ago
address != null ? address.id : null,
selectedBtn,
widget.arguments["cid"],
0,
productId ?? null,
productSkuId ?? "",
actProductId ?? "",
actProductSkuId ?? "",
count1,
3 years ago
payChannel,
tableId);
} else
3 years ago
queryOrderInfo(
3 years ago
null,
selectedBtn,
null,
0,
productId ?? null,
productSkuId ?? "",
actProductId ?? "",
actProductSkuId ?? "",
count1,
3 years ago
payChannel,
tableId);
3 years ago
});
3 years ago
weChatResponseEventHandler.listen((event) async {
print("payCallback: ${event.errCode}");
toOrderDetails(placeOrderFirst.id);
});
}
3 years ago
///订单结算信息
3 years ago
queryOrderInfo(addressId, isTake, memberCouponId, orderId, promotionId,
3 years ago
productSkuId, actProductId, actProductSkuId, buyNum, payChannel,tableId) async {
3 years ago
BaseData<SettleOrderInfo> baseData = await minService.getOrderInfo({
3 years ago
"addressId": addressId,
"isTake": isTake,
"memberCouponId": memberCouponId,
"orderId": orderId,
"promotionId": promotionId,
3 years ago
"productSkuId": productSkuId,
"actProductId": actProductId,
3 years ago
"actProductSkuId": actProductSkuId,
3 years ago
"buyNum": buyNum,
3 years ago
"payChannel": payChannel,
"tableId":tableId
3 years ago
}).catchError((error) {});
3 years ago
this.promotion = null;
promotions = "";
this.couponListBean = null;
coupons = "";
3 years ago
if (baseData != null && baseData.isSuccess) {
3 years ago
setState(() {
settleOrderInfo = baseData.data;
3 years ago
if((settleOrderInfo?.promotionId??"")!=""){
settleOrderInfo.promotionInfoList.forEach((element) {
if(element.id == settleOrderInfo.promotionId){
this.promotion = element;
promotions = promotion?.name ?? "";
}
});
}
if((settleOrderInfo?.memberCouponId??"")!=""){
settleOrderInfo.couponList.forEach((element) {
if(element.id == settleOrderInfo.memberCouponId){
this.couponListBean = element;
coupons = couponListBean?.promotionName ?? "";
}
});
}
3 years ago
if (settleOrderInfo.orderProductList == null ||
settleOrderInfo.orderProductList.length == 0) {
3 years ago
placeOrder = true;
queryOrderDetails(
pageType != null ? widget.arguments["orderId"] : parentId);
3 years ago
}
3 years ago
});
3 years ago
}
3 years ago
}
3 years ago
///查看订单详情
queryOrderDetails(id) async {
3 years ago
print("ididididididid: $id");
3 years ago
BaseData<MinOrderInfo> baseData = await minService.getOrderDetails({
"id":pageType != null ? widget.arguments["orderId"] : parentId,
3 years ago
}).catchError((error) {});
if (baseData != null && baseData.isSuccess) {
setState(() {
minOrderInfo = baseData.data;
});
3 years ago
} else {
3 years ago
SmartDialog.showToast(baseData.msg ?? "", alignment: Alignment.center);
3 years ago
}
}
3 years ago
queryAddress(int selectedBtn) async {
setState(() {
this.selectedBtn = selectedBtn;
});
3 years ago
if (address != null) {
3 years ago
queryOrderInfo(
3 years ago
address.id,
selectedBtn,
null,
0,
productId ?? null,
3 years ago
productSkuId ?? "",
3 years ago
actProductId ?? "",
actProductSkuId ?? "",
count1,
3 years ago
payChannel,
tableId);
3 years ago
return;
}
BaseData<List<Address>> baseDate =
await minService.queryAddress().catchError((error) {});
BMFCoordinate bmfCoordinate = BMFCoordinate(
double.tryParse(storeInfo.latitude),
double.tryParse(storeInfo.longitude),
);
if (baseDate != null && baseDate.isSuccess) {
setState(() {
address = baseDate.data[0];
});
3 years ago
for (int i = 1; i < baseDate.data.length; i++) {
Address address1 = baseDate.data[i];
BMFCoordinate coordinate = await BMFCalculateUtils.coordConvert(
coordinate: BMFCoordinate(
double.tryParse(address.longitude),
double.tryParse(address.latitude),
),
fromType: BMF_COORD_TYPE.COMMON,
toType: BMF_COORD_TYPE.BD09LL);
BMFCoordinate coordinate1 = await BMFCalculateUtils.coordConvert(
coordinate: BMFCoordinate(
double.tryParse(address1.longitude),
double.tryParse(address1.latitude),
),
fromType: BMF_COORD_TYPE.COMMON,
toType: BMF_COORD_TYPE.BD09LL);
double mi = await BMFCalculateUtils.getLocationDistance(
bmfCoordinate, coordinate);
double mi1 = await BMFCalculateUtils.getLocationDistance(
bmfCoordinate, coordinate1);
if (mi1 < mi) {
setState(() {
address = address1;
});
3 years ago
}
}
3 years ago
queryOrderInfo(
3 years ago
address.id,
selectedBtn,
null,
0,
productId ?? null,
3 years ago
productSkuId ?? "",
3 years ago
actProductId ?? "",
actProductSkuId ?? "",
count1,
3 years ago
payChannel,
tableId);
3 years ago
}
}
///选择收货地址
selectedAddress(String addId) async {
BaseData<List<Address>> baseDate =
await minService.queryAddress().catchError((error) {});
if (baseDate != null && baseDate.isSuccess) {
setState(() {
baseDate.data.forEach((element) {
if (element.id == addId) address = element;
});
});
3 years ago
queryOrderInfo(
3 years ago
address.id,
selectedBtn,
null,
0,
productId ?? null,
3 years ago
productSkuId ?? "",
3 years ago
actProductId ?? "",
actProductSkuId ?? "",
count1,
3 years ago
payChannel,
tableId);
}
}
3 years ago
PlaceOrderFirst placeOrderFirst;
DownOrder downOrder;
///发起活动
queryLaunchAct() async {
BaseData baseData = await minService.launchAct({
"actProductId": activityDetails.actProduct.id,
"actRecordId": 0,
"actTemplateId": activityDetails.actProduct.templateId,
"actTimeId": activityDetails.actProduct.timeId,
"addressId": address == null ? null : address.id,
3 years ago
"isDirectBuy": (bargainType == BargainType.BargainBug ||
bargainType == BargainType.CollageBug)
? false
: true,
"getType": selectedBtn,
"productId": activityDetails.actProduct.productId,
"skuId": actProductSkuId ?? "",
3 years ago
"skuPrice": settleOrderInfo.price,
"templateType": pageType,
}).catchError((error) {});
if (baseData != null && baseData.isSuccess) {
setState(() {
launchJoinAct = baseData.data;
3 years ago
if (bargainType == BargainType.BargainBug) {
toBargain();
} else {
activityPay();
}
});
} else {
if ((activityDetails?.actProduct?.productStock ?? 0) == 0)
SmartDialog.showToast("活动商品售罄", alignment: Alignment.center);
}
}
///参与活动
queryJoinAct() async {
BaseData baseData = await minService.joinAct({
"actProductId": activityDetails.actProduct.id,
"actRecordId": widget.arguments["indexP"],
"actTemplateId": activityDetails.actProduct.templateId,
"actTimeId": activityDetails.actProduct.timeId,
"addressId": address == null ? null : address.id,
3 years ago
"isDirectBuy": (bargainType == BargainType.BargainBug ||
bargainType == BargainType.CollageBug)
? false
: true,
"getType": selectedBtn,
"productId": activityDetails.actProduct.productId,
"skuId": actProductSkuId ?? "",
"skuPrice": skuPrice1,
"templateType": pageType
}).catchError((error) {});
if (baseData != null && baseData.isSuccess) {
launchJoinAct = baseData.data;
activityPay();
} else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
}
}
3 years ago
///小程序下单
queryPlaceOrderFirst() async {
3 years ago
// 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;
// }
// });
// }
3 years ago
3 years ago
placeOrderFirst = PlaceOrderFirst();
3 years ago
placeOrderFirst.cartNum = settleOrderInfo.orderNum;
placeOrderFirst.cartSum = settleOrderInfo.price;
placeOrderFirst.addressId = address == null ? null : address.id;
3 years ago
placeOrderFirst.isSubscribe = false;
3 years ago
placeOrderFirst.isTakeOut = selectedBtn;
placeOrderFirst.notes = remakers;
3 years ago
placeOrderFirst.numberOfPeople = "$numberOfPeople";
3 years ago
placeOrderFirst.orderSource = 2;
placeOrderFirst.orderType = "0";
3 years ago
placeOrderFirst.orderTypeId = 0;
3 years ago
placeOrderFirst.parentCode = parentCode; // 火锅加菜
placeOrderFirst.parentId = parentId; // 火锅加菜
3 years ago
placeOrderFirst.payChannel = payChannel;
placeOrderFirst.promotionInfoDTO = PromotionInfoDTOBean();
3 years ago
placeOrderFirst.promotionInfoDTO.promotionId =
3 years ago
(promotion != null && tableId <= 0) ? promotion.id : "";
3 years ago
// : widget.arguments["pid"] ?? "";
3 years ago
placeOrderFirst.promotionInfoDTO.couponId =
3 years ago
(couponListBean != null && tableId <= 0) ? couponListBean.id : "";
3 years ago
// : widget.arguments["cid"] ?? "";
3 years ago
placeOrderFirst.recMobile =
(mobile == null || mobile == "") ? mobile : storeInfo.headMobile;
3 years ago
placeOrderFirst.shoppingCartSkuItemList = settleOrderInfo.orderProductList;
3 years ago
placeOrderFirst.skuItemDTOList = [];
placeOrderFirst.source = 1;
placeOrderFirst.storeId = storeInfo.id;
placeOrderFirst.subcribeTime = null;
3 years ago
placeOrderFirst.tableId = "$tableId";
3 years ago
if (tableId == 0) {
///正常的商店下单
3 years ago
BaseData<dynamic> baseData = await minService
3 years ago
.placeOrderFirst(placeOrderFirst.toJson())
.catchError((error) {
print("error: $error");
});
if (baseData != null && baseData.isSuccess) {
placeOrder = true;
3 years ago
this.downOrder = DownOrder.fromJson(baseData.data);
3 years ago
querySettlement();
} else {
3 years ago
SmartDialog.showToast(baseData?.msg, alignment: Alignment.center);
3 years ago
}
3 years ago
} else {
///火锅店下单, 等待结算
BaseData<DownOrder> baseData;
3 years ago
if (placeOrder) {
// 结算
querySettlement();
3 years ago
} else {
3 years ago
if (parentId == "") {
3 years ago
// 下单
3 years ago
baseData = await minService
.placeOrderFirst(placeOrderFirst.toJson())
.catchError((error) {
print("error: $error");
});
3 years ago
} else {
//加菜
3 years ago
baseData = await minService
.addOrder(placeOrderFirst.toJson())
.catchError((error) {
print("error: $error");
});
}
3 years ago
}
if (baseData != null && baseData.isSuccess) {
placeOrder = true;
3 years ago
this.downOrder = baseData.data;
3 years ago
queryOrderDetails(
(parentId == null || parentId == "") ? baseData.data.id : parentId);
3 years ago
setState(() {});
3 years ago
} else {
3 years ago
SmartDialog.showToast(baseData?.msg, alignment: Alignment.center);
}
3 years ago
}
}
///结算
3 years ago
querySettlement() async {
placeOrderFirst.id = parentId != "" ? parentId : downOrder.id;
3 years ago
placeOrderFirst.orderProductVOList = downOrder == null
? minOrderInfo.orderProductVOList
: downOrder.orderProductVOList;
3 years ago
if (placeOrderFirst.payChannel == 1) {
3 years ago
if (Platform.isAndroid) {
3 years ago
if (!(await Min.isInitialize())) {
// 小程序的微信支付和app的充值支付使用同一个WXPayEntryActivity回调,
// 然而充值时小程序未初始化会导致回调内部代码调用getPackage空指针,
// 故而在此初始化一下
await Min.initialize();
}
3 years ago
}
3 years ago
BaseData<WxPay> baseData = await minService
.settlementWx(placeOrderFirst.toJson())
.catchError((error) {
print(error);
});
3 years ago
if (baseData != null && baseData.isSuccess) {
WxPay wxPay = baseData.data;
await registerWxApi(
3 years ago
appId: wxPay.appId,
doOnAndroid: true,
universalLink: "https://hx.lotus-wallet.com/app/",
);
3 years ago
payWithWeChat(
3 years ago
appId: wxPay.appId,
partnerId: wxPay.partnerId,
prepayId: wxPay.prepayId,
packageValue: wxPay.packageValue,
nonceStr: wxPay.nonceStr,
timeStamp: int.tryParse(wxPay.timeStamp),
sign: wxPay.sign,
);
3 years ago
}
} else {
3 years ago
BaseData baseData = await minService
.settlementApi(placeOrderFirst.toJson())
.catchError((error) {
print(error);
});
3 years ago
if (baseData != null && baseData.isSuccess) {
3 years ago
SmartDialog.showToast(baseData?.msg == "ok" ? "订单支付成功":"", alignment: Alignment.center);
3 years ago
toOrderDetails(placeOrderFirst.id);
3 years ago
} else {
3 years ago
SmartDialog.show(
widget: Tips(
() {
toOrderDetails(placeOrderFirst.id);
},
3 years ago
text: "${baseData.msg}",
));
3 years ago
}
}
}
3 years ago
///活动结算
activityPay() async {
if (payChannel == 1) {
3 years ago
if (Platform.isAndroid) {
if (!(await Min.isInitialize())) {
// 小程序的微信支付和app的充值支付使用同一个WXPayEntryActivity回调,
// 然而充值时小程序未初始化会导致回调内部代码调用getPackage空指针,
// 故而在此初始化一下
await Min.initialize();
}
}
BaseData<WxPay> baseData = await minService.actPay({
3 years ago
"orderId":
bargainOrderId != null ? bargainOrderId : launchJoinAct.orderId,
"payChannel": placeOrderFirst.payChannel
}).catchError((error) {
3 years ago
print(error);
});
if (baseData != null && baseData.isSuccess) {
WxPay wxPay = baseData.data;
await registerWxApi(
appId: wxPay.appId,
doOnAndroid: true,
universalLink: "https://hx.lotus-wallet.com/app/",
);
payWithWeChat(
appId: wxPay.appId,
partnerId: wxPay.partnerId,
prepayId: wxPay.prepayId,
packageValue: wxPay.packageValue,
nonceStr: wxPay.nonceStr,
timeStamp: int.tryParse(wxPay.timeStamp),
sign: wxPay.sign,
);
}
} else {
BaseData baseData = await minService.actPay({
3 years ago
"orderId":
bargainOrderId != null ? bargainOrderId : launchJoinAct.orderId,
"payChannel": payChannel
3 years ago
}).catchError((error) {
print(error);
});
if (baseData != null && baseData.isSuccess) {
3 years ago
toOrderDetails(
bargainOrderId != null ? bargainOrderId : launchJoinAct.orderId);
3 years ago
} else {
SmartDialog.show(
widget: Tips(
() {
3 years ago
toOrderDetails(bargainOrderId != null
? bargainOrderId
: launchJoinAct.orderId);
3 years ago
},
text: "${baseData.msg}",
));
}
}
}
3 years ago
toOrderDetails(String orderId) {
3 years ago
Navigator.of(context).popAndPushNamed(
'/router/order_details',
arguments: {
"id": orderId,
},
);
// Navigator.of(context).pop();
3 years ago
}
///去砍价详情页面
toBargain() async {
await Navigator.of(context)
.popAndPushNamed('/router/bargain_details', arguments: {
"actRecordId": launchJoinAct.actRecordId,
// "limitNumber": limitNumber,
"storeInfo": storeInfo,
});
}
@override
Widget build(BuildContext context) {
3 years ago
return Stack(
children: [
Container(
// height: 175.h,
// color: Color(0xFF3A405A),
// width: MediaQuery.of(context).size.width,
decoration: BoxDecoration(
image: DecorationImage(
fit: BoxFit.fill,
image: AssetImage("assets/image/settlement_bg.webp"),
),
3 years ago
),
3 years ago
width: double.infinity,
height: 375.h,
),
Scaffold(
backgroundColor: Colors.transparent,
appBar: MyAppBar(
background: Colors.transparent,
leadingColor: Colors.white,
title: S.of(context).dingdanjiesuan,
titleColor: Colors.white,
brightness: Brightness.dark,
titleSize: 18.sp,
),
body: Container(
child: Column(
children: [
Expanded(
child: Container(
child: SingleChildScrollView(
physics: BouncingScrollPhysics(),
3 years ago
child: Container(
3 years ago
child: Column(
children: [
3 years ago
DistributionMode((addressId, isTake, memberCouponId,
orderId, promotionId) {
3 years ago
setState(() {
this.selectedBtn = 0;
});
queryOrderInfo(
addressId,
isTake,
memberCouponId,
orderId,
3 years ago
promotionId ?? (productId ?? ""),
3 years ago
productSkuId ?? "",
actProductId ?? "",
actProductSkuId ?? "",
count1,
3 years ago
payChannel,
tableId ?? 0);
3 years ago
}, queryAddress, storeInfo, address,
selectedAddress, pageType),
SizedBox(
height: 16,
),
/// 预留的手机号, 可修改
// EditPhoneWidget(
// storeInfo,
// mobileChange,
// ),
///订单商品
SettlementOrderCommodity(
selectedBtn,
settleOrderInfo,
minOrderInfo,
tableId,
pageType,
),
///优惠券/备注/会员优惠金额
ActivityCouponRemarks(
couponCart,
activityCart,
settleOrderInfo,
coupons,
promotions,
3 years ago
couponCount(),
placeOrder,
remakers,
3 years ago
() {
3 years ago
Navigator.of(context).pushNamed(
'/router/edit_remarks_page',
arguments: {},
).then((value) => {
3 years ago
setState(() {
if (value != null) remakers = value;
})
});
3 years ago
},
tableId,
3 years ago
),
3 years ago
3 years ago
if (placeOrder && joinA != JoinActivity.BargainBug)
3 years ago
3 years ago
///支付方式
3 years ago
PayMethod(payChannelCheck),
],
3 years ago
),
),
),
3 years ago
),
flex: 1,
),
Container(
height: 54.h,
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [
BoxShadow(
color: Color(0x08213303).withAlpha(12),
offset: Offset(0, -1),
blurRadius: 8,
spreadRadius: 0,
3 years ago
),
3 years ago
],
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Spacer(),
Text(
S.of(context).heji,
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Colors.black,
),
),
Text(
(minOrderInfo != null
? "${minOrderInfo.orderSumPrice}"
: "${settleOrderInfo == null ? "0" : settleOrderInfo.price}"),
style: TextStyle(
fontSize: 20.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF32A060),
),
),
SizedBox(
width: 28,
),
RoundButton(
width: 88.w,
height: 32.h,
radius: 16,
text: joinA == JoinActivity.BargainBug
? "发起砍价"
: (placeOrder ? "提交订单" : "下单"),
textColor: Colors.white,
fontWeight: MyFontWeight.regular,
backgroup: Color(0xFF32A060),
fontSize: 16.sp,
padding: EdgeInsets.symmetric(
vertical: 5.h,
),
callback: () {
pageType != null
? bargainOrderId != null
3 years ago
? activityPay()
: joinA == JoinActivity.GoJoin
? queryJoinAct()
: queryLaunchAct()
3 years ago
: queryPlaceOrderFirst();
},
),
3 years ago
SizedBox(
width: 17,
)
3 years ago
],
),
3 years ago
),
3 years ago
],
),
),
3 years ago
)
],
);
}
3 years ago
payChannelCheck(int payChannel) {
this.payChannel = payChannel;
3 years ago
queryOrderInfo(
address?.id,
selectedBtn,
3 years ago
couponListBean?.id,
3 years ago
0,
3 years ago
promotion?.id ?? productId,
3 years ago
productSkuId ?? "",
actProductId ?? "",
actProductSkuId ?? "",
count1,
3 years ago
payChannel,
tableId);
3 years ago
}
3 years ago
mobileChange(String mobile) {
this.mobile = mobile;
}
3 years ago
int couponCount() {
if (settleOrderInfo == null ||
settleOrderInfo.couponList == null ||
settleOrderInfo.couponList.length == 0) return 0;
int count = 0;
settleOrderInfo.couponList.forEach((element) {
if (element.tenantCode == "") {
count++;
}
});
return count;
}
3 years ago
String coupons = "";
String promotions = "";
3 years ago
///优惠券弹窗
3 years ago
couponCart() async {
CouponListBean couponBean = await showModalBottomSheet(
3 years ago
context: context,
backgroundColor: Colors.transparent,
builder: (context) {
3 years ago
return SettlementCoupon(settleOrderInfo, storeInfo,
couponBean: couponListBean);
3 years ago
},
);
// if (couponBean != null) {
// this.couponListBean = couponBean;
// coupons = couponListBean?.promotionName ?? "";
// promotions = "";
// this.promotion = null;
queryOrderInfo(
3 years ago
address?.id,
selectedBtn,
3 years ago
couponBean?.id,
3 years ago
0,
productId ?? null,
3 years ago
productSkuId ?? "",
3 years ago
actProductId ?? "",
actProductSkuId ?? "",
count1,
3 years ago
payChannel,
tableId);
// }
3 years ago
}
3 years ago
///活动弹窗
activityCart() async {
// if (couponListBean != null) return;
PromotionInfoListBean pro = await showModalBottomSheet(
context: context,
backgroundColor: Colors.transparent,
builder: (context) {
return SettlementActivity(settleOrderInfo, storeInfo);
},
);
// if (pro != null) {
// this.promotion = pro;
// promotions = promotion?.name ?? "";
// coupons = "";
// this.couponListBean = null;
queryOrderInfo(
3 years ago
address?.id,
selectedBtn,
null,
0,
promotion != null ? pro.id : (productId ?? null),
3 years ago
productSkuId ?? "",
3 years ago
actProductId ?? "",
actProductSkuId ?? "",
count1,
3 years ago
payChannel,
tableId);
3 years ago
}
// }
}