|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
|
<layout-page>
|
|
|
<view class="box defaultBgc">
|
|
|
- <scroll-view class="scrollBox" scroll-y="true" @scrolltolower="loadingMore">
|
|
|
+ <scroll-view class="scrollBox" scroll-y="true">
|
|
|
<view class="content">
|
|
|
<!-- 钱包 -->
|
|
|
<view class="wallet">
|
|
@@ -27,10 +27,6 @@
|
|
|
<text>{{ balance.balance > 0 ? (balance?.balance / 100.0).toFixed(2) : 0 }}</text>
|
|
|
<text class="title">余额</text>
|
|
|
</view>
|
|
|
- <view class="wallet-content-coupon wallet-content-item" @tap="handleTo('coupon')">
|
|
|
- <text>{{ myCoupon }}</text>
|
|
|
- <text class="title">优惠券</text>
|
|
|
- </view>
|
|
|
</view>
|
|
|
</view>
|
|
|
<!-- 签到 -->
|
|
@@ -58,25 +54,35 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <!-- 福利 -->
|
|
|
- <view class="welfare">
|
|
|
- <view
|
|
|
- v-for="item in items"
|
|
|
- :key="item.id"
|
|
|
- class="item"
|
|
|
- :class="{ disabled: !item.canTake }"
|
|
|
- @tap="onGetCoupon(item.id, item.canTake)"
|
|
|
- >
|
|
|
- <view class="img">
|
|
|
- <image
|
|
|
- src="/static/img/ticket.png"
|
|
|
- mode="scaleToFill"
|
|
|
- />
|
|
|
- </view>
|
|
|
- <text>{{ item.name }}</text>
|
|
|
+ <!-- 积分规则、积分兑换 -->
|
|
|
+ <view class="ss-m-t-20">
|
|
|
+ <uni-section title="积分规则" type="line" style="background-color: #fff;">
|
|
|
+ <uni-list>
|
|
|
+ <uni-list-item v-for="(k, i) in integralRules" :key="i" :showArrow="false">
|
|
|
+ <template v-slot:header>
|
|
|
+ <text class="ss-m-t-10">{{ k.text }}</text>
|
|
|
+ </template>
|
|
|
+ <template v-slot:footer>
|
|
|
+ <view class="d-flex align-center" style="width: 100px; text-align: start;">
|
|
|
+ <image src="/static/svg/integral.svg" style="width: 30px; height: 30px;"></image>
|
|
|
+ <view class="color-primary ss-m-l-10">{{ k.point }}</view>
|
|
|
+ </view>
|
|
|
+ </template>
|
|
|
+ </uni-list-item>
|
|
|
+ </uni-list>
|
|
|
+ </uni-section>
|
|
|
+ <view class="ss-m-t-20">
|
|
|
+ <uni-section title="积分兑换" type="line" style="background-color: #fff;">
|
|
|
+ <view class="goods" >
|
|
|
+ <view class="goods-item" v-for="(item,index) in goodsList" :key="index" @tap.stop="handleClickGoods">
|
|
|
+ <image :src="item.url" class="goods-item-img" mode="widthFix"></image>
|
|
|
+ <view class="goods-item-name">{{ item.name }}</view>
|
|
|
+ <view>消耗积分<text class="goods-item-price">{{ item.point }}</text></view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </uni-section>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <uni-load-more :status="more" />
|
|
|
</view>
|
|
|
</scroll-view>
|
|
|
</view>
|
|
@@ -92,13 +98,8 @@ import {
|
|
|
createRewardSignInRecord,
|
|
|
getAccountBalance,
|
|
|
getUserAccount,
|
|
|
- getDiyTemplateUsed,
|
|
|
- getDiyTemplate,
|
|
|
- getCouponTemplatePage,
|
|
|
- takeCoupon,
|
|
|
- getCouponPage
|
|
|
} from '@/api/sign'
|
|
|
-import { onShow, onLoad } from '@dcloudio/uni-app'
|
|
|
+import { onShow } from '@dcloudio/uni-app'
|
|
|
import { userStore } from '@/store/user'
|
|
|
import { showAuthModal } from '@/hooks/useModal'
|
|
|
|
|
@@ -106,6 +107,31 @@ const useUserStore = userStore()
|
|
|
// 设置自定义tabBar选中值
|
|
|
|
|
|
const SignItems = ref([])
|
|
|
+// 积分规则
|
|
|
+const integralRules = [
|
|
|
+ { text: '个人注册', point: 100 },
|
|
|
+ { text: '个人拉新注册', point: 50 },
|
|
|
+ { text: '完善在线简历信息', point: 50 },
|
|
|
+ { text: '购买14天双周卡', point: 200 },
|
|
|
+ { text: '购买30天月卡', point: 350 },
|
|
|
+ { text: '购买60天月卡', point: 500 },
|
|
|
+ { text: '购买90天月卡', point: 800 },
|
|
|
+ { text: '购买年度卡', point: 1200 }
|
|
|
+]
|
|
|
+// 商品列表
|
|
|
+const goodsList = [
|
|
|
+ { name: '房券-高端酒店房券', point: 12000, url: 'https://minio.menduner.com/dev/menduner/hotalRoomVoucher.png' },
|
|
|
+ { name: '门墩儿酒店英语学习年卡', point: 8000, url: 'https://minio.menduner.com/dev/menduner/englishCourses.png' },
|
|
|
+ { name: '红酒-经典年份葡萄酒', point: 5000, url: 'https://minio.menduner.com/dev/menduner/redWine.png' },
|
|
|
+ { name: '瑞幸咖啡券-瑞幸咖啡精致享受券', point: 2000, url: 'https://minio.menduner.com/dev/menduner/coffee.png' },
|
|
|
+ { name: '减压捏捏乐', point: 500, url: 'https://minio.menduner.com/dev/menduner/pinchMusic.png' }
|
|
|
+]
|
|
|
+const handleClickGoods = () => {
|
|
|
+ uni.showToast({
|
|
|
+ icon: 'none',
|
|
|
+ title: '请前往网页版门墩儿商城兑换'
|
|
|
+ })
|
|
|
+}
|
|
|
|
|
|
// 连续签到天数
|
|
|
const continuousDay = ref(0)
|
|
@@ -117,26 +143,8 @@ const todayNumber = ref()
|
|
|
|
|
|
const balance = ref({})
|
|
|
|
|
|
-const pageInfo = ref({
|
|
|
- pageNo: 1,
|
|
|
- pageSize: 20
|
|
|
-})
|
|
|
-const total = ref(0)
|
|
|
-const items = ref([])
|
|
|
-const more = ref('more')
|
|
|
-
|
|
|
-const myCoupon = ref(0)
|
|
|
-
|
|
|
-// watch(() => useUserStore.isLogin, () => {
|
|
|
-// if (useUserStore.isLogin) {
|
|
|
-// init()
|
|
|
-// }
|
|
|
-// })
|
|
|
-
|
|
|
watch([() => useUserStore.refreshToken, () => useUserStore.isLogin], () => {
|
|
|
if (useUserStore.isLogin) {
|
|
|
- getMyCoupon()
|
|
|
- initCoupon()
|
|
|
getSummary()
|
|
|
getBalance()
|
|
|
}
|
|
@@ -157,11 +165,6 @@ function init () {
|
|
|
getSummary()
|
|
|
// 获取余额积分
|
|
|
getBalance()
|
|
|
- // 获取优惠券列表
|
|
|
- initCoupon()
|
|
|
- // 获取我的优惠券总数
|
|
|
- getMyCoupon()
|
|
|
-
|
|
|
}
|
|
|
|
|
|
// 获取积分余额
|
|
@@ -222,94 +225,6 @@ async function handleSignIn () {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-// 获取优惠券分页
|
|
|
-async function getAllCouponPage () {
|
|
|
- try {
|
|
|
- const { data } = await getCouponTemplatePage({ ...pageInfo.value })
|
|
|
- // console.log(data)
|
|
|
- if (!data || !data.list || !data.list.length) {
|
|
|
- if (pageInfo.value.pageNo === 1) {
|
|
|
- more.value = 'more'
|
|
|
- return
|
|
|
- }
|
|
|
- pageInfo.value.pageNo--
|
|
|
- more.value = 'more'
|
|
|
- return
|
|
|
- }
|
|
|
- items.value.push(...data.list)
|
|
|
- total.value = +data.total
|
|
|
- more.value = total.value === items.value.length ? 'noMore' : 'more'
|
|
|
- } catch (error) {
|
|
|
- if (pageInfo.value.pageNo === 1) {
|
|
|
- more.value = 'more'
|
|
|
- return
|
|
|
- }
|
|
|
- pageInfo.value.pageNo--
|
|
|
- more.value = 'more'
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-async function getMyCoupon () {
|
|
|
- const { data } = await getCouponPage({ pageNo:1, pageSize: 1, status: 1 })
|
|
|
- if (data) {
|
|
|
- myCoupon.value = +data.total
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-// 优惠券列表
|
|
|
-// async function handleGetTmpUsed () {
|
|
|
-// try {
|
|
|
-// const { data } = await getDiyTemplateUsed()
|
|
|
-// if (!data?.home?.components) {
|
|
|
-// uni.showToast({
|
|
|
-// title: '暂无优惠券',
|
|
|
-// icon: 'none',
|
|
|
-// mask: true
|
|
|
-// })
|
|
|
-// return
|
|
|
-// }
|
|
|
-// const idsItem = data.home.components.find(e => e.id === 'CouponCard')
|
|
|
-// if (!idsItem) {
|
|
|
-// uni.showToast({
|
|
|
-// title: '暂无优惠券',
|
|
|
-// icon: 'none',
|
|
|
-// mask: true
|
|
|
-// })
|
|
|
-// return
|
|
|
-// }
|
|
|
-// const ids = idsItem?.property?.couponIds
|
|
|
-// if (!ids) {
|
|
|
-// uni.showToast({
|
|
|
-// title: '暂无优惠券',
|
|
|
-// icon: 'none',
|
|
|
-// mask: true
|
|
|
-// })
|
|
|
-// return
|
|
|
-// }
|
|
|
-// const { data: _data } = await getDiyTemplate(ids.join(','))
|
|
|
-// items.value = _data
|
|
|
-// more.value = 'noMore'
|
|
|
-// } catch (error) {
|
|
|
-
|
|
|
-// }
|
|
|
-// }
|
|
|
-
|
|
|
-async function loadingMore () {
|
|
|
- if (more.value === 'noMore') {
|
|
|
- return
|
|
|
- }
|
|
|
- more.value = 'loading'
|
|
|
- pageInfo.value.pageNo++
|
|
|
- getAllCouponPage()
|
|
|
-}
|
|
|
-
|
|
|
-function initCoupon () {
|
|
|
- pageInfo.value.pageNo = 1
|
|
|
- items.value = []
|
|
|
- getAllCouponPage()
|
|
|
-}
|
|
|
-
|
|
|
function handleLogin () {
|
|
|
if (!useUserStore.isLogin) {
|
|
|
showAuthModal()
|
|
@@ -323,38 +238,6 @@ function toInfo () {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
-async function onGetCoupon(id, canTake) {
|
|
|
- if (!canTake) {
|
|
|
- return
|
|
|
- }
|
|
|
- uni.showLoading({
|
|
|
- title: '领取中'
|
|
|
- })
|
|
|
- try {
|
|
|
- const {
|
|
|
- code,
|
|
|
- msg
|
|
|
- } = await takeCoupon(id)
|
|
|
- if (code !== 0) {
|
|
|
- uni.showToast({
|
|
|
- title: msg,
|
|
|
- icon: 'none'
|
|
|
- })
|
|
|
- return
|
|
|
- }
|
|
|
- uni.showToast({
|
|
|
- title: '领取成功',
|
|
|
- icon: 'success'
|
|
|
- })
|
|
|
- getMyCoupon()
|
|
|
- initCoupon()
|
|
|
- } catch (error) {
|
|
|
-
|
|
|
- } finally {
|
|
|
- uni.hideLoading()
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
function handleTo (page) {
|
|
|
if (!useUserStore.isLogin) {
|
|
|
showAuthModal()
|
|
@@ -367,11 +250,10 @@ function handleTo (page) {
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
-$px: 20rpx;
|
|
|
.box {
|
|
|
overflow: hidden;
|
|
|
height: 100vh;
|
|
|
- padding: $px 0 0 0;
|
|
|
+ padding: 20rpx 0 0 0;
|
|
|
box-sizing: border-box;
|
|
|
.scrollBox{
|
|
|
height: 100%;
|
|
@@ -384,14 +266,12 @@ $px: 20rpx;
|
|
|
box-sizing: border-box;
|
|
|
}
|
|
|
.wallet {
|
|
|
- // padding: 0 $px;
|
|
|
box-sizing: border-box;
|
|
|
height: 200rpx;
|
|
|
margin-bottom: 20rpx;
|
|
|
&-content {
|
|
|
display: flex;
|
|
|
height: 100%;
|
|
|
- // border: 2rpx solid #E5E5E5;
|
|
|
border-radius: 10rpx;
|
|
|
background: #FFF;
|
|
|
|
|
@@ -430,7 +310,7 @@ $px: 20rpx;
|
|
|
}
|
|
|
}
|
|
|
&-item {
|
|
|
- width: 16.6%;
|
|
|
+ width: 25%;
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
|
align-items: center;
|
|
@@ -447,13 +327,13 @@ $px: 20rpx;
|
|
|
}
|
|
|
}
|
|
|
.signIn {
|
|
|
- // padding: 0 $px;
|
|
|
+ // padding: 0 20rpx;
|
|
|
box-sizing: border-box;
|
|
|
&-content {
|
|
|
border-radius: 10rpx;
|
|
|
background: #FFF;
|
|
|
&-items {
|
|
|
- padding: 20rpx $px;
|
|
|
+ padding: 20rpx 20rpx;
|
|
|
display: flex;
|
|
|
height: 220rpx;
|
|
|
box-sizing: border-box;
|
|
@@ -471,6 +351,7 @@ $px: 20rpx;
|
|
|
background: #f2f4f7;
|
|
|
border-radius: 10rpx;
|
|
|
&.active {
|
|
|
+ color: #fff;
|
|
|
background: rgba(16,137,123, .66);
|
|
|
}
|
|
|
.text {
|
|
@@ -506,45 +387,51 @@ $px: 20rpx;
|
|
|
background-color: #00897B;
|
|
|
color: #FFF;
|
|
|
&.disabled {
|
|
|
- background-color: #a7a7a7 !important;
|
|
|
+ // background-color: #a7a7a7 !important;
|
|
|
+ opacity: .5;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
- .welfare {
|
|
|
- display: grid;
|
|
|
- grid-template-columns: repeat(2, 1fr);
|
|
|
- grid-gap: 20rpx;
|
|
|
- padding: 20rpx $px;
|
|
|
- .item {
|
|
|
- text-align: center;
|
|
|
- background: #FFF;
|
|
|
- padding: $px;
|
|
|
- font-size: .85em;
|
|
|
- &.disabled {
|
|
|
- position: relative;
|
|
|
- &::after {
|
|
|
- content: '已领取';
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- justify-content: center;
|
|
|
- position: absolute;
|
|
|
- top: 0;
|
|
|
- left: 0;
|
|
|
- width: 100%;
|
|
|
- height: 100%;
|
|
|
- background: rgba(255,255,255,.75);
|
|
|
- }
|
|
|
+ .goods {
|
|
|
+ padding: 0 15upx;
|
|
|
+ display: flex;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ justify-content: space-between;
|
|
|
+ &-item {
|
|
|
+ background: #FFFFFF;
|
|
|
+ width: 48%;
|
|
|
+ margin: 10upx 0;
|
|
|
+ box-sizing: border-box;
|
|
|
+ &-img {
|
|
|
+ width: 100%;
|
|
|
+ height: 250upx;
|
|
|
+ display: block;
|
|
|
+ margin: auto;
|
|
|
}
|
|
|
- .img {
|
|
|
- image {
|
|
|
- width: 128rpx;
|
|
|
- height: 128rpx;
|
|
|
- }
|
|
|
+ &-price {
|
|
|
+ padding-top: 10upx;
|
|
|
+ color: #00897B;
|
|
|
+ font-size: 32upx;
|
|
|
+ }
|
|
|
+ &-name {
|
|
|
+ width: 100%;
|
|
|
+ white-space: nowrap;
|
|
|
+ font-size: 28upx;
|
|
|
+ line-height: 50upx;
|
|
|
+ padding-bottom: 10upx;
|
|
|
+ padding-top: 10upx;
|
|
|
+ overflow:hidden;
|
|
|
+ text-overflow:ellipsis;
|
|
|
+ -webkit-box-orient:vertical;
|
|
|
+ -webkit-line-clamp:2;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+:deep(.uni-section .uni-section-header__decoration) {
|
|
|
+ background-color: #00897B !important;
|
|
|
+}
|
|
|
</style>
|