|
@@ -1,220 +1,225 @@
|
|
|
-/**
|
|
|
- * Created by xw on 2020/7/22.
|
|
|
- */
|
|
|
-var fleaMarket = new Vue({
|
|
|
- el:"#fleaMarket",
|
|
|
- mixins: [cmSysVitaMixins],
|
|
|
- data: {
|
|
|
- tabIndex:0,
|
|
|
- shopId:'',
|
|
|
- productId: $("#productId").val(),
|
|
|
- isShow:false,
|
|
|
- isRequest:false,
|
|
|
- Showlogo:false,
|
|
|
- detail:{},
|
|
|
- previewBigimage:'',
|
|
|
- previewThumb:[],
|
|
|
- previewParams:[],
|
|
|
- recommdeImage:[],
|
|
|
- userID: GLOBAL_USER_ID,
|
|
|
- HandType:false,
|
|
|
- ShowImage:false,
|
|
|
- recommde:false,
|
|
|
- soldImage:false,
|
|
|
- vShow_brand:false,
|
|
|
- bnameShow:false,
|
|
|
- FlagTwo:false,
|
|
|
- recommdeindex:0,
|
|
|
- current:0,
|
|
|
- },
|
|
|
- computed: {
|
|
|
-
|
|
|
- },
|
|
|
- methods: {
|
|
|
- InfoData: function(){
|
|
|
- var _this = this;
|
|
|
- SecondApi.ProductDetail({productId:_this.productId,userId: _this.userID},function (res) {
|
|
|
- if(res.code==0){
|
|
|
- _this.isRequest =true;
|
|
|
- _this.detail = res.data;
|
|
|
- _this.previewThumb = res.data.imageList;
|
|
|
- _this.previewBigimage =res.data.imageList[0];
|
|
|
- _this.cmSysParams.productId = `${_this.productId}`;
|
|
|
- _this.cmSysParams.pageLabel = `${res.data.brandName}`;
|
|
|
- setTimeout(function(){ // 图片懒加载
|
|
|
- $("img[data-original]").lazyload();
|
|
|
- },500);
|
|
|
- if(_this.userID!=null){
|
|
|
- if(res.data.secondHandType ==2){ //临期产品显示
|
|
|
- _this.HandType =true;
|
|
|
- }else {
|
|
|
- _this.HandType =false;
|
|
|
- }
|
|
|
- }
|
|
|
- if(res.data.showContactFlag!=2){
|
|
|
- _this.ShowImage=true;
|
|
|
- }else {
|
|
|
- _this.ShowImage=false;
|
|
|
- }
|
|
|
- if(res.data.sold == 1){//sold是否出售 0未出售,1已出售
|
|
|
- _this.soldImage = true;
|
|
|
- }else {
|
|
|
- _this.soldImage = false;
|
|
|
- }
|
|
|
- if(res.data.brandName !=''&& res.data.brandName!=null){
|
|
|
- _this.bnameShow = true;
|
|
|
- if(res.data.brandID ==161){
|
|
|
- _this.vShow_brand = true;
|
|
|
- }else {
|
|
|
- _this.vShow_brand = false;
|
|
|
- }
|
|
|
- }else {
|
|
|
- _this.bnameShow = false;
|
|
|
- }
|
|
|
- if (res.data.detailTalkFlag ==1){ //是否详聊 1不开启,2开启
|
|
|
- _this.FlagTwo==true;
|
|
|
- }else {
|
|
|
- _this.FlagTwo==false;
|
|
|
- }
|
|
|
- if(res.data.brandInfo==null||res.data.brandInfo==""){
|
|
|
- _this.Showlogo = false;
|
|
|
- }else {
|
|
|
- _this.Showlogo = true;
|
|
|
- }
|
|
|
- setTimeout(function(){
|
|
|
- if (isPC) {
|
|
|
- var magnifier = new ImageMagnifier(
|
|
|
- '#imgShown #CM____pic_thumb li',
|
|
|
- '#imgShown .bigImage',
|
|
|
- '#imgShown .preview-box',
|
|
|
- '#imgShown .mask',
|
|
|
- '#imgShown .bigitem',
|
|
|
- "on"
|
|
|
- ).init();
|
|
|
- } else {
|
|
|
- var swiper = new Swiper('#swiperImage', {
|
|
|
- loop : true,
|
|
|
- autoplay: {
|
|
|
- delay: 2000,
|
|
|
- disableOnInteraction: false
|
|
|
- },
|
|
|
- pagination: {
|
|
|
- el: '.swiper-pagination',
|
|
|
- type: 'fraction'
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- },500);
|
|
|
- }else {
|
|
|
- _this.isRequest =false;
|
|
|
- window.location.href = "/404.html?error=未查询到该商品";
|
|
|
- }
|
|
|
-
|
|
|
- })
|
|
|
- },
|
|
|
- changeActive:function(){
|
|
|
- var _this = this;
|
|
|
- _this.isShow = true;
|
|
|
- },
|
|
|
- removeActive:function(){
|
|
|
- var _this = this;
|
|
|
- _this.isShow = false;
|
|
|
- },
|
|
|
- ImgList:function(item,index){
|
|
|
- var _this = this;
|
|
|
- _this.current = index;
|
|
|
- _this.previewBigimage = item;
|
|
|
- },
|
|
|
- },
|
|
|
- created: function () {
|
|
|
- this.id = $("#productId").val();
|
|
|
- this.cmSysParams.pageType = 7;
|
|
|
- },
|
|
|
- mounted: function () {
|
|
|
- var _self = this;
|
|
|
- _self.InfoData();
|
|
|
- SecondApi.ProductRecommend({productId:_self.id},function (res) {
|
|
|
- if(res.code==0){
|
|
|
- console.log(res)
|
|
|
- if(res.data.length > 0){
|
|
|
- _self.recommdeImage = res.data;
|
|
|
- _self.recommde =true;
|
|
|
- }else {
|
|
|
- _self.recommde =false;
|
|
|
- }
|
|
|
- if(res.data.length<7){
|
|
|
- var length = 7-res.data.length;
|
|
|
- _self.recommdeindex = length;
|
|
|
- }else {
|
|
|
- var remainderres=res.data.length%7;
|
|
|
- _self.recommdeindex= 7-remainderres;
|
|
|
- console.log(_self.recommdeindex)
|
|
|
- }
|
|
|
- self.recommendPage = isPC ? Math.ceil(res.data.length / 7) : Math.ceil(res.data.length / 3);
|
|
|
- setTimeout(function(){
|
|
|
- if (isPC) {
|
|
|
- $('#productRecommend').slide({
|
|
|
- mainCell:".swiper-wrapper"
|
|
|
- ,titCell:".swiper-pagination span"
|
|
|
- ,effect: "leftLoop"
|
|
|
- ,interTime: 3000
|
|
|
- ,autoPlay: true
|
|
|
- ,scroll:7
|
|
|
- ,vis:7
|
|
|
- ,trigger: "mouseover"
|
|
|
- });
|
|
|
- } else {
|
|
|
- var swiper = new Swiper('#productRecommend', {
|
|
|
- slidesPerView: 3,
|
|
|
- spaceBetween: 0,
|
|
|
- autoplay: {
|
|
|
- delay: 3000,
|
|
|
- disableOnInteraction: false
|
|
|
- },
|
|
|
- pagination: {
|
|
|
- el: '.swiper-pagination'
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- },500);
|
|
|
-
|
|
|
- }
|
|
|
- });
|
|
|
- SecondApi.ProductCount({productId: _self.id},function (res) {
|
|
|
- if(res.code==0){
|
|
|
- console.log(res)
|
|
|
- }else {
|
|
|
- console.log(res)
|
|
|
- }
|
|
|
- });
|
|
|
- //相關推薦輪播
|
|
|
- // var mySwiper = new Swiper('#productRecommend',{
|
|
|
- // slidesPerView: 7,
|
|
|
- // spaceBetween: 12,
|
|
|
- // slidesPerGroup: 7,
|
|
|
- // autoplay: {
|
|
|
- // delay:10000,
|
|
|
- // disableOnInteraction: false,//是否禁止autoplay。默认为true:停止。
|
|
|
- // },
|
|
|
- // loop: false,
|
|
|
- // observer: true, //修改swiper自己或子元素时,自动初始化swiper
|
|
|
- // observeParents: true, //修改swiper的父元素时,自动初始化swiper
|
|
|
- // pagination: {
|
|
|
- // el: '.swiper-pagination',
|
|
|
- // clickable: true,
|
|
|
- // },
|
|
|
- // on:{
|
|
|
- // init:function() {
|
|
|
- // var length = this.slides.length;
|
|
|
- // if(length < 8) {
|
|
|
- // this.autoplay.stop();
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
- // })
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-});
|
|
|
-
|
|
|
+/**
|
|
|
+ * Created by xw on 2020/7/22.
|
|
|
+ */
|
|
|
+var fleaMarket = new Vue({
|
|
|
+ el:"#fleaMarket",
|
|
|
+ mixins: [cmSysVitaMixins],
|
|
|
+ data: {
|
|
|
+ tabIndex:0,
|
|
|
+ shopId:'',
|
|
|
+ productId: $("#productId").val(),
|
|
|
+ isShow:false,
|
|
|
+ isRequest:false,
|
|
|
+ Showlogo:false,
|
|
|
+ detail:{},
|
|
|
+ previewBigimage:'',
|
|
|
+ previewThumb:[],
|
|
|
+ previewParams:[],
|
|
|
+ recommdeImage:[],
|
|
|
+ userID: GLOBAL_USER_ID,
|
|
|
+ HandType:false,
|
|
|
+ ShowImage:false,
|
|
|
+ recommde:false,
|
|
|
+ soldImage:false,
|
|
|
+ vShow_brand:false,
|
|
|
+ bnameShow:false,
|
|
|
+ FlagTwo:false,
|
|
|
+ recommdeindex:0,
|
|
|
+ current:0,
|
|
|
+ },
|
|
|
+ filters: {
|
|
|
+ NumFormat: function(text) { //处理金额
|
|
|
+ return Number(text).toFixed(2)
|
|
|
+ },
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ InfoData: function(){
|
|
|
+ var _this = this;
|
|
|
+ SecondApi.ProductDetail({productId:_this.productId,userId: _this.userID},function (res) {
|
|
|
+ if(res.code==0){
|
|
|
+ _this.isRequest =true;
|
|
|
+ _this.detail = res.data;
|
|
|
+ _this.previewThumb = res.data.imageList;
|
|
|
+ _this.previewBigimage =res.data.imageList[0];
|
|
|
+ _this.cmSysParams.productId = `${_this.productId}`;
|
|
|
+ _this.cmSysParams.pageLabel = `${res.data.brandName}`;
|
|
|
+ setTimeout(function(){ // 图片懒加载
|
|
|
+ $("img[data-original]").lazyload();
|
|
|
+ },500);
|
|
|
+ if(_this.userID!=null){
|
|
|
+ if(res.data.secondHandType ==2){ //临期产品显示
|
|
|
+ _this.HandType =true;
|
|
|
+ }else {
|
|
|
+ _this.HandType =false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(res.data.showContactFlag!=2){
|
|
|
+ _this.ShowImage=true;
|
|
|
+ }else {
|
|
|
+ _this.ShowImage=false;
|
|
|
+ }
|
|
|
+ if(res.data.sold == 1){//sold是否出售 0未出售,1已出售
|
|
|
+ _this.soldImage = true;
|
|
|
+ }else {
|
|
|
+ _this.soldImage = false;
|
|
|
+ }
|
|
|
+ if(res.data.brandName !=''&& res.data.brandName!=null){
|
|
|
+ _this.bnameShow = true;
|
|
|
+ if(res.data.brandID ==161){
|
|
|
+ _this.vShow_brand = true;
|
|
|
+ }else {
|
|
|
+ _this.vShow_brand = false;
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ _this.bnameShow = false;
|
|
|
+ }
|
|
|
+ if (res.data.detailTalkFlag ==1){ //是否详聊 1不开启,2开启
|
|
|
+ _this.FlagTwo==true;
|
|
|
+ }else {
|
|
|
+ _this.FlagTwo==false;
|
|
|
+ }
|
|
|
+ if(res.data.brandInfo==null||res.data.brandInfo==""){
|
|
|
+ _this.Showlogo = false;
|
|
|
+ }else {
|
|
|
+ _this.Showlogo = true;
|
|
|
+ }
|
|
|
+ setTimeout(function(){
|
|
|
+ if (isPC) {
|
|
|
+ var magnifier = new ImageMagnifier(
|
|
|
+ '#imgShown #CM____pic_thumb li',
|
|
|
+ '#imgShown .bigImage',
|
|
|
+ '#imgShown .preview-box',
|
|
|
+ '#imgShown .mask',
|
|
|
+ '#imgShown .bigitem',
|
|
|
+ "on"
|
|
|
+ ).init();
|
|
|
+ } else {
|
|
|
+ var swiper = new Swiper('#swiperImage', {
|
|
|
+ loop : true,
|
|
|
+ autoplay: {
|
|
|
+ delay: 2000,
|
|
|
+ disableOnInteraction: false
|
|
|
+ },
|
|
|
+ pagination: {
|
|
|
+ el: '.swiper-pagination',
|
|
|
+ type: 'fraction'
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },500);
|
|
|
+ }else {
|
|
|
+ _this.isRequest =false;
|
|
|
+ window.location.href = "/404.html?error=未查询到该商品";
|
|
|
+ }
|
|
|
+
|
|
|
+ })
|
|
|
+ },
|
|
|
+ changeActive:function(){
|
|
|
+ var _this = this;
|
|
|
+ _this.isShow = true;
|
|
|
+ },
|
|
|
+ removeActive:function(){
|
|
|
+ var _this = this;
|
|
|
+ _this.isShow = false;
|
|
|
+ },
|
|
|
+ ImgList:function(item,index){
|
|
|
+ var _this = this;
|
|
|
+ _this.current = index;
|
|
|
+ _this.previewBigimage = item;
|
|
|
+ },
|
|
|
+ },
|
|
|
+ created: function () {
|
|
|
+ this.id = $("#productId").val();
|
|
|
+ this.cmSysParams.pageType = 7;
|
|
|
+ },
|
|
|
+ mounted: function () {
|
|
|
+ var _self = this;
|
|
|
+ _self.InfoData();
|
|
|
+ SecondApi.ProductRecommend({productId:_self.id},function (res) {
|
|
|
+ if(res.code==0){
|
|
|
+ console.log(res)
|
|
|
+ if(res.data.length > 0){
|
|
|
+ _self.recommdeImage = res.data;
|
|
|
+ _self.recommde =true;
|
|
|
+ }else {
|
|
|
+ _self.recommde =false;
|
|
|
+ }
|
|
|
+ if(res.data.length<7){
|
|
|
+ var length = 7-res.data.length;
|
|
|
+ _self.recommdeindex = length;
|
|
|
+ }else {
|
|
|
+ var remainderres=res.data.length%7;
|
|
|
+ _self.recommdeindex= 7-remainderres;
|
|
|
+ console.log(_self.recommdeindex)
|
|
|
+ }
|
|
|
+ self.recommendPage = isPC ? Math.ceil(res.data.length / 7) : Math.ceil(res.data.length / 3);
|
|
|
+ setTimeout(function(){
|
|
|
+ if (isPC) {
|
|
|
+ $('#productRecommend').slide({
|
|
|
+ mainCell:".swiper-wrapper"
|
|
|
+ ,titCell:".swiper-pagination span"
|
|
|
+ ,effect: "leftLoop"
|
|
|
+ ,interTime: 3000
|
|
|
+ ,autoPlay: true
|
|
|
+ ,scroll:7
|
|
|
+ ,vis:7
|
|
|
+ ,trigger: "mouseover"
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ var swiper = new Swiper('#productRecommend', {
|
|
|
+ slidesPerView: 3,
|
|
|
+ spaceBetween: 0,
|
|
|
+ autoplay: {
|
|
|
+ delay: 3000,
|
|
|
+ disableOnInteraction: false
|
|
|
+ },
|
|
|
+ pagination: {
|
|
|
+ el: '.swiper-pagination'
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },500);
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+ SecondApi.ProductCount({productId: _self.id},function (res) {
|
|
|
+ if(res.code==0){
|
|
|
+ console.log(res)
|
|
|
+ }else {
|
|
|
+ console.log(res)
|
|
|
+ }
|
|
|
+ });
|
|
|
+ //相關推薦輪播
|
|
|
+ // var mySwiper = new Swiper('#productRecommend',{
|
|
|
+ // slidesPerView: 7,
|
|
|
+ // spaceBetween: 12,
|
|
|
+ // slidesPerGroup: 7,
|
|
|
+ // autoplay: {
|
|
|
+ // delay:10000,
|
|
|
+ // disableOnInteraction: false,//是否禁止autoplay。默认为true:停止。
|
|
|
+ // },
|
|
|
+ // loop: false,
|
|
|
+ // observer: true, //修改swiper自己或子元素时,自动初始化swiper
|
|
|
+ // observeParents: true, //修改swiper的父元素时,自动初始化swiper
|
|
|
+ // pagination: {
|
|
|
+ // el: '.swiper-pagination',
|
|
|
+ // clickable: true,
|
|
|
+ // },
|
|
|
+ // on:{
|
|
|
+ // init:function() {
|
|
|
+ // var length = this.slides.length;
|
|
|
+ // if(length < 8) {
|
|
|
+ // this.autoplay.stop();
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+});
|
|
|
+
|