123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170 |
- <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: 10px;" @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="$fileUrl() + '/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: 12px;">
- <span class="textColor5">
- ¥{{item.order.goodsPrice}}
- </span>
- <span class="textColor3">
- 共 <span class="textColor5">{{item.num}}</span>件商品
- </span>
- </view>
- <view class="row" style="justify-content: flex-end;">
- <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: 10px;
- }
- .tabs {
- display: flex;
-
- .tab {
- width: 68px;
- height: 24px;
- font-size: 14px;
- background: #fff;
- border-radius: 4px;
- line-height: 24px;
- text-align: center;
- }
- .active {
- background: #FEA200;
- color: #fff;
- }
- }
-
- .list {
- padding: 10px 0;
-
- .item {
- background: #fff;
- border-radius: 4px;
- display: flex;
- padding: 10px;
- margin-bottom: 10px;
- font-size: 14px;
- align-items: center;
- position: relative;
-
- .tag {
- background: #DEF2E4;
- color: #00C537;
- font-size: 16px;
- padding: 2px 5px;
- border-radius: 0 0 0 10px;
- position: absolute;
- right: 0;
- top: 0;
- }
- .icon {
- width: 75px;
- height: 75px;
- border-radius: 4px;
- }
-
- .info {
- display: flex;
- flex-direction: column;
- justify-content: flex-end;
- align-items: center;
- padding-left: 10px;
- flex: 1;
-
- .row {
- width: 100%;
- margin-top: 10px;
- display: flex;
- }
- }
- }
- }
- </style>
|