Bläddra i källkod

fix:优化会员中心界面的一些调整。

“HeShaoZe” 4 månader sedan
förälder
incheckning
b8d8b2f6d5

BIN
assets/images/icon_alipay_payment.webp


BIN
assets/images/icon_cb_selected.webp


BIN
assets/images/icon_cb_un_select.webp


BIN
assets/images/icon_member_comment_very_satisfied.webp


BIN
assets/images/icon_wechat_payment.webp


+ 4 - 0
lib/data/api/response/item_list_response.dart

@@ -1,6 +1,7 @@
 import 'package:json_annotation/json_annotation.dart';
 import 'package:location/data/bean/goods_bean.dart';
 
+import '../../bean/goods_evaluate_info.dart';
 import '../../bean/pay_item_bean.dart';
 
 part 'item_list_response.g.dart';
@@ -13,6 +14,9 @@ class ItemListResponse {
   @JsonKey(name: "payOptions")
   List<PayItemBean>? payInfoList;
 
+  @JsonKey(name: "evaluateList")
+  List<GoodsEvaluateInfo>? evaluateList;
+
   ItemListResponse(this.goodsList, this.payInfoList);
 
   factory ItemListResponse.fromJson(Map<String, dynamic> json) =>

+ 4 - 1
lib/data/api/response/item_list_response.g.dart

@@ -14,10 +14,13 @@ ItemListResponse _$ItemListResponseFromJson(Map<String, dynamic> json) =>
       (json['payOptions'] as List<dynamic>?)
           ?.map((e) => PayItemBean.fromJson(e as Map<String, dynamic>))
           .toList(),
-    );
+    )..evaluateList = (json['evaluateList'] as List<dynamic>?)
+        ?.map((e) => GoodsEvaluateInfo.fromJson(e as Map<String, dynamic>))
+        .toList();
 
 Map<String, dynamic> _$ItemListResponseToJson(ItemListResponse instance) =>
     <String, dynamic>{
       'list': instance.goodsList,
       'payOptions': instance.payInfoList,
+      'evaluateList': instance.evaluateList,
     };

+ 30 - 0
lib/data/bean/goods_evaluate_info.dart

@@ -0,0 +1,30 @@
+
+import 'package:json_annotation/json_annotation.dart';
+
+part 'goods_evaluate_info.g.dart';
+
+@JsonSerializable()
+class GoodsEvaluateInfo {
+
+  @JsonKey(name: 'avatar')
+  String avatar;
+
+  @JsonKey(name: 'name')
+  String name;
+
+  @JsonKey(name: 'content')
+  String content;
+
+  @JsonKey(name: 'description')
+  String description;
+
+  GoodsEvaluateInfo(
+      this.avatar,
+      this.name,
+      this.content,
+      this.description,
+      );
+
+  factory GoodsEvaluateInfo.fromJson(Map<String, dynamic> json) =>
+      _$GoodsEvaluateInfoFromJson(json);
+}

+ 23 - 0
lib/data/bean/goods_evaluate_info.g.dart

@@ -0,0 +1,23 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of 'goods_evaluate_info.dart';
+
+// **************************************************************************
+// JsonSerializableGenerator
+// **************************************************************************
+
+GoodsEvaluateInfo _$GoodsEvaluateInfoFromJson(Map<String, dynamic> json) =>
+    GoodsEvaluateInfo(
+      json['avatar'] as String,
+      json['name'] as String,
+      json['content'] as String,
+      json['description'] as String,
+    );
+
+Map<String, dynamic> _$GoodsEvaluateInfoToJson(GoodsEvaluateInfo instance) =>
+    <String, dynamic>{
+      'avatar': instance.avatar,
+      'name': instance.name,
+      'content': instance.content,
+      'description': instance.description,
+    };

+ 10 - 4
lib/module/member/member_controller.dart

@@ -21,6 +21,7 @@ import 'package:location/utils/common_expand.dart';
 import 'package:location/utils/toast_util.dart';
 
 import '../../data/api/response/subscription_check_response.dart';
+import '../../data/bean/goods_evaluate_info.dart';
 import '../../data/bean/member_status_info.dart';
 import '../../data/bean/wechat_payment_sign_bean.dart';
 import '../../data/consts/error_code.dart';
@@ -39,8 +40,6 @@ import '../../utils/payment_status_manager.dart';
 import '../../widget/animated_switcher_widget.dart';
 import '../browser/browser_view.dart';
 import '../mine/mine_controller.dart';
