chengkun
2025-05-23 a6f7b382623096b6a00924f418447cf5204e825e
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
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
//加减乘除
function accAdd(arg1, arg2) {
    var r1, r2, m;
    try {
        r1 = arg1.toString().split(".")[1].length
    } catch(e) {
        r1 = 0
    }
    try {
        r2 = arg2.toString().split(".")[1].length
    } catch(e) {
        r2 = 0
    }
    m = Math.pow(10, Math.max(r1, r2))
    return(arg1 * m + arg2 * m) / m
}
 
function accSub(arg1, arg2) {
    return accAdd(arg1, -arg2);
}
 
function accMul(arg1, arg2) {
    var m = 0,
        s1 = arg1.toString(),
        s2 = arg2.toString();
    try {
        m += s1.split(".")[1].length
    } catch(e) {}
    try {
        m += s2.split(".")[1].length
    } catch(e) {}
    return Number(s1.replace(".", "")) * Number(s2.replace(".", "")) / Math.pow(10, m)
}
 
function accDiv(arg1, arg2) {
    var t1 = 0,
        t2 = 0,
        r1, r2;
    try {
        t1 = arg1.toString().split(".")[1].length
    } catch(e) {}
    try {
        t2 = arg2.toString().split(".")[1].length
    } catch(e) {}
    with(Math) {
        r1 = Number(arg1.toString().replace(".", ""));
        r2 = Number(arg2.toString().replace(".", ""));
        return(r1 / r2) * pow(10, t2 - t1);
    }
}
 
function myFunction(_this) {
    _this.value = _this.value.replace(/[^0-9]/g, '');
}
 
/* 选择不同会员等级操作 */
$("ul#level_rating").on("tap", "li", function() {
    $(this).addClass("member_set_meal_cur"); // 点击li添加class
    $(this).siblings('li').removeClass("member_set_meal_cur"); // 删除兄弟li的class属性
 
    var price = $(this).find("#server_price").val();
    $("#price").html(price);
    $("#r_price").val(price);
    $("#order_price").html(price);
    $("#vip_price").val(price);
    $("#bank_price").val(price);
 
    var rating = $(this).find("#ratingid").text();
    $("#rating_id").val(rating);
    $("#id").val(rating);
    // 切换套餐时,支付方式又积分模式恢复成付款模式
    $("#paymentform").show();
    $("#integral_buy").hide();
    if(document.getElementById('integral_switch_rating')) {
        document.getElementById('integral_switch_rating').classList.remove('mui-active');
        document.querySelector('.mui-switch-handle').setAttribute('style', '');
        
    }
    $("#integral_pay").val('');
    $("#dkjf").val('');
    $("#spread_integral_box").hide();
})
 
/* 选择不同增值服务操作 */
$("ul#pack_type").on("tap", "li", function() {
    $(this).addClass("value_added_cur"); // 点击li添加class
    $(this).siblings('li').removeClass("value_added_cur"); // 删除兄弟li的class属性
 
    var price = $(this).find("#server_price").val();
    $("#price").html(price);
    $("#r_price").val(price);
    $("#order_price").html(price);
    $("#vip_price").val(price);
 
    var service = $(this).find("#serviceid").text();
    $("#service_id").val(service);
    $("#id").val(service);
    // 切换套餐时,支付方式又积分模式恢复成付款模式
    $("#paymentform").show();
    $("#integral_buy").hide();
    if(document.getElementById('integral_switch_rating')) {
        document.getElementById('integral_switch_rating').classList.remove('mui-active');
        document.querySelector('.mui-switch-handle').setAttribute('style', '');
    }
    $("#integral_pay").val('');
    $("#dkjf").val('');
    $("#spread_integral_box").hide();
 
})
 
/* 选择不同充值积分操作 */
$("ul#integral_num").on("click", "li", function() {
    var integral = $(this).attr('data-integral'); // 充值积分
    if(parseInt(integral)>=parseInt(min_integral) || parseInt(integral)==0){
        $(this).addClass("pay_choice_cur"); // 点击li添加class
        $(this).siblings('li').removeClass("pay_choice_cur"); // 删除兄弟li的class属性
    }else{
        showToast('最低充值:' + min_integral + jifen, 2);
        return false;
    }
 
    if(integral == '0') {
        $('.defined').show();
        $('#price').html(0);
        $('#bank_price').val(0);
        $('#order_price').val(0);
        $('#integral_int').val(integral);
        $('#user_defined').val('');
    } else {
        var integralid = $(this).attr('data-id'); // 积分类别id
        var discount = $(this).attr('data-discount'); // 积分折扣
 
        if(parseInt(discount) > 0) {
            var price = (integral / pro) * (discount / 100);
        } else {
            var price = integral / pro;
        }
        price=Math.round(price * 100) / 100;
        $("#integralid").val(integralid);
        $('.defined').hide();
        $('#user_defined').val('');
 
        $('#price').html(price);
        $('#bank_price').val(price);
        $('#order_price').val(price);
         
        $('#integral_int').val(integral);
    }
})
 
