二维码扫描,从相册中扫
权限说明
This commit is contained in:
@@ -30,7 +30,7 @@ class ReservationController extends GetxController with BaseControllerMixin {
|
||||
final TextEditingController amountController = TextEditingController();
|
||||
|
||||
// 车牌号
|
||||
final TextEditingController plateNumberController = TextEditingController(text: "浙F");
|
||||
TextEditingController plateNumberController = TextEditingController();
|
||||
|
||||
// 加氢站
|
||||
final List<String> stationOptions = [
|
||||
@@ -343,6 +343,7 @@ class ReservationController extends GetxController with BaseControllerMixin {
|
||||
String name = "";
|
||||
String leftHydrogen = "";
|
||||
String workEfficiency = "";
|
||||
|
||||
//累计数据
|
||||
String fillingWeight = "";
|
||||
String fillingTimes = "";
|
||||
@@ -352,10 +353,10 @@ class ReservationController extends GetxController with BaseControllerMixin {
|
||||
void onInit() {
|
||||
phone = StorageService.to.phone ?? "";
|
||||
name = StorageService.to.name ?? "";
|
||||
|
||||
plateNumberController = TextEditingController(text: plateNumber);
|
||||
getCatinfo();
|
||||
getJqinfo();
|
||||
// getSiteList();
|
||||
getSiteList();
|
||||
super.onInit();
|
||||
}
|
||||
|
||||
@@ -363,7 +364,7 @@ class ReservationController extends GetxController with BaseControllerMixin {
|
||||
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=LSFGL23Z2ND214377',
|
||||
);
|
||||
if (responseData == null || responseData.data == null) {
|
||||
showToast('服务暂不可用,请稍后');
|
||||
@@ -372,7 +373,8 @@ class ReservationController extends GetxController with BaseControllerMixin {
|
||||
|
||||
var result = BaseModel.fromJson(responseData.data);
|
||||
|
||||
fillingWeight = "${result.data["fillingWeight"]}${result.data["fillingWeightUnit"]}";
|
||||
fillingWeight =
|
||||
"${result.data["fillingWeight"]}${result.data["fillingWeightUnit"]}";
|
||||
fillingTimes = "${result.data["fillingTimes"]}${result.data["fillingTimesUnit"]}";
|
||||
|
||||
updateUi();
|
||||
@@ -411,6 +413,7 @@ class ReservationController extends GetxController with BaseControllerMixin {
|
||||
}
|
||||
|
||||
void getSiteList() async {
|
||||
showLoading("加载中");
|
||||
final originalHeaders = Map<String, dynamic>.from(HttpService.to.dio.options.headers);
|
||||
try {
|
||||
HttpService.to.setBaseUrl(AppTheme.jiaqing_service_url);
|
||||
@@ -420,10 +423,12 @@ class ReservationController extends GetxController with BaseControllerMixin {
|
||||
|
||||
if (responseData == null && responseData!.data == null) {
|
||||
showToast('暂时无法获取站点信息');
|
||||
dismissLoading();
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
dismissLoading();
|
||||
var result = BaseModel.fromJson(responseData.data);
|
||||
// showToast(result.data["data"].toString());
|
||||
} catch (e) {
|
||||
@@ -431,6 +436,7 @@ class ReservationController extends GetxController with BaseControllerMixin {
|
||||
}
|
||||
} catch (e) {
|
||||
} finally {
|
||||
dismissLoading();
|
||||
HttpService.to.setBaseUrl(AppTheme.test_service_url);
|
||||
HttpService.to.dio.options.headers = originalHeaders;
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@ import 'package:dropdown_button2/dropdown_button2.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:getx_scaffold/getx_scaffold.dart';
|
||||
import 'package:ln_jq_app/pages/qr_code/view.dart';
|
||||
|
||||
import '../../../storage_service.dart';
|
||||
import 'controller.dart';
|
||||
|
||||
class ReservationPage extends GetView<ReservationController> {
|
||||
@@ -23,9 +23,9 @@ class ReservationPage extends GetView<ReservationController> {
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
_buildUserInfoCard(),
|
||||
const SizedBox(height: 16),
|
||||
const SizedBox(height: 5),
|
||||
_buildCarInfoCard(),
|
||||
const SizedBox(height: 16),
|
||||
const SizedBox(height: 5),
|
||||
_buildReservationFormCard(context),
|
||||
],
|
||||
),
|
||||
@@ -48,9 +48,9 @@ class ReservationPage extends GetView<ReservationController> {
|
||||
child: Row(
|
||||
children: [
|
||||
const CircleAvatar(
|
||||
radius: 24,
|
||||
radius: 20,
|
||||
backgroundColor: Colors.blue,
|
||||
child: Icon(Icons.person, color: Colors.white, size: 30),
|
||||
child: Icon(Icons.person, color: Colors.white, size: 34),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
@@ -59,12 +59,12 @@ class ReservationPage extends GetView<ReservationController> {
|
||||
children: [
|
||||
Text(
|
||||
controller.name,
|
||||
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
|
||||
style: TextStyle(fontSize: 14, fontWeight: FontWeight.bold),
|
||||
),
|
||||
SizedBox(height: 4),
|
||||
SizedBox(height: 6),
|
||||
Text(
|
||||
controller.phone,
|
||||
style: TextStyle(color: Colors.grey, fontSize: 12),
|
||||
style: TextStyle(color: Colors.grey, fontSize: 11),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -96,7 +96,7 @@ class ReservationPage extends GetView<ReservationController> {
|
||||
),
|
||||
const Divider(height: 1, indent: 16, endIndent: 16),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 16.0),
|
||||
padding: const EdgeInsets.symmetric(vertical: 11.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
@@ -114,9 +114,9 @@ class ReservationPage extends GetView<ReservationController> {
|
||||
Widget _buildStatItem(String value, String label) {
|
||||
return Column(
|
||||
children: [
|
||||
Text(value, style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
|
||||
Text(value, style: const TextStyle(fontSize: 15, fontWeight: FontWeight.bold)),
|
||||
const SizedBox(height: 4),
|
||||
Text(label, style: const TextStyle(color: Colors.grey, fontSize: 12)),
|
||||
Text(label, style: const TextStyle(color: Colors.grey, fontSize: 11 )),
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -127,7 +127,7 @@ class ReservationPage extends GetView<ReservationController> {
|
||||
elevation: 2,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
padding: const EdgeInsets.all(11),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
@@ -141,10 +141,10 @@ class ReservationPage extends GetView<ReservationController> {
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
const SizedBox(width: 8),
|
||||
Icon(
|
||||
Icons.propane_tank_outlined,
|
||||
size: 80,
|
||||
Icons.propane_rounded,
|
||||
size: 50,
|
||||
color: Colors.blue.withOpacity(0.5),
|
||||
),
|
||||
],
|
||||
@@ -158,18 +158,33 @@ class ReservationPage extends GetView<ReservationController> {
|
||||
bool isButton = value == '扫码绑定';
|
||||
return Row(
|
||||
children: [
|
||||
Text(label, style: const TextStyle(color: Colors.grey, fontSize: 14)),
|
||||
Text(label, style: const TextStyle(color: Colors.grey, fontSize: 11)),
|
||||
const SizedBox(width: 8),
|
||||
isButton
|
||||
? ElevatedButton.icon(
|
||||
onPressed: () {
|
||||
/* TODO: 扫码绑定逻辑 */
|
||||
? GestureDetector(
|
||||
onTap: () {
|
||||
Get.to(() => const QrCodePage());
|
||||
},
|
||||
icon: const Icon(Icons.qr_code_scanner, size: 16),
|
||||
label: Text(value),
|
||||
style: ElevatedButton.styleFrom(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
|
||||
child: Container(
|
||||
margin: EdgeInsetsGeometry.only(left: 10.w),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 5),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Colors.blue.shade300, width: 1),
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
color: Colors.blue.withOpacity(0.05),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min, // Keep the row compact
|
||||
children: [
|
||||
const Icon(Icons.search, size: 13, color: Colors.blue),
|
||||
const SizedBox(width: 3),
|
||||
Text(
|
||||
value,
|
||||
style: const TextStyle(
|
||||
color: Colors.blue, fontSize: 11, fontWeight: FontWeight.w500),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
: Text(
|
||||
@@ -396,9 +411,13 @@ class ReservationPage extends GetView<ReservationController> {
|
||||
),
|
||||
dropdownStyleData: DropdownStyleData(
|
||||
maxHeight: 200,
|
||||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(8)),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
menuItemStyleData: const MenuItemStyleData(
|
||||
height: 40,
|
||||
),
|
||||
menuItemStyleData: const MenuItemStyleData(height: 40),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user