zhaojs
2023-08-01 cc6247528b559cf6a9468591bb889bb58dc14199
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
<template>
    <view class="item-v" @click="getShareLink(items)">
        <view class="item-img">
            <image :src="items.mainPic">
            </image>
        </view>
        <view class="item-txt">
            <view style="display: flex;">
                <image :src="items.labelImg"></image>
                <view class="item-txt-title">{{items.title}}</view>
            </view>
            <view class="item-coupon">
                <view class="cop-con">
                    <view class="cop-txt">券</view>
                    <view class="cop-money">¥{{items.couponPrice}}</view>
                </view>
            </view>
            <view class="item-bottom">
                <view class="item-price">
                    <view>券后价<span class="item-price-prc">¥{{items.actualPrice}}</span></view>
                    <view style="text-decoration: line-through;">原价:{{items.originalPrice}}</view>
                </view>
 
                <view class="item-copy">复制链接</view>
 
            </view>
        </view>
    </view>
</template>
 
<script>
    export default {
        props: {
            items: Object,
            isrecord: {
                type: Boolean,
                default: false
            },
        },
        created() {},
        methods: {
            oncopy(txt) {
                let copyObj = {
                    data: txt,
                    success: function() {
                        uni.showToast({
                            title: '优惠链接已复制,现在打开手机淘宝,领取优惠券吧~',
                            icon: 'none',
                            duration: 2500
                        });
                    },
                    fail: function(e) {
                        console.log(e);
                    }
                };
                uni.setClipboardData(copyObj);
            },
            getShareLink(items) {
                if(this.isrecord)
                {//记录点击
                    this.recordClick(items.goodsId,items.sourceType,items.dtitle,items.actualPrice);
                }
                var goodsid=items.goodsId;
                var that = this;
                let postdata = {
                    goodsId: goodsid
                };
                uni.showLoading({
                    title: '复制中..',
                    mask: true
                });
                this.$http.post('/api/taoke/get_privilege_link',
                    postdata
                ).then(e => {
                    uni.hideLoading();
                    if (e.code != 0) {
                        return;
                    }
                    this.oncopy(e.data.info.longTpwd);
                }).catch(function(err) {
                    console.log(err);
                })
            },
            recordClick(goodsid,plat,title,act_price)
            {
                let postdata={
                    goodsid:goodsid,
                    plat:plat,
                    title:title,
                    act_price:act_price
                }
                this.$http.post('/api/activity/recordItemClick',
                    postdata
                ).then(e => {
                    
                }).catch(function(err) {
                    console.log(err);
                })
            }
        },
    }
</script>
 
<style>
    .item-price-prc {
        color: #fe3a3f;
        font-size: 1.2rem;
        margin-right: 0.4rem;
        font-weight: 500;
    }
 
    .cop-txt {
        padding: 0.1rem;
    }
 
    .cop-money {
        display: flex;
        align-items: center;
        height: 100%;
        font-weight: 400;
        color: #ff4d42;
        background: #fff;
        padding: 0.1rem;
    }
 
    .cop-con {
        display: inline-flex;
        background: linear-gradient(0deg, #ff753c, #ff4b42);
        color: #fff;
        padding: 0.05rem;
        font-size: 0.9rem;
 
    }
 
    .item-v {
        display: flex;
        justify-content: space-between;
        padding: 0.5rem;
        background: #fff;
        border-radius: 0.3rem;
        width: 92%;
        margin: 0 auto;
        margin-bottom: 0.3rem;
    }
 
    .item-img {
        width: 20%;
    }
 
    .item-img image {
        width: 6rem;
        height: 6rem;
    }
 
    .item-txt {
        width: 71%;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }
 
    .item-txt image {
        width: 1.6rem;
        height: 0.9rem;
    }
 
    .item-txt-title {
        font-size: 0.9rem;
        margin-left: 0.3rem;
        text-overflow: -o-ellipsis-lastline;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        -webkit-box-orient: vertical;
        width: 90%;
    }
 
    .item-price {
        display: flex;
        font-size: 0.8rem;
        align-items: baseline;
        color: #8d8484;
    }
 
    .item-bottom {
        display: flex;
        justify-content: space-between;
    }
 
    .item-copy {
        width: 5.92rem;
        height: 1.66rem;
        background: linear-gradient(-90deg, #fe3a3f, #faa450);
        font-size: 0.9rem;
        font-weight: 500;
        color: #fffefd;
        line-height: 1.66rem;
        text-align: center;
        border: 0;
        outline: 0;
        float: right;
        border-radius: 1rem;
    }
</style>