user.js 7.2 KB

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