-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathOwner_accepted.html
More file actions
311 lines (306 loc) · 10.4 KB
/
Owner_accepted.html
File metadata and controls
311 lines (306 loc) · 10.4 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
<!DOCTYPE html>
<html>
<head>
<title>已被接单</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="css/bootstrap.css" rel="stylesheet" type="text/css" media="all" />
<link href="css/style_home.css" rel="stylesheet" type="text/css" media="all" />
<link href="css/home_layout.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css" />
<script src="js/jquery-3.3.1.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/msg_share.js"></script>
<script src="js/jquery.cookie.js"></script>
<script src="https://cdn.bootcss.com/datatables/1.10.16/js/jquery.dataTables.js"></script>
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Open+Sans:400,300,300italic,400italic,600,600italic,700,700italic,800,800italic" />
<link href="https://fonts.googleapis.com/css?family=Abril+Fatface" rel="stylesheet" type="text/css" />
<style>
.content {
margin: 50px auto;
border: 1px solid #ccc;
}
.operation {
margin: 10px;
}
.operation>button {
margin: 10px;
}
#books_length {
float: left;
margin-left: 20px;
}
#books_filter {
float: right;
margin-right: 20px;
}
#books {
margin: 5px;
}
.center-block {
display: block;
margin: auto;
}
</style>
</head>
<body>
<div class="banner1">
<div class="container">
<center>
<div class="logo">
<a href="Owner_main.html" style="font-family:Abril Fatface; white-space:nowrap;">Pass All<span>
Logistics Transportation System</span></a>
</div>
</center>
<div class="navigation">
<nav class="navbar navbar-default">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse nav-wil" id="bs-example-navbar-collapse-1">
<nav class="cl-effect-13" id="cl-effect-13">
<ul class="nav navbar-nav">
<li><a href="Owner_main.html">主页</a></li>
<li><a href="Owner_published.html">已发订单</a></li>
<li><a href="Owner_accepted.html" class="active">已被接单</a></li>
<li><a href="Owner_transforming.html">正在运输</a></li>
<li><a href="Owner_information.html">个人资料</a></li>
<li><a href="Owner_mailus.html">关于我们</a></li>
</ul>
</nav>
</div>
<!-- /.navbar-collapse -->
</nav>
</div>
</div>
</div>
<div class="container2">
<div class="blog">
<h3 style=" font-family:微软雅黑;"><span>在此页面显示的是您 </span> 已被承接的订单 </h3>
<p class="dolore">您可以选择司机</p>\
<section class="content">
<div class="modal fade" id="editBookInfo" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<label class="modal-title">选择司机</label>
</div>
<div id="editBookModal" class="modal-body">
<form method="get" role="form" class="form-horizontal">
<div class="form-group">
<label class="col-sm-12" style="text-align: center;">确认选择此司机为您配送货物?</label>
</div>
</form>
<form method="get" role="form" class="form-horizontal" id="subform_choose">
<div class="form-group" style="display: none;">
<label for="drivernumber" class="col-sm-3 control-label">司机联系方式:</label>
<div class="col-sm-8">
<input class="form-control" name="drivernumber" id="drivernumber" type="text" readonly="true">
</div>
</div>
<div class="form-group" style="display: none;">
<label for="Orderkey" class="col-sm-3 control-label">订单号:*</label>
<div class="col-sm-8">
<input class="form-control" name="Orderkey" id="Orderkey" type="text" readonly="true">
</div>
</div>
<div class="form-group" style="display: none;">
<label for="Pay" class="col-sm-3 control-label">金额:*</label>
<div class="col-sm-8">
<input class="form-control" name="Pay" id="Pay" type="text" readonly="true">
</div>
</div>
</form>
</div>
<div class="modal-footer">
<div class="center-block" align="center">
<button id="cancelEdit" type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<button id="choosedriver" type="button" class="btn btn-success" data-dismiss="modal">确定</button>
</div>
</div>
</div>
</div>
</div>
<table id="books" class="table table-striped table-bordered row-border hover order-column" cellspacing="0" width="100%">
<thead>
<tr>
<th>序号</th>
<th>订单号</th>
<th>商品名称</th>
<th>商品类型</th>
<th>出发地</th>
<th>目的地</th>
<th>价格</th>
<th>要求送达时间</th>
<th>司机姓名</th>
<th>联系方式</th>
<th>车牌号</th>
<th>运输类型</th>
<th>车型</th>
<th>订单状态</th>
</tr>
</thead>
<tbody></tbody>
<button id="btn_edit" type="button" class="btn bg-success" style="color: black; display: none;">
<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>修改
</button>
</table>
</section>
</div>
</div>
</body>
<script type="text/javascript">
var arr = new Array(); //先声明一维
function all() {
$.ajax({
type: "post",
async: false,
url: "http://localhost:8081/msg_orders_accepted.php",
data: 'Numbers=' + $.cookie('user'),
dataType: "json",
success: function(result) {
for (var i = 0; i < result.length; i++) { //一维长度为length
arr[i] = new Array(); //再声明二维
arr[i][0] = "";
arr[i][1] = result[i].Orderkey;
arr[i][2] = result[i].Cargoname;
arr[i][3] = result[i].Category;
arr[i][4] = result[i].Beginplace;
arr[i][5] = result[i].Endplace;
arr[i][6] = result[i].Pay;
arr[i][7] = result[i].Reqtime;
arr[i][8] = result[i].Drivername;
arr[i][9] = result[i].Drivernumber;
arr[i][10] = result[i].Carid;
arr[i][11] = result[i].TransportType;
arr[i][12] = result[i].CarType;
arr[i][13] = result[i].Status;
}
}
})
return;
}
</script>
<script>
all();
var data = arr;
var table;
$(function() {
var table = $('#books').DataTable({
data: data,
"pagingType": "full_numbers",
"bSort": true,
"language": {
"sProcessing": "处理中...",
"sLengthMenu": "显示 _MENU_ 项结果",
"sZeroRecords": "没有匹配结果",
"sInfo": "显示第 _START_ 至 _END_ 项结果,共 _TOTAL_ 项",
"sInfoEmpty": "显示第 0 至 0 项结果,共 0 项",
"sInfoFiltered": "(由 _MAX_ 项结果过滤)",
"sInfoPostFix": "",
"sSearch": "搜索:",
"sUrl": "",
"sEmptyTable": "表中数据为空",
"sLoadingRecords": "载入中...",
"sInfoThousands": ",",
"oPaginate": {
"sFirst": "首页",
"sPrevious": "上页",
"sNext": "下页",
"sLast": "末页"
},
"oAria": {
"sSortAscending": ": 以升序排列此列",
"sSortDescending": ": 以降序排列此列"
}
},
"columnDefs": [{
"searchable": false,
"orderable": true,
"targets": 0
}, {
"targets": [13],
"visible": false,
}, ],
});
table.on('order.dt search.dt', function() {
table.column(0, {
search: 'applied',
order: 'applied'
}).nodes().each(function(cell, i) {
cell.innerHTML = i + 1;
});
}).draw();
$('#books tbody').on('click', 'tr', function() {
if ($(this).hasClass('selected')) {
$(this).removeClass('selected');
} else {
table.$('tr.selected').removeClass('selected');
$(this).addClass('selected');
document.getElementById("btn_edit").click();
}
});
$('#btn_edit').click(function() {
if (table.rows('.selected').data().length) {
$("#editBookInfo").modal()
var rowData = table.rows('.selected').data()[0];
var inputs = $("#editBookInfo").find('input')
$(inputs[0]).val(rowData[9])
$(inputs[1]).val(rowData[1])
$(inputs[2]).val(rowData[6])
} else {
alert('请选择项目');
}
});
$('#choosedriver').click(function() {
var charge;
$.ajax({
type: "post",
async: false,
url: "http://localhost:8081/msg_owner.php",
data: 'number=' + $.cookie('user'),
dataType: "json",
success: function(result) {
charge = result[0].Account;
}
});
if (charge < $("#Pay").val()) {
alert("选定失败,您的余额不足以支付本次订单,请充值!!!!")
} else {
$.ajax({
type: "post",
async: false,
url: "http://localhost:8081/choose.php",
data: $("#subform_choose").serialize() + '&' + 'Numbers=' + $.cookie('user'),
dataType: "json",
success: function(result) {
alert("选定成功!运费已扣除");
location.reload();
}
});
}
});
$("#cancelEdit").click(function() {
$("#editBookModal").find('input').val('')
})
$.fn.dataTable.ext.search.push(
function(settings, data, dataIndex) {
if (data[13] != '等待接单') {
return false;
}
return true;
}
);
table.draw();
})
</script>
</html>