Browse Source

feat: 优化

shuisheng 2 năm trước cách đây
mục cha
commit
e758d3a8aa
3 tập tin đã thay đổi với 36 bổ sung14 xóa
  1. 18 8
      src/App.vue
  2. 3 3
      src/components/QrPay/index.vue
  3. 15 3
      src/interface.ts

+ 18 - 8
src/App.vue

@@ -1,9 +1,12 @@
 <template>
-  <router-view></router-view>
+  <n-config-provider :theme-overrides="themeOverrides">
+    <router-view></router-view>
+  </n-config-provider>
 </template>
 
 <script lang="ts" setup>
 import { isMobile } from 'billd-utils';
+import { GlobalThemeOverrides, NConfigProvider } from 'naive-ui';
 import { onMounted } from 'vue';
 
 import { useCheckUpdate } from '@/hooks/use-checkUpdate';
@@ -18,13 +21,12 @@ const { appInfo } = useCheckUpdate();
 const cacheStore = usePiniaCacheStore();
 const userStore = useUserStore();
 
-function handleUpdate() {
-  const old = getLastBuildDate();
-  if (appInfo.value.lastBuildDate !== old) {
-    localStorage.clear();
-  }
-  setLastBuildDate(appInfo.value.lastBuildDate);
-}
+const themeOverrides: GlobalThemeOverrides = {
+  common: {
+    primaryColor: '#ffd700',
+    primaryColorHover: '#ffd700',
+  },
+};
 
 onMounted(() => {
   handleUpdate();
@@ -52,6 +54,14 @@ onMounted(() => {
     );
   }
 });
+
+function handleUpdate() {
+  const old = getLastBuildDate();
+  if (appInfo.value.lastBuildDate !== old) {
+    localStorage.clear();
+  }
+  setLastBuildDate(appInfo.value.lastBuildDate);
+}
 </script>
 
 <style lang="scss">

+ 3 - 3
src/components/QrPay/index.vue

@@ -8,7 +8,7 @@
         :src="aliPayBase64"
         alt=""
       />
-      <template v-if="currentPayStatus !== PayStatusEnum.error">
+      <template v-if="currentPayStatus !== PayStatusEnum.wait">
         <div class="mask">
           <div class="txt">
             {{
@@ -63,7 +63,7 @@ const downTimer = ref();
 const downTimeStart = ref();
 const downTimeEnd = ref();
 
-const currentPayStatus = ref(PayStatusEnum.error);
+const currentPayStatus = ref(PayStatusEnum.wait);
 const props = defineProps({
   money: { type: String, default: '0.00' },
   goodsId: { type: Number, default: -1 },
@@ -109,7 +109,7 @@ async function startPay(data: {
   liveRoomId: number;
   money?: string;
 }) {
-  currentPayStatus.value = PayStatusEnum.error;
+  currentPayStatus.value = PayStatusEnum.wait;
   payOk.value = false;
   clearInterval(payStatusTimer.value);
   clearInterval(downTimer.value);

+ 15 - 3
src/interface.ts

@@ -7,9 +7,16 @@ export enum LiveLineEnum {
 }
 
 export enum PayStatusEnum {
-  error = 'error',
+  wait = 'billd_status_wait',
+  timeout = 'billd_status_timeout',
+  /** (交易创建,等待买家付款) */
   WAIT_BUYER_PAY = 'WAIT_BUYER_PAY',
+  /** (交易支付成功) */
   TRADE_SUCCESS = 'TRADE_SUCCESS',
+  /** (未付款交易超时关闭,或支付完成后全额退款) */
+  TRADE_CLOSED = 'TRADE_CLOSED',
+  /** (交易结束,不可退款) */
+  TRADE_FINISHED = 'TRADE_FINISHED',
 }
 
 export interface IServerInfo {
@@ -83,12 +90,17 @@ export interface IOrder {
   user?: IUser;
   /** 商品信息 */
   goods?: IGoods;
+  /** 直播间信息 */
+  live_room?: IGoods;
+
   billd_live_user_id?: number;
   billd_live_goods_id?: number;
   billd_live_live_room_id?: number;
+  billd_live_order_subject?: string;
   /** 判断幂等 */
   billd_live_order_version?: number;
-  billd_live_order_subject?: string;
+  client_ip?: string;
+
   product_code?: string;
   qr_code?: string;
   /** 买家支付宝账号 */
@@ -110,7 +122,7 @@ export interface IOrder {
   /** 商家订单号 */
   out_trade_no?: string;
   /** 交易状态:WAIT_BUYER_PAY(交易创建,等待买家付款)、TRADE_CLOSED(未付款交易超时关闭,或支付完成后全额退款)、TRADE_SUCCESS(交易支付成功)、TRADE_FINISHED(交易结束,不可退款) */
-  trade_status?: string;
+  trade_status?: PayStatusEnum;
   /** 本次交易打款给卖家的时间 */
   send_pay_date?: string;
   created_at?: string;