Browse Source

更改getorderInfo接口,增加优惠类型,去掉(useVipPrice,useBenefit两个字段);

修改各项优惠的显示隐藏;
new_revision_app
wurong 2 years ago
parent
commit
473a06aa8f
  1. 2
      lib/main.dart
  2. 24
      lib/retrofit/data/member_Infor.dart
  3. 8
      lib/retrofit/data/settleOrderInfo.dart
  4. 126
      lib/settlement/settlement.dart
  5. 10
      lib/settlement/settlement_view/activity_coupon_remarks.dart
  6. 11
      lib/settlement/settlement_view/settlement_order_commodity.dart

2
lib/main.dart

@ -202,7 +202,7 @@ class MyApp extends StatelessWidget {
} else if (locales[0].countryCode == "CN"){
locale = Locale.fromSubtags(languageCode: 'zh', countryCode: 'CH');
} else{
locale = Locale.fromSubtags(languageCode: 'en', countryCode: 'US');
locale = Locale.fromSubtags(languageCode: 'en', countryCode: 'CH');
}
return appLocale ?? locale;
},

24
lib/retrofit/data/member_Infor.dart

@ -31,10 +31,10 @@ class MemberInfor {
int age,
String signature,
String background,
String follow,
String fans,
String trendTotal,
String gainLikeTotal,}){
dynamic follow,
dynamic fans,
dynamic trendTotal,
dynamic gainLikeTotal,}){
_id = id;
_nickname = nickname;
_headimg = headimg;
@ -86,10 +86,10 @@ class MemberInfor {
int _age;
String _signature;
String _background;
String _follow;
String _fans;
String _trendTotal;
String _gainLikeTotal;
dynamic _follow;
dynamic _fans;
dynamic _trendTotal;
dynamic _gainLikeTotal;
String get id => _id;
String get nickname => _nickname;
@ -104,10 +104,10 @@ class MemberInfor {
int get age => _age;
String get signature => _signature;
String get background => _background;
String get follow => _follow;
String get fans => _fans;
String get trendTotal => _trendTotal;
String get gainLikeTotal => _gainLikeTotal;
dynamic get follow => _follow;
dynamic get fans => _fans;
dynamic get trendTotal => _trendTotal;
dynamic get gainLikeTotal => _gainLikeTotal;
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};

8
lib/retrofit/data/settleOrderInfo.dart

@ -23,6 +23,8 @@ class SettleOrderInfo {
int selectDiscount;
bool useVipPriceSelect = false;
String vipDiscountAmount;
String totalDiscountAmount;
String discountType;
static SettleOrderInfo fromJson(Map<String, dynamic> map) {
@ -54,6 +56,8 @@ class SettleOrderInfo {
settleOrderInfoBean.isRaise = map['isRaise'];
settleOrderInfoBean.selectDiscount = map['selectDiscount'];
settleOrderInfoBean.vipDiscountAmount = map['vipDiscountAmount'];
settleOrderInfoBean.totalDiscountAmount = map['totalDiscountAmount'];
settleOrderInfoBean.discountType = map['discountType'];
return settleOrderInfoBean;
}
@ -77,7 +81,9 @@ class SettleOrderInfo {
"usePlateMoney":usePlateMoney,
"isRaise":isRaise,
"selectDiscount":selectDiscount,
"vipDiscountAmount":vipDiscountAmount
"vipDiscountAmount":vipDiscountAmount,
"totalDiscountAmount": totalDiscountAmount,
"discountType":discountType,
};

126
lib/settlement/settlement.dart

@ -7,6 +7,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
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_datetime_picker/flutter_datetime_picker.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:fluwx/fluwx.dart';
@ -16,6 +17,7 @@ import 'package:huixiang/retrofit/data/address.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/down_order.dart';
import 'package:huixiang/retrofit/data/launch_join_act.dart';
import 'package:huixiang/retrofit/data/miNiDetail.dart';
import 'package:huixiang/retrofit/data/min_order_info.dart';
import 'package:huixiang/retrofit/data/placeOrderFirst.dart';
import 'package:huixiang/retrofit/data/settleOrderInfo.dart';
@ -35,7 +37,6 @@ import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:huixiang/view_widget/round_button.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../retrofit/data/shoppingCart.dart';
import '../view_widget/settlement_tips_dialog.dart';
@ -93,6 +94,7 @@ class _Settlement extends State<Settlement> {
String subscribeStoresName;
String subTime;
int storesIndex = 0;
String discountType;
@override
void initState() {
@ -145,8 +147,9 @@ class _Settlement extends State<Settlement> {
productSkuId ?? "",
actProductId ?? "",
actProductSkuId ?? "",
useVipPriceSelect,
useBenefitSelect,
"NONE",
// useVipPriceSelect,
// useBenefitSelect,
count1,
payChannel,
tableId);
@ -160,8 +163,9 @@ class _Settlement extends State<Settlement> {
productSkuId ?? "",
actProductId ?? "",
actProductSkuId ?? "",
useVipPriceSelect,
useBenefitSelect,
"NONE",
// useVipPriceSelect,
// useBenefitSelect,
count1,
payChannel,
tableId);
@ -175,8 +179,9 @@ class _Settlement extends State<Settlement> {
productSkuId ?? "",
actProductId ?? "",
actProductSkuId ?? "",
useVipPriceSelect,
(useVipPriceSelect == true && isVips) ? false:useBenefitSelect,
(isVips == false || tableId > 0) ? ((vipLevelName == "黄金会员" && placeOrder) ? "MEMBER_RANK" :"NONE"):"AUTO",
// useVipPriceSelect,
// (useVipPriceSelect == true && isVips) ? false:useBenefitSelect,
count1,
payChannel,
tableId);
@ -198,8 +203,9 @@ class _Settlement extends State<Settlement> {
productSkuId,
actProductId,
actProductSkuId,
useVipPriceSelect,
useBenefitSelect,
discountType,
// useVipPriceSelect,
// useBenefitSelect,
buyNum,
payChannel,
tableId) async {
@ -215,8 +221,9 @@ class _Settlement extends State<Settlement> {
"productSkuId": productSkuId,
"actProductId": actProductId,
"actProductSkuId": actProductSkuId,
"useVipPrice":useVipPriceSelect,
"useBenefit": useBenefitSelect,
"discountType":discountType,
// "useVipPrice":useVipPriceSelect,
// "useBenefit": useBenefitSelect,
"buyNum": buyNum,
"payChannel":payChannel,
"tableId": tableId
@ -260,8 +267,9 @@ class _Settlement extends State<Settlement> {
productSkuId ?? "",
actProductId ?? "",
actProductSkuId ?? "",
useVipPriceSelect,
useBenefitSelect,
"NONE",
// useVipPriceSelect,
// useBenefitSelect,
count1,
(tableId > 0 ? minOrderInfo.isRaise : settleOrderInfo.isRaise) ? 7 :payChannel,
tableId);
@ -347,8 +355,9 @@ class _Settlement extends State<Settlement> {
productSkuId ?? "",
actProductId ?? "",
actProductSkuId ?? "",
useVipPriceSelect,
useBenefitSelect,
"AUTO",
// useVipPriceSelect,
// useBenefitSelect,
count1,
payChannel,
tableId);
@ -400,8 +409,9 @@ class _Settlement extends State<Settlement> {
productSkuId ?? "",
actProductId ?? "",
actProductSkuId ?? "",
useVipPriceSelect,
useBenefitSelect,
"AUTO",
// useVipPriceSelect,
// useBenefitSelect,
count1,
payChannel,
tableId);
@ -429,8 +439,9 @@ class _Settlement extends State<Settlement> {
productSkuId ?? "",
actProductId ?? "",
actProductSkuId ?? "",
useVipPriceSelect,
useBenefitSelect,
"AUTO",
// useVipPriceSelect,
// useBenefitSelect,
count1,
payChannel,
tableId);
@ -538,8 +549,8 @@ class _Settlement extends State<Settlement> {
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.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.recMobile =
(mobile == null || mobile == "") ? mobile : storeInfo.headMobile;
placeOrderFirst.shoppingCartSkuItemList = settleOrderInfo.orderProductList;
@ -804,8 +815,9 @@ class _Settlement extends State<Settlement> {
productSkuId ?? "",
actProductId ?? "",
actProductSkuId ?? "",
useVipPriceSelect,
useBenefitSelect,
"AUTO",
// useVipPriceSelect,
// useBenefitSelect,
count1,
payChannel,
tableId ?? 0);
@ -839,7 +851,7 @@ class _Settlement extends State<Settlement> {
(coupons != "" || promotions != "")
? false
: useVipPriceSelect,
this.showVipTips),
this.showVipTips,useBenefitSelect,placeOrder),
/////
if (settleOrderInfo != null ||
@ -875,8 +887,6 @@ class _Settlement extends State<Settlement> {
vipBenefitSelect,
payChannel,
vipLevelName,
),
},
subscribeParam,
showDateSelector,
reservationTime,
@ -997,14 +1007,15 @@ class _Settlement extends State<Settlement> {
queryOrderInfo(
address?.id,
selectedBtn,
(settleOrderInfo.isRaise || payChannel == 5 || ((payChannel == 4 && settleOrderInfo.usePlateMoney == false))) ? "" :couponListBean?.id,
(settleOrderInfo.isRaise || payChannel == 5) ? "" :couponListBean?.id,
0,
(settleOrderInfo.isRaise || payChannel == 5 || ((payChannel == 4 && settleOrderInfo.usePlateMoney == false))) ? "" :promotion?.id ?? productId,
(settleOrderInfo.isRaise || payChannel == 5) ? "" :promotion?.id ?? productId,
productSkuId ?? "",
actProductId ?? "",
actProductSkuId ?? "",
(settleOrderInfo.isRaise || payChannel == 5 || ((payChannel == 4 && settleOrderInfo.usePlateMoney == false))) ? false :useVipPriceSelect,
(settleOrderInfo.isRaise || payChannel == 5 || ((payChannel == 4 && settleOrderInfo.usePlateMoney == false)) || useVipPriceSelect == true) ? false :useBenefitSelect,
(settleOrderInfo.isRaise || payChannel == 5) ?"NONE" : ((useVipPriceSelect == false) ? "MEMBER_RANK" : (isVips == false &&vipLevelName == "黄金会员")?"MEMBER_RANK":"AUTO"),
// (settleOrderInfo.isRaise || payChannel == 5 || ((payChannel == 4 && settleOrderInfo.usePlateMoney == false))) ? false :useVipPriceSelect,
// (settleOrderInfo.isRaise || payChannel == 5 || ((payChannel == 4 && settleOrderInfo.usePlateMoney == false)) || useVipPriceSelect == true) ? false :useBenefitSelect,
count1,
payChannel,
tableId);}
@ -1025,13 +1036,15 @@ class _Settlement extends State<Settlement> {
productSkuId ?? "",
actProductId ?? "",
actProductSkuId ?? "",
useVipPriceSelect,
useVipPriceSelect == true ? false :useBenefitSelect,
useVipPriceSelect == true ? "VIP": "MEMBER_RANK",
// useVipPriceSelect,
// useVipPriceSelect == true ? false :useBenefitSelect,
count1,
payChannel,
tableId);}
}
///
vipBenefitSelect(bool useBenefitSelect) {
this.useBenefitSelect = useBenefitSelect;
if (tableId > 0) {
@ -1046,8 +1059,9 @@ class _Settlement extends State<Settlement> {
productSkuId ?? "",
actProductId ?? "",
actProductSkuId ?? "",
useVipPriceSelect,
useBenefitSelect,
"MEMBER_RANK",
// useVipPriceSelect,
// useBenefitSelect,
count1,
payChannel,
tableId);
@ -1103,8 +1117,9 @@ class _Settlement extends State<Settlement> {
productSkuId ?? "",
actProductId ?? "",
actProductSkuId ?? "",
useVipPriceSelect,
useBenefitSelect,
(couponBean?.id ?? 0) == 0 ?((isVips == false &&vipLevelName == "黄金会员") ? "MEMBER_RANK" :"AUTO"):"NONE",
// useVipPriceSelect,
// useBenefitSelect,
count1,
payChannel,
tableId);
@ -1133,12 +1148,13 @@ class _Settlement extends State<Settlement> {
selectedBtn,
0,
0,
(pro.id ?? "") ?? productId,
(pro?.id ?? 0) ?? productId,
productSkuId ?? "",
actProductId ?? "",
actProductSkuId ?? "",
useVipPriceSelect,
useBenefitSelect,
((pro?.id ?? 0) ?? productId) == 0 ?((isVips == false &&vipLevelName == "黄金会员") ? "MEMBER_RANK" :"AUTO"):"NONE",
// useVipPriceSelect,
// useBenefitSelect,
count1,
payChannel,
tableId);
@ -1195,38 +1211,6 @@ class _Settlement extends State<Settlement> {
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Container(
// padding: EdgeInsets.symmetric(vertical: 10.h, horizontal: 14.w),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// GestureDetector(
// onTap: () {
// Navigator.of(context).pop();
// },
// child: Text(
// S.of(context).quxiao,
// style:
// TextStyle(fontSize: 18.sp, color: Colors.black),
// ),
// ),
// GestureDetector(
// onTap: () {
// setState(() {
// subscribeStoresName =
// subscribeParam.stores[storesIndex];
// });
// Navigator.of(context).pop();
// },
// child: Text(
// S.of(context).queding,
// style: TextStyle(
// fontSize: 18.sp, color: Color(0xFF32A060)),
// ),
// ),
// ],
// ),
// ),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,

10
lib/settlement/settlement_view/activity_coupon_remarks.dart

@ -53,13 +53,13 @@ class ActivityCouponRemarks extends StatefulWidget {
this.showVipTips,
this.vipBenefitSelect,
this.payChannell,
this.vipLevelName);
this.showVipTips,
this.vipLevelName,
this.subscribeParam,
this.showDateSelector,
this.reservationTime,
this.showAlertDialog,
this.subscribeStoresName);
this.subscribeStoresName
);
@override
State<StatefulWidget> createState() {
@ -270,8 +270,8 @@ class _ActivityCouponRemarks extends State<ActivityCouponRemarks> {
// ),
// ),
if (widget.placeOrder &&
widget?.settleOrderInfo?.benefitDiscountAmount != null &&
widget?.settleOrderInfo?.benefitDiscountAmount != "0")
(widget?.settleOrderInfo?.discountType == "MEMBER_RANK" && widget?.settleOrderInfo?.benefitDiscountAmount != null &&
widget?.settleOrderInfo?.benefitDiscountAmount != "0"))
Container(
margin: EdgeInsets.only(bottom: 13),
child: Row(

11
lib/settlement/settlement_view/settlement_order_commodity.dart

@ -117,13 +117,13 @@ class _SettlementOrderCommodity extends State<SettlementOrderCommodity> {
if (widget.useVipPriceSelect &&
widget.settleOrderInfo.memberVO.isVip &&
(widget.tableId > 0 ? !(widget?.minOrderInfo?.isRaise ?? false) : !(widget?.settleOrderInfo?.isRaise ?? false)) &&
(widget?.settleOrderInfo?.discountAmount != "0")) {
(widget?.settleOrderInfo?.discountType == "VIP" && widget?.settleOrderInfo?.vipDiscountAmount != "0")) {
widgets.add(vipItem(Color(0xFFFF7A1A), "VIP优惠",
(widget.minOrderInfo != null && widget.minOrderInfo.orderProductVOList != null) ? (widget.minOrderInfo?.discountAmount ?? ""):(widget?.settleOrderInfo?.discountAmount ?? "")));
(widget.minOrderInfo != null && widget.minOrderInfo.orderProductVOList != null) ? (widget.minOrderInfo?.discountAmount ?? ""):(widget?.settleOrderInfo?.vipDiscountAmount ?? "")));
}
if (widget.useBenefitSelect &&
(widget?.settleOrderInfo?.benefitDiscountAmount != "0") && ((widget.tableId > 0 ? !(widget?.minOrderInfo?.isRaise ?? false) : !(widget?.settleOrderInfo?.isRaise ?? false)))) {
(widget?.settleOrderInfo?.discountType == "MEMBER_RANK" && widget?.settleOrderInfo?.benefitDiscountAmount != "0") && ((widget.tableId > 0 ? !(widget?.minOrderInfo?.isRaise ?? false) : !(widget?.settleOrderInfo?.isRaise ?? false)))) {
widgets.add(vipItem(Color(0xFFFF7A1A), "会员优惠金额",
(widget.minOrderInfo != null && widget.minOrderInfo.orderProductVOList != null) ? (widget.minOrderInfo?.benefitDiscountAmount ?? "") :(widget?.settleOrderInfo?.benefitDiscountAmount ?? "")));
}
@ -251,7 +251,7 @@ class _SettlementOrderCommodity extends State<SettlementOrderCommodity> {
color: Color(0xFF4C4C4C),
),
),
if (productList.discountAmount != null)
if (productList.discountAmount != null && productList.discountAmount != "0")
Text(
S.of(context).yuan_(productList.sellPrice),
style: TextStyle(
@ -504,13 +504,14 @@ class _SettlementOrderCommodity extends State<SettlementOrderCommodity> {
);
}
///
String discountPrice() {
if (widget.minOrderInfo != null) {
return AppUtils.calculateDouble(double.tryParse(widget.minOrderInfo?.totalDiscountPrice ?? "0"));
} else if (widget.tableId < 0) {
return "0";
} else {
return AppUtils.calculateDouble(double.tryParse(widget?.settleOrderInfo?.discountAmount ?? "0") + double.tryParse(widget?.settleOrderInfo?.benefitDiscountAmount ?? "0"));
return AppUtils.calculateDouble(double.tryParse(widget?.settleOrderInfo?.totalDiscountAmount ?? "0"));
}
}

Loading…
Cancel
Save