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