Handy_Cao hai 1 ano
pai
achega
20f1b7f4a3

+ 156 - 0
src/packages/pc/views/footer/pricing/detail2/components/delivery/index.vue

@@ -0,0 +1,156 @@
+<!-- 挂牌点价-订单明细-交收 -->
+<template>
+    <app-drawer :title="t('operation.delivery')" :width="840" v-model:show="show" :loading="loading" :refresh="refresh">
+        <el-form ref="formRef" class="el-form--horizontal" label-width="140px" :model="formData" :rules="formRules">
+            <el-form-item :label="t('position.goods.goodsname')">
+                <span>{{ selectedRow.goodsCode }}</span>
+            </el-form-item>
+            <el-form-item :label="t('position.goods.buyorsell')">
+                <span>{{ getBuyOrSellName(selectedRow.tHDetailEx.buyOrSell) }}</span>
+            </el-form-item>
+            <el-form-item :label="t('position.goods.curholderamount')">
+                <span>{{ formatDecimal(selectedRow.tHDetailEx.holderAmount, selectedRow.decimalPlace) }}</span>
+            </el-form-item>
+            <el-form-item :label="t('position.goods.curpositionqty')">
+                <span>{{ selectedRow.tHDetailEx.holderQty*selectedRow.agreeUnit + getGoodsUnitName(selectedRow.goodsUnitID) }}</span>
+            </el-form-item>
+            <el-form-item :label="t('position.goods.frozenqty')">
+                <span>{{ selectedRow.tHDetailEx.freezeQty*selectedRow.agreeUnit + getGoodsUnitName(selectedRow.goodsUnitID) }}</span>
+            </el-form-item>
+            <el-form-item :label="t('position.goods.enableqty')">
+                <span>{{ enableqty }}</span>
+            </el-form-item>
+            <el-form-item :label="t('position.goods.mindeliverylot')">
+                <span>{{ mindeliverylot }}</span>
+            </el-form-item>
+            <el-form-item :label="t('position.goods.holddetail.holderprice')">
+                <span>{{ formatDecimal(selectedRow.tHDetailEx.holderPrice, selectedRow.decimalPlace) }}</span>
+            </el-form-item>
+            <el-form-item :label="t('position.goods.closepl')">
+                <span :class="handlePriceColor(selectedRow.tHDetailEx.floatPL)">
+                    {{ formatDecimal(selectedRow.tHDetailEx.floatPL) }}
+                </span>
+            </el-form-item>
+            <el-form-item prop="DeliveryLot" :label="t('position.goods.deliverylot')">
+                <el-input-number :placeholder="t('common.pleaseenter')" v-model="formData.DeliveryLot" :precision="0"
+                    :max="enableqty" :min="0" />
+            </el-form-item>
+            <el-form-item :label="t('position.goods.deliveryqty')">
+                <span>{{ (formData.DeliveryLot ?? 0) * selectedRow.agreeUnit }}{{ selectedRow.goodsUnit }}</span>
+            </el-form-item>
+            <el-form-item class="el-form-item--row" prop="DeliveryInfo"
+                :label="selectedRow.tHDetailEx.buyOrSell === BuyOrSell.Buy ? t('position.goods.address') : t('position.goods.deliveryinfo')">
+                <div class="el-form-item--col">
+                    <el-input type="textarea" :placeholder="selectedRow.tHDetailEx.buyOrSell === BuyOrSell.Buy ? t('position.goods.tips9') : t('position.goods.tips10')"
+                        :rows="3" v-model="formData.DeliveryInfo" />
+                    <el-icon :size="20" style="cursor: pointer;" @click="showAddress = true"
+                        v-if="selectedRow.tHDetailEx.buyOrSell === BuyOrSell.Buy">
+                        <CirclePlusFilled />
+                    </el-icon>
+                </div>
+            </el-form-item>
+        </el-form> 
+        <app-address v-model:show="showAddress" @change="onAddressChange" />
+        <template #footer>
+            <el-button type="info" @click="onCancel(false)">{{ t('operation.cancel') }}</el-button>
+            <el-button type="primary" @click="onSubmit">{{ t('operation.delivery') }}</el-button>
+        </template> 
+    </app-drawer>
+</template>
+
+<script lang="ts" setup>
+import { ref, PropType, computed } from 'vue'
+import { ElMessage, FormInstance, FormRules } from 'element-plus'
+import { useOfflineDelivery } from '@/business/trade'
+import { getBuyOrSellName, BuyOrSell } from '@/constants/order'
+import { formatDecimal, handlePriceColor, handleRequestBigNumber } from '@/filters'
+import { getGoodsUnitName } from '@/constants/unit'
+import { i18n, useFuturesStore } from '@/stores'
+import AppDrawer from '@pc/components/base/drawer/index.vue'
+import AppAddress from '@pc/components/modules/address/index.vue'
+
+const { t } = i18n.global
+
+const props = defineProps({
+    selectedRow: {
+        type: Object as PropType<Model.SBYJMyOrderRsp & {
+            closepl: number; // 浮动盈亏
+            closeplColor: string; // 浮动盈亏颜色
+        }>,
+        required: true,
+    }
+})
+
+const { formSubmit, formData, loading } = useOfflineDelivery()
+const show = ref(true)
+const refresh = ref(false)
+const showAddress = ref(false)
+const formRef = ref<FormInstance>()
+const futuresStore = useFuturesStore()
+const goods = futuresStore.getGoods(props.selectedRow.goodsCode)
+
+const { mindeliverylot = 0 } = goods ?? {}
+
+// 表单验证规则
+const formRules: FormRules = {
+    DeliveryLot: [{
+        required: true,
+        message: t('position.goods.tips7'),
+        validator: (rule, value, callback) => {
+            if (value >= mindeliverylot) {
+                callback()
+            } else {
+                callback(new Error(t('position.goods.tips8') + `${mindeliverylot}`))
+            }
+        }
+    }],
+    DeliveryInfo: [{
+        required: true,
+        message: props.selectedRow.tHDetailEx.buyOrSell === BuyOrSell.Buy ? t('position.goods.tips9') : t('position.goods.tips10'),
+        validator: () => {
+            return !!formData.DeliveryInfo
+        }
+    }],
+}
+
+// 可用重量
+const enableqty = computed(() => {
+    const { tHDetailEx, agreeUnit } = props.selectedRow
+    return (tHDetailEx.holderQty - tHDetailEx.freezeQty) * agreeUnit
+}) 
+
+// 选择地址
+const onAddressChange = (item: Model.UserReceiveInfoRsp) => {
+    const contact = `${item.receivername} ${item.phonenum}`
+    const address = `${item.provincename} ${item.cityname} ${item.districtname} ${item.address}`
+    formData.DeliveryInfo = [contact, address].join('\n')
+}
+
+const onCancel = (isRefresh = false) => {
+    show.value = false
+    refresh.value = isRefresh
+}
+
+const onSubmit = () => {
+    formRef.value?.validate((valid) => {
+        if (valid) {
+            const { buyOrSell, tradeID } = props.selectedRow.tHDetailEx
+            const { goodsCode } = props.selectedRow
+            const { marketid, goodsid } = goods ?? {}
+            /// 市场ID
+            formData.Header = { MarketID: marketid, GoodsID: goodsid }
+            formData.GoodsCode = goodsCode
+            formData.GoodsID = goodsid
+            formData.BuyOrSell = buyOrSell
+            formData.TradeID = handleRequestBigNumber(tradeID)
+
+            formSubmit().then(() => {
+                ElMessage.success(t('common.submitsuccess'))
+                onCancel(true)
+            }).catch((err) => {
+                ElMessage.error(t('common.submitfailure') + err)
+            })
+        }
+    })
+}
+</script>

