user.js 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378
  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. changePassword: (data) =>
  96. request({
  97. url: '/user/api/user/changePassword',
  98. method: 'POST',
  99. data,
  100. custom: {
  101. showSuccess: true,
  102. loadingMsg: '验证中',
  103. },
  104. }),
  105. // 绑定、更换手机号
  106. changeMobile: (data) =>
  107. request({
  108. url: '/user/api/user/changeMobile',
  109. method: 'POST',
  110. data,
  111. custom: {
  112. showSuccess: true,
  113. loadingMsg: '验证中',
  114. },
  115. }),
  116. // 修改用户名
  117. changeUsername: (data) =>
  118. request({
  119. url: '/user/api/user/changeUsername',
  120. method: 'POST',
  121. data,
  122. custom: {
  123. showSuccess: true,
  124. loadingMsg: '验证中',
  125. },
  126. }),
  127. // 更新小程序信息
  128. updateMpUserInfo: (data) =>
  129. request({
  130. url: '/user/api/user/updateMpUserInfo',
  131. method: 'POST',
  132. data,
  133. }),
  134. // 第三方授权信息
  135. thirdOauthInfo: () =>
  136. request({
  137. url: '/user/api/user/thirdOauth',
  138. method: 'GET',
  139. params: {
  140. provider: $platform.provider,
  141. platform: $platform.platform,
  142. },
  143. custom: {
  144. showLoading: false,
  145. },
  146. }),
  147. // 添加分享记录
  148. addShareLog: (data) =>
  149. request({
  150. url: 'share/add',
  151. method: 'POST',
  152. data,
  153. custom: {
  154. showError: false,
  155. },
  156. }),
  157. share: {
  158. list: (params) =>
  159. request({
  160. url: 'share/list',
  161. method: 'GET',
  162. params,
  163. }),
  164. },
  165. // 账号登出
  166. logout: (data) =>
  167. request({
  168. url: '/user/api/user/logout',
  169. method: 'POST',
  170. data,
  171. }),
  172. // 账号注销
  173. logoff: (data) =>
  174. request({
  175. url: '/user/api/user/logoff',
  176. method: 'POST',
  177. data,
  178. }),
  179. address: {
  180. // default: () =>
  181. // request({
  182. // url: 'user/address/default',
  183. // method: 'GET',
  184. // custom: {
  185. // showError: false,
  186. // },
  187. // }),
  188. default: () =>
  189. request2({
  190. url: 'member/address/get-default',
  191. method: 'GET',
  192. custom: {
  193. showError: false,
  194. },
  195. }),
  196. list: () =>
  197. request2({
  198. url: 'member/address/list',
  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. update: (data) =>
  212. request2({
  213. url: 'member/address/update',
  214. method: 'PUT',
  215. data,
  216. custom: {
  217. showSuccess: true,
  218. },
  219. }),
  220. detail: (id) =>
  221. request2({
  222. url: 'member/address/get?id=' + id,
  223. method: 'GET',
  224. }),
  225. delete: (id) =>
  226. request2({
  227. url: 'member/address/delete?id=' + id,
  228. method: 'DELETE',
  229. }),
  230. },
  231. favorite: {
  232. list: (params) =>
  233. request2({
  234. url: 'product/favorite/page',
  235. method: 'GET',
  236. params,
  237. }),
  238. do: (id) =>
  239. request({
  240. url: 'user/goodsLog/favorite',
  241. method: 'POST',
  242. data: {
  243. goods_id: id,
  244. },
  245. custom: {
  246. showSuccess: true,
  247. auth: true,
  248. },
  249. }),
  250. // 取消收藏
  251. cancel: (id) =>
  252. request2({
  253. url: 'product/favorite/delete-list',
  254. method: 'DELETE',
  255. data: {
  256. spuIds: id.split(',').map(item => item * 1),
  257. // spuIds: id.split(',').join(','),
  258. },
  259. custom: {
  260. showSuccess: true,
  261. auth: true,
  262. },
  263. }),
  264. // cancel: (id) =>
  265. // request({
  266. // url: 'user/goodsLog/favorite',
  267. // method: 'POST',
  268. // data: {
  269. // goods_ids: id,
  270. // },
  271. // custom: {
  272. // showSuccess: true,
  273. // auth: true,
  274. // },
  275. // }),
  276. },
  277. view: {
  278. list: (params) =>
  279. request({
  280. url: 'user/goodsLog/views',
  281. method: 'GET',
  282. params,
  283. custom: {},
  284. }),
  285. delete: (data) =>
  286. request({
  287. url: 'user/goodsLog/viewDel',
  288. method: 'DELETE',
  289. data,
  290. custom: {
  291. showSuccess: true,
  292. },
  293. }),
  294. },
  295. wallet: {
  296. log: (params) =>
  297. request2({
  298. // url: 'member/point/record/page',
  299. url: 'pay/wallet-transaction/page',
  300. method: 'GET',
  301. params,
  302. custom: {},
  303. }),
  304. log2: (params) =>
  305. request2({
  306. url: 'member/point/record/page',
  307. // url: 'pay/wallet-transaction/page',
  308. method: 'GET',
  309. params,
  310. custom: {},
  311. }),
  312. // log: (params) =>
  313. // request({
  314. // url: '/user/api/walletLog',
  315. // method: 'GET',
  316. // params,
  317. // custom: {},
  318. // }),
  319. },
  320. account: {
  321. info: (params) =>
  322. request({
  323. url: 'user/account',
  324. method: 'GET',
  325. params,
  326. custom: {
  327. showError: false,
  328. auth: true,
  329. },
  330. }),
  331. save: (data) =>
  332. request({
  333. url: 'user/account',
  334. method: 'POST',
  335. data,
  336. custom: {
  337. showSuccess: true,
  338. auth: true,
  339. },
  340. }),
  341. },
  342. //数量接口
  343. // data: () =>
  344. // request({
  345. // url: 'user/user/data',
  346. // method: 'GET',
  347. // custom: {
  348. // showLoading: false,
  349. // auth: true,
  350. // },
  351. // }),
  352. data: () =>
  353. request2({
  354. url: 'trade/order/get-count',
  355. method: 'GET',
  356. custom: {
  357. showLoading: false,
  358. auth: true,
  359. },
  360. }),
  361. data2: () =>
  362. request2({
  363. url: 'trade/after-sale/get-applying-count',
  364. method: 'GET',
  365. custom: {
  366. showLoading: false,
  367. auth: true,
  368. },
  369. }),
  370. };