netsale-edit.js
3.74 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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
'use strict';
var $ = require('jquery'),
common = require('../common/common');
require('../util/custom.js');
/*
* 获取业务数据
*/
window.NETSALEDATA = require('./partials/data.js');
window.GOLABDATA = {
on: function(key, callback) {
var that = this;
if (!that.registerEvent) {
that.registerEvent = {};
}
if (!that.registerEvent[key]) {
that.registerEvent[key] = [];
}
if (that.registerEvent[key].indexOf(callback) == -1) {
that.registerEvent[key].push(callback);
}
},
fire: function(key) {
var that = this;
if (!this.registerEvent) return;
if (key) {
if (!this.registerEvent[key]) return;
var listeners = that.registerEvent[key];
var args = [].slice.call(arguments, 1);
for (var i in listeners) {
return listeners[i].apply(this, args);
}
} else {
var map = {},
args = [].slice.call(arguments, 1);
for (var key in that.registerEvent) {
var listeners = that.registerEvent[key];
for (var i in listeners) {
map[key] = listeners[i].apply(this, args);
}
}
return map;
}
}
};
//获取skn
if (NETSALEDATA && NETSALEDATA.baseProductInfo && NETSALEDATA.baseProductInfo.baseProduct) {
$('#productSkn').val(NETSALEDATA.baseProductInfo.baseProduct.productSkn);
} else {
common.util.__tip("SKN不存在");
}
console.log(NETSALEDATA);
/*加载其他模块*/
require('./partials/basic-info');
require('./partials/editor_recommend');
require('./partials/model');
require('./partials/video.js');
require('./partials/brand-relation');
require('./partials/add-info');
require('./partials/netsale-ty.js');
if ($('.contentpanel').data('type') == 'info') {
$('.contentpanel').find('input').prop('disabled', true);
$('.contentpanel').find('.btn').addClass('disabled');
$('.panel-footer').remove();
$('#saveAllInfo').hide();
// 上架审核的查看页面
if ($('.contentpanel').data('action') != 'audit') {
$('#passBtn').hide();
$('#rejectBtn').hide();
}
} else {
$('#backBtn').hide();
$('#passBtn').hide();
$('#rejectBtn').hide();
}
var e = new common.edit('#netsaleAllInfo');
$(document).on("click", "#saveAllInfo", function() {
var data = {};
$.each(GOLABDATA.fire(), function(key, value) {
if (typeof value == 'string') {
data = value;
return;
}
$.extend(data, value, true);
});
/*common.util.__ajax({
url: '/goods/product/saveNetSaleAllInfo',
data: data
}, function(res) {
});*/
e.submit('/goods/product/saveNetSaleAllInfo', function(option) {
option.data = data;
option.success = function(res) {
res = res.data;
if (res.code == '200') {
e.$tip(res.message, function() {
location.href = '/goods/netsale/index';
}, 'growl-success');
} else {
e.$tip(res.message);
}
return false;
}
})
})
var Bll = {
toast: function(content, fn) {
common.dialog.confirm("温馨提示", content, function() {
common.util.__ajax({
url: '/supplier/baseproduct/auditReject',
data: fn()
}, function() {
//g.reload();
//loadTab();
history.go(-1);
});
});
}
}
// 单个驳回
$(document).on("click", "#rejectBtn", function() {
//auditOperation([],3,)
var data = function() {
var reason = $('#reason').val();
if (reason === '' || $.trim(reason) === '') {
return "请填写驳回原因";
}
return {
productSknList: JSON.stringify([NETSALEDATA.baseProductInfo.baseProduct.productSkn]),
targetStatus: 3, // 驳回
rejectReason: reason
};
}
Bll.toast($("#template").html(), data);
});
// 单个通过
$(document).on("click", "#passBtn", function() {
//auditOperation([],3,)
var data = function() {
return {
productSknList: JSON.stringify([NETSALEDATA.baseProductInfo.baseProduct.productSkn]),
targetStatus: 4, //通过
rejectReason: ""
};
}
Bll.toast("确定要通过该申请吗?", data);
});