li.shaoyi 2 лет назад
Родитель
Сommit
77fd24da5a

+ 55 - 0
src/packages/pc/components/layouts/header/components/setting/index.vue

@@ -0,0 +1,55 @@
+<!-- 系统设置 -->
+<template>
+    <app-drawer title="设置" width="400" v-model:show="show">
+        <el-form ref="formRef" class="el-form--vertical" label-width="80px" :model="formData">
+            <el-form-item prop="orderFocusType" label="订单焦点">
+                <el-select placeholder="请选择" v-model="formData.orderFocusType">
+                    <el-option label="价格" :value="1" />
+                    <el-option label="数量" :value="2" />
+                </el-select>
+            </el-form-item>
+            <el-form-item prop="orderFocusType" label="价格类型">
+                <el-select placeholder="请选择" v-model="formData.orderPriceType">
+                    <el-option label="现价" :value="1" />
+                    <el-option label="对手价" :value="2" />
+                    <el-option label="实时价" :value="3" />
+                </el-select>
+            </el-form-item>
+        </el-form>
+        <template #footer>
+            <el-button type="info" @click="resetSettings">恢复默认</el-button>
+            <el-button type="primary" @click="updateSettings">保存设置</el-button>
+        </template>
+    </app-drawer>
+</template>
+
+<script lang="ts" setup>
+import { ref } from 'vue'
+import { ElMessageBox, FormInstance } from 'element-plus'
+import { useSettingStore } from '@/stores'
+import AppDrawer from '@pc/components/base/drawer/index.vue'
+
+const settingStore = useSettingStore()
+const formRef = ref<FormInstance>()
+const show = ref(true)
+const formData = ref({ ...settingStore.userSetting })
+
+const onCancel = () => {
+    show.value = false
+}
+
+const updateSettings = () => {
+    settingStore.updateSettings(formData.value)
+    onCancel()
+}
+
+const resetSettings = () => {
+    ElMessageBox.confirm(
+        '是否恢复到默认设置?',
+        '提示'
+    ).then(() => {
+        settingStore.resetSettings()
+        onCancel()
+    })
+}
+</script>

+ 5 - 0
src/packages/pc/components/layouts/header/index.less

@@ -46,6 +46,11 @@
                     content: var(--icon-maximize);
                 }
             }
+
+            .el-icon {
+                font-size: 22px;
+                cursor: pointer;
+            }
         }
 
         .user-dropdown {

+ 3 - 1
src/packages/pc/components/layouts/header/index.vue

@@ -10,7 +10,8 @@
                 <el-badge type="danger" :is-dot="noticeStore.unreadList.length > 0">
                     <app-icon icon="g-icon--notice" @click="openComponent('notice')" />
                 </el-badge>
-                <app-icon icon="Tickets" size="20" @click="openComponent('report')" />
+                <app-icon icon="Tickets" @click="openComponent('report')" />
+                <app-icon icon="Setting" @click="openComponent('setting')" />
                 <span class="g-icon--minimize" @click="exitFullSreen" v-if="fullScreen"></span>
                 <span class="g-icon--maximize" @click="setFullSreen" v-else></span>
             </div>
@@ -50,6 +51,7 @@ const componentMap = new Map<string, unknown>([
     ['cancel', defineAsyncComponent(() => import('./components/cancel/index.vue'))],
     ['avater', defineAsyncComponent(() => import('./components/avater/index.vue'))],
     ['report', defineAsyncComponent(() => import('./components/report/index.vue'))],
+    ['setting', defineAsyncComponent(() => import('./components/setting/index.vue'))],
 ])
 
 const { componentId, openComponent, closeComponent } = useComponent()

+ 4 - 6
src/packages/pc/views/footer/goods/order/cancel/index.vue

@@ -31,7 +31,7 @@ const onCancel = (isRefresh = false) => {
     refresh.value = isRefresh
 }
 
-const onCancelSumit = () => {
+const onCancelSumit = async () => {
     loading.value = true
     for (let i = 0; i < props.selectedRows.length; i++) {
         const { orderid, marketid, goodsid } = props.selectedRows[i]
@@ -39,11 +39,9 @@ const onCancelSumit = () => {
         formData.Header = { MarketID: marketid, GoodsID: goodsid }
         formData.OldOrderId = orderid
         /// 提交
-        cancelSubmit()
+        await cancelSubmit()
     }
-    setTimeout(() => {
-        loading.value = false
-        onCancel(true)
-    }, 1000)
+    loading.value = false
+    onCancel(true)
 }
 </script>

+ 4 - 6
src/packages/pc/views/footer/goods/order/clear/index.vue

@@ -33,19 +33,17 @@ const onCancelSumit = () => {
             tradeMode: '50',
             orderStatus: '3,7,12'
         }
-    }).then((res) => {
+    }).then(async (res) => {
         for (let i = 0; i < res.data.length; i++) {
             const { orderid, marketid, goodsid } = res.data[i]
             ///  参数信息
             formData.Header = { MarketID: marketid, GoodsID: goodsid }
             formData.OldOrderId = orderid
             /// 提交
-            cancelSubmit()
+            await cancelSubmit()
         }
-        setTimeout(() => {
-            loading.value = false
-            onCancel(true)
-        }, 2000)
+        loading.value = false
+        onCancel(true)
     }).catch((err) => {
         loading.value = false
         ElMessage.error('提交失败:' + err)

+ 6 - 2
src/packages/pc/views/market/trade/goods/list/listing/index.vue

@@ -185,8 +185,12 @@ const onRadioChange = (value: number) => {
 
 const onPriceClick = (buyorsell: BuyOrSell, value: number) => {
     formData.BuyOrSell = buyorsell === BuyOrSell.Sell ? BuyOrSell.Buy : BuyOrSell.Sell
-    formData.OrderPrice = value
-    priceInputFocus()
+    if (orderPriceType.value === 3) {
+        qtyInputFocus()
+    } else {
+        formData.OrderPrice = value
+        priceInputFocus()
+    }
 }
 
 // 提交挂牌

+ 6 - 6
src/stores/modules/setting.ts

@@ -27,10 +27,10 @@ export const useSettingStore = defineStore(() => {
     }
 
     // 保存设置
-    const saveSettings = (value: Omit<Model.LocalSetting, 'loginId'>) => {
+    const updateSettings = (value: Omit<Model.LocalSetting, 'loginId'>) => {
         const item = {
-            loginId: loginStore.userId,
-            ...value
+            ...value,
+            loginId: loginStore.userId
         }
         if (settingIndex.value > -1) {
             settings[settingIndex.value] = item
@@ -41,7 +41,7 @@ export const useSettingStore = defineStore(() => {
     }
 
     // 恢复默认设置
-    const restoreDefaultSettings = () => {
+    const resetSettings = () => {
         if (settingIndex.value > -1) {
             settings.splice(settingIndex.value, 1)
             localData.setValue('settings', settings)
@@ -51,7 +51,7 @@ export const useSettingStore = defineStore(() => {
     return {
         userSetting,
         getSettingValue,
-        saveSettings,
-        restoreDefaultSettings
+        updateSettings,
+        resetSettings
     }
 })