|
|
@@ -0,0 +1,136 @@
|
|
|
+<!-- 我的订单-转让成交-历史 -->
|
|
|
+<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>{{ getBuyOrSellName(item.buyorsell) }}</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="g-order-list__content">
|
|
|
+ <ul>
|
|
|
+ <li>
|
|
|
+ <span>转让数量</span>
|
|
|
+ <span>{{ item.tradeqty }}</span>
|
|
|
+ </li>
|
|
|
+ <li>
|
|
|
+ <span>转让价</span>
|
|
|
+ <span>{{ item.tradeprice }}</span>
|
|
|
+ </li>
|
|
|
+ <li>
|
|
|
+ <span>订货价</span>
|
|
|
+ <span>{{ item.presaleprice }}</span>
|
|
|
+ </li>
|
|
|
+ <li>
|
|
|
+ <span>损益</span>
|
|
|
+ <span>{{ item.closepl }}</span>
|
|
|
+ </li>
|
|
|
+ <li>
|
|
|
+ <span>成交时间</span>
|
|
|
+ <span>{{ formatDate(item.tradetime, '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 } from '@/filters'
|
|
|
+import { useRequest } from '@/hooks/request'
|
|
|
+import { queryMineTradeTradeDetails } from '@/services/api/transfer'
|
|
|
+import { getBuyOrSellName } 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.MineTradeTradeDetailsRsp[]>([])
|
|
|
+const selectedRow = shallowRef<Model.MineTradeTradeDetailsRsp>()
|
|
|
+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(queryMineTradeTradeDetails, {
|
|
|
+ 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.MineTradeTradeDetailsRsp) => {
|
|
|
+ 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>
|