Преглед на файлове

系统公告接口联调

zhengjinyi преди 3 години
родител
ревизия
d09a828616

+ 2 - 2
src/main/resources/config/dev/application-dev.yml

@@ -54,9 +54,9 @@ logging:
 caimei:
   siteEnv: 0 #网站环境,(2:正式环境,1:测试环境,0:开发环境)
   #spiServer: http://192.168.2.68:8008
-  coreServer: https://core-b.caimei365.com
+#  coreServer: https://core-b.caimei365.com
 #  coreServer: http://192.168.2.67:18002
-  #coreServer: http://192.168.2.75:18002
+  coreServer: http://192.168.2.75:18002
   imageDomain: https://img-b.caimei365.com
   wwwDomain: http:localhost:8009
   destPath: classpath:/

+ 2 - 1
src/main/resources/static/css/help/details.css

@@ -6,7 +6,8 @@ li{list-style:none}
 @media screen and (min-width:768px){
     .pageWrap{width: 968px;}
     .navLayout{min-height: 500px;}
-    .news-container{width: 100%;min-height: 600px;background-color: #FFFFFF;margin-top: 24px;box-sizing: border-box;padding: 32px;border-radius: 8px;}
+    .news-container{width: 100%;min-height: 600px;background-color: #FFFFFF;margin-top: 24px;box-sizing: border-box;padding:0 32px 32px 32px;border-radius: 8px;}
+    .news-title{width: 100%;line-height: 80px;font-size: 20px;font-weight: bold;text-align: center;color: #333333;}
     .news-container-html{width: 100%;min-height: 600px;}
 }
 

+ 25 - 0
src/main/resources/static/js/common/serviceapi/utils.service.js

@@ -479,6 +479,31 @@ var PublicApi = {
                 callback(res)
             });
         },
+        GetNewsList:function(params,callback){ //公告列表
+            Http.AjaxService({
+                url:'/commodity/home/title',
+                type:'get',
+                data:params,
+                json:false,
+                isHost:true
+            })
+                .then(function(res){
+                    callback(res)
+                });
+        },
+        GetNewsDetails:function(params,callback){ //获取公告详情
+            Http.AjaxService({
+                url:'/commodity/home/capacity',
+                type:'get',
+                data:params,
+                json:false,
+                isHost:true
+            })
+                .then(function(res){
+                    callback(res)
+                });
+        }
+
 };
 
 

+ 7 - 192
src/main/resources/static/js/help/details.js

