Browse Source

邀请码功能更新;

核销功能更新;
核销后关闭二维码;
社群合并更改;
ff_new
w-R 3 years ago
parent
commit
3dc3211a2e
  1. 4
      lib/community/community_child_page.dart
  2. 2
      lib/generated/intl/messages_zh_Hant_CN.dart
  3. 2
      lib/generated/intl/messages_zh_TW.dart
  4. 24
      lib/home/home_page.dart
  5. 1
      lib/home/huixiang_brand_page.dart
  6. 2
      lib/l10n/intl_zh_Hant_CN.arb
  7. 2
      lib/l10n/intl_zh_TW.arb
  8. 8
      lib/login/login_page.dart
  9. 10
      lib/mine/coupons_page.dart
  10. 58
      lib/mine/invitation_record.dart
  11. 4
      lib/mine/mine_card_page.dart
  12. 31
      lib/mine/mine_view/mine_view.dart
  13. 2
      lib/mine/roll_center_page.dart
  14. 2
      lib/order/order_history_page.dart
  15. 66
      lib/order/write_off_page.dart
  16. 32
      lib/qr/qr_share.dart
  17. 120
      lib/retrofit/data/coupon_detail.dart
  18. 4
      lib/retrofit/min_api.dart
  19. 13
      lib/retrofit/retrofit_api.dart
  20. 43
      lib/retrofit/retrofit_api.g.dart
  21. 150
      lib/settlement/settlement.dart
  22. 4
      lib/settlement/settlement_view/activity_coupon_remarks.dart
  23. 2
      lib/view_widget/invite_success_dialog.dart
  24. 5
      lib/view_widget/new_coupon_widget.dart

4
lib/community/community_child_page.dart

@ -143,7 +143,9 @@ class _CommunityChildPage extends State<CommunityChildPage> with AutomaticKeepAl
"businessId": articles[position].id, "businessId": articles[position].id,
"userId": userId, "userId": userId,
}, },
); ).then((value) {
_onRefresh();
});
}, },
); );
}, },

2
lib/generated/intl/messages_zh_Hant_CN.dart

@ -65,7 +65,7 @@ class MessageLookup extends MessageLookupByLibrary {
static m22(zhe) => "全場${zhe}"; static m22(zhe) => "全場${zhe}";
static m23(num) => "${num}"; static m23(num) => "${num}";
static m24(ren) => "¥${ren}/人"; static m24(ren) => "¥${ren}/人";

2
lib/generated/intl/messages_zh_TW.dart

@ -65,7 +65,7 @@ class MessageLookup extends MessageLookupByLibrary {
static m22(zhe) => "全場${zhe}"; static m22(zhe) => "全場${zhe}";
static m23(num) => "${num}"; static m23(num) => "${num}";
static m24(ren) => "¥${ren}/人"; static m24(ren) => "¥${ren}/人";

24
lib/home/home_page.dart

@ -1,8 +1,10 @@
import 'dart:convert'; import 'dart:convert';
import 'package:dio/dio.dart'; 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_easyloading/flutter_easyloading.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:flutter_swiper/flutter_swiper.dart'; import 'package:flutter_swiper/flutter_swiper.dart';
import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/generated/l10n.dart';
@ -271,6 +273,24 @@ class _HomePage extends State<HomePage> with AutomaticKeepAliveClientMixin {
EasyLoading.dismiss(); EasyLoading.dismiss();
} }
///
queryWiped(memberCouponId) async {
if (apiService == null) {
SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService(
Dio(),
context: context,
token: value.getString("token"),
);
}
BaseData baseData = await apiService.wiped(memberCouponId);
if (baseData != null && baseData.isSuccess) {
SmartDialog.showToast("核销成功", alignment: Alignment.center);
} else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
}
}
_onRefresh(){ _onRefresh(){
queryHome(); queryHome();
queryMsgStats(); queryMsgStats();
@ -483,6 +503,10 @@ class _HomePage extends State<HomePage> with AutomaticKeepAliveClientMixin {
/// ///
activityShowAlertDialog(result.toString()); activityShowAlertDialog(result.toString());
return; return;
}if(result.toString().contains("type\":\"wiped")){
///
queryWiped(jsonDecode(result.toString())["memberCouponId"]);
return;
} }
// String result = await scanner.scan(); // String result = await scanner.scan();
Uri uri = Uri.parse(result); Uri uri = Uri.parse(result);

1
lib/home/huixiang_brand_page.dart

@ -51,7 +51,6 @@ class _BrandPage extends State<BrandPage>
Dio(), Dio(),
context: context, context: context,
token: value.getString('token'), token: value.getString('token'),
showLoading: false,
); );
BaseData<BrandData> baseData = BaseData<BrandData> baseData =

2
lib/l10n/intl_zh_Hant_CN.arb

@ -338,7 +338,7 @@
"chakanwuliu": "查看物流", "chakanwuliu": "查看物流",
"zailaiyidan": "再來一單", "zailaiyidan": "再來一單",
"shanchudingdan": "刪除訂單", "shanchudingdan": "刪除訂單",
"qudanhao": "取號{num}", "qudanhao": "取號{num}",
"lingquchenggong": "領取成功", "lingquchenggong": "領取成功",
"dianwolingqu": "點我領取", "dianwolingqu": "點我領取",
"chengweidianpuzhuanshuhuiyuan": "成為專屬會員,享專屬權益", "chengweidianpuzhuanshuhuiyuan": "成為專屬會員,享專屬權益",