/* 支付方式选择 */
function paycheck(type) {
    var type;
    if(type == "wxpay") {
        $(".wxpay").addClass("member_set_meal_fk_xz_cur");
        $(".alipay").removeClass("member_set_meal_fk_xz_cur");
        $(".bank").removeClass("member_set_meal_fk_xz_cur");
        $("#paytype").val('wxpay');
        $(".paybank").hide();
        $("#div_coupon").show();
        $("#paymentform").attr("action", "index.php?c=dingdan");
    } else if(type == "alipay") {
        $(".alipay").addClass("member_set_meal_fk_xz_cur");
        $(".wxpay").removeClass("member_set_meal_fk_xz_cur");
        $(".bank").removeClass("member_set_meal_fk_xz_cur");
        $("#paytype").val('alipay');
        $(".paybank").hide();
        $("#div_coupon").show();
        $("#paymentform").attr("action", "index.php?c=dingdan");
    } else if(type == "bank") {
        $(".bank").addClass("member_set_meal_fk_xz_cur");
        $(".alipay").removeClass("member_set_meal_fk_xz_cur");
        $(".wxpay").removeClass("member_set_meal_fk_xz_cur");
        $("#paytype").val('bank');
        $(".paybank").show();
     
        $("#paymentform").attr("action", "index.php?c=paybank");
     }
}
 
/* 积分填写 */
 
function checkIntegralNum() {
    var integral = $("#user_defined").val();
    if(parseInt(integral) > 0) {
        var integralval = integral;
        var discountarr = [];
        for(var i in integralclass) {
            if(integralval >= parseInt(integralclass[i]['integral'])) {
                discountarr.push({
                    'discount': integralclass[i]['discount'],
                    'id': integralclass[i]['id']
                });
            }
        }
        if(discountarr.length > 0) {
            var discount = discountarr[discountarr.length - 1].discount;
            $("#integralid").val(discountarr[discountarr.length - 1].id);
        }
        if(parseInt(discount) > 0) {
            var price = (integral / pro) * (discount / 100);
        } else {
            var price = integral / pro;
        }
        price=Math.round(price * 100) / 100;
        $('#price').html(price);
        $('#bank_price').val(price);
        $('#order_price').val(price);
        $('#integral_int').val(integral);
    } else {
        $('#price').html(0);
        $('#bank_price').val(0);
        $('#order_price').val(0);
        $('#integral_int').val(0);
 
    }
}
 
function autointegral() {
    var integral = parseInt($("#user_defined").val());
    if(integral) {
        if(min_integral > 0 && integral < min_integral) {
            integral = min_integral;
            $("#user_defined").val(integral);
            $('#integral_int').val(integral);
        } else {
            $("#user_defined").val(integral);
            $('#integral_int').val(integral);
        }
        var integralval = integral;
        var discountarr = [];
        for(var i in integralclass) {
            if(integralval >= parseInt(integralclass[i]['integral'])) {
                discountarr.push({
                    'discount': integralclass[i]['discount'],
                    'id': integralclass[i]['id']
                });
            }
        }
        if(discountarr.length > 0) {
            var discount = discountarr[discountarr.length - 1].discount;
            $("#integralid").val(discountarr[discountarr.length - 1].id);
        }else{
            var discount = 0;
            $("#integralid").val('');
        }
        if(parseInt(discount) > 0) {
            var price = (integral / pro) * (discount / 100);
        } else {
            var price = integral / pro;
        }
        price=Math.round(price * 100) / 100;
        $('#price').html(price);
        $('#bank_price').val(price);
        $('#order_price').val(price);
 
    }
}
 
