user.js 6.0 KB

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