lisy
2023-07-27 81932e21cb584b992bdbde80df84eb81f77073d0
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
/**
 * 小件物流订单管理初始化
 */
var TOrderLogistics = {
    id: "TOrderLogisticsTable",    //表格id
    seItem: null,        //选中的条目
    table: null,
    layerIndex: -1
};
var language =$("#language").val()
/**
 * 初始化表格的列
 */
TOrderLogistics.initColumn = function () {
    return [
        {field: 'selectItem', radio: true},
        {title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'},
        {title: language==1?'下单时间':(language==2?'Order time':'Waktu pesanan'), field: 'insertTime', visible: true, align: 'center', valign: 'middle',width:'8%',
            formatter: function (value, row) {
                return currentTime(value);
            }
        },
        {title: language==1?'订单类型':(language==2?'Order type':'Jenis pesanan'), field: 'type', visible: true, align: 'center', valign: 'middle',
            formatter: function (value, row) {
                var btn = "";
                if(row.type != '' && row.type != null) {
                    if (row.type == 4){
                        if(language==1){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="同城快送" onfocus="TUser.tooltip()">同城快送</p>']
                        }else if(language==2){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="Intra-city express delivery" onfocus="TUser.tooltip()">Intra-city express delivery</p>']
                        }else {
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="Pengiriman Ekspres Dalam Kota" onfocus="TUser.tooltip()">Pengiriman Ekspres Dalam Kota</p>']
                        }
                    }
                }
                return btn;
            }
        },
        {title: language==1?'订单编号':(language==2?'Order number':'Jumlah order'), field: 'orderNum', visible: true, align: 'center', valign: 'middle',
            formatter: function (value, row) {
                var btn = "";
                if(row.orderNum != '' && row.orderNum != null) {
                    btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.orderNum + '" onfocus="TUser.tooltip()">' + row.orderNum + '</p>']
                }
                return btn;
            }
        },
        {title:language==1?'订单来源':(language==2?'Order source':'Sumber pesanan'), field: 'orderSource', visible: true, align: 'center', valign: 'middle',
            formatter: function (value, row) {
                var btn = "";
                if(row.orderSource != '' && row.orderSource != null) {
 
                    if(language==1){
                        if (row.orderSource == 1){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="APP下单" onfocus="TUser.tooltip()">APP下单</p>']
                        } else if (row.orderSource == 2){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="扫码下单" onfocus="TUser.tooltip()">扫码下单</p>']
                        } else if (row.orderSource == 3){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="小程序下单" onfocus="TUser.tooltip()">小程序下单</p>']
                        } else if (row.orderSource == 4){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="司机下单" onfocus="TUser.tooltip()">司机下单</p>']
                        } else if (row.orderSource == 5){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="调度下单" onfocus="TUser.tooltip()">调度下单</p>']
                        }
                    }else if(language==2){
                        if (row.orderSource == 1){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="APP order" onfocus="TUser.tooltip()">APP order</p>']
                        } else if (row.orderSource == 2){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="Scanning code to place order" onfocus="TUser.tooltip()">Scanning code to place order</p>']
                        } else if (row.orderSource == 3){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="Mini program order" onfocus="TUser.tooltip()">Mini program order</p>']
                        } else if (row.orderSource == 4){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="The driver orders" onfocus="TUser.tooltip()">The driver orders</p>']
                        } else if (row.orderSource == 5){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="Scheduling orders" onfocus="TUser.tooltip()">Scheduling orders</p>']
                        }
                    }else {
                        if (row.orderSource == 1){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="Order APP" onfocus="TUser.tooltip()">Order APP</p>']
                        } else if (row.orderSource == 2){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="Memindai kode untuk menempatkan perintah" onfocus="TUser.tooltip()">Memindai kode untuk menempatkan perintah</p>']
                        } else if (row.orderSource == 3){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="Perintah program mini" onfocus="TUser.tooltip()">Perintah program mini</p>']
                        } else if (row.orderSource == 4){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="Pemandu perintah" onfocus="TUser.tooltip()">Pemandu perintah</p>']
                        } else if (row.orderSource == 5){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="Perintah jadwal" onfocus="TUser.tooltip()">Perintah jadwal</p>']
                        }
                    }
 
                }
                return btn;
            }
        },
        {title: language==1?'乘车时间':(language==2?'Riding time':'Waktu berkuda'), field: 'travelTime', visible: true, align: 'center', valign: 'middle',width:'10%',
            formatter: function (value, row) {
                return currentTime(value);
            }
        },
        {title:language==1?'用户id':(language==2?'User id':'Identitas pengguna'), field: 'userId', visible: false, align: 'center', valign: 'middle'},
        {title:language==1?'下单用<br/>户昵称':(language==2?'Nickname of user placing the order ':'Nama panggilan pengguna menempatkan pesanan'), field: 'nickName', visible: true, align: 'center', valign: 'middle',
        },
        {title: language==1?'下单用<br/>户手机':(language==2?'Mobile phone of user placing the order':'Ponsel Pengguna Menempatkan Pesanan'), field: 'phone', visible: true, align: 'center', valign: 'middle',
        },
        {title: language==1?'收货人<br/>姓名':(language==2?'Name of Recipient':'Nama penerima'), field: 'recipient', visible: true, align: 'center', valign: 'middle',
            formatter: function (value, row) {
                var btn = "";
                if(row.recipient != '' && row.recipient != null) {
                    btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.recipient + '" onfocus="TUser.tooltip()">' + row.recipient + '</p>']
                }
                return btn;
            }
        },
        {title: language==1?'收货人<br/>手机':(language==2?'Mobile phone of Recipient':'Ponsel penerima'), field: 'recipientPhone', visible: true, align: 'center', valign: 'middle',
            formatter: function (value, row) {
                var btn = "";
                if(row.recipientPhone != '' && row.recipientPhone != null) {
                    btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.recipientPhone + '" onfocus="TUser.tooltip()">' + row.recipientPhone + '</p>']
                }
                return btn;
            }
        },
        {title: language==1?'起点':(language==2?'Starting location':'Lokasi awal'), field: 'startAddress', visible: true, align: 'center', valign: 'middle',
            formatter: function (value, row) {
                var btn = "";
                if(row.startAddress != '' && row.startAddress != null) {
                    var str = row.startAddress;
                    var str1 = "";
                    var arr = "";
                    for(var i=0,len=str.length/15;i<len;i++) {
                        str1 = str.substr(0,15);
                        str = str.replace(str1,'');
                        arr += str1 + "<br>";
                    }
                    arr = arr.substring(0,arr.length-4);
                    btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.startAddress + '" onfocus="TUser.tooltip()">' + arr + '</p>']
                }
                return btn;
            }
        },
        {title: language==1?'终点':(language==2?'Destination':'Tujuan'), field: 'endAddress', visible: true, align: 'center', valign: 'middle',
            formatter: function (value, row) {
                var btn = "";
                if(row.endAddress != '' && row.endAddress != null) {
                    var str = row.endAddress;
                    var str1 = "";
                    var arr = "";
                    for(var i=0,len=str.length/15;i<len;i++) {
                        str1 = str.substr(0,15);
                        str = str.replace(str1,'');
                        arr += str1 + "<br>";
                    }
                    arr = arr.substring(0,arr.length-4);
                    btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.endAddress + '" onfocus="TUser.tooltip()">' + arr + '</p>']
                }
                return btn;
            }
        },
        {title: language==1?'接单司机':(language==2?'Order-taking driver':'Pengemudi pengambilan pesanan'), field: 'driverName', visible: true, align: 'center', valign: 'middle',
        },
        {title: language==1?'接单车辆':(language==2?'Order-accepting vehicle':'Kendaraan yang menerima pesanan'), field: 'carName', visible: true, align: 'center', valign: 'middle',
        },
        {title: language==1?'订单金额':(language==2?'Order amount':'Jumlah pesanan'), field: 'orderMoney', visible: true, align: 'center', valign: 'middle',
        },
        {title: language==1?'备注':(language==2?'Remarks':'Catatan'), field: 'remark', visible: true, align: 'center', valign: 'middle', width:'300px',
            formatter: function (value, row) {
                if(typeof value != 'undefined'){
                    return '<span title="' + value + '">' + value + '</span>';
                }
            }
        },
        {title:language==1?'状态':(language==2?'State':'Status'), field: 'state', visible: true, align: 'center', valign: 'middle',
            formatter: function (value, row) {
                var btn = "";
                if(row.state != '' && row.state != null) {
                    if(language==1){
                        if (row.state == 1){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="待接单" onfocus="TUser.tooltip()">待接单</p>']
                        } else if (row.state == 2){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="待出发" onfocus="TUser.tooltip()">待出发</p>']
                        } else if (row.state == 3){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="待到达预约地点" onfocus="TUser.tooltip()">待到达预约地点</p>']
                        } else if (row.state == 4){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="待取货" onfocus="TUser.tooltip()">待取货</p>']
                        } else if (row.state == 5){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="服务中" onfocus="TUser.tooltip()">服务中</p>']
                        } else if (row.state == 6){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="已送达" onfocus="TUser.tooltip()">已送达</p>']
                        } else if (row.state == 7){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="待支付" onfocus="TUser.tooltip()">待支付</p>']
                        }else if (row.state == 8){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="需补差价" onfocus="TUser.tooltip()">需补差价</p>']
                        } else if (row.state == 9){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="已取货" onfocus="TUser.tooltip()">已取货</p>']
                        } else if (row.state == 10){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="已取消" onfocus="TUser.tooltip()">已取消</p>']
                        }else if (row.state == 11){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="改派中" onfocus="TUser.tooltip()">改派中</p>']
                        }else if (row.state == 12){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="已支付差价" onfocus="TUser.tooltip()">已支付差价</p>']
                        }
                    }else if(language==2){
                        if (row.state == 1){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="Waiting for accepting orders" onfocus="TUser.tooltip()">Waiting for accepting orders</p>']
                        } else if (row.state == 2){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="Waiting for departure" onfocus="TUser.tooltip()">Waiting for departure</p>']
                        } else if (row.state == 3){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="To arrive at the reservation place" onfocus="TUser.tooltip()">To arrive at the reservation place</p>']
                        } else if (row.state == 4){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="Goods to be picked up" onfocus="TUser.tooltip()">Goods to be picked up</p>']
                        } else if (row.state == 5){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="In service" onfocus="TUser.tooltip()">In service</p>']
                        } else if (row.state == 6){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="Delivered" onfocus="TUser.tooltip()">Delivered</p>']
                        } else if (row.state == 7){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="To be paid" onfocus="TUser.tooltip()">To be paid</p>']
                        }else if (row.state == 8){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="Need to cover the difference" onfocus="TUser.tooltip()">Need to cover the difference</p>']
                        } else if (row.state == 9){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="Goods collected" onfocus="TUser.tooltip()">Goods collected</p>']
                        } else if (row.state == 10){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="Has been cancelled" onfocus="TUser.tooltip()">Has been cancelled</p>']
                        }else if (row.state == 11){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="In conversion" onfocus="TUser.tooltip()">In conversion</p>']
                        }else if (row.state == 12){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="Difference paid" onfocus="TUser.tooltip()">Difference paid</p>']
                        }
                    }else {
                        if (row.state == 1){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="Menunggu untuk menerima pesanan" onfocus="TUser.tooltip()">Menunggu untuk menerima pesanan</p>']
                        } else if (row.state == 2){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="Menunggu keberangkatan" onfocus="TUser.tooltip()">Menunggu keberangkatan</p>']
                        } else if (row.state == 3){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="Untuk tiba di tempat reservasi" onfocus="TUser.tooltip()">Untuk tiba di tempat reservasi</p>']
                        } else if (row.state == 4){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="Barang yang akan dijemput" onfocus="TUser.tooltip()">Barang yang akan dijemput</p>']
                        } else if (row.state == 5){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="Dalam pelayanan" onfocus="TUser.tooltip()">Dalam pelayanan</p>']
                        } else if (row.state == 6){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="Dikirim" onfocus="TUser.tooltip()">Dikirim</p>']
                        } else if (row.state == 7){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="Untuk dibayar" onfocus="TUser.tooltip()">Untuk dibayar</p>']
                        }else if (row.state == 8){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="Perbedaan harus dibuat" onfocus="TUser.tooltip()">Perbedaan harus dibuat</p>']
                        } else if (row.state == 9){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="Menangkap" onfocus="TUser.tooltip()">Menangkap</p>']
                        } else if (row.state == 10){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="Telah dibatalkan" onfocus="TUser.tooltip()">Telah dibatalkan</p>']
                        }else if (row.state == 11){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="Dalam proses pemindahan ulang" onfocus="TUser.tooltip()">Dalam proses pemindahan ulang</p>']
                        }else if (row.state == 12){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="Perbedaan dibayar" onfocus="TUser.tooltip()">Perbedaan dibayar</p>']
                        }
                    }
 
                }
                return btn;
            }
        }
    ];
};
 
