Blame view

public/js/home/returns-apply.js 20.8 KB
weiqingting authored
1 2 3 4 5
/**
 * 退换货申请
 * @author: yyqing<yanqing.yang@yoho.cn>
 * @date: 2016/2/29
 */
陈轩 authored
6
var $ = require('yoho-jquery'),
7 8
    Addr = require('./common-address'),
    _dialog = require('../common/dialog');
weiqingting authored
9
郝肖肖 authored
10 11
var reTipsHbs = require('hbs/home/orders/re-tips.hbs');
yyq authored
12
var stringHandle = require('../common/stringHandle');
Targaryen authored
13
weiqingting authored
14 15 16 17
var $goodsTable = $('#goods-table'),
    $checkBox = $goodsTable.find('input[type="checkbox"]'),
    $reasons = $goodsTable.find('.return-reason'),
    $refundType = $('input[name="refund-type"]'),
hongweigao authored
18 19 20
    $areaCode = $('#streets'),
    $bankNameSpan = $('#bank-name-span'),
    $bankId = $('#bank-id');
weiqingting authored
21 22 23 24 25 26 27 28 29 30 31 32 33

var $refundInfo = $('#refund-pay-info'),
    $payYoho = $refundInfo.find('.type-yoho'),
    $payBank = $refundInfo.find('.type-bank'),
    $payAli = $refundInfo.find('.type-alipay');

var $exchange = $('.exchange-detail'),
    $hidePhone = $exchange.find('input[name="hide-phone"]'),
    $refundMode = $exchange.find('.refund-mode');

var $submitBox = $('.submit-box'),
    $waitPoint = $submitBox.find('.wait-gif span');
陈轩 authored
34
var pageType = 0, // 0-换货  1-退货
weiqingting authored
35 36 37 38 39 40
    orderCode = $('#order-code').val(),
    defaultArea = $exchange.find('input[name="hide-area"]').val(),
    defaultPhone = $hidePhone.val(),
    disPhone = '',
    verifyTip = '',
    colorSize = {},
hongweigao authored
41
    timer,
htoooth authored
42 43
    needSubbranch = '',
    refund;
hongweigao authored
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60

var option = {
    className: 'refund-dialog',
    btns: [
        {
            id: 'refund-sure',
            btnClass: ['refund-sure'],
            name: '确定提交'
        },
        {
            id: 'refund-cancel close',
            btnClass: ['refund-cancel close'],
            name: '返回修改'
        }
    ]
};
61 62
var refundConfirm = {};
63
var Dialog = _dialog.Dialog,
64
    Confirm = _dialog.Confirm;
weiqingting authored
65
hongweigao authored
66 67 68 69 70 71
var resetImg = function($p) {
    $p.removeClass('selected');
    $p.find('input[name=imgs]').val('');
    $p.find('img').attr('src', '');
};
陈轩 authored
72
require('../plugins/jquery.qupload');
OF1706 authored
73
require('../common/ajaxfileupload');
weiqingting authored
74 75 76 77 78 79 80

if (defaultPhone) {
    $hidePhone.remove();
    disPhone = defaultPhone.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2');
    $exchange.find('input[name="phone"]').val(disPhone);
}
郝肖肖 authored
81
// 退货结算
郝肖肖 authored
82
function getRefundCompute() {
郝肖肖 authored
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
    var goods = [];

    if (!pageType) {
        return false;
    }

    $goodsTable.find('input[type="checkbox"]:checked').each(function() {
        var $par = $(this).closest('tr'),
            goodsInfo;

        goodsInfo = {
            product_skn: $par.find('input[name="skn"]').val(),
            product_skc: $par.find('input[name="skc"]').val(),
            product_sku: $par.find('input[name="sku"]').val(),
            goods_type: $par.find('input[name="typeid"]').val(),
98
            last_price: $par.find('input[name="price"]').val()
郝肖肖 authored
99 100 101 102 103 104
        };

        goods.push(goodsInfo);
    });

    if (goods.length <= 0) {
郝肖肖 authored
105
        $('.re-tips').html(reTipsHbs({}));
郝肖肖 authored
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
        return false;
    }

    $.ajax({
        type: 'POST',
        url: '/home/returns/api/refundCompute',
        data: {
            orderCode: orderCode,
            goods: JSON.stringify(goods)
        }
    }).then(function(d) {
        if (d.code === 200) {
            $('.re-tips').html(reTipsHbs(d.data));
        }
    });
}
yyq authored
123 124 125 126 127 128 129 130 131 132 133
function syncRefundMode() {
    var skns = [];

    if (!defaultArea) {
        return;
    }

    $goodsTable.find('input[type="checkbox"]:checked').each(function() {
        skns.push($(this).siblings('input[name="skn"]').val());
    });
weiqingting authored
134 135 136 137
    $.ajax({
        type: 'POST',
        url: '/home/returns/getDelivery',
        data: {
yyq authored
138 139 140
            orderCode: orderCode,
            areaCode: defaultArea,
            skns: skns.join(',')
weiqingting authored
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
        }
    }).then(function(jsonData) {
        var _html = '';

        if (jsonData.code === 200) {
            $.each(jsonData.data, function(k, v) {
                var checked = '';

                if (v.is_default === 'Y') {
                    checked = 'checked="checked"';
                }
                _html += '<input type="radio" name="delivery-tpye" value="' +
                    v.id + '" ' + checked + '"">' + v.name;
            });
            $refundMode.html(_html);
        }
    });
}

