mycard.vue
4.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
<template>
<view>
<view class="vipBox" v-if="card.isVip">
<image class="fm" :src="vTypeImg"></image>
<image class="vv" src="/static/vip.png"></image>
<view class="poInfo">
<view class="flexline">
<view class="typeStr">{{card.info.cardTypeStr}}</view>
<view class="cardCode">{{card.info.cardCode}}</view>
</view>
<view class="flexline mt40">
<view class="ye">
余额(元)
<text>{{card.info.balance}}</text>
</view>
<view class="zk">
折扣
<view>
<text>{{(100 - card.info.discountPercent)/10}}</text>
折
</view>
</view>
</view>
</view>
<view class="cardBottom">
<text>有效期至{{card.info.expirationTime}}</text>
<text class="renewBtn" @click="goRenew">立即续费</text>
</view>
</view>
<view class="uni-padding-wrap uni-common-mt">
<uni-segmented-control :current="current" :values="items" style-type="text" active-color="#16C682"
@clickItem="onClickItem" />
</view>
<view class="bill-content">
<view v-if="current === 0">
<view>
<view class="billItem" v-for="(item,index) in list1" :key="index">
<view>订单编号: <text>{{item.dataId}}</text></view>
<view>消费类型: <text>{{item.consumeTypeStr}}</text></view>
<view>消费时间:
<text v-if="item.siteOrder?.payTime">{{item.siteOrder.payTime}}</text>
<text v-else-if="item.cptSignOrder?.payTime">{{item.cptSignOrder?.payTime}}</text>
<text v-else>{{item.orderTime}}</text>
</view>
<view v-if="item.siteOrder?.verificationCode">验证码:
<text>【{{item.siteOrder.verificationCode}}】 </text>
</view>
<view v-if="item.siteOrder">预订项目: <text>{{item.siteOrder.siteName}}</text></view>
<view class="billFoot">
<view class="status">支付</view>
<!-- <view class="status warning" v-else>{{item.siteOrder.payStatusStr}}</view> -->
<!-- 退钱 -->
<view class="price" style="display: block;">
<text class="success" style="white-space: nowrap;">¥{{item.dataValue}}
<text class="danger" v-if="item.siteOrder?.refundAmount">(已退款¥{{item.siteOrder.refundAmount}})</text>
<text class="danger" v-if="item.cptSignOrder?.payStatus=='5'">(已退款¥{{item.cptSignOrder.organizerRefundAmount}})</text>
</text>
</view>
</view>
</view>
<view class="nodata" v-if="list1.length==0">
<image mode="aspectFit" src="/static/nodata.png"></image>
</view>
</view>
</view>
<view v-if="current === 1">
<view class="billItem" v-for="(item,index) in list2" :key="index">
<view>订单编号: <text>{{item.orderCode}}</text></view>
<view v-if="item.payTime">充值日期: <text>{{item.payTime}} </text></view>
<view>充值方式: <text>{{item.payTypeStr}}</text></view>
<view class="billFoot">
<view class="status">充值金额</view>
<view class="price">¥{{item.orderValue}}</view>
</view>
</view>
<view class="nodata" v-if="list2.length==0">
<image mode="aspectFit" src="/static/nodata.png"></image>
</view>
</view>
</view>
</view>
</template>
<script setup>
import {
onLoad,onPullDownRefresh
} from '@dcloudio/uni-app'
import {
ref
} from 'vue'
import * as api from '@/common/api.js'
const vTypeImg = ref('/static/v1.png')
const items = ref(['消费记录', '充值记录'])
const current = ref(0)
const card = ref({})
const list1 = ref([])
const list2 = ref([])
const currUser = uni.getStorageSync('currUser');
onLoad(() => {
api.getOwnMemberInfo().then((res) => {
card.value = res.data
getxfList()
})
})
onPullDownRefresh(()=>{
api.getOwnMemberInfo().then((res) => {
card.value = res.data
getxfList()
})
})
function onClickItem(e) {
console.log(e)
if (e.currentIndex === 0) {
getxfList()
} else if (e.currentIndex === 1) {
getxzList()
}
if (current.value !== e.currentIndex) {
current.value = e.currentIndex;
}
}
function getxfList() {
if (card.value.isVip) {
// 消费
api.xfList({
memberId: card.value.info.id
}).then((res) => {
list1.value = res.rows
})
}
}
function getxzList() {
if (card.value.isVip) {
// 充值
api.czList({
memberId: card.value.info.id
}).then((res) => {
list2.value = res.rows
})
}
}
function goRenew() {
let path = '/pages/usercenter/mycard/renew';
uni.navigateTo({
url: path
});
}
</script>
<style scoped>
.vipBox {
margin-bottom: 30rpx
}
.billItem {
padding-bottom: 1rpx;
margin: 0 0 30rpx;
}
.billItem view text text{float: none;}
.billFoot {
padding: 22rpx 35rpx;
margin-bottom: 20rpx
}
.success{color: #16C682;}
.danger{color: #da2a2a;}
</style>