初始上传
This commit is contained in:
397
addon/shopcomponent/shop/view/category/index.html
Executable file
397
addon/shopcomponent/shop/view/category/index.html
Executable file
@@ -0,0 +1,397 @@
|
||||
<style>
|
||||
.progress-layer {width:400px;background:#fff;position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);box-shadow:1px 1px 50px rgba(0,0,0,.3);padding:20px 20px;z-index:100;display:none;}
|
||||
.progress-layer h3 {line-height:1;margin-bottom:15px;text-align:center;font-size:14px;}
|
||||
.progress-layer .layui-progress-big,.progress-layer .layui-progress-big .layui-progress-bar {height:14px;line-height:14px;}
|
||||
.progress-layer .layui-progress-text {line-height:14px;}
|
||||
.goods-info {padding: 5px 0;align-items: center;flex-wrap:unset!important;}
|
||||
.goods-info .room-name {padding-left: 5px;line-height: 1}
|
||||
.goods-info img {width:50px;height: 50px;}
|
||||
.single-filter-box{display: flex; justify-content: space-between}
|
||||
.category-search {padding: 20px;}
|
||||
.search-item {margin-bottom: 20px;display: flex;justify-content: space-between;}
|
||||
.item-right select {margin-right: 20px;width: 80px; height: 25px;}
|
||||
.qualification {line-height: 1.5;background: #f5f5f5;color: #999;font-size: 12px;padding: 10px;border: 1px solid #eee;border-radius: 2px}
|
||||
.layui-form-label{width: 205px}
|
||||
.reject-reason {height: 100%;padding-bottom: 20px;}
|
||||
</style>
|
||||
|
||||
<div class="single-filter-box">
|
||||
<button class="layui-btn" onclick="sync()">同步类目库</button>
|
||||
<div class="layui-form">
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="keywords" 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>
|
||||
<!-- <a href="{:href_url('live://shop/goods/add')}" class="layui-btn layui-btn-primary">添加商品</a>-->
|
||||
</div>
|
||||
<table id="category_list" lay-filter="category_list"></table>
|
||||
|
||||
<!-- 修改服务类目弹出层 -->
|
||||
<script type="text/html" id="sev">
|
||||
<div class="goods-service">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">服务类目:</label>
|
||||
<div class="layui-input-block">
|
||||
<p>{{d.leimu}}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>营业执照或组织机构代码证:</label>
|
||||
<div class="layui-input-block img-upload">
|
||||
<div class="upload-img-block">
|
||||
<div class="upload-img-box {{# if (d.license){ }}hover{{# } }}">
|
||||
<div class="upload-default" id="license">
|
||||
{{# if(d.license){ }}
|
||||
<div id="preview_licenseUpload" class="preview_img">
|
||||
<img layer-src src="{{ ns.img(d.license)}}" class="img_prev"/>
|
||||
</div>
|
||||
{{# }else{ }}
|
||||
<div class="upload">
|
||||
<i class="iconfont iconshangchuan"></i>
|
||||
<p>上传资质</p>
|
||||
</div>
|
||||
{{# } }}
|
||||
</div>
|
||||
<div class="operation">
|
||||
<div>
|
||||
<i title="图片预览" class="iconfont iconreview js-preview" style="margin-right: 20px;"></i>
|
||||
<i title="删除图片" class="layui-icon layui-icon-delete js-delete"></i>
|
||||
</div>
|
||||
<div class="replace_img js-replace">点击替换</div>
|
||||
</div>
|
||||
<input type="hidden" name="license" id="zhengshu" value="{{# if(d.license){ }}{{d.license}}{{# } }}" lay-verify="license"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{# if(d.qualification_type !=0){ }}
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">{{# if(d.qualification_type==1){ }}*{{# } }}</span>上传类目资质:</label>
|
||||
<div class="layui-input-block">
|
||||
<p class="qualification">{{d.qualification}}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"></label>
|
||||
<div class="layui-input-block img-upload">
|
||||
<div class="upload-img-block">
|
||||
<div class="upload-img-box {{# if (d.certificate){ }}hover{{# } }}">
|
||||
<div class="upload-default" id="category">
|
||||
{{# if(d.certificate){ }}
|
||||
<div id="preview_categoryUpload" class="preview_img">
|
||||
<img layer-src src="{{ ns.img(d.certificate)}}" class="img_prev"/>
|
||||
</div>
|
||||
{{# }else{ }}
|
||||
<div class="upload">
|
||||
<i class="iconfont iconshangchuan"></i>
|
||||
<p>上传资质</p>
|
||||
</div>
|
||||
{{# } }}
|
||||
</div>
|
||||
<div class="operation">
|
||||
<div>
|
||||
<i title="图片预览" class="iconfont iconreview js-preview" style="margin-right: 20px;"></i>
|
||||
<i title="删除图片" class="layui-icon layui-icon-delete js-delete"></i>
|
||||
</div>
|
||||
<div class="replace_img js-replace">点击替换</div>
|
||||
</div>
|
||||
<input type="hidden" name="category" id="leimu_qualification" value="{{# if(d.certificate){ }}{{d.certificate}}{{# } }}" lay-verify="category"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="word-aux">类目资质示例可到<a href="https://developers.weixin.qq.com/doc/ministore/minishopspecification/leimuzizhi/qiyeleimu.html" class="text-color" target="_blank">《非个人主体开放类目资质要求》</a>中查看</div>
|
||||
</div>
|
||||
{{# } }}
|
||||
{{# if(d.product_qualification_type !=0){ }}
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">{{# if(d.product_qualification_type==1){ }}*{{# } }}</span>上传商品资质:</label>
|
||||
<div class="layui-input-block">
|
||||
<p class="qualification">{{d.product_qualification}}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"></label>
|
||||
<div class="layui-input-block img-upload">
|
||||
<div class="upload-img-block">
|
||||
<div class="upload-img-box {{# if (d.qualification_pics){ }}hover{{# } }}" >
|
||||
<div class="upload-default" id="product">
|
||||
{{# if(d.qualification_pics){ }}
|
||||
<div id="preview_productUpload" class="preview_img">
|
||||
<img layer-src src="{{ ns.img(d.qualification_pics)}}" class="img_prev"/>
|
||||
</div>
|
||||
{{# }else{ }}
|
||||
<div class="upload">
|
||||
<i class="iconfont iconshangchuan"></i>
|
||||
<p>上传资质</p>
|
||||
</div>
|
||||
{{# } }}
|
||||
</div>
|
||||
<div class="operation">
|
||||
<div>
|
||||
<i title="图片预览" class="iconfont iconreview js-preview" style="margin-right: 20px;"></i>
|
||||
<i title="删除图片" class="layui-icon layui-icon-delete js-delete"></i>
|
||||
</div>
|
||||
<div class="replace_img js-replace">点击替换</div>
|
||||
</div>
|
||||
<input type="hidden" name="product" id="product_qualification" value="{{# if(d.qualification_pics){ }}{{d.qualification_pics}}{{# } }}" lay-verify="product"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="word-aux">商品资质示例可到<a href="https://developers.weixin.qq.com/doc/ministore/minishopspecification/leimuzizhi/qiyeshangpin.html" class="text-color" target="_blank">《非个人主体开放类目商品资质要求》</a>中查看</div>
|
||||
</div>
|
||||
{{# } }}
|
||||
</div>
|
||||
</script>
|
||||
<script type="text/html" id="reason">
|
||||
<div class="reject-reason">{{d.reject_reason}}</div>
|
||||
</script>
|
||||
|
||||
<!-- 操作 -->
|
||||
<script type="text/html" id="operation">
|
||||
<div class="table-btn">
|
||||
{{# if(d.status!=1){ }}
|
||||
{{# if( (d.qualification_type != 0) || (d.product_qualification_type != 0) ){ }}
|
||||
<a class="layui-btn" lay-event="audit">上传资质</a>
|
||||
{{# } }}
|
||||
{{# } }}
|
||||
{{# if(d.status==9){ }}
|
||||
<a class="layui-btn" lay-event="reason">查看失败原因</a>
|
||||
{{# } }}
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<div class="progress-layer">
|
||||
<!-- <h3>正在同步中...</h3>-->
|
||||
<div class="layui-progress layui-progress-big" lay-showPercent="false" lay-filter="progress">
|
||||
<!-- <div class="layui-progress-bar layui-bg-blue" lay-percent="0%"></div>-->
|
||||
<div class="layui-anim" data-anim="layui-anim-rotate layui-anim-loop">正在同步中...</div>
|
||||
<!-- <div class="code">追加:layui-anim-loop</div>-->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var laytpl;
|
||||
var layer;
|
||||
var form,table,element,syncClick = false,repeat_flag = false;
|
||||
layui.use(['form','layer','laytpl' ,'element'], function() {
|
||||
form = layui.form;
|
||||
laytpl = layui.laytpl;
|
||||
var layer = layui.layer;
|
||||
element = layui.element;
|
||||
|
||||
/**
|
||||
* 搜索功能
|
||||
*/
|
||||
form.on('submit(search)', function(data) {
|
||||
table.reload({
|
||||
page: {
|
||||
curr: 1
|
||||
},
|
||||
where: data.field
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
table = new Table({
|
||||
elem: '#category_list',
|
||||
url: ns.url("shopcomponent://shop/category/lists"),
|
||||
where: {
|
||||
"keywords": $(".keywords").val(),
|
||||
"third_cat_id" : "{$third_cat_id}",
|
||||
{notempty name="$third_cat_id"}"page": 1{/notempty}
|
||||
},
|
||||
cols: [
|
||||
[{
|
||||
title: '类目',
|
||||
unresize: 'false',
|
||||
width: '30%',
|
||||
field: 'leimu'
|
||||
}, {
|
||||
title: '类目资质',
|
||||
unresize: 'false',
|
||||
width: '15%',
|
||||
field: 'qualification_type_name'
|
||||
},{
|
||||
title: '商品资质',
|
||||
unresize: 'false',
|
||||
width: '15%',
|
||||
field: 'product_qualification_type_name'
|
||||
}, {
|
||||
field: 'audit_time',
|
||||
title: '审核时间',
|
||||
unresize: 'false',
|
||||
width: '15%',
|
||||
}, {
|
||||
field: 'status_name',
|
||||
title: '审核状态',
|
||||
unresize: 'false',
|
||||
width: '10%',
|
||||
}, {
|
||||
title: '操作',
|
||||
toolbar: '#operation',
|
||||
unresize: 'false',
|
||||
align:'right'
|
||||
}]
|
||||
]
|
||||
});
|
||||
|
||||
table.tool(function(obj) {
|
||||
var data = obj.data;
|
||||
switch (obj.event) {
|
||||
case 'audit': //上传资质
|
||||
laytpl($("#sev").html()).render(data, function(html) {
|
||||
layer.open({
|
||||
type: 1,
|
||||
shadeClose: true,
|
||||
shade: 0.3,
|
||||
offset: 'auto',
|
||||
scrollbar: true,
|
||||
fixed: false,
|
||||
title: "上传资质",
|
||||
area: ['800px', 'auto'],
|
||||
btn: ['确认', '取消'],
|
||||
content: html,
|
||||
yes: function(){
|
||||
var first_cat_id = data.first_cat_id;
|
||||
var second_cat_id = data.second_cat_id;
|
||||
var third_cat_id = data.third_cat_id;
|
||||
var zhengshu =$('#zhengshu').val();
|
||||
var leimu_qualification =$('#leimu_qualification').val();
|
||||
var product_qualification =$('#product_qualification').val();
|
||||
if (repeat_flag) return;
|
||||
repeat_flag = true;
|
||||
$.ajax({
|
||||
url: ns.url("shopcomponent://shop/category/qualifications"),
|
||||
data: {first_cat_id:first_cat_id,second_cat_id:second_cat_id,third_cat_id:third_cat_id,zhengshu:zhengshu,leimu_qualification:leimu_qualification,product_qualification:product_qualification},
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function(res) {
|
||||
repeat_flag = false;
|
||||
if (res.code == 0) {
|
||||
layer.confirm('操作成功', {
|
||||
title: '操作提示',
|
||||
btn: ['返回列表', '继续操作'],
|
||||
yes: function(index, layero) {
|
||||
location.hash = ns.hash("shopcomponent://shop/category/lists")
|
||||
layer.closeAll()
|
||||
},
|
||||
btn2: function(index, layero) {
|
||||
listenerHash(); // 刷新页面
|
||||
layer.closeAll();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
layer.msg(res.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
success: function(){
|
||||
form.render();
|
||||
|
||||
var categoryUpload = new Upload({
|
||||
elem: '#category'
|
||||
});
|
||||
var productUpload = new Upload({
|
||||
elem: '#product'
|
||||
});
|
||||
var licenseUpload = new Upload({
|
||||
elem: '#license'
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
break;
|
||||
case 'reason': //查看失败原因
|
||||
laytpl($("#reason").html()).render(data, function(html) {
|
||||
layer.open({
|
||||
type: 1,
|
||||
shadeClose: true,
|
||||
shade: 0.3,
|
||||
offset: 'auto',
|
||||
scrollbar: true,
|
||||
fixed: false,
|
||||
title: "失败原因",
|
||||
area: ['450px', 'auto'],
|
||||
btn: ['退出'],
|
||||
content: html,
|
||||
});
|
||||
|
||||
});
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// 同步商品
|
||||
function sync(start){
|
||||
if (syncClick) return;
|
||||
syncClick = true;
|
||||
var start = start == undefined ? 0 : start;
|
||||
// $(".progress-layer").show();
|
||||
i=showSync();
|
||||
$.ajax({
|
||||
url: ns.url("shopcomponent://shop/category/sync"),
|
||||
data: {
|
||||
start: start,
|
||||
},
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function(res) {
|
||||
syncClick = false;
|
||||
if (res.code == 0) {
|
||||
var data = res.data,
|
||||
next = parseInt(start) + 1;
|
||||
|
||||
if (next < data.total_page) {
|
||||
if (start == 0) {
|
||||
$(".progress-layer").fadeOut();
|
||||
}
|
||||
var progress = (next / data.total_page * 100).toFixed(2);
|
||||
element.progress('progress', progress + '%');
|
||||
// 拉取下一页
|
||||
sync(next);
|
||||
} else {
|
||||
if (!$(".progress-layer").is(':hidden')) $(".progress-layer").fadeOut();
|
||||
closeSync(i);
|
||||
layer.closeAll();
|
||||
layer.msg('同步成功');
|
||||
table.reload();
|
||||
}
|
||||
} else {
|
||||
layer.msg(res.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
// 同步等待
|
||||
function showSync() {
|
||||
return layer.msg('正在同步中...', {icon: 16,shade: [0.5, '#f5f5f5'],scrollbar: false,offset: 'auto', time:100000});
|
||||
}
|
||||
// 关闭
|
||||
function closeSync(index) {
|
||||
layer.close(index);
|
||||
|
||||
}
|
||||
$('#layerDemo .layui-btn').on('click', function(){
|
||||
var othis = $(this), method = othis.data('method');
|
||||
active[method] ? active[method].call(this, othis) : '';
|
||||
});
|
||||
|
||||
$(function () {
|
||||
$.ajax({
|
||||
url: ns.url("shopcomponent://shop/category/syncauditresult"),
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function(res) {
|
||||
}
|
||||
})
|
||||
})
|
||||
</script>
|
||||
281
addon/shopcomponent/shop/view/goods/access.html
Executable file
281
addon/shopcomponent/shop/view/goods/access.html
Executable file
@@ -0,0 +1,281 @@
|
||||
<style type="text/css">
|
||||
.access{padding: 10px;}
|
||||
.access-title {font-size: 18px;font-family: Microsoft YaHei;font-weight: 400;color: #333333;}
|
||||
.access-item{background-color: #F8F8F8;display: flex;flex-direction: column;justify-content: space-between;}
|
||||
.item {display: flex;justify-content: space-between;margin: 20px 0 20px 10px;}
|
||||
.item-datail {position: relative;}
|
||||
.item-number {width: 30px;height: 30px;border-radius: 50%;border: 5px solid #eee;position: absolute;top: -5px;left: -45px;box-sizing: border-box;font-size: 10px;line-height: 20px;}
|
||||
.item-number label{width: 20px;height: 20px;background: #ddd;border-radius: 50%; text-align: center;color: #FFFFFF !important;display: inline-block;font-size: 12px;}
|
||||
.item-number.active {border: 5px solid;}
|
||||
.item-number.active label {background: var(--base-color);}
|
||||
.item-check{position: absolute;top: 5px; left: 20px;width: 25px;height: 25px;background: #CCCCCC;border-radius: 50%;display: flex;align-items: center;justify-content: center;}
|
||||
.item-check i{border-radius: 50%;border: none;font-size: 14px;color: #fff}
|
||||
.item-checked{border-radius: 50%;}
|
||||
.item-checked i {color: var(--base-color);}
|
||||
.item-datail div {font-size: 14px;font-family: Microsoft YaHei;font-weight: 400;color: #333333;margin-bottom: 10px;}
|
||||
.item-datail p {display: inline-block; font-size: 12px;font-family: Microsoft YaHei;font-weight: 400;color: #999999;}
|
||||
.item-datail a {font-size: 12px;font-family: Microsoft YaHei;font-weight: 400;color: var(--base-color) !important;}
|
||||
.item button {width: 88px;height: 34px;background: var(--base-color);border-radius: 2px;border: 1px solid #FFFFFF;font-weight: 400;color: #FFFFFF;cursor: pointer;}
|
||||
.item span,.item a,.item button {margin-right: 40px;margin-top: 10px;}
|
||||
.layui-timeline-item:before{top: 27px;}
|
||||
.order-pay-layer .wrap{display: flex;}
|
||||
.order-pay-layer .wrap .flex{flex: 1}
|
||||
.order-pay-layer .wrap .flex:last-child{border-left: 1px solid #eee}
|
||||
.order-pay-layer .qrcode img{width: 150px;margin: auto;display: block;}
|
||||
.order-pay-layer .goods-name {margin-right: 15px;font-weight: bold;}
|
||||
.order-pay-layer .price {margin-right: 15px;margin-top: 15px;font-weight: bold;}
|
||||
.order-pay-layer .tips {margin-bottom: 15px;}
|
||||
a:hover{text-decoration: none!important;cursor: pointer}
|
||||
</style>
|
||||
|
||||
<div class="access">
|
||||
<div class="access-title">微信视频号</div>
|
||||
<ul class="layui-timeline">
|
||||
<li class="layui-timeline-item">
|
||||
<div class="layui-timeline-content layui-text">
|
||||
<div class="item">
|
||||
<div class="item-datail">
|
||||
<div class="item-number active border-color-light-9">
|
||||
<label>1</label>
|
||||
</div>
|
||||
<div>创建微信视频号</div>
|
||||
<p>在微信中创建视频号,如已有视频号可越过该步骤。</p>
|
||||
</div>
|
||||
<a href="https://www.kancloud.cn/niucloud/niushop_b2c_v4/2251549" target="_blank" class="layui-btn">接入指南</a>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="layui-timeline-item">
|
||||
<div class="layui-timeline-content layui-text">
|
||||
<div class="item">
|
||||
<div class="item-datail">
|
||||
<div class="item-number {if $checkres['code'] == 0 && $checkres['data']['status'] == 2}active border-color-light-9{/if}">
|
||||
<label>2</label>
|
||||
</div>
|
||||
<div>申请开通自定义版交易组件</div>
|
||||
<p>完成自定义版交易组件接入后,小程序即可在视频号中实现商品展示和带货等功能,进一步提升经营能力。若您已开通标准化交易组件,则暂不支持切换</p>
|
||||
</div>
|
||||
{if $checkres['code'] == 0}
|
||||
{if $checkres['data']['status'] != 2 && $checkres['data']['status'] != 3}
|
||||
<button type="button" onclick="apply()">立即开通</button>
|
||||
{/if}
|
||||
{else/}
|
||||
<button type="button" onclick="apply()">立即开通</button>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="access-item">
|
||||
<div class="item">
|
||||
<div class="item-datail">
|
||||
<div class="item-check {if $checkres['code'] == 0 && $checkres['data']['status'] == 2}item-checked bg-color-light-9{/if}">
|
||||
<i class="iconfont iconduihao"></i>
|
||||
</div>
|
||||
<div style="margin-left: 60px;">
|
||||
<label>完成自定义版交易组件开通申请</label>
|
||||
<br>
|
||||
<p>官方审核团队将对接入资质进行审核,通过后可进行下一步操作。</p>
|
||||
</div>
|
||||
</div>
|
||||
{if $checkres['code'] == 0}
|
||||
{if $checkres['data']['status'] == 2}
|
||||
<span>已开通</span>
|
||||
{elseif $checkres['data']['status'] == 3}
|
||||
<span>封禁中</span>
|
||||
{else/}
|
||||
<span>未开通</span>
|
||||
{/if}
|
||||
{else/}
|
||||
<span>未开通</span>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="layui-timeline-item">
|
||||
<div class="layui-timeline-content layui-text">
|
||||
<div class="item">
|
||||
<div class="item-datail">
|
||||
<div class="item-number {if $checkres['code'] == 0 && $checkres['data']['status'] == 2}active border-color-light-9{/if}">
|
||||
<label>3</label>
|
||||
</div>
|
||||
<div>自定义版交易组件申请通过,接口调用场景检测</div>
|
||||
<p>自定义交易组件开通之后,如果当前小程序版本低于4.1.5,则需下载4.1.5或更高版本小程序进行发布,<a href="{:href_url('weapp://shop/weapp/package')}" target="_blank">前去发布</a></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="access-item">
|
||||
<div class="item">
|
||||
<div class="item-datail">
|
||||
<div class="item-check {if $checkres['code'] == 0 && $checkres['data']['status'] == 2 && $checkres['data']['access_info']['spu_audit_finished'] eq 1}item-checked bg-color-light-9{/if}">
|
||||
<i class="iconfont iconduihao"></i>
|
||||
</div>
|
||||
<div style="margin-left: 60px;">
|
||||
<label>商品接口调用</label>
|
||||
<br>
|
||||
<p>请至少将一件商品同步到微信,并等待商品审核通过<a href="{:href_url('shopcomponent://shop/goods/lists')}">前去添加</a></p>
|
||||
</div>
|
||||
</div>
|
||||
{if $checkres['code'] == 0 && $checkres['data']['status'] == 2 && $checkres['data']['access_info']['spu_audit_finished'] eq 1}
|
||||
<span>已完成</span>
|
||||
{else/}
|
||||
<button type="button" onclick="finishAccess(6)">完成</button>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="item" style="margin-top: 0;">
|
||||
<div class="item-datail">
|
||||
<div class="item-check {if $checkres['code'] == 0 && $checkres['data']['status'] == 2 && $checkres['data']['access_info']['ec_order_finished'] eq 1}item-checked bg-color-light-9{/if}">
|
||||
<i class="iconfont iconduihao"></i>
|
||||
</div>
|
||||
<div style="margin-left: 60px;">
|
||||
<label>订单接口调用</label>
|
||||
<br>
|
||||
<p>需手动扫码下单,使用微信支付并付款成功</p>
|
||||
</div>
|
||||
</div>
|
||||
{if $checkres['code'] == 0 && $checkres['data']['status'] == 2 && $checkres['data']['access_info']['ec_order_finished'] eq 1}
|
||||
<span>已完成</span>
|
||||
{else/}
|
||||
{if $checkres['code'] == 0 && $checkres['data']['access_info']['pay_order_success'] eq 1}
|
||||
<button type="button" onclick="finishAccess(7)">完成</button>
|
||||
{else/}
|
||||
<button type="button" onclick="orderPay()">扫码下单</button>
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
<div class="item" style="margin-top: 0;">
|
||||
<div class="item-datail">
|
||||
<div class="item-check {if $checkres['code'] == 0 && $checkres['data']['status'] == 2 && $checkres['data']['access_info']['send_delivery_finished'] eq 1}item-checked bg-color-light-9{/if}">
|
||||
<i class="iconfont iconduihao"></i>
|
||||
</div>
|
||||
<div style="margin-left: 60px;">
|
||||
<label>物流接口调用</label>
|
||||
<br>
|
||||
<p>订单支付之后,需对该测试订单进行发货操作</p>
|
||||
</div>
|
||||
</div>
|
||||
{if $checkres['code'] == 0 && $checkres['data']['status'] == 2 && $checkres['data']['access_info']['send_delivery_finished'] eq 1}
|
||||
<span>已完成</span>
|
||||
{else/}
|
||||
<button type="button" onclick="finishAccess(8)">完成</button>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="item" style="margin-top: 0;">
|
||||
<div class="item-datail">
|
||||
<div class="item-check {if $checkres['code'] == 0 && $checkres['data']['status'] == 2 && $checkres['data']['access_info']['ec_after_sale_finished'] eq 1}item-checked bg-color-light-9{/if}">
|
||||
<i class="iconfont iconduihao"></i>
|
||||
</div>
|
||||
<div style="margin-left: 60px;">
|
||||
<label>售后接口调用</label>
|
||||
<br>
|
||||
<p>订单发货之后,需下单人对该测试订单进行申请售后操作</p>
|
||||
</div>
|
||||
</div>
|
||||
{if $checkres['code'] == 0 && $checkres['data']['status'] == 2 && $checkres['data']['access_info']['ec_after_sale_finished'] eq 1}
|
||||
<span>已完成</span>
|
||||
{else/}
|
||||
<button type="button" onclick="finishAccess(9)">完成</button>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="layui-timeline-item">
|
||||
<div class="layui-timeline-content layui-text">
|
||||
<div class="item">
|
||||
<div class="item-datail">
|
||||
<div class="item-number {if $checkres['code'] == 0 && $checkres['data']['status'] == 2 && $checkres['data']['access_info']['ec_after_sale_finished'] eq 1}active border-color-light-9{/if}">
|
||||
<label>4</label>
|
||||
</div>
|
||||
<div>自定义版交易组件开通成功</div>
|
||||
<p>开通成功之后可在小程序中“功能>交易组件>场景接入>视频号推广”中关联视频号,关联之后视频号管理员可前往“视频号创作者中心>商品橱窗”中添加商品<a href="https://mp.weixin.qq.com" target="_blank">前去添加</a>。 </p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<script type="text/html" id="orderPay">
|
||||
<div class="order-pay-layer">
|
||||
<div class="tips text-color">注:需使用微信扫码下单使用微信支付,且支付成功。</div>
|
||||
<div class="wrap">
|
||||
<div class="flex">
|
||||
<div class="goods-name">{{ d.goods_name }}</div>
|
||||
<div class="price">¥{{ d.price }}</div>
|
||||
</div>
|
||||
<div class="flex">
|
||||
<div class="qrcode">
|
||||
<img src="{{ ns.img(d.qrcode_path) }}" alt="">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
var laytpl,repeatTag = false;
|
||||
layui.use(['laytpl'], function() {
|
||||
laytpl = layui.laytpl;
|
||||
});
|
||||
|
||||
function apply(){
|
||||
$.ajax({
|
||||
url: ns.url("shopcomponent://shop/goods/access"),
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function(res) {
|
||||
if (res.code == 0) {
|
||||
layer.msg('开通成功');
|
||||
setTimeout(function () {
|
||||
listenerHash(); // 刷新页面
|
||||
}, 500)
|
||||
} else {
|
||||
layer.msg(res.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function orderPay() {
|
||||
$.ajax({
|
||||
url: ns.url("shopcomponent://shop/goods/getorderpayinfo"),
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function(res) {
|
||||
if (res.code == 0) {
|
||||
laytpl($('#orderPay').html()).render(res.data, function(string){
|
||||
layer.open({
|
||||
type: 1,
|
||||
title: '订单测试',
|
||||
content: string,
|
||||
area: ['500px', '340px'],
|
||||
btn: ['支付成功', '取消'],
|
||||
yes: function () {
|
||||
listenerHash(); // 刷新页面
|
||||
layer.closeAll();
|
||||
}
|
||||
})
|
||||
});
|
||||
} else {
|
||||
layer.msg(res.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function finishAccess(item) {
|
||||
if (repeatTag) return;
|
||||
repeatTag = true;
|
||||
$.ajax({
|
||||
url: ns.url("shopcomponent://shop/goods/finishaccess"),
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
data: {item: item},
|
||||
success: function (res) {
|
||||
repeatTag = false;
|
||||
if (res.code == 0) {
|
||||
listenerHash(); // 刷新页面
|
||||
} else {
|
||||
layer.msg(res.message);
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
711
addon/shopcomponent/shop/view/goods/index.html
Executable file
711
addon/shopcomponent/shop/view/goods/index.html
Executable file
@@ -0,0 +1,711 @@
|
||||
<style>
|
||||
.progress-layer {width:400px;background:#fff;position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);box-shadow:1px 1px 50px rgba(0,0,0,.3);padding:20px 20px;z-index:100;display:none;}
|
||||
.progress-layer h3 {line-height:1;margin-bottom:15px;text-align:center;font-size:14px;}
|
||||
.progress-layer .layui-progress-big,.progress-layer .layui-progress-big .layui-progress-bar {height:14px;line-height:14px;}
|
||||
.progress-layer .layui-progress-text {line-height:14px;}
|
||||
.goods-info {padding: 5px 0;align-items: center;flex-wrap:unset!important;float: left !important;}
|
||||
.goods-info .room-name {padding-left: 5px;line-height: 1}
|
||||
.goods-info img {width:50px;height: 50px;}
|
||||
.single-filter-box{justify-content: end}
|
||||
.add-good-form .layui-input-block {width: 450px;}
|
||||
.add-good-form .layui-form-item {position: relative;}
|
||||
.add-good-form .category-wrap {position: absolute; left: 150px; top: 40px; z-index: 9; background-color: #FFFFFF; border: 1px solid #EEEEEE;}
|
||||
.add-good-form .category-wrap .category-list {display: flex;}
|
||||
.add-good-form .category-wrap ul {width: 151px; height: 300px; overflow: auto; background-color: #FFFFFF; border-right: 1px solid #EEEEEE; box-sizing: border-box;}
|
||||
.add-good-form .category-wrap ul:last-child {border-right: 1px solid #EEEEEE;}
|
||||
.add-good-form .category-wrap ul li {line-height: 26px; padding: 0 15px; cursor: pointer;}
|
||||
.add-good-form .category-wrap .category-btn {width: 100%; padding: 10px 15px; box-sizing: border-box; border-top: 1px solid #EEEEEE;}
|
||||
.layui-layer-page .layui-layer-content {overflow: auto !important; position: relative;}
|
||||
.goods-category-mask {width: 100%; height: 100%; position: absolute; left: 0; top: 0; z-index: 9;}
|
||||
.selected-style {color: #FFFFFF;}
|
||||
.reject-reason {height: 100%;padding-bottom: 20px;}
|
||||
.reason .layui-layer-content {overflow: unset!important}
|
||||
</style>
|
||||
|
||||
{if $checkres['code'] != 0 || $checkres['data']['status'] != 2}
|
||||
<div>
|
||||
<div style="margin-top:10% ">
|
||||
<div style="text-align:center;margin: auto;">
|
||||
<img src="SHOP_IMG/empty.jpg.png" alt="">
|
||||
</div>
|
||||
<div style="text-align:center;margin: auto;margin-top: 10px">
|
||||
<span >视频号未入驻,请先完成视频号入驻</span>
|
||||
</div>
|
||||
<div style="text-align:center;margin: auto;margin-top: 10px">
|
||||
<a href="{:href_url('shopcomponent://shop/goods/access')}" class="text-color">立即处理</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{else/}
|
||||
<div class="single-filter-box">
|
||||
<a href="javascript:addGood();" class="layui-btn ">添加商品</a>
|
||||
<!-- <button class="layui-btn layui-btn-primary " onclick="sync()">同步刷新</button>-->
|
||||
</div>
|
||||
<table id="goods_list" lay-filter="goods_list"></table>
|
||||
{/if}
|
||||
<!-- 直播间信息 -->
|
||||
<script type="text/html" id="goodsinfo">
|
||||
<div class="table-btn goods-info">
|
||||
<img src="{{ ns.img(d.cover_img) }}">
|
||||
<span class="room-name" title="{{ d.goods_name }}">{{ d.goods_name }}</span>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="cat">
|
||||
<div class="table-btn goods-info" style="position: relative">
|
||||
<!-- <input type="text" value="{{d.out_product_id}}" hidden id="goods_id">-->
|
||||
<span class="room-name" style="float: right; width: 100%; overflow: hidden; z-index: 1" title="{{ d.cat_name }}">{{ d.cat_name }}</span> | <span class="text-color" style="float:left;z-index: 100; margin-right: 1px;cursor:pointer" onclick="check_cat({{d.out_product_id}})">修改</span>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="reason">
|
||||
<div class="reject-reason">{{d.reject_reason}}</div>
|
||||
</script>
|
||||
|
||||
<!-- 状态修改 -->
|
||||
<script type="text/html" id="goodsStatus">
|
||||
<div class="table-btn goods-info" style="position: relative">
|
||||
<span class="room-name {{# if(d.status==5){ }} text-color {{# } }} " {{# if(d.status!=5){ }}style="color:#808080" {{# } }} title="{{ d.status_name }}">{{ d.status_name }}</span>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<!-- 操作 -->
|
||||
<script type="text/html" id="operation">
|
||||
<div class="table-btn">
|
||||
<a class="layui-btn" lay-event="delete">删除</a>
|
||||
{{# if(d.edit_status==3){ }}
|
||||
<a class="layui-btn" lay-event="reason">查看失败原因</a>
|
||||
{{# } }}
|
||||
{{# if(d.edit_status==4){ }}
|
||||
{{# if(d.status==5){ }}
|
||||
<a class="layui-btn" lay-event="dellisting">下架</a>
|
||||
{{# } }}
|
||||
{{# if(d.status!=5){ }}
|
||||
<a class="layui-btn" lay-event="listing">上架</a>
|
||||
{{# } }}
|
||||
{{# } }}
|
||||
</div>
|
||||
</script>
|
||||
<!-- 批量操作 -->
|
||||
<script type="text/html" id="batchOperation">
|
||||
<button class="layui-btn layui-btn-primary" lay-event="delete">批量删除</button>
|
||||
<button class="layui-btn layui-btn-primary" lay-event="listing">批量上架</button>
|
||||
<button class="layui-btn layui-btn-primary" lay-event="dellisting">批量下架</button>
|
||||
</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>
|
||||
var form, table, element, laytpl, syncClick = false,
|
||||
delete_flag = false,
|
||||
save_flag = false,saveEdit_flag = false,
|
||||
dellisting_flag = false,
|
||||
listing_flag = false,
|
||||
goodsId = [], selectedGoodsId = [], goods_list = [],out_product_id='',
|
||||
cate_level_1_id = 0, cate_level_2_id = 0, cate_level_3_id = 0;
|
||||
reLoad();
|
||||
function reLoad() {
|
||||
layui.use(['form', 'element', 'laytpl'], function () {
|
||||
form = layui.form;
|
||||
element = layui.element;
|
||||
laytpl = layui.laytpl;
|
||||
|
||||
table = new Table({
|
||||
elem: '#goods_list',
|
||||
url: ns.url("shopcomponent://shop/goods/lists"),
|
||||
bottomToolbar: "#batchOperation",
|
||||
cols: [
|
||||
[{
|
||||
type: 'checkbox',
|
||||
unresize: 'false',
|
||||
width: '3%'
|
||||
}, {
|
||||
title: '商品信息',
|
||||
unresize: 'false',
|
||||
width: '15%',
|
||||
templet: "#goodsinfo",
|
||||
align:'left'
|
||||
}, {
|
||||
title: '微信商品类目',
|
||||
unresize: 'false',
|
||||
width: '15%',
|
||||
templet: "#cat",
|
||||
align:'left'
|
||||
}, {
|
||||
title: '价格',
|
||||
unresize: 'false',
|
||||
width: '10%',
|
||||
field: 'price'
|
||||
}, {
|
||||
field: 'goods_stock',
|
||||
title: '库存',
|
||||
unresize: 'false',
|
||||
width: '6%'
|
||||
}, {
|
||||
templet: "#goodsStatus",
|
||||
title: '状态',
|
||||
unresize: 'false',
|
||||
width: '10%',
|
||||
}, {
|
||||
field: 'create_time',
|
||||
title: '提交时间',
|
||||
unresize: 'false',
|
||||
width: '10%',
|
||||
}, {
|
||||
field: 'audit_time',
|
||||
title: '审核时间',
|
||||
unresize: 'false',
|
||||
width: '10%',
|
||||
}, {
|
||||
field: 'edit_status_name',
|
||||
title: '审核状态',
|
||||
unresize: 'false',
|
||||
width: '10%',
|
||||
}, {
|
||||
title: '操作',
|
||||
toolbar: '#operation',
|
||||
unresize: 'false',
|
||||
align:'right'
|
||||
}]
|
||||
]
|
||||
});
|
||||
|
||||
table.tool(function (obj) {
|
||||
var data = obj.data;
|
||||
switch (obj.event) {
|
||||
case 'delete': //删除
|
||||
deleteGoods(data.out_product_id);
|
||||
break;
|
||||
case 'listing': //上架
|
||||
listingGoods(data.out_product_id);
|
||||
break;
|
||||
case 'dellisting': //下架
|
||||
dellistingGoods(data.out_product_id);
|
||||
break;
|
||||
case 'reason': //查看失败原因
|
||||
laytpl($("#reason").html()).render(data, function (html) {
|
||||
layer.open({
|
||||
type: 1,
|
||||
shadeClose: true,
|
||||
shade: 0.3,
|
||||
offset: 'auto',
|
||||
fixed: false,
|
||||
title: "失败原因",
|
||||
area: ['450px', 'auto'],
|
||||
btn: ['退出'],
|
||||
content: html,
|
||||
skin: 'reason'
|
||||
});
|
||||
|
||||
});
|
||||
break;
|
||||
}
|
||||
})
|
||||
|
||||
/**
|
||||
* 保存添加商品
|
||||
*/
|
||||
form.on('submit(save)', function (data) {
|
||||
if (save_flag) return;
|
||||
save_flag = true;
|
||||
if (selectedGoodsId == '') {
|
||||
layer.msg('请选择商品');
|
||||
}
|
||||
if (cate_level_3_id == '') {
|
||||
layer.msg('请选择分类');
|
||||
}
|
||||
data.field.goods_ids = selectedGoodsId;
|
||||
data.field.third_cat_id = cate_level_3_id;
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
dataType: 'JSON',
|
||||
url: ns.url("shopcomponent://shop/goods/add"),
|
||||
data: data.field,
|
||||
success: function (res) {
|
||||
save_flag = false;
|
||||
if (res.code == 0) {
|
||||
layer.confirm('添加成功', {
|
||||
title: '操作提示',
|
||||
btn: ['返回列表', '继续操作'],
|
||||
yes: function (index, layero) {
|
||||
location.hash = ns.hash("shopcomponent://shop/goods/lists")
|
||||
layer.close(index);
|
||||
},
|
||||
btn2: function (index, layero) {
|
||||
listenerHash(); // 刷新页面
|
||||
layer.close(index);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
layer.msg(res.message);
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
/**
|
||||
* 保存编辑分类
|
||||
*/
|
||||
form.on('submit(saveEdit)', function (data) {
|
||||
let goods_id = out_product_id;
|
||||
if (saveEdit_flag) return;
|
||||
saveEdit_flag = true;
|
||||
if (goods_id == '') {
|
||||
layer.msg('请选择商品');
|
||||
}
|
||||
if (cate_level_3_id == '') {
|
||||
layer.msg('请选择分类');
|
||||
}
|
||||
data.field.goods_id = goods_id;
|
||||
data.field.third_cat_id = cate_level_3_id;
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
dataType: 'JSON',
|
||||
url: ns.url("shopcomponent://shop/goods/edit"),
|
||||
data: data.field,
|
||||
success: function (res) {
|
||||
save_flag = false;
|
||||
if (res.code == 0) {
|
||||
layer.confirm('编辑成功', {
|
||||
title: '操作提示',
|
||||
btn: ['返回列表', '继续操作'],
|
||||
yes: function (index, layero) {
|
||||
location.hash = ns.hash("shopcomponent://shop/goods/lists")
|
||||
layer.close(index);
|
||||
},
|
||||
btn2: function (index, layero) {
|
||||
layer.close(index);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
layer.msg(res.message);
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
// 批量操作
|
||||
table.bottomToolbar(function (obj) {
|
||||
if (obj.data.length < 1) {
|
||||
layer.msg('请选择要操作的数据');
|
||||
return;
|
||||
}
|
||||
var id_array = new Array();
|
||||
for (i in obj.data) id_array.push(obj.data[i].out_product_id);
|
||||
switch (obj.event) {
|
||||
case "delete":
|
||||
deleteGoods(id_array.toString());
|
||||
break;
|
||||
case "listing":
|
||||
listingGoods(id_array.toString());
|
||||
break;
|
||||
case "dellisting":
|
||||
dellistingGoods(id_array.toString());
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
function deleteGoods(goods_ids){
|
||||
layer.confirm('是否确定要删除所选商品?', {title: '提示'}, function (index) {
|
||||
if (delete_flag) return;
|
||||
delete_flag = true;
|
||||
layer.close(index);
|
||||
|
||||
$.ajax({
|
||||
url: ns.url("shopcomponent://shop/goods/delete"),
|
||||
data: {out_product_ids: goods_ids},
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function (res) {
|
||||
layer.msg(res.message);
|
||||
delete_flag = false;
|
||||
if (res.code == 0) {
|
||||
table.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function listingGoods(goods_ids){
|
||||
layer.confirm('是否确定要上架所选商品?', {title: '提示'}, function (index) {
|
||||
if (listing_flag) return;
|
||||
listing_flag = true;
|
||||
layer.close(index);
|
||||
|
||||
$.ajax({
|
||||
url: ns.url("shopcomponent://shop/goods/listing"),
|
||||
data: {out_product_ids: goods_ids},
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function (res) {
|
||||
layer.msg(res.message);
|
||||
listing_flag = false;
|
||||
if (res.code == 0) {
|
||||
table.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function dellistingGoods(goods_ids){
|
||||
layer.confirm('是否确定要下架所选商品?', {title: '提示'}, function (index) {
|
||||
if (dellisting_flag) return;
|
||||
dellisting_flag = true;
|
||||
layer.close(index);
|
||||
|
||||
$.ajax({
|
||||
url: ns.url("shopcomponent://shop/goods/dellisting"),
|
||||
data: {out_product_ids: goods_ids},
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function (res) {
|
||||
layer.msg(res.message);
|
||||
dellisting_flag = false;
|
||||
if (res.code == 0) {
|
||||
table.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
// 同步商品
|
||||
function sync(start) {
|
||||
if (syncClick) return;
|
||||
syncClick = true;
|
||||
var start = start == undefined ? 0 : start;
|
||||
|
||||
$.ajax({
|
||||
url: ns.url("shopcomponent://shop/goods/sync"),
|
||||
data: {
|
||||
start: start,
|
||||
},
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function(res) {
|
||||
syncClick = false;
|
||||
if (res.code == 0) {
|
||||
var data = res.data,
|
||||
next = parseInt(start) + 1;
|
||||
|
||||
if (next < data.total_page) {
|
||||
if (start == 0) {
|
||||
$(".progress-layer").fadeOut();
|
||||
}
|
||||
var progress = (next / data.total_page * 100).toFixed(2);
|
||||
element.progress('progress', progress + '%');
|
||||
// 拉取下一页
|
||||
sync(next);
|
||||
} else {
|
||||
if (!$(".progress-layer").is(':hidden')) $(".progress-layer").fadeOut();
|
||||
layer.closeAll();
|
||||
layer.msg('同步成功');
|
||||
table.reload();
|
||||
}
|
||||
} else {
|
||||
layer.msg(res.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加商品
|
||||
*/
|
||||
function addGood() {
|
||||
laytpl($("#add_good").html()).render({}, function(html) {
|
||||
add_good_layer = layer.open({
|
||||
type: 1,
|
||||
title: '添加商品',
|
||||
area: ['700px', '500px'],
|
||||
content: html,
|
||||
success: function(layero, index) {
|
||||
form.render();
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改微信商品分类
|
||||
*/
|
||||
function check_cat(goods_id){
|
||||
if(goods_id!=''){
|
||||
out_product_id = goods_id;
|
||||
}
|
||||
laytpl($("#check_cat").html()).render({}, function(html) {
|
||||
add_good_layer = layer.open({
|
||||
type: 1,
|
||||
title: '修改商品分类',
|
||||
area: ['700px', '500px'],
|
||||
content: html,
|
||||
success: function(layero, index) {
|
||||
form.render();
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
function selectGoods() {
|
||||
goodsSelect(function (data) {
|
||||
|
||||
goodsId = [];
|
||||
goods_list = [];
|
||||
|
||||
for (var key in data) {
|
||||
goodsId.push(data[key].goods_id);
|
||||
data[key].buy_num = 2;
|
||||
goods_list.push(data[key]);
|
||||
}
|
||||
|
||||
laytpl($("#table_goods_list").html()).render(goods_list, function(html) {
|
||||
$(".add-good-form .layui-table tbody").html(html);
|
||||
})
|
||||
|
||||
$("input[name='goods_ids']").val(JSON.stringify(goodsId));
|
||||
|
||||
selectedGoodsId = goodsId.toString();
|
||||
}, selectedGoodsId);
|
||||
}
|
||||
|
||||
function closeAddGoodsLayer() {
|
||||
layer.close(add_good_layer);
|
||||
}
|
||||
|
||||
// 选择分类
|
||||
function selectCategory() {
|
||||
$(".category-wrap").removeClass("layui-hide");
|
||||
$(".goods-category-mask").removeClass("layui-hide");
|
||||
}
|
||||
|
||||
$('body').off('click', '.goods-category-mask').on('click', '.goods-category-mask', function() {
|
||||
$(".category-wrap").addClass("layui-hide");
|
||||
$(".goods-category-mask").addClass("layui-hide");
|
||||
})
|
||||
|
||||
function selectThird(event){
|
||||
cate_level_3_id = $(event).attr('lay-id');
|
||||
$(event).addClass('selected-style bg-color').siblings('li').removeClass("selected-style bg-color");
|
||||
}
|
||||
|
||||
// 选中分类
|
||||
function selectedCategory(event, level, id) {
|
||||
$(event).addClass('selected-style bg-color').siblings('li').removeClass("selected-style bg-color");
|
||||
$.ajax({
|
||||
url: ns.url("shopcomponent://shop/category/getCategoryByParent"),
|
||||
data: {
|
||||
level: level,
|
||||
pid: id
|
||||
},
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function(res) {
|
||||
$(".cate-select").val('');
|
||||
var obj = {};
|
||||
obj.level = level;
|
||||
obj.list = res.data;
|
||||
if (obj.list.length > 0 && obj.level < 4) {
|
||||
renderCategory(obj);
|
||||
}
|
||||
if (level == 2) cate_level_1_id = id;
|
||||
else cate_level_2_id = id;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function renderCategory(data) {
|
||||
laytpl($("#category_wrap").html()).render(data, function(html) {
|
||||
|
||||
if (data.level == 2) {
|
||||
$(".category-level-2").removeClass("layui-hide");
|
||||
$(".category-level-2").html(html);
|
||||
$(".category-level-3").addClass("layui-hide");
|
||||
$(".category-level-3").html();
|
||||
} else if (data.level == 3) {
|
||||
$(".category-level-3").removeClass("layui-hide");
|
||||
$(".category-level-3").html(html);
|
||||
}
|
||||
form.render();
|
||||
})
|
||||
}
|
||||
|
||||
function saveCate() {
|
||||
if (!$('.category-level-1 li.selected-style').length) {
|
||||
layer.msg('请选择一级分类', {icon: 5, anim: 6});
|
||||
return false;
|
||||
}
|
||||
if (!$('.category-level-2 li.selected-style').length) {
|
||||
layer.msg('请选择二级分类', {icon: 5, anim: 6});
|
||||
return false;
|
||||
}
|
||||
if (!$('.category-level-3 li.selected-style').length) {
|
||||
layer.msg('请选择三级分类', {icon: 5, anim: 6});
|
||||
return false;
|
||||
}
|
||||
|
||||
var firstLevel = $('.category-level-1 li.selected-style'),
|
||||
secondLevel = $('.category-level-2 li.selected-style'),
|
||||
thirdLevel = $('.category-level-3 li.selected-style');
|
||||
|
||||
$(".cate-select").val(firstLevel.text() + '>' + secondLevel.text() + '>' + thirdLevel.text());
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
dataType: 'JSON',
|
||||
url: ns.url("shopcomponent://shop/goods/check"),
|
||||
data: {third_cat_id:thirdLevel.attr('lay-id')},
|
||||
success: function(res) {
|
||||
if (res.code != 0) {
|
||||
layer.confirm('该类目需上传相应资质', {
|
||||
title:'操作提示',
|
||||
btn: ['上传资质', '暂不上传'],
|
||||
yes: function(index, layero) {
|
||||
location.hash = ns.hash("shopcomponent://shop/category/lists?third_cat_id="+cate_level_3_id)
|
||||
layer.close(index);
|
||||
},
|
||||
btn2: function(index, layero) {
|
||||
layer.close(index);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$(".category-wrap").addClass("layui-hide");
|
||||
$(".goods-category-mask").addClass("layui-hide");
|
||||
}
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="check_cat">
|
||||
<div class="goods-category-mask layui-hide"></div>
|
||||
|
||||
<div class="layui-form add-good-form">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label mid"><span class="required">*</span>商品分类:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" readonly lay-verify="required" autocomplete="off" class="layui-input len-long cate-select" onclick="selectCategory()">
|
||||
</div>
|
||||
<p class="word-aux mid">分类必选,此分类为调取的微信分类内容</p>
|
||||
|
||||
<div class="category-wrap layui-hide">
|
||||
<div class="category-list">
|
||||
<ul class="category-level-1">
|
||||
{foreach $first_cat as $first_k => $first_v}
|
||||
<li onclick="selectedCategory(this, 2, {$first_v.first_cat_id})" lay-id="{$first_v.first_cat_id}">{$first_v.first_cat_name}</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
<ul class="category-level-2 layui-hide"></ul>
|
||||
<ul class="category-level-3 layui-hide"></ul>
|
||||
</div>
|
||||
|
||||
<div class="category-btn">
|
||||
<button class="layui-btn" onclick="saveCate()">确定</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row mid">
|
||||
<button class="layui-btn" lay-submit lay-filter="saveEdit">保存</button>
|
||||
<button class="layui-btn layui-btn-primary" onclick="closeAddGoodsLayer()">取消</button>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="add_good">
|
||||
<div class="goods-category-mask layui-hide"></div>
|
||||
|
||||
<div class="layui-form add-good-form">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label mid"><span class="required">*</span>商品分类:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" readonly lay-verify="required" autocomplete="off" class="layui-input len-long cate-select" onclick="selectCategory()">
|
||||
</div>
|
||||
<p class="word-aux mid">分类必选,此分类为调取的微信分类内容</p>
|
||||
|
||||
<div class="category-wrap layui-hide">
|
||||
<div class="category-list">
|
||||
<ul class="category-level-1">
|
||||
{foreach $first_cat as $first_k => $first_v}
|
||||
<li onclick="selectedCategory(this, 2, {$first_v.first_cat_id})" lay-id="{$first_v.first_cat_id}">{$first_v.first_cat_name}</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
<ul class="category-level-2 layui-hide"></ul>
|
||||
<ul class="category-level-3 layui-hide"></ul>
|
||||
</div>
|
||||
|
||||
<div class="category-btn">
|
||||
<button class="layui-btn" onclick="saveCate()">确定</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label mid"><span class="required">*</span>选择商品:</label>
|
||||
<div class="layui-input-block">
|
||||
<button class="layui-btn" onclick="selectGoods()">选择商品</button>
|
||||
</div>
|
||||
<p class="word-aux mid">请选择需要关联至视频号直播的商品</p>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label mid"></label>
|
||||
<div class="layui-input-block">
|
||||
<table class="layui-table" lay-skin="line" lay-size="lg">
|
||||
<colgroup>
|
||||
<col width="100%">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>商品</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr><td>暂无商品</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row mid">
|
||||
<button class="layui-btn" lay-submit lay-filter="save">保存</button>
|
||||
<button class="layui-btn layui-btn-primary" onclick="closeAddGoodsLayer()">取消</button>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="table_goods_list">
|
||||
{{# layui.each(d, function(index, item) { }}
|
||||
<tr>
|
||||
<td>
|
||||
<div class="table-title">
|
||||
<div class="title-pic">
|
||||
{{# if(item.goods_image){ }}
|
||||
<img layer-src src="{{ns.img(item.goods_image.split(',')[0],'small')}}"/>
|
||||
{{# } }}
|
||||
</div>
|
||||
<div class="title-content">
|
||||
<a href="javascript:;" class="multi-line-hiding text-color-sub" title="{{item.goods_name}}">{{item.goods_name}}</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{{# }) }}
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="category_wrap">
|
||||
{{# if (d.level == 2) { }}
|
||||
{{# layui.each(d.list, function(index, item) { }}
|
||||
<li onclick="selectedCategory(this, 3, {{item.second_cat_id}})" lay-id="{{item.second_cat_id}}">{{item.second_cat_name}}</li>
|
||||
{{# }) }}
|
||||
{{# } else if (d.level == 3) { }}
|
||||
{{# layui.each(d.list, function(index, item) { }}
|
||||
<li onclick="selectThird(this)" lay-id="{{item.third_cat_id}}">{{item.third_cat_name}}</li>
|
||||
{{# }) }}
|
||||
{{# } }}
|
||||
</script>
|
||||
BIN
addon/shopcomponent/shop/view/public/img/live_new.png
Executable file
BIN
addon/shopcomponent/shop/view/public/img/live_new.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
BIN
addon/shopcomponent/shop/view/public/img/live_select.png
Executable file
BIN
addon/shopcomponent/shop/view/public/img/live_select.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
Reference in New Issue
Block a user