function setBackInput(type) {
    $payYoho.hide();
    if (type === 2) {
        $payBank.show();
        $payAli.hide();
        $payYoho.hide();
    } else if (type === 3) {
        $payAli.show();
        $payBank.hide();
        $payYoho.hide();
    } else if (type === 4) {
        $payYoho.show();
        $payBank.hide();
        $payAli.hide();
    }
}
177
function formatExchangeOption($dom, type) {
yyq authored
178 179 180 181 182
    var sku = $dom.data('sku'),
        skc = $dom.data('skc');
    var $optItem,
        $colorDom,
        $colorItem;
183 184 185 186 187 188 189 190 191 192 193 194
    var cd;

    if (!$dom || !sku) {
        return;
    }

    $dom.children().each(function() {
        if (+sku === +$(this).attr('value')) {
            $optItem = $(this);
        }
    });
yyq authored
195 196 197 198 199 200 201
    $colorDom = $dom.closest('.exchange-choose-wrap').find('.exchange-color');

    $colorDom.children().each(function() {
        if (+skc === +$(this).attr('value')) {
            $colorItem = $(this);
        }
    });
202 203 204

    type = type * 1;
    if (!type || type === 4 || type === 6 || type === 8) {
yyq authored
205 206
        $optItem && $optItem.removeAttr('disabled');
        $colorItem && $colorItem.removeAttr('disabled');
207 208 209 210 211 212 213 214 215 216
    } else {
        if (+$dom.val() === +sku) {
            $dom.val(0);
            cd = new Confirm({
                content: '无理由换货不可选择换为相同颜色尺码',
                cb: function() {
                    cd.close();
                }
            }).show();
        }
yyq authored
217 218 219 220 221 222 223 224 225 226
        $optItem && $optItem.attr('disabled', 'disabled');

        if (colorSize[skc].length === 1 && +colorSize[skc][0].id === +sku) {
            if (+$colorDom.val() === +skc) {
                $colorDom.val(0).change();
            }
            $colorItem && $colorItem.attr('disabled', 'disabled');
        } else {
            $colorItem && $colorItem.removeAttr('disabled');
        }
227 228 229
    }
}
weiqingting authored
230 231 232 233 234 235 236 237 238
if ($refundInfo.length) {
    pageType = 1;

    $refundType.each(function() {
        if ($(this).prop('checked')) {
            setBackInput($(this).val() * 1);
        }
    });
} else if (defaultArea) {
yyq authored
239
    syncRefundMode();
weiqingting authored
240 241 242 243
}

defaultArea = defaultArea ? defaultArea : '';
Addr.loadAllData(defaultArea, {
hongweigao authored
244 245
    areaDomId: 'area',
    streetsDomId: 'streets'
weiqingting authored
246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266
});

// 页面获取size列表数据
$goodsTable.find('.sizeinfo').each(function() {
    var sizes = [];

    $(this).children().each(function() {
        sizes.push($(this).data());
    });
    colorSize[$(this).data().id] = sizes;
});

