user.js 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381
  1. import request from '@/sheep/request';
  2. import $platform from '@/sheep/platform';
  3. export default {
  4. getUnused: () =>
  5. request({
  6. url: '/app-api/promotion/coupon/get-unused-count',
  7. method: 'GET',
  8. custom: {
  9. showLoading: false,
  10. auth: true,
  11. },
  12. }),
  13. profile: () =>
  14. request({
  15. url: '/app-api/member/user/get',
  16. method: 'GET',
  17. custom: {
  18. showLoading: false,
  19. auth: true,
  20. },
  21. }),
  22. balance: () =>
  23. request({
  24. url: '/app-api/pay/wallet/get',
  25. method: 'GET',
  26. custom: {
  27. showLoading: false,
  28. auth: true,
  29. },
  30. }),
  31. update: (data) =>
  32. request({
  33. url: '/app-api/member/user/update',
  34. method: 'PUT',
  35. custom: {
  36. showSuccess: true,
  37. auth: true,
  38. },
  39. data,
  40. }),
  41. // 账号登录
  42. accountLogin: (data) =>
  43. request({
  44. url: '/user/api/user/accountLogin',
  45. method: 'POST',
  46. data,
  47. custom: {
  48. showSuccess: true,
  49. loadingMsg: '登录中',
  50. },
  51. }),
  52. // 短信登录
  53. smsLogin: (data) =>
  54. request({
  55. url: '/user/api/user/smsLogin',
  56. method: 'POST',
  57. data,
  58. custom: {
  59. showSuccess: true,
  60. loadingMsg: '登录中',
  61. },
  62. }),
  63. // 短信注册
  64. smsRegister: (data) =>
  65. request({
  66. url: '/user/api/user/smsRegister',
  67. method: 'POST',
  68. data,
  69. custom: {
  70. showSuccess: true,
  71. loadingMsg: '正在注册',
  72. },
  73. }),
  74. // 重置密码
  75. resetPassword: (data) =>
  76. request({
  77. url: '/user/api/user/resetPassword',
  78. method: 'POST',
  79. data,
  80. custom: {
  81. showSuccess: true,
  82. loadingMsg: '验证中',
  83. },
  84. }),
  85. // 修改密码
  86. changePassword: (data) =>
  87. request({
  88. url: '/user/api/user/changePassword',
  89. method: 'POST',
  90. data,
  91. custom: {
  92. showSuccess: true,
  93. loadingMsg: '验证中',
  94. },
  95. }),
  96. // 绑定、更换手机号
  97. changeMobile: (data) =>
  98. request({
  99. url: '/user/api/user/changeMobile',
  100. method: 'POST',
  101. data,
  102. custom: {
  103. showSuccess: true,
  104. loadingMsg: '验证中',
  105. },
  106. }),
  107. // 修改用户名
  108. changeUsername: (data) =>
  109. request({
  110. url: '/user/api/user/changeUsername',
  111. method: 'POST',
  112. data,
  113. custom: {
  114. showSuccess: true,
  115. loadingMsg: '验证中',
  116. },
  117. }),
  118. // 更新小程序信息
  119. updateMpUserInfo: (data) =>
  120. request({
  121. url: '/user/api/user/updateMpUserInfo',
  122. method: 'POST',
  123. data,
  124. }),
  125. // 第三方授权信息
  126. thirdOauthInfo: () =>
  127. request({
  128. url: '/user/api/user/thirdOauth',
  129. method: 'GET',
  130. params: {
  131. provider: $platform.provider,
  132. platform: $platform.platform,
  133. },
  134. custom: {
  135. showLoading: false,
  136. },
  137. }),
  138. // 添加分享记录
  139. addShareLog: (data) =>
  140. request({
  141. url: 'share/add',
  142. method: 'POST',
  143. data,
  144. custom: {
  145. showError: false,
  146. },
  147. }),
  148. share: {
  149. list: (params) =>
  150. request({
  151. url: 'share/list',
  152. method: 'GET',
  153. params,
  154. }),
  155. },
  156. // 账号登出
  157. logout: (data) =>
  158. request({
  159. url: '/user/api/user/logout',
  160. method: 'POST',
  161. data,
  162. }),
  163. // 账号注销
  164. logoff: (data) =>
  165. request({
  166. url: '/user/api/user/logoff',
  167. method: 'POST',
  168. data,
  169. }),
  170. address: {
  171. default: () =>
  172. request({
  173. url: '/app-api/member/address/get-default',
  174. method: 'GET',
  175. custom: {
  176. showError: false,
  177. },
  178. }),
  179. list: () =>
  180. request({
  181. url: '/app-api/member/address/list',
  182. method: 'GET',
  183. custom: {},
  184. }),
  185. create: (data) =>
  186. request({
  187. url: '/app-api/member/address/create',
  188. method: 'POST',
  189. data,
  190. custom: {
  191. showSuccess: true,
  192. },
  193. }),
  194. update: (data) =>
  195. request({
  196. url: '/app-api/member/address/update',
  197. method: 'PUT',
  198. data,
  199. custom: {
  200. showSuccess: true,
  201. },
  202. }),
  203. detail: (id) =>
  204. request({
  205. url: '/app-api/member/address/get?id=' + id,
  206. method: 'GET',
  207. }),
  208. delete: (id) =>
  209. request({
  210. url: '/app-api/member/address/delete?id=' + id,
  211. method: 'DELETE',
  212. }),
  213. },
  214. invoice: {
  215. list: () =>
  216. request({
  217. url: 'user/invoice',
  218. method: 'GET',
  219. custom: {},
  220. }),
  221. create: (data) =>
  222. request({
  223. url: 'user/invoice',
  224. method: 'POST',
  225. data,
  226. custom: {
  227. showSuccess: true,
  228. },
  229. }),
  230. update: (id, data) =>
  231. request({
  232. url: 'user/invoice/' + id,
  233. method: 'PUT',
  234. data,
  235. custom: {
  236. showSuccess: true,
  237. },
  238. }),
  239. detail: (id) =>
  240. request({
  241. url: 'user/invoice/' + id,
  242. method: 'GET',
  243. }),
  244. delete: (id) =>
  245. request({
  246. url: 'user/invoice/' + id,
  247. method: 'DELETE',
  248. }),
  249. },
  250. favorite: {
  251. list: (params) =>
  252. request({
  253. url: '/app-api/product/favorite/page',
  254. method: 'GET',
  255. params,
  256. }),
  257. do: (id) =>
  258. request({
  259. url: '/app-api/product/favorite/create',
  260. method: 'POST',
  261. data: {
  262. spuId: id,
  263. },
  264. custom: {
  265. showSuccess: true,
  266. auth: true,
  267. },
  268. }),
  269. dos: (id) =>
  270. request({
  271. url: '/app-api/product/favorite/delete',
  272. method: 'DELETE',
  273. data: {
  274. spuId: id,
  275. },
  276. custom: {
  277. showSuccess: true,
  278. auth: true,
  279. },
  280. }),
  281. // 取消收藏
  282. cancel: (id) =>
  283. request({
  284. url: '/app-api/product/favorite/delete-list',
  285. method: 'DELETE',
  286. data: {
  287. spuIds: id.split(',').map(item => item * 1),
  288. // spuIds: id.split(',').join(','),
  289. },
  290. custom: {
  291. showSuccess: true,
  292. auth: true,
  293. },
  294. }),
  295. },
  296. view: {
  297. list: (params) =>
  298. request({
  299. url: 'user/goodsLog/views',
  300. method: 'GET',
  301. params,
  302. custom: {},
  303. }),
  304. delete: (data) =>
  305. request({
  306. url: 'user/goodsLog/viewDel',
  307. method: 'DELETE',
  308. data,
  309. custom: {
  310. showSuccess: true,
  311. },
  312. }),
  313. },
  314. wallet: {
  315. log: (params) =>
  316. request({
  317. // url: 'member/point/record/page',
  318. url: '/app-api/pay/wallet-transaction/page',
  319. method: 'GET',
  320. params,
  321. custom: {},
  322. }),
  323. log2: (params) =>
  324. request({
  325. url: '/app-api/member/point/record/page',
  326. // url: 'pay/wallet-transaction/page',
  327. method: 'GET',
  328. params,
  329. custom: {},
  330. }),
  331. },
  332. account: {
  333. info: (params) =>
  334. request({
  335. url: 'user/account',
  336. method: 'GET',
  337. params,
  338. custom: {
  339. showError: false,
  340. auth: true,
  341. },
  342. }),
  343. save: (data) =>
  344. request({
  345. url: 'user/account',
  346. method: 'POST',
  347. data,
  348. custom: {
  349. showSuccess: true,
  350. auth: true,
  351. },
  352. }),
  353. },
  354. //数量接口
  355. data: () =>
  356. request({
  357. url: '/app-api/trade/order/get-count',
  358. method: 'GET',
  359. custom: {
  360. showLoading: false,
  361. auth: true,
  362. },
  363. }),
  364. data2: () =>
  365. request({
  366. url: '/app-api/trade/after-sale/get-applying-count',
  367. method: 'GET',
  368. custom: {
  369. showLoading: false,
  370. auth: true,
  371. },
  372. }),
  373. };