|
@@ -42,18 +42,32 @@
|
|
|
<span class="message">您还没有卡券</span>
|
|
|
</div>
|
|
|
</van-checkbox-group>
|
|
|
+ <!-- 为避免冲突,小程序 和 H5 跳转 CRM小程序:积分商城 的逻辑分开处理 -->
|
|
|
<div
|
|
|
:class="['guide-box', 'mgb-110', !list?.length && 'flex-bottom']"
|
|
|
v-if="platform === 'miniprogram'"
|
|
|
>
|
|
|
<div class="guide-title">优惠券兑换指导</div>
|
|
|
<div class="guide-desc" @click="navigateToMiniProgram">
|
|
|
+ 停车优惠券可直接使用,若您还没有兑换或继续兑换,可前往
|
|
|
+ <span class="guide-mini">嘉里中心小程序>积分商城</span>
|
|
|
+ 进行兑换
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ :class="['guide-box', 'mgb-110', !list?.length && 'flex-bottom']"
|
|
|
+ v-if="platform === 'micromessenger'"
|
|
|
+ >
|
|
|
+ <div class="guide-title">优惠券兑换指导</div>
|
|
|
+ <div class="guide-desc">
|
|
|
停车优惠券可直接使用,若您还没有兑换或继续兑换,可前往
|
|
|
<wx-open-launch-weapp
|
|
|
- username=""
|
|
|
- path=""
|
|
|
- env-version=""
|
|
|
+ username="gh_0bd6a97b6d38"
|
|
|
+ :path="launchPath"
|
|
|
+ :env-version="window.env === 'qa' ? 'trial' : 'release'"
|
|
|
class="wx-open-launch-weapp"
|
|
|
+ @launch="launchFn"
|
|
|
+ @error="launchErrorFn"
|
|
|
><span class="guide-mini"
|
|
|
>嘉里中心小程序>积分商城</span
|
|
|
></wx-open-launch-weapp
|
|
@@ -95,8 +109,8 @@ import { mapState } from 'vuex';
|
|
|
import uni from '@/utils/uniHooks';
|
|
|
// import { initWxJsSdkConfig } from '@/utils/login';
|
|
|
import { Toast } from 'vant';
|
|
|
-import { getPlatform } from '@/utils/index';
|
|
|
-
|
|
|
+import { getPlatform, getAppIdByGroupIdAndMallId, isInWeixinH5 } from '@/utils';
|
|
|
+import { initWxJsSdkConfig } from '@/utils/login';
|
|
|
export default {
|
|
|
created() {
|
|
|
// 纸质优惠券
|
|
@@ -122,12 +136,18 @@ export default {
|
|
|
// JSON.parse(uni.getStorageSync('checkedCouponList')) || [];
|
|
|
},
|
|
|
mounted() {
|
|
|
- // initWxJsSdkConfig([], ['wx-open-launch-weapp']);
|
|
|
+ if (isInWeixinH5()) {
|
|
|
+ initWxJsSdkConfig(
|
|
|
+ ['checkJsApi', 'chooseImage'],
|
|
|
+ ['wx-open-launch-weapp']
|
|
|
+ );
|
|
|
+ }
|
|
|
setTimeout(() => {
|
|
|
uni.setNavigationBarTitle({
|
|
|
title: '优惠券',
|
|
|
});
|
|
|
}, 300);
|
|
|
+ this.launchPathInit();
|
|
|
// console.log('查看结果', uni.getStorageSync('list'));
|
|
|
const list = uni.getStorageSync('list');
|
|
|
this.parkFee = JSON.parse(uni.getStorageSync('parkFee'));
|
|
@@ -231,6 +251,7 @@ export default {
|
|
|
parkMallCode: 1, // 0静安 1浦东 2杭州 3北京 4沈阳 5深圳
|
|
|
paperCouponFee: 0, // 纸质优惠金额
|
|
|
platform: getPlatform(),
|
|
|
+ launchPath: '', // H5跳转CRM微信小程序
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
@@ -434,10 +455,48 @@ export default {
|
|
|
// 跳转小程序
|
|
|
navigateToMiniProgram() {
|
|
|
if (this.platform === 'miniprogram') {
|
|
|
+ const { projectId } = getAppIdByGroupIdAndMallId({
|
|
|
+ groupId: this.$route.params.groupId,
|
|
|
+ mallId: this.$route.params.mallId,
|
|
|
+ type: 'all',
|
|
|
+ });
|
|
|
window.toWXSendMsg({
|
|
|
type: 'navigateToMiniProgram',
|
|
|
- options: {},
|
|
|
+ options: {
|
|
|
+ launchPath: this.launchPath,
|
|
|
+ },
|
|
|
});
|
|
|
+ setTimeout(() => {
|
|
|
+ this.$router.go(-2);
|
|
|
+ }, 200);
|
|
|
+ }
|
|
|
+ if (isInWeixinH5()) {
|
|
|
+ // this.$wx.chooseWXPay({
|
|
|
+ // timestamp: params?.timeStamp,
|
|
|
+ // nonceStr: params?.nonceStr,
|
|
|
+ // package: params?.package,
|
|
|
+ // signType: params?.signType,
|
|
|
+ // paySign: params?.paySign,
|
|
|
+ // success: function (res) {
|
|
|
+ // // alert('success: ' + JSON.stringify(res));
|
|
|
+ // // res: {"errMsg":"chooseWXPay:cancel"}
|
|
|
+ // if (res.errMsg === 'chooseWXPay:ok') {
|
|
|
+ // resolve({ errMsg: 'requestPayment:ok' });
|
|
|
+ // } else {
|
|
|
+ // reject(res);
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // cancel: function (res) {
|
|
|
+ // // alert('cancel: ' + JSON.stringify(res));
|
|
|
+ // // res: {"errMsg":"chooseWXPay:cancel"}
|
|
|
+ // resolve({ errMsg: 'requestPayment:cancel' });
|
|
|
+ // },
|
|
|
+ // fail: function (err) {
|
|
|
+ // // eslint-disable-next-line no-console
|
|
|
+ // console.error(err);
|
|
|
+ // reject(err);
|
|
|
+ // },
|
|
|
+ // });
|
|
|
}
|
|
|
},
|
|
|
// 超限提示
|
|
@@ -497,6 +556,22 @@ export default {
|
|
|
});
|
|
|
this.$router.back();
|
|
|
},
|
|
|
+ launchPathInit() {
|
|
|
+ const { projectId } = getAppIdByGroupIdAndMallId({
|
|
|
+ groupId: this.$route.params.groupId,
|
|
|
+ mallId: this.$route.params.mallId,
|
|
|
+ type: 'all',
|
|
|
+ });
|
|
|
+ this.launchPath = `?trackSourceType=运营位&trackSourceName=功能球&projectId=${projectId}&groupId=${this.$route.params.groupId}&mallId=${this.$route.params.mallId}&source=tparkingH5`;
|
|
|
+ },
|
|
|
+ // H5 跳转到小程序
|
|
|
+ launchFn() {
|
|
|
+ this.$router.go(-2);
|
|
|
+ console.log('H5 跳转到 嘉里中心小程序: success');
|
|
|
+ },
|
|
|
+ launchErrorFn() {
|
|
|
+ console.log('H5 跳转到 嘉里中心小程序: fail');
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
@@ -718,6 +793,7 @@ export default {
|
|
|
line-height: 42px;
|
|
|
|
|
|
.guide-mini {
|
|
|
+ display: inline-block;
|
|
|
color: #064c8a;
|
|
|
text-decoration: underline;
|
|
|
margin: 0 5px;
|