$reasons.change(function() {
    var $par = $(this).parent().parent(),
        type = $(this).val() * 1;

    if (type === 4 || type === 6 || type === 8) {
        $par.next().show();
    } else {
        $par.next().hide();
    }
267 268

    formatExchangeOption($par.find('.exchange-size'), type);
weiqingting authored
269 270
});
hongweigao authored
271 272 273 274 275 276 277 278 279 280 281
// 切换支行银行信息
function switchSubBank() {
    needSubbranch = $bankId.children('option:selected').attr('data');
    if (needSubbranch === 'Y') {
        $bankNameSpan.removeClass('hide');
    } else {
        $bankNameSpan.addClass('hide');
    }
    $refundInfo.find('input[name="bank-name"]').val('');
}
hongweigao authored
282 283 284 285 286
// 选择退款银行
$bankId.change(function() {
    switchSubBank();
});
weiqingting authored
287 288 289 290 291 292 293 294 295
$checkBox.change(function() {
    var $par = $(this).parent().parent();

    if ($(this).prop('checked')) {
        $par.find('select').prop('disabled', false);
    } else {
        $par.find('select').val(0).prop('disabled', true);
        $par.next().hide();
    }
郝肖肖 authored
296
yyq authored
297
    syncRefundMode();
郝肖肖 authored
298
    getRefundCompute();
weiqingting authored
299 300 301
});

$goodsTable.on('change', '.exchange-color', function() {
yyq authored
302
    var $warp = $(this).closest('.exchange-choose-wrap').parent(),
303
        $warpSize = $warp.find('.exchange-size'),
weiqingting authored
304 305 306 307 308 309 310 311
        _html = '<option value="0">请选择尺码</option>',
        id = $(this).val();

    if (colorSize[id]) {
        $.each(colorSize[id], function(k, v) {
            _html += '<option value="' + v.id + '">' + v.name + '</option>';
        });
    }
312 313 314
    $warpSize.html(_html).val(0);

    formatExchangeOption($warpSize, $warp.find('.return-reason').val());
weiqingting authored
315 316
});
OF1706 authored
317 318
$goodsTable.on('click', '.btn-del', function(e) {
    var $p = $(this).closest('li');
weiqingting authored
319
OF1706 authored
320 321 322
    e.stopPropagation();
    resetImg($p);
});
weiqingting authored
323
hongweigao authored
324
// 上传图片事件
OF1706 authored
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
function fileChangeEvent() {

    // 图片上传
    $goodsTable.on('change', 'input[type=file]', function() {

        var $f = $(this);
        var $p = $f.parent().siblings('.up-image-list');

        var $unSelectLi = $p.find('li:not(.selected)');

        if ($f.val()) {
            $.ajaxFileUpload({
                url: '/common/upload/image',
                secureuri: false,
                fileElementId: $f,
                data: {
                    bucket: 'evidenceImages'
                },
                dataType: 'json',
                success: function(data /* , status */) {

                    var resData = data.data,
                        len = resData.images.length > $unSelectLi.length ?
                            $unSelectLi.length : resData.images.length;
hongweigao authored
350
                    var url,
hongweigao authored
351 352 353
                        relaUrl,
                        i,
                        $li;
hongweigao authored
354
OF1706 authored
355 356
                    if (data && data.code === 200 && data.data && data.data.images) {
hongweigao authored
357 358
                        for (i = 0; i < len; i++) {
                            $li = $($unSelectLi[i]);
OF1706 authored
359 360

                            url = resData.images[i] +
hongweigao authored
361 362
                                '?imageMogr2/thumbnail/130x130/extent/130x130/background' +
                                '/d2hpdGU=/position/center/quality/90';
OF1706 authored
363 364 365 366 367 368 369 370
                            relaUrl = resData.imagesList[i];
                            $li.find('img').attr('src', url).attr('source-url', url);
                            $li.find('input[name=imgs]').val(relaUrl);
                            $li.addClass('selected');
                        }


                    } else if (data && data.message) {
hongweigao authored
371
                        alert(data.message);//eslint-disable-line
OF1706 authored
372 373
                    }
                },
hongweigao authored
374
                error: function() {    /** data, status, e **/
hongweigao authored
375
                    alert('上传失败,请稍后再试!');//eslint-disable-line
OF1706 authored
376 377 378
                },
                complete: function() {
                    $f.clone().replaceAll($f);
weiqingting authored
379 380 381 382
                }
            });
        }
    });
OF1706 authored
383 384 385
}

