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

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

View File

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

View File

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