This commit is contained in:
2026-07-12 04:33:48 +08:00
parent f8a90ad305
commit e7ce0f7bae
151 changed files with 2765 additions and 2947 deletions

View File

@@ -9,9 +9,9 @@ import '../../utils/http_util.dart';
import '../../utils/utils.dart';
class MobileBuyService extends StatefulWidget {
final Map<String, dynamic> data;
final Map<String, dynamic>? data;
const MobileBuyService(this.data, {Key key})
const MobileBuyService(this.data, {Key? key})
: super(key: key);
@override
@@ -20,7 +20,7 @@ class MobileBuyService extends StatefulWidget {
class MobileBuyServiceState extends State<MobileBuyService> {
List<KeyValue> plans = [];
KeyValue selectedPlan;
KeyValue? selectedPlan;
double price = 0.0;
double tax = 0.0;
double paymentAmount = 0.0;
@@ -45,37 +45,37 @@ class MobileBuyServiceState extends State<MobileBuyService> {
);
col1.children.add(
Utils.buildLine(S.of(context).service_descritpion, widget.data['service_selections']['description'], valueSize: 16),
Utils.buildLine(S.of(context).service_descritpion, widget.data!['service_selections']['description'], valueSize: 16),
);
col1.children.add(
Utils.buildLine(S.of(context).your_group, widget.data['group']['name'], valueSize: 16),
Utils.buildLine(S.of(context).your_group, widget.data!['group']['name'], valueSize: 16),
);
if (widget.data['store']['id'] != null) {
if (widget.data!['store']['id'] != null) {
col1.children.add(
Utils.buildLine(S.of(context).store, widget.data['store']['name'], valueSize: 16),
Utils.buildLine(S.of(context).store, widget.data!['store']['name'], valueSize: 16),
);
}
if (widget.data['domain'] != null) {
if (widget.data!['domain'] != null) {
col1.children.add(
Utils.buildLine(S.of(context).domain_name, widget.data['domain'], valueSize: 16),
Utils.buildLine(S.of(context).domain_name, widget.data!['domain'], valueSize: 16),
);
}
if (widget.data['exists_service'] == null) {
if (widget.data!['exists_service'] == null) {
col1.children.add(
Utils.buildLine(S.of(context).current_plan, 'N/A', valueSize: 16),
);
} else {
col1.children.add(
Utils.buildLine(S.of(context).current_plan, widget.data['exists_service']['description'], valueSize: 16),
Utils.buildLine(S.of(context).current_plan, widget.data!['exists_service']['description'], valueSize: 16),
);
col1.children.add(
Utils.buildLine(S.of(context).expiration_date,
Utils.utcDatetimeStringToLocalDatetimeString(context,
widget.data['exists_service']['expiration_date']),
widget.data!['exists_service']['expiration_date']),
valueSize: 16
),
);
@@ -97,8 +97,8 @@ class MobileBuyServiceState extends State<MobileBuyService> {
print('newValue $newValue');
setState(() {
selectedPlan = newValue;
price = selectedPlan.value['price'];
tax = selectedPlan.value['price'] * selectedPlan.value['tax'];
price = selectedPlan!.value['price'];
tax = selectedPlan!.value['price'] * selectedPlan!.value['tax'];
paymentAmount = price + tax;
});
},
@@ -155,11 +155,11 @@ class MobileBuyServiceState extends State<MobileBuyService> {
void _submit() {
if (store.state.user == null) {
Utils.requireLogin(context, returnUrl: '/buy-service/${widget.data['group']['id']}/${widget.data['service_selections']['code']}');
Utils.requireLogin(context, returnUrl: '/buy-service/${widget.data!['group']['id']}/${widget.data!['service_selections']['code']}');
return;
}
Map<String, dynamic> newData = widget.data;
newData['selected_plan'] = selectedPlan.value;
Map<String, dynamic>? newData = widget.data;
newData?['selected_plan'] = selectedPlan!.value;
HttpUtil.httpPost('v1/create-service-buy-renewal-invoice',
(response) {
Routes.router.navigateTo(context, '/paynow/${response.data['order_id']}', replace: true);
@@ -173,7 +173,7 @@ class MobileBuyServiceState extends State<MobileBuyService> {
@override
void initState() {
super.initState();
List o = (widget.data['service_selections']['options'] as List);
List o = (widget.data!['service_selections']['options'] as List);
for (int i = 0; i < o.length; i++) {
Map<String, dynamic> o1 = o[i];
plans.add(new KeyValue(o1['name'], o1));