|
@@ -1,4 +1,5 @@
|
|
|
import { getToken } from '@/utils/auth'
|
|
|
+import { fetch } from '@/api/index'
|
|
|
import i18n from '@/i18n'
|
|
|
|
|
|
const state = {
|
|
@@ -107,7 +108,9 @@ const state = {
|
|
|
name: '是',
|
|
|
value: 1
|
|
|
}
|
|
|
- ]
|
|
|
+ ],
|
|
|
+ arrCategoryList: [],
|
|
|
+ arrBrandList: []
|
|
|
}
|
|
|
|
|
|
const mutations = {
|
|
@@ -122,6 +125,12 @@ const mutations = {
|
|
|
},
|
|
|
SET_VIDEOPLAYDIALOG(state, obj) {
|
|
|
state.videoPlayDialog = obj
|
|
|
+ },
|
|
|
+ SET_ARRCATEGORYLIST(state, val) {
|
|
|
+ state.arrCategoryList = val
|
|
|
+ },
|
|
|
+ SET_ARRBRANDLIST(state, val) {
|
|
|
+ state.arrBrandList = val
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -144,6 +153,35 @@ const actions = {
|
|
|
if (data.code === 200) {
|
|
|
commit('SET_ROLEARR', data.data)
|
|
|
}
|
|
|
+ },
|
|
|
+ // 商品分类
|
|
|
+ async setCategoryList({ commit }) {
|
|
|
+ console.log(fetch)
|
|
|
+ const data = await fetch('/api/shop/product/category/list', {})
|
|
|
+ if (data.code === 200) {
|
|
|
+ const temp = data.data.map(item => {
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ name: item.category_name,
|
|
|
+ value: item.id
|
|
|
+ }
|
|
|
+ })
|
|
|
+ commit('SET_ARRCATEGORYLIST', temp)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 商品品牌
|
|
|
+ async setBrandlist({ commit }) {
|
|
|
+ const data = await fetch('/api/shop/product/brand/list', {})
|
|
|
+ if (data.code === 200) {
|
|
|
+ const temp = data.data.map(item => {
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ name: item.brand_name,
|
|
|
+ value: item.id
|
|
|
+ }
|
|
|
+ })
|
|
|
+ commit('SET_ARRBRANDLIST', temp)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|