Commit a1a94856514b3e5b0ca713163f74dc9f93a80543

Authored by wdn127929
2 parents 4fe36c62 d48ee717

dart 3.0 版本 && 合并v5.5.0分支

Too many changes to show.

To preserve performance only 29 of 29+ files are displayed.

... ... @@ -18,19 +18,19 @@ if (flutterRoot == null) {
def flutterVersionCode = "545"
def flutterVersionCode = "550"
if (flutterVersionCode == null) {
flutterVersionCode = '545'
flutterVersionCode = '550'
}
def flutterVersionName = "5.4.5"
def flutterVersionName = "5.5.0"
if (flutterVersionName == null) {
flutterVersionName = '5.4.5'
flutterVersionName = '5.5.0'
}
... ...
... ... @@ -17,7 +17,7 @@ source 'https://cdn.cocoapods.org/'
# source 'https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git'
# pod 'gitee-mosect-ijkplayer', :source => 'https://gitee.com/mosect/ijkplayer.git'
platform :ios, '12.0'
platform :ios, '15.0'
... ... @@ -58,8 +58,8 @@ post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f < 11.0
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f < 15.0
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '15.0'
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
'$(inherited)',
... ...
... ... @@ -402,6 +402,6 @@ SPEC CHECKSUMS:
webview_flutter: 3603125dfd3bcbc9d8d418c3f80aeecf331c068b
WechatOpenSDK-XCFramework: 36fb2bea0754266c17184adf4963d7e6ff98b69f
PODFILE CHECKSUM: 1cefd2e71f0fcfa4f2430db723fe500dadb93e92
PODFILE CHECKSUM: cf11b939cc9fd0a3a3e1864a115dd2357e789cac
COCOAPODS: 1.16.2
... ...
... ... @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objectVersion = 50;
objects = {
/* Begin PBXBuildFile section */
... ... @@ -489,6 +489,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD)";
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
... ... @@ -548,9 +549,10 @@
CODE_SIGN_ENTITLEMENTS = Runner/RunnerProfile.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 5451;
CURRENT_PROJECT_VERSION = 5500;
DEVELOPMENT_TEAM = 8J59HM8B82;
ENABLE_BITCODE = NO;
EXCLUDED_ARCHS = "";
FLUTTER_BUILD_MODE = release;
FLUTTER_ROOT = /Users/naji2021/Documents/flutter;
FRAMEWORK_SEARCH_PATHS = (
... ... @@ -558,13 +560,13 @@
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 15.6;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
MARKETING_VERSION = 5.4.5;
MARKETING_VERSION = 5.5.0;
PODS_ROOT = "$(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine;
PRODUCT_NAME = Runner;
... ... @@ -572,8 +574,9 @@
SWIFT_ENABLE_BATCH_MODE = NO;
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
VALID_ARCHS = "$(inherited)";
VALID_ARCHS = "arm64 arm64e x86_64";
VERSIONING_SYSTEM = "apple-generic";
WARNING_CFLAGS = "-Wno-documentation";
};
name = Profile;
};
... ... @@ -581,6 +584,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD)";
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
... ... @@ -639,6 +643,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD)";
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
... ... @@ -699,10 +704,11 @@
CODE_SIGN_ENTITLEMENTS = "Runner/一键订Debug.entitlements";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 5451;
CURRENT_PROJECT_VERSION = 5500;
DEVELOPMENT_TEAM = 8J59HM8B82;
ENABLE_BITCODE = NO;
FLUTTER_BUILD_MODE = release;
EXCLUDED_ARCHS = "";
FLUTTER_BUILD_MODE = debug;
FLUTTER_ROOT = /Users/naji2021/Documents/flutter;
FLUTTER_TARGET = "/Users/naji2021/Desktop/Flutter-ReserveApp/lib/main.dart";
FRAMEWORK_SEARCH_PATHS = (
... ... @@ -710,13 +716,13 @@
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 15.6;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
MARKETING_VERSION = 5.4.5;
MARKETING_VERSION = 5.5.0;
PACKAGE_CONFIG = "/Users/naji2021/Desktop/Flutter-ReserveApp/.dart_tool/package_config.json";
PODS_ROOT = "$(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine;
... ... @@ -726,8 +732,9 @@
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
VALID_ARCHS = "$(inherited)";
VALID_ARCHS = "arm64 arm64e x86_64";
VERSIONING_SYSTEM = "apple-generic";
WARNING_CFLAGS = "-Wno-documentation";
};
name = Debug;
};
... ... @@ -741,9 +748,10 @@
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 5451;
CURRENT_PROJECT_VERSION = 5500;
DEVELOPMENT_TEAM = 8J59HM8B82;
ENABLE_BITCODE = NO;
EXCLUDED_ARCHS = "";
FLUTTER_BUILD_MODE = release;
FLUTTER_ROOT = /Users/naji2021/Documents/flutter;
FRAMEWORK_SEARCH_PATHS = (
... ... @@ -751,13 +759,13 @@
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 15.6;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
MARKETING_VERSION = 5.4.5;
MARKETING_VERSION = 5.5.0;
PODS_ROOT = "$(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine;
PRODUCT_NAME = Runner;
... ... @@ -765,8 +773,9 @@
SWIFT_ENABLE_BATCH_MODE = NO;
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
VALID_ARCHS = "$(inherited)";
VALID_ARCHS = "arm64 arm64e x86_64";
VERSIONING_SYSTEM = "apple-generic";
WARNING_CFLAGS = "-Wno-documentation";
};
name = Release;
};
... ...
... ... @@ -157,7 +157,7 @@ class Constant {
'到店': ['管理员', '店长', '前台', '迎宾'],
'离店': ['管理员', '店长', '前台', '迎宾'],
'全店任务': ['管理员', '店长', '客户经理', '收银员', '服务员', '前台'],
'创建新的优惠券': [
'创建新券': [
'管理员',
'店长',
],
... ...
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:one_key/models/filter_btn_model.dart';
import 'package:one_key/models/upload_img_model.dart';
import 'dart:convert' as convert;
... ... @@ -26,7 +26,7 @@ class CouponModel extends Object {
this.msg,
);
factory CouponModel.fromJson(Map<String, dynamic> srcJson) =>
factory CouponModel.fromJson(Map<dynamic, dynamic> srcJson) =>
_$CouponModelFromJson(srcJson);
Map<String, dynamic> toJson() => _$CouponModelToJson(this);
... ... @@ -89,6 +89,9 @@ class CouponSunModel extends Object {
@JsonKey(name: 'use')
CouponUse? use;
@JsonKey(name: 'arule')
Arule? arule;
@JsonKey(name: 'exp_date')
ExpDate? expDate;
... ... @@ -104,10 +107,20 @@ class CouponSunModel extends Object {
@JsonKey(name: 'lite_qrcode')
String? liteQrcode;
@JsonKey(name: 'aexpiration')
String? aexpiration;
@JsonKey(name: 'number')
int number;
// arule 券使用和分享规则 领取后有效天数
bool isCheck = false;
bool showText = false;
bool isMarking = false;
TextEditingController numberC = TextEditingController(text: '0');
CouponSunModel(
this.id,
this.uid,
... ... @@ -128,11 +141,14 @@ class CouponSunModel extends Object {
this.isOpenBool,
this.price,
this.use,
this.arule,
this.expDate,
this.nickNameShow,
this.grantNum,
this.urllink,
this.liteQrcode);
this.liteQrcode,
this.aexpiration,
this.number);
factory CouponSunModel.fromJson(Map<String, dynamic> srcJson) =>
_$CouponSunModelFromJson(srcJson);
... ... @@ -173,6 +189,56 @@ class CouponUse extends Object {
}
@JsonSerializable()
class Arule extends Object {
@JsonKey(name: 'is_same_day')
bool isSameDay;
@JsonKey(name: 'is_accumulation')
bool isAccumulation;
@JsonKey(name: 'is_compartment')
bool isCompartment;
@JsonKey(name: 'is_eatin')
bool isEatin;
@JsonKey(name: 'is_takeout')
bool isTakeout;
@JsonKey(name: 'is_appointment')
bool isAppointment;
@JsonKey(name: 'is_share_lose')
bool isShareLose;
@JsonKey(name: 'is_share_have')
bool isShareHave;
@JsonKey(name: 'is_commission')
bool isCommission;
@JsonKey(name: 'commission')
String commission;
Arule(
this.isSameDay,
this.isAccumulation,
this.isCompartment,
this.isEatin,
this.isTakeout,
this.isAppointment,
this.isShareLose,
this.isShareHave,
this.isCommission,
this.commission);
factory Arule.fromJson(Map<String, dynamic> srcJson) =>
_$AruleFromJson(srcJson);
Map<String, dynamic> toJson() => _$AruleToJson(this);
}
@JsonSerializable()
class ExpDate extends Object {
@JsonKey(name: 'is_none')
bool isNone;
... ...
... ... @@ -6,7 +6,7 @@ part of 'coupon_model.dart';
// JsonSerializableGenerator
// **************************************************************************
CouponModel _$CouponModelFromJson(Map<String, dynamic> json) {
CouponModel _$CouponModelFromJson(Map<dynamic, dynamic> json) {
return CouponModel(
json['ret'] as int?,
(json['data'] as List?)
... ... @@ -26,43 +26,51 @@ Map<String, dynamic> _$CouponModelToJson(CouponModel instance) =>
CouponSunModel _$CouponSunModelFromJson(Map<String, dynamic> json) {
return CouponSunModel(
json['id'] as String?,
json['uid'] as String?,
json['aname'] as String?,
json['desc'] as String?,
json['stime'] as String?,
json['etime'] as String?,
json['explain'] as String?,
json['status'] as String?,
json['cdate'] as String?,
json['receive_num'] as String?,
json['use_num'] as String?,
json['nickname'] as String?,
json['uid_list'] as String?,
json['is_examine'] as String?,
json['is_type'] as String?,
json['is_open'] as String?,
json['is_open'] == "1" ? true : false,
json['price'] as String?,
json['use'] == null
? null
: (json['use'] is String)
? CouponUse.fromJson(jsonDecode(json['use']))
: (json['use'] is Map)
? CouponUse.fromJson(json['use'])
: null,
json['exp_date'] == null
? null
: (json['exp_date'] is String)
? ExpDate.fromJson(jsonDecode(json['exp_date']))
: (json['exp_date'] is Map)
? ExpDate.fromJson(json['exp_date'])
: null,
json['nick_name'] as String?,
json['grant_num'] as String?,
json['urllink'] as String?,
json['lite_qrcode'] as String?,
);
json['id'] as String?,
json['uid'] as String?,
json['aname'] as String?,
json['desc'] as String?,
json['stime'] as String?,
json['etime'] as String?,
json['explain'] as String?,
json['status'] as String?,
json['cdate'] as String?,
json['receive_num'] as String?,
json['use_num'] as String?,
json['nickname'] as String?,
json['uid_list'] as String?,
json['is_examine'] as String?,
json['is_type'] as String?,
json['is_open'] as String?,
json['is_open'] == "1" ? true : false,
json['price'] as String?,
json['use'] == null
? null
: (json['use'] is String)
? CouponUse.fromJson(jsonDecode(json['use']))
: (json['use'] is Map)
? CouponUse.fromJson(json['use'])
: null,
json['arule'] == null
? null
: (json['arule'] is String)
? Arule.fromJson(jsonDecode(json['arule']))
: (json['arule'] is Map)
? Arule.fromJson(json['arule'])
: null,
json['exp_date'] == null
? null
: (json['exp_date'] is String)
? ExpDate.fromJson(jsonDecode(json['exp_date']))
: (json['exp_date'] is Map)
? ExpDate.fromJson(json['exp_date'])
: null,
json['nick_name'] as String?,
json['grant_num'] as String?,
json['urllink'] as String?,
json['lite_qrcode'] as String?,
json['aexpiration'] as String?,
(json['number'] ?? 0) as int);
}
Map<String, dynamic> _$CouponSunModelToJson(CouponSunModel instance) =>
... ... @@ -86,11 +94,14 @@ Map<String, dynamic> _$CouponSunModelToJson(CouponSunModel instance) =>
'isOpenBool': instance.isOpenBool,
'price': instance.price,
'use': instance.use,
'arule': instance.arule,
'exp_date': instance.expDate,
'nick_name': instance.nickNameShow,
'grant_num': instance.grantNum,
'urllink':instance.urllink,
'lite_qrcode':instance.liteQrcode
'urllink': instance.urllink,
'lite_qrcode': instance.liteQrcode,
'aexpiration': instance.aexpiration,
'number': instance.number
};
CouponUse _$CouponUseFromJson(Map<String, dynamic> json) {
... ... @@ -147,6 +158,96 @@ Map<String, dynamic> _$CouponUseToJson(CouponUse instance) => <String, dynamic>{
'images': instance.images
};
Arule _$AruleFromJson(Map<String, dynamic> json) {
bool isSameDay = false;
if (json['is_same_day'] is String) {
isSameDay = json['is_same_day'] == '1' ? true : false;
} else if (json['is_same_day'] is bool) {
isSameDay = json['is_same_day'] ? true : false;
}
bool isAccumulation = false;
if (json['is_accumulation'] is String) {
isAccumulation = json['is_accumulation'] == '1' ? true : false;
} else if (json['is_accumulation'] is bool) {
isAccumulation = json['is_accumulation'] ? true : false;
}
bool isCompartment = false;
if (json['is_compartment'] is String) {
isCompartment = json['is_compartment'] == '1' ? true : false;
} else if (json['is_compartment'] is bool) {
isCompartment = json['is_compartment'] ? true : false;
}
bool isEatin = false;
if (json['is_eatin'] is String) {
isEatin = json['is_eatin'] == '1' ? true : false;
} else if (json['is_eatin'] is bool) {
isEatin = json['is_eatin'] ? true : false;
}
bool isTakeout = false;
if (json['is_takeout'] is String) {
isTakeout = json['is_takeout'] == '1' ? true : false;
} else if (json['is_takeout'] is bool) {
isTakeout = json['is_takeout'] ? true : false;
}
bool isAppointment = false;
if (json['is_appointment'] is String) {
isAppointment = json['is_appointment'] == '1' ? true : false;
} else if (json['is_appointment'] is bool) {
isAppointment = json['is_appointment'] ? true : false;
}
bool isShareLose = false;
if (json['is_share_lose'] is String) {
isShareLose = json['is_share_lose'] == '1' ? true : false;
} else if (json['is_share_lose'] is bool) {
isShareLose = json['is_share_lose'] ? true : false;
}
bool isShareHave = false;
if (json['is_share_have'] is String) {
isShareHave = json['is_share_have'] == '1' ? true : false;
} else if (json['is_share_have'] is bool) {
isShareHave = json['is_share_have'] ? true : false;
}
bool isCommission = false;
if (json['is_commission'] is String) {
isCommission = json['is_commission'] == '1' ? true : false;
} else if (json['is_commission'] is bool) {
isCommission = json['is_commission'] ? true : false;
}
return Arule(
isSameDay,
isAccumulation,
isCompartment,
isEatin,
isTakeout,
isAppointment,
isShareLose,
isShareHave,
isCommission,
json['commission']);
}
Map<String, dynamic> _$AruleToJson(Arule instance) => <String, dynamic>{
'is_same_day': instance.isSameDay,
'is_accumulation': instance.isAccumulation,
'is_compartment': instance.isCompartment,
'is_eatin': instance.isEatin,
'is_takeout': instance.isTakeout,
'is_appointment': instance.isAppointment,
'is_share_lose': instance.isShareLose,
'is_share_have': instance.isShareHave,
'is_commission': instance.isCommission,
'commission': instance.commission,
};
ExpDate _$ExpDateFromJson(Map<String, dynamic> json) {
List<FilterBtnModel> weekdata = [];
if (json['week_data'] != null) {
... ...
... ... @@ -339,7 +339,6 @@ class MarkStoreModel {
if (json['content'] != null) {
content = [];
if (json['content'] is List) {
List temp = json['content'];
temp.forEach((element) {
... ... @@ -418,7 +417,7 @@ class MarkChefModel {
isImages = json['is_images'];
if (json['content'] != null) {
content = [];
if (json['content'] is List) {
if (json['content'] is List) {
List temp = json['content'];
temp.forEach((element) {
content!.add(ContentModel.fromJson(element));
... ... @@ -531,6 +530,15 @@ class MarkMarketingModel {
String? isComments;
String? isCommentsCoupon;
List<CouponSunModel>? couponDataListComments;
String? isCouponFree;
String? isCouponPay;
List<CouponSunModel>? couponDataListPay;
List<CouponSunModel>? couponDataListFree;
String? isLogo; //
... ... @@ -542,10 +550,12 @@ class MarkMarketingModel {
this.isTranspond,
this.logo,
this.wecomle,
this.isCoupon,
this.isCouponFree,
this.isCouponPay,
this.isRecharge,
this.rechargeData,
this.couponDataList,
this.couponDataListPay,
this.couponDataListFree,
this.isComments,
this.isCommentsCoupon,
this.couponDataListComments,
... ... @@ -559,35 +569,68 @@ class MarkMarketingModel {
isLink = json['is_link'];
wecomle = json['wecomle'];
logo = json['logo'];
isCoupon = json['is_coupon'];
isCouponFree = json['is_coupon_free'];
isCouponPay = json['is_coupon_pay'];
isRecharge = json['is_recharge'];
rechargeData = json['recharge_data'] != null
? new RechargeListSunModel.fromJson(json['recharge_data'])
: null;
if (json['coupon_data'] != null) {
couponDataList = <CouponSunModel>[];
if (json['coupon_data'] is Map) {
if (json['coupon_data_pay'] != null) {
couponDataListPay = <CouponSunModel>[];
if (json['coupon_data_pay'] is Map) {
//旧数据map
couponDataListPay!.add(CouponSunModel.fromJson(json['coupon_data_pay']));
} else {
var couponData;
if (json['coupon_data_pay'] is String) {
couponData = convert.jsonDecode(json['coupon_data_pay']);
} else {
couponData = json['coupon_data_pay'];
}
if(couponData is List){
couponData.forEach((v) {
couponDataListPay!.add(CouponSunModel.fromJson(v as Map<String, dynamic>));
});
}
else if (couponData is Map) {
// json['coupon_data'].forEach((v) {
couponDataListPay!.add(CouponSunModel.fromJson(couponData as Map<String, dynamic>));
// });
} else {
couponData.forEach((v) {
couponDataListPay!.add(v);
});
}
}
}
if (json['coupon_data_free'] != null) {
couponDataListFree = <CouponSunModel>[];
if (json['coupon_data_free'] is Map) {
//旧数据map
couponDataList!.add(CouponSunModel.fromJson(json['coupon_data']));
couponDataListFree!
.add(CouponSunModel.fromJson(json['coupon_data_free']));
} else {
var couponData;
if (json['coupon_data'] is String) {
couponData = convert.jsonDecode(json['coupon_data']);
if (json['coupon_data_free'] is String) {
couponData = convert.jsonDecode(json['coupon_data_free']);
} else {
couponData = json['coupon_data'];
couponData = json['coupon_data_free'];
}
if (couponData is List) {
couponData.forEach((v) {
couponDataList!.add(CouponSunModel.fromJson(v));
couponDataListFree!.add(CouponSunModel.fromJson(v));
});
} else if (couponData is Map) {
// json['coupon_data'].forEach((v) {
couponDataList!.add(CouponSunModel.fromJson(couponData as Map<String, dynamic>));
couponDataListFree!.add(CouponSunModel.fromJson(couponData as Map<String, dynamic>));
// });
} else {
couponData.forEach((v) {
couponDataList!.add(v);
couponDataListFree!.add(v);
});
}
}
... ... @@ -636,10 +679,12 @@ class MarkMarketingModel {
data['is_link'] = this.isLink;
data['wecomle'] = this.wecomle;
data['logo'] = this.logo;
data['is_coupon'] = this.isCoupon;
data['is_coupon_free'] = this.isCouponFree;
data['is_coupon_pay'] = this.isCouponPay;
data['is_recharge'] = this.isRecharge;
data['recharge_data'] = this.rechargeData;
data['coupon_data'] = this.couponDataList;
data['coupon_data_pay'] = this.couponDataListPay;
data['coupon_data_free'] = this.couponDataListFree;
data['is_comments'] = this.isComments;
data['is_comments_coupon'] = this.isCommentsCoupon;
data['coupon_data_comments'] = this.couponDataListComments;
... ...
... ... @@ -7,11 +7,14 @@ import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:one_key/app.dart';
import 'package:one_key/constant/error.dart';
import 'package:one_key/net/http_url.dart';
import 'package:one_key/pages/my/contant_item_page.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/loading.dart';
import 'package:provider/provider.dart';
import '../constant/constant.dart';
import 'base_resp.dart';
/**
... ... @@ -379,8 +382,9 @@ class DioUtil {
// }
// };
}
_dio!.options.method = method;
_dio!.options.baseUrl = 'http://xt04.colorcun.com/';
_dio!.options.baseUrl = HttpUrl.server_address;
_dio!.options.contentType = Headers.multipartFormDataContentType;
return options;
... ...
... ... @@ -67,36 +67,44 @@ class _CouponCreateSelectTypePageState
child: Row(
children: [
Image.asset(
Utils.getImgPath(selectF
? 'coupon_select_type_user'
: 'coupon_select_type_user_un'),
width: ScreenUtil().setWidth(70 * 2),
),
HEmptyView(70),
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'仅为我创建',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(36),
color: selectF
? MyColours.color_ffffff
: MyColours.color_999999),
),
VEmptyView(16),
Text(
'创建后仅我可发放该优惠券',
style: TextStyle(
fontSize: ScreenUtil().setSp(24),
color: selectF
? MyColours.color_ffffff
: MyColours.color_BFC4D4),
),
],
Utils.getImgPath(selectF ? 'free' : 'free_un'),
width: ScreenUtil().setWidth(50 * 2),
),
HEmptyView(56),
Expanded(
child: Text(
'免费代金券',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(36),
color: selectF
? MyColours.color_ffffff
: MyColours.color_999999),
)),
// Column(
// mainAxisAlignment: MainAxisAlignment.center,
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Text(
// '仅为我创建',
// style: TextStyle(
// fontWeight: FontWeight.bold,
// fontSize: ScreenUtil().setSp(36),
// color: selectF
// ? MyColours.color_ffffff
// : MyColours.color_999999),
// ),
// VEmptyView(16),
// Text(
// '创建后仅我可发放该优惠券',
// style: TextStyle(
// fontSize: ScreenUtil().setSp(24),
// color: selectF
// ? MyColours.color_ffffff
// : MyColours.color_BFC4D4),
// ),
// ],
// ),
],
),
)),
... ... @@ -131,37 +139,21 @@ class _CouponCreateSelectTypePageState
child: Row(
children: [
Image.asset(
Utils.getImgPath(!selectF
? 'coupon_select_type_store'
: 'coupon_select_type_store_un'),
width: ScreenUtil().setWidth(75 * 2),
Utils.getImgPath(!selectF ? 'pay' : 'pay_un'),
width: ScreenUtil().setWidth(50 * 2),
),
HEmptyView(60),
HEmptyView(56),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'为全店创建',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(36),
color: !selectF
? MyColours.color_ffffff
: MyColours.color_999999),
),
VEmptyView(16),
Text(
'创建后所有员工均可发放该优惠券',
style: TextStyle(
fontSize: ScreenUtil().setSp(24),
color: !selectF
? MyColours.color_ffffff
: MyColours.color_BFC4D4),
),
],
)),
child: Text(
'付费优惠券',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(36),
color: !selectF
? MyColours.color_ffffff
: MyColours.color_999999),
),
),
],
),
)),
... ...
... ... @@ -197,7 +197,7 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
///是否立即启用
Widget _canUse(String title, bool swich) {
return Container(
padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(24)),
padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(14)),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
... ... @@ -215,8 +215,12 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
Spacer(),
Image.asset(
swich
? Utils.getImgPath('swich_on')
: Utils.getImgPath('swich_off'),
? Utils.getImgPath(title == '立即启用' || title == '是否核销'
? 'swich_on'
: 'swich_on_lit')
: Utils.getImgPath(title == '立即启用' || title == '是否核销'
? 'swich_off'
: 'swich_off_lit'),
width: ScreenUtil().setWidth(44 * 2),
)
],
... ... @@ -328,9 +332,9 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
appBar: SystemAppBar(
'优惠券详情',
onTap: () {
if (Navigator.canPop(context)) {
Navigator.pop(context);
}
if (Navigator.canPop(context)) {
Navigator.pop(context);
}
},
// rightImgName: couponProvider != null &&
// couponProvider.couponSunModel != null &&
... ... @@ -386,13 +390,23 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
'券类型',
couponProvider.couponSunModel!.isType == '1'
? '店铺优惠券'
: '我的优惠券'),
: couponProvider.couponSunModel!.isType ==
'2'
? '我的优惠券'
: couponProvider
.couponSunModel!.isType ==
'3'
? '免费代金券'
: '付费优惠券'),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
if (couponProvider.couponSunModel!.isType == '1')
if (couponProvider.couponSunModel!.isType == '1' ||
couponProvider.couponSunModel!.isType == '3' ||
couponProvider.couponSunModel!.isType == '4')
Column(
children: [
_canUse(
... ... @@ -414,7 +428,21 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
if (couponProvider.couponSunModel!.isType == '1' &&
_item(
couponProvider.couponSunModel!.isType == '3'
? '券金额'
: '销售价',
'${couponProvider.couponSunModel!.price}元' ??
''),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
if ((couponProvider.couponSunModel!.isType == '1' ||
couponProvider.couponSunModel!.isType ==
'4') &&
couponProvider.couponSunModel!.use != null)
Column(
crossAxisAlignment: CrossAxisAlignment.start,
... ... @@ -470,24 +498,22 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
_item(
'销售价',
'${couponProvider.couponSunModel!.price ?? ''}元' ),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
],
),
_item('券要求', couponProvider.couponSunModel!.desc!),
_item(
'消费要求',
couponProvider.couponSunModel!.isType == '1' ||
couponProvider.couponSunModel!.isType ==
'2'
? couponProvider.couponSunModel!.desc??''
: '消费满${couponProvider.couponSunModel!.desc}元可用'),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
_item(
'有效期从',
'活动开始于',
Utils.getDateStrFromJiekou(
couponProvider.couponSunModel!.stime)),
Container(
... ... @@ -496,9 +522,40 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
),
VEmptyView(24),
_item(
'有效期至',
'活动结束于',
Utils.getDateStrFromJiekou(
couponProvider.couponSunModel!.etime)),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
if (couponProvider.couponSunModel!.isType == '3' ||
couponProvider.couponSunModel!.isType == '4')
_item('领取后有效天数',
couponProvider.couponSunModel!.aexpiration??''),
if ((couponProvider.couponSunModel!.isType == '3' ||
couponProvider.couponSunModel!.isType ==
'4') &&
couponProvider.couponSunModel!.expDate != null)
Column(children: [
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
_item(
'不可用日期',
couponProvider
.couponSunModel!.expDate!.weekShow??''),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
]),
if (couponProvider.couponSunModel!.isType == '1' &&
couponProvider.couponSunModel!.expDate != null)
Column(children: [
... ... @@ -554,7 +611,102 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
// ],
// )
// : SizedBox(),
couponProvider.couponSunModel!.isType == '1'
if (couponProvider.couponSunModel!.isType == '3' ||
couponProvider.couponSunModel!.isType == '4')
Column(
children: [
VEmptyView(24),
Container(
alignment: Alignment.centerLeft,
child: Text(
'使用规则:',
style: TextStyle(
color: MyColours.color_515151,
// fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(32)),
),
),
VEmptyView(24),
Padding(
padding: EdgeInsets.only(
left: w(32),
),
child: Column(
children: [
_canUse(
'领取当日可用',
couponProvider.couponSunModel!.arule!
.isSameDay),
_canUse(
'可以叠加使用其他优惠券',
couponProvider.couponSunModel!.arule!
.isAccumulation,
),
_canUse(
'可使用包间',
couponProvider.couponSunModel!.arule!
.isCompartment),
_canUse(
'堂食可用',
couponProvider
.couponSunModel!.arule!.isEatin,
),
_canUse(
'外带可用',
couponProvider.couponSunModel!.arule!
.isTakeout),
_canUse(
'是否需要提前预约',
couponProvider.couponSunModel!.arule!
.isAppointment),
],
),
),
VEmptyView(24),
Container(
alignment: Alignment.centerLeft,
child: Text(
'分享设置:',
style: TextStyle(
color: MyColours.color_515151,
// fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(32)),
),
),
VEmptyView(24),
Padding(
padding: EdgeInsets.only(
left: w(32),
),
child: Column(
children: [
_canUse(
'用户可以分享给好友',
couponProvider.couponSunModel!.arule!
.isShareLose),
_canUse(
'用户分享给好友后继续拥有此券',
couponProvider
.couponSunModel!.arule!.isShareHave,
),
_canUse(
'分享核销后,分享用户获得佣金',
couponProvider.couponSunModel!.arule!
.isCommission),
_item('分享佣金',
'${couponProvider.couponSunModel!.arule!.commission}%'),
],
),
),
VEmptyView(24),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
],
),
couponProvider.couponSunModel!.isType == '1' ||
couponProvider.couponSunModel!.isType == '4'
? Column(
crossAxisAlignment:
CrossAxisAlignment.start,
... ... @@ -572,12 +724,6 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
_item(
'发放总量限制',
couponProvider
.couponSunModel!.grantNum ??
''),
// _select(
// '谁可以发放',
// '查看',
... ... @@ -593,6 +739,10 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
],
)
: SizedBox(),
VEmptyView(24),
_item('发放总量限制',
couponProvider.couponSunModel!.grantNum ?? ''),
couponProvider.couponSunModel!.explain != null &&
couponProvider.couponSunModel!.explain != ''
? Container(
... ... @@ -606,39 +756,40 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
: SizedBox(),
couponProvider.couponSunModel!.explain != null &&
couponProvider.couponSunModel!.explain != ''
? _item('券说明', '')
? _item('券说明',
couponProvider.couponSunModel!.explain??'')
: SizedBox(),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
// VEmptyView(24),
// if (couponProvider.couponSunModel.explain != null &&
// couponProvider.couponSunModel.explain != '')
// Align(
// alignment: Alignment.centerRight,
// child: Text(
// couponProvider.couponSunModel.explain,
// textAlign: TextAlign.left,
// style: TextStyle(
// // height: 1.5,
// fontSize: font(16),
// color: MyColours.color_999999),
// ),
// ),
VEmptyView(24),
if (couponProvider.couponSunModel!.explain != null &&
couponProvider.couponSunModel!.explain != '')
Align(
alignment: Alignment.centerLeft,
child: Text(
couponProvider.couponSunModel!.explain!,
textAlign: TextAlign.left,
style: TextStyle(
// height: 1.5,
fontSize: font(16),
color: MyColours.color_999999),
),
),
if (couponProvider.couponSunModel!.explain != null &&
couponProvider.couponSunModel!.explain != '')
VEmptyView(24),
// Container(
// height: ScreenUtil().setWidth(2),
// color: MyColours.color_E7E7E7,
// ),
VEmptyView(24),
// VEmptyView(24),
_canUse(
'立即启用',
couponProvider.couponSunModel!.status == '1'
? true
: false)
: false),
VEmptyView(24),
],
))),
),
... ... @@ -666,8 +817,7 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
if (couponProvider.couponSunModel!.liteQrcode != null &&
couponProvider.couponSunModel!.isType == '1')
if (couponProvider.couponSunModel!.liteQrcode != null)
RoundButton(
text: '生成海报',
width: w(100),
... ... @@ -685,55 +835,65 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
return;
}
// 谁可以发放
// 可以发放的才能分享
if (couponProvider.couponSunModel!.uidList!
.split(',')
.contains(Provider.of<UserModel>(context,
listen: false)
.user!
.openid)) {
if (couponProvider.couponSunModel!.isType == '3') {
NavigatorUtil.goCouponPosterPage(
context,
widget.idstr,
couponProvider.couponSunModel!.use,
couponProvider.couponSunModel);
} else {
Utils.showToast('您没有此权限');
// 谁可以发放
// 可以发放的才能分享
if (couponProvider.couponSunModel!.uidList!
.split(',')
.contains(Provider.of<UserModel>(context,
listen: false)
.user!
.openid)) {
NavigatorUtil.goCouponPosterPage(
context,
widget.idstr,
couponProvider.couponSunModel!.use,
couponProvider.couponSunModel);
} else {
Utils.showToast('您没有此权限');
}
}
},
),
if (couponProvider.couponSunModel!.liteQrcode != null)
HEmptyView(30),
RoundButton(
text: '复用',
width: w(100),
gradientStart: MyColours.color_ffffff,
gradientEnd: MyColours.color_ffffff,
borderColor: MyColours.color_438E93,
textColor: MyColours.color_438E93,
height: ScreenUtil().setWidth(80),
radius: ScreenUtil().setWidth(14),
isBold: true,
fontSize: 28,
onPressed: () async {
//复用,跳转至编辑页面
bool? needRefresh =
await NavigatorUtil.goCouponEditPage(context,
isMine:
couponProvider.couponSunModel!.isType ==
'1'
? false
: true,
couponSunModel: couponProvider.couponSunModel);
if(needRefresh != null &&needRefresh){
if (Navigator.canPop(context)) {
Navigator.pop(context);
}
}
},
),
if (couponProvider.couponSunModel!.isType == '3' ||
couponProvider.couponSunModel!.isType == '4')
RoundButton(
text: '复用',
width: w(100),
gradientStart: MyColours.color_ffffff,
gradientEnd: MyColours.color_ffffff,
borderColor: MyColours.color_438E93,
textColor: MyColours.color_438E93,
height: ScreenUtil().setWidth(80),
radius: ScreenUtil().setWidth(14),
isBold: true,
fontSize: 28,
onPressed: () async {
//复用,跳转至编辑页面
dynamic needRefresh =
await NavigatorUtil.goCouponEditPage(context,
isMine:
couponProvider.couponSunModel!.isType ==
'4'
? false
: true,
couponSunModel:
couponProvider.couponSunModel);
if (needRefresh != null && needRefresh) {
if (Navigator.canPop(context)) {
Navigator.pop(context);
}
}
},
),
HEmptyView(30),
Expanded(
child: RoundButton(
... ... @@ -747,37 +907,45 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
Utils.showToast('请先启用优惠券后再进行操作!');
return;
}
if (couponProvider.couponSunModel!.isType == '1' &&
couponProvider.couponSunModel!.status == '1') {
//店铺券
// 谁可以发放
// 可以发放的才能分享
if (couponProvider.couponSunModel!.uidList!
.split(',')
.contains(Provider.of<UserModel>(context,
listen: false)
.user!
.openid)) {
//包含当前登录人
if (couponProvider.couponSunModel!.status == '1') {
if (couponProvider.couponSunModel!.isType == '3') {
Utils.goShareBuyCouponToWeChat(
context,
widget.idstr,
couponProvider.couponSunModel!.isType,
couponProvider.couponSunModel!.use,
couponProvider.couponSunModel!);
couponProvider.couponSunModel);
} else {
Utils.showToast('您没有此权限');
// 谁可以发放
// 可以发放的才能分享
if (couponProvider.couponSunModel!.uidList!
.split(',')
.contains(Provider.of<UserModel>(context,
listen: false)
.user!
.openid)) {
//包含当前登录人
Utils.goShareBuyCouponToWeChat(
context,
widget.idstr,
couponProvider.couponSunModel!.isType,
couponProvider.couponSunModel!.use,
couponProvider.couponSunModel);
} else {
Utils.showToast('您没有此权限');
}
}
} else if (couponProvider.couponSunModel!.isType ==
'2' &&
couponProvider.couponSunModel!.status == '1') {
// 我的优惠券
Utils.goShareBuyCouponToWeChatMy(
context,
widget.idstr,
managerName,
couponProvider.couponSunModel!);
}
// else if (couponProvider.couponSunModel.isType ==
// '2' &&
// couponProvider.couponSunModel.status == '1') {
// // 我的优惠券
// Utils.goShareBuyCouponToWeChatMy(
// context,
// widget.idstr,
// managerName,
// couponProvider.couponSunModel);
// }
},
),
)
... ...
... ... @@ -50,7 +50,12 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
TextEditingController _couponRequireEditControl = TextEditingController();
TextEditingController _couponExplainEditControl = TextEditingController();
TextEditingController _limitNumControl = TextEditingController();
TextEditingController _commissionControl = TextEditingController();
TextEditingController _limitDay = TextEditingController();
FocusNode _limitNumFocusNode = FocusNode();
FocusNode _limitDayFocusNode = FocusNode();
FocusNode _commissionFocusNode = FocusNode();
final heightCell = ScreenUtil().setWidth(48 * 2);
bool swichState = true; //默认启用 开关状态
final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
... ... @@ -62,6 +67,9 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
late CouponProvider couponProvider;
bool swichHexiao = true; //默认启用 核销状态
String? uids = '';
// bool swichHexiao = true; //默认启用 核销状态
TextEditingController _priceControl = TextEditingController();
FocusNode _priceFocusNode = FocusNode();
... ... @@ -80,7 +88,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
bool limitNone = true;
bool limitWeek = false;
bool limitBirthday = false;
String weekShow = '点击设置可用日期';
String weekShow = '无';
List<FilterBtnModel> weekData = [];
// morning == "00:00-00:00"
... ... @@ -93,6 +101,20 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
List<String?> imgAll = [];
bool isSameDay = true; //领取当日可用
bool isAccumulation = true; //叠加使用
bool isCompartment = true; //包间可用
bool isEatin = true; //堂食
bool isTakeout = true; //外带
bool isAppointment = true; //预约
bool isShareLose = true; //分享好友
bool isShareHave = true; //分享好友后继续拥有此券
bool isCommission = true; //返佣金
@override
void initState() {
super.initState();
... ... @@ -194,15 +216,26 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
endDate = DateUtil.formatDate(dateTimee, format: DateFormats.y_mo_d);
swichState = widget.couponSunModel!.status == '1' ? true : false;
_priceControl.text = widget.couponSunModel!.price;
_limitDay.text = widget.couponSunModel!.aexpiration ??'';
isSameDay = widget.couponSunModel!.arule!.isSameDay;
isAccumulation = widget.couponSunModel!.arule!.isAccumulation;
isCompartment = widget.couponSunModel!.arule!.isCompartment;
isEatin = widget.couponSunModel!.arule!.isEatin; //堂食
isTakeout = widget.couponSunModel!.arule!.isTakeout; //外带
isAppointment = widget.couponSunModel!.arule!.isAppointment;
isShareLose = widget.couponSunModel!.arule!.isShareLose; //分享好友
isShareHave = widget.couponSunModel!.arule!.isShareHave; //分享好友后继续拥有此券
isCommission = widget.couponSunModel!.arule!.isCommission; //返佣金
_commissionControl.text = widget.couponSunModel!.arule!.commission;
weekShow = widget.couponSunModel!.expDate!.weekShow ?? '无';
weekData = widget.couponSunModel!.expDate!.weekData ?? [];
_limitNumControl.text = widget.couponSunModel!.grantNum??'';
if (widget.isMine) {
//我的优惠券
} else {
//店铺
swichHexiao = widget.couponSunModel!.isExamine == '1' ? true : false;
_priceControl.text = widget.couponSunModel!.price;
if (!widget.isMine) {
//付费优惠券
// swichHexiao = widget.couponSunModel.isExamine == '1' ? true : false;
money = widget.couponSunModel!.use!.isCash;
dish = widget.couponSunModel!.use!.isDish;
discount = widget.couponSunModel!.use!.isDiscount;
... ... @@ -224,10 +257,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
limitBirthday = widget.couponSunModel!.expDate!.isBirthday ? true : false;
limitWeek = widget.couponSunModel!.expDate!.isWeek ? true : false;
weekShow = widget.couponSunModel!.expDate!.weekShow ?? '点击设置可用日期';
weekData = widget.couponSunModel!.expDate!.weekData ;
uids = widget.couponSunModel!.uidList;
_limitNumControl.text = widget.couponSunModel!.grantNum??'';
}
}
... ... @@ -287,6 +317,11 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
filterBtnModel.title = '周${Utils.formatWeekDayNum(i)}';
weekData.add(filterBtnModel);
}
FilterBtnModel filterBtnModel1 = FilterBtnModel();
filterBtnModel1.selectNoon = false;
filterBtnModel1.selectNig = false;
filterBtnModel1.title = '法定假日';
weekData.add(filterBtnModel1);
}
//创建新券 客户经理创建活动
... ... @@ -308,14 +343,46 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
"explain": _couponExplainEditControl.text,
"is_open": swichState ? "1" : "0",
"status": swichState ? "1" : "0",
'is_type': widget.isMine ? "2" : "1"
'is_type': widget.isMine ? "3" : "4"
};
params['aexpiration'] = _limitDay.text;
// params['arule'] = ;
params['price'] =
_priceControl.text.trim().length == 0 ? '0' : _priceControl.text;
Map expDate = {
// 'is_none': limitNone ? '1' : '0',
// 'is_week': limitWeek ? '1' : '0',
// 'is_birthday': limitBirthday ? '1' : '0',
'week_show': weekShow,
'week_data': weekData
};
params['exp_date'] = jsonEncode(expDate);
if (_limitNumControl.text.trim().length == 0) {
params['grant_num'] = '1000';
} else {
params['grant_num'] = _limitNumControl.text;
}
Map setting = {
'is_same_day': isSameDay ? '1' : '0',
'is_accumulation': isAccumulation ? '1' : '0',
'is_compartment': isCompartment ? '1' : '0',
'is_eatin': isEatin ? '1' : '0',
'is_takeout': isTakeout ? '1' : '0',
'is_appointment': isAppointment ? '1' : '0',
'is_share_lose': isShareLose ? '1' : '0',
'is_share_have': isShareHave ? '1' : '0',
'is_commission': isCommission ? '1' : '0',
'commission': _commissionControl.text
};
params['arule'] = jsonEncode(setting);
params['is_examine'] = "1";
List<String?> images = [];
if (!widget.isMine) {
params['is_examine'] = swichHexiao ? "1" : "0";
params['uid_list'] = uids;
params['price'] =
_priceControl.text.trim().length == 0 ? '0' : _priceControl.text;
if (img.length > 0) {
img.forEach((value) {
... ... @@ -333,21 +400,6 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
'images': json.encode(images)
};
params['use'] = jsonEncode(use);
Map expDate = {
'is_none': limitNone ? '1' : '0',
'is_week': limitWeek ? '1' : '0',
'is_birthday': limitBirthday ? '1' : '0',
'week_show': weekShow,
'week_data': weekData
};
params['exp_date'] = jsonEncode(expDate);
if (_limitNumControl.text.trim().length == 0) {
params['grant_num'] = '1000';
} else {
params['grant_num'] = _limitNumControl.text;
}
}
bool isSuccess =
await couponProvider.createCustomerActivity(context, params) ;
... ... @@ -381,6 +433,8 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
TextEditingController controller, FocusNode focusNode,
{TextInputType textInputType = TextInputType.text}) {
return Container(
margin: EdgeInsets.only(bottom: w(12)),
height: w(24),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
... ... @@ -389,11 +443,12 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
title,
style: TextStyle(
color: Color.fromRGBO(0, 0, 0, 0.9),
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(32)),
fontWeight:
title == '分享佣金' ? FontWeight.normal : FontWeight.bold,
fontSize: title == '分享佣金' ? font(14) : font(16)),
),
),
HEmptyView(80),
// HEmptyView(10),
Expanded(
// width: ScreenUtil().setWidth(231 * 2),
child: TextField(
... ... @@ -407,18 +462,25 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
//输入文本的样式
inputFormatters: title == '券名称'
? [LengthLimitingTextInputFormatter(15)]
: [],
: title == '券金额' ||
title == '领取后有效天数' ||
title == '消费要求(0为无门槛)' ||
title == '分享佣金' ||
title == '发放总量限制'
? [FilteringTextInputFormatter.digitsOnly]
: [], // 限制输入为数字,
style: TextStyle(
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(32),
fontSize: ScreenUtil().setSp(28),
),
focusNode: focusNode,
decoration: InputDecoration(
isCollapsed: true,
border: OutlineInputBorder(borderSide: BorderSide.none),
hintText: hintText,
hintStyle: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(32),
fontSize: ScreenUtil().setSp(28),
),
enabledBorder: new UnderlineInputBorder(
borderSide: BorderSide.none,
... ... @@ -433,7 +495,26 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
},
keyboardType: textInputType),
),
HEmptyView(32)
HEmptyView(5),
if (title == '领取后有效天数')
Text(
'天',
style: TextStyle(
fontWeight: FontWeight.bold,
color: MyColours.color_515151,
fontSize: font(14),
),
),
if (title == '分享佣金')
Text(
'%',
style: TextStyle(
fontWeight: FontWeight.bold,
color: MyColours.color_515151,
fontSize: font(14),
),
),
HEmptyView(22)
],
),
);
... ... @@ -570,16 +651,16 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(32)),
)),
VEmptyView(26),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
// VEmptyView(26),
// Container(
// height: ScreenUtil().setWidth(2),
// color: MyColours.color_E7E7E7,
// ),
TextField(
controller: _couponExplainEditControl,
// keyboardType: TextInputType.number, //键盘类型,数字键盘
maxLines: 3,
maxLength: 50,
maxLines: 5,
maxLength: 500,
// maxLengthEnforced: true,
style: TextStyle(
... ... @@ -633,11 +714,14 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
}
///是否立即启用
Widget _canUse(String title, bool swich, GestureTapCallback onTap) {
Widget _canUse(String title, bool swich, GestureTapCallback onTap,
{bool isBig = true}) {
return InkWell(
onTap: onTap,
child: Container(
padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(24)),
padding: isBig
? EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(24))
: EdgeInsets.only(bottom: w(17)),
margin: EdgeInsets.only(right: ScreenUtil().setWidth(32)),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
... ... @@ -650,15 +734,16 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
title,
style: TextStyle(
color: Color.fromRGBO(0, 0, 0, 0.9),
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(32)),
fontWeight:
title == '立即启用' ? FontWeight.bold : FontWeight.normal,
fontSize: title == '立即启用' ? font(16) : font(14)),
),
),
Spacer(),
Image.asset(
swich
? Utils.getImgPath('swich_on')
: Utils.getImgPath('swich_off'),
? Utils.getImgPath(isBig ? 'swich_on' : 'swich_on_lit')
: Utils.getImgPath(isBig ? 'swich_off' : 'swich_off_lit'),
width: ScreenUtil().setWidth(44 * 2),
)
],
... ... @@ -798,51 +883,52 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
child: Column(
children: [
VEmptyView(56),
_item('券类型', widget.isMine ? '我的优惠券' : '店铺优惠券'),
// _item('券类型', widget.isMine ? '我的优惠券' : '店铺优惠券'),
// Container(
// height: ScreenUtil().setWidth(2),
// color: MyColours.color_E7E7E7,
// ),
// VEmptyView(24),
// widget.isMine
// ? SizedBox()
// : _canUse('是否核销', swichHexiao, () {
// setState(() {
// swichHexiao = !swichHexiao;
// });
// }),
// widget.isMine
// ? SizedBox()
// : Container(
// height: ScreenUtil().setWidth(2),
// color: MyColours.color_E7E7E7,
// ),
// widget.isMine ? SizedBox() : VEmptyView(24),
_textfield('券名称', '点击输入券名称',
_couponNameEditControl, _nameFocusNode),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
widget.isMine
? SizedBox()
: _canUse('是否核销', swichHexiao, () {
setState(() {
swichHexiao = !swichHexiao;
});
}),
widget.isMine
? SizedBox()
: Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
widget.isMine ? SizedBox() : VEmptyView(24),
_textfield('券名称', '例:9折券/200元代金券/菜品券',
_couponNameEditControl, _nameFocusNode),
VEmptyView(48),
//销售价
_textfield(widget.isMine ? '券金额' : '销售价',
'点击输入代金券金额', _priceControl, _priceFocusNode,
textInputType:
TextInputType.numberWithOptions(
decimal: true)),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
VEmptyView(48),
if (!widget.isMine)
Column(
children: [
//销售价
_textfield('销售价', '默认0元,可以免费发放',
_priceControl, _priceFocusNode,
textInputType:
TextInputType.numberWithOptions(
decimal: true)),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
// VEmptyView(24),
//券用途
VEmptyView(56),
Container(
alignment: Alignment.centerLeft,
child: Text(
... ... @@ -1060,16 +1146,18 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(48),
],
),
_textfield('券要求', '例:无门槛/满2000元',
_textfield('消费要求(0为无门槛)', '点击输入最低消费金额需求',
_couponRequireEditControl, _requireFocusNode),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
_select('有效期从', fromDate, () {
_select('活动开始于', fromDate, () {
FocusScope.of(context)
.requestFocus(FocusNode()); //点击空白处隐藏键盘
//弹出时间选择器
... ... @@ -1101,7 +1189,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
_select('有效期至', endDate, () {
_select('活动结束于', endDate, () {
FocusScope.of(context)
.requestFocus(FocusNode()); //点击空白处隐藏键盘
//弹出时间选择器
... ... @@ -1132,128 +1220,294 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
if (!widget.isMine)
Column(
children: [
//使用限制
VEmptyView(24),
Container(
alignment: Alignment.centerLeft,
child: Text(
'使用限制',
style: TextStyle(
color: Color.fromRGBO(0, 0, 0, 0.9),
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(32)),
),
),
VEmptyView(40),
Row(
children: [
HEmptyView(30),
_itemRadioWidget(limitNone, '无',
onTap: () {
if (!limitNone) {
setState(() {
limitNone = true;
limitWeek = false;
limitBirthday = false;
});
}
}),
Spacer(),
_itemRadioWidget(limitWeek, '每周',
onTap: () {
if (!limitWeek) {
setState(() {
limitWeek = true;
VEmptyView(48),
limitNone = false;
limitBirthday = false;
});
}
}),
Spacer(),
_itemRadioWidget(
limitBirthday, '会员生日当天', onTap: () {
if (!limitBirthday) {
setState(() {
limitBirthday = true;
limitNone = false;
limitWeek = false;
});
}
}),
HEmptyView(30),
],
),
if (limitWeek) VEmptyView(30),
if (limitWeek)
_select1(weekShow, '', () async {
FocusScope.of(context).requestFocus(
FocusNode()); //点击空白处隐藏键盘
//弹出时间选择器
// showPickerDateTime(context);
showDateSelWidget = false;
List<FilterBtnModel> data = await DialogUtil
.openCoponsWeekSelectModalBottomSheet(
context, weekData);
if (data != null) {
//改变了
weekData = [];
weekData.addAll(data);
weekShow = '';
String noonStr = '午餐:';
String nightStr = '晚餐:';
weekData.forEach((element) {
if (element.selectNoon!) {
noonStr += '${element.title} ';
}
if (element.selectNig!) {
nightStr += '${element.title} ';
}
});
if (noonStr.endsWith(' ')) {
noonStr = noonStr.substring(
0, noonStr.length - 1);
}
if (nightStr.endsWith(' ')) {
nightStr = nightStr.substring(
0, nightStr.length - 1);
}
_textfield('领取后有效天数', '点击输入,0表示到活动结束', _limitDay,
_limitDayFocusNode,
textInputType: TextInputType.number),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
if (noonStr == '午餐:' &&
nightStr == '晚餐:') {
weekShow = '点击设置可用日期';
} else {
if (noonStr != '午餐:' &&
nightStr != '晚餐:') {
weekShow =
noonStr + '\n' + nightStr;
} else if (noonStr != '午餐:') {
weekShow = noonStr;
} else {
weekShow = nightStr;
}
}
_select('不可用日期', weekShow, () async {
FocusScope.of(context)
.requestFocus(FocusNode()); //点击空白处隐藏键盘
//弹出时间选择器
// showPickerDateTime(context);
showDateSelWidget = false;
List<FilterBtnModel> data = await DialogUtil
.openCoponsWeekSelectModalBottomSheet(
context, weekData);
if (data != null) {
//改变了
weekData = [];
weekData.addAll(data);
weekShow = '';
String noonStr = '午餐:';
String nightStr = '晚餐:';
weekData.forEach((element) {
if (element.selectNoon!) {
noonStr += '${element.title} ';
}
if (element.selectNig!) {
nightStr += '${element.title} ';
}
});
if (noonStr.endsWith(' ')) {
noonStr = noonStr.substring(
0, noonStr.length - 1);
}
if (nightStr.endsWith(' ')) {
nightStr = nightStr.substring(
0, nightStr.length - 1);
}
if (noonStr == '午餐:' && nightStr == '晚餐:') {
weekShow = '无';
} else {
if (noonStr != '午餐:' && nightStr != '晚餐:') {
weekShow = noonStr + '\n' + nightStr;
} else if (noonStr != '午餐:') {
weekShow = noonStr;
} else {
weekShow = nightStr;
}
}
setState(() {});
}
}),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(48),
setState(() {});
}
}),
limitWeek ? VEmptyView(22) : VEmptyView(48),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(48),
Container(
alignment: Alignment.centerLeft,
child: Text(
'使用规则:',
style: TextStyle(
color: Color.fromRGBO(0, 0, 0, 0.9),
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(32)),
),
),
VEmptyView(24),
Padding(
padding: EdgeInsets.only(
left: w(32),
),
child: Column(
children: [
_canUse('领取当日可用', isSameDay, () {
setState(() {
isSameDay = !isSameDay;
});
}, isBig: false),
_canUse('可以叠加使用其他优惠券', isAccumulation, () {
setState(() {
isAccumulation = !isAccumulation;
});
}, isBig: false),
_canUse('可使用包间', isCompartment, () {
setState(() {
isCompartment = !isCompartment;
});
}, isBig: false),
_canUse('堂食可用', isEatin, () {
setState(() {
isEatin = !isEatin;
});
}, isBig: false),
_canUse('外带可用', isTakeout, () {
setState(() {
isTakeout = !isTakeout;
});
}, isBig: false),
_canUse('是否需要提前预约', isAppointment, () {
setState(() {
isAppointment = !isAppointment;
});
}, isBig: false),
],
),
),
VEmptyView(24),
Container(
alignment: Alignment.centerLeft,
child: Text(
'分享设置:',
style: TextStyle(
color: Color.fromRGBO(0, 0, 0, 0.9),
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(32)),
),
),
VEmptyView(24),
Padding(
padding: EdgeInsets.only(
left: w(32),
),
child: Column(
children: [
_canUse('用户可以分享给好友', isShareLose, () {
setState(() {
isShareLose = !isShareLose;
});
}, isBig: false),
_canUse('用户分享给好友后继续拥有此券', isShareHave, () {
setState(() {
isShareHave = !isShareHave;
});
}, isBig: false),
_canUse('分享核销后,分享用户获得佣金', isCommission, () {
setState(() {
isCommission = !isCommission;
});
}, isBig: false),
_textfield(
'分享佣金',
'点击输入佣金比例(实际消费金额计算)',
_commissionControl,
_commissionFocusNode,
textInputType: TextInputType.number),
],
),
),
VEmptyView(24),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
// if (!widget.isMine)
// Column(
// children: [
// //使用限制
// VEmptyView(24),
// Container(
// alignment: Alignment.centerLeft,
// child: Text(
// '使用限制',
// style: TextStyle(
// color: Color.fromRGBO(0, 0, 0, 0.9),
// fontWeight: FontWeight.bold,
// fontSize: ScreenUtil().setSp(32)),
// ),
// ),
// VEmptyView(40),
// Row(
// children: [
// HEmptyView(30),
// _itemRadioWidget(limitNone, '无',
// onTap: () {
// if (!limitNone) {
// setState(() {
// limitNone = true;
// limitWeek = false;
// limitBirthday = false;
// });
// }
// }),
// Spacer(),
// _itemRadioWidget(limitWeek, '每周',
// onTap: () {
// if (!limitWeek) {
// setState(() {
// limitWeek = true;
// limitNone = false;
// limitBirthday = false;
// });
// }
// }),
// Spacer(),
// _itemRadioWidget(
// limitBirthday, '会员生日当天', onTap: () {
// if (!limitBirthday) {
// setState(() {
// limitBirthday = true;
// limitNone = false;
// limitWeek = false;
// });
// }
// }),
// HEmptyView(30),
// ],
// ),
// if (limitWeek) VEmptyView(30),
// if (limitWeek)
// _select1(weekShow, '', () async {
// FocusScope.of(context).requestFocus(
// FocusNode()); //点击空白处隐藏键盘
// //弹出时间选择器
// // showPickerDateTime(context);
// showDateSelWidget = false;
// List<FilterBtnModel> data = await DialogUtil
// .openCoponsWeekSelectModalBottomSheet(
// context, weekData);
// if (data != null) {
// //改变了
// weekData = [];
// weekData.addAll(data);
// weekShow = '';
// String noonStr = '午餐:';
// String nightStr = '晚餐:';
// weekData.forEach((element) {
// if (element.selectNoon) {
// noonStr += '${element.title} ';
// }
// if (element.selectNig) {
// nightStr += '${element.title} ';
// }
// });
// if (noonStr.endsWith(' ')) {
// noonStr = noonStr.substring(
// 0, noonStr.length - 1);
// }
// if (nightStr.endsWith(' ')) {
// nightStr = nightStr.substring(
// 0, nightStr.length - 1);
// }
// if (noonStr == '午餐:' &&
// nightStr == '晚餐:') {
// weekShow = '点击设置可用日期';
// } else {
// if (noonStr != '午餐:' &&
// nightStr != '晚餐:') {
// weekShow =
// noonStr + '\n' + nightStr;
// } else if (noonStr != '午餐:') {
// weekShow = noonStr;
// } else {
// weekShow = nightStr;
// }
// }
// setState(() {});
// }
// }),
// limitWeek ? VEmptyView(22) : VEmptyView(48),
// Container(
// height: ScreenUtil().setWidth(2),
// color: MyColours.color_E7E7E7,
// ),
// VEmptyView(48),
// ],
// ),
widget.isMine ? VEmptyView(48) : VEmptyView(24),
widget.isMine
? SizedBox()
: _select('谁可以发放', '编辑', () async {
... ... @@ -1271,19 +1525,15 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
widget.isMine ? SizedBox() : VEmptyView(24),
widget.isMine
? SizedBox()
: _textfield('发放总量限制', '点击输入总数量限制',
_limitNumControl, _limitNumFocusNode,
textInputType: TextInputType.number),
widget.isMine
? SizedBox()
: Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
widget.isMine ? SizedBox() : VEmptyView(24),
widget.isMine ? SizedBox() : VEmptyView(48),
_textfield('发放总量限制', '点击输入总数量限制',
_limitNumControl, _limitNumFocusNode,
textInputType: TextInputType.number),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
_explain('券说明', '例:可用包间,停车免费,不与店内其他活动共享等'),
VEmptyView(20),
_canUse('立即启用', swichState, () {
... ... @@ -1314,6 +1564,11 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
Utils.showToast('请填写券名称');
return;
}
if (_priceControl.text.trim().length == 0) {
Utils.showToast(widget.isMine ? '请填写券金额' : '请填写销售价');
return;
}
if (!widget.isMine) {
if (money && moneyControl.text.trim().length == 0) {
Utils.showToast('请输入代金券金额!');
... ... @@ -1328,42 +1583,55 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
Utils.showToast('请输入菜品!');
return;
}
if (limitWeek && weekShow == '点击设置可用日期') {
Utils.showToast('请设置可用日期!');
return;
}
if (uids == null || uids == '') {
Utils.showToast('请设置发放人!');
return;
}
bool isNumber = Utils.isInteger(
_limitNumControl.text.trim()); //判断输入的内容是否是数字
if (!isNumber) {
Utils.showToast('发放总量限制请输入数字');
_limitNumControl.text = '';
return;
}
}
if (_couponRequireEditControl.text.trim().length == 0) {
Utils.showToast('请填写券要求');
Utils.showToast('请填写消费要求');
return;
}
if (fromDate == '点击选择') {
Utils.showToast('请选择有效期起始时间');
Utils.showToast('请选择活动开始时间');
return;
}
if (endDate == '点击选择') {
Utils.showToast('请选择有效期结束时间');
Utils.showToast('请选择活动结束时间');
return;
}
if (DateUtil.getDateTime(endDate)!
.compareTo(DateUtil.getDateTime(fromDate)!) <
if (DateUtil.getDateTime(endDate)
.compareTo(DateUtil.getDateTime(fromDate)) <
0) {
Utils.showToast('有效期结束时间不能早于起始时间');
Utils.showToast('活动结束时间不能早于活动开始时间');
return;
}
if (_limitDay.text.trim().length == 0) {
Utils.showToast('请填写领取后有效天数');
return;
}
if (isCommission &&
(_commissionControl.text.trim().length == 0 ||
_commissionControl.text == '0')) {
Utils.showToast('请填写分享佣金的比例');
return;
}
if (!widget.isMine) {
if (uids == null || uids == '') {
Utils.showToast('请设置发放人!');
return;
}
}
if (_limitNumControl.text.trim().length == 0) {
Utils.showToast('请填写发放总量限制');
return;
}
// bool isNumber = Utils.isInteger(
// _limitNumControl.text.trim()); //判断输入的内容是否是数字
// if (!isNumber) {
// Utils.showToast('发放总量限制请输入数字');
// _limitNumControl.text = '';
// return;
// }
// ***参数***
// _couponNameEditControl.text
... ... @@ -1376,8 +1644,8 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
}
},
text: '立即创建',
fontSize: 24,
isBold: false,
fontSize: 32,
isBold: true,
height: ScreenUtil().setWidth(37 * 2),
width: ScreenUtil().setWidth(130 * 2),
radius: ScreenUtil().setWidth(22),
... ...
import 'package:common_utils/common_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/models/coupon_model.dart';
import 'package:one_key/res/colors.dart';
... ... @@ -19,16 +20,17 @@ class CouponItemF extends StatefulWidget {
final bool showBtn;
final bool showCheck;
final bool radio;
CouponItemF(
{Key? key,
this.from,
this.onPressed,
this.onPressedSwich,
this.couponSonModel,
this.showBtn = false,
this.showCheck = false,
this.radio = false})
: super(key: key);
CouponItemF({
Key? key,
this.from,
this.onPressed,
this.onPressedSwich,
this.couponSonModel,
this.showBtn = false,
this.showCheck = false,
this.radio = false,
}) : super(key: key);
@override
_CouponItemFState createState() => _CouponItemFState();
... ... @@ -58,318 +60,526 @@ class _CouponItemFState extends State<CouponItemF> {
5,
context);
}
return Column(children: [
Stack(
alignment: widget.from == 'select'
? Alignment.centerLeft
: AlignmentDirectional.topStart,
children: [
InkWell(
onTap: widget.onPressed,
child: Container(
// width: ScreenUtil().setWidth(610),
margin: EdgeInsets.fromLTRB(
ScreenUtil().setWidth(40),
ScreenUtil().setWidth(0),
ScreenUtil().setWidth(40),
ScreenUtil().setWidth(0)),
decoration: BoxDecoration(
color: MyColours.color_ffffff,
boxShadow: [
BoxShadow(
spreadRadius: ScreenUtil().setWidth(2),
color: Color.fromRGBO(0, 0, 0, 0.25),
offset: Offset(0, ScreenUtil().setWidth(8)),
blurRadius: ScreenUtil().setWidth(8))
],
borderRadius: BorderRadius.all(
Radius.circular(ScreenUtil().setWidth(16)),
),
),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
height: ScreenUtil().setWidth(40),
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(24)),
decoration: BoxDecoration(
color: widget.from == 'history'
? MyColours.color_BFC4D4
: notSelect
? sunModel.isType == '1'
? sunModel.isMarking
? MyColours.color_00A870
: MyColours.color_438E93
: MyColours.color_ED7B2F
: MyColours.color_999999,
borderRadius: BorderRadius.only(
topLeft:
Radius.circular(ScreenUtil().setWidth(16)),
topRight: Radius.circular(
ScreenUtil().setWidth(16)))),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
sunModel.isType == '1'
? sunModel.isExamine == '1'
? '店铺优惠券(核销)'
: '店铺优惠券'
: '我的优惠券',
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(24)),
),
InkWell(
onTap: widget.onPressedSwich,
child: Text(
sunModel.isType == '1'
? sunModel.isExamine == '1'
? '被领取:${sunModel.receiveNum}张 已核销:${sunModel.useNum}张'
: '创建人:${sunModel.nickname ?? sunModel.uid} 被领取:${sunModel.receiveNum}张'
: '被领取:${sunModel.receiveNum}张',
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(20))),
),
],
return InkWell(
onTap: widget.onPressed,
child: Column(children: [
Stack(
alignment: widget.from == 'select'
? Alignment.centerLeft
: AlignmentDirectional.topStart,
children: [
Row(
children: [
HEmptyView(20),
widget.from == 'select'
? Image.asset(
Utils.getImgPath(sunModel.isCheck
? widget.radio
? 'c_mul_select'
: 'select_f'
: widget.radio
? 'c_not_edit'
: 'show_select_f'),
width: w(20),
)
: Container(),
Expanded(
child: Container(
// width: ScreenUtil().setWidth(610),
margin: EdgeInsets.fromLTRB(
ScreenUtil().setWidth(20),
ScreenUtil().setWidth(0),
ScreenUtil().setWidth(40),
ScreenUtil().setWidth(0)),
decoration: BoxDecoration(
color: MyColours.color_ffffff,
boxShadow: [
BoxShadow(
spreadRadius: ScreenUtil().setWidth(2),
color: Color.fromRGBO(0, 0, 0, 0.25),
offset: Offset(0, ScreenUtil().setWidth(8)),
blurRadius: ScreenUtil().setWidth(8))
],
borderRadius: BorderRadius.all(
Radius.circular(ScreenUtil().setWidth(16)),
),
),
Container(
padding: EdgeInsets.fromLTRB(
ScreenUtil().setWidth(24 * 2),
ScreenUtil().setWidth(9 * 2),
ScreenUtil().setWidth(10),
ScreenUtil().setWidth(20)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: ScreenUtil().setWidth(232 * 2),
child: Container(
height: ScreenUtil().setWidth(25 * 2),
constraints: BoxConstraints(
maxWidth: ScreenUtil().setWidth(190)),
child: Text(
sunModel.aname!,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: widget.from == 'history'
? MyColours.color_BFC4D4
: notSelect
? MyColours.color_515151
: MyColours.color_999999,
fontSize: ScreenUtil().setSp(36),
fontWeight: FontWeight.bold),
),
)),
Container(
height: ScreenUtil().setWidth(14 * 2),
width: ScreenUtil().setWidth(232 * 2),
child: Text('${sunModel.desc}',
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: widget.from == 'history'
? MyColours.color_BFC4D4
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
height: ScreenUtil().setWidth(40),
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(24)),
decoration: BoxDecoration(
color: widget.from == 'history'
? MyColours.color_BFC4D4
: widget.from == 'setting'
? MyColours.color_00A870
: notSelect
? MyColours.color_515151
? sunModel.isType == '1' ||
sunModel.isType == '3' ||
sunModel.isType == '4'
? sunModel.isMarking
? MyColours.color_00A870
: MyColours.color_438E93
: MyColours.color_ED7B2F
: MyColours.color_999999,
fontSize: ScreenUtil().setSp(20),
)),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(
ScreenUtil().setWidth(16)),
topRight: Radius.circular(
ScreenUtil().setWidth(16)))),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
sunModel.isType == '1'
? '付费优惠券'
: sunModel.isType == '2'
? '我的优惠券'
: sunModel.isType == '3'
? '免费代金券'
: '付费优惠券',
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(24)),
),
InkWell(
onTap: widget.onPressedSwich,
child: Text(
sunModel.isType == '1'
? sunModel.isExamine == '1'
? sunModel.receiveNum == null
? ''
: '被领取:${sunModel.receiveNum}张 已核销:${sunModel.useNum}张'
: '创建人:${sunModel.nickname ?? sunModel.uid} 被领取:${sunModel.receiveNum}张'
: sunModel.isType == '2'
? '被领取:${sunModel.receiveNum}张'
: sunModel.receiveNum == null
? ''
: '被领取:${sunModel.receiveNum}张 已核销:${sunModel.useNum}张',
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(20))),
),
],
),
VEmptyView(16),
(ObjectUtil.isNotEmpty(sunModel.stime) &&
sunModel.stime != '0') ||
(ObjectUtil.isNotEmpty(sunModel.etime) &&
sunModel.etime != '0')
? Container(
child: Text(
'使用时间:${ObjectUtil.isNotEmpty(sunModel.stime) ? Utils.getDateStrFromJiekou(sunModel.stime) : '--'} 至 ${ObjectUtil.isNotEmpty(sunModel.etime) ? Utils.getDateStrFromJiekou(sunModel.etime) : '--'}',
style: TextStyle(
color: widget.from == 'history'
? MyColours.color_BFC4D4
: MyColours.color_999999,
fontSize: ScreenUtil().setSp(20))),
)
: Container(),
],
),
// widget.from == 'select'
// ? widget.showCheck
// ? Positioned(
// right: 0,
// top: ScreenUtil().setWidth(20),
// child: Image.asset(
// Utils.getImgPath(widget.couponSonModel.isCheck
// ? 'check_r'
// : 'check_un'),
// width: ScreenUtil().setWidth(40),
// height: ScreenUtil().setWidth(40),
// ))
// : Container()
// :
),
ObjectUtil.isNotEmpty(sunModel.explain)
? const MySeparator(
width: 3, color: MyColours.color_f3f3f3)
: SizedBox(),
ObjectUtil.isNotEmpty(sunModel.explain)
? InkWell(
onTap: () {
if (explainH > 19) {
setState(() {
widget.couponSonModel!.showText =
!widget.couponSonModel!.showText;
});
}
},
child: Container(
width: double.infinity,
decoration: BoxDecoration(
color: widget.from == 'history'
? MyColours.color_ffffff
: notSelect
? MyColours.color_ffffff
: MyColours.color_FAFAFA,
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(
ScreenUtil().setWidth(20)),
bottomRight: Radius.circular(
ScreenUtil().setWidth(20)))),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
widget.couponSonModel!.showText
? Container(
padding: EdgeInsets.fromLTRB(
ScreenUtil().setWidth(24 * 2),
ScreenUtil().setWidth(14),
ScreenUtil().setWidth(0),
ScreenUtil().setWidth(14)),
width: ScreenUtil().screenWidth -
ScreenUtil().setWidth(92 * 2),
child: Text(
'说明:${sunModel.explain}',
maxLines: 5,
style: TextStyle(
color: widget.from ==
'history'
? MyColours
.color_BFC4D4
: MyColours
.color_999999,
fontSize: ScreenUtil()
.setSp(20))),
)
: Container(
padding: EdgeInsets.fromLTRB(
ScreenUtil().setWidth(24 * 2),
ScreenUtil().setWidth(14),
ScreenUtil().setWidth(0),
ScreenUtil().setWidth(14)),
width: ScreenUtil().screenWidth -
ScreenUtil()
.setWidth(92 * 2) +
ScreenUtil().setWidth(20),
child: Text(
'说明:${sunModel.explain}',
maxLines: 1,
overflow: TextOverflow.fade,
softWrap: false,
style: TextStyle(
color: widget.from ==
'history'
? MyColours
.color_BFC4D4
: MyColours
.color_999999,
fontSize: ScreenUtil()
.setSp(20))),
),
Container(
padding: EdgeInsets.fromLTRB(
ScreenUtil().setWidth(24 * 2),
ScreenUtil().setWidth(9 * 2),
ScreenUtil().setWidth(10),
ScreenUtil().setWidth(20)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Expanded(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Container(
// width: ScreenUtil()
// .setWidth(232 * 2),
child: Container(
height: ScreenUtil().setWidth(25 * 2),
constraints: BoxConstraints(
maxWidth:
ScreenUtil().setWidth(190)),
child: Text(
sunModel.aname ??'',
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: widget.from == 'history'
? MyColours.color_BFC4D4
: notSelect
? MyColours.color_515151
: MyColours
.color_999999,
fontSize:
ScreenUtil().setSp(36),
fontWeight: FontWeight.bold),
),
)),
Container(
height: ScreenUtil().setWidth(14 * 2),
width: ScreenUtil().setWidth(232 * 2),
child: Text(
sunModel.isType == '1' ||
sunModel.isType == '2'
? '${sunModel.desc}'
: sunModel.desc == '0'
? ''
: '消费满${sunModel.desc}元可用',
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: widget.from == 'history'
? MyColours.color_BFC4D4
: notSelect
? MyColours.color_515151
: MyColours
.color_999999,
fontSize:
ScreenUtil().setSp(20),
)),
),
],
)),
if (widget.from == 'select' &&
sunModel.isType == '3' &&
widget.radio)
Row(
children: [
InkWell(
onTap: () {
if (sunModel.number == 0) {
return;
}
sunModel.number--;
sunModel.numberC.text =
'${sunModel.number}';
},
child: Container(
height: w(40),
padding: EdgeInsets.symmetric(
horizontal: w(10)),
child: Image.asset(
Utils.getImgPath(
'plan_dish_minus'),
width: w(8),
),
),
Spacer(),
explainH > 19
? Container(
margin: EdgeInsets.only(
top:
ScreenUtil().setWidth(10),
right: ScreenUtil()
.setWidth(16)),
),
Container(
// constraints: BoxConstraints(
// minWidth: w(34),
// ),
width: w(30),
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(
r(5)),
border: Border.all(
width: w(1),
color: MyColours
.color_438E93)),
// constraints: BoxConstraints(minWidth: w(20)),
child: TextField(
maxLines: 1,
controller: sunModel.numberC,
// focusNode: _focusNode,
// autofocus: true,
inputFormatters: [
FilteringTextInputFormatter
.allow(RegExp(r'[0-9]')),
],
style: TextStyle(
color:
MyColours.color_438E93,
fontSize: font(11)),
textAlign: TextAlign.center,
// textAlignVertical: TextAlignVertical.center,
decoration: InputDecoration(
hintText: "数量",
isCollapsed: true,
hintStyle: TextStyle(
color:
MyColours.color_999999,
fontSize: font(11),
),
// isCollapsed:
// true, //重点,相当于高度包裹的意思,必须设置为true,不然有默认奇妙的最小高度
border: OutlineInputBorder(
borderSide:
BorderSide.none),
contentPadding:
EdgeInsets.only(
top: w(2),
bottom: w(2)),
),
keyboardType: TextInputType
.numberWithOptions(
decimal: true),
textInputAction:
TextInputAction.done,
onChanged: (value) {
// bool isNumber = Utils.isNumeric(
// value); //判断输入的内容是否是数字
// if (!isNumber) {
// Utils.showToast('请输入数字');
// pNumC.text = '';
// return;
// } else {
if (value != null &&
value != '') {
if (int.parse(value) >
int.parse(sunModel
.grantNum??'0')) {
Utils.showToast(
'最大数量限制为${sunModel.grantNum}');
sunModel.numberC.text =
sunModel.grantNum??'';
sunModel.number =
int.parse(sunModel
.grantNum??'0');
return;
}
sunModel.number =
int.parse(value);
}
// }
// setState(() {});
// _searchSellerLocation();
// customerProvider.searchData(value);
},
onEditingComplete: () {
FocusScope.of(context)
.requestFocus(
FocusNode()); //点击空白处隐藏键盘
// contantShowModel.searchData(
// contantShowModel.controller.text);
// _searchSellerLocation();
// _focusNode.unfocus();
},
)),
InkWell(
onTap: () {
if (sunModel.number ==
int.parse(
sunModel.grantNum??'0')) {
Utils.showToast('已达到最大数量限制');
return;
}
sunModel.number++;
sunModel.numberC.text =
'${sunModel.number}';
},
child: Container(
height: w(40),
padding: EdgeInsets.only(
left: w(10), right: w(10)),
child: Image.asset(
!widget.couponSonModel!
.showText
? Utils.getImgPath(
'quan_down_f')
: Utils.getImgPath(
'quan_up_f'),
Utils.getImgPath(
'plan_dish_add'),
width: w(8),
),
),
),
],
),
if (widget.from == 'setting' &&
sunModel.isType == '3')
Padding(
padding:
EdgeInsets.only(right: w(20)),
child: Text(
'${sunModel.number}张',
style: TextStyle(
fontSize: font(12),
fontWeight: FontWeight.bold,
color: MyColours.color_438E93),
))
],
),
VEmptyView(16),
(ObjectUtil.isNotEmpty(sunModel.stime) &&
sunModel.stime != '0') ||
(ObjectUtil.isNotEmpty(
sunModel.etime) &&
sunModel.etime != '0')
? Container(
child: Text(
'使用时间:${ObjectUtil.isNotEmpty(sunModel.stime) ? Utils.getDateStrFromJiekou(sunModel.stime) : '--'} 至 ${ObjectUtil.isNotEmpty(sunModel.etime) ? Utils.getDateStrFromJiekou(sunModel.etime) : '--'}',
style: TextStyle(
color: widget.from == 'history'
? MyColours.color_BFC4D4
: MyColours.color_999999,
fontSize:
ScreenUtil().setSp(20))),
)
: Container(),
],
),
// widget.from == 'select'
// ? widget.showCheck
// ? Positioned(
// right: 0,
// top: ScreenUtil().setWidth(20),
// child: Image.asset(
// Utils.getImgPath(widget.couponSonModel.isCheck
// ? 'check_r'
// : 'check_un'),
// width: ScreenUtil().setWidth(40),
// height: ScreenUtil().setWidth(40),
// ))
// : Container()
// :
),
ObjectUtil.isNotEmpty(sunModel.explain)
? const MySeparator(
width: 3, color: MyColours.color_f3f3f3)
: SizedBox(),
ObjectUtil.isNotEmpty(sunModel.explain)
? InkWell(
onTap: () {
if (explainH > 19) {
setState(() {
widget.couponSonModel!.showText =
!widget.couponSonModel!.showText;
});
}
},
child: Container(
width: double.infinity,
decoration: BoxDecoration(
color: widget.from == 'history'
? MyColours.color_ffffff
: notSelect
? MyColours.color_ffffff
: MyColours.color_FAFAFA,
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(
ScreenUtil().setWidth(20)),
bottomRight: Radius.circular(
ScreenUtil().setWidth(20)))),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
widget.couponSonModel!.showText
? Container(
padding: EdgeInsets.fromLTRB(
ScreenUtil()
.setWidth(24 * 2),
ScreenUtil().setWidth(14),
ScreenUtil().setWidth(0),
ScreenUtil()
.setWidth(14)),
width:
ScreenUtil().setWidth(28),
height: ScreenUtil()
.setWidth(28)),
)
: Container(),
HEmptyView(14)
],
)),
)
: Container(),
VEmptyView(32),
],
),
)),
Positioned(
left: ScreenUtil().setWidth(21),
child: widget.from == 'select'
? Image.asset(
Utils.getImgPath(sunModel.isCheck
? widget.radio
? 'select_f'
: 'c_mul_select'
: widget.radio
? 'show_select_f'
: 'c_not_edit'),
width: w(25),
)
: Container()),
Positioned(
right: ScreenUtil().setWidth(100),
top: ScreenUtil().setWidth(37 * 2),
child: widget.showBtn
? RoundButton(
width: widget.from == 'history'
? ScreenUtil().setWidth(44 * 2)
: ScreenUtil().setWidth(32 * 2),
height: ScreenUtil().setWidth(21 * 2),
radius: ScreenUtil().setWidth(10),
text: widget.from == 'history'
? '已过期'
: notSelect
? '停用'
: '启用',
fontSize: 24,
textColor: widget.from == 'history'
? MyColours.color_BFC4D4
: notSelect
? MyColours.color_438E93
: MyColours.color_999999,
gradientStart: MyColours.color_ffffff,
gradientEnd: MyColours.color_ffffff,
borderColor: widget.from == 'history'
? MyColours.color_BFC4D4
: notSelect
? MyColours.color_438E93
: MyColours.color_999999,
onPressed: widget.onPressedSwich,
)
: Container())
]),
VEmptyView(32)
]);
ScreenUtil().screenWidth -
ScreenUtil()
.setWidth(92 * 2),
child: Text(
'说明:${sunModel.explain}',
maxLines: 5,
style: TextStyle(
color: widget.from ==
'history'
? MyColours
.color_BFC4D4
: MyColours
.color_999999,
fontSize: ScreenUtil()
.setSp(20))),
)
: Container(
padding: EdgeInsets.fromLTRB(
ScreenUtil()
.setWidth(24 * 2),
ScreenUtil().setWidth(14),
ScreenUtil().setWidth(0),
ScreenUtil()
.setWidth(14)),
width: ScreenUtil()
.screenWidth -
ScreenUtil()
.setWidth(92 * 2) +
ScreenUtil().setWidth(20),
child: Text(
'说明:${sunModel.explain}',
maxLines: 1,
overflow:
TextOverflow.fade,
softWrap: false,
style: TextStyle(
color: widget.from ==
'history'
? MyColours
.color_BFC4D4
: MyColours
.color_999999,
fontSize: ScreenUtil()
.setSp(20))),
),
Spacer(),
explainH > 19
? Container(
margin: EdgeInsets.only(
top: ScreenUtil()
.setWidth(10),
right: ScreenUtil()
.setWidth(16)),
child: Image.asset(
!widget.couponSonModel!
.showText
? Utils.getImgPath(
'quan_down_f')
: Utils.getImgPath(
'quan_up_f'),
width: ScreenUtil()
.setWidth(28),
height: ScreenUtil()
.setWidth(28)),
)
: Container(),
HEmptyView(14)
],
)),
)
: Container(),
VEmptyView(32),
],
),
)),
],
),
Positioned(
right: ScreenUtil().setWidth(100),
top: ScreenUtil().setWidth(37 * 2),
child: widget.showBtn
? RoundButton(
width: widget.from == 'history'
? ScreenUtil().setWidth(44 * 2)
: ScreenUtil().setWidth(32 * 2),
height: ScreenUtil().setWidth(21 * 2),
radius: ScreenUtil().setWidth(10),
text: widget.from == 'history'
? '已过期'
: notSelect
? '停用'
: '启用',
fontSize: 24,
textColor: widget.from == 'history'
? MyColours.color_BFC4D4
: notSelect
? MyColours.color_438E93
: MyColours.color_999999,
gradientStart: MyColours.color_ffffff,
gradientEnd: MyColours.color_ffffff,
borderColor: widget.from == 'history'
? MyColours.color_BFC4D4
: notSelect
? MyColours.color_438E93
: MyColours.color_999999,
onPressed: widget.onPressedSwich,
)
: Container())
]),
VEmptyView(32)
]));
}
}
... ...
... ... @@ -194,14 +194,14 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin {
backgroundColor: MyColours.color_f3f3f3,
appBar: Utils.getAuthority(context, '线上券-设置')
? SystemAppBar(
'线上券',
'优惠券',
rightImgName: 'set_g.png',
onTapRight: () {
NavigatorUtil.goCouponSettingPage(context);
},
)
: SystemAppBar(
'线上券',
'优惠券',
),
body: Column(
children: <Widget>[
... ... @@ -211,16 +211,22 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin {
color: MyColours.color_ffffff,
padding: EdgeInsets.only(bottom: ScreenUtil().setWidth(6)),
child: TabBar(
isScrollable: true, // 允许滚动
padding: EdgeInsets.only(left: w(15)),
// labelPadding:
// EdgeInsets.only(left: 16.0, right: 16.0), // 调整标签周围的空白区域
controller: tabController,
tabs: [
Tab(
text: "全部",
),
Tab(
text: "店铺优惠券",
text: "免费代金券",
),
Tab(
text: "我的优惠券",
text: "付费优惠券",
),
Tab(
text: "核销记录",
... ... @@ -233,7 +239,7 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin {
unselectedLabelColor: MyColours.color_999999,
labelStyle: TextStyle(
color: MyColours.color_438E93,
fontSize: ScreenUtil().setSp(25),
fontSize: ScreenUtil().setSp(28),
fontWeight: FontWeight.bold),
unselectedLabelStyle: TextStyle(
color: MyColours.color_999999,
... ... @@ -254,12 +260,12 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin {
create: (_) => PersonnelProvider(),
child: ChangeNotifierProvider<MarketingCenterProvider>(
create: (_) => MarketingCenterProvider(),
child: CouponSunPage(index: 1))),
child: CouponSunPage(index: 3))),
ChangeNotifierProvider<PersonnelProvider>(
create: (_) => PersonnelProvider(),
child: ChangeNotifierProvider<MarketingCenterProvider>(
create: (_) => MarketingCenterProvider(),
child: CouponSunPage(index: 2))),
child: CouponSunPage(index: 4))),
ChangeNotifierProvider<PersonnelProvider>(
create: (_) => PersonnelProvider(),
child: CouponHasVerificationPage()),
... ... @@ -271,8 +277,8 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin {
padding: EdgeInsets.only(
top: ScreenUtil().setWidth(16 * 2),
bottom: ScreenUtil().setWidth(35 * 2),
left: ScreenUtil().setWidth(45 * 2),
right: ScreenUtil().setWidth(45 * 2),
left: ScreenUtil().setWidth(23 * 2),
right: ScreenUtil().setWidth(23 * 2),
),
decoration: BoxDecoration(
color: MyColours.color_ffffff,
... ... @@ -293,10 +299,10 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin {
tabController!.index == 3
? Expanded(
child: RoundButton(
text: '扫码核销',
text: '扫码核销付费券',
width: tabController!.index == 3
? double.infinity
: w(100),
: w(218),
gradientStart: MyColours.color_ffffff,
gradientEnd: MyColours.color_ffffff,
borderColor: MyColours.color_438E93,
... ... @@ -304,15 +310,15 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin {
height: ScreenUtil().setWidth(80),
radius: ScreenUtil().setWidth(14),
isBold: true,
fontSize: 28,
fontSize:32,
onPressed: () async {
_scan();
},
),
)
: RoundButton(
text: '扫码核销',
width: w(100),
text: '扫码核销付费券',
width: w(218),
gradientStart: MyColours.color_ffffff,
gradientEnd: MyColours.color_ffffff,
borderColor: MyColours.color_438E93,
... ... @@ -320,7 +326,7 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin {
height: ScreenUtil().setWidth(80),
radius: ScreenUtil().setWidth(14),
isBold: true,
fontSize: 28,
fontSize: 32,
onPressed: () async {
_scan();
},
... ... @@ -329,15 +335,15 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin {
if (tabController!.index != 3)
Expanded(
child: RoundButton(
text: '创建新的优惠券',
text: '创建新券',
height: ScreenUtil().setWidth(80),
radius: ScreenUtil().setWidth(14),
isBold: false,
fontSize: 28,
isBold: true,
fontSize: 32,
onPressed: () async {
// UserModel userModel =
// Provider.of<UserModel>(context, listen: false);
if (Utils.getAuthority(context, '创建新的优惠券')) {
if (Utils.getAuthority(context, '创建新券')) {
NavigatorUtil.goCouponCreateSelectTypePage(context);
}
// if (userModel.user.role_name == '管理员' ||
... ...
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/pages/coupon/coupon_item_f.dart';
import 'package:one_key/widgets/system_app_bar.dart';
import 'package:provider/provider.dart';
... ... @@ -40,7 +40,9 @@ class _CouponSettingPageState extends State<CouponSettingPage> {
bool isOnlineBook = false; //在线预订
bool isOrder = false; //提前点餐
bool isLink = false; //充值优惠活动链接
bool isCoupon = false; // 代金券
bool isCouponFree = false; // 代金券免费
bool isCouponPay = false; // 代金券付费
bool isRecharge = false; //充值券
String? welcome = '';
String? qiniuUrl = '';
... ... @@ -49,6 +51,11 @@ class _CouponSettingPageState extends State<CouponSettingPage> {
String rechargeContent = '';
List<CouponSunModel>? couponDataList = [];
List<CouponSunModel>? couponDataListFree = [];
List<CouponSunModel>? couponDataListPay = [];
List<CouponSunModel>? couponSelectFree = [];
List<CouponSunModel>? couponSelectPay = [];
bool isComments = false; //启用评价设置
bool isCommentsCoupon = false; //启用评价送券
List<CouponSunModel> couponDataListComments = [];
... ... @@ -62,7 +69,9 @@ class _CouponSettingPageState extends State<CouponSettingPage> {
getSellerTemplateConf() async {
bool success = await marketingCenterProvider.getSellerTemplateConf(context);
if (success && marketingCenterProvider.markDataModel!.marketing != null) {
if (success &&
marketingCenterProvider.markDataModel != null &&
marketingCenterProvider.markDataModel!.marketing != null) {
isTranspond =
marketingCenterProvider.markDataModel!.marketing!.isTranspond == '1'
? true
... ... @@ -83,9 +92,14 @@ class _CouponSettingPageState extends State<CouponSettingPage> {
? true
: false;
isCoupon = marketingCenterProvider.markDataModel!.marketing!.isCoupon == '1'
? true
: false;
isCouponPay =
marketingCenterProvider.markDataModel!.marketing!.isCouponPay == '1'
? true
: false;
isCouponFree =
marketingCenterProvider.markDataModel!.marketing!.isCouponFree == '1'
? true
: false;
isRecharge =
marketingCenterProvider.markDataModel!.marketing!.isRecharge == '1'
... ... @@ -94,8 +108,12 @@ class _CouponSettingPageState extends State<CouponSettingPage> {
rechargeData =
marketingCenterProvider.markDataModel!.marketing!.rechargeData;
couponDataList =
marketingCenterProvider.markDataModel!.marketing!.couponDataList ?? [];
couponSelectPay =
marketingCenterProvider.markDataModel!.marketing!.couponDataListPay ??
[];
couponSelectFree = marketingCenterProvider
.markDataModel!.marketing!.couponDataListFree ??
[];
couponDataListComments = marketingCenterProvider
.markDataModel!.marketing!.couponDataListComments ??
[];
... ... @@ -120,6 +138,10 @@ class _CouponSettingPageState extends State<CouponSettingPage> {
///优惠券设置
_setCouponShow() async {
List couponSelectFreeTemp = [];
couponSelectFree!.forEach((element) {
couponSelectFreeTemp.add(element.toJson());
});
//接口
Map marketingData = {
// 'isTranspond': isTranspond ? '1' : '0', //转发同行客人
... ... @@ -127,13 +149,15 @@ class _CouponSettingPageState extends State<CouponSettingPage> {
'is_arrival': isArrival ? '1' : '0', //确认到店
'is_online_book': isOnlineBook ? '1' : '0', //在线预订
'is_order': isOrder ? '1' : '0', //去点餐
'is_coupon': isCoupon ? '1' : '0', //代金券暂时
'is_coupon_free': isCouponFree ? '1' : '0', //代金券暂时免费
'is_coupon_pay': isCouponPay ? '1' : '0', //代金券暂时付费
'is_recharge': isRecharge ? '1' : '0', //充值券暂时
'is_link': isLink ? '1' : '0',
'wecomle': welcome ?? '',
'logo': qiniuUrl,
'recharge_data': rechargeData,
'coupon_data': json.encode(couponDataList),
'coupon_data_free': couponSelectFreeTemp,
'coupon_data_pay': json.encode(couponSelectPay),
'is_comments': isComments ? '1' : '0',
'is_comments_coupon': isCommentsCoupon ? '1' : '0',
'coupon_data_comments': json.encode(couponDataListComments),
... ... @@ -162,14 +186,30 @@ class _CouponSettingPageState extends State<CouponSettingPage> {
};
params['status'] = '1';
await couponProvider.getCustomerSelectActivityMarking(context, params,
isShowLoading: isShowLoading);
if (couponDataList == null || couponDataList!.length == 0) {
if (couponProvider.couponListSelect != null &&
couponProvider.couponListSelect!.length > 0) {
couponDataList!.add(couponProvider.couponListSelect![0]);
}
List<CouponSunModel>? couponData =
await couponProvider.getCustomerSelectActivityMarking(context, params,
isShowLoading: isShowLoading);
if (couponData != null) {
//组装免费、付费数据
couponData.forEach((element) {
if (element.isType == '3') {
couponDataListFree!.add(element);
} else if (element.isType == '4') {
couponDataListPay!.add(element);
}
});
}
// if (couponSelectFree == null || couponSelectFree.length == 0) {
// if (couponDataListFree != null && couponDataListFree.length > 0) {
// couponSelectFree.add(couponDataListFree[0]);
// }
// }
// if (couponSelectPay == null || couponSelectPay.length == 0) {
// if (couponDataListPay != null && couponDataListPay.length > 0) {
// couponSelectPay.add(couponDataListPay[0]);
// }
// }
setState(() {});
}
... ... @@ -194,75 +234,91 @@ class _CouponSettingPageState extends State<CouponSettingPage> {
///优惠券
Widget _markingCupon({
VoidCallback? onPressed,
required String title,
List<CouponSunModel>? coupon,
required VoidCallback onPressed,
bool select = false,
VoidCallback? onPressedSelect,
}) {
return Container(
margin: EdgeInsets.only(left: w(21), top: w(12), right: w(21)),
child: Column(
children: [
InkWell(
onTap: onPressedSelect,
child: Row(
children: [
Image.asset(
Utils.getImgPath(select ? 'f_select' : 'f_select_not'),
width: w(20),
),
HEmptyView(20),
Text(
'推荐店内优惠券活动',
style: TextStyle(
fontSize: font(14), color: MyColours.color_515151),
),
Spacer(),
RoundButton(
text: '选择活动',
width: w(72),
height: w(22),
gradientStart: MyColours.color_ffffff,
gradientEnd: MyColours.color_ffffff,
borderColor: MyColours.color_438E93,
textColor: MyColours.color_438E93,
radius: r(11),
fontSize: 24,
isBold: true,
onPressed: onPressed,
)
],
)),
VEmptyView(20),
ListView.builder(
shrinkWrap: true,
controller: controller,
itemCount: couponDataList!.length,
itemBuilder: (BuildContext context, int index) {
CouponSunModel couponData = couponDataList![index];
return _markingCuponItem(
couponData.aname!,
_getCouponsDesc(couponData),
couponData.price ?? '',
couponData.use != null && couponData.use!.isCash
? '${(double.parse(couponData.price) / double.parse(couponData.use!.cash!)) * 10}折'
: '',
'切换活动',
select: isCoupon, onPressedSelect: () {
setState(() {
isCoupon = !isCoupon;
});
});
})
],
),
return Column(
children: [
Container(
margin: EdgeInsets.only(left: w(21), top: w(12), right: w(21)),
child: InkWell(
onTap: onPressedSelect,
child: Row(
children: [
Image.asset(
Utils.getImgPath(select ? 'f_select' : 'f_select_not'),
width: w(20),
),
HEmptyView(20),
Text(
title,
style: TextStyle(
fontSize: font(14), color: MyColours.color_515151),
),
Spacer(),
RoundButton(
text: '选择活动',
width: w(72),
height: w(22),
gradientStart: MyColours.color_ffffff,
gradientEnd: MyColours.color_ffffff,
borderColor: MyColours.color_438E93,
textColor: MyColours.color_438E93,
radius: r(11),
fontSize: 24,
isBold: true,
onPressed: onPressed,
)
],
))),
VEmptyView(20),
ListView.builder(
shrinkWrap: true,
controller: controller,
itemCount: coupon!.length,
itemBuilder: (BuildContext context, int index) {
CouponSunModel couponData = coupon[index];
return CouponItemF(
from: 'setting',
couponSonModel: couponData,
showBtn: false,
onPressedSwich: () {
// couponProvider.couponList[index].isOpenBool =
// !couponProvider.couponList[index].isOpenBool;
// _setCustomerActivity(index);
},
onPressed: () {
NavigatorUtil.goCouponDetailPage(
context, couponData,
idStr: couponData.id);
},
);
// return _markingCuponItem(
// couponData.aname,
// _getCouponsDesc(couponData),
// couponData.price ?? '',
// couponData.use != null && couponData.use.isCash
// ? '${(double.parse(couponData.price) / double.parse(couponData.use.cash)) * 10}折'
// : '',
// '切换活动',
// select: isCoupon, onPressedSelect: () {
// setState(() {
// isCoupon = !isCoupon;
// });
// });
})
],
);
}
String? _getCouponsDesc(couponData) {
String? couponsDesc = '';
String _getCouponsDesc(couponData) {
String couponsDesc = '';
if (couponData != null) {
if (couponData.expDate == null) {
couponsDesc = couponData.desc;
couponsDesc = couponData.desc ?? '';
} else {
if (couponData.expDate.isNone) {
couponsDesc = '无限制,' + (couponData.desc ?? '');
... ... @@ -427,22 +483,25 @@ class _CouponSettingPageState extends State<CouponSettingPage> {
children: [
_headItem('预订安排中附带的营销推广'),
VEmptyView(24),
couponProvider.couponListSelect != null &&
couponProvider.couponListSelect!.length > 0
couponDataListPay != null && couponDataListPay!.length > 0
? _markingCupon(
select: isCoupon,
title: '预订安排中推荐付费优惠券活动',
coupon: couponSelectPay,
select: isCouponPay,
onPressedSelect: () {
setState(() {
isCoupon = !isCoupon;
isCouponPay = !isCouponPay;
});
},
onPressed: () async {
//切换活动
Map? temp =
await NavigatorUtil.goMarkingCouponSelectPage(
context, {'object': couponDataList}) ;
context,
'4',
{'object': couponSelectPay});
if (temp != null && temp['coupon'] != null) {
couponDataList = temp['coupon'];
couponSelectPay = temp['coupon'];
setState(() {});
}
... ... @@ -450,7 +509,37 @@ class _CouponSettingPageState extends State<CouponSettingPage> {
: (couponProvider.couponListSelect == null ||
couponProvider.couponListSelect!.length == 0)
? _markingItem(
'推荐店内优惠券活动',
'预订安排中推荐付费优惠券活动', '当前没有可用优惠券,请创建优惠券后再来尝试。',
select: false)
: SizedBox(),
VEmptyView(24),
couponDataListFree != null && couponDataListFree!.length > 0
? _markingCupon(
title: '预订安排中免费赠送代金券',
coupon: couponSelectFree,
select: isCouponFree,
onPressedSelect: () {
setState(() {
isCouponFree = !isCouponFree;
});
},
onPressed: () async {
//切换活动
dynamic temp =
await NavigatorUtil.goMarkingCouponSelectPage(
context,
'3',
{'object': couponSelectFree});
if (temp != null && temp['coupon'] != null) {
couponSelectFree = temp['coupon'];
setState(() {});
}
})
: (couponDataListFree == null ||
couponDataListFree!.length == 0)
? _markingItem(
'预订安排中免费赠送代金券',
'当前没有可用优惠券,请创建优惠券后再来尝试。',
select: false,
)
... ...
... ... @@ -43,9 +43,9 @@ class _CouponSunPageState extends State<CouponSunPage> {
WidgetsBinding.instance.addPostFrameCallback((_) {
if (widget.index == 0) {
couponProvider.pageState = PageState.Loading;
} else if (widget.index == 1) {
} else if (widget.index == 3) {
couponProvider.pageStateStore = PageState.Loading;
} else if (widget.index == 2) {
} else if (widget.index == 4) {
couponProvider.pageStateMine = PageState.Loading;
}
couponProvider.notifyListeners();
... ... @@ -116,10 +116,22 @@ class _CouponSunPageState extends State<CouponSunPage> {
Future<bool> getSellerTemplateConf(BuildContext context) async {
bool success = await marketingCenterProvider.getSellerTemplateConf(context);
if (success && marketingCenterProvider.markDataModel!.marketing != null) {
if (success &&
marketingCenterProvider.markDataModel != null &&
marketingCenterProvider.markDataModel!.marketing != null) {
couponDataList =
marketingCenterProvider.markDataModel!.marketing!.couponDataList ??
marketingCenterProvider.markDataModel!.marketing!.couponDataListPay ??
[];
if (marketingCenterProvider
.markDataModel!.marketing!.couponDataListFree !=
null &&
marketingCenterProvider
.markDataModel!.marketing!.couponDataListFree!.length >
0) {
couponDataList.addAll(marketingCenterProvider
.markDataModel!.marketing!.couponDataListFree!);
}
return true;
} else {
return false;
... ... @@ -156,9 +168,9 @@ class _CouponSunPageState extends State<CouponSunPage> {
PageState? pageState;
if (widget.index == 0) {
pageState = couponProvider.pageState;
} else if (widget.index == 1) {
} else if (widget.index == 3) {
pageState = couponProvider.pageStateStore;
} else if (widget.index == 2) {
} else if (widget.index == 4) {
pageState = couponProvider.pageStateMine;
}
return Container(
... ...
... ... @@ -26,15 +26,18 @@ import 'package:sendsms/sendsms.dart';
import 'package:flutter_sms/flutter_sms.dart';
import '../../../../models/coupon_model.dart';
import '../../../../utils/screen_util.dart';
/**
* 优惠券单选页面
*/
class MarkingCouponSelectPage extends StatefulWidget {
final String ?type;
final List<CouponSunModel>? couponList;
final bool mulSelect;
MarkingCouponSelectPage({Key? key, this.couponList, this.mulSelect = true})
MarkingCouponSelectPage(
{Key ?key, this.type, this.couponList, this.mulSelect = true})
: super(key: key);
@override
... ... @@ -47,12 +50,33 @@ class _MarkingCouponSelectPageState extends State<MarkingCouponSelectPage> {
late CouponProvider couponProvider;
List<CouponSunModel> selectDataList = [];
bool all = false;
@override
void initState() {
// TODO: implement initState
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) {
// if (!couponProvider.hasModify) {
_couponNetworkData();
// } else {
// couponProvider.pageStateSelect = PageState.Success;
// // couponProvider.notifyListeners();
// }
});
}
@override
void dispose() {
super.dispose();
}
///获取优惠券列表数据(status == 1)
_couponNetworkData({bool isShowLoading = true}) async {
Map<String, String?> params = {
"uid": Provider.of<UserModel>(context, listen: false).user!.openid,
Map<String, String> params = {
"uid": Provider.of<UserModel>(context, listen: false).user!.openid!,
"is_type": widget.type!
};
params['status'] = '1';
... ... @@ -71,145 +95,81 @@ class _MarkingCouponSelectPageState extends State<MarkingCouponSelectPage> {
for (var itemselect in widget.couponList!) {
if (itemselect.id == item.id) {
item.isCheck = true;
item.number = itemselect.number;
item.numberC.text = item.number.toString();
selectDataList.add(item);
// break outerloop;
}
}
}
if (selectDataList.length == couponProvider.couponListSelect!.length) {
all = true;
}
setState(() {});
}
@override
void initState() {
// TODO: implement initState
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) {
// if (!couponProvider.hasModify) {
_couponNetworkData();
// } else {
// couponProvider.pageStateSelect = PageState.Success;
// // couponProvider.notifyListeners();
// }
});
}
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
couponProvider = Provider.of<CouponProvider>(context, listen: true);
return Scaffold(
backgroundColor: MyColours.color_ffffff,
appBar: SystemAppBar(
'优惠券',
onTap: () {
if (Navigator.canPop(context)) {
Navigator.pop(context);
}
},
),
body: Column(
children: [
Expanded(child: Consumer<CouponProvider>(
builder: (context, model, _) {
if (model.pageStateSelect != PageState.Success) {
return ExceptionPage(
pageState: model.pageStateSelect,
callback: () {
_couponNetworkData();
// offset = 0;
// getMessage(showLoading: true);
},
emptyMsg: "暂时没有列表信息哦",
emptyImg: "empty_search",
showMsg: "加载中,请稍后...",
);
} else {
return EasyRefresh.custom(
controller: _controller,
shrinkWrap: true,
slivers: [
SliverList(
delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
return VEmptyView(40);
}, childCount: 1),
),
SliverList(
delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
return InkWell(
onTap: () {
//改这里 ******8
if (widget.mulSelect) {
couponProvider.couponListSelect![index].isCheck =
!couponProvider
.couponListSelect![index].isCheck;
if (couponProvider
.couponListSelect![index].isCheck) {
selectDataList.add(
couponProvider.couponListSelect![index]);
} else {
selectDataList.remove(
couponProvider.couponListSelect![index]);
}
} else {
couponProvider.couponListSelect!
.forEach((element) {
element.isCheck = false;
});
selectDataList = [];
selectDataList.add(
couponProvider.couponListSelect![index]);
couponProvider.couponListSelect![index].isCheck =
true;
}
setState(() {});
},
// child: Row(
// children: [
// HEmptyView(30),
// !widget.hasModify
// ? Checkbox(
// value: couponProvider
// .couponListSelect[index].isCheck,
// checkColor: MyColours.color_ffffff,
// activeColor: MyColours.app_main,
// onChanged: (bool value) {},
// )
// : Container(),
// Image.asset(
// couponProvider.listData[index]['checked']
// ? 'assets/select.png'
// : 'assets/unselect.png',
// width: ScreenUtil().setWidth(44)),
child: CouponItemF(
from: 'select',
showCheck: true,
radio: true,
couponSonModel:
couponProvider.couponListSelect![index],
onPressed: () {
// bool old = couponProvider
// .couponListSelect[index].isCheck;
backgroundColor: MyColours.color_ffffff,
appBar: SystemAppBar(
'选择优惠券',
onTap: () {
if (Navigator.canPop(context)) {
Navigator.pop(context);
}
},
),
body: Column(
children: [
Expanded(child: Consumer<CouponProvider>(
builder: (context, model, _) {
if (model.pageStateSelect != PageState.Success) {
return ExceptionPage(
pageState: model.pageStateSelect,
callback: () {
_couponNetworkData();
// offset = 0;
// getMessage(showLoading: true);
},
emptyMsg: "暂时没有列表信息哦",
emptyImg: "empty_search",
showMsg: "加载中,请稍后...",
);
} else {
return EasyRefresh.custom(
controller: _controller,
shrinkWrap: true,
slivers: [
SliverList(
delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
return VEmptyView(40);
}, childCount: 1),
),
SliverList(
delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
CouponSunModel sunModel =
couponProvider.couponListSelect![index];
return InkWell(
onTap: () {
if (sunModel.isType != '3') {
//改这里 ******8
if (widget.mulSelect) {
couponProvider
.couponListSelect![index].isCheck =
!couponProvider
.couponListSelect![index].isCheck;
if (couponProvider
.couponListSelect![index].isCheck) {
selectDataList.add(couponProvider
.couponListSelect![index]);
sunModel.isCheck = !sunModel.isCheck;
if (sunModel.isCheck) {
selectDataList.add(sunModel);
} else {
selectDataList.remove(couponProvider
.couponListSelect![index]);
selectDataList.remove(sunModel);
}
if (couponProvider.couponListSelect!
.every((element) => element.isCheck)) {
all = true;
} else {
all = false;
}
} else {
couponProvider.couponListSelect!
... ... @@ -217,52 +177,187 @@ class _MarkingCouponSelectPageState extends State<MarkingCouponSelectPage> {
element.isCheck = false;
});
selectDataList = [];
selectDataList.add(
couponProvider.couponListSelect![index]);
couponProvider
.couponListSelect![index].isCheck = true;
selectDataList.add(sunModel);
sunModel.isCheck = true;
}
setState(() {});
}));
}, childCount: couponProvider.couponListSelect!.length),
)
],
// onRefresh: () async {
// // offset = 0;
// // getMessage(showLoading: false);
// },
// onLoad: () async {
// // offset++;
// // getMessage(showLoading: false);
// },
);
}
},
)),
VEmptyView(20),
couponProvider.pageStateSelect == PageState.Success
? Padding(
padding: EdgeInsets.fromLTRB(ScreenUtil().setWidth(40), 0,
ScreenUtil().setWidth(40), ScreenUtil().setWidth(40)),
child: RoundButton(
onPressed: () async {
Map temp = {
'coupon': selectDataList,
};
if (Navigator.canPop(context)) {
Navigator.pop(context, temp);
}
},
text: '确定',
fontSize: 34,
isBold: false,
height: ScreenUtil().setWidth(80),
width: double.infinity,
radius: ScreenUtil().setWidth(10),
))
: Container()
],
),
);
}
},
// child: Row(
// children: [
// HEmptyView(30),
// !widget.hasModify
// ? Checkbox(
// value: couponProvider
// .couponListSelect[index].isCheck,
// checkColor: MyColours.color_ffffff,
// activeColor: MyColours.app_main,
// onChanged: (bool value) {},
// )
// : Container(),
// Image.asset(
// couponProvider.listData[index]['checked']
// ? 'assets/select.png'
// : 'assets/unselect.png',
// width: ScreenUtil().setWidth(44)),
child: CouponItemF(
from: 'select',
showCheck: true,
radio: widget.mulSelect,
couponSonModel:
couponProvider.couponListSelect![index],
onPressed: () {
// bool old = couponProvider
// .couponListSelect[index].isCheck;
//改这里 ******8
if (widget.mulSelect) {
couponProvider
.couponListSelect![index].isCheck =
!couponProvider
.couponListSelect![index].isCheck;
if (couponProvider
.couponListSelect![index].isCheck) {
selectDataList.add(couponProvider
.couponListSelect![index]);
} else {
selectDataList.remove(couponProvider
.couponListSelect![index]);
}
if (couponProvider.couponListSelect!.every(
(element) => element.isCheck)) {
all = true;
} else {
all = false;
}
} else {
couponProvider.couponListSelect!
.forEach((element) {
element.isCheck = false;
});
selectDataList = [];
selectDataList.add(couponProvider
.couponListSelect![index]);
couponProvider.couponListSelect![index]
.isCheck = true;
}
setState(() {});
}));
}, childCount: couponProvider.couponListSelect!.length),
)
],
// onRefresh: () async {
// // offset = 0;
// // getMessage(showLoading: false);
// },
// onLoad: () async {
// // offset++;
// // getMessage(showLoading: false);
// },
);
}
},
)),
VEmptyView(20),
if (couponProvider.pageStateSelect == PageState.Success)
widget.mulSelect
? Container(
padding: EdgeInsets.only(
left: w(20), top: w(12), right: w(20), bottom: w(25)),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
InkWell(
onTap: () {
all = !all;
if (all) {
selectDataList = [];
for (var item
in couponProvider.couponListSelect!) {
item.isCheck = true;
selectDataList.add(item);
}
} else {
selectDataList = [];
for (var item
in couponProvider.couponListSelect!) {
item.isCheck = false;
}
}
setState(() {});
},
child: Row(
children: [
Image.asset(
Utils.getImgPath(
all ? 'c_mul_select' : 'c_not_edit'),
width: ScreenUtil().setWidth(40),
),
HEmptyView(10),
Text(
'全选',
style: TextStyle(
fontSize: ScreenUtil().setWidth(32),
fontWeight: FontWeight.bold,
color: MyColours.color_000000),
),
HEmptyView(20),
],
)),
Expanded(
child: RoundButton(
onPressed: () async {
//如果是免费的优惠券,有个数的,数量为0的时候提示
bool can = true;
for (int i = 0; i < selectDataList.length; i++) {
CouponSunModel element = selectDataList[i];
if (element.isType == '3' &&
element.isCheck &&
element.number == 0) {
Utils.showToast(
'请输入【${element.aname}】的数量');
can = false;
break;
}
}
if (can) {
Map temp = {
'coupon': selectDataList,
};
if (Navigator.canPop(context)) {
Navigator.pop(context, temp);
}
}
},
text: '确定选择${selectDataList.length}个优惠券',
fontSize: 34,
isBold: false,
height: ScreenUtil().setWidth(80),
// width: double.infinity,
radius: ScreenUtil().setWidth(10),
)),
],
))
: Container(
padding: EdgeInsets.only(
left: w(20), top: w(12), right: w(20), bottom: w(25)),
child: RoundButton(
onPressed: () async {
Map temp = {
'coupon': selectDataList,
};
if (Navigator.canPop(context)) {
Navigator.pop(context, temp);
}
},
text: '确定',
fontSize: 34,
isBold: false,
height: ScreenUtil().setWidth(80),
width: double.infinity,
radius: ScreenUtil().setWidth(10),
))
],
));
}
}
... ...
... ... @@ -52,14 +52,17 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> {
bool isOnlineBook = false; //在线预订
bool isOrder = false; //提前点餐
bool isLink = false; //充值优惠活动链接
bool isCoupon = false; // 代金券
bool isCouponFree = false; // 代金券
bool isCouponPay = false; // 代金券
bool isRecharge = false; //充值券
bool isCustomerCancel = true; //向客人开放取消预订功能
RechargeListSunModel? rechargeData;
String rechargeContent = '';
List<CouponSunModel> couponDataList = [];
List<CouponSunModel> couponDataListFree = [];
List<CouponSunModel> couponDataListPay = [];
bool isComments = false; //启用评价设置
bool isCommentsCoupon = false; //启用评价送券
List<CouponSunModel> couponDataListComments = [];
... ... @@ -166,8 +169,12 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> {
? true
: false;
isCoupon =
marketingCenterProvider.markDataModel!.marketing!.isCoupon == '1'
isCouponFree =
marketingCenterProvider.markDataModel!.marketing!.isCouponFree == '1'
? true
: false;
isCouponPay =
marketingCenterProvider.markDataModel!.marketing!.isCouponPay == '1'
? true
: false;
... ... @@ -178,8 +185,11 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> {
rechargeData =
marketingCenterProvider.markDataModel!.marketing!.rechargeData;
couponDataList =
marketingCenterProvider.markDataModel!.marketing!.couponDataList ??
couponDataListFree =
marketingCenterProvider.markDataModel!.marketing!.couponDataListFree ??
[];
couponDataListPay =
marketingCenterProvider.markDataModel!.marketing!.couponDataListPay ??
[];
couponDataListComments = marketingCenterProvider
.markDataModel!.marketing!.couponDataListComments ??
... ...
... ... @@ -39,7 +39,8 @@ class _CommentsSettingPageState extends State<CommentsSettingPage> {
bool isOnlineBook = false; //在线预订
bool isOrder = false; //提前点餐
bool isLink = false; //充值优惠活动链接
bool isCoupon = false; // 代金券
bool isCouponFree = false; // 代金券
bool isCouponPay = false; // 代金券
bool isRecharge = false; //充值券
String? welcome = '';
... ... @@ -48,7 +49,8 @@ class _CommentsSettingPageState extends State<CommentsSettingPage> {
RechargeListSunModel? rechargeData;
String rechargeContent = '';
List<CouponSunModel> couponDataList = [];
List<CouponSunModel> couponDataListFree = [];
List<CouponSunModel> couponDataListPay = [];
bool isComments = false; //启用评价设置
bool isCommentsCoupon = false; //启用评价送券
List<CouponSunModel>? couponDataListComments = [];
... ... @@ -84,21 +86,27 @@ class _CommentsSettingPageState extends State<CommentsSettingPage> {
? true
: false;
isCoupon = marketingCenterProvider.markDataModel!.marketing!.isCoupon == '1'
? true
: false;
isCouponFree =
marketingCenterProvider.markDataModel!.marketing!.isCouponFree == '1'
? true
: false;
isCouponPay =
marketingCenterProvider.markDataModel!.marketing!.isCouponPay == '1'
? true
: false;
isRecharge =
marketingCenterProvider.markDataModel!.marketing!.isRecharge == '1'
? true
: false;
rechargeData =
marketingCenterProvider.markDataModel!.marketing!.rechargeData;
couponDataList =
marketingCenterProvider.markDataModel!.marketing!.couponDataList ?? [];
couponDataListFree =
marketingCenterProvider.markDataModel!.marketing!.couponDataListFree ??
[];
couponDataListPay =
marketingCenterProvider.markDataModel!.marketing!.couponDataListPay ??
[];
couponDataListComments = marketingCenterProvider
.markDataModel!.marketing!.couponDataListComments ??
[];
... ... @@ -131,13 +139,15 @@ class _CommentsSettingPageState extends State<CommentsSettingPage> {
'is_arrival': isArrival ? '1' : '0', //确认到店
'is_online_book': isOnlineBook ? '1' : '0', //在线预订
'is_order': isOrder ? '1' : '0', //去点餐
'is_coupon': isCoupon ? '1' : '0', //代金券暂时
'is_coupon_free': isCouponFree ? '1' : '0', //代金券暂时
'is_coupon_pay': isCouponPay ? '1' : '0', //代金券暂时
'is_recharge': isRecharge ? '1' : '0', //充值券暂时
'is_link': isLink ? '1' : '0',
'wecomle': welcome ?? '',
'logo': qiniuUrl,
'recharge_data': rechargeData,
'coupon_data': json.encode(couponDataList),
'coupon_data_pay': json.encode(couponDataListPay),
'coupon_data_free': json.encode(couponDataListFree),
'is_comments': isComments ? '1' : '0',
'is_comments_coupon': isCommentsCoupon ? '1' : '0',
'coupon_data_comments': json.encode(couponDataListComments),
... ... @@ -153,7 +163,7 @@ class _CommentsSettingPageState extends State<CommentsSettingPage> {
// bus.emit('refresh_coupon_list_f');
Utils.showToast('保存成功');
if (Navigator.canPop(context)) {
Navigator.pop(context);
Navigator.pop(context);
}
}
}
... ... @@ -495,6 +505,7 @@ class _CommentsSettingPageState extends State<CommentsSettingPage> {
Map? temp =
await NavigatorUtil.goMarkingCouponSelectPage(
context,
'3',
{'object': couponDataListComments},
mulSelect: false) ;
// Map temp = await NavigatorUtil.goCouponSelectPage(
... ...
... ... @@ -36,7 +36,8 @@ class _OrderSettingPageState extends State<OrderSettingPage> {
bool isOnlineBook = false; //在线预订
bool isOrder = true; //提前点餐
bool isLink = false; //充值优惠活动链接
bool isCoupon = false; // 代金券
bool isCouponFree = false; // 代金券
bool isCouponPay = false; // 代金券
bool isRecharge = false; //充值券
RechargeListSunModel? rechargeData;
... ... @@ -45,7 +46,8 @@ class _OrderSettingPageState extends State<OrderSettingPage> {
String? welcome = '';
List<CouponSunModel> couponDataList = [];
List<CouponSunModel> couponDataListFree = [];
List<CouponSunModel> couponDataListPay = [];
bool isComments = false; //启用评价设置
bool isCommentsCoupon = false; //启用评价送券
List<CouponSunModel> couponDataListComments = [];
... ... @@ -89,9 +91,14 @@ class _OrderSettingPageState extends State<OrderSettingPage> {
? true
: false;
isCoupon = marketingCenterProvider.markDataModel!.marketing!.isCoupon == '1'
? true
: false;
isCouponFree =
marketingCenterProvider.markDataModel!.marketing!.isCouponFree == '1'
? true
: false;
isCouponPay =
marketingCenterProvider.markDataModel!.marketing!.isCouponPay == '1'
? true
: false;
isRecharge =
marketingCenterProvider.markDataModel!.marketing!.isRecharge == '1'
... ... @@ -100,8 +107,12 @@ class _OrderSettingPageState extends State<OrderSettingPage> {
rechargeData =
marketingCenterProvider.markDataModel!.marketing!.rechargeData;
couponDataList =
marketingCenterProvider.markDataModel!.marketing!.couponDataList ?? [];
couponDataListFree =
marketingCenterProvider.markDataModel!.marketing!.couponDataListFree ??
[];
couponDataListPay =
marketingCenterProvider.markDataModel!.marketing!.couponDataListPay ??
[];
couponDataListComments = marketingCenterProvider
.markDataModel!.marketing!.couponDataListComments ??
[];
... ... @@ -133,9 +144,7 @@ class _OrderSettingPageState extends State<OrderSettingPage> {
if (indexSelect! < 0 || indexSelect! > 4) {
indexSelect = 0;
}
setState(() {
});
setState(() {});
}
}
... ... @@ -149,13 +158,15 @@ class _OrderSettingPageState extends State<OrderSettingPage> {
'is_arrival': isArrival ? '1' : '0', //确认到店
'is_online_book': isOnlineBook ? '1' : '0', //在线预订
'is_order': isOrder ? '1' : '0', //去点餐
'is_coupon': isCoupon ? '1' : '0', //代金券暂时
'is_coupon_free': isCouponFree ? '1' : '0', //代金券暂时
'is_coupon_pay': isCouponPay ? '1' : '0', //代金券暂时
'is_recharge': isRecharge ? '1' : '0', //充值券暂时
'is_link': isLink ? '1' : '0',
'wecomle': welcome ?? '',
'logo': qiniuUrl,
'recharge_data': rechargeData,
'coupon_data': json.encode(couponDataList),
'coupon_data_free': json.encode(couponDataListFree),
'coupon_data_pay': json.encode(couponDataListPay),
'is_comments': isComments ? '1' : '0',
'is_comments_coupon': isCommentsCoupon ? '1' : '0',
'coupon_data_comments': json.encode(couponDataListComments),
... ... @@ -170,7 +181,7 @@ class _OrderSettingPageState extends State<OrderSettingPage> {
if (success) {
Utils.showToast('保存成功');
if (Navigator.canPop(context)) {
Navigator.pop(context);
Navigator.pop(context);
}
}
}
... ... @@ -220,7 +231,7 @@ class _OrderSettingPageState extends State<OrderSettingPage> {
await marketingCenterProvider.setConfing(
context,
{
'sid': Provider.of<UserModel>(context,listen: false).user!.sellerid,
'sid': Provider.of<UserModel>(context, listen: false).user!.sellerid,
'key': 'is_allow_update',
'value': '${indexSelect! + 1}'
},
... ...
... ... @@ -39,7 +39,8 @@ class _RechargeSettingPageState extends State<RechargeSettingPage> {
bool isOnlineBook = false; //在线预订
bool isOrder = false; //提前点餐
bool isLink = false; //充值优惠活动链接
bool isCoupon = false; // 代金券
bool isCouponFree = false; // 代金券
bool isCouponPay = false; // 代金券
bool isRecharge = false; //充值券
String? welcome = '';
... ... @@ -48,7 +49,8 @@ class _RechargeSettingPageState extends State<RechargeSettingPage> {
RechargeListSunModel? rechargeData;
String rechargeContent = '';
List<CouponSunModel> couponDataList = [];
List<CouponSunModel> couponDataListFree = [];
List<CouponSunModel> couponDataListPay = [];
List<RechargeListSunModel> rechargeListCanUse = [];
bool isComments = false; //启用评价设置
bool isCommentsCoupon = false; //启用评价送券
... ... @@ -84,26 +86,28 @@ class _RechargeSettingPageState extends State<RechargeSettingPage> {
? true
: false;
isCoupon = marketingCenterProvider.markDataModel!.marketing!.isCoupon == '1'
? true
: false;
isCouponFree =
marketingCenterProvider.markDataModel!.marketing!.isCouponFree == '1'
? true
: false;
isCouponPay =
marketingCenterProvider.markDataModel!.marketing!.isCouponPay == '1'
? true
: false;
isRecharge =
marketingCenterProvider.markDataModel!.marketing!.isRecharge == '1'
? true
: false;
rechargeData =
marketingCenterProvider.markDataModel!.marketing!.rechargeData;
couponDataList =
marketingCenterProvider.markDataModel!.marketing!.couponDataList ?? [];
[];
couponDataListComments = marketingCenterProvider
.markDataModel!.marketing!.couponDataListComments ??
[];
isComments =
marketingCenterProvider.markDataModel!.marketing!.isComments == '1'
? true
marketingCenterProvider.markDataModel!.marketing!.isComments == '1'?true
: false;
isCommentsCoupon =
marketingCenterProvider.markDataModel!.marketing!.isCommentsCoupon ==
... ... @@ -130,13 +134,15 @@ class _RechargeSettingPageState extends State<RechargeSettingPage> {
'is_arrival': isArrival ? '1' : '0', //确认到店
'is_online_book': isOnlineBook ? '1' : '0', //在线预订
'is_order': isOrder ? '1' : '0', //去点餐
'is_coupon': isCoupon ? '1' : '0', //代金券暂时
'is_coupon_free': isCouponFree ? '1' : '0', //代金券暂时
'is_coupon_pay': isCouponPay ? '1' : '0', //代金券暂时
'is_recharge': isRecharge ? '1' : '0', //充值券暂时
'is_link': isLink ? '1' : '0',
'wecomle': welcome ?? '',
'logo': qiniuUrl,
'recharge_data': rechargeData,
'coupon_data': json.encode(couponDataList),
'coupon_data_pay': json.encode(couponDataListPay),
'coupon_data_free': json.encode(couponDataListFree),
'is_comments': isComments ? '1' : '0',
'is_comments_coupon': isCommentsCoupon ? '1' : '0',
'coupon_data_comments': json.encode(couponDataListComments),
... ... @@ -151,9 +157,9 @@ class _RechargeSettingPageState extends State<RechargeSettingPage> {
if (success) {
bus.emit('refresh_recharge_home');
Utils.showToast('保存成功');
if (Navigator.canPop(context)) {
Navigator.pop(context);
}
if (Navigator.canPop(context)) {
Navigator.pop(context);
}
}
}
... ...
... ... @@ -54,7 +54,7 @@ class _MarkingInteractionPageSimState extends State<MarkingInteractionPageSim> {
bool isOnlineBook = false; //在线预订
bool isOrder = false; //提前点餐
bool isLink = false; //充值优惠活动链接
bool isCoupon = false; // 代金券
// bool isCoupon = false; // 代金券
bool isRecharge = false; //充值券
RechargeListSunModel? rechargeData;
... ... @@ -155,9 +155,9 @@ class _MarkingInteractionPageSimState extends State<MarkingInteractionPageSim> {
? true
: false;
isCoupon = marketingCenterProvider.markDataModel!.marketing!.isCoupon == '1'
? true
: false;
// isCoupon = marketingCenterProvider.markDataModel.marketing.isCoupon == '1'
// ? true
// : false;
isRecharge =
marketingCenterProvider.markDataModel!.marketing!.isRecharge == '1'
... ... @@ -166,8 +166,8 @@ class _MarkingInteractionPageSimState extends State<MarkingInteractionPageSim> {
rechargeData =
marketingCenterProvider.markDataModel!.marketing!.rechargeData;
couponDataList =
marketingCenterProvider.markDataModel!.marketing!.couponDataList ?? [];
// couponDataList =
// marketingCenterProvider.markDataModel.marketing.couponDataList ?? [];
couponDataListComments = marketingCenterProvider
.markDataModel!.marketing!.couponDataListComments ??
[];
... ...