Browse Source

Merge branch 'master' into dev

master
w-R 3 years ago
parent
commit
9d5f7bb1e4
  1. 4
      lib/home/activity_list_page.dart
  2. 4
      lib/home/home_page.dart
  3. 65
      lib/home/huixiang_brand_page.dart
  4. 12
      lib/home/points_mall_page.dart
  5. 5
      lib/mine/mine_page.dart
  6. 123
      lib/order/order_detail_page.dart
  7. 10
      lib/retrofit/retrofit_api.dart
  8. 97
      lib/setting/help_feedback_page.dart
  9. 54
      lib/union/store_details_page.dart
  10. 4
      lib/union/union_details_page.dart
  11. 51
      lib/union/union_page.dart

4
lib/home/activity_list_page.dart

@ -82,7 +82,9 @@ class _ActivityListPage extends State<ActivityListPage>
return MyFooter(mode); return MyFooter(mode);
}, },
), ),
onRefresh: queryActivity, onRefresh: () {
setState(() {});
},
child: FutureBuilder( child: FutureBuilder(
future: queryActivity(), future: queryActivity(),
builder: (context, snapshot) { builder: (context, snapshot) {

4
lib/home/home_page.dart

@ -159,7 +159,9 @@ class _HomePage extends State<HomePage> with AutomaticKeepAliveClientMixin {
enablePullUp: false, enablePullUp: false,
header: MyHeader(), header: MyHeader(),
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
onRefresh: queryHome, onRefresh: (){
setState(() {});
},
child: SingleChildScrollView( child: SingleChildScrollView(
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
child: FutureBuilder( child: FutureBuilder(

65
lib/home/huixiang_brand_page.dart

@ -34,7 +34,6 @@ class BrandPage extends StatefulWidget {
class _BrandPage extends State<BrandPage> class _BrandPage extends State<BrandPage>
with SingleTickerProviderStateMixin, AutomaticKeepAliveClientMixin { with SingleTickerProviderStateMixin, AutomaticKeepAliveClientMixin {
final ScrollController scrollController = ScrollController(); final ScrollController scrollController = ScrollController();
final RefreshController refreshController = RefreshController(); final RefreshController refreshController = RefreshController();
@ -47,18 +46,22 @@ class _BrandPage extends State<BrandPage>
var isShowMore = false; var isShowMore = false;
Future queryHome() async { Future queryHome() async {
EasyLoading.show(status: S EasyLoading.show(status: S.current.zhengzaijiazai);
.of(context)
.zhengzaijiazai);
final SharedPreferences value = await SharedPreferences.getInstance(); final SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService(Dio(), context: context, apiService = ApiService(Dio(),
token: value.getString('token'), showLoading: false); context: context, token: value.getString('token'), showLoading: false);
BaseData<BrandData> baseData = await apiService.queryHome().catchError(( BaseData<BrandData> baseData =
error) { await apiService.queryHome().catchError((error) {
refreshController.refreshFailed(); refreshController.refreshFailed();
}); });
if (baseData != null && baseData.isSuccess) {
brandData = baseData.data;
} else {
refreshController.refreshFailed();
}
BaseData<PageInfo<BannerData>> banner = await apiService.queryBanner({ BaseData<PageInfo<BannerData>> banner = await apiService.queryBanner({
"model": {"type": "BRAND_APP"}, "model": {"type": "BRAND_APP"},
}).catchError((error) { }).catchError((error) {
@ -83,17 +86,9 @@ class _BrandPage extends State<BrandPage>
refreshController.refreshFailed(); refreshController.refreshFailed();
} }
EasyLoading.dismiss(); EasyLoading.dismiss();
if (baseData != null && baseData.isSuccess) { refreshController.refreshCompleted();
refreshController.refreshCompleted(); print("huixiang_______");
brandData = baseData.data; if(mounted) setState(() {});
} else {
refreshController.refreshFailed();
}
}
@override
void didChangeDependencies() {
super.didChangeDependencies();
} }
@override @override
@ -106,6 +101,9 @@ class _BrandPage extends State<BrandPage>
setState(() {}); setState(() {});
} }
}); });
queryHome();
} }
@override @override
@ -113,10 +111,7 @@ class _BrandPage extends State<BrandPage>
super.build(context); super.build(context);
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
toolbarHeight: 40.h - MediaQuery toolbarHeight: 40.h - MediaQuery.of(context).padding.top,
.of(context)
.padding
.top,
backgroundColor: Colors.white, backgroundColor: Colors.white,
elevation: 0, elevation: 0,
), ),
@ -140,14 +135,8 @@ class _BrandPage extends State<BrandPage>
child: Container( child: Container(
color: Color(0xFFF7F7F7), color: Color(0xFFF7F7F7),
margin: EdgeInsets.only(top: 16.h), margin: EdgeInsets.only(top: 16.h),
child: FutureBuilder( child: Column(
future: queryHome(), children: homeChildItem(),
builder: (context, snapshot) {
//ConnectionState
return Column(
children: homeChildItem(),
);
},
), ),
), ),
), ),
@ -266,7 +255,7 @@ class _BrandPage extends State<BrandPage>
TextSpan(children: [ TextSpan(children: [
TextSpan( TextSpan(
text: text:
brandData == null ? "" : brandData.originator, brandData == null ? "" : brandData.originator,
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 14.sp, fontSize: 14.sp,
@ -274,9 +263,7 @@ class _BrandPage extends State<BrandPage>
), ),
), ),
TextSpan( TextSpan(
text: " ${S text: " ${S.of(context).jituanchuangbanren}",
.of(context)
.jituanchuangbanren}",
style: TextStyle( style: TextStyle(
fontSize: 10.sp, fontSize: 10.sp,
color: Colors.black, color: Colors.black,
@ -309,9 +296,7 @@ class _BrandPage extends State<BrandPage>
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
children: [ children: [
Text( Text(
S S.of(context).gengduo,
.of(context)
.gengduo,
style: TextStyle( style: TextStyle(
fontSize: 12.sp, fontSize: 12.sp,
color: Colors.black, color: Colors.black,
@ -371,9 +356,7 @@ class _BrandPage extends State<BrandPage>
height: 40.h, height: 40.h,
), ),
Text( Text(
S S.of(context).linian,
.of(context)
.linian,
style: TextStyle( style: TextStyle(
fontSize: 16.sp, fontSize: 16.sp,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,

12
lib/home/points_mall_page.dart

@ -163,11 +163,6 @@ class _PointsMallPage extends State<PointsMallPage>
String categoryId; String categoryId;
_refresh() {
pageNum = 1;
creditGoods();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
super.build(context); super.build(context);
@ -183,9 +178,12 @@ class _PointsMallPage extends State<PointsMallPage>
}, },
), ),
controller: _refreshController, controller: _refreshController,
onRefresh: _refresh, onRefresh: () {
pageNum = 1;
setState(() {});
},
onLoading: () { onLoading: () {
creditGoods(); setState(() {});
}, },
child: SingleChildScrollView( child: SingleChildScrollView(
child: Container( child: Container(

5
lib/mine/mine_page.dart

@ -136,7 +136,10 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
enablePullUp: false, enablePullUp: false,
header: MyHeader(), header: MyHeader(),
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
onRefresh: queryUserInfo, onRefresh: () {
// queryUserInfo
setState(() {});
},
child: SingleChildScrollView( child: SingleChildScrollView(
child: Container( child: Container(
child: Stack( child: Stack(

123
lib/order/order_detail_page.dart

@ -718,13 +718,8 @@ class _OrderDetailPage extends State<OrderDetailPage> {
children: [ children: [
InkWell( InkWell(
onTap: () { onTap: () {
// showModalBottomSheet(
// context: context,
// builder: (context) {
// return PayInputWidget();
// },
// );
if (payStatus == 0) { if (payStatus == 0) {
orderCancel();
} else if (payStatus < 4) { } else if (payStatus < 4) {
SmartDialog.show( SmartDialog.show(
widget: TextImageWidget( widget: TextImageWidget(
@ -751,29 +746,32 @@ class _OrderDetailPage extends State<OrderDetailPage> {
); );
} }
}, },
child: Column( child: Container(
children: [ padding: EdgeInsets.all(5),
Image.asset( child: Column(
payStatus == 0 children: [
? "assets/image/icon_order_cancel.png" Image.asset(
: "assets/image/icon_request_refund.png", payStatus == 0
width: 24.w, ? "assets/image/icon_order_cancel.png"
height: 24.h, : "assets/image/icon_request_refund.png",
fit: BoxFit.contain, width: 24.w,
), height: 24.h,
SizedBox( fit: BoxFit.contain,
height: 8.h,
),
Text(
payStatus == 0
? S.of(context).quxiaodingdan
: S.of(context).shenqingtuikuan,
style: TextStyle(
color: Color(0xFF353535),
fontSize: 12.sp,
), ),
), SizedBox(
], height: 8.h,
),
Text(
payStatus == 0
? S.of(context).quxiaodingdan
: S.of(context).shenqingtuikuan,
style: TextStyle(
color: Color(0xFF353535),
fontSize: 12.sp,
),
),
],
),
), ),
), ),
GestureDetector( GestureDetector(
@ -785,32 +783,39 @@ class _OrderDetailPage extends State<OrderDetailPage> {
(orderInfo != null && orderInfo.storeVO != null) (orderInfo != null && orderInfo.storeVO != null)
? (orderInfo.storeVO.id ?? "") ? (orderInfo.storeVO.id ?? "")
: ""; : "";
aginOrder(storeId); String storeName =
(orderInfo != null && orderInfo.storeVO != null)
? (orderInfo.storeVO.storeName ?? "")
: "";
aginOrder(storeId, storeName);
} }
}, },
child: Column( child: Container(
children: [ padding: EdgeInsets.all(5),
Image.asset( child: Column(
payStatus == 0 children: [
? "assets/image/icon_order_renminbi.png" Image.asset(
: "assets/image/icon_order_agin.png", payStatus == 0
width: 24.w, ? "assets/image/icon_order_renminbi.png"
height: 24.h, : "assets/image/icon_order_agin.png",
fit: BoxFit.contain, width: 24.w,
), height: 24.h,
SizedBox( fit: BoxFit.contain,
height: 8.h,
),
Text(
payStatus == 0
? S.of(context).jixuzhifu
: S.of(context).zailaiyidan,
style: TextStyle(
color: Color(0xFF32A060),
fontSize: 12.sp,
), ),
), SizedBox(
], height: 8.h,
),
Text(
payStatus == 0
? S.of(context).jixuzhifu
: S.of(context).zailaiyidan,
style: TextStyle(
color: Color(0xFF32A060),
fontSize: 12.sp,
),
),
],
),
), ),
), ),
], ],
@ -830,9 +835,19 @@ class _OrderDetailPage extends State<OrderDetailPage> {
} }
} }
aginOrder(storeId) { orderCancel() async {
Navigator.of(context) BaseData baseData = await apiService.orderCancel(widget.arguments["id"]);
.pushNamed('/router/union_detail_page', arguments: {"id": storeId}); if (baseData != null && baseData.isSuccess) {
SmartDialog.showToast("订单取消成功");
Future.delayed(Duration(milliseconds: 300), () {
queryDetails();
});
}
}
aginOrder(storeId, storeName) {
Navigator.of(context).pushNamed('/router/union_detail_page',
arguments: {"id": storeId, "storeName": storeName});
} }
Widget buildCommodity() { Widget buildCommodity() {

10
lib/retrofit/retrofit_api.dart

@ -361,4 +361,14 @@ abstract class ApiService {
Future<BaseData<Logistics>> shippingTrace( Future<BaseData<Logistics>> shippingTrace(
@Path("shipperCode") String shipperCode, @Path("shipperCode") String shipperCode,
@Path("logisticCode") String logisticCode); @Path("logisticCode") String logisticCode);
///
@POST("/other/report")
Future<BaseData<bool>> report(@Body() Map<String, String> map);
///
@GET("/order/orderCancel?id={id}")
Future<BaseData<bool>> orderCancel(@Path("id") String id);
} }

97
lib/setting/help_feedback_page.dart

@ -1,9 +1,15 @@
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';
import 'package:flutter/services.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:huixiang/view_widget/round_button.dart'; import 'package:huixiang/view_widget/round_button.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:shared_preferences/shared_preferences.dart';
class HelpFeedbackPage extends StatefulWidget { class HelpFeedbackPage extends StatefulWidget {
@override @override
@ -15,6 +21,18 @@ class HelpFeedbackPage extends StatefulWidget {
class _HelpFeedbackPage extends State<HelpFeedbackPage> { class _HelpFeedbackPage extends State<HelpFeedbackPage> {
var _isExpanded = [false, false, false]; var _isExpanded = [false, false, false];
ApiService apiService;
@override
void initState() {
super.initState();
SharedPreferences.getInstance().then((value) {
apiService = ApiService(Dio(), context: context, token: value.getString("token"));
});
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@ -119,16 +137,21 @@ class _HelpFeedbackPage extends State<HelpFeedbackPage> {
), ),
flex: 1, flex: 1,
), ),
Container( InkWell(
height: 54.h, onTap: () {
alignment: Alignment.center, report();
color: Color(0xFF32A060), },
child: RoundButton( child: Container(
text: S.of(context).tijiao, height: 54.h,
backgroup: Color(0xFF32A060), alignment: Alignment.center,
textColor: Colors.white, color: Color(0xFF32A060),
fontSize: 16.sp, child: RoundButton(
fontWeight: FontWeight.bold, text: S.of(context).tijiao,
backgroup: Color(0xFF32A060),
textColor: Colors.white,
fontSize: 16.sp,
fontWeight: FontWeight.bold,
),
), ),
), ),
], ],
@ -137,6 +160,25 @@ class _HelpFeedbackPage extends State<HelpFeedbackPage> {
); );
} }
report() async {
var content = editingController.text;
var phone = phoneController.text;
BaseData baseData = await apiService.report({
"mobile": phone,
"reportContent": content,
});
if (baseData != null && baseData.isSuccess) {
SmartDialog.showToast("反馈成功");
Navigator.of(context).pop();
} else {
SmartDialog.showToast("反馈失败");
}
}
final TextEditingController editingController = TextEditingController();
final TextEditingController phoneController = TextEditingController();
int textLength = 0;
_feedback() { _feedback() {
return Container( return Container(
width: double.infinity, width: double.infinity,
@ -161,6 +203,13 @@ class _HelpFeedbackPage extends State<HelpFeedbackPage> {
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
child: TextField( child: TextField(
maxLines: 5, maxLines: 5,
controller: editingController,
onChanged: (value) {
setState(() {
textLength = value.length;
});
},
maxLength: 50,
decoration: InputDecoration( decoration: InputDecoration(
border: InputBorder.none, border: InputBorder.none,
hintText: S.of(context).fankuilizi, hintText: S.of(context).fankuilizi,
@ -172,18 +221,18 @@ class _HelpFeedbackPage extends State<HelpFeedbackPage> {
), ),
), ),
), ),
Container( // Container(
alignment: Alignment.bottomRight, // alignment: Alignment.bottomRight,
padding: EdgeInsets.only(right: 20.w), // padding: EdgeInsets.only(right: 20.w),
child: Text( // child: Text(
"0/50", // "$textLength/50",
style: TextStyle( // style: TextStyle(
fontSize: 14.sp, // fontSize: 14.sp,
fontWeight: FontWeight.w400, // fontWeight: FontWeight.w400,
color: Color(0xffA29E9E), // color: Color(0xffA29E9E),
), // ),
), // ),
), // ),
], ],
), ),
); );
@ -193,7 +242,7 @@ class _HelpFeedbackPage extends State<HelpFeedbackPage> {
return Container( return Container(
width: double.infinity, width: double.infinity,
margin: EdgeInsets.all(16.w), margin: EdgeInsets.all(16.w),
decoration: new BoxDecoration( decoration: BoxDecoration(
color: Color(0xffffffff), color: Color(0xffffffff),
borderRadius: BorderRadius.circular(4.0), borderRadius: BorderRadius.circular(4.0),
boxShadow: [ boxShadow: [
@ -211,6 +260,8 @@ class _HelpFeedbackPage extends State<HelpFeedbackPage> {
margin: EdgeInsets.fromLTRB(20.w, 0, 20.w, 0), margin: EdgeInsets.fromLTRB(20.w, 0, 20.w, 0),
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
child: TextField( child: TextField(
controller: phoneController,
inputFormatters: [LengthLimitingTextInputFormatter(11)],
decoration: InputDecoration( decoration: InputDecoration(
border: InputBorder.none, border: InputBorder.none,
hintText: S.of(context).qingshuruyouxiaoshoujihaoma, hintText: S.of(context).qingshuruyouxiaoshoujihaoma,

54
lib/union/store_details_page.dart

@ -475,7 +475,8 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
child: Row( child: Row(
children: [ children: [
Text( Text(
S.of(context) S
.of(context)
.pinglun_(commentTotal.toString()), .pinglun_(commentTotal.toString()),
style: TextStyle( style: TextStyle(
fontSize: 16.sp, fontSize: 16.sp,
@ -519,8 +520,31 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
), ),
); );
}, },
) ),
else if (memberList != null && memberList.length > 0)
Container(
height: 63.h,
decoration: BoxDecoration(
color: Color(0xFFF2F2F2),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(12),
offset: Offset(0, 2),
blurRadius: 14,
spreadRadius: 0,
),
],
),
alignment: Alignment.center,
child: Text(
S.of(context).yixiansquanbupinglun,
style: TextStyle(
fontSize: 14.sp,
color: Color(0xff353535),
),
),
),
if (memberList == null || memberList.length == 0)
Container( Container(
width: double.infinity, width: double.infinity,
height: 80.h, height: 80.h,
@ -965,30 +989,6 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
), ),
), ),
), ),
if (index == max - 1)
Container(
height: 63.h,
decoration: BoxDecoration(
color: Color(0xffF2F2F2),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(12),
offset: Offset(0, 2),
blurRadius: 14,
spreadRadius: 0,
),
],
),
margin: EdgeInsets.only(top: 30.h),
alignment: Alignment.center,
child: Text(
S.of(context).yixiansquanbupinglun,
style: TextStyle(
fontSize: 14.sp,
color: Color(0xff353535),
),
),
),
], ],
), ),
); );

4
lib/union/union_details_page.dart

@ -98,7 +98,9 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
enablePullUp: false, enablePullUp: false,
header: MyHeader(), header: MyHeader(),
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
onRefresh: queryStoreInfo, onRefresh: () {
setState(() {});
},
child: SingleChildScrollView( child: SingleChildScrollView(
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
child: Column( child: Column(

51
lib/union/union_page.dart

@ -75,6 +75,19 @@ class _UnionPage extends State<UnionPage>
super.initState(); super.initState();
WidgetsBinding.instance.addObserver(this); WidgetsBinding.instance.addObserver(this);
eventBus.on<EventType>().listen((event) {
if (event.type < 3) {
setState(() {});
}
});
getLatLng();
startLocation();
}
startLocation() async {
EasyLoading.show(status: S.current.zhengzaijiazai);
Location.getInstance().aMapFlutterLocation Location.getInstance().aMapFlutterLocation
.onResultCallback().listen((event) { .onResultCallback().listen((event) {
if (event != null && if (event != null &&
@ -88,16 +101,16 @@ class _UnionPage extends State<UnionPage>
latLng = BMFCoordinate(event["latitude"], event["longitude"]); latLng = BMFCoordinate(event["latitude"], event["longitude"]);
} }
BMFCalculateUtils.coordConvert( BMFCalculateUtils.coordConvert(
coordinate: latLng, coordinate: latLng,
fromType: BMF_COORD_TYPE.BD09LL, fromType: BMF_COORD_TYPE.BD09LL,
toType: BMF_COORD_TYPE.COMMON) toType: BMF_COORD_TYPE.COMMON)
.then((value) { .then((value) {
this.latLng = value; this.latLng = value;
saveLatLng( saveLatLng(
value, event["province"], event["city"], event["district"]); value, event["province"], event["city"], event["district"]);
print( print(
"value: ${value.latitude} " "union: Location result ${value.latitude} "
"${value.longitude}", "${value.longitude}",
); );
queryStore( queryStore(
"${value.latitude}", "${value.latitude}",
@ -117,24 +130,11 @@ class _UnionPage extends State<UnionPage>
} }
}); });
eventBus.on<EventType>().listen((event) {
print("object: UnionPage");
if (event.type < 3) {
setState(() {});
}
});
getLatLng();
Location.getInstance().prepareLoc(); Location.getInstance().prepareLoc();
startLocation();
}
startLocation() async {
EasyLoading.show(status: S.current.zhengzaijiazai);
Location.getInstance().startLocation(context).then((value) { Location.getInstance().startLocation(context).then((value) {
if (!value) { if (!value) {
EasyLoading.dismiss(); EasyLoading.dismiss();
refreshController.refreshCompleted(); refreshController.refreshFailed();
} }
}); });
} }
@ -151,16 +151,13 @@ class _UnionPage extends State<UnionPage>
getLatLng() async { getLatLng() async {
SharedPreferences.getInstance().then( SharedPreferences.getInstance().then(
(value) => { (value) => {
apiService = ApiService(Dio(), apiService = ApiService(Dio(), context: context,
context: context, token: value.getString('token'), showLoading: false),
token: value.getString('token'),
showLoading: false),
if (value.containsKey("latitude") && if (value.containsKey("latitude") &&
value.containsKey("longitude") && value.containsKey("longitude") &&
value.containsKey("province") && value.containsKey("province") &&
value.containsKey("city") && value.containsKey("city") &&
value.containsKey("district")) value.containsKey("district")) {
{
latLng = BMFCoordinate(double.tryParse(value.getString("latitude")), latLng = BMFCoordinate(double.tryParse(value.getString("latitude")),
double.tryParse(value.getString("longitude"))), double.tryParse(value.getString("longitude"))),
queryStore( queryStore(
@ -201,14 +198,14 @@ class _UnionPage extends State<UnionPage>
}).catchError((error) { }).catchError((error) {
refreshController.refreshFailed(); refreshController.refreshFailed();
}); });
EasyLoading.dismiss();
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
storeList = baseData.data; storeList = baseData.data;
refreshController.refreshCompleted(); refreshController.refreshCompleted();
setState(() {});
} else { } else {
refreshController.refreshFailed(); refreshController.refreshFailed();
} }
EasyLoading.dismiss();
setState(() {});
} }
@override @override

Loading…
Cancel
Save