pass.html 3.44 KB
<!DOCTYPE html>
<html lang="en">
<head>
    <title>main</title>
    <script src="/ufoPlatform/js/include.js"></script>
</head>
<body class="easyui-layout" fit="true">

<div id="passDiv" region="center">
    <table id="passTable" border="1px" cellpadding="1" cellspacing="0" align="center"
           style="margin-top: 30px; line-height: 30px;width:95%;border-color: #999999">
       <tr>
           <td>买家地址:</td>
           <td colspan="2" >
               <input type="hidden" id="receiveInfo_mobile"/>
               <span id="receiveInfo"></span>
           </td>
       </tr>
       <tr>
           <td>快递公司:</td>
           <td colspan="2">
               <input id="expressCompany"  class="easyui-combobox" disabled="disabled" readonly/>
           </td>
       </tr>
       <tr>
           <td>快递单号:</td>
           <td colspan="2">
               <input type="text" class="easyui-textbox" id="waybillCode"  style="width:300px"/>
           </td>
       </tr>
    </table>

</div>
<script>
    $(function () {
        //根据买家订单号获取买家收货信息
        getReceiveInfo();        
    	
    	// 快递公司下拉框
		initExpressCompanyDropdown();

        if($("#waybillCode").next()&&$("#waybillCode").next().children()){
            $("#waybillCode").next().children()[0].focus();
        }
    });
    
    function getReceiveInfo(){
    	var form = new FormData();
	    form.append("orderCode", document.getElementById("buyerOrderCode").value);
        //发送请求
		$.ajax({
		     type: "POST",
             url: contextPath + '/buyerOrder/getReceiveInfoByOrderCode',
             data: form,
             async: false,
             cache: false,
             contentType: false,
             processData: false,
             dataType: 'json',
             success: function (result) {
                 if(result.code == 200) {
                	 var name = result.data.receiveName;
                	 var mobile = result.data.receiveMobile;
                	 var address = result.data.receiveAddress;

                	 $("#receiveInfo_mobile").val(mobile);
                	 $("#receiveInfo").html("姓名:" + name + "<br>" + "手机号:" + mobile + "<br>" + "地址:" + address + "&nbsp;<button id='addressCopy'>复制</button>");

                     new ClipboardJS('#addressCopy', {
                         text: function() {
                             return name + '\r\n' + mobile + '\r\n' +  address;
                         }
                     });
                 }
                 else {
                     $.messager.alert("失败", result.message, "error");
                 }
             }
         });           
    }
    
    function initExpressCompanyDropdown() {
    	$.ajax({                              
            contentType: "application/json",
            dataType: "json",
            type: "POST",
            url: contextPath + '/buyerOrder/queryExpressCompanyList',
            data: {},
            success: function (data) {
                if (data.code != 200 || !data.data || data.data.length == 0) {
                    return;
                }
                $("#expressCompany").combobox({
                    width: 130,
                    data: data.data,
                    valueField: "id",
                    textField: "companyName"
                });
                $("#expressCompany").combobox("setValue",data.data[0].id);
            }
        });
    }
    
</script>
</body>
</html>