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