zhaojs
2023-05-16 9707c4410a67d6a6d63b634f53565711d2d337da
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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
Ω<template>
    <view class="turnChain-wrapper wrapperLayer">
        <titleBar :titleText='"转链工具"' :pageForm='"turnChain"'></titleBar>
        <view class="page-fixed colCen">
            <view class="topbarbox"></view>
            <view class="notice-bar-container rowCen">
                <view class="horn iconfont">
                    &#xe64c;
                </view>
                <view class="notice-txt">
                    <view class="txt-box">
                        通过转链后的链接所产生的订单才能进入您的佣金中哦~
                    </view>
                </view>
            </view>
 
            <view class="platform-bar-container">
                <scroll-view class="plat-scrollview" scroll-x scroll-with-animation>
                    <block v-for="(items,index) in platformList">
                        <view class="plat-items" :class="platCurrent==items.type?'plat-active':''"
                            @tap="platclk(items.type,items.platxt)">
                            <view class="items-content rowCenCen">
                                <view>{{items.label}}</view>
                            </view>
                        </view>
                    </block>
                </scroll-view>
            </view>
        </view>
 
        <view class="pageContent-container colCen">
            <view class="turn-container colCen">
                <view class="content-title rowCenBet">
                    <view class="left-txt rowCenCen">
                        <image v-if="backstate==1" src="../../../static/images/mine/scu.png" mode=""></image>
                        <image v-if="backstate==2" src="../../../static/images/mine/warn.png" mode=""></image>
                        <view :style="backstate==0?'':(backstate==1?'color:#1ED772':'color:#FE3738')">{{backstate==0?'待转换链接':(backstate==1?'转链成功':'转链失败')}}</view>
                    </view>
                    <view class="clean-btn" @tap="clean()">
                        清空
                    </view>
                </view>
                <view class="textarea-bac colCen">
                    <textarea class="txtstyle" :maxlength='-1' v-model="txtarea" :placeholder="platxt" />
                    <view class="bottom-bar rowCenEnd">
                        <view @tap="paste()">粘贴</view>
                    </view>
                </view>
 
                <view class="btn-container rowCen">
                    <view class="btn-box rowCenCen" v-if="backstate==1" @tap="copy()">
                        复制链接
                    </view>
                    <view class="btn-box rowCenCen" v-else @tap="turnChain()">
                        一键转换成我的链接
                    </view>
                </view>
            </view>
 
            <view class="colSetting-container colCen">
                <image class="jcpic"
                    src="https://hxshapp.oss-cn-beijing.aliyuncs.com/app/img/20210123/zhuanlian.png" mode="widthFix">
                </image>
            </view>
        </view>
        <!-- taobao -->
        <u-popup v-model="empowerModel" mode="center" border-radius="12">
            <empowerModel @closemodel='closeMdl' @updataInfo='updataUser'></empowerModel>
        </u-popup>
        <u-popup v-model="pddempowerModel" mode="center" border-radius="12">
            <pddEmpower @closemodel='closeMdlPdd'></pddEmpower>
        </u-popup>
    </view>
</template>
 