hongweigao authored
386
fileChangeEvent();// 初始化上传图片事件
weiqingting authored
387
hongweigao authored
388
$exchange.on('change', '#streets', function() {
yyq authored
389
    defaultArea = $(this).val() * 1;
weiqingting authored
390
yyq authored
391
    syncRefundMode();
weiqingting authored
392 393 394 395 396 397 398 399
});

$refundType.change(function() {
    var type = $(this).val() * 1;

    setBackInput(type);
});
yyq authored
400 401 402 403
$('#bank-card').keyup(function() {
    var $this = $(this),
        v = $this.val();
yyq authored
404
    /(\S{5}|\D)/.test(v) && $this.val($.trim(v.replace(/\D/g, '').replace(/(.{4})/g, '$1 ')));
yyq authored
405 406 407
});

weiqingting authored
408 409 410 411 412 413 414 415 416 417 418 419 420 421 422
// 打包退换货商品信息
function packGoogsList() {
    var goods = [],
        type = '换货';

    if (pageType) {
        type = '退货';
    }
    if (!$checkBox.length) {
        verifyTip = '没有可以' + type + '的商品';
    }

    $checkBox.each(function() {
        var $par = $(this).parent().parent(),
            $next = $par.next(),
yyq authored
423
            goodsInfo, cskc;
weiqingting authored
424 425 426 427 428 429 430 431 432 433 434

        if (verifyTip.length) {
            return;
        }

        if ($(this).prop('checked')) {
            goodsInfo = {
                product_skn: $par.find('input[name="skn"]').val(),
                product_skc: $par.find('input[name="skc"]').val(),
                product_sku: $par.find('input[name="sku"]').val(),
                goods_type: $par.find('input[name="typeid"]').val(),
435
                last_price: $par.find('input[name="price"]').val(),
weiqingting authored
436 437 438 439 440 441 442 443 444
                reason: $par.find('.return-reason').val() * 1
            };

            if (pageType) {
                goodsInfo.returned_reason = goodsInfo.reason;
            } else {
                goodsInfo.exchange_reason = goodsInfo.reason;
                goodsInfo.new_product_sku = $par.find('.exchange-size').val() * 1;
yyq authored
445 446
                cskc = $par.find('.exchange-color').val() * 1;
yyq authored
447
                $par.find('.exchange-color').children().each(function() {
yyq authored
448 449 450 451 452
                    if (cskc === +$(this).attr('value')) {
                        goodsInfo.new_goods_id = $(this).data('goodsid');
                    }
                });
weiqingting authored
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
                if (!verifyTip && !goodsInfo.new_goods_id) {
                    verifyTip = '请选择要换的颜色';
                }

                if (!verifyTip && !goodsInfo.new_product_sku) {
                    verifyTip = '请选择要换的尺码';
                }
            }
            if (!verifyTip && !goodsInfo.reason) {
                verifyTip = '请选择' + type + '原因';
            }

            if (goodsInfo.reason === 4 ||
                goodsInfo.reason === 6 ||
                goodsInfo.reason === 8) {
                goodsInfo.remark = $.trim($next.find('textarea').val());
                goodsInfo.evidence_images = [];
                $next.find('input[name="imgs"]').each(function() {
                    goodsInfo.evidence_images.push($(this).val());
                });

                if (!verifyTip && !goodsInfo.remark) {
                    verifyTip = '请填写' + type + '描述';
                }

                if (!verifyTip && !goodsInfo.evidence_images.length) {
                    verifyTip = '请上传图片';
                }
            }
            delete goodsInfo.reason;

            goods.push(goodsInfo);
        }
    });

    if (!verifyTip && !goods.length) {
        verifyTip = '请选择要' + type + '的商品';
    }

    return goods;
}

