最新版代码提交

This commit is contained in:
2026-04-13 16:12:25 +08:00
parent 26e57e4891
commit e894689918
5 changed files with 159 additions and 167 deletions

View File

@ -3,8 +3,8 @@ export default {
appName: "Wagoo",
appShareName: "Wagoo",
appId: "wx00e2dcdc7c02b23a",
apiBaseUrl: "https://api.wagoo.me/api/v1", // 服务端测试地址
// apiBaseUrl: "https://api.wagoo.pet/api/v1", // 服务端生产地址
// apiBaseUrl: "https://api.wagoo.me/api/v1", // 服务端测试地址
apiBaseUrl: "https://api.wagoo.pet/api/v1", // 服务端生产地址
// apiBaseUrl: "http:192.168.30.79", //本地接口
tencentMapKey: "WSBBZ-7OXK4-46QUC-KFB7B-4N3W7-M2BXM",
tencentSecret: "vb7D0PGj7xUvmOLuJz2Jd7ykTMpjiWRJ",

View File

@ -200,6 +200,31 @@ export default {
type: 0,
cursor: this.nextCursor
}
// 加载更多时直接请求,不使用缓存
if (this.goodPage > 1) {
getGoodsListData(params)
.then((res) => {
const list = res?.data.data?.products || res?.data || [];
const hasMore = res?.data.data?.has_more;
const nextCursor = res?.data.data?.next_cursor || '';
this.goodsList = [...this.goodsList, ...list];
this.hasMore = hasMore;
this.nextCursor = nextCursor;
this.goodsTotal = res?.count || 0;
})
.catch((err) => {
console.error('获取商品列表失败', err);
})
.finally(() => {
this.isLoadingGoods = false;
this.refreshTriggered = false;
});
return;
}
// 第一页使用缓存
getHomeGoodsWithCache(params, forceRefresh)
.then((res) => {
const list = res?.data.data?.products || res?.data.data || [];
@ -207,12 +232,8 @@ export default {
const nextCursor = res?.data.data?.next_cursor || '';
// 只有当数据有变化时才更新商品列表,避免不必要的刷新
if (this.goodPage === 1) {
if (res.hasChanged !== false || this.goodsList.length === 0) {
this.goodsList = list;
}
} else {
this.goodsList = [...this.goodsList, ...list];
if (res.hasChanged !== false || this.goodsList.length === 0) {
this.goodsList = list;
}
this.hasMore = hasMore;

View File

@ -1,19 +1,15 @@
<template>
<view class="flex-row-start info-cell good-info" :class="{'good-info-multi' : data.length > 1}">
<template v-if="data.length === 1">
<view class="good-wrapper">
<image class="good-icon" :src="data[0].product_pic" mode="aspectFill" @click="$emit('clickGoodImg', data[0])" />
<view class="price-section">
<view class="price-left">
<text class="hand-price-tag">到手价</text>
<text class="current-price">¥{{ data[0].goods_price || data[0].product_actual_price }}</text>
<text class="origin-price" v-if="data[0].product_original_price">原价¥{{ data[0].product_original_price }}</text>
<image class="good-icon" :src="data[0].product_pic" mode="aspectFill" @click="$emit('clickGoodImg', data[0])" />
<view class="good-content" @click="$emit('clickGoodInfo', data[0])">
<view class="goods-row-first">
<view class="goods-name">{{ data[0].goods_name || "" }}</view>
<view class="fs-28 app-fc-main goods-price">
¥{{ data[0].goods_price || data[0].product_actual_price }}
</view>
<text class="goods-count">已售{{ data[0].number || 1 }}</text>
</view>
<view class="goods-name" @click="$emit('clickGoodInfo', data[0])">
{{ data[0].goods_name || "" }}
</view>
<view class="fs-24 app-fc-normal">{{ data[0].number || 1 }}</view>
</view>
</template>
@ -84,64 +80,43 @@
padding-top: 20rpx;
align-items: flex-start;
.good-wrapper {
width: 100%;
display: flex;
flex-direction: column;
}
.good-icon {
width: 100%;
height: 400rpx;
width: 160rpx;
height: 160rpx;
border-radius: 16rpx;
background: #f5f5f5;
margin-right: 20rpx;
flex-shrink: 0;
}
.price-section {
.good-content {
flex: 1;
height: 160rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: baseline;
margin-top: 20rpx;
.price-left {
.goods-row-first {
display: flex;
align-items: baseline;
justify-content: space-between;
align-items: flex-start;
width: 100%;
.hand-price-tag {
font-size: 24rpx;
color: #fff;
background: linear-gradient(135deg, #FF19A0, #FF6B35);
padding: 4rpx 12rpx;
border-radius: 4rpx;
margin-right: 12rpx;
.goods-name {
font-size: 28rpx;
color: #3D3D3D;
line-height: 40rpx;
margin-right: 16rpx;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
}
.current-price {
font-size: 40rpx;
color: #FF19A0;
font-weight: bold;
}
.origin-price {
font-size: 24rpx;
color: #999;
text-decoration: line-through;
margin-left: 12rpx;
.goods-price {
flex-shrink: 0;
}
}
.goods-count {
font-size: 24rpx;
color: #999;
}
}
.goods-name {
font-size: 32rpx;
color: #3D3D3D;
line-height: 44rpx;
font-weight: bold;
margin-top: 16rpx;
}
}

View File

@ -11,7 +11,7 @@
>
<image
class="goods-img"
:src="item.image "
:src="item.image"
mode="aspectFill"
/>
<view class="goods-content">
@ -32,11 +32,11 @@
</view>
<!-- 图片撑满屏幕宽度 -->
<image
<!-- <image
class="full-width-img"
src="https://static.wagoo.pet/statics/1.png"
mode="widthFix"
/>
/> -->
<image
class="full-width-img"
src="https://static.wagoo.pet/statics/2.png"
@ -47,21 +47,21 @@
src="https://static.wagoo.pet/statics/3.png"
mode="widthFix"
/>
<image
<!-- <image
class="full-width-img"
src="https://static.wagoo.pet/statics/4.png"
mode="widthFix"
/>
<image
/> -->
<!-- <image
class="full-width-img"
src="https://static.wagoo.pet/statics/5.png"
mode="widthFix"
/>
<image
/> -->
<!-- <image
class="full-width-img"
src="https://static.wagoo.pet/statics/6.png"
mode="widthFix"
/>
/> -->
<view class="order-create-container">
<!-- 可拖动联系客服组件 -->
@ -247,100 +247,97 @@ export default {
// });
},
methods: {
getGoodsList(id) {
getGoodsDetail({
product_id:id,
})
.then((res) => {
this.orderData = res.data
this.orPrice = res.data.price
this.orderPrice = res.data[0].price
// console.log(res,'--=')
})
},
createOrder(isPrePay) {
return new Promise((resolve, reject) => {
if (!isPrePay) {
uni.showLoading({
title: "支付中",
mask: true,
});
}
const params = {
id: Number(this.orderData[0].goods_id),
};
createCartOrder(params)
.then((res) => {
if (typeof tt !== "undefined" && tt.requirePlugin) {
try {
const plugin = tt.requirePlugin("lifeServicePlugin");
if (plugin && plugin.createOrder) {
uni.hideLoading();
plugin.createOrder({
skuList: res.data.skuList,
bookInfo: res.data.bookInfo,
contactInfo: res.data.contactInfo,
callbackData: res.data.callbackData,
storeInfo: res.data.storeInfo,
tradeOption: res.data.tradeOption,
payment: res.data.payment,
success: (res) => {
const { orderId, outOrderNo } = res;
console.log("success res", res);
console.log("orderId", orderId, "outOrderNo", outOrderNo);
this.orderId = orderId;
this.outOrderNo = outOrderNo;
uni.navigateTo({
url: "/pages/client/order/list",
});
},
fail: (res) => {
console.log("fail res", res);
uni.showToast({
title: "支付失败",
icon: "none",
});
},
});
} else {
console.error("Plugin or createOrder method not found");
uni.showToast({
title: "支付插件初始化失败",
icon: "none",
});
}
} catch (error) {
console.error("Error requiring plugin:", error);
uni.showToast({
title: "支付插件加载失败",
icon: "none",
});
}
} else {
console.log("TikTok Mini Program environment not detected");
uni.showToast({
title: "请在抖音小程序中打开",
icon: "none",
});
}
resolve();
})
.catch((err) => {
uni.hideLoading();
console.error("createCartOrder error:", err);
uni.showToast({
title: "创建订单失败",
icon: "none",
});
reject(err);
});
});
},
getGoodsList(id) {
getGoodsDetail({
product_id:id,
})
.then((res) => {
this.orderData = res.data
this.orPrice = res.data.price
this.orderPrice = res.data[0].price
// console.log(res,'--=')
})
},
};
createOrder(isPrePay) {
return new Promise((resolve, reject) => {
if (!isPrePay) {
uni.showLoading({
title: "支付中",
mask: true,
});
}
const params = {
id: Number(this.orderData[0].goods_id),
};
createCartOrder(params)
.then((res) => {
if (typeof tt !== "undefined" && tt.requirePlugin) {
try {
const plugin = tt.requirePlugin("lifeServicePlugin");
if (plugin && plugin.createOrder) {
uni.hideLoading();
plugin.createOrder({
skuList: res.data.skuList,
bookInfo: res.data.bookInfo,
contactInfo: res.data.contactInfo,
callbackData: res.data.callbackData,
storeInfo: res.data.storeInfo,
tradeOption: res.data.tradeOption,
payment: res.data.payment,
success: (res) => {
const { orderId, outOrderNo } = res;
console.log("success res", res);
console.log("orderId", orderId, "outOrderNo", outOrderNo);
this.orderId = orderId;
this.outOrderNo = outOrderNo;
uni.navigateTo({
url: "/pages/client/order/list",
});
},
fail: (res) => {
console.log("fail res", res);
uni.showToast({
title: "支付失败",
icon: "none",
});
},
});
}else {
console.error("Plugin or createOrder method not found");
uni.showToast({
title: "支付插件初始化失败",
icon: "none",
});
}
} catch (error) {
console.error("Error requiring plugin:", error);
uni.showToast({
title: "支付插件加载失败",
icon: "none",
});
}
} else {
console.log("TikTok Mini Program environment not detected");
uni.showToast({
title: "请在抖音小程序中打开",
icon: "none",
});
}
resolve();
})
.catch((err) => {
uni.hideLoading();
console.error("createCartOrder error:", err);
uni.showToast({
title: "创建订单失败",
icon: "none",
});
reject(err);
});
});
},
},
};
</script>
<style lang="scss" scoped>

View File

@ -74,7 +74,6 @@
if (data.product_pic) {
return data.product_pic;
}
// Try to parse image_list from attr_key_value_map
if (data.product?.attr_key_value_map?.image_list) {
try {