detail.html 20.9 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
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8"/>
    <title>Yoho!Buy运营平台</title>
    <script src="/ufoPlatform/js/include.js"></script>
    <style>
        .sub-info td{
            font-size: 14px;
            font-color: #FFFFFF
        }
    </style>
</head>
<body class="easyui-layout" fit="true">
<div region="north" style="height:100px;border-bottom: 0;">
    <script>
        document.write(addHead('订单管理', '订单详情'));
    </script>
</div>
<div id="main" region="center">
    <div id="tt" class="easyui-tabs" style="height:auto;">
       <div title="订单信息" style="padding:20px;display:none;">
          <div style="float:right">
            <a id="returnBtn" class="btn-info">返回</a>
			<a id="updateOrderInfoBtn" class="btn-success">修改订单信息</a>
		  </div>
		  <div>
		    <h2>基本信息</h2>
		    <table class="sub-info" border="1" bordercolor="#ddd" cellspacing="0" width="100%" cellpadding="8">
		      <tr>
                <td><label>订单编号:</label><span id="orderCode"></span></td>
                <td><label>订单状态:</label><span id="statusStr"></span><input type="hidden" id="status"></td>
                <td><label>支付状态:</label><span id="payStatus"></span></td>
                <td><label>下单时间:</label><span id="createTimeStr"></span></td>
              </tr>
              <tr>
                <td><label>订购人:</label><span id="buyer"></span></td>
                <td><label>订单来源:</label><span id="clientTypeStr"></span></td>
                <td><label>支付渠道:</label><span id="payment"></span></td>
                <td><label>付款时间:</label><span id="payTime"></span></td>
              </tr>
		      <tr>
                <td><label>卖家发货时间:</label><span id="sellerSendGoodsTime"></span></td>
                <td><label>卖家快递单号:</label><span id="sellerWaybillCode"></span></td>
                <td><label>平台发货时间:</label><span id="platformSendGoodsTime"></span></td>
                <td><label>平台快递单号:</label><span id="platformWaybillCode"></span></td>
              </tr>
              <tr>
                <td><label>收货时间:</label><span id="receiveGoodsTime"></span></td>
                <td><label>平台收货仓库:</label><span id="depotName"></span></td>
                <td colspan="2"><label>平台收货地址:</label><span id="platformReceiveGoodsAddress"></span></td>
              </tr>
		    </table>
		    
		    <h2>收货信息</h2>
		    <table class="sub-info" border="1" bordercolor="#ddd" cellspacing="0" width="100%" cellpadding="8">
		      <tr>
                <td><label>收货人姓名:</label><span id="receiveName"></span></td>
                <td><label>手机号码:</label><span id="receiveMobile"></span></td>
                <td><label>收货地址:</label><span id="receiveAddress"></span></td>
              </tr>
              <tr>
                <td><label>详细地址:</label><span id="receiveAddressDetail"></span></td>
                <td><label>邮政编码:</label><span id="zipCode"></span></td>
              </tr>
		    </table>

		    <h2>卖家信息</h2>
		    <table class="sub-info" border="1" bordercolor="#ddd" cellspacing="0" width="100%" cellpadding="8">
		      <tr>
                <td><label>姓名:</label><span id="sellerName"></span></td>
                <td><label>卖家UID:</label><span id="sellerUid"></span></td>
                <td><label>绑定手机号码:</label><span id="sellerMobile"></span></td>
                <td><label>寄回地址:</label><span id="sellerRebackAddress"></span></td>
              </tr>
              <tr>
                <td><label>详细地址:</label><span id="sellerRebackAddressDetail"></span></td>
                <td><label>寄回手机号码:</label><span id="sellerRebackMobile"></span></td>
                <td><label>邮政编码:</label><span id="sellerZipCode"></span></td>
              </tr>
		    </table>

		    <h2>订单商品</h2>
		    <table class="sub-info" border="1" bordercolor="#ddd" cellspacing="0" width="100%" cellpadding="8">
		      <tr>
                <th>SKU-P</th>
                <th>商品图片</th>
                <th>商品名称</th>
                <th>颜色</th>
                <th>尺码</th>
                <th>销售价</th>
                <th>购买数量</th>
                <th>运费</th>
                <th>买家实付</th>
              </tr>
              <tr>
                <td><span id="skup"></span></td>
                <td><img id="productImage" height='78px;' width='59px;' /></td>
                <td><span id="productName"></span></td>
                <td><span id="colorName"></span></td>
                <td><span id="sizeName"></span></td>
                <td><span id="goodsPrice"></span></td>
                <td><span id="productNum"></span></td>
                <td><span id="shipFee"></span></td>
                <td><span id="amount"></span></td>
              </tr>
              <tr>
                <th colspan="2">销售价:<span id="salesPrice"></span></th>
                <th colspan="2">平台费用:<span id="platformFee"></span></th>
                <th colspan="2">银行转账费用:<span id="bankTransferfee"></span></th>
                <th colspan="3">卖家实际收入:<span id="sellerIncome"></span></th>
              </tr>
		    </table>
		    
		  </div>
       </div>
       <div title="物流信息" style="overflow:auto;padding:20px;display:none;">
          <h2>卖家发货物流</h2>
          <hr>
          <table id="sellerExpressTable"></table>
          <h2>平台发货物流/平台寄回物流</h2>
          <hr>
          <table id="platformExpressTable"></table>
       </div>
       <div title="操作记录" style="overflow:auto;padding:20px;display:none;">
          <hr>
          <table id="operateRecordTable"></table>
       </div>
    </div>
