shop_app/pages/vip/mine/sheng.vue

277 lines
5.9 KiB
Vue
Raw Normal View History

2025-06-14 10:01:48 +08:00
<template>
<view class="pageBox">
<view class="oneBox">
<view class="row flex1 row1">
<view class="icon flex"><up-icon name="coupon" size="32" color="#6A462A" /></view>
<view class="right flex1">
<view class="box">
<view class="tit">会员优惠劵</view>
<text>入会礼+月季劵+其他会员卷</text>
</view>
<view class="text">已省<text>{{sumData.coupon_saved_money || '0.00'}}</text></view>
</view>
</view>
<view class="row flex1">
<view class="icon flex"><up-icon name="integral" size="32" color="#6A462A" /></view>
<view class="right flex1">
<view class="box">
<view class="tit">会员价</view>
<text>享受会员价</text>
</view>
<view class="text">已省<text>{{sumData.vip_price_saved_money || '0.00'}}</text></view>
</view>
</view>
</view>
<view class="twoBox">
<view class="title">省钱明细</view>
<view class="item" v-for="(item, index) in infoList" :key="index">
<view class="date">
<text>{{parseDate(item.date)}}</text>
</view>
<view class="contBox" v-for="itm in item.list" :key="itm.id">
<view class="row">
<view class="cont flex1" v-for="it in itm.order.items" :key="it.id">
<image :src="it.pic_url" mode="aspectFill"></image>
<view class="box">
<view class="tit">{{it.goods_name}}</view>
<text>{{it.sku_name}}</text>
</view>
</view>
<view class="btm flex1">
<view class="time">{{itm.created_at}}</view>
<view class="text">已省<text>{{itm.total_saved_money}}</text></view>
</view>
</view>
</view>
</view>
<view class="noMore" v-if="infoList.length && page >= lastPage && !loading"> 没有更多了 </view>
<view v-if="loading" class="loadbox">
<up-loading-icon text="加载中..." textSize="14"></up-loading-icon>
</view>
<view v-if="!loading && !infoList.length">
<up-empty mode="list" icon="https://ct-upimg.yx090.com/g.ii090/images/sprite/empty/list.png" text="暂无明细喔"></up-empty>
</view>
</view>
</view>
</template>
<script>
import { ref, reactive, toRefs } from 'vue'
import { get, post } from '@/api/request.js'
export default {
setup() {
const data = reactive({
page: 1,
lastPage: 0,
loading: true,
infoList: [],
sumData: {}
})
const getInfo = () => {
uni.showLoading({
title: '加载中...',
mask: true
})
data.loading = true
get(`/api/v1/user/vip/orderVipSavedMoneyRecord`).then((res) => {
res.data.forEach((item) => {
let length = data.infoList.length
if(length && data.infoList[length - 1].date == item.created_at.slice(0, 7)) {
data.infoList[length - 1].list.push(item)
} else {
let obj = {
date: item.created_at.slice(0, 7),
list: [item]
}
data.infoList.push(obj)
}
})
data.lastPage = res.meta.last_page
data.sumData = res.sum
uni.hideLoading()
data.loading = false
}).catch(() => {
data.loading = false
})
}
function parseDate(val) {
let list = val.split('-')
return list[0] + '年' + list[1] + '月'
}
return {
...toRefs(data),
getInfo,
parseDate
}
},
async onLoad(options) {
this.getInfo()
},
onReachBottom() {
if (this.page < this.lastPage) {
this.page++
this.getInfo()
}
}
}
</script>
<style lang="scss" scoped>
.flex{
display: flex;
align-items: center;
justify-content: center;
}
.flex1{
display: flex;
align-items: center;
justify-content: space-between;
}
.pageBox{
width: 100%;
padding: 24rpx;
background: #F5F5F5;
min-height: 100vh;
box-sizing: border-box;
.oneBox{
padding: 24rpx 24rpx 0;
box-sizing: border-box;
background-color: #fff;
border-radius: 10px;
.btn{
color: #58341E;
background-color: #F9EDCE;
border-radius: 4px;
height: 80rpx;
font-size: 28rpx;
font-weight: 600;
margin-bottom: 20rpx;
}
.row{
padding: 20rpx 0;
&.row1{
border-bottom: 1rpx solid #f2f2f2;
}
.icon{
width: 110rpx;
height: 110rpx;
border-radius: 16px;
background-color: #F7DEB5;
}
.right{
width: calc(100% - 130rpx);
.box{
.tit{
color: #333;
font-size: 30rpx;
margin-bottom: 10rpx;
}
text{
color: #999;
font-size: 24rpx;
}
}
.text{
color: #58341E;
font-size: 28rpx;
text{
color: #464646;
}
}
}
}
}
.twoBox{
position: relative;
.title{
position: absolute;
left: 0;
top: 20rpx;
font-size: 30rpx;
font-weight: 600;
color: #5A5A5A;
}
.item{
padding: 20rpx 0 0;
.date{
margin-bottom: 20rpx;
display: flex;
justify-content: flex-end;
font-size: 26rpx;
color: #444;
text-align: right;
text{
background: linear-gradient(to right , #F5F5F5, #F7DFB7);
display: inline-block;
padding: 2px 3px;
}
}
.contBox{
background-color: #fff;
border-radius: 10rpx;
}
.row{
padding: 20rpx;
border-bottom: 1rpx solid #f2f2f2;
.cont{
padding-bottom: 20rpx;
image{
width: 120rpx;
height: 120rpx;
border-radius: 6rpx;
}
.box{
width: calc(100% - 140rpx);
min-height: 120rpx;
.tit{
color: #222;
font-size: 28rpx;
}
text{
color: #A8A8A8;
font-size: 24rpx;
}
}
}
.btm{
font-size: 28rpx;
.time{
color: #999;
font-size: 24rpx;
}
.text{
color: #909090;
text{
color: #444;
}
}
}
}
}
}
}
.noMore{
text-align: center;
font-size: 24rpx;
color: #999;
margin: auto;
padding: 30rpx 0;
width: 100%;
}
.loadbox {
padding: 30rpx 0;
text-align: center;
color: #666;
}
</style>