Handy_Cao 3 лет назад
Родитель
Сommit
c5e0586136

+ 55 - 1
src/business/trade/index.ts

@@ -2,7 +2,7 @@ import { ref, shallowRef } from 'vue'
 import { v4 } from 'uuid'
 import { ClientType } from '@/constants/client'
 import { useLoginStore } from '@/stores'
-import { spotPresaleDestingOrder } from '@/services/api/trade'
+import { spotPresaleDestingOrder, spotPresaleDeliveryConfirm, spotPresaleBreachOfContractConfirm } from '@/services/api/trade'
 
 // 采购摘牌
 export function usePurchaseOrderDesting() {
@@ -34,4 +34,58 @@ export function usePurchaseOrderDesting() {
         formData,
         formSubmit,
     }
+}
+
+// 铁合金现货预售交收确认
+export function useSpotPresaleDeliveryConfirm() {
+    const { getUserId } = useLoginStore()
+    const loading = shallowRef(false)
+
+    const confirmSubmit = (id: number) => {
+        loading.value = true
+        return spotPresaleDeliveryConfirm({
+            data: {
+                UserID: getUserId(),
+                Remark: '',
+                ClientType: ClientType.Web, // 终端类型
+                WRTradeDetailID: id,
+                ClientSerialNo: v4() // 客户端流水号
+            },
+            complete: () => {
+                loading.value = false
+            }
+        })
+    }
+
+    return {
+        loading,
+        confirmSubmit,
+    }
+}
+
+// 铁合金现货预售违约确认
+export function useSpotPresaleBreachOfContractConfirm() {
+    const loading = shallowRef(false)
+
+    const breachSubmit = (buyAmount: number, exchangeAmount: number, id: number ) => {
+        loading.value = true
+        return spotPresaleBreachOfContractConfirm({
+            data: {
+                HandleRemark: '',
+                WRTradeDetailID: id,
+                BuyAmount: buyAmount,
+                ExchangeAmount: exchangeAmount,
+                ClientSerialNo: v4(), // 客户端流水号
+                ClientType: ClientType.Web // 终端类型
+            },
+            complete: () => {
+                loading.value = false
+            }
+        })
+    }
+
+    return {
+        loading,
+        breachSubmit,
+    }
 }

+ 14 - 9
src/packages/mobile/router/index.ts

@@ -208,19 +208,24 @@ const routes: Array<RouteRecordRaw> = [
         component: () => import('../views/mine/order/index.vue'),
       },
       {
-        path: 'purchasetradedetail',
-        name: 'purchase-trade-detail',
-        component: () => import('../views/mine/order/components/purchasetradedetail/index.vue'),
+        path: 'purchasetrade',
+        name: 'purchase-trade',
+        component: () => import('../views/mine/order/components/purchasetrade/index.vue'),
+      },
+      {
+        path: 'wrorder',
+        name: 'wr-order',
+        component: () => import('../views/mine/order/components/wrorder/index.vue'),
       },
       {
-        path: 'wrorderdetail',
-        name: 'wr-order-detail',
-        component: () => import('../views/mine/order/components/wrorderdetail/index.vue'),
+        path: 'wrtrade',
+        name: 'wr-trade',
+        component: () => import('../views/mine/order/components/wrtrade/index.vue'),
       },
       {
-        path: 'wrtradedetail',
-        name: 'wr-trade-detail',
-        component: () => import('../views/mine/order/components/wrtradedetail/index.vue'),
+        path: 'purchasetradedetail',
+        name: 'purchase-trade-detail',
+        component: () => import('../views/mine/order/purchasetradedetail/index.vue'),
       }
     ]
   },

+ 4 - 7
src/packages/mobile/views/mine/order/components/purchasetradedetail/index.vue → src/packages/mobile/views/mine/order/components/purchasetrade/index.vue

@@ -25,11 +25,11 @@
                     <li class="list-column">
                         <span>状态</span>
                     </li>
-                    <Button round size="mini" @click="routerTo('')">更多</Button>
+                    <Button round size="mini">更多</Button>
                 </ul>
             </template>
             <template #default="{ item }">
-                <ul class="list list-row">
+                <ul class="list list-row" @click="$router.push({name:'purchase-trade-detail', params: {item: JSON.stringify(item)}})">
                     <li class="list-column"><span>{{ item.wrstandardname }}</span></li>
                     <li class="list-column"><span>{{ item.tradeqty }}</span></li>
                     <li class="list-column"><span>{{ item.tradeprice }}</span></li>
