You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
1.4 KiB
65 lines
1.4 KiB
import 'package:get/get.dart';
|
|
import '../../../routes/app_routes.dart';
|
|
|
|
class MeetItem {
|
|
final String id;
|
|
final String title;
|
|
final String description;
|
|
final double price;
|
|
final String productId;
|
|
|
|
MeetItem({
|
|
required this.id,
|
|
required this.title,
|
|
required this.description,
|
|
required this.price,
|
|
required this.productId,
|
|
});
|
|
}
|
|
|
|
class GoodsmeetController extends GetxController {
|
|
final RxList<MeetItem> items = <MeetItem>[].obs;
|
|
final RxBool loading = false.obs;
|
|
final RxString error = ''.obs;
|
|
|
|
@override
|
|
void onInit() {
|
|
super.onInit();
|
|
_loadProducts();
|
|
}
|
|
|
|
Future<void> _loadProducts() async {
|
|
loading.value = true;
|
|
error.value = '';
|
|
try {
|
|
items.assignAll([
|
|
MeetItem(
|
|
id: 'meet_basic',
|
|
title: '会议助手基础版',
|
|
description: '会议纪要与基础翻译',
|
|
price: 29.9,
|
|
productId: 'meet_101',
|
|
),
|
|
MeetItem(
|
|
id: 'meet_pro',
|
|
title: '会议助手高级版',
|
|
description: '纪要、翻译与AI总结增强',
|
|
price: 59.9,
|
|
productId: 'meet_201',
|
|
),
|
|
]);
|
|
} catch (e) {
|
|
error.value = e.toString();
|
|
} finally {
|
|
loading.value = false;
|
|
}
|
|
}
|
|
|
|
void purchase(MeetItem item) {
|
|
Get.toNamed(Routes.payment, arguments: {
|
|
'productId': item.productId,
|
|
'amount': item.price,
|
|
'description': item.title,
|
|
});
|
|
}
|
|
}
|