// 打包退货信息
hongweigao authored
496
function packRefundInfo(returnMode) {
weiqingting authored
497 498 499
    var res = {};

    res.goods = packGoogsList();
hongweigao authored
500
    res.payment = {return_amount_mode: returnMode};
weiqingting authored
501 502

    if (res.payment.return_amount_mode === 2) {
hongweigao authored
503 504
        res.payment.bank_id = $bankId.val() * 1;
        res.payment.head_bank_name = $bankId.children('option:selected').text();
weiqingting authored
505
hongweigao authored
506 507 508
        if (!verifyTip && res.payment.bank_id === 0) {
            verifyTip = '请选择银行';
        }
weiqingting authored
509
        res.payment.bank_name = $.trim($refundInfo.find('input[name="bank-name"]').val());
hongweigao authored
510 511
        if (!verifyTip && !res.payment.bank_name && needSubbranch === 'Y') {
            verifyTip = '请填写支行名称';
weiqingting authored
512 513 514 515 516 517 518
        }

        res.payment.payee_name = $.trim($refundInfo.find('input[name="payee-name"]').val());
        if (!verifyTip && !res.payment.payee_name) {
            verifyTip = '请填写收款人姓名';
        }
yyq authored
519
        res.payment.bank_card = $refundInfo.find('input[name="bank-card"]').val().replace(/\s/g, '');
weiqingting authored
520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535
        if (!verifyTip && !res.payment.bank_card) {
            verifyTip = '请填写收款账户';
        }

    } else if (res.payment.return_amount_mode === 3) {
        res.payment.alipay_name = $.trim($refundInfo.find('input[name="alipay-name"]').val());
        if (!verifyTip && !res.payment.alipay_name) {
            verifyTip = '请填写收款人姓名';
        }

        res.payment.alipay_account = $.trim($refundInfo.find('input[name="alipay-account"]').val());
        if (!verifyTip && !res.payment.alipay_account) {
            verifyTip = '请填写收款账户';
        }

    }
hongweigao authored
536 537 538

    res.goods = JSON.stringify(res.goods);
    res.payment = JSON.stringify(res.payment);
weiqingting authored
539 540 541 542 543
    return res;
}

// 打包换货信息
function packExchangeInfo() {
yyq authored
544
    var nameReg = /^([\u4e00-\u9fa5\w*]{1,20})$/;
weiqingting authored
545 546 547 548 549
    var res = {};

    res.goods = packGoogsList();

    res.consigneeName = $.trim($exchange.find('input[name="name"]').val());
yyq authored
550 551 552
    if (!verifyTip) {
        if (!res.consigneeName) {
            verifyTip = '请填写收货人姓名';
Targaryen authored
553
        } else if (stringHandle.chinese2(res.consigneeName) > 20) {
yyq authored
554
            verifyTip = '收货人姓名最多支持20个字符';
yyq authored
555 556 557 558
        } else if (!nameReg.test(res.consigneeName)) {
            verifyTip = '收货人姓名不支持特殊符号';
        }
    }
weiqingting authored
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
    if (!verifyTip && !res.consigneeName) {
        verifyTip = '请填写收货人姓名';
    }

    res.areaCode = $areaCode.val();
    if (!verifyTip && !res.areaCode * 1) {
        verifyTip = '请选择地区';
    }

    res.address = $.trim($exchange.find('input[name="address"]').val());
    if (!verifyTip && !res.address) {
        verifyTip = '请填写详细地址';
    }

    res.mobile = $.trim($exchange.find('input[name="phone"]').val());
    if (res.mobile === disPhone) {
        res.mobile = defaultPhone;
    } else {
        if (!verifyTip && !res.mobile) {
            verifyTip = '请填写手机号';
        }
    }

    res.zipCode = $.trim($exchange.find('input[name="postcode"]').val());
    res.deliveryType = $exchange.find('input[name="delivery-tpye"]:checked').val();
    if (!verifyTip && !res.deliveryType) {
        verifyTip = '请选择商品返回方式';
    }
OF1706 authored
588 589
    res.goods = JSON.stringify(res.goods);
weiqingting authored
590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610
    return res;
}

function loadWaiting(status) {
    var text = '○';

    if (status) {
        $submitBox.addClass('applying');
        timer = setInterval(function() {
            $waitPoint.text(text);
            if (text.length > 3) {
                text = '';
            }
            text += '○';
        }, 600);
    } else {
        $submitBox.removeClass('applying');
        clearInterval(timer);
    }
}
hongweigao authored
611
function saveRefundExchange(url, data) {
weiqingting authored
612 613 614 615 616 617 618 619 620 621 622
    loadWaiting(true);
    $.ajax({
        type: 'POST',
        url: url,
        data: data
    }).then(function(jsonData) {
        if (jsonData.code === 200) {
            if (jsonData.data && jsonData.data.refer) {
                window.location.href = jsonData.data.refer;
            }
        } else {
OF1706 authored
623
            alert(jsonData.message); //eslint-disable-line
weiqingting authored
624 625 626
            loadWaiting(false);
        }
    });
hongweigao authored
627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656
}

