You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

295 lines
12 KiB
Plaintext

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ApiImportForTM.aspx.cs" Inherits="TradeManage.SysManage.ApiImportForTM" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link rel="stylesheet" type="text/css" href="../themes/default/easyui.css" />
<link rel="stylesheet" type="text/css" href="../themes/icon.css" />
<link rel="stylesheet" type="text/css" href="../themes/New.css" />
<link rel="stylesheet" type="text/css" href="../themes/DataGrid.css" />
<link rel="stylesheet" type="text/css" href="../Scripts/fancybox/jquery.fancybox-1.3.4.css" />
<script src="../Scripts/MicrosoftAjax.js" type="text/javascript"></script>
<script src="../Scripts/jquery.min.js" type="text/javascript"></script>
<script src="../Scripts/jquery.easyui.min.js" type="text/javascript"></script>
<script src="../Scripts/DataGrid.js" type="text/javascript"></script>
<script src="../Scripts/DataPager.js" type="text/javascript"></script>
<script src="../Scripts/jquery.bgiframe.min.js" type="text/javascript"></script>
<script src="../Scripts/Global.js" type="text/javascript"></script>
<script src="../Scripts/WindowLoad.js" type="text/javascript"></script>
<script src="../Scripts/CheckBoxList.js" type="text/javascript"></script>
<script src="../Scripts/DatePicker/WdatePicker.js" type="text/javascript"></script>
<script type="text/javascript">
var CheckBoxList1 = new nblf.ui.CheckBoxList("divShop");
var WindowLoadModel = new WindowLoad();
$(document).ready(function () {
WindowLoadModel.ApplicationPath = "../";
WindowLoadModel.ControlID = "WindowLoad";
WindowLoadModel.Isbgiframe = true;
WindowLoadModel.Load();
ajaxInit(WindowLoadModel);
GetDefaultTime();
//var CurrentDate = new Date();
//$("#txtStartDate").val(CurrentDate.localeFormat("yyyy-MM-dd"));
//$("#txtStopDate").val(CurrentDate.localeFormat("yyyy-MM-dd"));
BindPlatType();
BindShop();
$("#cmdImport").click(function () {
Import();
});
$("#cmdIssue").click(function () {
Issue();
});
$("#chk_Selectall").click(function () {
if ($(this)[0].checked == true) {
CheckBoxList1.SelectAll();
} else {
CheckBoxList1.UnSelectAll();
}
});
$('#listPlatType').change(function () {
var PlatType = $(this).val();
if (PlatType == "1") { $("#cmdSQ").show(); }
else { $("#cmdSQ").hide(); }
BindShop();
});
});
function GetDefaultTime() {
var param = new Object();
param.Days =-3;
//param.KeyName = "ptlx";
$.ajax({
url: "SysManageService.asmx/GetDefaultTime",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
async: false,
success: function (data) {
$('#txt_SDate').val(data.d);
}
});
}
//#region 读取平台
function BindPlatType() {
var param = new Object();
param.CompanyID = 0;
param.KeyName = "ptlx";
$.ajax({
url: "../UserService.asmx/GetPlatBaseCode",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
async: false,
success: function (data) {
var html = new Sys.StringBuilder();
//html.append("<option value='0'>全部</option>");
$(data.d).each(function () {
html.append("<option value='" + this.SortNo + "'>" + this.Name + "</option>");
});
$('#listPlatType').html(html.toString());
}
});
}
//#endregion
//#region 读取店铺
function BindShop() {
var param = new Object();
param.PlatType = $('#listPlatType').val();
$.ajax({
url: "../BaseData.asmx/GetDeptShopListForTM",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
async: false,
success: function (data) {
CheckBoxList1.DataTextField = "ShopName"; //显示字段
CheckBoxList1.DataValueField = "ShopId"; //隐藏字段
CheckBoxList1.RepeatColumns = 10; //每行显示几项
CheckBoxList1.DataSource = data.d; //绑定数据源
CheckBoxList1.DataBind(); //绑定
// chk_Selectall.checked=false;
// CheckBoxList1.SelectAll();
}
});
}
//#endregion
//#region 数据导入
function Import() {
var param = new Object();
param.PlatType = $('#listPlatType').val();
param.StartDate = null;
if ($("#txt_SDate").val()!="")
param.StartDate = $("#txt_SDate").val();
param.StopDate = null;
if ($("#txt_EDate").val() != "")
param.StopDate = $("#txt_EDate").val();
//if (JqueryIsData(param.StartDate) == false) { alert("起始日期格式错误或者必须大于2000年,正确的格式为(2000-01-01)"); return; }
//if (JqueryIsData(param.StopDate) == false) { alert("结束日期格式错误或者必须大于2000年,正确的格式为(2000-01-01)"); return; }
param.ListModel =new Array();
$(CheckBoxList1.GetSelectItems()).each(function () {
var id = $(this).val();
Array.add(param.ListModel,id);
});
if (param.ListModel.length == 0) { alert("请至少选择一个店铺"); return;}
WindowLoadModel.Show();
$.ajax({
url: "SysManageService.asmx/ImportApiForTM2",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
success: function (data) {
WindowLoadModel.Hide();
if (data.d == "") {
alert("开始导入订单,估计要过一会才能导入完成,你可以尝试先处理其他事情,过会可以点击查看导入结果查看导入情况");
}
else {
alert(data.d);
}
return;
if (data.d == "") { $("#txtlog").val("导入成功"); }
else {
$("#txtlog").val(data.d);
}
}
});
}
function Issue() {
var param = new Object();
param.ListModel = new Array();
$(CheckBoxList1.GetSelectItems()).each(function () {
var id = $(this).val();
Array.add(param.ListModel, id);
});
if (param.ListModel.length == 0) { alert("请至少选择一个店铺"); return; }
WindowLoadModel.Show();
$.ajax({
url: "SysManageService.asmx/queryIssueList",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
success: function (data) {
WindowLoadModel.Hide();
if (data.d == "") {
alert("完成");
}
else {
alert(data.d);
}
return;
if (data.d == "") { $("#txtlog").val("导入成功"); }
else {
$("#txtlog").val(data.d);
}
}
});
}
function ImportLook() {
var param = new Object();
param.ListModel = new Array();
$(CheckBoxList1.GetSelectItems()).each(function () {
var id = $(this).val();
Array.add(param.ListModel, id);
});
if (param.ListModel.length == 0) { alert("请选择一个店铺查看导入结果"); return; }
WindowLoadModel.Show();
$.ajax({
url: "SysManageService.asmx/ImportApiLook",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
success: function (data) {
WindowLoadModel.Hide();
$("#txtlog").val(data.d);
}
});
}
//#endregion
function ShopGetAccessToken() {
var param = new Object();
param.ListModel = new Array();
$(CheckBoxList1.GetSelectItems()).each(function () {
var id = $(this).val();
Array.add(param.ListModel, id);
});
if (param.ListModel.length == 0) { alert("请至少选择一个店铺"); return; }
WindowLoadModel.Show();
$.ajax({
url: "SysManageService.asmx/ShopGetAccessToken",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
success: function (data) {
WindowLoadModel.Hide();
alert(data.d);
}
});
}
</script>
</head>
<body class="headbody">
<div class="title_ico">
待发货订单导入
</div>
<table id="tb1" class="tableAll" style="width: 100%;">
<colgroup>
<col style="width:100px;" />
<col />
</colgroup>
<tr>
<td colspan="2">
<font color="red">注已经授权并允许每天自动导入的店铺订单每天凌晨4-5点会由程序自动导入订单<br />
如有发现未导入成功或者其他情况的话,可以在这边手动执行导入<br />
没有授权或者导入失败的请在系统管理下面的店铺管理里确认店铺是否授权成功
</font></td>
</tr>
<tr>
<td class="f1">平台
</td>
<td>
<select id="listPlatType" class="selectClass" style="width: 150px;"></select>
<input id="cmdImport" type="button" class="btnClass btnClassAdd" value="导入订单" />&nbsp;&nbsp;&nbsp;<a href="CDiscountImport.aspx" target="_blank" style="display:none">CDiscount导单</a>
<input id="cmdSQ" type="button" class="btnClass btnClassEdit" value="速卖通店铺重新授权" onclick="ShopGetAccessToken();" /> </td>
</tr>
<tr>
<td class="f1">导入日期范围:</td>
<td>
<input id="txt_SDate" class="editTextbox" onfocus="WdatePicker()" style="width: 120px;" type="text" />-<input id="txt_EDate" class="editTextbox" onfocus="WdatePicker()" style="width: 120px;" type="text" /><font color="red">注日期范围不选默认导入最近15天的订单</font></td>
</tr>
<tr>
<td class="f1">店铺
<input id="chk_Selectall" type="checkbox" />
</td>
<td id="divShop">
</td>
</tr>
<tr>
<td class="f1">&nbsp;</td>
<td>
<input id="cmdFind" type="button" class="btnClass btnClassFind" value="查看导入结果" onclick="ImportLook();" /></td>
</tr>
<tr>
<td valign="top" colspan="2" >
<textarea id="txtlog" cols="20" rows="2" style="width: 100%; height: 400px"></textarea>
</td>
</tr>
</table>
</body>
</html>