</div>
<script>
$(function() {
	var param=window.location.search;
	var orderCode = getQueryString(param, "orderCode");
	
	$("#returnBtn").linkbutton({
        iconCls : "icon-search",
        onClick : function() {
        	window.location.href = contextPath + "/html/orderManage/list.html";
        }
    });
	$("#updateOrderInfoBtn").linkbutton({
        iconCls : "icon-search",
        onClick : function() {
        	var status = $("#status").val();
        	if(status>2){
        		alert("没有需要更新的数据!");
        	}else if(status == 2){//修改卖家物流单号
        		updateSellerWaybillCode(orderCode);
        	}else{
        		updateReceiveInfo(orderCode);
        	}
        	
        }
    });
    
    getOrderInfo(orderCode);
	
    $("#tt").tabs({
        onSelect:function(title,index){
        	if(index == 0){
        		getOrderInfo(orderCode);
        	}else if(index == 1){
        		getExpressList(orderCode);
            }else if(index == 2){
            	getOperateRecord(orderCode);
            }
        }
    });     
    
});

function updateSellerWaybillCode(orderCode){
	var sellerWaybillCode = $("#input_sellerWaybillCode").val();
	if(sellerWaybillCode == ''){
		alert("卖家快递单号不能为空");
		return;
	}
	$.post(contextPath + "/buyerOrder/updateReceiveInfo", {
		orderCode : orderCode,
        sellerWaybillCode : $("#input_sellerWaybillCode").val()
    }, function(data) {
        if (data.code == 200) {
        	getOrderInfo(orderCode);
            window.self.$.messager.show({
                title : "提示",
                msg : "更新信息成功!"
            });
        }else {
        	window.self.$.messager.alert("失败", "失败!", "error");
        }
    });
}

function updateReceiveInfo(orderCode){
	var receiveName = $("#input_receiveName").val();
	var receiveMobile = $("#input_receiveMobile").val();
	var receiveAddressDetail = $("#input_receiveAddressDetail").val();
	var receiveZipCode = $("#input_zipCode").val();
	var receiveAreaCode = $("#jiedao").combobox('getValue');
	if(receiveName == '' || receiveMobile == '' || receiveAddressDetail == '' || receiveAreaCode == ''){
		alert("收货人姓名,手机号码,收货地址,详细地址不能有空值!");
		return;
	}
	$.post(contextPath + "/buyerOrder/updateReceiveInfo", {
		orderCode : orderCode,
        receiveName : receiveName,
        receiveMobile : receiveMobile,
        receiveAddressDetail : receiveAddressDetail,
        receiveZipCode : receiveZipCode,
        receiveAreaCode : receiveAreaCode,
    }, function(data) {
        if (data.code == 200) {
        	getOrderInfo(orderCode);
            window.self.$.messager.show({
                title : "提示",
                msg : "更新信息成功!"
            });
        }else {
        	window.self.$.messager.alert("失败", "失败!", "error");
        }
    });
}

