Index.js
3.69 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
/**
* Created by yoho on 2016/6/28.
*/
/**
* Created by wangqianjun on 16/4/12.
*/
'use strict';
var $ = require('jquery');
var common = require('../../../common/common');
var Bll = {
Status: ["是", "否"],
toast: function (hint, url, data) {
common.dialog.confirm("警告",
hint,
function () {
common.util.__ajax({
url: url,
data: data
}, function () {
g.reload();
}, true);
});
}
};
/*下拉选择*/
new common.dropDown({
el: "#brandId",
ajax: "codGetBrandList"
});
new common.dropDown({
el: "#productSkn",
ajax: "queryRefundExchangeProductSkn"
});
new common.dropDown({
el: "#isPayDelivery"
});
var g = new common.grid({
el: '#basicTable',
parms: function () {
return {
brandId: common.util.__input("brandId"),
isRefundExchange: common.util.__input("isRefundExchange"),
productSkn: common.util.__input("productSkn")
};
},
columns: [
{
display: 'SKN',
name: 'productSkn'
}, {
display: '品牌',
name: 'brandName'
},
{
display: "是否特殊商品",
render: function (item) {
var html = [];
html.push("<p>" + Bll.Status[item.isRefundExchange] + "</p>");
return html.join('');
}
},
{
display: "操作",
render: function (item) {
var html = [];
if (item.sortIsRefundExchange == -1) {
if (item.isRefundExchange == 0) {//普通商品
html.push('<a data-index="' + item.__index + '" href="JavaScript:;" class="btn operation btn-danger btn-xs edit-class-btn" id="btn-item-close" data-type="close">关闭</a>');
} else {//特殊商品
html.push('<a data-index="' + item.__index + '" href="JavaScript:;" class="btn operation btn-success btn-xs edit-class-btn" id="btn-item-open" data-type="open">开启</a>');
}
} else {
if (item.isRefundExchange == 0) {//普通商品
html.push('<a data-index="' + item.__index + '" disabled href="JavaScript:;" class="btn operation btn-danger btn-xs edit-class-btn" id="btn-item-close" data-type="close">关闭</a>');
} else {//特殊商品
html.push('<a data-index="' + item.__index + '" disabled href="JavaScript:;" class="btn operation btn-success btn-xs edit-class-btn" id="btn-item-open" data-type="open">开启</a>');
}
}
return html.join('');
}
}
]
});
g.init('/refundExchangeAttribute/queryRefundExchangeList');
// 筛选
$(document).on('click', "#filter-btn", function () {
g.reload(1);
});
//开启
$(document).on('click', "#btn-item-open", function () {
var item = g.rows[$(this).data("index")];
item = {
productSkn: item.productSkn,
isRefundExchange: 0
};
Bll.toast("确认开启吗?", "/refundExchangeAttribute/modifyRefundExchangeStatus", item);
});
//关闭
$(document).on('click', "#btn-item-close", function () {
var item = g.rows[$(this).data("index")];
item = {
productSkn: item.productSkn,
isRefundExchange: 1
};
Bll.toast("确认关闭吗?", "/refundExchangeAttribute/modifyRefundExchangeStatus", item);
});
$('#export-btn').on('click', function () {
window.open("/ajax/down?queryConf=" + JSON.stringify(g.options.parms()) + "&type=productRefundExchangeExport");
});