hui.zhou
parent
77b80fe18b
commit
4bc06cd1a6
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue