123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308 |
- import axios from '~/plugins/axios'
- function saveStores ({ commit }, params = {}) {
- commit('common/REQUEST_COLLECTLIST')
- return axios.get(`/trade/collection/list`, { params })
- .then(response => {
- commit('common/GET_COLLECTLIST_SUCCESS', response.data)
- }, err => {
- commit('common/GET_COLLECTLIST_FAILURE', err)
- })
- }
- export const actions = {
-
- nuxtServerInit (store, { params, route, req }) {
-
- const userAgent = process.server ? req.headers['user-agent'] : navigator.userAgent
- const isMobile = /(iPhone|iPod|Opera Mini|Android.*Mobile|NetFront|PSP|BlackBerry|Windows Phone)/ig.test(userAgent)
- store.commit('option/SET_MOBILE_LAYOUT', isMobile)
- store.commit('option/SET_USER_AGENT', userAgent)
- return Promise.all([
-
-
- ])
- },
-
- loadRecommends ({ commit }) {
- commit('brand/REQUEST_RECOMMENDS')
- return axios.get('/cmsApi?method=queryContentPage&module=brandCenter_brandReco&orderBy=contExp_sort')
- .then(response => {
- commit('brand/GET_RECOMMENDS_SUCCESS', response.data)
- }, err => {
- commit('brand/GET_RECOMMENDS_FAILURE', err)
- })
- },
-
- loadPCBRecommends ({ commit }) {
- commit('brand/REQUEST_RECOMMENDS')
- return axios.get('/cmsApi?method=queryContentPage&module=brandCenter_brandReco')
- .then(response => {
- commit('brand/GET_RECOMMENDS_SUCCESS', response.data)
- }, err => {
- commit('brand/GET_RECOMMENDS_FAILURE', err)
- })
- },
-
- loadBrands ({ commit }, params = {}) {
- let keyword = params.keyword
- commit('brand/REQUEST_BRANDS', params)
- return axios.get(`/api/product/brand/initial/${keyword}`)
- .then(response => {
- commit('brand/GET_BRANDS_SUCCESS', response.data)
- }, err => {
- commit('brand/GET_BRANDS_FAILURE', err)
- })
- },
-
- loadBrandsPager ({ commit }, params = {}) {
- commit('brand/REQUEST_BRANDS_PAGER', params)
- return axios.get(`/api/product/brand/page/initial`, {params: params})
- .then(response => {
- commit('brand/GET_BRANDS_PAGER_SUCCESS', response.data)
- }, err => {
- commit('brand/GET_BRANDS_PAGER_FAILURE', err)
- })
- },
-
- loadBrandsPagerWithoutIndex ({ commit }, params = {}) {
- commit('brand/REQUEST_BRANDS_PAGER', params)
- return axios.get(`/api/product/brand/Brand/ByPage`, {params: params})
- .then(response => {
- commit('brand/GET_BRANDS_PAGER_SUCCESS', response.data)
- }, err => {
- commit('brand/GET_BRANDS_PAGER_FAILURE', err)
- })
- },
-
- loadAllProductKinds ({ commit }, params = {}) {
- let id = params.id
- commit('kind/REQUEST_KIND', params)
- return axios.get(`/api/product/kind/${id}/children_all`)
- .then(response => {
- commit('kind/GET_KIND_SUCCESS', { id, result: response.data })
- }, err => {
- commit('kind/GET_KIND_FAILURE', {id, err})
- })
- },
- loadKindParentsWithBothers ({ commit }, params = {}) {
- let id = params.id
- commit('kind/REQUEST_KINDPARENTSWITHBOTHERS', params)
- return axios.get(`/api/product/kind/${id}/parentsWithBothers`)
- .then(response => {
- commit('kind/GET_KINDPARENTSWITHBOTHERS_SUCCESS', response.data)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- }, err => {
- commit('kind/GET_KINDPARENTSWITHBOTHERS_FAILURE', err)
- })
- },
- loadKindFirstChild ({ commit }, params = {}) {
- let id = params.id
- commit('kind/REQUEST_KINDFIRSTCHILD', params)
- return axios.get(`/api/product/kind/${id}/children`)
- .then(response => {
- commit('kind/GET_KINDFIRSTCHILD_SUCCESS', response.data)
- }, err => {
- commit('kind/GET_KINDFIRSTCHILD_FAILURE', err)
- })
- },
- loadKindBrands ({ commit }, params = {}) {
- let id = params.id
- commit('kind/REQUEST_KINDBRANDS')
- return axios.get(`/api/product/kind/${id}/brands`)
- .then(response => {
- commit('kind/GET_KINDBRANDS_SUCCESS', response.data)
- }, err => {
- commit('kind/GET_KINDBRANDS_FAILURE', err)
- })
- },
- pageComGoods ({ commit }, kindid = '', brandid = '', pageParams = { page: 1, count: 10 }) {
- let params = {}
- let filter = {kindid: kindid.kindid, brandid: kindid.brandid, properties: kindid.properties}
- params.filter = filter
- params.page = pageParams.page
- params.count = pageParams.count
- commit('component/REQUEST_CMPGOODS')
- return axios.get('/api/product/product/getCompGoodsByKindid', { params })
- .then(response => {
- commit('component/GET_CMPGOODS_SUCCESS', response.data)
- }, err => {
- commit('component/GET_CMPGOODS_FAILURE', err)
- })
- },
-
- saveEntity ({ commit }, componentid) {
- commit('common/REQUEST_COLLECTSAVA')
- return axios.post(`/trade/collection/save`, componentid)
- .then(response => {
- commit('common/GET_COLLECTSAVA_SUCCESS', response.data)
- if (response.data === 'success') {
- commit('common/GET_COLLECTLIST_SUCCESS')
- return Promise.all([
- saveStores({ commit })
- ])
- }
- }, err => {
- commit('common/GET_COLLECTSAVA_FAILURE', err)
- })
- },
-
- saveStores ({ commit }, params = {}) {
- commit('common/REQUEST_COLLECTLIST')
- return axios.get(`/trade/collection/list`, { params })
- .then(response => {
- commit('common/GET_COLLECTLIST_SUCCESS', response.data)
- }, err => {
- commit('common/GET_COLLECTLIST_FAILURE', err)
- })
- },
-
- getCollectList ({ commit }, params = {}) {
- commit('common/REQUEST_COLLECT_LIST')
- return axios.get(`/trade/collection/list`, { params })
- .then(response => {
- commit('common/GET_COLLECT_LIST_SUCCESS', response.data)
- }, err => {
- commit('common/GET_COLLECT_LIST_FAILURE', err)
- })
- },
-
- loadPublishList ({ commit }, params = {}) {
- commit('common/REQUEST_PUBLISH_MOBILE')
- return axios.get(`/api/product/search/page`, { params })
- .then(response => {
- commit('common/GET_PUBLISH_MOBILE_SUCCESS', response.data)
- }, err => {
- commit('common/GET_PUBLISH_MOBILE_FAILURE', err)
- })
- },
-
- loadSupplierInformation ({ commit }, params = {}) {
- let uuid = params.uuid
- let param = {
- page: params.page,
- count: params.count
- }
- commit('supplierInformation/REQUEST_INFORMATION')
- return axios.get(`/api/produce/vendorlist/${uuid}`, {params: param})
- .then(response => {
- commit('supplierInformation/GET_INFORMATION_SUCCESS', response.data)
- }, err => {
- commit('supplierInformation/GET_INFORMATION_FAILURE', err)
- })
- },
-
- loadCompCollectInfo({ commit }) {
- commit('component/REQUEST_COLLECT')
- return axios.get('/trade/collection/count', { params: {type: 'component'} })
- .then(response => {
- commit('component/REQUEST_COLLECT_SUCCESS', response.data)
- }, err => {
- commit('component/REQUEST_COLLECT_FAILURE', err)
- })
- },
-
- getUserCollectCode({ commit }, params = {}) {
- commit('component/REQUEST_COLLECTCODE')
- return axios.get('/produce/kindConcern/kindList', { params: params })
- .then(response => {
- commit('component/REQUEST_COLLECTCODE_SUCCESS', response.data)
- }, err => {
- commit('component/REQUEST_COLLECTCODE_FAILURE', err)
- })
- },
-
- UpdateCollectCode({commit}, params = {}) {
- commit('component/UpdateOne_PRODUCTINFO', {key: params.key, status: params.status})
- },
-
- getLoadStorageData({commit}, params = {}) {
- commit('storage/REQUEST_LIST')
- return axios.get('/CommodityInOutbound/page', {params: params})
- .then(res => {
- commit('storage/GET_LIST_SUCCESS', res.data)
- }, err => {
- commit('storage/GET_LIST_FAILURE', err)
- })
- },
-
- getLoadStorageId({commit}, params = {}) {
- commit('storage/REQUEST_DETAIL')
- return axios.get('/CommodityInOutbound/id', {params: params})
- .then(res => {
- commit('storage/GET_DETAIL_SUCCESS', res.data.data)
- }, err => {
- commit('storage/GET_DETAIL_FAILURE', err)
- })
- },
-
- getLoadEnterpriseData({commit}, params = {}) {
- commit('storage/REQUEST_LIST')
- return axios.get('/trade/invoice/enterprise/inbound', {params: params})
- .then(res => {
- commit('storage/GET_LIST_SUCCESS', res.data)
- }, err => {
- commit('storage/GET_LIST_FAILURE', err)
- })
- },
-
- getLoadEnterpriseId({commit}, params = {}) {
- commit('storage/REQUEST_DETAIL')
- return axios.get(`/trade/invoice/${params.id}/find`)
- .then(res => {
- commit('storage/GET_DETAIL_SUCCESS', res.data)
- }, err => {
- commit('storage/GET_DETAIL_FAILURE', err)
- })
- },
-
- getLoadPurchaseData({commit}, params = {}) {
- commit('storage/REQUEST_LIST')
- return axios.get('/trade/purchase/status/createtime', {params: params})
- .then(res => {
- commit('storage/GET_LIST_SUCCESS', res.data)
- }, err => {
- commit('storage/GET_LIST_FAILURE', err)
- })
- },
-
- getLoadPurchaseId({commit}, params = {}) {
- commit('storage/REQUEST_DETAIL')
- return axios.get('/trade/purchase/purchaseId/' + params.id)
- .then(res => {
- commit('storage/GET_DETAIL_SUCCESS', res.data.data)
- }, err => {
- commit('storage/GET_DETAIL_FAILURE', err)
- })
- },
-
- getLoadLogistics({commit}, params = {}) {
- commit('storage/REQUEST_LOGISTICS')
- return axios.get('/trade/distributor/selected', { params })
- .then(res => {
- commit('storage/GET_LOGISTICS_SUCCESS', res.data)
- }, err => {
- commit('storage/GET_LOGISTICS_FAILURE', err)
- })
- }
- }
|