exportDa.php
9.29 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
<?php
use common\business\SuspendOrder;
header('Content-Type: application/vnd.ms-excel;charset=utf-8');
$title = date('Y-m-d') . '_订单';
$name = $title . ".xls";
header('Content-Disposition: attachment;filename=' . $name . '');
header('Cache-Control: max-age=0');
$fp = fopen('php://output', 'a');
$limit = 10000;
$cnt = 0;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
</head>
<body>
<div id="Classeur1_16681" align='center' x:publishsource="Excel">
<table border='1' cellpadding='0' cellspacing='0' width='100%' style="border-collapse: collapse">
<thead>
<tr>
<th style="width:110px" class="text-center align-middle hqy-all-select">订单号</th>
<th style="width:207px">设备拥有者</th>
<th style="width:207px">设备绑定人</th>
<th style="width:207px">报修设备</th>
<th style="width:207px">报修客户</th>
<th style="width:90px">报修时间</th>
<th style="width:273px;">上门地址</th>
<th style="width:80px;">支付金额</th>
<th style="width:80px;">配件费用</th>
<th style="width:80px">上门费</th>
<th style="width:80px">感谢费</th>
<th style="width:80px">工时费</th>
<th style="width:80px">订单金额</th>
<th style="width:80px">免佣金额</th>
<th style="width:80px">平台佣金</th>
<th style="width:70px">订单状态</th>
<th style="width:70px">支付状态</th>
<th style="width:70px">挂起状态</th>
<th style="width:70px">关闭状态</th>
<th style="width:60px">工程师</th>
<th style="width:80px">报修渠道</th>
<th style="width:90px">绑定时间</th>
<th style="width:90px">是否完成回访</th>
<!--<th style="width:280px">回访记录</th>-->
<?php if (isset($questions) && $questions) {
foreach ($questions as $item) {
?>
<th style="width:90px"><?= $item->title ?></th>
<?php }
} ?>
<th style="width:60px">综合评分</th>
<th style="width:60px">速度评分</th>
<th style="width:60px">态度评分</th>
<th style="width:60px">技能评分</th>
<th style="width:120px">评价内容</th>
<th style="width:120px">回访评论</th>
<th style="width:200px;">取消原因</th>
</tr>
</thead>
<tbody>
<?php foreach ($orderList as $order) : ?>
<tr>
<td class="text-center align-middle hqy-row-select"
style="vnd.ms-excel.numberformat:@"><?= $order['order_no'] ?></td>
<td>
<?= $order['ownername'] ?>
</td>
<td>
<?= !empty($order['bind_engineer_name']) ? $order['bind_engineer_name'] : $order['bind_engineer_nick_name'] ?>
</td>
<td>
<?= $order['repair_device_name'] ?>
</td>
<td>
<?= $order['nickname'] ?>(<?= $order['phone'] ?>)
</td>
<td>
<?= Yii::$app->formatter->asTime($order['created_at'], "yyyy-MM-dd"); ?>
</td>
<td>
<?php if ($order['title'] == $order['address']) {
echo $order['address'] . $order['address_detail'];
} else {
echo $order['title'] . $order['address_detail'] . '(' . $order['address'] . ')';
} ?>
</td>
<td style="vnd.ms-excel.numberformat:#,##0.00">
<?= $order['pay_price'] ?>
</td>
<td style="vnd.ms-excel.numberformat:#,##0.00">
<?= $order['parts_price'] ?>
</td>
<td style="vnd.ms-excel.numberformat:#,##0.00">
<?= $order['door_fee'] ?>
</td>
<td style="vnd.ms-excel.numberformat:#,##0.00">
<?= $order['thank_fee'] ?>
</td>
<td style="vnd.ms-excel.numberformat:#,##0.00">
<?= $order['labor_price'] ?>
</td>
<td style="vnd.ms-excel.numberformat:#,##0.00">
<?= $order['door_fee'] + $order['repair_price'] ?>
</td>
<td style="vnd.ms-excel.numberformat:#,##0.00">
<?= !empty($order['free_commission_amount']) ? $order['free_commission_amount'] : 0 ?>
</td>
<td style="vnd.ms-excel.numberformat:#,##0.00">
<?= !empty($order['employ_fee']) ? $order['employ_fee'] : 0 ?>
</td>
<td>
<?= $orderStatusList[$order['status']] ?>
</td>
<td>
<?= (isset($order['pay_at']) && $order['pay_at'] > 0) ? (($order['pay_price'] > 0) ? "已支付" : "优惠抵扣") : "未支付" ?>
</td>
<td>
<?php if ($order['is_suspend'] != SuspendOrder::SUSPEND_STATUS_SUCCESS) {
echo SuspendOrder::suspendLabels($order['is_suspend']);
} ?>
</td>
<td>
<?php if ($order['is_admin_close'] == 1) {
echo "管理员关闭";
} else if ($order['is_user_close'] == 1) {
echo "用户处理关闭";
} else if ($order['is_engineer_close'] == 1) {
echo "工程师处理关闭";
} else {
echo "正常";
}
?>
</td>
<td>
<?= $order['engineer_name'] ?>
</td>
<td>
<?= $channels[$order['repair_channel']] ?>
</td>
<td>
<?= Yii::$app->formatter->asTime($order['bind_at'], "yyyy-MM-dd"); ?>
</td>
<td>
<?= (isset($order['interview_finished']) && $order['interview_finished']) == 1 ? "是" : "否" ?>
</td>
<?php if (isset($questions) && $questions) {
foreach ($questions as $item) {
?>
<td><?php if (isset($order['interview_result']) && $order['interview_result']) {
$interview_result = json_decode($order['interview_result'], true);
if (isset($interview_result['answers'])) {
foreach ($interview_result['answers'] as $result) {
if (isset($result[$item->title])) {
echo $result[$item->title];
}
}
}
} ?></td>
<?php }
} ?>
<td>
<?= $order['final_star'] ?>
</td>
<td>
<?= $order['user_speed_star'] ?>
</td>
<td>
<?= $order['user_attitude_star'] ?>
</td>
<td>
<?= $order['user_skill_star'] ?>
</td>
<td>
<?= $order['user_comment'] ?>
</td>
<td>
<?php
$interview_comment_content = $order['interview_comment_content'];
if (!empty($interview_comment_content)) {
$interview_comment_content = explode('|', $interview_comment_content);
$content_str = "";
foreach ($interview_comment_content as $key => $interview_comment_content_item) {
$content_str .= ($key + 1) . '、' . $interview_comment_content_item . "; ";
}
echo $content_str;
}
?>
</td>
<td>
<?php
if($order['cancel_reason']) {
echo $order['cancel_reason'];
} else {
echo "";
}
?>
</td>
</tr>
<?php
$cnt++;
if (1000 == $cnt) { //刷新一下输出buffer,防止由于数据过多造成问题
ob_flush();
flush();
$cnt = 0;
}
?>
<?php endforeach; ?>
</tbody>
</table>
</div>
</body>
</html>