|
|
|
@ -1,11 +1,9 @@
|
|
|
|
|
import 'package:barcode_widget/barcode_widget.dart'; |
|
|
|
|
import 'package:dio/dio.dart'; |
|
|
|
|
import 'package:flutter/material.dart'; |
|
|
|
|
import 'package:flutter_baidu_mapapi_utils/flutter_baidu_mapapi_utils.dart'; |
|
|
|
|
import 'package:huixiang/generated/l10n.dart'; |
|
|
|
|
import 'package:huixiang/retrofit/data/base_data.dart'; |
|
|
|
|
import 'package:huixiang/retrofit/data/order_info.dart'; |
|
|
|
|
import 'package:huixiang/retrofit/data/page.dart'; |
|
|
|
|
import 'package:huixiang/retrofit/data/vip_card.dart'; |
|
|
|
|
import 'package:huixiang/retrofit/retrofit_api.dart'; |
|
|
|
|
import 'package:huixiang/utils/location.dart'; |
|
|
|
@ -42,12 +40,18 @@ class _VipDetailPage extends State<VipDetailPage> {
|
|
|
|
|
void initState() { |
|
|
|
|
super.initState(); |
|
|
|
|
|
|
|
|
|
Location.getInstance().aMapFlutterLocation.onResultCallback().listen((event) { |
|
|
|
|
vipDetail("", ""); |
|
|
|
|
|
|
|
|
|
Location.getInstance() |
|
|
|
|
.aMapFlutterLocation |
|
|
|
|
.onResultCallback() |
|
|
|
|
.listen((event) { |
|
|
|
|
if (event != null && |
|
|
|
|
event["latitude"] != null && |
|
|
|
|
event["longitude"] != null) { |
|
|
|
|
SharedPreferences.getInstance().then((value) { |
|
|
|
|
apiService = ApiService(Dio(), context: context, token: value.getString("token")); |
|
|
|
|
apiService = ApiService(Dio(), |
|
|
|
|
context: context, token: value.getString("token")); |
|
|
|
|
vipDetail(event["latitude"], event["longitude"]); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
@ -102,7 +106,7 @@ class _VipDetailPage extends State<VipDetailPage> {
|
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
Padding( |
|
|
|
|
padding: EdgeInsets.only(left: 16.w, top: 35.h, bottom: 16.h), |
|
|
|
|
padding: EdgeInsets.only(left: 16.w, top: 32.h, bottom: 8.h), |
|
|
|
|
child: Row( |
|
|
|
|
children: [ |
|
|
|
|
Text( |
|
|
|
@ -141,9 +145,9 @@ class _VipDetailPage extends State<VipDetailPage> {
|
|
|
|
|
child: shopItem(vipCard.storeList[position]), |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 1), |
|
|
|
|
itemCount: (vipCard != null && vipCard.storeList != null) |
|
|
|
|
? vipCard.storeList.length |
|
|
|
|
: 0, |
|
|
|
|
? vipCard.storeList.length : 0, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
@ -379,7 +383,7 @@ class _VipDetailPage extends State<VipDetailPage> {
|
|
|
|
|
height: 30.h, |
|
|
|
|
color: Colors.black, |
|
|
|
|
drawText: false, |
|
|
|
|
) |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
) |
|
|
|
|
], |
|
|
|
@ -392,7 +396,7 @@ class _VipDetailPage extends State<VipDetailPage> {
|
|
|
|
|
|
|
|
|
|
Widget shopItem(StoreListBean store) { |
|
|
|
|
return Container( |
|
|
|
|
margin: EdgeInsets.all(16.w), |
|
|
|
|
margin: EdgeInsets.symmetric(horizontal: 16.w, vertical: 8.h), |
|
|
|
|
child: Column( |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround, |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
@ -445,15 +449,18 @@ class _VipDetailPage extends State<VipDetailPage> {
|
|
|
|
|
color: Color(0xff353535), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Text( |
|
|
|
|
store.address, |
|
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 12.sp, |
|
|
|
|
fontWeight: FontWeight.w400, |
|
|
|
|
color: Color(0xff353535), |
|
|
|
|
Expanded( |
|
|
|
|
child: Text( |
|
|
|
|
store.address, |
|
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 12.sp, |
|
|
|
|
fontWeight: FontWeight.w400, |
|
|
|
|
color: Color(0xff353535), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
flex: 1, |
|
|
|
|
) |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
SizedBox( |
|
|
|
@ -477,15 +484,10 @@ class _VipDetailPage extends State<VipDetailPage> {
|
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Text(// "3.9km" |
|
|
|
|
(store.distance ?? 0) > 1000 |
|
|
|
|
? S.of(context).gongli( |
|
|
|
|
((store.distance ?? 0) / 1000 * 100) |
|
|
|
|
.toInt() / |
|
|
|
|
100.0) |
|
|
|
|
: S.of(context).mi( |
|
|
|
|
((store.distance ?? 0) * 100).toInt() / |
|
|
|
|
100.0), |
|
|
|
|
Text( |
|
|
|
|
(store.distance ?? 0) > 1000 |
|
|
|
|
? S.of(context).gongli(((store.distance ?? 0) / 1000 * 100).toInt() / 100.0) |
|
|
|
|
: S.of(context).mi(((store.distance ?? 0) * 100).toInt() / 100.0), |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 12.sp, |
|
|
|
|
fontWeight: FontWeight.w400, |
|
|
|
@ -503,10 +505,8 @@ class _VipDetailPage extends State<VipDetailPage> {
|
|
|
|
|
|
|
|
|
|
String totalPrice(orderInfo) { |
|
|
|
|
if (orderInfo == null) return ""; |
|
|
|
|
double totalPrice = (double.tryParse(orderInfo.orderSum) + |
|
|
|
|
double.tryParse(orderInfo.postFee)); |
|
|
|
|
if (orderInfo.orderDetail != null && |
|
|
|
|
orderInfo.orderDetail.couponDTO != null) { |
|
|
|
|
double totalPrice = (double.tryParse(orderInfo.orderSum) + double.tryParse(orderInfo.postFee)); |
|
|
|
|
if (orderInfo.orderDetail != null && orderInfo.orderDetail.couponDTO != null) { |
|
|
|
|
totalPrice -= double.tryParse(orderInfo.orderDetail.couponDTO.money); |
|
|
|
|
} |
|
|
|
|
return "$totalPrice"; |
|
|
|
@ -517,9 +517,7 @@ class _VipDetailPage extends State<VipDetailPage> {
|
|
|
|
|
if (products.length > 3) { |
|
|
|
|
products = products.sublist(0, 3); |
|
|
|
|
} |
|
|
|
|
return products |
|
|
|
|
.map( |
|
|
|
|
(e) => Container( |
|
|
|
|
return products.map((e) => Container( |
|
|
|
|
margin: EdgeInsets.symmetric(horizontal: 2.w), |
|
|
|
|
child: Column( |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround, |
|
|
|
@ -553,7 +551,6 @@ class _VipDetailPage extends State<VipDetailPage> {
|
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
) |
|
|
|
|
.toList(); |
|
|
|
|
).toList(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|