grounding.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. import http from '@/request/index.js';
  2. // 上架详情
  3. export const state = {
  4. groundData: [], //上架数据
  5. storageData: [], //货位数据
  6. detailsData: {} // 上架明细数据
  7. };
  8. export const mutations = {
  9. setGroundData(state, data) {
  10. state.groundData = data
  11. },
  12. setStorageData(state, data) {
  13. state.storageData = data
  14. },
  15. }
  16. export const actions = {
  17. getGroundData({
  18. commit,
  19. rootState
  20. }, data) {
  21. return new Promise((resolve, reject) => {
  22. http('groundIng.getList', {
  23. ...data.pam,
  24. stroomId: rootState.houseSelectData.houseId || ""
  25. }, '加载中').then(res => {
  26. if (res.success == true) {
  27. data.that.$refs.paging.complete(res.data.records);
  28. } else {
  29. // commit('DetailsData', []);
  30. }
  31. }).catch(e => {
  32. reject(e)
  33. })
  34. })
  35. },
  36. //获取货位
  37. getStorageData({
  38. commit,
  39. rootState
  40. }) {
  41. return new Promise((resolve, reject) => {
  42. http('groundIng.getStorageData', {
  43. stroomName: rootState.houseSelectData.houseName || ""
  44. }, '加载中').then(res => {
  45. if (res.success == true) {
  46. res.data.records.length && res.data.records.forEach((item) => {
  47. item.text = item.cgoLocName;
  48. item.value = item.id;
  49. })
  50. commit('setStorageData', res.data.records);
  51. }
  52. }).catch(e => {
  53. reject(e)
  54. })
  55. })
  56. },
  57. //批量上架
  58. listIngData({
  59. commit,
  60. rootState
  61. }, data) {
  62. return new Promise((resolve, reject) => {
  63. http('groundIng.listingData', data, '加载中').then(res => {
  64. if (res.success == true) {
  65. uni.showToast({
  66. title: '上架成功',
  67. icon: 'none',
  68. duration: 3000,
  69. success() {
  70. resolve()
  71. }
  72. });
  73. }
  74. }).catch(e => {
  75. reject(e)
  76. })
  77. })
  78. },
  79. }