shish 11 ماه پیش
والد
کامیت
8c41bfe7b8
1فایلهای تغییر یافته به همراه10 افزوده شده و 25 حذف شده
  1. 10 25
      mallApp/src/pages/home/mall.vue

+ 10 - 25
mallApp/src/pages/home/mall.vue

@@ -116,9 +116,7 @@ export default {
       height: 0,
       height: 0,
       currentTab: 0,
       currentTab: 0,
       scrollTop: 0,
       scrollTop: 0,
-      form: {
-        categoryId: ''
-      },
+      categoryId: '',
       currentTabIndex: 1,
       currentTabIndex: 1,
       myClass: 'fadeIn',
       myClass: 'fadeIn',
 			shopName:'',
 			shopName:'',
@@ -171,7 +169,7 @@ export default {
   methods: {
   methods: {
     toBuy(item){
     toBuy(item){
       let account = this.option.account?this.option.account:0
       let account = this.option.account?this.option.account:0
-      this.$util.pageTo({url:"/pages/goods/detail?id="+item.id+'&hdId='+this.hdId+'&categoryId='+this.form.categoryId+'&account='+account})
+      this.$util.pageTo({url:"/pages/goods/detail?id="+item.id+'&hdId='+this.hdId+'&categoryId='+this.categoryId+'&account='+account})
     },
     },
     buyProduct(){
     buyProduct(){
       let account = this.option.account?this.option.account:0
       let account = this.option.account?this.option.account:0
@@ -239,7 +237,6 @@ export default {
       if (this.$util.isEmpty(this.searchText)) {
       if (this.$util.isEmpty(this.searchText)) {
         return
         return
       }
       }
-      
       this.isSearchMode = true
       this.isSearchMode = true
       this.lastSearchText = this.searchText
       this.lastSearchText = this.searchText
       this.resetList()
       this.resetList()
@@ -259,24 +256,7 @@ export default {
       this.resetList()
       this.resetList()
       this.getGoodList()
       this.getGoodList()
     },
     },
-    
-    // 搜索商品
-    searchGoods() {
-      let hdId = this.option.id?this.option.id:0
-      return getList({ 
-        searchText: this.searchText, 
-        page: this.list.page, 
-        pageSize: 10,
-        hdId:hdId,
-        requestType:'mall'
-      }).then(res => {
-        this.completes(res)
-      }).catch(err => {
-        this.$msg('搜索失败')
-      })
-    },
     reachBottom () {
     reachBottom () {
-      console.log('reachBottom----------', this.list.finished)
       if (this.list.finished == false) {
       if (this.list.finished == false) {
         // 根据是否为搜索模式决定调用哪个方法
         // 根据是否为搜索模式决定调用哪个方法
         if (this.isSearchMode) {
         if (this.isSearchMode) {
@@ -301,14 +281,19 @@ export default {
     getMyClass () {
     getMyClass () {
       return getClass().then(res => {
       return getClass().then(res => {
         if(res.code && res.code == 1){
         if(res.code && res.code == 1){
-          this.form.categoryId = res.data[0].id
+          this.categoryId = res.data[0].id
           this.tabbar = res.data
           this.tabbar = res.data
         }
         }
       })
       })
     },
     },
+    // 搜索商品
+    searchGoods() {
+      this.getGoodList()
+    },
     // 列表
     // 列表
     getGoodList () {
     getGoodList () {
-      return getList({ ...this.form, page: this.list.page,pageSize:10,requestType:'mall' }) .then(res => {
+      let hdId = this.option.id?this.option.id:0
+      return getList({ cId:this.categoryId, page: this.list.page,pageSize:10,requestType:'mall',searchText: this.searchText,hdId:hdId}) .then(res => {
           // 处理商品列表数据,completes方法来自list混入
           // 处理商品列表数据,completes方法来自list混入
           // 该方法会处理分页数据,更新list对象的data、page、finished等属性
           // 该方法会处理分页数据,更新list对象的data、page、finished等属性
           // res包含接口返回的商品列表数据,completes方法会将数据添加到this.list.data中
           // res包含接口返回的商品列表数据,completes方法会将数据添加到this.list.data中
@@ -322,7 +307,7 @@ export default {
         return false
         return false
       } else {
       } else {
         this.currentTab = cur
         this.currentTab = cur
-        this.form.categoryId = item.id
+        this.categoryId = item.id
         
         
         // 切换分类时清空搜索状态
         // 切换分类时清空搜索状态
         this.clearSearchState()
         this.clearSearchState()