<script>
    import {
        mapMutations
    } from "vuex";
    import titleBar from '@/components/backTitlebar.vue'
    import empowerModel from '@/components/empowerModel.vue'
    import pddEmpower from '@/components/pddempower.vue'
    
    import utils from '@/utils/utils.js'
    export default {
        components: {
            titleBar,
            empowerModel,
            pddEmpower
        },
        data() {
            return {
                user: '',
                empowerModel: false,
                pddempowerModel:false,
                platCurrent: 1,
                platxt: '1.请粘贴您需要转换的淘宝文案/链接和淘口令/淘宝商品链接;不支持券链接\n2.多个链接粘贴在一起会导致识别失败,失败后,请单个链接转链\n3.若内容存在无法识别的文本,转链失败以后,可尝试分批转换',
                txtarea: '',
                backstate: 0,
                goodsList: [],
                platformList: [{
                        label: '淘宝',
                        type: 1,
                        platxt: '1.请粘贴您需要转换的淘宝文案/链接和淘口令/淘宝商品链接;不支持券链接\n2.多个链接粘贴在一起会导致识别失败,失败后,请单个链接转链\n3.若内容存在无法识别的文本,转链失败以后,可尝试分批转换'
                    },
                    {
                        label: '京东',
                        type: 2,
                        platxt: '1.可以是商品链接+文案、活动链接+文案、店铺链接+文案,例如:https://item.jd.com/100007926326.html 或哈密瓜5斤,9.9元https://u.jd.com/wKEHUQX\n2.特殊符号可会导致识别失败,失败后,请修改文案后再次转链 '
                    },
                    {
                        label: '拼多多',
                        type: 3,
                        platxt: '1.可以是商品链接、商品id 例如:https://p.pinduoduo.com/vgKyBIXv\n2.每次仅支持单个链接转链'
                    },
                    {
                        label: '唯品会',
                        type: 4,
                        platxt: '1.可以是商品链接、活动链接、例如:https://detail.vip.com/detail-1710613695-6919024311620373535.html\n2.多个链接粘贴在一起会导致识别失败,失败后,请单个链接转链    '
                    },
                    {
                        label: '抖音',
                        type: 5,
                        platxt: '1.可以是商品链接、例如:https://v.douyin.com/M5vpFKe/\n2.多个链接粘贴在一起会导致识别失败,失败后,请单个链接转链    '
                    }
                    // {
                    //     label:'苏宁'
                    // },
                    // {
                    //     label:'唯品会'
                    // }
                ],
            }
        },
        watch: {
            txtarea() {
                this.backstate = 0
            }
        },
        onLoad() {
            if(!this.hasLogin){
                uni.reLaunch({
                    url:"/pages/login/wxlogin"
                })
            }
        },
        methods: {
            updataUser() {
                var that = this;
                this.$u.api.getUserInfo({}).then(e => {
                    utils.setCache('userInfo', e.data.userinfo)
                    that.user = e.data.userinfo;
                    if(that.platCurrent == 1){
                        if (that.user.t_relation_id == "") {
                            that.empowerModel = true
                        } else {
                            that.empowerModel = false
                            that.doChain();
                        }
                    }else if(that.platCurrent == 3){
                        if(that.user.pdd_authority == 1){
                            that.empowerModel = false
                            that.doChain();
                        }else{
                            that.$u.api.checkPddAuth({}).then(e => {
                                var res = e.data;
                                if(res.bind == 1){
                                    that.doChain();
                                }else{
                                    that.pddempowerModel = true
                                }
                            }).catch(function (err) {
                            })
                        }
                    }
                    
                }).catch(function(err) {})
            },
            platclk(type, txt) {
                this.platCurrent = type
                this.platxt = txt
                this.backstate = 0
                this.txtarea = ''
            },
            closeMdl() {
                this.empowerModel = false
            },
            closeMdlPdd() {
                this.pddempowerModel = false
            },
            turnChain() {
                if (this.txtarea == "") return this.$alert("转链内容不能为空");
                if (this.platCurrent == 1 || this.platCurrent == 3) {
                    this.updataUser()
                } else {
                    this.doChain();
                }
            },
            doChain() {
                var that = this;
                this.$u.api.getChainTurning({
                    content: encodeURIComponent(this.txtarea),
                    type: this.platCurrent
                }).then(e => {
                    console.log(e)
                    if (e.code != 0) return that.$alert(e.msg)
                    if (e.data.info == "") {
                        that.$alert('转链失败');
                        that.$nextTick(() => {
                            that.backstate = 2
                        })
                    } else {
                        that.$alert('转链成功');
                        that.txtarea = e.data.info
                        that.$nextTick(() => {
                            that.backstate = 1
                        })
                    }
                }).catch(function(err) {})
            },
 
            clean() {
                this.txtarea = ''
                this.backstate = 0
            },
            paste() {
                uni.getClipboardData({
                    success: res => {
                        this.txtarea = res.data
                    }
                })
            },
            copy() {
                uni.setClipboardData({
                    data: this.txtarea,
                    success: () => {
                        uni.showToast({
                            icon: 'none',
                            title: '复制成功!'
                        })
                    }
                })
            }
        }
    }
