detail_processing_fragment.dart 8.1 KB

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