li.shaoyi 2 lat temu
rodzic
commit
34d116e0e0

+ 2 - 0
src/packages/mobile/views/order/list/Index.vue

@@ -58,6 +58,7 @@ const { componentRef, componentId, openComponent, closeComponent } = useComponen
 
 const componentMap = new Map<string, unknown>([
     ['presale', defineAsyncComponent(() => import('./components/presale/list/Index.vue'))], // 预售认购
+    ['hispresale', defineAsyncComponent(() => import('./components/presale/history/index.vue'))], // 历史预售认购
     ['swaporder', defineAsyncComponent(() => import('./components/swaporder/list/Index.vue'))], // 掉期委托
     ['swaptrade', defineAsyncComponent(() => import('./components/swaptrade/list/Index.vue'))], // 掉期成交
     ['goodsorder', defineAsyncComponent(() => import('./components/goodsorder/list/Index.vue'))], // 订单委托
@@ -79,6 +80,7 @@ const componentMap = new Map<string, unknown>([
 const onMoreClick = () => {
     switch (active.value) {
         case 0: {
+            showComponent('hispresale')
             break
         }
         case 1: {

+ 5 - 5
src/packages/mobile/views/order/list/components/presale/detail/Index.vue

@@ -7,16 +7,16 @@
             </template>
             <div class="g-form__container">
                 <CellGroup title="预售认购信息">
-                    <Cell title="商品代码/名称" :value="selectedRow.goodsname" />
+                    <Cell title="商品代码/名称" :value="`${selectedRow.goodscode}/${selectedRow.goodsname}`" />
                     <Cell title="认购数量" :value="selectedRow.orderqty" />
                     <Cell title="认购价" :value="selectedRow.orderprice" />
                     <Cell title="认购金额" :value="(selectedRow.orderprice * selectedRow.orderqty).toFixed(2)" />
-                    <Cell title="定金方式" :value="selectedRow.presaledepositvalue" />
+                    <Cell title="定金方式" :value="parsePercent(selectedRow.presaledepositvalue)" />
                     <Cell title="预售定金" :value="selectedRow.freezemargin" />
                     <Cell title="发售方" :value="selectedRow.sellname" />
                     <Cell title="起拍价" :value="selectedRow.startprice" />
-                    <Cell title="开始日期" :value="selectedRow.starttime" />
-                    <Cell title="结束日期" :value="selectedRow.endtime" />
+                    <Cell title="开始日期" :value="formatDate(selectedRow.starttime, 'YYYY-MM-DD')" />
+                    <Cell title="结束日期" :value="formatDate(selectedRow.endtime, 'YYYY-MM-DD')" />
                     <Cell title="委托状态" :value="getOrderStatusName(selectedRow.orderstatus)" />
                     <Cell title="委托时间" :value="selectedRow.ordertime" />
                     <Cell title="预售价" :value="handleNumberValue(selectedRow.tradeprice)" />
@@ -31,7 +31,7 @@
 <script lang="ts" setup>
 import { shallowRef, PropType } from 'vue'
 import { CellGroup, Cell } from 'vant'
-import { handleNumberValue } from '@/filters'
+import { handleNumberValue, formatDate, parsePercent } from '@/filters'
 import { getOrderStatusName } from '@/constants/order'
 import AppModal from '@/components/base/modal/index.vue'
 

+ 152 - 0
src/packages/mobile/views/order/list/components/presale/history/index.vue

@@ -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>

+ 2 - 2
src/packages/mobile/views/order/list/components/presale/list/Index.vue

@@ -33,11 +33,11 @@
                         </li>
                         <li>
                             <span>开始日期</span>
-                            <span>{{ item.starttime }}</span>
+                            <span>{{ formatDate(item.starttime, 'YYYY-MM-DD') }}</span>
                         </li>
                         <li>
                             <span>结束日期</span>
-                            <span>{{ item.endtime }}</span>
+                            <span>{{ formatDate(item.endtime, 'YYYY-MM-DD') }}</span>
                         </li>
                         <li>
                             <span>预售价</span>

+ 1 - 1
src/packages/mobile/views/order/position/components/presale/list/Index.vue

@@ -6,7 +6,7 @@
             <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>
+                        <h4>{{ item.goodscode }}/{{ item.goodsname }}</h4>
                     </div>
                     <div class="right">
                         <span>{{ getPayStatusName(item.paystatus) }}</span>

+ 1 - 1
src/packages/mobile/views/order/position/components/transfer/list/Index.vue

@@ -6,7 +6,7 @@
             <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>
+                        <h4>{{ item.goodscode }}/{{ item.goodsname }}</h4>
                     </div>
                     <div class="right">
                         <span>{{ getPayStatusName(item.paystatus) }}</span>