123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174 |
- <template>
- <view class="container">
- <view class="tabs">
- <view :class="['tab', tabActive == 1 ? 'active' : '']" @click="tabClick(1)">一番赏</view>
- <view :class="['tab', tabActive == 2 ? 'active' : '']" style="margin-left: 20rpx" @click="tabClick(2)">快递</view>
- </view>
- <view class="list">
- <view class="item" v-for="(item, index) in list">
- <view class="tag">已付款</view>
- <image v-if="item.order.orderType == 1" class="icon" :src="item.icon" mode="aspectFill"></image>
- <image
- v-else
- class="icon"
- :src="'https://file.rongcyl.cn/festatic/bkm/imgv2/consumptionRecords/expressDelivery.png'"
- mode="aspectFill"
- ></image>
- <view class="info">
- <view class="row title">
- <span v-if="item.order.orderType == 1">{{ item.name }}</span>
- <span v-else>下单发货</span>
- </view>
- <view class="row" style="justify-content: space-between; font-size: 24rpx">
- <span class="textColor5">¥{{ item.order.goodsPrice }}</span>
- <span class="textColor3">
- 共
- <span class="textColor5">{{ item.num }}</span>
- 件商品
- </span>
- </view>
- <view class="row" style="justify-content: space-between">
- <span style="font-size: 24rpx">{{ item.order.payTime }}</span>
- <span>
- 实付金额:
- <span class="textColor5">{{ item.order.actualPrice }}</span>
- </span>
- </view>
- </view>
- </view>
- </view>
- <uni-load-more
- v-if="list.length > 0"
- :status="loadMore"
- @clickLoadMore="load"
- :contentText="contentText"
- ></uni-load-more>
- <noData v-else />
- </view>
- </template>
- <script>
- import noData from '@/component/noData.vue'
- import { orderListApi } from '@/api/consumptionRecords.js'
- export default {
- components: {
- noData,
- },
- data() {
- return {
- tabActive: 1,
- list: [],
- loadMore: 'more',
- contentText: {
- contentdown: '点击加载更多',
- },
- params: {
- limit: 10,
- page: 1,
- orderType: 1,
- },
- }
- },
- onShow() {
- this.getList()
- },
- methods: {
- tabClick(index) {
- this.tabActive = index
- this.params.orderType = index
- this.list = []
- this.getList()
- },
- load() {
- if (this.loadMore == 'more') {
- this.params.page += 1
- this.getList()
- }
- },
- getList() {
- orderListApi(this.params).then(res => {
- console.log(res, '消费记录')
- this.list.push(...res.data.list)
- // 判断是否还有更多数据
- let listNum = this.params.limit * this.params.page
- let total = res.data.total
- if (total > listNum) {
- this.loadMore = 'more'
- } else {
- this.loadMore = 'noMore'
- }
- })
- },
- },
- }
- </script>
- <style scoped lang="scss">
- .container {
- padding: 20rpx;
- }
- .tabs {
- display: flex;
- .tab {
- width: 136rpx;
- height: 48rpx;
- font-size: 28rpx;
- background: #fff;
- border-radius: 8rpx;
- line-height: 48rpx;
- text-align: center;
- }
- .active {
- background: #fea200;
- color: #fff;
- }
- }
- .list {
- padding: 20rpx 0;
- .item {
- background: #fff;
- border-radius: 8rpx;
- display: flex;
- padding: 20rpx;
- margin-bottom: 20rpx;
- font-size: 28rpx;
- align-items: center;
- position: relative;
- .tag {
- background: #def2e4;
- color: #00c537;
- font-size: 32rpx;
- padding: 4rpx 10rpx;
- border-radius: 0 0 0 20rpx;
- position: absolute;
- right: 0;
- top: 0;
- }
- .icon {
- width: 150rpx;
- height: 150rpx;
- border-radius: 8rpx;
- }
- .info {
- display: flex;
- flex-direction: column;
- justify-content: flex-end;
- align-items: center;
- padding-left: 20rpx;
- flex: 1;
- .row {
- width: 100%;
- margin-top: 20rpx;
- display: flex;
- }
- }
- }
- }
- </style>
|