/**
 * 检查是否选中
 */
TOrderLogistics.check = function () {
    var selected = $('#' + this.id).bootstrapTable('getSelections');
    if(selected.length == 0){
        if(language==1){
            Feng.info("请先选中表格中的某一记录!");
        }else if(language==2){
            Feng.info("Please select 条记录 in the table first!");
        }else {
            Feng.info("Pilih catatan di tabel terlebih dahulu!");
        }
        return false;
    }else{
        TOrderLogistics.seItem = selected[0];
        return true;
    }
};
 
/**
 * 打开查看小件物流订单详情
 */
TOrderLogistics.detail = function () {
    if(this.check()){
        var index = layer.open({
            type: 2,
            title: language==1?'查看详情':(language==2?'View details':'Melihat rincian'),
            area: ['100%', '100%'], //宽高
            fix: false, //不固定
            maxmin: true,
            content: Feng.ctxPath + '/tOrderLogistics/tOrderLogistics_detail/' + TOrderLogistics.seItem.id
        });
        this.layerIndex = index;
    }
};
 
/**
 * 取消订单
 */
TOrderLogistics.cancel = function(){
    if (this.check()) {
        var nickname = TOrderLogistics.seItem.orderNum;
        if (nickname == "" || nickname == null || nickname == undefined) {
           if(language==1){
               nickname = "该订单";
            }else if(language==2){
               nickname = "The order";
            }else {
               nickname = "Perintah";
            };
        } else {
            nickname = "【" + nickname + "】";
        }
        if (TOrderLogistics.seItem.state == 5 || TOrderLogistics.seItem.state == 6 || TOrderLogistics.seItem.state == 9 || TOrderLogistics.seItem.state == 10 ) {
            if(language==1){
                swal("取消失败", "该状态下不能执行此操作", "warning");
            }else if(language==2){
                swal("Fail", "This operation cannot be performed in this state", "warning");
            }else {
                swal("Gagal", "perasi ini tidak dapat dilakukan dalam keadaan ini", "warning");
            }
 
            return;
        }
        swal({
            title: language==1?"您是否确认取消订单" + nickname + "?":(language==2?"Are you sure  to cancel the order" + nickname + "?":"Apakah Anda pasti akan membatalkan pesanan " + nickname + "?"),
            text: language==1?"请谨慎操作!":(language==2?' Please operate with caution!':'Harap beroperasi dengan hati -hati!'),
            type: "warning",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            confirmButtonText:  language==1?"取消订单":(language==2?' Cancel order':'Batalkan pesanan'),
            closeOnConfirm: false
        }, function () {
            var ajax = new $ax(Feng.ctxPath + "/tOrderLogistics/cancel", function (data) {
                if(language==1){
                    swal("取消订单成功", "您已经成功取消了" + nickname + "。", "success");
                }else if(language==2){
                    swal("Success", "You have successfully canceled" + nickname + "。", "success");
                }else {
                    swal("Success", "Anda telah berhasil membatalkan" + nickname + "。", "success");
                }
 
                TOrderLogistics.table.refresh();
            }, function (data) {
                if(language==1){
                    swal("取消订单失败", data.responseJSON.message + "!", "warning");
                }else if(language==2){
                    swal("Fail", data.responseJSON.message + "!", "warning");
                }else {
                    swal("Gagal", data.responseJSON.message + "!", "warning");
                }
            });
 
            ajax.set("tOrderLogisticsId", TOrderLogistics.seItem.id);
            ajax.start();
        });
    }
}
function currentTime(timestamp){
    var time = timestamp + '';
    if(time.length != 13){
        timestamp = timestamp * 1000;
    }
    var date = new Date(timestamp);;
    var Y = date.getFullYear() + '-';
    var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
    var D = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate()) + ' ';
 
    var h = (date.getHours() < 10 ? '0' + (date.getHours()) : date.getHours()) + ':';
    var m = (date.getMinutes() < 10 ? '0' + (date.getMinutes()) : date.getMinutes()) + ':';
    var s = (date.getSeconds() < 10 ? '0' + (date.getSeconds()) : date.getSeconds());
    var strDate = Y + M + D + h + m + s;
    return strDate
}
/**
 * 删除小件物流订单
 */
