detail_processing_fragment.dart 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. import 'package:cs_resources/generated/assets.dart';
  2. import 'package:cs_resources/generated/l10n.dart';
  3. import 'package:cs_resources/theme/app_colors_theme.dart';
  4. import 'package:flutter/cupertino.dart';
  5. import 'package:flutter/material.dart';
  6. import 'package:flutter/src/widgets/framework.dart';
  7. import 'package:hooks_riverpod/hooks_riverpod.dart';
  8. import 'package:router/componentRouter/component_service_manager.dart';
  9. import 'package:widgets/ext/ex_widget.dart';
  10. import 'package:widgets/my_button.dart';
  11. import 'package:widgets/my_load_image.dart';
  12. import 'package:widgets/my_text_view.dart';
  13. import '../apply/form_terms_page.dart';
  14. import '../form/form_types.dart';
  15. import 'form_detail_view_model.dart';
  16. class DetailProcessingFragment extends HookConsumerWidget {
  17. @override
  18. Widget build(BuildContext context, WidgetRef ref) {
  19. final state = ref.watch(formDetailViewModelProvider);
  20. final viewModel = ref.read(formDetailViewModelProvider.notifier);
  21. return SizedBox(
  22. width: double.infinity,
  23. height: double.infinity,
  24. child: Column(
  25. children: [
  26. SingleChildScrollView(
  27. scrollDirection: Axis.vertical,
  28. physics: const BouncingScrollPhysics(),
  29. child: Container(
  30. width: double.infinity,
  31. color: context.appColors.whiteBG,
  32. child: Column(
  33. mainAxisSize: MainAxisSize.min,
  34. crossAxisAlignment: CrossAxisAlignment.center,
  35. children: [
  36. //状态
  37. MyTextView(
  38. state.forDetail?.order?.refundStatus != 0
  39. ? S.current.refunded //已退款
  40. : state.forDetail?.order?.paymentStatus != 1
  41. ? S.current.unpaid //未支付
  42. : S.current.processing,
  43. marginTop: 17,
  44. textColor: state.forDetail?.order?.refundStatus != 0
  45. ? context.appColors.textDisEnableGray //已退款
  46. : state.forDetail?.order?.paymentStatus != 1
  47. ? context.appColors.deleteRed //未支付
  48. : context.appColors.textPrimary,
  49. fontSize: 24,
  50. isFontMedium: true,
  51. ),
  52. MyTextView(
  53. S.current.status,
  54. marginTop: 12,
  55. textColor: context.appColors.textBlack,
  56. fontSize: 17,
  57. isFontRegular: true,
  58. ),
  59. //退款的金额和待支付的金额展示
  60. Visibility(
  61. visible: state.forDetail?.order?.refundStatus != 0 || state.forDetail?.order?.paymentStatus != 1,
  62. child: MyTextView(
  63. "\$${state.forDetail?.order?.totalAmount ?? "-"}",
  64. marginTop: 15,
  65. textColor: context.appColors.textPrimary,
  66. fontSize: 24,
  67. isFontMedium: true,
  68. ),
  69. ),
  70. //Send On时间
  71. RichText(
  72. text: TextSpan(
  73. style: TextStyle(fontSize: 15, fontWeight: FontWeight.w400, color: context.appColors.textBlack),
  74. children: <TextSpan>[
  75. TextSpan(
  76. text: S.current.send_on_sometime(' '),
  77. ),
  78. TextSpan(
  79. text: state.forDetail?.sentOn ?? "-",
  80. style: TextStyle(fontSize: 15, fontWeight: FontWeight.w500, color: context.appColors.textBlack),
  81. ),
  82. ],
  83. ),
  84. ).marginOnly(top: 12, bottom: 28),
  85. //图片
  86. Visibility(
  87. visible: state.forDetail?.order?.refundStatus == 0 && state.forDetail?.order?.paymentStatus == 1,
  88. child: const MyAssetImage(
  89. Assets.formDetailProcessingImg,
  90. width: 40,
  91. height: 51.5,
  92. )),
  93. //提示文本
  94. Visibility(
  95. visible: state.forDetail?.order?.refundStatus == 0 && state.forDetail?.order?.paymentStatus == 1,
  96. child: MyTextView(
  97. S.current.processing_in_progress,
  98. marginTop: 15,
  99. marginBottom: 34,
  100. marginLeft: 50,
  101. marginRight: 50,
  102. textAlign: TextAlign.center,
  103. textColor: context.appColors.textBlack,
  104. fontSize: 15,
  105. isFontRegular: true,
  106. ),
  107. ),
  108. //分割线
  109. Container(
  110. color: context.appColors.backgroundDark,
  111. height: 10,
  112. ),
  113. Align(
  114. alignment: Alignment.centerLeft, // 左对齐
  115. child: MyTextView(
  116. FormTypes.iconMap[state.typeId]?['name'],
  117. marginTop: 22,
  118. marginBottom: 12,
  119. marginLeft: 18,
  120. textColor: context.appColors.textPrimary,
  121. fontSize: 17,
  122. isFontMedium: true,
  123. ),
  124. ),
  125. Align(
  126. alignment: Alignment.centerLeft, // 左对齐
  127. child: MyTextView(
  128. state.forDetail?.content?.typeOfApplication ?? "-",
  129. marginBottom: 22,
  130. marginLeft: 18,
  131. textColor: context.appColors.textBlack,
  132. fontSize: 15,
  133. isFontMedium: true,
  134. ),
  135. ),
  136. ],
  137. ),
  138. ),
  139. ).expanded(),
  140. Row(
  141. children: [
  142. MyButton(
  143. onPressed: () {
  144. ComponentServiceManager().mainService.startFeedbackCreatePage(context: context);
  145. },
  146. text: S.current.send_feedback,
  147. textColor: Colors.white,
  148. fontSize: 15,
  149. fontWeight: FontWeight.w400,
  150. radius: 7,
  151. backgroundColor: context.appColors.btnBgDefault,
  152. ).expanded(),
  153. const SizedBox(width: 10),
  154. MyButton(
  155. onPressed: () {
  156. FormTermsPage.startInstance(
  157. formType: state.typeId ?? "",
  158. estateFormId: state.estateFormId,
  159. formItem: null,
  160. enableEdit: false,
  161. formContent: state.forDetail?.content,
  162. );
  163. },
  164. text: S.current.view_application,
  165. textColor: Colors.white,
  166. fontSize: 15,
  167. fontWeight: FontWeight.w400,
  168. radius: 7,
  169. backgroundColor: context.appColors.greenBG,
  170. ).expanded(),
  171. ],
  172. ).marginOnly(left: 15, right: 15),
  173. Visibility(
  174. visible: state.forDetail?.order?.refundStatus != 0 || state.forDetail?.order?.paymentStatus != 1,
  175. child: MyButton(
  176. onPressed: () {
  177. viewModel.doPaymentOrder(state.forDetail?.order?.id??"");
  178. },
  179. text: S.current.payment,
  180. textColor: Colors.white,
  181. fontSize: 15,
  182. fontWeight: FontWeight.w400,
  183. radius: 7,
  184. backgroundColor: context.appColors.orangeBG,
  185. ).marginOnly(top: 6, left: 15, right: 15),
  186. ),
  187. const SizedBox(height: 17.5),
  188. ],
  189. ),
  190. );
  191. }
  192. }