瀏覽代碼

feat:数据刷新

ljc 1 月之前
父節點
當前提交
bef252b4ef

+ 2 - 0
components/cwg-payment.vue

@@ -32,6 +32,7 @@
 <script setup lang="ts">
   import { computed, ref, onMounted } from 'vue'
   import { newsApi } from '@/service/news'
+  import { storeToRefs } from 'pinia'
   import useRouter from '@/hooks/useRouter'
   import { drawApi } from '@/service/draw'
   import { useI18n } from 'vue-i18n'
@@ -40,6 +41,7 @@
   const { t, locale } = useI18n()
   const userStore = useUserStore()
   import { userToken } from '@/composables/config'
+  import { onLoad } from '@dcloudio/uni-app'
 
   const isRed = ref(false)
   const dropdownRef = ref(null)

+ 8 - 7
components/cwg-sidebar.vue

@@ -34,17 +34,18 @@
 </template>
 
 <script lang="ts" setup>
-  import useUserStore from '@/stores/use-user-store'
+import useUserStore from '@/stores/use-user-store'
 import { useMenuSplit } from '@/composables/useMenuSplit'
 import { computed } from 'vue'
+import { storeToRefs } from 'pinia'
 
 const { menus, setSubmenuRef, setMode, handleClick, handleSubmenuClick, mode } = useMenuSplit()
-  const { userInfo } = useUserStore()
-  // ib按钮展示
-  const ibStatus = computed(() => {
-    console.log(userInfo)
-    return userInfo.customInfo.ibInvalid == 0 && !!userInfo.ibInfo
-  })
+const userStore = useUserStore()
+const { userInfo } = storeToRefs(userStore)
+// ib按钮展示
+const ibStatus = computed(() => {
+  return userInfo.value?.customInfo?.ibInvalid == 0 && !!userInfo.value?.ibInfo
+})
 </script>
 
 <style scoped lang="scss">

+ 2 - 5
pages/ib/accountList.vue

@@ -70,13 +70,10 @@
     })
   }
 
-  const handleReset = () => {
+  const handleReset = (params: any) => {
     search.value = {
-      cId: '',
-      login: '',
+      ...params,
       platform: 'MT4',
-      startDate: '',
-      endDate: '',
     }
     nextTick(() => {
       tableRef.value?.refreshTable?.()

+ 2 - 2
pages/ib/agentList.vue

@@ -81,9 +81,9 @@
     })
   }
 
-  const handleReset = () => {
+  const handleReset = (params: any) => {
     search.value = {
-      name: '',
+      ...params,
     }
     nextTick(() => {
       tableRef.value?.refreshTable?.()

+ 6 - 3
pages/ib/components/applyIbDialog.vue

@@ -145,9 +145,11 @@
     // initCommissionTemplateData(29634)
   })
 
-  watch(() => props.visible, (val) => {
+  watch(() => props.visible, async (val) => {
     if (val) {
-      loadCustomerList()
+      laoding.value = true
+      await loadCustomerList()
+
       if (props.detail.id) {
         let params = {
           customId: props.detail.id,
@@ -157,8 +159,9 @@
             agentId: props.detail.id,
           }
         }
-        initCommissionTemplateData(params)
+        await initCommissionTemplateData(params)
       }
+      laoding.value = false
     }
   })
 

+ 8 - 10
pages/ib/customer.vue

@@ -198,22 +198,22 @@
         {
           label: t('Documentary.AgentBackground.item1'),
           type: 'documentary',
-          btnClick:(row)=>handleMenuClick({type: 'documentary', row}),
+          btnClick: (row) => handleMenuClick({ type: 'documentary', row }),
           show: true,
         },
         {
           label: t('Home.msg.ibTitle'),
           type: 'applyIb',
-          btnClick:(row)=>handleMenuClick({type: 'applyIb', row}),
-          show: (row)=>row.ibStatus == 1 && row.belongsType != 1,
+          btnClick: (row) => handleMenuClick({ type: 'applyIb', row }),
+          show: (row) => row.ibStatus == 1 && row.belongsType != 1,
         },
         {
           label: t('Ib.Custom.AccountAdjust'),
           type: 'Point',
-          btnClick:(row)=>handleMenuClick({type: 'Point', row}),
-          show: (row)=>row.belongsType != 1,
+          btnClick: (row) => handleMenuClick({ type: 'Point', row }),
+          show: (row) => row.belongsType != 1,
         },
-      ]
+      ],
     },
   ])
 