// 提交申请
$('.save-btn').click(function() {
    var url,
        data = {
            orderCode: orderCode
        },
        returnMode = 0,
        tip = '',
        content = '';

    verifyTip = ''; // 初始化提示语
    if (pageType) {
        url = '/home/returns/saveRefund';

        // 付款方式
        $refundType.each(function() {
            if ($(this).prop('checked')) {
                returnMode = $(this).val() * 1;
            }
        });

        if (!verifyTip && !returnMode) {
            verifyTip = '请选择退款方式';
        } else {
            $.extend(data, packRefundInfo(returnMode));
        }

        if (returnMode === 2) {
hongweigao authored
657
            tip = '请确保账户名与账户一致,如果账号与名称不符或填写错误,会影响退款时效或退到他人账户,请谨慎填写!';
hongweigao authored
658 659 660
            content = '<h2 class="title">确认提交</h2><div class="refund-tips">' + tip + '</div>';
        } else if (returnMode === 3) {
            tip = '支付宝账户需要经过实名认证,账户与真实姓名必须相符,可以在支付宝个人中心查看,' +
hongweigao authored
661
                '如果账户与名称不符或填写错误,会影响退款时效或退到他人账户,请谨慎填写!';
hongweigao authored
662 663 664 665 666 667 668 669 670 671 672 673 674
            content = '<h2 class="title">确认提交</h2><div class="refund-tips">' + tip + '</div>';
        }

    } else {
        url = '/home/returns/saveExchange';
        $.extend(data, packExchangeInfo());
    }

    if (verifyTip) {
        alert(verifyTip); //eslint-disable-line
        return;
    }
周少峰 authored
675
    if (pageType && returnMode !== 1) {
676
        refundConfirm = new Dialog($.extend(true, {}, option, {
hongweigao authored
677 678 679
            content: content,
            btns: [{
                cb: function() {
hongweigao authored
680
                    refundConfirm.close();
hongweigao authored
681 682 683 684 685 686 687 688 689 690 691 692
                    saveRefundExchange(url, data);
                }
            }, {
                cb: function() {
                    loadWaiting(false);
                }
            }]
        })).show();
    } else {
        saveRefundExchange(url, data);
    }
陈轩 authored
693
});
郝肖肖 authored
694 695 696

// 退货结算
getRefundCompute();
郝肖肖 authored
697
htoooth authored
698 699 700 701 702 703 704 705 706 707 708
refund = {
    $el: $('.special-tip'),
    init: function() {
        if (this.$el.length === 0) {
            return;
        }

        this.eventBind();
    },
    eventBind: function() {
        this.$el.find('.special-limit-7day').on('click', function() {
htoooth authored
709
            $(this).parent().find('.special-limit-tip').toggleClass('hide');
htoooth authored
710 711 712 713 714 715
        });
    }
};

refund.init();
郝肖肖 authored
716 717 718 719 720
$('.re-tips').on('click', '.icon-tip-help', function() {
    var tipHelpDialog, content;

    content = '<div class="tip-title">退款金额说明</div>';
    content += '<div class="tip-content">';
721 722
    content += '<p>*订单中包含的促销活动、优惠券、有货币、红包、礼品卡金额均已按比例分摊至各件商品。</p>';
    content += '<p>*此金额为最大退款金额,以实际退款为准。</p>';
郝肖肖 authored
723 724 725 726 727 728 729 730 731
    content += '</div>';

    tipHelpDialog = new Dialog({
        content: content,
        className: 'icon-tip-help-dialog',
        btns: [
            {
                id: 'tip-btn-sure',
                btnClass: ['tip-btn'],
732
                name: '我知道了',
郝肖肖 authored
733 734 735 736 737 738 739
                cb: function() {
                    tipHelpDialog.close();
                }
            }
        ]
    }).show();
});
yyq authored
740 741 742 743

$('.exp-title').click(function() {
    $(this).parent().toggleClass('hide-exp');
});