diff --git a/android/app/src/main/kotlin/com/taihe/mianhuatang/MainActivity.kt b/android/app/src/main/kotlin/com/taihe/mianhuatang/MainActivity.kt index 8537ae0..38032ef 100644 --- a/android/app/src/main/kotlin/com/taihe/mianhuatang/MainActivity.kt +++ b/android/app/src/main/kotlin/com/taihe/mianhuatang/MainActivity.kt @@ -1,4 +1,4 @@ -package com.taihe.vbvs_app +package com.taihe.mh_app import io.flutter.embedding.android.FlutterActivity diff --git a/lib/common/util/Dio.dart b/lib/common/util/Dio.dart new file mode 100644 index 0000000..0f9dcf7 --- /dev/null +++ b/lib/common/util/Dio.dart @@ -0,0 +1,241 @@ +import 'package:dio/dio.dart'; +import 'package:get/get.dart'; +import 'package:get_storage/get_storage.dart'; +import 'package:vbvs_app/common/util/MyUtils.dart'; +import 'package:vbvs_app/controller/login/login_controller.dart'; +import 'package:vbvs_app/pages/common/selectDialog.dart'; + +class ApiService { + static Dio dio = Dio(); + + static Dio request = Dio(); + static Dio requestNoInfo = Dio(); + static Dio requestNoError = Dio(); //不处理错误的请求,用于设备操作上报 + + static Dio reservation = Dio(); + + static void init() { + // 添加全局配置,如基础URL、 + // 拦截器等 + + // dio.httpClientAdapter = IOHttpClientAdapter( + // createHttpClient: () { + // final client = HttpClient(); + // client.badCertificateCallback = + // (X509Certificate cert, String host, int port) { + // return true; // Verify the certificate. + // }; + // return client; + // }, + // ); + + // request.options.baseUrl = CommonVariables.apiUrl; + // request.options.connectTimeout = const Duration(seconds: 15); + // request.options.receiveTimeout = const Duration(seconds: 10); + // request.options.sendTimeout = const Duration(seconds: 10); + // dio.options.headers['Content-Type'] = "application/json"; + // dio.options.headers['Token'] = "1"; + // 添加其他配置... + + // 添加拦截器(可选) + // request.interceptors.add(InterceptorsWrapper( + // onRequest: (options, handler) { + // print("---> ${options.method}, ${options.path}, ${options.data}"); + // options.headers['token'] = Get.find().model.token; + // print("${options.headers['token']}"); + // return handler.next(options); + // }, + // onResponse: (response, ResponseInterceptorHandler handler) { + // // 在响应处理前的操作,例如解析响应数据 + // // if (response.realUri.toString().contains("/login")) { + // // String? token = response.headers.value('token'); + // // if (token != null) { + // // print("token = ${token}"); + // // Get.find().token.value = token; + // // } + // // } + // print("<--- ${response.statusCode}, ${response.data}"); + // if (response.data is Map) { + // if (response.data['code'] == HttpStatusCodes.ok) { + // return handler.next(response); + // } else { + // if (response.data['code'] == 10011) { + // Get.offAndToNamed( + // "/loginPage", + // ); + // GlobalController globalController = Get.find(); + // globalController.resetParmAll(); + // showCustomConfirmDialog(Get.context!, "当前用户已在别处登录,请确认账号密码安全!", + // btnName: "确定", icon: ConfirmDialogIcon.warn) + // .then((d) { + // if (d == "confirm") { + // Get.back(); + // } + // }); + // } else if (response.data['code'] == 11004) { + // showCustomConfirmAndCancelDialog(Get.context!, "当前用户已登录,是否重新登录", + // confirmName: "确定", cancelName: "取消") + // .then((d) async { + // if (d == "confirm") { + // LoginController loginController = Get.find(); + // loginController.model.forceLogin = 1; + // String msg = await loginController.login(Get.context!); + // if (msg == null || msg.isEmpty) { + // Get.offAndToNamed("/mianPageBottomChange"); + // } + // } else if (d == "cancel") { + // // Get.offAndToNamed( + // // "/loginPage", + // // ); + // Get.back(); + // } + // }); + // } else if (response.data['code'] == 10009 || + // response.data['code'] == 11007 || + // response.data['code'] == 11008) { + // // 有可能对象获取不到,所以try catch包住 + // try { + // GlobalController globalController = + // Get.find(); + // globalController.resetParmAll(); + // UserInfoController userInfoController = + // Get.find(); + // userInfoController.model.token = null; + // userInfoController.model.user = null; + // userInfoController.model.login = 0; + // userInfoController.model.message = 0; + // LoginController loginController = Get.find(); + // loginController.model.account = null; + // loginController.model.password = null; + // loginController.model.phone = null; + // loginController.model.code = null; + // } catch (e) { + // print(e); + // } + // final box = GetStorage(); + // box.remove('user'); + // box.remove('token'); + // showToast(response.data["msg"]); + // } else if (response.data['code'] == 11005) { + // if (response.data['code'] == 11005) { + // var authUserData = response.data['data']; + // AuthBindTelController authBindTelController = Get.find(); + // authBindTelController.model.authUserInfo = authUserData; + // Get.toNamed("/auth_bind_tel"); + // } + // } else { + // showToast(response.data["msg"]); + // } + + // return handler.reject( + // DioException( + // requestOptions: RequestOptions(data: response.data['msg']), + // message: response.data['msg']), + // ); + // } + // } + // return handler.next(response); + // }, + // onError: (e, handler) { + // // 错误处理,例如打印错误信息 + // showToast("网络异常或服务连接异常,请稍候再试", color: color_error); + // print("DioError: $e"); + // return handler.reject(e); + // }, + // )); + + // requestNoInfo.options.baseUrl = CommonVariables.apiUrl; + // requestNoInfo.options.connectTimeout = const Duration(seconds: 15); + // requestNoInfo.options.receiveTimeout = const Duration(seconds: 10); + // requestNoInfo.options.sendTimeout = const Duration(seconds: 10); + // requestNoInfo.interceptors.add(InterceptorsWrapper( + // onRequest: (options, handler) { + // print("---> ${options.method}, ${options.path}, ${options.data}"); + // options.headers['token'] = Get.find().model.token; + // print("${options.headers['token']}"); + // return handler.next(options); + // }, + // onResponse: (response, ResponseInterceptorHandler handler) { + // // 在响应处理前的操作,例如解析响应数据 + // // if (response.realUri.toString().contains("/login")) { + // // String? token = response.headers.value('token'); + // // if (token != null) { + // // print("token = ${token}"); + // // Get.find().token.value = token; + // // } + // // } + // print("<--- ${response.statusCode}, ${response.data}"); + // if (response.data is Map) { + // if (response.data['code'] == HttpStatusCodes.ok) { + // return handler.next(response); + // } else { + // // showToast(response.data["msg"]); + // return handler.reject( + // DioException( + // requestOptions: RequestOptions(data: response.data['msg']), + // message: response.data['msg'], + // ), + // ); + // } + // } + // return handler.next(response); + // }, + // onError: (e, handler) { + // // 错误处理,例如打印错误信息 + // showToast("网络异常或服务连接异常,请稍候再试", color: color_error); + // print("DioError: $e"); + // return handler.reject(e); + // }, + // )); + + // requestNoError.options.baseUrl = CommonVariables.apiUrl; + // requestNoError.options.connectTimeout = const Duration(seconds: 5); + // requestNoError.options.receiveTimeout = const Duration(seconds: 3); + // requestNoError.options.sendTimeout = const Duration(seconds: 3); + // requestNoError.interceptors.add(InterceptorsWrapper( + // onRequest: (options, handler) { + // print( + // "requestNoError---> ${options.method}, ${options.path}, ${options.data}"); + // options.headers['token'] = Get.find().model.token; + // print("${options.headers['token']}"); + // return handler.next(options); + // }, + // onResponse: (response, ResponseInterceptorHandler handler) { + // print("requestNoError<--- ${response.statusCode}, ${response.data}"); + // return handler.next(response); + // }, + // onError: (e, handler) { + // // 错误处理,例如打印错误信息 + // print("requestNoError-->DioError: $e"); + // return handler.reject(e); + // }, + // )); + + reservationInit(); + } + + static void reservationInit() { + reservation.options.baseUrl = "https://crm-api.swes.com.cn"; + reservation.options.connectTimeout = const Duration(seconds: 15); + reservation.options.receiveTimeout = const Duration(seconds: 10); + reservation.options.sendTimeout = const Duration(seconds: 10); + reservation.interceptors.add(InterceptorsWrapper( + onRequest: (options, handler) { + print("---> ${options.method}, ${options.path}, ${options.data}"); + options.headers['token'] = + "bMAQVR1x48t66u8EDYSftAJGo17r0rIB3z15JgyyoGz1rAEZHs1htHOCorYFJ2RT"; + return handler.next(options); + }, + onResponse: (response, ResponseInterceptorHandler handler) { + print("<--- ${response.statusCode} ${response.data}"); + return handler.next(response); + }, + onError: (e, handler) { + // 错误处理,例如打印错误信息 + showToast("网络异常或服务连接异常,请稍候再试", color: color_error); + print("DioError: $e"); + return handler.reject(e); + }, + )); + } +} diff --git a/lib/controller/mh_controller/apply_repair_controller.dart b/lib/controller/mh_controller/apply_repair_controller.dart index 47640a2..7343622 100644 --- a/lib/controller/mh_controller/apply_repair_controller.dart +++ b/lib/controller/mh_controller/apply_repair_controller.dart @@ -1,5 +1,13 @@ import 'package:ef/ef.dart'; +import 'package:flutter/material.dart'; import 'package:json_annotation/json_annotation.dart'; +import 'package:vbvs_app/common/color/ServiceConstant.dart'; +import 'package:vbvs_app/common/color/repair_status.dart'; +import 'package:vbvs_app/common/util/MyUtils.dart'; +import 'package:vbvs_app/common/util/myDialog/my_dialog_controller.dart'; +import 'package:vbvs_app/common/util/requestWithLog.dart'; +import 'package:vbvs_app/controller/user_info_controller.dart'; +import 'package:vbvs_app/model/user_data.dart'; part 'apply_repair_controller.g.dart'; @@ -91,69 +99,122 @@ class ApplyRepairController extends GetControllerEx { // } // } - // //提交 - // Future submitRepair(BuildContext context) async { - // //tmp - // // return ''; - // String message = ''; - // final MyDialogController myDialogController = - // Get.find(); - // if (model.device_type == null || model.device_type!.isEmpty) { - // message = '请选择设备类型!'; - // showToast(message); - // return message; - // } - // if (model.device_category == null || model.device_category!.isEmpty) { - // message = '请输入设备型号!'; - // showToast(message); - // return message; - // } - // if (model.device_id == null || model.device_id!.isEmpty) { - // message = '请输入设备序列号id!'; - // showToast(message); - // return message; - // } - // if (model.apply_name == null || model.apply_name!.isEmpty) { - // message = '请输入姓名!'; - // showToast(message); - // return message; - // } - // RegExp nameRegExp = RegExp(r'^[\u4e00-\u9fa5]{2,4}$'); + //提交 + Future submitRepair(BuildContext context) async { + //tmp + // return ''; + String message = ''; + final MyDialogController myDialogController = + Get.find(); + if (model.device_type == null || model.device_type!.isEmpty) { + message = '请选择设备类型!'; + showToast(message); + return message; + } + if (model.device_category == null || model.device_category!.isEmpty) { + message = '请输入设备型号!'; + showToast(message); + return message; + } + if (model.device_id == null || model.device_id!.isEmpty) { + message = '请输入设备序列号id!'; + showToast(message); + return message; + } + if (model.apply_name == null || model.apply_name!.isEmpty) { + message = '请输入姓名!'; + showToast(message); + return message; + } + RegExp nameRegExp = RegExp(r'^[\u4e00-\u9fa5]{2,4}$'); - // if (!nameRegExp.hasMatch(model.apply_name!)) { - // message = '姓名必须为2到4个汉字!'; - // showToast(message); - // return message; - // } - // if (model.tel == null || model.tel!.isEmpty) { - // message = '请输入手机号!'; - // showToast(message); - // return message; - // } - // if (!MyUtils.isValidPhoneNumber(model.tel!)) { - // message = '无效的手机号!'; - // showToast(message); - // return message; - // } - // if (model.address == null || model.address!.isEmpty) { - // message = '请输入地址!'; - // showToast(message); - // return message; - // } - // if (model.desc == null || model.desc!.isEmpty) { - // message = '请输入问题描述!'; - // showToast(message); - // return message; - // } - // if (model.issue_img == null || model.issue_img!.isEmpty) { - // message = '请至少上传一张问题图片!'; - // showToast(message); - // return message; - // } - // model.status = RepairStatus.pending; - // await repairRepository.saveRepair(model); - // return message; - // } + if (!nameRegExp.hasMatch(model.apply_name!)) { + message = '姓名必须为2到4个汉字!'; + showToast(message); + return message; + } + if (model.tel == null || model.tel!.isEmpty) { + message = '请输入手机号!'; + showToast(message); + return message; + } + if (!MyUtils.isValidPhoneNumber(model.tel!)) { + message = '无效的手机号!'; + showToast(message); + return message; + } + if (model.address == null || model.address!.isEmpty) { + message = '请输入地址!'; + showToast(message); + return message; + } + if (model.desc == null || model.desc!.isEmpty) { + message = '请输入问题描述!'; + showToast(message); + return message; + } + if (model.issue_img == null || model.issue_img!.isEmpty) { + message = '请至少上传一张问题图片!'; + showToast(message); + return message; + } + model.status = RepairStatus.pending; + // await repairRepository.saveRepair(model); + String type = "repair_submit_${model.device_id}"; + String serviceAddress = ServiceConstant.service_address; + String serviceName = ServiceConstant.server_service; + String serviceApi = ServiceConstant.submit_repair; + String queryUrl = "$serviceAddress$serviceName$serviceApi?type=$type"; + + // 组织请求数据 + final UserInfoController userInfoController = + Get.find(); + UserModel user = userInfoController.model.user!; + + Map data = { + 'apply_name': model.apply_name, + 'address': model.address, + 'desc': model.desc, + 'device_type': model.device_type, + 'issue_img': model.issue_img, + 'tel': model.tel, + 'uid': user.uid, + 'device_category': model.device_category, + 'device_id': model.device_id, + 'device_name': model.device_name, + 'status': model.status, + }; + + // 发起插入请求(这里相当于之前的 saveRepair) + requestWithLog( + logTitle: "提交报修", + method: MyHttpMethod.post, + queryUrl: queryUrl, + data: data, + onSuccess: (res) { + if (res.data is List && res.data.isNotEmpty) { + final inserted = res.data[0]; + model.id = inserted['id']; + model.create_time = DateTime.tryParse(inserted['create_time']); + // TextSelectionOverlay + // // saveRepairHistor + // saveRepairHistory( + // RepairProcessModel() + // ..status = model.status + // ..record_id = inserted['id'], + // ); + showToast("提交成功!"); + } else { + showToast("提交失败:未返回数据!"); + } + }, + onFailure: (res) { + showToast("提交失败!"); + }, + ); + + return message; + } // Future getDeviceList() async { // final UserInfoController userInfoController = diff --git a/lib/controller/mh_controller/book_info_controller.dart b/lib/controller/mh_controller/book_info_controller.dart index e873978..998360c 100644 --- a/lib/controller/mh_controller/book_info_controller.dart +++ b/lib/controller/mh_controller/book_info_controller.dart @@ -5,9 +5,11 @@ import 'package:ef/ef.dart'; import 'package:vbvs_app/common/color/ServiceConstant.dart'; import 'package:vbvs_app/common/color/app_uri_status.dart'; import 'package:vbvs_app/common/util/DailyLogUtils.dart'; +import 'package:vbvs_app/common/util/Dio.dart'; import 'package:vbvs_app/common/util/MyUtils.dart'; import 'package:vbvs_app/common/util/requestWithLog.dart'; import 'package:vbvs_app/component/tool/TopSlideNotification.dart'; +import 'package:vbvs_app/controller/user_info_controller.dart'; import 'package:vbvs_app/model/api_response.dart'; class BookInfoModel { @@ -38,53 +40,23 @@ class BookInfoController extends GetControllerEx { attr = GetModel(BookInfoModel()).obs; } - // get userInfoController => Get.find(); + get userInfoController => Get.find(); - Future getData(String storeId) async { - // 初始化模型 + getData(id) { model.datetimes = []; model.datetimes_index = null; model.dataT = {}; updateAll(); - - String url = - "https://crm-api.swes.com.cn/agent/userBook/config/detailConfigByStore?storeId=$storeId"; - - await requestWithLog( - logTitle: "获取预约门店时间", - method: MyHttpMethod.get, - queryUrl: url, - successMsg: "获取预约门店时间成功", - errorMsg: "获取预约门店时间失败", - onSuccess: (res) { - final data = res.data; - if (data != null) { - model.datetimes = data["dateList"] ?? []; - model.datetimes_index = 0; - model.dataT = data; - time_periodChange(); // 原来的 time_periodChange - updateAll(); - } - }, - onFailure: (res) {}, - ); + ApiService.reservation + .get("/agent/userBook/config/detailConfigByStore?storeId=$id") + .then((d) { + model.datetimes = d.data["dateList"]; + model.datetimes_index = 0; + model.dataT = d.data; + time_periodChange(); + }); } - // getData(id) { - // model.datetimes = []; - // model.datetimes_index = null; - // model.dataT = {}; - // updateAll(); - // ApiService.reservation - // .get("/agent/userBook/config/detailConfigByStore?storeId=$id") - // .then((d) { - // model.datetimes = d.data["dateList"]; - // model.datetimes_index = 0; - // model.dataT = d.data; - // time_periodChange(); - // }); - // } - time_periodChange() { if (model.datetimes_index == null) { return; @@ -95,27 +67,23 @@ class BookInfoController extends GetControllerEx { updateAll(); } - // submitData(id) { - // String tel = userInfoController.model?.user?.tel ?? ""; - // if(tel.isEmpty) { - // showToast("用户未存在手机号"); - // return; - // } - // return ApiService.reservation.post("/agent/userBook/submitBook", data: { - // "extUserId": tel, - // "storeId": id, - // "realName": model.userName, - // "userPhone": model.userPhone, - // "bookDateId": model.time_period[model.select_time_index!]["id"] - // }); - // } + submitData(id) { + String tel = userInfoController.model?.user?.tel ?? ""; + if (tel.isEmpty) { + showToast("用户未存在手机号"); + return; + } + return ApiService.reservation.post("/agent/userBook/submitBook", data: { + "extUserId": tel, + "storeId": id, + "realName": model.userName, + "userPhone": model.userPhone, + "bookDateId": model.time_period[model.select_time_index!]["id"] + }); + } - // messageAdd(Map data) { - // return ApiService.request.post("/api/message/info", data: { - // "type": 0, - // "status": 1, - // "read": 1, - // "data": jsonEncode(data) - // }); - // } + messageAdd(Map data) { + return ApiService.request.post("/api/message/info", + data: {"type": 0, "status": 1, "read": 1, "data": jsonEncode(data)}); + } } diff --git a/lib/controller/mh_controller/device_list_controller.dart b/lib/controller/mh_controller/device_list_controller.dart index a10ba00..ff5b058 100644 --- a/lib/controller/mh_controller/device_list_controller.dart +++ b/lib/controller/mh_controller/device_list_controller.dart @@ -36,33 +36,6 @@ class DeviceListController extends GetControllerEx { attr = GetModel(DeviceListModel()).obs; } - // @override - // void onInit() { - // super.onInit(); - // model.keyword = ""; - // getDeviceList(); // 正确的初始化数据调用 - // } - - // getDeviceList({int time = 1}) async { - // String search = (model.keyword != null && model.keyword!.isNotEmpty) - // ? "?key=${model.keyword}" - // : ""; - // var data = await ApiService.request.get("/api/device/info/list$search"); - // if (data.data["data"] != null) { - // try { - // List tmp = data.data["data"] as List; - // model.deviceList = tmp.map((obj) => DeviceModel.fromJson(obj)).toList(); - // model.deviceListWyf = tmp; - // } catch (e) { - // print(e); - // } - // } else { - // model.deviceList = []; - // model.deviceListWyf = []; - // } - // updateAll(); - // } - getDeviceList() async { try { String search = (model.keyword != null && model.keyword!.isNotEmpty) @@ -82,8 +55,8 @@ class DeviceListController extends GetControllerEx { MyUtils.formatResponse(res, "设备.设备列表请求成功".tr, "设备.设备列表请求失败".tr); if (res.code == HttpStatusCodes.ok) { // bindDeviceNum.value = res.total!; - model.deviceList =res.data; - + model.deviceList = res.data; + updateAll(); return res; } diff --git a/lib/controller/mh_controller/experience_store_list_page.dart b/lib/controller/mh_controller/experience_store_list_page.dart index c856721..7f8e55a 100644 --- a/lib/controller/mh_controller/experience_store_list_page.dart +++ b/lib/controller/mh_controller/experience_store_list_page.dart @@ -1,9 +1,11 @@ import 'dart:ui'; import 'package:ef/ef.dart'; - +import 'package:geolocator/geolocator.dart'; import 'package:json_annotation/json_annotation.dart'; +import 'package:vbvs_app/controller/weather/weather_controller.dart'; +import 'package:vbvs_app/common/util/Dio.dart'; part 'experience_store_list_page.g.dart'; @@ -27,99 +29,98 @@ class ExperienceStoreListController ExperienceStoreListController() { attr = GetModel(ExperienceStoreListModel()).obs; } + WeatherModelController weatherModelController = Get.find(); + Position? position; + double latitude = 31.8512; + double longitude = 117.26061; - // Position? position; - // double latitude = 31.8512; - // double longitude = 117.26061; + int total = 0; + int page = 0; + bool lock = false; - // int total = 0; - // int page = 0; - // bool lock = false; - - - // resetParm() { - // position = null; - // total = 0; - // page = 0; - // lock = false; - // model.experienceStoreModelList = []; - // updateAll(); - // } - - // getData({int count = 10}) async { - // if (page != 0 && page * count > total) { - // return; - // } - // if (lock) { - // return; - // } - // if (page == 0) { - // position = await locationCheck(); - // } - // lock = true; - // int page_ = page; - // ApiService.reservation - // .get( - // "/agent/userBook/config/getBookStoreList?storeName=${"${model.keyword}".isNotEmpty ? model.keyword : ''}&latitude=${position == null ? latitude : position?.latitude}&longitude=${position == null ? longitude : position?.longitude}&page=$page&size=$count&sort=distance") - // .then((d) { - // lock = false; - // if (page == 0) { - // model.experienceStoreModelList = d.data["records"]; - // } else { - // int index = 0; - // d.data["records"]?.forEach((item) { - // if (model.experienceStoreModelList - // .indexWhere((item2) => item2["id"] == item["id"]) == - // -1) { - // model.experienceStoreModelList.add(item); - // } else { - // model.experienceStoreModelList[index] = item; - // } - // index++; - // }); - // } - // page = page_ + 1; - // total = d.data["total"]; - // updateAll(); - // }).catchError((d) { - // lock = false; - // }); - // } - - determinePosition() async { - // bool serviceEnabled; - // LocationPermission permission; - - // // Test if location services are enabled. - // serviceEnabled = await Geolocator.isLocationServiceEnabled(); - // if (!serviceEnabled) { - // // Location services are not enabled don't continue - // // accessing the position and request users of the - // // App to enable the location services. - // return Future.error('Location services are disabled.'); - // } - - // permission = await Geolocator.checkPermission(); - // if (permission == LocationPermission.denied) { - // permission = await Geolocator.requestPermission(); - // if (permission == LocationPermission.denied) { - // // Permissions are denied, next time you could try - // // requesting permissions again (this is also where - // // Android's shouldShowRequestPermissionRationale - // // returned true. According to Android guidelines - // // your App should show an explanatory UI now. - // return Future.error('Location permissions are denied'); - // } - // } - - // if (permission == LocationPermission.deniedForever) { - // // Permissions are denied forever, handle appropriately. - // return Future.error( - // 'Location permissions are permanently denied, we cannot request permissions.'); - // } - - // // When we reach here, permissions are granted and we can - // // continue accessing the position of the device. - // position = await Geolocator.getCurrentPosition(); + resetParm() { + position = null; + total = 0; + page = 0; + lock = false; + model.experienceStoreModelList = []; + updateAll(); } + + getData({int count = 10}) async { + if (page != 0 && page * count > total) { + return; + } + if (lock) { + return; + } + if (page == 0) { + position = await weatherModelController.determinePosition(); + } + lock = true; + int page_ = page; + ApiService.reservation + .get( + "/agent/userBook/config/getBookStoreList?storeName=${"${model.keyword}".isNotEmpty ? model.keyword : ''}&latitude=${position == null ? latitude : position?.latitude}&longitude=${position == null ? longitude : position?.longitude}&page=$page&size=$count&sort=distance") + .then((d) { + lock = false; + if (page == 0) { + model.experienceStoreModelList = d.data["records"]; + } else { + int index = 0; + d.data["records"]?.forEach((item) { + if (model.experienceStoreModelList + .indexWhere((item2) => item2["id"] == item["id"]) == + -1) { + model.experienceStoreModelList.add(item); + } else { + model.experienceStoreModelList[index] = item; + } + index++; + }); + } + page = page_ + 1; + total = d.data["total"]; + updateAll(); + }).catchError((d) { + lock = false; + }); + } + + //determinePosition() async { + // bool serviceEnabled; + // LocationPermission permission; + + // // Test if location services are enabled. + // serviceEnabled = await Geolocator.isLocationServiceEnabled(); + // if (!serviceEnabled) { + // // Location services are not enabled don't continue + // // accessing the position and request users of the + // // App to enable the location services. + // return Future.error('Location services are disabled.'); + // } + + // permission = await Geolocator.checkPermission(); + // if (permission == LocationPermission.denied) { + // permission = await Geolocator.requestPermission(); + // if (permission == LocationPermission.denied) { + // // Permissions are denied, next time you could try + // // requesting permissions again (this is also where + // // Android's shouldShowRequestPermissionRationale + // // returned true. According to Android guidelines + // // your App should show an explanatory UI now. + // return Future.error('Location permissions are denied'); + // } + // } + + // if (permission == LocationPermission.deniedForever) { + // // Permissions are denied forever, handle appropriately. + // return Future.error( + // 'Location permissions are permanently denied, we cannot request permissions.'); + // } + + // // When we reach here, permissions are granted and we can + // // continue accessing the position of the device. + // position = await Geolocator.getCurrentPosition(); + //} } diff --git a/lib/controller/mh_controller/my_experience_list_controller.dart b/lib/controller/mh_controller/my_experience_list_controller.dart index b4b7c41..64c25f9 100644 --- a/lib/controller/mh_controller/my_experience_list_controller.dart +++ b/lib/controller/mh_controller/my_experience_list_controller.dart @@ -1,7 +1,9 @@ import 'dart:convert'; import 'package:ef/ef.dart'; - +import 'package:vbvs_app/common/util/Dio.dart'; +import 'package:vbvs_app/common/util/MyUtils.dart'; +import 'package:vbvs_app/controller/user_info_controller.dart'; class BookExperienceListModel { List bookInfoList = []; //预约列表 @@ -14,102 +16,102 @@ class BookExperienceListController attr = GetModel(BookExperienceListModel()).obs; } - // resetParm() { - // model.bookInfoList = []; - // model.experienceStoreModelList = []; - // total = 0; - // page = 0; - // lock = false; - // updateAll(); - // } + resetParm() { + model.bookInfoList = []; + model.experienceStoreModelList = []; + total = 0; + page = 0; + lock = false; + updateAll(); + } - // getAllBook() { - // ApiService.reservation - // .get( - // "/agent/userBook/config/getBookStoreList?storeName=&latitude=31.8512&longitude=117.26061&page=0&size=20000&sort=distance") - // .then((d) { - // model.experienceStoreModelList = d.data["records"]; - // updateAll(); - // }); - // } + getAllBook() { + ApiService.reservation + .get( + "/agent/userBook/config/getBookStoreList?storeName=&latitude=31.8512&longitude=117.26061&page=0&size=20000&sort=distance") + .then((d) { + model.experienceStoreModelList = d.data["records"]; + updateAll(); + }); + } - // int total = 0; - // int page = 0; - // bool lock = false; + int total = 0; + int page = 0; + bool lock = false; - // getData({int count = 10, Function? finished}) { - // if (page != 0 && page * count > total) { - // finished?.call(); - // return; - // } - // if (lock) { - // finished?.call(); - // return; - // } - // lock = true; - // int page_ = page; - // String tel = Get.find().model.user?.tel ?? ""; - // if (tel.isEmpty) { - // showToast("用户未存在手机号"); - // finished?.call(); - // return; - // } - // ApiService.reservation - // .get( - // "/agent/userBook/list?extUserId=$tel&page=$page_&size=$count&sort=create_time,desc") - // .then((d) { - // lock = false; - // finished?.call(); - // if (page == 0) { - // model.bookInfoList = d.data["records"]; - // } else { - // int index = 0; - // d.data["records"]?.forEach((item) { - // if (model.bookInfoList - // .indexWhere((item2) => item2["id"] == item["id"]) == - // -1) { - // model.bookInfoList.add(item); - // } else { - // model.bookInfoList[index] = item; - // } - // index++; - // }); - // } - // page = page_ + 1; - // total = d.data["total"]; - // updateAll(); - // }).catchError((d) { - // lock = false; - // finished?.call(); - // }); - // } + getData({int count = 10, Function? finished}) { + if (page != 0 && page * count > total) { + finished?.call(); + return; + } + if (lock) { + finished?.call(); + return; + } + lock = true; + int page_ = page; + String tel = Get.find().model.user?.phone ?? ""; + if (tel.isEmpty) { + showToast("用户未存在手机号"); + finished?.call(); + return; + } + ApiService.reservation + .get( + "/agent/userBook/list?extUserId=$tel&page=$page_&size=$count&sort=create_time,desc") + .then((d) { + lock = false; + finished?.call(); + if (page == 0) { + model.bookInfoList = d.data["records"]; + } else { + int index = 0; + d.data["records"]?.forEach((item) { + if (model.bookInfoList + .indexWhere((item2) => item2["id"] == item["id"]) == + -1) { + model.bookInfoList.add(item); + } else { + model.bookInfoList[index] = item; + } + index++; + }); + } + page = page_ + 1; + total = d.data["total"]; + updateAll(); + }).catchError((d) { + lock = false; + finished?.call(); + }); + } - // cancelBook(id, {Function? success}) { - // String tel = Get.find().model.user?.tel ?? ""; - // if (tel.isEmpty) { - // showToast("用户未存在手机号"); - // return; - // } - // LoadingDialog.show("提交中..."); - // ApiService.reservation - // .post("/agent/userBook/cancel?extUserId=$tel&id=$id") - // .then((d) { - // page = 0; - // getData(finished: () { - // LoadingDialog.hide(); - // }); - // success?.call(); - // }).catchError((d) { - // LoadingDialog.hide(); - // }); - // } + cancelBook(id, {Function? success}) { + String tel = Get.find().model.user?.phone ?? ""; + if (tel.isEmpty) { + showToast("用户未存在手机号"); + return; + } + LoadingDialog.show("提交中..."); + ApiService.reservation + .post("/agent/userBook/cancel?extUserId=$tel&id=$id") + .then((d) { + page = 0; + getData(finished: () { + LoadingDialog.hide(); + }); + success?.call(); + }).catchError((d) { + LoadingDialog.hide(); + }); + } - // messageAdd(Map data) { - // return ApiService.request.post("/api/message/info", data: { - // "type": 0, - // "status": 1, - // "read": 1, - // "data": jsonEncode(data) - // }); - // } + messageAdd(Map data) { + return ApiService.request.post("/api/message/info", data: { + "type": 0, + "status": 1, + "read": 1, + "data": jsonEncode(data) + }); + } } diff --git a/lib/controller/weather/weather_controller.dart b/lib/controller/weather/weather_controller.dart index 43c32f0..4ab04e5 100644 --- a/lib/controller/weather/weather_controller.dart +++ b/lib/controller/weather/weather_controller.dart @@ -69,7 +69,7 @@ class WeatherModelController extends GetControllerEx { // 获取当前位置并存储到 model Future _getCurrentLocation() async { try { - Position position = await _determinePosition(); + Position position = await determinePosition(); if (position == null) { throw Exception("获取位置失败"); } @@ -97,7 +97,7 @@ class WeatherModelController extends GetControllerEx { } // 获取当前位置 - Future _determinePosition() async { + Future determinePosition() async { bool serviceEnabled; LocationPermission permission; diff --git a/lib/main.dart b/lib/main.dart index f63526a..6ddeae7 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -16,6 +16,7 @@ import 'package:vbvs_app/common/color/AppGlobal.dart'; import 'package:vbvs_app/common/color/ServiceConstant.dart'; import 'package:vbvs_app/common/util/CheckNetwork.dart'; import 'package:vbvs_app/common/util/CommonVariables.dart'; +import 'package:vbvs_app/common/util/Dio.dart'; import 'package:vbvs_app/common/util/FitTool.dart'; import 'package:vbvs_app/common/util/requestWithLog.dart'; import 'package:vbvs_app/controller/date/CalendarController.dart'; @@ -85,7 +86,7 @@ Future main() async { await initLanguageSetting(); WidgetsFlutterBinding.ensureInitialized(); - // ApiService.init(); + ApiService.init(); await GetStorage.init(); // 初始化登录 await initLocalStorage(); diff --git a/lib/pages/common/selectDialog.dart b/lib/pages/common/selectDialog.dart index 805682a..5c50444 100644 --- a/lib/pages/common/selectDialog.dart +++ b/lib/pages/common/selectDialog.dart @@ -875,7 +875,7 @@ Future showOneSelectionDialog( .bodyMedium .override( fontFamily: 'Readex Pro', - color: themeController.currentColor.sc3, + color: Colors.white, fontSize: 30.rpx, )), ClickableContainer( diff --git a/lib/pages/mh_page/apply_repair_page.dart b/lib/pages/mh_page/apply_repair_page.dart index 9a2293e..83ce71b 100644 --- a/lib/pages/mh_page/apply_repair_page.dart +++ b/lib/pages/mh_page/apply_repair_page.dart @@ -45,6 +45,7 @@ class ApplyRepairPage extends GetView { ), ), child: Scaffold( + resizeToAvoidBottomInset: true, // 自动调整页面避免被键盘遮挡 backgroundColor: Colors.transparent, appBar: AppBar( backgroundColor: Colors.transparent, @@ -1779,8 +1780,8 @@ class ApplyRepairPage extends GetView { ), ), Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 15, 15, 15, AppConstants.page_button_bottom_padding), + padding: EdgeInsetsDirectional.fromSTEB(30.rpx, 30.rpx, + 30.rpx, AppConstants.page_button_bottom_padding), child: Container( width: bodysize!.maxWidth, height: bodysize!.maxHeight * 0.056, @@ -1836,61 +1837,7 @@ class ApplyRepairPage extends GetView { ), ), ), - ) - - // Container( - // width: bodysize!.maxWidth, - // height: bodysize!.maxHeight * 0.056, - // decoration: BoxDecoration( - // color: FlutterFlowTheme.of(context) - // .secondaryBackground, - // borderRadius: BorderRadius.circular(16.rpx), - // ), - // child: FFButtonWidget( - // onPressed: () { - // print('Button pressed ...'); - // controller.submitRepair(context).then((msg) { - // if (msg.isEmpty) { - // MessageListController messageListController = - // Get.find(); - // messageListController.addMessage(); - // Get.to(() => ApplyRepairSuccessPage(), - // arguments: {'model': controller.model}); - // controller.model = - // ApplyRepairModel(); // 在 submitRepair 完成后执行 - // controller.updateAll(); - // } - // }).catchError((error) { - // // 错误处理 - // print('Error: $error'); - // }); - // }, - // text: '提交申请', - // options: FFButtonOptions( - // height: 40, - // padding: const EdgeInsetsDirectional.fromSTEB( - // 24, 0, 24, 0), - // iconPadding: const EdgeInsetsDirectional.fromSTEB( - // 0, 0, 0, 0), - // color: const Color(0xFFD3B684), - // textStyle: FlutterFlowTheme.of(context) - // .titleSmall - // .override( - // fontFamily: 'Readex Pro', - // color: Colors.white, - // fontSize: AppFontsize.normal_text_size, - // letterSpacing: 0, - // ), - // elevation: 0, - // borderSide: const BorderSide( - // color: Colors.transparent, - // width: 1, - // ), - // borderRadius: BorderRadius.circular(8), - // ), - // ), - // ), - ), + )), ), ], ), diff --git a/lib/pages/mh_page/bluetooth.dart b/lib/pages/mh_page/bluetooth.dart index 1e12021..7f0ab28 100644 --- a/lib/pages/mh_page/bluetooth.dart +++ b/lib/pages/mh_page/bluetooth.dart @@ -144,7 +144,7 @@ class _BluetoothState extends State { _buildMenuButton( context, '睡眠习惯', "/sleepHabitPage"), _buildMenuButton( - context, '分享设备', "/devicePeopleInfo"), + context, '分享设备', "/deviceSharePage"), _buildMenuButton( context, '解绑', "/devicePeopleInfo"), ], diff --git a/lib/pages/mh_page/book_date_widget.dart b/lib/pages/mh_page/book_date_widget.dart index e2f9dfe..abc8781 100644 --- a/lib/pages/mh_page/book_date_widget.dart +++ b/lib/pages/mh_page/book_date_widget.dart @@ -1,19 +1,11 @@ import 'package:ef/ef.dart'; import 'package:flutter/material.dart'; +import 'package:vbvs_app/common/color/appConstants.dart'; +import 'package:vbvs_app/common/util/FitTool.dart'; import 'package:vbvs_app/common/util/MyUtils.dart'; import 'package:vbvs_app/controller/mh_controller/book_info_controller.dart'; class BookDateWidget extends GetView { - // final String week; - // final String date; - - // const BookDateWidget({ - // super.key, - // String? week, - // String? date, - // }) : this.week = week ?? '周一', - // this.date = date ?? '07/10'; - int index; BookInfoController bookInfoController; @@ -22,25 +14,25 @@ class BookDateWidget extends GetView { @override Widget build(BuildContext context) { return InkWell(onTap: () { - // if(index == controller.model.datetimes_index) { - // return; - // } - // controller.model.datetimes_index = index; - // controller.time_periodChange(); - // controller.updateAll(); + if (index == controller.model.datetimes_index) { + return; + } + controller.model.datetimes_index = index; + controller.time_periodChange(); + controller.updateAll(); }, child: Obx(() { return Container( - width: 71.5, - height: 71.5, + width: 144.rpx, + height: 143.rpx, constraints: BoxConstraints( - minHeight: 70, + minHeight: 140.rpx, ), decoration: BoxDecoration( // color: FlutterFlowTheme.of(context).secondaryBackground, color: controller.model.datetimes_index == index - ? stringToColor('#D3B684') - : FlutterFlowTheme.of(context).secondaryBackground, - borderRadius: BorderRadius.circular(8), + ? Color(0XFF84F5FF) + : Color(0xFF003058), + borderRadius: BorderRadius.circular(13.rpx), ), child: Column( mainAxisSize: MainAxisSize.max, @@ -50,32 +42,32 @@ class BookDateWidget extends GetView { child: Text( "${bookInfoController.model.datetimes![index]?['dayName']}", style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: 'Readex Pro', - letterSpacing: 0, - color: controller.model.datetimes_index == index - ? stringToColor('#FFFFFF') - : stringToColor('#333333'), - ), + fontFamily: 'Readex Pro', + letterSpacing: 0, + color: controller.model.datetimes_index == index + ? Color(0XFF011D33) + : Colors.white, + fontSize: 26.rpx), ), ), Flexible( child: Text( "${bookInfoController.model.datetimes![index]?['day']}", style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: 'Readex Pro', - letterSpacing: 0, - color: controller.model.datetimes_index == index - ? stringToColor('#FFFFFF') - : stringToColor('#333333'), - ), + fontFamily: 'Readex Pro', + letterSpacing: 0, + color: controller.model.datetimes_index == index + ? Color(0XFF011D33) + : Colors.white, + fontSize: 19.rpx), ), ), Flexible( child: Icon( Icons.keyboard_arrow_down_rounded, color: controller.model.datetimes_index == index - ? stringToColor('#FFFFFF') - : stringToColor('#333333'), + ? Color(0XFF011D33) + : Colors.white, size: 12, ), ), diff --git a/lib/pages/mh_page/book_info_page.dart b/lib/pages/mh_page/book_info_page.dart index e8052e2..f53ebfa 100644 --- a/lib/pages/mh_page/book_info_page.dart +++ b/lib/pages/mh_page/book_info_page.dart @@ -1,9 +1,11 @@ import 'package:ef/ef.dart'; import 'package:flutter/material.dart'; +import 'package:flutterflow_ui/flutterflow_ui.dart'; import 'package:vbvs_app/common/color/appConstants.dart'; import 'package:vbvs_app/common/color/appFontsize.dart'; import 'package:vbvs_app/common/util/FitTool.dart'; import 'package:vbvs_app/common/util/MyUtils.dart'; +import 'package:vbvs_app/component/base/THFlutterFlowDropDown.dart'; import 'package:vbvs_app/component/tool/CustomCard.dart'; import 'package:vbvs_app/controller/mh_controller/book_info_controller.dart'; import 'package:vbvs_app/pages/common/selectDialog.dart'; @@ -16,6 +18,12 @@ class BookInfoPage extends GetView { BookInfoPage({required this.data}) { controller.getData(data["id"]); } + getLine() { + return Divider( + color: Color(0XFF929699), + thickness: 0.5.rpx, + ); + } @override Widget build(BuildContext context) { @@ -29,6 +37,7 @@ class BookInfoPage extends GetView { ), ), child: Scaffold( + resizeToAvoidBottomInset: false, // 自 // key: scaffoldKey, backgroundColor: Colors.transparent, appBar: AppBar( @@ -73,8 +82,8 @@ class BookInfoPage extends GetView { // ), Expanded( child: Padding( - padding: - const EdgeInsetsDirectional.fromSTEB(28, 27, 28, 0), + padding: EdgeInsetsDirectional.fromSTEB( + 30.rpx, 40.rpx, 30.rpx, 0), child: Container( width: MediaQuery.sizeOf(context).width, height: MediaQuery.sizeOf(context).height * 1, @@ -82,81 +91,76 @@ class BookInfoPage extends GetView { child: Column( mainAxisSize: MainAxisSize.max, children: [ - Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 0, 0, 0, 10), + Container( + width: MediaQuery.sizeOf(context).width, + constraints: BoxConstraints( + minHeight: 100.rpx, + ), + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: Color(0xFF929699), + width: 0.5.rpx))), child: Container( - width: MediaQuery.sizeOf(context).width, - constraints: const BoxConstraints( - minHeight: 50, - ), - child: Container( - child: Column( - mainAxisSize: MainAxisSize.max, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text( - '${data["name"]}', - style: FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: 'Readex Pro', - fontSize: - AppFontsize.title_size, - letterSpacing: 0, - fontWeight: FontWeight.w600, - color: Colors.white), - ), - Text( - '地址:${data["addressDetail"]}', - style: FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: 'Readex Pro', - fontSize: AppFontsize - .normal_text_size, - letterSpacing: 0, - color: Colors.white), - ), - ], - ), + margin: EdgeInsets.only( + left: 30.rpx, right: 30.rpx), + child: Column( + mainAxisSize: MainAxisSize.max, + crossAxisAlignment: + CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + '${data["name"]}', + style: FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: 'Readex Pro', + fontSize: 30.rpx, + letterSpacing: 0, + lineHeight: 1, + color: Colors.white), + ), + Text( + '地址:${data["addressDetail"]}', + style: FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: 'Readex Pro', + fontSize: 26.rpx, + letterSpacing: 0, + lineHeight: 1, + color: Color(0xFF929699)), + ), + ].divide(SizedBox( + height: 18.rpx, + )), ), ), ), - Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 0, 0, 0, 20), - child: Container( - width: MediaQuery.sizeOf(context).width, - height: - MediaQuery.sizeOf(context).height * 0.01, - constraints: const BoxConstraints( - maxHeight: 1, - ), - decoration: const BoxDecoration( - color: Color(0xFF929699), - ), - ), - ), - Align( - alignment: const AlignmentDirectional(-1, 0), - child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 0, 0, 0, 16), - child: Text( - '体验日期', - style: FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: 'Readex Pro', - fontSize: AppFontsize.title_size, - letterSpacing: 0, - fontWeight: FontWeight.w600, - color: Color(0xFF929699)), - ), + Container( + margin: EdgeInsets.only(left: 30.rpx), + height: 136.rpx, + alignment: Alignment.centerLeft, + child: Text( + '体验日期', + style: FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: 'Readex Pro', + fontSize: 30.rpx, + letterSpacing: 0, + color: Colors.white), ), ), + // Align( + // alignment: const AlignmentDirectional(-1, 0), + // child: Padding( + // padding: const EdgeInsetsDirectional.fromSTEB( + // 0, 0, 0, 16), + + // ), + // ), Obx(() { return Row( mainAxisSize: MainAxisSize.max, @@ -165,478 +169,407 @@ class BookInfoPage extends GetView { children: getBuildItems(context), ); }), - - // Obx(() => ListView( - // shrinkWrap: true, - // scrollDirection: Axis.horizontal, - // children: getBuildItems(context))), - // Padding( - // padding: - // EdgeInsetsDirectional.fromSTEB(0, 59, 0, 0), - // child: Row( - // mainAxisSize: MainAxisSize.max, - // mainAxisAlignment: - // MainAxisAlignment.spaceBetween, - // children: [ - // Text( - // '体验时段', - // style: FlutterFlowTheme.of(context) - // .bodyMedium - // .override( - // fontFamily: 'Readex Pro', - // fontSize: AppFontsize.title_size, - // letterSpacing: 0, - // ), - // ), - // Row( - // mainAxisSize: MainAxisSize.max, - // children: [ - // Padding( - // padding: EdgeInsetsDirectional.fromSTEB( - // 0, 0, 17, 0), - // child: Text( - // '09:30', - // style: FlutterFlowTheme.of(context) - // .bodyMedium - // .override( - // fontFamily: 'Readex Pro', - // fontSize: - // AppFontsize.title_size, - // letterSpacing: 0, - // ), - // ), - // ), - // Icon( - // Icons.keyboard_arrow_down_sharp, - // color: FlutterFlowTheme.of(context) - // .secondaryText, - // size: 12, - // ), - // ], - // ), - // ], - // ), - // ), + SizedBox(height: 90.rpx), + getLine(), Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 0, 59, 0, 0), - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Text( - '体验时段', - style: FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: 'Readex Pro', - fontSize: AppFontsize.title_size, - letterSpacing: 0, - color: Color(0xFF929699), - // 设置加粗 - ), - ), - Flexible(child: Obx(() { - return InkWell( - onTap: () { - showOneSelectionDialog(context, - arr: controller.model.time_period - .map((d) => - "${d['timeStr']} (${d['unBookAmount']}/${d['amount']})") - .toList()!, - checkIndex: controller.model - .select_time_index ?? - 0, checkChange: (index) { - controller.model.select_time_index = - index; + padding: EdgeInsetsDirectional.fromSTEB( + 30.rpx, 0.rpx, 30.rpx, 0), + child: Container( + height: 90.rpx, + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Text( + '体验时段', + style: FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: 'Readex Pro', + fontSize: 30.rpx, + letterSpacing: 0, + color: Colors.white, + // 设置加粗 + ), + ), + Flexible(child: Obx(() { + return InkWell( + onTap: () { + showOneSelectionDialog(context, + arr: controller + .model.time_period + .map((d) => + "${d['timeStr']} (${d['unBookAmount']}/${d['amount']})") + .toList()!, + checkIndex: controller.model + .select_time_index ?? + 0, checkChange: (index) { + controller.model + .select_time_index = index; - controller.updateAll(); - }, title: '请选择时间'); - }, - child: Container( - width: 140, - height: 30, - child: Row( - mainAxisAlignment: - MainAxisAlignment.end, - crossAxisAlignment: - CrossAxisAlignment - .center, // 确保图标和文本垂直居中 - mainAxisSize: MainAxisSize.max, - children: [ - Padding( - padding: - const EdgeInsetsDirectional - .fromSTEB(0, 3, 17, 0), - child: Text( - controller.model - .select_time_index != - null - ? "${controller.model.time_period?[controller.model.select_time_index!]?["timeStr"]}" - : '请选择时间', - style: FlutterFlowTheme.of( - context) - .bodyMedium + controller.updateAll(); + }, title: '请选择时间'); + }, + child: Container( + width: 140, + height: 30, + child: Row( + mainAxisAlignment: + MainAxisAlignment.end, + crossAxisAlignment: + CrossAxisAlignment + .center, // 确保图标和文本垂直居中 + mainAxisSize: MainAxisSize.max, + children: [ + Padding( + padding: + const EdgeInsetsDirectional + .fromSTEB( + 0, 3, 17, 0), + child: Text( + controller.model + .select_time_index != + null + ? "${controller.model.time_period?[controller.model.select_time_index!]?["timeStr"]}" + : '请选择时间', + style: FlutterFlowTheme + .of(context) + .bodyMedium + .override( + fontFamily: + 'Readex Pro', + fontSize: AppFontsize + .normal_text_size, + letterSpacing: 0, + color: (controller + .model + .select_time_index == + null) + ? stringToColor( + '#D0D0D0') + : Colors + .white), + ), + ), + Icon( + Icons + .keyboard_arrow_down_sharp, + color: FlutterFlowTheme.of( + context) + .secondaryText, + size: 16, + ), + ], + ), + ), + ); + })), + ], + ), + )), + getLine(), + Padding( + padding: EdgeInsetsDirectional.fromSTEB( + 30.rpx, 0, 30.rpx, 0), + child: Container( + height: 90.rpx, + // constraints: BoxConstraints( + // minHeight: 76.rpx, + // ), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Text( + '体验人员', + style: FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: 'Readex Pro', + fontSize: 30.rpx, + letterSpacing: 0, + color: Colors.white, + // 设置加粗 + ), + ), + Flexible( + child: Align( + alignment: + const AlignmentDirectional(1, 0), + child: Container( + width: MediaQuery.sizeOf(context) + .width * + 0.3, + height: MediaQuery.sizeOf(context) + .height * + 1, + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(0), + ), + child: Align( + alignment: + const AlignmentDirectional( + 1, 0), + child: TextFormField( + // autofocus: true, + controller: + TextEditingController( + text: controller.model + .userName ?? + ""), + onChanged: (d) { + controller.model.userName = d; + }, + obscureText: false, + decoration: InputDecoration( + labelStyle: + FlutterFlowTheme.of( + context) + .labelMedium + .override( + fontFamily: + 'Readex Pro', + fontSize: AppFontsize + .normal_text_size, + letterSpacing: 0, + ), + hintText: '输入姓名', + hintStyle: FlutterFlowTheme + .of(context) + .labelMedium .override( fontFamily: 'Readex Pro', fontSize: AppFontsize .normal_text_size, letterSpacing: 0, - color: (controller - .model - .select_time_index == - null) - ? stringToColor( - '#D0D0D0') - : stringToColor( - '#333333')), + color: Color( + 0xFF929699)), + enabledBorder: + UnderlineInputBorder( + borderSide: + const BorderSide( + color: Color(0x00000000), + width: 2, + ), + borderRadius: + BorderRadius.circular( + 8), + ), + focusedBorder: + UnderlineInputBorder( + borderSide: + const BorderSide( + color: Color(0x00000000), + width: 2, + ), + borderRadius: + BorderRadius.circular( + 8), + ), + errorBorder: + UnderlineInputBorder( + borderSide: + const BorderSide( + color: Color(0x00000000), + width: 2, + ), + borderRadius: + BorderRadius.circular( + 8), + ), + focusedErrorBorder: + UnderlineInputBorder( + borderSide: + const BorderSide( + color: Color(0x00000000), + width: 2, + ), + borderRadius: + BorderRadius.circular( + 8), + ), + contentPadding: + const EdgeInsetsDirectional + .fromSTEB( + 0, 0, 0, 12), ), - ), - Icon( - Icons.keyboard_arrow_down_sharp, - color: + style: FlutterFlowTheme.of(context) - .secondaryText, - size: 16, + .bodyMedium + .override( + fontFamily: + 'Readex Pro', + fontSize: 26.rpx, + letterSpacing: 0, + color: + Colors.white), + textAlign: TextAlign.end, ), - ], + ), ), ), - ); - })), - ], + ), + ], + ), ), ), + getLine(), Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 0, 25, 0, 0), + padding: EdgeInsetsDirectional.fromSTEB( + 30.rpx, 0, 30.rpx, 0), child: Container( - width: MediaQuery.sizeOf(context).width, - height: - MediaQuery.sizeOf(context).height * 0.03, + height: 90.rpx, constraints: BoxConstraints( minHeight: 76.rpx, ), - decoration: const BoxDecoration(), - child: Container( - width: MediaQuery.sizeOf(context).width, - height: MediaQuery.sizeOf(context).height * - 0.02, - decoration: const BoxDecoration(), - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Text( - '体验人员', - style: FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: 'Readex Pro', - fontSize: - AppFontsize.title_size, - letterSpacing: 0, - color: Color(0xFF929699), - // 设置加粗 - ), - ), - Flexible( - child: Align( - alignment: - const AlignmentDirectional( - 1, 0), - child: Container( - width: MediaQuery.sizeOf(context) - .width * - 0.3, - height: MediaQuery.sizeOf(context) - .height * - 1, - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular(0), - ), - child: Align( - alignment: - const AlignmentDirectional( - 1, 0), - child: TextFormField( - // autofocus: true, - controller: - TextEditingController( - text: controller.model - .userName ?? - ""), - onChanged: (d) { - controller.model.userName = - d; - }, - obscureText: false, - decoration: InputDecoration( - labelStyle: - FlutterFlowTheme.of( - context) - .labelMedium - .override( - fontFamily: - 'Readex Pro', - fontSize: AppFontsize - .normal_text_size, - letterSpacing: 0, - ), - hintText: '输入姓名', - hintStyle: FlutterFlowTheme - .of(context) - .labelMedium - .override( + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Text( + '手机号', + style: FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: 'Readex Pro', + fontSize: 30.rpx, + letterSpacing: 0, + color: Colors.white, + // 设置加粗 + ), + ), + Flexible( + child: Align( + alignment: + const AlignmentDirectional(1, 0), + child: Container( + width: MediaQuery.sizeOf(context) + .width * + 0.3, + height: MediaQuery.sizeOf(context) + .height * + 1, + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(0), + ), + child: Align( + alignment: + const AlignmentDirectional( + 1, 0), + child: TextFormField( + // autofocus: true, + controller: + TextEditingController( + text: controller.model + .userPhone ?? + ""), + onChanged: (d) { + controller.model.userPhone = + d; + }, + obscureText: false, + keyboardType: + TextInputType.phone, + decoration: InputDecoration( + labelStyle: + FlutterFlowTheme.of( + context) + .labelMedium + .override( fontFamily: 'Readex Pro', fontSize: AppFontsize .normal_text_size, letterSpacing: 0, - color: Color( - 0xFF929699)), - enabledBorder: - UnderlineInputBorder( - borderSide: - const BorderSide( - color: - Color(0x00000000), - width: 2, - ), - borderRadius: - BorderRadius.circular( - 8), - ), - focusedBorder: - UnderlineInputBorder( - borderSide: - const BorderSide( - color: - Color(0x00000000), - width: 2, - ), - borderRadius: - BorderRadius.circular( - 8), - ), - errorBorder: - UnderlineInputBorder( - borderSide: - const BorderSide( - color: - Color(0x00000000), - width: 2, - ), - borderRadius: - BorderRadius.circular( - 8), - ), - focusedErrorBorder: - UnderlineInputBorder( - borderSide: - const BorderSide( - color: - Color(0x00000000), - width: 2, - ), - borderRadius: - BorderRadius.circular( - 8), - ), - contentPadding: - const EdgeInsetsDirectional - .fromSTEB( - 0, 0, 0, 12), - ), - style: FlutterFlowTheme.of( - context) - .bodyMedium + ), + hintText: '输入手机号', + hintStyle: FlutterFlowTheme + .of(context) + .labelMedium .override( fontFamily: 'Readex Pro', - fontSize: 26.rpx, + fontSize: AppFontsize + .normal_text_size, letterSpacing: 0, - color: Colors.white), - textAlign: TextAlign.end, + color: Color( + 0xFF929699)), + enabledBorder: + UnderlineInputBorder( + borderSide: + const BorderSide( + color: Color(0x00000000), + width: 2, + ), + borderRadius: + BorderRadius.circular( + 8), + ), + focusedBorder: + UnderlineInputBorder( + borderSide: + const BorderSide( + color: Color(0x00000000), + width: 2, + ), + borderRadius: + BorderRadius.circular( + 8), + ), + errorBorder: + UnderlineInputBorder( + borderSide: + const BorderSide( + color: Color(0x00000000), + width: 2, + ), + borderRadius: + BorderRadius.circular( + 8), + ), + focusedErrorBorder: + UnderlineInputBorder( + borderSide: + const BorderSide( + color: Color(0x00000000), + width: 2, + ), + borderRadius: + BorderRadius.circular( + 8), + ), + contentPadding: + const EdgeInsetsDirectional + .fromSTEB( + 0, 0, 0, 12), ), - ), - ), - ), - ), - ], - ), - ), - ), - ), - Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 0, 25, 0, 0), - child: Container( - width: MediaQuery.sizeOf(context).width, - height: - MediaQuery.sizeOf(context).height * 0.03, - constraints: BoxConstraints( - minHeight: 76.rpx, - ), - decoration: const BoxDecoration(), - child: Container( - width: MediaQuery.sizeOf(context).width, - height: MediaQuery.sizeOf(context).height * - 0.02, - decoration: const BoxDecoration(), - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Text( - '手机号', - style: FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: 'Readex Pro', - fontSize: - AppFontsize.title_size, - letterSpacing: 0, - color: Color(0xFF929699), - // 设置加粗 - ), - ), - Flexible( - child: Align( - alignment: - const AlignmentDirectional( - 1, 0), - child: Container( - width: MediaQuery.sizeOf(context) - .width * - 0.3, - height: MediaQuery.sizeOf(context) - .height * - 1, - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular(0), - ), - child: Align( - alignment: - const AlignmentDirectional( - 1, 0), - child: TextFormField( - // autofocus: true, - controller: - TextEditingController( - text: controller.model - .userPhone ?? - ""), - onChanged: (d) { - controller.model.userPhone = - d; - }, - obscureText: false, - keyboardType: - TextInputType.phone, - decoration: InputDecoration( - labelStyle: - FlutterFlowTheme.of( - context) - .labelMedium - .override( - fontFamily: - 'Readex Pro', - fontSize: AppFontsize - .normal_text_size, - letterSpacing: 0, - ), - hintText: '输入手机号', - hintStyle: FlutterFlowTheme - .of(context) - .labelMedium + style: + FlutterFlowTheme.of(context) + .bodyMedium .override( fontFamily: 'Readex Pro', - fontSize: AppFontsize - .normal_text_size, + fontSize: 26.rpx, letterSpacing: 0, - color: Color( - 0xFF929699)), - enabledBorder: - UnderlineInputBorder( - borderSide: - const BorderSide( - color: - Color(0x00000000), - width: 2, - ), - borderRadius: - BorderRadius.circular( - 8), - ), - focusedBorder: - UnderlineInputBorder( - borderSide: - const BorderSide( - color: - Color(0x00000000), - width: 2, - ), - borderRadius: - BorderRadius.circular( - 8), - ), - errorBorder: - UnderlineInputBorder( - borderSide: - const BorderSide( - color: - Color(0x00000000), - width: 2, - ), - borderRadius: - BorderRadius.circular( - 8), - ), - focusedErrorBorder: - UnderlineInputBorder( - borderSide: - const BorderSide( - color: - Color(0x00000000), - width: 2, - ), - borderRadius: - BorderRadius.circular( - 8), - ), - contentPadding: - const EdgeInsetsDirectional - .fromSTEB( - 0, 0, 0, 12), - ), - style: FlutterFlowTheme.of( - context) - .bodyMedium - .override( - fontFamily: - 'Readex Pro', - fontSize: 26.rpx, - letterSpacing: 0, - color: Colors.white), - textAlign: TextAlign.end, - ), + color: + Colors.white), + textAlign: TextAlign.end, ), ), ), ), - ], - ), + ), + ], ), ), ), + getLine(), ], ), )), @@ -650,39 +583,39 @@ class BookInfoPage extends GetView { borderRadius: 16.rpx, gradientDirection: GradientDirection.vertical, onTap: () { - // if (controller.model.select_time_index == null) { - // showToast("请选择体验时间"); - // return; - // } - // if (controller.model.userName == null || - // controller.model.userName == "") { - // showToast("请输入姓名"); - // return; - // } - // if (controller.model.userPhone == null || - // controller.model.userPhone == "") { - // showToast("请输入手机号"); - // return; - // } - // if (MyUtils.isValidPhoneNumber( - // controller.model.userPhone!) == - // false) { - // showToast("请输入正确的手机号"); - // return; - // } - // controller.submitData(data["id"]).then((d) { - // if (d.data["status"] == 2) { - // d.data["addressDetail"] = data['addressDetail']; - // d.data["name"] = data["name"]; - // controller.messageAdd(d.data); - // Get.offAndToNamed("/bookSuccessPage", - // arguments: {"data": d.data}); - // } else { - // showToast("预约失败"); - // } - // }).catchError((d) { - // showToast("预约失败"); - // }); + if (controller.model.select_time_index == null) { + showToast("请选择体验时间"); + return; + } + if (controller.model.userName == null || + controller.model.userName == "") { + showToast("请输入姓名"); + return; + } + if (controller.model.userPhone == null || + controller.model.userPhone == "") { + showToast("请输入手机号"); + return; + } + if (MyUtils.isValidPhoneNumber( + controller.model.userPhone!) == + false) { + showToast("请输入正确的手机号"); + return; + } + controller.submitData(data["id"]).then((d) { + if (d.data["status"] == 2) { + d.data["addressDetail"] = data['addressDetail']; + d.data["name"] = data["name"]; + controller.messageAdd(d.data); + Get.offAndToNamed("/bookSuccessPage", + arguments: {"data": d.data}); + } else { + showToast("预约失败"); + } + }).catchError((d) { + showToast("预约失败"); + }); Get.toNamed("/bookSuccessPage", arguments: { "data": { "id": "7fbfbd614ef5befa3d8a84730f666853", diff --git a/lib/pages/mh_page/device/device.dart b/lib/pages/mh_page/device/device.dart index 03c1355..3e102b1 100644 --- a/lib/pages/mh_page/device/device.dart +++ b/lib/pages/mh_page/device/device.dart @@ -106,7 +106,7 @@ class DeviceInfoWidget extends GetView { text: '设备ID:' + (deviceListController.model .deviceList[ - index]['id'] ?? + index]['_id'] ?? ''), style: FlutterFlowTheme.of( context) @@ -232,13 +232,9 @@ class DeviceInfoWidget extends GetView { padding: EdgeInsetsDirectional.fromSTEB(0, 36.rpx, 0, 0), child: Container( width: MediaQuery.sizeOf(context).width, - height: 130, - constraints: BoxConstraints( - minHeight: 1, - maxHeight: 1, - ), + height: 0.5.rpx, decoration: BoxDecoration( - color: Color(0xFFB6BBC9), + color: Color(0xFF929699), ), ), ), diff --git a/lib/pages/mh_page/experience_store_page.dart b/lib/pages/mh_page/experience_store_page.dart index 8292e3b..1a561c7 100644 --- a/lib/pages/mh_page/experience_store_page.dart +++ b/lib/pages/mh_page/experience_store_page.dart @@ -9,324 +9,330 @@ import 'package:vbvs_app/common/color/appConstants.dart'; import 'package:vbvs_app/common/color/appFontsize.dart'; import 'package:vbvs_app/common/util/FitTool.dart'; import 'package:vbvs_app/common/util/MyUtils.dart'; +import 'package:vbvs_app/component/NullDataComponentWidget.dart'; import 'package:vbvs_app/component/tool/ClickableContainer.dart'; import 'package:vbvs_app/controller/mh_controller/experience_store_list_page.dart'; +import 'package:vbvs_app/controller/weather/weather_controller.dart'; import 'package:vbvs_app/pages/mh_page/Empty.dart'; import 'package:vbvs_app/pages/mh_page/experience_store_widget.dart'; import 'package:vbvs_app/pages/mh_page/searchWidget.dart'; -class ExperienceStorePage extends GetView { +class ExperienceStorePage extends StatefulWidget { ExperienceStorePage({super.key}); + @override + State createState() => _ExperienceStorePageState(); +} -// class _ExperienceStorePageState extends State { -// get controller => Get.find(); -// final scaffoldKey = GlobalKey(); +class _ExperienceStorePageState extends State { + final scaffoldKey = GlobalKey(); BoxConstraints? bodysize; ScrollController scrollController = ScrollController(); ExperienceStoreListController controller = Get.find(); + WeatherModelController weatherModelController = Get.find(); int runTime = 0; - // @override - // void initState() { - // // TODO: implement initState - // super.initState(); - // Timer(Duration(milliseconds: 100), () async { - // controller.resetParm(); - // await controller.determinePosition(); - // controller.page = 0; - // controller.getData(); - // scrollController.addListener(() { - // int ctime = DateTime.now().millisecondsSinceEpoch; - // if (ctime - runTime > 100 && - // scrollController.position.pixels + 80 > - // scrollController.position.maxScrollExtent) { - // runTime = ctime; - // print( - // "bottom get more data ${scrollController.position.pixels} ${scrollController.position.maxScrollExtent}"); - // controller.getData(); - // } - // }); - // }); - // } + @override + void initState() { + // TODO: implement initState + super.initState(); + Timer(Duration(milliseconds: 100), () async { + controller.resetParm(); + await weatherModelController.determinePosition(); + controller.page = 0; + controller.getData(); + scrollController.addListener(() { + int ctime = DateTime.now().millisecondsSinceEpoch; + if (ctime - runTime > 100 && + scrollController.position.pixels + 80 > + scrollController.position.maxScrollExtent) { + runTime = ctime; + print( + "bottom get more data ${scrollController.position.pixels} ${scrollController.position.maxScrollExtent}"); + controller.getData(); + } + }); + }); + } @override Widget build(BuildContext context) { return LayoutBuilder(builder: (context, cc) { - controller.model.experienceStoreModelList = [ - { - "id": "5b82d1d9c33c74647e7624ec1db7918f", - "enabled": true, - "code": "3401002", - "name": "SWES眠花糖合肥省委大院体验店", - "customerId": null, - "setNetCustomerKid": null, - "customer": null, - "kingdeeId": "", - "channel": null, - "salePersonId": "ed648f977422a9f32a05b4892a3cb529", - "salePerson": null, - "deptId": 3, - "deptName": null, - "dept": null, - "introduction": "", - "mobile": "18156022846", - "hotline": "0551-64464894", - "city": "合肥市", - "district": "庐阳区", - "addressDetail": "合肥市庐阳区逍遥津街道南含山路与红星路交汇处", - "image": "", - "latitude": "31.858934", - "longitude": "117.282166", - "isDel": false, - "isAppShow": true, - "business": true, - "authEndTime": null, - "createTime": 1701133326000, - "createAdminId": "f6da6faa2d50e7eff7b54bcdd55b0283", - "updateTime": 1709193588000, - "updateAdminId": null, - "distance": 2.2 - }, - { - "id": "97603deebb83f610f73acf5d0def2bce", - "enabled": true, - "code": "3401003", - "name": "SWES眠花糖合肥安粮国贸体验店", - "customerId": null, - "setNetCustomerKid": null, - "customer": null, - "kingdeeId": "", - "channel": null, - "salePersonId": "69297c65588adde4ee5de3c43a2c4033", - "salePerson": null, - "deptId": 3, - "deptName": null, - "dept": null, - "introduction": "", - "mobile": "18655643429", - "hotline": "0551-65156985", - "city": "合肥市", - "district": "政务新区", - "addressDetail": "安徽省合肥市蜀山区合作化南路16号", - "image": "", - "latitude": "31.82018", - "longitude": "117.25367", - "isDel": false, - "isAppShow": true, - "business": true, - "authEndTime": null, - "createTime": 1701133473000, - "createAdminId": "f6da6faa2d50e7eff7b54bcdd55b0283", - "updateTime": 1709193752000, - "updateAdminId": null, - "distance": 3.5 - }, - { - "id": "b6b588d7ff6b248115ee3e5951cf39a1", - "enabled": true, - "code": "3301001", - "name": "SWES眠花糖杭州南星桥旗舰店", - "customerId": null, - "setNetCustomerKid": null, - "customer": null, - "kingdeeId": "", - "channel": null, - "salePersonId": "f3a5e7935f65e94bc5aa6b2d63211e61", - "salePerson": null, - "deptId": 33, - "deptName": null, - "dept": null, - "introduction": "", - "mobile": "15222919097", - "hotline": "0571-86718606", - "city": "杭州市", - "district": "上城区", - "addressDetail": "浙江省杭州市上城区飞云江路45号一层102室", - "image": "", - "latitude": "30.21667", - "longitude": "120.17757", - "isDel": false, - "isAppShow": true, - "business": true, - "authEndTime": null, - "createTime": 1701135379000, - "createAdminId": "f6da6faa2d50e7eff7b54bcdd55b0283", - "updateTime": 1709194185000, - "updateAdminId": null, - "distance": 332.1 - }, - { - "id": "38fdbb715dc7bfddae3e32685c288e49", - "enabled": true, - "code": "3102001", - "name": "SWES眠花糖上海复兴荟旗舰店", - "customerId": null, - "setNetCustomerKid": null, - "customer": null, - "kingdeeId": "", - "channel": null, - "salePersonId": "4ae944badb423197bc54c0a6ec252944", - "salePerson": null, - "deptId": 32, - "deptName": null, - "dept": null, - "introduction": "", - "mobile": "13053037959", - "hotline": "021-63391962", - "city": "上海市", - "district": "黄浦区", - "addressDetail": "上海市黄浦区复兴东路1108号1层-1室", - "image": "", - "latitude": "31.22209", - "longitude": "121.494667", - "isDel": false, - "isAppShow": true, - "business": true, - "authEndTime": null, - "createTime": 1701135192000, - "createAdminId": "f6da6faa2d50e7eff7b54bcdd55b0283", - "updateTime": 1709194151000, - "updateAdminId": null, - "distance": 407.3 - }, - { - "id": "af908e6c5d1a2c8113b1c73117e15064", - "enabled": true, - "code": "3101001", - "name": "SWES眠花糖上海外滩九里体验店", - "customerId": null, - "setNetCustomerKid": null, - "customer": null, - "kingdeeId": "", - "channel": null, - "salePersonId": "1794f729f27ad4a44afad10061446dd5", - "salePerson": null, - "deptId": 31, - "deptName": null, - "dept": null, - "introduction": "", - "mobile": "13856414205", - "hotline": "021-63391208", - "city": "上海市", - "district": "黄浦区", - "addressDetail": "上海市黄浦区紫霞路103-107号1层103-12室", - "image": "", - "latitude": "31.218434", - "longitude": "121.502098", - "isDel": false, - "isAppShow": true, - "business": true, - "authEndTime": null, - "createTime": 1701134886000, - "createAdminId": "f6da6faa2d50e7eff7b54bcdd55b0283", - "updateTime": 1709194053000, - "updateAdminId": null, - "distance": 408.1 - }, - { - "id": "a5f1fc9a03ba827841c473e28a3fcdb2", - "enabled": true, - "code": "3101002", - "name": "SWES眠花糖上海尚悦湾旗舰店", - "customerId": null, - "setNetCustomerKid": null, - "customer": null, - "kingdeeId": "", - "channel": null, - "salePersonId": "d97ec48ee3b1060eb7ff5c81f0ffa37f", - "salePerson": null, - "deptId": 31, - "deptName": null, - "dept": null, - "introduction": "", - "mobile": "19523660595", - "hotline": "021-63336707", - "city": "上海市", - "district": "浦东新区", - "addressDetail": "上海市浦东新区银城路66号", - "image": "", - "latitude": "31.24103", - "longitude": "121.51045", - "isDel": false, - "isAppShow": true, - "business": true, - "authEndTime": null, - "createTime": 1701135694000, - "createAdminId": "f6da6faa2d50e7eff7b54bcdd55b0283", - "updateTime": 1709194087000, - "updateAdminId": null, - "distance": 408.4 - }, - { - "id": "21ddfb547060e930f841605dc4469bec", - "enabled": true, - "code": "1101001", - "name": "SWES眠花糖北京富力城旗舰店", - "customerId": null, - "setNetCustomerKid": null, - "customer": null, - "kingdeeId": "", - "channel": null, - "salePersonId": "b66028a628ce0fcb871ab7db5c17128e", - "salePerson": null, - "deptId": 11, - "deptName": null, - "dept": null, - "introduction": "", - "mobile": "15556119960", - "hotline": "010-58766288", - "city": "北京市", - "district": "朝阳区", - "addressDetail": "北京市朝阳区天力街3号楼1至2层商业12号", - "image": "", - "latitude": "39.89862", - "longitude": "116.45851", - "isDel": false, - "isAppShow": false, - "business": true, - "authEndTime": null, - "createTime": 1701134049000, - "createAdminId": "f6da6faa2d50e7eff7b54bcdd55b0283", - "updateTime": 1733193484000, - "updateAdminId": null, - "distance": 897.7 - }, - { - "id": "432bfdf508115827c5dca474b72dea68", - "enabled": true, - "code": "1102001", - "name": "SWES眠花糖北京英皇中心旗舰店", - "customerId": null, - "setNetCustomerKid": null, - "customer": null, - "kingdeeId": "", - "channel": null, - "salePersonId": "155848302d5b6f2768111574f0161816", - "salePerson": null, - "deptId": 12, - "deptName": null, - "dept": null, - "introduction": "", - "mobile": "18225602774", - "hotline": "010-53269059", - "city": "北京市", - "district": "朝阳区", - "addressDetail": "北京市朝阳区建国门外大街丁12号", - "image": "", - "latitude": "39.907911", - "longitude": "116.444584", - "isDel": false, - "isAppShow": true, - "business": true, - "authEndTime": null, - "createTime": 1701134158000, - "createAdminId": "f6da6faa2d50e7eff7b54bcdd55b0283", - "updateTime": 1710490644000, - "updateAdminId": null, - "distance": 898.9 - } - ]; + // controller.model.experienceStoreModelList = [ + // { + // "id": "5b82d1d9c33c74647e7624ec1db7918f", + // "enabled": true, + // "code": "3401002", + // "name": "SWES眠花糖合肥省委大院体验店", + // "customerId": null, + // "setNetCustomerKid": null, + // "customer": null, + // "kingdeeId": "", + // "channel": null, + // "salePersonId": "ed648f977422a9f32a05b4892a3cb529", + // "salePerson": null, + // "deptId": 3, + // "deptName": null, + // "dept": null, + // "introduction": "", + // "mobile": "18156022846", + // "hotline": "0551-64464894", + // "city": "合肥市", + // "district": "庐阳区", + // "addressDetail": "合肥市庐阳区逍遥津街道南含山路与红星路交汇处", + // "image": "", + // "latitude": "31.858934", + // "longitude": "117.282166", + // "isDel": false, + // "isAppShow": true, + // "business": true, + // "authEndTime": null, + // "createTime": 1701133326000, + // "createAdminId": "f6da6faa2d50e7eff7b54bcdd55b0283", + // "updateTime": 1709193588000, + // "updateAdminId": null, + // "distance": 2.2 + // }, + // { + // "id": "97603deebb83f610f73acf5d0def2bce", + // "enabled": true, + // "code": "3401003", + // "name": "SWES眠花糖合肥安粮国贸体验店", + // "customerId": null, + // "setNetCustomerKid": null, + // "customer": null, + // "kingdeeId": "", + // "channel": null, + // "salePersonId": "69297c65588adde4ee5de3c43a2c4033", + // "salePerson": null, + // "deptId": 3, + // "deptName": null, + // "dept": null, + // "introduction": "", + // "mobile": "18655643429", + // "hotline": "0551-65156985", + // "city": "合肥市", + // "district": "政务新区", + // "addressDetail": "安徽省合肥市蜀山区合作化南路16号", + // "image": "", + // "latitude": "31.82018", + // "longitude": "117.25367", + // "isDel": false, + // "isAppShow": true, + // "business": true, + // "authEndTime": null, + // "createTime": 1701133473000, + // "createAdminId": "f6da6faa2d50e7eff7b54bcdd55b0283", + // "updateTime": 1709193752000, + // "updateAdminId": null, + // "distance": 3.5 + // }, + // { + // "id": "b6b588d7ff6b248115ee3e5951cf39a1", + // "enabled": true, + // "code": "3301001", + // "name": "SWES眠花糖杭州南星桥旗舰店", + // "customerId": null, + // "setNetCustomerKid": null, + // "customer": null, + // "kingdeeId": "", + // "channel": null, + // "salePersonId": "f3a5e7935f65e94bc5aa6b2d63211e61", + // "salePerson": null, + // "deptId": 33, + // "deptName": null, + // "dept": null, + // "introduction": "", + // "mobile": "15222919097", + // "hotline": "0571-86718606", + // "city": "杭州市", + // "district": "上城区", + // "addressDetail": "浙江省杭州市上城区飞云江路45号一层102室", + // "image": "", + // "latitude": "30.21667", + // "longitude": "120.17757", + // "isDel": false, + // "isAppShow": true, + // "business": true, + // "authEndTime": null, + // "createTime": 1701135379000, + // "createAdminId": "f6da6faa2d50e7eff7b54bcdd55b0283", + // "updateTime": 1709194185000, + // "updateAdminId": null, + // "distance": 332.1 + // }, + // { + // "id": "38fdbb715dc7bfddae3e32685c288e49", + // "enabled": true, + // "code": "3102001", + // "name": "SWES眠花糖上海复兴荟旗舰店", + // "customerId": null, + // "setNetCustomerKid": null, + // "customer": null, + // "kingdeeId": "", + // "channel": null, + // "salePersonId": "4ae944badb423197bc54c0a6ec252944", + // "salePerson": null, + // "deptId": 32, + // "deptName": null, + // "dept": null, + // "introduction": "", + // "mobile": "13053037959", + // "hotline": "021-63391962", + // "city": "上海市", + // "district": "黄浦区", + // "addressDetail": "上海市黄浦区复兴东路1108号1层-1室", + // "image": "", + // "latitude": "31.22209", + // "longitude": "121.494667", + // "isDel": false, + // "isAppShow": true, + // "business": true, + // "authEndTime": null, + // "createTime": 1701135192000, + // "createAdminId": "f6da6faa2d50e7eff7b54bcdd55b0283", + // "updateTime": 1709194151000, + // "updateAdminId": null, + // "distance": 407.3 + // }, + // { + // "id": "af908e6c5d1a2c8113b1c73117e15064", + // "enabled": true, + // "code": "3101001", + // "name": "SWES眠花糖上海外滩九里体验店", + // "customerId": null, + // "setNetCustomerKid": null, + // "customer": null, + // "kingdeeId": "", + // "channel": null, + // "salePersonId": "1794f729f27ad4a44afad10061446dd5", + // "salePerson": null, + // "deptId": 31, + // "deptName": null, + // "dept": null, + // "introduction": "", + // "mobile": "13856414205", + // "hotline": "021-63391208", + // "city": "上海市", + // "district": "黄浦区", + // "addressDetail": "上海市黄浦区紫霞路103-107号1层103-12室", + // "image": "", + // "latitude": "31.218434", + // "longitude": "121.502098", + // "isDel": false, + // "isAppShow": true, + // "business": true, + // "authEndTime": null, + // "createTime": 1701134886000, + // "createAdminId": "f6da6faa2d50e7eff7b54bcdd55b0283", + // "updateTime": 1709194053000, + // "updateAdminId": null, + // "distance": 408.1 + // }, + // { + // "id": "a5f1fc9a03ba827841c473e28a3fcdb2", + // "enabled": true, + // "code": "3101002", + // "name": "SWES眠花糖上海尚悦湾旗舰店", + // "customerId": null, + // "setNetCustomerKid": null, + // "customer": null, + // "kingdeeId": "", + // "channel": null, + // "salePersonId": "d97ec48ee3b1060eb7ff5c81f0ffa37f", + // "salePerson": null, + // "deptId": 31, + // "deptName": null, + // "dept": null, + // "introduction": "", + // "mobile": "19523660595", + // "hotline": "021-63336707", + // "city": "上海市", + // "district": "浦东新区", + // "addressDetail": "上海市浦东新区银城路66号", + // "image": "", + // "latitude": "31.24103", + // "longitude": "121.51045", + // "isDel": false, + // "isAppShow": true, + // "business": true, + // "authEndTime": null, + // "createTime": 1701135694000, + // "createAdminId": "f6da6faa2d50e7eff7b54bcdd55b0283", + // "updateTime": 1709194087000, + // "updateAdminId": null, + // "distance": 408.4 + // }, + // { + // "id": "21ddfb547060e930f841605dc4469bec", + // "enabled": true, + // "code": "1101001", + // "name": "SWES眠花糖北京富力城旗舰店", + // "customerId": null, + // "setNetCustomerKid": null, + // "customer": null, + // "kingdeeId": "", + // "channel": null, + // "salePersonId": "b66028a628ce0fcb871ab7db5c17128e", + // "salePerson": null, + // "deptId": 11, + // "deptName": null, + // "dept": null, + // "introduction": "", + // "mobile": "15556119960", + // "hotline": "010-58766288", + // "city": "北京市", + // "district": "朝阳区", + // "addressDetail": "北京市朝阳区天力街3号楼1至2层商业12号", + // "image": "", + // "latitude": "39.89862", + // "longitude": "116.45851", + // "isDel": false, + // "isAppShow": false, + // "business": true, + // "authEndTime": null, + // "createTime": 1701134049000, + // "createAdminId": "f6da6faa2d50e7eff7b54bcdd55b0283", + // "updateTime": 1733193484000, + // "updateAdminId": null, + // "distance": 897.7 + // }, + // { + // "id": "432bfdf508115827c5dca474b72dea68", + // "enabled": true, + // "code": "1102001", + // "name": "SWES眠花糖北京英皇中心旗舰店", + // "customerId": null, + // "setNetCustomerKid": null, + // "customer": null, + // "kingdeeId": "", + // "channel": null, + // "salePersonId": "155848302d5b6f2768111574f0161816", + // "salePerson": null, + // "deptId": 12, + // "deptName": null, + // "dept": null, + // "introduction": "", + // "mobile": "18225602774", + // "hotline": "010-53269059", + // "city": "北京市", + // "district": "朝阳区", + // "addressDetail": "北京市朝阳区建国门外大街丁12号", + // "image": "", + // "latitude": "39.907911", + // "longitude": "116.444584", + // "isDel": false, + // "isAppShow": true, + // "business": true, + // "authEndTime": null, + // "createTime": 1701134158000, + // "createAdminId": "f6da6faa2d50e7eff7b54bcdd55b0283", + // "updateTime": 1710490644000, + // "updateAdminId": null, + // "distance": 898.9 + // } + // ]; + bodysize = cc; return GestureDetector( @@ -411,6 +417,7 @@ class ExperienceStorePage extends GetView { }, ), ), + Obx(() { if (controller .model.experienceStoreModelList.length == @@ -420,6 +427,7 @@ class ExperienceStorePage extends GetView { return Container(); } }), + Expanded( child: Obx(() => ListView( controller: scrollController, diff --git a/lib/pages/mh_page/experience_store_widget.dart b/lib/pages/mh_page/experience_store_widget.dart index 44538ce..2c1756b 100644 --- a/lib/pages/mh_page/experience_store_widget.dart +++ b/lib/pages/mh_page/experience_store_widget.dart @@ -188,27 +188,23 @@ class ExperienceStoreWidget extends GetView { child: InkWell( onTap: () async { //"latitude" -> "31.858934" "longitude" -> "117.282166" - // AppMapLocation.checkInstalledApps() - // .then((d) { - // if (AppMapLocation - // .availableMapsToNames.isEmpty) { - // showToast("未检测到导航软件"); - // } else { - // showOneSelectionDialog(context, - // title: "选择地图", - // arr: AppMapLocation - // .availableMapsToNames, - // checkChange: (index) { - // AppMapLocation.launchMap( - // index, - // data["name"], - // double.parse( - // "${data["latitude"]}"), - // double.parse( - // "${data["longitude"]}")); - // }); - // } - // }); + AppMapLocation.checkInstalledApps().then((d) { + if (AppMapLocation + .availableMapsToNames.isEmpty) { + showToast("未检测到导航软件"); + } else { + showOneSelectionDialog(context, + title: "选择地图", + arr: AppMapLocation.availableMapsToNames, + checkChange: (index) { + AppMapLocation.launchMap( + index, + data["name"], + double.parse("${data["latitude"]}"), + double.parse("${data["longitude"]}")); + }); + } + }); }, child: Container( width: MediaQuery.sizeOf(context).width * 0.105, diff --git a/lib/pages/mh_page/new_mine_page.dart b/lib/pages/mh_page/new_mine_page.dart index ca0609d..7a9c5d9 100644 --- a/lib/pages/mh_page/new_mine_page.dart +++ b/lib/pages/mh_page/new_mine_page.dart @@ -281,7 +281,7 @@ class _MinePageState extends State { children: [ _buildListTile('assets/img/icon/order.svg', '我的订单', '快捷查看我在网上的订单记录', - showTopLine: true, path: "/issueListpage"), + showTopLine: true, path: ""), _buildListTile('assets/img/icon/store.svg', '门店体验', '如果想免费体验智能设备,可在此进行提前预约', path: "/experienceStorePage"), @@ -293,7 +293,7 @@ class _MinePageState extends State { ), _buildListTile('assets/img/icon/mall.svg', '网上商城', '最新的智能产品线上购买服务', - path: "/issueListpage"), + path: ""), _buildListTile('assets/img/icon/address.svg', '地址管理', '用于收货和报修时联系您', path: "/addressListPage"), @@ -304,7 +304,7 @@ class _MinePageState extends State { 'assets/img/icon/customer_service.svg', '在线客服', '购买和使用智能床过程中,如果遇到疑问可与客服进行联系', - path: "/issueListpage"), + path: ""), ], ), ), @@ -345,15 +345,19 @@ class _MinePageState extends State { highlightColor: Colors.white, padding: EdgeInsets.all(0.rpx), onTap: () { - Get.toNamed(path!); + if (path == null || path.isEmpty) { + TopSlideNotification.show(context, text: "待开发功能".tr); + } else { + Get.toNamed(path); + } }, child: Container( decoration: BoxDecoration( border: Border( top: showTopLine - ? BorderSide(color: Color(0xFF929699), width: 2.rpx) + ? BorderSide(color: Color(0xFF929699), width: 0.5.rpx) : BorderSide.none, - bottom: BorderSide(color: Color(0xFF929699), width: 2.rpx), + bottom: BorderSide(color: Color(0xFF929699), width: 0.5.rpx), ), ), height: 116.rpx, diff --git a/lib/pages/mh_page/people_info.dart b/lib/pages/mh_page/people_info.dart index eeb5ac4..2c6f544 100644 --- a/lib/pages/mh_page/people_info.dart +++ b/lib/pages/mh_page/people_info.dart @@ -35,7 +35,7 @@ class _PeopleInfoState extends State { // } getLine() { - return Container(height: 0.5.rpx, color: Color(0xFFD8D8D8)); + return Container(height: 0.5.rpx, color: Color(0xFF929699)); } @override diff --git a/lib/pages/mh_page/repair_history_widget.dart b/lib/pages/mh_page/repair_history_widget.dart index 57c2da2..798fede 100644 --- a/lib/pages/mh_page/repair_history_widget.dart +++ b/lib/pages/mh_page/repair_history_widget.dart @@ -158,10 +158,10 @@ class RepairHistoryWidget extends GetView { // color: const Color(0xFF06486F), border: Border( top: index == 0 - ? BorderSide(color: const Color(0xFF929699), width: 1.rpx) + ? BorderSide(color: const Color(0xFF929699), width: 0.5.rpx) : BorderSide.none, bottom: - BorderSide(color: const Color(0xFF929699), width: 1.rpx), + BorderSide(color: const Color(0xFF929699), width: 0.5.rpx), ), ), child: Padding( diff --git a/lib/pages/mh_page/smys.dart b/lib/pages/mh_page/smys.dart index e844a13..3316737 100644 --- a/lib/pages/mh_page/smys.dart +++ b/lib/pages/mh_page/smys.dart @@ -13,13 +13,6 @@ class Smys extends GetView { // get glController => Get.find(); - getLine() { - return Container( - height: 1, - color: stringToColor("#152676"), - ); - } - // updateParm( // {int time = 2, bool isShowToast = true, Function? errorccCallback = null}) { // ApiService.request @@ -87,7 +80,7 @@ class Smys extends GetView { ], ), ), - + actions: [], centerTitle: false, ), diff --git a/lib/routers/mh_routers.dart b/lib/routers/mh_routers.dart index 0001d25..22e7a4d 100644 --- a/lib/routers/mh_routers.dart +++ b/lib/routers/mh_routers.dart @@ -59,7 +59,7 @@ var mhroutes = { "/roomPickerPage": (context) => RoomPickerPage(), "/editBedPage": (context) => EditBedPage(), "/experienceStorePage": (context) => ExperienceStorePage(), - "/bookInfoPage": (context, {arguments}) => BookInfoPage(data: arguments), + "/bookInfoPage": (context, {arguments}) => BookInfoPage(data: arguments["data"]), "/bookSuccessPage": (contxt, {arguments}) => BookSuccessPage(data: arguments["data"]), "/myExperiencePage": (context) => MyExperiencePage(), diff --git a/pubspec.lock b/pubspec.lock index b70acc4..4d3e985 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -498,7 +498,7 @@ packages: easydevice: dependency: "direct main" description: - path: "C:\\Users\\wyf\\Desktop\\blue\\easydevice" + path: "C:\\Users\\a\\Desktop\\blue\\easydevice" relative: false source: path version: "0.0.1" @@ -652,6 +652,14 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "6.1.0" + flutter_city_picker: + dependency: "direct main" + description: + name: flutter_city_picker + sha256: "393f138d90012ed8bbab0d98e1cd97e3c7577f079b43a9d288cdec7f440b6a7e" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.1.1" flutter_credit_card: dependency: transitive description: @@ -769,6 +777,14 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "0.1.3" + flutter_slidable: + dependency: "direct main" + description: + name: flutter_slidable + sha256: a857de7ea701f276fd6a6c4c67ae885b60729a3449e42766bb0e655171042801 + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.1.2" flutter_staggered_grid_view: dependency: transitive description: @@ -785,6 +801,14 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "2.1.0" + flutter_switch: + dependency: "direct main" + description: + name: flutter_switch + sha256: b91477f926bba135d2d203d7b24367492662d8d9c3aa6adb960b14c1087d3c41 + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.3.2" flutter_test: dependency: "direct dev" description: flutter @@ -901,13 +925,13 @@ packages: source: hosted version: "13.0.3" geolocator_android: - dependency: transitive + dependency: "direct overridden" description: name: geolocator_android - sha256: fcb1760a50d7500deca37c9a666785c047139b5f9ee15aa5469fae7dbbe3170d + sha256: "06e37fa32392f69f133e166ef6b358a8b6afddbf4c418fc236988184cc115a49" url: "https://pub.flutter-io.cn" source: hosted - version: "4.6.2" + version: "4.4.1" geolocator_apple: dependency: transitive description: @@ -956,6 +980,14 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "2.1.1" + gif: + dependency: "direct main" + description: + name: gif + sha256: ade95694f1471da737922806818ffade2814d1d7f8d10af38ebcf36ace012bc0 + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.3.0" glob: dependency: transitive description: @@ -1276,6 +1308,14 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "0.1.2-main.4" + map_launcher: + dependency: "direct main" + description: + name: map_launcher + sha256: "7436d6ef9ae57ff15beafcedafe0a8f0604006cbecd2d26024c4cfb0158c2b9a" + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.5.0" mapbox_search: dependency: transitive description: @@ -2098,6 +2138,14 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "3.7.1" + timeline_tile: + dependency: "direct main" + description: + name: timeline_tile + sha256: "85ec2023c67137397c2812e3e848b2fb20b410b67cd9aff304bb5480c376fc0c" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.0" timing: dependency: transitive description: