/*
 * @Author: ChenYaJin
 * @Date: 2021-11-05 10:49:07
 * @LastEditors  : WuWei
 * @LastEditTime : 2022-04-14 15:24:40
 * @Description: 付费二维码提示
 */

part of '../detail_index.dart';

class _QrcodeComponent extends StatelessWidget {
  const _QrcodeComponent({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    FeeIndexStore store;
    store = Provider.of<FeeIndexStore>(context);
    final serviceFeeDetail = store.serviceFeeDetail!;
    return Wisdom.column(
      crossAxisAlignment: CrossAxisAlignment.stretch,
      children: [
        WisCard(
          color: Colors.white,
          margin: EdgeInsets.symmetric(vertical: 10.pt),
          padding: EdgeInsets.symmetric(vertical: 25.pt),
          elevation: 0,
          shape: BeveledRectangleBorder(),
          child: Wisdom.column(
            mainAxisAlignment: MainAxisAlignment.center,
            crossAxisAlignment: CrossAxisAlignment.center,
            children: <Widget>[
              Wisdom(
                child: Text(
                  '房号 ${serviceFeeDetail.houseNo ?? ''}',
                  style: TextStyle(
                    color: Color.fromRGBO(255, 117, 49, 1),
                    fontSize: 14.pt,
                  ),
                ),
              ),
              Wisdom(
                margin: EdgeInsets.symmetric(vertical: 10.pt),
                child: Text(
                  '¥ ${serviceFeeDetail.arrearsFee is num ? serviceFeeDetail.arrearsFee!.toStringAsFixed(2) : serviceFeeDetail.arrearsFee ?? '0.00'}',
                  style: TextStyle(
                    color: Color.fromRGBO(246, 89, 93, 1),
                    fontSize: 17.pt,
                    fontWeight: FontWeight.bold,
                  ),
                ),
              ),
              WImage.network(
                '${APPConfig.baseURL}/app/admin/assetBill/v2/seePayQrCode?communityId=${serviceFeeDetail.communityId}&houseId=${serviceFeeDetail.houseId}&serviceFeeId=${serviceFeeDetail.id}&entCode=${store.entCode}&type=serviceFee',
                width: 150.pt,
                height: 150.pt,
              ),
              Wisdom(
                child: WisText.c222('请微信扫描二维码缴费', size: 14.pt),
              ),
            ],
          ),
        ),
        _BottomTipComponent()
      ],
    ).nestSliverToBoxAdapter();
  }
}

class _BottomTipComponent extends StatelessWidget {
  const _BottomTipComponent({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return Container(
      margin: EdgeInsets.fromLTRB(15.pt, 0, 15.pt, 15.pt),
      padding: EdgeInsets.only(bottom: 44.pt),
      child: Text(
        '未结清费用可以删除服务费用项，但只能删除本人添加的服务费用项。',
        style: TextStyle(
          color: Color(0xFFF94F48),
          fontSize: 13.pt,
          // height: 2,
        ),
      ),
    );
  }
}