-import 'member_discount_countdown_widget.dart';
-import 'member_evaluate_bean.dart';
 import 'member_evaluation_pop_up_dialog.dart';
 import 'member_first_week_discount_dialog.dart';
 import 'member_fun_bean.dart';
@@ -87,6 +86,9 @@ class MemberController extends BaseController implements PaymentStatusCallback {
 
   final RxList<PayItemBean> payItemList = <PayItemBean>[].obs;
 
+  ///评论
+  final RxList<GoodsEvaluateInfo> evaluateList = <GoodsEvaluateInfo>[].obs;
+
   final RxBool isShowCount = RxBool(true);
 
   CancelableFuture? _memberDataFuture;
@@ -115,7 +117,7 @@ class MemberController extends BaseController implements PaymentStatusCallback {
         StringName.memberFunName6, StringName.memberFunName6Desc),
   ];
 
-  final List<MemberEvaluateBean> evaluateList = [
+  /*final List<MemberEvaluateBean> evaluateList = [
     MemberEvaluateBean(1, Assets.images.iconEvaluate1.path, '用户189****7913',
         "上班没时间,远程遛娃,非常方便很好用。"),
     MemberEvaluateBean(2, Assets.images.iconEvaluate2.path, '用户177****2345',
@@ -126,7 +128,7 @@ class MemberController extends BaseController implements PaymentStatusCallback {
         "实时定位非常精准,用来监控孩子的行踪特别方便,再也不用担心他们乱跑了。"),
     MemberEvaluateBean(5, Assets.images.iconEvaluate5.path, '用户182****9012',
         "用来遛狗也很方便,再也不用担心狗狗跑丢了,真是个好工具!"),
-  ];
+  ];*/
 
   static const String _keMemberPageShowKey = "member_page_show_key";
 
@@ -243,6 +245,7 @@ class MemberController extends BaseController implements PaymentStatusCallback {
         .then((response) {
       goodsList.clear();
       payItemList.clear();
+      evaluateList.clear();
       _selectedGoods.value = null;
       if (response.goodsList?.isNotEmpty == true) {
         goodsList.addAll(response.goodsList!);
@@ -252,6 +255,9 @@ class MemberController extends BaseController implements PaymentStatusCallback {
         payItemList.addAll(response.payInfoList!);
         _selectedPayWay.value = payItemList.first;
       }
+      if (response.evaluateList?.isNotEmpty == true) {
+        evaluateList.addAll(response.evaluateList!);
+      }
     });
   }
 

+ 0 - 12
lib/module/member/member_evaluate_bean.dart

@@ -1,12 +0,0 @@
-class MemberEvaluateBean {
-  final int id;
-
-  final String avatarPath;
-
-  final String userName;
-
-  final String userEvaluate;
-
-  MemberEvaluateBean(
-      this.id, this.avatarPath, this.userName, this.userEvaluate);
-}

+ 0 - 1
lib/module/member/member_header_cycle_widget.dart

@@ -64,7 +64,6 @@ class _MemberHeaderCycleWidgetState extends State<MemberHeaderCycleWidget> {
     return Stack(
       children: [
         Container(
-          color: Colors.orangeAccent,
           height: 291.w + MediaQuery.of(Get.context!).padding.top,
           width: double.infinity,
           child: PageView.builder(

+ 83 - 167
lib/module/member/member_page.dart

@@ -16,16 +16,15 @@ import 'package:location/utils/common_expand.dart';
 import 'package:location/utils/project_expand.dart';
 import 'package:location/widget/auto_scroll_list_view.dart';
 import '../../data/bean/goods_bean.dart';
+import '../../data/bean/goods_evaluate_info.dart';
 import '../../data/bean/member_status_info.dart';
 import '../../data/bean/pay_item_bean.dart';
 import '../../data/consts/payment_type.dart';
-import '../../resource/fonts.gen.dart';
 import '../../resource/string.gen.dart';
 import '../../router/app_pages.dart';
 import '../../utils/date_util.dart';
 import '../../widget/animated_switcher_widget.dart';
 import 'member_discount_countdown_widget.dart';
-import 'member_evaluate_bean.dart';
 import 'member_header_cycle_widget.dart';
 
 ///进入会员类型
@@ -103,7 +102,6 @@ class MemberPage extends BasePage<MemberController> {
                                 borderRadius: BorderRadius.only(
                                     topLeft: Radius.circular(20.w),
                                     topRight: Radius.circular(20.w)),
-                                image: DecorationImage(image: Assets.images.iconMemberVipMiddleBg.provider())
                             ),
                             child: Column(
                               crossAxisAlignment: CrossAxisAlignment.start,
@@ -113,42 +111,19 @@ class MemberPage extends BasePage<MemberController> {
                                 SizedBox(height: 23.w),
                                 buildGoodsList(),
                                 SizedBox(height: 12.w),
-                                buildPrivacyPolicyView(),
                                 buildPayWayView(),
-                                SizedBox(height: 30.w),
-                                Padding(
-                                  padding: EdgeInsets.only(left: 12.w),
-                                  child: Text(StringName.memberEquityIntroduction,
-                                      style: TextStyle(
-                                          fontSize: 16.sp,
-                                          color: ColorName.black90,
-                                          fontWeight: FontWeight.bold)),
-                                ),
-                                SizedBox(height: 19.w),
-                                buildFunctionList(),
-                                SizedBox(height: 40.w),
+                                SizedBox(height: 12.w),
                                 Padding(
-                                  padding: EdgeInsets.only(left: 12.w),
+                                  padding: EdgeInsets.only(left: 16.w),
                                   child: Text(StringName.memberUserEvaluate,
                                       style: TextStyle(
                                           fontSize: 16.sp,
-                                          color: ColorName.black90,
+                                          color: ColorName.black,
                                           fontWeight: FontWeight.bold)),
                                 ),
-                                SizedBox(height: 8.w),
+                                //SizedBox(height: 8.w),
                                 buildUserEvaluateList(),
-                                SizedBox(height: 20.w),
-                                Container(
-                                  padding: EdgeInsets.all(12.w),
-                                  decoration: BoxDecoration(
-                                      color: '#F7F7F7'.color,
-                                      borderRadius: BorderRadius.circular(6.w)),
-                                  margin: EdgeInsets.symmetric(horizontal: 12.w),
-                                  child: Text(StringName.memberTips,
-                                      style: TextStyle(
-                                          fontSize: 12.sp, color: '#A7A7A7'.color)),
-                                ),
-                                SizedBox(height: 100.w)
+                                SizedBox(height: 190.w + MediaQuery.of(Get.context!).padding.bottom)
                               ],
                             ),
                           ),
@@ -159,76 +134,6 @@ class MemberPage extends BasePage<MemberController> {
                 ),
               ],
             )
-            /*Stack(
-              children: [
-                Assets.images.bgMemberHeader.image(width: double.infinity),
-                SafeArea(
-                  child: Column(
-                    children: [
-                      SizedBox(height: 249.w + MediaQuery.of(Get.context!).padding.top),
-                      buildUserInfoView(),
-                      SizedBox(height: 26.w),
-                      Container(
-                        width: double.infinity,
-                        decoration: BoxDecoration(
-                            borderRadius: BorderRadius.only(
-                                topLeft: Radius.circular(14.w),
-                                topRight: Radius.circular(14.w)),
-                            gradient: LinearGradient(
-                                begin: Alignment.topCenter,
-                                end: Alignment.bottomCenter,
-                                stops: [0.0, 0.1],
-                                colors: ['#EFE9FF'.color, Colors.white])),
-                        child: Column(
-                          crossAxisAlignment: CrossAxisAlignment.start,
-                          children: [
-                            SizedBox(height: 23.w),
-                            buildGoodsList(),
-                            SizedBox(height: 12.w),
-                            buildPrivacyPolicyView(),
-                            buildPayWayView(),
-                            SizedBox(height: 30.w),
-                            Padding(
-                              padding: EdgeInsets.only(left: 12.w),
-                              child: Text(StringName.memberEquityIntroduction,
-                                  style: TextStyle(
-                                      fontSize: 16.sp,
-                                      color: ColorName.black90,
-                                      fontWeight: FontWeight.bold)),
-                            ),
-                            SizedBox(height: 19.w),
-                            buildFunctionList(),
-                            SizedBox(height: 40.w),
-                            Padding(
-                              padding: EdgeInsets.only(left: 12.w),
-                              child: Text(StringName.memberUserEvaluate,
-                                  style: TextStyle(
-                                      fontSize: 16.sp,
-                                      color: ColorName.black90,
-                                      fontWeight: FontWeight.bold)),
-                            ),
-                            SizedBox(height: 8.w),
-                            buildUserEvaluateList(),
-                            SizedBox(height: 20.w),
-                            Container(
-                              padding: EdgeInsets.all(12.w),
-                              decoration: BoxDecoration(
-                                  color: '#F7F7F7'.color,
-                                  borderRadius: BorderRadius.circular(6.w)),
-                              margin: EdgeInsets.symmetric(horizontal: 12.w),
-                              child: Text(StringName.memberTips,
-                                  style: TextStyle(
-                                      fontSize: 12.sp, color: '#A7A7A7'.color)),
-                            ),
-                            SizedBox(height: 100.w)
-                          ],
-                        ),
-                      )
-                    ],
-                  ),
-                )
-              ],
-            ),*/
           ),
           buildHeadBar(),
           buildMemberBottomView()
@@ -639,19 +544,6 @@ class MemberPage extends BasePage<MemberController> {
       ],
     );
   }
-  // Spacer(),
-  // Container(
-  //     decoration: BoxDecoration(
-  //       color: '#272F51'.color,
-  //       border: Border.all(color: '#99CAB0F0'.color, width: 1.w),
-  //       borderRadius: BorderRadius.circular(100.w),
-  //     ),
-  //     padding: EdgeInsets.symmetric(horizontal: 18.w, vertical: 6.w),
-  //     child: Obx(() {
-  //       return Text(
-  //           MemberStatusInfo.getLevelDesc(controller.memberStatusInfo),
-  //           style: TextStyle(fontSize: 12.sp, color: '#D2CCFF'.color));
-  //     })),
 
   Widget buildMemberCardVipDesc() {
     return Obx(() {
@@ -679,7 +571,7 @@ class MemberPage extends BasePage<MemberController> {
     return Obx(() {
       return Stack(
         children: [
-          IgnorePointer(
+          /*IgnorePointer(
             child: Container(
               color: ColorName.colorPrimary.withOpacity(controller.toolBarOpacity),
               child: SafeArea(
@@ -689,7 +581,7 @@ class MemberPage extends BasePage<MemberController> {
                 ),
               ),
             ),
-          ),
+          ),*/
           SafeArea(
             child: SizedBox(
               width: double.infinity,
@@ -821,47 +713,69 @@ class MemberPage extends BasePage<MemberController> {
   }
 
   Widget buildUserEvaluateList() {
-    return Column(
-      children: [
-        for (int index = 0; index < controller.evaluateList.length; index++)
-          buildUserEvaluateItem(controller.evaluateList[index],
-              index == controller.evaluateList.length - 1)
-      ],
-    );
+    return Obx(() {
+      return Column(
+        children: [
+          for (int index = 0; index < controller.evaluateList.length; index++)
+            buildUserEvaluateItem(controller.evaluateList.value[index],
+                index == controller.evaluateList.value.length - 1,index == 0)
+        ],
+      );
+    });
   }
 
-  Widget buildUserEvaluateItem(MemberEvaluateBean item, bool isLast) {
-    return Column(
-      crossAxisAlignment: CrossAxisAlignment.start,
-      children: [
-        SizedBox(height: 20.w),
-        Row(
-          children: [
-            SizedBox(width: 12.w),
-            Image.asset(item.avatarPath, width: 24.w, height: 24.w),
-            SizedBox(width: 8.w),
-            Text(
-              item.userName,
-              style: TextStyle(fontSize: 14.sp, color: Colors.black),
-            )
-          ],
-        ),
-        SizedBox(height: 1.w),
-        Padding(
-            padding: EdgeInsets.only(left: 44.w, right: 12.w),
-            child: Text(
-              item.userEvaluate,
-              style: TextStyle(fontSize: 14.sp, color: '#BF000000'.color),
-            )),
-        SizedBox(height: 20.w),
-        Visibility(
-          child: Container(
-              margin: EdgeInsets.only(left: 26.w),
-              width: 288.w,
-              color: '#21000000'.color,
-              height: 1.w),
-        )
-      ],
+  Widget buildUserEvaluateItem(GoodsEvaluateInfo item, bool isLast,bool isFirst) {
+    return Container(
+      padding: EdgeInsets.symmetric(horizontal: 16.w),
+      child: Column(
+        crossAxisAlignment: CrossAxisAlignment.start,
+        children: [
+          SizedBox(height: isFirst? 16.w : 20.w),
+          Row(
+            children: [
+              CachedNetworkImage(imageUrl: item.avatar,width: 34.w, height: 34.w,),
+              SizedBox(width: 10.w),
+              // 使用 Expanded 确保 Column 占据剩余宽度
+              Expanded(
+                child: Column(
+                  crossAxisAlignment: CrossAxisAlignment.start,
+                  children: [
+                    Row(
+                      children: [
+                        Text(
+                          item.name,
+                          style: TextStyle(fontSize: 14.sp, color: "#333333".color, fontWeight: FontWeight.w400),
+                        ),
+                        Spacer(),
+                        Assets.images.iconMemberCommentVerySatisfied.image(width: 16.w,height: 16.w),
+                        SizedBox(width: 5.w),
+                        Text(
+                          item.description,
+                          style: TextStyle(fontSize: 11.sp, color: "#DC8514".color, fontWeight: FontWeight.w500),
+                        )
+                      ],
+                    ),
+                    SizedBox(height: 5.w),
+                    Text(
+                      item.content,
+                      style: TextStyle(fontSize: 11.sp, color: '#333333'.color, fontWeight: FontWeight.w400),
+                      maxLines: null, // 允许无限行数
+                      softWrap: true, // 允许文本换行
+                    )
+                  ],
+                ),
+              )
+            ],
+          ),
+          SizedBox(height: 20.w),
+          Visibility(
+            child: Container(
+              color: '#EEEEEE'.color,
+              height: 1.w,
+            ),
+          )
+        ],
+      ),
     );
   }
 
@@ -870,9 +784,14 @@ class MemberPage extends BasePage<MemberController> {
       return Visibility(
         visible: Platform.isIOS ? false : controller.payItemList.isNotEmpty,
         child: Container(
-          margin: EdgeInsets.only(top: 7.w),
+          margin: EdgeInsets.symmetric(horizontal: 16.w),
           child: Column(
+            crossAxisAlignment: CrossAxisAlignment.start,
             children: [
+              SizedBox(height: 12.w),
+              Text("支付方式",
+                  style: TextStyle(fontSize: 16.sp, color: ColorName.black,fontWeight: FontWeight.bold)),
+              SizedBox(height: 5.w,),
               for (PayItemBean item in controller.payItemList)
                 buildPayWayItem(item)
             ],
@@ -889,27 +808,24 @@ class MemberPage extends BasePage<MemberController> {
       child: Obx(() {
         bool isSelected = controller.selectedPayWay?.id == item.id;
         return Container(
-          padding: EdgeInsets.symmetric(vertical: 10.w),
+          padding: EdgeInsets.symmetric(vertical: 12.w),
           child: Row(
             children: [
-              SizedBox(width: 12.w),
               Image.asset(
                   getPaymentIconPath(
-                      payMethod: item.payMethod, payPlatform: item.payPlatform),
-                  width: 24.w,
-                  height: 24.w),
-              SizedBox(width: 6.w),
+                      payMethod:item.payMethod, payPlatform: item.payPlatform),
+                  width: 20.w,
+                  height: 20.w),
+              SizedBox(width: 8.w),
               Text(item.title,
-                  style: TextStyle(fontSize: 14.sp, color: ColorName.black90)),
+                  style: TextStyle(fontSize: 12.sp, color: ColorName.black,fontWeight: FontWeight.w400)),
               Spacer(),
               Image.asset(
                   isSelected
                       ? Assets.images.iconCbSelected.path
                       : Assets.images.iconCbUnSelect.path,
-                  width: 20.w,
-                  height: 20.w),
-              SizedBox(width: 20.w),
-            ],
+                  width: 16.w,
+                  height: 16.w),],
           ),
         );
       }),

+ 5 - 0
lib/resource/assets.gen.dart

@@ -264,6 +264,10 @@ class $AssetsImagesGen {
   AssetGenImage get iconMemberAvatar =>
       const AssetGenImage('assets/images/icon_member_avatar.webp');
 
+  /// File path: assets/images/icon_member_comment_very_satisfied.webp
+  AssetGenImage get iconMemberCommentVerySatisfied => const AssetGenImage(
+      'assets/images/icon_member_comment_very_satisfied.webp');
+
   /// File path: assets/images/icon_member_contact_click_help.webp
   AssetGenImage get iconMemberContactClickHelp =>
       const AssetGenImage('assets/images/icon_member_contact_click_help.webp');
@@ -665,6 +669,7 @@ class $AssetsImagesGen {
         iconMainRefreshMineLocation,
         iconMainTrackArrow,
         iconMemberAvatar,
+        iconMemberCommentVerySatisfied,
         iconMemberContactClickHelp,
         iconMemberContactClickHelpClose,
         iconMemberFun5,