6
0
Fork 0

select specs

develop
panliang 2023-03-17 22:38:36 +08:00
parent 219ff8a170
commit 10b3db109e
3 changed files with 18 additions and 8 deletions

View File

@ -1,6 +1,6 @@
ENV = 'production' ENV = 'production'
#VUE_APP_BASE_API = 'https://jiqu-library.peidikeji.cn/api' 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.abcdefg.fun/api'

View File

@ -140,6 +140,7 @@ export default {
async cartClick(e) { async cartClick(e) {
this.productId = e.id; this.productId = e.id;
this.number = 1; this.number = 1;
this.skuId = '';
await this.getProducts(); await this.getProducts();
this.show = true; this.show = true;
}, },
@ -154,7 +155,11 @@ export default {
async getProducts() { async getProducts() {
try { try {
this.loading = true; 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.products = resData;
this.skuId = this.products?.sku.id; this.skuId = this.products?.sku.id;
this.sku = this.products?.sku this.sku = this.products?.sku
@ -220,9 +225,10 @@ export default {
// sku, // sku,
handleSkuSelect(e) { handleSkuSelect(e) {
this.skuId = e.sku_id this.skuId = e.sku_id
this.$api.get(`/v1/store/${this.mid}/product-sku/${e.sku_id}`).then(res => { this.getProducts()
this.sku = res // this.$api.get(`/v1/store/${this.mid}/product-sku/${e.sku_id}`).then(res => {
}) // this.sku = res
// })
}, },
handleBack() { handleBack() {
if (getCurrentPages().length > 1) { if (getCurrentPages().length > 1) {

View File

@ -576,7 +576,11 @@
async getProducts() { async getProducts() {
try { try {
this.loading = true; 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.products = resData;
this.skuId = this.products?.sku.id this.skuId = this.products?.sku.id
@ -614,7 +618,7 @@
//sku //sku
onChangeSku(e) { onChangeSku(e) {
this.skuId = e.sku_id; this.skuId = e.sku_id;
this.getProdutsku(); this.getProducts();
}, },
// //
async getProdutsku() { async getProdutsku() {