Browse Source

更改

master
w-R 3 years ago
parent
commit
ee45331df0
  1. 3
      lib/home/home_view/featured_acticvity.dart
  2. 31
      lib/retrofit/min_api.dart
  3. 1
      lib/store/store_order.dart
  4. 37
      lib/store/store_view/settlement.dart
  5. 61
      lib/store/store_view/settlement_order_commodity.dart
  6. 12
      lib/store/store_view/store_order_list.dart

3
lib/home/home_view/featured_acticvity.dart

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

31
lib/retrofit/min_api.dart

@ -15,13 +15,18 @@ import 'data/findMiNiGroupList.dart';
import 'data/miNiDetail.dart';
import 'data/settleOrderInfo.dart';
import 'data/shoppingCart.dart';
part 'min_api.g.dart';
// const base_url = "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 baseUrl = "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 base_url = "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)
abstract class MinApiService {
factory MinApiService(Dio dio, {
factory MinApiService(
Dio dio, {
String baseUrl,
BuildContext context,
String token,
@ -53,7 +59,8 @@ abstract class MinApiService {
);
dio.interceptors.add(
InterceptorsWrapper(onRequest: (RequestOptions options) {
debugPrint("\n======================= Min_请求数据 =======================");
debugPrint(
"\n======================= Min_请求数据 =======================");
debugPrint("method = ${options.method.toString()}");
debugPrint("url = ${options.uri.toString()}");
debugPrint("headers = ${options.headers}");
@ -68,14 +75,16 @@ abstract class MinApiService {
}
debugPrint("params queryParameters = ${options.queryParameters}");
}, onResponse: (Response response) {
debugPrint("\n======================= Min_响应数据开始 =======================");
debugPrint(
"\n======================= Min_响应数据开始 =======================");
if (showLoading && EasyLoading.isShow) {
EasyLoading.dismiss();
}
debugPrint("code = ${response.statusCode}");
// 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;
if (map["code"] != 0) {
@ -90,12 +99,14 @@ abstract class MinApiService {
///poi服务请求不需要toast
SmartDialog.showToast(map["msg"], alignment: Alignment.center);
}
debugPrint("======================= Min_响应数据结束 =======================\n");
debugPrint(
"======================= Min_响应数据结束 =======================\n");
}, onError: (DioError e) {
if (EasyLoading.isShow) {
EasyLoading.dismiss();
}
debugPrint("\n======================= Min_错误响应数据 =======================");
debugPrint(
"\n======================= Min_错误响应数据 =======================");
debugPrint("type = ${e.type}");
debugPrint("message = ${e.message}");
debugPrint("\n");
@ -122,7 +133,6 @@ abstract class MinApiService {
Future<BaseData<List<FindMiNiGroupList>>> findMiNiGroupList(
@Body() Map<String, dynamic> param);
////
@GET("/product/queryMiNiProductDetail?id={id}")
Future<BaseData<MiNiDetail>> miNiDetail(@Path("id") String id);
@ -136,7 +146,4 @@ abstract class MinApiService {
@POST("order/getOrderInfo")
Future<BaseData<SettleOrderInfo>> getOrderInfo(
@Body() Map<String, dynamic> param);
}

1
lib/store/store_order.dart

@ -494,7 +494,6 @@ class _StoreOrderPage extends State<StoreOrderPage>
///
showShoppingCart() {
getShopCarGoods();
showModalBottomSheet(

37
lib/store/store_view/settlement.dart

@ -5,10 +5,9 @@ import 'package:flutter/services.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/order/order_view/order_commodity.dart';
import 'package:huixiang/order/order_view/order_info.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/coupon.dart';
import 'package:huixiang/retrofit/data/findMiNiGroupList.dart';
import 'package:huixiang/retrofit/data/order_info.dart';
import 'package:huixiang/retrofit/data/settleOrderInfo.dart';
import 'package:huixiang/retrofit/data/store_info.dart';
@ -16,8 +15,6 @@ import 'package:huixiang/retrofit/min_api.dart';
import 'package:huixiang/store/store_view/settlement_order_commodity.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:huixiang/view_widget/rename_dialog.dart';
import 'package:huixiang/view_widget/rename_dialog_content.dart';
import 'package:huixiang/view_widget/round_button.dart';
import 'package:huixiang/view_widget/separator.dart';
import 'package:shared_preferences/shared_preferences.dart';
@ -42,7 +39,10 @@ class _Settlement extends State<Settlement> {
GestureTapCallback callbackEx;
int isSelected = 0;
StoreInfo storeInfo;
List<ProductListBean> shopCar = [];
List<Map<String, dynamic>> shopCarGoods = [];
SettleOrderInfo settleOrderInfo;
int selectedCouponIndex = -1;
TextEditingController _vc;
List<String> addressBgs = [
@ -55,6 +55,8 @@ class _Settlement extends State<Settlement> {
void initState() {
super.initState();
storeInfo = widget.arguments["storeInfo"];
shopCar = widget.arguments["shopProduct"];
shopCarGoods = widget.arguments["shopGoods"];
_vc = TextEditingController(
text: storeInfo != null ? storeInfo.headMobile : "");
@ -78,18 +80,27 @@ class _Settlement extends State<Settlement> {
"addressId": null,
"isTake": 0,
"memberCouponId": null,
// "orderId": widget.arguments["orderId"],
"orderId": "1449199929208602624",
"orderId": 0,
"promotionId": null
});
if (baseData != null && baseData.isSuccess) {
setState(() {
settleOrderInfo = baseData.data;
setState(() {});
});
}
}
bool isEdit = false;
String totalPrice() {
if (shopCarGoods == null) return "";
double totalPrice = 0;
shopCarGoods.forEach((element) {
totalPrice += double.tryParse(element["price"]) * element["count"];
});
return "$totalPrice";
}
@override
Widget build(BuildContext context) {
return Stack(
@ -176,7 +187,8 @@ class _Settlement extends State<Settlement> {
color: Color(0xFF4C4C4C),
),
textAlign: TextAlign.right,
textAlignVertical: TextAlignVertical.center,
textAlignVertical:
TextAlignVertical.center,
keyboardType: TextInputType.phone,
decoration: InputDecoration(
errorBorder: InputBorder.none,
@ -238,7 +250,7 @@ class _Settlement extends State<Settlement> {
),
///
SettlementOrderCommodity(settleOrderInfo, 0),
SettlementOrderCommodity(shopCar, 0,shopCarGoods,settleOrderInfo),
// if (payStatus == 0) couponRemarks(),
/*(payStatus == 0) ? paySelector() : */
@ -278,7 +290,7 @@ class _Settlement extends State<Settlement> {
),
),
Text(
"¥19.00",
totalPrice(),
style: TextStyle(
fontSize: 20.sp,
fontWeight: MyFontWeight.semi_bold,
@ -613,7 +625,10 @@ class _Settlement extends State<Settlement> {
),
),
Text(
"满30减10",
(settleOrderInfo?.couponList == null || settleOrderInfo.couponList.length == 0)
? "暂无可用优惠券" : (selectedCouponIndex == -1
? "拥有${settleOrderInfo.couponList.length}张优惠券":
settleOrderInfo.couponList[selectedCouponIndex].promotionName),
textAlign: TextAlign.end,
style: TextStyle(
fontSize: 14.sp,

61
lib/store/store_view/settlement_order_commodity.dart

@ -1,24 +1,24 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.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/utils/font_weight.dart';
import 'package:huixiang/view_widget/custom_image.dart';
import 'package:huixiang/view_widget/separator.dart';
class SettlementOrderCommodity extends StatefulWidget {
final int isTakeOut;
final OrderInfo 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
State<StatefulWidget> createState() {
return _SettlementOrderCommodity();
}
}
class _SettlementOrderCommodity extends State<SettlementOrderCommodity> {
@ -65,13 +65,12 @@ class _SettlementOrderCommodity extends State<SettlementOrderCommodity> {
);
}
List<Widget> commodityList() {
if (widget.orderInfo == null) return [];
List<Widget> widgets = [];
if (widget.orderInfo.productList != null) {
widgets
.addAll(widget.orderInfo.productList.map((e) => commodityItem(e)).toList());
if (widget.orderInfo != null) {
widgets.addAll(
widget.orderInfo.map((e) => commodityItem(e)).toList());
}
widgets.add(SizedBox(height: 20.h));
@ -83,7 +82,8 @@ class _SettlementOrderCommodity extends State<SettlementOrderCommodity> {
? S.of(context).peisongfei
: S.of(context).yunfei,
"",
"+${widget.orderInfo.productList}"));
"+${widget.settleOrderInfo?.postAge??"0"}"
));
}
widgets.add(Container(
@ -101,13 +101,20 @@ class _SettlementOrderCommodity extends State<SettlementOrderCommodity> {
return widgets;
}
Widget commodityItem(ProductList productList) {
Widget commodityItem(ProductListBean productList) {
Map<String,dynamic> goodsBuyInfo;
widget.shopCarGood.forEach((element) {
if(element["id"] == productList.id){
goodsBuyInfo = element;
return;
}
});
return Container(
margin: EdgeInsets.only(top: 8.h, bottom: 8.h),
child: Row(
children: [
MImage(
productList.skuImg,
productList.imgPath,
width: 44.w,
height: 44,
fit: BoxFit.cover,
@ -138,7 +145,7 @@ class _SettlementOrderCommodity extends State<SettlementOrderCommodity> {
),
),
Text(
"x${productList.buyNum}",
"x${goodsBuyInfo["count"]}",
style: TextStyle(
fontSize: 12.sp,
color: Color(0xFF727272),
@ -164,7 +171,7 @@ class _SettlementOrderCommodity extends State<SettlementOrderCommodity> {
),
),
Text(
S.of(context).yuan_(productList.sellPrice),
S.of(context).yuan_(productList.price),
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 12.sp,
@ -311,15 +318,14 @@ class _SettlementOrderCommodity extends State<SettlementOrderCommodity> {
children: [
Expanded(
child: Text(
S.of(context).gongjijianshangpin(
(widget.orderInfo != null && widget.orderInfo.productList != null)
? widget.orderInfo.productList.length
S.of(context).gongjijianshangpin((widget.orderInfo != null &&
widget.orderInfo != null)
? widget.orderInfo.length
: "0"),
style: TextStyle(
fontSize: 10.sp,
color: Color(0xFFA29E9E),
fontWeight: MyFontWeight.semi_bold
),
fontWeight: MyFontWeight.semi_bold),
),
flex: 1,
),
@ -329,8 +335,7 @@ class _SettlementOrderCommodity extends State<SettlementOrderCommodity> {
style: TextStyle(
fontSize: 12.sp,
color: Color(0xFF353535),
fontWeight:MyFontWeight.semi_bold
),
fontWeight: MyFontWeight.semi_bold),
),
),
SizedBox(
@ -342,8 +347,7 @@ class _SettlementOrderCommodity extends State<SettlementOrderCommodity> {
style: TextStyle(
fontSize: 14.sp,
color: Color(0xFF32A060),
fontWeight: MyFontWeight.semi_bold
),
fontWeight: MyFontWeight.semi_bold),
)
],
),
@ -351,10 +355,11 @@ class _SettlementOrderCommodity extends State<SettlementOrderCommodity> {
}
String totalPrice() {
if (widget.orderInfo == null) return "";
double totalPrice = (double.tryParse(widget.orderInfo.orderSum) +
double.tryParse(widget.orderInfo.postFee));
if (widget.shopCarGood == null) return "";
double totalPrice = 0;
widget.shopCarGood.forEach((element) {
totalPrice += double.tryParse(element["price"]) * element["count"];
});
return "$totalPrice";
}
}

12
lib/store/store_view/store_order_list.dart

@ -98,8 +98,7 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
Container(
width: 100.w,
child: ListView.builder(
itemCount:
appletProducts == null ? 0 : appletProducts.length,
itemCount: appletProducts == null ? 0 : appletProducts.length,
controller: controller1,
physics: BouncingScrollPhysics(),
padding: EdgeInsets.only(top: 0, bottom: 25),
@ -111,8 +110,7 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
Container(
width: MediaQuery.of(context).size.width - 100.w,
child: ListView.builder(
itemCount: productListBeans == null
? 0 : productListBeans.length,
itemCount: productListBeans == null ? 0 : productListBeans.length,
physics: BouncingScrollPhysics(),
padding: EdgeInsets.zero,
itemBuilder: (context, position) {
@ -226,8 +224,10 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
double singlePrice = double.tryParse(element2["price"]);
allCount += element2["count"];
AiDecimalAccuracy aiDecimalAccuracy = AiDecimalAccuracy.fromInt(element2["count"]);
AiDecimalAccuracy aiPrice = AiDecimalAccuracy.tryParse("$singlePrice");
AiDecimalAccuracy aiDecimalAccuracy =
AiDecimalAccuracy.fromInt(element2["count"]);
AiDecimalAccuracy aiPrice =
AiDecimalAccuracy.tryParse("$singlePrice");
allPrice += (aiPrice * aiDecimalAccuracy);
}

Loading…
Cancel
Save