/*
 * @Author: XianKaiQun
 * @Date: 2020-08-18 18:21:07
 * @LastEditors: XianKaiQun
 * @LastEditTime: 2020-08-18 19:55:11
 * @Description: 
 */
import 'package:flutter/material.dart';
import 'package:receipt_package/src/impl/receipt_service_impl.dart';
import 'package:receipt_package/src/view_models/success.dart';

class PrivateSuccessStore with ChangeNotifier {
  final BuildContext context, providerContext;
  late Map<String, dynamic> routingArgs;
  PrivateSuccessStore(this.context, this.providerContext) {
    routingArgs = (ModalRoute.of(context)?.settings.arguments ??
            new Map<String, dynamic>()) as Map<String, dynamic>? ??
        {};
  }

  String? get payId => routingArgs['payId'];
  String? get prePayDetailId => routingArgs['prePayDetailId'];

  SuccessModel? data;
  Future getData() async {
    final res = await ReceiptServiceImpl().getSuccess({
      'payId': payId,
      'prePayDetailId': prePayDetailId,
    });
    data = res.data ?? SuccessModel();
    notifyListeners();
  }
}
