price.js
3.73 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
'use strict';
var $ = require('jquery'),
common=require('../common/common');
var ENUM={
vipType:{1:'正常折扣',2:'统一折扣',3:'无折扣',4:'固定折扣',5:'自定义折扣'}
}
exports.init = function() {
new common.dropDown({
el:'#shop',
ajax:'queryShop'
});
new common.dropDown({
el:'#supplier',
ajax:'querySupplier'
});
new common.dropDown({
el:'#brand',
ajax:'queryBrand'
});
new common.dropDown({
el:'#cate',
ajax:'maxSort'
});
new common.dropDown({el:"#jit"});
new common.dropDown({el:"#status"});
new common.dropDown({el:"#stock"});
new common.dropDown({el:"#sex"});
var g = new common.grid({
el:"#basicTable",
parms:function(){
return {
product_skn: common.util.__input("skn"),
shop_id:common.util.__input("shop"),
brand_id:common.util.__input("brand"),
supplier_id:common.util.__input("supplier"),
is_jit:common.util.__input("jit"),
is_auditing:common.util.__input("status"),
stock:common.util.__input("stock"),
gender:common.util.__input("sex"),
max_sort_id:common.util.__input("cate")
};
},
columns:[
{display: 'SKN', name: 'product_skn'},
{display: '商品信息', name:'info', render: function(item) {
return '<p>名称:' + item.product_name + '</p><p>品牌:' + item.brand_name + '</p><p>类目:' + item.middle_sort_name + '/' + item.small_sort_name + '</p>';
}},
{display: '供应商/店铺', name: 'supplier_name'},
{display: '性别', name: 'gender', render: function(item) {
}},
{display: '吊牌价', name: 'retail_price'},
{display: '销售价', name: 'sales_price'},
{display: 'VIP折扣类型', name: 'vip_discount_type', render: function(item) {
return ENUM.vipType[item.vip_discount_type];
}},
{display: 'VIP价', name: 'vip_price'},
{display: '自定义白金', name: 'vip3_price'},
{display: '自定义金卡', name: 'vip2_price'},
{display: '自定义银卡', name: 'vip1_price'},
{display: '返币金额', name: 'return_coin'},
{display: '操作信息', name: 'operateInfo', render: function(item) {
var html = '';
if (item.founder_name) {
html += '<p>' + item.founder_name + '</p>';
}
if (item.updateTime) {
html += '<p>' + item.updateTime + '</p>';
}
return html;
}},
{display: '操作', render:function(item){
return '<a href="javascript:;" class="btn btn-info btn-xs modify-btn" data-skn="' + item.product_skn + '">修改</a>'
}}
]
});
g.init($("#gridurl").val());
$('#basicTable').on('click', '.modify-btn', function() {
var skn = $(this).data('skn'),
that = this;
if ($(that).data('detail')) {
$(that).parents('tr').siblings('.product-detail').toggle();
return;
}
$.ajax({
type: 'POST',
url: '/product/getPrice',
dataType: 'json',
data: {
param: skn
}
}).then(function(res) {
var data = res.data.data;
/*console.log(data);
var tr = '<tr class="product-detail"><td colspan="15">'+
'<form><table></table></form></td></tr>';
$(that).data('detail', true).parents('tr').after($(tr));*/
});
});
$("#filter-btn").click(function(){
location.hash = '';
g.reload({
page: 1
});
});
}