2
lib/l10n/intl_zh_TW.arb

@ -338,7 +338,7 @@
"chakanwuliu": "查看物流", "chakanwuliu": "查看物流",
"zailaiyidan": "再來一單", "zailaiyidan": "再來一單",
"shanchudingdan": "刪除訂單", "shanchudingdan": "刪除訂單",
"qudanhao": "取號{num}", "qudanhao": "取號{num}",
"lingquchenggong": "領取成功", "lingquchenggong": "領取成功",
"dianwolingqu": "點我領取", "dianwolingqu": "點我領取",
"chengweidianpuzhuanshuhuiyuan": "成為專屬會員,享專屬權益", "chengweidianpuzhuanshuhuiyuan": "成為專屬會員,享專屬權益",

8
lib/login/login_page.dart

@ -706,7 +706,7 @@ class _MyLoginPageState extends State<LoginPage> with TickerProviderStateMixin {
), ),
), ),
Container( Container(
height: 40.h, height:35.h,
width: MediaQuery.of(context).size.width - 80.h, width: MediaQuery.of(context).size.width - 80.h,
// margin: EdgeInsets.only(top: 12.h), // margin: EdgeInsets.only(top: 12.h),
child: TextField( child: TextField(
@ -773,7 +773,7 @@ class _MyLoginPageState extends State<LoginPage> with TickerProviderStateMixin {
), ),
), ),
Container( Container(
height: 40.h, height:35.h,
width: MediaQuery.of(context).size.width - 80.h, width: MediaQuery.of(context).size.width - 80.h,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
@ -923,7 +923,7 @@ class _MyLoginPageState extends State<LoginPage> with TickerProviderStateMixin {
), ),
), ),
Container( Container(
height: 40.h, height:35.h,
width: MediaQuery.of(context).size.width - 80.h, width: MediaQuery.of(context).size.width - 80.h,
child: TextField( child: TextField(
style: TextStyle( style: TextStyle(
@ -949,7 +949,7 @@ class _MyLoginPageState extends State<LoginPage> with TickerProviderStateMixin {
), ),
), ),
textInputAction: TextInputAction.next, textInputAction: TextInputAction.next,
inputFormatters: [LengthLimitingTextInputFormatter(11)], inputFormatters: [LengthLimitingTextInputFormatter(6)],
cursorColor: Colors.grey, cursorColor: Colors.grey,
maxLines: 1, maxLines: 1,
), ),

10
lib/mine/coupons_page.dart

@ -1,3 +1,5 @@
import 'dart:convert';
import 'package:dio/dio.dart'; 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';
@ -172,13 +174,15 @@ class _CouponsPage extends State<CouponsPage> {
if (type == 1) { if (type == 1) {
receiveCoupon(coupons[position].id); receiveCoupon(coupons[position].id);
} else { } else {
if (coupons[position].bizType == 5) { if (coupons[position].bizType == 5 || coupons[position].bizType == 3) {
Navigator.of(context).pushNamed( Navigator.of(context).pushNamed(
'/router/write_off_page', '/router/write_off_page',
arguments: { arguments: {
"couponId": coupons[position].id, "couponId": coupons[position].id,
"coupon": coupons[position].toJson(), "coupon": jsonEncode(coupons[position]),
}); }).then((value) {
_onRefresh();
});
} else { } else {
showStoreSelector(coupons[position].storeList); showStoreSelector(coupons[position].storeList);
} }

58
lib/mine/invitation_record.dart

@ -13,6 +13,9 @@ import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/flutter_utils.dart'; import 'package:huixiang/utils/flutter_utils.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/view_widget/classic_header.dart';
import 'package:huixiang/view_widget/my_footer.dart';
import 'package:huixiang/view_widget/no_data_view.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
@ -27,6 +30,7 @@ class _InvitationRecord extends State<InvitationRecord>
with AutomaticKeepAliveClientMixin { with AutomaticKeepAliveClientMixin {
ApiService apiService; ApiService apiService;
RefreshController _refreshController = RefreshController(); RefreshController _refreshController = RefreshController();
ScrollController scrollController = ScrollController();
List<InvitationList> invitationList = []; List<InvitationList> invitationList = [];
UserInfo userInfo; UserInfo userInfo;
int pageNum = 1; int pageNum = 1;
@ -132,31 +136,32 @@ class _InvitationRecord extends State<InvitationRecord>
right: 16.w), right: 16.w),
child: Column( child: Column(
children: [ children: [
GestureDetector( GestureDetector(
onTap: (){ onTap: (){
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
child:Padding( child:Padding(
padding: EdgeInsets.only(top: 15.h, bottom: 30.h), padding: EdgeInsets.only(top: 15.h, bottom: 30.h),
child: Row( child: Row(
children: [ children: [
Icon( Icon(
Icons.arrow_back_ios, Icons.arrow_back_ios,
size: 24, size: 24,
), ),
SizedBox( SizedBox(
width: 1.w, width: 1.w,
), ),
Text( Text(
"我的邀请记录", "我的邀请记录",
style: TextStyle( style: TextStyle(
fontSize: 18.sp, fontSize: 18.sp,
color: Color(0xFF000000), color: Color(0xFF000000),
fontWeight: MyFontWeight.semi_bold, fontWeight: MyFontWeight.semi_bold,
),
), ),
), ],
], ))
))
), ),
Container( Container(
margin: EdgeInsets.only(bottom: 16.h), margin: EdgeInsets.only(bottom: 16.h),
@ -298,6 +303,13 @@ class _InvitationRecord extends State<InvitationRecord>
], ],
), ),
Expanded(child: Expanded(child:
(invitationList.length == null || invitationList.length == 0)
? NoDataView(
isShowBtn: false,
text:"还没有邀请记录哦~",
fontSize: 16.sp,
margin: EdgeInsets.only(top: 120.h),
):
ListView.builder( ListView.builder(
itemCount:invitationList.length, itemCount:invitationList.length,
shrinkWrap: true, shrinkWrap: true,

4
lib/mine/mine_card_page.dart

@ -46,13 +46,13 @@ class _MineCardPage extends State<MineCardPage>
indicatorSize: TabBarIndicatorSize.label, indicatorSize: TabBarIndicatorSize.label,
// //
tabs: <Widget>[ tabs: <Widget>[
MyTab(text: S.of(context).huiyuanka),
MyTab(text: S.of(context).quanbao), MyTab(text: S.of(context).quanbao),
MyTab(text: S.of(context).huiyuanka),
], ],
), ),
), ),
body: TabBarView( body: TabBarView(
children: [VipCardPage(), CouponsPage()], children: [CouponsPage(),VipCardPage(), ],
), ),
), ),
); );

31
lib/mine/mine_view/mine_view.dart

@ -1,7 +1,13 @@
import 'dart:convert';
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_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/data/user_info.dart'; import 'package:huixiang/retrofit/data/user_info.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/activity_coupons.dart'; import 'package:huixiang/view_widget/activity_coupons.dart';
import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/custom_image.dart';
@ -9,6 +15,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/view_widget/login_tips_dialog.dart'; import 'package:huixiang/view_widget/login_tips_dialog.dart';
import 'package:huixiang/view_widget/request_permission.dart'; import 'package:huixiang/view_widget/request_permission.dart';
import 'package:permission_handler/permission_handler.dart'; import 'package:permission_handler/permission_handler.dart';
import 'package:shared_preferences/shared_preferences.dart';
// import 'package:qrscan/qrscan.dart' as scanner; // import 'package:qrscan/qrscan.dart' as scanner;
class MineView extends StatefulWidget { class MineView extends StatefulWidget {
@ -25,6 +32,26 @@ class MineView extends StatefulWidget {
} }
class _MineView extends State<MineView> { class _MineView extends State<MineView> {
ApiService apiService;
///
queryWiped(memberCouponId) async {
if (apiService == null) {
SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService(
Dio(),
context: context,
token: value.getString("token"),
);
}
BaseData baseData = await apiService.wiped(memberCouponId);
if (baseData != null && baseData.isSuccess) {
SmartDialog.showToast("核销成功", alignment: Alignment.center);
} else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
}
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Column( return Column(
@ -98,6 +125,10 @@ class _MineView extends State<MineView> {
/// ///
activityShowAlertDialog(result.toString()); activityShowAlertDialog(result.toString());
return; return;
}if(result.toString().contains("type\":\"wiped")){
///
queryWiped(jsonDecode(result.toString())["memberCouponId"]);
return;
} }
// String result = await scanner.scan(); // String result = await scanner.scan();
Uri uri = Uri.parse(result); Uri uri = Uri.parse(result);

2
lib/mine/roll_center_page.dart

@ -128,7 +128,7 @@ class _RollCenterPage extends State<RollCenterPage> {
if (type == 1) { if (type == 1) {
receiveCoupon(coupons[position].id); receiveCoupon(coupons[position].id);
} else { } else {
if (coupons[position].bizType == 5) { if (coupons[position].bizType == 5 || coupons[position].bizType == 3) {
Navigator.of(context).pushNamed( Navigator.of(context).pushNamed(
'/router/write_off_page', '/router/write_off_page',
arguments: { arguments: {

2
lib/order/order_history_page.dart

@ -200,7 +200,7 @@ class _OrderHistoryList extends State<OrderHistoryList>
} else { } else {
current += 1; current += 1;
} }
setState(() {}); // setState(() {});
} else { } else {
refreshController.refreshFailed(); refreshController.refreshFailed();
refreshController.loadFailed(); refreshController.loadFailed();

66
lib/order/write_off_page.dart

@ -1,12 +1,20 @@
import 'dart:convert';
import 'package:barcode_widget/barcode_widget.dart'; import 'package:barcode_widget/barcode_widget.dart';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.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/data/coupon.dart'; import 'package:huixiang/retrofit/data/coupon.dart';
import 'package:huixiang/retrofit/data/coupon_detail.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:huixiang/view_widget/separator.dart'; import 'package:huixiang/view_widget/separator.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:qr_flutter/qr_flutter.dart'; import 'package:qr_flutter/qr_flutter.dart';
import 'package:shared_preferences/shared_preferences.dart';
class WriteOffPage extends StatefulWidget { class WriteOffPage extends StatefulWidget {
final arguments; final arguments;
@ -20,14 +28,44 @@ class WriteOffPage extends StatefulWidget {
} }
class _WriteOffPage extends State<WriteOffPage> { class _WriteOffPage extends State<WriteOffPage> {
Coupon coupon; dynamic coupon;
ApiService apiService;
CouponDetail queryCoupon;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
coupon = Coupon.fromJson(widget.arguments["coupon"]); coupon = jsonDecode(widget.arguments["coupon"]);
if (mounted) setState(() {}); if (mounted) setState(() {});
queryCouponDetail(coupon["memberCouponId"]);
}
////
queryCouponDetail(memberCouponId) async {
if (apiService == null) {
SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService(
Dio(),
context: context,
token: value.getString("token"),
);
}
BaseData baseData = await apiService.couponDetail(memberCouponId);
if (baseData != null && baseData.isSuccess) {
setState(() {
queryCoupon = baseData.data;
if(queryCoupon.status==2){
Navigator.of(context).pop(true);
}
else Future.delayed(Duration(seconds: 1), () {
queryCouponDetail(coupon["memberCouponId"]);
});
});
} else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
}
} }
@override @override
@ -61,7 +99,7 @@ class _WriteOffPage extends State<WriteOffPage> {
child: Column( child: Column(
children: [ children: [
Text( Text(
coupon != null ? coupon.couponName : "", coupon != null ? coupon["couponName"] : "",
style: TextStyle( style: TextStyle(
fontSize: 16.sp, fontSize: 16.sp,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -71,8 +109,8 @@ class _WriteOffPage extends State<WriteOffPage> {
height: 8.h, height: 8.h,
), ),
Text( Text(
(coupon.useStartTime == null || coupon.useEndTime == null) ? "" : S.of(context).youxiaoqi( (coupon["useStartTime"] == null || coupon["useEndTime"] == null) ? "" : S.of(context).youxiaoqi(
"${coupon.useStartTime.replaceAll("-", ".").split(" ")[0]}-${coupon.useEndTime.replaceAll("-", ".").split(" ")[0]}"), "${coupon["useStartTime"].replaceAll("-", ".").split(" ")[0]}-${coupon["useEndTime"].replaceAll("-", ".").split(" ")[0]}"),
style: TextStyle( style: TextStyle(
fontSize: 12.sp, fontSize: 12.sp,
color: Color(0xFF353535), color: Color(0xFF353535),
@ -103,11 +141,11 @@ class _WriteOffPage extends State<WriteOffPage> {
children: [ children: [
Text( Text(
coupon != null coupon != null
? "${coupon.id.substring(0, 4)} " ? "${coupon["memberCouponId"].substring(0, 4)} "
"${coupon.id.substring(4, 8)} " "${coupon["memberCouponId"].substring(4, 8)} "
"${coupon.id.substring(8, 12)} " "${coupon["memberCouponId"].substring(8, 12)} "
"${coupon.id.substring(12, 16)} " "${coupon["memberCouponId"].substring(12, 16)} "
"${coupon.id.substring(16, coupon.id.length)}" "${coupon["memberCouponId"].substring(16, coupon["memberCouponId"].length)}"
: "", : "",
style: TextStyle( style: TextStyle(
fontSize: 14.sp, fontSize: 14.sp,
@ -115,12 +153,12 @@ class _WriteOffPage extends State<WriteOffPage> {
? 10 ? 10
: (MediaQuery.of(context).size.width - : (MediaQuery.of(context).size.width -
64.w) / 64.w) /
(((coupon.id.length) * 4)), (((coupon["memberCouponId"].length) * 4)),
letterSpacing: coupon == null letterSpacing: coupon == null
? 8 ? 8
: (MediaQuery.of(context).size.width - : (MediaQuery.of(context).size.width -
64.w) / 64.w) /
(((coupon.id.length) * 4)), (((coupon["memberCouponId"].length) * 4)),
fontWeight: MyFontWeight.semi_bold, fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF353535), color: Color(0xFF353535),
), ),
@ -130,7 +168,7 @@ class _WriteOffPage extends State<WriteOffPage> {
), ),
BarcodeWidget( BarcodeWidget(
barcode: Barcode.code128(useCode128C: true), barcode: Barcode.code128(useCode128C: true),
data: coupon != null ? coupon.id : "", data: coupon != null ? coupon["memberCouponId"] : "",
height: 72.h, height: 72.h,
color: Colors.black, color: Colors.black,
drawText: false, drawText: false,
@ -139,7 +177,7 @@ class _WriteOffPage extends State<WriteOffPage> {
height: 16.h, height: 16.h,
), ),
Expanded(child: QrImage( Expanded(child: QrImage(
data: coupon != null ? coupon.id : "", data: "{\"type\":\"wiped\",\"memberCouponId\":\"${coupon["memberCouponId"]}\"}",
version: QrVersions.auto, version: QrVersions.auto,
size: 200.w, size: 200.w,
gapless: true, gapless: true,

32
lib/qr/qr_share.dart

@ -29,7 +29,8 @@ class _QrSharePage extends State<QrSharePage> {
SharedPreferences.getInstance().then((value) { SharedPreferences.getInstance().then((value) {
if (value.getString('user') != null && value.getString('user') != "") { if (value.getString('user') != null && value.getString('user') != "") {
phone = UserInfo.fromJson(jsonDecode(value.getString('user'))).inviteCode; phone =
UserInfo.fromJson(jsonDecode(value.getString('user'))).inviteCode;
setState(() {}); setState(() {});
} }
}); });
@ -114,21 +115,20 @@ class _QrSharePage extends State<QrSharePage> {
children: [ children: [
shareTypeTitle(S.of(context).wodeyaoqingma), shareTypeTitle(S.of(context).wodeyaoqingma),
Container( Container(
margin: EdgeInsets.only(left: 16.w, right: 24.w), margin: EdgeInsets.only(left: 16.w, right: 24.w),
child: GestureDetector( child: GestureDetector(
child: Text( child: SelectableText(
// S.of(context).baocunsaoma, // S.of(context).baocunsaoma,
phone, phone,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
color: Color(0xFF2E3552), color: Color(0xFF2E3552),
fontSize: 40.sp, fontSize: 40.sp,
fontWeight: MyFontWeight.semi_bold, fontWeight: MyFontWeight.semi_bold,
),
), ),
), onTap: this.copy(phone),
onTap: this.copy(phone), )),
)
),
// Container( // Container(
// width: 152.w, // width: 152.w,
// height: 152.w, // height: 152.w,
@ -228,7 +228,7 @@ class _QrSharePage extends State<QrSharePage> {
} }
copy(String phone) { copy(String phone) {
print("..."+phone); print("..." + phone);
Clipboard.setData(ClipboardData(text: phone)); Clipboard.setData(ClipboardData(text: phone));
} }
} }

120
lib/retrofit/data/coupon_detail.dart

@ -0,0 +1,120 @@
/// id : "1493050078934335488"
/// createTime : "2022-02-14 10:30:53"
/// createUser : "1307141152536788992"
/// updateTime : "2022-02-14 10:30:53"
/// updateUser : "1307141152536788992"
/// mid : "1486626867212451840"
/// couponId : "1435510333782360064"
/// receiveTime : "2022-02-14 10:30:53"
/// useTime : null
/// useTimeStart : "2022-02-14 10:30:53"
/// useTimeEnd : "2022-02-15 10:30:53"
/// status : 1
/// isDeleted : false
/// tenantCode : "1166"
/// couponCode : ""
class CouponDetail {
CouponDetail({
String id,
String createTime,
String createUser,
String updateTime,
String updateUser,
String mid,
String couponId,
String receiveTime,
dynamic useTime,
String useTimeStart,
String useTimeEnd,
int status,
bool isDeleted,
String tenantCode,
String couponCode,}){
_id = id;
_createTime = createTime;
_createUser = createUser;
_updateTime = updateTime;
_updateUser = updateUser;
_mid = mid;
_couponId = couponId;
_receiveTime = receiveTime;
_useTime = useTime;
_useTimeStart = useTimeStart;
_useTimeEnd = useTimeEnd;
_status = status;
_isDeleted = isDeleted;
_tenantCode = tenantCode;
_couponCode = couponCode;
}
CouponDetail.fromJson(dynamic json) {
_id = json['id'];
_createTime = json['createTime'];
_createUser = json['createUser'];
_updateTime = json['updateTime'];
_updateUser = json['updateUser'];
_mid = json['mid'];
_couponId = json['couponId'];
_receiveTime = json['receiveTime'];
_useTime = json['useTime'];
_useTimeStart = json['useTimeStart'];
_useTimeEnd = json['useTimeEnd'];
_status = json['status'];
_isDeleted = json['isDeleted'];
_tenantCode = json['tenantCode'];
_couponCode = json['couponCode'];
}
String _id;
String _createTime;
String _createUser;
String _updateTime;
String _updateUser;
String _mid;
String _couponId;
String _receiveTime;
dynamic _useTime;
String _useTimeStart;
String _useTimeEnd;
int _status;
bool _isDeleted;
String _tenantCode;
String _couponCode;
String get id => _id;
String get createTime => _createTime;
String get createUser => _createUser;
String get updateTime => _updateTime;
String get updateUser => _updateUser;
String get mid => _mid;
String get couponId => _couponId;
String get receiveTime => _receiveTime;
dynamic get useTime => _useTime;
String get useTimeStart => _useTimeStart;
String get useTimeEnd => _useTimeEnd;
int get status => _status;
bool get isDeleted => _isDeleted;
String get tenantCode => _tenantCode;
String get couponCode => _couponCode;
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['id'] = _id;
map['createTime'] = _createTime;
map['createUser'] = _createUser;
map['updateTime'] = _updateTime;
map['updateUser'] = _updateUser;
map['mid'] = _mid;
map['couponId'] = _couponId;
map['receiveTime'] = _receiveTime;
map['useTime'] = _useTime;
map['useTimeStart'] = _useTimeStart;
map['useTimeEnd'] = _useTimeEnd;
map['status'] = _status;
map['isDeleted'] = _isDeleted;
map['tenantCode'] = _tenantCode;
map['couponCode'] = _couponCode;
return map;
}
}

4
lib/retrofit/min_api.dart

@ -61,8 +61,8 @@ abstract class MinApiService {
} }
headers["Environment"] = "app"; headers["Environment"] = "app";
dio.options = BaseOptions( dio.options = BaseOptions(
connectTimeout: 60000, connectTimeout: 15000,
receiveTimeout: 60000, receiveTimeout: 15000,
headers: headers, headers: headers,
responseType: ResponseType.json, responseType: ResponseType.json,
); );

13
lib/retrofit/retrofit_api.dart

@ -25,6 +25,7 @@ import 'data/brand_data.dart';
import 'data/category_select_list.dart'; import 'data/category_select_list.dart';
import 'data/chapter.dart'; import 'data/chapter.dart';
import 'data/collect_class_list.dart'; import 'data/collect_class_list.dart';
import 'data/coupon_detail.dart';
import 'data/course_details.dart'; import 'data/course_details.dart';
import 'data/course_list.dart'; import 'data/course_list.dart';
import 'data/exchange_order.dart'; import 'data/exchange_order.dart';
@ -87,8 +88,8 @@ abstract class ApiService {
headers["Environment"] = "app"; headers["Environment"] = "app";
} }
dio.options = BaseOptions( dio.options = BaseOptions(
connectTimeout: 60000, connectTimeout: 20000,
receiveTimeout: 60000, receiveTimeout: 20000,
headers: headers, headers: headers,
responseType: ResponseType.json, responseType: ResponseType.json,
); );
@ -490,4 +491,12 @@ abstract class ApiService {
@POST("/member/inviteMemberList") @POST("/member/inviteMemberList")
Future<BaseData<PageInfo<InvitationList>>> inviteMemberList(@Body() Map<String, dynamic> map); Future<BaseData<PageInfo<InvitationList>>> inviteMemberList(@Body() Map<String, dynamic> map);
///
@GET("/coupon/wiped/{memberCouponId}")
Future<BaseData> wiped(@Path("memberCouponId") String memberCouponId);
///
@GET("coupon/detail/")
Future<BaseData<CouponDetail>> couponDetail(@Path("") String memberCouponId);
} }

43
lib/retrofit/retrofit_api.g.dart

@ -1827,5 +1827,48 @@ class _ApiService implements ApiService {
return value; return value;
} }
@override
Future<BaseData<dynamic>> wiped(memberCouponId) async {
ArgumentError.checkNotNull(memberCouponId, 'memberCouponId');
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
final _result = await _dio.request<Map<String, dynamic>>(
'/coupon/wiped/$memberCouponId',
queryParameters: queryParameters,
options: RequestOptions(
method: 'GET',
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData<dynamic>.fromJson(
_result.data,
(json) => json as dynamic,
);
return value;
}
@override
Future<BaseData<CouponDetail>> couponDetail(memberCouponId) async {
ArgumentError.checkNotNull(memberCouponId, 'memberCouponId');
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
final _result = await _dio.request<Map<String, dynamic>>(
'coupon/detail/$memberCouponId',
queryParameters: queryParameters,
options: RequestOptions(
method: 'GET',
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData<CouponDetail>.fromJson(
_result.data,
(json) => CouponDetail.fromJson(json),
);
return value;
}
} }

150
lib/settlement/settlement.dart

@ -20,7 +20,6 @@ import 'package:huixiang/retrofit/data/wx_pay.dart';
import 'package:huixiang/retrofit/min_api.dart'; import 'package:huixiang/retrofit/min_api.dart';
import 'package:huixiang/settlement/settlement_view/activity_coupon_remarks.dart'; import 'package:huixiang/settlement/settlement_view/activity_coupon_remarks.dart';
import 'package:huixiang/settlement/settlement_view/distribution.dart'; import 'package:huixiang/settlement/settlement_view/distribution.dart';
import 'package:huixiang/settlement/settlement_view/edit_phone.dart';
import 'package:huixiang/settlement/settlement_view/pay_method.dart'; import 'package:huixiang/settlement/settlement_view/pay_method.dart';
import 'package:huixiang/settlement/settlement_view/settlement_activity.dart'; import 'package:huixiang/settlement/settlement_view/settlement_activity.dart';
import 'package:huixiang/settlement/settlement_view/settlement_coupon.dart'; import 'package:huixiang/settlement/settlement_view/settlement_coupon.dart';
@ -53,7 +52,7 @@ class _Settlement extends State<Settlement> {
SettleOrderInfo settleOrderInfo; SettleOrderInfo settleOrderInfo;
MinOrderInfo minOrderInfo; MinOrderInfo minOrderInfo;
int selectedBtn = 0; int selectedBtn = 0;
String remakers = "口味、面包硬度等"; String remakers = "";
String parentCode = ""; String parentCode = "";
String parentId = ""; String parentId = "";
int payChannel = 4; int payChannel = 4;
@ -74,8 +73,8 @@ class _Settlement extends State<Settlement> {
parentId = widget.arguments["parentId"] ?? ""; parentId = widget.arguments["parentId"] ?? "";
storeInfo = widget.arguments["storeInfo"]; storeInfo = widget.arguments["storeInfo"];
numberOfPeople = widget.arguments["numberOfPeople"] ?? 0; numberOfPeople = widget.arguments["numberOfPeople"] ?? 0;
promotions=widget.arguments["pName"]??""; promotions = widget.arguments["pName"] ?? "";
coupons=widget.arguments["cName"]??""; coupons = widget.arguments["cName"] ?? "";
if (tableId == 0) { if (tableId == 0) {
placeOrder = true; placeOrder = true;
} }
@ -84,14 +83,13 @@ class _Settlement extends State<Settlement> {
String minToken = value.getString("minToken"); String minToken = value.getString("minToken");
String tenant = value.getString("tenant"); String tenant = value.getString("tenant");
String storeId = value.getString("storeId"); String storeId = value.getString("storeId");
minService = MinApiService( minService = MinApiService(Dio(),
Dio(), context: context,
context: context, token: minToken,
token: minToken, tenant: tenant,
tenant: tenant, storeId: storeId,
storeId: storeId, showLoading: true);
); if (promotions != null && promotions != "" || tableId <= 0) {
if(promotions != null && promotions != "" || tableId <=0){
queryOrderInfo( queryOrderInfo(
address != null ? address.id : null, address != null ? address.id : null,
selectedBtn, selectedBtn,
@ -99,7 +97,7 @@ class _Settlement extends State<Settlement> {
0, 0,
widget.arguments["pid"], widget.arguments["pid"],
); );
}else if(coupons != null && coupons != "" || tableId <=0){ } else if (coupons != null && coupons != "" || tableId <= 0) {
queryOrderInfo( queryOrderInfo(
address != null ? address.id : null, address != null ? address.id : null,
selectedBtn, selectedBtn,
@ -107,8 +105,7 @@ class _Settlement extends State<Settlement> {
0, 0,
null, null,
); );
} } else
else
queryOrderInfo(null, selectedBtn, null, 0, null); queryOrderInfo(null, selectedBtn, null, 0, null);
}); });
@ -142,7 +139,6 @@ class _Settlement extends State<Settlement> {
queryOrderDetails(parentId); queryOrderDetails(parentId);
} }
}); });
} }
} }
@ -215,13 +211,12 @@ class _Settlement extends State<Settlement> {
/// ///
selectedAddress(String addId) async { selectedAddress(String addId) async {
BaseData<List<Address>> baseDate = BaseData<List<Address>> baseDate =
await minService.queryAddress().catchError((error) {}); await minService.queryAddress().catchError((error) {});
if (baseDate != null && baseDate.isSuccess) { if (baseDate != null && baseDate.isSuccess) {
setState(() { setState(() {
baseDate.data.forEach((element) { baseDate.data.forEach((element) {
if(element.id == addId) if (element.id == addId) address = element;
address = element;
}); });
}); });
@ -259,9 +254,13 @@ class _Settlement extends State<Settlement> {
placeOrderFirst.payChannel = payChannel; placeOrderFirst.payChannel = payChannel;
placeOrderFirst.promotionInfoDTO = PromotionInfoDTOBean(); placeOrderFirst.promotionInfoDTO = PromotionInfoDTOBean();
placeOrderFirst.promotionInfoDTO.promotionId = placeOrderFirst.promotionInfoDTO.promotionId =
(promotion != null && tableId <= 0) ? promotion.id : widget.arguments["pid"]??""; (promotion != null && tableId <= 0)
? promotion.id
: widget.arguments["pid"] ?? "";
placeOrderFirst.promotionInfoDTO.couponId = placeOrderFirst.promotionInfoDTO.couponId =
(couponListBean != null && tableId <= 0) ? couponListBean.id : widget.arguments["cid"]??""; (couponListBean != null && tableId <= 0)
? couponListBean.id
: widget.arguments["cid"] ?? "";
placeOrderFirst.recMobile = placeOrderFirst.recMobile =
(mobile == null || mobile == "") ? mobile : storeInfo.headMobile; (mobile == null || mobile == "") ? mobile : storeInfo.headMobile;
placeOrderFirst.shoppingCartSkuItemList = settleOrderInfo.orderProductList; placeOrderFirst.shoppingCartSkuItemList = settleOrderInfo.orderProductList;
@ -282,10 +281,8 @@ class _Settlement extends State<Settlement> {
placeOrder = true; placeOrder = true;
this.downOrder = baseData.data; this.downOrder = baseData.data;
querySettlement(); querySettlement();
} } else {
else{ SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
SmartDialog.showToast(baseData.msg,
alignment: Alignment.center);
} }
} else { } else {
/// ///
@ -342,7 +339,7 @@ class _Settlement extends State<Settlement> {
BaseData<WxPay> baseData = await minService BaseData<WxPay> baseData = await minService
.settlementWx(placeOrderFirst.toJson()) .settlementWx(placeOrderFirst.toJson())
.catchError((error) { .catchError((error) {
print(error); print(error);
}); });
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
WxPay wxPay = baseData.data; WxPay wxPay = baseData.data;
@ -361,13 +358,12 @@ class _Settlement extends State<Settlement> {
sign: wxPay.sign, sign: wxPay.sign,
); );
} }
} } else {
else {
BaseData baseData = await minService BaseData baseData = await minService
.settlementApi(placeOrderFirst.toJson()) .settlementApi(placeOrderFirst.toJson())
.catchError((error) { .catchError((error) {
print(error); print(error);
}); });
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
toOrderDetails(placeOrderFirst.id); toOrderDetails(placeOrderFirst.id);
} else { } else {
@ -429,26 +425,15 @@ class _Settlement extends State<Settlement> {
child: Container( child: Container(
child: Column( child: Column(
children: [ children: [
DistributionMode( DistributionMode((addressId, isTake,
(addressId, memberCouponId, orderId, promotionId) {
isTake, setState(() {
memberCouponId, this.selectedBtn = 0;
orderId, });
promotionId){ queryOrderInfo(addressId, isTake,
setState(() { memberCouponId, orderId, promotionId);
this.selectedBtn = 0; }, queryAddress, storeInfo, address,
}); selectedAddress),
queryOrderInfo(addressId,
isTake,
memberCouponId,
orderId,
promotionId);
},
queryAddress,
storeInfo,
address,
selectedAddress
),
SizedBox( SizedBox(
height: 16, height: 16,
@ -470,24 +455,26 @@ class _Settlement extends State<Settlement> {
///// /////
ActivityCouponRemarks( ActivityCouponRemarks(
couponCart, couponCart,
activityCart, activityCart,
settleOrderInfo, settleOrderInfo,
coupons, coupons,
promotions, promotions,
couponCount(), couponCount(),
placeOrder, placeOrder,
remakers, () { remakers,
Navigator.of(context).pushNamed( () {
'/router/edit_remarks_page', Navigator.of(context).pushNamed(
arguments: {}, '/router/edit_remarks_page',
).then((value) => { arguments: {},
setState(() { ).then((value) => {
if (value != null) remakers = value; setState(() {
}) if (value != null) remakers = value;
}); })
}, });
tableId,), },
tableId,
),
if (placeOrder) if (placeOrder)
@ -598,13 +585,13 @@ class _Settlement extends State<Settlement> {
this.couponListBean = couponBean; this.couponListBean = couponBean;
coupons = couponListBean.promotionName; coupons = couponListBean.promotionName;
promotions = ""; promotions = "";
queryOrderInfo( queryOrderInfo(
address != null ? address.id : null, address != null ? address.id : null,
selectedBtn, selectedBtn,
couponListBean != null ? couponListBean.id : null, couponListBean != null ? couponListBean.id : null,
0, 0,
null, null,
); );
} }
} }
@ -622,14 +609,13 @@ class _Settlement extends State<Settlement> {
this.promotion = pro; this.promotion = pro;
promotions = promotion.name; promotions = promotion.name;
coupons = ""; coupons = "";
queryOrderInfo( queryOrderInfo(
address != null ? address.id : null, address != null ? address.id : null,
selectedBtn, selectedBtn,
null, null,
0, 0,
promotion != null ? promotion.id : null, promotion != null ? promotion.id : null,
); );
} }
} }
} }

4
lib/settlement/settlement_view/activity_coupon_remarks.dart

@ -200,11 +200,11 @@ class _ActivityCouponRemarks extends State<ActivityCouponRemarks> {
), ),
Expanded( Expanded(
child: Text( child: Text(
widget.remark, widget.remark != ""? widget.remark:"口味、面包硬度等",
textAlign: TextAlign.end, textAlign: TextAlign.end,
style: TextStyle( style: TextStyle(
fontSize: 14.sp, fontSize: 14.sp,
color: Color(0xFF353535), color: Color(0xFFA29E9E),
fontWeight: MyFontWeight.semi_bold, fontWeight: MyFontWeight.semi_bold,
), ),
), ),

2
lib/view_widget/invite_success_dialog.dart

@ -64,7 +64,7 @@ class _InviteSuccessDialog extends State<InviteSuccessDialog> {
textAlign: TextAlign.center, textAlign: TextAlign.center,
text: TextSpan( text: TextSpan(
text: text:
"通过${widget.invite.substring(0, 3)}****${widget.invite.substring(7, 11)}的邀请码完成邀请,获得", "通过${widget.invite}的邀请码完成邀请,获得",
style: TextStyle( style: TextStyle(
color: Color(0xFF1A1A1A), color: Color(0xFF1A1A1A),
fontSize: 14.sp, fontSize: 14.sp,

5
lib/view_widget/new_coupon_widget.dart

@ -254,8 +254,7 @@ class NewCouponWidget extends StatelessWidget {
), ),
Text( Text(
S.of(context).manyuankeyong(coupon != null S.of(context).manyuankeyong(coupon != null
? double.tryParse("${coupon.fullAmount}" ?? "0") ? ("${coupon.fullAmount}" ?? "0")
.toInt()
.toString() .toString()
: ""), : ""),
style: TextStyle( style: TextStyle(
@ -436,7 +435,7 @@ class NewCouponWidget extends StatelessWidget {
color: Color(0xFF32A060), color: Color(0xFF32A060),
), ),
child: Text( child: Text(
(coupon.bizType == 5) (coupon.bizType == 5 || coupon.bizType == 3)
? S.of(context).quhexiao ? S.of(context).quhexiao
: S.of(context).qushiyong, : S.of(context).qushiyong,
style: TextStyle( style: TextStyle(

Loading…
Cancel
Save