user.js 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441
  1. import request from '@/sheep/request';
  2. import request2 from '@/sheep/request2';
  3. import $platform from '@/sheep/platform';
  4. export default {
  5. profile: () =>
  6. request2({
  7. url: 'member/user/get',
  8. method: 'GET',
  9. custom: {
  10. showLoading: false,
  11. auth: true,
  12. },
  13. }),
  14. balance: () =>
  15. request2({
  16. url: '/app-api/pay/wallet/get',
  17. method: 'GET',
  18. custom: {
  19. showLoading: false,
  20. auth: true,
  21. },
  22. }),
  23. // profile: () =>
  24. // request({
  25. // url: '/user/api/user/profile',
  26. // method: 'GET',
  27. // custom: {
  28. // showLoading: false,
  29. // auth: true,
  30. // },
  31. // }),
  32. // update: (data) =>
  33. // request({
  34. // url: '/user/api/user/update',
  35. // method: 'POST',
  36. // custom: {
  37. // showSuccess: true,
  38. // auth: true,
  39. // },
  40. // data,
  41. // }),
  42. update: (data) =>
  43. request2({
  44. url: 'member/user/update',
  45. method: 'PUT',
  46. custom: {
  47. showSuccess: true,
  48. auth: true,
  49. },
  50. data,
  51. }),
  52. // 账号登录
  53. accountLogin: (data) =>
  54. request({
  55. url: '/user/api/user/accountLogin',
  56. method: 'POST',
  57. data,
  58. custom: {
  59. showSuccess: true,
  60. loadingMsg: '登录中',
  61. },
  62. }),
  63. // 短信登录
  64. smsLogin: (data) =>
  65. request({
  66. url: '/user/api/user/smsLogin',
  67. method: 'POST',
  68. data,
  69. custom: {
  70. showSuccess: true,
  71. loadingMsg: '登录中',
  72. },
  73. }),
  74. // 短信注册
  75. smsRegister: (data) =>
  76. request({
  77. url: '/user/api/user/smsRegister',
  78. method: 'POST',
  79. data,
  80. custom: {
  81. showSuccess: true,
  82. loadingMsg: '正在注册',
  83. },
  84. }),
  85. // 重置密码
  86. resetPassword: (data) =>
  87. request({
  88. url: '/user/api/user/resetPassword',
  89. method: 'POST',
  90. data,
  91. custom: {
  92. showSuccess: true,
  93. loadingMsg: '验证中',
  94. },
  95. }),
  96. // 修改密码
  97. changePassword: (data) =>
  98. request({
  99. url: '/user/api/user/changePassword',
  100. method: 'POST',
  101. data,
  102. custom: {
  103. showSuccess: true,
  104. loadingMsg: '验证中',
  105. },
  106. }),
  107. // 绑定、更换手机号
  108. changeMobile: (data) =>
  109. request({
  110. url: '/user/api/user/changeMobile',
  111. method: 'POST',
  112. data,
  113. custom: {
  114. showSuccess: true,
  115. loadingMsg: '验证中',
  116. },
  117. }),
  118. // 修改用户名
  119. changeUsername: (data) =>
  120. request({
  121. url: '/user/api/user/changeUsername',
  122. method: 'POST',
  123. data,
  124. custom: {
  125. showSuccess: true,
  126. loadingMsg: '验证中',
  127. },
  128. }),
  129. // 更新小程序信息
  130. updateMpUserInfo: (data) =>
  131. request({
  132. url: '/user/api/user/updateMpUserInfo',
  133. method: 'POST',
  134. data,
  135. }),
  136. // 第三方授权信息
  137. thirdOauthInfo: () =>
  138. request({
  139. url: '/user/api/user/thirdOauth',
  140. method: 'GET',
  141. params: {
  142. provider: $platform.provider,
  143. platform: $platform.platform,
  144. },
  145. custom: {
  146. showLoading: false,
  147. },
  148. }),
  149. // 添加分享记录
  150. addShareLog: (data) =>
  151. request({
  152. url: 'share/add',
  153. method: 'POST',
  154. data,
  155. custom: {
  156. showError: false,
  157. },
  158. }),
  159. share: {
  160. list: (params) =>
  161. request({
  162. url: 'share/list',
  163. method: 'GET',
  164. params,
  165. }),
  166. },
  167. // 账号登出
  168. logout: (data) =>
  169. request({
  170. url: '/user/api/user/logout',
  171. method: 'POST',
  172. data,
  173. }),
  174. // 账号注销
  175. logoff: (data) =>
  176. request({
  177. url: '/user/api/user/logoff',
  178. method: 'POST',
  179. data,
  180. }),
  181. address: {
  182. // default: () =>
  183. // request({
  184. // url: 'user/address/default',
  185. // method: 'GET',
  186. // custom: {
  187. // showError: false,
  188. // },
  189. // }),
  190. default: () =>
  191. request2({
  192. url: 'member/address/get-default',
  193. method: 'GET',
  194. custom: {
  195. showError: false,
  196. },
  197. }),
  198. list: () =>
  199. request2({
  200. url: 'member/address/list',
  201. method: 'GET',
  202. custom: {},
  203. }),
  204. // list: () =>
  205. // request({
  206. // url: 'user/address',
  207. // method: 'GET',
  208. // custom: {},
  209. // }),
  210. create: (data) =>
  211. request2({
  212. url: 'member/address/create',
  213. method: 'POST',
  214. data,
  215. custom: {
  216. showSuccess: true,
  217. },
  218. }),
  219. // create: (data) =>
  220. // request({
  221. // url: 'user/address',
  222. // method: 'POST',
  223. // data,
  224. // custom: {
  225. // showSuccess: true,
  226. // },
  227. // }),
  228. update: (data) =>
  229. request2({
  230. url: 'member/address/update',
  231. method: 'PUT',
  232. data,
  233. custom: {
  234. showSuccess: true,
  235. },
  236. }),
  237. // update: (id, data) =>
  238. // request({
  239. // url: 'user/address/' + id,
  240. // method: 'PUT',
  241. // data,
  242. // custom: {
  243. // showSuccess: true,
  244. // },
  245. // }),
  246. detail: (id) =>
  247. request2({
  248. url: 'member/address/get?id=' + id,
  249. method: 'GET',
  250. }),
  251. // detail: (id) =>
  252. // request({
  253. // url: 'user/address/' + id,
  254. // method: 'GET',
  255. // }),
  256. delete: (id) =>
  257. request2({
  258. url: 'member/address/delete?id=' + id,
  259. method: 'DELETE',
  260. }),
  261. // delete: (id) =>
  262. // request({
  263. // url: 'user/address/' + id,
  264. // method: 'DELETE',
  265. // }),
  266. },
  267. invoice: {
  268. list: () =>
  269. request({
  270. url: 'user/invoice',
  271. method: 'GET',
  272. custom: {},
  273. }),
  274. create: (data) =>
  275. request({
  276. url: 'user/invoice',
  277. method: 'POST',
  278. data,
  279. custom: {
  280. showSuccess: true,
  281. },
  282. }),
  283. update: (id, data) =>
  284. request({
  285. url: 'user/invoice/' + id,
  286. method: 'PUT',
  287. data,
  288. custom: {
  289. showSuccess: true,
  290. },
  291. }),
  292. detail: (id) =>
  293. request({
  294. url: 'user/invoice/' + id,
  295. method: 'GET',
  296. }),
  297. delete: (id) =>
  298. request({
  299. url: 'user/invoice/' + id,
  300. method: 'DELETE',
  301. }),
  302. },
  303. favorite: {
  304. list: (params) =>
  305. request2({
  306. url: 'product/favorite/page',
  307. method: 'GET',
  308. params,
  309. }),
  310. do: (id) =>
  311. request({
  312. url: 'user/goodsLog/favorite',
  313. method: 'POST',
  314. data: {
  315. goods_id: id,
  316. },
  317. custom: {
  318. showSuccess: true,
  319. auth: true,
  320. },
  321. }),
  322. // 取消收藏
  323. cancel: (id) =>
  324. request2({
  325. url: 'product/favorite/delete-list',
  326. method: 'DELETE',
  327. data: {
  328. spuIds: id.split(',').map(item => item * 1),
  329. // spuIds: id.split(',').join(','),
  330. },
  331. custom: {
  332. showSuccess: true,
  333. auth: true,
  334. },
  335. }),
  336. // cancel: (id) =>
  337. // request({
  338. // url: 'user/goodsLog/favorite',
  339. // method: 'POST',
  340. // data: {
  341. // goods_ids: id,
  342. // },
  343. // custom: {
  344. // showSuccess: true,
  345. // auth: true,
  346. // },
  347. // }),
  348. },
  349. view: {
  350. list: (params) =>
  351. request({
  352. url: 'user/goodsLog/views',
  353. method: 'GET',
  354. params,
  355. custom: {},
  356. }),
  357. delete: (data) =>
  358. request({
  359. url: 'user/goodsLog/viewDel',
  360. method: 'DELETE',
  361. data,
  362. custom: {
  363. showSuccess: true,
  364. },
  365. }),
  366. },
  367. wallet: {
  368. log: (params) =>
  369. request2({
  370. url: 'pay/wallet-transaction/page',
  371. method: 'GET',
  372. params,
  373. custom: {},
  374. }),
  375. // log: (params) =>
  376. // request({
  377. // url: '/user/api/walletLog',
  378. // method: 'GET',
  379. // params,
  380. // custom: {},
  381. // }),
  382. },
  383. account: {
  384. info: (params) =>
  385. request({
  386. url: 'user/account',
  387. method: 'GET',
  388. params,
  389. custom: {
  390. showError: false,
  391. auth: true,
  392. },
  393. }),
  394. save: (data) =>
  395. request({
  396. url: 'user/account',
  397. method: 'POST',
  398. data,
  399. custom: {
  400. showSuccess: true,
  401. auth: true,
  402. },
  403. }),
  404. },
  405. //数量接口
  406. // data: () =>
  407. // request({
  408. // url: 'user/user/data',
  409. // method: 'GET',
  410. // custom: {
  411. // showLoading: false,
  412. // auth: true,
  413. // },
  414. // }),
  415. data: () =>
  416. request2({
  417. url: 'trade/order/get-count',
  418. method: 'GET',
  419. custom: {
  420. showLoading: false,
  421. auth: true,
  422. },
  423. }),
  424. data2: () =>
  425. request2({
  426. url: 'trade/after-sale/get-applying-count',
  427. method: 'GET',
  428. custom: {
  429. showLoading: false,
  430. auth: true,
  431. },
  432. }),
  433. };