Commit 349c731ed98d10433a10f32de11cfbfd533d9904

Authored by wdn127929
1 parent c375575d

创建优惠券链接

@@ -481,8 +481,10 @@ class HttpUrl { @@ -481,8 +481,10 @@ class HttpUrl {
481 static const String create_reserve_recheck = 481 static const String create_reserve_recheck =
482 "?service=App.Reserve.CreateReserveRecheck"; // 创建核餐 482 "?service=App.Reserve.CreateReserveRecheck"; // 创建核餐
483 483
484 - static const String get_reserve_recheck_by_rid = 484 + static const String get_reserve_recheck_by_rid =
485 "?service=App.Reserve.GetReserveRecheckByRid"; // 获取核餐记录 485 "?service=App.Reserve.GetReserveRecheckByRid"; // 获取核餐记录
486 - 486 +
  487 + static const String create_activity_url_link =
  488 + "?service=App.Wechat.CreateActivityUrlLink"; // 创建商家优惠券小程序URL
487 489
488 } 490 }
@@ -278,14 +278,22 @@ class _CouponEidtPageState extends State<CouponEidtPage> { @@ -278,14 +278,22 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
278 bool isSuccess = 278 bool isSuccess =
279 await couponProvider.createCustomerActivity(context, params); 279 await couponProvider.createCustomerActivity(context, params);
280 if (isSuccess) { 280 if (isSuccess) {
281 - //成功之后跳回前一个页面  
282 - // bus.emit('refresh_coupon_list');  
283 - EventBus().emit('refresh_coupon_invitation');  
284 - bus.emit('refresh_coupon_list_f');  
285 - // bus.emit('refresh_marketting_page'); 281 + //创建券的二维码
  282 + Map<String, String> param = {
  283 + "sid": Provider.of<UserModel>(context, listen: false).user.sellerid,
  284 + "id": couponProvider.couponId,
  285 + };
  286 + bool success = await couponProvider.createActivityUrlLink(context, param);
  287 + if (success) {
  288 + //成功之后跳回前一个页面
  289 + // bus.emit('refresh_coupon_list');
  290 + EventBus().emit('refresh_coupon_invitation');
  291 + bus.emit('refresh_coupon_list_f');
  292 + // bus.emit('refresh_marketting_page');
286 293
287 - bus.emit('refresh_table_m_coupon');  
288 - Navigator.pop(context, true); 294 + bus.emit('refresh_table_m_coupon');
  295 + Navigator.pop(context, true);
  296 + }
289 } 297 }
290 } 298 }
291 299
@@ -41,6 +41,8 @@ class CouponProvider with ChangeNotifier { @@ -41,6 +41,8 @@ class CouponProvider with ChangeNotifier {
41 List<IsExamineSunModel> isExamineList = []; //商家券核销列表 41 List<IsExamineSunModel> isExamineList = []; //商家券核销列表
42 IsExamineSunModel isExamineDetail; 42 IsExamineSunModel isExamineDetail;
43 String errorSMS = ''; 43 String errorSMS = '';
  44 +
  45 + String couponId = '';
44 CouponProvider() { 46 CouponProvider() {
45 // for (int i = 0; i < 20; i++) { 47 // for (int i = 0; i < 20; i++) {
46 // swichStateData.add(true); 48 // swichStateData.add(true);
@@ -149,6 +151,7 @@ class CouponProvider with ChangeNotifier { @@ -149,6 +151,7 @@ class CouponProvider with ChangeNotifier {
149 // pageState = PageState.ConnectivityError; 151 // pageState = PageState.ConnectivityError;
150 return false; 152 return false;
151 } else { 153 } else {
  154 + couponId = baseResp.data['id'];
152 // pageState = PageState.Success; 155 // pageState = PageState.Success;
153 return true; 156 return true;
154 } 157 }
@@ -164,6 +167,56 @@ class CouponProvider with ChangeNotifier { @@ -164,6 +167,56 @@ class CouponProvider with ChangeNotifier {
164 } 167 }
165 } 168 }
166 169
  170 + ///CreateActivityUrlLink
  171 + Future<dynamic> createActivityUrlLink(
  172 + BuildContext context, Map<String, String> params,
  173 + {isShowLoading = true}) async {
  174 + BaseResp<dynamic> baseResp = await DioUtil()
  175 + .request<dynamic>(context, Method.get, HttpUrl.create_activity_url_link,
  176 + data: params, showLoading: isShowLoading)
  177 + .catchError((error) {
  178 + print(error.toString());
  179 + if (error is MyError) {
  180 + // switch (error.type) {
  181 + // case 1:
  182 + // pageState = PageState.ConnectivityError;
  183 + // break;
  184 + // case 2:
  185 + // pageState = PageState.ConnectivityTimeOut;
  186 + // break;
  187 + // default:
  188 + // pageState = PageState.ConnectivityError;
  189 + // break;
  190 + // }
  191 + }
  192 + // notifyListeners();
  193 + return false;
  194 + });
  195 + if (baseResp.code == Constant.status_success) {
  196 + if (baseResp.data.isEmpty) {
  197 + // pageState = PageState.ConnectivityError;
  198 + return false;
  199 + } else {
  200 + if( '${baseResp.data['errcode']}' == '0'){
  201 + return true;
  202 + }
  203 + // pageState = PageState.Success;
  204 + return false;
  205 + }
  206 +
  207 + // notifyListeners();
  208 + // return NotebookDetail.fromJson(baseResp.data);
  209 + } else {
  210 + // pageState = PageState.ConnectivityError;
  211 + if (baseResp != null) {
  212 + Utils.showToast(baseResp.msg ?? "");
  213 + }
  214 + return false;
  215 + }
  216 + }
  217 +
  218 + //
  219 +
167 ///客户经理获取所创建活动列表 220 ///客户经理获取所创建活动列表
168 Future<List<CouponSunModel>> getCustomerActivity( 221 Future<List<CouponSunModel>> getCustomerActivity(
169 BuildContext context, Map<String, String> params, int index, 222 BuildContext context, Map<String, String> params, int index,