Browse Source

Merge branches 'dev' and 'master' of https://git.lotus-wallet.com/fmk/huixiang_app

 Conflicts:
	lib/store/store_view/settlement.dart
master
fmk 3 years ago
parent
commit
e92e5eb7c2
  1. 5
      lib/home/home_view/featured_acticvity.dart
  2. 37
      lib/retrofit/min_api.dart
  3. 5
      lib/store/store_order.dart
  4. 6
      lib/store/store_view/settlement.dart
  5. 76
      lib/store/store_view/settlement_order_commodity.dart
  6. 72
      lib/store/store_view/store_order_list.dart

5
lib/home/home_view/featured_acticvity.dart

@ -26,7 +26,7 @@ class _FeaturedActivity extends State<FeaturedActivity> {
height: 10.h, height: 10.h,
), ),
Container( Container(
margin: EdgeInsets.symmetric(horizontal: 11.w), margin: EdgeInsets.symmetric(horizontal: 9.w),
child: Row( child: Row(
children: [ children: [
Container( Container(
@ -65,9 +65,6 @@ class _FeaturedActivity extends State<FeaturedActivity> {
), ),
), ),
), ),
SizedBox(
height: 10.h,
),
Container( Container(
child: stackItem(14.sp), child: stackItem(14.sp),
margin: EdgeInsets.symmetric(horizontal: 5.w), margin: EdgeInsets.symmetric(horizontal: 5.w),

37
lib/retrofit/min_api.dart

@ -15,13 +15,18 @@ import 'data/findMiNiGroupList.dart';
import 'data/miNiDetail.dart'; import 'data/miNiDetail.dart';
import 'data/settleOrderInfo.dart'; import 'data/settleOrderInfo.dart';
import 'data/shoppingCart.dart'; import 'data/shoppingCart.dart';
part 'min_api.g.dart'; part 'min_api.g.dart';
// const base_url = "https://pos.platform.lotus-wallet.com/app/"; /// // const base_url = "https://pos.platform.lotus-wallet.com/app/"; ///
// const baseUrl = "https://pos.platform.lotus-wallet.com/app/"; /// // const baseUrl = "https://pos.platform.lotus-wallet.com/app/"; ///
const base_url = "http://192.168.10.236:8765/app/"; /// const base_url = "http://192.168.10.236:8765/app/";
const baseUrl = "http://192.168.10.236:8765/app/"; ///
///
const baseUrl = "http://192.168.10.236:8765/app/";
///
// const base_url = "http://192.168.10.37:8766/app/"; // const base_url = "http://192.168.10.37:8766/app/";
// const baseUrl = "http://192.168.10.37:8766/app/"; // const baseUrl = "http://192.168.10.37:8766/app/";
@ -29,7 +34,8 @@ const baseUrl = "http://192.168.10.236:8765/app/"; ///费韬
/// ///
@RestApi(baseUrl: baseUrl) @RestApi(baseUrl: baseUrl)
abstract class MinApiService { abstract class MinApiService {
factory MinApiService(Dio dio, { factory MinApiService(
Dio dio, {
String baseUrl, String baseUrl,
BuildContext context, BuildContext context,
String token, String token,
@ -38,7 +44,7 @@ abstract class MinApiService {
bool pay = false, bool pay = false,
}) { }) {
Map<String, dynamic> headers = Map<String, dynamic> headers =
(token == null || token == "") ? {} : {'token': "Bearer $token"}; (token == null || token == "") ? {} : {'token': "Bearer $token"};
if (tenant != null && tenant != "") { if (tenant != null && tenant != "") {
headers["tenant"] = tenant; headers["tenant"] = tenant;
} }
@ -53,7 +59,8 @@ abstract class MinApiService {
); );
dio.interceptors.add( dio.interceptors.add(
InterceptorsWrapper(onRequest: (RequestOptions options) { InterceptorsWrapper(onRequest: (RequestOptions options) {
debugPrint("\n======================= Min_请求数据 ======================="); debugPrint(
"\n======================= Min_请求数据 =======================");
debugPrint("method = ${options.method.toString()}"); debugPrint("method = ${options.method.toString()}");
debugPrint("url = ${options.uri.toString()}"); debugPrint("url = ${options.uri.toString()}");
debugPrint("headers = ${options.headers}"); debugPrint("headers = ${options.headers}");
@ -68,14 +75,16 @@ abstract class MinApiService {
} }
debugPrint("params queryParameters = ${options.queryParameters}"); debugPrint("params queryParameters = ${options.queryParameters}");
}, onResponse: (Response response) { }, onResponse: (Response response) {
debugPrint("\n======================= Min_响应数据开始 ======================="); debugPrint(
"\n======================= Min_响应数据开始 =======================");
if (showLoading && EasyLoading.isShow) { if (showLoading && EasyLoading.isShow) {
EasyLoading.dismiss(); EasyLoading.dismiss();
} }
debugPrint("code = ${response.statusCode}"); debugPrint("code = ${response.statusCode}");
// p(jsonEncode(response.data)); // p(jsonEncode(response.data));
debugPrint(jsonEncode(response.data), wrapWidth: response.data.toString().length); debugPrint(jsonEncode(response.data),
wrapWidth: response.data.toString().length);
Map map = response.data; Map map = response.data;
if (map["code"] != 0) { if (map["code"] != 0) {
@ -90,12 +99,14 @@ abstract class MinApiService {
///poi服务请求不需要toast ///poi服务请求不需要toast
SmartDialog.showToast(map["msg"], alignment: Alignment.center); SmartDialog.showToast(map["msg"], alignment: Alignment.center);
} }
debugPrint("======================= Min_响应数据结束 =======================\n"); debugPrint(
"======================= Min_响应数据结束 =======================\n");
}, onError: (DioError e) { }, onError: (DioError e) {
if (EasyLoading.isShow) { if (EasyLoading.isShow) {
EasyLoading.dismiss(); EasyLoading.dismiss();
} }
debugPrint("\n======================= Min_错误响应数据 ======================="); debugPrint(
"\n======================= Min_错误响应数据 =======================");
debugPrint("type = ${e.type}"); debugPrint("type = ${e.type}");
debugPrint("message = ${e.message}"); debugPrint("message = ${e.message}");
debugPrint("\n"); debugPrint("\n");
@ -122,7 +133,6 @@ abstract class MinApiService {
Future<BaseData<List<FindMiNiGroupList>>> findMiNiGroupList( Future<BaseData<List<FindMiNiGroupList>>> findMiNiGroupList(
@Body() Map<String, dynamic> param); @Body() Map<String, dynamic> param);
//// ////
@GET("/product/queryMiNiProductDetail?id={id}") @GET("/product/queryMiNiProductDetail?id={id}")
Future<BaseData<MiNiDetail>> miNiDetail(@Path("id") String id); Future<BaseData<MiNiDetail>> miNiDetail(@Path("id") String id);
@ -130,13 +140,10 @@ abstract class MinApiService {
/// ///
@POST("shoppingcart") @POST("shoppingcart")
Future<BaseData<ShoppingCart>> shoppingCart( Future<BaseData<ShoppingCart>> shoppingCart(
@Body() Map<String, dynamic> param,Map<String, dynamic> header); @Body() Map<String, dynamic> param, Map<String, dynamic> header);
/// ///
@POST("order/getOrderInfo") @POST("order/getOrderInfo")
Future<BaseData<SettleOrderInfo>> getOrderInfo( Future<BaseData<SettleOrderInfo>> getOrderInfo(
@Body() Map<String, dynamic> param); @Body() Map<String, dynamic> param);
}
}

5
lib/store/store_order.dart

@ -420,7 +420,7 @@ class _StoreOrderPage extends State<StoreOrderPage>
toDownOrder() { toDownOrder() {
if (shopCarGoods == null || shopCarGoods.length == 0) { if (shopCarGoods == null || shopCarGoods.length == 0) {
SmartDialog.showToast("请选择要购买的商品~"); SmartDialog.showToast("请选择要购买的商品~");
return ; return;
} }
getShopCarGoods(); getShopCarGoods();
@ -494,7 +494,6 @@ class _StoreOrderPage extends State<StoreOrderPage>
/// ///
showShoppingCart() { showShoppingCart() {
getShopCarGoods(); getShopCarGoods();
showModalBottomSheet( showModalBottomSheet(
@ -537,7 +536,7 @@ class _StoreOrderPage extends State<StoreOrderPage>
addsShoppingCart() async { addsShoppingCart() async {
BaseData baseDate = await apiService.creditOrder({ BaseData baseDate = await apiService.creditOrder({
"parentId": widget.arguments["parentId"], "parentId": widget.arguments["parentId"],
"skuImg": widget.arguments["skuImg"], "skuImg": null,
"skuNameStr": widget.arguments["skuNameStr"], "skuNameStr": widget.arguments["skuNameStr"],
"skuPrice": widget.arguments["skuPrice"], "skuPrice": widget.arguments["skuPrice"],
"skuStock": widget.arguments["skuStock"], "skuStock": widget.arguments["skuStock"],

6
lib/store/store_view/settlement.dart

@ -615,7 +615,10 @@ class _Settlement extends State<Settlement> {
), ),
), ),
Text( Text(
"满30减10", (settleOrderInfo?.couponList == null || settleOrderInfo.couponList.length == 0)
? "暂无可用优惠券" : (selectedCouponIndex == -1
? "拥有${settleOrderInfo.couponList.length}张优惠券":
settleOrderInfo.couponList[selectedCouponIndex].promotionName),
textAlign: TextAlign.end, textAlign: TextAlign.end,
style: TextStyle( style: TextStyle(
fontSize: 14.sp, fontSize: 14.sp,
@ -674,7 +677,6 @@ class _Settlement extends State<Settlement> {
); );
} }
///
Widget payMethod() { Widget payMethod() {
return Container( return Container(
width: double.infinity, width: double.infinity,

76
lib/store/store_view/settlement_order_commodity.dart

@ -1,9 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/order_info.dart'; import 'package:huixiang/retrofit/data/findMiNiGroupList.dart';
import 'package:huixiang/retrofit/data/settleOrderInfo.dart'; import 'package:huixiang/retrofit/data/settleOrderInfo.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/custom_image.dart';
@ -11,15 +9,16 @@ import 'package:huixiang/view_widget/separator.dart';
class SettlementOrderCommodity extends StatefulWidget { class SettlementOrderCommodity extends StatefulWidget {
final int isTakeOut; final int isTakeOut;
final SettleOrderInfo orderInfo; final List<ProductListBean> orderInfo;
final List<Map<String, dynamic>> shopCarGood;
final SettleOrderInfo settleOrderInfo;
SettlementOrderCommodity(this.orderInfo,this.isTakeOut); SettlementOrderCommodity(this.orderInfo, this.isTakeOut,this.shopCarGood,this.settleOrderInfo);
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
return _SettlementOrderCommodity(); return _SettlementOrderCommodity();
} }
} }
class _SettlementOrderCommodity extends State<SettlementOrderCommodity> { class _SettlementOrderCommodity extends State<SettlementOrderCommodity> {
@ -66,13 +65,12 @@ class _SettlementOrderCommodity extends State<SettlementOrderCommodity> {
); );
} }
List<Widget> commodityList() { List<Widget> commodityList() {
if (widget.orderInfo == null) return []; if (widget.orderInfo == null) return [];
List<Widget> widgets = []; List<Widget> widgets = [];
if (widget.orderInfo.orderProductList != null) { if (widget.orderInfo != null) {
widgets widgets.addAll(
.addAll(widget.orderInfo.orderProductList.map((e) => commodityItem(e)).toList()); widget.orderInfo.map((e) => commodityItem(e)).toList());
} }
widgets.add(SizedBox(height: 20.h)); widgets.add(SizedBox(height: 20.h));
@ -84,7 +82,8 @@ class _SettlementOrderCommodity extends State<SettlementOrderCommodity> {
? S.of(context).peisongfei ? S.of(context).peisongfei
: S.of(context).yunfei, : S.of(context).yunfei,
"", "",
"+${widget.orderInfo.postAge}")); "+${widget.settleOrderInfo?.postAge??"0"}"
));
} }
widgets.add(Container( widgets.add(Container(
@ -102,13 +101,20 @@ class _SettlementOrderCommodity extends State<SettlementOrderCommodity> {
return widgets; return widgets;
} }
Widget commodityItem(OrderProductListBean productList) { Widget commodityItem(ProductListBean productList) {
Map<String,dynamic> goodsBuyInfo;
widget.shopCarGood.forEach((element) {
if(element["id"] == productList.id){
goodsBuyInfo = element;
return;
}
});
return Container( return Container(
margin: EdgeInsets.only(top: 8.h, bottom: 8.h), margin: EdgeInsets.only(top: 8.h, bottom: 8.h),
child: Row( child: Row(
children: [ children: [
MImage( MImage(
productList.skuImg, productList.imgPath,
width: 44.w, width: 44.w,
height: 44, height: 44,
fit: BoxFit.cover, fit: BoxFit.cover,
@ -139,7 +145,7 @@ class _SettlementOrderCommodity extends State<SettlementOrderCommodity> {
), ),
), ),
Text( Text(
"x${productList.buyNum}", "x${goodsBuyInfo["count"]}",
style: TextStyle( style: TextStyle(
fontSize: 12.sp, fontSize: 12.sp,
color: Color(0xFF727272), color: Color(0xFF727272),
@ -165,7 +171,7 @@ class _SettlementOrderCommodity extends State<SettlementOrderCommodity> {
), ),
), ),
Text( Text(
S.of(context).yuan_(productList.sellPrice), S.of(context).yuan_(productList.price),
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 12.sp, fontSize: 12.sp,
@ -312,15 +318,14 @@ class _SettlementOrderCommodity extends State<SettlementOrderCommodity> {
children: [ children: [
Expanded( Expanded(
child: Text( child: Text(
S.of(context).gongjijianshangpin( S.of(context).gongjijianshangpin((widget.orderInfo != null &&
(widget.orderInfo != null && widget.orderInfo.orderProductList != null) widget.orderInfo != null)
? widget.orderInfo.orderProductList.length ? widget.orderInfo.length
: "0"), : "0"),
style: TextStyle( style: TextStyle(
fontSize: 10.sp, fontSize: 10.sp,
color: Color(0xFFA29E9E), color: Color(0xFFA29E9E),
fontWeight: MyFontWeight.semi_bold fontWeight: MyFontWeight.semi_bold),
),
), ),
flex: 1, flex: 1,
), ),
@ -328,10 +333,9 @@ class _SettlementOrderCommodity extends State<SettlementOrderCommodity> {
child: Text( child: Text(
S.of(context).jiesuanjine, S.of(context).jiesuanjine,
style: TextStyle( style: TextStyle(
fontSize: 12.sp, fontSize: 12.sp,
color: Color(0xFF353535), color: Color(0xFF353535),
fontWeight:MyFontWeight.semi_bold fontWeight: MyFontWeight.semi_bold),
),
), ),
), ),
SizedBox( SizedBox(
@ -341,10 +345,9 @@ class _SettlementOrderCommodity extends State<SettlementOrderCommodity> {
totalPrice(), totalPrice(),
textAlign: TextAlign.end, textAlign: TextAlign.end,
style: TextStyle( style: TextStyle(
fontSize:14.sp, fontSize: 14.sp,
color: Color(0xFF32A060), color: Color(0xFF32A060),
fontWeight: MyFontWeight.semi_bold fontWeight: MyFontWeight.semi_bold),
),
) )
], ],
), ),
@ -352,10 +355,11 @@ class _SettlementOrderCommodity extends State<SettlementOrderCommodity> {
} }
String totalPrice() { String totalPrice() {
if (widget.orderInfo == null) return ""; if (widget.shopCarGood == null) return "";
double totalPrice = (double.tryParse(widget.orderInfo.orderSum) + double totalPrice = 0;
double.tryParse(widget.orderInfo.postAge)); widget.shopCarGood.forEach((element) {
totalPrice += double.tryParse(element["price"]) * element["count"];
});
return "$totalPrice"; return "$totalPrice";
} }
}
}

72
lib/store/store_view/store_order_list.dart

@ -86,42 +86,40 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
width: MediaQuery.of(context).size.width, width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height - (kToolbarHeight + 38 + 54.h), height: MediaQuery.of(context).size.height - (kToolbarHeight + 38 + 54.h),
margin: EdgeInsets.only( margin: EdgeInsets.only(
top: (MediaQuery.of(context).padding.top + 38 + kToolbarHeight), top: (MediaQuery.of(context).padding.top + 38 + kToolbarHeight),
), ),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
children: [ children: [
Container( Container(
width: 100.w, width: 100.w,
child: ListView.builder( child: ListView.builder(
itemCount: itemCount: appletProducts == null ? 0 : appletProducts.length,
appletProducts == null ? 0 : appletProducts.length, controller: controller1,
controller: controller1, physics: BouncingScrollPhysics(),
physics: BouncingScrollPhysics(), padding: EdgeInsets.only(top: 0, bottom: 25),
padding: EdgeInsets.only(top: 0, bottom: 25), itemBuilder: (context, position) {
itemBuilder: (context, position) { return orderItem(appletProducts[position], position);
return orderItem(appletProducts[position], position); },
},
),
), ),
Container( ),
width: MediaQuery.of(context).size.width - 100.w, Container(
child: ListView.builder( width: MediaQuery.of(context).size.width - 100.w,
itemCount: productListBeans == null child: ListView.builder(
? 0 : productListBeans.length, itemCount: productListBeans == null ? 0 : productListBeans.length,
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
itemBuilder: (context, position) { itemBuilder: (context, position) {
return goodsItem(position); return goodsItem(position);
}, },
),
), ),
], ),
), ],
),
); );
} }
@ -226,8 +224,10 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
double singlePrice = double.tryParse(element2["price"]); double singlePrice = double.tryParse(element2["price"]);
allCount += element2["count"]; allCount += element2["count"];
AiDecimalAccuracy aiDecimalAccuracy = AiDecimalAccuracy.fromInt(element2["count"]); AiDecimalAccuracy aiDecimalAccuracy =
AiDecimalAccuracy aiPrice = AiDecimalAccuracy.tryParse("$singlePrice"); AiDecimalAccuracy.fromInt(element2["count"]);
AiDecimalAccuracy aiPrice =
AiDecimalAccuracy.tryParse("$singlePrice");
allPrice += (aiPrice * aiDecimalAccuracy); allPrice += (aiPrice * aiDecimalAccuracy);
} }

Loading…
Cancel
Save