Commit 3520b32d9322ad39bf68a357d89f277bf659445c

Authored by weixin_45529955
1 parent e6531640

营销活动新

... ... @@ -20,19 +20,19 @@ if (flutterRoot == null) {
def flutterVersionCode = "710"
def flutterVersionCode = "720"
if (flutterVersionCode == null) {
flutterVersionCode = '710'
flutterVersionCode = '720'
}
def flutterVersionName = "7.1.0"
def flutterVersionName = "7.2.0"
if (flutterVersionName == null) {
flutterVersionName = '7.1.0'
flutterVersionName = '7.2.0'
}
... ... @@ -83,8 +83,8 @@ android {
ndk {
//选择要添加的对应 cpu 类型的 .so 库。
abiFilters 'arm64-v8a', 'x86_64', 'mips64' //魅族64位,不支持32位
// abiFilters 'armeabi', 'armeabi-v7a', 'arm64-v8a', 'x86_64','x86', 'mips', 'mips64'
// abiFilters 'arm64-v8a', 'x86_64', 'mips64' //魅族64位,不支持32位
abiFilters 'armeabi', 'armeabi-v7a', 'arm64-v8a', 'x86_64','x86', 'mips', 'mips64'
}
lintOptions {
... ...
... ... @@ -77,6 +77,10 @@ class HttpUrl {
"?service=App.Reserve.NewGetReserveList"; //商家预订本列表【2019-11-26】
static const String create_customer_activity =
"?service=App.Activity.CreateCustomerActivity"; //客户经理创建活动
static const String import_activity_phone_coupon =
"?service=App.Activity.ImportActivityPhoneCoupon"; //创建手机号营销活动并发放权益
static const String send_phone_marketing_sms =
"?service=App.Activity.SendPhoneMarketingSms"; //发送手机号营销活动短信
static const String get_customer_activity =
"?service=App.Activity.NewCustomerActivityList"; //获取所创建活动的列表
... ...
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:one_key/constant/state.dart';
import 'package:one_key/models/coupon_model.dart';
import 'package:one_key/models/store_customer_home_model.dart'
as storeCustomerHomeModel;
import 'package:one_key/provider/customer_making_provider.dart';
import 'package:one_key/provider/customer_provider.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/route/navigator_util.dart';
import 'package:one_key/utils/dialog_util.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/system_app_bar.dart';
import 'package:provider/provider.dart';
import '../../../utils/screen_util.dart';
class CreateMarketingPlanPage extends StatefulWidget {
final bool isSeller;
final String? uid;
final List<storeCustomerHomeModel.SellerUser>? sellerUser;
const CreateMarketingPlanPage({
Key? key,
required this.isSeller,
this.uid,
this.sellerUser,
}) : super(key: key);
@override
State<CreateMarketingPlanPage> createState() =>
_CreateMarketingPlanPageState();
}
class _CreateMarketingPlanPageState extends State<CreateMarketingPlanPage> {
late CustomerProvider customerProvider;
late CustomerMakingProvider customerMakingProvider;
final TextEditingController _greetingController =
TextEditingController(text: '好久不见!甚是想念,为了表达我们的思念之情');
final TextEditingController _amountController = TextEditingController();
List<String> couponNames = [];
int? _selectedCouponIndex;
String? _selectedCouponName;
/// 0:发放消费金;1:赠送优惠券
int _giftType = 0;
String gid = '';
@override
void initState() {
super.initState();
_greetingController.addListener(_onFormChanged);
_amountController.addListener(_onFormChanged);
WidgetsBinding.instance.addPostFrameCallback((_) {
if (!mounted) return;
_computeGid();
_loadCoupons();
});
}
@override
void dispose() {
_greetingController.removeListener(_onFormChanged);
_amountController.removeListener(_onFormChanged);
_greetingController.dispose();
_amountController.dispose();
super.dispose();
customerMakingProvider.clearData();
}
void _onFormChanged() {
if (mounted) {
setState(() {});
}
}
void _computeGid() {
gid = '';
if (widget.isSeller) {
for (final item in customerMakingProvider.selectCustomerSeller) {
gid += '${item.gid},';
}
} else {
for (final item in customerMakingProvider.selectCustomer) {
gid += '${item.id},';
}
}
if (gid.endsWith(',')) {
gid = gid.substring(0, gid.length - 1);
}
}
Future<void> _loadCoupons() async {
final userModel = Provider.of<UserModel>(context, listen: false);
final uid = widget.isSeller ? userModel.user!.openid : widget.uid;
final params = <String, String?>{
'uid': uid,
'status': '1',
};
await customerProvider.getCustomerSelectActivityNew(context, params,
isShowLoading: false);
if (!mounted) return;
if (customerProvider.couponListSelect == null ||
customerProvider.couponListSelect!.isEmpty) {
return;
}
couponNames = customerProvider.couponListSelect!
.map((e) => e.aname)
.whereType<String>()
.toList();
_selectedCouponIndex = 0;
_selectedCouponName = couponNames.isNotEmpty ? couponNames.first : null;
setState(() {});
}
String get _labels {
final labels = customerMakingProvider.labels;
if (labels == null || labels.trim().isEmpty) {
return '';
}
return '[$labels] ';
}
int get _selectedCount => widget.isSeller
? customerMakingProvider.selectCustomerSeller.length
: customerMakingProvider.selectCustomer.length;
String get _selectedSummary => '已选 $_labels${_selectedCount}位顾客';
String get _giftText {
if (_giftType == 0) {
final amount = _amountController.text.trim();
return amount.isEmpty ? '赠送您消费金' : '赠送您$amount消费金';
}
return '赠送您${_selectedCouponName ?? '优惠券'}';
}
String _buildPreview() {
final userModel = Provider.of<UserModel>(context, listen: false);
final storeName = userModel.user?.sellername ?? '';
final greeting = _greetingController.text.trim();
if (_giftType == 1 && _selectedCouponIndex != null) {
final coupon = customerProvider.couponListSelect![_selectedCouponIndex!];
final requirement = coupon.desc?.trim();
final validity = _buildCouponValidity(coupon);
final couponContent = <String>[
_giftText,
if (requirement != null && requirement.isNotEmpty) requirement,
'凭手机号核销',
if (validity.isNotEmpty) validity,
].join(',');
return '--$storeName--\n嘿,老朋友! $greeting, $couponContent。 '
'欢迎提前预订,拒收请回复R';
}
return '--$storeName--\n嘿,老朋友! $greeting, '
'$_giftText,到店凭手机号核销。 欢迎提前预订,拒收请回复R';
}
String _buildCouponValidity(CouponSunModel coupon) {
String? validForever;
String? stime;
String? etime;
if (coupon.expirationDate != null) {
validForever = coupon.expirationDate!.validForever;
stime = coupon.expirationDate!.stime;
etime = coupon.expirationDate!.etime;
} else if (coupon.aexpiration != null) {
validForever = coupon.aexpiration!.validForever;
stime = coupon.aexpiration!.stime;
etime = coupon.aexpiration!.etime;
}
if (validForever == '1') {
return '';
}
final startDate = _formatCouponTimestamp(stime);
final endDate = _formatCouponTimestamp(etime);
if (startDate.isNotEmpty && endDate.isNotEmpty) {
return '有效期自$startDate到$endDate';
}
if (startDate.isNotEmpty) {
return '有效期自$startDate起';
}
if (endDate.isNotEmpty) {
return '有效期至$endDate';
}
return '';
}
String _formatCouponTimestamp(String? timestamp) {
if (timestamp == null || timestamp.isEmpty) {
return '';
}
final seconds = int.tryParse(timestamp);
if (seconds == null || seconds <= 0) {
return '';
}
final date = DateTime.fromMillisecondsSinceEpoch(seconds * 1000);
final month = date.month.toString().padLeft(2, '0');
final day = date.day.toString().padLeft(2, '0');
return '${date.year}-$month-$day';
}
Future<void> _viewCustomers() async {
FocusScope.of(context).requestFocus(FocusNode());
if (widget.isSeller) {
await NavigatorUtil.goCustomerListPage(context,
FromPage.FromPageMakeRecord, '', {'object': widget.sellerUser});
if (!mounted) return;
_computeGid();
setState(() {});
} else {
await NavigatorUtil.goMyCustomerListPage(
context,
FromPage.FromPageMakeRecord,
widget.uid,
labels: customerMakingProvider.labels ?? '',
);
if (!mounted) return;
_computeGid();
setState(() {});
}
}
void _selectCoupon() {
FocusScope.of(context).requestFocus(FocusNode());
if (couponNames.isEmpty) {
Utils.showToast('暂无优惠券,请创建新优惠');
return;
}
DialogUtil.showSelectCusmanDialog(context, couponNames, (value) {
if (value != null && value is List && value.isNotEmpty) {
setState(() {
_selectedCouponIndex = value.first as int;
_selectedCouponName = couponNames[_selectedCouponIndex!];
});
}
}, selecteds: _selectedCouponIndex == null ? [] : [_selectedCouponIndex!]);
}
Future<void> _confirm() async {
FocusScope.of(context).requestFocus(FocusNode());
if (_selectedCount == 0) {
Utils.showToast('请至少选择1名顾客');
return;
}
if (_giftType == 0 && _amountController.text.trim().isEmpty) {
Utils.showToast('请输入发放消费金金额');
return;
}
if (_giftType == 1 && _selectedCouponIndex == null) {
Utils.showToast('请选择优惠券');
return;
}
final userModel = Provider.of<UserModel>(context, listen: false);
final greeting = _greetingController.text.trim();
if (greeting.isEmpty) {
Utils.showToast('请输入问候语');
return;
}
final phones = <String>[];
if (widget.isSeller) {
for (final item in customerMakingProvider.selectCustomerSeller) {
final phone = item.phone?.trim();
if (phone != null && phone.isNotEmpty) {
phones.add(phone);
}
}
} else {
for (final item in customerMakingProvider.selectCustomer) {
final phone = item.phone?.trim();
if (phone != null && phone.isNotEmpty) {
phones.add(phone);
}
}
}
if (phones.isEmpty) {
Utils.showToast('所选顾客暂无手机号');
return;
}
final labels = customerMakingProvider.labels ?? '';
final targetGroupNames = labels
.split(',')
.map((e) => e.trim())
.where((e) => e.isNotEmpty)
.toList();
final params = <String, dynamic>{
'sellerid': userModel.user!.sellerid,
'phones': json.encode(phones.toSet().toList()),
'benefit_type': _giftType == 0 ? 1 : 2,
'greeting': greeting,
};
if (targetGroupNames.isNotEmpty) {
params['target_group_names'] = json.encode(targetGroupNames);
}
final uidValue = widget.isSeller ? userModel.user!.openid : widget.uid;
final uidInt = int.tryParse(uidValue ?? '');
if (uidInt != null && uidInt > 0) {
params['uid'] = uidInt;
} else if (uidValue != null && uidValue.isNotEmpty) {
params['uid'] = uidValue;
}
if (_giftType == 0) {
params['consume_amount'] =
double.tryParse(_amountController.text.trim()) ?? 0;
} else if (_selectedCouponIndex != null) {
params['aid'] = int.tryParse(
customerProvider.couponListSelect![_selectedCouponIndex!].id ??
'') ??
0;
}
final importResult = await customerProvider
.importActivityPhoneCoupon(context, params, showLoading: true);
if (!mounted) return;
if (importResult == null) return;
final marketingId = _extractMarketingId(importResult);
if (marketingId == null || marketingId <= 0) {
Utils.showToast('创建营销活动失败');
return;
}
final success = await customerProvider.sendPhoneMarketingSms(
context,
<String, dynamic>{
'sellerid': userModel.user!.sellerid,
'marketing_id': marketingId,
},
showLoading: true);
if (!mounted) return;
if (!success) return;
Utils.showToast('执行成功');
if (Navigator.canPop(context)) {
Navigator.pop(context);
}
}
int? _extractMarketingId(dynamic data) {
if (data is Map) {
for (final key in ['marketing_id', 'id']) {
if (data.containsKey(key)) {
final value = data[key];
final parsed = _extractMarketingId(value);
if (parsed != null) return parsed;
}
}
for (final value in data.values) {
final parsed = _extractMarketingId(value);
if (parsed != null) return parsed;
}
} else if (data is List) {
for (final value in data) {
final parsed = _extractMarketingId(value);
if (parsed != null) return parsed;
}
} else if (data is num) {
return data.toInt();
} else if (data is String) {
return int.tryParse(data);
}
return null;
}
@override
Widget build(BuildContext context) {
customerProvider = Provider.of<CustomerProvider>(context, listen: true);
customerMakingProvider =
Provider.of<CustomerMakingProvider>(context, listen: true);
return Scaffold(
backgroundColor: MyColours.color_ffffff,
appBar: SystemAppBar(
'创建营销活动',
),
body: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
_buildSelectedBar(),
_buildSectionRow('赠送优惠选择'),
_buildGiftMoneyRow(),
_buildGiftCouponRow(),
_buildSectionRow('问候语(点击可以编写)'),
_buildGreetingInput(),
_buildSectionRow('短信内容预览'),
_buildPreviewBox(),
SizedBox(height: w(3)),
_buildBottomButton(),
],
),
),
);
}
Widget _buildSelectedBar() {
return Container(
color: MyColours.app_main,
padding: EdgeInsets.symmetric(horizontal: w(16), vertical: w(16)),
child: Row(
children: [
Expanded(
child: Text(
_selectedSummary,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: font(14),
),
),
),
InkWell(
onTap: _viewCustomers,
child: Padding(
padding: EdgeInsets.only(left: w(16)),
child: Text(
'查看',
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: font(14),
decoration: TextDecoration.underline,
),
),
),
),
],
),
);
}
Widget _buildSectionRow(String title) {
return Container(
height: w(48),
padding: EdgeInsets.symmetric(horizontal: w(16)),
alignment: Alignment.centerLeft,
decoration: BoxDecoration(
color: MyColours.color_ffffff,
border: Border(
bottom: BorderSide(
color: MyColours.color_E4E4E4,
width: w(1),
),
),
),
child: Text(
title,
style: TextStyle(
color: MyColours.color_27262B,
fontSize: font(16),
fontWeight: FontWeight.w400,
),
),
);
}
Widget _buildGiftMoneyRow() {
return _buildGiftOptionRow(
type: 0,
title: '发放消费金',
trailing: Row(
mainAxisSize: MainAxisSize.min,
children: [
_buildAmountInput(),
SizedBox(width: w(6)),
Text(
'元',
style: TextStyle(
color: MyColours.color_27262B,
fontSize: font(14),
),
),
],
),
alignTrailingRight: false,
);
}
Widget _buildGiftCouponRow() {
return _buildGiftOptionRow(
type: 1,
title: '赠送优惠券',
trailing: _buildCouponSelect(),
);
}
Widget _buildGiftOptionRow({
required int type,
required String title,
required Widget trailing,
bool alignTrailingRight = true,
}) {
final selected = _giftType == type;
return InkWell(
onTap: () {
setState(() {
_giftType = type;
});
},
child: Container(
height: w(40),
padding: EdgeInsets.only(left: w(16), right: w(16)),
decoration: BoxDecoration(
color: MyColours.color_ffffff,
border: Border(
bottom: BorderSide(
color: MyColours.color_E4E4E4,
width: w(1),
),
),
),
child: Row(
children: [
Image.asset(
Utils.getImgPath(selected ? 'f_select' : 'f_select_not'),
width: w(18),
height: w(18),
),
SizedBox(width: w(8)),
Text(
title,
style: TextStyle(
color: MyColours.color_27262B,
fontSize: font(14),
),
),
if (alignTrailingRight) const Spacer(),
if (!alignTrailingRight) SizedBox(width: w(10)),
trailing,
],
),
),
);
}
Widget _buildAmountInput() {
return Container(
width: w(150),
height: w(30),
padding: EdgeInsets.symmetric(horizontal: w(8)),
alignment: Alignment.center,
decoration: BoxDecoration(
color: MyColours.color_ffffff,
border: Border.all(
color: MyColours.color_B7B7B7,
width: w(1),
),
),
child: TextField(
controller: _amountController,
keyboardType: const TextInputType.numberWithOptions(decimal: true),
maxLines: 1,
textAlignVertical: TextAlignVertical.center,
style: TextStyle(
color: MyColours.color_27262B,
fontSize: font(10),
),
decoration: InputDecoration(
isCollapsed: true,
border: InputBorder.none,
hintText: '请输入数字',
hintStyle: TextStyle(
color: MyColours.color_999999,
fontSize: font(10),
),
),
),
);
}
Widget _buildCouponSelect() {
return InkWell(
onTap: _selectCoupon,
child: Container(
height: w(30),
padding: EdgeInsets.symmetric(horizontal: w(10), vertical: w(4)),
decoration: BoxDecoration(
color: MyColours.color_E4E4E4,
borderRadius: BorderRadius.circular(r(5)),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
_selectedCouponName ?? '请选择优惠券',
style: TextStyle(
color: MyColours.app_main,
fontSize: font(12),
),
),
SizedBox(width: w(6)),
Image.asset(
Utils.getImgPath('down_c'),
width: w(22),
height: w(22),
),
],
),
),
);
}
Widget _buildGreetingInput() {
return Container(
height: w(116),
margin: EdgeInsets.symmetric(horizontal: w(16), vertical: w(3)),
padding: EdgeInsets.all(w(10)),
decoration: BoxDecoration(
color: MyColours.color_ffffff,
borderRadius: BorderRadius.circular(r(8)),
border: Border.all(
color: MyColours.color_B7B7B7,
width: w(1),
),
),
child: TextField(
controller: _greetingController,
keyboardType: TextInputType.multiline,
maxLines: 4,
minLines: 4,
textAlignVertical: TextAlignVertical.top,
style: TextStyle(
color: MyColours.color_27262B,
fontSize: font(14),
),
decoration: InputDecoration(
border: InputBorder.none,
isCollapsed: true,
hintText: '请输入问候语',
hintStyle: TextStyle(
color: MyColours.color_999999,
fontSize: font(14),
),
),
),
);
}
Widget _buildPreviewBox() {
return Container(
height: w(220),
margin: EdgeInsets.symmetric(horizontal: w(16), vertical: w(3)),
padding: EdgeInsets.all(w(10)),
decoration: BoxDecoration(
color: MyColours.color_ffffff,
borderRadius: BorderRadius.circular(r(8)),
border: Border.all(
color: MyColours.color_B7B7B7,
width: w(1),
),
),
child: Text(
_buildPreview(),
maxLines: 9,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: MyColours.color_999999,
fontSize: font(14),
height: 1.4,
),
),
);
}
Widget _buildBottomButton() {
return Container(
padding: EdgeInsets.only(
left: w(45),
right: w(45),
top: w(12),
bottom: w(26),
),
child: SizedBox(
width: double.infinity,
height: w(42),
child: ElevatedButton(
onPressed: _confirm,
style: ElevatedButton.styleFrom(
backgroundColor: MyColours.app_main,
foregroundColor: MyColours.color_ffffff,
elevation: 0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(r(5)),
),
),
child: Text(
'确认执行',
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: font(16),
fontWeight: FontWeight.w500,
),
),
),
),
);
}
}
... ...
... ... @@ -463,7 +463,8 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
customerMakingProvider.selectCustomer =
customerProvider!.selectCustomer;
customerMakingProvider.fromPage = widget.fromPage;
NavigatorUtil.goMyMakeMarkingPage(context, widget.uid);
NavigatorUtil.goCreateMarketingPlanPage(context,
isSeller: false, uid: widget.uid);
} else {
customerMakingProvider.labels = customerProvider!.labels;
customerMakingProvider.selectCustomer =
... ...
... ... @@ -526,9 +526,9 @@ class _CustomerListPageState extends State<CustomerListPage>
customerMakingProvider.selectCustomerSeller =
customerProvider!.selectCustomerSeller;
customerMakingProvider.fromPage = widget.fromPage;
NavigatorUtil.goMakeMarkingPage(
context, {'object': widget.sellerUser},
fromPage: FromPage.FromPageCustomerList);
NavigatorUtil.goCreateMarketingPlanPage(context,
isSeller: true,
sellerUserObject: {'object': widget.sellerUser});
} else {
customerMakingProvider.labels = customerProvider!.labels;
customerMakingProvider.selectCustomerSeller =
... ...
... ... @@ -588,13 +588,10 @@ class CustomerProvider extends ChangeNotifier {
CouponModel.fromJson(baseResp.responseData as Map<String, dynamic>)
.data!
.cast<CouponSunModel>();
// 屏蔽type==2 的券 我的优惠券
// 只保留免费优惠券(免费代金券 type == 3)
List<CouponSunModel> temp = [];
for (int i = 0; i < couponListSelect!.length; i++) {
if (couponListSelect![i].isType == '2' ||
(couponListSelect![i].isType == '1' &&
couponListSelect![i].isExamine != '1')) {
} else {
if (couponListSelect![i].isType == '3') {
temp.add(couponListSelect![i]);
}
}
... ... @@ -1265,6 +1262,74 @@ class CustomerProvider extends ChangeNotifier {
}
}
///创建手机号营销活动并发放权益(消费金/优惠券)
Future<Map<String, dynamic>?> importActivityPhoneCoupon(
BuildContext context, Map<String, dynamic> params,
{bool showLoading = false}) async {
try {
BaseResp<dynamic> baseResp = await DioUtil().request<dynamic>(
context, Method.post, HttpUrl.import_activity_phone_coupon,
data: params, showLoading: showLoading);
if (baseResp != null && baseResp.code == Constant.status_success) {
final data = _normalizeActivityData(baseResp.data);
if (data != null) {
return data;
}
return _normalizeActivityData(baseResp.responseData?['data']);
} else {
if (baseResp != null) {
Utils.showToast(baseResp.msg ?? "");
}
}
} catch (error) {
print(error.toString());
}
return null;
}
///确认执行:发送手机号营销活动短信
Future<bool> sendPhoneMarketingSms(
BuildContext context, Map<String, dynamic> params,
{bool showLoading = false}) async {
try {
BaseResp<dynamic> baseResp = await DioUtil().request<dynamic>(
context, Method.post, HttpUrl.send_phone_marketing_sms,
data: params, showLoading: showLoading);
if (baseResp != null && baseResp.code == Constant.status_success) {
return true;
} else {
if (baseResp != null) {
Utils.showToast(baseResp.msg ?? "");
}
}
} catch (error) {
print(error.toString());
}
return false;
}
Map<String, dynamic>? _normalizeActivityData(dynamic data) {
if (data is Map<String, dynamic>) {
return data;
}
if (data is Map) {
return Map<String, dynamic>.from(data);
}
if (data is List) {
if (data.isEmpty) {
return {};
}
final first = data.first;
if (first is Map<String, dynamic>) {
return first;
}
if (first is Map) {
return Map<String, dynamic>.from(first);
}
}
return null;
}
///催促未完成任务经理发消息
Future<bool> sendMarketingMsgByMid(
BuildContext context, Map<String, String?> params,
... ...
... ... @@ -958,6 +958,20 @@ class NavigatorUtil {
replace: replace);
}
/// 创建营销计划
static Future<dynamic> goCreateMarketingPlanPage(
BuildContext context, {
required bool isSeller,
String? uid,
Map? sellerUserObject,
replace = false,
}) {
return _navigateTo(
context,
"${Routes.create_marketing_plan_page}?isSeller=${isSeller}&uid=${uid ?? ''}&sellerUserObject=${FluroConvertUtils.object2string(sellerUserObject ?? {'object': []})}",
replace: replace);
}
/// 我的创建营销
static Future<dynamic> goMyMakeMarkingPage(BuildContext context, String? uid,
{replace = false,
... ...
... ... @@ -69,6 +69,7 @@ import 'package:one_key/pages/my/consume/return_money_page.dart';
import 'package:one_key/pages/my/customer_type/custom_label_page.dart';
import 'package:one_key/pages/my/customer_type/customer_home_page.dart';
import 'package:one_key/pages/my/customer_type/customer_statistics_page.dart';
import 'package:one_key/pages/my/customer_type/create_marketing_plan_page.dart';
import 'package:one_key/pages/my/customer_type/my_customer/my_customer_detail_edit_page.dart';
import 'package:one_key/pages/my/customer_type/my_customer/my_customer_detail_page.dart';
... ... @@ -1764,6 +1765,29 @@ var makeMarkingPageHandle = new Handler(
child: MakeMarkingPage(fromPage: fromPage, sellerUser: sellerUser));
});
///创建营销计划
var createMarketingPlanPageHandle = new Handler(
handlerFunc: (BuildContext? context, Map<dynamic, List<Object>> params) {
bool isSeller =
FluroConvertUtils.string2bool(params["isSeller"]!.first as String);
String uid = params["uid"]!.first as String;
Map object =
FluroConvertUtils.string2map(params["sellerUserObject"]!.first as String)!;
List temp = object['object'] ?? [];
List<storeCustomerHomeModel.SellerUser> sellerUser = [];
for (var item in temp) {
sellerUser.add(storeCustomerHomeModel.SellerUser.fromJson(item));
}
return ChangeNotifierProvider<CustomerProvider>(
create: (_) => CustomerProvider(),
child: CreateMarketingPlanPage(
isSeller: isSeller,
uid: uid.isEmpty ? null : uid,
sellerUser: sellerUser));
});
///我的创建营销
var myMakeMarkingPageHandle = new Handler(
handlerFunc: (BuildContext? context, Map<dynamic, List<Object>> params) {
... ...
... ... @@ -122,6 +122,7 @@ class Routes {
static String my_marketing_records_detail_page =
"/my_marketing_records_detail_page"; //全店营销记录详情
static String my_make_marketing_page = "/my_make_marketing_page"; //创建营销
static String create_marketing_plan_page = "/create_marketing_plan_page"; //创建营销计划
static String my_customer_detail_page = "/my_customer_detail_page"; //客户详情
static String my_customer_detail_page_sim =
"/my_customer_detail_page_sim"; //客户详情
... ... @@ -605,6 +606,8 @@ class Routes {
router.define(my_marketing_records_detail_page,
handler: myMarketingRecordsDetailPageHandle);
router.define(my_make_marketing_page, handler: myMakeMarkingPageHandle);
router.define(create_marketing_plan_page,
handler: createMarketingPlanPageHandle);
router.define(my_customer_detail_page, handler: myCustomerDetailPageHandle);
router.define(my_customer_detail_page_sim,
handler: myCustomerDetailPageSimHandle);
... ...
... ... @@ -14,6 +14,8 @@ class SystemAppBar extends StatelessWidget implements PreferredSizeWidget {
final Color bgColor;
final bool needWhite;
final Color titleColor;
final double backIconWidth;
final double backIconHeight;
const SystemAppBar(this.title,
{Key? key,
... ... @@ -24,7 +26,9 @@ class SystemAppBar extends StatelessWidget implements PreferredSizeWidget {
this.bgColor = MyColours.color_ffffff,
this.needWhite = false,
this.leftTitle = '',
this.titleColor = MyColours.color_353535})
this.titleColor = MyColours.color_353535,
this.backIconWidth = 20,
this.backIconHeight = 31})
: super(key: key);
@override
... ... @@ -58,8 +62,8 @@ class SystemAppBar extends StatelessWidget implements PreferredSizeWidget {
needWhite
? "assets/icon_white.png"
: "assets/icon_back.png",
width: ScreenUtil().setWidth(20),
height: ScreenUtil().setWidth(31),
width: ScreenUtil().setWidth(backIconWidth),
height: ScreenUtil().setWidth(backIconHeight),
),
leftTitle != ''
? Padding(
... ...