初始上传
This commit is contained in:
158
addon/wechat/shop/view/fans/fans_tag_list.html
Executable file
158
addon/wechat/shop/view/fans/fans_tag_list.html
Executable file
@@ -0,0 +1,158 @@
|
||||
<style>
|
||||
.layui-table {margin: 0}
|
||||
</style>
|
||||
|
||||
<div>
|
||||
<button class="layui-btn" onclick="addOrEditTag('添加标签')">添加标签</button>
|
||||
<button class="layui-btn" onclick="syncTag()">同步标签</button>
|
||||
</div>
|
||||
<div>
|
||||
<table id="tag_list" lay-filter="tag_list" class="layui-table"></table>
|
||||
</div>
|
||||
|
||||
<script type="text/html" id="operation">
|
||||
<a class="default" lay-event="edit">编辑</a> |
|
||||
<a class="default" lay-event="delete">删除</a> <br/>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="addOrEditTag">
|
||||
<div class="layui-form" lay-filter="otherInfo">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label sm">标签名称</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="tag_name" class="layui-input" value="{{d.tag_name}}" lay-verify="required">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row sm">
|
||||
<button class="layui-btn" lay-submit lay-filter="addOrEditTagSubmit">保存</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary" onclick="back()">返回</button>
|
||||
</div>
|
||||
<input type="hidden" name="id" value="{{d.id}}">
|
||||
<input type="hidden" name="tag_id" value="{{d.tag_id}}">
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
var form,laytpl,index,layer;
|
||||
var table = new Table({
|
||||
elem : '#tag_list',
|
||||
filter : "tag_list",
|
||||
url : "{:addon_url('wechat://shop/fans/fansTagList')}",
|
||||
cols : [
|
||||
[
|
||||
{
|
||||
type : 'checkbox',
|
||||
unresize : 'true'
|
||||
},
|
||||
{
|
||||
field: 'tag_name',
|
||||
title: '标签名称',
|
||||
unresize : 'true'
|
||||
},
|
||||
{
|
||||
title : '操作',
|
||||
toolbar : '#operation',
|
||||
width : '30%',
|
||||
align : 'right',
|
||||
unresize : 'true'
|
||||
}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
table.tool(function(obj){
|
||||
var data = obj.data;
|
||||
switch (obj.event) {
|
||||
case 'edit':
|
||||
addOrEditTag('编辑标签', data);
|
||||
break;
|
||||
case 'delete':
|
||||
deleteTag(data);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
layui.use([ 'form', 'laytpl'], function() {
|
||||
laytpl = layui.laytpl;
|
||||
form = layui.form;
|
||||
form.render();
|
||||
|
||||
var repeat_flag = false;//防重复标识
|
||||
form.on('submit(addOrEditTagSubmit)', function (data) {
|
||||
if (repeat_flag) return;
|
||||
repeat_flag = true;
|
||||
var url = data.field.id > 0 ? '{:addon_url("wechat://shop/fans/editFansTag")}' : '{:addon_url("wechat://shop/fans/addFansTag")}';
|
||||
$.ajax({
|
||||
type: "post",
|
||||
async: false,
|
||||
url: url,
|
||||
dataType: 'json',
|
||||
data: data.field,
|
||||
success: function (res) {
|
||||
back();
|
||||
layer.msg(res.message);
|
||||
if (res.code == 0) {
|
||||
table.reload();
|
||||
}
|
||||
repeat_flag = false;
|
||||
}
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
function addOrEditTag(title, data) {
|
||||
var tpl_data = data == undefined ? {tag_name: '', tag_id: 0, id: 0} : data;
|
||||
laytpl($("#addOrEditTag").html()).render(tpl_data, function (html) {
|
||||
index = layer.open({
|
||||
type: 1,
|
||||
title: title,
|
||||
skin: 'layer-tips-class',
|
||||
area: ['450px'],
|
||||
content: html
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
var repeat_flag_delete = false;//防重复标识
|
||||
function deleteTag(data){
|
||||
if (repeat_flag_delete) return;
|
||||
repeat_flag_delete = true;
|
||||
layer.confirm('确定要删除该标签吗?',function (index) {
|
||||
layer.close(index);
|
||||
$.ajax({
|
||||
type : "post",
|
||||
async : false,
|
||||
url : '{:addon_url("wechat://shop/fans/deleteFansTag")}',
|
||||
dataType: 'json',
|
||||
data : data,
|
||||
success:function(res){
|
||||
layer.msg(res.message);
|
||||
if(res.code == 0){
|
||||
table.reload();
|
||||
}
|
||||
repeat_flag_delete = false;
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function syncTag(){
|
||||
$.ajax({
|
||||
url : '{:addon_url("wechat://shop/fans/syncFansTag")}',
|
||||
dataType: 'json',
|
||||
async : false,
|
||||
type : "post",
|
||||
beforeSend : function(){
|
||||
index = layer.load(2);
|
||||
},
|
||||
success:function(res){
|
||||
back();
|
||||
layer.msg(res.message);
|
||||
if(res.code == 0){
|
||||
table.reload();
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
212
addon/wechat/shop/view/fans/lists.html
Executable file
212
addon/wechat/shop/view/fans/lists.html
Executable file
@@ -0,0 +1,212 @@
|
||||
<link rel="stylesheet" type="text/css" href="SHOP_CSS/member.css" />
|
||||
<link rel="stylesheet" type="text/css" href="WECHAT_CSS/wx_fans.css" />
|
||||
<style>
|
||||
.layui-layout-admin .tips-wrap{margin-bottom: 15px;}
|
||||
</style>
|
||||
|
||||
<div class="single-filter-box">
|
||||
<button class="layui-btn btn-hide" lay-submit="" lay-filter="save" onclick="refresh()">同步粉丝信息</button>
|
||||
<div class="layui-form">
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="nickname" placeholder="请输入粉丝名称" autocomplete="off" class="layui-input">
|
||||
<button type="button" class="layui-btn layui-btn-primary" lay-filter="search" lay-submit>
|
||||
<i class="layui-icon"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-collapse tips-wrap">
|
||||
<div class="layui-colla-item">
|
||||
<h2 class="layui-colla-title">操作提示</h2>
|
||||
<div class="layui-colla-content layui-show">说明:把同步公众号上的实际粉丝数量与信息同步到商城中展示</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 列表 -->
|
||||
<table id="Fans_list" lay-filter="Fans_list"></table>
|
||||
|
||||
<!-- 批量操作 -->
|
||||
<script type="text/html" id="batchOperation">
|
||||
</script>
|
||||
|
||||
<!-- 地址 -->
|
||||
<script type="text/html" id="diqu">
|
||||
<p>{{d.country}}{{d.province}}{{d.city}}{{ d.district != '' && d.district != '无' ? d.district : '' }}</p>
|
||||
</script>
|
||||
|
||||
<!-- 操作 -->
|
||||
<script type="text/html" id="operation">
|
||||
<div class="table-btn">
|
||||
<a class="layui-btn" href="" lay-event="">查看消息</a>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<!-- 用户信息 -->
|
||||
<script type="text/html" id="fansMessage">
|
||||
<div class='table-title'>
|
||||
<div class='title-pic'>
|
||||
{{# if(d.headimgurl){ }}
|
||||
<img layer-src src={{ns.img(d.headimgurl)}} class="head-portrait">
|
||||
{{# } }}
|
||||
</div>
|
||||
<div class='title-content'>
|
||||
<p class="layui-elip">用户名:{{d.nickname}}</p>
|
||||
{{# if(d.sex == 1){ }}
|
||||
<p class="layui-elip">性别:男</p>
|
||||
{{# }else{ }}
|
||||
<p class="layui-elip">性别:女</p>
|
||||
{{# } }}
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<!-- 用户来源 -->
|
||||
<script type="text/html" id="subscribe_scene">
|
||||
{{# if(d.subscribe_scene == 'ADD_SCENE_SEARCH'){ }}
|
||||
<p>公众号搜索</p>
|
||||
{{# } }}
|
||||
{{# if(d.subscribe_scene == 'ADD_SCENE_ACCOUNT_MIGRATION'){ }}
|
||||
<p>公众号迁移</p>
|
||||
{{# } }}
|
||||
{{# if(d.subscribe_scene == 'ADD_SCENE_PROFILE_CARD'){ }}
|
||||
<p>名片分享</p>
|
||||
{{# } }}
|
||||
{{# if(d.subscribe_scene == 'ADD_SCENE_QR_CODE'){ }}
|
||||
<p>扫描二维码</p>
|
||||
{{# } }}
|
||||
|
||||
{{# if(d.subscribe_scene == 'ADD_SCENE_PROFILE_LINK'){ }}
|
||||
<p>图文页内名称点击</p>
|
||||
{{# } }}
|
||||
|
||||
{{# if(d.subscribe_scene == 'ADD_SCENE_PROFILE_ITEM'){ }}
|
||||
<p>图文页右上角菜单</p>
|
||||
{{# } }}
|
||||
|
||||
{{# if(d.subscribe_scene == 'ADD_SCENE_PAID'){ }}
|
||||
<p>支付后关注</p>
|
||||
{{# } }}
|
||||
|
||||
{{# if(d.subscribe_scene == 'ADD_SCENE_OTHERS '){ }}
|
||||
<p>其他</p>
|
||||
{{# } }}
|
||||
|
||||
</script>
|
||||
|
||||
<div class="progress-layer">
|
||||
<h3>正在同步中,已完成...</h3>
|
||||
<div class="layui-progress layui-progress-big" lay-showPercent="true" lay-filter="progress">
|
||||
<div class="layui-progress-bar layui-bg-blue" lay-percent="0%"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
layui.use(['form', 'element'], function() {
|
||||
var table,
|
||||
form = layui.form;
|
||||
form.render();
|
||||
|
||||
table = new Table({
|
||||
elem: '#Fans_list',
|
||||
url: ns.url("wechat://shop/fans/lists"),
|
||||
page: true,
|
||||
cols: [
|
||||
[{
|
||||
title: '粉丝信息',
|
||||
width: '30%',
|
||||
unresize: 'false',
|
||||
templet: '#fansMessage'
|
||||
}, {
|
||||
field: 'subscribe_time',
|
||||
title: '关注时间',
|
||||
width: '20%',
|
||||
unresize: 'false',
|
||||
templet: function(data) {
|
||||
return ns.time_to_date(data.subscribe_time);
|
||||
}
|
||||
}, {
|
||||
field: 'country',
|
||||
title: '详细地址',
|
||||
width: '30%',
|
||||
unresize: 'false',
|
||||
templet:'#diqu'
|
||||
}, {
|
||||
field: 'subscribe_scene',
|
||||
title: '粉丝来源',
|
||||
width: '20%',
|
||||
unresize: 'false',
|
||||
templet:'#subscribe_scene'
|
||||
}]
|
||||
]
|
||||
});
|
||||
/**
|
||||
* 搜索功能
|
||||
*/
|
||||
form.on('submit(search)', function(data) {
|
||||
table.reload({
|
||||
page: {
|
||||
curr: 1
|
||||
},
|
||||
where: data.field
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// 更新粉丝列表
|
||||
var repeat_flag = false;//防重复标识
|
||||
var page_index = 0;
|
||||
var page_count = 0;
|
||||
var progress_element;
|
||||
layui.use('element', function(){
|
||||
progress_element = layui.element;
|
||||
});
|
||||
|
||||
function refresh() {
|
||||
if(repeat_flag) return;
|
||||
repeat_flag = true;
|
||||
$.ajax({
|
||||
type : "post",
|
||||
url : "{:addon_url('wechat://shop/fans/syncWechatFans')}",
|
||||
data : {
|
||||
"page" : page_index,
|
||||
},
|
||||
dataType : "JSON",
|
||||
beforeSend : function() {
|
||||
$(".progress-layer").fadeIn();
|
||||
},
|
||||
success : function(data) {
|
||||
repeat_flag = false;
|
||||
if (data.code != 0 && data.message != undefined && data.message != '') {
|
||||
layer.msg(data.message);
|
||||
$(".progress-layer").fadeOut();
|
||||
} else if (data.code == 0) {
|
||||
if (page_index == 0) page_count = data['data']["page_count"];
|
||||
|
||||
page_index += 1;
|
||||
if (data.data == null) {
|
||||
$(".progress-layer").fadeOut();
|
||||
}
|
||||
|
||||
if (page_index <= page_count) {
|
||||
var speed_of_progress = (page_index / page_count * 100).toFixed(2);
|
||||
progress_element.progress('progress', speed_of_progress + '%');
|
||||
}
|
||||
if (page_index <= page_count) {
|
||||
repeat_flag = false;
|
||||
refresh();
|
||||
} else {
|
||||
listenerHash(); // 刷新页面
|
||||
layer.closeAll();
|
||||
}
|
||||
} else {
|
||||
layer.msg('更新失败');
|
||||
$(".progress-layer").fadeOut();
|
||||
}
|
||||
},
|
||||
error: function (e) {
|
||||
layer.msg('更新失败');
|
||||
$(".progress-layer").fadeOut();
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user