function getOrderInfo(orderCode){
    var form = new FormData();
	form.append("orderCode", orderCode);
    
    //发送请求
	$.ajax({
	     type: "POST",
         url: contextPath + '/buyerOrder/getOrderDetail',
         data: form,
         async: false,
         cache: false,
         contentType: false,
         processData: false,
         dataType: 'json',
         success: function (result) {
             if(result.code == 200) {
            	 $("#orderCode").html(result.data.orderCode);
            	 $("#statusStr").html(result.data.statusStr);
            	 $("#status").val(result.data.status);
            	 $("#payStatus").html(result.data.payStatus);
            	 $("#createTimeStr").html(result.data.createTimeStr);
            	 $("#buyer").html(result.data.buyerName + "(UID:" + result.data.buyerUid + ")");
            	 $("#clientTypeStr").html(result.data.clientTypeStr);
            	 $("#payment").html(result.data.payment);
            	 $("#payTime").html(result.data.payTime);
            	 $("#sellerSendGoodsTime").html(result.data.sellerSendGoodsTime);
            	 $("#sellerWaybillCode").html(result.data.sellerWaybillCode);
            	 $("#platformSendGoodsTime").html(result.data.platformSendGoodsTime);
            	 $("#platformWaybillCode").html(result.data.platformWaybillCode);
            	 $("#receiveGoodsTime").html(result.data.receiveGoodsTime);
            	 var depotNo = result.data.depotNo;
            	 var depotName = "";
            	 if(0 == depotNo){
            		 depotName = "北京";
            	 }else if(1 == depotNo){
            		 depotName = "南京";
            	 }
            	 $("#depotName").html(depotName);
            	 $("#platformReceiveGoodsAddress").html(result.data.platformReceiveGoodsAddress);
            	 if(result.data.status ==2){//卖家已发货,卖家可联系客服修改物流单号
            		 $("#sellerWaybillCode").html('<input id="input_sellerWaybillCode" type="text" class="easyui-textbox" value="' + result.data.sellerWaybillCode + '"/>');
            	 }
            	 
            	 //收货信息
            	 //卖家发货前,买家可联系客服修改收货信息
            	 if(result.data.status >= 2){
            		 $("#receiveName").html(result.data.receiveName);
                	 $("#receiveMobile").html(result.data.receiveMobile);
                	 $("#receiveAddress").html(result.data.receiveAddress);
                	 $("#receiveAddressDetail").html(result.data.receiveAddressDetail);
                	 $("#zipCode").html(result.data.zipCode);
            	 }else{
            		 $("#receiveName").html('<input id="input_receiveName" type="text" class="easyui-textbox" value="' + result.data.receiveName + '"/>');
                	 $("#receiveMobile").html('<input id="input_receiveMobile" type="text" class="easyui-textbox" value="' + result.data.receiveMobile + '"/>');
                	 $("#receiveAddressDetail").html('<input id="input_receiveAddressDetail" type="text" class="easyui-textbox" value="' + result.data.receiveAddressDetail + '"/>');
                	 $("#zipCode").html('<input id="input_zipCode" type="text" class="easyui-textbox" value="' + result.data.zipCode + '"/>');
                	 //省市区级联
                	 var addressStr = '<input id="sheng" class="easyui-combobox"  style="width:100px">'
                	                + '<input id="shi" class="easyui-combobox"  style="width:100px">'
                	                + '<input id="quxian" class="easyui-combobox"  style="width:100px">'
                	                + '<input id="jiedao" class="easyui-combobox"  style="width:150px">';
                	 $("#receiveAddress").html(addressStr);
                	 initAreaDropDown(result.data.receiveAreaCode);
            	 }
            	 
            	 //卖家信息
            	 $("#sellerName").html(result.data.sellerName);
            	 $("#sellerUid").html(result.data.sellerUid);
            	 $("#sellerMobile").html(result.data.sellerMobile);
            	 $("#sellerRebackAddress").html(result.data.sellerRebackAddress);
            	 $("#sellerRebackAddressDetail").html(result.data.sellerRebackAddressDetail);
            	 $("#sellerRebackMobile").html(result.data.sellerRebackMobile);
            	 $("#sellerZipCode").html(result.data.sellerZipCode);
            	 //商品信息
            	 $("#skup").html(result.data.skup);
            	 $("#productImage").attr("src", result.data.productImage);
            	 $("#productName").html(result.data.productName);
            	 $("#colorName").html(result.data.colorName);
            	 $("#sizeName").html(result.data.sizeName);
            	 $("#goodsPrice").html(result.data.goodsPrice);
            	 $("#productNum").html(result.data.productNum);
            	 $("#shipFee").html(result.data.shipFee);
            	 $("#amount").html(result.data.amount);
            	 $("#salesPrice").html(result.data.goodsPrice);
            	 $("#platformFee").html(result.data.platformFee);
            	 $("#bankTransferfee").html(result.data.bankTransferfee);
            	 $("#sellerIncome").html(result.data.sellerIncome);
             }
             else {
                 $.messager.alert("失败", result.message, "error");
             }
         }
     }); 
}

