修改bug
commit
fdf57f72ce
|
|
@ -29,13 +29,10 @@ export default {
|
||||||
// #endif
|
// #endif
|
||||||
},
|
},
|
||||||
onShow(option) {
|
onShow(option) {
|
||||||
let invite_code = option.query.invite_code || strToParams(decodeURIComponent(option.query.scene)).invite_code
|
let invite_code = option.query.invite_code || strToParams(decodeURIComponent(option.query.scene)).invite_code||''
|
||||||
uni.setStorageSync('INVITE_CODE',invite_code)
|
uni.setStorageSync('INVITE_CODE',invite_code)
|
||||||
/* #ifdef MP-WEIXIN */
|
/* #ifdef MP-WEIXIN */
|
||||||
if(!invite_code){
|
// wxMnpLogin(invite_code)
|
||||||
wxMnpLogin()
|
|
||||||
}
|
|
||||||
|
|
||||||
/* #endif */
|
/* #endif */
|
||||||
},
|
},
|
||||||
onHide: function () {
|
onHide: function () {
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,7 @@ export default {
|
||||||
const invite_code = uni.getStorageSync('INVITE_CODE');
|
const invite_code = uni.getStorageSync('INVITE_CODE');
|
||||||
// const code = await getWxCode();
|
// const code = await getWxCode();
|
||||||
if(!this.$store.getters.token){
|
if(!this.$store.getters.token){
|
||||||
await wxMnpLogin()
|
await wxMnpLogin(invite_code)
|
||||||
}
|
}
|
||||||
const params = {}
|
const params = {}
|
||||||
if(!!invite_code) params.inviter_code = invite_code
|
if(!!invite_code) params.inviter_code = invite_code
|
||||||
|
|
@ -130,6 +130,7 @@ export default {
|
||||||
code:code,
|
code:code,
|
||||||
...params
|
...params
|
||||||
});
|
});
|
||||||
|
//invite_code%3D1%26order_pre%3D1
|
||||||
await this.LOGIN(resData.token);
|
await this.LOGIN(resData.token);
|
||||||
// await this.LOGIN('555|bZL3mr19Tpgs4jRvpKkguoH865lL2zGLa35WdU7Z')
|
// await this.LOGIN('555|bZL3mr19Tpgs4jRvpKkguoH865lL2zGLa35WdU7Z')
|
||||||
if(!!this.redirec) this.$u.route({
|
if(!!this.redirec) this.$u.route({
|
||||||
|
|
|
||||||
|
|
@ -382,6 +382,9 @@ export default {
|
||||||
isFirstLoading: true,
|
isFirstLoading: true,
|
||||||
isNull: false,
|
isNull: false,
|
||||||
loading: false,
|
loading: false,
|
||||||
|
// 商品SPU-ID
|
||||||
|
productId: '',
|
||||||
|
// 选择的SKU-ID
|
||||||
skuId: '',
|
skuId: '',
|
||||||
number: 1,
|
number: 1,
|
||||||
products: {},
|
products: {},
|
||||||
|
|
@ -482,7 +485,7 @@ export default {
|
||||||
if (showShrough) {
|
if (showShrough) {
|
||||||
this.showShrough = showShrough;
|
this.showShrough = showShrough;
|
||||||
}
|
}
|
||||||
this.skuId = skuId;
|
this.productId = skuId;
|
||||||
this.getProducts();
|
this.getProducts();
|
||||||
this.$store.dispatch('goods/getCartList');
|
this.$store.dispatch('goods/getCartList');
|
||||||
},
|
},
|
||||||
|
|
@ -495,7 +498,7 @@ export default {
|
||||||
let code = this.user.code ? this.user.code : '';
|
let code = this.user.code ? this.user.code : '';
|
||||||
let shareObj = {
|
let shareObj = {
|
||||||
title: this.detail.name,
|
title: this.detail.name,
|
||||||
path: `/pages/product_details/index?skuId=${this.skuId}&invite_code=${code}`,
|
path: `/pages/product_details/index?product=${this.productId}&invite_code=${code}`,
|
||||||
imageUrl: this.detail.cover,
|
imageUrl: this.detail.cover,
|
||||||
};
|
};
|
||||||
return shareObj;
|
return shareObj;
|
||||||
|
|
@ -604,8 +607,9 @@ export default {
|
||||||
async getProducts() {
|
async getProducts() {
|
||||||
try {
|
try {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
const resData = await this.$api.get(`/v1/product/products/${this.skuId}`);
|
const resData = await this.$api.get(`/v1/product/products/${this.productId}`);
|
||||||
this.products = resData;
|
this.products = resData;
|
||||||
|
this.skuId = this.products?.sku.id
|
||||||
|
|
||||||
if (resData?.sku?.is_bargaing) {
|
if (resData?.sku?.is_bargaing) {
|
||||||
this.bargainOrderLog();
|
this.bargainOrderLog();
|
||||||
|
|
@ -649,7 +653,7 @@ export default {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
const resData = await this.$api.get(`/v1/product/sku/${this.skuId}`);
|
const resData = await this.$api.get(`/v1/product/sku/${this.skuId}`);
|
||||||
this.products = resData;
|
this.products = resData;
|
||||||
|
|
||||||
if (resData?.sku?.is_bargaing) {
|
if (resData?.sku?.is_bargaing) {
|
||||||
this.bargainOrderLog();
|
this.bargainOrderLog();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,18 +18,39 @@
|
||||||
onLoad(e) {
|
onLoad(e) {
|
||||||
const scene = strToParams(decodeURIComponent(e.scene))
|
const scene = strToParams(decodeURIComponent(e.scene))
|
||||||
this.scene=scene
|
this.scene=scene
|
||||||
uni.setStorageSync('INVITE_CODE', scene.invite_code)
|
// 优先存储 invite_code
|
||||||
|
if (scene.invite_code) {
|
||||||
|
uni.setStorageSync('INVITE_CODE', scene.invite_code)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 产品详细页
|
||||||
if (scene.product) {
|
if (scene.product) {
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url: '/pages/product_details/index?skuId=' + scene.product
|
url: '/pages/product_details/index?skuId=' + scene.product
|
||||||
})
|
})
|
||||||
uni.setStorageSync('INVITE_CODE', scene.code)
|
}
|
||||||
} else if (scene.order_pre) {
|
// 扫码下单
|
||||||
}else if(scene.invite_code){
|
else if (scene.order_pre) {
|
||||||
|
// setTimeout(async () => {
|
||||||
|
// uni.showLoading({
|
||||||
|
// title: '加载中',
|
||||||
|
// mask: true
|
||||||
|
// });
|
||||||
|
// const obj = {
|
||||||
|
// id: scene.order_pre
|
||||||
|
// }
|
||||||
|
// const { order_id } = await this.$api.post(`/v1/order-pre/order`, obj)
|
||||||
|
// uni.hideLoading()
|
||||||
|
// uni.redirectTo({
|
||||||
|
// url: '/pages/order_details/index?id=' + order_id
|
||||||
|
// })
|
||||||
|
// }, 1000)
|
||||||
|
}
|
||||||
|
// 默认跳转首页
|
||||||
|
else {
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url: '/pages/index/index'
|
url: '/pages/index/index'
|
||||||
})
|
})
|
||||||
uni.setStorageSync('INVITE_CODE', scene.invite_code)
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
|
|
|
||||||
|
|
@ -19,10 +19,10 @@ export function getWxCode() {
|
||||||
}
|
}
|
||||||
|
|
||||||
//小程序静默登录
|
//小程序静默登录
|
||||||
export async function wxMnpLogin(){
|
export async function wxMnpLogin(invite_code){
|
||||||
store.commit('user/LOGOUT')
|
store.commit('user/LOGOUT')
|
||||||
const code = await getWxCode()
|
const code = await getWxCode()
|
||||||
const invite_code= uni.getStorageSync('INVITE_CODE')||null
|
invite_code=invite_code?invite_code: uni.getStorageSync('INVITE_CODE')
|
||||||
await silentLogin({code,invite_code})
|
await silentLogin({code,invite_code})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue