index.js 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. export const actions = {
  2. // 全局服务初始化
  3. nuxtServerInit (store, {isDev, req}) {
  4. // 检查设备类型
  5. const userAgent = process.server ? req.headers['user-agent'] : navigator.userAgent
  6. const isMobile = /(iPhone|iPod|Opera Mini|Android.*Mobile|NetFront|PSP|BlackBerry|Windows Phone)/ig.test(userAgent)
  7. const cookie = process.server ? req.headers['cookie'] : null
  8. store.commit('option/SET_MOBILE_LAYOUT', isMobile)
  9. store.commit('option/SET_USER_AGENT', userAgent)
  10. store.commit('option/SET_COOKIES', cookie)
  11. // 设置跳转的URL
  12. if (!isDev) {
  13. store.commit('option/UPDATE_URL', 'http://127.0.0.1:8888')
  14. }
  15. return Promise.all([
  16. // 全局数据
  17. store.dispatch('loadUserInfo'),
  18. store.dispatch('loadExchangeInfoAll')
  19. ])
  20. },
  21. // 获取用户信息
  22. loadUserInfo ({ commit }) {
  23. return this.$http.get('/user/authentication')
  24. .then(response => {
  25. commit('option/REQUEST_USER_INFO_SUCCESS', response.data)
  26. // state.option.sessionId = response.data.content.sessionId
  27. }, err => {
  28. commit('option/REQUEST_USER_INFO_FAILURE', err)
  29. })
  30. },
  31. // 获取深圳交货方式
  32. loadDelivery ({commit}, params = {}) {
  33. return this.$http.get('/facilitator/deliveryType/enuu/delivery', {params})
  34. .then(response => {
  35. commit('delivery/REQUEST_SHENZHEN_SUCCESS', response.data)
  36. }, err =>{
  37. console.log(err)
  38. })
  39. },
  40. // 获取香港交货方式
  41. loadStock ({commit}, params = {}) {
  42. return this.$http.get('/facilitator/deliveryType/enuu/delivery', {params})
  43. .then(response => {
  44. commit('delivery/REQUEST_HONGKONG_FAILURE', response.data)
  45. }, err => {
  46. console.log(err)
  47. })
  48. },
  49. // 获取客户所有委托单信息
  50. loadClientSheetInfo ({commit}, params = {}) {
  51. return this.$http.get('/CommissionSheet/client/page', {params})
  52. .then(response => {
  53. commit('clientSheet/REQUEST_LIST_SUCCESS', response.data)
  54. }, err => {
  55. console.log(err)
  56. })
  57. },
  58. // 单个获取(委、受)托单信息
  59. loadSheetDetails ({commit}, params = {}) {
  60. return this.$http.get('/CommissionSheet/id', {params})
  61. .then(response => {
  62. commit('clientSheet/REQUEST_DETAILS_SUCCESS', response.data)
  63. commit('severSheet/REQUEST_DETAILS_SUCCESS', response.data)
  64. if (response.data) {
  65. return this.$http.get('/facilitator/deliveryType/enuu/delivery', {params: {type: 'importdelivery', enuu: response.data.content.baileeCompanyenuu}})
  66. .then(response => {
  67. commit('delivery/REQUEST_SHENZHEN_SUCCESS', response.data)
  68. }, err =>{
  69. console.log(err)
  70. }),
  71. this.$http.get('/facilitator/deliveryType/enuu/delivery', {params: {type: 'importstock', enuu: response.data.content.baileeCompanyenuu}})
  72. .then(response => {
  73. commit('delivery/REQUEST_HONGKONG_FAILURE', response.data)
  74. }, err => {
  75. console.log(err)
  76. })
  77. }
  78. }, err => {
  79. console.log(err)
  80. })
  81. },
  82. // 获取客户所有受托单信息
  83. loadSeverSheetInfo ({commit}, params = {}) {
  84. return this.$http.get('/CommissionSheet/facilitator/page', {params})
  85. .then(response => {
  86. commit('severSheet/REQUEST_LIST_SUCCESS', response.data)
  87. }, err => {
  88. console.log(err)
  89. })
  90. },
  91. // 获取客户申报要素信息
  92. loadDeclarationElementsInfo ({commit}, params = {}) {
  93. return this.$http.get('/facilitator/declarationElements/page', {params})
  94. .then(response => {
  95. commit('declarationElements/REQUEST_LIST_SUCCESS', response.data)
  96. }, err => {
  97. console.log(err)
  98. })
  99. },
  100. // 单个获取申报要素信息
  101. loadDeclarationElementsDetails ({commit}, params = {}) {
  102. return this.$http.get('/facilitator/declarationElements/id', {params})
  103. .then(response => {
  104. commit('declarationElements/REQUEST_DETAILS_SUCCESS', response.data)
  105. }, err => {
  106. console.log(err)
  107. })
  108. },
  109. // 获取关务汇总单信息
  110. loadCustomsInfo ({commit}, params = {}) {
  111. return this.$http.get('/facilitator/customerHouseServiceSheet/page', {params})
  112. .then(response => {
  113. commit('customerHouse/REQUEST_LIST_SUCCESS', response.data)
  114. }, err => {
  115. console.log(err)
  116. })
  117. },
  118. // 获取所有汇率信息
  119. loadExchangeInfoAll ({commit}) {
  120. return this.$http.get('/facilitator/exchangeRate/all')
  121. .then(response => {
  122. commit('exchange/REQUEST_ALL_SUCCESS', response.data)
  123. }, err => {
  124. console.log(err)
  125. })
  126. },
  127. // 分页获取客户资料
  128. loadexchangeInfo ({commit}, params = {}) {
  129. return this.$http.get('/facilitator/exchangeRate/page', {params})
  130. .then(response => {
  131. commit('exchange/REQUEST_LIST_SUCCESS', response.data)
  132. }, err => {
  133. console.log(err)
  134. })
  135. },
  136. // 分页获取外汇账号的信息
  137. loadremittanceInfo ({commit}, params = {}) {
  138. return this.$http.get('/customer/remittanceAccount/page', {params})
  139. .then(response => {
  140. commit('payment/REQUEST_LIST_SUCCESS', response.data)
  141. }, err => {
  142. console.log(err)
  143. })
  144. },
  145. // 获取货币种类
  146. loadexchangeCurrencyList ({commit}, params = {}) {
  147. return this.$http.get('/common/currencyList/all', {params})
  148. .then(response => {
  149. commit('exchange/REQUEST_CURRENCYLIST_SUCCESS', response.data)
  150. }, err => {
  151. console.log(err)
  152. })
  153. },
  154. // 获取服务商客户资料模块客户分页
  155. loadcustomerInfo ({commit}, params = {}) {
  156. return this.$http.get('/customer/page', {params})
  157. .then(response => {
  158. commit('customer/REQUEST_LIST_SUCCESS', response.data)
  159. }, err => {
  160. console.log(err)
  161. })
  162. },
  163. // 获取服务商客户资料模块客户单个数据
  164. getOnceCusinfo ({commit}, params = {}) {
  165. return this.$http.get('/customer/id', {params})
  166. .then(response => {
  167. commit('customer/REQUEST_DETAILS_SUCCESS', response.data)
  168. }, err => {
  169. console.log(err)
  170. })
  171. },
  172. // 关务部验证获取信息
  173. getguanwuinfo ({commit}, params = {}) {
  174. return this.$http.get('/CommissionSheet/customerhouseValid/ids', {params})
  175. .then(response => {
  176. commit('severSheet/REQUEST_TRUSTEELIST_SUCCESS', response.data)
  177. }, err => {
  178. console.log(err)
  179. })
  180. },
  181. }