提交 f3cb46cc 编写于 作者: doc_wei's avatar doc_wei

新增我录入的会员功能

上级 842ec1c8
var rowId = "";
var memberMation = {};
layui.config({
base: basePath,
version: skyeyeVersion
}).extend({
window: 'js/winui.window'
}).define(['window', 'table', 'jquery', 'winui', 'form'], function (exports) {
winui.renderColor();
var $ = layui.$,
form = layui.form,
table = layui.table;
authBtn('1645535320880');
table.render({
id: 'messageTable',
elem: '#messageTable',
method: 'post',
url: shopBasePath + 'queryMyWriteMemberList',
where: getTableParams(),
even: true,
page: true,
limits: getLimits(),
limit: getLimit(),
cols: [[
{ title: systemLanguage["com.skyeye.serialNumber"][languageType], fixed: 'left', type: 'numbers'},
{ field: 'contacts', title: '会员称呼', align: 'left', width: 140, fixed: 'left', templet: function(d){
return '<a lay-event="select" class="notice-title-click">' + d.contacts + '</a>';
}},
{ field: 'phone', title: '联系电话', align: 'center', width: 100},
{ field: 'email', title: '电子邮箱', align: 'left', width: 120},
{ field: 'address', title: '地址', align: 'left', width: 100},
{ field: 'enabled', title: '状态', align: 'center', width: 80, templet: function(d){
return shopUtil.getEnableStateName(d.enabled);
}},
{ title: systemLanguage["com.skyeye.operation"][languageType], fixed: 'right', align: 'center', width: 300, toolbar: '#tableBar'}
]],
done: function(){
matchingLanguage();
}
});
table.on('tool(messageTable)', function (obj) {
var data = obj.data;
var layEvent = obj.event;
if (layEvent === 'edit') { //编辑
editmember(data);
}else if (layEvent === 'delete') { //删除
deletemember(data);
}else if (layEvent === 'enabled') { //启用
editEnabled(data);
}else if(layEvent == 'unenabled'){ //禁用
editNotEnabled(data)
}else if(layEvent == 'select'){ //详情
selectMember(data)
}
});
// 编辑
function editmember(data){
rowId = data.id;
_openNewWindows({
url: "../../tpl/member/memberEdit.html",
title: "编辑会员",
pageId: "memberEdit",
area: ['90vw', '90vh'],
callBack: function(refreshCode){
if (refreshCode == '0') {
winui.window.msg(systemLanguage["com.skyeye.successfulOperation"][languageType], {icon: 1,time: 2000});
loadTable();
} else if (refreshCode == '-9999') {
winui.window.msg(systemLanguage["com.skyeye.operationFailed"][languageType], {icon: 2,time: 2000});
}
}});
}
// 删除会员
function deletemember(data){
layer.confirm(systemLanguage["com.skyeye.deleteOperationMsg"][languageType], {icon: 3, title: systemLanguage["com.skyeye.deleteOperation"][languageType]}, function(index){
layer.close(index);
AjaxPostUtil.request({url: shopBasePath + "member004", params: {rowId: data.id}, type: 'json', method: "POST", callback: function(json){
if(json.returnCode == 0){
winui.window.msg(systemLanguage["com.skyeye.deleteOperationSuccessMsg"][languageType], {icon: 1, time: 2000});
loadTable();
}else{
winui.window.msg(json.returnMessage, {icon: 2, time: 2000});
}
}});
});
}
// 设置启用状态
function editEnabled(data){
layer.confirm('确认要更改该会员为启用状态吗?', { icon: 3, title: '状态变更' }, function (index) {
AjaxPostUtil.request({url: shopBasePath + "member006", params: {rowId: data.id}, type: 'json', method: "PUT", callback: function(json){
if(json.returnCode == 0){
winui.window.msg("设置成功。", {icon: 1, time: 2000});
loadTable();
}else{
winui.window.msg(json.returnMessage, {icon: 2, time: 2000});
}
}});
});
}
// 设置禁用状态
function editNotEnabled(data){
layer.confirm('确认要更改该会员为禁用状态吗?', { icon: 3, title: '状态变更' }, function (index) {
AjaxPostUtil.request({url: shopBasePath + "member007", params: {rowId: data.id}, type: 'json', method: "PUT", callback: function(json){
if(json.returnCode == 0){
winui.window.msg("设置成功。", {icon: 1, time: 2000});
loadTable();
}else{
winui.window.msg(json.returnMessage, {icon: 2, time: 2000});
}
}});
});
}
// 详情
function selectMember(data){
rowId = data.id;
_openNewWindows({
url: "../../tpl/member/memberInfo.html",
title: systemLanguage["com.skyeye.detailsPageTitle"][languageType],
pageId: "memberinfo",
area: ['90vw', '90vh'],
callBack: function(refreshCode){
}
});
}
// 添加会员
$("body").on("click", "#addBean", function(){
_openNewWindows({
url: "../../tpl/member/memberAdd.html",
title: "新增会员",
pageId: "memberAdd",
area: ['90vw', '90vh'],
callBack: function(refreshCode){
if (refreshCode == '0') {
winui.window.msg(systemLanguage["com.skyeye.successfulOperation"][languageType], {icon: 1,time: 2000});
loadTable();
} else if (refreshCode == '-9999') {
winui.window.msg(systemLanguage["com.skyeye.operationFailed"][languageType], {icon: 2,time: 2000});
}
}});
});
form.render();
form.on('submit(formSearch)', function (data) {
if (winui.verifyForm(data.elem)) {
table.reload("messageTable", {page: {curr: 1}, where: getTableParams()})
}
return false;
});
$("body").on("click", "#reloadTable", function() {
loadTable();
});
// 刷新
function loadTable(){
table.reload("messageTable", {where: getTableParams()});
}
function getTableParams(){
return {
contacts: $("#contacts").val(),
phone: $("#phone").val(),
email: $("#email").val(),
enabled: $("#enabled").val()
};
}
exports('myWriteMemberList', {});
});
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<link href="../../assets/lib/layui/css/layui.css" rel="stylesheet" />
<link href="../../assets/lib/winui/css/winui.css" rel="stylesheet" />
</head>
<body>
<div class="txtcenter" style="margin:0 auto;padding-top:10px;">
<form class="layui-form layui-form-pane" action="" autocomplete="off">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">会员称呼</label>
<div class="layui-input-inline">
<input type="text" id="contacts" name="contacts" placeholder="请输入会员称呼" class="layui-input" />
</div>
<label class="layui-form-label">手机号码</label>
<div class="layui-input-inline">
<input type="text" id="phone" name="phone" placeholder="请输入手机号码" class="layui-input" />
</div>
<label class="layui-form-label">电子邮箱</label>
<div class="layui-input-inline">
<input type="text" id="email" name="email" placeholder="请输入电子邮箱" class="layui-input" />
</div>
<label class="layui-form-label"><language showName="com.skyeye.state"></language></label>
<div class="layui-input-inline">
<select id="enabled" name="enabled">
<option value="">全部</option>
<option value="1">启用</option>
<option value="2">禁用</option>
</select>
</div>
<button type="reset" class="layui-btn layui-btn-primary list-form-search"><language showName="com.skyeye.reset"></language></button>
<button class="layui-btn list-form-search" lay-submit lay-filter="formSearch"><language showName="com.skyeye.search2"></language></button>
</div>
</div>
</form>
</div>
<div class="winui-toolbar">
<div class="winui-tool">
<button id="reloadTable" class="winui-toolbtn"><i class="fa fa-refresh" aria-hidden="true"></i><language showName="com.skyeye.refreshDataBtn"></language></button>
<button id="addBean" class="winui-toolbtn" auth="1645535320880"><i class="fa fa-plus" aria-hidden="true"></i><language showName="com.skyeye.addBtn"></language></button>
</div>
</div>
<div style="margin:auto 10px;">
<table id="messageTable" lay-filter="messageTable"></table>
<script type="text/html" id="tableBar">
{{# if(d.enabled == 2 && auth('1645535338174')){ }}
<a class="layui-btn layui-btn-xs" lay-event="edit"><language showName="com.skyeye.editBtn"></language></a>
{{# } }}
{{# if(d.enabled == 2 && auth('1645535281417')){ }}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="delete"><language showName="com.skyeye.deleteBtn"></language></a>
{{# } }}
{{# if(d.enabled == 1 && auth('1645535298928')){ }}
<a class="layui-btn layui-btn-xs" lay-event="unenabled"><language showName="com.skyeye.disableBtn"></language></a>
{{# } }}
{{# if(d.enabled == 2 && auth('1645535290395')){ }}
<a class="layui-btn layui-btn-xs" lay-event="enabled"><language showName="com.skyeye.enableBtn"></language></a>
{{# } }}
</script>
</div>
<script src="../../assets/lib/layui/layui.js"></script>
<script src="../../assets/lib/layui/custom.js"></script>
<script type="text/javascript">
layui.config({base: '../../js/member/'}).use('myWriteMemberList');
</script>
</body>
</html>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册