</script>
 
<style lang="scss">
    .juan {
        height: 28rpx;
        background: linear-gradient(90deg, #ff8873 0, #ff4f4f 100%);
        border-radius: 4rpx;
        padding: 0 10rpx 0 2rpx;
        font-size: 19rpx;
        font-weight: 400;
        color: #fff;
        line-height: 28rpx;
    }
 
    .juan text {
        background: #fff;
        border-radius: 2rpx 0 0 2rpx;
        font-size: 20rpx;
        color: #FE3A33;
        margin: auto 10rpx auto 0;
        min-width: 24rpx;
        max-width: 24rpx;
        min-height: 24rpx;
        max-height: 24rpx;
        display: inline-block;
        line-height: 24rpx;
        text-align: center;
        vertical-align: middle;
        margin-top: -4rpx;
    }
 
    .turnChain-wrapper {
        width: 100%;
 
        .page-fixed {
            width: 100%;
            position: fixed;
            top: 90rpx;
            z-index: 5;
 
            .notice-bar-container {
                width: 100%;
                height: 50rpx;
                background: #FEF9F6;
 
                .horn {
                    font-size: 22rpx;
                    font-weight: 500;
                    color: #FE3738;
                    margin-left: 20rpx;
                    white-space: nowrap;
                }
 
                .notice-txt {
                    position: relative;
                    width: 100%;
                    height: 50rpx;
                    padding-left: 30rpx;
                    overflow: hidden;
 
                    .txt-box {
                        position: absolute;
                        height: 50rpx;
                        line-height: 50rpx;
                        white-space: nowrap;
                        font-size: 22rpx;
                        font-weight: 500;
                        color: #FE3738;
                        animation: slideLeft calc(var(--left)/30*1s) linear infinite;
                    }
 
                    @keyframes slideLeft {
                        0% {
                            left: 0rpx;
                        }
 
                        100% {
                            left: calc(0rpx - (var(--left))*1rpx)
                        }
                    }
                }
            }
 
            .platform-bar-container {
                width: 100%;
                height: 86rpx;
                background: #FFFFFF;
 
                .plat-scrollview {
                    width: 100%;
                    height: 100%;
                    white-space: nowrap;
 
                    .plat-items {
                        display: inline-block;
                        height: 86rpx;
                        margin-right: 70rpx;
 
                        .items-content {
                            height: 100%;
                            font-size: 28rpx;
                            font-weight: 500;
                            color: #333333;
                            border-bottom: 4rpx solid transparent;
                        }
                    }
 
                    .plat-items:nth-child(1) {
                        margin-left: 40rpx;
                    }
 
                    .plat-active {
                        .items-content {
                            font-weight: bold;
                            color: #FE3738;
                            border-bottom: 4rpx solid #FE3738;
                        }
                    }
                }
            }
        }
 
        .pageContent-container {
            width: 100%;
            padding: 0 20rpx;
            margin-top: 155rpx;
 
            .colSetting-container {
                width: 100%;
                background: #FFFFFF;
                margin-top: 20rpx;
                border-radius: 16rpx;
 
                .listbox {
                    width: 100%;
 
                    .goods-items-container {
                        width: 100%;
                        height: 240rpx;
                        padding: 0 20rpx;
                        border-top: 1rpx solid #f5f5f5;
 
                        .left-imagecontent {
                            width: 200rpx;
                            height: 200rpx;
                            border-radius: 8rpx;
                            overflow: hidden;
                        }
 
                        .right-goodsinfo-container {
                            margin-left: 20rpx;
                            width: 460rpx;
                            height: 200rpx;
 
                            .goodsnameinfo-content {
                                width: 100%;
 
                                .typeIcon-content {
                                    width: 60rpx;
                                    height: 26rpx;
                                    margin-right: 5rpx;
                                }
 
                                .tradename {
                                    width: 400rpx;
                                    overflow: hidden;
                                    text-overflow: ellipsis;
                                    white-space: nowrap;
                                    font-size: 28rpx;
                                    line-height: 34rpx;
                                    font-weight: 500;
                                    color: #333333;
                                }
                            }
 
                            .cardbottom-container {
                                width: 100%;
 
                                .price-saleNums-container {
                                    width: 100%;
                                    line-height: 30rpx;
                                    margin-bottom: 16rpx;
 
                                    .greytxt {
                                        font-size: 20rpx;
                                        font-weight: 400;
                                        color: #999999;
                                        line-height: 30rpx;
                                    }
 
                                    .rmb {
                                        font-size: 20rpx;
                                        font-weight: bold;
                                        color: #FF4242;
                                        line-height: 30rpx;
                                    }
 
                                    .pricebox {
                                        font-size: 28rpx;
                                        line-height: 34rpx;
                                        font-weight: bold;
                                        color: #FF4242;
                                    }
                                }
 
                                .discounts-container {
                                    width: 100%;
                                    margin-bottom: 16rpx;
 
                                    .coupon-box {
                                        width: 102rpx;
                                        height: 30rpx;
                                        background: url(@/static/images/goods/couponbac.png)no-repeat;
                                        background-size: 100% 100%;
                                        font-size: 20rpx;
                                        font-weight: 500;
                                        color: #FF4242;
                                    }
 
                                    .back-box {
                                        width: 100rpx;
                                        height: 30rpx;
                                        background: linear-gradient(-90deg, #7619EC, #A429F3);
                                        border-radius: 5rpx;
                                        margin-left: 8rpx;
                                        font-size: 20rpx;
                                        font-weight: 500;
                                        color: #FFFFFF;
                                    }
                                }
 
                                .saleNum-content {
                                    //width: 100%;
                                    font-size: 20rpx;
                                    font-weight: 400;
                                    line-height: 34rpx;
                                    color: #999999;
                                }
 
                                .shopEnter-bar {
                                    width: 100%;
                                    line-height: 34rpx;
 
                                    .storename {
                                        font-size: 20rpx;
                                        font-weight: 400;
                                        color: #999999;
                                    }
 
                                    .enterbtn {
                                        .enterStore {
                                            font-size: 20rpx;
                                            font-weight: 400;
                                            color: #333333;
                                            margin: 0 5rpx;
                                        }
 
                                        .arrow {
                                            width: 6rpx;
                                            height: 12rpx;
                                            margin-top: 4rpx;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
 
            .turn-container {
                width: 100%;
                height: 560rpx;
                background: #FFFFFF;
                border-radius: 16rpx;
                padding: 0 27rpx;
 
                .content-title {
                    width: 100%;
                    height: 87rpx;
                    font-size: 28rpx;
                    font-weight: 500;
 
                    .left-txt {
                        color: #333333;
 
                        image {
                            width: 26rpx;
                            height: 26rpx;
                            margin-right: 10rpx;
                        }
                    }
 
                    .clean-btn {
                        color: #666666;
                    }
                }
            }
 
            .textarea-bac {
                width: 100%;
                height: 330rpx;
                background: #F8F8F8;
                border-radius: 16rpx;
                padding: 30rpx;
 
                .txtstyle {
                    height: 240rpx;
                    font-size: 24rpx;
                    font-weight: 500;
                    color: #000000;
                }
 
                .bottom-bar {
                    width: 100%;
                    text-align: right;
                    font-size: 24rpx;
                    font-weight: 500;
                    color: #999999;
                }
            }
 
            .btn-container {
                width: 100%;
                padding: 0 10rpx;
                margin-top: 30rpx;
 
                .btn-box {
                    width: 100%;
                    height: 86rpx;
                    background: #FD002F;
                    border-radius: 43rpx;
                    font-size: 30rpx;
                    font-weight: 500;
                    color: #FFFFFF;
                }
            }
 
            .jcpic {
                width: 100%;
                margin-top: 45rpx;
            }
        }
    }
</style>