index.php
10.1 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
<?php
use app\ht\helpers\CssFiles;
use app\ht\widgets\LinkPager;
use yii\helpers\Url;
$this->title = "设置收信息工程师";
$this->params['breadcrumbs'][] = '系统管理';
$this->params['breadcrumbs'][] = $this->title;
CssFiles::register($this, 'exts/base/1.0.0/ui/switch/switch-1.0.0.css');
CssFiles::register($this, 'exts/base/1.0.0/ui/select2/select2-1.0.0.css');
CssFiles::register($this, 'exts/base/1.0.0/ui/select2/select2-bootstrap-1.0.0.css');
?>
<form action="<?php echo Url::toRoute(['/system/administrators/do-add']); ?>" name="customerForm" id="customerForm" method="post">
<div class="panel panel-default">
<div class="panel-body">
<table class="panel-box-tb">
<tbody>
<tr>
<td class="text-right" style="width: 10%">
<b>可接收信息工程师:</b>
</td>
<td style="width: 75%">
<input type="hidden" value="0" id="engineer_id" name="engineer_id" />
<input class="form-control" id="engineer" name="engineer" placeholder="请录入工程师手机或名称" autocomplete="off" />
</td>
<td style="width: 15%">
<button type="submit" class="btn btn-primary" id="save">添加</button>
<a class="btn btn-default" href="<?php echo Url::toRoute('/system/administrators/index'); ?>">重 置</a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</form>
<form action="<?php echo Url::toRoute(['/system/administrators/index']); ?>" name="customerForm" id="customerForm" method="get">
<div class="panel panel-default">
<div class="panel-body">
<table class="panel-box-tb">
<tbody>
<tr>
<td class="text-right" style="width: 10%">
<b>工程师姓名:</b>
</td>
<td>
<input class="form-control" id="engineerName" name="engineerName" value="<?=$gets["engineerName"]?>" placeholder="请录入工程师名称"/>
</td>
<td class="text-right" style="width: 10%">
<b>手机号码:</b>
</td>
<td>
<input class="form-control" id="engineerPhone" name="engineerPhone" value="<?=$gets["engineerPhone"]?>" placeholder="请录入工程师手机"/>
</td>
<td>
<button type="submit" class="btn btn-primary" id="search">查询</button>
<a class="btn btn-default" href="<?php echo Url::toRoute('/system/administrators/index'); ?>">重 置</a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</form>
<div class="panel panel-default">
<div class="panel-body">
<?php if (!empty($dataList)) : ?>
<div class="table-responsive">
<table class="table table-striped table-bordered" id="brand-table">
<thead>
<tr>
<th style="width:5%;" class="text-center align-middle hqy-row-select">ID</th>
<th style="width:10%;">工程师信息</th>
<th style="width:15%;">是否接收订单通知</th>
<th style="width:15%;">是否可以分享订单</th>
<th style="width:15%;">是否可以接收客服通知</th>
<th style="width:15%;">是否可以接收营销活动通知</th>
<th style="width:10%;">添加时间</th>
<th style="width:15%;">操作</th>
</tr>
</thead>
<tbody>
<?php foreach ($dataList as $data) : ?>
<tr>
<td class="itemcls" data="<?= $data['id'] ?>"><?= $data['id'] ?></td>
<td >
昵称:<?= $data['nickname'] ?> <br/>
真实姓名:<?= $data['realname'] ?> <br/>
手机号码:<?= $data['phone'] ?> <br/>
</td>
<td>
<input type="checkbox" class="switch notify_check_open" data-on-text="是" data-off-text="否" <?php if ($data['is_order_notify'] == 0) echo 'checked' ?> data-id="<?= $data['id'] ?>" />
</td>
<td >
<input type="checkbox"class="switch share_check_open" data-on-text="是" data-off-text="否" <?php if ($data['is_order_share'] == 0) echo 'checked' ?> data-id="<?= $data['id'] ?>"/>
</td>
<td >
<input type="checkbox" class="switch cs_check_open" data-on-text="是" data-off-text="否" <?php if ($data['is_cs_notify'] == 0) echo 'checked' ?> data-id="<?= $data['id'] ?>"/>
</td>
<td >
<input type="checkbox" class="switch activity_check_open" data-on-text="是" data-off-text="否" <?php if ($data['is_activity_notify'] == 0) echo 'checked' ?> data-id="<?= $data['id'] ?>"/>
</td>
<td >
<?= date('Y-m-d H:i:s', $data['created_at']) ?>
</td>
<td class="row_<?= $data['id'] ?>">
<form action="<?php echo Url::toRoute(['/system/administrators/delete']); ?>" name="MyForm<?= $data['id'] ?>" id="MyForm<?= $data['id'] ?>" method="get">
<input type="hidden" id="id" name="id" value="<?= $data['id'] ?>"/>
<button type="submit" class="btn btn-primary" id="delete">删除</button>
</form>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php else : ?>
<p class="text-center">
没有找到数据
</p>
<?php endif; ?>
</div>
<div class="panel-footer">
<div class="hqy-panel-pager">
<?= LinkPager::widget([
'pagination' => $pages,
]); ?>
<div class="clearfix"></div>
</div>
</div>
</div>
<script type="text/javascript" src="<?=Url::toRoute('/exts/base/1.0.0/ui/typeahead/bootstrap3-typeahead.min.js')?>" ></script>
<script>
var searchItemUrl = "<?=Url::toRoute('/system/administrators/search-engineer')?>";
seajs.use("base/1.0.0/ui/switch/switch-1.0.0",function () {
$(".switch").bootstrapSwitch(
{
onSwitchChange: function (event, state) {
var className = event.target.className;
var dataId = event.target.attributes["data-id"].value;
//监听switch change事件,可以根据状态把相应的业务逻辑代码写在这里
/*if (state == true) {
$("#state").html('switch turn no')
} else {
$("#state").html('switch turn off')
}*/
if (className == "switch notify_check_open") {
window.location.href = "<?php echo Url::toRoute(['/system/administrators/enable-order-notify']); ?>" + "?id=" + dataId;
} else if (className == "switch share_check_open") {
window.location.href = "<?php echo Url::toRoute(['/system/administrators/enable-order-share']); ?>" + "?id=" + dataId;
} else if (className == "switch cs_check_open") {
window.location.href = "<?php echo Url::toRoute(['/system/administrators/enable-cs-notify']); ?>" + "?id=" + dataId;
} else if (className == "switch activity_check_open") {
window.location.href = "<?php echo Url::toRoute(['/system/administrators/enable-activity-notify']); ?>" + "?id=" + dataId;
}
}
}
);
$(".switch").bootstrapSwitch('toggleState', true);
});
// 表单提交验证
seajs.use("base/1.0.0/unit/validate/custom-1.0.0",function () {
var validator = $("#customerForm").validate({
});
});
$(document).ready(function () {
$('#engineer').typeahead({
minLength: 1,
items:25,
source: function(query, process) {
var parameter = $.csrf({query: query});
$.post(searchItemUrl, parameter, function (res) {
var data = [];
var iList = res.list;
for(i in iList){
var tItem = iList[i];
data.push(JSON.stringify(tItem));
}
process(data);
},'json');
},
highlighter: function(item) {
var itemObject = JSON.parse(item);
var title = itemObject.name + "(" + itemObject.nickname + ")" + itemObject.phone;
return title ;
},
updater: function(item) {
var itemObject = JSON.parse(item);
var title = itemObject.name + "(" + itemObject.nickname + ")" + itemObject.phone;
$('#engineer_id').val(itemObject.id);
return title;
}
});
$('#engineer').change(function(){
var currV = $(this).val();
if ('' == $.trim(currV)){
$('#engineer_id').val(0);
}
})
});
</script>