初始上传
This commit is contained in:
47
addon/electronicsheet/shop/controller/Config.php
Executable file
47
addon/electronicsheet/shop/controller/Config.php
Executable file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\electronicsheet\shop\controller;
|
||||
|
||||
use app\shop\controller\BaseShop;
|
||||
use addon\electronicsheet\model\ExpressElectronicsheet as ExpressElectronicsheetModel;
|
||||
|
||||
|
||||
class Config extends BaseShop
|
||||
{
|
||||
|
||||
/*
|
||||
* 电子面单设置
|
||||
*/
|
||||
public function config()
|
||||
{
|
||||
$config = new ExpressElectronicsheetModel();
|
||||
if (request()->isJson()) {
|
||||
|
||||
$data = [
|
||||
'site_id' => $this->site_id,
|
||||
'type' => input('type', 'kdniao'),
|
||||
'kdniao_user_id' => input('kdniao_user_id', ''),
|
||||
'kdniao_api_key' => input('kdniao_api_key', ''),
|
||||
'kdniao_port' => input('kdniao_port', ''),
|
||||
'cainiao_token' => input('cainiao_token', ''),
|
||||
'cainiao_ip' => input('cainiao_ip', ''),
|
||||
];
|
||||
|
||||
return $config->setElectronicsheetConfig($data);
|
||||
} else {
|
||||
|
||||
$res = $config->getElectronicsheetConfig($this->site_id);
|
||||
$this->assign('config_info', $res[ 'data' ][ 'value' ]);
|
||||
return $this->fetch('config/config');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
145
addon/electronicsheet/shop/controller/Electronicsheet.php
Executable file
145
addon/electronicsheet/shop/controller/Electronicsheet.php
Executable file
@@ -0,0 +1,145 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\electronicsheet\shop\controller;
|
||||
|
||||
use app\model\express\ExpressCompanyTemplate;
|
||||
use app\shop\controller\BaseShop;
|
||||
use addon\electronicsheet\model\ExpressElectronicsheet as ExpressElectronicsheetModel;
|
||||
|
||||
class Electronicsheet extends BaseShop
|
||||
{
|
||||
|
||||
/*
|
||||
* 电子面单列表
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
$model = new ExpressElectronicsheetModel();
|
||||
|
||||
$condition[] = [ 'site_id', '=', $this->site_id ];
|
||||
//获取续签信息
|
||||
if (request()->isJson()) {
|
||||
$status = input('status', '');//模板状态
|
||||
if ($status) {
|
||||
$condition[] = [ 'status', '=', $status ];
|
||||
}
|
||||
$template_name = input('template_name', '');
|
||||
if ($template_name) {
|
||||
$condition[] = [ 'template_name', 'like', '%' . $template_name . '%' ];
|
||||
}
|
||||
|
||||
$page = input('page', 1);
|
||||
$page_size = input('page_size', PAGE_LIST_ROWS);
|
||||
$list = $model->getExpressElectronicsheetPageList($condition, $page, $page_size, 'is_default desc');
|
||||
return $list;
|
||||
}
|
||||
return $this->fetch('electronicsheet/lists');
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加电子面单
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
if (request()->isJson()) {
|
||||
$data = [
|
||||
'site_id' => $this->site_id,
|
||||
'template_name' => input('template_name', ''),
|
||||
'company_id' => input('company_id', ''),
|
||||
'customer_name' => input('customer_name', ''),
|
||||
'customer_pwd' => input('customer_pwd', ''),
|
||||
'send_site' => input('send_site', ''),
|
||||
'send_staff' => input('send_staff', ''),
|
||||
'month_code' => input('month_code', ''),
|
||||
'postage_payment_method' => input('postage_payment_method', ''),
|
||||
'is_notice' => input('is_notice', ''),
|
||||
'is_default' => input('is_default', 0),
|
||||
'print_style' => input('print_style', 0),
|
||||
];
|
||||
$model = new ExpressElectronicsheetModel();
|
||||
return $model->addExpressElectronicsheet($data);
|
||||
|
||||
} else {
|
||||
//快递公司
|
||||
$express_company_model = new ExpressCompanyTemplate();
|
||||
$condition = [
|
||||
[ 'is_electronicsheet', '=', 1 ],
|
||||
];
|
||||
$company_list = $express_company_model->getExpressCompanyTemplateList($condition, 'company_id,company_name,print_style', 'sort asc');
|
||||
$this->assign('company_list', $company_list[ 'data' ]);
|
||||
return $this->fetch('electronicsheet/add');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑电子面单
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$model = new ExpressElectronicsheetModel();
|
||||
$id = input('id', 0);
|
||||
if (request()->isJson()) {
|
||||
$data = [
|
||||
'id' => $id,
|
||||
'site_id' => $this->site_id,
|
||||
'template_name' => input('template_name', ''),
|
||||
'company_id' => input('company_id', ''),
|
||||
'customer_name' => input('customer_name', ''),
|
||||
'customer_pwd' => input('customer_pwd', ''),
|
||||
'send_site' => input('send_site', ''),
|
||||
'send_staff' => input('send_staff', ''),
|
||||
'month_code' => input('month_code', ''),
|
||||
'postage_payment_method' => input('postage_payment_method', ''),
|
||||
'is_notice' => input('is_notice', ''),
|
||||
'is_default' => input('is_default', 0),
|
||||
'print_style' => input('print_style', 0),
|
||||
];
|
||||
return $model->editExpressElectronicsheet($data);
|
||||
|
||||
} else {
|
||||
|
||||
$info = $model->getExpressElectronicsheetInfo([ [ 'id', '=', $id ], [ 'site_id', '=', $this->site_id ] ]);
|
||||
$this->assign('electronicsheet_info', $info[ 'data' ]);
|
||||
//快递公司
|
||||
$express_company_model = new ExpressCompanyTemplate();
|
||||
$condition = [
|
||||
[ 'is_electronicsheet', '=', 1 ],
|
||||
];
|
||||
$company_list = $express_company_model->getExpressCompanyTemplateList($condition, 'company_id,company_name,print_style', 'sort asc');
|
||||
$this->assign('company_list', $company_list[ 'data' ]);
|
||||
return $this->fetch('electronicsheet/edit');
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 删除
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$id = input('id', '');
|
||||
|
||||
$groupbuy_model = new ExpressElectronicsheetModel();
|
||||
return $groupbuy_model->deleteExpressElectronicsheet([ [ 'id', '=', $id ], [ 'site_id', '=', $this->site_id ] ]);
|
||||
}
|
||||
|
||||
/*
|
||||
* 修改默认状态
|
||||
*/
|
||||
public function setDefaultStatus()
|
||||
{
|
||||
$id = input('id', '');
|
||||
|
||||
$groupbuy_model = new ExpressElectronicsheetModel();
|
||||
$groupbuy_model->setExpressElectronicsheetDefault([ [ 'site_id', '=', $this->site_id ] ], 0);
|
||||
return $groupbuy_model->setExpressElectronicsheetDefault([ [ 'id', '=', $id ], [ 'site_id', '=', $this->site_id ] ], 1);
|
||||
}
|
||||
|
||||
}
|
||||
192
addon/electronicsheet/shop/view/config/config.html
Executable file
192
addon/electronicsheet/shop/view/config/config.html
Executable file
@@ -0,0 +1,192 @@
|
||||
<style>
|
||||
.tips-wrap a {
|
||||
color: #fb6638;
|
||||
background: transparent;
|
||||
text-decoration: none;
|
||||
outline: none;
|
||||
cursor: pointer;
|
||||
-webkit-transition: color .2s ease;
|
||||
transition: color .2s ease;
|
||||
}
|
||||
.desc{
|
||||
margin-bottom: 15px;border:1px dashed #ff8143;padding: 5px 10px;background: #fff0e9;color: #ff8143;width: 65%;
|
||||
}
|
||||
</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-collapse tips-wrap cainiao">
|
||||
<div class="layui-colla-item">
|
||||
<h2 class="layui-colla-title">使用说明</h2>
|
||||
<ul class="layui-colla-content kdniao">
|
||||
<li>1.注册菜鸟账号 <a href="https://lcp.cloud.cainiao.com/permission/index" target="_blank">https://lcp.cloud.cainiao.com/permission/index</a> 在三方授权管理 搜索服务商发布的应用,点击授权,查看授权获取token。</li>
|
||||
<li>2. 前往<a href="https://dayin.cainiao.com" target="_blank"> https://dayin.cainiao.com </a> 添加订购关系。</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-card-body">
|
||||
<div class="desc">
|
||||
1. 注册快递鸟ID。<br>
|
||||
2. 实名认证。<br>
|
||||
3. 申请电子面单API:在快递鸟用户管理后台--申请API页面,点击申请电子面单API。<br>
|
||||
4. 将快递鸟用户ID以及API key填入以下表单。
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">类型选择:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="radio" name="type" value="kdniao" title="快递鸟" {if $config_info.type == 'kdniao'} checked="" {/if} lay-filter="type">
|
||||
<!--<input type="radio" name="type" value="cainiao" title="菜鸟" {if $config_info.type == 'cainiao'} checked="" {/if} lay-filter="type">-->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item kdniao">
|
||||
<label class="layui-form-label">用户ID:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="kdniao_user_id" value="{$config_info.kdniao_user_id}" class="layui-input len-long">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item kdniao">
|
||||
<label class="layui-form-label">API key:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="kdniao_api_key" value="{$config_info.kdniao_api_key}" class="layui-input len-long">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item cainiao">
|
||||
<label class="layui-form-label">token:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="cainiao_token" value="{$config_info.cainiao_token}" class="layui-input len-long">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-card card-common card-brief">
|
||||
<div class="layui-card-header">
|
||||
<span class="card-title">打印机设置</span>
|
||||
</div>
|
||||
|
||||
<div class="layui-collapse tips-wrap cainiao">
|
||||
<div class="layui-colla-item">
|
||||
<h2 class="layui-colla-title">使用说明</h2>
|
||||
<ul class="layui-colla-content">
|
||||
<li>1.下载菜鸟组件并安装。下载链接:<a href="http://cloudprint-docs-resource.oss-cn-shanghai.aliyuncs.com/download.html" target="_blank">http://cloudprint-docs-resource.oss-cn-shanghai.aliyuncs.com/download.html</a>。</li>
|
||||
<li>2. 请将打印机连接至本机。</li>
|
||||
<li>3.在下面填写菜鸟组件的地址信息(默认本机打印 ws://localhost:13528)。</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-card-body kdniao">
|
||||
<div class="desc">
|
||||
本地打印机名称(供快递鸟电子面单使用)。<br>
|
||||
1. 请将打印机连接至本机。<br>
|
||||
2. 在本机上安装打印控件。下载链接:<a href="http://www.kdniao.com/documents-instrument" target="_blank">http://www.kdniao.com/documents-instrument</a>。
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">本地打印机名称:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="kdniao_port" value="{$config_info.kdniao_port}" class="layui-input len-long">
|
||||
</div>
|
||||
</div>
|
||||
<!--<div class="layui-form-item">-->
|
||||
<!--<label class="layui-form-label">IP端口:</label>-->
|
||||
<!--<div class="layui-input-inline">-->
|
||||
<!--<input type="text" name="kdniao_port" value="{$config_info.kdniao_port}" class="layui-input len-long">-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
</div>
|
||||
|
||||
<div class="layui-card-body cainiao">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">菜鸟组件IP:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="cainiao_ip" value="{$config_info.cainiao_ip}" class="layui-input len-long">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="single-filter-box">
|
||||
<div class="form-row">
|
||||
<button class="layui-btn" lay-submit lay-filter="save">保存</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var type = "{$config_info.type}";
|
||||
if(type == 'kdniao'){
|
||||
$('.kdniao').show();
|
||||
$('.cainiao').hide();
|
||||
}else{
|
||||
$('.kdniao').hide();
|
||||
$('.cainiao').show();
|
||||
}
|
||||
|
||||
layui.use(['form'], function() {
|
||||
var form = layui.form,
|
||||
repeat_flag = false; //防重复标识
|
||||
|
||||
form.render();
|
||||
|
||||
form.verify({
|
||||
rate: function(value){
|
||||
if(value > 100 || value < 0 || value%1 != 0){
|
||||
return '请填写0-100的整数';
|
||||
}
|
||||
},
|
||||
flo: function (value) {
|
||||
if (value == '') {
|
||||
return;
|
||||
}
|
||||
var reg = /^(0|[1-9]\d*)(\s|$|\.\d{1,2}\b)/;
|
||||
if (!reg.test(value)) {
|
||||
return '价格不能小于0,可保留两位小数!'
|
||||
}
|
||||
},
|
||||
check_num:function(value){
|
||||
if($("input[name='min_withdraw']").val() > value){
|
||||
return '最小提现金额不能大于最大提现金额!';
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//类型切换
|
||||
form.on('radio(type)', function(data) {
|
||||
var type = data.value;
|
||||
if(type == 'kdniao'){
|
||||
$('.kdniao').show();
|
||||
$('.cainiao').hide();
|
||||
}else{
|
||||
$('.kdniao').hide();
|
||||
$('.cainiao').show();
|
||||
}
|
||||
});
|
||||
|
||||
form.on('submit(save)', function(data) {
|
||||
if (repeat_flag) return;
|
||||
repeat_flag = true;
|
||||
|
||||
field = data.field;
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
dataType: 'JSON',
|
||||
url: ns.url("electronicsheet://shop/config/config"),
|
||||
data: field,
|
||||
success: function(res) {
|
||||
layer.msg(res.message);
|
||||
repeat_flag = false;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
223
addon/electronicsheet/shop/view/electronicsheet/add.html
Executable file
223
addon/electronicsheet/shop/view/electronicsheet/add.html
Executable file
@@ -0,0 +1,223 @@
|
||||
<div class="layui-collapse tips-wrap">
|
||||
<div class="layui-colla-item">
|
||||
<h2 class="layui-colla-title">操作提示</h2>
|
||||
<ul class="layui-colla-content layui-show">
|
||||
<li>管理员可以在此页添加电子面单模板</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form form-wrap">
|
||||
|
||||
<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" value="" name="template_name" lay-verify="required" autocomplete="off" class="layui-input len-long">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item express_company">
|
||||
<label class="layui-form-label"><span class="required">*</span>快递公司:</label>
|
||||
<div class="layui-input-block len-short">
|
||||
<select name="company_id" lay-verify="required" lay-filter="company_id">
|
||||
<option value="">请选择</option>
|
||||
{foreach $company_list as $v}
|
||||
<option value="{$v.company_id}" class="company_id_{$v.company_id}" data-value="{$v.print_style}">{$v.company_name}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item print_style"></div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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">CustomerName:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" value="" name="customer_name" autocomplete="off" class="layui-input len-long">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">CustomerPwd:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" value="" name="customer_pwd" autocomplete="off" class="layui-input len-long">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">SendSite:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" value="" name="send_site" autocomplete="off" class="layui-input len-long">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">SendStaff:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" value="" name="send_staff" autocomplete="off" class="layui-input len-long">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">MonthCode:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" value="" name="month_code" 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 len-short">
|
||||
<select name="postage_payment_method">
|
||||
<option value="">请选择</option>
|
||||
<option value="1">现付</option>
|
||||
<option value="2">到付</option>
|
||||
<option value="3">月结</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">是否上门揽件:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="radio" name="is_notice" value="1" title="是" checked="">
|
||||
<input type="radio" name="is_notice" value="0" title="否">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">是否默认:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="radio" name="is_default" value="1" title="是" checked="">
|
||||
<input type="radio" name="is_default" value="0" title="否">
|
||||
</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="backElectronicSheetList()">返回</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
layui.use(['form'], function() {
|
||||
var form = layui.form,
|
||||
repeat_flag = false;
|
||||
|
||||
form.render();
|
||||
|
||||
/**
|
||||
* 表单验证
|
||||
*/
|
||||
form.verify({
|
||||
time: function(value) {
|
||||
var now_time = (new Date()).getTime();
|
||||
var start_time = (new Date($("#start_time").val())).getTime();
|
||||
var end_time = (new Date(value)).getTime();
|
||||
if (now_time > end_time) {
|
||||
return '结束时间不能小于当前时间!'
|
||||
}
|
||||
if (start_time > end_time) {
|
||||
return '结束时间不能小于开始时间!';
|
||||
}
|
||||
},
|
||||
flnum: function(value) {
|
||||
var arrMen = value.split(".");
|
||||
var val = 0;
|
||||
if (arrMen.length == 2) {
|
||||
val = arrMen[1];
|
||||
}
|
||||
if (val.length > 2) {
|
||||
return '保留小数点后两位!'
|
||||
}
|
||||
},
|
||||
int: function(value) {
|
||||
if (value <= 1 || value % 1 != 0) {
|
||||
return '请输入大于1的正整数!'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
form.on('select(company_id)', function(data){
|
||||
var print_style = $(".company_id_"+data.value).attr("data-value");
|
||||
|
||||
print_style = JSON.parse(print_style);
|
||||
|
||||
var html = '<div class="layui-form-item">' +
|
||||
'<label class="layui-form-label"><span class="required">*</span>模板样式:</label>' +
|
||||
'<div class="layui-input-block len-short">' +
|
||||
'<select name="print_style" lay-verify="required">' +
|
||||
'<option value="">请选择</option>';
|
||||
|
||||
for(i = 0; i < print_style.length; i ++){
|
||||
html += '<option value="'+ i +'">'+ print_style[i]['template_name'] +'</option>';
|
||||
}
|
||||
|
||||
html += '</select>' +
|
||||
'</div>' +
|
||||
'</div>';
|
||||
|
||||
$('.print_style').html(html);
|
||||
form.render();
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* 表单提交
|
||||
*/
|
||||
form.on('submit(save)', function(data){
|
||||
|
||||
if(repeat_flag) return;
|
||||
repeat_flag = true;
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
dataType: 'JSON',
|
||||
url: ns.url("electronicsheet://shop/electronicsheet/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("electronicsheet://shop/electronicsheet/lists");
|
||||
layer.close(index);
|
||||
},
|
||||
btn2: function(index, layero) {
|
||||
listenerHash(); // 刷新页面
|
||||
layer.close(index);
|
||||
}
|
||||
});
|
||||
}else{
|
||||
layer.msg(res.message);
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
function backElectronicSheetList() {
|
||||
location.hash = ns.hash("electronicsheet://shop/electronicsheet/lists");
|
||||
}
|
||||
</script>
|
||||
244
addon/electronicsheet/shop/view/electronicsheet/edit.html
Executable file
244
addon/electronicsheet/shop/view/electronicsheet/edit.html
Executable file
@@ -0,0 +1,244 @@
|
||||
<div class="layui-collapse tips-wrap">
|
||||
<div class="layui-colla-item">
|
||||
<h2 class="layui-colla-title">操作提示</h2>
|
||||
<ul class="layui-colla-content layui-show">
|
||||
<li>管理员可以在此页编辑电子面单模板</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form form-wrap">
|
||||
|
||||
<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" value="{$electronicsheet_info.template_name}" name="template_name" lay-verify="required" autocomplete="off" class="layui-input len-long">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item express_company">
|
||||
<label class="layui-form-label"><span class="required">*</span>快递公司:</label>
|
||||
<div class="layui-input-block len-short">
|
||||
<select name="company_id" lay-verify="required" lay-filter="company_id">
|
||||
<option value="">请选择</option>
|
||||
{foreach $company_list as $v}
|
||||
<option value="{$v.company_id}" class="company_id_{$v.company_id}" data-value="{$v.print_style}" {if $electronicsheet_info.company_id == $v.company_id} selected {/if}>{$v.company_name}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item print_style"></div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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">CustomerName:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" value="{$electronicsheet_info.customer_name}" name="customer_name" autocomplete="off" class="layui-input len-long">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">CustomerPwd:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" value="{$electronicsheet_info.customer_pwd}" name="customer_pwd" autocomplete="off" class="layui-input len-long">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">SendSite:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" value="{$electronicsheet_info.send_site}" name="send_site" autocomplete="off" class="layui-input len-long">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">SendStaff:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" value="{$electronicsheet_info.send_staff}" name="send_staff" autocomplete="off" class="layui-input len-long">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">MonthCode:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" value="{$electronicsheet_info.month_code}" name="month_code" 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 len-short">
|
||||
<select name="postage_payment_method">
|
||||
<option value="">请选择</option>
|
||||
<option value="1" {if $electronicsheet_info.postage_payment_method == 1} selected {/if}>现付</option>
|
||||
<option value="2" {if $electronicsheet_info.postage_payment_method == 2} selected {/if}>到付</option>
|
||||
<option value="3" {if $electronicsheet_info.postage_payment_method == 3} selected {/if}>月结</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">是否上门揽件:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="radio" name="is_notice" value="1" title="是" {if $electronicsheet_info.is_notice == 1} checked {/if}>
|
||||
<input type="radio" name="is_notice" value="0" title="否" {if $electronicsheet_info.is_notice == 0} checked {/if}>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">是否默认:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="radio" name="is_default" value="1" title="是" {if $electronicsheet_info.is_default == 1} checked {/if}>
|
||||
<input type="radio" name="is_default" value="0" title="否" {if $electronicsheet_info.is_default == 0} checked {/if}>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" name="id" value="{$electronicsheet_info.id}">
|
||||
|
||||
<div class="form-row">
|
||||
<button class="layui-btn" lay-submit lay-filter="save">保存</button>
|
||||
<button class="layui-btn layui-btn-primary" onclick="backElectronicSheetList()">返回</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
layui.use(['form'], function() {
|
||||
var form = layui.form,
|
||||
repeat_flag = false;
|
||||
|
||||
var print_style = '{$electronicsheet_info.print_style}';
|
||||
var company_id = '{$electronicsheet_info.company_id}';
|
||||
var print_style_data = $('.company_id_'+company_id).attr('data-value') || '{}';
|
||||
print_style_data = JSON.parse(print_style_data);
|
||||
|
||||
var html = '<div class="layui-form-item">' +
|
||||
'<label class="layui-form-label"><span class="required">*</span>模板样式:</label>' +
|
||||
'<div class="layui-input-block len-short">' +
|
||||
'<select name="print_style" lay-verify="required">' +
|
||||
'<option value="">请选择</option>';
|
||||
|
||||
for(i = 0; i < print_style_data.length; i ++){
|
||||
if(i == print_style){
|
||||
html += '<option value="'+ i +'" selected>'+ print_style_data[i]['template_name'] +'</option>';
|
||||
}else{
|
||||
html += '<option value="'+ i +'">'+ print_style_data[i]['template_name'] +'</option>';
|
||||
}
|
||||
}
|
||||
|
||||
html += '</select>' +
|
||||
'</div>' +
|
||||
'</div>';
|
||||
|
||||
$('.print_style').html(html);
|
||||
|
||||
form.render();
|
||||
|
||||
/**
|
||||
* 表单验证
|
||||
*/
|
||||
form.verify({
|
||||
time: function(value) {
|
||||
var now_time = (new Date()).getTime();
|
||||
var start_time = (new Date($("#start_time").val())).getTime();
|
||||
var end_time = (new Date(value)).getTime();
|
||||
if (now_time > end_time) {
|
||||
return '结束时间不能小于当前时间!'
|
||||
}
|
||||
if (start_time > end_time) {
|
||||
return '结束时间不能小于开始时间!';
|
||||
}
|
||||
},
|
||||
flnum: function(value) {
|
||||
var arrMen = value.split(".");
|
||||
var val = 0;
|
||||
if (arrMen.length == 2) {
|
||||
val = arrMen[1];
|
||||
}
|
||||
if (val.length > 2) {
|
||||
return '保留小数点后两位!'
|
||||
}
|
||||
},
|
||||
int: function(value) {
|
||||
if (value <= 1 || value % 1 != 0) {
|
||||
return '请输入大于1的正整数!'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
form.on('select(company_id)', function(data){
|
||||
var print_style = $(".company_id_"+data.value).attr("data-value");
|
||||
|
||||
print_style = JSON.parse(print_style);
|
||||
|
||||
var html = '<div class="layui-form-item">' +
|
||||
'<label class="layui-form-label"><span class="required">*</span>模板样式:</label>' +
|
||||
'<div class="layui-input-block len-short">' +
|
||||
'<select name="print_style" lay-verify="required">' +
|
||||
'<option value="">请选择</option>';
|
||||
|
||||
for(i = 0; i < print_style.length; i ++){
|
||||
html += '<option value="'+ i +'">'+ print_style[i]['template_name'] +'</option>';
|
||||
}
|
||||
|
||||
html += '</select>' +
|
||||
'</div>' +
|
||||
'</div>';
|
||||
|
||||
$('.print_style').html(html);
|
||||
form.render();
|
||||
});
|
||||
|
||||
/**
|
||||
* 表单提交
|
||||
*/
|
||||
form.on('submit(save)', function(data){
|
||||
if(repeat_flag) return;
|
||||
repeat_flag = true;
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
dataType: 'JSON',
|
||||
url: ns.url("electronicsheet://shop/electronicsheet/edit"),
|
||||
data: data.field,
|
||||
async: false,
|
||||
success: function(res){
|
||||
repeat_flag = false;
|
||||
|
||||
if (res.code == 0) {
|
||||
layer.confirm('编辑成功', {
|
||||
title:'操作提示',
|
||||
btn: ['返回列表', '继续编辑'],
|
||||
yes: function(index, layero) {
|
||||
location.hash = ns.hash("electronicsheet://shop/electronicsheet/lists");
|
||||
layer.close(index);
|
||||
},
|
||||
btn2: function(index, layero) {
|
||||
layer.close(index);
|
||||
}
|
||||
});
|
||||
}else{
|
||||
layer.msg(res.message);
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
function backElectronicSheetList() {
|
||||
location.hash = ns.hash("electronicsheet://shop/electronicsheet/lists");
|
||||
}
|
||||
</script>
|
||||
224
addon/electronicsheet/shop/view/electronicsheet/lists.html
Executable file
224
addon/electronicsheet/shop/view/electronicsheet/lists.html
Executable file
@@ -0,0 +1,224 @@
|
||||
<div class="single-filter-box">
|
||||
<button class="layui-btn" onclick="add()">添加电子面单模板</button>
|
||||
</div>
|
||||
|
||||
<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="template_name" 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="electronicsheet_tab">
|
||||
<div class="layui-tab-content">
|
||||
<!-- 列表 -->
|
||||
<table id="electronicsheet_list" lay-filter="electronicsheet_list"></table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 商品 -->
|
||||
<script type="text/html" id="goods">
|
||||
<div class="table-title">
|
||||
<div class="title-pic">
|
||||
{{# if(d.goods_image){ }}
|
||||
<img layer-src src="{{ns.img(d.goods_image.split(',')[0],'small')}}"/>
|
||||
{{# } }}
|
||||
</div>
|
||||
<div class="title-content">
|
||||
<a href="javascript:;" class="multi-line-hiding text-color" title="{{d.goods_name}}">{{d.goods_name}}</a>
|
||||
</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="status">
|
||||
{{# if(d.status == 1){ }}
|
||||
未开始
|
||||
{{# }else if(d.status == 2){ }}
|
||||
进行中
|
||||
{{# }else if(d.status == 3){ }}
|
||||
已结束
|
||||
{{# } }}
|
||||
</script>
|
||||
|
||||
<!-- 操作 -->
|
||||
<script type="text/html" id="operation">
|
||||
<div class="table-btn">
|
||||
<a class="layui-btn" lay-event="edit">编辑</a>
|
||||
{{# if(d.is_default != 1){ }}
|
||||
<a class="layui-btn" lay-event="default">设置默认</a>
|
||||
{{# } }}
|
||||
<a class="layui-btn" lay-event="del">删除</a>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
layui.use(['form', 'element'], function() {
|
||||
var table,
|
||||
form = layui.form,
|
||||
element = layui.element,
|
||||
repeat_flag = false; //防重复标识
|
||||
form.render();
|
||||
|
||||
table = new Table({
|
||||
elem: '#electronicsheet_list',
|
||||
url: ns.url("electronicsheet://shop/electronicsheet/lists"),
|
||||
cols: [
|
||||
[{
|
||||
'field':'template_name',
|
||||
title: '模板名称',
|
||||
unresize: 'false'
|
||||
}, {
|
||||
field: 'company_name',
|
||||
title: '快递公司',
|
||||
unresize: 'false'
|
||||
}, {
|
||||
field: 'is_default',
|
||||
title: '是否默认',
|
||||
unresize: 'false',
|
||||
templet: function(data) {
|
||||
if(data.is_default == 1){
|
||||
return '是';
|
||||
}else{
|
||||
return '否';
|
||||
}
|
||||
}
|
||||
}, {
|
||||
title: '操作',
|
||||
toolbar: '#operation',
|
||||
unresize: 'false',
|
||||
align:'right'
|
||||
}]
|
||||
]
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* 搜索功能
|
||||
*/
|
||||
form.on('submit(search)', function(data) {
|
||||
table.reload({
|
||||
page: {
|
||||
curr: 1
|
||||
},
|
||||
where: data.field
|
||||
});
|
||||
});
|
||||
|
||||
//监听Tab切换
|
||||
element.on('tab(status)', function(data) {
|
||||
var status = $(this).attr("data-status");
|
||||
table.reload({
|
||||
page: {
|
||||
curr: 1
|
||||
},
|
||||
where: {
|
||||
'status': status
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* 监听工具栏操作
|
||||
*/
|
||||
table.tool(function(obj) {
|
||||
var data = obj.data;
|
||||
switch (obj.event) {
|
||||
case 'edit': //编辑
|
||||
location.hash = ns.hash("electronicsheet://shop/electronicsheet/edit", {"id": data.id});
|
||||
break;
|
||||
case 'del': //删除
|
||||
deleteElectronicsheet(data.id);
|
||||
break;
|
||||
case 'default': //默认
|
||||
setDefaultStatus(data.id);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
function deleteElectronicsheet(id) {
|
||||
layer.confirm('确定要删除该电子面单模板吗?', function(index) {
|
||||
if (repeat_flag) return;
|
||||
repeat_flag = true;
|
||||
layer.close(index);
|
||||
|
||||
$.ajax({
|
||||
url: ns.url("electronicsheet://shop/electronicsheet/delete"),
|
||||
data: {
|
||||
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;
|
||||
});
|
||||
}
|
||||
|
||||
//默认
|
||||
function setDefaultStatus(id) {
|
||||
|
||||
layer.confirm('您确认设为默认模版吗?', function(index) {
|
||||
if (repeat_flag) return;
|
||||
repeat_flag = true;
|
||||
layer.close(index);
|
||||
|
||||
$.ajax({
|
||||
url: ns.url("electronicsheet://shop/electronicsheet/setdefaultstatus"),
|
||||
data: {
|
||||
id: id
|
||||
},
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function(res) {
|
||||
layer.msg(res.message);
|
||||
repeat_flag = false;
|
||||
if (res.code == 0) {
|
||||
table.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
}, function() {
|
||||
layer.close();
|
||||
repeat_flag = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function add() {
|
||||
location.hash = ns.hash("electronicsheet://shop/electronicsheet/add");
|
||||
}
|
||||
</script>
|
||||
BIN
addon/electronicsheet/shop/view/public/img/distribution_new.png
Executable file
BIN
addon/electronicsheet/shop/view/public/img/distribution_new.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
BIN
addon/electronicsheet/shop/view/public/img/distribution_select.png
Executable file
BIN
addon/electronicsheet/shop/view/public/img/distribution_select.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
Reference in New Issue
Block a user