Compare commits
2 Commits
127102726b
...
e90837a9b7
Author | SHA1 | Date | |
---|---|---|---|
e90837a9b7 | |||
be7a137b07 |
@ -5,7 +5,7 @@ class CommonApi {
|
|||||||
|
|
||||||
///---------post
|
///---------post
|
||||||
static const String login = '/auth/login'; // 登录 {'phonenumber': '', 'smsCode': '', 'clientId': '428a8310cd442757ae699df5d894f051', 'grantType': 'sms'};
|
static const String login = '/auth/login'; // 登录 {'phonenumber': '', 'smsCode': '', 'clientId': '428a8310cd442757ae699df5d894f051', 'grantType': 'sms'};
|
||||||
static const String checkVersion = '/system/version/list'; // 查询app版本 {'platformType': Platform.isAndroid ? 'android' : 'ios','status': 1}
|
static const String checkVersion = '/app/version/page'; // 查询app版本 {'platformType': Platform.isAndroid ? 'android' : 'ios','status': 1}
|
||||||
static const String uploadFile = '/resource/oss/upload';
|
static const String uploadFile = '/resource/oss/upload';
|
||||||
|
|
||||||
///[source]=wechat_open [clientId]=428a8310cd442757ae699df5d894f051 [grantType]=social [socialState]=1
|
///[source]=wechat_open [clientId]=428a8310cd442757ae699df5d894f051 [grantType]=social [socialState]=1
|
||||||
|
@ -24,4 +24,7 @@ class ShopApi {
|
|||||||
// 查询订单状态
|
// 查询订单状态
|
||||||
static const String goodsOrderStatus= '/trans/easypay/paymentQuery';
|
static const String goodsOrderStatus= '/trans/easypay/paymentQuery';
|
||||||
|
|
||||||
|
// 取消订单
|
||||||
|
static const String cancelGoodsOrder= '/app/order/cancel';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
library;
|
library;
|
||||||
|
import 'dart:async';
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:loopin/service/http.dart';
|
import 'package:loopin/service/http.dart';
|
||||||
import 'package:loopin/api/shop_api.dart';
|
import 'package:loopin/api/shop_api.dart';
|
||||||
@ -49,15 +53,16 @@ class _OrderDetailState extends State<OrderDetail> with SingleTickerProviderStat
|
|||||||
final res = await Http.get('${ShopApi.goodsOrderStatus}/$orderId');
|
final res = await Http.get('${ShopApi.goodsOrderStatus}/$orderId');
|
||||||
// transState
|
// transState
|
||||||
var orderStatus = res['data']['transState'];
|
var orderStatus = res['data']['transState'];
|
||||||
|
|
||||||
print('状态-------------->${orderStatus}');
|
print('状态-------------->${orderStatus}');
|
||||||
|
// orderStatus
|
||||||
|
setState(() {
|
||||||
|
orderGoodsInfo['orderStatus'] = orderStatus;
|
||||||
|
});
|
||||||
if (orderStatus == 2) { // 已支付
|
if (orderStatus == 2) { // 已支付
|
||||||
MyDialog.toast('支付成功');
|
MyDialog.toast('支付成功');
|
||||||
} else {
|
|
||||||
MyDialog.toast('支付尚未完成,请稍后查看');
|
|
||||||
}
|
}
|
||||||
|
} catch (e) {
|
||||||
|
|
||||||
} catch (e) {
|
|
||||||
print('报错-------------->${e}');
|
print('报错-------------->${e}');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -65,16 +70,29 @@ class _OrderDetailState extends State<OrderDetail> with SingleTickerProviderStat
|
|||||||
// 获取订单详情信息,包含商品参数
|
// 获取订单详情信息,包含商品参数
|
||||||
void getOrderDetail({required String orderId}) async {
|
void getOrderDetail({required String orderId}) async {
|
||||||
try {
|
try {
|
||||||
final res = await Http.get('${ShopApi.goodsOrderDetail}/$orderId');
|
final res = await Http.get('${ShopApi.goodsOrderDetail}/$orderId');
|
||||||
print('订单详情-------------->${res['data']}');
|
print('订单详情-------------->${res['data']}');
|
||||||
setState(() {
|
setState(() {
|
||||||
orderGoodsInfo = res['data']; // 注意取 data 部分
|
orderGoodsInfo = res['data']; // 注意取 data 部分
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Get.back();
|
Get.back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 取消订单
|
||||||
|
void _cancelOrder() async {
|
||||||
|
print('取消订单: $_orderId');
|
||||||
|
try {
|
||||||
|
final res = await Http.post('${ShopApi.cancelGoodsOrder}/$_orderId');
|
||||||
|
print('取消订单成功-------------->${res}');
|
||||||
|
getOrderDetail(orderId: _orderId); // 刷新订单详情数据
|
||||||
|
} catch (e) {
|
||||||
|
print('取消订单失败-------------->${e}');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 显示支付结果弹框
|
// 显示支付结果弹框
|
||||||
void _showPaymentResultDialog() {
|
void _showPaymentResultDialog() {
|
||||||
|
|
||||||
@ -139,6 +157,7 @@ class _OrderDetailState extends State<OrderDetail> with SingleTickerProviderStat
|
|||||||
child: OutlinedButton(
|
child: OutlinedButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
|
// getOrderDetail(orderId: _orderId);
|
||||||
getOrderRealStatus(orderId: _orderId); // 主动再次拉取订单状态
|
getOrderRealStatus(orderId: _orderId); // 主动再次拉取订单状态
|
||||||
},
|
},
|
||||||
style: OutlinedButton.styleFrom(
|
style: OutlinedButton.styleFrom(
|
||||||
@ -336,13 +355,6 @@ class _OrderDetailState extends State<OrderDetail> with SingleTickerProviderStat
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 取消订单
|
|
||||||
void _cancelOrder() {
|
|
||||||
print('取消订单: $_orderId');
|
|
||||||
// 实现取消订单的逻辑
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Widget emptyTip() {
|
Widget emptyTip() {
|
||||||
return Column(
|
return Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
@ -403,7 +415,7 @@ class _OrderDetailState extends State<OrderDetail> with SingleTickerProviderStat
|
|||||||
Icons.info,
|
Icons.info,
|
||||||
size: 16.0,
|
size: 16.0,
|
||||||
)),
|
)),
|
||||||
TextSpan(text: '待支付, '),
|
TextSpan(text: getOrderStatusText(orderStatus)),
|
||||||
TextSpan(text: _countdownFinished ? '倒计时已结束' : ' 剩余 '),
|
TextSpan(text: _countdownFinished ? '倒计时已结束' : ' 剩余 '),
|
||||||
if (!_countdownFinished)
|
if (!_countdownFinished)
|
||||||
WidgetSpan(
|
WidgetSpan(
|
||||||
@ -423,6 +435,7 @@ class _OrderDetailState extends State<OrderDetail> with SingleTickerProviderStat
|
|||||||
interval: const Duration(seconds: 1),
|
interval: const Duration(seconds: 1),
|
||||||
onFinished: () {
|
onFinished: () {
|
||||||
print("倒计时结束");
|
print("倒计时结束");
|
||||||
|
_cancelOrder();
|
||||||
setState(() {
|
setState(() {
|
||||||
_countdownFinished = true; // 倒计时结束时更新标志位
|
_countdownFinished = true; // 倒计时结束时更新标志位
|
||||||
});
|
});
|
||||||
@ -533,8 +546,9 @@ class _OrderDetailState extends State<OrderDetail> with SingleTickerProviderStat
|
|||||||
color: Colors.grey,
|
color: Colors.grey,
|
||||||
size: 14.0,
|
size: 14.0,
|
||||||
),
|
),
|
||||||
onTap: () {
|
onTap: ()async {
|
||||||
MyDialog.toast('复制订单信息', icon: Icon(Icons.check_circle));
|
await Clipboard.setData(ClipboardData(text: _orderId));
|
||||||
|
MyDialog.toast('订单已复制到剪切板', icon: Icon(Icons.check_circle));
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
@ -676,7 +676,11 @@ class _AttentionModuleState extends State<AttentionModule> {
|
|||||||
});
|
});
|
||||||
final data = res['data'];
|
final data = res['data'];
|
||||||
logger.d('关注用户的视频列表:$data');
|
logger.d('关注用户的视频列表:$data');
|
||||||
if (data == null || (data is List && data.isEmpty)) {
|
// 处理空数据情况
|
||||||
|
if (data == null || data['records'] == null || (data['records'] is List && data['records'].isEmpty)) {
|
||||||
|
setState(() {
|
||||||
|
videoList = []; // 清空视频列表
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1015,6 +1019,20 @@ class _AttentionModuleState extends State<AttentionModule> {
|
|||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
|
// 添加暂无数据提示
|
||||||
|
if (videoList.isEmpty && !isLoadingMore)
|
||||||
|
Expanded(
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
'暂无数据',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 16.0,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
else
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user