function initAreaDropDown(areaCode){
	var firstId = areaCode.substr(0,2);
	var secondId = areaCode.substr(0,4);
	var thirdId = areaCode.substr(0,6);
	var fourthId = areaCode;
	var flag = 0;
	$("#sheng").combobox({
		url:contextPath + '/buyerOrder/queryAreaList?parentCode=0',
		editable:false,
		valueField:'id',
		textField:'caption',
		loadFilter: function (data) {
            return defaultLoadFilter(data);
        },
        onLoadSuccess:function(data){ 
        	if(flag==0){
        		$('#sheng').combobox('setValue',firstId);
        	}
        },
		onSelect:function(region){
		$('#shi').combobox('unselect');
		$('#quxian').combobox('unselect');
		$('#jiedao').combobox('unselect');
		$('#shi').combobox('clear'); //清除原有项目
		$('#quxian').combobox('clear'); //清除原有项目
		$('#jiedao').combobox('clear'); //清除原有项目

		$('#shi').combobox('reload',contextPath + '/buyerOrder/queryAreaList?parentCode='+region.id);
	}
	})
	
	$("#shi").combobox({
		editable:false,
		valueField:'id',
		textField:'caption',
		loadFilter: function (data) {
            return defaultLoadFilter(data);
        },
        onLoadSuccess:function(data){ 
        	if(flag==0){
        		$('#shi').combobox('setValue',secondId);
        	}
        },
		onSelect:function(region){
		$('#quxian').combobox('unselect');	
		$('#jiedao').combobox('unselect');	
		$('#quxian').combobox('clear'); //清除原有项目
		$('#jiedao').combobox('clear'); //清除原有项目
		$('#quxian').combobox('reload',contextPath + '/buyerOrder/queryAreaList?parentCode='+region.id);
		}
	})
	
	$("#quxian").combobox({
		editable: false,
		valueField:'id',
		textField:'caption',
		loadFilter: function (data) {
            return defaultLoadFilter(data);
        },
        onLoadSuccess:function(data){ 
        	if(flag==0){
        		$('#quxian').combobox('setValue',thirdId);
        	}
        },
        onSelect:function(region){
    		$('#jiedao').combobox('unselect');	
    		$('#jiedao').combobox('clear'); //清除原有项目
    		$('#jiedao').combobox('reload',contextPath + '/buyerOrder/queryAreaList?parentCode='+region.id);
    	}
	})
	
	$("#jiedao").combobox({
		editable: false,
		valueField:'id',
		textField:'caption',
		loadFilter: function (data) {
            return defaultLoadFilter(data);
        },
        onLoadSuccess:function(data){ 
        	if(flag==0){
        		$('#jiedao').combobox('setValue',fourthId);
        		flag=1;
        	}
        }
	})
}

