diff --git a/.env.production b/.env.production index bea88e8..98c2cae 100644 --- a/.env.production +++ b/.env.production @@ -1,6 +1,6 @@ ENV = 'production' -#VUE_APP_BASE_API = 'https://jiqu-library.peidikeji.cn/api' -VUE_APP_BASE_API = 'https://jiqu-library.abcdefg.fun/api' +VUE_APP_BASE_API = 'https://jiqu-library.peidikeji.cn/api' +#VUE_APP_BASE_API = 'https://jiqu-library.abcdefg.fun/api' diff --git a/src/pageB/select_product/search.vue b/src/pageB/select_product/search.vue index 297b05b..7213ae4 100644 --- a/src/pageB/select_product/search.vue +++ b/src/pageB/select_product/search.vue @@ -140,6 +140,7 @@ export default { async cartClick(e) { this.productId = e.id; this.number = 1; + this.skuId = ''; await this.getProducts(); this.show = true; }, @@ -154,7 +155,11 @@ export default { async getProducts() { try { this.loading = true; - const resData = await this.$api.get(`/v1/store/${this.mid}/product-spu/${this.productId}`); + const params = {} + if (this.skuId) { + params.sku_id = this.skuId + } + const resData = await this.$api.get(`/v1/store/${this.mid}/product-spu/${this.productId}`, { params }); this.products = resData; this.skuId = this.products?.sku.id; this.sku = this.products?.sku @@ -220,9 +225,10 @@ export default { // 选择sku, 更新价格 handleSkuSelect(e) { this.skuId = e.sku_id - this.$api.get(`/v1/store/${this.mid}/product-sku/${e.sku_id}`).then(res => { - this.sku = res - }) + this.getProducts() + // this.$api.get(`/v1/store/${this.mid}/product-sku/${e.sku_id}`).then(res => { + // this.sku = res + // }) }, handleBack() { if (getCurrentPages().length > 1) { diff --git a/src/pages/product_details/index.vue b/src/pages/product_details/index.vue index 4065549..60388a4 100644 --- a/src/pages/product_details/index.vue +++ b/src/pages/product_details/index.vue @@ -576,7 +576,11 @@ async getProducts() { try { this.loading = true; - const resData = await this.$api.get(`/v1/product/products/${this.productId}`); + const params = {} + if (this.skuId) { + params.sku_id = this.skuId + } + const resData = await this.$api.get(`/v1/product/products/${this.productId}`, { params }); this.products = resData; this.skuId = this.products?.sku.id @@ -614,7 +618,7 @@ //sku改变 onChangeSku(e) { this.skuId = e.sku_id; - this.getProdutsku(); + this.getProducts(); }, //、 async getProdutsku() {