|
@@ -34,20 +34,22 @@ import '../../../components/status_card_item.dart';
|
|
|
|
|
|
@RoutePage()
|
|
|
class CleanOrderDetailPage extends HookConsumerWidget {
|
|
|
- final int id;
|
|
|
- final int serviceTypeCode;
|
|
|
+ final int id; // 订单id
|
|
|
+ final int serviceTypeCode; // 订单类型
|
|
|
+ final int serviesStatusCode; // 订单状态
|
|
|
const CleanOrderDetailPage({
|
|
|
Key? key,
|
|
|
- required this.id,
|
|
|
- required this.serviceTypeCode,
|
|
|
+ @PathParam('id') required this.id,
|
|
|
+ @PathParam('serviceTypeCode') required this.serviceTypeCode,
|
|
|
+ @PathParam('serviesStatusCode') required this.serviesStatusCode,
|
|
|
}) : super(key: key);
|
|
|
|
|
|
//启动当前页面
|
|
|
- static void startInstance({BuildContext? context, required int id, required int serviceTypeCode}) {
|
|
|
+ static void startInstance({BuildContext? context, required int id, required int serviceTypeCode, required int serviesStatusCode}) {
|
|
|
if (context != null) {
|
|
|
- context.router.push(CleanOrderDetailPageRoute(id: id, serviceTypeCode: serviceTypeCode));
|
|
|
+ context.router.push(CleanOrderDetailPageRoute(id: id, serviceTypeCode: serviceTypeCode, serviesStatusCode: serviesStatusCode));
|
|
|
} else {
|
|
|
- appRouter.push(CleanOrderDetailPageRoute(id:id, serviceTypeCode: serviceTypeCode));
|
|
|
+ appRouter.push(CleanOrderDetailPageRoute(id:id, serviceTypeCode: serviceTypeCode, serviesStatusCode: serviesStatusCode));
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -58,10 +60,11 @@ class CleanOrderDetailPage extends HookConsumerWidget {
|
|
|
final state = ref.watch(cleanOrderDetailVmProvider);
|
|
|
// final appConfigState = ref.watch(appConfigServiceProvider)
|
|
|
|
|
|
- final totalPrice = ref.watch(cleanOrderDetailVmProvider.select((state) => state.totalPrice));
|
|
|
+ List<Map<String, dynamic>> actionBtnList = servicesConstants.servicesStatusActionBtnList[serviesStatusCode]!;
|
|
|
+ Log.d("actionBtnList $actionBtnList");
|
|
|
|
|
|
useEffect(() {
|
|
|
- vm.setInitPageData(id: id, serviceTypeCode: serviceTypeCode);
|
|
|
+ vm.setInitPageData(id: id, serviceTypeCode: serviceTypeCode, serviceStatusCode: serviesStatusCode);
|
|
|
// 组件挂载时执行 - 执行接口请求
|
|
|
Future.microtask(() => vm.initPageData());
|
|
|
return () {
|
|
@@ -72,7 +75,7 @@ class CleanOrderDetailPage extends HookConsumerWidget {
|
|
|
return Scaffold(
|
|
|
appBar: MyAppBar.appBar(
|
|
|
context,
|
|
|
- "Confirm Order",
|
|
|
+ "Order Details",
|
|
|
backgroundColor: context.appColors.whiteBG,
|
|
|
),
|
|
|
backgroundColor: ColorUtils.string2Color("#F2F3F6"),
|
|
@@ -94,11 +97,16 @@ class CleanOrderDetailPage extends HookConsumerWidget {
|
|
|
},
|
|
|
successWidget: Column(
|
|
|
children: [
|
|
|
- Expanded(child: _buildBody(state, vm, context,ref)),
|
|
|
+ Expanded(
|
|
|
+ child: Padding(
|
|
|
+ padding: const EdgeInsets.only(bottom: 10),
|
|
|
+ child: _buildBody(state, vm, context,ref),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
// 底部联系信息
|
|
|
Visibility(
|
|
|
visible: state.loadingState == LoadState.State_Success,
|
|
|
- child: state.datas !=null ? _buildBottomSection(state, vm,ref, context, id, serviceTypeCode, totalPrice): Container(),
|
|
|
+ child: state.datas !=null ? _buildActionSection(context, state, vm, ref, id, serviceTypeCode,serviesStatusCode, actionBtnList): Container(),
|
|
|
)
|
|
|
|
|
|
],
|
|
@@ -138,24 +146,30 @@ class CleanOrderDetailPage extends HookConsumerWidget {
|
|
|
padding: const EdgeInsets.only(left: 10, right: 10, top: 18.5, bottom: 18.5),
|
|
|
child: _buildOrderService(state, vm, context),
|
|
|
),
|
|
|
- // 订单 上门时间
|
|
|
+ // total amount
|
|
|
Container(
|
|
|
color: context.appColors.whiteBG,
|
|
|
width: double.infinity,
|
|
|
margin: const EdgeInsets.only(left: 0, right: 0, top: 5, bottom: 0),
|
|
|
padding: const EdgeInsets.only(left: 10, right: 10, top: 18.5, bottom: 18.5),
|
|
|
- child: _buildOrderVisitTime(state, vm, context).onTap((){
|
|
|
- vm.handlerClickVisitTime(context);
|
|
|
- }),
|
|
|
+ child: _buildOrderTotalAmount(state, vm, context),
|
|
|
),
|
|
|
- // 订单 card 信息
|
|
|
+ // 订单 上门时间
|
|
|
Container(
|
|
|
color: context.appColors.whiteBG,
|
|
|
width: double.infinity,
|
|
|
margin: const EdgeInsets.only(left: 0, right: 0, top: 5, bottom: 0),
|
|
|
padding: const EdgeInsets.only(left: 10, right: 10, top: 18.5, bottom: 18.5),
|
|
|
- child: _buildOrderPayCardInfo(state, vm, context),
|
|
|
+ child: _buildOrderVisitTime(state, vm, context),
|
|
|
),
|
|
|
+ // 订单 card 信息
|
|
|
+ // Container(
|
|
|
+ // color: context.appColors.whiteBG,
|
|
|
+ // width: double.infinity,
|
|
|
+ // margin: const EdgeInsets.only(left: 0, right: 0, top: 5, bottom: 0),
|
|
|
+ // padding: const EdgeInsets.only(left: 10, right: 10, top: 18.5, bottom: 18.5),
|
|
|
+ // child: _buildOrderPayCardInfo(state, vm, context),
|
|
|
+ // ),
|
|
|
|
|
|
// 订单备注
|
|
|
Container(
|
|
@@ -166,13 +180,13 @@ class CleanOrderDetailPage extends HookConsumerWidget {
|
|
|
child: _buildOrderRemark(state, vm, context, ref),
|
|
|
),
|
|
|
// 订单 rules
|
|
|
- Container(
|
|
|
- color: context.appColors.whiteBG,
|
|
|
- width: double.infinity,
|
|
|
- margin: const EdgeInsets.only(left: 0, right: 0, top: 5, bottom: 0),
|
|
|
- padding: const EdgeInsets.only(left: 10, right: 10, top: 18.5, bottom: 18.5),
|
|
|
- child: _buildOrderRules(state, vm, context),
|
|
|
- ),
|
|
|
+ // Container(
|
|
|
+ // color: context.appColors.whiteBG,
|
|
|
+ // width: double.infinity,
|
|
|
+ // margin: const EdgeInsets.only(left: 0, right: 0, top: 5, bottom: 0),
|
|
|
+ // padding: const EdgeInsets.only(left: 10, right: 10, top: 18.5, bottom: 18.5),
|
|
|
+ // child: _buildOrderRules(state, vm, context),
|
|
|
+ // ),
|
|
|
],
|
|
|
),
|
|
|
);
|
|
@@ -326,12 +340,50 @@ class CleanOrderDetailPage extends HookConsumerWidget {
|
|
|
);
|
|
|
}
|
|
|
|
|
|
+ Widget _buildOrderTotalAmount(CleanOrderDetailState state, CleanOrderDetailVm vm, BuildContext context) {
|
|
|
+ return Column(
|
|
|
+ children: [
|
|
|
+ Row(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.start,
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
+ children: [
|
|
|
+ const MyAssetImage(
|
|
|
+ Assets.serviceMoneyIcon,
|
|
|
+ width: 15,
|
|
|
+ height: 17.5,
|
|
|
+ ),
|
|
|
+ const SizedBox(
|
|
|
+ width: 10,
|
|
|
+ ),
|
|
|
+ MyTextView(
|
|
|
+ 'Total Amount',
|
|
|
+ fontSize: 17,
|
|
|
+ isFontBold: true,
|
|
|
+ textColor: context.appColors.textBlack,
|
|
|
+ ),
|
|
|
+
|
|
|
+ MyTextView(
|
|
|
+ '\$200',
|
|
|
+ fontSize: 15,
|
|
|
+ textColor: context.appColors.textBlack,
|
|
|
+ isFontBold: true,
|
|
|
+ textAlign: TextAlign.end,
|
|
|
+ marginRight: 17,
|
|
|
+ ).expanded(),
|
|
|
+ ]
|
|
|
+ )
|
|
|
+ ]
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
Widget _buildOrderVisitTime(CleanOrderDetailState state, CleanOrderDetailVm vm, BuildContext context) {
|
|
|
return Row(
|
|
|
mainAxisSize: MainAxisSize.max,
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
children: [
|
|
|
Row(
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
children: [
|
|
|
const MyAssetImage(
|
|
|
Assets.serviceTimeIcon,
|
|
@@ -346,7 +398,6 @@ class CleanOrderDetailPage extends HookConsumerWidget {
|
|
|
fontSize: 17,
|
|
|
isFontBold: true,
|
|
|
textColor: context.appColors.textBlack,
|
|
|
- marginBottom: 5,
|
|
|
),
|
|
|
],
|
|
|
),
|
|
@@ -363,12 +414,12 @@ class CleanOrderDetailPage extends HookConsumerWidget {
|
|
|
textAlign: TextAlign.end,
|
|
|
marginRight: 17,
|
|
|
),
|
|
|
- // 右箭头 icon
|
|
|
- const MyAssetImage(
|
|
|
- Assets.serviceRightIcon,
|
|
|
- width: 17.5,
|
|
|
- height: 17.5,
|
|
|
- ),
|
|
|
+ // // 右箭头 icon
|
|
|
+ // const MyAssetImage(
|
|
|
+ // Assets.serviceRightIcon,
|
|
|
+ // width: 17.5,
|
|
|
+ // height: 17.5,
|
|
|
+ // ),
|
|
|
],
|
|
|
),
|
|
|
),
|
|
@@ -459,83 +510,31 @@ class CleanOrderDetailPage extends HookConsumerWidget {
|
|
|
Container(
|
|
|
margin: const EdgeInsets.only(left:10, right:10,top: 0),
|
|
|
width: double.infinity,
|
|
|
- height: 200,
|
|
|
padding: const EdgeInsets.all(15),
|
|
|
decoration: BoxDecoration(
|
|
|
- color: ColorUtils.string2Color("#F2F3F6"),
|
|
|
+ color: ColorUtils.string2Color("#F8F8F8"),
|
|
|
borderRadius: BorderRadius.circular(5),
|
|
|
- boxShadow: [
|
|
|
- BoxShadow(
|
|
|
- color: Colors.grey.withOpacity(0.2),
|
|
|
- spreadRadius:1,
|
|
|
- blurRadius: 2,
|
|
|
- offset: const Offset(0.5, 0.5), // changes position of shadow
|
|
|
- ),
|
|
|
- ]
|
|
|
+ // boxShadow: [
|
|
|
+ // BoxShadow(
|
|
|
+ // color: Colors.grey.withOpacity(0.2),
|
|
|
+ // spreadRadius:1,
|
|
|
+ // blurRadius: 2,
|
|
|
+ // offset: const Offset(0.5, 0.5), // changes position of shadow
|
|
|
+ // ),
|
|
|
+ // ]
|
|
|
+ ),
|
|
|
+ child: MyTextView(
|
|
|
+ 'Hope to arrive as soon as possible',
|
|
|
+ fontSize: 16,
|
|
|
+ isFontRegular: true,
|
|
|
+ textColor: context.appColors.textBlack,
|
|
|
+ marginBottom: 15,
|
|
|
),
|
|
|
- child: _buildTextAreaLayout(context, vm, ref, 'remark',),
|
|
|
),
|
|
|
],
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- /// 多行输入框
|
|
|
- Widget _buildTextAreaLayout(BuildContext context, CleanOrderDetailVm vm, WidgetRef ref,String key){
|
|
|
- final state = ref.watch(cleanOrderDetailVmProvider);
|
|
|
- final noteCount = useState(0);
|
|
|
- return Stack(
|
|
|
- children: [
|
|
|
- Container(
|
|
|
- child: TextField(
|
|
|
- cursorColor: context.appColors.authFiledText,
|
|
|
- cursorWidth: 1.5,
|
|
|
- autofocus: false,
|
|
|
- enabled: true,
|
|
|
- maxLines: null,
|
|
|
- focusNode: state.remarkInfo[key]!['focusNode'],
|
|
|
- controller: state.remarkInfo[key]!['controller'],
|
|
|
- decoration: InputDecoration(
|
|
|
- isDense: true,
|
|
|
- isCollapsed: true,
|
|
|
- border: InputBorder.none,
|
|
|
- hintText: state.remarkInfo[key]!['hintText'],
|
|
|
- hintStyle: TextStyle(
|
|
|
- color: context.appColors.authFiledHint,
|
|
|
- fontSize: 16.0,
|
|
|
- fontWeight: FontWeight.w400,
|
|
|
- ),
|
|
|
- ),
|
|
|
- style: TextStyle(
|
|
|
- color: context.appColors.authFiledText,
|
|
|
- fontSize: 16.0,
|
|
|
- fontWeight: FontWeight.w400,
|
|
|
- ),
|
|
|
- textInputAction: TextInputAction.done,
|
|
|
- onSubmitted: (value) {
|
|
|
- FocusScope.of(context).unfocus();
|
|
|
- },
|
|
|
- expands: true,
|
|
|
- onChanged: (text) {
|
|
|
- // 当文本改变时,更新字符数量
|
|
|
- noteCount.value = text.length;
|
|
|
- },
|
|
|
- ),
|
|
|
- ),
|
|
|
- // Positioned(
|
|
|
- // bottom: 0.0,
|
|
|
- // right: 0.0,
|
|
|
- // child: Text(
|
|
|
- // S.current.characters(noteCount.value),
|
|
|
- // style: TextStyle(
|
|
|
- // color: context.appColors.textBlack,
|
|
|
- // fontSize: 15.0,
|
|
|
- // ),
|
|
|
- // ),
|
|
|
- // ),
|
|
|
- ]
|
|
|
- );
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
Widget _buildOrderRules(CleanOrderDetailState state, CleanOrderDetailVm vm, BuildContext context) {
|
|
|
return Column(
|
|
@@ -570,63 +569,51 @@ class CleanOrderDetailPage extends HookConsumerWidget {
|
|
|
}
|
|
|
|
|
|
// 底部操作区域
|
|
|
- Widget _buildBottomSection(CleanOrderDetailState state, CleanOrderDetailVm vm,WidgetRef ref, BuildContext context, int id, int serviceTypeCode, totalPrice) {
|
|
|
- return Container(
|
|
|
- height: 50,
|
|
|
- width: double.infinity,
|
|
|
- child: Row(
|
|
|
- mainAxisAlignment: MainAxisAlignment.center,
|
|
|
- mainAxisSize: MainAxisSize.max,
|
|
|
- children: [
|
|
|
- Container(
|
|
|
- width: 122,
|
|
|
+ Widget _buildActionSection(BuildContext context,state, vm ,WidgetRef ref, int id, int serviceTypeCode, int serviesStatusCode, List<Map<String, dynamic>> actionBtnList) {
|
|
|
+ return LayoutBuilder(
|
|
|
+ builder: (BuildContext context, BoxConstraints constraints) {
|
|
|
+ final maxHeight = constraints.maxHeight;
|
|
|
+ final minHeight = constraints.minHeight;
|
|
|
+ final maxWidth = constraints.maxWidth;
|
|
|
+ // Log.d("---maxHeight-----$maxHeight-- $minHeight $maxWidth--");
|
|
|
+ return Container(
|
|
|
+ height: 71.5,
|
|
|
+ color: context.appColors.whiteBG,
|
|
|
+ width: maxWidth,
|
|
|
+ padding: const EdgeInsets.only(left: 10, right: 10),
|
|
|
child: Row(
|
|
|
- mainAxisAlignment: MainAxisAlignment.center,
|
|
|
- crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
- mainAxisSize: MainAxisSize.max,
|
|
|
- children: [
|
|
|
- Container(
|
|
|
- alignment: Alignment.center,
|
|
|
- padding: const EdgeInsets.only(left:5, right: 0,top:5,bottom: 5),
|
|
|
- child: Row(
|
|
|
- mainAxisAlignment: MainAxisAlignment.center,
|
|
|
- mainAxisSize: MainAxisSize.max,
|
|
|
- children: [
|
|
|
- MyTextView(
|
|
|
- "\$$totalPrice",
|
|
|
- fontSize: 18,
|
|
|
- textColor: Colors.white,
|
|
|
- isFontRegular: true,
|
|
|
- marginLeft: 5,
|
|
|
- marginRight: 15,
|
|
|
- onClick: (){
|
|
|
-
|
|
|
- },
|
|
|
- ),
|
|
|
- ],
|
|
|
- ),
|
|
|
- ),
|
|
|
- ],
|
|
|
- ).backgroundColor(context.appColors.textPrimary),
|
|
|
- ),
|
|
|
- Expanded(
|
|
|
- child: Container(
|
|
|
- color: context.appColors.redDefault,
|
|
|
- child: Center(
|
|
|
- child: MyTextView(
|
|
|
- 'Pay Now',
|
|
|
- textColor: context.appColors.textWhite,
|
|
|
- fontSize: 17,
|
|
|
- isFontMedium: true,
|
|
|
- textAlign: TextAlign.center,
|
|
|
- ),
|
|
|
- ),
|
|
|
- ).onTap((){
|
|
|
- vm.handlerClickPayNow(context, id: id , serviceTypeCode: serviceTypeCode);
|
|
|
- }),
|
|
|
- ),
|
|
|
- ],
|
|
|
- ),
|
|
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
+ mainAxisSize: MainAxisSize.max,
|
|
|
+ children: List.generate(actionBtnList.length, (index){
|
|
|
+ var item = actionBtnList[index];
|
|
|
+ return Expanded(
|
|
|
+ child: _buildBtn(context, item, vm, ref),
|
|
|
+ );
|
|
|
+ // return _buildBtn(context, item, vm, ref);
|
|
|
+ })
|
|
|
+ ),
|
|
|
+ ).scrollable(
|
|
|
+ scrollDirection: Axis.horizontal,
|
|
|
+ physics: BouncingScrollPhysics(),
|
|
|
+ );
|
|
|
+ }
|
|
|
);
|
|
|
}
|
|
|
+
|
|
|
+ Widget _buildBtn(BuildContext context, Map<String, dynamic> btnItem, vm, WidgetRef ref) {
|
|
|
+ // final btnCode = btnItem['code'];
|
|
|
+ return MyButton(
|
|
|
+ onPressed: (){
|
|
|
+ vm.handlerClickActionBtn(context, btnItem);
|
|
|
+ },
|
|
|
+ text: btnItem['text'],
|
|
|
+ radius: 10.0,
|
|
|
+ textColor: context.appColors.textWhite,
|
|
|
+ backgroundColor: ColorUtils.string2Color(btnItem['btnColor']),
|
|
|
+ fontSize: 12,
|
|
|
+ padding: const EdgeInsets.symmetric(horizontal: 5),
|
|
|
+ minWidth: btnItem['btnWidth']?.toDouble(),
|
|
|
+ minHeight: btnItem['btnHeight']?.toDouble() + 5,
|
|
|
+ ).marginOnly(left: 5);
|
|
|
+ }
|
|
|
}
|