user.js 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433
  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. list: () =>
  191. request2({
  192. url: 'member/address/list',
  193. method: 'GET',
  194. custom: {},
  195. }),
  196. // list: () =>
  197. // request({
  198. // url: 'user/address',
  199. // method: 'GET',
  200. // custom: {},
  201. // }),
  202. create: (data) =>
  203. request2({
  204. url: 'member/address/create',
  205. method: 'POST',
  206. data,
  207. custom: {
  208. showSuccess: true,
  209. },
  210. }),
  211. // create: (data) =>
  212. // request({
  213. // url: 'user/address',
  214. // method: 'POST',
  215. // data,
  216. // custom: {
  217. // showSuccess: true,
  218. // },
  219. // }),
  220. update: ( data) =>
  221. request2({
  222. url: 'member/address/update',
  223. method: 'PUT',
  224. data,
  225. custom: {
  226. showSuccess: true,
  227. },
  228. }),
  229. // update: (id, data) =>
  230. // request({
  231. // url: 'user/address/' + id,
  232. // method: 'PUT',
  233. // data,
  234. // custom: {
  235. // showSuccess: true,
  236. // },
  237. // }),
  238. detail: (id) =>
  239. request2({
  240. url: 'member/address/get?id=' + id,
  241. method: 'GET',
  242. }),
  243. // detail: (id) =>
  244. // request({
  245. // url: 'user/address/' + id,
  246. // method: 'GET',
  247. // }),
  248. delete: (id) =>
  249. request2({
  250. url: 'member/address/delete?id=' + id,
  251. method: 'DELETE',
  252. }),
  253. // delete: (id) =>
  254. // request({
  255. // url: 'user/address/' + id,
  256. // method: 'DELETE',
  257. // }),
  258. },
  259. invoice: {
  260. list: () =>
  261. request({
  262. url: 'user/invoice',
  263. method: 'GET',
  264. custom: {},
  265. }),
  266. create: (data) =>
  267. request({
  268. url: 'user/invoice',
  269. method: 'POST',
  270. data,
  271. custom: {
  272. showSuccess: true,
  273. },
  274. }),
  275. update: (id, data) =>
  276. request({
  277. url: 'user/invoice/' + id,
  278. method: 'PUT',
  279. data,
  280. custom: {
  281. showSuccess: true,
  282. },
  283. }),
  284. detail: (id) =>
  285. request({
  286. url: 'user/invoice/' + id,
  287. method: 'GET',
  288. }),
  289. delete: (id) =>
  290. request({
  291. url: 'user/invoice/' + id,
  292. method: 'DELETE',
  293. }),
  294. },
  295. favorite: {
  296. list: (params) =>
  297. request2({
  298. url: 'product/favorite/page',
  299. method: 'GET',
  300. params,
  301. }),
  302. do: (id) =>
  303. request({
  304. url: 'user/goodsLog/favorite',
  305. method: 'POST',
  306. data: {
  307. goods_id: id,
  308. },
  309. custom: {
  310. showSuccess: true,
  311. auth: true,
  312. },
  313. }),
  314. // 取消收藏
  315. cancel: (id) =>
  316. request2({
  317. url: 'product/favorite/delete-list',
  318. method: 'DELETE',
  319. data: {
  320. spuIds: id.split(',').map(item=>item*1),
  321. // spuIds: id.split(',').join(','),
  322. },
  323. custom: {
  324. showSuccess: true,
  325. auth: true,
  326. },
  327. }),
  328. // cancel: (id) =>
  329. // request({
  330. // url: 'user/goodsLog/favorite',
  331. // method: 'POST',
  332. // data: {
  333. // goods_ids: id,
  334. // },
  335. // custom: {
  336. // showSuccess: true,
  337. // auth: true,
  338. // },
  339. // }),
  340. },
  341. view: {
  342. list: (params) =>
  343. request({
  344. url: 'user/goodsLog/views',
  345. method: 'GET',
  346. params,
  347. custom: {},
  348. }),
  349. delete: (data) =>
  350. request({
  351. url: 'user/goodsLog/viewDel',
  352. method: 'DELETE',
  353. data,
  354. custom: {
  355. showSuccess: true,
  356. },
  357. }),
  358. },
  359. wallet: {
  360. log: (params) =>
  361. request2({
  362. url: 'pay/wallet-transaction/page',
  363. method: 'GET',
  364. params,
  365. custom: {},
  366. }),
  367. // log: (params) =>
  368. // request({
  369. // url: '/user/api/walletLog',
  370. // method: 'GET',
  371. // params,
  372. // custom: {},
  373. // }),
  374. },
  375. account: {
  376. info: (params) =>
  377. request({
  378. url: 'user/account',
  379. method: 'GET',
  380. params,
  381. custom: {
  382. showError: false,
  383. auth: true,
  384. },
  385. }),
  386. save: (data) =>
  387. request({
  388. url: 'user/account',
  389. method: 'POST',
  390. data,
  391. custom: {
  392. showSuccess: true,
  393. auth: true,
  394. },
  395. }),
  396. },
  397. //数量接口
  398. // data: () =>
  399. // request({
  400. // url: 'user/user/data',
  401. // method: 'GET',
  402. // custom: {
  403. // showLoading: false,
  404. // auth: true,
  405. // },
  406. // }),
  407. data: () =>
  408. request2({
  409. url: 'trade/order/get-count',
  410. method: 'GET',
  411. custom: {
  412. showLoading: false,
  413. auth: true,
  414. },
  415. }),
  416. data2: () =>
  417. request2({
  418. url: 'trade/after-sale/get-applying-count',
  419. method: 'GET',
  420. custom: {
  421. showLoading: false,
  422. auth: true,
  423. },
  424. }),
  425. };