|
...
|
...
|
@@ -6,6 +6,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
|
|
import 'package:one_key/provider/plan_dish_provider.dart';
|
|
|
|
|
|
|
|
import '../../../models/cookbook_model.dart';
|
|
|
|
import '../../../models/plan_cook_list_model.dart';
|
|
|
|
import '../../../res/colors.dart';
|
|
|
|
import '../../../utils/screen_util.dart';
|
|
|
|
import '../../../widgets/round_button.dart';
|
|
...
|
...
|
@@ -40,7 +41,9 @@ import 'package:provider/provider.dart'; |
|
|
|
class PlanDishEidtPage extends StatefulWidget {
|
|
|
|
final bool isMine;
|
|
|
|
final bool isEdit;
|
|
|
|
PlanDishEidtPage({Key key, this.isMine = false, this.isEdit = true})
|
|
|
|
final SunListPlan sunListPlan;
|
|
|
|
PlanDishEidtPage(
|
|
|
|
{Key key, this.isMine = false, this.isEdit = true, this.sunListPlan})
|
|
|
|
: super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
...
|
...
|
@@ -84,6 +87,33 @@ class _PlanDishEidtPageState extends State<PlanDishEidtPage> { |
|
|
|
} else {
|
|
|
|
labelShow = labelList[labelSelIndex];
|
|
|
|
}
|
|
|
|
if (widget.sunListPlan != null) {
|
|
|
|
_dishNameEditControl.text = widget.sunListPlan.pname;
|
|
|
|
if (widget.sunListPlan.type == '1') {
|
|
|
|
labelShow = '店内通用套餐';
|
|
|
|
} else {
|
|
|
|
labelShow = '自定义排菜单';
|
|
|
|
}
|
|
|
|
swichState = widget.sunListPlan.status == '1' ? true : false;
|
|
|
|
pNumC.text = widget.sunListPlan.pnum;
|
|
|
|
pNum = int.parse(widget.sunListPlan.pnum);
|
|
|
|
priceSum = widget.sunListPlan.menuPrice;
|
|
|
|
memberPriceSum = widget.sunListPlan.memberPrice;
|
|
|
|
dishPriceC.text = widget.sunListPlan.planPrice;
|
|
|
|
menuModel = widget.sunListPlan.cookList;
|
|
|
|
String dish = '';
|
|
|
|
menuModel.forEach((element) {
|
|
|
|
element.cookbooklist.forEach((cookbook) {
|
|
|
|
if (cookbook.amount > 0) {
|
|
|
|
dish += cookbook.name + '、';
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
if (dish.endsWith('、')) {
|
|
|
|
dish = dish.substring(0, dish.length - 1);
|
|
|
|
}
|
|
|
|
_dishExplainEditControl.text = dish;
|
|
|
|
}
|
|
|
|
|
|
|
|
_nameFocusNode.addListener(() {
|
|
|
|
if (_nameFocusNode.hasFocus) {
|
|
...
|
...
|
@@ -126,6 +156,9 @@ class _PlanDishEidtPageState extends State<PlanDishEidtPage> { |
|
|
|
"plan_price": dishPriceC.text,
|
|
|
|
"cook_list": json.encode(menuModel),
|
|
|
|
};
|
|
|
|
if (widget.sunListPlan != null) {
|
|
|
|
params['id'] = widget.sunListPlan.id;
|
|
|
|
}
|
|
|
|
// if (!widget.isMine) {
|
|
|
|
// params['is_examine'] = swichHexiao ? "1" : "0";
|
|
|
|
// params['uid_list'] = uids;
|
|
...
|
...
|
@@ -133,7 +166,7 @@ class _PlanDishEidtPageState extends State<PlanDishEidtPage> { |
|
|
|
bool isSuccess = await dishProvider.setPlanCook(context, params);
|
|
|
|
if (isSuccess) {
|
|
|
|
//成功之后跳回前一个页面
|
|
|
|
// bus.emit('refresh_dish_list');
|
|
|
|
bus.emit('refresh_dish_plan_home_list');
|
|
|
|
// EventBus().emit('refresh_dish_invitation');
|
|
|
|
// bus.emit('refresh_dish_list_f');
|
|
|
|
|
...
|
...
|
|