function checkNum(integral, integral_pro) {
 
    var integral_pay = $("#integral_pay").val();
 
    var price = $("#r_price").val();
 
    var need_integral = accMul(parseFloat(price), integral_pro);
 
    if(parseInt(need_integral) == 0){
        
        var need_integral    =    1;
        
    }else if(need_integral > parseInt(need_integral)){
        
        var need_integral     =     accAdd(parseInt(need_integral), 1);
    }
    
    if(integral_pay){
        
        if(parseInt(integral_pay) > 0){
            $("#integral_pay").val(parseInt(integral_pay));
        }
        
        if(parseInt(integral) >= parseInt(need_integral)) {
    
            if(parseInt(integral_pay) >= parseInt(need_integral)) {
    
                $("#integral_pay").val(parseInt(need_integral));
                
                var price_n = 0;
            } else {
                var price_n = accSub(parseFloat(price), accDiv(parseInt(integral_pay), integral_pro));
            }
    
        } else {
    
            if(parseInt(integral_pay) > parseInt(integral)) {
                $("#integral_pay").val(parseInt(integral));
                var price_n = accSub(parseFloat(price), accDiv(integral, integral_pro));
            } else {
                var price_n = accSub(parseFloat(price), accDiv(integral_pay, integral_pro));
            }
    
        }
    
        if(price_n <= 0) {
    
            $("#order_price").html(0);
    
            $("#paymentform").hide();
    
            $("#integral_buy").show();
    
        } else {
            var integral_dk    =    $("#integral_pay").val();
            $("#dkjf").val(integral_dk);
            $("#order_price").html(price_n);
            $("#bank_price").val(price_n);
            $("#paymentform").show();
            $("#integral_buy").hide();
    
        }
    }else{
        $("#dkjf").val('');
        $("#order_price").html(price);
        $("#bank_price").val(price);
        $("#paymentform").show();
        $("#integral_buy").hide();
    }
}
 
function integral_add_buy() {
    var service_id = $("#service_id").val();
    var r_integral = $("#r_price").val();
    var integral_need = accMul(r_integral, pro);
 
    if(parseInt(integral) < parseInt(integral_need)) {
        showToast(pricename+"不足,请先充值", 2, function() {
            location.href = wapurl + "member/index.php?c=pay";
        });
        return false;
    } else {
        $.post("index.php?c=dkzf", {
            tcid: service_id,
            integral: integral_need
        }, function(data) {
            var data = eval('(' + data + ')');
            if(data.error == '0') {
                showToast(data.msg, 2, function() {
                    location.href = wapurl + "member/index.php?c=com";
                });
                return false;
            } else {
                if(data.url) {
                    showToast(data.msg, 2, function() {
                        location.href = wapurl + "member/index.php?c=rating";
                    });
                    return false;
                } else {
                    showToast(data.msg, 2, function() {
                        location.reload(true);
                    });
                    return false;
                }
            }
        });
    }
}
 
function integral_rating_buy() {
    var rating_id = $("#rating_id").val();
    var r_integral = $("#r_price").val();
    var integral_need = accMul(r_integral, pro);
 
    if(parseInt(integral) < parseInt(integral_need)) {
        showToast(pricename+"不足,请先充值", 2, function() {
            location.href = "index.php?c=pay";
        });
        return false;
    } else {
        $.post("index.php?c=dkzf", {
            id: rating_id,
            integral: integral_need
        }, function(data) {
            var data = eval('(' + data + ')');
            if(data.error == '0') {
                showToast(data.msg, 2, function() {
                    location.href = wapurl + "member/index.php?c=com";
                });
                return false;
            } else {
                if(data.url) {
                    showToast(data.msg, 2, function() {
                        location.href = wapurl + "member/index.php?c=pay";
                    });
                    return false;
                } else {
                    showToast(data.msg, 2, function() {
                        location.reload(true);
                    });
                    return false;
                }
            }
        });
    }
}
 
function pay_form() {
    var data = $("#paymentform").serialize();
    var coupon = $("input[name='coupons']:checked").val();
    var scope = $("#" + coupon).val();
    var price = $("#vip_price").val();
 
    if(parseInt(price) < parseInt(scope)) {
        showToast('该优惠券未达消费条件!', 2);
        return false;
    }
 
    var paytype = $('#paytype').val();
    if(paytype == "") {
        showToast('请选择一种支付方式!', 2);
        return false;
    }
    showLoading();
    $.post(wapurl+'index.php?c=dingdan',data,function(data){
        hideLoading(); 
        var data=eval('('+data+')');
        showToast(data.msg);return false;
    });
}
 
