|
@@ -15,6 +15,7 @@ import Stomp from '@/lib/stompjs/index';
|
|
import { Encrypt, Decrypt } from '@/utils/crypto';
|
|
import { Encrypt, Decrypt } from '@/utils/crypto';
|
|
import CacheTool from '@/utils/cache-tool';
|
|
import CacheTool from '@/utils/cache-tool';
|
|
import uni from '@/utils/uniHooks';
|
|
import uni from '@/utils/uniHooks';
|
|
|
|
+import { mapState } from 'vuex';
|
|
import {initWxJsSdkConfig} from '@/utils/login.js';
|
|
import {initWxJsSdkConfig} from '@/utils/login.js';
|
|
|
|
|
|
export default {
|
|
export default {
|
|
@@ -30,6 +31,18 @@ export default {
|
|
created() {
|
|
created() {
|
|
this.init();
|
|
this.init();
|
|
},
|
|
},
|
|
|
|
+ computed: {
|
|
|
|
+ disabledBtn() {
|
|
|
|
+ return this.numArr.findIndex((val) => !val) !== -1;
|
|
|
|
+ },
|
|
|
|
+ ...mapState({
|
|
|
|
+ groupId: (state) => state.groupId,
|
|
|
|
+ openid: (state) => state.openid,
|
|
|
|
+ mallId: (state) => state.mallId,
|
|
|
|
+ kipUserId: (state) => state.kipUserId,
|
|
|
|
+ userInfo: (state) => state.userInfo,
|
|
|
|
+ }),
|
|
|
|
+ },
|
|
methods: {
|
|
methods: {
|
|
async init() {
|
|
async init() {
|
|
// console.log(33333333)
|
|
// console.log(33333333)
|
|
@@ -45,6 +58,7 @@ export default {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
CacheTool.init()
|
|
CacheTool.init()
|
|
|
|
+ console.log(484848);
|
|
if (window.location.href.search(/pageId=|token=/g) < 0) {
|
|
if (window.location.href.search(/pageId=|token=/g) < 0) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -52,11 +66,19 @@ export default {
|
|
/.*token=([0-9A-Za-z]*).*/g,
|
|
/.*token=([0-9A-Za-z]*).*/g,
|
|
'$1'
|
|
'$1'
|
|
);
|
|
);
|
|
|
|
+ console.log(55);
|
|
|
|
+ // this.getTicket()
|
|
this.wss(() => {
|
|
this.wss(() => {
|
|
|
|
+ console.log(565656);
|
|
this.$store.dispatch('baseInit', {
|
|
this.$store.dispatch('baseInit', {
|
|
pageId: window.location.href.replace(/.*pageId=([0-9A-Z]*).*/g, '$1'),
|
|
pageId: window.location.href.replace(/.*pageId=([0-9A-Z]*).*/g, '$1'),
|
|
- callback: this.wss,
|
|
|
|
|
|
+ // callback: this.wss,
|
|
|
|
+ callback: () => {
|
|
|
|
+ // 当所有的数据都初始化之后再次执行
|
|
|
|
+ this.getTicket()
|
|
|
|
+ },
|
|
});
|
|
});
|
|
|
|
+
|
|
});
|
|
});
|
|
},
|
|
},
|
|
send() {
|
|
send() {
|
|
@@ -164,6 +186,57 @@ export default {
|
|
// prod
|
|
// prod
|
|
CacheTool.setEnv('prod');
|
|
CacheTool.setEnv('prod');
|
|
},
|
|
},
|
|
|
|
+ // h5获取配置---公众号支付
|
|
|
|
+ getTicket() {
|
|
|
|
+ console.log(173);
|
|
|
|
+ let self = this
|
|
|
|
+ var datas = {
|
|
|
|
+ groupId: this.groupId,
|
|
|
|
+ mallid: this.mallId,
|
|
|
|
+ url: window.location.href.split("#")[0]
|
|
|
|
+ }
|
|
|
|
+ self.$md(datas)
|
|
|
|
+ console.log(199, datas);
|
|
|
|
+ uni.request({
|
|
|
|
+ url: self.$baseURL + "api/1.0/login/getTicket",
|
|
|
|
+ method: 'POST',
|
|
|
|
+ data: datas,
|
|
|
|
+ header: JSON.parse(uni.getStorageSync('handleUser')),
|
|
|
|
+ success: (res) => {
|
|
|
|
+ console.log(206, res);
|
|
|
|
+ if (res.data.code == 0) {
|
|
|
|
+ self.$wx.config({
|
|
|
|
+ debug: false, // 开启调试模式
|
|
|
|
+ appId: res.data.data.appId, // 必填,公众号的唯一标识
|
|
|
|
+ timestamp: res.data.data.timestamp, // 必填,生成签名的时间戳
|
|
|
|
+ nonceStr: res.data.data.nonceStr, // 必填,生成签名的随机串
|
|
|
|
+ signature: res.data.data.signature, // 必填,签名
|
|
|
|
+ jsApiList: ['chooseWXPay'] // 必填,需要使用的JS接口列表
|
|
|
|
+ });
|
|
|
|
+ self.$wx.ready(function() {
|
|
|
|
+ self.$wx.checkJsApi({
|
|
|
|
+ jsApiList: ['chooseWXPay'],
|
|
|
|
+ success: res => {
|
|
|
|
+ console.log('checked api:', res)
|
|
|
|
+ },
|
|
|
|
+ fail: err => {
|
|
|
|
+ console.log('check api fail:', err)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ });
|
|
|
|
+ self.$wx.error(function(res) {
|
|
|
|
+ console.log('err', res)
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ uni.showToast({
|
|
|
|
+ title: res.data.msg,
|
|
|
|
+ duration: 2000,
|
|
|
|
+ icon: 'none'
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
},
|
|
},
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|