TOrderLogistics.delete = function () {
    if (this.check()) {
        var orderNum = TOrderLogistics.seItem.orderNum;
        if (orderNum == "" || orderNum == null || orderNum == undefined) {
         if(language==1){
                orderNum = "该订单";
            }else if(language==2){
                orderNum = "The order";
            }else {
                orderNum = "Perintah";
            };
        } else {
            orderNum = "【" + orderNum + "】";
        }
        if (TOrderLogistics.seItem.state != 10) {
            if(language==2){
                swal("删除失败", "This operation can only be performed in the status of delete failed [cancelled]", "warning");
            }else if(language==1){
                swal("Fail", "【已取消】状态下才能执行此操作", "warning");
            }else {
                swal("Gagal", "Operasi ini hanya dapat dilakukan dalam status Delete Gagal [dibatalkan]", "warning");
            }
            return;
        }
        swal({
            title: language==1?"您是否确认删除" + nickname + "?":(language==2?"Are you sure to delete the" + orderNum + "?":"Apakah Anda pasti akan menghapus" + orderNum + "?"),
            text: language==1?"请谨慎操作!":(language==2?' Please operate with caution!':'Harap beroperasi dengan hati -hati!'),
            type: "warning",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            confirmButtonText: language==1?"删除":(language==2?'Delete':'Hapus'),
            closeOnConfirm: false
        }, function () {
            var ajax = new $ax(Feng.ctxPath + "/tOrderLogistics/delete", function (data) {
                if(language==1){
                    swal("删除成功", "您已经删除了" + orderNum + "。", "success");
                }else if(language==2){
                    swal("Success", "You have deleted it" + orderNum + "。", "success");
                }else {
                    swal("Success", "Anda telah menghapusnya" + orderNum + "。", "success");
                }
                TOrderLogistics.table.refresh();
            }, function (data) {
                if(language==1){
                    swal("删除失败", data.responseJSON.message + "!", "warning");
                }else if(language==2){
                    swal("Failed to delete", data.responseJSON.message + "!", "warning");
                }else {
                    swal("Hapus Gagal", data.responseJSON.message + "!", "warning");
                }
            });
            ajax.set("tOrderLogisticsId", TOrderLogistics.seItem.id);
            ajax.start();
        });
    }
};
 
