|
@@ -54,8 +54,10 @@ export default {
|
|
orderChannel: [],
|
|
orderChannel: [],
|
|
bigServiceInfo: {},
|
|
bigServiceInfo: {},
|
|
},
|
|
},
|
|
- // 产品列表
|
|
|
|
|
|
+ // 产品列表(正在上架的,没区分权限)
|
|
productList: [],
|
|
productList: [],
|
|
|
|
+ // 所有产品列表(包含上架下架的所有历史产品)
|
|
|
|
+ productListAll: [],
|
|
// 历史选择的产品列表
|
|
// 历史选择的产品列表
|
|
historyProductList: [],
|
|
historyProductList: [],
|
|
// 页面表单数据
|
|
// 页面表单数据
|
|
@@ -265,6 +267,9 @@ export default {
|
|
setProductList (state, payload = []) {
|
|
setProductList (state, payload = []) {
|
|
state.productList = payload
|
|
state.productList = payload
|
|
},
|
|
},
|
|
|
|
+ setProductListAll (state, payload = []) {
|
|
|
|
+ state.productListAll = payload
|
|
|
|
+ },
|
|
setOrderEditDisabled(state, f = false) {
|
|
setOrderEditDisabled(state, f = false) {
|
|
state.orderInfo.disabled = f
|
|
state.orderInfo.disabled = f
|
|
},
|
|
},
|
|
@@ -373,26 +378,36 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
// 获取产品备选项信息
|
|
// 获取产品备选项信息
|
|
- async getProductList ({ commit, dispatch, state }, payload) {
|
|
|
|
|
|
+ async getProductList ({ commit, dispatch, state }, payload = {}) {
|
|
// 此处不能用缓存,需要实时查询subject=1/2的数据
|
|
// 此处不能用缓存,需要实时查询subject=1/2的数据
|
|
// if (Array.isArray(state.productList) && state.productList.length > 0) {
|
|
// if (Array.isArray(state.productList) && state.productList.length > 0) {
|
|
// return state.productList
|
|
// return state.productList
|
|
// }
|
|
// }
|
|
-
|
|
|
|
|
|
+ const showAll = payload.showAll
|
|
const p = {
|
|
const p = {
|
|
subject: state.pageForm.buySubject,
|
|
subject: state.pageForm.buySubject,
|
|
...payload,
|
|
...payload,
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (showAll) {
|
|
|
|
+ p.showAll = 1
|
|
|
|
+ }
|
|
|
|
+
|
|
commit('setLoadingState', { key: 'productList', value: true })
|
|
commit('setLoadingState', { key: 'productList', value: true })
|
|
try {
|
|
try {
|
|
const { error_code: code, error_msg: msg, data } = await ajaxGetProductionList(p)
|
|
const { error_code: code, error_msg: msg, data } = await ajaxGetProductionList(p)
|
|
if (code === 0 && data) {
|
|
if (code === 0 && data) {
|
|
- await dispatch('initProductListData', data)
|
|
|
|
|
|
+ const productList = await dispatch('initProductListData', data)
|
|
|
|
+ if (showAll) {
|
|
|
|
+ commit('setProductListAll', productList)
|
|
|
|
+ } else {
|
|
|
|
+ commit('setProductList', productList)
|
|
|
|
+ }
|
|
|
|
+ return productList
|
|
} else {
|
|
} else {
|
|
showNotify({ message: msg })
|
|
showNotify({ message: msg })
|
|
}
|
|
}
|
|
- return state.productList
|
|
|
|
|
|
+ return []
|
|
} catch (error) {
|
|
} catch (error) {
|
|
console.log(error)
|
|
console.log(error)
|
|
} finally {
|
|
} finally {
|
|
@@ -400,7 +415,7 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
// 初始化产品备选项信息
|
|
// 初始化产品备选项信息
|
|
- initProductListData({ commit }, payload = {}) {
|
|
|
|
|
|
+ initProductListData(_, payload = {}) {
|
|
const { productList, activityList } = payload
|
|
const { productList, activityList } = payload
|
|
let pList = []
|
|
let pList = []
|
|
// 整理productList
|
|
// 整理productList
|
|
@@ -453,7 +468,7 @@ export default {
|
|
children: aList
|
|
children: aList
|
|
})
|
|
})
|
|
|
|
|
|
- commit('setProductList', pList)
|
|
|
|
|
|
+ return pList
|
|
},
|
|
},
|
|
async getBigServiceInfo({ commit, state }, payload = {}) {
|
|
async getBigServiceInfo({ commit, state }, payload = {}) {
|
|
// 有数据,直接返回数据
|
|
// 有数据,直接返回数据
|