Handy_Cao 3 lat temu
rodzic
commit
b46fb5af7e

+ 20 - 23
src/business/order/index.ts

@@ -1,4 +1,4 @@
-import { shallowRef } from 'vue'
+import { reactive, shallowRef } from 'vue'
 import { useDataTable } from '@/hooks/datatable'
 import {
     queryWrOrderDetail,
@@ -97,21 +97,17 @@ export function useQueryWrOrderDetail() {
     const { dataList, total, pageIndex, pageSize, pageCount } = useDataTable<Model.WrOrderDetailRsp>()
     const loading = shallowRef(false)
     const { getUserId } = useLoginStore()
+    const formData = reactive<Partial<Model.WrOrderDetailReq>>({
+        userid: getUserId(),
+        haswr: 1,
+        page: pageIndex.value,
+        pagesize: pageSize.value,
+    })
 
-    const getWrOrderDetail = async (haswr: number, marketid?: number, bcancel?: number, wrtradetype?: number, begindate?: string, enddate?: string) => {
+    const getWrOrderDetail = async () => {
         loading.value = true
         await queryWrOrderDetail({
-            data: {
-                userid: getUserId(),
-                haswr: haswr,
-                bcancel: bcancel,
-                marketid: marketid,
-                wrtradetype: wrtradetype,
-                begindate: begindate,
-                enddate: enddate,
-                page: pageIndex.value,
-                pagesize: pageSize.value,
-            },
+            data: formData,
             success: (res) => {
                 total.value = res.total
                 dataList.value = res.data
@@ -131,6 +127,7 @@ export function useQueryWrOrderDetail() {
         pageSize,
         pageCount,
         getWrOrderDetail,
+        formData
     }
 }
 
@@ -140,18 +137,17 @@ export function useQueryWrTradeDetail() {
     const loading = shallowRef(false)
     const { getUserId } = useLoginStore()
 
-    const getWrTradeDetail = async (haswr: number, marketid?: number, begindate?: string, enddate?: string) => {
+    const formData = reactive<Partial<Model.WrTradeDetailReq>>({
+        userid: getUserId(),
+        haswr: 1,
+        page: pageIndex.value,
+        pagesize: pageSize.value,
+    })
+
+    const getWrTradeDetail = async () => {
         loading.value = true
         await queryWrTradeDetail({
-            data: {
-                userid: getUserId(),
-                haswr: haswr,
-                marketid: marketid,
-                begindate: begindate,
-                enddate: enddate,
-                page: pageIndex.value,
-                pagesize: pageSize.value,
-            },
+            data: formData,
             success: (res) => {
                 total.value = res.total
                 dataList.value = res.data
@@ -171,6 +167,7 @@ export function useQueryWrTradeDetail() {
         pageSize,
         pageCount,
         getWrTradeDetail,
+        formData
     }
 }
 

+ 80 - 1
src/packages/mobile/views/mine/order/his/purchasetrade/index.vue

@@ -3,5 +3,84 @@
         <template #header>
             <app-navbar title="采购订单-已完成" />
         </template>
+        <app-pull-refresh ref="pullRefreshRef" class="order-list__wrapper" v-model:error="error"
+            v-model:pageIndex="pageIndex" :page-count="pageCount" @refresh="onRefresh">
+            <ul class="section">
+                <li class="section-item" v-for="(item, index) in dataList" :key="index">
+                    <div class="section-item__titlebar">
+                        <div class="left">
+                            <span>{{ item.wrstandardname }}</span>
+                            <span>{{ item.enddatemonth }}</span>
+                            <span>{{ (item.depositrate * 100).toFixed(0) }}%</span>
+                            <span>{{ item.tradeqty }}{{ getGoodsUnitName(item.unitid) }}</span>
+                        </div>
+                        <div class="right">
+                            <span>{{ item.thjorderstatusdisplay }}</span>
+                        </div>
+                    </div>
+                    <div class="section-item__content">
+                        <table cellspacing="0" cellpadding="0">
+                            <tr>
+                                <th>定金</th>
+                                <td>{{ handleNumberValue(item.payeddeposit) }}</td>
+                                <th>参考价</th>
+                                <td>{{ handleNumberValue(item.tradeprice) }}</td>
+                                <th>到期日</th>
+                                <td>{{ item.enddate }}</td>
+                            </tr>
+                            <tr>
+                                <th>购买价</th>
+                                <td>{{ handleNumberValue(item.transferprice) }}</td>
+                                <th>实际价</th>
+                                <td>{{ handleNumberValue(item.lastprice) }}</td>
+                                <th>尾款</th>
+                                <td>{{ handleNumberValue(item.remainamount) }}</td>
+                            </tr>
+                        </table>
+                    </div>
+                    <div class="section-item__btnbar">
+                        <Button size="small" @click="onClick(item)" round>详情</Button>
+                    </div>
+                </li>
+            </ul>
+        </app-pull-refresh>
     </app-view>
-</template>
+</template>
+
+<script lang="ts" setup>
+import { shallowRef, onActivated } from 'vue'
+import { Button } from 'vant'
+import { useNavigation } from '@/hooks/navigation'
+import { handleNumberValue } from '@/filters'
+import { getGoodsUnitName } from '@/constants/unit'
+import { useTHJPurchaseTradeDetail } from '@/business/order'
+import AppPullRefresh from '@mobile/components/base/pull-refresh/index.vue'
+
+const { router } = useNavigation()
+const { pageIndex, pageCount, getTHJPurchaseTradeDetail } = useTHJPurchaseTradeDetail()
+const dataList = shallowRef<Model.THJPurchaseTradeDetailRsp[]>([])
+const error = shallowRef(false)
+const pullRefreshRef = shallowRef()
+
+const onClick = (item: Model.THJPurchaseTradeDetailRsp) => {
+    router.push({ name: 'purchase-trade-detail', params: { item: JSON.stringify(item) } })
+}
+
+const onRefresh = (finish: () => void) => {
+    /// 查询已完成
+    getTHJPurchaseTradeDetail(1).then((res) => {
+        if (pageIndex.value === 1) {
+            dataList.value = []
+        }
+        dataList.value.push(...res)
+    }).catch(() => {
+        error.value = true
+    }).finally(() => {
+        finish()
+    })
+}
+
+onActivated(() => {
+    pullRefreshRef.value?.refresh()
+})
+</script>

+ 69 - 1
src/packages/mobile/views/mine/order/his/transfer/index.vue

@@ -3,5 +3,73 @@
         <template #header>
             <app-navbar title="转让委托-已完成" />
         </template>
+        <app-pull-refresh class="order-list__wrapper" v-model:error="error" v-model:pageIndex="pageIndex"
+            :page-count="pageCount" @refresh="onRefresh">
+            <ul class="section">
+                <li class="section-item" v-for="(item, index) in dataList" :key="index">
+                    <div class="section-item__titlebar">
+                        <div class="left">
+                            <span>{{ item.wrstandardname }}</span>
+                        </div>
+                    </div>
+                    <div class="section-item__content">
+                        <table cellspacing="0" cellpadding="0">
+                            <tr>
+                                <th>数量</th>
+                                <td>{{ item.transferqty.toString() + getGoodsUnitName(item.unitid) }}</td>
+                                <th>转让价</th>
+                                <td>{{ handleNumberValue(item.transferprice, '元/' + getGoodsUnitName(item.unitid)) }}
+                                </td>
+                                <th>金额</th>
+                                <td>{{ handleNumberValue(item.transferamount) }}元</td>
+                            </tr>
+                            <tr>
+                                <th>预售价格</th>
+                                <td>{{ handleNumberValue(item.tradeprice) }}</td>
+                                <th>已付定金</th>
+                                <td>{{ handleNumberValue(item.payeddeposit) }}</td>
+                            </tr>
+                        </table>
+                    </div>
+                    <div class="section-item__btnbar">
+                        <Button size="small" @click="onClick(item)" round>详情</Button>
+                    </div>
+                </li>
+            </ul>
+        </app-pull-refresh>
     </app-view>
-</template>
+</template>
+
+<script lang="ts" setup>
+
+import { shallowRef } from 'vue'
+import { Button } from 'vant'
+import { useNavigation } from '@/hooks/navigation'
+import { getGoodsUnitName } from '@/constants/unit'
+import { handleNumberValue } from '@/filters'
+import { useQueryTHJPurchaseTransferOrder } from '@/business/order'
+import AppPullRefresh from '@mobile/components/base/pull-refresh/index.vue'
+
+const { router } = useNavigation()
+const { pageIndex, pageCount, getTHJPurchaseTransferOrder } = useQueryTHJPurchaseTransferOrder()
+const dataList = shallowRef<Model.THJPurchaseTransferOrderRsp[]>([])
+const error = shallowRef(false)
+
+const onClick = (item: Model.THJPurchaseTransferOrderRsp) => {
+    router.push({ name: 'transfer-detail', query: { id: item.wrtradedetailid } })
+}
+
+const onRefresh = (finish: () => void) => {
+    /// 查询未完成
+    getTHJPurchaseTransferOrder(3).then((res) => {
+        if (pageIndex.value === 1) {
+            dataList.value = []
+        }
+        dataList.value.push(...res)
+    }).catch(() => {
+        error.value = true
+    }).finally(() => {
+        finish()
+    })
+}
+</script>

+ 91 - 1
src/packages/mobile/views/mine/order/his/wrorder/index.vue

@@ -3,5 +3,95 @@
         <template #header>
             <app-navbar title="供求委托-历史" />
         </template>
+        <app-pull-refresh ref="pullRefreshRef" class="order-list__wrapper" v-model:pageIndex="pageIndex" v-model:error="error"
+            :page-count="pageCount" @refresh="onRefresh">
+            <Cell title="委托日期" :value="date"  @click="show = true"></Cell>
+            <ul class="section">
+                <li class="section-item" v-for="(item, index) in dataList" :key="index">
+                    <div class="section-item__titlebar">
+                        <div class="left">
+                            <span>{{ item.wrstandardname }}</span>
+                        </div>
+                        <div class="right">
+                            <span>{{ getTHJOrderStatusName(item.wrtradeorderstatus) }}</span>
+                        </div>
+                    </div>
+                    <div class="section-item__content">
+                        <table cellspacing="0" cellpadding="0">
+                            <tr>
+                                <th>挂牌数量</th>
+                                <td>{{ item.orderqty }}</td>
+                                <th>挂牌价格</th>
+                                <td>{{ item.fixedprice }}</td>
+                                <th>成交数量</th>
+                                <td>{{ item.tradeqty }}</td>
+                            </tr>
+                            <tr>
+                                <td>{{ handleNoneValue(item.warehousename) }}</td>
+                            </tr>
+                        </table>
+                    </div>
+                    <div class="section-item__btnbar">
+                        <Button size="small" @click="onClick(item)" round>详情</Button>
+                    </div>
+                </li>
+            </ul>
+        </app-pull-refresh>
+        <Calendar :show="show" type="range" :max-date="new Date()" :min-date="moment().subtract(1, 'years').toDate()" @close="onClose" @confirm="onConfirm" />
     </app-view>
-</template>
+</template>
+
+<script lang="ts" setup>
+import { shallowRef, ref } from 'vue'
+import { Button, Calendar, Cell } from 'vant'
+import { formatDate, handleNoneValue } from '@/filters'
+import { getTHJOrderStatusName } from '@/constants/order'
+import { useQueryWrOrderDetail } from '@/business/order'
+import AppPullRefresh from '@mobile/components/base/pull-refresh/index.vue'
+import { useNavigation } from '@/hooks/navigation'
+import moment from 'moment'
+
+const { router } = useNavigation()
+const { pageIndex, pageCount, getWrOrderDetail, formData } = useQueryWrOrderDetail()
+const dataList = shallowRef<Model.WrOrderDetailRsp[]>([])
+const error = shallowRef(false)
+/// 是否显示日历
+const show = shallowRef(true)
+/// 显示日期
+const date = ref('')
+/// 下拉刷新
+const pullRefreshRef = shallowRef()
+
+const onClick = (item: Model.WrOrderDetailRsp) => {
+    router.push({ name: 'wrorder-detail', params: { item: JSON.stringify(item) } })
+}
+
+const onRefresh = (finish: () => void) => {
+    /// 查询未完成
+    getWrOrderDetail().then((res) => {
+        if (pageIndex.value === 1) {
+            dataList.value = []
+        }
+        dataList.value.push(...res)
+    }).catch(() => {
+        error.value = true
+    }).finally(() => {
+        finish()
+    })
+}
+
+const onClose = () => {
+    show.value = false
+}
+
+const onConfirm = (values: Date[]) => {
+    const [start, end] = values;
+    show.value = false
+    formData.begindate = formatDate(start.toString(), 'YYYYMMDD')
+    formData.enddate = formatDate(end.toString(), 'YYYYMMDD')
+    date.value = formData.begindate+'-'+formData.enddate
+    /// 查询
+    pullRefreshRef.value?.refresh()
+}
+
+</script>

+ 91 - 1
src/packages/mobile/views/mine/order/his/wrtrade/index.vue

@@ -3,5 +3,95 @@
         <template #header>
             <app-navbar title="供求成交-历史" />
         </template>
+        <app-pull-refresh  ref="pullRefreshRef" class="order-list__wrapper" v-model:pageIndex="pageIndex" :page-count="pageCount"
+            v-model:error="error" @refresh="onRefresh">
+            <Cell title="成交日期" :value="date"  @click="show = true"></Cell>
+            <ul class="section">
+                <li class="section-item" v-for="(item, index) in dataList" :key="index">
+                    <div class="section-item__titlebar">
+                        <div class="left">
+                            <span>{{ item.wrstandardname }}</span>
+                            <span>{{ getBuyOrSellName(item.buyorsell) }}</span>
+                        </div>
+                        <div class="right">
+                            <span>{{ formatDate(item.tradetime) }}</span>
+                        </div>
+                    </div>
+                    <div class="section-item__content">
+                        <table cellspacing="0" cellpadding="0">
+                            <tr>
+                                <th>挂牌数量</th>
+                                <td>{{ item.tradeqty }}</td>
+                                <th>成交价格</th>
+                                <td>{{ item.tradeprice }}</td>
+                                <th>金额</th>
+                                <td>{{ item.tradeqty }}</td>
+                            </tr>
+                            <tr>
+                                <td>{{ handleNoneValue(item.warehousename) }}</td>
+                            </tr>
+                        </table>
+                    </div>
+                    <div class="section-item__btnbar">
+                        <Button size="small" @click="onClick(item)" round>详情</Button>
+                    </div>
+                </li>
+            </ul>
+        </app-pull-refresh>
+        <Calendar :show="show" type="range" :max-date="new Date()" :min-date="moment().subtract(1, 'years').toDate()" @close="onClose" @confirm="onConfirm" />
     </app-view>
-</template>
+</template>
+
+<script lang="ts" setup>
+import { shallowRef, ref } from 'vue'
+import { Button, Calendar, Cell } from 'vant'
+import { formatDate, handleNoneValue } from '@/filters'
+import { getBuyOrSellName } from '@/constants/order'
+import { useQueryWrTradeDetail } from '@/business/order'
+import AppPullRefresh from '@mobile/components/base/pull-refresh/index.vue'
+import { useNavigation } from '@/hooks/navigation'
+import moment from 'moment'
+
+const { router } = useNavigation()
+const { pageIndex, pageCount, getWrTradeDetail, formData } = useQueryWrTradeDetail()
+const dataList = shallowRef<Model.WrTradeDetailRsp[]>([])
+const error = shallowRef(false)
+/// 是否显示日历
+const show = shallowRef(true)
+/// 显示日期
+const date = ref('')
+/// 下拉刷新
+const pullRefreshRef = shallowRef()
+
+const onClick = (item: Model.WrTradeDetailRsp) => {
+    router.push({ name: 'wrtrade-detail', params: { item: JSON.stringify(item) } })
+}
+
+const onRefresh = (finish: () => void) => {
+    /// 查询未完成
+    getWrTradeDetail().then((res) => {
+        if (pageIndex.value === 1) {
+            dataList.value = []
+        }
+        dataList.value.push(...res)
+    }).catch(() => {
+        error.value = true
+    }).finally(() => {
+        finish()
+    })
+}
+
+const onClose = () => {
+    show.value = false
+}
+
+const onConfirm = (values: Date[]) => {
+    const [start, end] = values;
+    show.value = false
+    formData.begindate = formatDate(start.toString(), 'YYYYMMDD')
+    formData.enddate = formatDate(end.toString(), 'YYYYMMDD')
+    date.value = formData.begindate+'-'+formData.enddate
+    /// 查询
+    pullRefreshRef.value?.refresh()
+}
+</script>

+ 1 - 1
src/packages/mobile/views/mine/order/list/components/wrorder/index.vue

@@ -57,7 +57,7 @@ const onClick = (item: Model.WrOrderDetailRsp) => {
 
 const onRefresh = (finish: () => void) => {
     /// 查询未完成
-    getWrOrderDetail(1).then((res) => {
+    getWrOrderDetail().then((res) => {
         if (pageIndex.value === 1) {
             dataList.value = []
         }

+ 1 - 1
src/packages/mobile/views/mine/order/list/components/wrtrade/index.vue

@@ -58,7 +58,7 @@ const onClick = (item: Model.WrTradeDetailRsp) => {
 
 const onRefresh = (finish: () => void) => {
     /// 查询未完成
-    getWrTradeDetail(1).then((res) => {
+    getWrTradeDetail().then((res) => {
         if (pageIndex.value === 1) {
             dataList.value = []
         }

+ 2 - 2
src/services/api/order/index.ts

@@ -4,14 +4,14 @@ import { HttpParams } from '@/services/http/interface'
 /**
  * 查询仓单成交明细
  */
- export function queryWrTradeDetail(params: HttpParams<{ req: Model.WrTradeDetailReq, rsp: Model.WrTradeDetailRsp[] }>) {
+ export function queryWrTradeDetail(params: HttpParams<{ req: Partial< Model.WrTradeDetailReq>, rsp: Model.WrTradeDetailRsp[] }>) {
     return httpRequest('/WrTrade2/QueryWrTradeDetail', 'get', params);
 }
 
 /**
  * 查询仓单委托单
  */
- export function queryWrOrderDetail(params: HttpParams<{ req: Model.WrOrderDetailReq, rsp: Model.WrOrderDetailRsp[] }>) {
+ export function queryWrOrderDetail(params: HttpParams<{ req: Partial<Model.WrOrderDetailReq>, rsp: Model.WrOrderDetailRsp[] }>) {
     return httpRequest('/WrTrade2/QueryWrOrderDetail', 'get', params);
 }