function getExpressList(orderCode){
	$("#sellerExpressTable").datagrid({
        fit: false,
        fitColumns: true,
        striped: true,
        rownumbers:true,
        url: contextPath + "/buyerOrder/queryExpressList",
        method: 'POST',
        queryParams: {
        	orderCode: orderCode,
        	expressTypeStr: "1"
    	},
        loadFilter: function (data) {
        	var temp = defaultLoadFilter(data);
            temp=null==temp?[]:temp;
            temp.rows = temp.list;
            return temp;
        },

        columns: [[{
            title: "物流公司",
            field: "expressCompanyName",
            width: 20,
            align: "center"
        }, {
            title: "快递单号",
            field: "waybillCode",
            width: 20,
            align: "center"
        }, {
            title: "处理时间",
            field: "createTimeStr",
            width: 20,
            align: "center"
        }, {
            title: "处理内容",
            field: "acceptRemark",
            width: 30,
            align: "center"
        }]],
        cache: false,
        pagination: false,
        idField: "id",
        singleSelect: true,
        onLoadSuccess: function (data) {
        	if (data.total == 0) {  
                 $(this).datagrid('appendRow', { expressCompanyName: '<div style="text-align:center;color:red">没有数据!</div>' }).datagrid('mergeCells', { index: 0, field: 'expressCompanyName', colspan: 4 })          
            }
        }
    });
	
	$("#platformExpressTable").myDatagrid({
        fit: false,
        fitColumns: true,
        striped: true,
        rownumbers:true,
        url: contextPath + "/buyerOrder/queryExpressList",
        method: 'POST',
        queryParams: {
        	orderCode: orderCode,
        	expressTypeStr: "2,3"
    	},
        loadFilter: function (data) {
        	var temp = defaultLoadFilter(data);
            temp=null==temp?[]:temp;
            temp.rows = temp.list;
            return temp;
        },

        columns: [[{
            title: "物流公司",
            field: "expressCompanyName",
            width: 20,
            align: "center"
        }, {
            title: "快递单号",
            field: "waybillCode",
            width: 20,
            align: "center"
        }, {
            title: "处理时间",
            field: "createTimeStr",
            width: 20,
            align: "center"
        }, {
            title: "处理内容",
            field: "acceptRemark",
            width: 30,
            align: "center"
        }]],
        cache: false,
        pagination: false,
        idField: "id",
        singleSelect: true,
        onLoadSuccess: function (data) {
        	if (data.total == 0) {  
                $(this).datagrid('appendRow', { expressCompanyName: '<div style="text-align:center;color:red">没有数据!</div>' }).datagrid('mergeCells', { index: 0, field: 'expressCompanyName', colspan: 4 })          
           }
        }
    });
}

function getOperateRecord(orderCode){
	$("#operateRecordTable").myDatagrid({
	    fit: false,
	    fitColumns: true,
	    striped: true,
	    rownumbers:true,
	    url: contextPath + "/buyerOrder/queryOperateRecordList",
	    method: 'POST',
	    queryParams: {
	    	orderCode: orderCode
		},
	    loadFilter: function (data) {
	    	var temp = defaultLoadFilter(data);
	        temp=null==temp?[]:temp;
	        temp.rows = temp.list;
	        return temp;
	    },

	    columns: [[{
	        title: "操作日志",
	        field: "type",
	        width: 20,
	        align: "center",
	        formatter: function (value, rowData, rowIndex) {
	        	if(value == 1){
	        		return "修改卖家物流单号";
	        	}else if(value == 2){
	        		return "修改收货人信息";
	        	}
	         }
	    }, {
	        title: "操作人",
	        field: "userName",
	        width: 20,
	        align: "center"
	    }, {
	        title: "处理时间",
	        field: "updateTimeStr",
	        width: 20,
	        align: "center"
	    }]],
	    cache: false,
	    pagination: false,
	    idField: "id",
	    singleSelect: true,
	    onLoadSuccess: function (data) {
	    	if (data.total == 0) {  
                $(this).datagrid('appendRow', { type: '<div style="text-align:center;color:red">没有数据!</div>' }).datagrid('mergeCells', { index: 0, field: 'type', colspan: 3 })          
           }
	    }
	});
}


function getQueryString(paraPart,name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
    var r = paraPart.substr(1).match(reg);
    if (r != null) return unescape(r[2]);
    return null;
}

</script>
</body>
</html>