user.js 7.0 KB

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