|
...
|
...
|
@@ -31,7 +31,9 @@ import '../online_check/photo_view_wiget.dart'; |
|
|
|
class CouponDetailPage extends StatefulWidget {
|
|
|
|
final CouponSunModel? couponSunModel;
|
|
|
|
final String? idstr;
|
|
|
|
CouponDetailPage({Key? key, this.couponSunModel, this.idstr})
|
|
|
|
final bool isHistory;
|
|
|
|
CouponDetailPage(
|
|
|
|
{Key? key, this.couponSunModel, this.idstr, this.isHistory = false})
|
|
|
|
: super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
...
|
...
|
@@ -79,8 +81,8 @@ class _CouponDetailPageState extends State<CouponDetailPage> { |
|
|
|
"uid": Provider.of<UserModel>(context, listen: false).user!.openid,
|
|
|
|
};
|
|
|
|
|
|
|
|
bool success =
|
|
|
|
await _baseIndoProvider.getCustomerActivityBaseinfo(context, params,isShowLoading: false);
|
|
|
|
bool success = await _baseIndoProvider
|
|
|
|
.getCustomerActivityBaseinfo(context, params, isShowLoading: false);
|
|
|
|
if (success) {
|
|
|
|
managerName = _baseIndoProvider.baseInfoSunModel!.name;
|
|
|
|
}
|
|
...
|
...
|
@@ -109,7 +111,8 @@ class _CouponDetailPageState extends State<CouponDetailPage> { |
|
|
|
}
|
|
|
|
|
|
|
|
///时间选择
|
|
|
|
Widget _select(String title, String hintText, GestureTapCallback onTap,{bool canEdit = false}) {
|
|
|
|
Widget _select(String title, String hintText, GestureTapCallback onTap,
|
|
|
|
{bool canEdit = false}) {
|
|
|
|
return InkWell(
|
|
|
|
onTap: onTap,
|
|
|
|
child: Container(
|
|
...
|
...
|
@@ -140,7 +143,8 @@ class _CouponDetailPageState extends State<CouponDetailPage> { |
|
|
|
))),
|
|
|
|
HEmptyView(20),
|
|
|
|
Image.asset(
|
|
|
|
Utils.getImgPath(canEdit ? 'enter_store_arrow_r':'arrow_right_new'),
|
|
|
|
Utils.getImgPath(
|
|
|
|
canEdit ? 'enter_store_arrow_r' : 'arrow_right_new'),
|
|
|
|
width: ScreenUtil().setWidth(20),
|
|
|
|
),
|
|
|
|
// HEmptyView(32),
|
|
...
|
...
|
@@ -800,9 +804,11 @@ class _CouponDetailPageState extends State<CouponDetailPage> { |
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
),
|
|
|
|
VEmptyView(24),
|
|
|
|
Utils.getAuthority(context, '优惠券详情-编辑发放人')
|
|
|
|
? _select('谁可以发放', nickNameShow,canEdit: true,
|
|
|
|
() async {
|
|
|
|
Utils.getAuthority(
|
|
|
|
context, '优惠券详情-编辑发放人') &&
|
|
|
|
!widget.isHistory
|
|
|
|
? _select('谁可以发放', nickNameShow,
|
|
|
|
canEdit: true, () async {
|
|
|
|
Map? temp = await NavigatorUtil
|
|
|
|
.goCouponToPersonnalPage(
|
|
|
|
context,
|
|
...
|
...
|
@@ -921,7 +927,8 @@ class _CouponDetailPageState extends State<CouponDetailPage> { |
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
if (couponProvider.couponSunModel!.liteQrcode != null)
|
|
|
|
if (couponProvider.couponSunModel!.liteQrcode != null &&
|
|
|
|
!widget.isHistory)
|
|
|
|
RoundButton(
|
|
|
|
text: '生成海报',
|
|
|
|
width: w(100),
|
|
...
|
...
|
@@ -986,6 +993,7 @@ class _CouponDetailPageState extends State<CouponDetailPage> { |
|
|
|
//复用,跳转至编辑页面
|
|
|
|
dynamic needRefresh =
|
|
|
|
await NavigatorUtil.goCouponEditPage(context,
|
|
|
|
replace: widget.isHistory ? true : false,
|
|
|
|
isMine: couponProvider
|
|
|
|
.couponSunModel!.isType ==
|
|
|
|
'1'
|
|
...
|
...
|
@@ -995,7 +1003,7 @@ class _CouponDetailPageState extends State<CouponDetailPage> { |
|
|
|
couponProvider.couponSunModel);
|
|
|
|
if (needRefresh != null && needRefresh) {
|
|
|
|
if (Navigator.canPop(context)) {
|
|
|
|
Navigator.pop(context);
|
|
|
|
Navigator.pop(context, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
...
|
...
|
@@ -1011,47 +1019,36 @@ class _CouponDetailPageState extends State<CouponDetailPage> { |
|
|
|
couponSunModel:
|
|
|
|
couponProvider.couponSunModel);
|
|
|
|
if (needRefresh != null && needRefresh) {
|
|
|
|
if (Navigator.canPop(context)) {
|
|
|
|
Navigator.pop(context);
|
|
|
|
if (mounted) {
|
|
|
|
if (Navigator.canPop(context)) {
|
|
|
|
Navigator.pop(context, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
),
|
|
|
|
HEmptyView(30),
|
|
|
|
Expanded(
|
|
|
|
child: RoundButton(
|
|
|
|
text: '分享给客户',
|
|
|
|
height: ScreenUtil().setWidth(80),
|
|
|
|
radius: ScreenUtil().setWidth(14),
|
|
|
|
gradientStart: MyColours.color_438E93,
|
|
|
|
gradientEnd: MyColours.color_438E93,
|
|
|
|
isBold: false,
|
|
|
|
fontSize: 28,
|
|
|
|
onPressed: () {
|
|
|
|
if (couponProvider.couponSunModel!.status != '1') {
|
|
|
|
Utils.showToast('请先启用优惠券后再进行操作!');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (couponProvider.couponSunModel!.status == '1') {
|
|
|
|
if (couponProvider.couponSunModel!.isType ==
|
|
|
|
'3') {
|
|
|
|
Utils.goShareBuyCouponToWeChat(
|
|
|
|
context,
|
|
|
|
widget.idstr,
|
|
|
|
couponProvider.couponSunModel!.isType,
|
|
|
|
couponProvider.couponSunModel!.use,
|
|
|
|
couponProvider.couponSunModel);
|
|
|
|
} else {
|
|
|
|
// 谁可以发放
|
|
|
|
// 可以发放的才能分享
|
|
|
|
if (couponProvider.couponSunModel!.uidList!
|
|
|
|
.split(',')
|
|
|
|
.contains(Provider.of<UserModel>(context,
|
|
|
|
listen: false)
|
|
|
|
.user!
|
|
|
|
.openid)) {
|
|
|
|
//包含当前登录人
|
|
|
|
if (!widget.isHistory)
|
|
|
|
Expanded(
|
|
|
|
child: RoundButton(
|
|
|
|
text: '分享给客户',
|
|
|
|
height: ScreenUtil().setWidth(80),
|
|
|
|
radius: ScreenUtil().setWidth(14),
|
|
|
|
gradientStart: MyColours.color_438E93,
|
|
|
|
gradientEnd: MyColours.color_438E93,
|
|
|
|
isBold: false,
|
|
|
|
fontSize: 28,
|
|
|
|
onPressed: () {
|
|
|
|
if (couponProvider.couponSunModel!.status !=
|
|
|
|
'1') {
|
|
|
|
Utils.showToast('请先启用优惠券后再进行操作!');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (couponProvider.couponSunModel!.status ==
|
|
|
|
'1') {
|
|
|
|
if (couponProvider.couponSunModel!.isType ==
|
|
|
|
'3') {
|
|
|
|
Utils.goShareBuyCouponToWeChat(
|
|
|
|
context,
|
|
|
|
widget.idstr,
|
|
...
|
...
|
@@ -1059,23 +1056,39 @@ class _CouponDetailPageState extends State<CouponDetailPage> { |
|
|
|
couponProvider.couponSunModel!.use,
|
|
|
|
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);
|
|
|
|
// }
|
|
|
|
},
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
))
|
|
|
|
]);
|
...
|
...
|
|