6
0
Fork 0
develop
panliang 2023-02-24 17:07:25 +08:00
parent 2c3d45f7cc
commit 0a7e7ef725
4 changed files with 47 additions and 40 deletions

View File

@ -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'

View File

@ -128,7 +128,7 @@ export default {
},
},
selectedLength() {
return this.cartList.length;
return this.selectedCart.length;
},
height() {

View File

@ -121,7 +121,9 @@ export default {
},
onLoad(e) {
this.searchText = e.keywords;
this.category = e.cid;
if (e.cid && e.cid != 0) {
this.category = e.cid
}
this.mid = e.mid;
},
methods: {
@ -129,7 +131,6 @@ export default {
if (e == '') uni.navigateBack();
},
Search() {
this.category = '';
this.downCallback();
},
onChangeNumber(e) {

View File

@ -198,6 +198,10 @@
let data = {}
if (options.data) {
data = JSON.parse(decodeURIComponent(options.data));
this.type = data.type;
this.goods = data?.goods ?? [];
this.cards = data?.cards ?? [];
this.cuId = data?.cuId
}
else if (options.store_cart) {
// id
@ -205,29 +209,28 @@
this.$api.get(`/v1/store/desk/${desk}`).then(res => {
this.desk = res
this.type = 'desk'
})
// id
this.mid = options.mid
// id
let ids = options.store_cart.split(',').map(value => parseInt(value))
this.$store.dispatch('storeCart/getCart').then(res => {
const goods = res.filter(item => ids.indexOf(item.id) >= 0)
this.goods = goods.map(item => {
return {
sku_id: item.id,
num: item.number
}
// id
this.mid = options.mid
// id
let ids = options.store_cart.split(',').map(value => parseInt(value))
this.$store.dispatch('storeCart/getCart').then(res => {
const goods = res.filter(item => ids.indexOf(item.id) >= 0)
this.goods = goods.map(item => {
return {
sku_id: item.id,
num: item.number
}
})
this.getDetail()
})
this.getDetail()
})
} else {
this.type = data.type;
this.goods = data?.goods ?? [];
this.cards = data?.cards ?? [];
this.cuId = data?.cuId
}
uni.$on('address:select', this.addressUpdate);
this.type = data.type;
this.goods = data?.goods ?? [];
this.cards = data?.cards ?? [];
this.cuId = data?.cuId
},
computed: {
@ -299,7 +302,7 @@
params.cuId = this.cuId
} else if (this.type == 'cart') {
params.shopping_cart = this.cards;
} else {
} else if (this.type == 'desk') {
params.products = this.goods.map(item => {
return {
sku_id: item.sku_id,
@ -307,6 +310,10 @@
}
})
}
else {
const {num, sku_id } = this.goods[0];
params.product = { sku_id: sku_id, quantity: num }
}
if (btnLoading) return;
btnLoading = true;
@ -323,6 +330,8 @@
params.desk = this.desk.id
params.store_id = this.mid
order = await this.$api.post(`/v1/order/orders`, params)
//
uni.clearStorageSync('desk')
}
else {
order = await this.$api.post('/v1/order/orders', params);
@ -369,9 +378,7 @@
this.couponShow = true
},
//
addressUpdate({
id
}) {
addressUpdate({id}) {
this.addressId = id;
},
//
@ -386,22 +393,21 @@
params.quantity= num
} else if(this.type == 'bargains'){
params.bargain_order_id = this.cuId
const {
num,
sku_id
} = this.goods[0];
params.product = {
sku_id: sku_id,
quantity: num,
};
const { num, sku_id } = this.goods[0];
params.product = { sku_id: sku_id, quantity: num };
}else if (this.type == 'cart') {
params.shopping_cart = this.cards;
} else if (this.type == 'desk') {
params.store_id = this.mid
params.products = this.goods.map(item => {
return {
sku_id: item.sku_id,
quantity: item.num,
}
})
} else {
const { num, sku_id } = this.goods[0];
params.product = {
sku_id: sku_id,
quantity: num,
};
params.product = {sku_id: sku_id,quantity: num};
}
try {
let orderInfo