operations.limit.Edit.js 24.4 KB
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 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 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 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822
webpackJsonp([115],[
/* 0 */
/***/ function(module, exports, __webpack_require__) {

	var $ = __webpack_require__(1),
	    common = __webpack_require__(2);

	// require('../common/bootstrap-wysihtml5');
	// require('../util/datepicker');

	var ENMA = {
	    attachType: {
	        1: "图片",
	        2: "视频",
	        3: "文本",
	        4: "新图片"
	    },
	    dia:{
	        1:"img",
	        2:"video",
	        3:"wenZi"
	    },
	    bucket:{
	        bucket:"goodsimg"
	    }
	}


	//测试数据
	var g = new common.grid({
	    el: "#baseTable",
	    columns: [{
	        display: "标题",
	        render: function(item) {
	            if (item.isDefault == 1) {
	                return "默认封面图片";
	            }
	            return ENMA.attachType[item.attachType];
	        }
	    }, {
	        display: "内容",
	        render: function(item) {
	            
	            if (item.isDefault == 1) {
	                return '<input type="file" name="coverImg" id="coverImg" value="' + item.attachUrl + '" placeholder="封面图" required/>';
	            } else {
	                if (item.attachType == 1) {
	                    return "<img src='" + item.attachUrl + "' style='width:120px;height:80px' />";
	                } else if (item.attachType == 2) {
	                    return "<video src='" + item.attachUrl + "' controls></video>";
	                } else if (item.attachType == 4) {
	                    return "<img src='" + item.attachUrl + "' style='width:120px;height:80px'/>";
	                }
	                else {
	                    return item.intro;
	                }
	            }
	        }
	    },{
	        display:"排序",
	        width:'10%',
	        render:function(item){
	            if (!item.isDefault) {
	                return "<input type='number' class='form-control inputorder' data-index='" + item.__index + "' value="+item.orderBy+" />";
	            }else{
	                item.orderBy=1;
	                return "1";
	            }
	        }
	    }, {
	        display: "操作",
	        render: function(item) {
	            var htmlArr = [];
	            if (!item.isDefault) {
	                htmlArr.push("<button type='button' data-index='" + item.__index + "' class='delete btn btn-danger btn-xs'>删除</button>");
	                htmlArr.push("<button type='button' data-index='" + item.__index + "' class='edit btn btn-info btn-xs'>编辑</button>");
	            }
	            return htmlArr.join(',');
	        }
	    }]
	});

	var __ac = $.trim($("#attachmentContent").val());
	g.__rows = __ac ? JSON.parse(__ac) : [{
	    "attachType": 1,
	    "attachUrl": "",
	    "isDefault": 1
	}];

	g.init(g.__rows);
	var e1 = new common.edit('#baseTable',ENMA.bucket);
	e1.on("callback", function(obj) {
	    if (obj.key == "file_onComplete_coverImg") {
	        g.__rows[0].attachUrl = obj.data;
	    }
	});
	e1.init();

	var isSave = false;
	$(window).on('beforeunload', function() {
	    if (!isSave) {
	        return '您输入的内容尚未保存';
	    }
	});
	//初始化form表单
	var e = new common.edit('#editor-group',ENMA.bucket);

	e.on("render",function(){
	    var isFirst=true;
	    var _um=$("#limitProductType").val();
	    changeLimitProductInfo(_um);

	    $(":radio[name=limitProductType]").change(function(){
	        var _um=$(this).val();
	        changeLimitProductInfo(_um);
	    });

	    function changeLimitProductInfo(_um){
	        if(_um=="2" || _um=="5"){
	            $("#limitProductType_2").show().find("input").attr("required",true);
	        }else{
	            $("#limitProductType_2").hide().find("input").removeAttr("required");
	        }

	        if(_um=="3"){
	            $("#limitProductType_3").show();
	            $("#limitProductToolTips").show();
	            getLimitCodeSendHistory();
	        }else{
	            $("#limitProductType_3").hide();
	            $("#limitProductToolTips").hide();
	        }

	        if(_um=="4" || _um=="5"){
	            $("#limitProductType_4").show().find("input").attr("required",true);
	            $("#channelType").val(1);
	        }else{
	            $("#limitProductType_4").hide().find("input").removeAttr("required");
	            $("#channelType").val(0);
	        }
	    }
	    $(":radio[name='productType']").change( function() {
	        switch (this.value) {
	            case "0":
	                $("#sknName").hide();
	                $("#sknInfo").hide();
	                $(".product_normal").show();
	                $(".product_global").hide();
	                if(isFirst){
	                    $(":radio[name='limitProductType']:checked").change();
	                    isFirst=false;
	                }else{
	                    $(":radio[name='limitProductType']:first")[0].checked=true;
	                    $(":radio[name='limitProductType']:first").change();
	                }
	                break;
	            case "1":
	                $("#sknName").hide();
	                $("#sknInfo").hide();
	                $(".product_normal").hide();
	                $(".product_global").show();
	                $("#limitProductType_2").find("input").removeAttr("required");
	                $("#limitProductType_4").find("input").removeAttr("required");
	                break;
	            case "2":
	                $("#sknName").hide();
	                $("#sknInfo").hide();
	                $(".product_normal").hide();
	                $(".product_global").show();
	                $("#price_div").hide();
	                $("#limitProductType_2").find("input").removeAttr("required");
	                $("#limitProductType_4").find("input").removeAttr("required");
	                break;
	        }
	    });
	    var productName = $("#productName").val();
	    if(productName != '' && productName != undefined){
	        $(":radio[name='productType']").attr("disabled",true);
	        $(":radio[name='limitProductType']").attr("disabled",true);
	    }

	    var productType = $("#productType").val();
	    if ( productType == "") productType = 0;
	    $("#productType").val($(":radio[name='productType']:checked").val());

	    var _sm=$("#hotFlag").val();
	    if(_sm=="1"){
	        $(".order-by").find("input").attr("required",true);
	        $(".order-by").find(".red").show();
	    }
	    $(":radio[name=hotFlag]").change(function(){
	        var _sm=$(this).val();
	        if(_sm=="1"){
	            $(".order-by").find("input").attr("required",true);
	            $(".order-by").find(".red").show();
	        }else{
	            $(".order-by").find("input").removeAttr("required");
	            $(".order-by").find(".red").hide();
	        }
	    });
	});

	e.on("validate", function() {

	    var productType = $(":radio[name='productType']:checked").val();

	    if (productType == 0) {
	        return validateNormal();
	    } else {
	        return validateGlobal();
	    }

	});
	e.on("validate", function() {
	    var helpLimit = $("#helpLimit").val();
	    if (helpLimit > 10) {
	        return "助力人数上限不能超过10人";
	    }
	    return true;
	});
	// 普通限购
	function validateNormal() {
	    // var batchNo = $("#batchNo").val();
	    // if (batchNo.length == 0) {
	    //     return "限购码批次不能为空";
	    // }
	    // return true;
	}
	// 全球购限购
	function validateGlobal() {

	}

	/*验证批次号*/
	e.on("validate", function() {

	    // 限购商品才检查
	    var productType = $(":radio[name='productType']:checked").val();
	    if (productType != "0") {
	        return true;
	    }

	    var batchNo = $('#batchNo').val();
	    if (batchNo.length == 0) {
	        return true;
	    }
	    var param = {
	        batchNo: batchNo,
	        id: $("#id").val()
	    };
	    var _m="批次号接口接口异常";
	    common.util.__ajax({
	        url: '/limitCode/checkLimitCodeByBatchNo',
	        async: false,
	        data: param
	    }, function(res){
	        console.log(res);
	        if(res.data){
	            _m="";
	        }else{
	            _m="批次号不存在";
	        }
	    }, true);
	    if(_m){
	        return _m;
	    }else{
	        common.util.__ajax({
	            url: '/limitProduct/checkBatchNoExist',
	            async: false,
	            data: param
	        }, function(res){
	             console.log(res);
	             if(res.data){
	                _m="";
	            }else{
	                _m=res.message;
	            }
	        }, true);

	        if(_m){
	            return _m;
	        }
	    }
	});

	/*验证排队限购ID*/
	e.on("validate", function() {

	    // 限购商品才检查
	    var productType = $(":radio[name='productType']:checked").val();

	    if (productType != "0") {
	        return true;
	    }

	    var _um=$("#limitProductType").val();
	    if(_um=="1" || _um=="3" || _um=="4"){
	        return true;
	    }

	    var activityId = $.trim($("#activityId").val());

	    if (activityId.length == 0) {
	        return "排队限购ID不能为空";
	    }

	    var param = {
	        activityId: activityId,
	        id: $("#id").val()
	    };
	    var _m="排队限购ID接口异常";
	    common.util.__ajax({
	        url:'/DrawlineActivityRest/checkActivityIdExists',
	        async:false,
	        data:param
	    },function(res){
	        if(res.data.exists){//true
	            _m="";
	        }else{
	            _m="排队限购ID不存在";
	        }
	    },true);
	    if(_m){
	        return _m;
	    }else{
	        common.util.__ajax({
	            url:'/limitProduct/checkActivityIdNoExist',
	            async:false,
	            data:param
	        },function(res){
	            console.log("checkActivityIdNoExist",res);
	            if(res.data){//true
	                _m="";
	            }else{
	                _m="排队限购ID"+activityId+"已被关联";
	            }
	        },true);

	        if(_m){
	            return _m;
	        }
	    }
	});

	/*上传默认图片*/
	e.on("validate", function() {
	    if (!g.__rows[0].attachUrl) {
	        return "请上传默认封面";
	    }
	});
	/*验证排序*/
	e.on("validate", function() {
	    // var _sm=$("#hotFlag").val();
	    // if(_sm=="0"){
	    //     return true;
	    // }
	    var orderBy = $.trim($("#orderBy").val());
	    if (orderBy && !/^(?:[1-9][0-9]*|0)$/.test(orderBy)) {
	        return '排序值输入格式不正确';
	    }
	});
	/*验证排序*/
	e.on("validate",function(){
	    var error=0;
	    var a={};
	    if(g.__rows.length>0){
	        for(var i in g.__rows){
	            var row=g.__rows[i];
	            if(!row.orderBy){
	                error++;
	            }
	            if(a.hasOwnProperty(row.orderBy)){
	                error++;
	            }else{
	                a[row.orderBy]=0;
	            }
	        }
	    }
	    if(error>0){
	        return "请正确输入排序,并且不要重复";
	    }
	});

	/* 验证APP端底部按钮提示信息 */
	e.on("validate", function() {
	    var _um=$("#limitProductType").val();
	    if(_um == "3") {
	        var tips = $("#limitProductTips").val();
	        if(!tips) {
	            return "请设置点击底部按钮后的提示内容!";
	        }

	        if(tips.length > 100) {
	            return "点击底部按钮的提示内容长度不能超过100个字符!";
	        }
	    }
	})

	e.init();

	//添加修改
	$('.limit-add-btn').click(function(option) {
	    isSave = true;
	    e.submit($('#limit-add-form').attr('action'), function(option) {
	        //option.debug=true;
	        option.data.attachmentContent = JSON.stringify(g.__rows);

	        /*if ($('input[name="dayFlag"]:checked').val() == 0) {
	            saleTime = new Date(option.data.saleTime.slice(0, -3).replace(/-/g, '/'));
	        }*/
	        console.log(option.data);
	        // option.debug=true;
	        option.beforeSend = function() {
	            $('#limit-add-btn').addClass('disabled');
	        };
	        option.success = function(res) {

	            removeUploadUidFile();

	            if (res.code == "200") {
	                e.$tip('提交成功', function() {
	                    location.href = "/limit/product/index";
	                }, 'growl-success');
	            } else {
	                $('#limit-add-btn').removeClass('disabled');
	                e.$tip(res.message);
	            }

	            return false;
	        }
	        option.error = function(res) {
	            e.$tip("提交失败");
	        };
	    });
	});

	// 在执行保存时,如果有上传UID表格,但未执行 '发放限购码'或者'删除表格',需要执行'删除'
	function removeUploadUidFile() {
	    var operationCode = $("#uploadedOperationCode").val();
	    if(operationCode) {
	        common.util.__ajax({
	            url: "/limitProduct/deleteLimitProductUidRecord",
	            data: {
	                "operationCode": operationCode
	            }
	        }, function (res) {
	            // do nothing
	        }, false)
	    }
	}


	// var $editor = $('#editor'),  //文字,图片,视频容器
	//     type = $('#limit-add-form').attr('type');

	var Bll = {
	    img: function(title, item, index) {
	        common.dialog.confirm(title, common.util.__template($("#picDialogTemp").html(), item), function() {
	            var _html = $.trim($("#imgText").val());

	            if (_html) {
	                if (item.attachType) {
	                    //修改
	                    g.__rows[index].attachUrl = _html;
	                } else {
	                    //添加
	                    g.__rows.push({
	                        "attachType":1,
	                        "attachUrl": _html,
	                        "isDefault": 0,
	                        "attachName": $("#attachName").val()
	                    });
	                }

	                g.reload();
	                e1.init();
	            }
	        });
	        var a = new common.edit("#upload-wrapper",ENMA.bucket);
	        a.on("callback", function(obj) {
	            if (obj.key == "file_onComplete_imgfile") {
	                $("#imgText").val(obj.data);
	            }
	        });
	        a.init();
	    },
	    imgBlank: function(title, item, index) {
	        common.dialog.confirm(title, common.util.__template($("#picDialogTemp").html(), item), function() {
	            var _html = $.trim($("#imgText").val());

	            if (_html) {
	                if (item.attachType) {
	                    //修改
	                    g.__rows[index].attachUrl = _html;
	                } else {
	                    //添加
	                    g.__rows.push({
	                        "attachType":4,
	                        "attachUrl": _html,
	                        "isDefault": 0,
	                        "attachName": $("#attachName").val()
	                    });
	                }

	                g.reload();
	                e1.init();
	            }
	        });
	        var a = new common.edit("#upload-wrapper",ENMA.bucket);
	        a.on("callback", function(obj) {
	            if (obj.key == "file_onComplete_imgfile") {
	                $("#imgText").val(obj.data);
	            }
	        });
	        a.init();
	    },
	    video:function(title, item, index){
	        common.dialog.confirm(title, common.util.__template($("#vidioDialogTemp").html(), item), function() {
	            var _html = $.trim($("#videoText").val());
	            var _html1 = $.trim($("#imgText").val());
	            if (_html&&_html1) {
	                if (item.attachType) {
	                    //修改
	                    g.__rows[index].attachUrl = _html;
	                    g.__rows[index].intro = _html1;
	                } else {
	                    //添加
	                    g.__rows.push({
	                        "attachType": 2,
	                        "attachUrl": _html,
	                        "intro":_html1,
	                        "isDefault": 0,
	                        "attachName": $("#attachName").val()
	                    });
	                }

	                g.reload();
	                e1.init();
	            }else{
	                common.util.__tip("请同时输入视频地址和默认图片地址");
	                return false;
	            }
	        });
	        var a1 = new common.edit("#upload-wrapper1",ENMA.bucket);
	        a1.on("callback", function(obj) {
	            if (obj.key == "file_onComplete_videofile") {
	                $("#videoText").val(obj.data);
	            }
	        });
	        a1.init();
	        var a2 = new common.edit("#upload-wrapper2",ENMA.bucket);
	        a2.on("callback", function(obj) {
	            console.log(obj);
	            if (obj.key == "file_onComplete_imgfile") {
	                $("#imgText").val(obj.data);
	            }
	        });
	        a2.init();
	    },
	    wenZi: function(title, item, index) {
	        common.dialog.confirm(title, common.util.__template('<textarea id="text-editor">{intro}</textarea>', item), function() {
	            var _html = $.trim($("#text-editor").val());

	            if (_html) {
	                if (item.attachType) {
	                    //修改
	                    g.__rows[index].intro = _html;
	                } else {
	                    //添加
	                    g.__rows.push({
	                        "attachType": 3,
	                        "intro": _html,
	                        "isDefault": 0
	                    });
	                }

	                g.reload();
	                e1.init();
	            }
	        });
	       // $('#text-editor').wysihtml5();
	    }

	}

	//添加文字
	$('body').on('click', '#textDialog', function() {
	    Bll.wenZi("添加文字", {});
	    return false;
	});
	//添加空格
	$('body').on('click', '#blankDialog', function() {
	    Bll.imgBlank("添加新图片",{});
	    return false;
	});
	$('body').on('click', '#picDialog', function() {
	    Bll.img("添加图片",{});
	    return false;
	});
	$('body').on('click', '#videoDialog', function() {
	    Bll.video("添加视频",{});
	    return false;
	});
	//删除
	$('body').on('click', ".delete", function() {
	    var index = $(this).data("index");
	    g.__rows.splice(index, 1);
	    g.reload();
	    e1.init();
	});
	//修改
	$('body').on('click', ".edit", function() {
	    var item = g.rows[$(this).data("index")];
	    Bll[ENMA.dia[item.attachType]]("修改" + ENMA.attachType[item.attachType], item, $(this).data("index"));
	});
	$(document).on("change",".inputorder",function(){
	    var item = g.rows[$(this).data("index")];
	    $(this).val($(this).val().replace(/\D/g,''));
	    item.orderBy =$(this).val();//(item.__index+1);
	});

	// 上传UID表格
	var limitProductCode = $('#limitProductCode').val();
	var batchCode = $('#batchNo').val();
	var loadModal = null;
	common.edit.ajaxfileupload("#uploadBox", {
	    params: {
	        type: "limitProductUid",
	        __type: "batch-import",
	        args: "limitProductCode=" + limitProductCode + "&batchCode=" + batchCode
	    },
	    valid_extensions: ['xls', 'xlsx'],
	    onStart: function() {
	        loadModal = common.dialog.load();
	    },
	    onComplete: function (response) {
	        if(loadModal) {
	            loadModal.close();
	        }

	        if (response.status && response.code == 200) {
	            common.util.__tip(response.message, 'success');

	            // 当前操作码
	            var operationCode = response.data;
	            if(operationCode) {
	                $("#uploadOperator").hide();
	                $("#postUploadOperator").show();
	                // 设置operationCode,便于后续发放限购码和删除UID表格操作
	                $("#uploadedOperationCode").val(operationCode);
	            }

	            // g.reload();
	        }
	        else {
	            common.util.__tip(response.message, 'warning');
	        }
	    }
	});

	$(document).on("click", "#chooseFile", function () {
	    $("#uploadBox").click();
	});

	// 发放限购码
	$(document).on("click", "#sendLimitCode", function() {
	    $("#sendLimitCode").attr('disabled', 'disabled');
	    $("#deleteUploadedUid").attr('disabled', 'disabled');

	    var operationCode = $("#uploadedOperationCode").val();
	    if(operationCode) {
	        $(".send-limitcode-tips").show();
	        common.util.__ajax({
	            url: "/limitProduct/batchSendLimitCode",
	            data: {
	                "operationCode": operationCode
	            }
	        }, function (res) {
	            $(".send-limitcode-tips").hide();
	            sendLimitCodeCallback(res);

	            // 刷新发放记录
	            getLimitCodeSendHistory();
	        }, true)
	    }
	});

	// 删除UID表格
	$(document).on("click", "#deleteUploadedUid", function() {
	    $("#sendLimitCode").attr('disabled', 'disabled');
	    $("#deleteUploadedUid").attr('disabled', 'disabled');

	    var operationCode = $("#uploadedOperationCode").val();
	    if(operationCode) {
	        common.util.__ajax({
	            url: "/limitProduct/deleteLimitProductUidRecord",
	            data: {
	                "operationCode": operationCode
	            }
	        }, function (res) {
	            sendLimitCodeCallback(res);
	        }, true)
	    }
	});

	function sendLimitCodeCallback(res) {
	    $("#sendLimitCode").removeAttr('disabled');
	    $("#deleteUploadedUid").removeAttr('disabled');
	    if(res && res.code == 200) {
	        common.util.__tip(res.message, 'success');

	        $("#uploadOperator").show();
	        $("#postUploadOperator").hide();
	        $("#uploadedOperationCode").val('');
	    } else {
	        common.util.__tip(res.message, 'warning');
	    }
	}

	// 下载上传的UID表格
	$(document).on("click", ".uploaded-uid-xls", function() {
	    var operationCode = $("#uploadedOperationCode").val();
	    downloadUidXls(operationCode);
	});

	// 限购码发放记录列表中,下载上传的UID的表格
	$(document).on("click", ".limitcode-send-history", function() {
	    var operationCode = $(this).data('operationcode');
	    downloadUidXls(operationCode);
	})

	function downloadUidXls(operationCode) {
	    if(operationCode) {
	        window.open("/ajax/down?queryConf=" + operationCode + "&type=limitProductUid");
	    } else {
	        common.util.__tip("无法找到上传的记录!", "warning");
	        return false;
	    }
	}

	// 获取限购码发放记录,在选择"指定UID得限购码"和点击"发放限购码"时调用
	function getLimitCodeSendHistory() {
	    var limitProductCode = $('#limitProductCode').val();
	    var batchNo = $('#batchNo').val();

	    common.util.__ajax({
	        url: "/limitProduct/queryLimitCodeSendHistory",
	        data: {
	            "limitProductCode": limitProductCode,
	            "batchNo": batchNo
	        }
	    }, function (res) {
	        if(res && res.code == '200') {
	            var data = res.data;
	            var htmlArr = [];
	            htmlArr.push('<h5>发放记录(限十条):</h5>');
	            $.each(data, function(index, item) {
	                var operationCode = item.operationCode;
	                var timestamp = item.timestamp;

	                var content = '<div><a href="javascript:;" class="limitcode-send-history" data-operationcode="' + operationCode +
	                '">限购码发放记录' + (index + 1) + ',UID表格上传时间: ' + new Date(timestamp * 1000).toLocaleString() + '</a></div>';

	                htmlArr.push(content);
	            });

	            console.log(htmlArr.join(' '));

	            $("#limitUidHistory").html(htmlArr.join(' '));
	            if(data.length > 0) {
	                $("#limitUidHistory").show();
	            }
	        }
	    }, true)
	}

	$(document).on('change', '#batchNo', function() {
	    var batchNo = $("#batchNo").val();
	    if(batchNo == ''){
	        return;
	    }
	    common.util.__ajax({
	        url: "/limitProduct/getSknInfoById",
	        data: {
	            "batchNo": batchNo
	        }
	    }, function (res) {
	        if(res.message == "操作成功"){
	            $("#sknInfo").show();
	            $("#sknMessage").html("商品名称:"+res.data.productName+",  SKN:"+res.data.productSkn);
	        }else{
	            $("#sknInfo").show();
	            $("#sknMessage").html(res.message);
	        }
	    }, true)
	});

	$(document).on('change', '#productSkn', function() {
	    var productSkn = $("#productSkn").val();
	    if(productSkn == ''){
	        return;
	    }
	    common.util.__ajax({
	        url: "/limitProduct/getSknInfoById",
	        data: {
	            "productSkn": productSkn
	        }
	    }, function (res) {
	        if(res.message == "操作成功"){
	            $("#sknName").show();
	            $("#sknName").html("商品名称:"+res.data.productName+",  SKN:"+res.data.productSkn);
	        }else{
	            $("#sknName").show();
	            $("#sknName").html(res.message);
	        }
	    }, true)
	});



/***/ }
]);