Commit b0cda2c4dd1dfaa6297beae5be87327bc1740b38

Authored by wdn127929
1 parent 893b0a2d

已预订列表展示核餐结果&删除订金权限(自己录入的可以删除)

import 'dart:convert';
import 'package:json_annotation/json_annotation.dart';
import 'package:one_key/models/reserve_recheck_model.dart';
import 'package:one_key/utils/utils.dart';
part 'notebook.g.dart';
... ... @@ -59,6 +60,8 @@ class Notebook {
bool large = false;
String place_order_name; //下单人
List<ReserveRecheckSunModel> reserveRecheckType;
// String get tableinfoStr {
// return name +
// "\n" +
... ... @@ -134,10 +137,14 @@ class Notebook {
}
String get operationText {
String type;
if (reserveRecheckType != null && reserveRecheckType.length > 0) {
type = reserveRecheckType.last.typeShow;
}
switch (status) {
//订单状态 0:待确认,1:已定座,2:确认到店,3:用餐完成,4:取消预订
case "1":
return "";
return type ?? "";
case "2":
return "已到店";
case "3":
... ... @@ -145,9 +152,9 @@ class Notebook {
case "4":
return "已取消";
case "6":
return "";
return type ?? "";
default:
return "";
return type ?? "";
}
}
... ...
... ... @@ -7,6 +7,14 @@ part of 'notebook.dart';
// **************************************************************************
Notebook _$NotebookFromJson(Map<String, dynamic> json) {
List reserveR = json['reserve_recheck_type'];
List<ReserveRecheckSunModel> data = [];
if (reserveR != null && reserveR.length > 0) {
data = <ReserveRecheckSunModel>[];
json['reserve_recheck_type'].forEach((v) {
data.add(new ReserveRecheckSunModel.fromJson(v));
});
}
return Notebook()
..tableinfo = json['tableinfo'] as String
..id = json['id'] as String
... ... @@ -54,7 +62,8 @@ Notebook _$NotebookFromJson(Map<String, dynamic> json) {
..orderInfo = json['order_info'] == null
? null
: OrderInfo.fromJson(json['order_info'] as Map<String, dynamic>)
..place_order_name = json['place_order_name'] ?? '';
..place_order_name = json['place_order_name'] ?? ''
..reserveRecheckType = data;
}
Map<String, dynamic> _$NotebookToJson(Notebook instance) => <String, dynamic>{
... ...
... ... @@ -41,6 +41,8 @@ class ReserveDepositSunModel {
String cdate;
String nickName;
String insertUid;
String get payTimeStr {
if (payTime.toString() == '0') {
return '';
... ... @@ -60,7 +62,8 @@ class ReserveDepositSunModel {
this.payType,
this.payNo,
this.cdate,
this.nickName});
this.nickName,
this.insertUid});
ReserveDepositSunModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
... ... @@ -73,6 +76,7 @@ class ReserveDepositSunModel {
payNo = json['pay_no'];
cdate = json['cdate'];
nickName = json['nick_name'] ?? '';
insertUid = json['insert_uid'];
}
Map<String, dynamic> toJson() {
... ... @@ -87,6 +91,8 @@ class ReserveDepositSunModel {
data['pay_no'] = this.payNo;
data['cdate'] = this.cdate;
data['nick_name'] = this.nickName;
data['insert_uid'] = this.insertUid;
return data;
}
}
... ...
... ... @@ -177,7 +177,8 @@ class _BookDepositPageState extends State<BookDepositPage> {
.toString(),
'pay_type': payTypeIndex == null ? null : payType[payTypeIndex],
'pay_no': receiptNumberC.text
'pay_no': receiptNumberC.text,
'insert_uid':Provider.of<UserModel>(context,listen: false).user.openid
};
print(feastModel.sellerManageList[collectionPIndex].title);
bool success = await detailModel.createReserveDeposit(context, pramas);
... ...
... ... @@ -1440,22 +1440,26 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
color: MyColours.color_515151,
fontSize: font(14)),
),
InkWell(
onTap: () {
//弹框确认是否删除
DialogUtil.cupertinoAlertDialog(context,
title: "",
content: "是否确定删除?",
isBoldContent: true,
contentColor: MyColours.color_E6000000,
rTitle: "删除", rCallback: () {
_delReserveDepositByid(data.id);
});
},
child: Image.asset(
Utils.getImgPath('delete_g'),
width: w(20),
))
if (Provider.of<UserModel>(context, listen: false)
.user
.openid ==
data.insertUid)
InkWell(
onTap: () {
//弹框确认是否删除
DialogUtil.cupertinoAlertDialog(context,
title: "",
content: "是否确定删除?",
isBoldContent: true,
contentColor: MyColours.color_E6000000,
rTitle: "删除", rCallback: () {
_delReserveDepositByid(data.id);
});
},
child: Image.asset(
Utils.getImgPath('delete_g'),
width: w(20),
))
],
),
),
... ... @@ -3481,46 +3485,44 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
// ),
// ),
// )),
if( detailEntity.order.cookbooklist
.length >
0)
Expanded(
flex: 1,
child: InkWell(
onTap: () {
NavigatorUtil
.goHasOrderFoodPage(
context,
rid: detailEntity
.id);
},
child: Container(
margin: EdgeInsets.only(
left: ScreenUtil()
.setWidth(20)),
decoration: BoxDecoration(
color: MyColours
.color_199095,
borderRadius:
BorderRadius.circular(
ScreenUtil()
.setWidth(
10)),
),
child: Align(
alignment:
Alignment.center,
child: Text('查看菜品',
style: TextStyle(
color: MyColours
.color_ffffff,
fontSize:
ScreenUtil()
.setSp(
34))),
),
if (detailEntity
.order.cookbooklist.length >
0)
Expanded(
flex: 1,
child: InkWell(
onTap: () {
NavigatorUtil
.goHasOrderFoodPage(
context,
rid: detailEntity
.id);
},
child: Container(
margin: EdgeInsets.only(
left: ScreenUtil()
.setWidth(20)),
decoration: BoxDecoration(
color: MyColours
.color_199095,
borderRadius: BorderRadius
.circular(ScreenUtil()
.setWidth(10)),
),
child: Align(
alignment:
Alignment.center,
child: Text('查看菜品',
style: TextStyle(
color: MyColours
.color_ffffff,
fontSize:
ScreenUtil()
.setSp(
34))),
),
)),
),
)),
// _cancelAndChangeBtn(() {
// DialogUtil
// .showShareDialog(
... ...
... ... @@ -78,6 +78,7 @@ class _VerifyFoodPageState extends State<VerifyFoodPage> {
Utils.showToast('保存成功');
bus.emit('refresh_detail_reserve_recheck');
bus.emit('refresh_book_list');
Navigator.pop(context);
}
}
... ...
... ... @@ -465,6 +465,20 @@ class NoteBookItemFState extends State<NoteBookItemF>
? MyColours.color_438E93
: MyColours.color_BFC4D4;
Color roomColor = canDo &&
(Utils.getAuthority(context, '到店') ||
notebook.uid == userModel.user.openid)
? MyColours.color_438E93
: MyColours.color_BFC4D4;
if (notebook.operationText == '未接通') {
bgColor = MyColours.color_F78D94;
} else if (notebook.operationText == '待定') {
bgColor = MyColours.color_F2995F;
} else if (notebook.operationText == '已确认') {
bgColor = MyColours.color_8EBBBE;
}
String detail = '';
if (notebook.tid.split(",").length >= 2) {
//连台
... ... @@ -529,7 +543,7 @@ class NoteBookItemFState extends State<NoteBookItemF>
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: bgColor,
color: roomColor,
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(32)),
),
... ...
... ... @@ -475,6 +475,20 @@ class NoteBookItemSimpleState extends State<NoteBookItemSimple>
? MyColours.color_438E93
: MyColours.color_BFC4D4;
Color roomColor = canDo &&
(Utils.getAuthority(context, '到店') ||
notebook.uid == userModel.user.openid)
? MyColours.color_438E93
: MyColours.color_BFC4D4;
if (notebook.operationText == '未接通') {
bgColor = MyColours.color_F78D94;
} else if (notebook.operationText == '待定') {
bgColor = MyColours.color_F2995F;
} else if (notebook.operationText == '已确认') {
bgColor = MyColours.color_8EBBBE;
}
String detail = '';
if (notebook.tid.split(",").length >= 2) {
//连台
... ... @@ -540,7 +554,7 @@ class NoteBookItemSimpleState extends State<NoteBookItemSimple>
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: bgColor,
color: roomColor,
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(32)),
),
... ...