model.js
3.92 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
'use strict';
var $ = require('jquery'),
common = require('../../../common/common');
new common.dropDown({
el: '#select—model',
ajax: 'queryModelListForSelect',
hash: true
});
new common.dropDown({
el: '#select—size',
ajax: 'queryProdSizeListForSel',
hash: true,
params:function(){
return{productSkn:NETSALEDATA.baseProductInfo.baseProduct.productSkn}
}
});
var modelCardTable = new common.grid({
el: "#model-card",
hash: false,
columns: [{
display: '模特',
name: 'modelName'
}, {
display: '尺码',
name: 'size'
}, {
display: '模特卡',
render: function(item) {
return '<img src="' + item.modelImg + '"/>';
}
},{
display: '操作',
render: function(item) {
return '<a href="JavaScript:;" class="btn btn-info btn-xs info-btn" id="btn-model-del" data-index="' + item.__index + '">删除</a>'
}
}]
});
modelCardTable.init(NETSALEDATA.modelcardList);
$(document).on('click', '#btn-model-add', function () {
modelCardTable.init(NETSALEDATA.modelcardList);
var productSkn = NETSALEDATA.baseProductInfo.baseProduct.productSkn;
var modelCardId = $("#select—model").val();
var size = $("#select—size").val();
if(modelCardId==-1){
common.util.__tip("模特姓名不能为空");
return false;
}
if(size==-1){
common.util.__tip("商品尺寸不能为空");
return false;
}
common.util.__ajax({
url: '/goods/product/addproductModelCard',
data: {
productSkn:productSkn,
modelCardId:modelCardId,
size:size
}
}, function (res) {
if(res.code==200){
NETSALEDATA.modelcardList = res.data;
modelCardTable.init(res.data);
}
});
});
$(document).on('click', '#btn-model-del', function () {
modelCardTable.init(NETSALEDATA.modelcardList);
var item = modelCardTable.rows[$(this).data("index")];
var productSkn = NETSALEDATA.baseProductInfo.baseProduct.productSkn;
common.util.__ajax({
url: '/goods/product/delproductModelCard',
data: {
productSkn:productSkn,
modelCardId:item.modelcardId,
size:item.size
}
}, function (res) {
if(res.code==200){
NETSALEDATA.modelcardList = res.data;
modelCardTable.init(res.data);
}
});
});
var modelTryTable = new common.grid({
el: "#model-try",
hash: false,
columns: [{
display: '',
type: 'checkbox'
},{
display: '模特',
name: 'modelName'
}, {
display: '身高/体重',
render: function(item) {
return item.height + 'cm/' + item.weight + 'kg';
}
}, {
display: '三围',
name: 'vitalStatistics',
render: function(item) {
return item.vitalStatistics + 'cm';
}
}, {
display: '试穿尺码',
render: function(item) {
return item.fitModelBo.fit_size;
}
}, {
display: '试穿描述',
render: function(item) {
return item.fitModelBo.feel;
}
}, {
display: '备注',
render: function(item) {
return item.fitModelBo.fit_remark;
}
}]
});
// $(".wqt_checkbox").each(function(){
// this.checked="checked";
// });
// setTimeout(function(){$(".wqt_all").attr("checked",'checked');},2000)
modelTryTable.init(NETSALEDATA.modelTryList);
var modelTryList = NETSALEDATA.modelTryList;
for(var i=0;i<modelTryList.length;i++){
if(modelTryList[i].fitModelBo.is_show==1){
$(".wqt_checkbox").eq(i).prop("checked", true);
}
}
$(document).on('click', '#modelTry-save', function () {
// modelTryTable.init(NETSALEDATA.modelTryList);
var productSkn = NETSALEDATA.baseProductInfo.baseProduct.productSkn;
var erpFitModel = [];
$(".wqt_checkbox").each(function(i,val){
erpFitModel[i] = NETSALEDATA.modelTryList[i].fitModelBo;
if(val.checked==false){
erpFitModel[i].is_show=0;
}else{
erpFitModel[i].is_show=1;
}
});
common.util.__ajax({
url: '/meterManage/tryModel/addtryModelInfo',
data: {
productSkn:productSkn,
erpFitModel:JSON.stringify(erpFitModel)
}
}, function (res) {
if(res.code==200){
}
});
});