添加价格

hmxc
小赖 4 years ago
parent 96a5588bc0
commit be54a30b2d

@ -1,6 +1,7 @@
import 'package:aku_community_manager/const/resource.dart';
import 'package:flutter/material.dart';
import 'package:aku_community_manager/const/resource.dart';
enum FIX_ENUM {
///
HAND_OUT,
@ -110,15 +111,6 @@ class FixModel {
title: '分派给李保国师傅', date: DateTime(2020, 10, 23, 10, 32, 14)),
FixStatus(title: '师傅已接单', date: DateTime(2020, 10, 23, 10, 38, 26)),
],
result: FixResult(
detail: '电饭煲插头没插',
material: '',
imgs: [R.ASSETS_STATIC_FIX_FOOD_PNG],
),
review: UserReviewInfo(
rate: 5,
content: '师傅太用心了',
),
),
),
FixModel(
@ -130,7 +122,7 @@ class FixModel {
userName: '杨建',
userPhoneNumber: '18882929292',
fixArea: 'A区',
type: FIX_PAYMENT_TYPE.FREE,
type: FIX_PAYMENT_TYPE.PAY,
limit: FIX_DATE_LIMIT.HOUR_24,
subType: FIX_SUB_TYPE.NORMAL,
fixStatuses: [
@ -149,6 +141,10 @@ class FixModel {
rate: 5,
content: '师傅太用心了',
),
priceDetail: FixPriceDetail(
humanPrice: 10,
materialPrice: 0,
),
),
),
];
@ -228,6 +224,8 @@ class FixDetailModel {
FixResult result;
UserReviewInfo review;
FixPriceDetail priceDetail;
FixDetailModel({
this.userName,
this.userPhoneNumber,
@ -238,6 +236,7 @@ class FixDetailModel {
this.fixStatuses,
this.result,
this.review,
this.priceDetail,
});
}
@ -271,3 +270,13 @@ class UserReviewInfo {
this.content,
});
}
class FixPriceDetail {
double humanPrice;
double materialPrice;
FixPriceDetail({
this.humanPrice,
this.materialPrice,
});
double get allPrice => humanPrice + materialPrice;
}

@ -8,6 +8,7 @@ import 'package:aku_community_manager/tools/screen_tool.dart';
import 'package:aku_community_manager/ui/widgets/inner/aku_title_box.dart';
import 'package:aku_community_manager/ui/widgets/inner/pick_image.dart';
import 'package:aku_ui/common_widgets/aku_material_button.dart';
import 'package:common_utils/common_utils.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
@ -24,6 +25,18 @@ class _FixWorkFinishPageState extends State<FixWorkFinishPage> {
List<File> _imgs = [];
TextEditingController _descriptionController = TextEditingController();
TextEditingController _materialController = TextEditingController();
TextEditingController _humanController = TextEditingController();
TextEditingController _materialPriceController = TextEditingController();
@override
void dispose() {
_descriptionController?.dispose();
_materialController?.dispose();
_materialPriceController?.dispose();
_materialPriceController?.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return AkuScaffold(
@ -243,10 +256,85 @@ class _FixWorkFinishPageState extends State<FixWorkFinishPage> {
)
],
),
// widget.model.detail.type == FIX_PAYMENT_TYPE.FREE
// ? SizedBox()
// :
AkuTitleBox(
title: '费用明细',
spacing: 16,
children: [
Row(
children: [
AkuBox.h(96),
Text('人工费'),
Expanded(
child: TextField(
controller: _humanController,
onChanged: (_) => setState(() {}),
keyboardType: TextInputType.number,
textAlign: TextAlign.end,
decoration: InputDecoration(
border: InputBorder.none,
hintText: '请输入',
hintStyle: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 28.sp,
color: AppStyle.minorTextColor,
),
),
),
),
],
),
Divider(height: 1.w),
Row(
children: [
AkuBox.h(96),
Text('材料费'),
Expanded(
child: TextField(
onChanged: (_) => setState(() {}),
controller: _materialPriceController,
textAlign: TextAlign.end,
keyboardType: TextInputType.number,
decoration: InputDecoration(
border: InputBorder.none,
hintText: '请输入',
hintStyle: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 28.sp,
color: AppStyle.minorTextColor,
),
),
),
),
],
),
Divider(height: 1.w),
Row(
children: [
AkuBox.h(96),
Text('总计费用'),
Spacer(),
Builder(
builder: (context) {
double humanPrice =
double.tryParse(_humanController.text);
double materialPrice =
double.tryParse(_materialPriceController.text);
if (TextUtil.isEmpty(_humanController.text) ||
TextUtil.isEmpty(_materialPriceController.text)) {
return Text('人工费或材料费不能为空');
} else if (humanPrice == null || materialPrice == null)
return Text('输入有误');
else
return Text(
'¥${(humanPrice + materialPrice).toStringAsFixed(2)}');
},
),
],
),
],
),
],
@ -269,6 +357,11 @@ class _FixWorkFinishPageState extends State<FixWorkFinishPage> {
imgs: _imgs,
);
widget.model.type = FIX_ENUM.DONE;
if (widget.model.detail.type == FIX_PAYMENT_TYPE.PAY)
widget.model.detail.priceDetail = FixPriceDetail(
humanPrice: double.parse(_humanController.text),
materialPrice: double.parse(_materialController.text),
);
Get.back();
},
),

Loading…
Cancel
Save