feat: 新增微信公众号打开方式

This commit is contained in:
wangsongsole 2024-03-06 16:41:31 +08:00
parent d8e9929dd5
commit f373ff3250
3 changed files with 21 additions and 2 deletions

View File

@ -151,12 +151,22 @@
/* ******************************************** 官方领取 ******************************************** */ /* ******************************************** 官方领取 ******************************************** */
/* 直接领取 */ /* 直接领取 */
directSubmit () { directSubmit () {
const openid = localStorage.getItem('openid');
/* 公众号打开 */
if (this.goods.group_info.channel == 2 && this.goods.group_info.is_webview == 1 && !openid) {
const linkId = localStorage.getItem('linkId');
location.href = `https://openapi.1688sup.com/wechat/oauth?jump=${location.origin}/${linkId}/${this.key}`;
return;
}
const data = { const data = {
key: this.key, key: this.key,
token: this.token, token: this.token,
code_batch_id: this.code_batch_id, code_batch_id: this.code_batch_id,
receive_mode: 1 receive_mode: 1,
openid
}; };
req.axiosPost("/key/couponGroupUsage", data) req.axiosPost("/key/couponGroupUsage", data)
.then((res) => { .then((res) => {
if (res.code == 200) { if (res.code == 200) {

View File

@ -122,7 +122,6 @@
let linkId = this.getQueryString('id'); let linkId = this.getQueryString('id');
let keyCode = this.getQueryString('key'); let keyCode = this.getQueryString('key');
let openid = this.getQueryString('openid'); let openid = this.getQueryString('openid');
debugger;
openid && localStorage.setItem('openid', openid); openid && localStorage.setItem('openid', openid);
if (!linkId) {//地址栏无携带id if (!linkId) {//地址栏无携带id
let path = window.location.pathname; let path = window.location.pathname;

View File

@ -188,6 +188,15 @@
} }
}, },
receiveFn () { receiveFn () {
const openid = localStorage.getItem('openid');
/* 公众号打开 */
if (this.goodInfo.entity.channel == 2 && this.goodInfo.entity.is_webview == 1 && !openid) {
const key = localStorage.getItem('key');
const linkId = localStorage.getItem('linkId');
location.href = `https://openapi.1688sup.com/wechat/oauth?jump=${location.origin}/${linkId}/${key}`;
return;
}
if (this.loading) return; if (this.loading) return;
this.loading = true; this.loading = true;
let self = this; let self = this;
@ -201,6 +210,7 @@
goods_id: this.goodInfo.entity.goods_id, goods_id: this.goodInfo.entity.goods_id,
code_batch_id: this.goodInfo.code_batch_id, code_batch_id: this.goodInfo.code_batch_id,
token: localStorage.getItem("token"), token: localStorage.getItem("token"),
openid
}; };
req.axiosPost("/key/usage", data) req.axiosPost("/key/usage", data)
.then((res) => { .then((res) => {