goods.studentPrice.Index.js
4.46 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
webpackJsonp([55],[
/* 0 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(1),
common = __webpack_require__(2);
/***********************变价列表***********************/
new common.dropDown({
el: '#shop',
ajax: 'shopsRest'
});
new common.dropDown({
el: '#brand',
ajax: 'brand',
params:function(){
return {userLimitFlag:true};
}
});
var ENUM = {
gender: {
1: '男',
2: '女',
3: '通用'
},
vipType: {
1: '正常折扣',
2: '统一折扣',
3: '无折扣',
4: '固定折扣',
5: '自定义折扣'
}
};
// 对float数字进行精度控制,保留小数点后4位
// 暂只支持字符串
var formatFloat = function(num) {
var number = parseFloat(num);
if (isNaN(number))
return "";
return Math.round(number * 10000) / 10000;
}
var tabTree = new common.tabTree("#sortTree");
tabTree.init();
var g = new common.grid({
el: "#basicTable",
usepagesize:true,
parms: function() {
var studentPriceValScope = $("#studentPriceValScope").val();
return {
product_skn: common.util.__input("skn"),
max_sort_id: tabTree.selected[0] ? tabTree.selected[0].id : "",
middle_sort_id: tabTree.selected[1] ? tabTree.selected[1].id : "",
small_sort_id: tabTree.selected[2] ? tabTree.selected[2].id : "",
shop_id: common.util.__input("shop"),
brand_id: common.util.__input("brand"),
studentPriceValScope: studentPriceValScope
}
},
columns: [
{display: '商品信息', render: function(item) {
var html = '<p>SKN:'+item.product_skn +'</p><p>名称:' + item.product_name + '</p><p>品牌:' + item.brand_name + '</p>' +
'<div>类目:'+'<br>'+ item.max_sort_name;
if(item.middle_sort_name) {html += ' > ' + item.middle_sort_name;}
if(item.small_sort_name) {html += ' > ' + item.small_sort_name;}
html += "</div><p>";
html += '<p>性别:'+ENUM.gender[item.gender]+'</p>';
return html;
}},
{display: '供应商/店铺', render: function(item) {
var html = '';
if (item.supplier_name) {
html += item.supplier_name;
if (item.shop_name) {html += '/';}
}
if (item.shop_name) {html += item.shop_name;}
return html;
}},
{display: '当前售价', render: function(item) {
var html = '<p>吊牌价:'+item.retail_price +'</p>';
html += '<p>销售价:'+item.sales_price +'</p>';
if (item.student_price) {html += '<p>学生价:'+item.student_price +'</p>';}
return html;
}},
{display: 'VIP折扣类型', render: function(item) {
return ENUM.vipType[item.vip_discount_type];
}},
{display: '会员价', render: function(item) {
var html = '<p>VIP价:';
if(item.vip_price) html += item.vip_price +'</p>';
else html += '</p>';
html += '<p>白金:'+'<br>';
if(item.vip3_price) html += item.vip3_price +'</p>';
else html += '</p>';
html += '<p>金卡:'+'<br>';
if(item.vip2_price) html += item.vip2_price +'</p>';
else html += '</p>';
html += '<p>银卡:'+'<br>';
if(item.vip1_price) html += item.vip1_price +'</p>';
else html += '</p>';
return html;
}}
]
});
g.init('/goods/studentPrice/list');
//筛选
$(document).on('click', '#filter-btn', function () {
g.reload(1);
});
//回车筛选
$(document).on('keyup', 'body', function (event) {
if (event.keyCode == 13) {
$("#filter-btn").trigger('click');
}
});
//全部
$(document).on('click', '#all-btn', function () {
location.href = '';
});
/***********************批量功能***********************/
//批量导入按钮点击事件
$(document).ready(function() {
$("#import-btn").attr('target', '_blank');
});
//$(document).on('click', '#import-btn', function () {
//location.href="/supplier/baseproduct/batchUpdateStudentPrice";
//});
/***/ }
]);