init
This commit is contained in:
182
app/admin/view/product_purchase_links/index.html
Executable file
182
app/admin/view/product_purchase_links/index.html
Executable file
@@ -0,0 +1,182 @@
|
||||
<div class="content-wrapper">
|
||||
<section class="content-header">
|
||||
<h1>
|
||||
产品购买链接<small>链接列表</small>
|
||||
</h1>
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="{:url('/admin/index/index')}"><i class="fa fa-dashboard"></i> 首页</a></li>
|
||||
<li><a href="{:url('/admin/product_purchase_links/index')}"> 产品购买链接</a></li>
|
||||
<li class="active"> 链接列表</li>
|
||||
</ol>
|
||||
</section>
|
||||
<section class="content">
|
||||
<div class="box box-primary">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">链接列表</h3>
|
||||
<div class="box-tools pull-right">
|
||||
<div class="input-group input-group-sm">
|
||||
<input type="text" class="form-control pull-right" id="list-search-in" placeholder="Search Name" value="">
|
||||
<div class="input-group-btn">
|
||||
<button type="button" class="btn btn-default" id="list-search-btn"><i class="fa fa-search"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-body no-padding">
|
||||
<div class="table-responsive lists-table">
|
||||
<table class="table table-hover table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>产品名称</td>
|
||||
<td>型号</td>
|
||||
<td>上架状态</td>
|
||||
<td>平台</td>
|
||||
<td>链接地址</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{if condition="!empty($list)"}
|
||||
{volist name="list" id="vo"}
|
||||
<tr>
|
||||
<td rowspan="{$vo.rowspan}" style="vertical-align: middle;">{$vo.name}</td>
|
||||
<td rowspan="{$vo.rowspan}" style="vertical-align: middle;">{$vo.spu}</td>
|
||||
<td rowspan="{$vo.rowspan}" style="vertical-align: middle;">
|
||||
{if condition="$vo['is_show'] == -1"}
|
||||
<span class="label label-warning">未上架</span>
|
||||
{else/}
|
||||
<span class="label label-success">已上架</span>
|
||||
{/if}
|
||||
</td>
|
||||
<td>
|
||||
<select name="platform" data-id="{$vo.id}" data-value="{$vo.platform_id}">
|
||||
{volist name="platforms" id="p"}
|
||||
<option value="{$p.id}" {if condition="$vo.platform_id == $p.id"}selected="selected"{/if}>{$p.platform}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="link" value="{$vo.link}" data-id="{$vo.id}" data-value="{$vo.link}"/>
|
||||
</td>
|
||||
</tr>
|
||||
{if condition="!empty($vo.children)"}
|
||||
{volist name="vo.children" id="voc"}
|
||||
<tr>
|
||||
<td>
|
||||
<select name="platform" data-id="{$voc.id}" data-value="{$voc.platform_id}">
|
||||
{volist name="platforms" id="p"}
|
||||
<option value="{$p.id}" {if condition="$voc.platform_id == $p.id" }selected="selected" {/if}>{$p.platform}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="link" value="{$voc.link}" data-id="{$voc.id}" data-value="{$voc.link}" />
|
||||
</td>
|
||||
</tr>
|
||||
{/volist}
|
||||
{/if}
|
||||
{/volist}
|
||||
{/if}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-footer no-padding">
|
||||
<div class="mailbox-controls">
|
||||
<label for="import" class="btn btn-primary btn-sm" style="margin-right:8px;">
|
||||
<input type="file" id="import" name="file" class="hide" />
|
||||
<i class="fa fa-fw fa-cloud-upload"></i>导入
|
||||
</label>
|
||||
<a href="/admin/product_purchase_links/export?skeyword={$Request.get.skeyword}" class="btn btn-default btn-sm">
|
||||
<i class="fa fa-fw fa-cloud-download"></i>导出
|
||||
</a>
|
||||
<div class="pull-right">{$page}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
// 导入
|
||||
$('#import').change(function(event) {
|
||||
var input = $(this)[0]
|
||||
if (input.files.length > 0) {
|
||||
var _load
|
||||
var form_data = new FormData()
|
||||
form_data.append('file', input.files[0])
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/admin/product_purchase_links/import',
|
||||
data: form_data,
|
||||
cache: false,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
beforeSend: function() {
|
||||
_load = layer.load()
|
||||
},
|
||||
success: function (r) {
|
||||
if (r.code == 1) {
|
||||
layer.msg(r.msg, function () {
|
||||
location.reload()
|
||||
})
|
||||
} else {
|
||||
layer.alert(r.msg, { icon: 2 }, function () {
|
||||
location.reload()
|
||||
})
|
||||
}
|
||||
},
|
||||
error: function(e) {
|
||||
layer.alert('导入失败', { icon: 2 }, function() {
|
||||
location.reload()
|
||||
});
|
||||
},
|
||||
complete: function() {
|
||||
$('#import').val(null)
|
||||
layer.close(_load)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
// 更新数据
|
||||
var __update = function(data, success) {
|
||||
var _load
|
||||
return $.ajax({
|
||||
type: 'POST',
|
||||
url: '/admin/product_purchase_links/update',
|
||||
data: data,
|
||||
dataType: 'JSON',
|
||||
beforeSend: function() {
|
||||
_load = layer.load()
|
||||
},
|
||||
success: function(r) {
|
||||
if (r.code == 0) {
|
||||
layer.alert(r.msg, { icon: 2 }, function() {
|
||||
location.reload()
|
||||
})
|
||||
} else {
|
||||
typeof success == 'function' && success()
|
||||
layer.msg(r.msg)
|
||||
}
|
||||
},
|
||||
complete: function() {
|
||||
layer.close(_load)
|
||||
}
|
||||
})
|
||||
}
|
||||
$('[name="platform"]').change(function () {
|
||||
var value = $(this).get(0).dataset.value
|
||||
if (value == $(this).val()) return false;
|
||||
__update({ id: $(this).data('id'), platform_id: $(this).val() }, function() {
|
||||
$(this).get(0).dataset.value = $(this).val()
|
||||
}.bind(this))
|
||||
})
|
||||
$('[name="link"]').change(function(){
|
||||
var value = $(this).get(0).dataset.value
|
||||
if (value == $(this).val()) return false;
|
||||
__update({ id: $(this).data('id'), link: $(this).val() }, function () {
|
||||
$(this).get(0).dataset.value = $(this).val()
|
||||
}.bind(this))
|
||||
})
|
||||
})
|
||||
</script>
|
||||
Reference in New Issue
Block a user