Explorar el Código

fix: 修复部分BUG

YuJing hace 1 mes
padre
commit
ae296ac61c

+ 1 - 1
features/feature/src/main/ets/components/AddressComp.ets

@@ -32,7 +32,7 @@ export struct AddressComp{
 
   // 选择地址
   selectAddress(item: Address){
-    this.control._onBackPress({ item })
+    this.control._onBackPress(item)
   }
 
   build() {

+ 1 - 1
features/feature/src/main/ets/model/Query.ets

@@ -69,7 +69,7 @@ export class searchBookQuery extends Query {
       minAge: this.minAge,
       sort: this.sort,
       typeId: this.typeId,
-      userInfo: this.userId
+      userId: this.userId
     } as ESObject
   }
 }

+ 20 - 2
features/feature/src/main/ets/pages/viewModel/BookItemDetailViewModel.ets

@@ -1,4 +1,4 @@
-import { BookItem, IBestToast, YTAvoid } from "basic";
+import { BookItem, IBestToast, YTAvoid, yTRouter } from "basic";
 import { webview } from "@kit.ArkWeb";
 import { bookListApi } from "../../apis/BookListApi";
 import { OrderApi } from "../../apis/OrderApi";
@@ -18,9 +18,27 @@ export class BookItemDetailViewModel{
   }
 
   // 立刻借阅
-  borrow() {
+  async borrow() {
     // todo 逻辑相对比较复杂,在 view 中处理完成后再 copy 过来
+    // 押金缴纳检测
+    let ans = await OrderApi.getUserDeposit()
+    let deposit = Number.parseFloat(ans.deposit)
+    if (deposit < 100) {
+      yTRouter.router2CenterDialog({
+        param: { text: '借阅失败,请先缴纳押金', date: '去缴纳' }
+      }, (info) => {
+        let ans = info.result as number
+        if(ans == 1) {
+          yTRouter.router2CashPledgePage()
+        }
+      })
 
+      // todo 测试结束后需要加回来
+      // return
+    }
+
+    let list: BookItem[] = [this.book]
+    yTRouter.router2OrderOrderConfirmPage(list)
   }
 
   // 加入书包

+ 5 - 1
features/feature/src/main/ets/view/ThirdView.ets

@@ -85,7 +85,11 @@ export struct ThirdView {
     .width('100%')
     .height('100%')
     .backgroundColor('#F7F9FA')
-
+    .onVisibleAreaChange([0, 1], (v, t) => {
+      if (v && t == 1) {
+        this.vm.getBagBookList()
+      }
+    })
   }
 
   @Builder

+ 1 - 1
features/feature/src/main/ets/view/viewModel/SecondViewModel.ets

@@ -50,7 +50,7 @@ export class SecondViewModel{
 
   // 更改选中的分类
   changeCategory(index: number, toIndex: boolean = false) {
-    if(index == this.categoryIndex && index !=+ 0) return
+    if(index == this.categoryIndex && index != 0) return
 
     this.categoryIndex = index
     if (toIndex) {