user.js 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389
  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. favorite: {
  243. list: (params) =>
  244. request2({
  245. url: 'product/favorite/page',
  246. method: 'GET',
  247. params,
  248. }),
  249. do: (id) =>
  250. request({
  251. url: 'user/goodsLog/favorite',
  252. method: 'POST',
  253. data: {
  254. goods_id: id,
  255. },
  256. custom: {
  257. showSuccess: true,
  258. auth: true,
  259. },
  260. }),
  261. // 取消收藏
  262. cancel: (id) =>
  263. request2({
  264. url: 'product/favorite/delete-list',
  265. method: 'DELETE',
  266. data: {
  267. spuIds: id.split(',').map(item => item * 1),
  268. // spuIds: id.split(',').join(','),
  269. },
  270. custom: {
  271. showSuccess: true,
  272. auth: true,
  273. },
  274. }),
  275. // cancel: (id) =>
  276. // request({
  277. // url: 'user/goodsLog/favorite',
  278. // method: 'POST',
  279. // data: {
  280. // goods_ids: id,
  281. // },
  282. // custom: {
  283. // showSuccess: true,
  284. // auth: true,
  285. // },
  286. // }),
  287. },
  288. view: {
  289. list: (params) =>
  290. request({
  291. url: 'user/goodsLog/views',
  292. method: 'GET',
  293. params,
  294. custom: {},
  295. }),
  296. delete: (data) =>
  297. request({
  298. url: 'user/goodsLog/viewDel',
  299. method: 'DELETE',
  300. data,
  301. custom: {
  302. showSuccess: true,
  303. },
  304. }),
  305. },
  306. wallet: {
  307. log: (params) =>
  308. request2({
  309. // url: 'member/point/record/page',
  310. url: 'pay/wallet-transaction/page',
  311. method: 'GET',
  312. params,
  313. custom: {},
  314. }),
  315. log2: (params) =>
  316. request2({
  317. url: 'member/point/record/page',
  318. // url: 'pay/wallet-transaction/page',
  319. method: 'GET',
  320. params,
  321. custom: {},
  322. }),
  323. // log: (params) =>
  324. // request({
  325. // url: '/user/api/walletLog',
  326. // method: 'GET',
  327. // params,
  328. // custom: {},
  329. // }),
  330. },
  331. account: {
  332. info: (params) =>
  333. request({
  334. url: 'user/account',
  335. method: 'GET',
  336. params,
  337. custom: {
  338. showError: false,
  339. auth: true,
  340. },
  341. }),
  342. save: (data) =>
  343. request({
  344. url: 'user/account',
  345. method: 'POST',
  346. data,
  347. custom: {
  348. showSuccess: true,
  349. auth: true,
  350. },
  351. }),
  352. },
  353. //数量接口
  354. // data: () =>
  355. // request({
  356. // url: 'user/user/data',
  357. // method: 'GET',
  358. // custom: {
  359. // showLoading: false,
  360. // auth: true,
  361. // },
  362. // }),
  363. data: () =>
  364. request2({
  365. url: 'trade/order/get-count',
  366. method: 'GET',
  367. custom: {
  368. showLoading: false,
  369. auth: true,
  370. },
  371. }),
  372. data2: () =>
  373. request2({
  374. url: 'trade/after-sale/get-applying-count',
  375. method: 'GET',
  376. custom: {
  377. showLoading: false,
  378. auth: true,
  379. },
  380. }),
  381. };