Commit 349c731ed98d10433a10f32de11cfbfd533d9904

Authored by wdn127929
1 parent c375575d

创建优惠券链接

... ... @@ -481,8 +481,10 @@ class HttpUrl {
static const String create_reserve_recheck =
"?service=App.Reserve.CreateReserveRecheck"; // 创建核餐
static const String get_reserve_recheck_by_rid =
static const String get_reserve_recheck_by_rid =
"?service=App.Reserve.GetReserveRecheckByRid"; // 获取核餐记录
static const String create_activity_url_link =
"?service=App.Wechat.CreateActivityUrlLink"; // 创建商家优惠券小程序URL
}
... ...
... ... @@ -278,14 +278,22 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
bool isSuccess =
await couponProvider.createCustomerActivity(context, params);
if (isSuccess) {
//成功之后跳回前一个页面
// bus.emit('refresh_coupon_list');
EventBus().emit('refresh_coupon_invitation');
bus.emit('refresh_coupon_list_f');
// bus.emit('refresh_marketting_page');
//创建券的二维码
Map<String, String> param = {
"sid": Provider.of<UserModel>(context, listen: false).user.sellerid,
"id": couponProvider.couponId,
};
bool success = await couponProvider.createActivityUrlLink(context, param);
if (success) {
//成功之后跳回前一个页面
// bus.emit('refresh_coupon_list');
EventBus().emit('refresh_coupon_invitation');
bus.emit('refresh_coupon_list_f');
// bus.emit('refresh_marketting_page');
bus.emit('refresh_table_m_coupon');
Navigator.pop(context, true);
bus.emit('refresh_table_m_coupon');
Navigator.pop(context, true);
}
}
}
... ...
... ... @@ -41,6 +41,8 @@ class CouponProvider with ChangeNotifier {
List<IsExamineSunModel> isExamineList = []; //商家券核销列表
IsExamineSunModel isExamineDetail;
String errorSMS = '';
String couponId = '';
CouponProvider() {
// for (int i = 0; i < 20; i++) {
// swichStateData.add(true);
... ... @@ -149,6 +151,7 @@ class CouponProvider with ChangeNotifier {
// pageState = PageState.ConnectivityError;
return false;
} else {
couponId = baseResp.data['id'];
// pageState = PageState.Success;
return true;
}
... ... @@ -164,6 +167,56 @@ class CouponProvider with ChangeNotifier {
}
}
///CreateActivityUrlLink
Future<dynamic> createActivityUrlLink(
BuildContext context, Map<String, String> params,
{isShowLoading = true}) async {
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.get, HttpUrl.create_activity_url_link,
data: params, showLoading: isShowLoading)
.catchError((error) {
print(error.toString());
if (error is MyError) {
// switch (error.type) {
// case 1:
// pageState = PageState.ConnectivityError;
// break;
// case 2:
// pageState = PageState.ConnectivityTimeOut;
// break;
// default:
// pageState = PageState.ConnectivityError;
// break;
// }
}
// notifyListeners();
return false;
});
if (baseResp.code == Constant.status_success) {
if (baseResp.data.isEmpty) {
// pageState = PageState.ConnectivityError;
return false;
} else {
if( '${baseResp.data['errcode']}' == '0'){
return true;
}
// pageState = PageState.Success;
return false;
}
// notifyListeners();
// return NotebookDetail.fromJson(baseResp.data);
} else {
// pageState = PageState.ConnectivityError;
if (baseResp != null) {
Utils.showToast(baseResp.msg ?? "");
}
return false;
}
}
//
///客户经理获取所创建活动列表
Future<List<CouponSunModel>> getCustomerActivity(
BuildContext context, Map<String, String> params, int index,
... ...