ShowDd.php
13.1 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
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
<?php
define('EmpireCMSAdmin','1');
require("../../class/connect.php");
require("../../class/db_sql.php");
require("../../class/functions.php");
require("class/hShopSysFun.php");
$link=db_connect();
$empire=new mysqlquery();
$editor=1;
//驗證用戶
$lur=is_login();
$logininid=$lur['userid'];
$loginin=$lur['username'];
$loginrnd=$lur['rnd'];
$loginlevel=$lur['groupid'];
$loginadminstyleid=$lur['adminstyleid'];
//ehash
$ecms_hashur=hReturnEcmsHashStrAll();
//驗證權限
CheckLevel($logininid,$loginin,$classid,"shopdd");
$enews=ehtmlspecialchars($_GET['enews']);
$url="查看訂單";
$ddid=(int)$_GET['ddid'];
if(!$ddid)
{
printerror('ErrorUrl','');
}
$r=$empire->fetch1("select * from {$dbtbpre}enewsshopdd where ddid='$ddid'");
if(!$r['ddid'])
{
printerror('ErrorUrl','');
}
$addr=$empire->fetch1("select * from {$dbtbpre}enewsshopdd_add where ddid='$ddid'");
//提交者
if(empty($r[userid]))//非會員
{
$username="<font color=cccccc>遊客</font>";
}
else
{
$username="<a href='../member/AddMember.php?enews=EditMember&userid=".$r[userid].$ecms_hashur['ehref']."' target=_blank>".$r[username]."</a>";
}
//需要發票
$fp="否";
if($r[fp])
{
$fp="是";
}
//金額
$total=0;
if($r[payby]==1)
{
$pstotal=$r[pstotal]." 點";
$alltotal=$r[alltotalfen]." 點";
$total=$r[pstotal]+$r[alltotalfen];
$mytotal=$total." 點";
}
else
{
$pstotal=$r[pstotal]." 元";
$alltotal=$r[alltotal]." 元";
$total=$r[pstotal]+$r[alltotal]+$r[fptotal]-$r[pretotal];
$mytotal=$total." 元";
}
//支付方式
if($r[payby]==1)
{
$payfsname=$r[payfsname]."(積分購買)";
}
elseif($r[payby]==2)
{
$payfsname=$r[payfsname]."(餘額購買)";
}
else
{
$payfsname=$r[payfsname];
}
//狀態
if($r['checked']==1)
{
$ch="已確認";
}
elseif($r['checked']==2)
{
$ch="取消";
}
elseif($r['checked']==3)
{
$ch="退貨";
}
else
{
$ch="<font color=red>未確認</font>";
}
//發貨
if($r['outproduct']==1)
{
$ou="已發貨";
}
elseif($r['outproduct']==2)
{
$ou="備貨中";
}
else
{
$ou="<font color=red>未發貨</font>";
}
if($r['haveprice']==1)
{
$ha="已付款";
}
else
{
$ha="<font color=red>未付款</font>";
}
//顯示商品信息
function ShowBuyproduct($buycar,$payby){
global $empire,$dbtbpre;
$record="!";
$field="|";
$buycarr=explode($record,$buycar);
$bcount=count($buycarr);
$totalmoney=0;
$totalfen=0;
?>
<table width='100%' border=0 align=center cellpadding=3 cellspacing=1>
<tr class='header'>
<td width='9%' height=23> <div align=center>序號</div></td>
<td width='42%'> <div align=center>商品名稱</div></td>
<td width='15%'> <div align=center>單價</div></td>
<td width='10%'> <div align=center>數量</div></td>
<td width='19%'> <div align=center>小計</div></td>
</tr>
<?php
$j=0;
for($i=0;$i<$bcount-1;$i++)
{
$j++;
$pr=explode($field,$buycarr[$i]);
$productid=$pr[1];
$fr=explode(",",$pr[1]);
//ID
$classid=(int)$fr[0];
$id=(int)$fr[1];
//屬性
$addatt='';
if($pr[2])
{
$addatt=$pr[2];
}
//數量
$pnum=(int)$pr[3];
if(empty($pnum))
{
$pnum=1;
}
//單價
$price=$pr[4];
$thistotal=$price*$pnum;
$buyfen=$pr[5];
$thistotalfen=$buyfen*$pnum;
if($payby==1)
{
$showprice=$buyfen." 點";
$showthistotal=$thistotalfen." 點";
}
else
{
$showprice=$price." 元";
$showthistotal=$thistotal." 元";
}
//產品名稱
$title=stripSlashes($pr[6]);
//返回鏈接
$titleurl="../../public/InfoUrl/?classid=$classid&id=$id";
$totalmoney+=$thistotal;
$totalfen+=$thistotalfen;
?>
<tr>
<td align=center><?=$j?></td>
<td align=center><a href="<?=$titleurl?>" target="_blank"><?=$title?></a><?=$addatt?' - '.$addatt:''?></td>
<td align=right><b>¥<?=$showprice?></b></td>
<td align=right><?=$pnum?></td>
<td align=right><?=$showthistotal?></td>
</tr>
<?php
}
//點數付費
if($payby==1)
{
?>
<tr>
<td colspan=5><div align=right>合計點數:<strong><?=$totalfen?></strong></div></td>
<td> </td>
</tr>
<?php
}
else
{
?>
<tr>
<td colspan=5><div align=right>合計:<strong>¥<?=$totalmoney?></strong></div></td>
<td> </td>
</tr>
<?php
}
?>
</table>
<?php
}
//------ 操作日誌 ------
//操作事件
$shopecms_r=array
(
'SetChecked'=>'設置訂單狀態',
'SetOutProduct'=>'設置發貨狀態',
'SetHaveprice'=>'設置付款狀態',
'DelDd'=>'刪除訂單',
'EditPretotal'=>'修改優惠金額',
'DdRetext'=>'修改後台訂單備註',
'DoCutMaxnum'=>'設置庫存',
);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="../adminstyle/<?=$loginadminstyleid?>/adminstyle.css" rel="stylesheet" type="text/css">
<title>查看訂單</title>
<script>
function PrintDd()
{
pdiv.style.display="none";
window.print();
}
</script>
</head>
<body>
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1">
<form name="showddform" id="showddform" method="post" action="ecmsshop.php" onsubmit="return confirm('確認要操作?');">
<?=$ecms_hashur['form']?>
<input name="enews" type="hidden" id="enews" value="DdRetext">
<input name="ddid" type="hidden" id="ddid" value="<?=$ddid?>">
<tr>
<td width="61%" height="27" bgcolor="#FFFFFF"><strong>訂單ID:
<?=$r[ddno]?>
</strong></td>
<td width="39%" bgcolor="#FFFFFF"><strong>下單時間:
<?=$r[ddtime]?>
</strong></td>
</tr>
<tr>
<td height="23" colspan="2" bgcolor="#EFEFEF"><strong>商品信息</strong></td>
</tr>
<tr>
<td colspan="2">
<?
ShowBuyproduct($addr[buycar],$r[payby]);
?> </td>
</tr>
<tr>
<td height="23" colspan="2" bgcolor="#EFEFEF"><strong>訂單信息</strong></td>
</tr>
<tr>
<td height="23" colspan="2"><table width="100%" border="0" cellspacing="1" cellpadding="3">
<tr>
<td height="25"><div align="right">提交者:</div></td>
<td><?=$username?></td>
<td><div align="right">提交者IP地址:</div></td>
<td><strong>
<?=$r[userip]?>
</strong></td>
</tr>
<tr>
<td width="15%" height="25">
<div align="right">訂單號:</div></td>
<td width="35%"><strong>
<?=$r[ddno]?>
</strong></td>
<td width="15%"><div align="right">訂單狀態:</div></td>
<td width="35%"><strong>
<?=$ha?>
</strong>/<strong>
<?=$ou?>
</strong>/<strong>
<?=$ch?>
</strong></td>
</tr>
<tr>
<td height="25">
<div align="right">下單時間:</div></td>
<td><strong>
<?=$r[ddtime]?>
</strong></td>
<td><div align="right">商品總金額:</div></td>
<td><strong>
<?=$alltotal?>
</strong></td>
</tr>
<tr>
<td height="25">
<div align="right">配送方式:</div></td>
<td><strong>
<?=$r[psname]?>
</strong></td>
<td><div align="right">+ 商品運費:</div></td>
<td><strong>
<?=$pstotal?>
</strong></td>
</tr>
<tr>
<td height="25">
<div align="right">支付方式:</div></td>
<td><strong>
<?=$payfsname?>
</strong></td>
<td><div align="right">+ 發票費用:</div></td>
<td><?=$r[fptotal]?></td>
</tr>
<tr>
<td height="25">
<div align="right">需要發票:</div></td>
<td><?=$fp?></td>
<td><div align="right">- 優惠:</div></td>
<td><?=$r[pretotal]?></td>
</tr>
<tr>
<td height="25">
<div align="right">發票抬頭:</div></td>
<td><strong>
<?=$r[fptt]?>
</strong></td>
<td><div align="right">訂單總金額:</div></td>
<td><strong>
<?=$mytotal?>
</strong></td>
</tr>
<tr>
<td height="25"><div align="right">發票名稱:</div></td>
<td colspan="3"><strong>
<?=$r[fpname]?>
</strong></td>
</tr>
</table></td>
</tr>
<tr>
<td height="23" colspan="2" bgcolor="#EFEFEF"><strong>收貨人信息</strong></td>
</tr>
<tr>
<td colspan="2"><table width="100%%" border="0" cellspacing="1" cellpadding="3">
<tr>
<td width="20%" height="25">真實姓名:</td>
<td width="80%">
<?=$r[truename]?> </td>
</tr>
<tr>
<td height="25">QQ:</td>
<td>
<?=$r[oicq]?> </td>
</tr>
<tr>
<td height="25">MSN:</td>
<td>
<?=$r[msn]?> </td>
</tr>
<tr>
<td height="25">固定電話:</td>
<td>
<?=$r[mycall]?> </td>
</tr>
<tr>
<td height="25">手機:</td>
<td>
<?=$r[phone]?> </td>
</tr>
<tr>
<td height="25">聯繫郵箱:</td>
<td>
<?=$r[email]?> </td>
</tr>
<tr>
<td height="25">聯繫地址:</td>
<td>
<?=$r[address]?> </td>
</tr>
<tr>
<td height="25">郵編:</td>
<td>
<?=$r[zip]?> </td>
</tr>
<tr>
<td height="25">標誌建築:</td>
<td><?=$r[signbuild]?></td>
</tr>
<tr>
<td height="25">最佳送貨時間:</td>
<td><?=$r[besttime]?></td>
</tr>
<tr>
<td height="25">備註:</td>
<td>
<?=nl2br($addr[bz])?> </td>
</tr>
</table></td>
</tr>
<tbody id="pdiv">
<tr>
<td height="23" colspan="2" bgcolor="#EFEFEF"><strong>相關操作</strong></td>
</tr>
<tr>
<td height="23" colspan="2"><table width="100%" border="0" cellspacing="1" cellpadding="3">
<tr>
<td width="16%">後台備註內容:<br>
<br>
<font color="#666666">(前台會員可查看,比如提供快遞號等信息)</font></td>
<td width="77%"><textarea name="retext" cols="65" rows="6" id="retext"><?=$addr['retext']?></textarea></td>
<td width="7%"><input type="submit" name="Submit2" value="提交" onClick="document.showddform.enews.value='DdRetext';"></td>
</tr>
<tr>
<td height="25">修改優惠金額:</td>
<td><input name="pretotal" type="text" id="pretotal" value="<?=$r[pretotal]?>">
修改原因:
<input name="bz" type="text" id="bz"></td>
<td><input type="submit" name="Submit3" value="提交" onClick="document.showddform.enews.value='EditPretotal';"></td>
</tr>
</table></td>
</tr>
<tr>
<td height="23" colspan="2" bgcolor="#EFEFEF"><strong>訂單操作日誌</strong></td>
</tr>
<tr>
<td height="23" colspan="2"><table width="100%" border="0" cellspacing="1" cellpadding="3" class="tableborder">
<tr class="header">
<td width="21%" height="23"><div align="center">操作時間</div></td>
<td width="17%"><div align="center">操作者</div></td>
<td width="19%"><div align="center">事件</div></td>
<td width="19%"><div align="center">操作內容</div></td>
<td width="24%"><div align="center">操作原因</div></td>
</tr>
<?php
$logsql=$empire->query("select logid,userid,username,ecms,bz,addbz,logtime from {$dbtbpre}enewsshop_ddlog where ddid='$ddid' order by logid desc");
while($logr=$empire->fetch($logsql))
{
$empirecms=$shopecms_r[$logr['ecms']];
if($logr['ecms']=='DoCutMaxnum')
{
$logr['addbz']=$logr['addbz']=='ecms=1'?'還原庫存':'減少庫存';
}
?>
<tr bgcolor="#ffffff">
<td height="23"><div align="center"><?=$logr['logtime']?></div></td>
<td><div align="center"><?=$logr['username']?></div></td>
<td><div align="center"><?=$empirecms?></div></td>
<td><?=$logr['addbz']?></td>
<td><?=$logr['bz']?></td>
</tr>
<?php
}
?>
</table></td>
</tr>
<tr>
<td colspan="2"><div align="center">
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1">
<tr>
<td><div align="center">
<input type="button" name="Submit" value=" 打 印 " onclick="javascript:PrintDd();">
</div></td>
</tr>
</table>
</div></td>
</tr>
</tbody>
</form>
</table>
</body>
</html>
<?
db_close();
$empire=null;
?>