Browse Source

feat:权益包兑换

dev_des
1054425342@qq.com 2 months ago
parent
commit
6bb401b366
  1. 40
      components/DynamicIsland.vue
  2. 15
      pages/index/iSoul.vue
  3. 113
      pages/index/index.vue

40
components/DynamicIsland.vue

@ -22,8 +22,12 @@
<template> <template>
<template v-if="styleType != 'timeShop'"> <template v-if="styleType != 'timeShop'">
<view class="top-section"> <view class="top-section">
<text class="welcome-text" v-if="userInfo&&userInfo.token">{{ title }}</text> <text class="welcome-text" v-if="userInfo && userInfo.token">{{
<text class="welcome-text" v-else @click="toLogin">hi 快去登录 ></text> title
}}</text>
<text class="welcome-text" v-else @click="toLogin"
>hi 快去登录 ></text
>
<view class="qr-code"> <view class="qr-code">
<image <image
style="width: 39rpx; height: 39rpx" style="width: 39rpx; height: 39rpx"
@ -38,7 +42,9 @@
<text class="stat-label">权益</text> <text class="stat-label">权益</text>
</view> </view>
<view class="stat-item"> <view class="stat-item">
<text class="stat-number">{{ getStatNumber("时间银行") }}</text> <text class="stat-number">{{
getStatNumber("时间银行")
}}</text>
<text class="stat-label">时间银行</text> <text class="stat-label">时间银行</text>
</view> </view>
</view> </view>
@ -58,7 +64,9 @@
<view class="bottom-section"> <view class="bottom-section">
<view class="stats-section"> <view class="stats-section">
<view class="stat-item"> <view class="stat-item">
<text class="stat-number">{{ getStatNumber("时间银行") }}</text> <text class="stat-number">{{
getStatNumber("时间银行")
}}</text>
<text class="stat-label">时间银行</text> <text class="stat-label">时间银行</text>
</view> </view>
</view> </view>
@ -78,7 +86,11 @@
" "
></image> ></image>
今日点赞和留言<text 今日点赞和留言<text
style="font-size: 30rpx; font-weight: bold; margin: 0 10rpx" style="
font-size: 30rpx;
font-weight: bold;
margin: 0 10rpx;
"
>100</text >100</text
> >
</view> </view>
@ -258,9 +270,6 @@ export default {
if (this.isScrolled !== shouldScroll) { if (this.isScrolled !== shouldScroll) {
this.isScrolled = shouldScroll; this.isScrolled = shouldScroll;
// //
if (uni.vibrateShort) {
uni.vibrateShort();
}
} }
// //
@ -306,7 +315,7 @@ export default {
JSON.parse(uni.getStorageSync("userInfo"))) || JSON.parse(uni.getStorageSync("userInfo"))) ||
this.$store.state.user.userInfo || this.$store.state.user.userInfo ||
{}; {};
console.log(this.userInfo,'this.userInfo') console.log(this.userInfo, "this.userInfo");
// //
if (this.userInfo && this.userInfo.nickname) { if (this.userInfo && this.userInfo.nickname) {
this.currentTitle = `Hi!${this.userInfo.nickname},欢迎回来~`; this.currentTitle = `Hi!${this.userInfo.nickname},欢迎回来~`;
@ -318,9 +327,11 @@ export default {
}, },
toWebView() { toWebView() {
uni.navigateTo({ uni.navigateTo({
url:'/subPackages/webPage/webPage?url='+'https://www.dayunyuanjian.cn/dist/#/chat-demo' url:
}) "/subPackages/webPage/webPage?url=" +
} "https://www.dayunyuanjian.cn/dist/#/chat-demo",
});
},
}, },
}; };
</script> </script>
@ -333,6 +344,7 @@ export default {
position: relative; position: relative;
opacity: 1; opacity: 1;
transition: opacity 0.3s ease; transition: opacity 0.3s ease;
padding:24rpx 0
} }
.dynamic-island-placeholder.visible { .dynamic-island-placeholder.visible {
@ -346,7 +358,8 @@ export default {
} }
.dynamic-island { .dynamic-island {
margin: 24rpx auto 24rpx; // margin: 24rpx auto 24rpx;
margin: 0 auto;
z-index: 100; z-index: 100;
background: rgba(0, 0, 0, 0.75); background: rgba(0, 0, 0, 0.75);
@ -428,7 +441,6 @@ export default {
.qr-code { .qr-code {
width: 32rpx; width: 32rpx;
height: 32rpx; height: 32rpx;
} }
.qr-icon { .qr-icon {

15
pages/index/iSoul.vue

@ -94,9 +94,7 @@
<!-- 数字资产权益 --> <!-- 数字资产权益 -->
<view class="digital-assets"> <view class="digital-assets">
<view class="asset-card"> <view class="asset-card">
<image <image @click="handleAssetAction()" :src="
@click="handleAssetAction()"
:src="
showImg('/uploads/20250729/42598a2dcf4c9a6f8c6e122e54b65c4f.png') showImg('/uploads/20250729/42598a2dcf4c9a6f8c6e122e54b65c4f.png')
" mode="aspectFill" class="digital-img"></image> " mode="aspectFill" class="digital-img"></image>
@ -197,7 +195,7 @@
<view class="popup-content"> <view class="popup-content">
<view class="input-section"> <view class="input-section">
<text class="input-label">请输入兑换码</text> <text class="input-label">请输入兑换码</text>
<input class="exchange-input" v-model="exchangeCode" placeholder="请输入兑换码" maxlength="20" /> <input class="exchange-input" v-model="exchangeCode" placeholder="请输入兑换码" />
</view> </view>
<view class="popup-actions"> <view class="popup-actions">
<button class="cancel-btn" @click="closeExchangePopup">取消</button> <button class="cancel-btn" @click="closeExchangePopup">取消</button>
@ -458,9 +456,16 @@
).then((res) => { ).then((res) => {
if (res.code == 200) { if (res.code == 200) {
uni.showToast({ uni.showToast({
title: "兑换成功", title: "兑换成功,为您跳转订单页~",
icon: "none", icon: "none",
}); });
this.closeExchangePopup()
setTimeout(() => {
uni.navigateTo({
url: "/subPackages/orderQy/list"
})
}, 2000)
} else { } else {
uni.showToast({ uni.showToast({

113
pages/index/index.vue

@ -1,20 +1,43 @@
<template> <template>
<view class="bg"> <view class="bg">
<headerVue @change="changeAddress" :address="addressInfo" fixed isLocation></headerVue> <headerVue
@change="changeAddress"
:address="addressInfo"
fixed
isLocation
></headerVue>
<!-- 灵动岛组件 --> <!-- 灵动岛组件 -->
<!-- 灵动岛组件 - 自包含无需传递参数 --> <!-- 灵动岛组件 - 自包含无需传递参数 -->
<DynamicIsland ref="dynamicIsland" :page-id="'index_page'" @toggle="handleIslandToggle" <DynamicIsland
@action="handleIslandAction" /> ref="dynamicIsland"
:page-id="'index_page'"
@toggle="handleIslandToggle"
@action="handleIslandAction"
/>
<view class="content" @click="handleContentClick"> <view class="content" @click="handleContentClick">
<!-- 权益商品区域 --> <!-- 权益商品区域 -->
<ProductSection v-if="productList.length" title="权益商品" :productList="productList" <ProductSection
moreUrl="/subPackages/equityGoods/index" detailUrlPrefix="/subPackages/equityGoods/detail" v-show="productList.length"
@like-toggle="handleLikeToggle" /> title="权益商品"
<ProductSection titleBgColor="#92FF8F" aiTagTextColor="#08FB05" aiTagBorderColor="#6EAA3D" title="有感商品" :productList="productList"
:productList="productListFeeling" moreUrl="/pages/index/sensoryStore" moreUrl="/subPackages/equityGoods/index"
detailUrlPrefix="/subPackages/techan/detail" @like-toggle="handleLikeToggle" isFeel /> detailUrlPrefix="/subPackages/equityGoods/detail"
@like-toggle="handleLikeToggle"
/>
<ProductSection
titleBgColor="#92FF8F"
aiTagTextColor="#08FB05"
aiTagBorderColor="#6EAA3D"
title="有感商品"
:productList="productListFeeling"
moreUrl="/pages/index/sensoryStore"
detailUrlPrefix="/subPackages/techan/detail"
@like-toggle="handleLikeToggle"
isFeel
/>
<view class="tab-bar-placeholder"></view> <view class="tab-bar-placeholder"></view>
</view> </view>
@ -67,45 +90,48 @@
// isLiked: false, // isLiked: false,
// }, // },
], ],
productListFeeling: [{ productListFeeling: [
{
id: 34, id: 34,
image: "https://epic.js-dyyj.com/uploads/20250728/22e319f3feb1b63fbb539d425c51fe70.png", image:
"https://epic.js-dyyj.com/uploads/20250728/22e319f3feb1b63fbb539d425c51fe70.png",
title: "OUT OF SPACE 东方线香", title: "OUT OF SPACE 东方线香",
price: "138.00", price: "138.00",
isLiked: true, isLiked: true,
isShop: true isShop: true,
}, },
{ {
id: 32, id: 32,
image: "https://epic.js-dyyj.com/uploads/20250728/cc9907153c887a6428283a407928db9a.png", image:
"https://epic.js-dyyj.com/uploads/20250728/cc9907153c887a6428283a407928db9a.png",
title: "AI-Agent智能玩具", title: "AI-Agent智能玩具",
price: "398.00", price: "398.00",
isLiked: false, isLiked: false,
}, },
], ],
selectedText: '', selectedText: "",
addressInfo: null, addressInfo: null,
isLoading: true, //
}; };
}, },
onLoad() {}, onLoad() {},
async onReady() { async onReady() {
let res = await this.$main.getLocationInfo() let res = await this.$main.getLocationInfo();
console.log(res) console.log(res);
this.addressInfo = res this.addressInfo = res;
this.selectedText = res && res.city this.selectedText = res && res.city;
uni.setStorageSync('SYS_ADDRESS_INFO', JSON.stringify(res)) uni.setStorageSync("SYS_ADDRESS_INFO", JSON.stringify(res));
this.getList(); this.getList();
this.geBenefitPackaget() this.geBenefitPackaget();
}, },
onShow() { onShow() {
this.browse_record({ this.browse_record({
type: "page", type: "page",
title: "首页" title: "首页",
}); });
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.dynamicIsland.getUserInfo(); this.$refs.dynamicIsland.getUserInfo();
}) });
}, },
onPageScroll(e) { onPageScroll(e) {
// ID // ID
@ -114,9 +140,9 @@
onReachBottom() {}, onReachBottom() {},
methods: { methods: {
changeAddress(res) { changeAddress(res) {
this.addressInfo = res this.addressInfo = res;
uni.setStorageSync('SYS_ADDRESS_INFO', JSON.stringify(res)) uni.setStorageSync("SYS_ADDRESS_INFO", JSON.stringify(res));
this.geBenefitPackaget() this.geBenefitPackaget();
}, },
gotoUrlNew(item, index) { gotoUrlNew(item, index) {
if (index == 0) { if (index == 0) {
@ -132,7 +158,8 @@
viewDetail(item) { viewDetail(item) {
if (item.url) { if (item.url) {
uni.navigateTo({ uni.navigateTo({
url: "/subPackages/webPage/webPage?url=" + encodeURIComponent(item.url), url:
"/subPackages/webPage/webPage?url=" + encodeURIComponent(item.url),
}); });
return; return;
} }
@ -142,7 +169,8 @@
}, },
getList() { getList() {
// //
this.Post({ this.Post(
{
type_id: 3, type_id: 3,
position: 17, position: 17,
}, },
@ -154,37 +182,37 @@
}); });
}, },
geBenefitPackaget() { geBenefitPackaget() {
this.Post({ this.Post(
cityId: this.addressInfo.cityId {
cityId: this.addressInfo.cityId,
}, },
"/framework/index/benefitPackage/list", "/framework/index/benefitPackage/list",
'DES' "DES"
).then((res) => { ).then((res) => {
if (res.data) { if (res.data) {
this.productList = res.data.map(item => { this.productList = res.data.map((item) => {
return { return {
...item, ...item,
image: item.mainUrl, image: item.mainUrl,
id: item.benefitPackageId, id: item.benefitPackageId,
avatar: "https://epic.js-dyyj.com/uploads/20250728/d27ef6e6c26877da7775664fed376c6f.png", avatar:
"https://epic.js-dyyj.com/uploads/20250728/d27ef6e6c26877da7775664fed376c6f.png",
aiName: "文徵明", aiName: "文徵明",
} };
}) });
} }
}); });
}, },
gotoVideo(item) { gotoVideo(item) {
uni.navigateTo({ uni.navigateTo({
url: "/subPackages/video/video?item=" + url:
"/subPackages/video/video?item=" +
encodeURIComponent(JSON.stringify(item)), encodeURIComponent(JSON.stringify(item)),
}); });
}, },
// //
handleLikeToggle({ handleLikeToggle({ item, index }) {
item,
index
}) {
this.productList[index] = item; this.productList[index] = item;
}, },
@ -213,7 +241,8 @@
}; };
</script> </script>
<style> <style>
page {} page {
}
</style> </style>
<style lang="scss" scoped> <style lang="scss" scoped>
.bg { .bg {
@ -226,7 +255,7 @@
/* 页面样式 */ /* 页面样式 */
.content { .content {
height: calc(100vh - 123rpx); height: 100%;
width: 100%; width: 100%;
padding: 0 20rpx; padding: 0 20rpx;
box-sizing: border-box; box-sizing: border-box;

Loading…
Cancel
Save