zhengjinyi il y a 7 mois
Parent
commit
ff0516ba60

+ 5 - 0
src/main/resources/static/css/flea-market/list.css

@@ -26,8 +26,11 @@
     .Listitem {width: 284px;display: inline-block;margin: 0 16px 20px 0;border-radius: 8px;overflow: hidden;}
     .itemImg {display: block;position: relative;width: 100%;height: 284px;margin-right: 20px;background-color: #fff;cursor: pointer;}
     .itemImg .bigImg {width: 100%;height: 100%;}
+
     .infotag {font-size: 10px;padding: 0 10px;height: 18px;line-height: 18px;text-align: center;display: inline-block;border-radius: 4px;flex: auto;margin: 0 3px}
     .ItemInfo tag {display: flex;}
+    .ItemInfo .itemImg-buyFlag{ width: 22px;height: 22px;display: inline-block;float: left;}
+    .ItemInfo .itemImg-buyFlag img{ width: 22px;height: 22px; display: block;}
     .infotag.news {border: solid 1px #f94b4b;color: #f94b4b;background-color: #fadbdb}
     .infotag.brand {border: solid 1px #f9a24b;color: #f9a24b;background-color: #faefdb;}
     .infotag.sold {border: solid 1px #9aa5b5;color: #9aa5b5;background-color: #e3ebf7;}
@@ -75,6 +78,8 @@
     .activeImg{opacity: 0.5;}
     .itemImg img{width: 100%;height: 100%;}
     .ItemInfo{float: right;width: 60vw}
+    .ItemInfo .itemImg-buyFlag{ width: 22px;height: 22px;display: inline-block;float: left;}
+    .ItemInfo .itemImg-buyFlag img{ width: 22px;height: 22px; display: block;}
     .infotag {font-size: 3vw;padding: 0 2.7vw;height: 4.8vw;line-height:  4.8vw;text-align: center;display: inline-block;border-radius: .48vw;flex: auto;margin: 0 .72vw}
     .infotag.news {border: solid .27vw #f94b4b;color: #f94b4b;background-color: #fadbdb}
     .infotag.brand {border: solid.27vw #f9a24b;color: #f9a24b;background-color: #faefdb;}

+ 4 - 0
src/main/resources/static/css/flea-market/secondDetail.css

@@ -19,6 +19,8 @@
     .inner-container {width: 1184px;height: auto;margin: 0 auto;}
     .preview-header {padding: 16px;background-color: #FFFFFF;margin: 10px 0 20px 0;overflow: hidden;border-radius: 16px;}
     .preview-header .preview-banner {width: 452px;height: 545px;float: left;position: relative;}
+    .preview-header .itemImg-buyFlag{ width: 36px;height: 36px;position: absolute;right: 10px;top: 10px;border-radius: 50%;background: #FFFFFF;}
+    .preview-header .itemImg-buyFlag img{ width: 36px;height: 36px; display: block;}
     .preview-header .preview-info {width: 685px;float: right;opacity: 0;}
     .preview-header .preview-info.active {opacity: 1;}
     .preview-header .preview-banner-big {width: 452px;height: 452px;float: left;border: 1px solid #e4e4e4;border-radius: 8px;overflow: hidden;}
@@ -92,6 +94,8 @@
     #swiperImage .swiper-wrapper .swiper-slide{position:relative;zoom:1;vertical-align:middle;width:100%;overflow:hidden;text-align:center}
     #swiperImage .swiper-wrapper img{width:auto;height:100vw;display:block}
     #imgShown{width: 100%; height: 100vw;position: relative;background: #fff}
+    .preview-header .itemImg-buyFlag{ width: 8vw;height: 8vw;position: absolute;right: 10px;top: 10px;z-index: 9999;border-radius: 50%;background: #FFFFFF;}
+    .preview-header .itemImg-buyFlag img{ width: 8vw;height: 8vw; display: block;}
     .preview-info{box-sizing: border-box;padding: 0 3.3vw;overflow: hidden;background: #fff}
     .preview-info-main{box-sizing: border-box;padding: 2.8vw;font-size: 3.4vw;line-height: 7.5vw;color: #93979F;background: #f3f7fe;border-radius: 2vw;position: relative;margin: 3.5vw 0;overflow: hidden}
     .preview-info .preview-info-main .info {width: 100%;height: 8vw;float: left;margin-bottom: 1.3vw;line-height: 8vw;}

BIN
src/main/resources/static/img/flea-market/icon-mai@2x.png


BIN
src/main/resources/static/img/flea-market/icon-seller@2x.png


+ 12 - 3
src/main/resources/static/js/flea-market/form.js

@@ -18,6 +18,10 @@ var fleaMarketForm = new Vue({
            {name:'医美',value:1},
            {name:'非医美',value:2},
         ],
+        resRouls:[
+           {name:'我要卖',value:1},
+           {name:'我要买',value:2},
+        ],
         currentId:0,
         handleCurrent:1,
         BrandList:[],
@@ -67,6 +71,7 @@ var fleaMarketForm = new Vue({
             ossName:'',//文件OSS名称
             userId:''//用户
          },
+        resRoulsIndex:0,
         brandname:'请选择',
         checkbox:false,
         shoplogoTwo:false,
@@ -244,9 +249,13 @@ var fleaMarketForm = new Vue({
             var ViewerDom = document.querySelector(DomEven);
             _this.viewer = new Viewer(ViewerDom, {url:'data-image'});
         },
-        getProductType(item){
-            this.secondType=item;
-            this.secondParams.secondProductType = item ;
+        getProductType(value){
+            this.secondType=value;
+            this.secondParams.secondProductType = value ;
+        },
+        getBuyFlage(index,value){
+            this.resRoulsIndex = index
+            this.secondParams.buyFlag = value ;
         },
         submitBtn () {
             const _this = this;

+ 5 - 0
src/main/resources/static/js/flea-market/list.js

@@ -34,6 +34,11 @@ var fleaMarketList = new Vue({
           noMore:false,
           hasNextPage:false
      },
+     filters: {
+        NumFormat: function(text) { //处理金额
+            return Number(text).toFixed(2)
+        },
+     },
      computed: {
           pageTotal () {
                   var total = Math.ceil(this.listRecord / this.listQuery.pageSize);

+ 225 - 220
src/main/resources/static/js/flea-market/secondDetail.js

@@ -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();
+       //                  }
+       //              }
+       //          }
+       // })
+
+    }
+
+
+});
+

+ 13 - 2
src/main/resources/templates/flea-market/detail.html

@@ -12,11 +12,17 @@
 <template th:replace="components/header"></template>
 
 <!-- 二手商品详情 -->
-<div class="preview-container" id="fleaMarket" >
+<div class="preview-container" id="fleaMarket" v-cloak>
     <input type="hidden" th:value="${productId}" id="productId">
     <div class="inner-container">
         <div class="preview-header clearfix">
             <div class="preview-banner clearfix" id="imgShown" >
+                <div class="itemImg-buyFlag" v-if="detail.buyFlag === 1">
+                    <img src="/img/flea-market/icon-seller@2x.png" alt="">
+                </div>
+                <div class="itemImg-buyFlag" v-if="detail.buyFlag === 2">
+                    <img src="/img/flea-market/icon-mai@2x.png" alt="">
+                </div>
                 <div class="preview-banner-big bigImage" v-if="isPC">
                     <img class="preview-img" src="/img/base/placeholder.png" :data-original="previewBigimage" >
                     <span class="mask"></span>
@@ -78,7 +84,12 @@
                                 <span v-else>价格详聊</span>
                             </span>
                             <span v-else class="fave-text">
-                                ¥<span class="big">{{detail.price>0 ? detail.price :'议价'}}</span>
+                                <template v-if="detail.price>0">
+                                    ¥<span class="big">{{ detail.price | NumFormat }}</span>
+                                </template>
+                                <template v-else>
+                                    <span class="big">议价</span>
+                                </template>
                             </span>
                         </p>
                     </div>

+ 9 - 0
src/main/resources/templates/flea-market/form.html

@@ -37,6 +37,15 @@
 <!--                    <span class="release-tips  errTips icon mIcon"-->
 <!--                          v-show="vShow_PublishIdentity">{{fromMessage}}</span>-->
 <!--                </div>-->
+                <div class="unlogin-item input-item shrink-spacing none">
+                    <div class="unlogin-label spacing">发布方选择:</div>
+                    <div class="secondradio">
+                        <div class="buy icon mIcon" v-for="(item ,index) in resRouls" :key='index' value="item.value"
+                             @click="getBuyFlage(index,item.value)" :class="resRoulsIndex === index ? 'select active':''">
+                            {{item.name}}
+                        </div>
+                    </div>
+                </div>
                 <div class="unlogin-item input-item shrink-spacing" id="vShow_contactName">
                     <div class="unlogin-label spacing" style="letter-spacing: 1px;"><span class="red-color">*</span>联系人:
                     </div>

+ 11 - 1
src/main/resources/templates/flea-market/list.html

@@ -64,9 +64,16 @@
                 <div class="Listitem" v-if="isShow" v-for="(item, index) in tabchildList">
                     <a class="itemImg onhref" :href="'/flea-market-'+item.productId+'.html'" target="_blank">
                         <img :src="item.imageList[0]" :class="item.sold==1?'activeImg':''" class="bigImg">
+
                     </a>
                     <div class="ItemInfo">
                         <div class="tag">
+                            <div class="itemImg-buyFlag" v-if="item.buyFlag === 1">
+                                <img src="/img/flea-market/icon-seller@2x.png" alt="">
+                            </div>
+                            <div class="itemImg-buyFlag" v-if="item.buyFlag === 2">
+                                <img src="/img/flea-market/icon-mai@2x.png" alt="">
+                            </div>
                             <span class="infotag news" v-if="item.sold==0&&item.newAdded==1">最新</span>
                             <span class="infotag brand" v-if="item.brandName!=null&&item.brandName!=''&&item.brandID!=161">{{item.brandName}}</span>
                             <span class="infotag sold " v-if="item.sold==1">已售</span>
@@ -90,7 +97,10 @@
                             </span>
                             <span v-else>
                                 <span v-if="item.sold == 1">&nbsp;&nbsp;&nbsp;</span>
-                                <span v-else>¥{{ item.price > 0 ? item.price : '议价' }}</span>
+                                <span v-else>
+                                    <span v-if="item.price > 0">¥{{ item.price | NumFormat }}</span>
+                                    <span v-else>议价</span>
+                                </span>
                             </span>
                         </div>
                         <div class="shijian">