/**
 * 查询小件物流订单列表
 */
TOrderLogistics.search = function () {
    var queryData = {};
    queryData['insertTime'] = $("#insertTime").val();
    queryData['orderNum'] = $("#orderNum").val();
    queryData['type'] = $("#type").val();
    queryData['orderSource'] = $("#orderSource").val();
    queryData['userName'] = $("#userName").val();
    queryData['userPhone'] = $("#userPhone").val();
    queryData['recipient'] = $("#recipient").val();
    queryData['recipientPhone'] = $("#recipientPhone").val();
    queryData['driver'] = $("#driver").val();
    queryData['state'] = $("#state").val();
    TOrderLogistics.table.refresh({query: queryData});
};
 
TOrderLogistics.resetSearch = function () {
    $("#insertTime").val("");
    $("#orderNum").val("");
    $("#type").val("");
    $("#orderSource").val("");
    $("#userName").val("");
    $("#userPhone").val("");
    $("#recipient").val("");
    $("#recipientPhone").val("");
    $("#driver").val("");
    $("#state").val("");
    TOrderLogistics.search();
};
 
$(function () {
    var defaultColunms = TOrderLogistics.initColumn();
    var table = new BSTable(TOrderLogistics.id, "/tOrderLogistics/list", defaultColunms);
    table.setPaginationType("server");
    TOrderLogistics.table = table.init();
});