Authored by dongjunjie

代销变价

@@ -41,6 +41,8 @@ module.exports=function(app) { @@ -41,6 +41,8 @@ module.exports=function(app) {
41 app.post("/product/getProductPrice", "price_getProductPrice"); 41 app.post("/product/getProductPrice", "price_getProductPrice");
42 42
43 app.post("/product/updateProductPrice", "price_updateProductPrice"); 43 app.post("/product/updateProductPrice", "price_updateProductPrice");
  44 +
  45 + app.post("/product/queryProductPriceListBySkn","price_queryProductPriceListBySkn");
44 46
45 app.post("/product/batchUpdateProductPrice", "price_batchUpdateProductPrice"); 47 app.post("/product/batchUpdateProductPrice", "price_batchUpdateProductPrice");
46 48
@@ -45,6 +45,13 @@ module.exports={ @@ -45,6 +45,13 @@ module.exports={
45 {name: 'vip3_price',type: 'number'} 45 {name: 'vip3_price',type: 'number'}
46 ] 46 ]
47 }, 47 },
  48 + queryProductPriceListBySkn:{
  49 + title:'变价记录',
  50 + url: '/product/queryProductPriceListBySkn',
  51 + params: [
  52 + {name: 'param', type: 'Number'}
  53 + ]
  54 + },
