fuc/storage/framework/smarty/compile/6f6a88b7fe784c6dcf893a754173ac8f035cbcd4_0.file_edit.tpl.php
2025-03-13 17:13:42 +08:00

326 lines
16 KiB
PHP
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/* Smarty version 5.3.1, created on 2024-12-09 10:06:46
from 'file:admin/product/edit.tpl' */
/* @var \Smarty\Template $_smarty_tpl */
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
'version' => '5.3.1',
'unifunc' => 'content_675650b6ba6035_66151303',
'has_nocache_code' => false,
'file_dependency' =>
array (
'6f6a88b7fe784c6dcf893a754173ac8f035cbcd4' =>
array (
0 => 'admin/product/edit.tpl',
1 => 1733709436,
2 => 'file',
),
),
'includes' =>
array (
'file:admin/header.tpl' => 1,
'file:admin/footer.tpl' => 1,
),
))) {
function content_675650b6ba6035_66151303 (\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = '/www/wwwroot/xiaofu.cloud/resources/views/tabler/admin/product';
$_smarty_tpl->renderSubTemplate('file:admin/header.tpl', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array(), (int) 0, $_smarty_current_dir);
?>
<div class="page-wrapper">
<div class="container-xl">
<div class="page-header d-print-none text-white">
<div class="row align-items-center">
<div class="col">
<h2 class="page-title">
<span class="home-title">商品 #<?php echo $_smarty_tpl->getValue('product')->id;?>
</span>
</h2>
<div class="page-pretitle my-3">
<span class="home-subtitle">编辑商品信息</span>
</div>
</div>
<div class="col-auto ms-auto d-print-none">
<div class="btn-list">
<a id="save-product" href="#" class="btn btn-primary">
<i class="icon ti ti-device-floppy"></i>
保存
</a>
</div>
</div>
</div>
</div>
</div>
<div class="page-body">
<div class="container-xl">
<div class="row row-deck row-cards">
<div class="col-md-6 col-sm-12">
<div class="card">
<div class="card-header card-header-light">
<h3 class="card-title">基础信息</h3>
</div>
<div class="card-body">
<div class="form-group mb-3 row">
<label class="form-label col-3 col-form-label required">名称</label>
<div class="col">
<input id="name" type="text" class="form-control"
value="<?php echo $_smarty_tpl->getValue('product')->name;?>
">
</div>
</div>
<div class="form-group mb-3 row">
<label class="form-label col-3 col-form-label required">价格</label>
<div class="col">
<input id="price" type="text" class="form-control"
value="<?php echo $_smarty_tpl->getValue('product')->price;?>
">
</div>
</div>
<div class="form-group mb-3 row">
<label class="form-label col-3 col-form-label required">库存小于0时不限制</label>
<div class="col">
<input id="stock" type="text" class="form-control"
value="<?php echo $_smarty_tpl->getValue('product')->stock;?>
">
</div>
</div>
<div class="form-group mb-3 row">
<label class="form-label col-3 col-form-label">销售状态</label>
<div class="col">
<select id="status" class="col form-select">
<option value="1" <?php if ($_smarty_tpl->getValue('product')->status === 1) {?>selected<?php }?>>正常</option>
<option value="0" <?php if ($_smarty_tpl->getValue('product')->status === 0) {?>selected<?php }?>>下架</option>
</select>
</div>
</div>
<div class="form-group mb-3 row">
<label class="form-label col-3 col-form-label">允许返利</label>
<div class="col">
<select id="reward" class="col form-select">
<option value="1" <?php if ($_smarty_tpl->getValue('product')->reward == "1") {?>selected<?php }?>>是
</option>
<option value="0" <?php if ($_smarty_tpl->getValue('product')->reward == "0") {?>selected<?php }?>>否</option>
</select>
</div>
</div>
<div class="form-group mb-3 row" style="display:none;">
<label class="form-label col-3 col-form-label">类型</label>
<div class="col">
<select id="type" class="col form-select">
<option value="tabp" <?php if ($_smarty_tpl->getValue('product')->type === "tabp") {?>selected<?php }?>>时间流量包
</option>
<option value="time" <?php if ($_smarty_tpl->getValue('product')->type === "time") {?>selected<?php }?>>时间包</option>
<option value="bandwidth" <?php if ($_smarty_tpl->getValue('product')->type === "bandwidth") {?>selected<?php }?>>
流量包
</option>
</select>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-6 col-sm-12">
<div class="card">
<div class="card-header card-header-light">
<h3 class="card-title">商品内容</h3>
</div>
<div class="card-body">
<div id="time_option" class="form-group mb-3 row">
<label class="form-label col-3 col-form-label required">商品时长 (天)</label>
<div class="col">
<input id="time" type="text" class="form-control"
value="<?php echo $_smarty_tpl->getValue('content')->time;?>
">
</div>
</div>
<div id="class_option" class="form-group mb-3 row">
<label class="form-label col-3 col-form-label required">等级</label>
<div class="col">
<input id="class" type="text" class="form-control"
value="<?php echo $_smarty_tpl->getValue('content')->class;?>
">
</div>
</div>
<div id="class_time_option" class="form-group mb-3 row">
<label class="form-label col-3 col-form-label required">等级时长 (天)</label>
<div class="col">
<input id="class_time" type="text" class="form-control"
value="<?php echo $_smarty_tpl->getValue('content')->class_time;?>
">
</div>
</div>
<div id="bandwidth_option" class="form-group mb-3 row">
<label class="form-label col-3 col-form-label required">可用流量 (GB)</label>
<div class="col">
<input id="bandwidth" type="text" class="form-control"
value="<?php echo $_smarty_tpl->getValue('content')->bandwidth;?>
">
</div>
</div>
<div id="node_group_option" class="form-group mb-3 row">
<label class="form-label col-3 col-form-label required">用户分组</label>
<div class="col">
<input id="node_group" type="text" class="form-control"
value="<?php echo $_smarty_tpl->getValue('content')->node_group;?>
">
</div>
</div>
<div id="speed_limit_option" class="form-group mb-3 row">
<label class="form-label col-3 col-form-label required">速率限制 (Mbps)</label>
<div class="col">
<input id="speed_limit" type="text" class="form-control"
value="<?php echo $_smarty_tpl->getValue('content')->speed_limit;?>
">
</div>
</div>
<div id="ip_limit_option" class="form-group mb-3 row">
<label class="form-label col-3 col-form-label required">同时连接IP限制</label>
<div class="col">
<input id="ip_limit" type="text" class="form-control"
value="<?php echo $_smarty_tpl->getValue('content')->ip_limit;?>
">
</div>
</div>
<div class="hr-text">
<span>购买限制</span>
</div>
<div class="form-group mb-3 row">
<label class="form-label col-3 col-form-label">用户等级要求</label>
<div class="col">
<input id="class_required" type="text" class="form-control"
value="<?php echo $_smarty_tpl->getValue('limit')->class_required;?>
">
</div>
</div>
<div class="form-group mb-3 row">
<label class="form-label col-3 col-form-label">用户所在的节点组</label>
<div class="col">
<input id="node_group_required" type="text" class="form-control"
value="<?php echo $_smarty_tpl->getValue('limit')->node_group_required;?>
">
</div>
</div>
<div class="mb-3">
<label class="row">
<span class="col">仅限新用户购买</span>
<span class="col-auto">
<label class="form-check form-check-single form-switch">
<input id="new_user_required" class="form-check-input" type="checkbox"
<?php if ($_smarty_tpl->getValue('limit')->new_user_required === 1) {?>checked="" <?php }?>>
</label>
</span>
</label>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php echo '<script'; ?>
>
$(function () {
$("#type").change();
});
$("#type").on("change", function () {
if (this.value === "bandwidth") {
$("#time_option").hide();
$("#class_option").hide();
$("#class_time_option").hide();
$("#bandwidth_option").show();
$("#node_group_option").hide();
$("#speed_limit_option").hide();
$("#ip_limit_option").hide();
$("#time").prop("required", false);
$("#class").prop("required", false);
$("#class_time").prop("required", false);
$("#bandwidth").prop("required", true);
$("#node_group").prop("required", false);
$("#speed_limit").prop("required", false);
$("#ip_limit").prop("required", false);
} else if (this.value === "time") {
$("#time_option").show();
$("#class_option").show();
$("#class_time_option").show();
$("#bandwidth_option").hide();
$("#node_group_option").show();
$("#speed_limit_option").show();
$("#ip_limit_option").show();
$("#time").prop("required", true);
$("#class").prop("required", true);
$("#class_time").prop("required", true);
$("#bandwidth").prop("required", false);
$("#node_group").prop("required", true);
$("#speed_limit").prop("required", true);
$("#ip_limit").prop("required", true);
} else {
$("#time_option").show();
$("#class_option").show();
$("#class_time_option").show();
$("#bandwidth_option").show();
$("#node_group_option").show();
$("#speed_limit_option").show();
$("#ip_limit_option").show();
$("#time").prop("required", true);
$("#class").prop("required", true);
$("#class_time").prop("required", true);
$("#bandwidth").prop("required", true);
$("#node_group").prop("required", true);
$("#speed_limit").prop("required", true);
$("#ip_limit").prop("required", true);
}
});
$("#save-product").click(function () {
let emptyFields = $('input[required]').filter(function () {
return $(this).val() === '';
});
if (emptyFields.length > 0) {
$("#fail-message").text("请填写所有必要栏位");
$("#fail-dialog").modal("show");
} else {
$.ajax({
url: '/admin/product/<?php echo $_smarty_tpl->getValue('product')->id;?>
',
type: 'PUT',
dataType: "json",
data: {
<?php
$_from = $_smarty_tpl->getSmarty()->getRuntime('Foreach')->init($_smarty_tpl, $_smarty_tpl->getValue('update_field'), 'key');
$foreach0DoElse = true;
foreach ($_from ?? [] as $_smarty_tpl->getVariable('key')->value) {
$foreach0DoElse = false;
?>
<?php echo $_smarty_tpl->getValue('key');?>
: $('#<?php echo $_smarty_tpl->getValue('key');?>
').val(),
<?php
}
$_smarty_tpl->getSmarty()->getRuntime('Foreach')->restore($_smarty_tpl, 1);?>
new_user_required: $("#new_user_required").is(":checked"),
},
success: function (data) {
if (data.ret === 1) {
$('#success-message').text(data.msg);
$('#success-dialog').modal('show');
window.setTimeout("location.href=top.document.referrer", <?php echo $_smarty_tpl->getValue('config')['jump_delay'];?>
);
} else {
$('#fail-message').text(data.msg);
$('#fail-dialog').modal('show');
}
}
})
}
});
<?php echo '</script'; ?>
>
<?php $_smarty_tpl->renderSubTemplate('file:admin/footer.tpl', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array(), (int) 0, $_smarty_current_dir);
}
}