yohoCoin.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
122
123
124
125
126
127
128
129
130
131
132
133
134
//yoho币
'use strict';
var $ = require('jquery'),
common=require('../common/common');
var ENUM = {
gender: {
1: '男',
2: '女',
3: '通用'
},
status: {
1: '<font color="#428bca">待审核</font>',
2: '<font color="#5cb85c">通过</font>',
3: '<font color="#d9534f">驳回</font>'
}
}
/*
var g = new common.grid({
el: "#yohoCoin_table1",
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"),
gender: common.util.__input("gender")
};
},
columns: [{
display: 'SKN',
name: 'product_skn'
}, {
display: '商品信息',
name: 'info',
render: function(item) {
return '<div>名称:' + item.product_name + '</div>' +
'<div>品牌:' + item.brand_name + '</div>' +
'<div>类目:' + item.middle_sort_name + '<b> ></b> ' + item.small_sort_name + '</div>';
}
}, {
display: '供应商 / 店铺',
name: 'supplier_name',
render: function(item) {
var html = '';
if (item.supplier_name) {
html += item.supplier_name;
}
if (item.shop_name) {
html += '/' + item.shop_name;
}
return html;
}
}, {
display: '性别',
name: 'gender',
render: function(item) {
return ENUM.gender[item.gender];
}
}, {
display: '吊牌价',
name: 'retail_price'
}, {
display: '销售价',
name: 'sales_price'
}, {
display: '返币金额',
name: 'return_coin'
}, {
display: '状态',
name: 'status',
render: function(item) {
return ENUM.status[item.status];
}
},{
display: '操作信息',
name: 'operateInfo',
render: function(item) {
var html = '';
if (item.founder_name) {
html += '<div>' + item.founder_name + '</div>';
}
if (item.updateTime) {
html += '<div>' + item.updateTime + '</div>';
}
return html;
}
}, {
display: '操作',
render: function(item) {
return '<a href="javascript:;" class="btn btn-info btn-xs btn-modify" data-skn="' + item.product_skn + '">修改</a>'
}
}]
});
*/
var g = new common.grid({
el: "#yohoCoin_table",
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"),
gender: common.util.__input("gender")
};
},
columns: [{
display: '',
render: function(item){
var html = "";
if(item.__index == 0){
$("#yohoCoin_table").find("thead tr th").html($("#coinListHead").html());
}
item.genderName = ENUM.gender[item.gender];
html += common.util.__template2($("#coinList").html(),item);
return html;
}
}]
});
g.init($("#gridurl").val());
$(document).on('click', '.btn-modify', function() {
if($(this).hasClass("openEditor")){
$(this).text("修改").removeClass("openEditor");
$(this).parents(".dataForShow").find(".dataForEditor td").hide();
}else{
$(this).text("收起").addClass("openEditor");
$(this).parents(".dataForShow").find(".dataForEditor td").show();
}
});