instruement.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. var instrueMent = new Vue({
  2. el:'#instrueMent',
  3. data:{
  4. listLoading:true,
  5. categorylist:[],
  6. hotlist:[],
  7. recommendPage: 1,
  8. floorList: [],
  9. userId:0,
  10. typeSort:'',
  11. moreflag:true,
  12. showflag:false,
  13. params:{
  14. pageId:'',
  15. userId:'',
  16. source:1
  17. },
  18. },
  19. computed:{
  20. },
  21. filters:{
  22. NumFormat:function(value) {//处理金额
  23. return Number(value).toFixed(2);
  24. },
  25. },
  26. methods:{
  27. PromotionsFormat:function(promo){//促销活动类型数据处理
  28. if(promo!=null){
  29. if(promo.type == 1 && promo.mode == 1){
  30. return true
  31. }else{
  32. return false
  33. }
  34. }
  35. return false
  36. },
  37. closeup:function(){
  38. this.showflag = false;
  39. document.body.style.overflow='';
  40. },
  41. showNav:function(){
  42. var _this = this;
  43. _this.showflag = !_this.showflag;
  44. if (_this.showflag){
  45. document.body.style.overflow='hidden';
  46. }else {
  47. document.body.style.overflow='';
  48. }
  49. },
  50. toserch:function(item){
  51. window.location.href='/product/instruelist.html?bigTypeID='+item.bigTypeID+'&typeSort='+this.typeSort
  52. },
  53. seeMore:function(page){
  54. page.isPageMore = true;
  55. },
  56. GetHomeFloorData: function(){
  57. var _self = this;
  58. ProductApi.GethomeData(_self.params,function (res) {
  59. if (res.code == 0 ) {
  60. _self.hotlist = res.data.hotSearchList;
  61. _self.floorList = res.data.floorList;
  62. _self.typeSort = res.data.page.typeSort;
  63. _self.listLoading =false;
  64. _self.SwiperNanner();
  65. _self.getClassify();
  66. }else {
  67. CAIMEI.Alert(res.msg, '确定');
  68. }
  69. })
  70. },
  71. getClassify: function() {
  72. var _self = this;
  73. PublicApi.GetProductClassify({typeSort:_self.typeSort, source: 'www'}, function (res) {
  74. if (res.code == 0) {
  75. _self.categorylist = res.data;
  76. } else {
  77. CAIMEI.Alert(res.msg, '确定', false);
  78. }
  79. })
  80. },
  81. SwiperNanner: function(){
  82. setTimeout(function(){
  83. // 图片懒加载
  84. $("img[data-original]").lazyload();
  85. },500);
  86. setTimeout(function(){
  87. if (isPC) {
  88. $('#recommendBox').slide({
  89. mainCell:".swiper-wrapper"
  90. ,titCell:".swiper-pagination span"
  91. ,effect: "leftLoop"
  92. ,interTime: 3000
  93. ,autoPlay: true
  94. ,scroll:5
  95. ,vis:5
  96. });
  97. } else {
  98. var swiper = new Swiper('#recommendBox', {
  99. slidesPerView: 2,
  100. slidesPerColumn: 2,
  101. spaceBetween: 0,
  102. slidesPerGroup: 2,
  103. autoplay: {
  104. delay: 3000,
  105. disableOnInteraction: false
  106. },
  107. pagination: {
  108. el: '.swiper-pagination'
  109. }
  110. });
  111. }
  112. },500);
  113. },
  114. },
  115. created: function() {
  116. var userInfo = localStorage.getItem('userInfo');
  117. if(userInfo){
  118. this.params.userId = JSON.parse(userInfo).userId;
  119. }
  120. this.params.pageId = getUrlParam('id');
  121. this.GetHomeFloorData();
  122. },
  123. })