split_order.html
8.38 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
<include file="public/layout" />
<style type="text/css">
html, body {
overflow: visible;
}
a.btn {
background: #fff none repeat scroll 0 0;
border: 1px solid #f5f5f5;
border-radius: 4px;
color: #999;
cursor: pointer !important;
display: inline-block;
font-size: 12px;
font-weight: normal;
height: 20px;
letter-spacing: normal;
line-height: 20px;
margin: 0 5px 0 0;
padding: 1px 6px;
vertical-align: top;
}
a.red:hover {
background-color: #e84c3d;
border-color: #c1392b;
color: #fff;
}
</style>
<body style="background-color: #FFF; overflow: auto;">
<div id="toolTipLayer" style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page">
<div class="fixed-bar">
<div class="item-title"><a class="back" href="javascript:history.back();" title="返回列表"><i class="fa fa-arrow-circle-o-left"></i></a>
<div class="subject">
<h3>订单拆分</h3>
<h5>分批发货的订单可拆分</h5>
</div>
</div>
</div>
<form class="form-horizontal" action="{:U('Admin/Order/split_order')}" id="split_order" method="post">
<div class="ncap-form-default">
<dl class="row">
<dt class="tit">
<label>费用信息</label>
</dt>
<dd class="opt"><input type="hidden" name="order_id" value="{$order.order_id}">
<strong>{$order.total_amount}</strong>(商品总价:{$order.goods_price} 运费:{$order.shipping_price})
<span class="err"></span>
<p class="notic">订单总额=商品总价+运费 </p>
</dd>
</dl>
<dl class="row">
<dt class="tit">
<label>收货人</label>
</dt>
<dd class="opt">
{$order.consignee}
</dd>
</dl>
<dl class="row">
<dt class="tit">
<label>手机</label>
</dt>
<dd class="opt" style="width:50%">
{$order.mobile}
<p class="notic">温馨提示:原单商品不可全部移除 </p>
</dd>
<dd style="float:right ; width:25% !important;">
<a class='ncap-btn-big ncap-btn-gray' style="margin-right:5px" href='javascript:void(0);' onclick='window.location.reload();'><i class='fa fa-repeat'></i>重置</a>
<a class='ncap-btn-big ncap-btn-green' href='javascript:void(0);' onclick='add_split()'><i class='fa fa-cut'></i>添加拆单</a>
</dd>
<div class="clear"></div>
</dl>
<dl class="row">
<dt class="tit">
<label for="invoice_title">原单商品列表</label>
</dt>
<dd class="opt" id="origin" style="width:70%;">
<div class="ncap-order-details" id="goods_list_div">
<div class="hDivBox" id="ajax_return" >
<table cellspacing="0" cellpadding="0" style="border:0px">
<thead>
<tr>
<!--<th class="sign" axis="col0">
<div style="width: 24px;"><i class="ico-check"></i></div>
</th>-->
<th align="left" abbr="order_sn" axis="col3" class="w500">
<div style="text-align: left; " class="">商品名称</div>
</th>
<th align="left" abbr="consignee" axis="col4" class="w100">
<div style="text-align: left; " class="">规格</div>
</th>
<th align="left" abbr="consignee" axis="col4" class="w100">
<div style="text-align: left; " class="">原购数</div>
</th>
<th align="center" abbr="article_show" axis="col5" class="w100">
<div style="text-align: center; " class="">数量</div>
</th>
<th align="center" abbr="article_time" axis="col6" class="w200">
<div style="text-align: center; " class="">操作</div>
</th>
<!--<th style="width:100%" axis="col7">
<div></div>
</th>-->
</tr>
</thead>
<tbody>
<foreach name="orderGoods" item="vo">
<tr>
<!--<td class="sign" axis="col0">
<div style="width: 24px;"><i class="ico-check"></i></div>
</td>-->
<td align="left" abbr="goods_name" axis="col3" class="w500">
<div style="text-align: left; " class="">{$vo.goods_name}</div>
</td>
<td align="left" abbr="spec_key_name" axis="col4" class="w100">
<div style="text-align: left; " class="">{$vo.spec_key_name}</div>
</td>
<td align="left" abbr="goods_price" axis="col4" class="w100">
<div style="text-align: left;" class="">{$vo.goods_price}</div>
</td>
<td align="center" abbr="article_show" axis="col5" class="w100">
<div style="text-align: center; " class="">
<input type="text" class="input-txt" style="width:60px !important;text-align:center" name="old_goods[{$vo.rec_id}]" rel="{$vo.rec_id}" value="{$vo.goods_num}" onkeyup="this.value=this.value.replace(/[^\d.]/g,'')" onpaste="this.value=this.value.replace(/[^\d.]/g,'')">
</div>
</td>
<td align="center" abbr="article_time" axis="col6" class="w100">
<div style="text-align: center; " class="">
<a class="btn red" href="javascript:void(0);" onclick="javascript:$(this).parent().parent().parent().remove();"><i class="fa fa-trash-o"></i>删除</a>
</div>
</td>
<!--<td style="width:100%" axis="col7">
<div></div>
</td>-->
</tr>
</foreach>
</tbody>
</table>
</div>
</div>
</dd>
<dd style="float:right ; width:5% !important;">
</dd>
</dl>
<dl class="row" id="last_tr">
<dt class="tit">管理员备注</dt>
<dd class="opt">
<textarea class="tarea" style="width:440px; height:150px;" name="admin_note" id="admin_note">{$order.admin_note|htmlspecialchars_decode}</textarea>
<span class="err"></span>
<p class="notic"></p>
</dd>
</dl>
<div class="bot"><a href="JavaScript:void(0);" onClick="checkSubmit()" class="ncap-btn-big ncap-btn-green" id="submitBtn">保存</a></div>
</div>
</form>
</div>
<script type="text/javascript">
var no = 1;
$(function(){
add_split();
});
function add_split(){
var new_order = '';
new_order += "<dl id='new_"+no+"' class='new_split row'><dt class='tit'>新单商品列表</dt><dd class='opt' style='width:70%;'>";
new_order += $('#origin').html();
new_order += "</dt><dd class='opt' style='float:right ; width:10% !important;'><a class='ncap-btn-big ncap-btn-red' href='javascript:void(0);' onclick='javascript:$(this).parent().parent().remove();'><i class='fa fa-trash-o'></i>删除</a></dd></dl>";
$('#last_tr').before(new_order);
$('#new_'+no+' .input-txt').each(function(i,o){
var name = $(this).attr('name');
$(this).attr('name',no+'_'+name);
});
no++;
}
var b = {$goods_num_arr};
function checkSubmit(){
layer.msg('加载中...', {icon: 16,shade: [0.5, '#f5f5f5'],scrollbar: false,offset: '10px', time:100000}) ;
var a = [],g = [];
$('input[name*=old_goods]').each(function(i,o){
var rec_id = $(o).attr('rel');
if(!a[rec_id]){
a[rec_id] = 0;
}
a[rec_id] = a[rec_id] + parseInt($(o).val());
});
$('#origin .input-txt').each(function(){
g.push($(this).val());
});
if($('.new_split').length == 0){
layer.alert("请至少拆分一单", {icon: 2});
return false;
}
if(g.length == 0){
layer.alert('原单商品不可全部移除', {icon: 2});
return false;
}
for(var k in b){
if(a[k] > parseInt(b[k]['goods_num'])){
var lt = a[k] - parseInt(b[k]['goods_num']);
layer.alert(b[k]['goods_name']+',数量大于原商单购买数'+lt+'件', {icon: 2});
return false;
}
if(a[k] < parseInt(b[k]['goods_num'])){
var lt = parseInt(b[k]['goods_num']) - a[k];
layer.alert(b[k]['goods_name']+',数量少于原商单购买数'+lt+'件', {icon: 2});
return false;
}
}
$('#split_order').submit();
}
</script>
</body>
</html>