import http from '@/request/index.js'; // 上架详情 export const state = { groundData: [], //上架数据 storageData: [], //货位数据 detailsData: {} // 上架明细数据 }; export const mutations = { setGroundData(state, data) { state.groundData = data }, setStorageData(state, data) { state.storageData = data }, } export const actions = { getGroundData({ commit, rootState }, data) { return new Promise((resolve, reject) => { http('groundIng.getList', { ...data.pam, stroomId: rootState.houseSelectData.houseId || "" }, '加载中').then(res => { if (res.success == true) { data.that.$refs.paging.complete(res.data.records); } else { // commit('DetailsData', []); } }).catch(e => { reject(e) }) }) }, //获取货位 getStorageData({ commit, rootState }) { return new Promise((resolve, reject) => { http('groundIng.getStorageData', { stroomName: rootState.houseSelectData.houseName || "" }, '加载中').then(res => { if (res.success == true) { res.data.records.length && res.data.records.forEach((item) => { item.text = item.cgoLocName; item.value = item.id; }) commit('setStorageData', res.data.records); } }).catch(e => { reject(e) }) }) }, //批量上架 listIngData({ commit, rootState }, data) { return new Promise((resolve, reject) => { http('groundIng.listingData', data, '加载中').then(res => { if (res.success == true) { uni.showToast({ title: '上架成功', icon: 'none', duration: 3000, success() { resolve() } }); } }).catch(e => { reject(e) }) }) }, }