ground_detail.html
8.88 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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
<!--上架 - 详情页 - wwb-->
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<link rel="import" href="./detail_tpl.html" id="ground_detail_tpl"/>
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<link href="../../css/mui.min.css" rel="stylesheet" />
<link href="../../css/themes.css" rel="stylesheet" />
<link href="../../css/check.css" rel="stylesheet"/>
<link href="../../css/index_view.css" rel="stylesheet" />
</head>
<body>
<div class="mui-content detailRow">
<form class="mui-input-group" id="detailContent" style="background:none;">
<ul class="mui-table-view" style="margin-bottom:12px;">
<li class="mui-table-view-cell mui-collapse">
<a class="mui-navigate-right" href="#">产品信息</a>
<div class="mui-collapse-content">
</div>
</li>
</ul>
</form>
</div>
<script src="../../js/mui.min.js"></script>
<script src="../../js/jquery.min.js"></script>
<script src="../../js/template-web.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/utils.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/common.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/request.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
function clicked(){
common.openwin('../commonPages/qrcode',true,{ titleText: '扫码上架' })
}
var acceptoodsVo = [];//定义实际货位的列表集合
/*获取二维码返回值*/
function scaned(t, r, f) {
console.log(r);//返回二维码读取的数据
var list = acceptoodsVo;
if(r && Array.isArray(list) && list.length >0){
var locationCode = list.filter(function(item){
return item.positionName == r;
})[0];
if(locationCode){
mui.alert('扫描成功!','提示','确定',function (e) {
//jQuery(".realReceiveStore").val(locationCode.id);
document.getElementsByClassName('realReceiveStore')[0].value = locationCode.id;
},'div')
}else{
mui.alert('扫描的货位码不在实际货位码可选集合中,请重新扫描!','提示','确定',function (e) {},'div')
}
}
}
(function($,$$) {
var utils = new Utils();
utils.appendModule('#ground_detail_tpl');
function showData(data){
var html = template('detail_tpl', data);
document.getElementById('detailContent').innerHTML = html;
}
/* 过滤还有备选货位的数据 */
function filterDatas(datas,upFinishType){
var list = datas.list;
if(upFinishType != "1" && list.length && list.length > 0){//未上架
for(var i = 0,len = list.length;i<len;i++){
if(!list[i].upParentId){//指示货位
list[i].realNum = list[i].realReceiveQuantiry;
}
}
}
return datas;
}
$.plusReady(function(){
$.init({
beforeback: function() {
var list = plus.webview.currentWebview().opener();
mui.fire(list, 'pagefresh',{ selectTabs: details.selectTabs === 1 ? 0: 1, query: details.query });
return true;
}
})
var self = plus.webview.currentWebview();
var details = JSON.parse(self.details);//获得参数
var upParentId = details.upParentId;
console.log(JSON.stringify(details.selectTabs) );
var postData = {
distributeCode: details.distributeCode,
upFinishType: details.upFinishType,
id: details.id
};
var detailData = {};
var url = '/a/shelfInfo/shelfInfoList',
titleUrl = '/a/shelfInfo/shelfInfoTitle',
groundUrl = '/a/checkacceptdetail/finish';
plus.nativeUI.showWaiting('加载中...');
mui.ajaxRequest(titleUrl,{
type: 'POST',
data: { distributeCode: postData.distributeCode },
success: function(data){
console.log(JSON.stringify(data))
if(data.code === 200){
for(var key in data.data){
detailData[key] = data.data[key];
}
mui.ajaxRequest(url,{
type: 'POST',
data: postData,
success: function(data){
console.log(JSON.stringify(data))
plus.nativeUI.closeWaiting();
if(data.code === 200){
detailData.list = data.data.list;
if(data.data.list && data.data.list[0] && data.data.list[0].acceptoodsVo){
acceptoodsVo = data.data.list[0].acceptoodsVo;
}
console.log('detailData********************************')
var _detailData = filterDatas(detailData,details.upFinishType);
showData(_detailData);
if(details.upFinishType === '0'){
var groundBtn = '<button type="button" id="ground" class="mui-btn mui-btn-warning mui-btn-block" style="margin-bottom: 20px;" data-loading-text = "提交中" data-loading-icon-position="right">确认上架</button>'
document.querySelector('.detailRow').insertAdjacentHTML("beforeEnd",groundBtn);
}
}else{
mui.toast(data.msg,{ type: 'div' });
}
},
error: function(xhr,type,errorThrown){
console.log(xhr.responseText)
}
});
}else{
mui.toast(data.msg,{ type: 'div' });
}
},
error: function(xhr,type,errorThrown){
console.log(xhr.responseText)
}
})
// 上架
console.log(details.upFinishType)
if(details.upFinishType === '0'){
var ground = (document.querySelector('#ground'));
$('.detailRow').on('tap','#ground',function(e){
document.activeElement.blur(); // 隐藏软键盘
var edit = document.querySelectorAll('.goodsInfo');
var id = detailData.list[0].id;
if(edit[0] && edit.length > 0){
var detailListVo = [],submitData = {};
mui.each(edit,function(index,item){
var postData = {};
var $$input = $$(item).find('input.realNum'),realNum = 0;
if($$input[0]){
realNum = $$input.val()-0;
}
var realReceiveStore =item.querySelector('.realReceiveStore').value;
postData.id = id;
postData.realNum = realNum;
postData.productBatchNo = detailData.list[0].productBatchNo;
postData.realReceiveStore = realReceiveStore;
postData.upParentId = detailData.list[index].upParentId?detailData.list[index].upParentId:"";
detailListVo.push(postData);
});
submitData.detailListVo = detailListVo;
submitData.distributeCode = details.distributeCode;
console.log(submitData)
}
var btnArray = ['否', '是'];
mui.confirm('是否确认上架?', '操作提示', btnArray, function(e) {
if (e.index == 1) {
mui.ajaxRequest(groundUrl,{
type: 'POST',
data: submitData,
contentType: "application/json",
showWaiting: true,
success: function(data){
if(data.code === 200){
//mui.toast('上架成功',{ type: 'div' });
mui.alert(data.data);
var page = plus.webview.getWebviewById('ground_not_list');
mui.fire(page,'pagefresh',{ selectTab: '1' });
common.gotowin('acc_not_list',{ });
plus.webview.currentWebview().close();
}else{
mui.alert(data.msg)
}
},
error: function(xhr,type,errorThrown){
console.log(xhr.responseText)
}
});
}
},'div')
});
}
//绑定输入实际上架数验证
$$('#detailContent').on('keyup','.realNum',function(){
var _this = this,$$this = $$(this);
var id = _this.dataset.id,realReceiveQuantiry = _this.dataset.realreceivequantiry-0,oldValue = _this.dataset.oldvalue-0;
_this.value = _this.value.replace(/\D/g,'')-0;
var count = 0;
var eles = mui(".mui-input-row input[data-id='"+id+"']"),len = eles.length;
eles.each(function (e) {
count += this.value-0;
});
if(count > realReceiveQuantiry){
if(len == 2){
var text1 = "该药品存在“补货指示货位”和“备选上架货位”,两货位实际上架数量相加不能大于指示数量"+realReceiveQuantiry+"!";
mui.alert(text1,'提示','确定',function (e) {
_this.value = oldValue;
},'div')
}else{
var text1 = "实际上架数量不能大于指示数量"+realReceiveQuantiry+"!";
mui.alert(text1,'提示','确定',function (e) {
_this.value = oldValue;
},'div')
}
}
});
})
})(mui,jQuery);
</script>
</body>
</html>