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