@@ -44,15 +44,12 @@
 </template>
 
 <script lang="ts" setup>
-import { shallowRef } from 'vue'
+
 import { useTHJPurchaseTradeDetail } from '@/business/order'
 import AppPullRefresh from '@mobile/components/base/pull-refresh/index.vue'
-import { useNavigation } from '@/hooks/navigation'
 import { Button } from 'vant'
 
 const { dataList, pageIndex, pageCount, getTHJPurchaseTradeDetail } = useTHJPurchaseTradeDetail()
-const { routerTo } = useNavigation()
-
 const onRefresh = (callback: () => void) => {
     getTHJPurchaseTradeDetail().finally(() => callback())
 }
@@ -73,7 +70,7 @@ const onRefresh = (callback: () => void) => {
             &-row {
                 font-size: .32rem;
                 border-bottom: 1px solid #eee;
-                padding: .12rem .32rem;
+                padding: .20rem .32rem;
             }
 
             &-column {

+ 4 - 8
src/packages/mobile/views/mine/order/components/wrorderdetail/index.vue → src/packages/mobile/views/mine/order/components/wrorder/index.vue

@@ -1,9 +1,9 @@
 <template>
     <app-view class="wrorderdetail">
         <app-pull-refresh class="wrorderdetail__container" v-model:pageIndex="pageIndex" :page-count="pageCount"
-            :updateList="dataList" @refresh="onRefresh" @updated="onRefreshUpdated">
+            :updateList="dataList" @refresh="onRefresh">
             <template #header>
-                <ul class="list list-row" v-if="showHeader">
+                <ul class="list list-row">
                     <li class="list-column">
                         <span>商品</span>
                     </li>
@@ -22,7 +22,7 @@
                     <li class="list-column">
                         <span>状态</span>
                     </li>
-                    <Button round @click="routerTo('')">更多</Button>
+                    <Button round size="mini">更多</Button>
                 </ul>
             </template>
             <template #default="{ item }">
@@ -40,7 +40,7 @@
 </template>
 
 <script lang="ts" setup>
-import { shallowRef } from 'vue'
+
 import { useQueryWrOrderDetail } from '@/business/order'
 import AppPullRefresh from '@mobile/components/base/pull-refresh/index.vue'
 import { useNavigation } from '@/hooks/navigation'
@@ -48,16 +48,12 @@ import { Button } from 'vant'
 import { getTHJOrderStatusName } from "@/constants/order";
 
 const { dataList, pageIndex, pageCount, getWrOrderDetail } = useQueryWrOrderDetail()
-const showHeader = shallowRef(false)
 const { routerTo } = useNavigation()
 
 const onRefresh = (callback: () => void) => {
     getWrOrderDetail(1).finally(() => callback())
 }
 
-const onRefreshUpdated = (data: Model.UserScoreLogRsp[]) => {
-    showHeader.value = data.length > 0
-}
 </script>
 
 <style lang="less">

+ 4 - 8
src/packages/mobile/views/mine/order/components/wrtradedetail/index.vue → src/packages/mobile/views/mine/order/components/wrtrade/index.vue

@@ -1,9 +1,9 @@
 <template>
     <app-view class="wrtradedetail">
         <app-pull-refresh class="wrtradedetail__container" v-model:pageIndex="pageIndex" :page-count="pageCount"
-            :updateList="dataList" @refresh="onRefresh" @updated="onRefreshUpdated">
+            :updateList="dataList" @refresh="onRefresh">
             <template #header>
-                <ul class="list list-row" v-if="showHeader">
+                <ul class="list list-row">
                     <li class="list-column">
                         <span>商品</span>
                     </li>
@@ -22,7 +22,7 @@
                     <li class="list-column">
                         <span>成交时间</span>
                     </li>
-                    <Button round @click="routerTo('bank-hisstatement')">更多</Button>
+                    <Button round size="mini" @click="routerTo('bank-hisstatement')">更多</Button>
                 </ul>
             </template>
             <template #default="{ item }">
@@ -42,7 +42,7 @@
 </template>
 
 <script lang="ts" setup>
-import { shallowRef } from 'vue'
+
 import { useQueryWrTradeDetail } from '@/business/order'
 import AppPullRefresh from '@mobile/components/base/pull-refresh/index.vue'
 import { useNavigation } from '@/hooks/navigation'
@@ -50,16 +50,12 @@ import { Button } from 'vant'
 import { formatDate } from '@/filters'
 
 const { dataList, pageIndex, pageCount, getWrTradeDetail } = useQueryWrTradeDetail()
-const showHeader = shallowRef(false)
 const { routerTo } = useNavigation()
 
 const onRefresh = (callback: () => void) => {
     getWrTradeDetail(1).finally(() => callback())
 }
 
-const onRefreshUpdated = (data: Model.UserScoreLogRsp[]) => {
-    showHeader.value = data.length > 0
-}
 </script>
 
 <style lang="less">

+ 6 - 6
src/packages/mobile/views/mine/order/index.vue

@@ -5,13 +5,13 @@
         </template>
         <Tabs>
             <Tab title="采购订单">
-                <purchase-trade-detail />
+                <purchase-trade />
             </Tab>
             <Tab title="供求委托">
-                <wr-order-detail />
+                <wr-order />
             </Tab>
             <Tab title="供求成交">
-                <wr-trade-detail />
+                <wr-trade />
             </Tab>
         </Tabs>
     </app-view>
@@ -21,9 +21,9 @@
 
 import { Tab, Tabs } from 'vant'
 
-import PurchaseTradeDetail from './components/purchasetradedetail/index.vue'
-import WrOrderDetail from './components/wrorderdetail/index.vue'
-import WrTradeDetail from './components/wrtradedetail/index.vue'
+import PurchaseTrade from './components/purchasetrade/index.vue'
+import WrOrder from './components/wrorder/index.vue'
+import WrTrade from './components/wrtrade/index.vue'
 
 </script>
 

+ 165 - 0
src/packages/mobile/views/mine/order/purchasetradedetail/index.vue

@@ -0,0 +1,165 @@
+<template>
+    <app-view class="purchasetradedetail">
+        <template #header>
+            <app-navbar title="采购详情" />
+        </template>
+        <div v-if="detail" class="purchasetradedetail__container">
+            <table class="purchasetradedetail__container__table" cellspacing="0" cellpadding="0">
+                <tbody>
+                    <tr class="row">
+                        <td>商品:</td>
+                        <td>{{ handleNoneValue(detail.wrstandardname) }}</td>
+                        <td>仓库:</td>
+                        <td>{{ handleNoneValue(detail.warehousename) }}</td>
+                    </tr>
+                    <tr class="row">
+                        <td>预售价:</td>
+                        <td>{{ handleNoneValue(detail.tradeprice) }}</td>
+                        <td>数量:</td>
+                        <td>{{ handleNoneValue(detail.tradeqty) }}</td>
+                    </tr>
+                    <tr class="row">
+                        <td>定金:</td>
+                        <td>{{ handleNoneValue(detail.payeddeposit) }}</td>
+                        <td>实际价:</td>
+                        <td>{{ handleNoneValue(detail.lastprice) }}</td>
+                    </tr>
+                    <tr class="row">
+                        <td>尾款:</td>
+                        <td>{{ handleNoneValue(detail.remainamount) }}</td>
+                        <td>优惠:</td>
+                        <td>{{ handleNoneValue(detail.discountamount) }}</td>
+                    </tr>
+                    <tr class="row">
+                        <td>状态:</td>
+                        <td>{{ handleNoneValue(detail.orderstatus) }}</td>
+                        <td>总货款:</td>
+                        <td>{{ handleNoneValue(detail.tradeamount) }}</td>
+                    </tr>
+                    <tr class="row">
+                        <td>提货方式:</td>
+                        <td>{{ handleNoneValue(detail.thjdeliverymodedisplay) }}</td>
+                        <td>摘牌时间:</td>
+                        <td>{{ formatDate(detail.tradetime, 'YYYY/MM/DD HH:mm:ss') }}</td>
+                    </tr>
+                    <tr class="row">
+                        <td>联系人:</td>
+                        <td>{{ handleNoneValue(detail.contactname) }}</td>
+                        <td>联系方式:</td>
+                        <td>{{ handleNoneValue(detail.contactinfo) }}</td>
+                    </tr>
+                    <tr class="row">
+                        <td>目的地地址:</td>
+                        <td colspan="3">{{ handleNoneValue(detail.desaddress) }}</td>
+                    </tr>
+                    <tr class="row">
+                        <td>发票信息:</td>
+                        <td colspan="3">{{ handleNoneValue(detail.receiptinfo )}}</td>
+                    </tr>
+                    <tr class="row">
+                        <td>合同单号:</td>
+                        <td colspan="2">{{ handleNoneValue(detail.wrtradedetailid) }}</td>
+                        <Button size="mini">查看合同</Button>
+                    </tr>
+                </tbody>
+            </table>            
+        </div>
+        <div v-else>
+            <Empty />
+        </div>
+        <template #footer>
+            <div class="purchasetradedetail_buttonview">
+                <Button block round type="primary" v-if="detail?.orderstatus === 1">合同转让</Button>
+                <Button block round type="primary" v-if="detail?.orderstatus === 8">转让撤销</Button>
+                <Button block round type="primary" v-if="detail?.orderstatus === 5" @click="spotConfirmSubmit">确认交收</Button>
+                <div class="pay__buttonview">
+                    <Button block round type="primary" v-if="detail?.orderstatus === 3" @click="spotBreachSubmit">违约</Button>
+                    <Button block round type="primary" v-if="detail?.orderstatus === 3">支付</Button>
+                </div>
+            </div>
+        </template>
+    </app-view>
+</template>
+
+<script lang="ts" setup>
+
+import { shallowRef, computed, ref } from 'vue'
+import { useNavigation } from '@/hooks/navigation'
+import { fullloading, dialog } from '@/utils/vant'
+import { Empty, Button, Toast } from 'vant'
+import { handleNoneValue, formatDate } from "@/filters";
+import { useSpotPresaleBreachOfContractConfirm, useSpotPresaleDeliveryConfirm } from "@/business/trade";
+
+const { route } = useNavigation()
+const item = route.params.item
+const detail = shallowRef<Model.THJPurchaseTradeDetailRsp>()
+const { breachSubmit } = useSpotPresaleBreachOfContractConfirm()
+const { confirmSubmit} = useSpotPresaleDeliveryConfirm()
+const { router } = useNavigation()
+
+if (item) {
+    detail.value = JSON.parse(item.toString())
+} 
+
+/// 确认交收
+const spotConfirmSubmit = () => {
+    dialog('确认要交收吗?', {
+        showCancelButton: true
+    }).then(() => {
+        fullloading((hideLoading) => {
+            confirmSubmit(detail.value?.wrtradedetailid ?? 0).then(() => {
+                hideLoading()
+                dialog('确认交收提交成功,请耐心等待审核。').then(() => {
+                    router.back()
+                })
+            }).catch((err) => {
+                Toast.fail(err)
+            })
+        })
+    })
+}
+
+const spotBreachSubmit = () => {
+    dialog('确认要违约吗?', {
+        showCancelButton: true
+    }).then(() => {
+        fullloading((hideLoading) => {
+            const {wrtradedetailid, lastamount, discountamount} = detail.value ?? {}
+            breachSubmit(lastamount, discountamount, wrtradedetailid).then(() => {
+                hideLoading()
+                dialog('违约提交成功,请耐心等待审核。').then(() => {
+                    router.back()
+                })
+            }).catch((err) => {
+                Toast.fail(err)
+            })
+        })
+    })
+}
+    
+</script>
+
+<style lang="less">
+
+.purchasetradedetail {
+    &__container {
+        height: 100%;
+        overflow-y: auto;
+        padding: .10rem .20rem;
+    }
+
+    &_buttonview {
+        .pay__buttonview {
+            display: flex;
+            flex-direction: row;
+            justify-content: space-between;
+            padding: .1rem;
+
+            .van-button {
+                width: 45%;
+            }
+        }
+    }
+}
+
+</style>

+ 22 - 0
src/types/proto/trade.d.ts

@@ -70,5 +70,27 @@ declare global {
             WRTradeDetailID: number; // 采购成交单ID
             ClientSerialNo: string; // 客户端流水号
         }
+
+        // 铁合金现货预售违约申请接口请求
+        interface SpotPresaleBreachOfContractApplyReq {
+            Header?: IMessageHead;
+            UserID: number; // 用户ID,必填
+            WRTradeDetailID: number; // 采购成交单ID,必填
+            BuyAmount: number; // 买方应退费用,必填
+            ExchangeAmount: number; // 平台应收,必填
+            ApplyRemark?: string; // 申请备注
+            ClientType: number; // 终端类型
+            ClientSerialNo: string; // 客户端流水号
+        }
+        
+        // 铁合金现货预售违约申请接口应答
+        interface SpotPresaleBreachOfContractApplyRsp {
+            Header?: IMessageHead;
+            RetCode: number; // 返回码
+            RetDesc: string; // 描述信息
+            UserID: number; // 用户ID,必填
+            WRTradeDetailID: number; // 采购成交单ID
+            ClientSerialNo: string; // 客户端流水号
+        }
     }
 }