@@ -3,209 +3,24 @@ var orderPage = new Vue({
     el: "#beansPage",
     data: {
         isRequset:false,
-        noMore: false,
-        tabsListIndex:0,
-        listQuery:{
-            userId:0,
-            pageNum:1,
-            pageSize:9
-        },
-        beansList:[],
-        listRecord: 0,
-        pageInput: '1',
-        modelType:0,
-        afterSale:'',
-    },
-    filters: {
-        TypeFormat:function(value) {
-            switch (value) {
-                case 0:
-                    return  '活动券';
-                    break;
-                case 1:
-                    return  '品类券';
-                    break;
-                case 2:
-                    return  '用户专享券';
-                    break;
-                case 3:
-                    return  '店铺券';
-                    break;
-                case 4:
-                    return  '新用户券';
-                    break;
-            }
-        }
-    },
-    computed: {
-        pageTotal: function () {
-            var total = Math.ceil(this.listRecord / this.listQuery.pageSize);
-            return total > 0 ? total : 1;
-        },
-        showPageBtn: function () {
-            var total = Math.ceil(this.listRecord / this.listQuery.pageSize);
-            total = total > 0 ? total : 1;
-            var index = this.listQuery.pageNum, arr = [];
-            if (total <= 6) {
-                for (var i = 1; i <= total; i++) {
-                    arr.push(i);
-                }
-                return arr;
-            }
-            if (index <= 3) return [1, 2, 3, 4, 5, 0, total];
-            if (index >= total - 2) return [1, 0, total - 4, total - 3, total - 2, total - 1, total];
-            return [1, 0, index - 2, index - 1, index, index + 1, index + 2, 0, total];
-        }
+        newsData:{},
     },
     methods: {
-        getHomeSaleTips:function () {
-            var  _self = this;
-            PublicApi.getHomeSaleTips({},function (response) {
-                if(response.code == 0){
-                    var data = response.data;
-                    _self.afterSale = data.afterSale;
-                    _self.isRequset = false;
-                }else{
-                    CAIMEI.Alert(response.msg, '确定', false);
-                }
-            })
-        },
-        toPagination: function (pageNum) {//点击切换分页
-            if (pageNum <= this.pageTotal) {
-                this.listQuery.pageNum = pageNum;
-                this.QueryCouponCollarList();
-            }
-        },
-        checkNum: function () {//输入跳转分页
-            if (this.pageInput > this.pageTotal) {
-                this.pageInput = this.pageTotal;
-            } else if (this.pageInput < 1) {
-                this.pageInput = 1;
-            }
-        },
-        changeOrderFn:function(index,status){
+        GetNewsDetails:function (id) {
             var  _self = this;
-            _self.orderTabBarIndex = index;
-            _self.listQuery.orderState = status;
-            _self.listQuery.searchNo = '';
-            _self.listQuery.beginTime = '';
-            _self.listQuery.endTime = '';
-            _self.listQuery.pageNum = 1;
-            _self.isRequset = true;
-            _self.QueryCouponCollarList()
-        },
-        QueryCouponCollarList:function(){//查询优惠券列表
-            var _self = this;
-            ProductApi.QueryCouponCollarList(_self.listQuery,function (response) {
+            PublicApi.GetNewsDetails({id:id},function (response) {
                 if(response.code == 0){
-                    var data = response.data;
-                    if( data.list && data.list.length>0) {
-                        _self.coupinList = [];
-                        _self.coupinList = data.list;
-                        _self.listRecord = data.total;
-                    }else{
-                        _self.coupinList = [];
-                        _self.coupinList = data.list;
-                        _self.listRecord = data.total;
-                    }
+                    _self.newsData = response.data;
                     _self.isRequset = false;
                 }else{
                     CAIMEI.Alert(response.msg, '确定', false);
                 }
             })
         },
-        toBuyCoupon:function (coupon) {// 点击购买按钮事件处理
-            var  _self = this;
-            if(this.listQuery.userId == 0){
-                window.location.href='/login.html';
-            }else{
-                ProductApi.createCouponRecord({userId:_self.listQuery.userId, couponId:coupon.couponId}, function (response) {
-                    if(response.code == 0){
-                        let couponRecordId = response.data.couponRecordId
-                        window.location.href = '/pay/caimei-paycash.html?pageType=3&couponId='+coupon.couponId+'&couponRecordId='+couponRecordId;
-                    }else{
-                        if(response.code == -1){//个人机构不能购买
-                            CAIMEI.Alert('该优惠券仅限医美机构购买,请升级为医美机构后再次购买。', '去升级', true, function(){
-                                window.location.href = "/user/setting/upgrade.html";
-                            });
-                        }else if(response.code == -2){//会员机构不是医美机构不能购买
-                            CAIMEI.dialog('该优惠券仅限医美机构购买',false,function () {});
-                        }else{
-                            CAIMEI.Alert(response.msg, '确定', false);
-                        }
-                    }
-                })
-            }
-        },
-        receiveCoupon:function(coupon){// 点击领取按钮事件处理
-            var  _self = this;
-            console.log(coupon)
-            if(_self.listQuery.userId == 0){
-                window.location.href='/login.html';
-            }else{
-                ProductApi.ReceiveCoupon({userId:_self.listQuery.userId, couponId:coupon.couponId, source:1}, function (response) {
-                    if(response.code == 0){
-                        CAIMEI.dialog('领取成功',true,function () {
-                            setTimeout(function(){
-                                coupon.couponBtnType = 1;
-                            },200)
-                        });
-                    }else{
-                        CAIMEI.Alert(response.msg, '确定', false);
-                    }
-                })
-            }
-        },
-        myClickCoupon:function (){// 我的优惠券跳转
-            var  _self = this;
-            if(_self.listQuery.userId>0){
-                window.location.href='/user/coupon.html';
-            }else{
-                window.location.href='/login.html';
-            }
-        },
-        toUseCoupon:function (coupon){// 去使用跳转路径
-            var _self = this;
-            switch (coupon.couponType) {
-                case 0:// 活动券跳转到商城首页 / 或者活动页(看是否指定了商品)
-                    if(coupon.productType == 1){
-                        _self.QueryCouponCollarList()
-                        window.open('/index.html');
-                    }else{
-                        _self.QueryCouponCollarList()
-                        window.open('/product/product-coupon.html?couponId='+coupon.couponId);
-                    }
-                    break;
-                case 1:// 品类券:跳转到产品 / 仪器页
-                    if(coupon.categoryType == 1){
-                        _self.QueryCouponCollarList()
-                        window.open('/product/type-287.html');
-                    }else{
-                        _self.QueryCouponCollarList()
-                        window.open('/product/type-286.html');
-                    }
-                    break;
-                case 2:// 专享券:跳转到商城首页
-                    _self.QueryCouponCollarList()
-                    window.open('/index.html');
-                    break;
-                case 3:// 店铺券:跳转到店铺首页
-                    _self.QueryCouponCollarList()
-                    window.open('/supplier-'+coupon.shopId+'.html');
-                    break;
-                case 4:// 新用户券:跳转到商城首页
-                    _self.QueryCouponCollarList()
-                    window.open('/index.html');
-                    break;
-            }
-        }
+
     },
     mounted: function () {
-        var _self = this;
-        if(globalUserData){
-            _self.userId = globalUserData.userId;
-            _self.listQuery.userId = _self.userId;
-        }
-        _self.getHomeSaleTips();
+        var id = CAIMEI.getUrlParam('id');
+        this.GetNewsDetails(id);
     }
 });

+ 15 - 156
src/main/resources/static/js/help/news.js

@@ -6,57 +6,13 @@ var orderPage = new Vue({
         noMore: false,
         tabsListIndex:0,
         listQuery:{
-            userId:0,
             pageNum:1,
-            pageSize:9
+            pageSize:20
         },
-        beansList:[],
         listRecord: 0,
         pageInput: '1',
         modelType:0,
-        newsList:[
-            {id:1212,title:'12月德玛莉直播秒杀活动即将开始12月德玛莉直播秒杀活动即将开始',time:'2022年03月10日'},
-            {id:1212,title:'12月德玛莉直播秒杀活动即将开始12月德玛莉直播秒杀活动即将开始',time:'2022年03月10日'},
-            {id:1212,title:'12月德玛莉直播秒杀活动即将开始12月德玛莉直播秒杀活动即将开始',time:'2022年03月10日'},
-            {id:1212,title:'12月德玛莉直播秒杀活动即将开始12月德玛莉直播秒杀活动即将开始',time:'2022年03月10日'},
-            {id:1212,title:'12月德玛莉直播秒杀活动即将开始12月德玛莉直播秒杀活动即将开始',time:'2022年03月10日'},
-            {id:1212,title:'12月德玛莉直播秒杀活动即将开始12月德玛莉直播秒杀活动即将开始',time:'2022年03月10日'},
-            {id:1212,title:'12月德玛莉直播秒杀活动即将开始12月德玛莉直播秒杀活动即将开始',time:'2022年03月10日'},
-            {id:1212,title:'12月德玛莉直播秒杀活动即将开始12月德玛莉直播秒杀活动即将开始',time:'2022年03月10日'},
-            {id:1212,title:'12月德玛莉直播秒杀活动即将开始12月德玛莉直播秒杀活动即将开始',time:'2022年03月10日'},
-            {id:1212,title:'12月德玛莉直播秒杀活动即将开始12月德玛莉直播秒杀活动即将开始',time:'2022年03月10日'},
-            {id:1212,title:'12月德玛莉直播秒杀活动即将开始12月德玛莉直播秒杀活动即将开始',time:'2022年03月10日'},
-            {id:1212,title:'12月德玛莉直播秒杀活动即将开始12月德玛莉直播秒杀活动即将开始',time:'2022年03月10日'},
-            {id:1212,title:'12月德玛莉直播秒杀活动即将开始12月德玛莉直播秒杀活动即将开始',time:'2022年03月10日'},
-            {id:1212,title:'12月德玛莉直播秒杀活动即将开始12月德玛莉直播秒杀活动即将开始',time:'2022年03月10日'},
-            {id:1212,title:'12月德玛莉直播秒杀活动即将开始12月德玛莉直播秒杀活动即将开始',time:'2022年03月10日'},
-            {id:1212,title:'12月德玛莉直播秒杀活动即将开始12月德玛莉直播秒杀活动即将开始',time:'2022年03月10日'},
-            {id:1212,title:'12月德玛莉直播秒杀活动即将开始12月德玛莉直播秒杀活动即将开始',time:'2022年03月10日'},
-            {id:1212,title:'12月德玛莉直播秒杀活动即将开始12月德玛莉直播秒杀活动即将开始',time:'2022年03月10日'},
-            {id:1212,title:'12月德玛莉直播秒杀活动即将开始12月德玛莉直播秒杀活动即将开始',time:'2022年03月10日'},
-            {id:1212,title:'12月德玛莉直播秒杀活动即将开始12月德玛莉直播秒杀活动即将开始',time:'2022年03月10日'},
-        ],
-    },
-    filters: {
-        TypeFormat:function(value) {
-            switch (value) {
-                case 0:
-                    return  '活动券';
-                    break;
-                case 1:
-                    return  '品类券';
-                    break;
-                case 2:
-                    return  '用户专享券';
-                    break;
-                case 3:
-                    return  '店铺券';
-                    break;
-                case 4:
-                    return  '新用户券';
-                    break;
-            }
-        }
+        newsList:[],
     },
     computed: {
         pageTotal: function () {
@@ -82,7 +38,7 @@ var orderPage = new Vue({
         toPagination: function (pageNum) {//点击切换分页
             if (pageNum <= this.pageTotal) {
                 this.listQuery.pageNum = pageNum;
-                this.QueryCouponCollarList();
+                this.GetNewsList();
             }
         },
         checkNum: function () {//输入跳转分页
@@ -92,30 +48,19 @@ var orderPage = new Vue({
                 this.pageInput = 1;
             }
         },
-        changeOrderFn:function(index,status){
-            var  _self = this;
-            _self.orderTabBarIndex = index;
-            _self.listQuery.orderState = status;
-            _self.listQuery.searchNo = '';
-            _self.listQuery.beginTime = '';
-            _self.listQuery.endTime = '';
-            _self.listQuery.pageNum = 1;
-            _self.isRequset = true;
-            _self.QueryCouponCollarList()
-        },
-        QueryCouponCollarList:function(){//查询优惠券列表
+        GetNewsList:function(){//查询优惠券列表
             var _self = this;
-            ProductApi.QueryCouponCollarList(_self.listQuery,function (response) {
+            PublicApi.GetNewsList(_self.listQuery,function (response) {
                 if(response.code == 0){
                     var data = response.data;
-                    if( data.list && data.list.length>0) {
-                        _self.coupinList = [];
-                        _self.coupinList = data.list;
-                        _self.listRecord = data.total;
+                    if( data.results && data.results.length>0) {
+                        _self.newsList = [];
+                        _self.newsList = data.results;
+                        _self.listRecord = data.totalRecord;
                     }else{
-                        _self.coupinList = [];
-                        _self.coupinList = data.list;
-                        _self.listRecord = data.total;
+                        _self.newsList = [];
+                        _self.newsList = data.results;
+                        _self.listRecord = data.totalRecord;
                     }
                     _self.isRequset = false;
                 }else{
@@ -123,98 +68,12 @@ var orderPage = new Vue({
                 }
             })
         },
-        toBuyCoupon:function (coupon) {// 点击购买按钮事件处理
-            var  _self = this;
-            if(this.listQuery.userId == 0){
-                window.location.href='/login.html';
-            }else{
-                ProductApi.createCouponRecord({userId:_self.listQuery.userId, couponId:coupon.couponId}, function (response) {
-                    if(response.code == 0){
-                        let couponRecordId = response.data.couponRecordId
-                        window.location.href = '/pay/caimei-paycash.html?pageType=3&couponId='+coupon.couponId+'&couponRecordId='+couponRecordId;
-                    }else{
-                        if(response.code == -1){//个人机构不能购买
-                            CAIMEI.Alert('该优惠券仅限医美机构购买,请升级为医美机构后再次购买。', '去升级', true, function(){
-                                window.location.href = "/user/setting/upgrade.html";
-                            });
-                        }else if(response.code == -2){//会员机构不是医美机构不能购买
-                            CAIMEI.dialog('该优惠券仅限医美机构购买',false,function () {});
-                        }else{
-                            CAIMEI.Alert(response.msg, '确定', false);
-                        }
-                    }
-                })
-            }
-        },
-        receiveCoupon:function(coupon){// 点击领取按钮事件处理
-            var  _self = this;
-            console.log(coupon)
-            if(_self.listQuery.userId == 0){
-                window.location.href='/login.html';
-            }else{
-                ProductApi.ReceiveCoupon({userId:_self.listQuery.userId, couponId:coupon.couponId, source:1}, function (response) {
-                    if(response.code == 0){
-                        CAIMEI.dialog('领取成功',true,function () {
-                            setTimeout(function(){
-                                coupon.couponBtnType = 1;
-                            },200)
-                        });
-                    }else{
-                        CAIMEI.Alert(response.msg, '确定', false);
-                    }
-                })
-            }
-        },
-        myClickCoupon:function (){// 我的优惠券跳转
+        hanldDetails:function (id){// 跳转公告详情
             var  _self = this;
-            if(_self.listQuery.userId>0){
-                window.location.href='/user/coupon.html';
-            }else{
-                window.location.href='/login.html';
-            }
-        },
-        toUseCoupon:function (coupon){// 去使用跳转路径
-            var _self = this;
-            switch (coupon.couponType) {
-                case 0:// 活动券跳转到商城首页 / 或者活动页(看是否指定了商品)
-                    if(coupon.productType == 1){
-                        _self.QueryCouponCollarList()
-                        window.open('/index.html');
-                    }else{
-                        _self.QueryCouponCollarList()
-                        window.open('/product/product-coupon.html?couponId='+coupon.couponId);
-                    }
-                    break;
-                case 1:// 品类券:跳转到产品 / 仪器页
-                    if(coupon.categoryType == 1){
-                        _self.QueryCouponCollarList()
-                        window.open('/product/type-287.html');
-                    }else{
-                        _self.QueryCouponCollarList()
-                        window.open('/product/type-286.html');
-                    }
-                    break;
-                case 2:// 专享券:跳转到商城首页
-                    _self.QueryCouponCollarList()
-                    window.open('/index.html');
-                    break;
-                case 3:// 店铺券:跳转到店铺首页
-                    _self.QueryCouponCollarList()
-                    window.open('/supplier-'+coupon.shopId+'.html');
-                    break;
-                case 4:// 新用户券:跳转到商城首页
-                    _self.QueryCouponCollarList()
-                    window.open('/index.html');
-                    break;
-            }
+            window.open('/news/details.html?id='+id);
         }
     },
     mounted: function () {
-        var _self = this;
-        if(globalUserData){
-            _self.userId = globalUserData.userId;
-            _self.listQuery.userId = _self.userId;
-        }
-        // _self.QueryCouponCollarList();
+        this.GetNewsList();
     }
 });

+ 7 - 4
src/main/resources/static/js/index.js

@@ -95,12 +95,10 @@ var homeData = new Vue({
                 if(response.code == 0){
                     _self.couponEntry = response.data.couponEntry
                     if(isPC){
-                        _self.newsList = response.data.bannerList.slice(0,2)
+                        _self.newsList = response.data.annhade.slice(0,2)
                     }else{
-                        _self.newsList = response.data.bannerList.slice(0,1)
+                        _self.newsList = response.data.annhade.slice(0,1)
                     }
-                    console.log('couponEntry', _self.couponEntry)
-                    console.log('GLOBAL_USER_ID', GLOBAL_USER_ID)
                     if(GLOBAL_USER_ID == 0 &&_self.couponEntry == 1){
                         var isActivityStatus =  localStorage.getItem('isActivityStatus');
                         //新加优惠券弹窗
@@ -116,6 +114,10 @@ var homeData = new Vue({
                 }
             });
         },
+        hanldDetails:function (id){// 跳转公告详情
+            var  _self = this;
+            window.open('/news/details.html?id='+id);
+        },
         // GetHomeRightData: function(){//模块加载
         //     var _self = this;
         //     PublicApi.GetHomeRightData({ source: 1 },function(response){
@@ -330,6 +332,7 @@ var homeData = new Vue({
         // 获取设置商品价格
         if (GLOBAL_USER_ID) {
             this.GetHomeData();
+            this.GetHomeInit();
         }else{
             // 设置页面查看更多
             this.setReadeMore();

+ 2 - 1
src/main/resources/templates/help/details.html

@@ -19,7 +19,8 @@
         <img src="/img/base/loading.gif">
       </div>
       <div class="news-container clear" v-else>
-        <div class="news-container-html" v-html="afterSale"></div>
+        <div class="news-title" v-text="newsData.title"></div>
+        <div class="news-container-html" v-html="newsData.capacity"></div>
       </div>
     </div>
   </div>

+ 4 - 4
src/main/resources/templates/help/news.html

@@ -24,19 +24,19 @@
         </div>
         <div class="news-container clear" v-else>
           <div class="news-content-list clear" v-if="newsList.length > 0">
-            <a href="/news/details.html" target="_blank" class="news-list-cell" v-for="(list, index) in newsList" :key="index">
+            <a href="javascript:void(0)" class="news-list-cell" v-for="(list, index) in newsList" :key="index" @click="hanldDetails(list.id)">
               <div class="news-list-le">
                 <span class="new-icon"></span>
                 <p>{{ list.title }}</p>
               </div>
               <div class="news-list-ri">
-                {{ list.time }}
+                {{ list.creationtime }}
               </div>
             </a>
           </div>
           <div v-else class="empty">
             <img src="/img/account/icon-coupon-empty@2x.png">
-            <div class="msg"><p>暂无可领的优惠券</p></div>
+            <div class="msg"><p>暂无公告~</p></div>
           </div>
         </div>
         <!--分页-->
@@ -60,7 +60,7 @@
 <!-- 引入底部 -->
 <template th:replace="components/footer"></template>
 <template th:replace="components/foot-link"></template>
-<script charset="utf-8" type="text/javascript" th:src="@{/js/common/serviceapi/product.service.js(v=${version})}"></script>
+<script charset="utf-8" type="text/javascript" th:src="@{/js/common/serviceapi/utils.service.js(v=${version})}"></script>
 <script charset="utf-8" type="text/javascript" th:src="@{/js/help/news.js(v=${version})}"></script>
 </body>
 </html>

+ 1 - 1
src/main/resources/templates/index.html

@@ -40,7 +40,7 @@
         <div class="inner">
             <div class="new-label">公告:</div>
             <div class="new-list">
-                <a href="/news/details.html" target="_blank" class="new-li" v-for="(list ,index) in newsList" :key="index">
+                <a href="javascript:void(0)" class="new-li" v-for="(list ,index) in newsList" :key="index" @click="hanldDetails(list.id)">
                     <span class="new-icon"></span>
                     <p>{{ list.title }}</p>
                 </a>