add.html
5.5 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
<style>
.full_reduce{
display: none;
}
.discount{
display: none;
}
</style>
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
<input name="row[type]" type="hidden" value="0">
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Coupon_name')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-coupon_name" class="form-control" data-rule="required" name="row[coupon_name]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Is_new')}:</label>
<div class="col-xs-12 col-sm-8">
{:build_select('row[is_new]', $is_new, null, ['class'=>'form-control', 'required'=>''])}
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('C_type')}:</label>
<div class="col-xs-12 col-sm-8">
{:build_select('row[c_type]', $c_type, null, ['class'=>'form-control c_type', 'required'=>''])}
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Coupon_type')}:</label>
<div class="col-xs-12 col-sm-8">
{:build_select('row[coupon_type]', $coupon_type, null, ['class'=>'form-control coupon_type', 'required'=>''])}
</div>
</div>
<div class="form-group full_reduce">
<label class="control-label col-xs-12 col-sm-2">{:__('Full_reduce')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-full_reduce" class="form-control" step="0.01" name="row[full_reduce]" type="number" value="0.00">
</div>
</div>
<div class="form-group reduce">
<label class="control-label col-xs-12 col-sm-2">{:__('Reduce')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-reduce" class="form-control" step="0.01" name="row[reduce]" type="number" value="0.00">
</div>
</div>
<div class="form-group discount">
<label class="control-label col-xs-12 col-sm-2">{:__('Discount')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-discount" data-rule="range(1~10)" class="form-control" name="row[discount]" type="number" value="1">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Coupon_number')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-coupon_number" data-rule="required" class="form-control" name="row[coupon_number]" type="number" value="0">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Start_time')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-start_time" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[start_time]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('End_time')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-end_time" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[end_time]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Gift')}:</label>
<div class="col-xs-12 col-sm-8">
{:build_select('row[gift]', $gift, null, ['class'=>'form-control', 'required'=>''])}
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Sort')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-sort" data-rule="required range(0~)" class="form-control" name="row[sort]" type="number" value="0">
</div>
</div>
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">
<button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
</div>
</div>
</form>
<script src="https://code.jquery.com/jquery-3.0.0.min.js"></script>
<script>
$(function(){
//无门槛,有门槛
$('.c_type').change(function(){
var t_value = $(this).children('option:selected').val();//这就是selected的值
c_type(t_value);
});
//减少券,折扣券
$('.coupon_type').change(function(){
var coupon_value = $(this).children('option:selected').val();//这就是selected的值
coupon_type(coupon_value);
})
});
function c_type(t_value){
if(t_value == 0){
//无门槛,不显示
$('.full_reduce').css('display','none');
}else{
//有门槛,显示
$('.full_reduce').css('display','block');
}
}
//优惠类型
function coupon_type(coupon_value){
if(coupon_value == 0){
//减少券,减少金额显示,折扣金额隐藏
$('.reduce').css('display','block');
$('.discount').css('display','none');
}else{
//折扣券,折扣金额显示,减少金额隐藏
$('.reduce').css('display','none');
$('.discount').css('display','block');
}
}
</script>