|
|
|
@ -170,7 +170,7 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
|
|
|
|
|
|
|
|
|
|
///领取优惠券 |
|
|
|
|
_receiveCoupon(couponId) async { |
|
|
|
|
BaseData baseData = await apiService.receiveCoupon(couponId); |
|
|
|
|
BaseData baseData = await apiService.receiveCoupon(couponId).catchError((onError) {}); |
|
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
|
queryStoreInfo(); |
|
|
|
|
showAlertDialog(); |
|
|
|
@ -192,7 +192,7 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
|
|
|
|
|
|
|
|
|
|
///领取VIP |
|
|
|
|
_receiveVip() async { |
|
|
|
|
BaseData baseData = await apiService.minLogin(storeInfo.id); |
|
|
|
|
BaseData baseData = await apiService.minLogin(storeInfo.id).catchError((onError) {}); |
|
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
|
SmartDialog.showToast(S.of(context).lingquchenggong, |
|
|
|
|
alignment: Alignment.center); |
|
|
|
@ -217,7 +217,7 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
|
|
|
|
|
alignment: Alignment.center); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
BaseData baseData = await apiService.minLogin(storeInfo.id); |
|
|
|
|
BaseData baseData = await apiService.minLogin(storeInfo.id).catchError((onError) {}); |
|
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
|
UserEntity userEntity = UserEntity.fromJson(baseData.data); |
|
|
|
|
startMin(userEntity.token, userEntity.userId); |
|
|
|
@ -227,9 +227,14 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
|
|
|
|
|
startMin(token, userId) async { |
|
|
|
|
if (storeInfo == null) return; |
|
|
|
|
if (storeInfo.mini == null) return; |
|
|
|
|
if(Platform.isAndroid){ |
|
|
|
|
if (!(await Min.isInitialize())) { |
|
|
|
|
// 小程序的微信支付和app的充值支付使用同一个WXPayEntryActivity回调, |
|
|
|
|
// 然而充值时小程序未初始化会导致回调内部代码调用getPackage空指针, |
|
|
|
|
// 故而在此初始化一下 |
|
|
|
|
await Min.initialize(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
printMin(); |
|
|
|
|
String miniAppId = storeInfo.mini.miniAppId; |
|
|
|
|
String filePath = ""; |
|
|
|
|