+ 18 - 7
src/packages/pc/views/footer/pricing/detail2/index.vue

@@ -54,6 +54,7 @@
         <!-- 操作 -->
         <template #operate="{ row }">
             <el-button type="danger" size="small" @click="showComponent('transfer', row)">{{ t('operation.close') }}</el-button>
+            <el-button type="primary" size="small" @click="showComponent('delivery', row)">{{ t('operation.delivery') }}</el-button>
         </template>
         <template #append v-if="showLoadMore">
             <el-button size="small" plain @click="loadMore">{{ t('common.loadMore' )}}</el-button>
@@ -68,23 +69,22 @@
 <script lang="ts" setup> 
 import { shallowRef, defineAsyncComponent, onUnmounted } from 'vue'
 import { getBuyOrSellName } from '@/constants/order'
-import { formatDecimal, formatDate, parsePercent, handlePriceColor } from '@/filters'
+import { formatDecimal, formatDate, handlePriceColor } from '@/filters'
 import { getGoodsUnitName } from '@/constants/unit'
 import { useComponent } from '@/hooks/component'
 import { useLocalPagination } from '@/hooks/pagination'
-import { useTableColumnsStore, i18n } from '@/stores'
+import { i18n } from '@/stores'
 import { useSBYJOrderStore } from '@/stores'
 import AppTable from '@pc/components/base/table/index.vue'
 import eventBus from '@/services/bus'
 
 const componentMap = new Map<string, unknown>([
     ['transfer', defineAsyncComponent(() => import('./components/transfer/index.vue'))],
+    ['delivery', defineAsyncComponent(() => import('./components/delivery/index.vue'))],
 ])
 
