设备 预约接口
This commit is contained in:
@@ -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<BookInfoModel> {
|
||||
attr = GetModel(BookInfoModel()).obs;
|
||||
}
|
||||
|
||||
// get userInfoController => Get.find<UserInfoController>();
|
||||
get userInfoController => Get.find<UserInfoController>();
|
||||
|
||||
Future<void> 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<BookInfoModel> {
|
||||
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)});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user