@@ -257,11 +257,9 @@
     })
   }
 
-  const handleReset = () => {
+  const handleReset = (params: any) => {
     search.value = {
-      name: '',
-      email: '',
-      cId: '',
+      ...params,
       belongsType: search.value.belongsType, // 保持当前的分类标签选中
     }
     nextTick(() => {

+ 3 - 4
pages/ib/recording.vue

@@ -148,15 +148,14 @@
     })
   }
 
-  const handleReset = () => {
+  const handleReset = (params) => {
     searchParams.value = {
+      ...params,
       types: 1,
-      date: defaultDateRange,
     }
     search.value = {
+      ...params,
       types: 1,
-      startDate: defaultDateRange[0],
-      endDate: defaultDateRange[1],
     }
     nextTick(() => {
       tableRef.value?.refreshTable?.()

+ 4 - 8
pages/ib/subsList.vue

@@ -88,7 +88,7 @@
   const { numberFormat, numberDecimal } = useFilters()
   const { t, locale } = useI18n()
   const { Code } = Config
-
+  const searchParams = ref({})
   const search = ref({
     ibNo: '',
     name: '',
@@ -179,7 +179,7 @@
           btnClick: (row) => handleMenuClick({ type: 'exclusiveCommission', row }),
           show: (row) => row.exclusiveCommissionOptions?.length > 0,
         },
-      ]
+      ],
     },
   ])
 
@@ -221,13 +221,9 @@
     })
   }
 
