最新版代码提交

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", appName: "Wagoo",
appShareName: "Wagoo", appShareName: "Wagoo",
appId: "wx00e2dcdc7c02b23a", appId: "wx00e2dcdc7c02b23a",
apiBaseUrl: "https://api.wagoo.me/api/v1", // 服务端测试地址 // apiBaseUrl: "https://api.wagoo.me/api/v1", // 服务端测试地址
// apiBaseUrl: "https://api.wagoo.pet/api/v1", // 服务端生产地址 apiBaseUrl: "https://api.wagoo.pet/api/v1", // 服务端生产地址
// apiBaseUrl: "http:192.168.30.79", //本地接口 // apiBaseUrl: "http:192.168.30.79", //本地接口
tencentMapKey: "WSBBZ-7OXK4-46QUC-KFB7B-4N3W7-M2BXM", tencentMapKey: "WSBBZ-7OXK4-46QUC-KFB7B-4N3W7-M2BXM",
tencentSecret: "vb7D0PGj7xUvmOLuJz2Jd7ykTMpjiWRJ", tencentSecret: "vb7D0PGj7xUvmOLuJz2Jd7ykTMpjiWRJ",

View File

@ -200,6 +200,31 @@ export default {
type: 0, type: 0,
cursor: this.nextCursor 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) getHomeGoodsWithCache(params, forceRefresh)
.then((res) => { .then((res) => {
const list = res?.data.data?.products || res?.data.data || []; const list = res?.data.data?.products || res?.data.data || [];
@ -207,12 +232,8 @@ export default {
const nextCursor = res?.data.data?.next_cursor || ''; const nextCursor = res?.data.data?.next_cursor || '';
// 只有当数据有变化时才更新商品列表,避免不必要的刷新 // 只有当数据有变化时才更新商品列表,避免不必要的刷新
if (this.goodPage === 1) { if (res.hasChanged !== false || this.goodsList.length === 0) {
if (res.hasChanged !== false || this.goodsList.length === 0) { this.goodsList = list;
this.goodsList = list;
}
} else {
this.goodsList = [...this.goodsList, ...list];
} }
this.hasMore = hasMore; this.hasMore = hasMore;

View File

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

View File

@ -11,7 +11,7 @@
> >
<image <image
class="goods-img" class="goods-img"
:src="item.image " :src="item.image"
mode="aspectFill" mode="aspectFill"
/> />
<view class="goods-content"> <view class="goods-content">
@ -32,11 +32,11 @@
</view> </view>
<!-- 图片撑满屏幕宽度 --> <!-- 图片撑满屏幕宽度 -->
<image <!-- <image
class="full-width-img" class="full-width-img"
src="https://static.wagoo.pet/statics/1.png" src="https://static.wagoo.pet/statics/1.png"
mode="widthFix" mode="widthFix"
/> /> -->
<image <image
class="full-width-img" class="full-width-img"
src="https://static.wagoo.pet/statics/2.png" src="https://static.wagoo.pet/statics/2.png"
@ -47,21 +47,21 @@
src="https://static.wagoo.pet/statics/3.png" src="https://static.wagoo.pet/statics/3.png"
mode="widthFix" mode="widthFix"
/> />
<image <!-- <image
class="full-width-img" class="full-width-img"
src="https://static.wagoo.pet/statics/4.png" src="https://static.wagoo.pet/statics/4.png"
mode="widthFix" mode="widthFix"
/> /> -->
<image <!-- <image
class="full-width-img" class="full-width-img"
src="https://static.wagoo.pet/statics/5.png" src="https://static.wagoo.pet/statics/5.png"
mode="widthFix" mode="widthFix"
/> /> -->
<image <!-- <image
class="full-width-img" class="full-width-img"
src="https://static.wagoo.pet/statics/6.png" src="https://static.wagoo.pet/statics/6.png"
mode="widthFix" mode="widthFix"
/> /> -->
<view class="order-create-container"> <view class="order-create-container">
<!-- 可拖动联系客服组件 --> <!-- 可拖动联系客服组件 -->
@ -247,100 +247,97 @@ export default {
// }); // });
}, },
methods: { methods: {
getGoodsList(id) { getGoodsList(id) {
getGoodsDetail({ getGoodsDetail({
product_id:id, product_id:id,
}) })
.then((res) => { .then((res) => {
this.orderData = res.data this.orderData = res.data
this.orPrice = res.data.price this.orPrice = res.data.price
this.orderPrice = res.data[0].price this.orderPrice = res.data[0].price
// console.log(res,'--=') // 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);
});
});
},
}, },
}; 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> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

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