Explorar o código

Merge branch 'master' of http://git.izouma.com/xiongzhu/paimaide

panhui %!s(int64=3) %!d(string=hai) anos
pai
achega
31f628a35f

+ 1 - 1
src/components/OrderItem.vue

@@ -389,7 +389,7 @@ export default {
         pay() {
         pay() {
             this.$toast.loading('支付中')
             this.$toast.loading('支付中')
             this.$http
             this.$http
-                .post('/order/balancePay', { orderId: this.orderInfo.id })
+                .post('/order/balancePay', { orderId: this.info.id })
                 .then(res => {
                 .then(res => {
                     this.$toast.success('支付成功')
                     this.$toast.success('支付成功')
                     setTimeout(() => {
                     setTimeout(() => {

+ 0 - 1
src/stores/user.js

@@ -71,7 +71,6 @@ export const useUserStore = defineStore('user', () => {
     const get = async () => {
     const get = async () => {
         if (!http.token.value) return Promise.reject()
         if (!http.token.value) return Promise.reject()
         return http.get('/user/my').then(res => {
         return http.get('/user/my').then(res => {
-            console.log(res)
             user.value = res
             user.value = res
         })
         })
     }
     }

+ 0 - 1
src/views/HomePage.vue

@@ -235,7 +235,6 @@ const getStatus = info => {
         } else if (isBefore(new Date(), new Date(date1 + ' ' + info.saleStart))) {
         } else if (isBefore(new Date(), new Date(date1 + ' ' + info.saleStart))) {
             return getTime(new Date(date1 + ' ' + info.saleStart), 1) - getTime(new Date())
             return getTime(new Date(date1 + ' ' + info.saleStart), 1) - getTime(new Date())
         } else {
         } else {
-            console.log(addDays(new Date(date1 + ' ' + info.saleStart), 1))
             return getTime(addDays(new Date(date1 + ' ' + info.saleStart), 1)) - getTime(new Date())
             return getTime(addDays(new Date(date1 + ' ' + info.saleStart), 1)) - getTime(new Date())
         }
         }
     }
     }

+ 1 - 1
src/views/LoginPage.vue

@@ -25,7 +25,7 @@
                     </van-field>
                     </van-field>
                     <van-field
                     <van-field
                         v-model="formData.password"
                         v-model="formData.password"
-                        :type="showPsd ? 'text' : 'password'"
+                        :type="showPwd ? 'text' : 'password'"
                         name="密码"
                         name="密码"
                         placeholder="请输入密码"
                         placeholder="请输入密码"
                         clearable
                         clearable

+ 31 - 4
src/views/MinePage.vue

@@ -8,7 +8,7 @@
                 <img src="../assets/icon_bianji.png" class="icon" alt="" />
                 <img src="../assets/icon_bianji.png" class="icon" alt="" />
             </div>
             </div>
             <div class="userInfo" v-else @click="goLogin">
             <div class="userInfo" v-else @click="goLogin">
-                <van-image width="60" height="60" radius="4" :src="notLogo"></van-image>
+                <van-image width="60" height="60" radius="4" :src="defaultAvatar"></van-image>
                 <span class="name">未登录</span>
                 <span class="name">未登录</span>
                 <img src="../assets/icon_bianji.png" class="icon" alt="" />
                 <img src="../assets/icon_bianji.png" class="icon" alt="" />
             </div>
             </div>
@@ -54,7 +54,7 @@
                         <span class="text1" @click="$router.push({ name: 'wallet' })">我的钱包</span>
                         <span class="text1" @click="$router.push({ name: 'wallet' })">我的钱包</span>
                     </div>
                     </div>
                     <van-grid class="card-content" :border="false" :column-num="1">
                     <van-grid class="card-content" :border="false" :column-num="1">
-                        <van-grid-item text="465.26" @click="$router.push({ name: 'wallet' })">
+                        <van-grid-item :text="balanceText" @click="$router.push({ name: 'wallet' })">
                             <template #icon>
                             <template #icon>
                                 <img class="grid-icon" src="../assets/info_icon_qianbao.png" alt="" />
                                 <img class="grid-icon" src="../assets/info_icon_qianbao.png" alt="" />
                             </template>
                             </template>
@@ -108,9 +108,12 @@
 
 
 <script setup>
 <script setup>
 import { computed } from 'vue'
 import { computed } from 'vue'
-import { useUserStore } from '../stores/user'
+import { useUserStore } from '@/stores/user'
 import { useRouter } from 'vue-router'
 import { useRouter } from 'vue-router'
-import notLogo from '../assets/png_moren.png'
+import defaultAvatar from '@/assets/png_moren.png'
+import { ref, watch } from 'vue'
+import { http } from '@/plugins/http'
+
 const userStore = useUserStore()
 const userStore = useUserStore()
 const user = computed(() => {
 const user = computed(() => {
     return userStore.user
     return userStore.user
@@ -124,6 +127,30 @@ const goLogin = () => {
 const goSetting = () => {
 const goSetting = () => {
     router.push({ name: 'setting' })
     router.push({ name: 'setting' })
 }
 }
+const balance = ref({})
+function getBalance() {
+    http.get('/user/balance').then(res => {
+        balance.value = res
+    })
+}
+watch(user, val => {
+    if (val) {
+        getBalance()
+    } else {
+        balance.value = {}
+    }
+})
+getBalance()
+const balanceText = computed(() => {
+    if (balance.value) {
+        if (balance.value.balance > 1000000) {
+            return (balance.value.balance / 1000000).toFixed(1).replace(/\.0$/, '') + 'M'
+        } else if (balance.value.balance > 1000) {
+            return (balance.value.balance / 1000).toFixed(1).replace(/\.0$/, '') + 'K'
+        }
+    }
+    return 'N/A'
+})
 </script>
 </script>
 
 
 <style lang="less" scoped>
 <style lang="less" scoped>