48 batchUpdateProductPrice:{ 55 batchUpdateProductPrice:{
49 title: "批量变价接口", 56 title: "批量变价接口",
50 url: '/product/batchUpdateProductPrice', 57 url: '/product/batchUpdateProductPrice',
1 <%include '../../../common/views/__ui/header'%> 1 <%include '../../../common/views/__ui/header'%>
2 -  
3 <%include '../../../common/views/__partail/ListHeader'%> 2 <%include '../../../common/views/__partail/ListHeader'%>
4 3
5 <div class="contentpanel"> 4 <div class="contentpanel">
6 <div class="panel panel-default" id="priceChangeSearch" style="margin-bottom:10px;"> 5 <div class="panel panel-default" id="priceChangeSearch" style="margin-bottom:10px;">
7 <div class="panel-body"> 6 <div class="panel-body">
8 -  
9 <div class="row"> 7 <div class="row">
10 -  
11 - <div class="panel-col2"> 8 + <div class="panel-col">
12 <input id="skn" class="form-control panel-input height40" type="text" placeholder="请输入SKN" onkeyup="this.value=this.value.replace(/\D/gi,'')"> 9 <input id="skn" class="form-control panel-input height40" type="text" placeholder="请输入SKN" onkeyup="this.value=this.value.replace(/\D/gi,'')">
13 </div> 10 </div>
14 11
@@ -25,10 +22,6 @@ @@ -25,10 +22,6 @@
25 </div> 22 </div>
26 23
27 <div class="panel-col"> 24 <div class="panel-col">
28 - <input id="brandInput" class="form-control panel-input height40" type="text" placeholder="请输入品牌名称">  
29 - </div>  
30 -  
31 - <div class="panel-col">  
32 <select name="supplier" id="supplier" tabindex="-1" title="" class="form-control"> 25 <select name="supplier" id="supplier" tabindex="-1" title="" class="form-control">
33 <option value="-1">请选择供应商</option> 26 <option value="-1">请选择供应商</option>
34 </select> 27 </select>
@@ -72,123 +65,186 @@ @@ -72,123 +65,186 @@
72 </div> 65 </div>
73 66
74 <div class="panel-col"> 67 <div class="panel-col">
75 - <select name="brandCooperation" id="brandCooperation" tabindex="-1" title="" class="form-control">  
76 - <option value="-1">合作模式</option>  
77 - <option value="1">代销</option>  
78 - <option value="2">经销</option>  
79 - <option value="3">自主</option>  
80 - </select>  
81 - </div>  
82 -  
83 - <div class="panel-col">  
84 - <select name="brandCooperationSet" id="brandCooperationSet" tabindex="-1" title="" class="form-control">  
85 - <option value="0">未设置</option>  
86 - <option value="-1">全部</option>  
87 - <option value="1">已设置</option>  
88 - </select>  
89 - </div>  
90 -  
91 - <div class="panel-col">  
92 <a id="filter-btn" href="javascript:;" class="btn btn-info">筛选</a> 68 <a id="filter-btn" href="javascript:;" class="btn btn-info">筛选</a>
93 <a id="all-btn" href="javascript:;" class="btn btn-info">全部</a> 69 <a id="all-btn" href="javascript:;" class="btn btn-info">全部</a>
94 </div> 70 </div>
95 71
96 <div class="panel-col" style="margin: 0 0 0 -5px;"> 72 <div class="panel-col" style="margin: 0 0 0 -5px;">
97 - <a id="import-btn" href="javascript:;" class="btn btn-info">批量导入</a> 73 + <a id="import-btn" href="javascript:;" class="btn btn-primary">批量导入</a>
98 </div> 74 </div>
99 </div> 75 </div>
100 </div> 76 </div>
101 </div> 77 </div>
102 -  
103 <div class="panel"> 78 <div class="panel">
104 <div class="dataTables_wrapper no-footer" id="basicTable"></div> 79 <div class="dataTables_wrapper no-footer" id="basicTable"></div>
105 -  
106 - <div class="panel bulk-import" style='padding:20px'>  
107 - <a id="return-btn" href="javascript:;" class="btn btn-info" style="margin-bottom: 10px">返回列表</a>  
108 -  
109 - <div class="import-hd" style="padding: 10px 20px; border: 1px solid #cccccc">  
110 - <span class="excel-upload-wrap">  
111 - <label>选择文件</label>  
112 - <input id="upload-input" name="file" class="btn btn-default excel-upload" type="file">  
113 - </span>  
114 -  
115 - <a class="excel-model" href="/ajax/link/batchUpdatePrice">表头下载</a>  
116 - <input id="sure-change" class="btn btn-primary" type="button" value="确定变价"> 80 + <div class="panel bulk-import" id="priceChange_import" style="padding: 20px;">
  81 + <a id="return-btn" href="javascript:;" class="btn btn-info">返回列表</a>
  82 + <a id="download-btn" href="javascript:;" class="btn btn-success" style="display: none">
  83 + <span class="glyphicon glyphicon-arrow-down"></span> 下载导入结果
  84 + </a>
  85 +
  86 + <table class="table table-bordered" style="border:1px solid #ddd; margin-top: 10px">
  87 + <tr>
  88 + <td width="120px" style="line-height: 37px"><b>上传EXCEL:</b></td>
  89 + <td style="position: relative;">
  90 + <input id="priceChangeUpload" name="file" type="file" style="cursor: pointer; height: 37px; top: 8px;">
  91 + <div class="file-name btn btn-primary">请选择文件</div>
  92 + </td>
  93 + </tr>
  94 + <tr>
  95 + <td width="120px"><b>说明:</b></td>
  96 + <td>
  97 + 1、上传文件必须是<span style="color:red;">.xlsx</span>文件<br>
  98 + 2、Excel表头为:<span style="color: #67D267;">SKN、吊牌价、销售价、VIP折扣类型、VIP价、白金价、金卡价、银卡价</span><br>
  99 + 3、第一行为表头内容,第二行开始为正式内容<br>
  100 + 4、每个文件控制在2500行以内<br>
  101 + 5、<a href="/ajax/link/batchUpdatePrice" style="margin: 0; text-decoration: underline">下载样例.xlsx</a>
  102 + </td>
  103 + </tr>
  104 + </table>
  105 +
  106 + <div id="priceChangeImportMessage">
  107 + <b>批量上传结果:</b>
  108 + <span id="detailMassage"></span>
  109 + <div class="clearfix"></div>
117 </div> 110 </div>
118 111
119 - <ol id="error-msg" class="error-msg" style="color: red"></ol>  
120 - <div class="priceTable-wrap">  
121 -  
122 - <div class="panel panel-warning" style="margin: 0;">  
123 - <div class="panel-heading">SKN变价<a id="delete-all" class="btn btn-danger" style="margin-left: 50px;" href="javascript:;">全部删除</a></div>  
124 - 112 + <div id="priceChangeImportResultSet">
  113 + <div class="title">
  114 + <span>生效时间设置:</span>
  115 + <div class="clearfix"></div>
  116 + </div>
  117 + <div class="form-inline">
  118 + <label>价格生效时间:</label>
  119 + <div class="form-group">
  120 + <input id="importStartDate" jsaction="date:end:importEndDate" type="text" class="form-control" placeholder="开始日期" style="width: 150px">
  121 + &nbsp;~&nbsp;
  122 + <input id="importEndDate" jsaction="date:start:importStartDate" type="text" class="form-control" placeholder="结束日期" style="width: 150px">
  123 + </div>
  124 + <div class="form-group">
  125 + <a href="javascript:;" class="btn btn-success btn-submit-priceChange">确定提交</a>
  126 + </div>
125 </div> 127 </div>
126 - <div class="dataTables_wrapper no-footer" id="priceTable"></div>  
127 </div> 128 </div>
128 - <div class="success-wrap" style="display: none;">  
129 - <a class="btn btn-info" href="">返回变价列表</a>  
130 - <a id="download-btn" class="btn btn-success" data-domain="{{domain}}" href="javascript:;">下载导入结果</a> 129 +
  130 + <div id="priceChangeImportResult">
  131 + <div class="title">
  132 + <span>批量变价列表:(成功导入的变价)</span>
  133 + <a id="deleteAllImport" href="javascript:;" class="btn btn-xs btn-danger" style="float: right;padding-right: 10px">全部删除</a>
  134 + <div class="clearfix"></div>
  135 + </div>
  136 + <div id="importResultTable"></div>
131 </div> 137 </div>
132 </div> 138 </div>
133 </div> 139 </div>
134 </div> 140 </div>
135 141
136 -<input type="hidden" id="btnAuthority" value="<%bottons%>">  
137 -<input type="hidden" id="gridurl" value="<%gridurl%>">  
138 -  
139 <script id="template" type="text/template"> 142 <script id="template" type="text/template">
140 - <tr class="product-detail">  
141 - <td colspan="15">  
142 - <form>  
143 - <table class="table table-striped table-bordered">  
144 - <tr>  
145 - <th>SKN</th>  
146 - <th>销售价</th>  
147 - <th>VIP折扣类型</th>  
148 - <th>VIP</th>  
149 - <th>白金价</th>  
150 - <th>金卡价</th>  
151 - <th>银卡价</th>  
152 - <th>进货价</th>  
153 - <th>进货折扣</th>  
154 - <th>成本</th>  
155 - <th>操作</th>  
156 - </tr>  
157 - <tr>  
158 - <td class="skn-value"></td>  
159 - <td>  
160 - <input class="sale-price" type="text" value="{sales_price}">  
161 - </td>  
162 - <td>  
163 - <select class="discount-select">  
164 - <option value="1">正常折扣</option>  
165 - <option value="2">统一折扣</option>  
166 - <option value="3">无折扣</option>  
167 - <option value="4">固定折扣</option>  
168 - <option value="5">自定义折扣</option>  
169 - </select>  
170 - </td>  
171 - <td>  
172 - <input class="vip-price" type="text" value="{vip_price}">  
173 - </td>  
174 - <td>  
175 - <input class="vip3-price" type="text" value="{vip3_price}" disabled>  
176 - </td>  
177 - <td>  
178 - <input class="vip2-price" type="text" value="{vip2_price}" disabled>  
179 - </td>  
180 - <td>  
181 - <input class="vip1-price" type="text" value="{vip1_price}" disabled>  
182 - </td>  
183 - <td>{purchase_price}</td>  
184 - <td>{purchase_discount}</td>  
185 - <td>{cost_price}</td>  
186 - <td><a class="sure-modify" href="javascript:;">确认修改</a></td>  
187 - </tr>  
188 - </table>  
189 - </form>  
190 - </td>  
191 - </tr> 143 + <td colspan="15" style="padding: 0">
  144 + <table class="table table-striped table-bordered" style="margin: 0;border: 0">
  145 + <tr>
  146 + <th style="border-top: 0; border-left: 0">销售价</th>
  147 + <th style="border-top: 0">VIP折扣类型</th>
  148 + <th style="border-top: 0">VIP</th>
  149 + <th style="border-top: 0">白金价</th>
  150 + <th style="border-top: 0">金卡价</th>
  151 + <th style="border-top: 0">银卡价</th>
  152 + <th style="border-top: 0">价格生效时间</th>
  153 + <th style="border-top: 0">进货价</th>
  154 + <th style="border-top: 0">进货折扣</th>
  155 + <th style="border-top: 0">成本</th>
  156 + <th style="border-top: 0">操作</th>
  157 + </tr>
  158 + <tr>
  159 + <td style="border-bottom: 0; border-left: 0">
  160 + <input class="sale-price form-control" type="text" value="{sales_price}" onkeyup="this.value=this.value.replace(/\D/gi,'')">
  161 + </td>
  162 + <td style="border-bottom: 0">
  163 + <select class="discount-select form-control" style="width: 110px">
  164 + <option value="1">正常折扣</option>
  165 + <option value="2">统一折扣</option>
  166 + <option value="3">无折扣</option>
  167 + <option value="4">固定折扣</option>
  168 + <option value="5">自定义折扣</option>
  169 + </select>
  170 + </td>
  171 + <td style="border-bottom: 0">
  172 + <input class="vip-price form-control" type="text" value="{vip_price}" onkeyup="this.value=this.value.replace(/\D/gi,'')">
  173 + </td>
  174 + <td style="border-bottom: 0">
  175 + <input class="vip3-price form-control" type="text" value="{vip3_price}" disabled>
  176 + </td>
  177 + <td style="border-bottom: 0">
  178 + <input class="vip2-price form-control" type="text" value="{vip2_price}" disabled>
  179 + </td>
  180 + <td style="border-bottom: 0">
  181 + <input class="vip1-price form-control" type="text" value="{vip1_price}" disabled>
  182 + </td>
  183 + <td class="form-inline" style="border-bottom: 0">
  184 + <input id="start_{product_skn}" jsaction="date:end:end_{product_skn}" class="startDate form-control" type="text" value="{cgpriceStartTime}" placeholder="开始日期" style='background-color:#fff'>
  185 + <label>&nbsp;~&nbsp;</label>
  186 + <input id="end_{product_skn}" jsaction="date:start:start_{product_skn}" class="endDate form-control" type="text" value="{cgpriceEndTime}" placeholder="结束日期" style='background-color:#fff'>
  187 + </td>
  188 + <td style="border-bottom: 0">{purchase_price}</td>
  189 + <td style="border-bottom: 0">{purchase_discount}</td>
  190 + <td style="border-bottom: 0">{cost_price}</td>
  191 + <td style="border-bottom: 0">
  192 + <a href="javascript:;" class="btn btn-success btn-xs sure-modify">保存</a>
  193 + </td>
  194 + </tr>
  195 + </table>
  196 + </td>
  197 +</script>
  198 +<script id="template2" type="text/template">
  199 + <div class="productInfo">
  200 + <table class="table table-striped table-bordered">
  201 + <thead>
  202 + <tr align="center">
  203 + <th>SKN</th>
  204 + <th>商品名称</th>
  205 + <th>品牌</th>
  206 + <th>类目</th>
  207 + </tr>
  208 + </thead>
  209 + <tbody>
  210 + <tr>
  211 + <td>[[productSkn]]</td>
  212 + <td>[[goodsName]]</td>
  213 + <td>[[brandName]]</td>
  214 + <td>
  215 + [[maxSortName]]
  216 + [[if midleSortName]]&nbsp;>&nbsp;[[midleSortName]][[/if]]
  217 + [[if smallSortName]]&nbsp;>&nbsp;[[smallSortName]][[/if]]
  218 + </td>
  219 + </tr>
  220 + </tbody>
  221 + </table>
  222 + </div>
  223 + <h2 style="color: #999; font-family: 'Microsoft YaHei'; font-size: 14px;">—— 变价记录表 ——</h2>
  224 + <div class="historyList">
  225 + <table class="table table-striped table-bordered">
  226 + <thead>
  227 + <tr>
  228 + <th>吊牌价</th>
  229 + <th>销售价</th>
  230 + <th>价格生效时间</th>
  231 + <th>变价时间</th>
  232 + <th>变价人</th>
  233 + </tr>
  234 + </thead>
  235 + <tbody>
  236 + [[each list as item index]]
  237 + <tr>
  238 + <td>[[item.retailPrice]]</td>
  239 + <td>[[item.salesPrice]]</td>
  240 + <td>[[item.effectiveTime]]</td>
  241 + <td>[[item.createTime]]</td>
  242 + <td>[[item.founderName]]</td>
  243 + </tr>
  244 + [[/each]]
  245 + </tbody>
  246 + </table>
  247 + </div>
192 </script> 248 </script>
193 249
194 <%include '../../../common/views/__ui/footer'%> 250 <%include '../../../common/views/__ui/footer'%>
@@ -2,21 +2,7 @@ @@ -2,21 +2,7 @@
2 var $ = require('jquery'), 2 var $ = require('jquery'),
3 common = require('../../common/common'); 3 common = require('../../common/common');
4 4
5 -var ENUM = {  
6 - vipType: {  
7 - 1: '正常折扣',  
8 - 2: '统一折扣',  
9 - 3: '无折扣',  
10 - 4: '固定折扣',  
11 - 5: '自定义折扣'  
12 - },  
13 - gender: {  
14 - 1: '男',  
15 - 2: '女',  
16 - 3: '通用'  
17 - }  
18 -}  
19 - 5 +/***********************变价列表***********************/
20 6
21 new common.dropDown({ 7 new common.dropDown({
22 el: '#shop', 8 el: '#shop',
@@ -47,6 +33,21 @@ new common.dropDown({ @@ -47,6 +33,21 @@ new common.dropDown({
47 el: "#sex" 33 el: "#sex"
48 }); 34 });
49 35
  36 +var ENUM = {
  37 + vipType: {
  38 + 1: '正常折扣',
  39 + 2: '统一折扣',
  40 + 3: '无折扣',
  41 + 4: '固定折扣',
  42 + 5: '自定义折扣'
  43 + },
  44 + gender: {
  45 + 1: '男',
  46 + 2: '女',
  47 + 3: '通用'
  48 + }
  49 +};
  50 +
50 //多级菜单 51 //多级菜单
51 var tabTree = new common.tabTree("#sortTree"); 52 var tabTree = new common.tabTree("#sortTree");
52 tabTree.init(); 53 tabTree.init();
@@ -56,8 +57,8 @@ var g = new common.grid({ @@ -56,8 +57,8 @@ var g = new common.grid({
56 parms: function() { 57 parms: function() {
57 var select = tabTree.getAddress(); 58 var select = tabTree.getAddress();
58 return { 59 return {
59 - shop_id: common.util.__input("shopId"),  
60 product_skn: common.util.__input("skn"), 60 product_skn: common.util.__input("skn"),
  61 + shop_id: common.util.__input("shop"),
61 brand_id: common.util.__input("brand"), 62 brand_id: common.util.__input("brand"),
62 supplier_id: common.util.__input("supplier"), 63 supplier_id: common.util.__input("supplier"),
63 is_jit: common.util.__input("jit"), 64 is_jit: common.util.__input("jit"),
@@ -67,391 +68,432 @@ var g = new common.grid({ @@ -67,391 +68,432 @@ var g = new common.grid({
67 max_sort_id: select[0] ? select[0].id : "", 68 max_sort_id: select[0] ? select[0].id : "",
68 middle_sort_id: select[1] ? select[1].id : "", 69 middle_sort_id: select[1] ? select[1].id : "",
69 small_sort_id: select[2] ? select[2].id : "" 70 small_sort_id: select[2] ? select[2].id : ""
70 - };  
71 - },  
72 - columns: [{  
73 - display: 'SKN',  
74 - name: 'product_skn'  
75 - }, {  
76 - display: '商品信息',  
77 - name: 'info',  
78 - render: function(item) {  
79 - return '<p>名称:' + item.product_name + '</p><p>品牌:' + item.brand_name + '</p><p>类目:' + item.middle_sort_name + '/' + item.small_sort_name + '</p>';  
80 } 71 }
81 - }, {  
82 - display: '供应商/店铺',  
83 - name: 'supplier_name'  
84 - }, {  
85 - display: '性别',  
86 - name: 'gender',  
87 - render: function(item) { 72 + },
  73 + columns: [
  74 + {display: 'SKN', name: 'product_skn'},
  75 + {display: '商品信息', render: function(item) {
  76 + var html = '<p>名称:' + item.product_name + '</p><p>品牌:' + item.brand_name + '</p>' +
  77 + '<div>类目:'+ item.middle_sort_name;
  78 + if(item.middle_sort_name) {html += '&nbsp;>&nbsp;' + item.middle_sort_name;}
  79 + if(item.small_sort_name) {html += '&nbsp;>&nbsp;' + item.small_sort_name;}
  80 + return html + "</div>";
  81 + }},
  82 + {display: '供应商/店铺', render: function(item) {
  83 + var html = '';
  84 + if (item.supplier_name) {
  85 + html += item.supplier_name;
  86 + if (item.shop_name) {html += '/';}
  87 + }
  88 + if (item.shop_name) {html += item.shop_name;}
  89 + return html;
  90 + }},
  91 + {display: '性别', render: function(item) {
88 return ENUM.gender[item.gender]; 92 return ENUM.gender[item.gender];
89 - }  
90 - }, {  
91 - display: '吊牌价',  
92 - name: 'retail_price'  
93 - }, {  
94 - display: '销售价',  
95 - name: 'sales_price'  
96 - }, {  
97 - display: 'VIP折扣类型',  
98 - name: 'vip_discount_type',  
99 - render: function(item) { 93 + }},
  94 + {display: '吊牌价', name: 'retail_price'},
  95 + {display: '销售价', name: 'sales_price'},
  96 + {display: 'VIP折扣类型', render: function(item) {
100 return ENUM.vipType[item.vip_discount_type]; 97 return ENUM.vipType[item.vip_discount_type];
101 - }  
102 - }, {  
103 - display: 'VIP价',  
104 - name: 'vip_price'  
105 - }, {  
106 - display: '白金',  
107 - name: 'vip3_price'  
108 - }, {  
109 - display: '金卡',  
110 - name: 'vip2_price'  
111 - }, {  
112 - display: '银卡',  
113 - name: 'vip1_price'  
114 - }, {  
115 - display: '操作信息',  
116 - name: 'operateInfo',  
117 - render: function(item) { 98 + }},
  99 + {display: 'VIP价', name: 'vip_price'},
  100 + {display: '白金', name: 'vip3_price'},
  101 + {display: '金卡', name: 'vip2_price'},
  102 + {display: '银卡', name: 'vip1_price'},
  103 + {display: '生效时间', name: 'effectiveTime'},
  104 + {display: '操作信息', render: function(item) {
118 var html = ''; 105 var html = '';
119 - if (item.founder_name) {  
120 - html += '<p>' + item.founder_name + '</p>';  
121 - }  
122 -  
123 - if (item.updateTime) {  
124 - html += '<p>' + item.updateTime + '</p>';  
125 - } 106 + if (item.founder_name) {html += '<p>' + item.founder_name + '</p>';}
  107 + if (item.updateTime) {html += '<div style="color: #999;font-size: 12px">' + item.updateTime + '</div>';}
126 return html; 108 return html;
  109 + }},
  110 + {display: '操作', render: function(item) {
  111 + return '<a href="javascript:;" class="btn btn-info btn-xs modify-btn" data-skn="' + item.product_skn + '">修改</a><br>' +
  112 + '<a href="javascript:;" class="btn btn-primary btn-xs history-btn" data-skn="' + item.product_skn + '" style="margin-top: 10px">变价记录</a>'
127 } 113 }
128 - }, {  
129 - display: '操作',  
130 - render: function(item) {  
131 - return '<a href="javascript:;" class="btn btn-info btn-xs modify-btn" data-skn="' + item.product_skn + '">修改</a>'  
132 - }  
133 - }] 114 + }]
134 }); 115 });
  116 +g.init('/product/queryProductPriceList');
135 117
136 -g.init($("#gridurl").val());  
137 -  
138 -//单个变价  
139 -$('#basicTable').on('click', '.modify-btn', function() { 118 +//单个变价修改
  119 +$(document).on('click', '.modify-btn', function() {
140 var skn = $(this).data('skn'), 120 var skn = $(this).data('skn'),
141 - that = this;  
142 -  
143 - if ($(that).data('detail')) {  
144 - $(that).parents('tr').next('.product-detail').toggle();  
145 - return; 121 + parentTr = $(this).parent().parent(),
  122 + sknTd = parentTr.find('td').eq(0);
  123 +
  124 + if($(this).hasClass('open')){
  125 + $(this).removeClass('open');
  126 + $(this).text('修改');
  127 + sknTd.removeAttr('rowspan','2');
  128 + parentTr.next('.product-detail').remove();
  129 + parentTr.next('.extraTr').remove();
  130 + }else{
  131 + $(this).addClass('open');
  132 + $(this).text('收起');
  133 + sknTd.attr('rowspan','2');
  134 + parentTr.after('<tr class="product-detail"><td colspan="15">加载中...若长时间加载不出来,请重新刷新页面!</td>' +
  135 + '</tr><tr class="extraTr"></tr>');
  136 +
  137 + common.util.__ajax({
  138 + url:'/product/getProductPrice',
  139 + data: {param: skn}
  140 + },function(rs){
  141 + var data = rs.data;
  142 + parentTr.next('.product-detail').html($(common.util.__template($("#template").html(), data)));
  143 + new common.edit(".product-detail").init();
  144 +
  145 + var $wrap = parentTr.next('.product-detail'),
  146 + $price = $wrap.find('.sale-price'),
  147 + $select = $wrap.find('.discount-select'),
  148 + $vipPrice = $wrap.find('.vip-price'),
  149 + $vip3Price = $wrap.find('.vip3-price'),
  150 + $vip2Price = $wrap.find('.vip2-price'),
  151 + $vip1Price = $wrap.find('.vip1-price'),
  152 + $startDate = $wrap.find('.startDate'),
  153 + $endDate = $wrap.find('.endDate'),
  154 + $submitBtn = $wrap.find('.sure-modify');
  155 + $select.val(data.vip_discount_type);
  156 +
  157 + vipPrice($wrap);
  158 + $select.on('change', function() {
  159 + vipPrice($wrap);
  160 + });
  161 + $vipPrice.on('blur', function() {
  162 + vipPrice($wrap);
  163 + });
  164 + $price.on('blur', function() {
  165 + vipPrice($wrap);
  166 + });
  167 + $submitBtn.on('click', function() {
  168 + common.util.__ajax({
  169 + url: '/product/updateProductPrice',
  170 + data: {
  171 + product_skn: skn,
  172 + sales_price: $price.val(),
  173 + vip_discount_type: $select.val(),
  174 + vip_price: $vipPrice.val(),
  175 + vip1_price: $vip1Price.val(),
  176 + vip2_price: $vip2Price.val(),
  177 + vip3_price: $vip3Price.val(),
  178 + cgpriceStartTime:$startDate.val(),
  179 + cgpriceEndTime:$endDate.val()
  180 + }
  181 + }, function(res) {
  182 + if (res.code == 200) {g.reload()}
  183 + })
  184 + });
  185 + },true);
146 } 186 }
147 187
148 - $.ajax({  
149 - type: 'POST',  
150 - url: '/product/getProductPrice',  
151 - dataType: 'json',  
152 - data: {  
153 - param: skn  
154 - }  
155 - }).then(function(res) {  
156 - var data = res.data;  
157 -  
158 - $(that).data('detail', true).parents('tr')  
159 - .after($(common.util.__template($("#template").html(), data)))  
160 - .next('.product-detail').find('.skn-value').text(skn);  
161 -  
162 - var $wrap = $(that).parents('tr').next('.product-detail'),  
163 - $price = $wrap.find('.sale-price'), 188 + function vipPrice($wrap) {
  189 + var $price = $wrap.find('.sale-price'),
164 $select = $wrap.find('.discount-select'), 190 $select = $wrap.find('.discount-select'),
165 $vipPrice = $wrap.find('.vip-price'), 191 $vipPrice = $wrap.find('.vip-price'),
166 $vip3Price = $wrap.find('.vip3-price'), 192 $vip3Price = $wrap.find('.vip3-price'),
167 $vip2Price = $wrap.find('.vip2-price'), 193 $vip2Price = $wrap.find('.vip2-price'),
168 - $vip1Price = $wrap.find('.vip1-price'),  
169 - $submitBtn = $wrap.find('.sure-modify');  
170 -  
171 - $select.val(data.vip_discount_type);  
172 -  
173 - function vipPrice() {  
174 - var price = $price.val(),  
175 - vipPrice = $vipPrice.val(),  
176 - selectVal = $select.val() - 1,  
177 - priceArr = [];  
178 -  
179 - priceArr.push([price * 0.95, price * 0.9, price * 0.88]);  
180 - priceArr.push([price * 0.95, price * 0.95, price * 0.95]);  
181 - priceArr.push([price, price, price]);  
182 - priceArr.push([$vipPrice.val(), $vipPrice.val(), $vipPrice.val()]);  
183 -  
184 - if (selectVal == 4) {  
185 - $vip1Price.removeAttr('disabled');  
186 - $vip2Price.removeAttr('disabled');  
187 - $vip3Price.removeAttr('disabled');  
188 - } else {  
189 - $vip1Price.attr('disabled', true).val(Number(priceArr[selectVal][0]).toFixed(2));  
190 - $vip2Price.attr('disabled', true).val(Number(priceArr[selectVal][1]).toFixed(2));  
191 - $vip3Price.attr('disabled', true).val(Number(priceArr[selectVal][2]).toFixed(2)); 194 + $vip1Price = $wrap.find('.vip1-price');
  195 +
  196 + var price = $price.val(),
  197 + vipPrice = $vipPrice.val(),
  198 + selectVal = $select.val() - 1,
  199 + priceArr = [];
  200 +
  201 + priceArr.push([price * 0.95, price * 0.9, price * 0.88]);
  202 + priceArr.push([price * 0.95, price * 0.95, price * 0.95]);
  203 + priceArr.push([price, price, price]);
  204 + priceArr.push([vipPrice, vipPrice, vipPrice]);
  205 +
  206 + if (selectVal == 4) {
  207 + $vip1Price.removeAttr('disabled');
  208 + $vip2Price.removeAttr('disabled');
  209 + $vip3Price.removeAttr('disabled');
  210 + } else {
  211 + $vip1Price.attr('disabled', true).val(Number(priceArr[selectVal][0]).toFixed(2));
  212 + $vip2Price.attr('disabled', true).val(Number(priceArr[selectVal][1]).toFixed(2));
  213 + $vip3Price.attr('disabled', true).val(Number(priceArr[selectVal][2]).toFixed(2));
  214 + }
  215 + }
  216 +});
  217 +//变价记录
  218 +$(document).on('click', '.history-btn', function () {
  219 + var skn = $(this).data('skn');
  220 + var option = {
  221 + title:'变价记录详情',
  222 + content:"<div class='historyDetail'>加载变价记录...</div>",
  223 + width:'70%',
  224 + button:[{value:"关闭", css:"btn-primary"}]
  225 + };
  226 + new common.dialog(option);
  227 + $.ajax({
  228 + type: 'POST',
  229 + dataType: 'json',
  230 + url: '/product/queryProductPriceListBySkn',
  231 + data: {param: skn},
  232 + success: function (rs) {
  233 + var data = rs;
  234 + $('.historyDetail').html($(common.util.__template2($("#template2").html(), data.data)));
  235 + if(data.code != 200){
  236 + common.util.__tip(data.message);
192 } 237 }
  238 + },
  239 + error: function (rs) {
  240 + $('.historyDetail').html($(common.util.__template2($("#template2").html(), {})));
  241 + common.util.__tip(rs.data.message);
193 } 242 }
194 -  
195 - vipPrice();  
196 - $select.on('change', function() {  
197 - vipPrice();  
198 - });  
199 -  
200 - $vipPrice.on('blur', function() {  
201 - vipPrice();  
202 - });  
203 -  
204 - $price.on('blur', function() {  
205 - vipPrice();  
206 - });  
207 -  
208 - $submitBtn.on('click', function() {  
209 - common.util.__ajax({  
210 - url: '/product/updateProductPrice',  
211 - data: {  
212 - product_skn: skn,  
213 - sales_price: $price.val(),  
214 - vip_discount_type: $select.val(),  
215 - return_coin: $wrap.find('.return-coin').val(),  
216 - vip_price: $vipPrice.val(),  
217 - vip1_price: $vip1Price.val(),  
218 - vip2_price: $vip2Price.val(),  
219 - vip3_price: $vip3Price.val()  
220 - }  
221 - }, function(res) {  
222 - if (res.code == 200) {  
223 - g.reload();  
224 - }  
225 - })  
226 - });  
227 -  
228 }); 243 });
229 }); 244 });
230 -  
231 //筛选 245 //筛选
232 -$("#filter-btn").click(function() { 246 +$(document).on('click', '#filter-btn', function () {
233 g.reload(1); 247 g.reload(1);
234 }); 248 });
235 -  
236 //回车筛选 249 //回车筛选
237 -$('#skn').on('keyup', function(event) { 250 +$(document).on('keyup', 'body', function (event) {
238 if (event.keyCode == 13) { 251 if (event.keyCode == 13) {
239 $("#filter-btn").trigger('click'); 252 $("#filter-btn").trigger('click');
240 } 253 }
241 }); 254 });
242 -  
243 //全部 255 //全部
244 -$("#all-btn").click(function() { 256 +$(document).on('click', '#all-btn', function () {
245 location.href = ''; 257 location.href = '';
246 }); 258 });
247 -  
248 //批量导入按钮点击事件 259 //批量导入按钮点击事件
249 -$('#import-btn').on('click', function() { 260 +$(document).on('click', '#import-btn', function () {
250 $('#basicTable').hide(); 261 $('#basicTable').hide();
251 $('#priceChangeSearch').hide(); 262 $('#priceChangeSearch').hide();
252 $('.bulk-import').show(); 263 $('.bulk-import').show();
253 }); 264 });
254 265
255 -//返回列表  
256 -$('#return-btn').on('click', function() {  
257 - $('.bulk-import').hide();  
258 - $('#basicTable').show();  
259 - $('#priceChangeSearch').show();  
260 -});  
261 -  
262 -//批量导入  
263 -var successList = null,  
264 - $error = $('#error-msg'),  
265 - loadModal = null;  
266 -$('#upload-input').after('<div class="file-name btn btn-default">请选择文件</div>');  
267 -common.edit.ajaxfileupload("#upload-input", {  
268 - params: {  
269 - type: "price",  
270 - __type: "batch-import",  
271 - shop: common.util.__input("shopId")  
272 - },  
273 - onStart: function() {  
274 - loadModal = common.dialog.load();  
275 - $('.file-name').text($('#upload-input').val().replace("C:\\fakepath\\", ""));  
276 - },  
277 - onComplete: function(response) {  
278 - console.log(response);  
279 - if (loadModal) {  
280 - loadModal.close();  
281 - }  
282 - if (response.code == 200) {  
283 - var data = response.data,  
284 - li = '';  
285 -  
286 - $('#priceTable').show();  
287 - $('.success-wrap').hide();  
288 - successList = data.successList;  
289 - $.each(data.failFileReason, function(i, value) {  
290 - li += '<li>' + value + '</li>';  
291 - });  
292 - $error.empty().html(li);  
293 - p.init(successList);  
294 - } else {  
295 - common.util.__tip(response.message, 'warning');  
296 - }  
297 -  
298 -  
299 - }  
300 -});  
301 - 266 +/***********************批量导入***********************/
302 267
303 -  
304 -var isFirst = false,  
305 - tableHtml = ''; 268 +var loadModal = null;
  269 +var importPriceChangeData;
  270 +var path = ''; //确定变价后返回的excel名
306 var p = new common.grid({ 271 var p = new common.grid({
307 - el: "#priceTable",  
308 - columns: [{  
309 - display: 'SKN',  
310 - render: function(item) { 272 + el: "#importResultTable",
  273 + columns: [
  274 + {display: 'SKN', render: function(item) {
311 return item.newProductPriceBo.product_skn; 275 return item.newProductPriceBo.product_skn;
312 - }  
313 - }, {  
314 - display: '吊牌价',  
315 - render: function(item) {  
316 - return item.newProductPriceBo.retail_price + '<p style="color: #ccc;">' + item.oldProductPriceBo.retail_price + '</p>';  
317 - }  
318 - }, {  
319 - display: '销售价',  
320 - render: function(item) { 276 + }},
  277 + {display: '吊牌价', render: function(item) {
  278 + return '<p>'+item.newProductPriceBo.retail_price + '</p><div style="color: #999;">' + item.oldProductPriceBo.retail_price + '</div>';
  279 + }},
  280 + {display: '销售价', render: function(item) {
321 var newPrice = item.newProductPriceBo, 281 var newPrice = item.newProductPriceBo,
322 - newPriceHtml = newPrice.sales_price;  
323 - 282 + newPriceHtml = '<p>'+newPrice.sales_price+'</p>';
324 if (newPrice.sales_price < (newPrice.retail_price / 2)) { 283 if (newPrice.sales_price < (newPrice.retail_price / 2)) {
325 newPriceHtml = '<p style="color: red">' + newPrice.sales_price + '</p>'; 284 newPriceHtml = '<p style="color: red">' + newPrice.sales_price + '</p>';
326 } 285 }
327 -  
328 - return newPriceHtml + '<p style="color: #ccc;">' + item.oldProductPriceBo.sales_price + '</p>';  
329 - }  
330 - }, {  
331 - display: 'VIP折扣类型',  
332 - render: function(item) {  
333 - return ENUM.vipType[item.newProductPriceBo.vip_discount_type] +  
334 - '<p style="color: #ccc;">' + ENUM.vipType[item.oldProductPriceBo.vip_discount_type] + '</p>';  
335 - }  
336 - }, {  
337 - display: 'VIP价',  
338 - render: function(item) { 286 + return newPriceHtml + '<div style="color: #999;">' + item.oldProductPriceBo.sales_price + '</div>';
  287 + }},
  288 + {display: 'VIP折扣类型', render: function(item) {
  289 + return '<p>'+ENUM.vipType[item.newProductPriceBo.vip_discount_type] + '</p>'+
  290 + '<div style="color: #999;">' + ENUM.vipType[item.oldProductPriceBo.vip_discount_type] + '</div>';
  291 + }},
  292 + {display: 'VIP价', render: function(item) {
339 var newPrice = item.newProductPriceBo, 293 var newPrice = item.newProductPriceBo,
340 newPriceHtml = ''; 294 newPriceHtml = '';
341 -  
342 if (newPrice.vip_price) { 295 if (newPrice.vip_price) {
343 - newPriceHtml = newPrice.vip_price;  
344 -  
345 if (newPrice.vip_price < (newPrice.retail_price / 2)) { 296 if (newPrice.vip_price < (newPrice.retail_price / 2)) {
346 newPriceHtml = '<p style="color: red">' + newPrice.vip_price + '</p>'; 297 newPriceHtml = '<p style="color: red">' + newPrice.vip_price + '</p>';
  298 + }else{
  299 + newPriceHtml = '<p>'+newPrice.vip_price+'</p>';
347 } 300 }
348 } else { 301 } else {
349 - newPriceHtml = '-' 302 + newPriceHtml = '<p>-</p>'
350 } 303 }
351 - return newPriceHtml + '<p style="color: #ccc;">' + item.oldProductPriceBo.vip_price + '</p>';  
352 - }  
353 - }, {  
354 - display: '白金价',  
355 - render: function(item) { 304 + if(item.oldProductPriceBo.vip_price){
  305 + newPriceHtml += '<div style="color: #999;">' + item.oldProductPriceBo.vip_price + '</div>';
  306 + }else{
  307 + newPriceHtml += '<div>-</div>';
  308 + }
  309 + return newPriceHtml;
  310 + }},
  311 + {display: '白金价', render: function(item) {
356 var newPrice = item.newProductPriceBo, 312 var newPrice = item.newProductPriceBo,
357 - newPriceHtml = newPrice.vip3_price;  
358 -  
359 - if (newPrice.vip3_price < (newPrice.retail_price / 2)) {  
360 - newPriceHtml = '<p style="color: red">' + newPrice.vip3_price + '</p>'; 313 + newPriceHtml = '';
  314 + if (newPrice.vip3_price){
  315 + if (newPrice.vip3_price < (newPrice.retail_price / 2)) {
  316 + newPriceHtml = '<p style="color: red">' + newPrice.vip3_price + '</p>';
  317 + }else{
  318 + newPriceHtml = '<p>'+newPrice.vip3_price+'</p>';
  319 + }
  320 + }else{
  321 + newPriceHtml = '<p>-</p>'
361 } 322 }
362 -  
363 - return newPriceHtml + '<p style="color: #ccc;">' + item.oldProductPriceBo.vip3_price + '</p>';  
364 - }  
365 - }, {  
366 - display: '金卡价',  
367 - render: function(item) { 323 + if(item.oldProductPriceBo.vip3_price){
  324 + newPriceHtml += '<div style="color: #999;">' + item.oldProductPriceBo.vip3_price + '</div>';
  325 + }else{
  326 + newPriceHtml += '<div>-</div>';
  327 + }
  328 + return newPriceHtml;
  329 + }},
  330 + {display: '金卡价', render: function(item) {
368 var newPrice = item.newProductPriceBo, 331 var newPrice = item.newProductPriceBo,
369 - newPriceHtml = newPrice.vip2_price;  
370 -  
371 - if (newPrice.vip2_price < (newPrice.retail_price / 2)) {  
372 - newPriceHtml = '<p style="color: red">' + newPrice.vip2_price + '</p>'; 332 + newPriceHtml = '';
  333 + if (newPrice.vip2_price){
  334 + if (newPrice.vip2_price < (newPrice.retail_price / 2)) {
  335 + newPriceHtml = '<p style="color: red">' + newPrice.vip2_price + '</p>';
  336 + }else {
  337 + newPriceHtml = '<p>'+newPrice.vip2_price+'</p>';
  338 + }
  339 + }else{
  340 + newPriceHtml = '<p>-</p>'
373 } 341 }
374 -  
375 - return newPriceHtml + '<p style="color: #ccc;">' + item.oldProductPriceBo.vip2_price + '</p>';  
376 - }  
377 - }, {  
378 - display: '银卡价',  
379 - render: function(item) { 342 + if(item.oldProductPriceBo.vip2_price){
  343 + newPriceHtml += '<div style="color: #999;">' + item.oldProductPriceBo.vip2_price + '</div>';
  344 + }else{
  345 + newPriceHtml += '<div>-</div>';
  346 + }
  347 + return newPriceHtml;
  348 + }},
  349 + {display: '银卡价', render: function(item) {
380 var newPrice = item.newProductPriceBo, 350 var newPrice = item.newProductPriceBo,
381 - newPriceHtml = newPrice.vip1_price;  
382 -  
383 - if (newPrice.vip1_price < (newPrice.retail_price / 2)) {  
384 - newPriceHtml = '<p style="color: red">' + newPrice.vip1_price + '</p>'; 351 + newPriceHtml = '';
  352 + if (newPrice.vip1_price){
  353 + if (newPrice.vip1_price < (newPrice.retail_price / 2)) {
  354 + newPriceHtml = '<p style="color: red">' + newPrice.vip1_price + '</p>';
  355 + }else{
  356 + newPriceHtml = '<p>'+newPrice.vip1_price+'</p>';
  357 + }
  358 + }else{
  359 + newPriceHtml = '<p>-</p>'
  360 + }
  361 + if(item.oldProductPriceBo.vip1_price){
  362 + newPriceHtml += '<div style="color: #999;">' + item.oldProductPriceBo.vip1_price + '</div>';
  363 + }else{
  364 + newPriceHtml += '<div>-</div>';
385 } 365 }
  366 + return newPriceHtml;
  367 + }},
  368 + {display: '操作', render: function(item) {
  369 + return '<a class="btn btn-danger btn-xs deleteImport" data-index="' + item.__index + '" href="javascript:;">删除</a>';
  370 + }}
  371 + ]
  372 +});
386 373
387 - return newPriceHtml + '<p style="color: #ccc;">' + item.oldProductPriceBo.vip2_price + '</p>';  
388 - }  
389 - }, {  
390 - display: '操作',  
391 - render: function(item) {  
392 - return '<a class="btn btn-info delete-btn" data-index="' + item.__index + '" href="javascript:;">删除</a>'; 374 +common.edit.ajaxfileupload("#priceChangeUpload", {
  375 + params: {
  376 + type: "price",
  377 + __type: "batch-import"
  378 + },
  379 + onStart: function() {
  380 + loadModal = common.dialog.load();
  381 + clearImportResult()
  382 + },
  383 + onComplete: function(response) {
  384 + console.log("批量接口返回数据",response);
  385 + if (loadModal) loadModal.close();
  386 +
  387 + if(response.code == 200){
  388 + if(response.data.failFileReason && response.data.failFileReason.length > 0){
  389 + showImportMessage(response.data.failFileReason.join('<br/>'), "error");
  390 + }else {
  391 + showImportMessage("批量导入全部成功!", "success");
  392 + }
  393 + if(response.data.successList && response.data.successList.length > 0){
  394 + showImportTable(response.data);
  395 + }
  396 + }else{
  397 + showImportMessage(response.message, "error");
  398 + common.util.__tip(response.message);
393 } 399 }
394 - }] 400 + }
395 }); 401 });
396 402
397 -//全部删除按钮  
398 -$('#delete-all').on('click', function() {  
399 - $('#priceTable').empty();  
400 - $error.empty();  
401 - successList.length = 0;  
402 -})  
403 -  
404 -  
405 -//批量变价列表单个删除  
406 -$('#priceTable').on('click', '.delete-btn', function() {  
407 - //var index = p.rows[$(this).data('index')];  
408 - successList.splice($(this).data('index'), 1);  
409 - p.reload();  
410 - // console.log(p.rows); 403 +//显示批量导入结果
  404 +function showImportMessage(message, statue){
  405 + $("#priceChangeImportMessage").removeAttr("class").addClass(statue).show();
  406 + $("#detailMassage").html(message);
  407 +}
  408 +//显示批量导入数据表
  409 +function showImportTable(data){
  410 + importPriceChangeData = data.successList;
  411 +
  412 + p.init(importPriceChangeData);
  413 + $("#priceChangeImportResultSet").show();
  414 + $("#priceChangeImportResult").show();
  415 + new common.edit("#priceChangeImportResultSet").init();
  416 +}
  417 +//清除批量导入结果及列表
  418 +function clearImportResult(){
  419 + $("#detailMassage").empty();
  420 + $("#importResultTable").empty();
  421 + $("#priceChangeImportResultSet input").val('');
  422 +
  423 + $('#download-btn').hide();
  424 + $("#priceChangeImportMessage").hide();
  425 + $("#priceChangeImportResultSet").hide();
  426 + $("#priceChangeImportResult").hide();
  427 +}
411 428
  429 +//全部删除
  430 +$(document).on('click', '#deleteAllImport', function () {
  431 + common.dialog.confirm(
  432 + '删除确认提示',
  433 + '你确定<b><font color="#ff0000">全部删除</font></b>已成功导入的变价么?',
  434 + function () {
  435 + importPriceChangeData.length = 0;
  436 + p.reload();
  437 + }
  438 + );
412 }); 439 });
413 -  
414 -  
415 -//确定变价  
416 -var path = ''; //确定变价后返回的excel名  
417 -$('#sure-change').on('click', function() {  
418 - var arr = [],  
419 - data = '';  
420 -  
421 - if (!successList || successList.length == 0) {  
422 - alert('请上传批量变价文件');  
423 - return; 440 +//单个删除
  441 +$(document).on('click', '.deleteImport', function () {
  442 + common.dialog.confirm(
  443 + '删除确认提示',
  444 + '你确定<b><font color="#ff0000">删除</font></b>该变价么?',
  445 + function () {
  446 + var index = $(this).data("index");
  447 + if(importPriceChangeData){
  448 + [].splice.call(importPriceChangeData,index,1);
  449 + p.reload();
  450 + }
  451 + }
  452 + );
  453 +});
  454 +//确定提交批量
  455 +$(document).on('click', '.btn-submit-priceChange', function () {
  456 + if(importPriceChangeData.length < 1){
  457 + common.util.__tip("没有可提交的变价,请重新导入!");
  458 + return false;
424 } 459 }
425 - console.log(successList);  
426 - $.each(successList, function(i, value) {  
427 - arr.push(value.newProductPriceBo);  
428 - });  
429 -  
430 - // var count=Math.ceil(arr.length/200);  
431 - // for(var i=0;i<count;i++){  
432 - // item=arr.slice(i*200,(i+1)*200);  
433 - // }  
434 - // while(item=arr.slice(2,4)){  
435 -  
436 - // }  
437 -  
438 - data = JSON.stringify(arr);  
439 - console.log(data);  
440 - common.util.__ajax({  
441 - url: '/product/batchUpdateProductPrice',  
442 - data: {  
443 - batchList: data,  
444 - shop_id: common.util.__input("shopId") 460 + common.dialog.confirm(
  461 + '提交确认提示',
  462 + '你确定<b><font color="#449d44">提交并保存</font></b>成功导入的变价么?',
  463 + function () {
  464 + var arr = [];
  465 + $.each(importPriceChangeData, function(i, value) {
  466 + arr.push(value.newProductPriceBo);
  467 + });
  468 + common.util.__ajax({
  469 + url: '/product/batchUpdateProductPrice',
  470 + data: {
  471 + batchList: JSON.stringify(arr),
  472 + cgpriceStartTime:$('#importStartDate').val(),
  473 + cgpriceEndTime:$('#importEndDate').val()
  474 + }
  475 + }, function(res) {
  476 + path = res.data;
  477 + importPriceChangeData.length = 0;
  478 + clearImportResult();
  479 + if(path && path != ''){
  480 + $('#download-btn').show();
  481 + }
  482 + });
445 } 483 }
446 - }, function(res) {  
447 - $('#priceTable').hide();  
448 - $('.success-wrap').show();  
449 - path = res.data;  
450 - successList.length = 0;  
451 - });  
452 - 484 + );
453 }); 485 });
454 -  
455 -$('#download-btn').on('click', function() { 486 +//下载导入结果
  487 +$(document).on('click', '#download-btn', function() {
456 location.href = '/ajax/download?path=' + path; 488 location.href = '/ajax/download?path=' + path;
  489 +});
  490 +//返回列表
  491 +$(document).on('click', '#return-btn', function () {
  492 + if(path == ''){
  493 + $('.bulk-import').hide();
  494 + $('#basicTable').show();
  495 + $('#priceChangeSearch').show();
  496 + }else{
  497 + location.href = '';
  498 + }
457 }); 499 });
@@ -19,5 +19,6 @@ @@ -19,5 +19,6 @@
19 @import "module/template"; 19 @import "module/template";
20 @import "module/shop-pc"; 20 @import "module/shop-pc";
21 @import "module/shop-app"; 21 @import "module/shop-app";
  22 +@import "module/priceChange";
22 @import "module/base"; 23 @import "module/base";
23 @import "module/shopsReport"; 24 @import "module/shopsReport";
  1 +/*********************代销变价*******************/
  2 +#priceChange_import{
  3 + font-family: "Microsoft YaHei";
  4 +}
  5 +
  6 +#priceChangeImportMessage{
  7 + display: none;
  8 + margin-top: 10px;
  9 + font-size: 18px;
  10 + font-weight: bold;
  11 + padding: 5px 10px;
  12 + background: #ccc;
  13 + color: #ffffff;
  14 +}
  15 +#priceChangeImportMessage b, #priceChangeImportMessage span{
  16 + display: block;
  17 + float: left;
  18 +}
  19 +
  20 +#priceChange_import .success{
  21 + background:#449d44;
  22 +}
  23 +
  24 +#priceChange_import .error{
  25 + background:#ff0000;
  26 +}
  27 +
  28 +#priceChange_import select.error{
  29 + border: 2px solid #ff0000;
  30 + background: none;
  31 +}
  32 +
  33 +#priceChange_import .title{
  34 + padding: 5px 10px;
  35 + background: #5bc0de;
  36 + height: auto;
  37 + text-align: left;
  38 + border:1px solid #46b8da;
  39 + color: #FFFFFF;
  40 + font-size: 14px;
  41 +}
  42 +
  43 +#priceChange_import .title span{
  44 + display: block;
  45 + float: left;
  46 + line-height: 27px;
  47 + font-size: 15px;
  48 +}
  49 +
  50 +#priceChange_import .title a.btn{
  51 + float: right;
  52 + margin-right: 10px;
  53 +}
  54 +
  55 +#priceChangeImportResult, #priceChangeImportResultSet{
  56 + display: none;
  57 + margin-top: 10px;
  58 +}
  59 +
  60 +#priceChangeImportResultSet .form-inline{
  61 + margin: 10px 0 0;
  62 + padding: 0 20px;
  63 +}