|
@@ -1,5 +1,28 @@
|
|
|
import axios from '~plugins/axios'
|
|
|
|
|
|
+
|
|
|
+function loadBrandCategories ({commit}, params = {}) {
|
|
|
+ let id = params.id
|
|
|
+ commit('brandCategories/REQUEST_CATEGORIES', params)
|
|
|
+ return axios.get(`/api/product/brand/${id}/kinds`)
|
|
|
+ .then(response => {
|
|
|
+ commit('brandCategories/GET_CATEGORIES_SUCCESS', response.data)
|
|
|
+ }, err => {
|
|
|
+ commit('brandCategories/GET_CATEGORIES_FAILURE', err)
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+function loadBrandComponent ({commit}, params = {}) {
|
|
|
+ commit('brandComponent/REQUEST_COMPONENT', params)
|
|
|
+ return axios.get('/api/product/component/list', { params })
|
|
|
+ .then(response => {
|
|
|
+ commit('brandComponent/GET_COMPONENT_SUCCESS', response.data)
|
|
|
+ }, err => {
|
|
|
+ commit('brandComponent/GET_COMPONENT_FAILURE', err)
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
export const actions = {
|
|
|
|
|
|
nuxtServerInit (store, { params, route, isServer, req }) {
|
|
@@ -119,12 +142,22 @@ export const actions = {
|
|
|
|
|
|
loadComponentDetail ({commit}, params = {}) {
|
|
|
let id = params.id
|
|
|
- console.log(id)
|
|
|
+
|
|
|
commit('componentDetail/REQUEST_DETAIL', params)
|
|
|
return axios.get(`/api/product/component/${id}`)
|
|
|
.then(response => {
|
|
|
console.log('response', response.data)
|
|
|
commit('componentDetail/GET_DETAIL_SUCCESS', response.data)
|
|
|
+ if (response.data) {
|
|
|
+ commit('componentMenu/REQUEST_MENU', params)
|
|
|
+ return axios.get(`/api/product/kind/structing/${response.data.kindid}`)
|
|
|
+ .then(response => {
|
|
|
+ console.log('response', response.data)
|
|
|
+ commit('componentMenu/GET_MENU_SUCCESS', response.data)
|
|
|
+ }, err => {
|
|
|
+ commit('componentMenu/GET_MENU_FAILURE', err)
|
|
|
+ })
|
|
|
+ }
|
|
|
}, err => {
|
|
|
commit('componentDetail/GET_DETAIL_FAILURE', err)
|
|
|
})
|
|
@@ -154,16 +187,31 @@ export const actions = {
|
|
|
commit('componentStore/GET_STORE_FAILURE', err)
|
|
|
})
|
|
|
},
|
|
|
+
|
|
|
+ loadComponentInformation ({commit}, params = {}) {
|
|
|
+ commit('componentInformation/REQUEST_INFORMATION', params)
|
|
|
+ return axios.get('/api/commodity/goods/page', { params })
|
|
|
+ .then(response => {
|
|
|
+ console.log('loadComponentInformation', response.data)
|
|
|
+ commit('componentInformation/GET_INFORMATION_SUCCESS', response.data)
|
|
|
+ }, err => {
|
|
|
+ commit('componentInformation/GET_INFORMATION_FAILURE', err)
|
|
|
+ })
|
|
|
+ },
|
|
|
|
|
|
|
|
|
- loadBrandDetail ({commit}, params = {}) {
|
|
|
+ loadBrandDetail ({commit, dispatch}, params = {}) {
|
|
|
let id = params.id
|
|
|
- console.log(id)
|
|
|
commit('brandDetail/REQUEST_DETAIL', params)
|
|
|
return axios.get(`/api/product/brand/${id}`)
|
|
|
.then(response => {
|
|
|
- console.log('response', response.data)
|
|
|
+ let brand = response.data || {}
|
|
|
+ console.log('loadBrandDetail', response.data !== null)
|
|
|
commit('brandDetail/GET_DETAIL_SUCCESS', response.data)
|
|
|
+ return Promise.all([
|
|
|
+ loadBrandCategories({ commit }, {id: brand.id}),
|
|
|
+ loadBrandComponent({ commit }, {count: 10, filter: { brandid: brand.id }, page: 1})
|
|
|
+ ])
|
|
|
}, err => {
|
|
|
commit('brandDetail/GET_DETAIL_FAILURE', err)
|
|
|
})
|
|
@@ -174,12 +222,21 @@ export const actions = {
|
|
|
commit('brandCategories/REQUEST_CATEGORIES', params)
|
|
|
return axios.get(`/api/product/brand/${id}/kinds`)
|
|
|
.then(response => {
|
|
|
- console.log('response', response.data)
|
|
|
commit('brandCategories/GET_CATEGORIES_SUCCESS', response.data)
|
|
|
}, err => {
|
|
|
commit('brandCategories/GET_CATEGORIES_FAILURE', err)
|
|
|
})
|
|
|
},
|
|
|
+
|
|
|
+ loadBrandComponent ({commit}, params = {}) {
|
|
|
+ commit('brandComponent/REQUEST_COMPONENT', params)
|
|
|
+ return axios.get('/api/product/component/list', { params })
|
|
|
+ .then(response => {
|
|
|
+ commit('brandComponent/GET_COMPONENT_SUCCESS', response.data)
|
|
|
+ }, err => {
|
|
|
+ commit('brandComponent/GET_COMPONENT_FAILURE', err)
|
|
|
+ })
|
|
|
+ },
|
|
|
|
|
|
loadHelpSnapsho ({ commit }, params = {}) {
|
|
|
commit('help/REQUEST_SNAPSHO')
|