-const { getTableColumns } = useTableColumnsStore()
 const { showLoadMore, loadMore } = useLocalPagination<Model.SBYJMyOrderRsp>()
 const selectedRow = shallowRef<Model.SBYJMyOrderRsp>()
-const tableColumns = shallowRef<Model.TableColumn[]>([])
 const { t } = i18n.global
 
 const { getSBYJMyOrders, $toRefs } = useSBYJOrderStore()
@@ -106,9 +106,20 @@ const showComponent = (componentName: string, row: Model.SBYJMyOrderRsp) => {
     openComponent(componentName)
 }
 
-getTableColumns('order-detail2', true).then((res) => {
-    tableColumns.value = res
-})
+const tableColumns = shallowRef<Model.TableColumn[]>([
+    { field: 'goodsname', label: 'position.goods.goodsname' },
+    { field: 'buyorsell', label: 'position.goods.buyorsell' },
+    { field: 'holderqty', label: 'position.goods.holddetail.holderqty' },
+    { field: 'freezeqty', label: 'position.goods.holddetail.freezeqty' },
+    { field: 'enableqty', label: 'position.goods.holddetail.enableqty' },
+    { field: 'holderprice', label: 'position.goods.holddetail.holderprice' },
+    { field: 'holderamount', label: 'position.goods.holddetail.holderamount' },
+    { field: 'usedMargin', label: 'position.goods.holddetail.usedMargin' },
+    { field: 'profitLoss', label: 'position.goods.holddetail.profitLoss' },
+    { field: 'tradetime', label: 'position.goods.holddetail.tradetime' },
+    { field: 'tradeid', label: 'position.goods.holddetail.tradeid' },
+    { field: 'operate', label: 'common.operate', fixed: 'right', width: 140 },
+])
 
 onUnmounted(() => posChangedNtf.cancel())
 </script>

+ 1 - 2
src/packages/thj/views/home/main/Index.vue

@@ -52,14 +52,13 @@ import { parsePercent, handleNumberValue, formatDecimal, formatDate } from '@/fi
 import { queryQuoteGoodsList } from '@/services/api/swap'
 import { queryImageConfigs } from '@/services/api/common'
 import { queryNewTitles } from '@/services/api/news'
-import { useGlobalStore, useUserStore, useFuturesStore } from '@/stores'
+import { useUserStore, useFuturesStore } from '@/stores'
 import quoteSocket from '@/services/websocket/quote'
 import Banner from '@mobile/components/base/banner/index.vue'
 
 const LineChart = defineAsyncComponent(() => import('@mobile/components/modules/echarts/line/index.vue'))
 
 const subscribe = quoteSocket.createSubscribe()
-const globalStore = useGlobalStore()
 const userStore = useUserStore()
 const futuresStore = useFuturesStore()
 const refreshing = shallowRef(false) // 是否处于加载中状态

+ 1 - 1
src/packages/tss/views/mine/Index.vue

@@ -23,7 +23,7 @@
                     <div class="profile-account">
                         <div class="profile-account-first">
                             <span>{{ $t('account.account') }}</span>
-                            <Icon name="checked" size="14" color="#CC0000" ></Icon>
+                            <Icon name="checked" size="14" color="#46D63C" ></Icon>
                         </div>
                         <span>{{ currentAccount.accountid ?? 0 }}</span>
                     </div>