添加: 添加交易市场插件

This commit is contained in:
wuhui_zzw 2023-02-22 15:15:08 +08:00
parent 7afb0b1db9
commit bdddeb8347
4 changed files with 156 additions and 0 deletions

View File

@ -0,0 +1,156 @@
{extend name="app/shop/view/base.html"/}
{block name="resources"}
<style>
.prompt-block .prompt {
display: inline-block;
}
.prompt-block .prompt {
width: 18px;
height: 18px;
line-height: 18px;
position: relative;
}
.user-head-img{
width:40px;
height:40px;
margin-right:20px;
}
</style>
{/block}
{block name="main"}
<!-- 顶部操作内容 -->
<div class="single-filter-box top">
<div class="right">
<button class="layui-btn" onclick="addMember()">添加成员</button>
<button class="layui-btn" style="background-color: #009688;" onclick="synchronization(0)">同步开发者</button>
<button class="layui-btn" style="background-color: #FFB800;" onclick="synchronization(1)">同步体验者</button>
</div>
<div class="left"></div>
</div>
<!-- 列表 -->
<table id="listContent" lay-filter="listContent"></table>
<!-- 操作 -->
<script type="text/html" id="operation">
<div class="table-btn">
<a class="layui-btn" lay-event="delete">删除</a>
</div>
</script>
{/block}
{block name="script"}
<script>
var table,
form,
editIframe,
repeat_flag = false;//防重复标识;
layui.use(['form'], function() {
form = layui.form;
form.render();
// 内容获取
table = new Table({
elem: '#listContent',
url: ns.url("aliapp://shop/member/index"),
cols: [[
{align: 'center', field: 'id', title: 'ID', width: '5%', unresize: 'false'},
{align: 'center', field: 'user_id', title: '支付宝用户id', unresize: 'area'},
{align: 'center', field: 'nick_name', title: '昵称', unresize: 'area'},
{
align: 'center', templet: function (d) {
// 成员的状态VALID-有效UNCONFIRMED-未确认TIMEOUT-已经失效REFUSED-用户拒绝
let statusText = '';
switch (d.status) {
case 'VALID': statusText = '有效'; break;
case 'UNCONFIRMED': statusText = '未确认'; break;
case 'TIMEOUT': statusText = '已经失效'; break;
case 'REFUSED': statusText = '用户拒绝'; break;
}
return statusText;
}, title: '状态', unresize: 'false'
},
{align: 'center', field: 'gmt_join', title: '加入时间', unresize: 'area'},
{align: 'center', field: 'logon_id', title: '支付宝账号', unresize: 'area'},
{align: 'center', field: 'gmt_invite', title: '邀请时间', unresize: 'area'},
{
align: 'center', templet: function (d) {
// 角色类型DEVELOPER-开发者EXPERIENCER-体验者
return d.role === 'DEVELOPER' ? '开发者' : '体验者';
}, title: '角色类型', unresize: 'false'
},
{title: '操作', toolbar: '#operation', unresize: 'false', align: 'right'}
]],
});
// 监听工具栏操作
table.tool(function(obj) {
var data = obj.data;
switch (obj.event) {
case 'delete':
delMember(data.id);
break;//删除
}
});
});
// 成员同步
function synchronization(type){
let index = ns.loading('open','同步中,请等待......');
requestApi("aliapp://shop/Member/synchronization",{ type: type },function (res) {
table.reload({
page: {
curr: 1
},
});
layer.close(index);
})
}
// 添加成员
function addMember(){
editIframe = layer.open({
type: 2,
title: '添加名片',
skin: 'layer-tips-class',
area: ['70%','90%'],
content: ns.url("aliapp://shop/Member/addMember", {}),
end: function(){
table.reload({
page: {
curr: 1
},
});
}
});
}
// 删除成员
function delMember(id){
layer.confirm('确定删除成员吗!', {icon: 3, title:'提示'}, function(confirmIndex){
layer.close(confirmIndex);
let index = ns.loading('open','删除中,请等待......');
requestApi("aliapp://shop/Member/delMember",{ id: id },function (res) {
table.reload({
page: {
curr: 1
},
});
layer.close(index);
})
});
}
// 发起请求
function requestApi(api,data,fun){
if (repeat_flag) return false;
repeat_flag = true;
$.ajax({
url: ns.url(api),
data: data,
dataType: 'JSON',
type: 'POST',
success: function(res) {
layer.msg(res.message);
repeat_flag = false;
if(typeof fun === 'function') fun(res);
}
});
}
</script>
{/block}