|
|
@@ -0,0 +1,152 @@
|
|
|
+<!-- 我的订单-预售认购-历史 -->
|
|
|
+<template>
|
|
|
+ <app-modal direction="right" height="100%" v-model:show="showModal">
|
|
|
+ <app-view class="g-form">
|
|
|
+ <template #header>
|
|
|
+ <app-navbar title="历史预售认购" @back="closed">
|
|
|
+ <template #footer>
|
|
|
+ <Cell title="查询日期" :value="dateRange.join('-')" @click="showCalendar = true" is-link />
|
|
|
+ </template>
|
|
|
+ </app-navbar>
|
|
|
+ </template>
|
|
|
+ <app-pull-refresh ref="pullRefreshRef" v-model:loading="loading" v-model:error="error"
|
|
|
+ v-model:pageIndex="pageIndex" :page-count="pageCount" @refresh="onRefresh">
|
|
|
+ <div class="g-order-list">
|
|
|
+ <div class="g-order-list__box" v-for="(item, index) in dataList" :key="index">
|
|
|
+ <div class="g-order-list__titlebar">
|
|
|
+ <div class="left">
|
|
|
+ <h4>{{ item.goodsname }}</h4>
|
|
|
+ <span>{{ item.orderid }}</span>
|
|
|
+ </div>
|
|
|
+ <div class="right">
|
|
|
+ <span>{{ getOrderStatusName(item.orderstatus) }}</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="g-order-list__content">
|
|
|
+ <ul>
|
|
|
+ <li>
|
|
|
+ <span>认购量</span>
|
|
|
+ <span>{{ item.orderqty }}</span>
|
|
|
+ </li>
|
|
|
+ <li>
|
|
|
+ <span>认购价</span>
|
|
|
+ <span>{{ item.orderprice }}</span>
|
|
|
+ </li>
|
|
|
+ <li>
|
|
|
+ <span>发售方</span>
|
|
|
+ <span>{{ item.sellname }}</span>
|
|
|
+ </li>
|
|
|
+ <li>
|
|
|
+ <span>起拍价</span>
|
|
|
+ <span>{{ item.startprice }}</span>
|
|
|
+ </li>
|
|
|
+ <li>
|
|
|
+ <span>开始日期</span>
|
|
|
+ <span>{{ formatDate(item.starttime, 'YYYY-MM-DD') }}</span>
|
|
|
+ </li>
|
|
|
+ <li>
|
|
|
+ <span>结束日期</span>
|
|
|
+ <span>{{ formatDate(item.endtime, 'YYYY-MM-DD') }}</span>
|
|
|
+ </li>
|
|
|
+ <li>
|
|
|
+ <span>预售价</span>
|
|
|
+ <span>{{ handleNumberValue(item.tradeprice) }}</span>
|
|
|
+ </li>
|
|
|
+ <li>
|
|
|
+ <span>订单量</span>
|
|
|
+ <span>{{ handleNumberValue(item.tradeqty) }}</span>
|
|
|
+ </li>
|
|
|
+ <li>
|
|
|
+ <span>日期</span>
|
|
|
+ <span>{{ formatDate(item.ordertime, 'YYYY-MM-DD') }}</span>
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+ </div>
|
|
|
+ <div class="g-order-list__btnbar">
|
|
|
+ <Button size="small" @click="showComponent(item)" round>详情</Button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </app-pull-refresh>
|
|
|
+ <Calendar v-model:show="showCalendar" type="range" :max-date="new Date()"
|
|
|
+ :min-date="moment().subtract(1, 'years').toDate()" @confirm="onConfirm" />
|
|
|
+ <component ref="componentRef" v-bind="{ selectedRow }" :is="componentMap.get(componentId)"
|
|
|
+ @closed="closeComponent" v-if="componentId" />
|
|
|
+ </app-view>
|
|
|
+ </app-modal>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script lang="ts" setup>
|
|
|
+import { shallowRef, ref, defineAsyncComponent } from 'vue'
|
|
|
+import { formatDate, handleNumberValue } from '@/filters'
|
|
|
+import { useRequest } from '@/hooks/request'
|
|
|
+import { queryMineTradeOrderDetails } from '@/services/api/presale'
|
|
|
+import { getOrderStatusName } from '@/constants/order'
|
|
|
+import { useComponent } from '@/hooks/component'
|
|
|
+import { Button, Calendar, Cell } from 'vant'
|
|
|
+import moment from 'moment'
|
|
|
+import AppModal from '@/components/base/modal/index.vue'
|
|
|
+import AppPullRefresh from '@mobile/components/base/pull-refresh/index.vue'
|
|
|
+
|
|
|
+const componentMap = new Map<string, unknown>([
|
|
|
+ ['detail', defineAsyncComponent(() => import('../detail/Index.vue'))],
|
|
|
+])
|
|
|
+
|
|
|
+const dataList = shallowRef<Model.MineTradeOrderDetailsRsp[]>([])
|
|
|
+const selectedRow = shallowRef<Model.MineTradeOrderDetailsRsp>()
|
|
|
+const error = shallowRef(false)
|
|
|
+const pullRefreshRef = shallowRef()
|
|
|
+const showModal = shallowRef(true)
|
|
|
+const showCalendar = shallowRef(false) // 是否显示日期选择器
|
|
|
+const dateRange = ref<string[]>([]) // 日期范围
|
|
|
+
|
|
|
+const { componentRef, componentId, openComponent, closeComponent } = useComponent()
|
|
|
+
|
|
|
+const { loading, pageIndex, pageCount, run } = useRequest(queryMineTradeOrderDetails, {
|
|
|
+ manual: true,
|
|
|
+ params: {
|
|
|
+ pagesize: 20,
|
|
|
+ ishis: true,
|
|
|
+ },
|
|
|
+ onSuccess: (res) => {
|
|
|
+ if (pageIndex.value === 1) {
|
|
|
+ dataList.value = []
|
|
|
+ }
|
|
|
+ dataList.value.push(...res.data)
|
|
|
+ },
|
|
|
+ onError: () => {
|
|
|
+ error.value = true
|
|
|
+ }
|
|
|
+})
|
|
|
+
|
|
|
+const showComponent = (row: Model.MineTradeOrderDetailsRsp) => {
|
|
|
+ selectedRow.value = row
|
|
|
+ openComponent('detail')
|
|
|
+}
|
|
|
+
|
|
|
+// 选择日期
|
|
|
+const onConfirm = ([start, end]: Date[]) => {
|
|
|
+ showCalendar.value = false
|
|
|
+ dateRange.value = [formatDate(start.toISOString(), 'YYYYMMDD'), formatDate(end.toISOString(), 'YYYYMMDD')]
|
|
|
+ pageIndex.value = 1
|
|
|
+ pullRefreshRef.value?.refresh()
|
|
|
+}
|
|
|
+
|
|
|
+const onRefresh = () => {
|
|
|
+ const [begindate, enddate] = dateRange.value
|
|
|
+ run({
|
|
|
+ begindate,
|
|
|
+ enddate,
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+// 关闭弹窗
|
|
|
+const closed = () => {
|
|
|
+ showModal.value = false
|
|
|
+}
|
|
|
+
|
|
|
+// 暴露组件属性给父组件调用
|
|
|
+defineExpose({
|
|
|
+ closed,
|
|
|
+})
|
|
|
+</script>
|