You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
import $api from "@/api/index.js"
|
|
|
|
export default {
|
|
|
|
state: {
|
|
|
|
pageActive: false,
|
|
|
|
activeIndex: 0,
|
|
|
|
tabList: [{
|
|
|
|
title: '综合推荐',
|
|
|
|
sort: 'top desc',
|
|
|
|
}, {
|
|
|
|
title: '单量',
|
|
|
|
sort: 'total_sale',
|
|
|
|
sign: 0,
|
|
|
|
is_sign: 1,
|
|
|
|
}, {
|
|
|
|
title: '距离',
|
|
|
|
sort: 'price',
|
|
|
|
sign: 0,
|
|
|
|
is_sign: 1,
|
|
|
|
},{
|
|
|
|
title: '评分',
|
|
|
|
sort: 'star',
|
|
|
|
sign: 0,
|
|
|
|
is_sign: 1,
|
|
|
|
}],
|
|
|
|
param: {
|
|
|
|
page: 1,
|
|
|
|
sort: ''
|
|
|
|
},
|
|
|
|
list: {
|
|
|
|
data: [],
|
|
|
|
last_page: 1,
|
|
|
|
current_page: 1
|
|
|
|
},
|
|
|
|
banner: []
|
|
|
|
},
|
|
|
|
mutations: {
|
|
|
|
async updateServiceItem(state, item) {
|
|
|
|
let {
|
|
|
|
key,
|
|
|
|
val
|
|
|
|
} = item
|
|
|
|
state[key] = val
|
|
|
|
}
|
|
|
|
},
|
|
|
|
actions: {
|
|
|
|
async getServiceIndex({
|
|
|
|
commit,
|
|
|
|
state
|
|
|
|
}, param) {
|
|
|
|
let d = await $api.service.index(param);
|
|
|
|
let {
|
|
|
|
banner
|
|
|
|
} = d
|
|
|
|
commit('updateServiceItem', {
|
|
|
|
key: 'banner',
|
|
|
|
val: banner
|
|
|
|
})
|
|
|
|
},
|
|
|
|
async getServiceList({
|
|
|
|
commit,
|
|
|
|
state
|
|
|
|
}, param) {
|
|
|
|
let d = await $api.service.serviceList(param)
|
|
|
|
let oldList = state.list;
|
|
|
|
let newList = d;
|
|
|
|
let list = {}
|
|
|
|
if (param.page == 1) {
|
|
|
|
list = newList;
|
|
|
|
} else {
|
|
|
|
newList.data = oldList.data.concat(newList.data)
|
|
|
|
list = newList;
|
|
|
|
}
|
|
|
|
commit('updateServiceItem', {
|
|
|
|
key: 'list',
|
|
|
|
val: list
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|