user.js 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637
  1. import request from '@/utils/request'
  2. import qs from 'qs'
  3. import { getToken } from '@/utils/auth'
  4. import { method } from 'lodash';
  5. export const getUsers = (params) => {
  6. return new request({
  7. url: './sys/authUsers',
  8. method: 'get',
  9. params: params
  10. });
  11. }
  12. export const updatePwd = (params, token) => {
  13. return new request({
  14. url: './sys/authUsers/updatePwd',
  15. method: 'post',
  16. headers: {
  17. token
  18. },
  19. data: qs.stringify(Object.assign({
  20. rm: 1,
  21. }, params))
  22. });
  23. }
  24. export const updatePwdLogout = () => {
  25. return new request({
  26. url: './ums/logout',
  27. method: 'delete',
  28. });
  29. }
  30. export const getMenus = () => {
  31. return new request({
  32. url: './sys/menus',
  33. method: 'get',
  34. params: {
  35. applicationId: 2
  36. }
  37. });
  38. }
  39. export const getMyMenuTreeData = () => {
  40. return new request({
  41. url: './sys/menus/myTreeData',
  42. method: 'get',
  43. });
  44. }
  45. export const getChildrenMenuNum = (menuName) => {
  46. return new request({
  47. url: './sys/menus/getChildrenMenuNum',
  48. method: 'get',
  49. params: {
  50. menuName
  51. }
  52. });
  53. }
  54. export const getUserAuthorities = (userId) => {
  55. return new request({
  56. url: './uua/' + userId + '/authorities',
  57. method: 'get',
  58. });
  59. }
  60. export const getEmailCode = (account, email) => {
  61. return new request({
  62. url: './sys/authUsers/emailCode',
  63. method: 'get',
  64. params: {
  65. account,
  66. email
  67. }
  68. });
  69. }
  70. export const getSmsCode = (account, service) => {
  71. return new request({
  72. url: './sys/authUsers/smsCode',
  73. method: 'get',
  74. params: {
  75. account,
  76. service
  77. }
  78. });
  79. }
  80. export const getMobileSmsCode = (mobile, service) => {
  81. return new request({
  82. url: './sys/authUsers/mobile/smsCode',
  83. method: 'get',
  84. params: {
  85. mobile,
  86. service
  87. }
  88. });
  89. }
  90. export const getCaptcha = (uid) => {
  91. if (uid) {
  92. return new request({
  93. url: './sys/captcha',
  94. method: 'get',
  95. headers: {
  96. 'Captcha-Uid': uid
  97. },
  98. responseType: 'blob'
  99. });
  100. } else {
  101. return new request({
  102. url: './sys/captcha',
  103. method: 'get',
  104. responseType: 'blob'
  105. });
  106. }
  107. }
  108. export const getCaptchaNew = (uid) => {
  109. if (uid) {
  110. return new request({
  111. url: './sys/captcha',
  112. method: 'get',
  113. headers: {
  114. 'Captcha-Uid': uid,
  115. 'Captcha-Type': 'number',
  116. },
  117. responseType: 'blob',
  118. });
  119. } else {
  120. return new request({
  121. url: './sys/captcha',
  122. method: 'get',
  123. responseType: 'blob',
  124. headers: {
  125. 'Captcha-Type': 'number',
  126. },
  127. });
  128. }
  129. }
  130. export const resetPwd = (account, newPwd, surePwd, code) => {
  131. return new request({
  132. url: './sys/authUsers/resetPwd',
  133. method: 'post',
  134. data: qs.stringify({
  135. account,
  136. newPwd,
  137. surePwd,
  138. code
  139. })
  140. });
  141. }
  142. export const addToUserGroup = (userUid, groupKey, token) => {
  143. return new request({
  144. url: './sys/authUsers/' + userUid + "/group",
  145. method: 'post',
  146. headers: {
  147. token
  148. },
  149. data: qs.stringify({
  150. groupKey
  151. })
  152. });
  153. }
  154. export const findBasicInfo = () => {
  155. return new request({
  156. url: './uc/userCenter/findBasicInfo',
  157. method: 'get'
  158. });
  159. }
  160. export const findUserInfo = () => {
  161. return new request({
  162. url: './uc/userCenter/userInfo',
  163. method: 'get'
  164. })
  165. }
  166. export const saveUserInfo = (userNickName, basePersonnelInfo) => {
  167. return new request({
  168. url: './uc/userCenter/updateUserInfo',
  169. method: 'post',
  170. data: {
  171. basePersonnelInfo,
  172. userNickName
  173. }
  174. })
  175. }
  176. export const removeFromUserGroup = (userUid, groupKey) => {
  177. return new request({
  178. url: './sys/authUsers/' + userUid + "/group",
  179. method: 'delete',
  180. params: {
  181. groupKey
  182. }
  183. });
  184. }
  185. export function sendTelCode(account, service, language) {
  186. return new request({
  187. url: './ums/umsUsers/registCode',
  188. method: 'get',
  189. headers: {
  190. ANON: true
  191. },
  192. params: {
  193. account,
  194. service,
  195. language
  196. }
  197. });
  198. }
  199. export function registerByTel(umsUser, code, language, registType) {
  200. return new request({
  201. url: './ums/umsUsers/regist',
  202. method: 'post',
  203. headers: {
  204. ANON: true,
  205. "Content-Type": "application/json"
  206. },
  207. data: {
  208. umsUser,
  209. code,
  210. language,
  211. registType
  212. }
  213. })
  214. }
  215. export function checkCodeLogin(mobile, checkCode) {
  216. console.log('mobile,checkCode:', mobile, checkCode)
  217. return new request({
  218. url: './uc/userRegisterAndLogin/checkCodeLogin?mobile=' + mobile + '&checkCode=' + checkCode,
  219. method: 'get'
  220. });
  221. console.log(new request({
  222. url: './uc/userRegisterAndLogin/checkCodeLogin?mobile=' + mobile + '&checkCode=' + checkCode,
  223. method: 'get'
  224. }))
  225. }
  226. export const setPwd = (param) => {
  227. param = JSON.parse(param)
  228. let token = getToken()
  229. param.Authorization = token;
  230. param = JSON.stringify(param);
  231. return new request({
  232. url: './ums/umsUsers/changePassword',
  233. method: 'post',
  234. headers: {
  235. ANON: true
  236. },
  237. data: {
  238. param
  239. }
  240. })
  241. }
  242. export const updatePrsonnelInfo = (umsUser, language) => {
  243. return new request({
  244. url: './uc/userRegisterAndLogin/updatePrsonnelInfo',
  245. method: 'post',
  246. headers: {
  247. ANON: true,
  248. },
  249. data: {
  250. umsUser,
  251. language
  252. }
  253. })
  254. }
  255. export const updateEmail = (email, code) => {
  256. return new request({
  257. url: './uc/securitySetting/updateEmail',
  258. method: 'get',
  259. params: {
  260. email,
  261. code
  262. }
  263. })
  264. }
  265. //根据用户id获取用户信息
  266. export const getUserInfoById = (id) => {
  267. return new request({
  268. url: './uc/securitySetting/getUserInfoById',
  269. method: 'get'
  270. })
  271. }
  272. export const validCheckCode = (mobile, code) => {
  273. return new request({
  274. url: './uc/securitySetting/validCode',
  275. method: 'get',
  276. params: {
  277. mobile,
  278. code
  279. }
  280. })
  281. }
  282. export const updateMobile = (mobile, code) => {
  283. return new request({
  284. url: './uc/securitySetting/updateMobile',
  285. method: 'get',
  286. params: {
  287. mobile,
  288. code
  289. }
  290. })
  291. }
  292. export const saveUserPic = (userPic) => {
  293. return new request({
  294. url: './uc/userCenter/saveUserPic',
  295. method: 'get',
  296. params: {
  297. userPic
  298. }
  299. })
  300. }
  301. export const settingLanguage = (language) => {
  302. return new request({
  303. url: './uc/userCenter/settingLanguage',
  304. method: 'get',
  305. params: {
  306. language
  307. }
  308. })
  309. }
  310. /**
  311. * 用户成长体系
  312. */
  313. // 个人积分
  314. export const getUserPointPage = () => {
  315. return new request({
  316. url: './uc/umsUserPoints/getUserPoint',
  317. method: 'get',
  318. // params: {
  319. // userUid
  320. // }
  321. })
  322. }
  323. // 用户获取任务接口
  324. export const getUserTaskComplete = (language) => {
  325. return new request({
  326. url: './uc/umsUserTasks/getUserTaskComplete',
  327. method: 'get',
  328. })
  329. }
  330. // 用户完成任务获得积分接口
  331. export const addPointDetailByTaskDict = ({ taskDict, point }, token) => {
  332. return new request({
  333. url: './uc/umsUserPointDetailss/addPointDetailByTaskDict',
  334. method: 'post',
  335. data: {
  336. taskDict, point
  337. },
  338. headers: {
  339. token
  340. },
  341. })
  342. }
  343. // 用户签到
  344. export const addSignPointDetail = ({ taskDict, point }, token) => {
  345. return new request({
  346. url: './uc/umsUserPointDetailss/addSignPointDetail',
  347. method: 'post',
  348. data: {
  349. taskDict,
  350. point,
  351. },
  352. headers: {
  353. token
  354. },
  355. })
  356. }
  357. // 积分明细接口
  358. export const getUserPointDetailsPage = (params) => {
  359. return new request({
  360. url: './uc/umsUserPointDetailss/getUserPointDetailsPage',
  361. method: 'get',
  362. params: params
  363. })
  364. }
  365. // 积分兑换商品列表
  366. export const umsPointCommoditys = () => {
  367. return new request({
  368. url: './uc/umsPointCommoditys/commodityList',
  369. method: 'get',
  370. // params: params
  371. })
  372. }
  373. // 下载咨询等扣减积分
  374. export const downloadDeductingIntegral = (params, token) => {
  375. return new request({
  376. url: './uc/umsUserPointDetailss/reducePoint?taskDict=' + params,
  377. method: 'post',
  378. headers: {
  379. token
  380. },
  381. })
  382. }
  383. // 成长值任务列表
  384. export const growthValueTaskList = () => {
  385. return new request({
  386. url: './uc/umsUserGrowthTasks/getUserGrowthTaskComplete',
  387. method: 'get',
  388. // params: params
  389. })
  390. }
  391. // 新增成长值
  392. export const completeGrowthValue = ({ taskDict }, token) => {
  393. return new request({
  394. url: './uc/umsUserGrowthDetailss/addGrowthDetailByTaskDict',
  395. method: 'post',
  396. data: {
  397. taskDict
  398. },
  399. headers: {
  400. token
  401. },
  402. })
  403. }
  404. // 成长值明细
  405. export const getUserGrowthDetails = (params) => {
  406. return new request({
  407. url: './uc/umsUserGrowthDetailss/getGrowthDetailsPage',
  408. method: 'get',
  409. params: params
  410. })
  411. }
  412. // 兑换商品
  413. export const exchangeUserPoints = (data, token) => {
  414. return new request({
  415. url: './uc/umsUserPoints/exchangeUserPoints',
  416. method: 'post',
  417. data: {
  418. umsPointCommodity: data
  419. },
  420. headers: {
  421. token
  422. },
  423. })
  424. }
  425. //支付
  426. export const exchangeUserPointsStatus = (params,userAddressId,token) => {
  427. return new request({
  428. url: './uc/umsUserPoints/exchangeUserPoints',
  429. method: 'post',
  430. data: {
  431. umsPointCommodity:params,
  432. userAddressId,
  433. },
  434. headers: {
  435. token
  436. },
  437. })
  438. }
  439. // 获取省市区
  440. export const getSysAreaList = (params) => {
  441. return new request({
  442. url: './uc/umsUserCommodityAddresss/getSysAreaList',
  443. method: 'get',
  444. params: params
  445. })
  446. }
  447. // 查询地址列表
  448. export const getUmsUserCommodityAddresss = (params) => {
  449. return new request({
  450. url: './uc/umsUserCommodityAddresss',
  451. method: 'get',
  452. params: params
  453. })
  454. }
  455. // 新增修改地址
  456. export const addUmsUserCommodityAddresss = (data, token) => {
  457. return new request({
  458. url: './uc/umsUserCommodityAddresss/saveAddress',
  459. method: 'post',
  460. headers: {
  461. token
  462. },
  463. data: data
  464. })
  465. }
  466. // 修改已有订单的地址
  467. export const modifyAddress = (umsUserCommodityAddress, orderId, token) => {
  468. return new request({
  469. url: './uc/umsUserCommodityAddresss/updateOrderAddress',
  470. method: 'post',
  471. headers: {
  472. token
  473. },
  474. data: { umsUserCommodityAddress, orderId }
  475. })
  476. }
  477. // 删除地址
  478. export const deleteUmsUserCommodityAddresss = (id, token) => {
  479. return new request({
  480. url: './uc/umsUserCommodityAddresss/' + id,
  481. headers: {
  482. token
  483. },
  484. method: 'delete',
  485. });
  486. }
  487. // 获取商品详情
  488. export const getProductDetails = id => {
  489. return new request({
  490. url: './uc/umsPointCommoditys/' + id,
  491. method: 'get',
  492. });
  493. }
  494. // 删除订单
  495. export const deleteOrders = (id, token) => {
  496. return new request({
  497. url: './uc/umsPointCommodityOrders/' + id,
  498. headers: {
  499. token
  500. },
  501. method: 'delete',
  502. });
  503. }
  504. // 订单评论
  505. export const orderReview = (data,orderNo, token) => {
  506. return new request({
  507. url: './uc/umsOrderComments',
  508. method: 'post',
  509. headers: {
  510. token
  511. },
  512. data: { umsOrderComment: data ,
  513. orderNo:orderNo}
  514. })
  515. }
  516. // 获取订单列表
  517. export const toObtainListOrder = (params) => {
  518. return new request({
  519. url: './uc/umsPointCommodityOrders/getMyOrderPage',
  520. method: 'get',
  521. params: params
  522. });
  523. }
  524. // 取消订单
  525. export const cancelGoodsOrders = (id, token) => {
  526. return new request({
  527. url: './uc/umsPointCommodityOrders/cancelOrder?id=' + id,
  528. headers: {
  529. token
  530. },
  531. method: 'post',
  532. });
  533. }
  534. // 订单详情
  535. export const orderDetails = (id) => {
  536. return new request({
  537. url: './uc/umsPointCommodityOrders/getCommodityOrderDetails?orderId=' + id,
  538. method: 'get',
  539. });
  540. }
  541. // 订单确认
  542. export const orderConfirmation = (id, token) => {
  543. return new request({
  544. url: './uc/umsPointCommodityOrders/confirmOrder?id=' + id,
  545. method: 'post',
  546. headers: {
  547. token
  548. },
  549. });
  550. }
  551. // 用户等级
  552. export const getUserLevelList = () => {
  553. return new request({
  554. url: './uc/umsUserGrowthGrades',
  555. method: 'get',
  556. });
  557. }
  558. // 用户权益
  559. export const getUserRightsList = () => {
  560. return new request({
  561. url: './uc/umsUserGrowthRights',
  562. method: 'get',
  563. });
  564. }
  565. // 积分商城个人订单
  566. export const getPersonalOrder = (id) => {
  567. return new request({
  568. url: './uc/umsPointCommoditys/getCommodityOrderByUserId?commodityId=' + id,
  569. method: 'get',
  570. });
  571. }
  572. //支付
  573. export const getMoney = (orderId,payType,token) => {
  574. return new request({
  575. url: './uc/umsUserPoints/userCommonPay' ,
  576. method: 'post',
  577. data:{
  578. orderId:orderId,
  579. payType:payType,
  580. },
  581. headers: {
  582. token
  583. },
  584. });
  585. }
  586. //支付状态
  587. export const getMoneyStatus = (orderNo) => {
  588. return new request({
  589. url: './uc/commonPay/checkUserPayStatus?orderNo=' + orderNo ,
  590. method: 'get',
  591. });
  592. }