初始上传
This commit is contained in:
192
addon/giftcard/shop/view/card/detail.html
Executable file
192
addon/giftcard/shop/view/card/detail.html
Executable file
@@ -0,0 +1,192 @@
|
||||
<style>
|
||||
.card-common .layui-card-body{padding-top: 0;}
|
||||
.card-common {margin-top: 15px;margin-bottom: 0;box-shadow: initial;}
|
||||
.promotion-view{display:flex;flex-wrap:wrap}
|
||||
.promotion-view-item{width:33.3%;padding-right:10px;box-sizing:border-box;line-height:30px}
|
||||
.todo-list .promotion-stat-item{flex:1;width:0;cursor:pointer}
|
||||
.layui-layout-admin .layui-body .body-content {background: 0 0;padding: 0;}
|
||||
.gift-card-goods span{cursor: pointer; color: var(--base-color);}
|
||||
.layui-tab-title{margin-bottom: 15px;}
|
||||
.layui-layout-admin .single-filter-box.top {padding-top: 0 !important;}
|
||||
.add-way .add-way-item{display: flex;margin: 8px 0;align-items: center;}
|
||||
.add-way .add-way-item input{margin: 0 10px;}
|
||||
.add-way .add-way-item .layui-form-radio{margin-right: 0;}
|
||||
/* 商品列表 */
|
||||
.shop-information-table > p{padding-left: 5px;padding-bottom: 5px;}
|
||||
.shop-information-table table {width: 100%;border: 1px solid rgb(238,238,238);}
|
||||
.shop-information-table .table-body {max-height: 400px;overflow: auto;}
|
||||
.table-trOne{height: 48px;background:rgb(245,245,245) ;}
|
||||
.shop-information-table th{text-align: left;padding-left:28px;box-sizing: border-box;font-weight: 500;color:#333333;}
|
||||
.shop-information-table th:last-child{border:none;}
|
||||
.table-trTow{width:100%;height:60px;border-top:1px solid rgb(238,238,238);}
|
||||
.table-trTow>td{text-align: left;padding-left:28px;box-sizing: border-box;font-weight: 500;color:#333333;border-right:1px solid rgb(238,238,238);}
|
||||
.table-trTow>td:nth-child(5){color:var(--base-color)}
|
||||
/* 卡记录 */
|
||||
.layui-timeline-item{padding-bottom:28px;}
|
||||
.layui-timeline-item:after{overflow: hidden;height: 0;content:"";display: block;clear: both;}
|
||||
.layui-timeline-item:before, hr{background:var(--base-color);margin-left:92px;}
|
||||
.distribution{width:100%;min-height: 50px;background:white;margin-top:15px;padding: 15px;box-sizing: border-box;}
|
||||
.layui-timeline-axis{left:87px;background:var(--base-color);display: flex;align-items: center;justify-content: center;}
|
||||
.layui-timeline-content{float:left;display: inline-block;padding-left:45px;}
|
||||
.layui-time-left{float: left;width:85px;height: 40px;padding: 2px 10px 0 0;box-sizing: border-box;}
|
||||
.layui-timeline{padding-left:60px;}
|
||||
.layui-time-left>p:nth-of-type(1){font-size:14px;color:#333333;text-align: right;}
|
||||
.layui-time-left>p:nth-of-type(2){color:rgb(164,164,164);text-align: right;}
|
||||
.layui-icon-center {width: 40%;height: 40%;border-radius: 50%;background: white;}
|
||||
</style>
|
||||
|
||||
<div class="layui-card card-common card-brief">
|
||||
<div class="layui-card-header">
|
||||
<span class="card-title">礼品卡信息</span>
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<div class="promotion-view">
|
||||
<div class="promotion-view-item">
|
||||
<label>卡号:</label>
|
||||
<span>{$detail.card_no}</span>
|
||||
</div>
|
||||
{if $detail.card_type!='virtual'}
|
||||
<div class="promotion-view-item">
|
||||
<label>卡密:</label>
|
||||
<span>{if $detail.card_cdk}{$detail.card_cdk}{else/}--{/if}</span>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="promotion-view-item">
|
||||
<label>卡类型:</label>
|
||||
<span>{if $detail.card_right_type == 'real'}实体卡{else/}电子卡{/if}</span>
|
||||
</div>
|
||||
<div class="promotion-view-item grouping">
|
||||
<label>权益类型:</label>
|
||||
<span>{if $detail.card_right_type == 'goods'}礼品卡{else/}储值卡{/if}</span>
|
||||
</div>
|
||||
{if $detail.card_right_type == 'balance'}
|
||||
<div class="promotion-view-item grouping">
|
||||
<label>储蓄余额:</label>
|
||||
<span>{$detail.balance}</span>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="promotion-view-item">
|
||||
<label>状态:</label>
|
||||
<span>{$detail.status_name}</span>
|
||||
</div>
|
||||
{if $detail.init_member_id > 0 }
|
||||
<div class="promotion-view-item">
|
||||
<label>{if $detail.card_type == 'real'}激活人{else/}购买人{/if}:</label>
|
||||
<span>{$detail.init_member_nickname}</span>
|
||||
</div>
|
||||
{if $detail.card_type=='virtual'}
|
||||
<div class="promotion-view-item">
|
||||
<label>购买订单:</label>
|
||||
<a class="text-color" href="{:href_url('giftcard://shop/order/detail',['order_id'=> $detail['order_id']])}" target="_blank">{$detail.order_no}</a>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="promotion-view-item">
|
||||
<label>{if $detail.card_type == 'real'}激活{else/}购买{/if}时间:</label>
|
||||
<span>{if $detail.card_type == 'real'}{:time_to_date($detail.activate_time)}{else/}{:time_to_date($detail.create_time)}{/if}</span>
|
||||
</div>
|
||||
<div class="promotion-view-item">
|
||||
<label>当前持卡人:</label>
|
||||
<span>{$detail.member_nickname}</span>
|
||||
</div>
|
||||
<div class="promotion-view-item">
|
||||
<label>有效期:</label>
|
||||
<span>{if $detail.valid_time == 0}永久{else/}{:time_to_date($detail.valid_time)}{/if}</span>
|
||||
</div>
|
||||
{if $detail.status != "to_use"&& $detail.use_time && ($detail.status == "expire" || $detail.status == "invalid" || $detail.status == "used")}
|
||||
<div class="promotion-view-item">
|
||||
<label>使用时间:</label>
|
||||
<span>{:date('Y-m-d H:i:s',$detail.use_time)}</span>
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 商品信息 -->
|
||||
{if $detail['card_right_type'] == 'goods'}
|
||||
<div class="layui-card card-common card-brief">
|
||||
<div class="layui-card-header">
|
||||
<span class="card-title">商品信息</span>
|
||||
</div>
|
||||
<div class="layui-card-body shop-information-table">
|
||||
{if $detail.card_right_goods_type == 'all'}
|
||||
<p>礼品卡持卡人兑换时可从以下商品列表中任选{$detail.card_right_goods_count}件</p>
|
||||
{/if}
|
||||
<div class="table-head">
|
||||
<table lay-skin="line">
|
||||
<colgroup>
|
||||
<col width="80%">
|
||||
{if $detail.card_right_goods_type == 'all'}
|
||||
<col width="20%">
|
||||
{/if}
|
||||
{if $detail.card_right_goods_type != 'all'}
|
||||
<col width="10%">
|
||||
<col width="10%">
|
||||
{/if}
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr class="table-trOne">
|
||||
<th lay-data="{field:'product_name', width:200}">商品</th>
|
||||
<th lay-data="{field:'price'}">价格</th>
|
||||
{if $detail.card_right_goods_type != 'all'}
|
||||
<th lay-data="{field:'sale_num'}">数量</th>
|
||||
{/if}
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
<div class="table-body">
|
||||
<table lay-skin="line">
|
||||
<colgroup>
|
||||
<col width="80%">
|
||||
{if $detail.card_right_goods_type == 'all'}
|
||||
<col width="20%">
|
||||
{/if}
|
||||
{if $detail.card_right_goods_type != 'all'}
|
||||
<col width="10%">
|
||||
<col width="10%">
|
||||
{/if}
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
{foreach $detail['card_goods_list'] as $list_k => $order_goods_item}
|
||||
<tr class="table-trTow">
|
||||
<td>{$order_goods_item.sku_name}</td>
|
||||
<td>{$order_goods_item.price}</td>
|
||||
{if $detail.card_right_goods_type != 'all'}
|
||||
<td>{$order_goods_item.total_num}</td>
|
||||
{/if}
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="layui-card card-common card-brief">
|
||||
<div class="layui-card-header">
|
||||
<span class="card-title">卡记录</span>
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<ul class="layui-timeline">
|
||||
{foreach name="$card_log_list" item="vo"}
|
||||
<li class="layui-timeline-item">
|
||||
<div class="layui-time-left">
|
||||
<p>{:date('Y-m-d', $vo.create_time)}</p>
|
||||
<p>{:date('H:i:s', $vo.create_time)}</p>
|
||||
</div>
|
||||
<div class="layui-icon layui-timeline-axis">
|
||||
<span class="layui-icon-center"></span>
|
||||
</div>
|
||||
<div class="layui-timeline-content layui-text">
|
||||
<div class="layui-timeline-title">{$vo.remark}</div>
|
||||
</div>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
179
addon/giftcard/shop/view/card/lists.html
Executable file
179
addon/giftcard/shop/view/card/lists.html
Executable file
@@ -0,0 +1,179 @@
|
||||
<style>
|
||||
.table-tab .layui-tab-content{margin-top: 10px;}
|
||||
.add-way .add-way-item{display: flex;margin: 8px 0;align-items: center;}
|
||||
.add-way .add-way-item input{margin: 0 10px;}
|
||||
.add-way .add-way-item .layui-form-radio{margin-right: 0;}
|
||||
</style>
|
||||
|
||||
<div class="screen layui-collapse" lay-filter="card_tab">
|
||||
<div class="layui-colla-item">
|
||||
<form class="layui-colla-content layui-form layui-show">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">编号名称</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="search_text" placeholder="请输入编号名称" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<button type="button" class="layui-btn" lay-filter="search" lay-submit>筛选</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-tab table-tab" lay-filter="bargain_tab">
|
||||
<ul class="layui-tab-title">
|
||||
<li class="layui-this" data-status="all">全部</li>
|
||||
{foreach $status_list as $k => $v}
|
||||
<li data-status="{$k}">{$v}</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
<div class="layui-tab-content poster_list">
|
||||
<!-- 列表 -->
|
||||
<table id="poster_list" lay-filter="poster_list"></table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 操作 -->
|
||||
<script type="text/html" id="action">
|
||||
<div class="table-btn">
|
||||
<a class="layui-btn" lay-event="delete">删除</a>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var table,form,laytpl,element,repeat_flag,layer_label;
|
||||
var giftcard_id = {$giftcard_id};
|
||||
var import_id = {$import_id};
|
||||
|
||||
layui.use(['form','laytpl','element'], function () {
|
||||
laytpl = layui.laytpl;
|
||||
form = layui.form;
|
||||
element = layui.element;
|
||||
repeat_flag = false; //防重复标识
|
||||
form.render();
|
||||
|
||||
table = new Table({
|
||||
elem: '#poster_list',
|
||||
url: ns.url("giftcard://shop/card/lists", {'giftcard_id': giftcard_id,'import_id':import_id}),
|
||||
cols: [
|
||||
[{
|
||||
field: 'card_no',
|
||||
title: '编号',
|
||||
unresize: 'false',
|
||||
width: '20%',
|
||||
},{
|
||||
field: 'card_cdk',
|
||||
title: '卡密',
|
||||
unresize: 'false',
|
||||
width: '20%',
|
||||
}, {
|
||||
title: '生成时间',
|
||||
unresize: 'false',
|
||||
width: '15%',
|
||||
templet: function (data) {
|
||||
return ns.time_to_date(data.create_time);
|
||||
}
|
||||
}, {
|
||||
field: 'member_nickname',
|
||||
title: '激活会员',
|
||||
unresize: 'false',
|
||||
width: '10%',
|
||||
templet: function (data) {
|
||||
return data.member_nickname || '--'
|
||||
}
|
||||
}, {
|
||||
field: 'sort',
|
||||
unresize: 'false',
|
||||
title: '激活时间',
|
||||
width: '15%',
|
||||
templet: function (data) {
|
||||
if(data.activate_time == 0)
|
||||
return "--";
|
||||
else
|
||||
return ns.time_to_date(data.activate_time);
|
||||
}
|
||||
}, {
|
||||
field: 'status_name',
|
||||
title: '状态',
|
||||
unresize: 'false',
|
||||
width: '10%'
|
||||
},{
|
||||
title: '操作',
|
||||
toolbar: '#action',
|
||||
unresize: 'false',
|
||||
align : 'right'
|
||||
}]
|
||||
]
|
||||
});
|
||||
|
||||
element.on('tab(bargain_tab)', function () {
|
||||
table.reload({
|
||||
page: {
|
||||
curr: 1
|
||||
},
|
||||
where: {
|
||||
'status': this.getAttribute('data-status')
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* 监听工具栏操作
|
||||
*/
|
||||
table.tool(function (obj) {
|
||||
var data = obj.data;
|
||||
switch (obj.event) {
|
||||
case 'delete': //删除
|
||||
deleteCard(data.card_id);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
function deleteCard(id) {
|
||||
layer.confirm('确定要删除该卡项记录吗?', function (index) {
|
||||
if (repeat_flag) return;
|
||||
repeat_flag = true;
|
||||
layer.close(index);
|
||||
|
||||
$.ajax({
|
||||
url: ns.url("giftcard://shop/card/delete"),
|
||||
data: {
|
||||
card_id: id
|
||||
},
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function (res) {
|
||||
layer.msg(res.message);
|
||||
repeat_flag = false;
|
||||
if (res.code == 0) {
|
||||
table.reload({
|
||||
page: {
|
||||
curr: 1
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}, function () {
|
||||
layer.close();
|
||||
repeat_flag = false;
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 搜索功能
|
||||
*/
|
||||
form.on('submit(search)', function (data) {
|
||||
table.reload({
|
||||
page: {curr: 1},
|
||||
where: data.field
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
407
addon/giftcard/shop/view/cardimport/lists.html
Executable file
407
addon/giftcard/shop/view/cardimport/lists.html
Executable file
@@ -0,0 +1,407 @@
|
||||
<style>
|
||||
.add-way .add-way-item{display: flex;margin: 8px 0;align-items: center;flex-wrap: wrap;}
|
||||
.add-way .add-way-item input{margin: 0 10px;}
|
||||
.add-way .add-way-item .layui-form-radio{margin-right: 0;padding-right: 0;}
|
||||
.add-way .word-aux{flex-basis: 100%;margin-left: 0;}
|
||||
.disabled-click{pointer-events: none;color: #999 !important;}
|
||||
#addFile {margin-left: 10px;cursor: pointer;color: var(--base-color);}
|
||||
.upload-file{flex-basis: 100%;padding-left: 12px;padding-top: 5px;}
|
||||
.load-animation {
|
||||
position: fixed;
|
||||
z-index: 19999999;
|
||||
background-color: rgba(255,255,255,.9);
|
||||
width: 700px;
|
||||
height: 400px;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
margin: auto;
|
||||
}
|
||||
.load-animation .load-head{
|
||||
font-size: 16px;
|
||||
height: 44px;
|
||||
line-height: 44px;
|
||||
padding-left: 10px;
|
||||
}
|
||||
.load-animation .load-body {
|
||||
height: 300px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-size: 16px;
|
||||
}
|
||||
.load-animation .load-body .animation-outer{
|
||||
position: relative;
|
||||
margin-top: 30px;
|
||||
border-radius: 10px;
|
||||
width: 300px;
|
||||
height: 10px;
|
||||
background-color: #eee;
|
||||
}
|
||||
.load-animation .load-body .animation-within{
|
||||
border-radius: 10px;
|
||||
width: 0;
|
||||
height: 100%;
|
||||
background-color: var(--base-color);
|
||||
transition: all .3s;
|
||||
}
|
||||
.load-animation .load-body .num{
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
top: -20px
|
||||
}
|
||||
.confirm-import{margin-left: 0 !important;}
|
||||
</style>
|
||||
|
||||
<div class="single-filter-box">
|
||||
<button class="layui-btn" onclick="addCard()">添加卡密</button>
|
||||
</div>
|
||||
|
||||
<div class="layui-tab table-tab" lay-filter="bargain_tab">
|
||||
<div class="layui-tab-content poster_list">
|
||||
<!-- 列表 -->
|
||||
<table id="poster_list" lay-filter="poster_list"></table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type='text/html' id="iog_card_cdk">
|
||||
<div class="layui-form iog-card-cdk">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label sm">添加方式:</label>
|
||||
<div class="layui-input-block add-way">
|
||||
<div class="add-way-item">
|
||||
<input type="radio" name="type" value="auto" lay-filter="validityType" checked>
|
||||
<span class="sub-text">在线制卡</span>
|
||||
<input type="number" class="layui-input len-short sub-text" name="num">
|
||||
<span class="sub-text">张</span>
|
||||
<div class="word-aux">在线制卡最多单次制作1千张,卡号及密钥按照制卡规则设置。</div>
|
||||
</div>
|
||||
<div class="add-way-item">
|
||||
<input type="radio" name="type" value="import" lay-filter="validityType">
|
||||
<span class="sub-text disabled-click">导入制卡</span>
|
||||
<span>(下载<a href="GIFTCARD_CSV/card_import.csv" class="text-color" target="_blank">导入模板</a>)</span>
|
||||
<div class="upload-file sub-text disabled-click">
|
||||
<div class="upload-img-block" id="addFile">
|
||||
<div class="upload-img-box">
|
||||
<div class="upload-default">
|
||||
<div class="upload">
|
||||
<i class="iconfont iconshangchuan"></i>
|
||||
<p>导入模版</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="word-aux">导入制卡需上传卡密文档,注意不要重复,且单次最多制作1千张。</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<button class="layui-btn confirm-auto">确定</button>
|
||||
<button class="layui-btn confirm-import layui-hide">确定</button>
|
||||
<button class="layui-btn layui-btn-primary cancel">取消</button>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<!-- 操作 -->
|
||||
<script type="text/html" id="operation">
|
||||
<div class="table-btn">
|
||||
<a class="layui-btn" lay-event="delete">删除</a>
|
||||
<a class="layui-btn" lay-event="export">导出</a>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var table,form,laytpl,upload,layer_label,
|
||||
repeat_flag = false; //防重复标识
|
||||
var giftcard_id = {$giftcard_id};
|
||||
|
||||
layui.use(['form','laytpl','upload'], function () {
|
||||
laytpl = layui.laytpl;
|
||||
form = layui.form;
|
||||
upload = layui.upload;
|
||||
form.render();
|
||||
|
||||
table = new Table({
|
||||
elem: '#poster_list',
|
||||
url: ns.url("giftcard://shop/cardimport/lists",{'giftcard_id': giftcard_id}),
|
||||
cols: [
|
||||
[
|
||||
{
|
||||
field:'type_name',
|
||||
title: '制卡类型',
|
||||
unresize: 'false',
|
||||
width: '15%',
|
||||
}, {
|
||||
field: 'total_count',
|
||||
unresize: 'false',
|
||||
title: '在线/导入制卡数',
|
||||
width: '10%',
|
||||
}, {
|
||||
field: 'success_count',
|
||||
unresize: 'false',
|
||||
title: '成功制卡数',
|
||||
width: '10%',
|
||||
}, {
|
||||
field: 'fail_count',
|
||||
unresize: 'false',
|
||||
title: '导入失败数',
|
||||
width: '10%'
|
||||
},
|
||||
{
|
||||
field: 'use_count',
|
||||
unresize: 'false',
|
||||
title: '使用数',
|
||||
width: '10%',
|
||||
}, {
|
||||
field: 'activate_count',
|
||||
unresize: 'false',
|
||||
title: '激活数',
|
||||
width: '10%',
|
||||
}, {
|
||||
field: 'create_time',
|
||||
title: '制卡时间',
|
||||
unresize: 'false',
|
||||
width: '15%',
|
||||
templet: function (data) {
|
||||
return ns.time_to_date(data.create_time);
|
||||
}
|
||||
}, {
|
||||
title: '操作',
|
||||
toolbar: '#operation',
|
||||
unresize: 'false',
|
||||
align : 'right'
|
||||
}]
|
||||
]
|
||||
});
|
||||
|
||||
/**
|
||||
* 监听工具栏操作
|
||||
*/
|
||||
table.tool(function (obj) {
|
||||
var data = obj.data;
|
||||
switch (obj.event) {
|
||||
case 'export':
|
||||
exportFn(data.import_id);
|
||||
break;
|
||||
case 'delete':
|
||||
del(data.import_id);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 导出
|
||||
*/
|
||||
function exportFn(id) {
|
||||
window.open(ns.url("giftcard://shop/cardimport/export",{ request_mode: 'download',import_id: id}));
|
||||
}
|
||||
|
||||
// 删除
|
||||
function del(id){
|
||||
layer.confirm('您正在执行删除操作,请谨慎处理', {
|
||||
btn: ['确定','取消'] //按钮
|
||||
,cancel: function(index, layero){
|
||||
repeat_flag = false;
|
||||
layer.close(index);
|
||||
}
|
||||
},function (index) {
|
||||
if (repeat_flag) return false;
|
||||
repeat_flag = true;
|
||||
layer.close(index);
|
||||
$.ajax({
|
||||
url: ns.url("giftcard://shop/cardimport/delete"),
|
||||
data: {
|
||||
import_id: id
|
||||
},
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function (res) {
|
||||
layer.msg(res.message);
|
||||
if (res.code == 0) {
|
||||
table.reload();
|
||||
}
|
||||
repeat_flag = false;
|
||||
}
|
||||
});
|
||||
}, function(index){
|
||||
repeat_flag = false;
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// 添加卡密
|
||||
var interval;
|
||||
var formData = new FormData();
|
||||
var cardPup;
|
||||
function addCard(){
|
||||
laytpl($("#iog_card_cdk").html()).render({}, function (html) {
|
||||
cardPup = layer.open({
|
||||
type: 1,
|
||||
title:"添加卡密",
|
||||
area:['700px','400px'],
|
||||
content: html,
|
||||
success: function(layero, index){
|
||||
form.render();
|
||||
|
||||
// 上传文件
|
||||
var uploadInst = upload.render({
|
||||
elem: '#addFile' //绑定元素
|
||||
,url: ns.url("giftcard://shop/cardimport/create") //上传接口
|
||||
,accept:'file'
|
||||
,acceptMime: '.csv'
|
||||
,exts: 'csv'
|
||||
,auto: false
|
||||
,bindAction: ".iog-card-cdk .confirm-import"
|
||||
,data:{
|
||||
type: 'import',
|
||||
giftcard_id
|
||||
},
|
||||
choose:function(obj){
|
||||
//预读本地文件,如果是多文件,则会遍历。(不支持ie8/9)
|
||||
obj.preview(function(index, file, result){
|
||||
$("#addFile .upload").html(file.name);
|
||||
formData.append('file',file);
|
||||
});
|
||||
},
|
||||
done: function(res){
|
||||
if (res.code >= 0) {
|
||||
importing(res.data,'import');
|
||||
} else {
|
||||
layer.msg(res.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
form.on('radio(validityType)', function(data){
|
||||
if(data.value == 'auto'){
|
||||
$(".iog-card-cdk .confirm-import").addClass("layui-hide");
|
||||
$(".iog-card-cdk .confirm-auto").removeClass("layui-hide");
|
||||
}else{
|
||||
$(".iog-card-cdk .confirm-import").removeClass("layui-hide");
|
||||
$(".iog-card-cdk .confirm-auto").addClass("layui-hide");
|
||||
}
|
||||
$(data.elem).parent(".add-way-item").siblings().find(".sub-text").addClass("disabled-click");
|
||||
$(data.elem).parent(".add-way-item").find(".sub-text").removeClass("disabled-click");
|
||||
});
|
||||
|
||||
$(".iog-card-cdk .confirm-auto").click(()=>{
|
||||
var obj = {};
|
||||
obj.type = $(".iog-card-cdk input[name='type']:checked").val();
|
||||
obj.giftcard_id = giftcard_id;
|
||||
|
||||
var num = $(".iog-card-cdk input[name='num']").val();
|
||||
if(obj.type == 'auto')
|
||||
obj.num = num;
|
||||
else if(obj.type == 'import')
|
||||
return false;
|
||||
|
||||
if (repeat_flag) return;
|
||||
repeat_flag = true;
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
dataType: 'JSON',
|
||||
url: ns.url("giftcard://shop/cardimport/create"),
|
||||
data: obj,
|
||||
success: function (res) {
|
||||
repeat_flag = false;
|
||||
if (res.code >= 0) {
|
||||
importing(res.data);
|
||||
} else {
|
||||
layer.msg(res.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$(".iog-card-cdk .form-row .cancel").click(function(){
|
||||
layer.closeAll();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
function importing(data) {
|
||||
loadAnimation();
|
||||
cdkLog(data);
|
||||
getCardImportInfo(data);
|
||||
interval = setInterval(()=>{
|
||||
getCardImportInfo(data);
|
||||
},1000);
|
||||
}
|
||||
|
||||
function cdkLog(id) {
|
||||
formData.append('import_id',id);
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
dataType: 'JSON',
|
||||
url: ns.url("giftcard://shop/cardimport/cdkLog"),
|
||||
data: formData,
|
||||
processData: false,
|
||||
contentType:false,
|
||||
success: function (res) {}
|
||||
});
|
||||
}
|
||||
|
||||
function getCardImportInfo(id) {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
dataType: 'JSON',
|
||||
url: ns.url("giftcard://shop/cardimport/getCardImportInfo"),
|
||||
data: {import_id:id},
|
||||
success: function (res) {
|
||||
if(res.code >= 0){
|
||||
var data = res.data;
|
||||
var num = ((parseInt(data.imported_count)/parseInt(data.total_count))*100).toFixed(2);
|
||||
if(num >= 100) num = 100;
|
||||
progress(num);
|
||||
if(parseInt(data.imported_count) == parseInt(data.total_count)){
|
||||
clearInterval(interval);
|
||||
layer.msg("制卡成功");
|
||||
formData.delete('import_id');
|
||||
formData.delete('file');
|
||||
setTimeout(()=>{
|
||||
closeProgress();
|
||||
layer.close(cardPup);
|
||||
table.reload();
|
||||
},1000)
|
||||
}
|
||||
}else
|
||||
repeat_flag = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function loadAnimation(){
|
||||
var html = `
|
||||
<div class="load-animation">
|
||||
<div class="load-head">正在添加</div>
|
||||
<div class="load-body">
|
||||
<div>卡密正在添加中,请稍等...</div>
|
||||
<div class="animation-outer">
|
||||
<span class="num">0.00%</span>
|
||||
<div class="animation-within"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
$("body").append(html);
|
||||
}
|
||||
function progress(num) {
|
||||
$(".load-animation .animation-within").css("width",num+'%');
|
||||
$(".load-animation .num").html(num+'%');
|
||||
}
|
||||
function closeProgress() {
|
||||
$(".load-animation").remove();
|
||||
}
|
||||
</script>
|
||||
130
addon/giftcard/shop/view/category/add.html
Executable file
130
addon/giftcard/shop/view/category/add.html
Executable file
@@ -0,0 +1,130 @@
|
||||
<style>
|
||||
.colorSelector{
|
||||
position: relative;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border-radius: 3px;
|
||||
border: 1px solid #d7d7d7;
|
||||
display: inline-block;
|
||||
cursor: pointer;
|
||||
vertical-align: middle;
|
||||
padding: 2px;
|
||||
}
|
||||
.colorSelector div{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 3px;
|
||||
}
|
||||
.flexbox-fix-btn .btn{
|
||||
margin-top: 0;
|
||||
line-height: 1;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="layui-form">
|
||||
<div class="layui-card card-common card-brief">
|
||||
<div class="layui-card-body">
|
||||
<div class="layui-form ns-form">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>分组名称:</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="category_name" type="text" lay-verify="required" class="layui-input len-mid">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>排序:</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="sort" type="number" lay-verify="num" class="layui-input len-mid">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>分组颜色:</label>
|
||||
<div class="layui-input-block flex">
|
||||
<div class="flex_fill">
|
||||
<div class="picker colorSelector" id="color-picker">
|
||||
<div data-value="#333"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<button class="layui-btn" lay-submit lay-filter="save">保存</button>
|
||||
<button class="layui-btn layui-btn-primary" onclick="backGiftCardCategoryList()">返回</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" src="__STATIC__/ext/colorPicker/js/colorpicker.js"></script>
|
||||
<script>
|
||||
var form,repeat_flag = false;//防重复标识
|
||||
layui.use(['form'], function() {
|
||||
form = layui.form;
|
||||
form.render();
|
||||
|
||||
Colorpicker.create({
|
||||
el: "color-picker",
|
||||
color: "#333",
|
||||
change: function (elem, hex) {
|
||||
$('#color-picker').attr('data-value', hex);
|
||||
$('#color-picker div').css('background', hex);
|
||||
}
|
||||
});
|
||||
/**
|
||||
* 表单验证
|
||||
*/
|
||||
form.verify({
|
||||
num: function(value) {
|
||||
if(!new RegExp("^-?[1-9]\\d*$").test(value)){
|
||||
return "排序号只能是大于0的整数";
|
||||
}
|
||||
if(value < 0){
|
||||
return "排序号必须大于0";
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
* 监听保存
|
||||
*/
|
||||
form.on('submit(save)', function(data) {
|
||||
data.field.font_color = $('#color-picker').attr('data-value');
|
||||
|
||||
if(repeat_flag) return false;
|
||||
repeat_flag = true;
|
||||
|
||||
$.ajax({
|
||||
url: ns.url("giftcard://shop/category/add"),
|
||||
data: data.field,
|
||||
dataType: 'JSON', //服务器返回json格式数据
|
||||
type: 'POST', //http请求类型
|
||||
success: function(res) {
|
||||
repeat_flag = false;
|
||||
if (res.code == 0) {
|
||||
layer.confirm('添加成功', {
|
||||
title:'操作提示',
|
||||
btn: ['返回列表', '继续添加'],
|
||||
closeBtn: 0,
|
||||
yes: function(index, layero) {
|
||||
location.hash = ns.hash("giftcard://shop/category/lists")
|
||||
layer.close(index);
|
||||
},
|
||||
btn2: function(index, layero) {
|
||||
listenerHash(); // 刷新页面
|
||||
layer.close(index);
|
||||
}
|
||||
});
|
||||
}else{
|
||||
layer.msg(res.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// 返回
|
||||
function backGiftCardCategoryList() {
|
||||
location.hash = ns.hash("giftcard://shop/category/lists");
|
||||
}
|
||||
</script>
|
||||
149
addon/giftcard/shop/view/category/edit.html
Executable file
149
addon/giftcard/shop/view/category/edit.html
Executable file
@@ -0,0 +1,149 @@
|
||||
<style>
|
||||
.colorSelector{
|
||||
position: relative;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border-radius: 3px;
|
||||
border: 1px solid #d7d7d7;
|
||||
display: inline-block;
|
||||
cursor: pointer;
|
||||
vertical-align: middle;
|
||||
padding: 2px;
|
||||
}
|
||||
.colorSelector div{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 3px;
|
||||
}
|
||||
.flexbox-fix-btn .btn{
|
||||
margin-top: 0;
|
||||
line-height: 1;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="layui-form">
|
||||
<div class="layui-card card-common card-brief">
|
||||
<div class="layui-card-body">
|
||||
<div class="layui-form ns-form">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>分组名称:</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="category_name" type="text" lay-verify="required" class="layui-input len-mid" value="{$detail.category_name}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>排序:</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="sort" type="number" lay-verify="num" class="layui-input len-mid" value="{$detail.sort}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>分组颜色:</label>
|
||||
<div class="layui-input-block flex">
|
||||
<div class="flex_fill">
|
||||
<div class="picker colorSelector" id="color-picker">
|
||||
<div data-value="{$detail.font_color}"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" name="category_id" value="{$detail.category_id}">
|
||||
<div class="form-row">
|
||||
<button class="layui-btn" lay-submit lay-filter="save">保存</button>
|
||||
<button class="layui-btn layui-btn-primary" onclick="backGiftCardCategoryList()">返回</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--素材图片列表-->
|
||||
<script type="text/html" id="mediaImage">
|
||||
{{# if(d.list.length){ }}
|
||||
{{# for(var i=0;i<d.list.length;i++){ }}
|
||||
<div class="item upload_img_square_item" data-index="{{i}}">
|
||||
<div class="img-wrap">
|
||||
<img src="{{ns.img(d.list[i])}}" layer-src="{{ns.img(d.list[i])}}">
|
||||
</div>
|
||||
<div class="operation">
|
||||
<i title="图片预览" class="iconfont iconreview js-preview"></i>
|
||||
<i title="删除图片" class="layui-icon layui-icon-delete js-delete" data-index="{{i}}"></i>
|
||||
<div class="replace_img" data-index="{{i}}">点击替换</div>
|
||||
</div>
|
||||
</div>
|
||||
{{# } }}
|
||||
{{# if(d.list.length < d.max){ }}
|
||||
<div class="item js-add-media-image upload_img_square">+</div>
|
||||
{{# } }}
|
||||
{{# }else{ }}
|
||||
<div class="item js-add-media-image upload_img_square">+</div>
|
||||
{{# } }}
|
||||
</script>
|
||||
<script type="text/javascript" src="__STATIC__/ext/colorPicker/js/colorpicker.js"></script>
|
||||
<script>
|
||||
var form,repeat_flag = false; //防重复标识
|
||||
layui.use(['form'], function() {
|
||||
form = layui.form;
|
||||
form.render();
|
||||
|
||||
Colorpicker.create({
|
||||
el: "color-picker",
|
||||
color: "#333",
|
||||
change: function (elem, hex) {
|
||||
$('#color-picker').attr('data-value', hex);
|
||||
$('#color-picker div').css('background', hex);
|
||||
}
|
||||
});
|
||||
/**
|
||||
* 表单验证
|
||||
*/
|
||||
form.verify({
|
||||
num: function(value) {
|
||||
if(!new RegExp("^-?[1-9]\\d*$").test(value)){
|
||||
return "排序号只能是大于0的整数";
|
||||
}
|
||||
if(value < 0){
|
||||
return "排序号必须大于0";
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
* 监听保存
|
||||
*/
|
||||
form.on('submit(save)', function(data) {
|
||||
data.field.font_color = $('#color-picker').attr('data-value');
|
||||
|
||||
if(repeat_flag) return false;
|
||||
repeat_flag = true;
|
||||
|
||||
$.ajax({
|
||||
url: ns.url("giftcard://shop/category/edit"),
|
||||
data: data.field,
|
||||
dataType: 'JSON', //服务器返回json格式数据
|
||||
type: 'POST', //http请求类型
|
||||
success: function(res) {
|
||||
repeat_flag = false;
|
||||
if (res.code == 0) {
|
||||
layer.confirm('编辑成功', {
|
||||
title:'操作提示',
|
||||
btn: ['返回列表'],
|
||||
closeBtn: 0,
|
||||
yes: function(index, layero) {
|
||||
location.hash = ns.hash("giftcard://shop/category/lists")
|
||||
layer.close(index);
|
||||
}
|
||||
});
|
||||
}else{
|
||||
layer.msg(res.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function backGiftCardCategoryList() {
|
||||
location.hash = ns.hash("giftcard://shop/category/lists");
|
||||
}
|
||||
</script>
|
||||
189
addon/giftcard/shop/view/category/lists.html
Executable file
189
addon/giftcard/shop/view/category/lists.html
Executable file
@@ -0,0 +1,189 @@
|
||||
<style>
|
||||
.len-short{width: 70px !important;}
|
||||
</style>
|
||||
|
||||
<div class="single-filter-box">
|
||||
<button class="layui-btn" onclick="add()">添加分组</button>
|
||||
</div>
|
||||
<div class="screen layui-collapse" lay-filter="category_tab">
|
||||
<div class="layui-colla-item">
|
||||
<form class="layui-colla-content layui-form layui-show">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">分组名称</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="search_text" placeholder="请输入分组名称" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<button type="button" class="layui-btn" lay-filter="search" lay-submit>筛选</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-tab table-tab" lay-filter="category_tab">
|
||||
<div class="layui-tab-content">
|
||||
<!-- 列表 -->
|
||||
<table id="list" lay-filter="list"></table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 编辑排序 -->
|
||||
<script type="text/html" id="editSort">
|
||||
<input name="sort" type="number" onchange="modifySort({{d.category_id}}, this)" value="{{d.sort}}" class="layui-input edit-sort len-short">
|
||||
</script>
|
||||
|
||||
<!-- 操作 -->
|
||||
<script type="text/html" id="operation">
|
||||
<div class="table-btn">
|
||||
<a class="layui-btn" lay-event="edit">编辑</a>
|
||||
<a class="layui-btn" lay-event="delete">删除</a>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var table ,form, laytpl,layer_label, element;
|
||||
var repeat_flag = false; //防重复标识
|
||||
|
||||
layui.use(['form', 'laytpl','element',], function () {
|
||||
form = layui.form;
|
||||
laytpl = layui.laytpl;
|
||||
form.render();
|
||||
|
||||
table = new Table({
|
||||
elem: '#list',
|
||||
url: ns.url("giftcard://shop/category/lists"),
|
||||
cols: [
|
||||
[{
|
||||
field: 'category_name',
|
||||
title: '分组名称',
|
||||
unresize: 'false',
|
||||
width: '15%',
|
||||
}, {
|
||||
field: 'font_color',
|
||||
unresize: 'false',
|
||||
title: '分组颜色',
|
||||
templet: function (data) {
|
||||
return '<span style="color:'+data.font_color+'">'+data.font_color+'</span>'
|
||||
},
|
||||
}, {
|
||||
field: 'sort',
|
||||
unresize: 'false',
|
||||
title: '排序',
|
||||
templet: '#editSort',
|
||||
sort : true,
|
||||
width: '15%',
|
||||
}, {
|
||||
field: 'create_time',
|
||||
title: '创建时间',
|
||||
unresize: 'false',
|
||||
templet: function (data) {
|
||||
return ns.time_to_date(data.create_time);
|
||||
}
|
||||
}, {
|
||||
title: '操作',
|
||||
toolbar: '#operation',
|
||||
unresize: 'false',
|
||||
align : 'right'
|
||||
}]
|
||||
]
|
||||
});
|
||||
|
||||
/**
|
||||
* 监听工具栏操作
|
||||
*/
|
||||
table.tool(function (obj) {
|
||||
var data = obj.data;
|
||||
switch (obj.event) {
|
||||
case 'edit':
|
||||
location.hash = ns.hash("giftcard://shop/category/edit", {'category_id': data.category_id});
|
||||
break;
|
||||
case 'delete':
|
||||
del(data.category_id);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 监听搜索
|
||||
*/
|
||||
form.on('submit(search)', function(data){
|
||||
table.reload({
|
||||
page: {
|
||||
curr: 1
|
||||
},
|
||||
where: data.field
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
function del(id){
|
||||
if (repeat_flag) return false;
|
||||
repeat_flag = true;
|
||||
layer.confirm('您正在执行删除操作,请谨慎处理', {
|
||||
btn: ['确定','取消'] //按钮
|
||||
,cancel: function(index, layero){
|
||||
repeat_flag = false;
|
||||
layer.close(index);
|
||||
}
|
||||
},function (index) {
|
||||
layer.close(index);
|
||||
$.ajax({
|
||||
url: ns.url("giftcard://shop/category/delete"),
|
||||
data: {
|
||||
category_id: id
|
||||
},
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function (res) {
|
||||
layer.msg(res.message);
|
||||
repeat_flag = false;
|
||||
if (res.code == 0) {
|
||||
table.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
}, function(index){
|
||||
repeat_flag = false;
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// 监听单元格编辑
|
||||
function modifySort(id, event) {
|
||||
var data = $(event).val();
|
||||
if (!new RegExp("^-?[1-9]\\d*$").test(data)) {
|
||||
layer.msg("排序号只能是整数");
|
||||
return;
|
||||
}
|
||||
if(data<0){
|
||||
layer.msg("排序号必须大于0");
|
||||
return ;
|
||||
}
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: ns.url("giftcard://shop/category/modifySort"),
|
||||
data: {
|
||||
sort: data,
|
||||
category_id: id
|
||||
},
|
||||
dataType: 'JSON',
|
||||
success: function(res) {
|
||||
layer.msg(res.message);
|
||||
if (res.code == 0) {
|
||||
table.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function add() {
|
||||
location.hash = ns.hash("giftcard://shop/category/add");
|
||||
}
|
||||
|
||||
</script>
|
||||
732
addon/giftcard/shop/view/giftcard/add.html
Executable file
732
addon/giftcard/shop/view/giftcard/add.html
Executable file
@@ -0,0 +1,732 @@
|
||||
|
||||
<style>
|
||||
.hide{display: none;}
|
||||
.goods_num {padding-left: 20px;}
|
||||
.goods-image-wrap .js-goods-image{margin-bottom: 0;line-height: 1;display: flex}
|
||||
.card-common .goods-image-wrap .item{width: 185px;height: 119.7px;line-height: 119.7px;margin-top: 5px;margin-bottom: 5px;float: unset}
|
||||
.card-common .goods-image-wrap .item .img-wrap{width: 100%;height: 100%;}
|
||||
.card-common .goods-image-wrap .item .img-wrap img{max-height: 100%;max-width: 100%;width: auto;height: auto;display: flex;align-items: center;justify-content: center;}
|
||||
.card-common .goods-image-wrap .item .operation{width: 100%;height: 100%;line-height: 5;}
|
||||
.layui-table .goods-title{display: flex;align-items: center;}
|
||||
.layui-table .goods-title .goods-img{width: 55px;height: 55px;line-height: 55px;flex-shrink: 0;margin-right: 10px;}
|
||||
.layui-table .goods-title .goods-img img{max-width: 100%;max-height: 100%;}
|
||||
#real-goods .layui-table{margin-bottom: 0;margin-top: 0;}
|
||||
#real-goods #goods{border: 0;}
|
||||
#real-goods .layui-table-body{overflow: auto;max-height: 500px;margin-bottom: 15px;border-bottom: 1px solid #e6e6e6;}
|
||||
#real-goods .layui-table-body tbody tr:last-of-type td{border: none;}
|
||||
.layui-table-head tr th:last-of-type{text-align: right;}
|
||||
.layui-table-body tr td:last-of-type .table-btn{justify-content: flex-end;}
|
||||
.disabled-click{pointer-events: none;color: #999 !important;}
|
||||
.period-validity .layui-input-block>div{margin: 8px 0;display: flex;align-items: center;}
|
||||
.period-validity .layui-input-block>div .layui-input-inline{margin: 0 8px;}
|
||||
.period-validity .layui-input-block .layui-form-radio{margin-right: 0;padding-right: 0;}
|
||||
.layui-input-inline.totality-num{float: none;}
|
||||
.commodity-type-box{display: flex;}
|
||||
.commodity-type-item{
|
||||
margin-right: 15px;
|
||||
padding: 15px 20px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
border: 1px solid #e5e5e5;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="layui-form">
|
||||
<!-- 礼品卡类型 -->
|
||||
<div class="layui-tab layui-tab-brief" lay-filter="goods_tab">
|
||||
<div class="layui-tab-content">
|
||||
<div class="layui-tab-item layui-show">
|
||||
<div class="layui-card card-common card-brief">
|
||||
<div class="layui-card-header">
|
||||
<span class="card-title">礼品卡类型</span>
|
||||
</div>
|
||||
<div class="layui-card-body commodity-type-box" >
|
||||
<div class="commodity-type-item {if $card_type == 'virtual'}border-color{/if}" onclick="location.hash = ns.hash('giftcard://shop/giftcard/add?card_type=virtual')">
|
||||
<span class="{if $card_type == 'virtual'}text-color{/if}">电子卡</span>
|
||||
<span class="text-color-gray">(线上购买)</span>
|
||||
</div>
|
||||
<div class="commodity-type-item {if $card_type == 'real'}border-color{/if}" onclick="location.hash = ns.hash('giftcard://shop/giftcard/add?card_type=real')">
|
||||
<span class="{if $card_type == 'real'}text-color{/if}">实体卡</span>
|
||||
<span class="text-color-gray">(线下发放)</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-card card-common card-brief">
|
||||
<input name="card_type" value="{$card_type}" type="hidden">
|
||||
<div class="layui-card-header">
|
||||
<span class="card-title">基础设置</span>
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>礼品卡名称:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="card_name" value="" lay-verify="required" autocomplete="off" class="layui-input len-long" maxlength="40">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>分组:</label>
|
||||
<div class="layui-input-inline len-mid">
|
||||
<select class="category_id" name="category_id" lay-verify="required" lay-filter="categoryId">
|
||||
<option value="">请选择</option>
|
||||
{foreach $category_list as $k=>$v}
|
||||
<option value="{$v['category_id']}">{$v['category_name']}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div id="card-cover" class="layui-form-item goods-image-wrap">
|
||||
<label class="layui-form-label"><span class="required">*</span>礼品卡封面:</label>
|
||||
<div class="layui-input-block">
|
||||
<!--素材图片-->
|
||||
<div class="js-goods-image"></div>
|
||||
</div>
|
||||
<div class="word-aux">至少传一张封面,最多上传3张封面</div>
|
||||
</div>
|
||||
{if $card_type == 'virtual'}
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">销售价:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="number" min="0" name="card_price" onchange="detectionNumType(this,'positiveNumber')" class="layui-input len-short integral" autocomplete="off" value="0.00">
|
||||
</div>
|
||||
<div class="layui-form-mid">元</div>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">排序:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" min="0" name="sort" value="0" lay-verify='sort' onchange="detectionNumType(this,'integral')" autocomplete="off" class="layui-input len-short">
|
||||
</div>
|
||||
</div>
|
||||
{if $card_type == 'virtual'}
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">是否允许转赠:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="radio" name="is_allow_transfer" value="1" lay-verify="required" title="是" checked>
|
||||
<input type="radio" name="is_allow_transfer" value="0" lay-verify="required" title="否">
|
||||
</div>
|
||||
<div class="word-aux">转赠开启后,用户可以将自己的礼品卡作为礼包赠送给其他用户</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{if $card_type == 'real'}
|
||||
<div class="layui-card-header">
|
||||
<span class="card-title">制卡规则</span>
|
||||
</div>
|
||||
<div class="layui-card-body ">
|
||||
|
||||
<div class="layui-form-item participation-condition">
|
||||
<label class="layui-form-label"><span class="required">*</span>秘钥内容:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" class="cdk_type" name="cdk_type[]" value="0-9" lay-skin="primary" title="0-9" checked>
|
||||
<input type="checkbox" class="cdk_type" name="cdk_type[]" value="a-z" lay-skin="primary" title="a-z">
|
||||
<input type="checkbox" class="cdk_type" name="cdk_type[]" value="A-Z" lay-skin="primary" title="A-Z">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>秘钥位数:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" min="4" name="cdk_length" lay-verify="required|cdk_length" onchange="detectionNumType(this,'integral')" class="layui-input len-short" autocomplete="off" value="6">
|
||||
</div>
|
||||
<div class="word-aux">
|
||||
卡密位数仅限制卡密内容长度
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">卡号前缀:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="card_prefix" value="" autocomplete="off" class="layui-input len-long">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">卡号后缀:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="card_suffix" value="" autocomplete="off" class="layui-input len-long">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="layui-card-header">
|
||||
<span class="card-title">礼品卡权益</span>
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<!--类型选择-->
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>权益类型:</label>
|
||||
<div class="layui-input-block">
|
||||
{foreach $card_right_type_list as $k=>$v}
|
||||
<input type="radio" name="card_right_type" value="{$k}" lay-verify="required" lay-filter="cardRightType" title="{$v}" {if $k=='balance' }checked{/if}>
|
||||
{/foreach}
|
||||
</div>
|
||||
</div>
|
||||
<!--储值-->
|
||||
<div id="real-balance" class="layui-show">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">储值余额:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="number" min="0" name="balance" onchange="detectionNumType(this,'positiveNumber')" class="layui-input len-short" autocomplete="off" value="0">
|
||||
</div>
|
||||
<div class="layui-form-mid">元</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--商品-->
|
||||
<div id="real-goods" class="layui-hide">
|
||||
<!--数量类型选择-->
|
||||
<div class="layui-form-item goods-number">
|
||||
<label class="layui-form-label"><span class="required">*</span>礼品卡中商品选赠规则:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="radio" name="card_right_goods_type" value="item" lay-verify="required" lay-filter="cardTightGoodsType" title="礼品卡由下列商品及其数量打包而成" checked>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item goods-number">
|
||||
<label class="layui-form-label"></label>
|
||||
<div class="layui-input-block">
|
||||
<input type="radio" name="card_right_goods_type" value="all" lay-verify="required" lay-filter="cardTightGoodsType" title="礼品卡持卡人兑换时可从以下商品列表中任选N件商品">
|
||||
<div class="layui-input-inline totality-num">
|
||||
<input type="number" min="0" disabled name="card_right_goods_count" onchange="detectionNumType(this,'integral')" class="layui-input len-short" autocomplete="off" value="0">
|
||||
</div>
|
||||
<span class="sub-text totality-num disabled-click">件</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">商品:</label>
|
||||
<div class="layui-input-block">
|
||||
<div class="layui-table-head">
|
||||
<table class="layui-table show" lay-skin="line" lay-size="lg">
|
||||
<colgroup>
|
||||
<col width="45%">
|
||||
<col width="15%">
|
||||
<col class="goods_num_col" width="15%">
|
||||
<col width="15%">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>商品名称</th>
|
||||
<th>原价</th>
|
||||
<th class="goods_num_col">数量</th>
|
||||
<th class="operation">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
<div class="layui-table-body">
|
||||
<table class="layui-table show" id="goods" lay-skin="line" lay-size="lg">
|
||||
<colgroup>
|
||||
<col width="45%">
|
||||
<col width="15%">
|
||||
<col class="goods_num_col" width="15%">
|
||||
<col width="15%">
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr class="goods-empty">
|
||||
<td colspan="4">
|
||||
<div>未添加商品</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<button class="layui-btn" onclick="addGoods()">添加商品</button>
|
||||
<span class="goods_num">已选商品(<span id="goods_num" class="text-color">0</span>)</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-card-header">
|
||||
<span class="card-title">有效期</span>
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<div class="layui-form-item period-validity">
|
||||
<label class="layui-form-label"><span class="required">*</span>有效期:</label>
|
||||
<div class="layui-input-block">
|
||||
<div>
|
||||
<input type="radio" name="validity_type" value="forever" lay-filter="validityType" checked>
|
||||
<span class="sub-text">永久有效</span>
|
||||
</div>
|
||||
<div>
|
||||
<input type="radio" name="validity_type" value="date" lay-filter="validityType">
|
||||
<span class="sub-text disabled-click">有效期至</span>
|
||||
<div class="layui-input-inline" style="float: none">
|
||||
<input type="text" class="layui-input sub-text disabled-click" name="validity_time" lay-verify="time" placeholder="有效期限" id="start_time" readonly>
|
||||
<i class="iconrili iconfont calendar"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<input type="radio" name="validity_type" value="day" lay-filter="validityType">
|
||||
<span class="sub-text disabled-click">领取后</span>
|
||||
<div class="layui-input-inline" style="float: none">
|
||||
<input type="number" min="0" name="validity_day" onchange="detectionNumType(this,'integral')" autocomplete="off" class="layui-input len-short sub-text disabled-click" value="0" lay-verify='time_day' readonly>
|
||||
</div>
|
||||
<span class="sub-text disabled-click">天有效</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-card-header">
|
||||
<span class="card-title">使用须知</span>
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required"></span>使用须知:</label>
|
||||
<div class="layui-input-block">
|
||||
<script id="instruction" type="text/plain" style="width:800px;height:400px;"></script>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-card-header">
|
||||
<span class="card-title">礼品卡详情</span>
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required"></span>详情:</label>
|
||||
<div class="layui-input-block">
|
||||
<script id="editor" type="text/plain" style="width:800px;height:400px;"></script>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<button class="layui-btn" lay-submit lay-filter="save">保存</button>
|
||||
<button class="layui-btn layui-btn-primary" onclick="backGiftCardList()">返回</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--素材图片列表-->
|
||||
<script type="text/html" id="mediaImage">
|
||||
{{# if(d.list.length){ }}
|
||||
{{# for(var i=0;i<d.list.length;i++){ }}
|
||||
<div class="item upload_img_square_item" data-index="{{i}}">
|
||||
<div class="img-wrap">
|
||||
<img src="{{ns.img(d.list[i])}}" layer-src="{{ns.img(d.list[i])}}">
|
||||
</div>
|
||||
<div class="operation">
|
||||
<i title="图片预览" class="iconfont iconreview js-preview"></i>
|
||||
<i title="删除图片" class="layui-icon layui-icon-delete js-delete" data-index="{{i}}"></i>
|
||||
<div class="replace_img" data-index="{{i}}">点击替换</div>
|
||||
</div>
|
||||
</div>
|
||||
{{# } }}
|
||||
{{# if(d.list.length < d.max){ }}
|
||||
<div class="item js-add-media-image upload_img_square">+</div>
|
||||
{{# } }}
|
||||
{{# }else{ }}
|
||||
<div class="item js-add-media-image upload_img_square">+</div>
|
||||
{{# } }}
|
||||
</script>
|
||||
<script type="text/javascript" charset="utf-8" src="__STATIC__/ext/ueditor/ueditor.config.js"></script>
|
||||
<script type="text/javascript" charset="utf-8" src="__STATIC__/ext/ueditor/ueditor.all.js"> </script>
|
||||
<script type="text/javascript" charset="utf-8" src="__STATIC__/ext/ueditor/lang/zh-cn/zh-cn.js"></script>
|
||||
<script type="text/javascript" src="GIFTCARD_JS/media.js"></script>
|
||||
<script>
|
||||
var form,laytpl,laydate,
|
||||
repeat_flag = false,
|
||||
selectGoodsSkuId = [],
|
||||
selectGoodsId = [],
|
||||
num_list = [],
|
||||
goods = [],
|
||||
currentDate = new Date(),
|
||||
mediaImage = [],
|
||||
mediaIds = [],
|
||||
activityInstruction,
|
||||
activityDetail;
|
||||
|
||||
var GOODS_IMAGE_MAX = 3; //素材上传数量
|
||||
|
||||
var default_instruction = `1. 礼品卡有效期为购买日起三年内有效,过期失效,请在有效期内使用。<br>2. 本卡可在指定门店,可以本人使用,或者转赠他人,本卡仅限于店铺或者外带时消费使用,不适用于会员卡购买或者充值。<br>3. 本卡不记名、不挂失、不可兑换现金、不找零。可多次使用。<br>4. 如有疑问请拨打:`;
|
||||
|
||||
layui.use(['form', 'laytpl', 'laydate'], function() {
|
||||
laydate = layui.laydate;
|
||||
form = layui.form;
|
||||
laytpl = layui.laytpl;
|
||||
refreshGoodsImage();
|
||||
|
||||
activityDetail = UE.getEditor('editor', {
|
||||
autoHeightEnabled: false
|
||||
});
|
||||
activityInstruction = UE.getEditor('instruction', {
|
||||
autoHeightEnabled: false
|
||||
});
|
||||
|
||||
currentDate.setDate(currentDate.getDate() + 30);
|
||||
form.render();
|
||||
laydate.render({
|
||||
elem: '#start_time',
|
||||
type: 'datetime',
|
||||
change: function(value, date, endDate) {
|
||||
$(".date-picker-btn").removeClass("selected");
|
||||
}
|
||||
});
|
||||
|
||||
//权益类型
|
||||
form.on('radio(cardRightType)', function(data) {
|
||||
if (data.value.trim() == 'balance') {
|
||||
$('#real-balance').removeClass('layui-hide').addClass('layui-show');
|
||||
$('#real-goods').removeClass('layui-show').addClass('layui-hide');
|
||||
$('.goods_num_col').find('input').attr('lay-verify','required');
|
||||
} else if (data.value.trim() == 'goods') {
|
||||
$('#real-goods').removeClass('layui-hide').addClass('layui-show');
|
||||
$('#real-balance').removeClass('layui-show').addClass('layui-hide');
|
||||
$('input[name="balance"]').val(0);
|
||||
$('.goods_num_col').find('input').attr('lay-verify','required|number');
|
||||
}
|
||||
});
|
||||
|
||||
//有效期
|
||||
form.on('radio(validityType)', function(data) {
|
||||
$(data.elem).parent("div").siblings().find(".sub-text").addClass("disabled-click");
|
||||
$(data.elem).parent("div").find(".sub-text").removeClass("disabled-click");
|
||||
if (data.value.trim() == 'forever') {
|
||||
$('input[name="validity_day"]').val('').attr('readonly', 'readonly');
|
||||
$('input[name="validity_time"]').val('');
|
||||
} else if (data.value.trim() == 'date') {
|
||||
$('input[name="validity_day"]').val('').attr('readonly', 'readonly');
|
||||
} else if (data.value.trim() == 'day') {
|
||||
$('input[name="validity_day"]').removeAttr('readonly');
|
||||
$('input[name="validity_time"]').val('');
|
||||
}
|
||||
});
|
||||
|
||||
//商品数量类型
|
||||
form.on('radio(cardTightGoodsType)', function(data) {
|
||||
if (data.value.trim() == 'all') {
|
||||
$(".goods-number .word-aux").addClass("layui-hide");
|
||||
$('.goods_num_col').removeClass('show').addClass('hide');
|
||||
$('.goods_num_col').find('input').attr('lay-verify','required');
|
||||
|
||||
$(".totality-num input").attr("disabled", false);
|
||||
$(".totality-num input").attr('lay-verify','required|number');
|
||||
$(".totality-num").removeClass('disabled-click');
|
||||
|
||||
} else if (data.value.trim() == 'item') {
|
||||
$(".goods-number .word-aux").removeClass("layui-hide");
|
||||
$(".totality-num input").attr("disabled", true);
|
||||
$(".totality-num").addClass('disabled-click');
|
||||
$(".totality-num input").attr('lay-verify','');
|
||||
$('input[name="card_right_goods_count"]').val(0);
|
||||
$('.goods_num_col').removeClass('hide').addClass('show');
|
||||
$('.goods_num_col').find('input').attr('lay-verify','required|number');
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 表单提交
|
||||
*/
|
||||
form.on('submit(save)', function(data) {
|
||||
if (mediaImage.length < 1) {
|
||||
layer.msg("至少选择一个礼品封面");
|
||||
return false;
|
||||
}
|
||||
data.field.media_ids = mediaIds.toString();
|
||||
data.field.card_cover = mediaImage.toString();
|
||||
|
||||
if (data.field.card_right_type == 'goods') {
|
||||
goods = [];
|
||||
var num_list = [];
|
||||
$(".goods_num").each(function() {
|
||||
// 商品按数量
|
||||
if (data.field.card_right_goods_type == 'all') {
|
||||
num_list.push(0);
|
||||
} else {
|
||||
num_list.push($(this).val());
|
||||
}
|
||||
});
|
||||
|
||||
for (var i = 0; i < selectGoodsSkuId.length; i++) {
|
||||
var obj = {};
|
||||
obj.sku_id = selectGoodsSkuId[i];
|
||||
obj.goods_id = selectGoodsId[i];
|
||||
obj.goods_num = num_list[i];
|
||||
goods.push(obj)
|
||||
}
|
||||
data.field.goods_sku_list = JSON.stringify(goods);
|
||||
if (goods.length == 0) {
|
||||
layer.msg("请选择商品");
|
||||
return;
|
||||
}
|
||||
}else{
|
||||
data.field.goods_sku_list = '';
|
||||
if (data.field.balance == 0) {
|
||||
layer.msg("请输入储值余额");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(data.field.card_type == 'real'){
|
||||
if(data.field['cdk_type[0]'] == undefined && data.field['cdk_type[1]'] == undefined && data.field['cdk_type[2]'] == undefined){
|
||||
layer.msg("卡密内容不能为空");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
data.field.desc = activityDetail.getContent();
|
||||
data.field.instruction = activityInstruction.getContent();
|
||||
|
||||
if (repeat_flag) return;
|
||||
repeat_flag = true;
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
dataType: 'JSON',
|
||||
url: ns.url("giftcard://shop/giftcard/add"),
|
||||
data: data.field,
|
||||
async: false,
|
||||
success: function(res) {
|
||||
repeat_flag = false;
|
||||
|
||||
if (res.code == 0) {
|
||||
layer.confirm('添加成功', {
|
||||
title: '操作提示',
|
||||
btn: ['返回列表', '继续添加'],
|
||||
closeBtn: 0,
|
||||
yes: function(index, layero) {
|
||||
location.hash = ns.hash("giftcard://shop/giftcard/lists");
|
||||
layer.close(index);
|
||||
},
|
||||
btn2: function(index, layero) {
|
||||
listenerHash(); // 刷新页面
|
||||
layer.close(index);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
layer.msg(res.message);
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
//表单验证
|
||||
form.verify({
|
||||
number: function(value) {
|
||||
if (value <= 0) {
|
||||
return "数量不能小于或等于0"
|
||||
}
|
||||
},
|
||||
sort: function(value) {
|
||||
if (value < 0) {
|
||||
return "排序不能小于0"
|
||||
}
|
||||
},
|
||||
nums: function(value) {
|
||||
if (value < 10) {
|
||||
return "请输入大于10的数"
|
||||
}
|
||||
},
|
||||
time: function(value) {
|
||||
var time_type = $('[name="time_type"]:checked').val();
|
||||
if (time_type == 2) {
|
||||
var now_time = (new Date()).getTime();
|
||||
var end_time = (new Date(value)).getTime();
|
||||
if (!end_time) {
|
||||
return '有效期不能为空'
|
||||
}
|
||||
if (now_time > end_time) {
|
||||
return '有效期不能小于当前时间!'
|
||||
}
|
||||
}
|
||||
},
|
||||
time_day: function(value) {
|
||||
var time_type = $('[name="time_type"]:checked').val();
|
||||
if (time_type == 3) {
|
||||
if (value <= 0) {
|
||||
return '有效期天数至少为一天!'
|
||||
}
|
||||
}
|
||||
},
|
||||
cdk_length: function(value) {
|
||||
if (value <= 0) {
|
||||
return "密钥位数不能小于或等于0"
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
//添加素材
|
||||
$("body").off("click", ".js-add-media-image").on("click", ".js-add-media-image", function() {
|
||||
openMedia(function(data) {
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
if (mediaImage.length < GOODS_IMAGE_MAX) {
|
||||
mediaImage.push(data[i].media_path);
|
||||
mediaIds.push(data[i].media_id);
|
||||
}
|
||||
}
|
||||
refreshGoodsImage();
|
||||
}, GOODS_IMAGE_MAX - mediaImage.length);
|
||||
});
|
||||
|
||||
//替换商品主图
|
||||
$("body").off("click", ".replace_img").on("click", ".replace_img", function () {
|
||||
var index = $(this).data('index');
|
||||
openMedia(function (data) {
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
mediaImage[index] = data[i].media_path;
|
||||
mediaIds[index] = data[i].media_id;
|
||||
}
|
||||
refreshGoodsImage();
|
||||
},1);
|
||||
});
|
||||
|
||||
//渲染商品主图列表
|
||||
function refreshGoodsImage() {
|
||||
var goods_image_template = $("#mediaImage").html();
|
||||
var data = {
|
||||
list: mediaImage,
|
||||
max: GOODS_IMAGE_MAX
|
||||
};
|
||||
|
||||
laytpl(goods_image_template).render(data, function(html) {
|
||||
|
||||
$(".js-goods-image").html(html);
|
||||
|
||||
//加载图片放大
|
||||
loadImgMagnify();
|
||||
|
||||
if (mediaImage.length) {
|
||||
|
||||
//预览
|
||||
$(".js-goods-image .js-preview").click(function() {
|
||||
$(this).parent().prev().find("img").click();
|
||||
});
|
||||
|
||||
//图片删除
|
||||
$(".js-goods-image .js-delete").click(function() {
|
||||
var index = $(this).attr("data-index");
|
||||
mediaImage.splice(index, 1);
|
||||
mediaIds.splice(index, 1);
|
||||
refreshGoodsImage();
|
||||
});
|
||||
}
|
||||
|
||||
//最多传十张图
|
||||
if (mediaImage.length < GOODS_IMAGE_MAX) {
|
||||
$(".js-add-goods-image").show();
|
||||
} else {
|
||||
$(".js-add-goods-image").hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function backGiftCardList() {
|
||||
location.hash = ns.hash("giftcard://shop/giftcard/lists");
|
||||
}
|
||||
|
||||
//检测数据类型
|
||||
function detectionNumType(el, type) {
|
||||
var value = $(el).val();
|
||||
//大于零 且 不是小数
|
||||
if (value < 0 && type == 'integral')
|
||||
$(el).val(0);
|
||||
else if (type == 'integral')
|
||||
$(el).val(Math.round(value));
|
||||
|
||||
//大于1 且 不是小数
|
||||
if (value < 1 && type == 'positiveInteger')
|
||||
$(el).val(1);
|
||||
else if (type == 'positiveInteger')
|
||||
$(el).val(Math.round(value));
|
||||
//大于零可以是小数
|
||||
if (type == 'positiveNumber') {
|
||||
value = parseFloat(value).toFixed(2);
|
||||
if (value < 0)
|
||||
$(el).val(0);
|
||||
else
|
||||
$(el).val(value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加商品
|
||||
*/
|
||||
function addGoods() {
|
||||
goodsSelect(function (data) {
|
||||
if (Object.keys(data).length == 0) {
|
||||
selectGoodsSkuId = [];
|
||||
selectGoodsId = [];
|
||||
$('.goods-empty').show();
|
||||
$("#goods_num").text(selectGoodsSkuId.length);
|
||||
$("#goods tbody tr:not(.goods-empty)").remove();
|
||||
return;
|
||||
}
|
||||
|
||||
var price = 0.00;
|
||||
var card_right_goods_type_change = $('input[name="card_right_goods_type"]:checked').val();
|
||||
|
||||
var th_display = card_right_goods_type_change == 'item' ? 'show' : 'hide';
|
||||
if (th_display == 'show') {
|
||||
$('.goods_num_col').removeClass('hide').addClass('show');
|
||||
} else {
|
||||
$('.goods_num_col').removeClass('show').addClass('hide');
|
||||
}
|
||||
|
||||
var html = '';
|
||||
|
||||
for (var key in data) {
|
||||
for (var sku in data[key].selected_sku_list) {
|
||||
var item = data[key].selected_sku_list[sku];
|
||||
if (selectGoodsSkuId.indexOf(parseInt(item.sku_id)) != -1) {
|
||||
continue;
|
||||
}
|
||||
html += `<tr data-sku_id="${item.sku_id}" data-goods_id="${item.goods_id}">`;
|
||||
html += `
|
||||
<td>
|
||||
<div class="goods-title">
|
||||
<div class="goods-img">
|
||||
<img layer-src src="${item.sku_image ? ns.img(item.sku_image) : ''}" alt="">
|
||||
</div>
|
||||
<p class="multi-line-hiding goods-name">${item.sku_name}</p>
|
||||
</div>
|
||||
</td>`;
|
||||
html += `<td class='price-one'>${item.price}</td>`;
|
||||
html += `<td class="goods_num_col ` + th_display +
|
||||
`"><input type="number" name="" min="1" onchange="detectionNumType(this,'integral')" lay-verify="required|number" class="layui-input goods_num" value='1'></td>`;
|
||||
html +=
|
||||
`<td class='operation'> <div class='table-btn '><a href='javascript:;' class='layui-btn' onclick='deleteGoods(this)'>删除商品</a></div></td>`;
|
||||
html += `</tr>`;
|
||||
price += Number(item.price);
|
||||
selectGoodsSkuId.push(item.sku_id);
|
||||
selectGoodsId.push(item.goods_id);
|
||||
}
|
||||
}
|
||||
|
||||
if(selectGoodsSkuId.length) {
|
||||
$('.goods-empty').hide();
|
||||
$("#goods tbody").append(html);
|
||||
} else {
|
||||
$('.goods-empty').show();
|
||||
}
|
||||
$("#goods_num").text(selectGoodsSkuId.length);
|
||||
|
||||
}, selectGoodsSkuId, {
|
||||
mode: "sku",
|
||||
goods_class: 1,
|
||||
is_disabled_goods_class: 1
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品
|
||||
*/
|
||||
function deleteGoods(data) {
|
||||
var obj = $(data).parent().parent().parent();
|
||||
$(obj).remove();
|
||||
for (var i in selectGoodsSkuId) {
|
||||
if (selectGoodsSkuId[i] == Number($(obj).attr("data-sku_id"))) {
|
||||
selectGoodsSkuId.splice(i, 1);
|
||||
num_list.splice(i, 1);
|
||||
}
|
||||
}
|
||||
$("#goods_num").text(selectGoodsSkuId.length)
|
||||
|
||||
if(selectGoodsSkuId.length) $('.goods-empty').hide();
|
||||
else $('.goods-empty').show();
|
||||
}
|
||||
</script>
|
||||
424
addon/giftcard/shop/view/giftcard/buy_order.html
Executable file
424
addon/giftcard/shop/view/giftcard/buy_order.html
Executable file
@@ -0,0 +1,424 @@
|
||||
<style>
|
||||
.rights_interests{line-height: 13px;}
|
||||
.layui-layout-admin .layui-form-item .layui-input-inline{background-color: #fff;}
|
||||
</style>
|
||||
|
||||
<div class="screen layui-collapse" lay-filter="selection_panel">
|
||||
<div class="layui-colla-item">
|
||||
<form class="layui-colla-content layui-form layui-show">
|
||||
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">订单号</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="order_number" autocomplete="off" class="layui-input" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">订单状态</label>
|
||||
<div class="layui-input-inline">
|
||||
<select name="status" id="">
|
||||
<option value="">请选择状态</option>
|
||||
<option value="0">待支付</option>
|
||||
<option value="1">已完成</option>
|
||||
<option value="2">已取消</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">订单来源</label>
|
||||
<div class="layui-input-inline">
|
||||
<select name="order_from">
|
||||
<option value="">全部</option>
|
||||
{foreach $order_from_list as $order_from_k => $order_from_v}
|
||||
<option value="{$order_from_k}">{$order_from_v['name']}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">付款方式</label>
|
||||
<div class="layui-input-inline">
|
||||
<select name="pay_type" >
|
||||
<option value="">全部</option>
|
||||
{foreach pay_type_list as $pay_type_k => $pay_type_v}
|
||||
<option value="{$pay_type_k}">{$pay_type_v}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">下单时间</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" class="layui-input" name="start_time" placeholder="开始时间" id="start_time" readonly>
|
||||
<i class=" iconrili iconfont calendar"></i>
|
||||
</div>
|
||||
<div class="layui-form-mid">-</div>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" class="layui-input" name="end_time" placeholder="结束时间" id="end_time" readonly>
|
||||
<i class=" iconrili iconfont calendar"></i>
|
||||
</div>
|
||||
<button class="layui-btn layui-btn-primary date-picker-btn" onclick="datePick(7, this);return false;">近7天</button>
|
||||
<button class="layui-btn layui-btn-primary date-picker-btn" onclick="datePick(30, this);return false;">近30天</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item"></div>
|
||||
|
||||
<div class="form-row">
|
||||
<button class="layui-btn" lay-submit lay-filter="search">筛选</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-tab table-tab" lay-filter="manjian_tab">
|
||||
<div class="layui-tab-content">
|
||||
<!-- 列表 -->
|
||||
<table id="order_list" lay-filter="order_list"></table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/html" id="rights_interests">
|
||||
<div class=rights_interests>
|
||||
<p><span>积分:{{d.point}}</span></p><br>
|
||||
<p><span>余额:{{d.balance}}</span></p><br>
|
||||
<!-- <p><span>优惠卷:{{d.coupon_name}}</span></p>-->
|
||||
</div>
|
||||
</script>
|
||||
<script type="text/html" id="order_status">
|
||||
<div>
|
||||
{{# if(d.status == 0){ }}待支付{{# }else if(d.status == 1){ }}已完成{{# }else{ }}已取消{{# } }}
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="poster_status">
|
||||
<div class='table-title'>
|
||||
{{# if(d.status == 0){ }}
|
||||
<div class='title-pic' style="text-align:left">未激活</div>
|
||||
{{# }else if(d.status == 1){ }}
|
||||
<div class='title-pic text-color' style="text-align:left">已激活</div>
|
||||
{{# }else if(d.status == 2){ }}
|
||||
<div class='title-pic' style="text-align:left">已作废</div>
|
||||
{{# } }}
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<!-- 操作 -->
|
||||
<script type="text/html" id="operation">
|
||||
<div class="table-btn">
|
||||
{{#if(d.type==1){ }}
|
||||
<a class="layui-btn" lay-event="edit">编辑</a>
|
||||
{{# } }}
|
||||
{{# if(d.type==2){ }}
|
||||
<a class="layui-btn" lay-event="detail">兑换卡列表</a>
|
||||
{{# if(d.status==0){ }}
|
||||
<a class="layui-btn" lay-event="start">批量激活</a>
|
||||
<a class="layui-btn" lay-event="close">批量作废</a>
|
||||
{{# }else if(d.status==0 || d.status==1){ }}
|
||||
<a class="layui-btn" lay-event="close">批量作废</a>
|
||||
{{# } }}
|
||||
<a class="layui-btn" lay-event="exportcard">导出</a>
|
||||
{{#} }}
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<!-- 电子卡编辑html -->
|
||||
<script type="text/html" id="label_change">
|
||||
<div class="layui-form member-form" id="reset_label" lay-filter="form">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label sm">数量:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" name="card_count" class="layui-input len-short" autocomplete="off" min="0">
|
||||
</div>
|
||||
</div>
|
||||
<input class="reset-label-id" type="hidden" name="card_id" value="{{d.id}}" />
|
||||
<div class="form-row sm">
|
||||
<button class="layui-btn" lay-submit lay-filter="setlabel">确定</button>
|
||||
<button class="layui-btn layui-btn-primary" onclick="closeLabel()">返回</button>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var laytpl,layer_label,laydate;
|
||||
layui.use(['form', 'laytpl','laydate'], function () {
|
||||
var table, form = layui.form, repeat_flag = false; //防重复标识
|
||||
laydate = layui.laydate;
|
||||
laytpl = layui.laytpl;
|
||||
form.render();
|
||||
|
||||
//渲染时间
|
||||
laydate.render({
|
||||
elem: '#start_time',
|
||||
type: 'datetime'
|
||||
});
|
||||
|
||||
laydate.render({
|
||||
elem: '#end_time',
|
||||
type: 'datetime'
|
||||
});
|
||||
|
||||
table = new Table({
|
||||
elem: '#order_list',
|
||||
url: ns.url("giftcard://shop/giftcard/order"),
|
||||
cols: [
|
||||
[{
|
||||
field: 'order_number',
|
||||
title: '订单编号',
|
||||
unresize: 'false',
|
||||
width: '12%',
|
||||
}, {
|
||||
field: 'card_name',
|
||||
title: '礼品卡名称',
|
||||
unresize: 'false',
|
||||
width: '12%',
|
||||
},
|
||||
{
|
||||
field: 'order_total_name',
|
||||
title: '下单会员',
|
||||
unresize: 'false',
|
||||
width: '7%',
|
||||
// templet: '#selling_price'
|
||||
},{
|
||||
field: 'card_price',
|
||||
title: '单价',
|
||||
unresize: 'false',
|
||||
width: '7%',
|
||||
},{
|
||||
field: 'num',
|
||||
title: '数量',
|
||||
unresize: 'false',
|
||||
width: '7%',
|
||||
},{
|
||||
field: 'order_total_price',
|
||||
title: '总价',
|
||||
unresize: 'false',
|
||||
width: '7%',
|
||||
// templet: '#selling_price'
|
||||
},{
|
||||
title: '下单时间',
|
||||
unresize: 'false',
|
||||
width: '15%',
|
||||
templet: function (data) {
|
||||
return ns.time_to_date(data.create_time);
|
||||
}
|
||||
},{
|
||||
field: 'pay_time',
|
||||
title: '支付时间',
|
||||
unresize: 'false',
|
||||
width: '10%',
|
||||
templet: function (data) {
|
||||
return data.pay_time? ns.time_to_date(data.pay_time):'---';
|
||||
}
|
||||
}, {
|
||||
field: 'status',
|
||||
title: '状态',
|
||||
unresize: 'false',
|
||||
width: '8%',
|
||||
templet: '#order_status'
|
||||
},
|
||||
// {
|
||||
// title: '操作',
|
||||
// toolbar: '#operation',
|
||||
// unresize: 'false',
|
||||
// align:'right'
|
||||
// }
|
||||
]
|
||||
],
|
||||
});
|
||||
|
||||
/**
|
||||
* 监听工具栏操作
|
||||
*/
|
||||
table.tool(function (obj) {
|
||||
var data = obj.data;
|
||||
switch (obj.event) {
|
||||
case 'edit':
|
||||
location.hash = ns.hash("giftcard://shop/giftcard/editgiftcard?id="+data.id);
|
||||
break;
|
||||
case 'detail':
|
||||
location.hash = ns.hash("giftcard://shop/giftcard/recordlist?id="+data.id);
|
||||
break;
|
||||
case 'close': //关闭
|
||||
close(data.id);
|
||||
break;
|
||||
case 'start': //启用
|
||||
start(data.id);
|
||||
break;
|
||||
case 'exportcard'://导出
|
||||
exportcard(data.id,data.code);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 关闭
|
||||
*/
|
||||
function close(id) {
|
||||
if (repeat_flag) return false;
|
||||
repeat_flag = true;
|
||||
|
||||
layer.confirm('确定作废吗?',{
|
||||
btn: ['确定','取消'] //按钮
|
||||
,cancel: function(index, layero){
|
||||
repeat_flag = false;
|
||||
}
|
||||
}, function (index) {
|
||||
layer.close(index);
|
||||
$.ajax({
|
||||
url: ns.url("giftcard://shop/giftcard/editstatus"),
|
||||
data: {
|
||||
id: id, status: 2
|
||||
},
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function (res) {
|
||||
layer.msg(res.message);
|
||||
repeat_flag = false;
|
||||
if (res.code == 0) {
|
||||
table.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
}, function(index){
|
||||
repeat_flag = false;
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 开启
|
||||
*/
|
||||
function start(id) {
|
||||
if (repeat_flag) return false;
|
||||
repeat_flag = true;
|
||||
layer.confirm('确定激活吗?', {
|
||||
btn: ['确定','取消'] //按钮
|
||||
,cancel: function(index, layero){
|
||||
repeat_flag = false;
|
||||
layer.close(index);
|
||||
}
|
||||
},function (index) {
|
||||
layer.close(index);
|
||||
$.ajax({
|
||||
url: ns.url("giftcard://shop/giftcard/editstatus"),
|
||||
data: {
|
||||
id: id, status: 1
|
||||
},
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function (res) {
|
||||
layer.msg(res.message);
|
||||
repeat_flag = false;
|
||||
if (res.code == 0) {
|
||||
table.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
}, function(index){
|
||||
repeat_flag = false;
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
|
||||
function edit(data){
|
||||
laytpl($("#label_change").html()).render(data, function(html) {
|
||||
layer_label = layer.open({
|
||||
title: '编辑数量',
|
||||
skin: 'layer-tips-class',
|
||||
type: 1,
|
||||
area: ['450px'],
|
||||
content: html,
|
||||
success: function(){
|
||||
form.render();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
form.render();
|
||||
}
|
||||
function exportcard(id,name){
|
||||
var param = {request_mode: 'download','id':id,'name':name};
|
||||
location.href = ns.url("giftcard://shop/giftcard/exportcard",param);
|
||||
return false;
|
||||
}
|
||||
form.on('submit(setlabel)', function(obj) {
|
||||
if (repeat_flag) return false;
|
||||
repeat_flag = true;
|
||||
|
||||
var field = obj.field;
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ns.url("giftcard://shop/giftcard/editGiftCard"),
|
||||
data: {
|
||||
'card_id': field.card_id,
|
||||
'card_count': field.card_count
|
||||
},
|
||||
dataType: 'JSON',
|
||||
success: function(res) {
|
||||
layer.msg(res.message);
|
||||
repeat_flag = false;
|
||||
if (res.code == 0) {
|
||||
table.reload();
|
||||
layer.closeAll('page');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* 搜索功能
|
||||
*/
|
||||
form.on('submit(search)', function (data) {
|
||||
table.reload({
|
||||
page: {
|
||||
curr: 1
|
||||
},
|
||||
where: data.field
|
||||
});
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* 七天时间
|
||||
*/
|
||||
function datePick(date_num,event_obj){
|
||||
$(".date-picker-btn").removeClass("selected");
|
||||
$(event_obj).addClass('selected');
|
||||
// alert(new Date().format("yyyy-MM-dd hh:mm"));
|
||||
var now_date = new Date();
|
||||
|
||||
Date.prototype.Format = function (fmt,date_num) { //author: meizz
|
||||
this.setDate(this.getDate()-date_num);
|
||||
var o = {
|
||||
"M+": this.getMonth() + 1, //月份
|
||||
"d+": this.getDate(), //日
|
||||
"H+": this.getHours(), //小时
|
||||
"m+": this.getMinutes(), //分
|
||||
"s+": this.getSeconds(), //秒
|
||||
"q+": Math.floor((this.getMonth() + 3) / 3), //季度
|
||||
"S": this.getMilliseconds() //毫秒
|
||||
};
|
||||
if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
|
||||
for (var k in o)
|
||||
if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
|
||||
return fmt;
|
||||
};
|
||||
// var now_time = new Date().Format("yyyy-MM-dd HH:mm:ss",0);//当前日期
|
||||
var now_time = new Date().Format("yyyy-MM-dd 23:59:59",0);//当前日期
|
||||
var before_time = new Date().Format("yyyy-MM-dd 00:00:00",date_num-1);//前几天日期
|
||||
$("input[name=start_time]").val(before_time,0);
|
||||
$("input[name=end_time]").val(now_time,date_num-1);
|
||||
|
||||
}
|
||||
function closeLabel() {
|
||||
layer.close(layer_label);
|
||||
}
|
||||
function add() {
|
||||
location.hash = ns.hash("giftcard://shop/giftcard/addelectgiftcard");
|
||||
}
|
||||
</script>
|
||||
467
addon/giftcard/shop/view/giftcard/detail.html
Executable file
467
addon/giftcard/shop/view/giftcard/detail.html
Executable file
@@ -0,0 +1,467 @@
|
||||
<style>
|
||||
.card-common {margin-top: 15px;margin-bottom: 0;box-shadow: initial;}
|
||||
.card-common .layui-card-body{padding-top: 0;}
|
||||
.promotion-view{display:flex;flex-wrap:wrap}
|
||||
.promotion-view-item{width:33.3%;padding-right:10px;box-sizing:border-box;line-height:30px}
|
||||
.promotion-stat-view{display:flex;flex-wrap:wrap}
|
||||
.promotion-stat-view .promotion-stat-item{width:25%;padding:0 15px 10px 15px;box-sizing:border-box}
|
||||
.promotion-stat-view .promotion-stat-item .promotion-stat-item-title{color:#909399;font-size:14px;margin-top:5px}
|
||||
.promotion-stat-view .promotion-stat-item .promotion-stat-item-value{color:#303133;font-size:26px;margin-top:10px}
|
||||
.todo-list .promotion-stat-item{flex:1;width:0;cursor:pointer}
|
||||
.layui-layout-admin .layui-body .body-content {background: 0 0;padding: 0;}
|
||||
.gift-card-goods span{cursor: pointer; color: var(--base-color);}
|
||||
.layui-tab-title{margin-bottom: 15px;}
|
||||
.layui-layout-admin .single-filter-box.top {padding-top: 0 !important;}
|
||||
.add-way .add-way-item{display: flex;margin: 8px 0;align-items: center;}
|
||||
.add-way .add-way-item input{margin: 0 10px;}
|
||||
.add-way .add-way-item .layui-form-radio{margin-right: 0;}
|
||||
.card-goods .layui-table{margin-bottom: 0;margin-top: 0;}
|
||||
#card_right_type_goods #goods{border: 0;}
|
||||
.card-goods .layui-table .goods-title{display: flex;align-items: center;}
|
||||
.card-goods .layui-table .goods-title .goods-img{width: 55px;height: 55px;line-height: 55px;flex-shrink: 0;margin-right: 10px;}
|
||||
.card-goods .layui-table .goods-title .goods-img img{max-width: 100%;max-height: 100%;}
|
||||
.card-goods .layui-table-body{overflow: auto;max-height: 425px;margin-bottom: 15px;border-bottom: 1px solid #e6e6e6;}
|
||||
.card-goods .layui-table-body .layui-table{border: none;}
|
||||
.card-goods .layui-table-body tbody tr:last-of-type td{border: none;}
|
||||
.card-goods .layui-table-head tr th:last-of-type{text-align: right;}
|
||||
.card-goods .layui-table-body tr td:last-of-type{text-align: right;}
|
||||
.card-tab{margin-bottom: 15px;margin-top: 15px;}
|
||||
/* 商品列表 */
|
||||
.shop-information-table > p{padding-left: 5px;padding-bottom: 5px;}
|
||||
.shop-information-table table {width: 100%;border: 1px solid rgb(238,238,238);}
|
||||
.shop-information-table .table-body {max-height: 400px;overflow: auto;}
|
||||
.table-trOne{height: 48px;background:rgb(245,245,245) ;}
|
||||
.shop-information-table th{text-align: left;padding-left:28px;box-sizing: border-box;font-weight: 500;color:#333333;}
|
||||
.shop-information-table th:last-child{border:none;}
|
||||
.table-trTow{width:100%;height:60px;border-top:1px solid rgb(238,238,238);}
|
||||
.table-trTow>td{text-align: left;padding-left:28px;box-sizing: border-box;font-weight: 500;color:#333333;border-right:1px solid rgb(238,238,238);}
|
||||
.table-trTow>td:nth-child(5){color:var(--base-color)}
|
||||
</style>
|
||||
|
||||
<div class="layui-card card-common card-brief head top">
|
||||
<div class="layui-card-header">
|
||||
<span class="card-title">基本信息</span>
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<div class="promotion-view">
|
||||
<div class="promotion-view-item">
|
||||
<label>礼品卡名称:</label>
|
||||
<span>{$detail.card_name}</span>
|
||||
</div>
|
||||
<div class="promotion-view-item grouping">
|
||||
<label>分组:</label>
|
||||
<span>{$detail.category_name}</span>
|
||||
</div>
|
||||
|
||||
<div class="promotion-view-item grouping">
|
||||
<label>卡类型:</label>
|
||||
<span>{$detail.card_type_name}</span>
|
||||
</div>
|
||||
|
||||
<div class="promotion-view-item">
|
||||
<label>权益类型:</label>
|
||||
<span>{$detail.card_right_type=='goods' ? '礼品卡' : '储值卡'}</span>
|
||||
</div>
|
||||
{if $detail.card_right_type=='balance'}
|
||||
<div class="promotion-view-item">
|
||||
<label>储值余额:</label>
|
||||
<span>{$detail.balance}元</span>
|
||||
</div>
|
||||
{/if}
|
||||
{if $detail.card_type=='virtual'}
|
||||
<div class="promotion-view-item">
|
||||
<label>销售价:</label>
|
||||
<span>{$detail.card_price}元</span>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="promotion-view-item">
|
||||
<label>有效期:</label>
|
||||
<span>
|
||||
{if $detail.validity_type=='forever'}
|
||||
永久有效
|
||||
{elseif $detail.validity_type=='date'/}
|
||||
有效期至{:date('Y-m-d H:i:s',$detail.validity_time)}
|
||||
{elseif $detail.validity_type=='day'/}
|
||||
领取后{$detail.validity_day}天有效
|
||||
{/if}
|
||||
</span>
|
||||
</div>
|
||||
{if $detail.card_type=='virtual'}
|
||||
<div class="promotion-view-item">
|
||||
<label>是否允许转赠:</label>
|
||||
<span>{if $detail.is_allow_transfer == 1}是{else/}否{/if}</span>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-card card-common card-brief head top">
|
||||
<div class="layui-card-header">
|
||||
<span class="card-title">数据统计</span>
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<div class="promotion-stat-view todo-list">
|
||||
{if $detail.card_type=='virtual'}
|
||||
<div class="promotion-stat-item" >
|
||||
<div class="promotion-stat-item-title">卡销量</div>
|
||||
<div class="promotion-stat-item-value">{$detail.sale_num}</div>
|
||||
</div>
|
||||
<div class="promotion-stat-item" >
|
||||
<div class="promotion-stat-item-title">已使用</div>
|
||||
<div class="promotion-stat-item-value">{$detail.use_count}</div>
|
||||
</div>
|
||||
<div class="promotion-stat-item" >
|
||||
<div class="promotion-stat-item-title">未使用</div>
|
||||
<div class="promotion-stat-item-value">{$detail.sale_num - $detail.use_count}</div>
|
||||
</div>
|
||||
{/if}
|
||||
{if $detail.card_type=='real'}
|
||||
<div class="promotion-stat-item" >
|
||||
<div class="promotion-stat-item-title">制卡数</div>
|
||||
<div class="promotion-stat-item-value">{$detail.card_count}</div>
|
||||
</div>
|
||||
<div class="promotion-stat-item" >
|
||||
<div class="promotion-stat-item-title">激活数</div>
|
||||
<div class="promotion-stat-item-value">{$detail.activate_count}</div>
|
||||
</div>
|
||||
<div class="promotion-stat-item" >
|
||||
<div class="promotion-stat-item-title">已使用</div>
|
||||
<div class="promotion-stat-item-value">{$detail.use_count}</div>
|
||||
</div>
|
||||
<div class="promotion-stat-item" >
|
||||
<div class="promotion-stat-item-title">未使用</div>
|
||||
<div class="promotion-stat-item-value">{$detail.activate_count - $detail.use_count}</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-card card-common card-brief head top">
|
||||
<div class="layui-card-header">
|
||||
<span class="card-title">使用规则</span>
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
{if $detail.card_right_type=='goods'}
|
||||
{if $detail.card_right_goods_type == 'all'}
|
||||
<p>礼品卡持卡人兑换时可从以下商品列表中任选{$detail.card_right_goods_count}件。</p>
|
||||
{else/}
|
||||
<p>礼品卡持卡人兑换时可从按照商品列表中商品数量进行兑换。</p>
|
||||
{/if}
|
||||
{else/}
|
||||
<p>礼品卡持卡人兑换时将储值卡的储值余额充值到持卡人账户余额中</p>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 商品信息 -->
|
||||
{if $detail['card_right_type'] == 'goods'}
|
||||
<div class="layui-card card-common card-brief head top">
|
||||
<div class="layui-card-header">
|
||||
<span class="card-title">商品信息</span>
|
||||
</div>
|
||||
<div class="layui-card-body shop-information-table">
|
||||
<div class="table-head">
|
||||
<table lay-skin="line">
|
||||
<colgroup>
|
||||
<col width="80%">
|
||||
{if $detail.card_right_goods_type == 'all'}
|
||||
<col width="20%">
|
||||
{/if}
|
||||
{if $detail.card_right_goods_type != 'all'}
|
||||
<col width="10%">
|
||||
<col width="10%">
|
||||
{/if}
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr class="table-trOne">
|
||||
<th lay-data="{field:'product_name', width:200}">商品</th>
|
||||
<th lay-data="{field:'price'}">价格</th>
|
||||
{if $detail.card_right_goods_type != 'all'}
|
||||
<th lay-data="{field:'sale_num'}">数量</th>
|
||||
{/if}
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
<div class="table-body">
|
||||
<table lay-skin="line">
|
||||
<colgroup>
|
||||
<col width="80%">
|
||||
{if $detail.card_right_goods_type == 'all'}
|
||||
<col width="20%">
|
||||
{/if}
|
||||
{if $detail.card_right_goods_type != 'all'}
|
||||
<col width="10%">
|
||||
<col width="10%">
|
||||
{/if}
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
{foreach $detail['goods_list'] as $list_k => $order_goods_item}
|
||||
<tr class="table-trTow">
|
||||
<td>{$order_goods_item.sku_info ? $order_goods_item.sku_info.sku_name : ''}</td>
|
||||
<td>{$order_goods_item.sku_info ? $order_goods_item.sku_info.price : ''}</td>
|
||||
{if $detail.card_right_goods_type != 'all'}
|
||||
<td>{$order_goods_item.goods_num}</td>
|
||||
{/if}
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="layui-card card-common card-brief head top">
|
||||
<div class="layui-card-header">
|
||||
<span class="card-title">礼品卡列表</span>
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<div class="screen layui-collapse card-tab" lay-filter="card_tab">
|
||||
<div class="layui-colla-item">
|
||||
<form class="layui-colla-content layui-form layui-show">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">礼品卡编号</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="search_text" placeholder="请输入礼品卡编号" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<button type="button" class="layui-btn" lay-filter="search" lay-submit>筛选</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-tab table-tab" lay-filter="card_state_tab">
|
||||
<ul class="layui-tab-title">
|
||||
<li class="layui-this" data-status="all">全部</li>
|
||||
{foreach $status_list as $k => $v}
|
||||
<li data-status="{$k}">{$v}</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
<div class="layui-tab-content poster_list">
|
||||
<!-- 列表 -->
|
||||
<table id="poster_list" lay-filter="poster_list"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type='text/html' id="promotion_list_item_box_html">
|
||||
<div class="promotion-list-item-title">
|
||||
<div class="promotion-list-item-title-icon">
|
||||
<img src="{{ ns.img(d.sku_image) }}" alt="">
|
||||
</div>
|
||||
<p class="promotion-list-item-title-name multi-line-hiding">{{ d.sku_name }}</p>
|
||||
</div>
|
||||
</script>
|
||||
<script type="text/html" id="operation">
|
||||
<div class="table-btn">
|
||||
{{# if(d.status == 'to_activate'){ }}
|
||||
<a class="layui-btn" lay-event="delete">删除</a>
|
||||
{{# } }}
|
||||
{{# if(d.status != 'to_activate'){ }}
|
||||
<a class="layui-btn" lay-event="info">详情</a>
|
||||
{{# } }}
|
||||
</div>
|
||||
</script>
|
||||
<script>
|
||||
var categoryList = {:json_encode($category_list)} ? {:json_encode($category_list)} : [];
|
||||
var category_id = {$detail.category_id};
|
||||
var giftcard_id = {$detail.giftcard_id};
|
||||
categoryList.forEach(item => {
|
||||
if(item.category_id == category_id){
|
||||
$(".grouping span").text(item.name);
|
||||
}
|
||||
});
|
||||
|
||||
var table,element,form,laytpl,repeat_flag=false;
|
||||
layui.use(['form', 'element', 'laytpl','laydate'], function () {
|
||||
laytpl = layui.laytpl;
|
||||
element = layui.element;
|
||||
form = layui.form;
|
||||
form.render();
|
||||
|
||||
element.on('tab(card_state_tab)', function () {
|
||||
table.reload({
|
||||
page: {
|
||||
curr: 1
|
||||
},
|
||||
where: {
|
||||
'status': this.getAttribute('data-status')
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* 搜索功能
|
||||
*/
|
||||
form.on('submit(search)', function (data) {
|
||||
table.reload({
|
||||
page: {curr: 1},
|
||||
where: data.field
|
||||
});
|
||||
});
|
||||
|
||||
table = new Table({
|
||||
elem: '#poster_list',
|
||||
url: ns.url("giftcard://shop/card/lists", {'giftcard_id': giftcard_id}),
|
||||
cols: [
|
||||
{if $detail.card_type=='virtual'}
|
||||
[{
|
||||
field: 'card_no',
|
||||
title: '卡号',
|
||||
unresize: 'false',
|
||||
width: '20%',
|
||||
}, {
|
||||
field: 'member_nickname',
|
||||
title: '所属会员',
|
||||
unresize: 'false',
|
||||
width: '15%',
|
||||
templet: function (data) {
|
||||
var html = `<a class="text-color" href="${ns.href('shop/member/editmember',{'member_id':data.member_id})}" target="_blank">${data.member_nickname || '--'}</a>`
|
||||
return html;
|
||||
}
|
||||
}, {
|
||||
title: '获取时间',
|
||||
unresize: 'false',
|
||||
width: '15%',
|
||||
templet: function (data) {
|
||||
return ns.time_to_date(data.create_time);
|
||||
}
|
||||
}, {
|
||||
field: 'status_name',
|
||||
title: '状态',
|
||||
unresize: 'false',
|
||||
width: '15%'
|
||||
}, {
|
||||
field: 'order_no',
|
||||
title: '订单',
|
||||
unresize: 'false',
|
||||
width: '15%',
|
||||
templet: function (data) {
|
||||
var html = `<a class="text-color" href="${ns.href('giftcard://shop/order/detail',{'order_id':data.order_id})}" target="_blank">${data.order_no}</a>`
|
||||
return html;
|
||||
}
|
||||
},{
|
||||
title: '操作',
|
||||
toolbar: '#operation',
|
||||
unresize: 'false',
|
||||
align : 'right'
|
||||
}]
|
||||
{else /}
|
||||
[{
|
||||
field: 'card_no',
|
||||
title: '卡号',
|
||||
unresize: 'false',
|
||||
width: '20%',
|
||||
},{
|
||||
field: 'card_cdk',
|
||||
title: '秘钥',
|
||||
unresize: 'false',
|
||||
width: '20%',
|
||||
}, {
|
||||
title: '生成时间',
|
||||
unresize: 'false',
|
||||
width: '15%',
|
||||
templet: function (data) {
|
||||
return ns.time_to_date(data.create_time);
|
||||
}
|
||||
}, {
|
||||
field: 'member_nickname',
|
||||
title: '激活会员',
|
||||
unresize: 'false',
|
||||
width: '10%',
|
||||
templet: function (data) {
|
||||
var html;
|
||||
if(data.member_id)
|
||||
html = `<a class="text-color" href="${ns.href('shop/member/editmember',{'member_id':data.member_id})}" target="_blank">${data.member_nickname}</a>`;
|
||||
else
|
||||
html = `<a>--</a>`;
|
||||
return html;
|
||||
}
|
||||
}, {
|
||||
field: 'sort',
|
||||
unresize: 'false',
|
||||
title: '激活时间',
|
||||
width: '15%',
|
||||
templet: function (data) {
|
||||
if(data.activate_time == 0)
|
||||
return "--";
|
||||
else
|
||||
return ns.time_to_date(data.activate_time);
|
||||
}
|
||||
}, {
|
||||
field: 'status_name',
|
||||
title: '状态',
|
||||
unresize: 'false',
|
||||
width: '10%'
|
||||
},{
|
||||
title: '操作',
|
||||
toolbar: '#operation',
|
||||
unresize: 'false',
|
||||
align : 'right'
|
||||
}]
|
||||
{/if}
|
||||
]
|
||||
});
|
||||
|
||||
/**
|
||||
* 监听工具栏操作
|
||||
*/
|
||||
table.tool(function (obj) {
|
||||
var data = obj.data;
|
||||
switch (obj.event) {
|
||||
case 'delete': //删除
|
||||
deleteCard(data.card_id);
|
||||
break;
|
||||
case 'info':
|
||||
window.open(ns.href("giftcard://shop/card/detail",{card_id:data.card_id}))
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
function deleteCard(id) {
|
||||
layer.confirm('确定要删除该卡项记录吗?', function (index) {
|
||||
if (repeat_flag) return;
|
||||
repeat_flag = true;
|
||||
layer.close(index);
|
||||
|
||||
$.ajax({
|
||||
url: ns.url("giftcard://shop/card/delete"),
|
||||
data: {
|
||||
card_id: id
|
||||
},
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function (res) {
|
||||
layer.msg(res.message);
|
||||
repeat_flag = false;
|
||||
if (res.code == 0) {
|
||||
table.reload({
|
||||
page: {
|
||||
curr: 1
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}, function () {
|
||||
layer.close();
|
||||
repeat_flag = false;
|
||||
});
|
||||
}
|
||||
})
|
||||
</script>
|
||||
744
addon/giftcard/shop/view/giftcard/edit.html
Executable file
744
addon/giftcard/shop/view/giftcard/edit.html
Executable file
@@ -0,0 +1,744 @@
|
||||
<style>
|
||||
.operation .table-btn{justify-content: flex-start ;}
|
||||
.goods_num {padding-left: 20px;}
|
||||
.hide{display: none;}
|
||||
.layui-table .goods-title{display: flex;align-items: center;}
|
||||
.layui-table .goods-title .goods-img{width: 55px;height: 55px;line-height: 55px;flex-shrink: 0;margin-right: 10px;}
|
||||
.layui-table .goods-title .goods-img img{max-width: 100%;max-height: 100%;}
|
||||
#card_right_type_goods .layui-table{margin-bottom: 0;margin-top: 0;}
|
||||
#card_right_type_goods #goods{border: 0;}
|
||||
#card_right_type_goods .layui-table-body{overflow: auto;max-height: 500px;margin-bottom: 15px;border-bottom: 1px solid #e6e6e6;}
|
||||
#card_right_type_goods .layui-table-body tbody tr:last-of-type td{border: none;}
|
||||
.layui-table-head tr th:last-of-type{text-align: right;}
|
||||
.layui-table-body tr td:last-of-type .table-btn{justify-content: flex-end;}
|
||||
.card-common .goods-image-wrap .item{width: 185px;height: 119.7px;line-height: 119.7px;margin-top: 5px;margin-bottom: 5px;float: unset}
|
||||
.card-common .goods-image-wrap .item .img-wrap{width: 100%;height: 100%;display: flex;align-items: center;justify-content: center;}
|
||||
.card-common .goods-image-wrap .item .img-wrap img{max-height: 100%;max-width: 100%;width: auto;height: auto;}
|
||||
.card-common .goods-image-wrap .item .operation{width: 100%;height: 100%;line-height: 5;}
|
||||
.goods-image-wrap .js-goods-image{margin-bottom: 0;line-height: 1;display: flex}
|
||||
.disabled-click{pointer-events: none;color: #999 !important;}
|
||||
.period-validity .layui-input-block>div{margin: 8px 0;display: flex;align-items: center;}
|
||||
.period-validity .layui-input-block>div .layui-input-inline{margin: 0 8px;}
|
||||
.period-validity .layui-input-block .layui-form-radio{margin-right: 0;padding-right: 0;}
|
||||
.layui-input-inline.totality-num{float: none;}
|
||||
</style>
|
||||
|
||||
<div class="layui-form">
|
||||
<div class="layui-card card-common card-brief">
|
||||
<div class="layui-card-header">
|
||||
<span class="card-title">基础设置</span>
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>礼品卡名称:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="card_name" value="{$giftcard_info.card_name}" lay-verify="required" autocomplete="off" class="layui-input len-long" maxlength="40">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>分组:</label>
|
||||
<div class="layui-input-inline len-mid">
|
||||
<select class="category_id" name="category_id" lay-verify="required" lay-filter="categoryId">
|
||||
<option value="">请选择</option>
|
||||
{foreach $category_list as $k=>$v}
|
||||
<option value="{$v['category_id']}" {if $giftcard_info.category_id == $v['category_id']} selected {/if}>{$v['category_name']}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div id="card-cover" class="layui-form-item goods-image-wrap">
|
||||
<label class="layui-form-label">礼品卡封面:</label>
|
||||
<div class="layui-input-block">
|
||||
<!--素材图片-->
|
||||
<div class="js-goods-image"></div>
|
||||
</div>
|
||||
<div class="word-aux"></div>
|
||||
</div>
|
||||
{if $giftcard_info['card_type'] == 'virtual'}
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">销售价:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="number" min="0" name="card_price" onchange="detectionNumType(this,'positiveNumber')" class="layui-input len-short integral" autocomplete="off" value="{$giftcard_info.card_price}">
|
||||
</div>
|
||||
<div class="layui-form-mid">元</div>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">排序:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" min="0" name="sort" value="{$giftcard_info.sort}" lay-verify = 'sort' onchange="detectionNumType(this,'integral')" autocomplete="off" class="layui-input len-short">
|
||||
</div>
|
||||
</div>
|
||||
{if $giftcard_info['card_type'] == 'virtual'}
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">是否允许转赠:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="radio" name="is_allow_transfer" value="1" lay-verify="required" title="是" {if $giftcard_info.is_allow_transfer == 1} checked {/if}>
|
||||
<input type="radio" name="is_allow_transfer" value="0" lay-verify="required" title="否" {if $giftcard_info.is_allow_transfer == 0} checked {/if}>
|
||||
</div>
|
||||
<div class="word-aux">转赠开启后,用户可以将自己的礼品卡作为礼包赠送给其他用户</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{if $giftcard_info['card_type'] == 'real'}
|
||||
<div class="layui-card-header">
|
||||
<span class="card-title">制卡规则</span>
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
|
||||
<div class="layui-form-item participation-condition">
|
||||
<label class="layui-form-label"><span class="required">*</span>卡密内容:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" class="cdk_type" name="cdk_type[]" value="0-9" lay-skin="primary" title="0-9" {if in_array('0-9',explode(',',$giftcard_info.cdk_type))} checked {/if}>
|
||||
<input type="checkbox" class="cdk_type" name="cdk_type[]" value="a-z" lay-skin="primary" title="a-z" {if in_array('a-z',explode(',',$giftcard_info.cdk_type))} checked {/if}>
|
||||
<input type="checkbox" class="cdk_type" name="cdk_type[]" value="A-Z" lay-skin="primary" title="A-Z" {if in_array('A-Z',explode(',',$giftcard_info.cdk_type))} checked {/if}>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>卡密位数:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" min="4" name="cdk_length" value="{$giftcard_info.cdk_length}" lay-verify="required" onchange="detectionNumType(this,'integral')" class="layui-input len-short" autocomplete="off">
|
||||
</div>
|
||||
<div class="word-aux">卡密位数仅限制卡密内容长度</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">卡号前缀:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="card_prefix" value="{$giftcard_info.card_prefix}" autocomplete="off" class="layui-input len-long">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">卡号后缀:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="card_suffix" value="{$giftcard_info.card_suffix}" autocomplete="off" class="layui-input len-long">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="layui-card-header">
|
||||
<span class="card-title">礼品卡权益</span>
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<!--类型选择-->
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>权益类型:</label>
|
||||
<div class="layui-input-block">
|
||||
{foreach $card_right_type_list as $k=>$v}
|
||||
<input type="radio" name="card_right_type" value="{$k}" lay-verify="required" lay-filter="cardRightType" title="{$v}" {if $k == $giftcard_info.card_right_type}checked{else/}disabled{/if}>
|
||||
{/foreach}
|
||||
</div>
|
||||
</div>
|
||||
<!--储值-->
|
||||
<div id="card_right_type_balance" class="{if $giftcard_info.card_right_type == 'balance'} layui-show {else/} layui-hide {/if}">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">储值余额:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="number" min="0" name="balance" onchange="detectionNumType(this,'positiveNumber')" class="layui-input len-short" autocomplete="off" value="{$giftcard_info.balance}">
|
||||
</div>
|
||||
<div class="layui-form-mid">元</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--商品-->
|
||||
<div id="card_right_type_goods" class="{if $giftcard_info.card_right_type == 'goods'} layui-show {else/} layui-hide {/if}">
|
||||
|
||||
<div class="layui-form-item goods-number">
|
||||
<label class="layui-form-label"><span class="required">*</span>礼品卡中商品选赠规则:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="radio" name="card_right_goods_type" value="item" lay-verify="required" lay-filter="cardTightGoodsType" title="礼品卡由下列商品及其数量打包而成" {if $giftcard_info.card_right_goods_type == 'item'} checked {/if}>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item goods-number">
|
||||
<label class="layui-form-label"></label>
|
||||
<div class="layui-input-block">
|
||||
<input type="radio" name="card_right_goods_type" value="all" lay-verify="required" lay-filter="cardTightGoodsType" title="礼品卡持卡人兑换时可从以下商品列表中任选N件商品" {if $giftcard_info.card_right_goods_type == 'all'} checked {/if}>
|
||||
<div class="layui-input-inline totality-num">
|
||||
<input type="number" min="0" {if $giftcard_info.card_right_goods_type == 'all'} lay-verify="required|number"{/if} {if $giftcard_info.card_right_goods_type == 'item'} disabled {/if} name="card_right_goods_count" onchange="detectionNumType(this,'integral')" class="layui-input len-short" autocomplete="off" value="{$giftcard_info.card_right_goods_count}">
|
||||
</div>
|
||||
<span class="sub-text totality-num {if $giftcard_info.card_right_goods_type == 'item'} disabled-click {/if}">件</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">商品:</label>
|
||||
<div class="layui-input-block">
|
||||
<div class="layui-table-head">
|
||||
<table class="layui-table" lay-skin="line" lay-size="lg">
|
||||
<colgroup>
|
||||
<col width="45%">
|
||||
<col width="15%">
|
||||
<col class="goods_num_col {if $giftcard_info.card_right_goods_type == 'all'} hide {else/} show {/if}" width="15%">
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>商品名称</th>
|
||||
<th>原价</th>
|
||||
<th class="goods_num_col {if $giftcard_info.card_right_goods_type == 'all'} hide {else/} show {/if}">数量</th>
|
||||
<th class="operation">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
<div class="layui-table-body">
|
||||
<table class="layui-table" id="goods" lay-skin="line" lay-size="lg">
|
||||
<colgroup>
|
||||
<col width="45%">
|
||||
<col width="15%">
|
||||
<col class="goods_num_col {if $giftcard_info.card_right_goods_type == 'all'} hide {else/} show {/if}" width="15%">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
{if empty($giftcard_info.goods_list)}
|
||||
<tr class="goods-empty">
|
||||
<td colspan="{if $giftcard_info.card_right_goods_type == 'item'}4{else/}3{/if}">
|
||||
<div>未添加商品</div>
|
||||
</td>
|
||||
</tr>
|
||||
{else/}
|
||||
{foreach $giftcard_info.goods_list as $goods_item}
|
||||
<tr data-sku_id="{$goods_item.sku_id}" data-goods_id="{$goods_item.goods_id}">
|
||||
<td>
|
||||
<div class="goods-title">
|
||||
<div class="goods-img">
|
||||
<img layer-src src="{$goods_item.sku_info.sku_image ? img($goods_item.sku_info.sku_image) : ''}" alt="">
|
||||
</div>
|
||||
<p class="multi-line-hiding goods-name">{$goods_item.sku_info ? $goods_item.sku_info.sku_name : ''}</p>
|
||||
</div>
|
||||
</td>
|
||||
<td class='price-one'>{$goods_item.sku_info ? $goods_item.sku_info.price : ''}</td>
|
||||
<td class="goods_num_col {if $giftcard_info.card_right_goods_type == 'all'} hide {else/} show {/if}">
|
||||
<input type="number" name="" min="1" onchange="detectionNumType(this,'integral')" lay-verify="required{if $giftcard_info.card_right_goods_type == 'item'}|number{/if}" class="layui-input goods_num" value='{$goods_item.goods_num}'>
|
||||
</td>
|
||||
<td class='operation'> <div class='table-btn '><a href='javascript:;' class='layui-btn' onclick='deleteGoods(this)'>删除商品</a></div></td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{/if}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<button class="layui-btn" onclick="addGoods()">添加商品</button>
|
||||
<span class="goods_num">已选商品(<span id="goods_num" class="text-color">{:count($giftcard_info.goods_list)}</span>)</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-card-header">
|
||||
<span class="card-title">有效期</span>
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<div class="layui-form-item period-validity">
|
||||
<label class="layui-form-label"><span class="required">*</span>有效期:</label>
|
||||
<div class="layui-input-block">
|
||||
<div>
|
||||
<input type="radio" name="validity_type" value="forever" lay-filter="validityType" {if $giftcard_info.validity_type == 'forever'} checked {/if}>
|
||||
<span class="sub-text {if $giftcard_info.validity_type != 'forever'} disabled-click {/if}">永久有效</span>
|
||||
</div>
|
||||
<div>
|
||||
<input type="radio" name="validity_type" value="date" lay-filter="validityType" {if $giftcard_info.validity_type == 'date'} checked {/if}>
|
||||
<span class="sub-text {if $giftcard_info.validity_type != 'date'} disabled-click {/if}">有效期至</span>
|
||||
<div class="layui-input-inline" style="float: none">
|
||||
<input type="text" class="layui-input sub-text {if $giftcard_info.validity_type != 'date'} disabled-click {/if}" name="validity_time" lay-verify="time" placeholder="有效期限" id="start_time" value="{:time_to_date($giftcard_info.validity_time)}" readonly>
|
||||
<i class=" iconrili iconfont calendar"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<input type="radio" name="validity_type" value="day" lay-filter="validityType" {if $giftcard_info.validity_type == 'day'} checked {/if}>
|
||||
<span class="sub-text {if $giftcard_info.validity_type != 'day'} disabled-click {/if}">领取后</span>
|
||||
<div class="layui-input-inline" style="float: none">
|
||||
<input type="number" min="0" name="validity_day" onchange="detectionNumType(this,'integral')" autocomplete="off" class="layui-input len-short sub-text {if $giftcard_info.validity_type != 'day'} disabled-click {/if}" value="{$giftcard_info.validity_day}" lay-verify='time_day' readonly>
|
||||
</div>
|
||||
<span class="sub-text {if $giftcard_info.validity_type != 'day'} disabled-click {/if}">天有效</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="word-aux">说明:有效期截止后,不支持退款</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-card-header">
|
||||
<span class="card-title">使用须知</span>
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required"></span>使用须知:</label>
|
||||
<div class="layui-input-block">
|
||||
<script id="instruction" type="text/plain" style="width:800px;height:400px;"></script>
|
||||
<input type="hidden" name="activity_instruction" value="{$giftcard_info.instruction}" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-card-header">
|
||||
<span class="card-title">礼品卡详情</span>
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required"></span>详情:</label>
|
||||
<div class="layui-input-block">
|
||||
<script id="editor" type="text/plain" style="width:800px;height:400px;"></script>
|
||||
<input type="hidden" name="activity_detail" value="{$giftcard_info.desc}" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<input type="hidden" name="giftcard_id" value="{$giftcard_info.giftcard_id}" />
|
||||
<button class="layui-btn" lay-submit lay-filter="save">保存</button>
|
||||
<button class="layui-btn layui-btn-primary" onclick="backGiftCardList()">返回</button>
|
||||
<a id="cardCoverId"></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--素材图片列表-->
|
||||
<script type="text/html" id="mediaImage">
|
||||
{{# if(d.list.length){ }}
|
||||
{{# for(var i=0;i<d.list.length;i++){ }}
|
||||
<div class="item upload_img_square_item" data-index="{{i}}">
|
||||
<div class="img-wrap">
|
||||
<img src="{{ns.img(d.list[i])}}" layer-src="{{ns.img(d.list[i])}}">
|
||||
</div>
|
||||
<div class="operation">
|
||||
<i title="图片预览" class="iconfont iconreview js-preview"></i>
|
||||
<i title="删除图片" class="layui-icon layui-icon-delete js-delete" data-index="{{i}}"></i>
|
||||
<div class="replace_img" data-index="{{i}}">点击替换</div>
|
||||
</div>
|
||||
</div>
|
||||
{{# } }}
|
||||
{{# if(d.list.length < d.max){ }}
|
||||
<div class="item js-add-media-image upload_img_square">+</div>
|
||||
{{# } }}
|
||||
{{# }else{ }}
|
||||
<div class="item js-add-media-image upload_img_square">+</div>
|
||||
{{# } }}
|
||||
</script>
|
||||
<script type="text/javascript" charset="utf-8" src="__STATIC__/ext/ueditor/ueditor.config.js"></script>
|
||||
<script type="text/javascript" charset="utf-8" src="__STATIC__/ext/ueditor/ueditor.all.js"> </script>
|
||||
<script type="text/javascript" charset="utf-8" src="__STATIC__/ext/ueditor/lang/zh-cn/zh-cn.js"></script>
|
||||
<script type="text/javascript" src="GIFTCARD_JS/media.js"></script>
|
||||
<script>
|
||||
var form, laytpl, tableData = [],
|
||||
repeat_flag = false,
|
||||
selectGoodsSkuId = [],
|
||||
selectGoodsId = [],
|
||||
goods = [],
|
||||
currentDate = new Date(),
|
||||
activityInstruction = "",
|
||||
activityDetail = "",
|
||||
mediaImage = [], //封面头像
|
||||
mediaIds = [],//封面id
|
||||
saveData = null;
|
||||
|
||||
var GOODS_IMAGE_MAX = 3; //素材上传数量
|
||||
var card_right_goods_type = "{$giftcard_info.card_right_goods_type}";
|
||||
var goods_list = {:json_encode($giftcard_info.goods_list)};
|
||||
mediaImage = '{:json_encode($giftcard_info.card_cover)}' ? {:json_encode($giftcard_info.card_cover)}.split(',') : [];
|
||||
mediaIds = '{:json_encode($giftcard_info.media_ids)}' ? {:json_encode($giftcard_info.media_ids)}.split(',') : [];
|
||||
|
||||
if(goods_list.length > 0){
|
||||
for(var i = 0; i < goods_list.length; i++){
|
||||
selectGoodsSkuId.push(parseInt(goods_list[i].sku_id));
|
||||
selectGoodsId.push(parseInt(goods_list[i].goods_id));
|
||||
}
|
||||
}
|
||||
|
||||
layui.use(['form', 'laytpl','laydate'], function () {
|
||||
var laydate = layui.laydate;
|
||||
form = layui.form;
|
||||
laytpl = layui.laytpl;
|
||||
|
||||
refreshGoodsImage();
|
||||
currentDate.setDate(currentDate.getDate() + 30);
|
||||
activityDetail = UE.getEditor('editor', {autoHeightEnabled: false});
|
||||
// 加载商品详情
|
||||
activityDetail.ready(function () {
|
||||
activityDetail.setContent($("input[name='activity_detail']").val());
|
||||
});
|
||||
|
||||
activityInstruction = UE.getEditor('instruction', {autoHeightEnabled: false});
|
||||
// 加载商品详情
|
||||
activityInstruction.ready(function () {
|
||||
activityInstruction.setContent($("input[name='activity_instruction']").val());
|
||||
});
|
||||
form.render();
|
||||
|
||||
// 时间组件
|
||||
laydate.render({
|
||||
elem: '#start_time'
|
||||
,type: 'datetime'
|
||||
,change: function(value, date, endDate){
|
||||
$(".date-picker-btn").removeClass("selected");
|
||||
}
|
||||
});
|
||||
|
||||
//表单验证
|
||||
form.verify({
|
||||
number: function (value) {
|
||||
if (value <= 0) {
|
||||
return "数量不能小于或等于0"
|
||||
}
|
||||
},
|
||||
sort: function (value) {
|
||||
if (value < 0) {
|
||||
return "排序不能小于0"
|
||||
}
|
||||
},
|
||||
price: function (value) {
|
||||
if (value == 0) {
|
||||
return "销售价不能为0"
|
||||
}
|
||||
},
|
||||
market_price: function (value) {
|
||||
if (value < 0) {
|
||||
return "市场价不能为小于0"
|
||||
}
|
||||
},
|
||||
time: function (value) {
|
||||
var validity_type = $('[name="validity_type"]:checked').val();
|
||||
if (validity_type == 'date') {
|
||||
var now_time = (new Date()).getTime();
|
||||
var end_time = (new Date(value)).getTime();
|
||||
if (!end_time) {
|
||||
return '有效期不能为空!'
|
||||
}
|
||||
if (now_time > end_time) {
|
||||
return '有效期不能小于当前时间!'
|
||||
}
|
||||
}
|
||||
},
|
||||
time_day: function (value) {
|
||||
var validity_type = $('[name="validity_type"]:checked').val();
|
||||
if (validity_type == 'day') {
|
||||
if (value <= 0) {
|
||||
return '有效期天数至少为一天!'
|
||||
}
|
||||
}
|
||||
},
|
||||
cdk_length: function (value) {
|
||||
if (value <= 0) {
|
||||
return "密钥位数不能小于或等于0"
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
//权益类型
|
||||
form.on('radio(cardRightType)', function(data){
|
||||
if(data.value.trim() == 'balance'){
|
||||
$('#card_right_type_balance').removeClass('layui-hide').addClass('layui-show');
|
||||
$('#card_right_type_goods').removeClass('layui-show').addClass('layui-hide');
|
||||
}else if(data.value.trim() == 'goods'){
|
||||
$('#card_right_type_goods').removeClass('layui-hide').addClass('layui-show');
|
||||
$('#card_right_type_balance').removeClass('layui-show').addClass('layui-hide');
|
||||
}
|
||||
});
|
||||
|
||||
//有效期
|
||||
form.on('radio(validityType)', function(data){
|
||||
$(data.elem).parent("div").siblings().find(".sub-text").addClass("disabled-click");
|
||||
$(data.elem).parent("div").find(".sub-text").removeClass("disabled-click");
|
||||
if(data.value.trim() == 'forever'){
|
||||
$('input[name="validity_day"]').val('').attr('readonly','readonly');
|
||||
$('input[name="validity_time"]').val('');
|
||||
}else if(data.value.trim() == 'date'){
|
||||
$('input[name="validity_day"]').val('').attr('readonly','readonly');
|
||||
}else if(data.value.trim() == 'day'){
|
||||
$('input[name="validity_day"]').removeAttr('readonly');
|
||||
$('input[name="validity_time"]').val('');
|
||||
}
|
||||
});
|
||||
|
||||
//商品数量类型
|
||||
form.on('radio(cardTightGoodsType)', function(data){
|
||||
if (data.value.trim() == 'all') {
|
||||
|
||||
$('.goods_num_col').removeClass('show').addClass('hide');
|
||||
$('.goods_num_col').find('input').attr('lay-verify','required');
|
||||
|
||||
$(".totality-num input").attr("disabled", false);
|
||||
$(".totality-num").removeClass('disabled-click');
|
||||
$(".totality-num input").attr('lay-verify','required|number');
|
||||
|
||||
} else if (data.value.trim() == 'item') {
|
||||
$('.goods_num_col').removeClass('hide').addClass('show');
|
||||
$('.goods_num_col').find('input').attr('lay-verify','required|number');
|
||||
|
||||
$('input[name="card_right_goods_count"]').val(0);
|
||||
$(".totality-num input").attr("disabled", true);
|
||||
$(".totality-num").addClass('disabled-click');
|
||||
$(".totality-num input").attr('lay-verify','');
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
// 保存
|
||||
function saveFunc(data){
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
dataType: 'JSON',
|
||||
url: ns.url("giftcard://shop/giftcard/edit"),
|
||||
data: data.field,
|
||||
async: false,
|
||||
success: function (res) {
|
||||
repeat_flag = false;
|
||||
|
||||
if (res.code == 0) {
|
||||
layer.confirm('编辑成功', {
|
||||
title: '操作提示',
|
||||
btn: ['返回列表', '继续编辑'],
|
||||
closeBtn: 0,
|
||||
yes: function(index, layero) {
|
||||
location.hash = ns.hash("giftcard://shop/giftcard/lists");
|
||||
layer.close(index);
|
||||
},
|
||||
btn2: function(index, layero) {
|
||||
layer.close(index);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
layer.msg(res.message);
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 表单提交
|
||||
*/
|
||||
form.on('submit(save)', function (data) {
|
||||
if(!mediaIds.length){
|
||||
layer.msg("请至少选择一张图片作为礼品卡封面");
|
||||
return false;
|
||||
}
|
||||
data.field.media_ids = mediaIds.toString();
|
||||
data.field.card_cover = mediaImage.toString();
|
||||
|
||||
if(data.field.card_right_type == 'goods') {
|
||||
goods = [];
|
||||
var num_list = [];
|
||||
$(".goods_num").each(function () {
|
||||
// 商品按数量
|
||||
if(data.field.card_right_goods_type == 'all'){
|
||||
num_list.push(0);
|
||||
}else{
|
||||
num_list.push($(this).val());
|
||||
}
|
||||
});
|
||||
|
||||
for (var i = 0; i < selectGoodsSkuId.length; i++) {
|
||||
var obj = {};
|
||||
obj.sku_id = selectGoodsSkuId[i];
|
||||
obj.goods_id = selectGoodsId[i];
|
||||
obj.goods_num = num_list[i];
|
||||
goods.push(obj)
|
||||
}
|
||||
data.field.goods_sku_list = JSON.stringify(goods);
|
||||
if (goods.length == 0) {
|
||||
layer.msg("请选择商品");
|
||||
return;
|
||||
}
|
||||
}else{
|
||||
data.field.goods_sku_list = '';
|
||||
if (data.field.balance == 0) {
|
||||
layer.msg("请输入储值余额");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
data.field.desc = activityDetail.getContent();
|
||||
data.field.instruction = activityInstruction.getContent();
|
||||
|
||||
if(data.field.card_type == 'real'){
|
||||
if(data.field['cdk_type[0]'] == undefined && data.field['cdk_type[1]'] == undefined && data.field['cdk_type[2]'] == undefined){
|
||||
layer.msg("卡密内容不能为空");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (repeat_flag) return;
|
||||
repeat_flag = true;
|
||||
|
||||
saveFunc(data);
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
//添加素材
|
||||
$("body").off("click", ".js-add-media-image").on("click", ".js-add-media-image", function () {
|
||||
openMedia(function (data) {
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
if (mediaImage.length < GOODS_IMAGE_MAX){
|
||||
mediaImage.push(data[i].media_path);
|
||||
mediaIds.push(data[i].media_id);
|
||||
}
|
||||
}
|
||||
refreshGoodsImage();
|
||||
}, GOODS_IMAGE_MAX - mediaImage.length);
|
||||
});
|
||||
|
||||
//替换商品主图
|
||||
$("body").off("click", ".replace_img").on("click", ".replace_img", function () {
|
||||
var index = $(this).data('index');
|
||||
openMedia(function (data) {
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
mediaImage[index] = data[i].media_path;
|
||||
mediaIds[index] = data[i].media_id;
|
||||
}
|
||||
refreshGoodsImage();
|
||||
},1);
|
||||
});
|
||||
|
||||
//渲染商品主图列表
|
||||
function refreshGoodsImage() {
|
||||
var goods_image_template = $("#mediaImage").html();
|
||||
var data = {
|
||||
list: mediaImage,
|
||||
max: GOODS_IMAGE_MAX
|
||||
};
|
||||
|
||||
laytpl(goods_image_template).render(data, function (html) {
|
||||
|
||||
$(".js-goods-image").html(html);
|
||||
|
||||
//加载图片放大
|
||||
loadImgMagnify();
|
||||
|
||||
if (mediaImage.length) {
|
||||
|
||||
//预览
|
||||
$(".js-goods-image .js-preview").click(function () {
|
||||
$(this).parent().prev().find("img").click();
|
||||
});
|
||||
|
||||
//图片删除
|
||||
$(".js-goods-image .js-delete").click(function () {
|
||||
var index = $(this).attr("data-index");
|
||||
mediaImage.splice(index, 1);
|
||||
mediaIds.splice(index, 1);
|
||||
refreshGoodsImage();
|
||||
});
|
||||
}
|
||||
|
||||
//最多传十张图
|
||||
if (mediaImage.length < GOODS_IMAGE_MAX) {
|
||||
$(".js-add-goods-image").show();
|
||||
} else {
|
||||
$(".js-add-goods-image").hide();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
// 返回
|
||||
function backGiftCardList() {
|
||||
location.hash = ns.hash("giftcard://shop/giftcard/lists");
|
||||
}
|
||||
|
||||
//检测数据类型
|
||||
function detectionNumType(el, type) {
|
||||
var value = $(el).val();
|
||||
//大于零 且 不是小数
|
||||
if (value < 0 && type == 'integral')
|
||||
$(el).val(0);
|
||||
else if (type == 'integral')
|
||||
$(el).val(Math.round(value));
|
||||
|
||||
//大于1 且 不是小数
|
||||
if (value < 1 && type == 'positiveInteger')
|
||||
$(el).val(1);
|
||||
else if (type == 'positiveInteger')
|
||||
$(el).val(Math.round(value));
|
||||
//大于零可以是小数
|
||||
if (type == 'positiveNumber') {
|
||||
value = parseFloat(value).toFixed(2);
|
||||
if (value < 0)
|
||||
$(el).val(0);
|
||||
else
|
||||
$(el).val(value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加商品
|
||||
*/
|
||||
function addGoods() {
|
||||
goodsSelect(function (data) {
|
||||
if (Object.keys(data).length == 0) {
|
||||
selectGoodsSkuId = [];
|
||||
selectGoodsId = [];
|
||||
$('.goods-empty').show();
|
||||
$("#goods_num").text(selectGoodsSkuId.length);
|
||||
$("#goods tbody tr:not(.goods-empty)").remove();
|
||||
return;
|
||||
}
|
||||
|
||||
var price = 0.00;
|
||||
var card_right_goods_type_change = $('input[name="card_right_goods_type"]:checked').val();
|
||||
|
||||
var th_display = card_right_goods_type_change == 'item' ? 'show' : 'hide';
|
||||
if(th_display == 'show'){
|
||||
$('.goods_num_col').removeClass('hide').addClass('show').find('input').attr('lay-verify','required|number');
|
||||
}else{
|
||||
$('.goods_num_col').removeClass('show').addClass('hide').find('input').attr('lay-verify','required');
|
||||
}
|
||||
|
||||
var html = '';
|
||||
|
||||
for (var key in data) {
|
||||
for (var sku in data[key].selected_sku_list) {
|
||||
var item = data[key].selected_sku_list[sku];
|
||||
if (selectGoodsSkuId.indexOf(parseInt(item.sku_id)) != -1) {
|
||||
continue;
|
||||
}
|
||||
html += `<tr data-sku_id="${item.sku_id}" data-goods_id="${item.goods_id}">`;
|
||||
html += `
|
||||
<td>
|
||||
<div class="goods-title">
|
||||
<div class="goods-img">
|
||||
<img layer-src src="${item.sku_image ? ns.img(item.sku_image) : ''}" alt="">
|
||||
</div>
|
||||
<p class="multi-line-hiding goods-name">${item.sku_name}</p>
|
||||
</div>
|
||||
</td>
|
||||
`;
|
||||
html += `<td class='price-one'>${item.price }</td>`;
|
||||
html += `<td class="goods_num_col `+ th_display +`"><input type="number" name="" min="1" onchange="detectionNumType(this,'integral')" lay-verify="required" class="layui-input goods_num" value='1'></td>`;
|
||||
html += `<td class='operation'> <div class='table-btn '><a href='javascript:;' class='layui-btn' onclick='deleteGoods(this)'>删除商品</a></div></td>`;
|
||||
html += `</tr>`;
|
||||
price += Number(item.price);
|
||||
selectGoodsSkuId.push(item.sku_id);
|
||||
selectGoodsId.push(item.goods_id);
|
||||
}
|
||||
}
|
||||
|
||||
if(selectGoodsSkuId.length) {
|
||||
$('.goods-empty').hide();
|
||||
$("#goods tbody").append(html);
|
||||
} else {
|
||||
$('.goods-empty').show();
|
||||
}
|
||||
$("#goods_num").text(selectGoodsSkuId.length);
|
||||
|
||||
}, selectGoodsSkuId, {mode: "sku",goods_class: 1,is_disabled_goods_class: 1});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品
|
||||
*/
|
||||
function deleteGoods(data) {
|
||||
var obj = $(data).parent().parent().parent();
|
||||
$(obj).remove();
|
||||
for (var i in selectGoodsSkuId) {
|
||||
if (selectGoodsSkuId[i] == Number($(obj).attr("data-sku_id"))) {
|
||||
selectGoodsSkuId.splice(i, 1);
|
||||
selectGoodsId.splice(i, 1);
|
||||
}
|
||||
}
|
||||
$("#goods_num").text(selectGoodsSkuId.length)
|
||||
|
||||
if(selectGoodsSkuId.length) $('.goods-empty').hide();
|
||||
else $('.goods-empty').show();
|
||||
}
|
||||
|
||||
</script>
|
||||
552
addon/giftcard/shop/view/giftcard/lists.html
Executable file
552
addon/giftcard/shop/view/giftcard/lists.html
Executable file
@@ -0,0 +1,552 @@
|
||||
<style>
|
||||
.rights_interests{line-height: 13px;}
|
||||
.len-short{width: 70px !important;}
|
||||
.hide{display: none;}
|
||||
.show{display: block;}
|
||||
.layui-layout-admin .table-tab .layui-tab-title{margin-bottom: 10px;}
|
||||
</style>
|
||||
|
||||
<div class="single-filter-box">
|
||||
<button class="layui-btn" onclick="add()">添加礼品卡</button>
|
||||
</div>
|
||||
|
||||
<div class="screen layui-collapse" lay-filter="card_tab">
|
||||
<div class="layui-colla-item">
|
||||
<form class="layui-colla-content layui-form layui-show">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">礼品卡名称</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="search_text" placeholder="请输入卡名称" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<button type="button" class="layui-btn" lay-filter="search" lay-submit>筛选</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-tab table-tab" lay-filter="card_type_tab">
|
||||
<ul class="layui-tab-title">
|
||||
<li class="layui-this tab1" lay-id="all">全部</li>
|
||||
<li class="tab1" lay-id="virtual">电子卡</li>
|
||||
<li class="tab2" lay-id="real">实体卡</li>
|
||||
</ul>
|
||||
<div class="layui-tab-content poster_list">
|
||||
<!-- 列表 -->
|
||||
<table id="poster_list" lay-filter="poster_list"></table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/html" id="rights_interests">
|
||||
<div class=rights_interests>
|
||||
<p style="margin-top: 13px"><span>积分:{{d.point}}</span></p><br>
|
||||
<p><span>余额:{{d.balance}}</span></p><br>
|
||||
</div>
|
||||
</script>
|
||||
<script type="text/html" id="selling_price">
|
||||
<div class=rights_interests>
|
||||
{{# if(d.type == 1){ }}¥{{d.selling_price}}{{# }else{ }}---{{# } }}
|
||||
</div>
|
||||
</script>
|
||||
<script type="text/html" id="poster_status">
|
||||
<div class='table-title'>
|
||||
{{# if(d.status == 0){ }}
|
||||
<div class='title-pic' style="text-align:left">未激活</div>
|
||||
{{# }else if(d.status == 1){ }}
|
||||
<div class='title-pic' style="text-align:left">已激活</div>
|
||||
{{# }else if(d.status == 2){ }}
|
||||
<div class='title-pic' style="text-align:left">已作废</div>
|
||||
{{# } }}
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<!-- 时间 -->
|
||||
<script id="time" type="text/html">
|
||||
<div class="layui-elip">开始:{{ns.time_to_date(d.start_time)}}</div>
|
||||
<div class="layui-elip">结束:{{ns.time_to_date(d.end_time)}}</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="validity_type">
|
||||
<div class='table-title'>
|
||||
{{# if(d.validity_type == 'forever'){ }}
|
||||
<div class='title-pic' style="text-align:left">永久有效</div>
|
||||
{{# }else if(d.validity_type == 'date'){ }}
|
||||
<div class='title-pic' style="text-align:left">有效期至{{ns.time_to_date(d.validity_time)}}</div>
|
||||
{{# }else if(d.validity_type == 'day'){ }}
|
||||
<div class='title-pic' style="text-align:left">领取后{{d.validity_day}}天内有效</div>
|
||||
{{# } }}
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<!-- 操作 -->
|
||||
<script type="text/html" id="operation">
|
||||
<div class="table-btn">
|
||||
<a class="layui-btn" lay-event="elect_detail">详情</a>
|
||||
<a class="layui-btn" lay-event="edit">编辑</a>
|
||||
{{# if(d.status==0){ }}
|
||||
<a class="layui-btn" lay-event="start">上架</a>
|
||||
<a class="layui-btn" lay-event="delete">删除</a>
|
||||
{{# } }}
|
||||
{{# if(d.status==1){ }}
|
||||
<a class="layui-btn" lay-event="close">下架</a>
|
||||
{{# } }}
|
||||
{{# if(d.card_type=='real'){ }}
|
||||
<a class="layui-btn" lay-event="add_batch">制卡</a>
|
||||
{{# } }}
|
||||
{{# if(d.card_type=='virtual'){ }}
|
||||
<a class="layui-btn" lay-event="order">订单</a>
|
||||
{{# } }}
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="status">
|
||||
<div class='table-title'>
|
||||
{{# if(d.status == 0){ }}
|
||||
<div class='title-pic' style="text-align:left">已结束</div>
|
||||
{{# }else if(d.status == 1){ }}
|
||||
<div class='title-pic' style="text-align:left">进行中</div>
|
||||
{{# } }}
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<!-- 编辑排序 -->
|
||||
<script type="text/html" id="editSort">
|
||||
<input name="sort" type="number" onchange="editSort({{d.giftcard_id}}, this)" value="{{d.sort}}" class="layui-input edit-sort len-short">
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="card_right_type">
|
||||
<div class='table-title'>
|
||||
{{# if(d.card_right_type == 'balance'){ }}
|
||||
<div class='title-pic' style="text-align:left">储值卡</div>
|
||||
{{# }else if(d.card_right_type == 'goods'){ }}
|
||||
<div class='title-pic' style="text-align:left">礼品卡</div>
|
||||
{{# } }}
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var table,form,laytpl,repeat_flag,layer_label,element;
|
||||
layui.use(['form','laytpl','element'], function () {
|
||||
laytpl = layui.laytpl;
|
||||
form = layui.form;
|
||||
element = layui.element;
|
||||
repeat_flag = false; //防重复标识
|
||||
form.render();
|
||||
|
||||
var cols = {
|
||||
"all": [
|
||||
[{
|
||||
field: 'card_name',
|
||||
title: '礼品卡名称',
|
||||
unresize: 'false',
|
||||
width: '16%',
|
||||
}, {
|
||||
title: '权益类型',
|
||||
unresize: 'false',
|
||||
width: '8%',
|
||||
templet: '#card_right_type'
|
||||
}, {
|
||||
title: '卡类型',
|
||||
unresize: 'false',
|
||||
width: '8%',
|
||||
field: 'card_type_name'
|
||||
}, {
|
||||
field: 'sale_num',
|
||||
title: '销量/激活数',
|
||||
unresize: 'false',
|
||||
width: '8%',
|
||||
templet: function(data){
|
||||
var val = data.card_type == 'real' ? data.activate_count : data.sale_num;
|
||||
return val;
|
||||
}
|
||||
},{
|
||||
field: 'use_count',
|
||||
title: '已使用',
|
||||
unresize: 'false',
|
||||
width: '8%',
|
||||
}, {
|
||||
title: '有效期',
|
||||
unresize: 'false',
|
||||
width: '12%',
|
||||
templet: '#validity_type'
|
||||
}, {
|
||||
field: 'sort',
|
||||
unresize: 'false',
|
||||
title: '排序',
|
||||
templet: '#editSort',
|
||||
sort : true,
|
||||
width: '7%',
|
||||
}, {
|
||||
field: 'status',
|
||||
title: '状态',
|
||||
unresize: 'false',
|
||||
width: '10%',
|
||||
templet: '#status'
|
||||
},{
|
||||
field: 'create_time',
|
||||
title: '创建时间',
|
||||
unresize: 'false',
|
||||
width: '14%',
|
||||
templet: function (data) {
|
||||
return ns.time_to_date(data.create_time);
|
||||
}
|
||||
}, {
|
||||
title: '操作',
|
||||
toolbar: '#operation',
|
||||
unresize: 'false',
|
||||
align : 'right'
|
||||
}]
|
||||
],
|
||||
"virtual": [
|
||||
[{
|
||||
field: 'card_name',
|
||||
title: '礼品卡名称',
|
||||
unresize: 'false',
|
||||
width: '16%',
|
||||
}, {
|
||||
title: '权益类型',
|
||||
unresize: 'false',
|
||||
width: '8%',
|
||||
templet: '#card_right_type'
|
||||
}, {
|
||||
title: '卡类型',
|
||||
unresize: 'false',
|
||||
width: '8%',
|
||||
field: 'card_type_name'
|
||||
}, {
|
||||
field: 'sale_num',
|
||||
title: '销量',
|
||||
unresize: 'false',
|
||||
width: '8%',
|
||||
},{
|
||||
field: 'use_count',
|
||||
title: '已使用',
|
||||
unresize: 'false',
|
||||
width: '8%',
|
||||
}, {
|
||||
title: '有效期',
|
||||
unresize: 'false',
|
||||
width: '12%',
|
||||
templet: '#validity_type'
|
||||
}, {
|
||||
field: 'sort',
|
||||
unresize: 'false',
|
||||
title: '排序',
|
||||
templet: '#editSort',
|
||||
sort : true,
|
||||
width: '7%',
|
||||
}, {
|
||||
field: 'status',
|
||||
title: '状态',
|
||||
unresize: 'false',
|
||||
width: '10%',
|
||||
templet: '#status'
|
||||
},{
|
||||
field: 'create_time',
|
||||
title: '创建时间',
|
||||
unresize: 'false',
|
||||
width: '14%',
|
||||
templet: function (data) {
|
||||
return ns.time_to_date(data.create_time);
|
||||
}
|
||||
}, {
|
||||
title: '操作',
|
||||
toolbar: '#operation',
|
||||
unresize: 'false',
|
||||
align : 'right'
|
||||
}]
|
||||
],
|
||||
"real": [
|
||||
[{
|
||||
field: 'card_name',
|
||||
title: '礼品卡名称',
|
||||
unresize: 'false',
|
||||
width: '10%',
|
||||
}, {
|
||||
title: '权益类型',
|
||||
unresize: 'false',
|
||||
width: '8%',
|
||||
templet: '#card_right_type'
|
||||
}, {
|
||||
title: '卡类型',
|
||||
unresize: 'false',
|
||||
width: '8%',
|
||||
field: 'card_type_name'
|
||||
},
|
||||
{
|
||||
field: 'card_count',
|
||||
title: '制卡数',
|
||||
unresize: 'false',
|
||||
width: '8%',
|
||||
},{
|
||||
field: 'activate_count',
|
||||
title: '激活数',
|
||||
unresize: 'false',
|
||||
width: '8%',
|
||||
},{
|
||||
field: 'use_count',
|
||||
title: '已使用',
|
||||
unresize: 'false',
|
||||
width: '8%'
|
||||
},{
|
||||
title: '有效期',
|
||||
unresize: 'false',
|
||||
width: '10%',
|
||||
templet: '#validity_type'
|
||||
}, {
|
||||
field: 'sort',
|
||||
unresize: 'false',
|
||||
title: '排序',
|
||||
templet: '#editSort',
|
||||
sort : true,
|
||||
width: '7%',
|
||||
}, {
|
||||
field: 'status',
|
||||
title: '状态',
|
||||
unresize: 'false',
|
||||
width: '8%',
|
||||
templet: '#status'
|
||||
},{
|
||||
field: 'create_time',
|
||||
title: '创建时间',
|
||||
unresize: 'false',
|
||||
width: '14%',
|
||||
templet: function (data) {
|
||||
return ns.time_to_date(data.create_time);
|
||||
}
|
||||
}, {
|
||||
title: '操作',
|
||||
toolbar: '#operation',
|
||||
unresize: 'false',
|
||||
align : 'right'
|
||||
}]
|
||||
]
|
||||
}
|
||||
|
||||
element.on('tab(card_type_tab)', function () {
|
||||
table = new Table({
|
||||
elem: '#poster_list',
|
||||
url: ns.url("giftcard://shop/giftcard/lists"),
|
||||
cols: cols[this.getAttribute('lay-id')],
|
||||
where: {
|
||||
'card_type': this.getAttribute('lay-id')
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
table = new Table({
|
||||
elem: '#poster_list',
|
||||
url: ns.url("giftcard://shop/giftcard/lists"),
|
||||
cols: cols.all
|
||||
});
|
||||
|
||||
$('body').off('click', '.tab1').on('click', '.tab1', function () {
|
||||
$('.poster_list2').removeClass('show').addClass('hide');
|
||||
$('.poster_list').removeClass('hide').addClass('show');
|
||||
});
|
||||
|
||||
/**
|
||||
* 监听工具栏操作
|
||||
*/
|
||||
table.tool(function (obj) {
|
||||
var data = obj.data;
|
||||
|
||||
switch (obj.event) {
|
||||
case 'edit':
|
||||
location.hash = ns.hash("giftcard://shop/giftcard/edit?giftcard_id="+data.giftcard_id);
|
||||
break;
|
||||
case 'delete':
|
||||
del(data.giftcard_id);
|
||||
break;
|
||||
case 'elect_detail':
|
||||
window.open(ns.href("giftcard://shop/giftcard/detail?giftcard_id="+data.giftcard_id));
|
||||
break;
|
||||
case 'close': //下架
|
||||
output(data.giftcard_id);
|
||||
break;
|
||||
case 'start': //上架
|
||||
onput(data.giftcard_id);
|
||||
break;
|
||||
case 'add_batch': //添加批次
|
||||
location.hash = ns.hash("giftcard://shop/cardimport/lists",{"giftcard_id": data.giftcard_id});
|
||||
break;
|
||||
case 'check_card': //查看卡密
|
||||
window.open(ns.href("giftcard://shop/card/lists",{giftcard_id: data.giftcard_id}));
|
||||
break;
|
||||
case 'order': //查看订单
|
||||
window.open(ns.href('giftcard://shop/order/order?giftcard_id=' + data.giftcard_id))
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
table.on("sort",function (obj) {
|
||||
table.reload({
|
||||
page: {
|
||||
curr: 1
|
||||
},
|
||||
where: {
|
||||
order:obj.field,
|
||||
sort:obj.type
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* 下架
|
||||
*/
|
||||
function output(id) {
|
||||
if (repeat_flag) return false;
|
||||
repeat_flag = true;
|
||||
|
||||
layer.confirm('确定下架吗?',{
|
||||
btn: ['确定','取消'] //按钮
|
||||
,cancel: function(index, layero){
|
||||
repeat_flag = false;
|
||||
layer.close(index);
|
||||
}
|
||||
}, function (index) {
|
||||
layer.close(index);
|
||||
$.ajax({
|
||||
url: ns.url("giftcard://shop/giftcard/isuse"),
|
||||
data: {
|
||||
id: id,
|
||||
status: 0
|
||||
},
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function (res) {
|
||||
layer.msg(res.message);
|
||||
repeat_flag = false;
|
||||
if (res.code == 0) {
|
||||
table.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
}, function(){
|
||||
repeat_flag = false;
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 上架
|
||||
*/
|
||||
function onput(id) {
|
||||
if (repeat_flag) return false;
|
||||
repeat_flag = true;
|
||||
|
||||
layer.confirm('确定上架吗?',{
|
||||
btn: ['确定','取消'] //按钮
|
||||
,cancel: function(index, layero){
|
||||
repeat_flag = false;
|
||||
layer.close(index);
|
||||
}
|
||||
}, function (index) {
|
||||
layer.close(index);
|
||||
$.ajax({
|
||||
url: ns.url("giftcard://shop/giftcard/isuse"),
|
||||
data: {
|
||||
id: id, status: 1
|
||||
},
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function (res) {
|
||||
layer.msg(res.message);
|
||||
repeat_flag = false;
|
||||
if (res.code == 0) {
|
||||
table.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
}, function(index){
|
||||
repeat_flag = false;
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
|
||||
// 监听单元格编辑
|
||||
function editSort(goods_id, event){
|
||||
var data = $(event).val();
|
||||
if (data == '') {
|
||||
$(event).val(0);
|
||||
data = 0;
|
||||
}
|
||||
|
||||
if(!new RegExp("^-?[0-9]\\d*$").test(data)){
|
||||
layer.msg("排序号只能是整数");
|
||||
return ;
|
||||
}
|
||||
if(data<0){
|
||||
layer.msg("排序号必须大于0");
|
||||
return ;
|
||||
}
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: ns.url("giftcard://shop/giftcard/sort"),
|
||||
data: {
|
||||
goods_id: goods_id,
|
||||
sort: data
|
||||
},
|
||||
dataType: 'JSON',
|
||||
success: function(res) {
|
||||
layer.msg(res.message);
|
||||
if(res.code==0){
|
||||
table.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 删除
|
||||
function del(id){
|
||||
if (repeat_flag) return false;
|
||||
repeat_flag = true;
|
||||
layer.confirm('礼品卡删除将同时删除对应会员获取的礼品卡,请谨慎处理。', {
|
||||
title:'删除礼品卡',
|
||||
btn: ['确定','取消'] //按钮
|
||||
,cancel: function(index, layero){
|
||||
repeat_flag = false;
|
||||
layer.close(index);
|
||||
}
|
||||
},function (index) {
|
||||
layer.close(index);
|
||||
$.ajax({
|
||||
url: ns.url("giftcard://shop/giftcard/delete"),
|
||||
data: {
|
||||
giftcard_id: id
|
||||
},
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function (res) {
|
||||
layer.msg(res.message);
|
||||
repeat_flag = false;
|
||||
if (res.code == 0) {
|
||||
table.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
}, function(index){
|
||||
repeat_flag = false;
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索功能
|
||||
*/
|
||||
form.on('submit(search)', function (data) {
|
||||
table.reload({
|
||||
page: {curr: 1},
|
||||
where: data.field
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function add() {
|
||||
location.hash = ns.hash("giftcard://shop/giftcard/add");
|
||||
}
|
||||
</script>
|
||||
242
addon/giftcard/shop/view/giftcard_records/elect_lists.html
Executable file
242
addon/giftcard/shop/view/giftcard_records/elect_lists.html
Executable file
@@ -0,0 +1,242 @@
|
||||
<style>
|
||||
.rights_interests {
|
||||
line-height: 13px;
|
||||
}
|
||||
.layui-form-item{
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
.search-input{
|
||||
margin-right: 0 !important;
|
||||
}
|
||||
.layui-table-view .layui-table td, .layui-table-view .layui-table th{
|
||||
text-align: center;
|
||||
}
|
||||
.table-title .title-pic{
|
||||
width: 100% !important;
|
||||
height: 100%;
|
||||
margin-left: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="screen layui-collapse" lay-filter="selection_panel">
|
||||
<div class="layui-colla-content layui-form layui-show">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline search-input">
|
||||
<label class="layui-form-label">卡编号:</label>
|
||||
<div class="layui-input-inline search-input">
|
||||
<input type="text" name="search_text" placeholder="请输入卡编号" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<div class="layui-input-inline">
|
||||
<!-- <button class="layui-btn" lay-submit lay-filter="search">筛选</button> -->
|
||||
<button type="button" class="layui-btn layui-btn-primary" lay-filter="search" lay-submit>
|
||||
<i class="layui-icon"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-tab table-tab" lay-filter="manjian_tab">
|
||||
<div class="layui-tab-content">
|
||||
<!-- 列表 -->
|
||||
<table id="poster_list" lay-filter="poster_list"></table>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/html" id="time">
|
||||
<div class='rights_interests'>
|
||||
{{# if(d.create_time){ }}
|
||||
<p style="margin-top: 13px;"><span>生成时间:{{ns.time_to_date(d.create_time)}}</span></p><br/>
|
||||
{{# } }}
|
||||
{{# if(d.use_time){ }}
|
||||
<p><span>使用时间:{{ns.time_to_date(d.use_time)}}</span></p>
|
||||
{{# } }}
|
||||
</div>
|
||||
</script>
|
||||
<script type="text/html" id="rights_interests">
|
||||
<div class='rights_interests'>
|
||||
<p style="margin-top: 13px;"><span>积分:{{d.point}}</span></p><br>
|
||||
<p><span>余额:{{d.balance}}</span></p><br>
|
||||
</div>
|
||||
</script>
|
||||
<script type="text/html" id="poster_status">
|
||||
<div class='table-title'>
|
||||
{{# if(d.elect_status == 0){ }}
|
||||
<div class='title-pic text-color'>待使用</div>
|
||||
{{# }else if(d.elect_status == 1){ }}
|
||||
<div class='title-pic '>已使用</div>
|
||||
{{# }else if(d.elect_status == 2){ }}
|
||||
<div class='title-pic'>已过期</div>
|
||||
{{# } }}
|
||||
</div>
|
||||
</script>
|
||||
<!-- 操作 -->
|
||||
<script type="text/html" id="operation">
|
||||
<div class="table-btn">
|
||||
{{# if(d.entity_status==0){ }}
|
||||
<a class="layui-btn" lay-event="start">激活</a>
|
||||
<a class="layui-btn" lay-event="close">作废</a>
|
||||
{{# }else if(d.entity_status==1){ }}
|
||||
<a class="layui-btn" lay-event="close">作废</a>
|
||||
{{# } }}
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var laytpl;
|
||||
var id = {:input('id', 0)};
|
||||
layui.use(['form', 'laytpl'], function () {
|
||||
var table,
|
||||
form = layui.form,
|
||||
repeat_flag = false; //防重复标识
|
||||
form.render();
|
||||
|
||||
laytpl = layui.laytpl;
|
||||
table = new Table({
|
||||
elem: '#poster_list',
|
||||
url: ns.url("giftcard://shop/giftcard/electlist"),
|
||||
where: {
|
||||
id: id
|
||||
},
|
||||
cols: [
|
||||
[{
|
||||
field: 'LAY_INDEX',
|
||||
title: '序号',
|
||||
unresize: 'false',
|
||||
width: '7%',
|
||||
templet: function (data) {
|
||||
return data.LAY_INDEX;
|
||||
}
|
||||
}, {
|
||||
field: 'number',
|
||||
title: '卡编号',
|
||||
unresize: 'false',
|
||||
width: '10%',
|
||||
}, {
|
||||
field: 'username',
|
||||
title: '使用人',
|
||||
unresize: 'false',
|
||||
width: '12%',
|
||||
}, {
|
||||
title: '兑换权益',
|
||||
unresize: 'false',
|
||||
width: '10%',
|
||||
templet: '#rights_interests'
|
||||
}, {
|
||||
title: '时间',
|
||||
unresize: 'false',
|
||||
width: '15%',
|
||||
templet: '#time'
|
||||
}, {
|
||||
field: 'status',
|
||||
title: '状态',
|
||||
unresize: 'false',
|
||||
width: '12%',
|
||||
templet: '#poster_status'
|
||||
},]
|
||||
]
|
||||
});
|
||||
|
||||
/**
|
||||
* 监听工具栏操作
|
||||
*/
|
||||
table.tool(function (obj) {
|
||||
var data = obj.data;
|
||||
switch (obj.event) {
|
||||
case 'close': //关闭
|
||||
close(data.id);
|
||||
break;
|
||||
case 'start': //启用
|
||||
start(data.id);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 关闭
|
||||
*/
|
||||
function close(id) {
|
||||
if (repeat_flag) return false;
|
||||
repeat_flag = true;
|
||||
layer.confirm('确定作废吗?', {
|
||||
btn: ['确定', '取消'] //按钮
|
||||
, cancel: function (index, layero) {
|
||||
repeat_flag = false;
|
||||
layer.close(index);
|
||||
}
|
||||
}, function (index) {
|
||||
layer.close(index);
|
||||
$.ajax({
|
||||
url: ns.url("giftcard://shop/giftcard/editrecordstatus"),
|
||||
data: {
|
||||
id: id, entity_status: 2
|
||||
},
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function (res) {
|
||||
layer.msg(res.message);
|
||||
repeat_flag = false;
|
||||
if (res.code == 0) {
|
||||
table.reload();
|
||||
}
|
||||
}
|
||||
}, function (index) {
|
||||
repeat_flag = false;
|
||||
layer.close(index);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 开启
|
||||
*/
|
||||
function start(id) {
|
||||
if (repeat_flag) return false;
|
||||
repeat_flag = true;
|
||||
|
||||
layer.confirm('确定激活吗?', {
|
||||
btn: ['确定', '取消'] //按钮
|
||||
, cancel: function (index, layero) {
|
||||
repeat_flag = false;
|
||||
layer.close(index);
|
||||
}
|
||||
}, function (index) {
|
||||
layer.close(index);
|
||||
$.ajax({
|
||||
url: ns.url("giftcard://shop/giftcard/editrecordstatus"),
|
||||
data: {
|
||||
id: id, entity_status: 1
|
||||
},
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function (res) {
|
||||
layer.msg(res.message);
|
||||
repeat_flag = false;
|
||||
if (res.code == 0) {
|
||||
table.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
}, function (index) {
|
||||
repeat_flag = false;
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
|
||||
form.on('submit(search)', function (data) {
|
||||
table.reload({
|
||||
page: {
|
||||
curr: 1,
|
||||
id: id
|
||||
},
|
||||
where: data.field
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function add() {
|
||||
location.hash = ns.hash("giftcard://shop/giftcard/addgiftcard");
|
||||
}
|
||||
</script>
|
||||
293
addon/giftcard/shop/view/giftcard_records/lists.html
Executable file
293
addon/giftcard/shop/view/giftcard_records/lists.html
Executable file
@@ -0,0 +1,293 @@
|
||||
<style>
|
||||
.rights_interests {
|
||||
line-height: 13px;
|
||||
}
|
||||
.layui-form-item{
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
.search-input{
|
||||
margin-right: 0 !important;
|
||||
}
|
||||
.layui-table-view .layui-table td, .layui-table-view .layui-table th{
|
||||
text-align: center;
|
||||
}
|
||||
.table-title .title-pic{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin-left: 0;
|
||||
}
|
||||
.layui-table .table-btn{
|
||||
text-align: center;
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="screen layui-collapse" lay-filter="selection_panel">
|
||||
<div class="layui-colla-content layui-form layui-show">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline search-input">
|
||||
<label class="layui-form-label">兑换码:</label>
|
||||
<div class="layui-input-inline search-input">
|
||||
<input type="text" name="search_text" placeholder="请输入兑换码" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<div class="layui-input-inline">
|
||||
<!-- <button class="layui-btn" lay-submit lay-filter="search">筛选</button> -->
|
||||
<button type="button" class="layui-btn layui-btn-primary" lay-filter="search" lay-submit>
|
||||
<i class="layui-icon"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-tab table-tab" lay-filter="manjian_tab">
|
||||
<div class="layui-tab-content">
|
||||
<!-- 列表 -->
|
||||
<table id="poster_list" lay-filter="poster_list"></table>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/html" id="time">
|
||||
<div class='rights_interests'>
|
||||
{{# if(d.create_time){ }}
|
||||
<p><span>生成时间:{{ns.time_to_date(d.create_time)}}</span></p><br/>
|
||||
{{# } }}
|
||||
{{# if(d.activation_time){ }}
|
||||
<p><span>激活时间:{{ns.time_to_date(d.activation_time)}}</span></p><br>
|
||||
{{# } }}
|
||||
{{# if(d.use_time){ }}
|
||||
<p><span>使用时间:{{ns.time_to_date(d.use_time)}}</span></p>
|
||||
{{# } }}
|
||||
</div>
|
||||
</script>
|
||||
<script type="text/html" id="rights_interests">
|
||||
<div class='rights_interests' style="margin-top: 13px;">
|
||||
<p><span>积分:{{d.point}}</span></p><br>
|
||||
<p><span>余额:{{d.balance}}</span></p><br>
|
||||
</div>
|
||||
</script>
|
||||
<script type="text/html" id="poster_status">
|
||||
<div class='table-title'>
|
||||
{{# if(d.entity_status == 0){ }}
|
||||
<div class='title-pic'>未激活</div>
|
||||
{{# }else if(d.entity_status == 1){ }}
|
||||
<div class='title-pic text-color'>待使用</div>
|
||||
{{# }else if(d.entity_status == 2){ }}
|
||||
<div class='title-pic'>已作废</div>
|
||||
{{# }else if(d.entity_status == 3){ }}
|
||||
<div class='title-pic'>已使用</div>
|
||||
{{# }else if(d.entity_status == 4){ }}
|
||||
<div class='title-pic'>已过期</div>
|
||||
{{# } }}
|
||||
</div>
|
||||
</script>
|
||||
<!-- 操作 -->
|
||||
<script type="text/html" id="operation">
|
||||
<div class="table-btn">
|
||||
{{# if(d.entity_status==0){ }}
|
||||
<a class="layui-btn" lay-event="start">激活</a>
|
||||
<a class="layui-btn" lay-event="close">作废</a>
|
||||
{{# }else if(d.entity_status==1){ }}
|
||||
<a class="layui-btn" lay-event="close">作废</a>
|
||||
{{# } }}
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var laytpl;
|
||||
var id = {:input('id', 0)};
|
||||
layui.use(['form', 'laytpl'], function () {
|
||||
var table,
|
||||
form = layui.form,
|
||||
repeat_flag = false; //防重复标识
|
||||
form.render();
|
||||
|
||||
laytpl = layui.laytpl;
|
||||
table = new Table({
|
||||
elem: '#poster_list',
|
||||
url: ns.url("giftcard://shop/giftcard/recordlist"),
|
||||
where: {
|
||||
id: id
|
||||
},
|
||||
cols: [
|
||||
[{
|
||||
field: 'LAY_INDEX',
|
||||
title: '序号',
|
||||
unresize: 'false',
|
||||
width: '7%',
|
||||
templet: function (data) {
|
||||
return data.LAY_INDEX;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'entity_bianhao',
|
||||
title: '卡编号',
|
||||
unresize: 'false',
|
||||
width: '10%',
|
||||
}, {
|
||||
// field: 'carmichael_text',
|
||||
title: "<a onclick='hideorview()'>兑换码 <i id='hideorview' class='iconfont iconguanbi-yanjing'></i></a>",
|
||||
unresize: 'false',
|
||||
width: '10%',
|
||||
templet:function(data){
|
||||
var obj = $("#hideorview");
|
||||
if(obj.hasClass('iconguanbi-yanjing')){
|
||||
return '<span class="ceshi" data-index="'+data.carmichael_text+'">*********</span>';
|
||||
}else{
|
||||
return '<span class="ceshi" data-index="**********">'+data.carmichael_text+'</span>';
|
||||
}
|
||||
},
|
||||
}, {
|
||||
field: 'username',
|
||||
title: '使用人',
|
||||
unresize: 'false',
|
||||
width: '12%',
|
||||
}, {
|
||||
title: '兑换权益',
|
||||
unresize: 'false',
|
||||
width: '10%',
|
||||
templet: '#rights_interests'
|
||||
}, {
|
||||
title: '时间',
|
||||
unresize: 'false',
|
||||
width: '15%',
|
||||
templet: '#time'
|
||||
}, {
|
||||
field: 'status',
|
||||
title: '状态',
|
||||
unresize: 'false',
|
||||
width: '12%',
|
||||
templet: '#poster_status'
|
||||
}, {
|
||||
title: '操作',
|
||||
toolbar: '#operation',
|
||||
unresize: 'false',
|
||||
align:'right'
|
||||
}]
|
||||
]
|
||||
});
|
||||
/**
|
||||
* 监听工具栏操作
|
||||
*/
|
||||
table.tool(function (obj) {
|
||||
var data = obj.data;
|
||||
switch (obj.event) {
|
||||
case 'close': //关闭
|
||||
close(data.id);
|
||||
break;
|
||||
case 'start': //启用
|
||||
start(data.id);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 关闭
|
||||
*/
|
||||
function close(id) {
|
||||
if (repeat_flag) return false;
|
||||
repeat_flag = true;
|
||||
layer.confirm('确定作废吗?', {
|
||||
btn: ['确定', '取消'] //按钮
|
||||
, cancel: function (index, layero) {
|
||||
repeat_flag = false;
|
||||
layer.close(index);
|
||||
}
|
||||
}, function (index) {
|
||||
layer.close(index);
|
||||
$.ajax({
|
||||
url: ns.url("giftcard://shop/giftcard/editrecordstatus"),
|
||||
data: {
|
||||
id: id, entity_status: 2
|
||||
},
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function (res) {
|
||||
layer.msg(res.message);
|
||||
repeat_flag = false;
|
||||
if (res.code == 0) {
|
||||
table.reload();
|
||||
}
|
||||
}
|
||||
}, function (index) {
|
||||
repeat_flag = false;
|
||||
layer.close(index);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 开启
|
||||
*/
|
||||
function start(id) {
|
||||
if (repeat_flag) return false;
|
||||
repeat_flag = true;
|
||||
|
||||
layer.confirm('确定激活吗?', {
|
||||
btn: ['确定', '取消'] //按钮
|
||||
, cancel: function (index, layero) {
|
||||
repeat_flag = false;
|
||||
layer.close(index);
|
||||
}
|
||||
}, function (index) {
|
||||
layer.close(index);
|
||||
$.ajax({
|
||||
url: ns.url("giftcard://shop/giftcard/editrecordstatus"),
|
||||
data: {
|
||||
id: id, entity_status: 1
|
||||
},
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function (res) {
|
||||
layer.msg(res.message);
|
||||
repeat_flag = false;
|
||||
if (res.code == 0) {
|
||||
table.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
}, function (index) {
|
||||
repeat_flag = false;
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
|
||||
form.on('submit(search)', function (data) {
|
||||
table.reload({
|
||||
page: {
|
||||
curr: 1,
|
||||
id: id
|
||||
},
|
||||
where: data.field
|
||||
});
|
||||
});
|
||||
});
|
||||
function hideorview(data){
|
||||
var obj = $("#hideorview");
|
||||
// $("table tr").each(function(i){
|
||||
// if(i!=0){
|
||||
// // console.log($(this).children('1'));
|
||||
// }
|
||||
// });
|
||||
if(obj.hasClass('iconguanbi-yanjing')){
|
||||
obj.removeClass('iconguanbi-yanjing');
|
||||
obj.addClass('iconreview');
|
||||
$('.ceshi').each(function(index,val){
|
||||
var old = $(this).text();
|
||||
$(this).text($(this).data('index')).data('index',old)
|
||||
})
|
||||
}else{
|
||||
obj.removeClass('iconreview');
|
||||
obj.addClass('iconguanbi-yanjing');
|
||||
$('.ceshi').each(function(index,val){
|
||||
var old = $(this).text();
|
||||
$(this).text($(this).data('index')).data('index',old)
|
||||
})
|
||||
}
|
||||
}
|
||||
function add() {
|
||||
location.hash = ns.hash("giftcard://shop/giftcard/addgiftcard");
|
||||
}
|
||||
</script>
|
||||
427
addon/giftcard/shop/view/media/lists.html
Executable file
427
addon/giftcard/shop/view/media/lists.html
Executable file
@@ -0,0 +1,427 @@
|
||||
<link rel="stylesheet" type="text/css" href="SHOP_CSS/picture_manager.css" />
|
||||
<style>
|
||||
.album-box .album-img-box{display: flex;flex-wrap: wrap;}
|
||||
.album-box .album-content{margin-top: 10px;}
|
||||
.album-box .album-img-box li{margin: 0 13px 20px 0;position: relative;width: 290px;height: 187.5px;cursor: pointer;border: 1px solid #ccc;padding: 2px;}
|
||||
.album-box .album-img-box li.selected{border-color: var(--base-color);}
|
||||
.album-box .album-img-box li.selected .iconfont{color: var(--base-color);}
|
||||
.album-box .album-img-box li .iconfont{position: absolute;bottom: 0;right: 0;font-size: 30px;color: transparent;}
|
||||
.album-box .album-img-box li .album-pic{width: 100%;height: 100%;background-size: 100% 100%;background-repeat: no-repeat;background-position: center;}
|
||||
.album-box .album-img-box li .album-img-operation{position: absolute;top: 0;right: 0;bottom: 0;left: 0;background-color: rgba(0, 0, 0, .5);display: none;align-items: center;justify-content: center;color: #fff;}
|
||||
.album-box .album-img-box li .album-img-operation a{margin: 0 12px;color: #fff;font-size: 14px;}
|
||||
.multuple-list{max-height: 275px; height: auto;}
|
||||
.upload-attention{margin-left: 75px;}
|
||||
.multuple-list-box{display: flex;flex-direction: column;height: 100%;}
|
||||
.multuple-list-box .form-row{margin-top: auto;}
|
||||
.album-box .album-img-box li:hover .album-img-operation{display: flex;}
|
||||
.album-foot-operation{margin-top: auto;display: flex;justify-content: flex-end;padding: 0 25px;}
|
||||
.preview-img .layui-layer-content{padding: 0;}
|
||||
.album-content .album-img-box li:nth-child(7n){margin-right: 13px;}
|
||||
</style>
|
||||
|
||||
<!-- 清理网站缓存 start-->
|
||||
<meta http-equiv="pragma" content="no-cache">
|
||||
<meta http-equiv="Cache-Control" content="no-cache, no-store">
|
||||
<meta http-equiv="expires" content="0">
|
||||
<!-- 清理网站缓存 end-->
|
||||
|
||||
<!-- 搜索框 -->
|
||||
<div class="single-filter-box">
|
||||
<button class="layui-btn" onclick="uploadImg()">添加素材</button>
|
||||
</div>
|
||||
<div class="album-box">
|
||||
<div class="album-content">
|
||||
<ul class="album-img-box"></ul>
|
||||
<div class="album-foot-operation">
|
||||
<div id="paged" class="page"></div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 存储图片路径 -->
|
||||
<input type="hidden" id="hidden_image_path">
|
||||
</div>
|
||||
|
||||
<!-- 相册展示 -->
|
||||
<script type="text/html" id="list_html">
|
||||
{{# layui.each(d.list,function(index, item){ }}
|
||||
<li class="img layui-show">
|
||||
<img class="album-pic" src="{{ ns.img(item.media_path + '?time=' + parseInt(new Date().getTime()/1000)) }}" onerror="onerrorFn(this)">
|
||||
<div class="album-img-operation">
|
||||
<a href="javascript:;" data-id="{{item.media_id}}" onclick="previewFile('{{item.media_path}}','{{item.media_spec}}',this)">预览</a> |
|
||||
<a href="javascript:;" data-id="{{item.media_id}}" onclick="modifyFile(this)">替换</a> |
|
||||
<a href="javascript:;" class="delete-pic" data-id="{{item.media_id}}" onclick="deleteImg(this)">删除</a>
|
||||
</div>
|
||||
<i class="iconfont iconxuanzhong"></i>
|
||||
</li>
|
||||
{{# }) }}
|
||||
</script>
|
||||
|
||||
<!-- 多图上传 -->
|
||||
<script type="text/html" id="multuple_html">
|
||||
<div class="layui-form multuple-list-box">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label sm">本地图片</label>
|
||||
<ul class="layui-input-block multuple-list">
|
||||
<li class="multuple-list-img" id="ImgUpload">
|
||||
<span class="bg-color">+</span>
|
||||
<span>点击添加图片</span>
|
||||
</li>
|
||||
</ul>
|
||||
<p class="upload-attention">请上传320*220素材图片</p>
|
||||
</div>
|
||||
<div class="form-row sm">
|
||||
<button class="layui-btn layui-btn-disabled" disabled="disabled" onclick="submitOne()" id="chooseListAction">提交</button>
|
||||
<button class="layui-btn layui-btn-primary" onclick="back()">返回</button>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<!-- 替换图片 -->
|
||||
<script type="text/html" id="modify_file_html">
|
||||
<div class="layui-form multuple-list-box">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label sm">本地图片</label>
|
||||
<ul class="layui-input-block multuple-list">
|
||||
<li class="multuple-list-img" id="modifyFile">
|
||||
<span class="bg-color">+</span>
|
||||
<span>点击添加图片</span>
|
||||
</li>
|
||||
</ul>
|
||||
<p class="upload-attention">请上传320*220素材图片</p>
|
||||
</div>
|
||||
<div class="form-row sm">
|
||||
<button class="layui-btn layui-btn-disabled" disabled="disabled" id="modifyFileAction">提交</button>
|
||||
<button class="layui-btn layui-btn-primary" onclick="back()">返回</button>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var form, upload, laytpl, layer, laypage, layer_one,element,
|
||||
picture_arr = [],
|
||||
initIdent= true,
|
||||
limit = 10,
|
||||
album_list_count = 0;
|
||||
var repeat_flag = false;
|
||||
|
||||
$(function() {
|
||||
layui.use(['form', 'laytpl', 'laypage', 'layer', 'upload', 'element'], function () {
|
||||
form = layui.form;
|
||||
laytpl = layui.laytpl;
|
||||
laypage = layui.laypage;
|
||||
element = layui.element;
|
||||
layer = layui.layer;
|
||||
upload = layui.upload;
|
||||
|
||||
init(); //初始化数据
|
||||
form.render();
|
||||
element.init();
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* 图片加载
|
||||
*/
|
||||
function getFileAlbumList(page, limit) {
|
||||
$.ajax({
|
||||
url: ns.url("giftcard://shop/media/lists"),
|
||||
type: "POST",
|
||||
dataType: "JSON",
|
||||
async: false,
|
||||
data: {
|
||||
pic_name: $(".album-img-sreach").val(),
|
||||
page_size:limit,
|
||||
page
|
||||
},
|
||||
success: function(res) {
|
||||
res.data.status = $('.album-content-title .edit').attr('data-status');
|
||||
laytpl($("#list_html").html()).render(res.data, function(html) {
|
||||
$(".album-img-box").html(html);
|
||||
loadImgMagnify();
|
||||
});
|
||||
if(initIdent){
|
||||
album_list_count = res.data.list.length;
|
||||
$(".default-group .num").text(album_list_count);
|
||||
initIdent = false;
|
||||
}
|
||||
$("#paged").empty();
|
||||
if (res.data.count > 0) {
|
||||
//调用分页
|
||||
laypage.render({
|
||||
elem: "paged",
|
||||
count: res.data.count,
|
||||
curr: page, //当前页
|
||||
limit: limit,
|
||||
jump: function(obj, first) {
|
||||
if (!first) {
|
||||
getFileAlbumList(obj.curr, obj.limit);
|
||||
}
|
||||
form.render('checkbox');
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 图片替换
|
||||
function modifyFile(data) {
|
||||
laytpl($("#modify_file_html").html()).render({}, function(html) {
|
||||
layer_one = layer.open({
|
||||
type: 1,
|
||||
area: ['580px', '500px'],
|
||||
title: '替换图片',
|
||||
content: html,
|
||||
cancel: function() {
|
||||
$("#modifyFileAction").removeClass("bg-color").addClass("layui-btn-disabled").attr("disabled", "disabled");
|
||||
},
|
||||
success: function(res) {
|
||||
//上传图片
|
||||
upload.render({
|
||||
elem: '#modifyFile',
|
||||
url: ns.url("giftcard://shop/media/modifyFile"),
|
||||
data: {
|
||||
media_id: $(data).attr('data-id')
|
||||
},
|
||||
multiple: true,
|
||||
auto: false,
|
||||
bindAction: '#modifyFileAction',
|
||||
choose: function(obj) {
|
||||
//将每次选择的文件追加到文件队列
|
||||
var files = this.files = obj.pushFile();
|
||||
//预读本地文件,如果是多文件,则会遍历。(不支持ie8/9)
|
||||
obj.preview(function(index, file, result) {
|
||||
//追加预览图片
|
||||
var html = '';
|
||||
html += '<li class="multuple-list-img upload-wrap" index="' + index + '">';
|
||||
html += '<img src="' + result + '" alt="' + file.name + '">';
|
||||
html += '<span class="upload-close-modal" id="upload_img_' + index + '">×</span>';
|
||||
html += '<div class="upload-image-curtain">50%</div>';
|
||||
html += '<div class="tips"></div>';
|
||||
html += '</li>';
|
||||
$(".multuple-list").prepend(html);
|
||||
|
||||
//删除预览图片
|
||||
$("#upload_img_" + index).bind("click", function() {
|
||||
delete files[index];
|
||||
delete picture_arr[index]; //删除所选队列
|
||||
$(this).parent('.upload-wrap').remove();
|
||||
|
||||
// uploadListIns.config.elem.next()[0].value = ''; //清空 input file 值,以免删除后出现同名文件不可选
|
||||
|
||||
//禁止点击
|
||||
if ($(".multuple-list li").length <= 1) {
|
||||
$("#modifyFileAction").removeClass("bg-color").addClass("layui-btn-disabled").attr("disabled", "disabled");
|
||||
//未选择图片时,显示添加按钮
|
||||
$("#modifyFile").show();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
//禁止点击
|
||||
if ($(".multuple-list li").length > 1) {
|
||||
$("#modifyFileAction").addClass("bg-color").removeClass("layui-btn-disabled").removeAttr("disabled");
|
||||
//隐藏添加按钮,仅替换一张图片
|
||||
$("#modifyFile").hide();
|
||||
}
|
||||
});
|
||||
},
|
||||
done: function(res, index) {
|
||||
picture_arr.push(res.data);
|
||||
var image_box = $(".upload-wrap[index='" + index + "']").parent().find(".upload-image-curtain");
|
||||
var image_tips = $(".upload-wrap[index='" + index + "']").parent().find(".tips");
|
||||
image_box.text("50%");
|
||||
image_box.show();
|
||||
if (res.code >= 0) {
|
||||
setTimeout(function() {
|
||||
image_box.text("100%");
|
||||
}, 500);
|
||||
setTimeout(function() {
|
||||
getFileAlbumList(1, limit);
|
||||
layer.close(layer_one);
|
||||
}, 1000);
|
||||
return delete this.files[index]; //删除文件队列已经上传成功的文件
|
||||
} else {
|
||||
setTimeout(function() {
|
||||
image_box.text("上传失败");
|
||||
image_tips.text(res.message);
|
||||
layer.close(layer_one);
|
||||
}, 500);
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// 预览图片
|
||||
function previewFile(path, spec,data){
|
||||
let val = $(data).parent().parent().find('img').attr("data-isShow");
|
||||
if(val){
|
||||
layer.msg("图片无法进行预览!")
|
||||
return false;
|
||||
}
|
||||
spec = spec.split("*");
|
||||
layer.open({
|
||||
type:1,
|
||||
title: false,
|
||||
closeBtn: 0,
|
||||
shadeClose: true,
|
||||
area: [spec[0]+'px', spec[1]+'px'], //宽高
|
||||
content: "<img src=" + ns.img(path) + " />",
|
||||
skin: 'preview-img'
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化数据
|
||||
*/
|
||||
function init() {
|
||||
getFileAlbumList(1, limit); //图片加载
|
||||
}
|
||||
|
||||
/**
|
||||
* 多图上传
|
||||
*/
|
||||
function uploadImg() {
|
||||
var imageArray=1;
|
||||
laytpl($("#multuple_html").html()).render({}, function(html) {
|
||||
layer_one = layer.open({
|
||||
type: 1,
|
||||
area: ['580px', '430px'],
|
||||
title: '本地上传',
|
||||
content: html,
|
||||
cancel: function() {
|
||||
$("#chooseListAction").removeClass("bg-color").addClass("layui-btn-disabled").attr("disabled", "disabled");
|
||||
},
|
||||
success: function(res) {
|
||||
//上传图片
|
||||
upload.render({
|
||||
elem: '#ImgUpload',
|
||||
url: ns.url("giftcard://shop/media/upload"),
|
||||
data: {
|
||||
is_thumb:1,
|
||||
},
|
||||
multiple: true,
|
||||
auto: false,
|
||||
bindAction: '#chooseListAction',
|
||||
choose: function(obj) {
|
||||
imageArray=1;
|
||||
//将每次选择的文件追加到文件队列
|
||||
var files = this.files = obj.pushFile();
|
||||
//预读本地文件,如果是多文件,则会遍历。(不支持ie8/9)
|
||||
obj.preview(function(index, file, result) {
|
||||
this.num=index;
|
||||
//追加预览图片
|
||||
var html = '';
|
||||
html += '<li class="multuple-list-img upload-wrap" index="' + index + '">';
|
||||
html += '<img class="multuple-list-image" src="' + result + '" alt="' + file.name + '">';
|
||||
html += '<span class="upload-close-modal" id="upload_img_' + index + '">×</span>';
|
||||
html += '<div class="upload-image-curtain">50%</div>';
|
||||
html += '<div class="tips"></div>';
|
||||
html += '</li>';
|
||||
$(".multuple-list").prepend(html);
|
||||
//删除预览图片
|
||||
$("#upload_img_" + index).bind("click", function() {
|
||||
delete files[index];
|
||||
delete picture_arr[index]; //删除所选队列
|
||||
$(this).parent('.upload-wrap').remove();
|
||||
// uploadListIns.config.elem.next()[0].value = ''; //清空 input file 值,以免删除后出现同名文件不可选
|
||||
//禁止点击
|
||||
if ($(".multuple-list li").length <= 1) {
|
||||
$("#chooseListAction").removeClass("bg-color").addClass("layui-btn-disabled").attr("disabled", "disabled");
|
||||
}
|
||||
});
|
||||
//开启点击
|
||||
if ($(".multuple-list li").length > 1) {
|
||||
$("#chooseListAction").addClass("bg-color").removeClass("layui-btn-disabled").removeAttr("disabled");
|
||||
}
|
||||
|
||||
});
|
||||
},
|
||||
done: function(res,index) {
|
||||
let data=$('.multuple-list-image');
|
||||
// 禁止点击
|
||||
picture_arr.push(res.data);
|
||||
var image_box = $(".upload-wrap[index='" + index + "']").parent().find(".upload-image-curtain");
|
||||
var image_tips = $(".upload-wrap[index='" + index + "']").parent().find(".tips");
|
||||
image_box.text("上传汇总");
|
||||
image_box.text("50%");
|
||||
image_box.show();
|
||||
if (res.code >= 0) {
|
||||
setTimeout(function() {
|
||||
image_box.text("100%");
|
||||
}, 500);
|
||||
setTimeout(function() {
|
||||
getFileAlbumList(1, limit);
|
||||
layer.close(layer_one)
|
||||
}, 1000);
|
||||
return delete this.files[index]; //删除文件队列已经上传成功的文件
|
||||
} else {
|
||||
setTimeout(function() {
|
||||
image_box.text("上传失败");
|
||||
image_tips.text(res.message);
|
||||
layer.msg(res.message);
|
||||
}, 500);
|
||||
}
|
||||
if(imageArray==data.length){
|
||||
$("#chooseListAction").addClass("bg-color").removeClass("layui-btn-disabled").removeAttr("disabled");
|
||||
imageArray=1;
|
||||
return false
|
||||
}
|
||||
imageArray++
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
// 上传图片是禁止操作
|
||||
function submitOne(){
|
||||
$("#chooseListAction").removeClass("bg-color").addClass("layui-btn-disabled").attr("disabled","disabled");
|
||||
$(".upload-image-curtain").css('display','block').text('等待中')
|
||||
}
|
||||
|
||||
function deleteImg(data) {
|
||||
var flag_delete_img = false;
|
||||
var media_id = $(data).attr("data-id");
|
||||
if(!media_id){
|
||||
layer.msg("请选择图片再进行操作");
|
||||
return false;
|
||||
}
|
||||
var url = ns.url("giftcard://shop/media/delete");
|
||||
layer.confirm('删除图片会连本地存储或云存储的图片也删掉,请谨慎操作!', {
|
||||
btn: ['确定', '取消']
|
||||
}, function(index) {
|
||||
if (flag_delete_img) return;
|
||||
flag_delete_img = true;
|
||||
layer.close(index);
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
async: true,
|
||||
url,
|
||||
data: {
|
||||
media_id: media_id
|
||||
},
|
||||
dataType: "JSON",
|
||||
success: function(data) {
|
||||
flag_delete_img = false;
|
||||
layer.msg(data.message);
|
||||
if (data.code == 0) {
|
||||
getFileAlbumList(1, limit);
|
||||
layer.closeAll('page');
|
||||
}
|
||||
}
|
||||
});
|
||||
}, function() {
|
||||
layer.close();
|
||||
});
|
||||
}
|
||||
function onerrorFn(data){
|
||||
$(data).attr("data-isShow",true)
|
||||
}
|
||||
</script>
|
||||
213
addon/giftcard/shop/view/media/media.html
Executable file
213
addon/giftcard/shop/view/media/media.html
Executable file
@@ -0,0 +1,213 @@
|
||||
<link rel="stylesheet" type="text/css" href="GIFTCARD_CSS/media_manager.css" />
|
||||
<style>
|
||||
body{background-color: #fff;}
|
||||
.media-box .media-list-box{height: 380px;margin-right: 20px;display: flex;flex-direction: column;}
|
||||
.media-box .media-list-box .media-list {flex: 1;height: 0;overflow-y: scroll}
|
||||
.media-box .media-list-box .media-list::-webkit-scrollbar{display: none;}
|
||||
.media-box .media-img{max-height: 336px;}
|
||||
.media-box .media-img li{width: 185px;height: auto; margin: 0 7px 15px;}
|
||||
.media-box .media-img li div{height: 119.7px;line-height: 119.7px;background-size: cover;background-repeat: no-repeat;background-position: center;cursor: pointer;}
|
||||
.media-box .media-img li:nth-child(5n){margin-right: 0;}
|
||||
.layui-tab-content{padding: 0;height: 449px;}
|
||||
.layui-tab{margin: 5px 0 0;}
|
||||
.layui-tab .layui-tab-item{height: 449px;}
|
||||
.layui-laypage{margin: 10px 0 0;}
|
||||
.layui-tab-title {margin: 0 20px}
|
||||
#media {padding: 20px 20px 0;}
|
||||
.page {text-align: right}
|
||||
</style>
|
||||
|
||||
<div class="layui-tab layui-tab-brief media-tab select-media-wrap">
|
||||
<ul class="layui-tab-title layui-hide">
|
||||
<li class="layui-this">选择图片</li>
|
||||
</ul>
|
||||
<div class="layui-tab-content">
|
||||
<div id="media" class="layui-tab-item">
|
||||
<div class="media-box">
|
||||
<div class="media-content">
|
||||
<ul class="media-img"></ul>
|
||||
<div id="paged" class="page"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" name="media_ids" value="{$media_ids}" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 图片展示 -->
|
||||
<script type="text/html" id="mediaList">
|
||||
{{# layui.each(d.list,function(index,item){ }}
|
||||
<li data-media-id="{{item.media_id}}" data-json_data='{{JSON.stringify(item)}}' class="media-list-item">
|
||||
<div class="bg-color-gray" style="background-image:url({{ ns.img(item.media_path) }})">
|
||||
{{# if( getActiveArrayIndex(item.media_id) != "-1"){ }}
|
||||
<div class="image-box-active border-color"><i class="active-index">{{ getActiveArrayIndex(item.media_id) }}</i></div>
|
||||
{{# } }}
|
||||
</div>
|
||||
</li>
|
||||
{{# }) }}
|
||||
{{# if(d.list.length === 0){ }}
|
||||
<div class="empty-data">暂无数据</div>
|
||||
{{# } }}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var form, laytpl, laypage, upload,element,
|
||||
limit = 10,
|
||||
active_array = [],
|
||||
repeat_flag = false;
|
||||
layui.use(['form', 'laytpl', 'laypage', 'upload', 'element'], function() {
|
||||
form = layui.form;
|
||||
laytpl = layui.laytpl;
|
||||
laypage = layui.laypage;
|
||||
element = layui.element;
|
||||
upload = layui.upload;
|
||||
|
||||
form.render();
|
||||
//初始化数据
|
||||
init();
|
||||
|
||||
//监听搜索事件
|
||||
form.on('submit(search)', function() {
|
||||
mediaImgList(1, limit);
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* 素材图片加载
|
||||
* @param page
|
||||
* @param limit
|
||||
*/
|
||||
function mediaImgList(page, limit) {
|
||||
$.ajax({
|
||||
url: ns.url("giftcard://shop/media/media"),
|
||||
type: "POST",
|
||||
dataType: "JSON",
|
||||
async: false,
|
||||
data: {
|
||||
limit,
|
||||
page,
|
||||
media_name: $(".media-img-sreach").val(),
|
||||
app_module:ns_url.appModule,
|
||||
site_id:ns_url.siteId
|
||||
},
|
||||
success: function(res) {
|
||||
laytpl($("#mediaList").html()).render(res.data, function(data) {
|
||||
$(".media-img").html(data);
|
||||
});
|
||||
laypage.render({
|
||||
elem: 'paged',
|
||||
count: res.data.count,
|
||||
limit,
|
||||
curr: page,
|
||||
jump: function(obj, first) {
|
||||
if (!first) {
|
||||
mediaImgList(obj.curr, obj.limit);
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 选择个体
|
||||
*/
|
||||
function checkItem() {
|
||||
$("#media").unbind('click').on("click", ".media-list-item", function() {
|
||||
var json_data = $(this).data("json_data");
|
||||
json_data.id = parseInt(json_data.media_id);
|
||||
|
||||
if ($(this).find(".image-box-active").length > 0) {
|
||||
var active_index = getDeleteActiveArrayIndex(json_data.id);
|
||||
sortActiveArrayIndex(active_index);
|
||||
$(this).find(".image-box-active").remove();
|
||||
} else {
|
||||
json_data.index = active_array.length + 1;
|
||||
if (json_data.index > imgNum) {
|
||||
$(".media-box .media-img li").each((index,item) => {
|
||||
if(active_array.length > 0 && $(item).attr("data-media-id") == active_array[0].media_id) $(item).find(".image-box-active").remove();
|
||||
});
|
||||
var active_index = active_array.length > 0 ? getDeleteActiveArrayIndex(active_array[0].media_id) : 0;
|
||||
sortActiveArrayIndex(active_index);
|
||||
--json_data.index;
|
||||
}
|
||||
active_array.push(json_data);
|
||||
var active_html = '<div class="image-box-active border-color"><i class="active-index">' + active_array.length + '</i></div>';
|
||||
$(this).find("div").append(active_html);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//获取选择图片信息
|
||||
function selectGiftCardMediaListener(callback) {
|
||||
if (typeof callback != "function") return false;
|
||||
if($(".select-media-wrap .layui-tab-content .layui-tab-item").eq(0).hasClass("layui-show")){
|
||||
callback(active_array);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//获取选中
|
||||
function getActiveArrayIndex(id) {
|
||||
var delete_index = -1;
|
||||
$.each(active_array, function(i, item) {
|
||||
if (item.media_id == id) {
|
||||
delete_index = item.index;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
return delete_index;
|
||||
}
|
||||
|
||||
//删除选中
|
||||
function getDeleteActiveArrayIndex(id) {
|
||||
var delete_index;
|
||||
$.each(active_array, function(i, item) {
|
||||
if (item.id == id) {
|
||||
delete_index = item.index;
|
||||
active_array.splice(i, 1);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
return delete_index;
|
||||
}
|
||||
|
||||
//重新排序
|
||||
function sortActiveArrayIndex(index) {
|
||||
$.each(active_array, function(i, item) {
|
||||
var item_index = item.index;
|
||||
if (item_index > index) {
|
||||
active_array[i]["index"] = item_index - 1;
|
||||
if ($("#media").find(".media-list-item[data-media-id = '" + item["id"] + "']").length > 0) {
|
||||
$("#media").find(".media-list-item[data-media-id = '" + item["id"] + "']").find(".image-box-active i ").text(item["index"]);
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化数据
|
||||
*/
|
||||
function init() {
|
||||
mediaImgList(1, limit); //分组图像
|
||||
checkItem(); //选择个体
|
||||
$(".select-media-wrap .layui-tab-content .layui-tab-item").eq(0).addClass('layui-show').siblings().removeClass('layui-show');
|
||||
}
|
||||
|
||||
var search = window.location.search,
|
||||
imgNum = parseInt(getSearchString('imgNum', search));
|
||||
function getSearchString(key, Url) {
|
||||
var str = Url;
|
||||
str = str.substring(1, str.length); // 获取URL中?之后的字符(去掉第一位的问号)
|
||||
// 以&分隔字符串,获得类似name=xiaoli这样的元素数组
|
||||
var arr = str.split("&");
|
||||
var obj = new Object();
|
||||
// 将每一个数组元素以=分隔并赋给obj对象
|
||||
for (var i = 0; i < arr.length; i++) {
|
||||
var tmp_arr = arr[i].split("=");
|
||||
obj[decodeURIComponent(tmp_arr[0])] = decodeURIComponent(tmp_arr[1]);
|
||||
}
|
||||
return obj[key];
|
||||
}
|
||||
|
||||
</script>
|
||||
150
addon/giftcard/shop/view/order/detail.html
Executable file
150
addon/giftcard/shop/view/order/detail.html
Executable file
@@ -0,0 +1,150 @@
|
||||
<style>
|
||||
.layui-layout-admin .layui-body .body-content{background:none;padding:0;}
|
||||
.order-detail{padding: 15px;box-sizing: border-box;background: white;}
|
||||
.order-information{max-width:1500px;width:100%;min-height:40px;display: flex;}
|
||||
.order-information-bottom{margin-bottom: 38px;}
|
||||
.order-information-contentOne{width:400px;height:100%;padding-right: 48px;box-sizing: border-box;}
|
||||
.order-information-contentTwo{width:600px;height:100%;padding:0 80px;box-sizing: border-box}
|
||||
.order-information>div{border-left: 1px solid rgb(245,245,245);}
|
||||
.order-information>div:nth-child(1){border-left: none;}
|
||||
.contentOne-content{display: flex; font-size:14px;color:rgb(164,164,164);margin-bottom:14px;}
|
||||
.contentOne-content:after{overflow: hidden;display: block;content: "";height: 0;clear: both;}
|
||||
.contentOne-content-text{max-width:70%;min-width: 20%;color:#333333;margin-left:16px;float: left;display: -webkit-box;-webkit-line-clamp:2;overflow: hidden;text-overflow: ellipsis;-webkit-box-orient: vertical}
|
||||
.contentOne-content-title{min-width:85px;float: left;}
|
||||
.contentOne-content-text-die{line-height:24px;}
|
||||
.shop-information{width: 100%;background:white;padding:15px;box-sizing: border-box;margin-top:15px}
|
||||
.shop-information-table{width: 100%;padding:0 48px;box-sizing: border-box;margin-bottom:10px;}
|
||||
.shop-information-table>table{width: 100%;border: 1px solid rgb(238,238,238);}
|
||||
.table-trOne{height: 48px;background:rgb(245,245,245) ;}
|
||||
th{text-align: left;padding-left:28px;box-sizing: border-box;font-weight: 500;color:#333333;border-right:1px solid rgb(238,238,238);}
|
||||
th:last-child{border:none;}
|
||||
.table-trTow{width:100%;height:60px;border-top:1px solid rgb(238,238,238);}
|
||||
.table-trTow>td{text-align: left;padding-left:28px;box-sizing: border-box;font-weight: 500;color:#333333;border-right:1px solid rgb(238,238,238);}
|
||||
.table-trTow>td:nth-child(5){color:var(--base-color)}
|
||||
.to-detail{cursor: pointer;}
|
||||
</style>
|
||||
|
||||
<!-- 订单详情、订单状态 -->
|
||||
<div class="order-detail layui-card card-common card-brief">
|
||||
<div class="layui-card-header">
|
||||
<span class="card-title">订单详情</span>
|
||||
</div>
|
||||
<div class="order-information order-information-bottom layui-card-body">
|
||||
<div class="order-information-contentOne">
|
||||
<div class="contentOne-content">
|
||||
<div class="contentOne-content-title">交易流水号:</div>
|
||||
<div class="contentOne-content-text text-num">{$order_detail['out_trade_no']}</div>
|
||||
</div>
|
||||
<div class="contentOne-content">
|
||||
<div class="contentOne-content-title">订单编号:</div>
|
||||
<div class="contentOne-content-text text-num">{$order_detail['order_no']}</div>
|
||||
</div>
|
||||
<div class="contentOne-content">
|
||||
<div class="contentOne-content-title">订单来源:</div>
|
||||
<div class="contentOne-content-text">{$order_detail.order_from_name}</div>
|
||||
</div>
|
||||
<div class="contentOne-content">
|
||||
<div class="contentOne-content-title">订单状态:</div>
|
||||
<div class="contentOne-content-text">{$order_detail.order_status_name}</div>
|
||||
</div>
|
||||
<div class="contentOne-content">
|
||||
<div class="contentOne-content-title">购买人:</div>
|
||||
<div class="contentOne-content-text">{$order_detail.nickname}</div>
|
||||
</div>
|
||||
<div class="contentOne-content">
|
||||
<div class="contentOne-content-title">买家留言:</div>
|
||||
<div class="contentOne-content-text contentOne-content-text-die">
|
||||
{if $order_detail['buyer_message'] == ""}
|
||||
-
|
||||
{else/}
|
||||
{$order_detail['buyer_message']}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="order-information-contentTwo">
|
||||
<div class="contentOne-content">
|
||||
<div class="contentOne-content-title">礼品卡名称:</div>
|
||||
<div class="contentOne-content-text text-num">{$order_detail['order_name']}</div>
|
||||
</div>
|
||||
<div class="contentOne-content">
|
||||
<div class="contentOne-content-title">权益类型:</div>
|
||||
<div class="contentOne-content-text">{if $order_detail['card_right_type'] == 'goods'}礼品卡{else/}储值卡{/if}</div>
|
||||
</div>
|
||||
<div class="contentOne-content">
|
||||
<div class="contentOne-content-title">礼品卡数量:</div>
|
||||
<div class="contentOne-content-text">{$order_detail['num']}份</div>
|
||||
</div>
|
||||
<div class="contentOne-content">
|
||||
<div class="contentOne-content-title">卡内容:</div>
|
||||
<div class="contentOne-content-text">在使用时任选{$order_detail['card_right_goods_count']}件</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 商品信息 -->
|
||||
{if $order_detail['card_right_type'] == 'goods'}
|
||||
<div class="shop-information layui-card card-common card-brief">
|
||||
<div class="layui-card-header">
|
||||
<span class="card-title">商品信息</span>
|
||||
</div>
|
||||
<div class="shop-information-table layui-card-body">
|
||||
<table lay-filter="parse-table-order-product" lay-skin="line">
|
||||
<thead>
|
||||
<tr class="table-trOne">
|
||||
<th lay-data="{field:'product_name', width:200}">商品</th>
|
||||
<th lay-data="{field:'price'}">价格</th>
|
||||
{if $order_detail.card_right_goods_type != 'all'}
|
||||
<th lay-data="{field:'sale_num'}">数量</th>
|
||||
{/if}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach $order_detail['order_goods_list'] as $list_k => $order_goods_item}
|
||||
<tr class="table-trTow">
|
||||
<td>{$order_goods_item.sku_name}</td>
|
||||
<td>{$order_goods_item.price}</td>
|
||||
{if $order_detail.card_right_goods_type != 'all'}
|
||||
<td>{$order_goods_item.num}</td>
|
||||
{/if}
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- 卡密信息 -->
|
||||
<div class="shop-information layui-card card-common card-brief">
|
||||
<div class="layui-card-header">
|
||||
<span class="card-title">礼品卡信息</span>
|
||||
</div>
|
||||
<div class="shop-information-table layui-card-body">
|
||||
<table lay-filter="parse-table-order-product" lay-skin="line">
|
||||
<thead>
|
||||
<tr class="table-trOne">
|
||||
<th lay-data="{field:'product_name', width:200}">卡编号</th>
|
||||
<th lay-data="{field:'product_name', width:200}">权益类型</th>
|
||||
<th lay-data="{field:'sale_num'}">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach $card_list as $list_k => $card_item}
|
||||
<tr class="table-trTow">
|
||||
<td>{$card_item.card_no}</td>
|
||||
<td>{if $card_item.card_right_type == 'goods'}礼品卡{else/}储值卡{/if}</td>
|
||||
<td><span onclick="toDetail({$card_item.card_id})" class="text-color to-detail">查看详情</span></td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function toDetail(id){
|
||||
window.open(ns.href('giftcard://shop/card/detail',{'card_id': id}));
|
||||
}
|
||||
</script>
|
||||
326
addon/giftcard/shop/view/order/order.html
Executable file
326
addon/giftcard/shop/view/order/order.html
Executable file
@@ -0,0 +1,326 @@
|
||||
<link rel="stylesheet" href="GIFTCARD_CSS/order_list.css"/>
|
||||
<style>
|
||||
.layui-layout-admin .layui-form-item .layui-input-inline{background-color: #fff;}
|
||||
.layui-layout-admin .table-tab .layui-tab-title{margin-bottom: 15px;}
|
||||
</style>
|
||||
|
||||
<!-- 搜索框 -->
|
||||
<div class="screen layui-collapse" lay-filter="selection_panel">
|
||||
<div class="layui-colla-item">
|
||||
<form class="layui-colla-content layui-form layui-show">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">订单号</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="order_no" placeholder="请输入订单号" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">购买人昵称</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="nickname" placeholder="购买人昵称" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">支付时间</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" class="layui-input" name="start_time" placeholder="开始时间" id="start_time" readonly>
|
||||
<i class=" iconrili iconfont calendar"></i>
|
||||
</div>
|
||||
<div class="layui-form-mid">-</div>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" class="layui-input" name="end_time" placeholder="结束时间" id="end_time" readonly>
|
||||
<i class=" iconrili iconfont calendar"></i>
|
||||
</div>
|
||||
<button class="layui-btn layui-btn-primary date-picker-btn date-picker-btn-seven" onclick="datePick(7, this);return false;">近7天</button>
|
||||
<button class="layui-btn layui-btn-primary date-picker-btn date-picker-btn-thirty" onclick="datePick(30, this);return false;">近30天</button>
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" name="giftcard_id" value="{$giftcard_id}">
|
||||
<div class="form-row">
|
||||
<button type="button" class="layui-btn" lay-filter="search" lay-submit>筛选</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="layui-tab table-tab" lay-filter="order_tab">
|
||||
<ul class="layui-tab-title">
|
||||
<li class="layui-this" lay-id="">全部</li>
|
||||
<li lay-id="balance">储值卡</li>
|
||||
<li lay-id="goods">礼品卡</li>
|
||||
</ul>
|
||||
|
||||
<div class="layui-tab-content">
|
||||
<div id="order_list"></div>
|
||||
</div>
|
||||
<div id="order_page"></div>
|
||||
</div>
|
||||
<script src="GIFTCARD_JS/order_list.js"></script>
|
||||
<script>
|
||||
var form,laypage,element,laydate;
|
||||
var is_refresh = false;
|
||||
var order_type_status_json = {'balance': '储值卡', 'goods': '礼品卡'};
|
||||
|
||||
layui.use(['laypage','laydate','form', 'element'], function(){
|
||||
form = layui.form;
|
||||
laypage = layui.laypage;
|
||||
element = layui.element;
|
||||
laydate = layui.laydate;
|
||||
form.render();
|
||||
|
||||
// 支付时间
|
||||
laydate.render({
|
||||
elem: '#start_time'
|
||||
,type: 'datetime'
|
||||
,change: function(value, date, endDate){
|
||||
$(".date-picker-btn").removeClass("selected");
|
||||
}
|
||||
});
|
||||
laydate.render({
|
||||
elem: '#end_time'
|
||||
,type: 'datetime'
|
||||
,change: function(value, date, endDate){
|
||||
$(".date-picker-btn").removeClass("selected");
|
||||
}
|
||||
});
|
||||
|
||||
//监听Tab切换,以改变地址hash值
|
||||
element.on('tab(order_tab)', function(){
|
||||
$(".all-selected-checkbox input").prop("checked",false);
|
||||
var card_right_type = this.getAttribute('lay-id');
|
||||
|
||||
var hash_data = getHashList();
|
||||
hash_data.card_right_type = card_right_type;
|
||||
hash_data.page = 1;
|
||||
setHashOrderList(hash_data);
|
||||
});
|
||||
//监听筛选事件
|
||||
form.on('submit(search)', function(data){
|
||||
is_refresh = true;
|
||||
data.field.page = 1;
|
||||
resetOrderStatus(data.field.order_type, 2);
|
||||
setHashOrderList(data.field);
|
||||
setOrderStatusTab(data.field.order_status);
|
||||
return false;
|
||||
});
|
||||
|
||||
getHashData();
|
||||
getOrderList();//筛选
|
||||
});
|
||||
|
||||
var order = new Order();
|
||||
function getOrderList(){
|
||||
var url = ns.url("giftcard://shop/order/order", getHashArr().join('&'));
|
||||
|
||||
$.ajax({
|
||||
type : 'get',
|
||||
dataType: 'json',
|
||||
url :url,
|
||||
success : function(res){
|
||||
if(res.code == 0){
|
||||
order.setData(res.data);
|
||||
$("#order_list").html(order.fetch());
|
||||
form.render();
|
||||
|
||||
laypage_util = new Page({
|
||||
elem: 'order_page',
|
||||
count: res.data.count,
|
||||
curr: getHashPage(),
|
||||
limit:getHashData()['page_size'] || 10,
|
||||
callback: function(obj){
|
||||
var hash_data = getHashData();
|
||||
hash_data.page = obj.curr;
|
||||
hash_data.page_size = obj.limit;
|
||||
setHashOrderList(hash_data);
|
||||
}
|
||||
});
|
||||
|
||||
}else{
|
||||
layer.msg(res.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 通过hash获取页数
|
||||
function getHashPage(){
|
||||
var page = 1;
|
||||
var startTime = '';
|
||||
var endTime = '';
|
||||
var hash_arr = getHashArr();
|
||||
$.each(hash_arr,function(index, itemobj){
|
||||
var item_arr = itemobj.split("=");
|
||||
if(item_arr.length == 2){
|
||||
switch(item_arr[0]){
|
||||
case "page":
|
||||
page = item_arr[1];
|
||||
break;
|
||||
case "start_time":
|
||||
startTime = ns.date_to_time(item_arr[1].split("%")[0]);
|
||||
break;
|
||||
case "end_time":
|
||||
endTime = ns.date_to_time(item_arr[1].split("%")[0]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var _time = (endTime - startTime) / (24 * 60 * 60);
|
||||
if (_time == 6) {
|
||||
$(".date-picker-btn-seven").addClass("selected");
|
||||
$(".date-picker-btn-thirty").removeClass("selected");
|
||||
} else if (_time == 29) {
|
||||
$(".date-picker-btn-thirty").addClass("selected");
|
||||
$(".date-picker-btn-seven").removeClass("selected");
|
||||
} else {
|
||||
$(".date-picker-btn-seven").removeClass("selected");
|
||||
$(".date-picker-btn-thirty").removeClass("selected");
|
||||
}
|
||||
return page;
|
||||
}
|
||||
|
||||
//从hash中获取数据
|
||||
function getHashData(){
|
||||
var hash_arr = getHashArr();
|
||||
var form_json = {
|
||||
"start_time" : "",
|
||||
"end_time" : "",
|
||||
"nickname" : "",
|
||||
"order_no" : "",
|
||||
"card_right_type" : "",
|
||||
'page_size':'',
|
||||
"page" : ""
|
||||
};
|
||||
if(hash_arr.length > 0){
|
||||
$.each(hash_arr,function(index, itemobj){
|
||||
var item_arr = itemobj.split("=");
|
||||
if(item_arr.length == 2){
|
||||
$.each(form_json,function(key, form_val){
|
||||
if(item_arr[0] == key){
|
||||
form_json[key] = item_arr[1];
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
resetOrderStatus(form_json.card_right_type, 2);
|
||||
setOrderStatusTab(form_json.card_right_type);
|
||||
return form_json;
|
||||
}
|
||||
function getHashList(){
|
||||
var hash_arr = getHashArr();
|
||||
var form_json = {
|
||||
"start_time" : "",
|
||||
"end_time" : "",
|
||||
"nickname" : "",
|
||||
"order_no" : "",
|
||||
"card_right_type" : "",
|
||||
'page_size':'',
|
||||
"page" : ""
|
||||
};
|
||||
if(hash_arr.length > 0){
|
||||
$.each(hash_arr,function(index, itemobj){
|
||||
var item_arr = itemobj.split("=");
|
||||
if(item_arr.length == 2){
|
||||
$.each(form_json,function(key, form_val){
|
||||
if(item_arr[0].indexOf(key) != "-1"){
|
||||
form_json[key] = item_arr[1];
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return form_json;
|
||||
}
|
||||
|
||||
function setOrderStatusTab(order_status){
|
||||
$(".layui-tab-title li").removeClass("layui-this");
|
||||
$(".layui-tab-title li").each(function(){
|
||||
var status = $(this).attr("lay-id");
|
||||
if(status == order_status){
|
||||
$(this).addClass("layui-this")
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//重置状态tab 选项卡
|
||||
function resetOrderStatus(order_type, is_tab){
|
||||
var hash_order_type = getHashOrderType();
|
||||
if(hash_order_type != order_type || is_refresh == false){
|
||||
if(is_tab != 1 || is_refresh == false) {
|
||||
$(".layui-tab-title li").not(':first').remove();
|
||||
$(".layui-tab-title li:first").addClass("layui-this");
|
||||
}
|
||||
$.each(order_type_status_json,function(index, itemobj){
|
||||
if(is_tab != 1 || is_refresh == false) {
|
||||
$(".layui-tab-title").append('<li lay-id="' + index + '">' + itemobj + '</li>');
|
||||
}
|
||||
});
|
||||
form.render('select');
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 获取哈希值order_type
|
||||
*/
|
||||
function getHashOrderType(){
|
||||
var hash_arr = getHashArr();
|
||||
var card_right_type = "";
|
||||
if(hash_arr.length > 0){
|
||||
$.each(hash_arr,function(index, itemobj){
|
||||
var item_arr = itemobj.split("=");
|
||||
if(item_arr.length == 2){
|
||||
if(item_arr[0].indexOf("card_right_type") != "-1") {
|
||||
card_right_type = item_arr[1];
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
return card_right_type;
|
||||
}
|
||||
|
||||
function setHashOrderList(data){
|
||||
localStorage.setItem('formSubmit','search'); // 表单搜索标识,防止页面重新加载
|
||||
var hash = ['url=giftcard://shop/order/order'];
|
||||
for (let key in data) {
|
||||
if (data[key] != '' && data[key] != 'all') {
|
||||
hash.push(`${key}=${data[key]}`)
|
||||
}
|
||||
}
|
||||
location.hash = hash.join('&');
|
||||
getOrderList();
|
||||
}
|
||||
/**
|
||||
* 七天时间
|
||||
*/
|
||||
function datePick(date_num,event_obj){
|
||||
$(".date-picker-btn").removeClass("selected");
|
||||
$(event_obj).addClass('selected');
|
||||
Date.prototype.Format = function (fmt,date_num) { //author: meizz
|
||||
this.setDate(this.getDate()-date_num);
|
||||
var o = {
|
||||
"M+": this.getMonth() + 1, //月份
|
||||
"d+": this.getDate(), //日
|
||||
"H+": this.getHours(), //小时
|
||||
"m+": this.getMinutes(), //分
|
||||
"s+": this.getSeconds(), //秒
|
||||
"q+": Math.floor((this.getMonth() + 3) / 3), //季度
|
||||
"S": this.getMilliseconds() //毫秒
|
||||
};
|
||||
if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
|
||||
for (var k in o)
|
||||
if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
|
||||
return fmt;
|
||||
};
|
||||
var now_time = new Date().Format("yyyy-MM-dd 23:59:59",0);//当前日期
|
||||
var before_time = new Date().Format("yyyy-MM-dd 00:00:00",date_num-1);//前几天日期
|
||||
$("input[name=start_time]").val(before_time,0);
|
||||
$("input[name=end_time]").val(now_time,date_num-1);
|
||||
}
|
||||
</script>
|
||||
230
addon/giftcard/shop/view/public/css/media_manager.css
Executable file
230
addon/giftcard/shop/view/public/css/media_manager.css
Executable file
@@ -0,0 +1,230 @@
|
||||
#media {
|
||||
padding: 10px 20px;
|
||||
}
|
||||
|
||||
.media-box {
|
||||
display: flex;
|
||||
}
|
||||
.media-list-box::-webkit-scrollbar {
|
||||
display: none; /* Chrome Safari */
|
||||
}
|
||||
|
||||
.media-list-box {
|
||||
scrollbar-width: none; /* firefox */
|
||||
-ms-overflow-style: none; /* IE 10+ */
|
||||
overflow: auto;
|
||||
margin-right: 25px;
|
||||
width: 180px;
|
||||
height: 385px;
|
||||
position: relative;
|
||||
}
|
||||
.media-list-box ul .layui-nav-bar{
|
||||
display: none;
|
||||
}
|
||||
|
||||
.media-list-box button {
|
||||
position: absolute;
|
||||
left: 40px;
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
.media-list {
|
||||
width: 180px;
|
||||
background-color: #F7F7F7;
|
||||
}
|
||||
|
||||
.media-list li a{
|
||||
color: #333!important;
|
||||
}
|
||||
.media-list li a .num{position: absolute;right: 15px}
|
||||
.media-list li a .layui-nav-more{border-color: #333 transparent transparent}
|
||||
.media-list li.layui-nav-itemed a .layui-nav-more{border-color: transparent transparent #333!important;}
|
||||
.media-list li a:hover{background-color: #F7F7F7!important;}
|
||||
.media-list li a.layui-this{background-color: #E8E8E8!important;color: var(--base-color)!important;}
|
||||
.media-list li dl.layui-nav-child{background-color: #E8E8E8!important;}
|
||||
.media-list li dl.layui-nav-child a{padding-left: 20px}
|
||||
.media-list li.active {
|
||||
color: var(--base-color)!important;
|
||||
}
|
||||
|
||||
.media-content {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.media-img {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.media-img li {
|
||||
width: 125px;
|
||||
height: 155px;
|
||||
margin: 0 15px 15px 0;
|
||||
}
|
||||
|
||||
.media-img li div {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 125px;
|
||||
line-height: 125px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.media-img li div .image-box-active {
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border: 2px solid;
|
||||
}
|
||||
|
||||
.media-img li div .image-box-active:after {
|
||||
content: '';
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
right: 0;
|
||||
border: 15px solid;
|
||||
border-color: transparent;
|
||||
border-top-color: var(--base-color);
|
||||
border-right-color: var(--base-color);
|
||||
}
|
||||
|
||||
.media-img li div .image-box-active i {
|
||||
position: absolute;
|
||||
top: 2px;
|
||||
right: 2px;
|
||||
color: #fff;
|
||||
z-index: 2;
|
||||
font-style: normal;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.media-img li img {
|
||||
max-height: 100%;
|
||||
max-width: 100%;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.media-img li video {
|
||||
max-height: 100%;
|
||||
max-width: 100%;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.media-img li span {
|
||||
display: block;
|
||||
margin-top: 10px;
|
||||
height: 20px;
|
||||
line-height: 20px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.empty-data {
|
||||
margin-top: 10px;
|
||||
width: 100%;
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* 本地图片上传*/
|
||||
.multuple-list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
overflow-y: auto;
|
||||
height: 300px;
|
||||
padding-top: 10px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.multuple-list-img {
|
||||
border-color: #DDDDDD!important;
|
||||
}
|
||||
|
||||
.multuple-list li {
|
||||
position: relative;
|
||||
display: flex;
|
||||
margin-bottom: 10px;
|
||||
margin-right: 10px;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
width: 120px;
|
||||
height: 120px;
|
||||
border: 1px solid;
|
||||
}
|
||||
|
||||
.multuple-list li img {
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
}
|
||||
.multuple-list li video {
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
}
|
||||
|
||||
.upload-close-modal {
|
||||
display: none;
|
||||
position: absolute;
|
||||
top: -10px;
|
||||
right: -10px;
|
||||
height: 20px;
|
||||
width: 20px;
|
||||
font-size: 18px;
|
||||
line-height: 20px;
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
background-color: rgba(0, 0, 0, .5);
|
||||
border-radius: 50%;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.upload-image-curtain {
|
||||
display: none;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
text-align: center;
|
||||
line-height: 122px;
|
||||
font-size: 18px;
|
||||
color: #fff;
|
||||
background-color: rgba(0, 0, 0, .5);
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.multuple-list li:hover .upload-close-modal {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.multuple-list li span {
|
||||
cursor: pointer;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.multuple-list li span:first-of-type {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
font-size: 18px;
|
||||
margin-bottom: 10px;
|
||||
line-height: 30px;
|
||||
border-radius: 50%;
|
||||
color: #fff;
|
||||
}
|
||||
.media-list .layui-tree-iconArrow:after{top: 5px}
|
||||
.media-list .layui-tree-spread .layui-tree-iconArrow:after{transform: rotate(90deg);top: 8px;left: 0;}
|
||||
.media-list .layui-tree .layui-tree-entry {padding: 0;line-height: 1;height: auto;}
|
||||
.media-list .layui-tree .layui-tree-main {width: 100%;box-sizing: border-box;display: flex;align-items: center;}
|
||||
.media-list .layui-tree .layui-tree-main .layui-tree-txt{width: 100%;display: flex;justify-content: space-between;padding: 12px 10px 12px 0;}
|
||||
79
addon/giftcard/shop/view/public/css/order_list.css
Executable file
79
addon/giftcard/shop/view/public/css/order_list.css
Executable file
@@ -0,0 +1,79 @@
|
||||
.layui-table {margin-top: 15px;}
|
||||
.layui-table thead tr {background-color: #F8F6F9;}
|
||||
.layui-table th {border-width: 0; font-size: 14px!important;}
|
||||
.layui-table td {padding: 8px 15px;}
|
||||
.layui-table .header-row {border-top: 1px solid #e6e6e6;background: #f7f7f7;}
|
||||
.layui-table .header-row:hover{background: #f7f7f7 !important;}
|
||||
.separation-row hr {margin: 0;}
|
||||
|
||||
/* .layui-layout-admin .layui-body{min-width:1100px} */
|
||||
/*.date-picker-btn.selected{background-color:#0d73f9;color:#fff}*/
|
||||
.layui-table td,.layui-table th,.layui-table-fixed-r,.layui-table-header,.layui-table-page,.layui-table-tips-main,.layui-table-tool,.layui-table-view,.layui-table[lay-skin=line],.layui-table[lay-skin=row]{border-color:#f1f1f1 !important;}
|
||||
.layui-table thead th{border-bottom:none;padding-left:0;padding-right:0;}
|
||||
.order-list-table .separation-row td{padding:10px 20px;border: 0;}
|
||||
.order-list-table .separation-row:hover{background-color: #fff;}
|
||||
.order-list-table .remark-row{background: #FFF9DF!important;color: #D09B4C;}
|
||||
.order-list-table .remark-row:hover{background: #FFF9DF!important}
|
||||
.order-list-table .header-row td{padding: 8px 15px!important;}
|
||||
.order-list-table .header-row td:nth-child(1){border-right: 0;}
|
||||
.order-list-table .header-row td:nth-child(2){text-align:center;border-left: 0;}
|
||||
.order-list-table .header-row span{vertical-align:middle}
|
||||
.order-list-table .header-row td .order-item-header{text-align:left;color:#333;}
|
||||
.order-list-table .header-row td .order-item-header.more{cursor: pointer;overflow: hidden;position: relative;}
|
||||
.order-list-table .header-row td .more-operation{display: none;font-size: 14px;line-height: 20px;background-color: #fff;border-radius: 2px;box-shadow: 0 2px 8px 0 rgba(200,201,204,.5);position: absolute;z-index: 2000;padding: 10px;top: 28px;transform: translateX(10px);left: -12px;width: 200px;}
|
||||
.order-list-table .header-row td .more-operation:before{left: 8px;top: -14px;border: solid transparent;content: "";height: 0;width: 0;position: absolute;pointer-events: none;border-color: transparent;border-bottom-color: #fff;border-width: 8px;}
|
||||
.order-list-table .header-row td .more-operation span{color:#333;}
|
||||
|
||||
.order-list-table .checkbox-all .layui-table-cell{padding:0;text-align:center;}
|
||||
.order-list-table .product-info .layui-table-cell{padding:0 5px}
|
||||
.order-list-table .content-row:hover{background-color:#fff !important;}
|
||||
.order-list-table .content-row .product-info{border-right: 0;}
|
||||
.order-list-table .content-row .product-info .img-block{width:60px;height:60px;float:left;border:1px solid #e2e2e2;display: flex;align-items: center;justify-content: center;}
|
||||
.order-list-table .content-row .product-info .img-block>img{max-width:100%;max-height:100%;}
|
||||
.order-list-table .content-row .product-info .info{margin-left:70px}
|
||||
.order-list-table .content-row .product-info .info p{color:#8e8c8c;font-size:12px}
|
||||
.order-list-table .content-row .order-price{border-left: 0;}
|
||||
.order-list-table .content-row .product-list{border-right-width:1px}
|
||||
.order-list-table .content-row .product-list p{font-size:12px}
|
||||
.order-list-table .content-row .transaction-status{line-height: 24px;}
|
||||
.order-list-table .content-row .buyers{line-height: 24px;}
|
||||
.order-list-table .operation a{font-size: 14px;}
|
||||
.order-list-table .text-tile{color:rgb(164,164,164);}
|
||||
.order-no-data-block ul{width:200px;margin:20px auto; padding-bottom: 20px;}
|
||||
.order-no-data-block ul li{text-align:center;color:#c2c2c2}
|
||||
.order-no-data-block ul li:first-child{height:70px;line-height:70px}
|
||||
.order-no-data-block ul li:first-child i{font-size:35px}
|
||||
.footer-row{border:1px solid #f2f2f2}
|
||||
.screen{margin-top: 0;}
|
||||
|
||||
/*.order-money span {color: red;}*/
|
||||
#order_page {text-align: right;}
|
||||
.bottom-row{color:#e0a723;background: #fffbec;}
|
||||
.bottom-row:hover{background: #fffbec!important;}
|
||||
|
||||
.table-tab .layui-tab-content {padding-top: 0;}
|
||||
.line-hiding{ cursor : default; -webkit-line-clamp: 2 !important;}
|
||||
.address_box{width:87%; display: inline-block}
|
||||
.address_input{width: 1px;height: 0px;overflow: hidden;border: 0px}
|
||||
.screen .layui-colla-title .layui-colla-icon{color:var(--base-color) !important}
|
||||
.screen .layui-colla-title .text-color{position: absolute;right: 45px;font-size: 14px;padding: 5px;}
|
||||
.operation .operation-type{display: block;}
|
||||
.operation .operation-type .layui-btn{display: inline;text-align: left;line-height: 23px;padding: 0px;margin: 0px;padding-left:8px;}
|
||||
.layui-colla-title .put-open{position: absolute;right: 40px;padding: 5px;color: var(--base-color) ;}
|
||||
.content-row .order-price {
|
||||
border-left: 0;
|
||||
}
|
||||
.content-row .card-info {
|
||||
border-right: 0;
|
||||
}
|
||||
/*订单顶部的一行*/
|
||||
.order-list-top-line{justify-content:flex-end;}
|
||||
.order-list-top-line a{padding-right: 0px !important;}
|
||||
|
||||
.order-list-table .order-goods{align-items: flex-start !important;}
|
||||
.order-list-table .order-goods .info{margin-top: 3px;}
|
||||
.order-list-table .order-goods , .order-list-table .order-goods-item{display: flex;align-items: center;}
|
||||
.order-list-table .order-goods .img-block{margin-right: 10px;width: 60px;height: 60px;flex-shrink: 0;border: 1px solid #e2e2e2;display: flex;align-items: center;justify-content: center;}
|
||||
.order-list-table .order-goods .img-block{width: 105px;height: 63px;}
|
||||
.order-list-table .order-goods .img-block img{max-width: 100%;max-height: 100%;}
|
||||
.order-list-table .order-goods-item{margin-top: 10px;}
|
||||
1
addon/giftcard/shop/view/public/csv/card_import.csv
Executable file
1
addon/giftcard/shop/view/public/csv/card_import.csv
Executable file
@@ -0,0 +1 @@
|
||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<EFBFBD><EFBFBD>Կ
|
||||
|
BIN
addon/giftcard/shop/view/public/img/distribution.png
Executable file
BIN
addon/giftcard/shop/view/public/img/distribution.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
BIN
addon/giftcard/shop/view/public/img/distribution_new.png
Executable file
BIN
addon/giftcard/shop/view/public/img/distribution_new.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 390 B |
BIN
addon/giftcard/shop/view/public/img/distribution_new1.png
Executable file
BIN
addon/giftcard/shop/view/public/img/distribution_new1.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
BIN
addon/giftcard/shop/view/public/img/distribution_select.png
Executable file
BIN
addon/giftcard/shop/view/public/img/distribution_select.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
34
addon/giftcard/shop/view/public/js/media.js
Executable file
34
addon/giftcard/shop/view/public/js/media.js
Executable file
@@ -0,0 +1,34 @@
|
||||
// 素材
|
||||
function openMedia(callback, imgNum) {
|
||||
layui.use(['layer'], function () {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '素材管理',
|
||||
area: ['1050px', '600px'],
|
||||
fixed: false, //不固定
|
||||
btn: ['保存', '返回'],
|
||||
content: ns.url("giftcard://shop/media/media", {
|
||||
request_mode: 'iframe',
|
||||
mediaIds: mediaIds.toString(),
|
||||
imgNum: imgNum
|
||||
}),
|
||||
yes: function (index, layero) {
|
||||
var iframeWin = document.getElementById(layero.find('iframe')[0]['name']).contentWindow;//得到iframe页的窗口对象,执行iframe页的方法:
|
||||
iframeWin.selectGiftCardMediaListener(function (obj) {
|
||||
if (typeof callback == "string") {
|
||||
try {
|
||||
eval(callback + '(obj)');
|
||||
layer.close(index);
|
||||
} catch (e) {
|
||||
console.error('回调函数' + callback + '未定义');
|
||||
}
|
||||
} else if (typeof callback == "function") {
|
||||
callback(obj);
|
||||
layer.close(index);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
265
addon/giftcard/shop/view/public/js/order_list.js
Executable file
265
addon/giftcard/shop/view/public/js/order_list.js
Executable file
@@ -0,0 +1,265 @@
|
||||
/**
|
||||
* 渲染订单列表
|
||||
*/
|
||||
Order = function () {};
|
||||
|
||||
/**
|
||||
* 设置数据集
|
||||
*/
|
||||
Order.prototype.setData = function (data) {
|
||||
Order.prototype.data = data;
|
||||
};
|
||||
|
||||
/**
|
||||
* 列名数据
|
||||
*/
|
||||
Order.prototype.cols = [
|
||||
{
|
||||
type: 'checkbox',
|
||||
fixed: 'left',
|
||||
width: '3%',
|
||||
merge: true,
|
||||
template: function (orderitem, order) {
|
||||
var json = {};
|
||||
json.order_id = order.order_id;
|
||||
json.order_no = order.order_no;
|
||||
json.giftcard_id = order.giftcard_id;
|
||||
// if(order.order_type == 4 && order.order_data_status == 3){
|
||||
// var h = '<div class="sub-selected-checkbox" data-json='+ JSON.stringify(json) +' data-id='+ order.order_id +' disabled>';
|
||||
// h += '<input type="checkbox" lay-skin="primary" lay-filter="subCheckbox" name="" disabled>';
|
||||
// h += '</div>';
|
||||
// }else{
|
||||
var h = '<div class="sub-selected-checkbox" data-json='+ JSON.stringify(json) +' data-id='+ order.order_id +' >';
|
||||
h += '<input type="checkbox" lay-skin="primary" lay-filter="subCheckbox" name="" >';
|
||||
h += '</div>';
|
||||
// }
|
||||
return h;
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '<span>礼品卡</span>',
|
||||
width: "30%",
|
||||
className: "card-info",
|
||||
template: function (orderitem, order) {
|
||||
var h = '';
|
||||
h += '<div class="order-goods">';
|
||||
h += '<div class="img-block">';
|
||||
h += '<img layer-src="' + ns.img(orderitem.card_cover.split(",")[0]) + '" src="' + ns.img(orderitem.card_cover.split(",")[0]) + '">';
|
||||
h += '</div>';
|
||||
h += '<div class="info">';
|
||||
h += '<a href="' + ns.href("giftcard://shop/order/detail", {order_id: orderitem.order_id}) + '" target="_blank" title="' + orderitem.order_name + '" class="multi-line-hiding text-color-sub">' + orderitem.order_name + '</a>';
|
||||
h += '</div>';
|
||||
h += '</div>';
|
||||
|
||||
return h;
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "数量",
|
||||
width: "8%",
|
||||
align: "right",
|
||||
className: "order-price",
|
||||
template: function (orderitem, order) {
|
||||
var h = '<div style="text-align: center;">';
|
||||
h += '<span>' + orderitem.card_price + '</span><br>';
|
||||
h += '<span>' + orderitem.num + '件</span>';
|
||||
h += '</div>';
|
||||
return h;
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "权益类型",
|
||||
width: "10%",
|
||||
align: "right",
|
||||
className: "card-right-type",
|
||||
template: function (orderitem, order) {
|
||||
var h = '<div style="padding-right: 15px;">';
|
||||
h += '<span>' + (orderitem.card_right_type=='goods' ? '礼品卡' : '储值卡') + '</span>';
|
||||
h += '</div>';
|
||||
return h;
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "实付金额(元)",
|
||||
width: "8%",
|
||||
align: "right",
|
||||
className: "order-money",
|
||||
merge: true,
|
||||
template: function (orderitem, order) {
|
||||
var h = '<div style="padding-right: 15px;">';
|
||||
h += '<span>' + orderitem.pay_money + '</span>';
|
||||
h += '</div>';
|
||||
return h;
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "买家",
|
||||
width: "14%",
|
||||
align: "left",
|
||||
className: "goods-num",
|
||||
template: function (orderitem, order) {
|
||||
var h = '<div style="text-align: left;">';
|
||||
h += '<a href="' + ns.href("shop/member/editmember", {member_id: orderitem.member_id}) + '" target="_blank" class="multi-line-hiding text-color-sub text-color">' +orderitem.nickname + '</a>';
|
||||
h += '<span>' + orderitem.mobile + '</span>';
|
||||
h += '</div>';
|
||||
return h;
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "订单状态",
|
||||
width: "10%",
|
||||
align: "center",
|
||||
className: "transaction-status",
|
||||
merge: true,
|
||||
template: function (orderitem, order) {
|
||||
var html = '<div>' + order.order_status_name + '</div>';
|
||||
return html;
|
||||
}
|
||||
},
|
||||
{
|
||||
title : "支付时间",
|
||||
width : "15%",
|
||||
align : "center",
|
||||
className : "create-time",
|
||||
merge : true,
|
||||
template : function(orderitem,order){
|
||||
return '<div>' + ns.time_to_date(order.pay_time) + '</div>';
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "操作",
|
||||
align: "right",
|
||||
className: "operation",
|
||||
width:"11%",
|
||||
merge: true,
|
||||
template: function (orderitem, order) {
|
||||
var html='';
|
||||
html += '<div>';
|
||||
html += '<a class="layui-btn text-color" href="'+ns.href("giftcard://shop/order/detail", {order_id: orderitem.order_id}) +'">详情</a>';
|
||||
html += '</div>';
|
||||
return html;
|
||||
}
|
||||
}
|
||||
];
|
||||
/**
|
||||
* 渲染表头
|
||||
*/
|
||||
Order.prototype.header = function (hasThead) {
|
||||
var colgroup = '<colgroup>';
|
||||
var thead = '';
|
||||
if (hasThead) thead = '<thead><tr>';
|
||||
|
||||
for (var i = 0; i < this.cols.length; i++) {
|
||||
var align = this.cols[i].align ? "text-align:" + this.cols[i].align : "";
|
||||
|
||||
colgroup += '<col width="' + this.cols[i].width + '">';
|
||||
if (hasThead) {
|
||||
thead += '<th style="' + align + '" class="' + (this.cols[i].className || "") + '">';
|
||||
thead += '<div class="layui-table-cell">';
|
||||
if(this.cols[i].type){
|
||||
thead += '<div class="all-selected-checkbox">';
|
||||
thead += '<input type="checkbox" lay-skin="primary" lay-filter="allCheckbox" name="">';
|
||||
thead += '</div>';
|
||||
}else{
|
||||
thead += this.cols[i].title;
|
||||
}
|
||||
thead += '</div>';
|
||||
thead += '</th>';
|
||||
}
|
||||
}
|
||||
colgroup += '</colgroup>';
|
||||
if (hasThead) thead += '</tr></thead>';
|
||||
return colgroup + thead;
|
||||
};
|
||||
|
||||
/**
|
||||
* 渲染内容
|
||||
*/
|
||||
Order.prototype.tbody = function () {
|
||||
|
||||
var tbody = '<tbody>';
|
||||
for (var i = 0; i < this.data.list.length; i++) {
|
||||
|
||||
var order = this.data.list[i];
|
||||
if (i > 0) {
|
||||
//分割行
|
||||
tbody += '<tr class="separation-row">';
|
||||
tbody += '<td colspan="' + this.cols.length + '"></td>';
|
||||
tbody += '</tr>';
|
||||
}
|
||||
|
||||
//订单项头部
|
||||
tbody += '<tr class="header-row">';
|
||||
tbody += '<td colspan="9">';
|
||||
tbody += '<span class="order-item-header" style="margin-right:10px;">订单号:' + order.order_no + '</span>';
|
||||
tbody += '<span class="order-item-header text-color more" style="margin-right:50px;" onclick="showMore(' + order.order_id + ')">更多';
|
||||
tbody += '<div class="more-operation" data-order-id="' + order.order_id + '">';
|
||||
tbody += '<span>支付流水号:' + order.out_trade_no + '</span>';
|
||||
tbody += '</div></span>';
|
||||
|
||||
tbody += '<span class="order-item-header" style="margin-right:50px;">下单时间:' + ns.time_to_date(order.create_time) + '</span>';
|
||||
|
||||
tbody += '<span class="order-item-header" style="margin-right:50px;">订单来源:'+ order.order_from_name + (order.is_video_number ? '(视频号)' : '') +'</span>';
|
||||
|
||||
tbody += '<span class="order-item-header" style="margin-right:50px;">支付方式:'+ order.pay_type_name +'</span>';
|
||||
|
||||
tbody += '</td>';
|
||||
tbody += '</tr>';
|
||||
|
||||
var orderitemHtml = '';
|
||||
loadImgMagnify();
|
||||
orderitemHtml += '<tr class="content-row">';
|
||||
for (var k = 0; k < this.cols.length; k++) {
|
||||
orderitemHtml += '<td class="' + (this.cols[k].className || "") + '" align="' + (this.cols[k].align || "") + '" style="' + (this.cols[k].style || "") + '" rowspan="' + order.length + '">';
|
||||
orderitemHtml += this.cols[k].template(order, order);
|
||||
orderitemHtml += '</td>';
|
||||
}
|
||||
orderitemHtml += '</tr>';
|
||||
|
||||
tbody += orderitemHtml;
|
||||
|
||||
if(order.buyer_message != '') {
|
||||
//订单项底部
|
||||
tbody += '<tr class="bottom-row">';
|
||||
tbody += '<td colspan="9">';
|
||||
tbody += '<span class="order-item-header" style="margin-right:10px;">买家备注:' + order.buyer_message + '</span>';
|
||||
tbody += '</td>';
|
||||
tbody += '</tr>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
tbody += '</tbody>';
|
||||
return tbody;
|
||||
};
|
||||
|
||||
/**
|
||||
* 渲染表格
|
||||
*/
|
||||
Order.prototype.fetch = function () {
|
||||
if (this.data.list.length > 0) {
|
||||
return '<table class="layui-table layui-form">' + this.header(true) + '</table><table class="layui-table order-list-table layui-form">' + this.header(false) + this.tbody() + '</table>';
|
||||
} else {
|
||||
return '<table class="layui-table order-list-table layui-form">' + this.header(true) + '</table>' + '<div class="order-no-data-block"><ul><li><i class="layui-icon layui-icon-tabs"></i> </li><li>暂无订单</li></ul></div>';
|
||||
}
|
||||
};
|
||||
|
||||
function showMore(order_id) {
|
||||
$(".more-operation[data-order-id]").hide();
|
||||
$(".more-operation[data-order-id='" + order_id + "']").show();
|
||||
$("body").bind('click',function (e) {
|
||||
if (!$(e.target).closest(".order-item-header.more").length) {
|
||||
$(".more-operation[data-order-id='" + order_id + "']").hide();
|
||||
$("body").unbind('click');
|
||||
}
|
||||
});
|
||||
}
|
||||
$(".layui-colla-title").on("click", function(){
|
||||
if($(".layui-colla-title>i").hasClass("layui-icon-down") === false && $(".layui-colla-title>i").hasClass("layui-icon-up") === false){
|
||||
$(".layui-colla-title .put-open").html("展开");
|
||||
}else if($(".layui-colla-title>i").hasClass("layui-icon-down") === true){
|
||||
$(".layui-colla-title .put-open").html("展开");
|
||||
}else if($(".layui-colla-title>i").hasClass("layui-icon-up") === true){
|
||||
$(".layui-colla-title .put-open").html("收起");
|
||||
}
|
||||
})
|
||||
359
addon/giftcard/shop/view/transfer/list.html
Executable file
359
addon/giftcard/shop/view/transfer/list.html
Executable file
@@ -0,0 +1,359 @@
|
||||
<style>
|
||||
.rights_interests{
|
||||
line-height: 13px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="screen layui-collapse" lay-filter="selection_panel">
|
||||
<div class="layui-colla-item">
|
||||
<h2 class="layui-colla-title">筛选</h2>
|
||||
<form class="layui-colla-content layui-form layui-show">
|
||||
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">卡编号</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="number" autocomplete="off" class="layui-input" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">赠与人</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="has_keywords" placeholder="请输入账号昵称或手机号" autocomplete="off" class="layui-input" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">受赠人</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="receive_keywords" placeholder="请输入账号昵称或手机号" autocomplete="off" class="layui-input" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<button class="layui-btn" lay-submit lay-filter="search">筛选</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-tab table-tab" lay-filter="manjian_tab">
|
||||
<div class="layui-tab-content">
|
||||
<!-- 列表 -->
|
||||
<table id="record_list" lay-filter="record_list"></table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/html" id="rights_interests">
|
||||
<div class=rights_interests>
|
||||
<p><span>积分:{{d.point}}</span></p><br>
|
||||
<p><span>余额:{{d.balance}}</span></p><br>
|
||||
<!-- <p><span>优惠卷:{{d.coupon_name}}</span></p>-->
|
||||
</div>
|
||||
</script>
|
||||
<script type="text/html" id="order_status">
|
||||
<div class=rights_interests>
|
||||
{{# if(d.status == 0){ }}待支付{{# }else if(d.status == 1){ }}已完成{{# }else{ }}已取消{{# } }}
|
||||
</div>
|
||||
</script>
|
||||
<script type="text/html" id="poster_status">
|
||||
<div class='table-title'>
|
||||
{{# if(d.status == 0){ }}
|
||||
<div class='title-pic' style="text-align:left">未激活</div>
|
||||
{{# }else if(d.status == 1){ }}
|
||||
<div class='title-pic text-color' style="text-align:left">已激活</div>
|
||||
{{# }else if(d.status == 2){ }}
|
||||
<div class='title-pic' style="text-align:left">已作废</div>
|
||||
{{# } }}
|
||||
</div>
|
||||
</script>
|
||||
<!-- 操作 -->
|
||||
<script type="text/html" id="operation">
|
||||
<div class="table-btn">
|
||||
{{#if(d.type==1){ }}
|
||||
<a class="layui-btn" lay-event="edit">编辑</a>
|
||||
{{# } }}
|
||||
{{# if(d.type==2){ }}
|
||||
<a class="layui-btn" lay-event="detail">兑换卡列表</a>
|
||||
{{# if(d.status==0){ }}
|
||||
<a class="layui-btn" lay-event="start">批量激活</a>
|
||||
<a class="layui-btn" lay-event="close">批量作废</a>
|
||||
{{# }else if(d.status==0 || d.status==1){ }}
|
||||
<a class="layui-btn" lay-event="close">批量作废</a>
|
||||
{{# } }}
|
||||
<a class="layui-btn" lay-event="exportcard">导出</a>
|
||||
{{#} }}
|
||||
</div>
|
||||
</script>
|
||||
<!-- 电子卡编辑html -->
|
||||
<script type="text/html" id="label_change">
|
||||
<div class="layui-form member-form" id="reset_label" lay-filter="form">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label sm">数量:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" name="card_count" class="layui-input len-short" autocomplete="off" min="0">
|
||||
</div>
|
||||
</div>
|
||||
<input class="reset-label-id" type="hidden" name="card_id" value="{{d.id}}" />
|
||||
<div class="form-row sm">
|
||||
<button class="layui-btn" lay-submit lay-filter="setlabel">确定</button>
|
||||
<button class="layui-btn layui-btn-primary" onclick="closeLabel()">返回</button>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var laytpl,layer_label;
|
||||
layui.use(['form', 'laytpl','laydate'], function () {
|
||||
var table,
|
||||
form = layui.form,
|
||||
repeat_flag = false; //防重复标识
|
||||
form.render();
|
||||
laydate = layui.laydate;
|
||||
|
||||
//渲染时间
|
||||
laydate.render({
|
||||
elem: '#start_time',
|
||||
type: 'datetime'
|
||||
});
|
||||
|
||||
laydate.render({
|
||||
elem: '#end_time',
|
||||
type: 'datetime'
|
||||
});
|
||||
|
||||
laytpl = layui.laytpl;
|
||||
table = new Table({
|
||||
elem: '#record_list',
|
||||
url: ns.url("giftcard://shop/giftcard/transferrecordlist"),
|
||||
cols: [
|
||||
[{
|
||||
field: 'number',
|
||||
title: '卡编号',
|
||||
unresize: 'false',
|
||||
width: '12%',
|
||||
}, {
|
||||
field: 'card_name',
|
||||
title: '礼品卡名称',
|
||||
unresize: 'false',
|
||||
width: '12%',
|
||||
}, {
|
||||
field: 'has_member_name',
|
||||
title: '赠与人',
|
||||
unresize: 'false',
|
||||
width: '10%',
|
||||
},{
|
||||
field: 'receive_member_name',
|
||||
title: '受赠人',
|
||||
unresize: 'false',
|
||||
width: '10%',
|
||||
},{
|
||||
title: '转赠时间',
|
||||
unresize: 'false',
|
||||
width: '20%',
|
||||
templet: function (data) {
|
||||
return ns.time_to_date(data.create_time);
|
||||
}
|
||||
}
|
||||
// {
|
||||
// title: '操作',
|
||||
// toolbar: '#operation',
|
||||
// unresize: 'false',
|
||||
// align:'right'
|
||||
// }
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
/**
|
||||
* 监听工具栏操作
|
||||
*/
|
||||
table.tool(function (obj) {
|
||||
var data = obj.data;
|
||||
switch (obj.event) {
|
||||
case 'edit':
|
||||
location.hash = ns.hash("giftcard://shop/giftcard/editgiftcard?id="+data.id);
|
||||
break;
|
||||
case 'detail':
|
||||
location.hash = ns.hash("giftcard://shop/giftcard/recordlist?id="+data.id);
|
||||
break;
|
||||
case 'close': //关闭
|
||||
close(data.id);
|
||||
break;
|
||||
case 'start': //启用
|
||||
start(data.id);
|
||||
break;
|
||||
case 'exportcard'://导出
|
||||
exportcard(data.id,data.code);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 关闭
|
||||
*/
|
||||
function close(id) {
|
||||
if (repeat_flag) return false;
|
||||
repeat_flag = true;
|
||||
|
||||
layer.confirm('确定作废吗?',{
|
||||
btn: ['确定','取消'] //按钮
|
||||
,cancel: function(index, layero){
|
||||
repeat_flag = false;
|
||||
layer.close(index);
|
||||
}
|
||||
}, function () {
|
||||
$.ajax({
|
||||
url: ns.url("giftcard://shop/giftcard/editstatus"),
|
||||
data: {
|
||||
id: id, status: 2
|
||||
},
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function (res) {
|
||||
layer.msg(res.message);
|
||||
repeat_flag = false;
|
||||
if (res.code == 0) {
|
||||
table.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
}, function(){
|
||||
repeat_flag = false;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 开启
|
||||
*/
|
||||
function start(id) {
|
||||
if (repeat_flag) return false;
|
||||
repeat_flag = true;
|
||||
layer.confirm('确定激活吗?', {
|
||||
btn: ['确定','取消'] //按钮
|
||||
,cancel: function(index, layero){
|
||||
repeat_flag = false;
|
||||
layer.close(index);
|
||||
}
|
||||
},function (index) {
|
||||
layer.close(index);
|
||||
$.ajax({
|
||||
url: ns.url("giftcard://shop/giftcard/editstatus"),
|
||||
data: {
|
||||
id: id, status: 1
|
||||
},
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function (res) {
|
||||
layer.msg(res.message);
|
||||
repeat_flag = false;
|
||||
if (res.code == 0) {
|
||||
table.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
}, function(index){
|
||||
repeat_flag = false;
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
|
||||
function edit(data){
|
||||
laytpl($("#label_change").html()).render(data, function(html) {
|
||||
layer_label = layer.open({
|
||||
title: '编辑数量',
|
||||
skin: 'layer-tips-class',
|
||||
type: 1,
|
||||
area: ['450px'],
|
||||
content: html,
|
||||
success: function(){
|
||||
form.render();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
form.render();
|
||||
}
|
||||
function exportcard(id,name){
|
||||
var param = {request_mode: 'download','id':id,'name':name};
|
||||
location.href = ns.url("giftcard://shop/giftcard/exportcard",param);
|
||||
return false;
|
||||
}
|
||||
form.on('submit(setlabel)', function(obj) {
|
||||
if (repeat_flag) return false;
|
||||
repeat_flag = true;
|
||||
|
||||
var field = obj.field;
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ns.url("giftcard://shop/giftcard/editGiftCard"),
|
||||
data: {
|
||||
'card_id': field.card_id,
|
||||
'card_count': field.card_count
|
||||
},
|
||||
dataType: 'JSON',
|
||||
success: function(res) {
|
||||
layer.msg(res.message);
|
||||
repeat_flag = false;
|
||||
if (res.code == 0) {
|
||||
table.reload();
|
||||
layer.closeAll('page');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* 搜索功能
|
||||
*/
|
||||
form.on('submit(search)', function (data) {
|
||||
table.reload({
|
||||
page: {
|
||||
curr: 1
|
||||
},
|
||||
where: data.field
|
||||
});
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* 七天时间
|
||||
*/
|
||||
function datePick(date_num,event_obj){
|
||||
$(".date-picker-btn").removeClass("selected");
|
||||
$(event_obj).addClass('selected');
|
||||
// alert(new Date().format("yyyy-MM-dd hh:mm"));
|
||||
var now_date = new Date();
|
||||
|
||||
Date.prototype.Format = function (fmt,date_num) { //author: meizz
|
||||
this.setDate(this.getDate()-date_num);
|
||||
var o = {
|
||||
"M+": this.getMonth() + 1, //月份
|
||||
"d+": this.getDate(), //日
|
||||
"H+": this.getHours(), //小时
|
||||
"m+": this.getMinutes(), //分
|
||||
"s+": this.getSeconds(), //秒
|
||||
"q+": Math.floor((this.getMonth() + 3) / 3), //季度
|
||||
"S": this.getMilliseconds() //毫秒
|
||||
};
|
||||
if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
|
||||
for (var k in o)
|
||||
if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
|
||||
return fmt;
|
||||
};
|
||||
// var now_time = new Date().Format("yyyy-MM-dd HH:mm:ss",0);//当前日期
|
||||
var now_time = new Date().Format("yyyy-MM-dd 23:59:59",0);//当前日期
|
||||
var before_time = new Date().Format("yyyy-MM-dd 00:00:00",date_num-1);//前几天日期
|
||||
$("input[name=start_time]").val(before_time,0);
|
||||
$("input[name=end_time]").val(now_time,date_num-1);
|
||||
|
||||
}
|
||||
function closeLabel() {
|
||||
layer.close(layer_label);
|
||||
}
|
||||
function add() {
|
||||
location.hash = ns.hash("giftcard://shop/giftcard/addelectgiftcard");
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user