109 lines
2.8 KiB
HTML
109 lines
2.8 KiB
HTML
{extend name="app/shop/view/base.html" /}
|
|
{block name="resources"}
|
|
<style type="text/css">
|
|
.wechatid-input {width: 250px;margin-right: 10px;}
|
|
.single-filter-box {justify-content: unset;}
|
|
.align-center {justify-content: center;}
|
|
</style>
|
|
{/block}
|
|
|
|
{block name="main"}
|
|
<div class="single-filter-box">
|
|
<input type="text" name="" class="layui-input wechatid-input" placeholder="请输入体验者微信号">
|
|
<button class="layui-btn bg-color" onclick="add()">添加体验者</button>
|
|
</div>
|
|
<table id="test_user" lay-filter="test_user"></table>
|
|
<!-- 操作 -->
|
|
<script type="text/html" id="operation">
|
|
<div class="table-btn align-center">
|
|
<a class="layui-btn" lay-event="unbind">解绑</a>
|
|
</div>
|
|
</script>
|
|
{/block}
|
|
{block name="script"}
|
|
<script type="text/javascript">
|
|
var table;
|
|
layui.use([], function() {
|
|
|
|
table = new Table({
|
|
elem: '#test_user',
|
|
url: ns.url("wxoplatform://shop/weapp/experiencer"),
|
|
cols: [
|
|
[
|
|
{
|
|
field: 'wechatid',
|
|
title: '体验者微信号',
|
|
unresize: 'false',
|
|
width: '33%'
|
|
},
|
|
{
|
|
title: '绑定时间',
|
|
unresize: 'false',
|
|
width: '33%',
|
|
templet: function(data){
|
|
return data.create_time ? ns.time_to_date(data.create_time) : '-'
|
|
}
|
|
},
|
|
{
|
|
title: '操作',
|
|
toolbar: '#operation',
|
|
unresize: 'false',
|
|
width: '34%',
|
|
align: 'center'
|
|
}
|
|
]
|
|
],
|
|
});
|
|
|
|
/**
|
|
* 监听工具栏操作
|
|
*/
|
|
table.tool(function(obj) {
|
|
var data = obj.data;
|
|
switch (obj.event) {
|
|
case 'unbind':
|
|
$.ajax({
|
|
type: "post",
|
|
url: "{:addon_url('wxoplatform://shop/weapp/unbindTestUser')}",
|
|
dataType: "JSON",
|
|
data: {
|
|
id: data.id
|
|
},
|
|
success: function (res) {
|
|
layer.msg(res.message);
|
|
if (res.code >= 0) {
|
|
table.reload({ page: { curr: 1 } });
|
|
}
|
|
}
|
|
});
|
|
break;
|
|
}
|
|
});
|
|
});
|
|
|
|
// 添加体验者
|
|
function add(){
|
|
var wechatid = $('.wechatid-input').val();
|
|
if (wechatid.trim().length == 0) {
|
|
layer.msg('请输入体验者微信号');
|
|
return;
|
|
}
|
|
|
|
$.ajax({
|
|
type: "post",
|
|
url: "{:addon_url('wxoplatform://shop/weapp/bindTestUser')}",
|
|
dataType: "JSON",
|
|
data: {
|
|
wechatid: wechatid
|
|
},
|
|
success: function (res) {
|
|
layer.msg(res.message);
|
|
if (res.code >= 0) {
|
|
$('.wechatid-input').val('');
|
|
table.reload({ page: { curr: 1 } });
|
|
}
|
|
}
|
|
});
|
|
}
|
|
</script>
|
|
{/block} |