zhaojs
2023-07-31 34db7035c9c7880e00b9328d022be65a29c62cb2
public/html/compareprice.html
@@ -119,15 +119,15 @@
        }
        .detail___3ZQFW {
        background-color: #fff;
        height: 2.2rem;
        height: 2.6rem;
        border-radius: .16rem;
        padding: .1rem;
        position: relative;
        box-sizing: border-box;
    }
    .picture___r4a1j {
        height: 2rem;
        width: 2rem;
        height: 2.4rem;
        width: 2.4rem;
        border-radius: .1rem;
        position: absolute;
        left: .1rem;
@@ -137,8 +137,8 @@
        -webkit-justify-content: space-between;
        -ms-flex-pack: justify;
        justify-content: space-between;
        padding-left: 2.2rem;
        height: 2rem;
        padding-left: 2.5rem;
        width: 100%;
        overflow: hidden;
        -webkit-align-items: flex-start;
@@ -161,7 +161,7 @@
        justify-content: flex-start;
        padding: 0;
        margin: 0;
        height: .4rem;
        height: .85rem;
        font-size: .28rem;
        font-family: PingFangSC-Regular, PingFang SC;
        font-weight: 400;
@@ -170,6 +170,7 @@
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        width: 100%;
    }
    .shoplabel___1_Nv0 img {
@@ -183,7 +184,7 @@
    .shoplabel___1_Nv0 {
        height: .26rem;
        float: left;
        display:inline-block;
        position: relative;
        top: .05rem;
    }
@@ -203,7 +204,7 @@
    }
    .coupon___2SVZi {
        margin-top: 6px;
        margin-top: 3px;
        height: .28rem;
        background: linear-gradient(
                90deg, #ff8873, #ff4f4f);
@@ -268,19 +269,18 @@
        line-height: .32rem;
    }
    .detail___3ZQFW .choiceInfo___3ZuEa .price___dfbCD {
        margin-bottom: .16rem;
        -webkit-justify-content: flex-start;
        -ms-flex-pack: start;
        justify-content: flex-start;
        -webkit-align-items: baseline;
        -ms-flex-align: baseline;
        align-items: baseline;
        height: .24rem;
        font-size: .24rem;
        font-family: PingFangSC-Medium, PingFang SC;
        font-weight: 500;
        color: #fe3738;
        line-height: .24rem;
        line-height: .54rem;
    }
    .detail___3ZQFW .choiceInfo___3ZuEa .operation___3KazI {
@@ -311,9 +311,59 @@
        }
        .showshop
        {
            font-size: .28rem;
            font-size: .26rem;
            color: #787070;
            margin-top: 0.15rem;
        }
        .goodtitle
        {
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
        }
        .price_font
        {
            font-size: .26rem;
            color: #787070;
        }
        .plat-div
        {
            font-size: 0.28rem;
            padding: 0.2rem;
            background: #fff;
            margin-bottom: 0.2rem;
            display: flex;
            border-radius: .16rem;
            align-items: center;
        }
        .plat-ite
        {
            width: 20%;
            text-align: center;
            margin-right: 0.1rem;
            border-radius: 0.1rem;
            color: #fff;
            display: flex;
            justify-content: center;
            align-items: center;
            background: #F79633;
            padding: 0.1rem;
        }
        .plat-unite
        {
            background: #fff;
            border:1px solid #F79633;
            color:#F79633;
            width: 20%;
            text-align: center;
            margin-right: 0.1rem;
            border-radius: 0.1rem;
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 0.1rem;
        }
    </style>
</head>
@@ -329,7 +379,7 @@
                        清空
                    </div>
                    <div class="content-txtarea">
                        <textarea class="txtarea" v-model="txtareatxt" :placeholder='txtplaceholder'></textarea>
                        <textarea enterkeyhint="search" onkeydown="onTextareaKeyDown()" class="txtarea" v-model="txtareatxt" :placeholder='txtplaceholder'></textarea>
                        <span class="copytxt" v-on:click="fromcopy()">粘贴</span>
                    </div>
                    <div class="mid-button-content">
@@ -345,6 +395,18 @@
                        暂无数据~
                    </div>
                    <div v-else class="ulist">
                        <div class="plat-div" v-if="issearch">
                            <span>平台:</span>
                            <div v-on:click="changeplat(item)" :class="item.choose?'plat-ite':'plat-unite'" v-for="item in plat">
                                <span class="plat-span" v-if="item.choose">
                                    √{{item.platname}}
                                </span>
                                <span class="plat-span" v-else>
                                    {{item.platname}}
                                </span>
                            </div>
                        </div>
                        <a v-for="g in goodsItem" :key="g.id" v-on:click="handleCdetailFavorite(g)">
                            <div class="detail___3ZQFW">
                                <img :src="g.mainPic"
@@ -352,18 +414,26 @@
                                <div class="choiceInfo___3ZuEa">
                                    <div class="other___2Mv8Q">
                                        <h2>
                                            <div class="shoplabel___1_Nv0"><img
                                            <!-- <div class="shoplabel___1_Nv0"><img
                                                    :src="g.labelImg">
                                            </div>
                                            <span>{{g.title}}</span></h2>
                                            </div> -->
                                            <div class="goodtitle">
                                                <img class="shoplabel___1_Nv0" :src="g.labelImg">
                                                {{g.title}}</div></h2>
                                        <div v-if="g.couponPrice" class="coupon___2SVZi" style="float: left; margin-right:10px"><span>券</span>{{g.couponPrice}}元</div>
                                        <div class="coupon___2SVZi" style="background: #A429F3;"><span style="color: #A429F3;">返</span>{{g.fanli}}元</div>
                                        <div class="showshop">{{g.shopName}}</div>
                                        <div v-if="isshowfan" class="coupon___2SVZi" style="background: #A429F3;"><span style="color: #A429F3;">返</span>{{g.fanli}}元</div>
                                    </div>
                                    <div class="price___dfbCD">¥<span>{{g.actualPrice}}</span><u style="text-decoration:line-through">¥{{g.originalPrice}}</u></div>
                                    <div class="operation___3KazI">
                                    <div class="price___dfbCD">
                                        <span class="price_font" style="font-size: .26rem; font-weight: 500;">到手价</span><span style="padding: 0;">¥</span>
                                        <span v-if="isshowfan" style="padding: 0 .08rem 0 0;">{{(g.actualPrice-g.fanli).toFixed(2)}}</span>
                                        <span v-else style="padding: 0 .08rem 0 0;">{{g.actualPrice}}</span>
                                        <u v-if="g.sourceType=='tb'||g.sourceType=='tm'" style="text-decoration:line-through">¥{{g.originalPrice}}</u></div>
                                   <!--  <div class="operation___3KazI">
                                        <button>立即购买</button>
                                    </div>
                                    </div> -->
                                    <div class="showshop">月销{{g.monthSales}}</div>
                                    <div class="showshop">{{g.shopName}}</div>
                                </div>
                            </div>
                        </a>
@@ -376,7 +446,8 @@
</body>
</html>
<script type="text/javascript" src="https://cdn.staticfile.org/vue/2.6.11/vue.min.js"></script>
<script type="text/javascript" src="./js/vue.js"></script>
<script type="text/javascript" src="./js/md5.js"></script>
<script>
(function () {
@@ -394,6 +465,16 @@
    {
        app.likeDataGet(data);
    }
    function onTextareaKeyDown()
    {
        if (event.keyCode == 13)
        {
            app.search();
            document.activeElement.blur();
        }
    }
    Vue.use(VueLazyload, {
        preLoad: 1.3,//
        error: 'https://sr.ffquan.cn/cms_pic/20200622/bro7s7f6vrkd3jat4ujg0.png',
@@ -404,15 +485,46 @@
        el: '#comprice',
        data:{
          //posturl:'http://dfg.shop.com',
          posturl:'https://appapitest.ushopvip.com',
         // posturl:'http://appapitest.ushopvip.com',
          //posturl:'http://dfgapp.ushopvip.com',
          goodsItem:[],
          loading:false,
          isshowfan:false,
          plat:[
            {
                'platname':'淘宝',
                'plat':'tb',
                'choose':true
            },
            {
                'platname':'京东',
                'plat':'jd',
                'choose':true
            },
            {
                'platname':'抖音',
                'plat':'dy',
                'choose':true
            },
            {
                'platname':'拼多多',
                'plat':'pdd',
                'choose':true
            },
          ],
          txtareatxt:'',
          issearch:false,
          showTxt:'猜你喜欢',
          txtplaceholder:'1、支持淘宝、天猫、京东、抖音、拼多多等多家电商 \r\n 2、请粘贴您需要转换的分享文案/链接和口令/商品链接;不支持券链接'
          txtplaceholder:'1、支持淘宝、天猫、京东、抖音、拼多多等平台\r\n2、请粘贴您需要转换的分享文案/链接和口令/商品链接;不支持券链接'
        },
        methods:{
            changeplat:function(item)
            {
                var index=this.plat.findIndex(i=>i.plat==item.plat);
                item.choose=!item.choose;
                this.plat[index]=item;
                this.search();
            },
            //查询
            search:function()
            {
@@ -420,22 +532,46 @@
                {
                    return;
                }
                this.showTxt="查询排行";
                this.showTxt="查询结果";
                this.goodsItem=[];
                var that = this;
                this.loading = true
                var postData={
                        content:that.txtareatxt
                    };
                //查看不看的平台
                var cancelPlat=this.plat.filter(i=>!i.choose);
                if(cancelPlat&&cancelPlat.length>0)
                {
                    for(var i=0;i<cancelPlat.length;i++)
                    {
                        switch(cancelPlat[i].plat)
                        {
                            case "tb":
                                postData.exclude_tb=1;
                                break;
                            case "jd":
                                postData.exclude_jd=1;
                                break;
                            case "pdd":
                                postData.exclude_pdd=1;
                                break;
                            case "dy":
                                postData.exclude_dy=1;
                                break;
                        }
                    }
                }
                var header=this.getPostHeader(postData);
                $.ajax({
                    headers:{
                        "token":this.getUrlPar("token")
                    },
                    url:this.posturl+'/api/taoke/compare_good',
                    headers:header,
                    url:'/api/taoke/compare_good',
                    type:"post",
                    dataType:"json",
                    data:{
                        content:that.txtareatxt
                    }
                    data:postData
                }).done(function(res){
                    that.loading = false;
                    that.issearch=true;
                    if(res.code == 0){
                        that.goodsItem=res.data.list;
                    }                       
@@ -451,39 +587,49 @@
            },
            handleCdetailFavorite:function(item)
            {
                switch(item.sourceType)
                if(this.isshowfan)
                {
                    case "tb":
                        uni.navigateTo({
                            url: '/pages/goods/goodsDetail?id=' + item.goodsId+'&frompage=freebuy'
                        });
                        break;
                    default:
                        var itemsStr=this.Infoformat(JSON.stringify(item));
                        uni.navigateTo({
                            url: '/pages/goods/goodsDetail?sourcefrom=compareprice&info=' + itemsStr+'&frompage=compareprice'
                        });
                        break;
                    switch(item.sourceType)
                    {
                        case "tb":
                        case "tm":
                            uni.navigateTo({
                                url: '/pages/goods/goodsDetail?id=' + item.goodsId+'&frompage=compareprice'
                            });
                            break;
                        default:
                            var itemsStr=this.Infoformat(JSON.stringify(item));
                            uni.navigateTo({
                                url: '/pages/goods/goodsDetail?sourcefrom=compareprice&info=' + itemsStr+'&frompage=compareprice'
                            });
                            break;
                    }
                }
                else{
                    var itemsStr=this.Infoformat(JSON.stringify(item));
                    uni.navigateTo({
                        url: '/pages/goodDetail/index?id=' + item.goodsId+'&info'+itemsStr
                    });
                }
            },
            likeDataGet:function(postData)
            {
                var _this=this;
                $.ajax({
                    headers:{
                        "token":this.getUrlPar("token")
                    },
                    url:_this.posturl+'/api/taoke/get_goods_things',
                    type:"post",
                    dataType:"json",
                    async: false,
                    data:{
                var data={
                        deviceType:postData.postData,
                        deviceValue:postData.deviceValue,
                        pageId:1,
                        pageSize:10,
                        type:1
                    }
                    };
                var header=this.getPostHeader(data);
                $.ajax({
                    headers:header,
                    url:'/api/taoke/get_goods_things',
                    type:"post",
                    dataType:"json",
                    async: false,
                    data:data
                }).done(function(res){
                    _this.goodsItem=res.data.list;
                    console.log(res);                   
@@ -523,17 +669,55 @@
                if(r !=null)return unescape(r[2]);
                 return null;
            },
            getPostHeader(data)
            {
                var token=this.getUrlPar("token");
                if(token)
                {
                    return {
                        "token":token
                    }
                }
                else{
                    token=this.getUrlPar("dfgtoken");
                    if(token)
                    {
                        let keysList=Object.keys(data);
                        let enstr="";
                        if(keysList&&keysList.length>0)
                        {
                            let curData=data;
                            keysList.forEach(function(value,index){
                                enstr+=value+ (JSON.stringify(data[value]).replace(/^\"|\"$/g,''));
                            })
                        }
                        enstr="dfg"+enstr+"apph5"+token;
                        enstr=hex_md5(enstr);
                        enstr+='.'+token
                        return {
                            "dfgsessionkey":enstr
                         }
                    }
                }
            }
        },
        mounted:function(){
           /*  var postData={
                postData:'OAID',
                deviceValue:''
            };
            this.likeDataGet(postData); */
            var that=this;
            document.addEventListener('UniAppJSBridgeReady', function() {
                that.getLikeGoods();
            });
            var token=this.getUrlPar("token");
            if(token)
            {
                this.isshowfan=true;
                var that=this;
                    document.addEventListener('UniAppJSBridgeReady', function() {
                    that.getLikeGoods();
                });
            }
            else{
                var postData={
                    postData:'OAID',
                    deviceValue:''
                 };
                 this.likeDataGet(postData);
            }
        }
    })
</script>