Files
aishangjia-uniapp/sub_pages/wallet/recharge/order.vue
2023-08-04 13:14:48 +08:00

352 lines
8.8 KiB
Vue
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="wallet">
<view class="my-profit">
<view class="item" @click="$push('pages/wallet/recharge/index')">
<view class="profit">{{ userInfo.balance.toFixed(2) }}</view>
<view class="desc">
我的余额
</view>
</view>
<view class="item" @click="$push('pages/wallet/gift/gift')">
<view class="profit">{{ userInfo.points }}</view>
<view class="desc">礼物收益</view>
</view>
</view>
<view class="select-date" @click="openCalendar">
<u-icon class="icon" size="22" name="calendar"></u-icon>
<text v-if="createTimeStart && createTimeEnd">{{ createTimeStart }} ~ {{ createTimeEnd }}</text>
</view>
<view class="order" v-for="(item,index) in list" :key="index">
<view class="fenqi">
<block>
<view class="item">
<view class="goods-info">
<view class="goods-name">
<text class="name" v-if="item.scene == 10">用户充值</text>
<text class="name" v-if="item.scene == 20">用户消费</text>
<text class="name" v-if="item.scene == 30">管理员操作</text>
<text class="name" v-if="item.scene == 40">订单退款</text>
<text class="selling-point">{{ item.createTime }}</text>
<text class="selling-point" v-if="item.scene == 30">备注{{ item.remark }}</text>
</view>
<view class="goods-price">
<text class="add-price"
v-if="item.scene == 10 || item.scene == 40">+{{ item.money }}</text>
<text class="sub-price" v-if="item.scene == 20">-{{ item.money }}</text>
<block v-if="item.scene == 30">
<text class="add-price" v-if="item.money > 0">+{{ item.money }}</text>
<text class="sub-price" v-else>-{{ Math.abs(item.money) }}</text>
</block>
<text class="num">{{ item.balance }}</text>
</view>
</view>
</view>
</block>
</view>
</view>
<empty v-if="!list.length" tips="暂无数据" />
<u-calendar :show="show" mode="range" :minDate="minDate" @confirm="changeDate"
@close="closeShow"></u-calendar>
</view>
</template>
<script>
import {
dateFormat
} from '@/utils/util.js'
import store from '@/store';
import {
getUser
} from '@/api/user.js'
import * as LogApi from '@/api/balance-log.js'
export default {
data() {
return {
list: [],
record: {},
userInfo: {},
deliveryTime: dateFormat('YYYY-mm-dd', new Date()),
createTimeStart: null,
createTimeEnd: null,
// 正在加载中
isLoading: true,
// 当前选择的设备ID
show: false,
minDate: '',
isLogin: false
}
},
onLoad(option) {
const app = this
app.getUserInfo()
app.minDate = uni.$u.timeFormat(new Date().getTime() - 2592000000 * 2, 'yyyy-mm-dd');
},
onShow() {
// 查询报餐信息
this.getLog()
},
methods: {
// 获取购物车数据
getLog() {
const app = this
const {
deliveryTime,
createTimeStart,
createTimeEnd
} = this
const userId = uni.getStorageSync('userId')
LogApi.pageBalanceLog({
userId,
createTimeStart: createTimeStart ? createTimeStart + ' 00:00:00' : '',
createTimeEnd: createTimeEnd ? createTimeEnd + ' 23:59:59' : '',
limit: 50,
page: 1
}).then(res => {
app.list = res.data.list
})
},
getUserInfo() {
const app = this
uni.getSystemInfo({
success(data) {
if (data) {
app.statusBarHeight = data.statusBarHeight + 50
}
}
})
getUser().then(res => {
if (res.code == 0 && res.data.username != 'www') {
app.userInfo = res.data
app.isLogin = true
} else {
app.isLogin = false
}
})
},
changeDate(date) {
console.log("date: ", date[0]);
console.log("date.lenght: ", date.length);
// this.deliveryTime = date.result
this.createTimeStart = date[0]
this.createTimeEnd = date[date.length - 1]
this.getLog()
this.show = false
},
change(e) {
console.log(e);
},
openCalendar() {
this.show = true
},
closeShow(){
this.show = false
}
}
}
</script>
<style lang="scss" scoped>
.wallet {
background-color: #f3f3f3;
height: 100vh;
}
.order {
background-color: #ffffff;
border-radius: 12rpx;
width: 700rpx;
margin: 20rpx auto;
padding: 10rpx 0;
.title {
font-weight: bold;
font-size: 30rpx;
padding: 20rpx;
display: flex;
justify-content: space-between;
}
.xieyi {
padding: 20rpx;
font-size: 26rpx;
}
}
.fenqi {
padding: 10rpx 30rpx;
font-size: 26rpx;
.item {
display: flex;
padding: 10rpx 0;
.image {
width: 160rpx;
height: 120rpx;
}
.goods-info {
width: 700rpx;
margin-left: 10rpx;
display: flex;
justify-content: space-between;
.goods-name {
text-align: left;
display: flex;
flex-direction: column;
.name {
font-weight: 500;
max-width: 300rpx;
text-overflow: -o-ellipsis-lastline;
overflow: hidden; //溢出内容隐藏
text-overflow: ellipsis; //文本溢出部分用省略号表示
display: -webkit-box; //特别显示模式
-webkit-line-clamp: 2; //行数
line-clamp: 2;
-webkit-box-orient: vertical; //盒子中内容竖直排列
}
.selling-point {
max-width: 400rpx;
color: #999999;
text-overflow: -o-ellipsis-lastline;
overflow: hidden; //溢出内容隐藏
text-overflow: ellipsis; //文本溢出部分用省略号表示
display: -webkit-box; //特别显示模式
-webkit-line-clamp: 1; //行数
line-clamp: 1;
-webkit-box-orient: vertical; //盒子中内容竖直排列
}
}
.goods-price {
display: flex;
flex-direction: column;
.add-price {
color: #27b900;
}
.sub-price {
color: #ff0000;
}
.num {
text-align: right;
color: #cccccc;
}
}
}
}
}
.select-date {
text-align: center;
font-size: 28rpx;
padding: 12rpx 0;
margin: auto;
display: flex;
justify-content: center;
align-items: center;
.icon {
margin-right: 10rpx;
}
}
.on-buy {
background-color: #804002;
}
.user-card {
width: 700rpx;
height: 260rpx;
margin: 30rpx auto;
border-radius: 24rpx;
background: url('data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20version%3D%221.1%22%3E%3Cdefs%3E%3ClinearGradient%20id%3D%221%22%20x1%3D%220%22%20x2%3D%221%22%20y1%3D%220%22%20y2%3D%220%22%20gradientTransform%3D%22matrix(6.123233995736766e-17%2C%201%2C%20-0.024693877551020406%2C%206.123233995736766e-17%2C%200.5%2C%200)%22%3E%3Cstop%20stop-color%3D%22%230a060d%22%20stop-opacity%3D%221%22%20offset%3D%220%22%3E%3C%2Fstop%3E%3Cstop%20stop-color%3D%22%23660061%22%20stop-opacity%3D%221%22%20offset%3D%220.95%22%3E%3C%2Fstop%3E%3C%2FlinearGradient%3E%3C%2Fdefs%3E%3Crect%20width%3D%22100%25%22%20height%3D%22100%25%22%20fill%3D%22url(%231)%22%3E%3C%2Frect%3E%3C%2Fsvg%3E');
.user-info {
padding: 40rpx;
position: relative;
.avatar {
display: flex;
align-items: center;
color: #ffffff;
.avatar-img {
border: 4rpx solid #ffffff;
}
.user {
margin-left: 15rpx;
.nickname {
font-size: 34rpx;
}
.desc {
font-size: 26rpx;
color: #b2b2b2;
}
}
image {
border: 4rpx solid #ffffff;
}
}
.buy-log {
position: absolute;
z-index: 999;
text-align: center;
top: 50rpx;
right: 40rpx;
font-size: 24rpx;
padding: 5rpx 20rpx;
border-radius: 12rpx 0 12rpx 0;
background-color: #f3f3f3;
}
}
}
// 我的收益
.my-profit {
background: url('data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20version%3D%221.1%22%3E%3Cdefs%3E%3ClinearGradient%20id%3D%221%22%20x1%3D%220%22%20x2%3D%221%22%20y1%3D%220%22%20y2%3D%220%22%20gradientTransform%3D%22matrix(6.123233995736766e-17%2C%201%2C%20-0.024693877551020406%2C%206.123233995736766e-17%2C%200.5%2C%200)%22%3E%3Cstop%20stop-color%3D%22%230a060d%22%20stop-opacity%3D%221%22%20offset%3D%220%22%3E%3C%2Fstop%3E%3Cstop%20stop-color%3D%22%23660061%22%20stop-opacity%3D%221%22%20offset%3D%220.95%22%3E%3C%2Fstop%3E%3C%2FlinearGradient%3E%3C%2Fdefs%3E%3Crect%20width%3D%22100%25%22%20height%3D%22100%25%22%20fill%3D%22url(%231)%22%3E%3C%2Frect%3E%3C%2Fsvg%3E');
display: flex;
align-items: center;
justify-content: space-around;
color: #ffffff;
margin: 42rpx auto 42rpx auto;
padding: 22rpx 0;
width: 700rpx;
height: 140rpx;
box-shadow: 0 1rpx 5rpx 0px #eaebec;
border-radius: 24rpx;
.item {
text-align: center;
.profit {
font-size: 38rpx;
font-weight: 500;
color: #ffffff;
}
.desc {
font-size: 24rpx;
color: #d8d9dc;
}
}
}
</style>