# Conflicts:
#	lib/widget/picker/bee_pick_image_widget.dart
pull/1/head
戴余标 3 years ago
commit 19469b774a

@ -1,13 +1,14 @@
import 'package:aku_new_community/base/base_style.dart';
import 'package:aku_new_community/model/common/img_model.dart';
import 'package:common_utils/common_utils.dart';
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import 'package:json_annotation/json_annotation.dart';
part 'home_activity_model.g.dart';
@JsonSerializable()
class HomeActivityModel {
class HomeActivityModel extends Equatable {
final int id;
final String title;
final int status;
@ -17,12 +18,15 @@ class HomeActivityModel {
final String activityEndTime;
final List<ImgModel>? imgList;
final int? registrationNum;
final List<ImgModel>? avatarImgList;
factory HomeActivityModel.fromJson(Map<String, dynamic> json) =>
_$HomeActivityModelFromJson(json);
DateTime? get begin => DateUtil.getDateTime(registrationStartTime);
DateTime? get end => DateUtil.getDateTime(registrationEndTime);
String get statusString {
switch (this.status) {
case 1:
@ -53,6 +57,20 @@ class HomeActivityModel {
}
}
@override
List<Object?> get props => [
id,
title,
status,
registrationStartTime,
registrationEndTime,
activityStartTime,
activityEndTime,
imgList,
registrationNum,
avatarImgList,
];
const HomeActivityModel({
required this.id,
required this.title,
@ -62,6 +80,7 @@ class HomeActivityModel {
required this.activityStartTime,
required this.activityEndTime,
this.imgList,
this.registrationNum,
required this.registrationNum,
this.avatarImgList,
});
}

@ -19,4 +19,7 @@ HomeActivityModel _$HomeActivityModelFromJson(Map<String, dynamic> json) =>
?.map((e) => ImgModel.fromJson(e as Map<String, dynamic>))
.toList(),
registrationNum: json['registrationNum'] as int?,
avatarImgList: (json['avatarImgList'] as List<dynamic>?)
?.map((e) => ImgModel.fromJson(e as Map<String, dynamic>))
.toList(),
);

@ -1,6 +1,5 @@
import 'package:json_annotation/json_annotation.dart';
import 'package:aku_new_community/ui/market/shop_car/shop_car_func.dart';
import 'package:json_annotation/json_annotation.dart';
part 'good_detail_model.g.dart';
@ -9,14 +8,14 @@ class GoodDetailModel {
final int id;
final List<JcookImageVoList>? jcookImageVoList;
final num sellPrice;
final num discountPrice;
final String? skuName;
final num? discountPrice;
final String skuName;
final int status;
final int shopStatus;
final int? sellNum;
final int? kind;
final String defaultLocation;
final String defaultAddressDetail;
final int kind;
final String? defaultLocation;
final String? defaultAddressDetail;
final int stockStatus;
final List<JcookSpecificationVoList> jcookSpecificationVoList;
final int isCollection;

@ -13,14 +13,14 @@ GoodDetailModel _$GoodDetailModelFromJson(Map<String, dynamic> json) =>
?.map((e) => JcookImageVoList.fromJson(e as Map<String, dynamic>))
.toList(),
sellPrice: json['sellPrice'] as num,
discountPrice: json['discountPrice'] as num,
skuName: json['skuName'] as String?,
discountPrice: json['discountPrice'] as num?,
skuName: json['skuName'] as String,
status: json['status'] as int,
shopStatus: json['shopStatus'] as int,
sellNum: json['sellNum'] as int?,
kind: json['kind'] as int?,
defaultLocation: json['defaultLocation'] as String,
defaultAddressDetail: json['defaultAddressDetail'] as String,
kind: json['kind'] as int,
defaultLocation: json['defaultLocation'] as String?,
defaultAddressDetail: json['defaultAddressDetail'] as String?,
stockStatus: json['stockStatus'] as int,
jcookSpecificationVoList:
(json['jcookSpecificationVoList'] as List<dynamic>)

@ -14,6 +14,7 @@ class WorkOrderDetailModel extends Equatable {
final String reserveDate;
final String content;
final String createDate;
final List<ImgModel>? imgList;
final List<ImgModel>? servicePersonnelImgList;
final int newReportNum;
final int? evaluateLevel;
@ -23,22 +24,6 @@ class WorkOrderDetailModel extends Equatable {
factory WorkOrderDetailModel.fromJson(Map<String, dynamic> json) =>
_$WorkOrderDetailModelFromJson(json);
const WorkOrderDetailModel({
required this.id,
required this.code,
required this.status,
required this.workOrderTypeName,
required this.reserveAddress,
required this.reserveDate,
required this.content,
required this.createDate,
this.servicePersonnelImgList,
required this.newReportNum,
this.evaluateLevel,
this.evaluateContent,
this.evaluateDate,
});
@override
List<Object?> get props => [
id,
@ -54,5 +39,23 @@ class WorkOrderDetailModel extends Equatable {
evaluateLevel,
evaluateContent,
evaluateDate,
imgList
];
const WorkOrderDetailModel({
required this.id,
required this.code,
required this.status,
required this.workOrderTypeName,
required this.reserveAddress,
required this.reserveDate,
required this.content,
required this.createDate,
this.imgList,
this.servicePersonnelImgList,
required this.newReportNum,
this.evaluateLevel,
this.evaluateContent,
this.evaluateDate,
});
}

@ -17,6 +17,9 @@ WorkOrderDetailModel _$WorkOrderDetailModelFromJson(
reserveDate: json['reserveDate'] as String,
content: json['content'] as String,
createDate: json['createDate'] as String,
imgList: (json['imgList'] as List<dynamic>?)
?.map((e) => ImgModel.fromJson(e as Map<String, dynamic>))
.toList(),
servicePersonnelImgList:
(json['servicePersonnelImgList'] as List<dynamic>?)
?.map((e) => ImgModel.fromJson(e as Map<String, dynamic>))

@ -1,3 +1,4 @@
import 'package:aku_new_community/model/common/img_model.dart';
import 'package:common_utils/common_utils.dart';
import 'package:equatable/equatable.dart';
import 'package:json_annotation/json_annotation.dart';
@ -15,10 +16,13 @@ class WorkOrderListModel extends Equatable {
final String content;
final String updateDate;
final String createDate;
final List<ImgModel>? imgList;
factory WorkOrderListModel.fromJson(Map<String, dynamic> json) =>
_$WorkOrderListModelFromJson(json);
DateTime? get updateDateDT => DateUtil.getDateTime(updateDate);
DateTime? get createDateDT => DateUtil.getDateTime(createDate);
@override
@ -32,6 +36,7 @@ class WorkOrderListModel extends Equatable {
content,
updateDate,
createDate,
imgList
];
const WorkOrderListModel({
@ -44,5 +49,6 @@ class WorkOrderListModel extends Equatable {
required this.content,
required this.updateDate,
required this.createDate,
this.imgList,
});
}

@ -17,4 +17,7 @@ WorkOrderListModel _$WorkOrderListModelFromJson(Map<String, dynamic> json) =>
content: json['content'] as String,
updateDate: json['updateDate'] as String,
createDate: json['createDate'] as String,
imgList: (json['imgList'] as List<dynamic>?)
?.map((e) => ImgModel.fromJson(e as Map<String, dynamic>))
.toList(),
);

@ -0,0 +1,22 @@
import 'package:equatable/equatable.dart';
import 'package:json_annotation/json_annotation.dart';
part 'work_order_type_model.g.dart';
@JsonSerializable()
class WorkOrderTypeModel extends Equatable {
final int id;
final String name;
factory WorkOrderTypeModel.fromJson(Map<String, dynamic> json) =>
_$WorkOrderTypeModelFromJson(json);
const WorkOrderTypeModel({
required this.id,
required this.name,
});
@override
List<Object?> get props => [
id,
name,
];
}

@ -0,0 +1,13 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'work_order_type_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
WorkOrderTypeModel _$WorkOrderTypeModelFromJson(Map<String, dynamic> json) =>
WorkOrderTypeModel(
id: json['id'] as int,
name: json['name'] as String,
);

@ -4,7 +4,6 @@ import 'package:aku_new_community/pages/personal/clock_in/clock_in_page.dart';
import 'package:aku_new_community/pages/personal/user_profile_page.dart';
import 'package:aku_new_community/pages/setting_page/settings_page.dart';
import 'package:aku_new_community/pages/sign/login/login_page.dart';
import 'package:aku_new_community/painters/user_bottom_bar_painter.dart';
import 'package:aku_new_community/provider/user_provider.dart';
import 'package:aku_new_community/ui/market/order/order_page.dart';
import 'package:aku_new_community/ui/profile/car/car_manage_page.dart';
@ -13,6 +12,7 @@ import 'package:aku_new_community/ui/profile/new_house/my_family_page.dart';
import 'package:aku_new_community/ui/profile/new_house/my_house_page.dart';
import 'package:aku_new_community/utils/headers.dart';
import 'package:aku_new_community/utils/network/net_util.dart';
import 'package:aku_new_community/widget/beeImageNetwork.dart';
import 'package:aku_new_community/widget/others/user_tool.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/cupertino.dart';
@ -36,150 +36,6 @@ class PersonalIndex extends StatefulWidget {
class _PersonalIndexState extends State<PersonalIndex>
with SingleTickerProviderStateMixin, AutomaticKeepAliveClientMixin {
SliverAppBar _sliverAppBar(double height) {
final userProvider = Provider.of<UserProvider>(context);
return SliverAppBar(
pinned: false,
toolbarHeight: 0,
elevation: 0,
floating: false,
expandedHeight: 450.w - height,
backgroundColor: Colors.white,
flexibleSpace: FlexibleSpaceBar(
background: Stack(
children: [
Positioned(
top: 0,
left: 0,
right: 0,
bottom: 0,
child: Container(
// decoration: BoxDecoration(
// image: DecorationImage(
// image: AssetImage(R.ASSETS_ICONS_ICON_MY_SETTING_PNG),
// fit: BoxFit.cover,
// ),
// ),
child: Column(
children: [
Spacer(),
MaterialButton(
padding: EdgeInsets.all(5.w),
onPressed: () {
if (!userProvider.isLogin)
Get.to(() => LoginPage());
else
Get.to(() => UserProfilePage());
},
child: Container(
margin: EdgeInsets.only(left: 32.w),
child: Row(
children: [
Hero(
tag: 'AVATAR1',
child: ClipOval(
// child: FadeInImage.assetNetwork(
// placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
// image: SARSAPI.image(userProvider
// .userInfoModel!.imgUrls.isNotEmpty
// ? userProvider
// .userInfoModel!.imgUrls.first.url
// : ''),
// height: 106.w,
// width: 106.w,
// fit: BoxFit.cover,
// imageErrorBuilder:
// (context, error, stackTrace) {
// return Image.asset(
// R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
// height: 106.w,
// width: 106.w,
// );
// },
// ),
),
),
Container(
margin: EdgeInsets.only(left: 16.w),
child: userProvider.isLogin
? Text(
userProvider.userInfoModel?.nickName ??
'',
style: TextStyle(
fontSize: 32.sp,
color: Color(0xffad8940),
),
)
: Text(
'登录/注册',
style: TextStyle(
fontSize: 32.sp,
color: Color(0xffad8940),
),
)),
],
),
),
),
Stack(
children: [
Positioned(
bottom: 0,
left: 0,
right: 0,
child: Container(
height: 41.w,
width: double.infinity,
child: CustomPaint(
painter: UserBottomBarPainter(),
),
),
),
Container(
margin: EdgeInsets.only(
top: 38.w,
left: 36.w,
right: 36.w,
bottom: 18.w,
),
child: Image.asset(
R.ASSETS_IMAGES_MEMBER_BG_PNG,
width: 678.w,
height: 129.w,
),
),
],
),
],
),
),
)
],
),
),
);
}
// Container _containerBar(String title) {
// return Container(
// color: title == '我的物业' ? Colors.white : BaseStyle.colorf9f9f9,
// padding: EdgeInsets.all(title == '我的物业' ? 0 : 32.w),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Text(
// title,
// style: TextStyle(
// fontWeight: FontWeight.w600,
// fontSize: BaseStyle.fontSize34,
// color: ktextPrimary,
// ),
// ),
// ],
// ),
// );
// }
Widget _orderButton({
required String name,
required String path,
@ -275,30 +131,14 @@ class _PersonalIndexState extends State<PersonalIndex>
Hero(
tag: 'AVATAR',
child: ClipOval(
// child: FadeInImage.assetNetwork(
// placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
// image: SARSAPI.image((userProvider
// .userInfoModel?.imgUrls ??
// [])
// .isNotEmpty
// ? (userProvider.userInfoModel?.imgUrls ??
// [])
// .first
// .url
// : ''),
// height: 106.w,
// width: 106.w,
// fit: BoxFit.cover,
// imageErrorBuilder:
// (context, error, stackTrace) {
// return Image.asset(
// R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
// height: 106.w,
// width: 106.w,
// );
// },
// ),
),
child: BeeImageNetwork(
width: 106.w,
height: 106.w,
imgs: UserTool.userProvider.userInfoModel
?.imgList ??
[],
),
),
),
Container(
margin: EdgeInsets.only(left: 16.w),

@ -8,9 +8,10 @@ import 'package:aku_new_community/provider/user_provider.dart';
import 'package:aku_new_community/utils/headers.dart';
import 'package:aku_new_community/utils/network/base_model.dart';
import 'package:aku_new_community/utils/network/net_util.dart';
import 'package:aku_new_community/widget/beeImageNetwork.dart';
import 'package:aku_new_community/widget/bee_scaffold.dart';
import 'package:aku_new_community/widget/others/user_tool.dart';
import 'package:aku_new_community/widget/picker/bee_custom_picker.dart';
import 'package:aku_new_community/widget/picker/bee_date_picker.dart';
import 'package:aku_new_community/widget/picker/bee_image_picker.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:common_utils/common_utils.dart';
@ -90,31 +91,12 @@ class _UserProfilePageState extends State<UserProfilePage> {
Hero(
tag: 'AVATAR',
child: ClipOval(
// child:
// CachedNetworkImage(
// imageUrl: SARSAPI.image(
// userProvider.userInfoModel!.imgUrls.isNotEmpty
// ? userProvider.userInfoModel?.imgUrls.first.url
// : ''),
// height: 56.w,
// width: 56.w,
// placeholder: (context, url) =>
// Image.asset(R.ASSETS_IMAGES_PLACEHOLDER_WEBP),
// errorWidget: (context, url, error) =>
// Image.asset(R.ASSETS_IMAGES_PLACEHOLDER_WEBP),
// fit: BoxFit.fill,
// ),
// FadeInImage.assetNetwork(
// placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
// image: SARSAPI.image(
// (userProvider.userInfoModel?.imgUrls ?? []).isNotEmpty
// ? userProvider.userInfoModel?.imgUrls.first.url
// : ''),
// height: 56.w,
// width: 56.w,
// fit: BoxFit.cover,
// ),
),
child: BeeImageNetwork(
width: 56.w,
height: 56.w,
imgs: UserTool.userProvider.userInfoModel?.imgList ?? [],
),
),
),
onPressed: _pickAvatar,
),
@ -162,14 +144,14 @@ class _UserProfilePageState extends State<UserProfilePage> {
}
},
),
_buildTile(
'出生日期',
'userProvider.userInfoModel!.birthdayValue'.text.make(),
onPressed: () async {
DateTime? date = await BeeDatePicker.pick(DateTime.now());
if (date != null) userProvider.setBirthday(date);
},
),
// _buildTile(
// '出生日期',
// 'userProvider.userInfoModel!.birthdayValue'.text.make(),
// onPressed: () async {
// DateTime? date = await BeeDatePicker.pick(DateTime.now());
// if (date != null) userProvider.setBirthday(date);
// },
// ),
].sepWidget(
separate: Divider(
indent: 104.w,

@ -163,7 +163,7 @@ class UserProvider extends ChangeNotifier {
BaseModel model = await NetUtil().post(
SAASAPI.user.updateAvatar,
params: {
'fileUrls': [path]
'imgUrls': [path]
},
showMessage: true,
);

@ -18,7 +18,7 @@ class ActivityCard extends StatelessWidget {
this.home = false,
}) : super(key: key);
bool get outdate => model!.end!.compareTo(DateTime.now()) == -1;
bool get outdate => ActivityFunc.dateCheck(model!.end) == '';
Widget build(BuildContext context) {
return ConstrainedBox(
@ -109,7 +109,8 @@ class ActivityCard extends StatelessWidget {
[
Flexible(
child: AvatarsParticipate(
avatars: (model?.imgList?.map((e) => e.url).toList() ?? []),
avatars:
(model?.avatarImgList?.map((e) => e.url).toList() ?? []),
pNum: model?.registrationNum ?? 0,
hasIcon: false,
),

@ -5,7 +5,7 @@ class ActivityFunc {
}
var nowDate = DateTime.now();
if (date.isBefore(nowDate)) {
return '已结束';
return '';
} else {
var days = date.difference(nowDate).inDays;
if (days > 0) {

@ -49,8 +49,10 @@ class _PublishTaskPageState extends State<PublishTaskPage> {
//
int _rewardType = 0;
//
DateTime? _appointDate;
//
DateTime? _appointEndDate;
TextEditingController _rewardController = TextEditingController();
@ -59,9 +61,11 @@ class _PublishTaskPageState extends State<PublishTaskPage> {
String? _content;
List<File> _photos = [];
String? _voiceUri;
//
String? _accessAddress;
String? _accessAddressDetail;
//
String? _serviceAddress;
String? _serviceAddressDetail;
@ -110,56 +114,56 @@ class _PublishTaskPageState extends State<PublishTaskPage> {
bottomNavi: Padding(
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 32.w),
child: BeeLongButton(
onPressed: !canTap
? null
: () async {
var cancel = BotToast.showLoading();
var _voiceUrl;
if (_voiceUri != null) {
try {
var base = await NetUtil().upload(
SAASAPI.uploadFile.uploadImg,
File.fromUri(Uri(path: _voiceUri)));
if (base.success) {
_voiceUrl = base.data;
} else {
BotToast.showText(text: base.msg);
}
} catch (e) {
print(e.toString());
}
}
var imgs;
if (_photos.isNotEmpty) {
try {
imgs = await NetUtil()
.uploadFiles(_photos, SAASAPI.uploadFile.uploadImg);
} catch (e) {
print(e.toString());
}
}
var re = await TaskFunc.publish(
type: _type,
sex: _sex,
servicePersonnel: _service,
readyStartTime: _appointDate.toString(),
readyEndTime: _appointEndDate.toString(),
contact: _nameController.text,
tel: _telController.text,
accessAddress: _accessAddress!,
accessAddressDetail: _accessAddressDetail!,
serviceAddress: _serviceAddress,
serviceAddressDetail: _serviceAddressDetail,
remarks: _content,
voiceUrl: _voiceUrl,
imgUrls: imgs,
rewardType: _rewardType,
reward: _rewardController.text);
if (re) {
Get.back();
}
cancel();
},
onPressed: () async {
if (!canTap) {
return;
}
var cancel = BotToast.showLoading();
var _voiceUrl;
if (_voiceUri != null) {
try {
var base = await NetUtil().upload(SAASAPI.uploadFile.uploadImg,
File.fromUri(Uri(path: _voiceUri)));
if (base.success) {
_voiceUrl = base.data;
} else {
BotToast.showText(text: base.msg);
}
} catch (e) {
print(e.toString());
}
}
var imgs;
if (_photos.isNotEmpty) {
try {
imgs = await NetUtil()
.uploadFiles(_photos, SAASAPI.uploadFile.uploadImg);
} catch (e) {
print(e.toString());
}
}
var re = await TaskFunc.publish(
type: _type,
sex: _sex,
servicePersonnel: _service,
readyStartTime: _appointDate.toString(),
readyEndTime: _appointEndDate.toString(),
contact: _nameController.text,
tel: _telController.text,
accessAddress: _accessAddress!,
accessAddressDetail: _accessAddressDetail!,
serviceAddress: _serviceAddress,
serviceAddressDetail: _serviceAddressDetail,
remarks: _content,
voiceUrl: _voiceUrl,
imgUrls: imgs,
rewardType: _rewardType,
reward: _rewardController.text);
if (re) {
Get.back();
}
cancel();
},
text: '确认发布',
),
),
@ -176,7 +180,6 @@ class _PublishTaskPageState extends State<PublishTaskPage> {
return BeePickerBox(
onPressed: () {
Get.back();
print(_type);
setState(() {});
},
child: CupertinoPicker.builder(
@ -770,7 +773,10 @@ class _PublishTaskPageState extends State<PublishTaskPage> {
children: [
GestureDetector(
onTap: () async {
_content = await Get.to(() => TaskRemarkPage());
_content = await Get.to(() => TaskRemarkPage(
text: _content,
)) ??
'';
setState(() {});
},
child: Material(
@ -1007,36 +1013,59 @@ class _PublishTaskPageState extends State<PublishTaskPage> {
bool get canTap {
if (_type == 0) {
BotToast.showText(text: '请选择类型');
return false;
}
if (_service == 0) {
BotToast.showText(text: '请选择服务人员');
return false;
}
if (_rewardType == 0) {
BotToast.showText(text: '请选择赏金类型');
return false;
}
if (_sex == 0) {
BotToast.showText(text: '请选择性别');
return false;
}
if (_appointDate == null) {
BotToast.showText(text: '请选择预约开始时间');
return false;
}
if (_appointEndDate == null) {
BotToast.showText(text: '请选择预约结束时间');
return false;
}
if (_accessAddress == null) {
BotToast.showText(text: '请填写收取地址');
return false;
}
if (_accessAddressDetail == null) {
BotToast.showText(text: '请填写收取详细地址');
return false;
}
if (_type == 1 && _serviceAddress == null) {
BotToast.showText(text: '请填写服务地址');
return false;
}
if (_type == 1 && _accessAddressDetail == null) {
BotToast.showText(text: '请填写服务详细地址');
return false;
}
if (_rewardController.text.isEmpty) {
BotToast.showText(text: '请填写赏金');
return false;
}
if (int.parse(_rewardController.text) == 0) {
BotToast.showText(text: '赏金不能为0');
return false;
}
if (_nameController.text.isEmpty) {
BotToast.showText(text: '请填写联系人姓名');
return false;
}
if (_telController.text.isEmpty) {
BotToast.showText(text: '请填写联系人电话');
return false;
}
return true;

@ -8,7 +8,8 @@ import 'package:get/get.dart';
import 'package:velocity_x/velocity_x.dart';
class TaskRemarkPage extends StatefulWidget {
const TaskRemarkPage({Key? key}) : super(key: key);
final String? text;
const TaskRemarkPage({Key? key, this.text}) : super(key: key);
@override
_TaskRemarkPageState createState() => _TaskRemarkPageState();
@ -22,6 +23,9 @@ class _TaskRemarkPageState extends State<TaskRemarkPage> {
@override
void initState() {
_shortcutLabel = HiveStore.shortcutBox!.values.cast<String>().toList();
if (widget.text != null) {
_contentController.text = widget.text!;
}
super.initState();
}
@ -122,7 +126,7 @@ class _TaskRemarkPageState extends State<TaskRemarkPage> {
child: BeeLongButton(
onPressed: () async {
var inBox = _shortcutLabel.contains(_contentController.text);
if (!inBox&&_contentController.text.isNotEmpty) {
if (!inBox && _contentController.text.isNotEmpty) {
await HiveStore.shortcutBox!.add(_contentController.text);
}
Get.back(result: _contentController.text);

@ -1,4 +1,5 @@
import 'package:aku_new_community/extensions/num_ext.dart';
import 'package:aku_new_community/extensions/widget_list_ext.dart';
import 'package:aku_new_community/models/work_order/work_order_bill_model.dart';
import 'package:aku_new_community/widget/bee_divider.dart';
import 'package:aku_new_community/widget/buttons/bee_long_button.dart';
@ -52,7 +53,10 @@ class WorkOrderBillDialog extends StatelessWidget {
.make(),
],
))
.toList(),
.toList()
.sepWidget(
separate: 16.hb,
),
BeeDivider.horizontal(),
Row(
children: [

@ -1,7 +1,9 @@
import 'dart:math';
import 'package:aku_new_community/constants/saas_api.dart';
import 'package:aku_new_community/extensions/num_ext.dart';
import 'package:aku_new_community/extensions/widget_list_ext.dart';
import 'package:aku_new_community/models/work_order/work_order_report_model.dart';
import 'package:aku_new_community/utils/network/net_util.dart';
import 'package:aku_new_community/widget/bee_divider.dart';
import 'package:aku_new_community/widget/bee_scaffold.dart';
import 'package:aku_new_community/widget/dotted_line.dart';
import 'package:aku_new_community/widget/views/bee_grid_image_view.dart';
@ -38,27 +40,16 @@ class _HistoryReportPageState extends State<HistoryReportPage> {
firstRefresh: true,
header: MaterialHeader(),
onRefresh: () async {
// var base =
// await NetUtil().get(SAASAPI.workOrder.findRRById, params: {
// 'workOrderId': widget.id,
// });
// if (base.success) {
// _models = (base.data as List)
// .map((e) => WorkOrderReportModel.fromJson(e))
// .toList();
// setState(() {});
// }
_models.add(WorkOrderReportModel(
id: Random().nextInt(100),
type: Random().nextInt(100),
content: '${List.filled(Random().nextInt(50), 'aabb')}',
userType: Random().nextInt(2),
createId: Random().nextInt(100),
createName: 'xxx',
createDate: DateTime.now().toString(),
totalCost: '300',
imgList: [],
reportRecordVoList: []));
var base =
await NetUtil().get(SAASAPI.workOrder.findRRById, params: {
'workOrderId': widget.id,
});
if (base.success) {
_models = (base.data as List)
.map((e) => WorkOrderReportModel.fromJson(e))
.toList();
setState(() {});
}
setState(() {});
},
child: _models.isEmpty
@ -104,6 +95,14 @@ class LineCard extends StatefulWidget {
class _LineCardState extends State<LineCard> {
double _height = 0;
double get total {
double sum = 0;
for (var item in widget.model.reportRecordVoList) {
sum = sum + item.price;
}
return sum;
}
@override
void didChangeDependencies() {
WidgetsBinding.instance?.addPostFrameCallback((timeStamp) {
@ -232,6 +231,7 @@ class _LineCardState extends State<LineCard> {
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
24.hb,
...widget.model.reportRecordVoList
.map((e) => Row(
children: [
@ -250,7 +250,28 @@ class _LineCardState extends State<LineCard> {
.make(),
],
))
.toList(),
.toList()
.sepWidget(
separate: 16.hb,
),
24.hb,
BeeDivider.horizontal(),
24.hb,
Row(
children: [
'工单总费用'
.text
.size(28.sp)
.color(Colors.black.withOpacity(0.65))
.make(),
Spacer(),
'¥${total}'
.text
.size(28.sp)
.color(Color(0xFFF5222D))
.make(),
],
)
],
),
)

@ -1,14 +1,20 @@
import 'dart:io';
import 'package:aku_new_community/constants/saas_api.dart';
import 'package:aku_new_community/extensions/num_ext.dart';
import 'package:aku_new_community/ui/function_and_service/task/task_remark_page.dart';
import 'package:aku_new_community/ui/function_and_service/work_order/work_order_map.dart';
import 'package:aku_new_community/models/work_order/work_order_type_model.dart';
import 'package:aku_new_community/ui/function_and_service/work_order/work_order_func.dart';
import 'package:aku_new_community/ui/function_and_service/work_order/work_order_remark_page.dart';
import 'package:aku_new_community/utils/network/net_util.dart';
import 'package:aku_new_community/widget/beeImageNetwork.dart';
import 'package:aku_new_community/widget/bee_divider.dart';
import 'package:aku_new_community/widget/bee_scaffold.dart';
import 'package:aku_new_community/widget/buttons/bee_long_button.dart';
import 'package:aku_new_community/widget/others/user_tool.dart';
import 'package:aku_new_community/widget/picker/bee_date_picker.dart';
import 'package:aku_new_community/widget/picker/bee_pick_image_widget.dart';
import 'package:aku_new_community/widget/picker/bee_picker_box.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:common_utils/common_utils.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -24,7 +30,7 @@ class PublishWorkOrderPage extends StatefulWidget {
}
class _PublishWorkOrderPageState extends State<PublishWorkOrderPage> {
int _type = 0;
int _typeIndex = -1;
DateTime? _appointDate;
@ -33,6 +39,7 @@ class _PublishWorkOrderPageState extends State<PublishWorkOrderPage> {
TextEditingController _addressController = TextEditingController();
String _remark = '';
List<File> _photos = [];
List<WorkOrderTypeModel> _types = [];
@override
void initState() {
@ -61,14 +68,18 @@ class _PublishWorkOrderPageState extends State<PublishWorkOrderPage> {
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
CircleAvatar(
maxRadius: 50.w,
ClipOval(
child: BeeImageNetwork(
width: 100.w,
height: 100.w,
imgs: UserTool.userProvider.userInfoModel?.imgList ?? [],
),
),
16.wb,
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
'李一宣'
'${UserTool.userProvider.userInfoModel!.nickName}'
.text
.size(28.sp)
.color(Colors.black.withOpacity(0.85))
@ -86,7 +97,8 @@ class _PublishWorkOrderPageState extends State<PublishWorkOrderPage> {
onTap: () {},
child: Icon(
CupertinoIcons.chevron_right,
size: 40.w,
color: Colors.black.withOpacity(0.25),
size: 32.w,
)),
],
),
@ -96,43 +108,102 @@ class _PublishWorkOrderPageState extends State<PublishWorkOrderPage> {
],
),
),
bottomNavi: BeeLongButton(onPressed: () {}, text: '确认发布'),
bottomNavi: Padding(
padding: EdgeInsets.only(
left: 32.w,
right: 32.w,
bottom: MediaQuery.of(context).padding.bottom + 32.w),
child: BeeLongButton(
onPressed: () async {
if (!canTap) {
return;
}
var cancel = BotToast.showLoading();
var imgUrls = <String>[];
try {
imgUrls = await NetUtil()
.uploadFiles(_photos, SAASAPI.uploadFile.uploadImg);
} catch (e) {
print(e.toString());
}
try {
var re = await WorkOrderFuc.publish(
estateId: 1,
workOrderTypeId: _types[_typeIndex].id,
reserveDate: _appointDate.toString(),
reserveAddress: _appointEndDate.toString(),
content: _remark,
imgUrls: imgUrls);
if (re) {
Get.back();
}
} catch (e) {
print(e.toString());
}
cancel();
},
text: '确认发布'),
),
);
}
bool get canTap {
if (_appointDate == null) {
BotToast.showText(text: '请选择预约开始时间');
return false;
}
if (_appointEndDate == null) {
BotToast.showText(text: '请选择预约结束时间');
return false;
}
if (_typeIndex == -1) {
BotToast.showText(text: '请选择类型');
return false;
}
if (_addressController.text.isEmpty) {
BotToast.showText(text: '请输入地址');
return false;
}
if (_remark.isEmpty) {
BotToast.showText(text: '请输入具体需求');
return false;
}
return true;
}
Container _baseInfo(BuildContext context) {
var type = GestureDetector(
onTap: () async {
_type = 1;
showModalBottomSheet(
context: context,
builder: (context) {
return BeePickerBox(
onPressed: () {
Get.back();
print(_type);
setState(() {});
},
child: CupertinoPicker.builder(
itemExtent: 60.w,
childCount: WorkOrderMap.orderType.values.length,
onSelectedItemChanged: (index) {
var typeStr =
WorkOrderMap.orderType.values.toList()[index];
WorkOrderMap.orderType.forEach((key, value) {
if (value == typeStr) {
_type = key;
}
});
},
itemBuilder: (context, index) {
var str = WorkOrderMap.orderType.values.toList()[index];
return Center(
child: str.text.size(32.sp).isIntrinsic.make(),
);
}));
},
);
_typeIndex = 0;
var base = await NetUtil().get(SAASAPI.workOrder.typeList);
if (base.success) {
_types = (base.data as List)
.map((e) => WorkOrderTypeModel.fromJson(e))
.toList();
await showModalBottomSheet(
context: context,
builder: (context) {
return BeePickerBox(
onPressed: () {
Get.back();
setState(() {});
},
child: CupertinoPicker.builder(
itemExtent: 60.w,
childCount: _types.length,
onSelectedItemChanged: (index) {
_typeIndex = index;
},
itemBuilder: (context, index) {
var str = _types[index].name;
return Center(
child: str.text.size(32.sp).isIntrinsic.make(),
);
}));
},
);
}
},
child: Material(
color: Colors.transparent,
@ -146,14 +217,15 @@ class _PublishWorkOrderPageState extends State<PublishWorkOrderPage> {
.color(Colors.black.withOpacity(0.45))
.make(),
),
'${_type == 0 ? '请选择分类' : WorkOrderMap.orderType[_type]}'
'${_typeIndex == -1 ? '请选择分类' : _types[_typeIndex].name}'
.text
.size(28.sp)
.color(Colors.black.withOpacity(_type == 0 ? 0.25 : 0.85))
.color(Colors.black.withOpacity(_typeIndex == -1 ? 0.25 : 0.85))
.make(),
Spacer(),
Icon(
CupertinoIcons.chevron_right,
color: Colors.black.withOpacity(0.25),
size: 24.w,
),
],
@ -179,10 +251,12 @@ class _PublishWorkOrderPageState extends State<PublishWorkOrderPage> {
child: Material(
color: Colors.transparent,
child:
'${DateUtil.formatDate(_appointDate, format: DateFormats.zh_mo_d_h_m)}'
'${_appointDate == null ? '请选择开始时间' : DateUtil.formatDate(_appointDate, format: DateFormats.zh_mo_d_h_m)}'
.text
.size(24.sp)
.color(Colors.black.withOpacity(0.85))
.align(TextAlign.start)
.color(Colors.black
.withOpacity(_appointDate == null ? 0.25 : 0.85))
.make(),
),
),
@ -197,16 +271,20 @@ class _PublishWorkOrderPageState extends State<PublishWorkOrderPage> {
child: Material(
color: Colors.transparent,
child:
'${DateUtil.formatDate(_appointEndDate, format: DateFormats.zh_mo_d_h_m)}'
'${_appointDate == null ? '请选择结束时间' : DateUtil.formatDate(_appointEndDate, format: DateFormats.zh_mo_d_h_m)}'
.text
.size(24.sp)
.color(Colors.black.withOpacity(_type == 0 ? 0.25 : 0.85))
.align(TextAlign.end)
.color(Colors.black
.withOpacity(_appointEndDate == null ? 0.25 : 0.85))
.make(),
),
),
),
24.wb,
Icon(
CupertinoIcons.chevron_right,
color: Colors.black.withOpacity(0.25),
size: 24.w,
),
],
@ -242,7 +320,10 @@ class _PublishWorkOrderPageState extends State<PublishWorkOrderPage> {
);
var remark = GestureDetector(
onTap: () async {
_remark = await Get.to(() => TaskRemarkPage());
_remark = await Get.to(() => WorkOrderRemarkPage(
text: _remark,
)) ??
'';
setState(() {});
},
child: Material(
@ -251,14 +332,14 @@ class _PublishWorkOrderPageState extends State<PublishWorkOrderPage> {
children: [
SizedBox(
width: 170.w,
child: '任务备注'
child: '具体需求'
.text
.size(28.sp)
.color(Colors.black.withOpacity(0.45))
.make(),
),
Expanded(
child: '${_remark.isEmpty ? '请输入任务备注' : _remark}'
child: '${_remark.isEmpty ? '请输入具体需求' : _remark}'
.text
.size(28.sp)
.color(
@ -268,6 +349,7 @@ class _PublishWorkOrderPageState extends State<PublishWorkOrderPage> {
20.wb,
Icon(
CupertinoIcons.chevron_right,
color: Colors.black.withOpacity(0.25),
size: 24.w,
),
],
@ -282,6 +364,7 @@ class _PublishWorkOrderPageState extends State<PublishWorkOrderPage> {
borderRadius: BorderRadius.circular(16.w),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
32.hb,
type,
@ -316,9 +399,11 @@ class _PublishWorkOrderPageState extends State<PublishWorkOrderPage> {
],
),
24.hb,
BeePickImageWidget(onChanged: (value) {
_photos = value;
}),
BeePickImageWidget(
maxCount: 6,
onChanged: (value) {
_photos = value;
}),
],
),
);

@ -56,7 +56,7 @@ class WorkOrderCard extends StatelessWidget {
GestureDetector(
onTap: () {
Get.to(() => WorkOrderDetailPage(
model: model,
id: model.id,
));
},
child: ClipPath(
@ -124,7 +124,10 @@ class WorkOrderCard extends StatelessWidget {
.make(),
24.hb,
BeeHorImageView(
maxCount: 4, imgs: [], imgWidth: 146.w, imgHeight: 146.w),
maxCount: 4,
imgs: model.imgList ?? [],
imgWidth: 146.w,
imgHeight: 146.w),
24.hb,
Row(
children: [
@ -135,14 +138,6 @@ class WorkOrderCard extends StatelessWidget {
.color(Colors.black.withOpacity(0.45))
.make(),
Spacer(),
24.wb,
GestureDetector(
onTap: () {},
child: Icon(
CupertinoIcons.ellipsis_vertical,
size: 40.w,
),
)
],
),
],

@ -2,11 +2,12 @@ import 'package:aku_new_community/constants/saas_api.dart';
import 'package:aku_new_community/extensions/num_ext.dart';
import 'package:aku_new_community/gen/assets.gen.dart';
import 'package:aku_new_community/models/work_order/work_order_detail_model.dart';
import 'package:aku_new_community/models/work_order/work_order_list_model.dart';
import 'package:aku_new_community/models/work_order/work_order_progress_model.dart';
import 'package:aku_new_community/ui/function_and_service/task/dialogs/task_evaluation_dialog.dart';
import 'package:aku_new_community/ui/function_and_service/work_order/dialogs/urge_dialog.dart';
import 'package:aku_new_community/ui/function_and_service/work_order/dialogs/work_order_bill_dialog.dart';
import 'package:aku_new_community/ui/function_and_service/work_order/dialogs/work_order_finish_dialog.dart';
import 'package:aku_new_community/ui/function_and_service/work_order/dialogs/work_order_progress_dialog.dart';
import 'package:aku_new_community/ui/function_and_service/work_order/team_list_page.dart';
import 'package:aku_new_community/ui/function_and_service/work_order/work_order_func.dart';
import 'package:aku_new_community/ui/function_and_service/work_order/work_order_map.dart';
@ -29,9 +30,12 @@ import 'package:velocity_x/src/extensions/num_ext.dart';
import 'package:velocity_x/src/extensions/string_ext.dart';
class WorkOrderDetailPage extends StatefulWidget {
final WorkOrderListModel model;
final int id;
const WorkOrderDetailPage({Key? key, required this.model}) : super(key: key);
const WorkOrderDetailPage({
Key? key,
required this.id,
}) : super(key: key);
@override
_WorkOrderDetailPageState createState() => _WorkOrderDetailPageState();
@ -51,61 +55,87 @@ class _WorkOrderDetailPageState extends State<WorkOrderDetailPage> {
Widget build(BuildContext context) {
return BeeScaffold(
title: '',
extendBody: true,
body: Stack(
children: [
Container(
width: double.infinity,
height: 380.w,
decoration: BoxDecoration(
gradient: _getLiner,
),
child: Column(
children: [
150.w.heightBox,
Row(
children: [
Padding(
padding: EdgeInsets.symmetric(horizontal: 32.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
_model == null
? Container()
: Container(
width: double.infinity,
height: 380.w,
decoration: BoxDecoration(
gradient: _getLiner,
),
child: Column(
children: [
150.w.heightBox,
Row(
children: [
GestureDetector(
onTap: () async {},
child: Material(
color: Colors.transparent,
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
'${WorkOrderMap.orderStatus[_model?.status] ?? ''}'
.text
.size(40.sp)
.color(Colors.black)
.bold
.make(),
],
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 32.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
GestureDetector(
onTap: () async {
var base = await NetUtil().get(
SAASAPI.workOrder.findScheduleById,
params: {'workOrderId': widget.id});
if (base.success) {
var models = (base.data as List)
.map((e) =>
WorkOrderProgressModel.fromJson(
e))
.toList();
await Get.bottomSheet(
WorkOrderProgressDialog(
models: models));
} else {
BotToast.showText(text: base.msg);
}
},
child: Material(
color: Colors.transparent,
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
'${WorkOrderMap.orderStatus[_model?.status] ?? ''}'
.text
.size(40.sp)
.color(Colors.black)
.bold
.make(),
16.wb,
Icon(
CupertinoIcons.chevron_right,
size: 32.w,
color: Colors.black.withOpacity(0.65),
)
],
),
),
),
'${WorkOrderMap.subStatusString[_model?.status] ?? ''}'
.text
.size(24.sp)
.color(Colors.black.withOpacity(0.45))
.make(),
],
),
),
'${WorkOrderMap.subStatusString[_model?.status] ?? ''}'
.text
.size(24.sp)
.color(Colors.black.withOpacity(0.45))
.make(),
Spacer(),
],
),
),
Spacer(),
],
],
),
),
],
),
),
SafeArea(
child: EasyRefresh(
firstRefresh: true,
header: MaterialHeader(),
onRefresh: () async {
var base = await NetUtil().get(SAASAPI.workOrder.findById);
var base = await NetUtil().get(SAASAPI.workOrder.findById,
params: {'workOrderId': widget.id});
if (base.success) {
_model = WorkOrderDetailModel.fromJson(base.data);
setState(() {});
@ -118,7 +148,8 @@ class _WorkOrderDetailPageState extends State<WorkOrderDetailPage> {
EdgeInsets.only(top: 120.w, left: 32.w, right: 32.w),
children: [
Offstage(
offstage: _model!.servicePersonnelImgList == null,
offstage: _model!.servicePersonnelImgList == null ||
_model!.servicePersonnelImgList!.isEmpty,
child: Column(
children: [
_servicePeople(),
@ -135,7 +166,12 @@ class _WorkOrderDetailPageState extends State<WorkOrderDetailPage> {
)),
],
),
bottomNavi: _getBottomButton(),
bottomNavi: Padding(
padding: EdgeInsets.only(
left: 32.w,
right: 32.w,
bottom: MediaQuery.of(context).padding.bottom + 32.w),
child: _getBottomButton()),
);
}
@ -183,7 +219,7 @@ class _WorkOrderDetailPageState extends State<WorkOrderDetailPage> {
return BeeLongButton(
onPressed: () async {
await Get.bottomSheet(UrgeDialog(onConfirm: () async {
var re = await WorkOrderFuc.promotionRate(_model!.id);
var re = await WorkOrderFuc.promotionRate(widget.id);
if (re) {
_refreshController.callRefresh();
}
@ -195,7 +231,7 @@ class _WorkOrderDetailPageState extends State<WorkOrderDetailPage> {
return BeeLongButton(
onPressed: () async {
await Get.bottomSheet(WorkOrderFinishDialog(onConfirm: () async {
var re = await WorkOrderFuc.confirmComplete(_model!.id);
var re = await WorkOrderFuc.confirmComplete(widget.id);
if (re) {
Get.back();
_refreshController.callRefresh();
@ -206,7 +242,7 @@ class _WorkOrderDetailPageState extends State<WorkOrderDetailPage> {
case 6:
return BeeLongButton(
onPressed: () async {
var bills = await WorkOrderFuc.getBill(workOrderId: _model!.id);
var bills = await WorkOrderFuc.getBill(workOrderId: widget.id);
await Get.bottomSheet(WorkOrderBillDialog(models: bills));
},
text: '确认支付');
@ -216,9 +252,7 @@ class _WorkOrderDetailPageState extends State<WorkOrderDetailPage> {
await Get.bottomSheet(TaskEvaluationDialog(
evaluate: (star, content) async {
return await WorkOrderFuc.evaluate(
workOrderId: widget.model.id,
star: star,
evaluation: content);
workOrderId: widget.id, star: star, evaluation: content);
},
));
},
@ -277,6 +311,7 @@ class _WorkOrderDetailPageState extends State<WorkOrderDetailPage> {
borderRadius: BorderRadius.circular(12.w),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
'服务人员名单'
.text
@ -394,7 +429,7 @@ class _WorkOrderDetailPageState extends State<WorkOrderDetailPage> {
.make(),
24.hb,
BeeGridImageView(
urls: [],
urls: (_model!.imgList ?? []).map((e) => e.url).toList(),
),
24.hb,
],

@ -63,4 +63,27 @@ class WorkOrderFuc {
}
return models;
}
///
static Future<bool> publish({
required int estateId,
required int workOrderTypeId,
required String reserveDate,
required String reserveAddress,
required String content,
required List<String> imgUrls,
}) async {
var base = await NetUtil().post(SAASAPI.workOrder.insert,
params: {
'estateId': estateId,
'workOrderTypeId': workOrderTypeId,
'reserveDate': reserveDate,
'reserveAddress': reserveAddress,
'content': content,
'imgUrls': imgUrls,
},
showMessage: true);
return base.success;
}
}

@ -1,7 +1,4 @@
class WorkOrderMap {
static Map<int, String> orderType = {
1: '报事报修',
};
static Map<int, String> orderStatus = {
1: '待分配',
2: '工单池',

@ -1,6 +1,6 @@
import 'package:aku_new_community/constants/saas_api.dart';
import 'package:aku_new_community/models/work_order/work_order_list_model.dart';
import 'package:aku_new_community/ui/function_and_service/work_order/history_report_page.dart';
import 'package:aku_new_community/ui/function_and_service/work_order/publish_work_order_page.dart';
import 'package:aku_new_community/ui/function_and_service/work_order/work_order_card.dart';
import 'package:aku_new_community/utils/network/net_util.dart';
import 'package:aku_new_community/widget/bee_scaffold.dart';
@ -48,10 +48,7 @@ class _WorkOrderPageState extends State<WorkOrderPage>
actions: [
IconButton(
onPressed: () {
// Get.to(() => PublishWorkOrderPage());
Get.to(() => HistoryReportPage(
id: 1,
));
Get.to(() => PublishWorkOrderPage());
},
icon: Icon(
CupertinoIcons.plus_circle,
@ -71,12 +68,14 @@ class _WorkOrderPageState extends State<WorkOrderPage>
Widget _getOrderView(int index) {
return EasyRefresh(
firstRefresh: true,
header: MaterialHeader(),
onRefresh: () async {
_page = 1;
var base = await NetUtil().getList(SAASAPI.workOrder.list, params: {
'pageNum': _page,
'size': _size,
'status': index,
'status': index == 0 ? null : index,
});
_models =
base.rows.map((e) => WorkOrderListModel.fromJson(e)).toList();
@ -87,7 +86,7 @@ class _WorkOrderPageState extends State<WorkOrderPage>
var base = await NetUtil().getList(SAASAPI.workOrder.list, params: {
'pageNum': _page,
'size': _size,
'status': index + 1,
'status': index == 0 ? null : index,
});
if (_models.length < base.total) {
_models.addAll(

@ -0,0 +1,196 @@
import 'package:aku_new_community/utils/hive_store.dart';
import 'package:aku_new_community/widget/bee_scaffold.dart';
import 'package:aku_new_community/widget/buttons/bee_long_button.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:velocity_x/velocity_x.dart';
class WorkOrderRemarkPage extends StatefulWidget {
final String? text;
const WorkOrderRemarkPage({Key? key, this.text}) : super(key: key);
@override
_WorkOrderRemarkPageState createState() => _WorkOrderRemarkPageState();
}
class _WorkOrderRemarkPageState extends State<WorkOrderRemarkPage> {
TextEditingController _contentController = TextEditingController();
List<String> _shortcutLabel = [];
bool _edit = false;
@override
void initState() {
_shortcutLabel =
HiveStore.workOrderShortBox!.values.cast<String>().toList();
if (widget.text != null) {
_contentController.text = widget.text!;
}
super.initState();
}
@override
void dispose() {
_contentController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return BeeScaffold(
title: '添加需求',
body: ListView(
padding: EdgeInsets.all(32.w),
children: [
Container(
padding: EdgeInsets.all(32.w),
decoration: BoxDecoration(
color: Colors.white, borderRadius: BorderRadius.circular(16.w)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
'具体需求'
.text
.size(28.sp)
.color(Colors.black.withOpacity(0.45))
.make(),
],
),
32.w.heightBox,
Container(
width: double.infinity,
padding: EdgeInsets.symmetric(horizontal: 24.w),
decoration: BoxDecoration(
color: Colors.black.withOpacity(0.06),
borderRadius: BorderRadius.circular(16.w)),
child: TextField(
controller: _contentController,
autofocus: false,
onChanged: (text) => setState(() {}),
minLines: 5,
maxLength: 200,
maxLines: 20,
decoration: InputDecoration(
border: InputBorder.none,
),
),
),
32.w.heightBox,
Row(
children: [
'快捷标签'
.text
.size(24.sp)
.color(Colors.black.withOpacity(0.45))
.make(),
Spacer(),
GestureDetector(
onTap: () {
_edit = !_edit;
setState(() {});
},
child: Material(
color: Colors.transparent,
child: Row(
children: [
'${_edit ? '保存' : '编辑'}'
.text
.size(24.sp)
.color(Colors.black.withOpacity(0.45))
.make(),
],
),
),
),
],
),
32.w.heightBox,
Wrap(
spacing: 12.w,
runSpacing: 12.w,
children: _shortcutLabel
.mapIndexed((currentValue, index) =>
label(currentValue, _edit, index))
.toList(),
),
],
),
),
],
),
bottomNavi: Padding(
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 32.w),
child: BeeLongButton(
onPressed: () async {
var inBox = _shortcutLabel.contains(_contentController.text);
if (!inBox && _contentController.text.isNotEmpty) {
await HiveStore.workOrderShortBox!.add(_contentController.text);
}
Get.back(result: _contentController.text);
},
text: '完成',
),
),
);
}
Widget label(String text, bool edit, int index) {
var textHandled = '';
if (text.length > 10) {
textHandled = text.replaceRange(10, null, '');
} else {
textHandled = text;
}
return Stack(
clipBehavior: Clip.none,
children: [
GestureDetector(
onTap: () {
_contentController.text = text;
setState(() {});
},
child: Material(
color: Colors.transparent,
child: FittedBox(
child: Container(
height: 60.w,
padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 8.w),
alignment: Alignment.center,
decoration: BoxDecoration(
border: Border.all(color: Colors.black.withOpacity(0.25)),
borderRadius: BorderRadius.circular(8.w)),
child: textHandled.text
.size(22.sp)
.color(Colors.black.withOpacity(0.45))
.make(),
),
),
),
),
if (edit)
Positioned(
top: -10.w,
right: -10.w,
child: GestureDetector(
onTap: () {
_shortcutLabel.removeAt(index);
HiveStore.workOrderShortBox!.deleteAt(index);
setState(() {});
},
child: Material(
child: Icon(
CupertinoIcons.xmark_circle_fill,
size: 40.w,
color: Colors.black.withOpacity(0.45),
),
),
))
],
);
}
}

@ -1,13 +1,5 @@
import 'dart:async';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart';
import 'package:aku_new_community/base/base_style.dart';
import 'package:aku_new_community/gen/assets.gen.dart';
import 'package:aku_new_community/model/user/adress_model.dart';
@ -21,6 +13,13 @@ import 'package:aku_new_community/ui/market/shop_car/shop_car_page.dart';
import 'package:aku_new_community/utils/headers.dart';
import 'package:aku_new_community/widget/bee_divider.dart';
import 'package:aku_new_community/widget/bee_scaffold.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart';
import 'good_detail_bottomSheet.dart';
class GoodDetailPage extends StatefulWidget {
@ -258,7 +257,7 @@ class _GoodDetailPageState extends State<GoodDetailPage> {
height: 100.w,
width: double.infinity,
child: Text(
(_goodDetail!.skuName ?? ''),
(_goodDetail!.skuName),
style: TextStyle(
fontSize: 36.sp,
fontWeight: FontWeight.bold,
@ -267,7 +266,7 @@ class _GoodDetailPageState extends State<GoodDetailPage> {
overflow: TextOverflow.ellipsis,
),
),
_getIcon(_goodDetail!.kind ?? 0),
_getIcon(_goodDetail!.kind),
24.hb,
Row(
crossAxisAlignment: CrossAxisAlignment.center,
@ -326,13 +325,13 @@ class _GoodDetailPageState extends State<GoodDetailPage> {
height: 80.w,
width: double.infinity,
child: Text(
(_goodDetail!.skuName ?? ''),
(_goodDetail!.skuName),
style: TextStyle(fontSize: 28.sp, color: ktextPrimary),
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
),
_getIcon(_goodDetail!.kind ?? 0),
_getIcon(_goodDetail!.kind),
Spacer(),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
@ -340,15 +339,15 @@ class _GoodDetailPageState extends State<GoodDetailPage> {
16.wb,
'原价:'.text.color(Color(0xFFBBBBBB)).size(24.sp).make(),
Text(
(_goodDetail!.discountPrice).toStringAsFixed(2),
(_goodDetail!.discountPrice)?.toStringAsFixed(2) ?? '0.0',
style: TextStyle(fontSize: 24.sp, color: Color(0xFFBBBBBB)),
),
50.wb,
'折扣:'.text.color(Color(0xFFBBBBBB)).size(24.sp).make(),
Text(
(_goodDetail!.discountPrice) > (_goodDetail!.sellPrice)
((_goodDetail!.discountPrice) ?? 0.0) > (_goodDetail!.sellPrice)
? _getDiscount(_goodDetail!.sellPrice.toDouble(),
_goodDetail!.discountPrice.toDouble())
_goodDetail!.discountPrice?.toDouble() ?? 0.0)
: '暂无折扣',
style: TextStyle(fontSize: 24.sp, color: Color(0xFFBBBBBB)),
),

@ -439,7 +439,7 @@ class _SubmitOrderNormalPageState extends State<SubmitOrderNormalPage> {
var top = RichText(
text: TextSpan(children: [
WidgetSpan(
child: _getKindWd(model.kind ?? 0),
child: _getKindWd(model.kind),
),
TextSpan(
text: model.skuName,

@ -1,6 +1,7 @@
import 'package:aku_new_community/model/user/province_model.dart';
import 'package:aku_new_community/models/login/china_region_model.dart';
import 'package:aku_new_community/models/login/history_login_model.dart';
import 'package:aku_new_community/models/login/picked_city_model.dart';
import 'package:aku_new_community/models/user/user_config_model.dart';
import 'package:flutter/foundation.dart';
import 'package:hive/hive.dart';
@ -20,6 +21,10 @@ class HiveStore {
static Box? get shortcutBox => _shortcutBox;
static Box? _workOrderShortBox;
static Box? get workOrderShortBox => _workOrderShortBox;
static Future init() async {
if (!kIsWeb) {
var dir = await getApplicationDocumentsDirectory();
@ -30,10 +35,12 @@ class HiveStore {
Hive.registerAdapter(ChinaRegionModelAdapter()); //HiveTypeId:3
Hive.registerAdapter(HistoryLoginModelAdapter()); //HiveTypeId:4
Hive.registerAdapter(UserConfigModelAdapter()); //HiveTypeId:5
Hive.registerAdapter(PickedCityModelAdapter()); //HiveTypeId:6
_appBox = await Hive.openBox('app');
_userBox = await Hive.openBox('userBox');
_dataBox = await Hive.openBox('dataBox');
_shortcutBox = await Hive.openBox('shortcut');
_workOrderShortBox = await Hive.openBox('workOrderShort');
}
}
}

@ -26,7 +26,7 @@ class StackAvatar extends StatelessWidget {
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(22.w + 2.w),
border: Border.all(color: Color(0xFF999999)),
// border: Border.all(color: Color(0xFF999999)),
),
clipBehavior: Clip.antiAlias,
child: BeeImageNetwork(

@ -1,13 +1,11 @@
import 'dart:io';
import 'package:aku_new_community/utils/headers.dart';
import 'package:flutter/cupertino.dart';
import 'package:get/get.dart';
import 'package:image_picker/image_picker.dart';
import 'package:velocity_x/velocity_x.dart';
import 'package:aku_new_community/utils/headers.dart';
class BeeImagePicker {
static Future<File?> pick(
{required String title,

@ -3,6 +3,7 @@ import 'dart:io';
import 'package:aku_new_community/gen/assets.gen.dart';
import 'package:aku_new_community/widget/picker/bee_image_picker.dart';
import 'package:aku_new_community/widget/picker/bee_image_preview.dart';
// Package imports:
import 'package:dotted_border/dotted_border.dart';
import 'package:flutter/cupertino.dart';
@ -14,9 +15,13 @@ class BeePickImageWidget extends StatefulWidget {
final double? size;
final Function(List<File> files) onChanged;
final String description;
final int? maxCount;
BeePickImageWidget(
{Key? key, this.size, required this.onChanged, this.description = '上传照片'})
{Key? key,
this.size,
required this.onChanged,
this.description = '上传照片',
this.maxCount})
: super(key: key);
@override
@ -35,48 +40,52 @@ class _BeePickImageWidgetState extends State<BeePickImageWidget> {
runSpacing: 10.w,
children: [
..._files.map((e) => showImage(e)).toList(),
GestureDetector(
onTap: () async {
await BeeImagePicker.pick(title: '选择图片').then(
(value) {
if (value != null) {
_files.add(
File(value.path),
);
}
},
);
widget.onChanged(_files);
setState(() {});
},
child: DottedBorder(
color: Colors.black.withOpacity(0.25),
borderType: BorderType.RRect,
strokeWidth: 2.w,
dashPattern: [6, 3],
radius: Radius.circular(8.w),
child: Container(
width: widget.size ?? 160.w,
height: widget.size ?? 160.w,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Image.asset(
Assets.icons.camera.path,
width: 60.w,
height: 60.w,
color: Color(0xFF999999),
),
4.w.heightBox,
widget.description.text
.color(Colors.black.withOpacity(0.45))
.size(22.sp)
.make(),
],
Offstage(
offstage:
widget.maxCount != null && _files.length >= widget.maxCount!,
child: GestureDetector(
onTap: () async {
await BeeImagePicker.pick(title: '选择图片').then(
(value) {
if (value != null) {
_files.add(
File(value.path),
);
}
},
);
widget.onChanged(_files);
setState(() {});
},
child: DottedBorder(
color: Colors.black.withOpacity(0.25),
borderType: BorderType.RRect,
strokeWidth: 2.w,
dashPattern: [6, 3],
radius: Radius.circular(8.w),
child: Container(
width: widget.size ?? 160.w,
height: widget.size ?? 160.w,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Image.asset(
Assets.icons.camera.path,
width: 60.w,
height: 60.w,
color: Color(0xFF999999),
),
4.w.heightBox,
widget.description.text
.color(Colors.black.withOpacity(0.45))
.size(22.sp)
.make(),
],
),
),
),
).material(color: Colors.transparent),
).material(color: Colors.transparent),
),
)
],
);
@ -84,17 +93,25 @@ class _BeePickImageWidgetState extends State<BeePickImageWidget> {
Widget showImage(File file) {
return Stack(children: [
Container(
width: widget.size ?? 160.w,
height: widget.size ?? 160.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.w),
color: Colors.black.withOpacity(0.03)),
child: Image.file(file,fit: BoxFit.cover,),
GestureDetector(
onTap: () async {
await BeeImagePreview.toFile(file: file);
},
child: Container(
width: widget.size ?? 160.w,
height: widget.size ?? 160.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.w),
color: Colors.black.withOpacity(0.03)),
child: Image.file(
file,
fit: BoxFit.cover,
),
),
),
Positioned(
top: 8.w,
right: 8.w,
top: 0.w,
right: 0.w,
child: Container(
width: 40.w,
height: 40.w,

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save