xiongzhu 2 năm trước cách đây
mục cha
commit
45584b57ba

+ 20 - 0
android/app/prod/release/output-metadata.json

@@ -0,0 +1,20 @@
+{
+  "version": 3,
+  "artifactType": {
+    "type": "APK",
+    "kind": "Directory"
+  },
+  "applicationId": "com.bigauction.mobile",
+  "variantName": "prodRelease",
+  "elements": [
+    {
+      "type": "SINGLE",
+      "filters": [],
+      "attributes": [],
+      "versionCode": 142,
+      "versionName": "1.0.0",
+      "outputFile": "app-prod-release.apk"
+    }
+  ],
+  "elementType": "File"
+}

BIN
android/app/src/main/assets/cdvasset.manifest


+ 2 - 1
src/locales/en.json

@@ -113,7 +113,8 @@
         "customer": "Add your broker",
         "reward": "Reward",
         "official": "Official",
-        "broker": "Broker"
+        "broker": "Broker",
+        "error": "Some error occurred, please try again later"
     },
     "delegate": {
         "increase": "Increase",

+ 2 - 1
src/locales/zh.json

@@ -110,7 +110,8 @@
         "customer": "专属客服",
         "reward": "奖励",
         "official": "官方",
-        "broker": "代理人"
+        "broker": "代理人",
+        "error": "发生错误,请稍后再试"
     },
     "delegate": {
         "increase": "加价",

+ 1 - 1
src/views/HomePage.vue

@@ -305,7 +305,7 @@ const isVip = computed(() => {
 const vipUserInfo = ref({})
 function getMineVip() {
     if (user.value == null) return
-    http.get('/vip/getUserVipInfo/' + user.value.id).then(res => {
+    http.get('/vip/mine').then(res => {
         vipUserInfo.value = res
     })
 }

+ 14 - 26
src/views/MinePage.vue

@@ -166,7 +166,7 @@
                             >
                         </div>
                         <van-switch
-                            @click="changeAuto"
+                            @click="toggleAutoTrade"
                             :disabled="!isVip"
                             :model-value="userVip && userVip.autoTradeEnabled"
                         />
@@ -475,35 +475,23 @@ const maxNumber = ref(0)
 const maxPrice = ref(0)
 const minPrice = ref(0)
 
-function changeAuto() {
+async function toggleAutoTrade() {
     if (!isVip.value) {
         return
     }
-    if (userVip.value.autoTradeEnabled) {
-        showConfirmDialog({
-            title: t('common.alert'),
-            message: t('vip.sureClose'),
-            confirmButtonText: t('common.close')
+    try {
+        Toast.loading({
+            message: t('common.loading') + '...',
+            forbidClick: true
         })
-            .then(() => {
-                Toast.loading({
-                    message: t('common.loading') + '...',
-                    forbidClick: true
-                })
-                return http.post('/vip/disableAutoTrade')
-            })
-            .then(() => {
-                Toast.success(t('vip.closed'))
-                getMineVip()
-            })
-            .catch(e => {
-                Toast.clear()
-                if (e && e.error) {
-                    Toast.success(e.error)
-                }
-            })
-    } else {
-        showSetModal.value = true
+        await http.post(userVip.value.autoTradeEnabled ? '/vip/disableAutoTrade' : '/vip/enableAutoTrade', {
+            minPrice: minPrice.value,
+            maxPrice: maxPrice.value
+        })
+        Toast.success(userVip.value.autoTradeEnabled ? t('vip.closed') : t('vip.opened'))
+        getMineVip()
+    } catch (e) {
+        Toast.error(e?.error || t('common.error'))
     }
 }
 

+ 32 - 0
tests/order.mjs

@@ -0,0 +1,32 @@
+import axios from 'axios'
+import qs from 'qs'
+
+const http = axios.create({
+    baseURL: 'http://localhost:8080'
+})
+const { data: token } = await http.post(
+    'http://localhost:8080/auth/login',
+    qs.stringify({
+        username: '15077886171',
+        password: '123456'
+    })
+)
+http.defaults.headers.common['Authorization'] = `Bearer ${token}`
+const {
+    data: { content: list }
+} = await http.post('/product/list', {
+    page: 0,
+    size: 20,
+    sort: 'delayTo,asc;sales,desc;',
+    query: { batchId: '11548', status: 'IN_STOCK' }
+})
+
+for (let i = 0; i < 3; i++) {
+    http.post('/order/createOrder', `productId=${list[0].id}`)
+        .then(res => {
+            console.log('success')
+        })
+        .catch(e => {
+            console.log(e.response.data.error)
+        })
+}