goods-detail.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. var app = new Vue({
  2. el: '#app',
  3. data: {
  4. submitStatus: false,
  5. // 幻灯片列表
  6. advertList: [],
  7. // 资讯列表
  8. noticeList: [],
  9. // 详情
  10. info: {},
  11. },
  12. created: function () {
  13. this.getInfo();
  14. },
  15. updated: function(){
  16. // 顶部轮播图
  17. var mySwiper = new Swiper ('.swiper-container', {
  18. // 如果需要分页器
  19. autoplay:true,
  20. pagination: {
  21. el: '.swiper-pagination'
  22. }
  23. });
  24. },
  25. methods: {
  26. // 获取用户信息
  27. getInfo: function(){
  28. var _this = this;
  29. var id = getParam('id');
  30. $.showLoading("数据加载中");
  31. $.post('/weixin/goods/getInfo', {id: id}, function (res) {
  32. $.hideLoading();
  33. if (res.code == 'success') {
  34. _this.info = res.data
  35. }else if(res.code == 'login'){
  36. login(res.data.url);
  37. }else{
  38. $.toast(res.message, 'text');
  39. }
  40. }, "json");
  41. }
  42. }
  43. });