-  const handleReset = () => {
+  const handleReset = (params: any) => {
     search.value = {
-      ibNo: '',
-      name: '',
-      cId: '',
-      startDate: '',
-      endDate: '',
+      ...params,
     }
     nextTick(() => {
       tableRef.value.refreshTable()

+ 4 - 5
stores/use-user-store.ts

@@ -3,6 +3,7 @@ import ls from "@/utils/store2";
 import { ref } from "vue";
 import { userToken } from "../composables/config";
 import crypt from "../composables/crypt";
+import useGlobalStore from "./use-global-store";
 
 export interface UserInfo {
   id?: string;
@@ -67,8 +68,7 @@ const useUserStore = defineStore("userStore", () => {
     if (encryptedInfo) {
       const decryptedInfo = crypt.decrypt(encryptedInfo);
       if (decryptedInfo) {
-        userInfo.value = JSON.parse(decryptedInfo);
-        isLoggedIn.value = true;
+        appVersion.value = JSON.parse(decryptedInfo);
       }
     }
   };
@@ -78,7 +78,6 @@ const useUserStore = defineStore("userStore", () => {
       const decryptedInfo = crypt.decrypt(encryptedInfo);
       if (decryptedInfo) {
         loginOptions.value = JSON.parse(decryptedInfo);
-        isLoggedIn.value = true;
       }
     }
   }
@@ -88,7 +87,6 @@ const useUserStore = defineStore("userStore", () => {
       const decryptedInfo = crypt.decrypt(encryptedInfo);
       if (decryptedInfo) {
         problemDetails.value = JSON.parse(decryptedInfo);
-        isLoggedIn.value = true;
       }
     }
   };
@@ -98,7 +96,6 @@ const useUserStore = defineStore("userStore", () => {
       const decryptedInfo = crypt.decrypt(encryptedInfo);
       if (decryptedInfo) {
         reasonsOptions.value = JSON.parse(decryptedInfo);
-        isLoggedIn.value = true;
       }
     }
   };
@@ -170,6 +167,8 @@ const useUserStore = defineStore("userStore", () => {
     ls.remove(ID_TYPE_OPTIONS_KEY);
     ls.remove(ACCOUNT_INFO_KEY);
 
+    const globalStore = useGlobalStore();
+    globalStore.setMode('customer');
   };
 
   initReasonsOptions();

+ 4 - 3
windows/left-window.vue

@@ -37,18 +37,19 @@
 
 <script lang="ts" setup>
 import { ref, computed } from 'vue'
+import { storeToRefs } from 'pinia'
 import useUserStore from '@/stores/use-user-store'
 import { useMenuSplit } from '@/composables/useMenuSplit'
 const { menus, setSubmenuRef, setMode, handleClick, handleSubmenuClick, mode } = useMenuSplit()
-const { userInfo } = useUserStore()
+const userStore = useUserStore()
+const { userInfo } = storeToRefs(userStore)
 
 // 控制侧边栏折叠状态
 const isCollapsed = ref(false)
 
 // ib按钮展示
 const ibStatus = computed(() => {
-  console.log(userInfo)
-  return userInfo.customInfo.ibInvalid == 0 && !!userInfo.ibInfo
+  return userInfo.value?.customInfo?.ibInvalid == 0 && !!userInfo.value?.ibInfo
 })
 
 // 固定菜单项点击事件

+ 78 - 66
windows/top-window.vue

@@ -1,83 +1,95 @@
 <template>
-	<header class="cwg-pc-header">
-		<div class="left">
-			<image class="left-img" src="/static/images/logo.png" mode="widthFix" alt="logo" @click="openLeftDrawer" />
-		</div>
-		<div class="right">
-			<cwg-payment />
-			<cwg-system />
-			<cwg-language />
-			<cwg-notice />
-			<cwg-right-drawer />
-		</div>
-	</header>
+  <header class="cwg-pc-header">
+    <div class="left">
+      <image class="left-img" src="/static/images/logo.png" mode="widthFix" alt="logo" @click="openLeftDrawer" />
+    </div>
+    <div class="right" v-if="visible">
+      <cwg-payment />
+      <cwg-system />
+      <cwg-language />
+      <cwg-notice />
+      <cwg-right-drawer />
+    </div>
+  </header>
 </template>
 
 <script setup lang="ts">
-const props = defineProps({
-	sidebarVisible: {
-		type: Boolean,
-		default: false
-	},
-})
+  import { ref, computed, defineComponent,watch } from 'vue'
+  import { storeToRefs } from 'pinia'
+  import useUserStore from '@/stores/use-user-store'
+
+  const userStore = useUserStore()
+  const { userInfo } = storeToRefs(userStore)
+
+  const visible = ref(true)
+
+  watch(() => userInfo.value, (val) => {
+    visible.value = !!val
+  })
+  const props = defineProps({
+    sidebarVisible: {
+      type: Boolean,
+      default: false,
+    },
+  })
 
 </script>
 
 <style scoped lang="scss">
-.cwg-pc-header {
-	display: flex;
-	align-items: center;
-	justify-content: space-between;
-	height: px2rpx(55);
-	background-color: rgba(255, 255, 255, 0.9);
-	border-bottom: 1px solid #f0f0f0;
-	padding: 0 px2rpx(16);
-	position: relative;
-	z-index: 10;
-}
+  .cwg-pc-header {
+    display: flex;
+    align-items: center;
+    justify-content: space-between;
+    height: px2rpx(55);
+    background-color: rgba(255, 255, 255, 0.9);
+    border-bottom: 1px solid #f0f0f0;
+    padding: 0 px2rpx(16);
+    position: relative;
+    z-index: 10;
+  }
 
-.left {
-	display: flex;
-	align-items: center;
-}
+  .left {
+    display: flex;
+    align-items: center;
+  }
 
 
-.center {
-	flex: 1;
-}
+  .center {
+    flex: 1;
+  }
 
-.right {
-	display: flex;
-	align-items: center;
-	gap: 0;
-}
+  .right {
+    display: flex;
+    align-items: center;
+    gap: 0;
+  }
 
-.bell .dot {
-	position: absolute;
-	top: 0;
-	right: -2px;
-	width: 7px;
-	height: 7px;
-	background: #27ae60;
-	border-radius: 50%;
-	display: inline-block;
-}
+  .bell .dot {
+    position: absolute;
+    top: 0;
+    right: -2px;
+    width: 7px;
+    height: 7px;
+    background: #27ae60;
+    border-radius: 50%;
+    display: inline-block;
+  }
 
-.left-img {
-	width: px2rpx(120);
-}
+  .left-img {
+    width: px2rpx(120);
+  }
 
-.avatar .img {
-	width: 32px;
-	height: 32px;
-	border-radius: 50%;
-	background: #eee;
-}
+  .avatar .img {
+    width: 32px;
+    height: 32px;
+    border-radius: 50%;
+    background: #eee;
+  }
 
-.logo .img {
-	width: 36px;
-	height: 36px;
-	border-radius: 50%;
-	background: #fff;
-}
+  .logo .img {
+    width: 36px;
+    height: 36px;
+    border-radius: 50%;
+    background: #fff;
+  }
 </style>