function integral_form() {
    var data = $("#paymentform").serialize();
    var integral = $('#integral_int').val();
 
    if(parseInt(min_integral) > parseInt(integral)) {
        showToast('最低充值:' + min_integral + pricename, 2);
        return false;
    }
 
    var coupon = $("input[name='coupons']:checked").val();
    var scope = $("#" + coupon).val();
    var price = $("#order_price").val();
 
    if(parseInt(price) < parseInt(scope)) {
        showToast('该优惠券未达消费条件!', 2);
        return false;
    }
 
    var paytype = $('#paytype').val();
    if(paytype == "") {
        showToast('请选择一种支付方式!', 2);
        return false;
    }
 
    showLoading();
    $.post(wapurl+'index.php?c=dingdan',data,function(data){
        hideLoading(); 
        var data=eval('('+data+')');
        showToast(data.msg);return false;
    });
}
 
// 企业猎头会员套餐和增值套餐积分兑换开关
if(document.getElementById('integral_switch_rating')) {
    document.getElementById('integral_switch_rating').addEventListener('toggle', function(event) {
        if(event.detail.isActive) {
            document.getElementById('spread_integral_box').style.display = 'block';
        } else {
            if(document.getElementById('integral_buy')) { // 积分付款和订单付款切换
                if(document.getElementById('integral_buy').style.display == '') {
                    document.getElementById('integral_buy').style.display = 'none';
                    document.getElementById('paymentform').style.display = '';
                }
            }
            if(document.getElementById('spread_integral_box')) {
                document.getElementById('spread_integral_box').style.display = 'none';
            }
            if(document.getElementById('integral_pay')) {
                document.getElementById('integral_pay').value = '';
            }
            if(document.getElementById('dkjf')) {
                document.getElementById('dkjf').value = '';
            }
            if(document.getElementById('order_price') && document.getElementById('r_price')) {
                document.getElementById('order_price').innerText = document.getElementById('r_price').value
            }
            if(document.getElementById('bank_price') && document.getElementById('r_price')) {
                document.getElementById('bank_price').innerText = document.getElementById('r_price').value
            }
        }
    });
 
}
// 企业getserver.htm内积分兑换开关
if(document.getElementById('integral_switch')) {
    document.getElementById('integral_switch').addEventListener('toggle', function(event) {
        if(event.detail.isActive) {
            document.getElementById('spread_integral_box').style.display = 'block';
        } else {
            if(document.getElementById('spread_integral_box')) { // 兑换积分部分隐藏
                document.getElementById('spread_integral_box').style.display = 'none';
            }
            if(document.getElementById('integral_pay')) { // 积分输入框
                document.getElementById('integral_pay').value = '';
            }
            if(document.getElementById('qrzf_btn')) {
                if(document.getElementById('qrzf_btn').style.display == '') {
                    document.getElementById('qrzf_btn').style.display = 'none';
                    document.getElementById('zffs').style.display = '';
                }
            }
            if(document.getElementById('price') && document.getElementById('r_price')) { // 发布职位抵扣积分,关闭时恢复价格
                document.getElementById('price').innerText = document.getElementById('r_price').innerHTML
            }
            if(document.getElementById('dkjfh_price') && document.getElementById('r_price')) { // 刷新职位抵扣后金额隐藏
                document.getElementById('dkjfh_price').innerText = '';
                document.getElementById('dkhdiv').style.display = 'none';
            }
        }
    });
 
}
 
 
// 汇款时间
var banktimePicker = document.getElementById('banktimePicker');
if(banktimePicker) {
    var bank_time = document.getElementById('bank_time');
    banktimePicker.addEventListener('tap', function() {
        document.activeElement.blur();
        var optionsJson = this.getAttribute('data-options') || '{}';
        var options = JSON.parse(optionsJson);
        var picker = new mui.DtPicker(options);
        picker.show(function(rs) {
            bank_time.value = rs.text;
            banktimePicker.innerText = rs.text;
            picker.dispose();
        });
    }, false);
}
 
// 职位推广:置顶、推荐、紧急招聘
function setJobPromote(id , type){
    
    var jobid    =    id;
    var days    =     $("#days").val();
    var type     =    type;
    
    if (days == '') {
        
        showToast('请填写职位推广天数!', 2);
        return false;
    }
    
    showLoading()
    
    $.post('index.php?c=setJobPromote', {jobid : jobid, type : type, days : days}, function(data) {
        
        hideLoading();
        
        var data     =     eval('(' + data + ')');
        var errcode =     data.errcode;
        var msg      =     data.msg;
        
        if(errcode == 7){
            
            showToast(msg, 2);
            return false;
        }else{
            
            showToast(msg, 2, function() {
                location.href = "index.php?c=job";
            })
        }
    });
}