Authored by 陶雨

模板商品管理

@@ -5,13 +5,11 @@ @@ -5,13 +5,11 @@
5 <div class="panel panel-default" style="margin-bottom:10px;"> 5 <div class="panel panel-default" style="margin-bottom:10px;">
6 <div class="panel-heading"> 6 <div class="panel-heading">
7 <div id="basicForm" class="form-horizontal form-bordered form-inline" data-id="<%id%>"> 7 <div id="basicForm" class="form-horizontal form-bordered form-inline" data-id="<%id%>">
8 - <input type="hidden" name="temp_id" value="108">  
9 <div class="form-group"> 8 <div class="form-group">
10 - <button type="button" class="btn btn-info" onclick="inputfile.click();">浏览文档</button>  
11 - <input type="file" id="inputfile" style="display:none" name="filexls"> 9 + <input id="uploadBox" name="file" type="file" style="position: absolute; top: 0;left: 0;z-index: -999">
  10 + <div id="chooseFile" class="file-name btn btn-success">上传商品</div>
  11 + <p style="color: #999">注:上传.xls文件</p>
12 </div> 12 </div>
13 - <button class="btn btn-success" type="submit" id="upload">上传商品</button>  
14 - <p style="color: #999">注:上传.xls文件</p>  
15 </div> 13 </div>
16 </div> 14 </div>
17 <div class="panel-body" id="condition"> 15 <div class="panel-body" id="condition">
@@ -42,6 +42,24 @@ var g = new common.grid({ @@ -42,6 +42,24 @@ var g = new common.grid({
42 42
43 g.init("/activityTemplate/getProductListByCondition"); 43 g.init("/activityTemplate/getProductListByCondition");
44 44
  45 +common.edit.ajaxfileupload("#uploadBox", {
  46 + params: {
  47 + type: "activityProduct",
  48 + __type: "batch-import",
  49 + args:id
  50 + },
  51 + valid_extensions: ['xls', 'xlsx'],
  52 + onComplete: function (response) {
  53 + if (response.status && response.code == 200) {
  54 + common.util.__tip(response.message, 'success');
  55 + g.reload();
  56 + }
  57 + else {
  58 + common.util.__tip(response.message, 'warning');
  59 + }
  60 + }
  61 +});
  62 +
45 //编辑 63 //编辑
46 $(document).on("click", ".edit", function () { 64 $(document).on("click", ".edit", function () {
47 var index = $(this).data("index"); 65 var index = $(this).data("index");
@@ -84,4 +102,8 @@ $(document).on("click", "#filter-btn", function () { @@ -84,4 +102,8 @@ $(document).on("click", "#filter-btn", function () {
84 //输入限制 102 //输入限制
85 $(document).on("keyup",".number", function () { 103 $(document).on("keyup",".number", function () {
86 $(this).val($(this).val().replace(/\D/g, '')); 104 $(this).val($(this).val().replace(/\D/g, ''));
  105 +});
  106 +
  107 +$(document).on("click", "#chooseFile", function () {
  108 + $("#uploadBox").click();
87 }); 109 });