part of user_order_awaiting;

/// 等待付款订单
class UserOrderAwaitingController extends GetxController {
// 已完成订单
  OrderCompletedInfoModel orderCompletedInfo = OrderCompletedInfoModel();
  OrderListModel orderListModel = OrderListModel();
  // 应付款、订单编号等
  List<OrderCompletedModel> orderAwaitings = [];


  @override
  void onReady() {
    getOrderInfo();
    super.onReady();
  }

  /// 修改用用户信息
  void cancelPay() async {
    final result = await MineAPI.cancelPay(ordersnum: orderListModel.ordersnum??'');
    if (result) {
      Toast.show('取消成功');
      update();
    }
  }




  /// 获取订单信息
  void getOrderInfo() async {
    // orderCompletedInfo = await MineAPI.userInfo();
    orderCompletedInfo = OrderCompletedInfoModel(id:1,price:'88.00',totalPay: '58.00',favorable: '5.00',orderId: 'ZJ2023122163728437',payWay: '微信支付',payTime: '2023-12-21 01:25:24',orderTime: '2023-12-21 01:25:15');
    orderAwaitings = [
      OrderCompletedModel(name: '订单编号',value: orderCompletedInfo.orderId.toString()),
      OrderCompletedModel(name: '支付方式',value: orderCompletedInfo.payWay.toString()),
      OrderCompletedModel(name: '支付时间',value: orderCompletedInfo.payTime.toString()),
    ];

    update();
  }

}
