6
0
Fork 0
hui.zhou
panliang 2022-06-10 13:05:03 +08:00
parent 77b80fe18b
commit 4bc06cd1a6
2 changed files with 23 additions and 12 deletions

View File

@ -382,6 +382,9 @@ export default {
isFirstLoading: true,
isNull: false,
loading: false,
// SPU-ID
productId: '',
// SKU-ID
skuId: '',
number: 1,
products: {},
@ -478,11 +481,11 @@ export default {
return price
}
},
onLoad({ skuId, showShrough }) {
onLoad({ productId, showShrough }) {
if (showShrough) {
this.showShrough = showShrough;
}
this.skuId = skuId;
this.productId = productId;
this.getProducts();
this.$store.dispatch('goods/getCartList');
},
@ -495,7 +498,7 @@ export default {
let code = this.user.code ? this.user.code : '';
let shareObj = {
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,
};
return shareObj;
@ -604,8 +607,9 @@ export default {
async getProducts() {
try {
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.skuId = this.products?.id
if (resData?.sku?.is_bargaing) {
this.bargainOrderLog();
@ -649,7 +653,7 @@ export default {
this.loading = true;
const resData = await this.$api.get(`/v1/product/sku/${this.skuId}`);
this.products = resData;
if (resData?.sku?.is_bargaing) {
this.bargainOrderLog();
}

View File

@ -17,12 +17,20 @@
onLoad(e) {
const scene = strToParams(decodeURIComponent(e.scene))
console.log(scene);
// invite_code
if (scene.invite_code) {
uni.setStorageSync('INVITE_CODE', scene.invite_code)
}
//
if (scene.product) {
uni.redirectTo({
url: '/pages/product_details/index?skuId=' + scene.product
})
uni.setStorageSync('INVITE_CODE', scene.code)
} else if (scene.order_pre) {
}
//
else if (scene.order_pre) {
setTimeout(async () => {
uni.showLoading({
title: '加载中',
@ -31,19 +39,18 @@
const obj = {
id: scene.order_pre
}
const {
order_id
} = await this.$api.post(`/v1/order-pre/order`, obj)
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 if(scene.invite_code){
}
//
else {
uni.redirectTo({
url: '/pages/index/index'
})
uni.setStorageSync('INVITE_CODE', scene.invite_code)
}
},
}