user.js 7.9 KB

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