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);
},
),
onRefresh: queryActivity,
onRefresh: () {
setState(() {});
},
child: FutureBuilder(
future: queryActivity(),
builder: (context, snapshot) {

4
lib/home/home_page.dart

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

65
lib/home/huixiang_brand_page.dart

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

12
lib/home/points_mall_page.dart

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

5
lib/mine/mine_page.dart

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

123
lib/order/order_detail_page.dart

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

10
lib/retrofit/retrofit_api.dart

@ -361,4 +361,14 @@ abstract class ApiService {
Future<BaseData<Logistics>> shippingTrace(
@Path("shipperCode") String shipperCode,
@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/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/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/round_button.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:shared_preferences/shared_preferences.dart';
class HelpFeedbackPage extends StatefulWidget {
@override
@ -15,6 +21,18 @@ class HelpFeedbackPage extends StatefulWidget {
class _HelpFeedbackPage extends State<HelpFeedbackPage> {
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
Widget build(BuildContext context) {
return Scaffold(
@ -119,16 +137,21 @@ class _HelpFeedbackPage extends State<HelpFeedbackPage> {
),
flex: 1,
),
Container(
height: 54.h,
alignment: Alignment.center,
color: Color(0xFF32A060),
child: RoundButton(
text: S.of(context).tijiao,
backgroup: Color(0xFF32A060),
textColor: Colors.white,
fontSize: 16.sp,
fontWeight: FontWeight.bold,
InkWell(
onTap: () {
report();
},
child: Container(
height: 54.h,
alignment: Alignment.center,
color: Color(0xFF32A060),
child: RoundButton(
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() {
return Container(
width: double.infinity,
@ -161,6 +203,13 @@ class _HelpFeedbackPage extends State<HelpFeedbackPage> {
alignment: Alignment.topLeft,
child: TextField(
maxLines: 5,
controller: editingController,
onChanged: (value) {
setState(() {
textLength = value.length;
});
},
maxLength: 50,
decoration: InputDecoration(
border: InputBorder.none,
hintText: S.of(context).fankuilizi,
@ -172,18 +221,18 @@ class _HelpFeedbackPage extends State<HelpFeedbackPage> {
),
),
),
Container(
alignment: Alignment.bottomRight,
padding: EdgeInsets.only(right: 20.w),
child: Text(
"0/50",
style: TextStyle(
fontSize: 14.sp,
fontWeight: FontWeight.w400,
color: Color(0xffA29E9E),
),
),
),
// Container(
// alignment: Alignment.bottomRight,
// padding: EdgeInsets.only(right: 20.w),
// child: Text(
// "$textLength/50",
// style: TextStyle(
// fontSize: 14.sp,
// fontWeight: FontWeight.w400,
// color: Color(0xffA29E9E),
// ),
// ),
// ),
],
),
);
@ -193,7 +242,7 @@ class _HelpFeedbackPage extends State<HelpFeedbackPage> {
return Container(
width: double.infinity,
margin: EdgeInsets.all(16.w),
decoration: new BoxDecoration(
decoration: BoxDecoration(
color: Color(0xffffffff),
borderRadius: BorderRadius.circular(4.0),
boxShadow: [
@ -211,6 +260,8 @@ class _HelpFeedbackPage extends State<HelpFeedbackPage> {
margin: EdgeInsets.fromLTRB(20.w, 0, 20.w, 0),
alignment: Alignment.topLeft,
child: TextField(
controller: phoneController,
inputFormatters: [LengthLimitingTextInputFormatter(11)],
decoration: InputDecoration(
border: InputBorder.none,
hintText: S.of(context).qingshuruyouxiaoshoujihaoma,

54
lib/union/store_details_page.dart

@ -475,7 +475,8 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
child: Row(
children: [
Text(
S.of(context)
S
.of(context)
.pinglun_(commentTotal.toString()),
style: TextStyle(
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(
width: double.infinity,
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,
header: MyHeader(),
physics: BouncingScrollPhysics(),
onRefresh: queryStoreInfo,
onRefresh: () {
setState(() {});
},
child: SingleChildScrollView(
physics: NeverScrollableScrollPhysics(),
child: Column(

51
lib/union/union_page.dart

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

Loading…
Cancel
Save