1
PC-20250623MANY\Administrator
2025-07-22 9ec3bd6e8d7357927533d8966f882cb5d28b3e0f
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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
<template>
  <div class="flex flex-col w-full h-full c2c-order-list">
    <div>
      <order-nav class="w-full" :title="$t('订单列表')" ref="nav">
        <template #right>
          <img class="w-24 h-27" :src="require('@/assets/image/c2c/Vector27.png')" alt="" @click="selectShow = true">
        </template>
      </order-nav>
    </div>
    <div class="flex-1 w-full overflow-auto">
      <div v-if="isEmpty === 'true'" class="flex justify-center mt-176">
        <div>
          <img class="w-157 h-152" :src="require('@/assets/image/c2c/Group323.png')" alt="">
          <p class="mt-36 font-28 text-center text-grey">{{ $t('暂无订单') }}</p>
        </div>
      </div>
      <div v-else>
        <van-pull-refresh :pulling-text="$t('下拉即可刷新')" :loosing-text="$t('释放即可刷新')" :loading-text="$t('加载中')"
          v-model="isLoading" @refresh="onRefresh">
          <van-list v-model="loading" :finished="finished" :immediate-check="false" :finished-text="$t('没有更多了')"
            @load="onLoad">
            <template v-if="list.length > 0">
              <items v-for="(item, index) in list" :items="item" :key="index" />
            </template>
            <div v-else class="w-full h-full">
              <van-empty class="custom-image" :image="require('@/assets/image/otc/nodatas.png')"
                :description="$t('暂无数据')">
              </van-empty>
            </div>
          </van-list>
        </van-pull-refresh>
        <!--        <div class="w-full mt-76 mb-52 font-28 text-grey text-center">已经全部加载完毕</div>-->
      </div>
    </div>
    <!--  显示筛选  -->
    <div class="select">
      <van-popup class="relative" v-model="selectShow" position="bottom" :style="fulHeight">
        <order-nav>
          <template #left><i></i></template>
          <template #title>
            <span class="font-35 font-700">{{ $t('订单历史筛选') }}</span>
          </template>
          <template #right>
            <van-icon @click.native="selectShow = false" name="cross" color="#9399A4" />
          </template>
        </order-nav>
        <div class=" px-37">
          <div class="">
            <p class="mb-38 font-28 text-grey">{{ $t('交易类型') }}</p>
            <div>
              <select-item :list="selectList.title" :value="currentDirection" @select='handleSelect' />
            </div>
          </div>
          <div class="mt-59">
            <p class="mb-38 font-28 text-grey">{{ $t('订单状态') }}</p>
            <div>
              <select-item :list="selectList.items" :value="currentState" @select='handleSelect2' />
            </div>
          </div>
          <div class="absolute right-37 left-37 bottom-70 flex">
            <van-button @click.native="reset" class="flex-1 mr-38 font-31 rounded-lg" type="info" color="#EAEBEE">
              <span style="color: #21262F">{{ $t('重置') }}</span>
            </van-button>
            <van-button @click.native="selectEnter" class="flex-1 font-31 rounded-lg" type="info" color="#1D91FF">
              {{ $t('确认') }}
            </van-button>
          </div>
        </div>
      </van-popup>
    </div>
 
    <!--  未读消息  -->
    <!--    <van-popup class="w-full h-full" v-model="showUnread" position="right">-->
    <!--      <unread @back="hiddenUnread" :data="unreadData"/>-->
    <!--    </van-popup>-->
  </div>
</template>
 
<script>
import {
  Popup,
  Icon,
  PullRefresh,
  Empty,
  Button,
  List, Toast,
} from "vant";
import OrderNav from "@/components/order-nav/OrderNav";
import Items from "@/page/orderList/items";
import SelectItem from "@/page/c2c-order-list/SelectItem";
import Unread from "@/page/c2c-order-list/Unread";
import listLoadMixins from '@/utils/list-load-mixins'
import { ctcOrderList } from "@/API/otc";
export default {
  name: "c2cOrderList",
  props: ['isEmpty'],
  mixins: [listLoadMixins],
  data() {
    return {
      currentDirection: '全部',
      currentState: '全部',
      form: {
        direction: '',
        state: '', // 0未付款/1已付款/2申诉中/3已完成/4已取消/5已超时
      },
      navHeight: 0,
      showUnread: false,
      selectShow: false,
      titleActive: '全部',
      itemActive: '全部',
      selectList: {
        title: [{
          title: this.$t('全部'),
          value: '',
        }, {
          title: this.$t('购买'),
          value: 'buy',
        }, {
          title: this.$t('出售'),
          value: 'sell',
        }],
        items: [
          {
            title: this.$t('全部'),
            value: '',
          },
          {
            title: this.$t('未付款'),
            value: 0,
          },
          {
            title: this.$t('已付款'),
            value: 1,
          },
          {
            title: this.$t('申诉中'),
            value: 2,
          },
          {
            title: this.$t('已完成'),
            value: 3,
          },
          {
            title: this.$t('已取消'),
            value: 4,
          },
          {
            title: this.$t('已超时'),
            value: 5,
          },
        ],
      },
    }
  },
  created() {
    this.get()
  },
  mounted() {
    // let obj =  this.selectList.title.find((item) => {
    //   return item.value === 'buy'
    // })
    this.navHeight = this.$refs.nav.$el.getBoundingClientRect().height;
  },
  methods: {
    get() { // 获取数据的方法需要自定义
      Toast.loading()
      ctcOrderList({ ...this.form }).then(res => {
        Toast.clear()
        res.data.forEach((item) => {
          // item.time = '01-03 17:20:20'
        })
        // console.log(res.data);
        this.handleData(res.data)
      })
    },
    handleSelect(data) {
      this.form.direction = data.value
      this.currentDirection = data.title
      // this.get()
    },
    handleSelect2(data) {
      this.form.state = data.value
      this.currentState = data.title
 
    },
    hiddenUnread() {
      this.showUnread = false;
    },
    // 筛选确定
    selectEnter() {
      this.selectShow = false
      this.onRefresh()
    },
    // 重置选择
    reset() {
      this.currentDirection = '全部'
      this.currentState = '全部'
      this.form.direction = ''
      this.form.state = ''
    },
  },
  computed: {
    fulHeight() {
      return {
        height: `calc(100vh - ${this.navHeight}px)`
      }
    },
    // unreadData() {
    //   const arr = this.formatData([...this.sell, ...this.buy])
    //   return arr.filter(v => v.msg !== undefined)
    // }
  },
  components: {
    [Popup.name]: Popup,
    [Icon.name]: Icon,
    [Button.name]: Button,
    [List.name]: List,
    [PullRefresh.name]: PullRefresh,
    [Empty.name]: Empty,
    OrderNav,
    Items,
    SelectItem,
    Unread,
  }
}
</script>
 
<style lang="scss" scoped>
.select {
  ::v-deep .van-popup {
    border-radius: 20px 20px 0 0;
  }
}
</style>