Files
YwxAppThink/addon/appmall/view/backend/addonreview/index.html
T

122 lines
5.8 KiB
HTML

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<title>插件审核 - 应用市场管理</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="/assets/layui/css/layui.css" rel="stylesheet">
<link href="/assets/ywxapp/css/wxapp.css" rel="stylesheet">
<style>body{background:#f2f3f5;padding:15px;}</style>
</head>
<body>
<form class="layui-form" lay-filter="filterForm">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">状态</label>
<div class="layui-input-inline" style="width:140px;">
<select name="status">
<option value="">全部</option>
<option value="0">待审核</option>
<option value="1">已通过</option>
<option value="2">已驳回</option>
</select>
</div>
</div>
<button class="layui-btn" lay-submit lay-filter="search">搜索</button>
</div>
</form>
<table id="dataTable" lay-filter="dataTable"></table>
<script type="text/html" id="statusTpl">
{{# if(d.status == 0){ }}<span class="layui-badge layui-bg-orange">待审核</span>
{{# } else if(d.status == 1){ }}<span class="layui-badge layui-bg-green">已通过</span>
{{# } else { }}<span class="layui-badge">已驳回</span>{{# } }}
</script>
<script type="text/html" id="operateTpl">
<a class="layui-btn layui-btn-xs" href="download?id={{ d.id }}" target="_blank">下载包</a>
{{# if(d.status == 0){ }}
<a class="layui-btn layui-btn-xs layui-btn-normal" lay-event="approve">通过并发布</a>
<a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="reject">驳回</a>
{{# } }}
<a class="layui-btn layui-btn-xs layui-btn-warm" lay-event="price">改价</a>
<a class="layui-btn layui-btn-xs" lay-event="detail">查看详情</a>
</script>
<script src="/assets/layui/layui.js"></script>
<script src="/assets/ywxapp/ywxapp.js" module="{$site.app}"></script>
<script>
layui.use(['table', 'form', 'layer', 'jquery', 'http'], function () {
var table = layui.table, form = layui.form, layer = layui.layer, $ = layui.jquery, http = layui.http;
table.render({
elem: '#dataTable',
url: 'index',
page: true,
limits: [10, 20, 50],
limit: 10,
cols: [[
{ field: 'id', title: 'ID', width: 70 },
{ field: 'name', title: '标识', width: 120 },
{ field: 'type', title: '类型', width: 80, templet: function (d) {
return d.type === 'template'
? '<span class="layui-badge" style="background:#722ed1;">模板</span>'
: '<span class="layui-badge layui-bg-blue">插件</span>';
} },
{ field: 'title', title: '名称', minWidth: 140 },
{ field: 'author', title: '作者', width: 120 },
{ field: 'version', title: '版本', width: 90 },
{ field: 'price', title: '价格', width: 90, templet: function (d) { return d.price > 0 ? '¥' + d.price : '免费'; } },
{ field: 'status', title: '状态', width: 90, templet: '#statusTpl' },
{ field: 'reject_reason', title: '驳回原因', minWidth: 160 },
{ field: 'create_at', title: '提交时间', width: 170, templet: function (d) { return d.create_at ? new Date(d.create_at * 1000).toLocaleString() : ''; } },
{ title: '操作', width: 240, toolbar: '#operateTpl', fixed: 'right' }
]],
response: { statusName: 'code', statusCode: 0, msgName: 'message', countName: 'count', dataName: 'data' }
});
form.on('submit(search)', function (data) {
table.reload('dataTable', { where: data.field, page: { curr: 1 } });
return false;
});
table.on('tool(dataTable)', function (elem) {
var d = elem.data;
if (elem.event === 'approve') {
layer.confirm('确认通过该插件并发布到市场?', function () {
http.post('approve', { id: d.id }).then(function (r) {
if (r.code === 0) { layer.msg('已通过并发布', { icon: 1 }); table.reload('dataTable'); }
else { layer.msg(r.message || '操作失败', { icon: 2 }); }
}).catch(function () { layer.msg('请求失败', { icon: 2 }); });
});
} else if (elem.event === 'reject') {
layer.prompt({ title: '驳回原因', formType: 2 }, function (val, idx) {
http.post('reject', { id: d.id, reason: val }).then(function (r) {
if (r.code === 0) { layer.close(idx); layer.msg('已驳回', { icon: 1 }); table.reload('dataTable'); }
else { layer.msg(r.message || '操作失败', { icon: 2 }); }
}).catch(function () { layer.msg('请求失败', { icon: 2 }); });
});
} else if (elem.event === 'detail') {
layer.open({
type: 2,
title: '审核详情 #' + d.id,
area: ['720px', '80%'],
content: 'detailview?id=' + d.id
});
} else if (elem.event === 'price') {
layer.prompt({ title: '修改「' + d.name + '」价格(0 为免费,同步全部版本)', value: d.price || '0' }, function (val, idx) {
var p = parseFloat(val);
if (isNaN(p) || p < 0) { layer.msg('请输入不小于 0 的价格', { icon: 2 }); return; }
http.post('updatePrice', { name: d.name, price: p }).then(function (r) {
if (r.code === 0) { layer.close(idx); layer.msg(r.message || '价格已更新', { icon: 1 }); table.reload('dataTable'); }
else { layer.msg(r.message || '操作失败', { icon: 2 }); }
}).catch(function () { layer.msg('请求失败', { icon: 2 }); });
});
}
});
});
</script>
</body>
</html>