user.js 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  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. update: (data) =>
  33. request2({
  34. url: 'member/user/update',
  35. method: 'PUT',
  36. custom: {
  37. showSuccess: true,
  38. auth: true,
  39. },
  40. data,
  41. }),
  42. // 账号登录
  43. accountLogin: (data) =>
  44. request({
  45. url: '/user/api/user/accountLogin',
  46. method: 'POST',
  47. data,
  48. custom: {
  49. showSuccess: true,
  50. loadingMsg: '登录中',
  51. },
  52. }),
  53. // 短信登录
  54. smsLogin: (data) =>
  55. request({
  56. url: '/user/api/user/smsLogin',
  57. method: 'POST',
  58. data,
  59. custom: {
  60. showSuccess: true,
  61. loadingMsg: '登录中',
  62. },
  63. }),
  64. // 短信注册
  65. smsRegister: (data) =>
  66. request({
  67. url: '/user/api/user/smsRegister',
  68. method: 'POST',
  69. data,
  70. custom: {
  71. showSuccess: true,
  72. loadingMsg: '正在注册',
  73. },
  74. }),
  75. // 绑定、更换手机号
  76. changeMobile: (data) =>
  77. request({
  78. url: '/user/api/user/changeMobile',
  79. method: 'POST',
  80. data,
  81. custom: {
  82. showSuccess: true,
  83. loadingMsg: '验证中',
  84. },
  85. }),
  86. // 更新小程序信息
  87. updateMpUserInfo: (data) =>
  88. request({
  89. url: '/user/api/user/updateMpUserInfo',
  90. method: 'POST',
  91. data,
  92. }),
  93. // 第三方授权信息
  94. thirdOauthInfo: () =>
  95. request({
  96. url: '/user/api/user/thirdOauth',
  97. method: 'GET',
  98. params: {
  99. provider: $platform.provider,
  100. platform: $platform.platform,
  101. },
  102. custom: {
  103. showLoading: false,
  104. },
  105. }),
  106. // 添加分享记录
  107. addShareLog: (data) =>
  108. request({
  109. url: 'share/add',
  110. method: 'POST',
  111. data,
  112. custom: {
  113. showError: false,
  114. },
  115. }),
  116. share: {
  117. list: (params) =>
  118. request({
  119. url: 'share/list',
  120. method: 'GET',
  121. params,
  122. }),
  123. },
  124. // 账号登出
  125. logout: (data) =>
  126. request({
  127. url: '/user/api/user/logout',
  128. method: 'POST',
  129. data,
  130. }),
  131. // 账号注销
  132. logoff: (data) =>
  133. request({
  134. url: '/user/api/user/logoff',
  135. method: 'POST',
  136. data,
  137. }),
  138. address: {
  139. // default: () =>
  140. // request({
  141. // url: 'user/address/default',
  142. // method: 'GET',
  143. // custom: {
  144. // showError: false,
  145. // },
  146. // }),
  147. default: () =>
  148. request2({
  149. url: 'member/address/get-default',
  150. method: 'GET',
  151. custom: {
  152. showError: false,
  153. },
  154. }),
  155. list: () =>
  156. request2({
  157. url: 'member/address/list',
  158. method: 'GET',
  159. custom: {},
  160. }),
  161. create: (data) =>
  162. request2({
  163. url: 'member/address/create',
  164. method: 'POST',
  165. data,
  166. custom: {
  167. showSuccess: true,
  168. },
  169. }),
  170. update: (data) =>
  171. request2({
  172. url: 'member/address/update',
  173. method: 'PUT',
  174. data,
  175. custom: {
  176. showSuccess: true,
  177. },
  178. }),
  179. detail: (id) =>
  180. request2({
  181. url: 'member/address/get?id=' + id,
  182. method: 'GET',
  183. }),
  184. delete: (id) =>
  185. request2({
  186. url: 'member/address/delete?id=' + id,
  187. method: 'DELETE',
  188. }),
  189. },
  190. favorite: {
  191. list: (params) =>
  192. request2({
  193. url: 'product/favorite/page',
  194. method: 'GET',
  195. params,
  196. }),
  197. do: (id) =>
  198. request({
  199. url: 'user/goodsLog/favorite',
  200. method: 'POST',
  201. data: {
  202. goods_id: id,
  203. },
  204. custom: {
  205. showSuccess: true,
  206. auth: true,
  207. },
  208. }),
  209. // 取消收藏
  210. cancel: (id) =>
  211. request2({
  212. url: 'product/favorite/delete-list',
  213. method: 'DELETE',
  214. data: {
  215. spuIds: id.split(',').map(item => item * 1),
  216. // spuIds: id.split(',').join(','),
  217. },
  218. custom: {
  219. showSuccess: true,
  220. auth: true,
  221. },
  222. }),
  223. // cancel: (id) =>
  224. // request({
  225. // url: 'user/goodsLog/favorite',
  226. // method: 'POST',
  227. // data: {
  228. // goods_ids: id,
  229. // },
  230. // custom: {
  231. // showSuccess: true,
  232. // auth: true,
  233. // },
  234. // }),
  235. },
  236. view: {
  237. list: (params) =>
  238. request({
  239. url: 'user/goodsLog/views',
  240. method: 'GET',
  241. params,
  242. custom: {},
  243. }),
  244. delete: (data) =>
  245. request({
  246. url: 'user/goodsLog/viewDel',
  247. method: 'DELETE',
  248. data,
  249. custom: {
  250. showSuccess: true,
  251. },
  252. }),
  253. },
  254. wallet: {
  255. log: (params) =>
  256. request2({
  257. // url: 'member/point/record/page',
  258. url: 'pay/wallet-transaction/page',
  259. method: 'GET',
  260. params,
  261. custom: {},
  262. }),
  263. log2: (params) =>
  264. request2({
  265. url: 'member/point/record/page',
  266. // url: 'pay/wallet-transaction/page',
  267. method: 'GET',
  268. params,
  269. custom: {},
  270. }),
  271. },
  272. account: {
  273. info: (params) =>
  274. request({
  275. url: 'user/account',
  276. method: 'GET',
  277. params,
  278. custom: {
  279. showError: false,
  280. auth: true,
  281. },
  282. }),
  283. save: (data) =>
  284. request({
  285. url: 'user/account',
  286. method: 'POST',
  287. data,
  288. custom: {
  289. showSuccess: true,
  290. auth: true,
  291. },
  292. }),
  293. },
  294. //数量接口
  295. // data: () =>
  296. // request({
  297. // url: 'user/user/data',
  298. // method: 'GET',
  299. // custom: {
  300. // showLoading: false,
  301. // auth: true,
  302. // },
  303. // }),
  304. data: () =>
  305. request2({
  306. url: 'trade/order/get-count',
  307. method: 'GET',
  308. custom: {
  309. showLoading: false,
  310. auth: true,
  311. },
  312. }),
  313. data2: () =>
  314. request2({
  315. url: 'trade/after-sale/get-applying-count',
  316. method: 'GET',
  317. custom: {
  318. showLoading: false,
  319. auth: true,
  320. },
  321. }),
  322. };