已绑定 数据回填
This commit is contained in:
@@ -5,6 +5,7 @@ import 'package:getx_scaffold/common/services/http.dart';
|
|||||||
import 'package:getx_scaffold/getx_scaffold.dart';
|
import 'package:getx_scaffold/getx_scaffold.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:ln_jq_app/common/model/base_model.dart';
|
import 'package:ln_jq_app/common/model/base_model.dart';
|
||||||
|
import 'package:ln_jq_app/common/model/vehicle_info.dart';
|
||||||
import 'package:ln_jq_app/pages/b_page/site/controller.dart';
|
import 'package:ln_jq_app/pages/b_page/site/controller.dart';
|
||||||
import 'package:ln_jq_app/storage_service.dart';
|
import 'package:ln_jq_app/storage_service.dart';
|
||||||
|
|
||||||
@@ -341,30 +342,44 @@ class ReservationController extends GetxController with BaseControllerMixin {
|
|||||||
|
|
||||||
String phone = "";
|
String phone = "";
|
||||||
String name = "";
|
String name = "";
|
||||||
String leftHydrogen = "";
|
String leftHydrogen = "0";
|
||||||
String workEfficiency = "";
|
String workEfficiency = "0";
|
||||||
|
|
||||||
//累计数据
|
//累计数据
|
||||||
String fillingWeight = "";
|
String fillingWeight = "0";
|
||||||
String fillingTimes = "";
|
String fillingTimes = "0";
|
||||||
String plateNumber = "沪AGZ8967";
|
String plateNumber = "";
|
||||||
|
String vin = "";
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
phone = StorageService.to.phone ?? "";
|
phone = StorageService.to.phone ?? "";
|
||||||
name = StorageService.to.name ?? "";
|
name = StorageService.to.name ?? "";
|
||||||
|
|
||||||
|
getUserBindCarInfo();
|
||||||
|
getSiteList();
|
||||||
|
super.onInit();
|
||||||
|
}
|
||||||
|
|
||||||
|
void getUserBindCarInfo() {
|
||||||
|
if (StorageService.to.hasVehicleInfo) {
|
||||||
|
VehicleInfo? bean = StorageService.to.vehicleInfo;
|
||||||
|
if (bean == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
plateNumber = bean.plateNumber;
|
||||||
|
vin = bean.vin;
|
||||||
plateNumberController = TextEditingController(text: plateNumber);
|
plateNumberController = TextEditingController(text: plateNumber);
|
||||||
getCatinfo();
|
getCatinfo();
|
||||||
getJqinfo();
|
getJqinfo();
|
||||||
getSiteList();
|
}
|
||||||
super.onInit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void getJqinfo() async {
|
void getJqinfo() async {
|
||||||
try {
|
try {
|
||||||
HttpService.to.setBaseUrl(AppTheme.test_service_url);
|
HttpService.to.setBaseUrl(AppTheme.test_service_url);
|
||||||
var responseData = await HttpService.to.get(
|
var responseData = await HttpService.to.get(
|
||||||
'appointment/truck/history-filling-summary?vin=LSFGL23Z2ND214377',
|
'appointment/truck/history-filling-summary?vin=$vin',
|
||||||
);
|
);
|
||||||
if (responseData == null || responseData.data == null) {
|
if (responseData == null || responseData.data == null) {
|
||||||
showToast('服务暂不可用,请稍后');
|
showToast('服务暂不可用,请稍后');
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ class ReservationPage extends GetView<ReservationController> {
|
|||||||
bool isButton = value == '扫码绑定';
|
bool isButton = value == '扫码绑定';
|
||||||
return Row(
|
return Row(
|
||||||
children: [
|
children: [
|
||||||
Text(label, style: const TextStyle(color: Colors.grey, fontSize: 11)),
|
Text(label, style: const TextStyle(fontSize: 13)),
|
||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
isButton
|
isButton
|
||||||
? GestureDetector(
|
? GestureDetector(
|
||||||
@@ -163,13 +163,7 @@ class ReservationPage extends GetView<ReservationController> {
|
|||||||
//判断是否绑定成功
|
//判断是否绑定成功
|
||||||
var scanResult = await Get.to(() => const QrCodePage());
|
var scanResult = await Get.to(() => const QrCodePage());
|
||||||
if (scanResult == true) {
|
if (scanResult == true) {
|
||||||
VehicleInfo? bean = StorageService.to.vehicleInfo;
|
controller.getUserBindCarInfo();
|
||||||
|
|
||||||
if (bean != null) {
|
|
||||||
showToast(
|
|
||||||
"已绑定${bean.plateNumber}-${StorageService.to.hasVehicleInfo}",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
@@ -183,10 +177,14 @@ class ReservationPage extends GetView<ReservationController> {
|
|||||||
child: Row(
|
child: Row(
|
||||||
mainAxisSize: MainAxisSize.min, // Keep the row compact
|
mainAxisSize: MainAxisSize.min, // Keep the row compact
|
||||||
children: [
|
children: [
|
||||||
const Icon(Icons.search, size: 13, color: Colors.blue),
|
Icon(
|
||||||
|
StorageService.to.hasVehicleInfo ? Icons.repeat : Icons.search,
|
||||||
|
size: 13,
|
||||||
|
color: Colors.blue,
|
||||||
|
),
|
||||||
const SizedBox(width: 3),
|
const SizedBox(width: 3),
|
||||||
Text(
|
Text(
|
||||||
value,
|
StorageService.to.hasVehicleInfo ? "换车牌" : value,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
color: Colors.blue,
|
color: Colors.blue,
|
||||||
fontSize: 11,
|
fontSize: 11,
|
||||||
@@ -199,7 +197,7 @@ class ReservationPage extends GetView<ReservationController> {
|
|||||||
)
|
)
|
||||||
: Text(
|
: Text(
|
||||||
value,
|
value,
|
||||||
style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w500),
|
style: const TextStyle(fontSize: 13, fontWeight: FontWeight.w500),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user