user.js 5.4 KB

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