Commit 525bb2cad7388df1d862f5483b6930251dee65e6

Authored by wdn127929
1 parent dc8619e4

店铺信息页面的可预定时段bug修复OK

... ... @@ -859,15 +859,22 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> {
// if (data.length == 1) {
// return '30';
// } else {
if (value[1] == 0) {
Map map = data[value[0]];
int minute = map.values.last[value[1]];
if (minute == 0) {
return '00';
} else if (value[1] == 1) {
return '15';
} else if (value[1] == 2) {
return '30';
} else {
return '45';
}
return '${minute}';
// if (value[1] == 0) {
// return '00';
// } else if (value[1] == 1) {
// return '15';
// } else if (value[1] == 2) {
// return '30';
// } else {
// return '45';
// }
// }
}
... ...
... ... @@ -7248,6 +7248,73 @@ class DialogUtil {
});
}
//显示选择可预定时段
static Future<List<int>> showSelectCusmanTimerDialog(
BuildContext context, List<dynamic> data, ValueChanged valueChanged,
{List<int> selecteds,
Color cancelTextColor = const Color.fromRGBO(0, 0, 0, 0.6),
String title = '',
VoidCallback onCancel,
String cancelText = '取消'}) {
return Picker(
selecteds: selecteds,
adapter: PickerDataAdapter<String>(pickerData: data),
height: ScreenUtil().setWidth(480),
hideHeader: false,
headerDecoration: BoxDecoration(
color: MyColours.color_ffffff,
border: Border(
bottom: BorderSide(
width: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7),
)),
title: Text(
title,
style: TextStyle(
fontWeight: FontWeight.bold,
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(32)),
),
cancelText: cancelText,
cancelTextStyle:
TextStyle(color: cancelTextColor, fontSize: ScreenUtil().setSp(32)),
confirmText: "确定",
itemExtent: ScreenUtil().setWidth(80),
confirmTextStyle: TextStyle(
color: MyColours.color_438E93, fontSize: ScreenUtil().setSp(32)),
selectedTextStyle: TextStyle(
color: MyColours.color_000000, fontSize: ScreenUtil().setSp(32)),
textStyle: TextStyle(
color: Color.fromRGBO(0, 0, 0, 0.26),
fontSize: ScreenUtil().setSp(32)),
selectionOverlay: Container(
height: ScreenUtil().setWidth(80),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
width: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7),
top: BorderSide(
width: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7))),
),
onCancel: onCancel,
onConfirm: (Picker picker, List value) {
Map map = data[value[0]];
List list = map.values.last;
if (list.length == 1) {
value[1] = 0;
}
print(value.toString());
if (valueChanged != null) {
valueChanged(value);
}
}).showModal<List<int>>(context).then((value) {
LogUtil.v("value:${value.toString()}");
return value;
});
}
//显示选择客户经理弹框
static Future<List<int>> showSelectCusmanDialog(
BuildContext context, List<dynamic> data, ValueChanged valueChanged,
... ...
... ... @@ -2294,12 +2294,36 @@ class Utils {
static getPickerData(String lastTime, List dateData) {
String hour = Utils.getHourFromhourAndMinute(lastTime);
String minute = Utils.getMinuteFromhourAndMinute(lastTime);
if (minute == '45') {
hour = '${int.parse(hour) + 1}';
}
List tempList = List();
// if (minute == '45') {
// hour = '${int.parse(hour) + 1}';
// }
tempList.addAll(dateData);
tempList.removeRange(0, int.parse(hour));
// if (minute != '45') {
Map<String, List<int>> map = tempList[0];
Map mapNew = {};
// map.map((key, value) {
// mapNew[key]
// });
List<int> list = [];
map.forEach((key, value) {
value.forEach((element) {
if (int.parse(minute) <= element) {
list.add(element);
}
});
mapNew[key] = list;
});
tempList.removeAt(0);
tempList.insert(0, mapNew);
// }
// tempList.replaceRange(0, 0, mapNew);
if (tempList.length == 0) {
tempList = [
{
... ...
... ... @@ -198,11 +198,11 @@ class SetTimeWidget {
showTimeSelector(
context, data, hourAndMinute, SetTimeCallback setTimeCallback) {
DialogUtil.showSelectCusmanDialog(context, data, (value) {
DialogUtil.showSelectCusmanTimerDialog(context, data, (value) {
setTimeCallback(value);
}, selecteds: [
_getFirSelected(hourAndMinute, data),
_getSecSelected(hourAndMinute)
_getSecSelected(hourAndMinute, data)
]).then((value) {
print(value);
});
... ... @@ -222,15 +222,22 @@ class SetTimeWidget {
}
// 第二列当前选中第几个
_getSecSelected(String hourAndMinute) {
_getSecSelected(String hourAndMinute, List data) {
String minute = Utils.getMinuteFromhourAndMinute(hourAndMinute);
if (minute == '00') {
return 0;
} else if (minute == '15') {
return 1;
} else if (minute == '30') {
return 2;
}
return 3;
int indexLeft = _getFirSelected(hourAndMinute, data); //第一列选中的index
Map map = data[indexLeft];
List list = map.values.last;
int item = int.parse(minute);
return list.indexOf(item);
// if (minute == '00') {
// return 0;
// } else if (minute == '15') {
// return 1;
// } else if (minute == '30') {
// return 2;
// }
// return 3;
}
}
... ...