|
...
|
...
|
@@ -11,6 +11,7 @@ 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/event_bus.dart';
|
|
|
|
import 'package:one_key/utils/utils.dart';
|
|
|
|
import 'package:one_key/widgets/h_empty_view.dart';
|
|
|
|
import 'package:one_key/widgets/round_button.dart';
|
|
...
|
...
|
@@ -43,6 +44,7 @@ class _CouponDetailPageState extends State<CouponDetailPage> { |
|
|
|
late CouponProvider couponProvider;
|
|
|
|
PageState pageState = PageState.Loading;
|
|
|
|
String? managerName = '';
|
|
|
|
String nickNameShow = '编辑';
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
...
|
...
|
@@ -58,6 +60,15 @@ class _CouponDetailPageState extends State<CouponDetailPage> { |
|
|
|
// setState(() {});
|
|
|
|
// }
|
|
|
|
});
|
|
|
|
bus.on("refresh_coupon_detail", (arg) {
|
|
|
|
_getActivityByIdRefresh();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
void dispose() {
|
|
|
|
bus.off("refresh_coupon_detail");
|
|
|
|
super.dispose();
|
|
|
|
}
|
|
|
|
|
|
|
|
_getCustomerActivityBaseinfo() async {
|
|
...
|
...
|
@@ -69,7 +80,7 @@ class _CouponDetailPageState extends State<CouponDetailPage> { |
|
|
|
};
|
|
|
|
|
|
|
|
bool success =
|
|
|
|
await _baseIndoProvider.getCustomerActivityBaseinfo(context, params);
|
|
|
|
await _baseIndoProvider.getCustomerActivityBaseinfo(context, params,isShowLoading: false);
|
|
|
|
if (success) {
|
|
|
|
managerName = _baseIndoProvider.baseInfoSunModel!.name;
|
|
|
|
}
|
|
...
|
...
|
@@ -81,14 +92,24 @@ class _CouponDetailPageState extends State<CouponDetailPage> { |
|
|
|
.getActivityById(context, {'id': widget.idstr}, isShowLoading: false);
|
|
|
|
if (success) {
|
|
|
|
pageState = PageState.Success;
|
|
|
|
nickNameShow = couponProvider.couponSunModel?.nickNameShow ?? '编辑';
|
|
|
|
} else {
|
|
|
|
pageState = PageState.ConnectivityError;
|
|
|
|
}
|
|
|
|
setState(() {});
|
|
|
|
}
|
|
|
|
|
|
|
|
_getActivityByIdRefresh() async {
|
|
|
|
bool success = await couponProvider
|
|
|
|
.getActivityById(context, {'id': widget.idstr}, isShowLoading: true);
|
|
|
|
if (success) {
|
|
|
|
nickNameShow = couponProvider.couponSunModel?.nickNameShow ?? '编辑';
|
|
|
|
}
|
|
|
|
setState(() {});
|
|
|
|
}
|
|
|
|
|
|
|
|
///时间选择
|
|
|
|
Widget _select(String title, String hintText, GestureTapCallback onTap) {
|
|
|
|
Widget _select(String title, String hintText, GestureTapCallback onTap,{bool canEdit = false}) {
|
|
|
|
return InkWell(
|
|
|
|
onTap: onTap,
|
|
|
|
child: Container(
|
|
...
|
...
|
@@ -108,20 +129,21 @@ class _CouponDetailPageState extends State<CouponDetailPage> { |
|
|
|
),
|
|
|
|
),
|
|
|
|
HEmptyView(20),
|
|
|
|
Spacer(),
|
|
|
|
Text(hintText,
|
|
|
|
style: TextStyle(
|
|
|
|
color: hintText == '点击选择'
|
|
|
|
? MyColours.color_999999
|
|
|
|
: MyColours.color_515151,
|
|
|
|
fontSize: ScreenUtil().setSp(32),
|
|
|
|
)),
|
|
|
|
// Spacer(),
|
|
|
|
Expanded(
|
|
|
|
child: Text(hintText,
|
|
|
|
style: TextStyle(
|
|
|
|
color: hintText == '点击选择'
|
|
|
|
? MyColours.color_999999
|
|
|
|
: MyColours.color_515151,
|
|
|
|
fontSize: ScreenUtil().setSp(32),
|
|
|
|
))),
|
|
|
|
HEmptyView(20),
|
|
|
|
Image.asset(
|
|
|
|
Utils.getImgPath('arrow_right_new'),
|
|
|
|
Utils.getImgPath(canEdit ? 'enter_store_arrow_r':'arrow_right_new'),
|
|
|
|
width: ScreenUtil().setWidth(20),
|
|
|
|
),
|
|
|
|
HEmptyView(32),
|
|
|
|
// HEmptyView(32),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
...
|
...
|
@@ -778,10 +800,28 @@ class _CouponDetailPageState extends State<CouponDetailPage> { |
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
),
|
|
|
|
VEmptyView(24),
|
|
|
|
_item(
|
|
|
|
'谁可以发放',
|
|
|
|
couponProvider
|
|
|
|
.couponSunModel!.nickNameShow!),
|
|
|
|
Utils.getAuthority(context, '优惠券详情-编辑发放人')
|
|
|
|
? _select('谁可以发放', nickNameShow,canEdit: true,
|
|
|
|
() async {
|
|
|
|
Map? temp = await NavigatorUtil
|
|
|
|
.goCouponToPersonnalPage(
|
|
|
|
context,
|
|
|
|
couponProvider
|
|
|
|
.couponSunModel
|
|
|
|
?.uidList ??
|
|
|
|
'',
|
|
|
|
id: widget.idstr ?? '',
|
|
|
|
needSave: true);
|
|
|
|
// if (temp != null &&
|
|
|
|
// temp['object'] != null) {
|
|
|
|
// uids = temp['object'];
|
|
|
|
// }
|
|
|
|
})
|
|
|
|
: _item(
|
|
|
|
'谁可以发放',
|
|
|
|
couponProvider.couponSunModel!
|
|
|
|
.nickNameShow!),
|
|
|
|
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_E7E7E7,
|
...
|
...
|
|