初始上传
This commit is contained in:
38
addon/pointcash/config/diy_view.php
Executable file
38
addon/pointcash/config/diy_view.php
Executable file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
return [
|
||||
|
||||
// 自定义模板页面类型,格式:[ 'title' => '页面类型名称', 'name' => '页面标识', 'path' => '页面路径', 'value' => '页面数据,json格式' ]
|
||||
'template' => [],
|
||||
|
||||
// 后台自定义组件——装修
|
||||
'util' => [],
|
||||
|
||||
// 自定义页面路径
|
||||
'link' => [],
|
||||
|
||||
// 自定义图标库
|
||||
'icon_library' => [],
|
||||
|
||||
// uni-app 组件,格式:[ 'name' => '组件名称/文件夹名称', 'path' => '文件路径/目录路径' ],多个逗号隔开,自定义组件名称前缀必须是diy-,也可以引用第三方组件
|
||||
'component' => [],
|
||||
|
||||
// uni-app 页面,多个逗号隔开
|
||||
'pages' => [],
|
||||
|
||||
// 模板信息,格式:'title' => '模板名称', 'name' => '模板标识', 'cover' => '模板封面图', 'preview' => '模板预览图', 'desc' => '模板描述'
|
||||
'info' => [],
|
||||
|
||||
// 主题风格配色,格式可以自由定义扩展,【在uni-app中通过:this.themeStyle... 获取定义的颜色字段,例如:this.themeStyle.main_color】
|
||||
'theme' => [],
|
||||
|
||||
// 自定义页面数据,格式:[ 'title' => '页面名称', 'name' => "页面标识", 'value' => [页面数据,json格式] ]
|
||||
'data' => []
|
||||
];
|
||||
23
addon/pointcash/config/event.php
Executable file
23
addon/pointcash/config/event.php
Executable file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
// 事件定义文件
|
||||
return [
|
||||
'bind' => [
|
||||
|
||||
],
|
||||
|
||||
'listen' => [
|
||||
//展示活动
|
||||
'ShowPromotion' => [
|
||||
'addon\pointcash\event\ShowPromotion',
|
||||
],
|
||||
'MemberAccountFromType' => [
|
||||
'addon\pointcash\event\MemberAccountFromType',
|
||||
],
|
||||
'PointRule' => [
|
||||
'addon\pointcash\event\PointRule',
|
||||
],
|
||||
],
|
||||
|
||||
'subscribe' => [
|
||||
],
|
||||
];
|
||||
20
addon/pointcash/config/info.php
Executable file
20
addon/pointcash/config/info.php
Executable file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
return [
|
||||
'name' => 'pointcash',
|
||||
'title' => '积分抵现',
|
||||
'description' => '下单时积分可抵部分现金',
|
||||
'type' => 'tool', //插件类型 system :系统插件(自动安装), promotion:扩展营销插件 tool:工具插件
|
||||
'status' => 1,
|
||||
'author' => '',
|
||||
'version' => '5.5.3',
|
||||
'version_no' => '553250709001',
|
||||
'content' => '',
|
||||
];
|
||||
19
addon/pointcash/config/menu_shop.php
Executable file
19
addon/pointcash/config/menu_shop.php
Executable file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | 平台端菜单设置
|
||||
// +----------------------------------------------------------------------
|
||||
return [
|
||||
[
|
||||
'name' => 'PROMOTION_POINGCASH',
|
||||
'title' => '积分抵现',
|
||||
'url' => 'pointcash://shop/config/index',
|
||||
'parent' => 'PROMOTION_CENTER',
|
||||
'is_show' => 1,
|
||||
'is_control' => 1,
|
||||
'is_icon' => 0,
|
||||
'picture' => 'addon/pointcash/shop/view/public/img/point_site.png',
|
||||
'picture_select' => '',
|
||||
'sort' => 100,
|
||||
]
|
||||
|
||||
];
|
||||
25
addon/pointcash/event/Install.php
Executable file
25
addon/pointcash/event/Install.php
Executable file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\pointcash\event;
|
||||
|
||||
/**
|
||||
* 应用安装
|
||||
*/
|
||||
class Install
|
||||
{
|
||||
/**
|
||||
* 执行安装
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
return success();
|
||||
}
|
||||
}
|
||||
37
addon/pointcash/event/MemberAccountFromType.php
Executable file
37
addon/pointcash/event/MemberAccountFromType.php
Executable file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\pointcash\event;
|
||||
|
||||
/**
|
||||
* 会员账户变化来源类型
|
||||
*/
|
||||
class MemberAccountFromType
|
||||
{
|
||||
|
||||
public function handle($data)
|
||||
{
|
||||
$from_type = [
|
||||
'point' => [
|
||||
'pointcash' => [
|
||||
'type_name' => '积分抵现',
|
||||
'type_url' => '',
|
||||
],
|
||||
]
|
||||
];
|
||||
if ($data == '') {
|
||||
return $from_type;
|
||||
} else {
|
||||
return $from_type[$data] ?? [];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
34
addon/pointcash/event/PointRule.php
Executable file
34
addon/pointcash/event/PointRule.php
Executable file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\pointcash\event;
|
||||
|
||||
use addon\pointcash\model\Config;
|
||||
|
||||
/**
|
||||
* 积分规则
|
||||
*/
|
||||
class PointRule
|
||||
{
|
||||
|
||||
public function handle($data)
|
||||
{
|
||||
$info = (new Config())->getPointCashConfig($data['site_id'])['data'];
|
||||
|
||||
$data = [
|
||||
'title' => '积分抵现',
|
||||
'content' => !$info['is_use'] || !$info['value']['cash_rate'] ? '-' : $info['value']['cash_rate'] . "积分可抵1元",
|
||||
'url' => 'pointcash://shop/config/index',
|
||||
'update_time' => $info['modify_time']
|
||||
];
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
95
addon/pointcash/event/ShowPromotion.php
Executable file
95
addon/pointcash/event/ShowPromotion.php
Executable file
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\pointcash\event;
|
||||
|
||||
use addon\pointcash\model\Config;
|
||||
|
||||
/**
|
||||
* 活动展示
|
||||
*/
|
||||
class ShowPromotion
|
||||
{
|
||||
public $promotion_type = 'unlimited_time';
|
||||
|
||||
/**
|
||||
* 活动展示
|
||||
* @param array $params
|
||||
* @return array
|
||||
*/
|
||||
public function handle($params = [])
|
||||
{
|
||||
$data = [
|
||||
|
||||
'admin' => [
|
||||
|
||||
],
|
||||
'shop' => [
|
||||
[
|
||||
//插件名称
|
||||
'name' => 'pointcash',
|
||||
//展示分类(根据平台端设置,admin(平台营销),shop:店铺营销,member:会员营销, tool:应用工具)
|
||||
'show_type' => 'shop',
|
||||
//展示主题
|
||||
'title' => '积分抵现',
|
||||
//展示介绍
|
||||
'description' => '下单时积分抵扣现金',
|
||||
//展示图标
|
||||
'icon' => 'addon/pointcash/icon.png',
|
||||
//跳转链接
|
||||
'url' => 'pointcash://shop/config/index',
|
||||
'summary' => $this->summary($params)
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 营销活动概况
|
||||
* @param $params
|
||||
* @return array
|
||||
*/
|
||||
private function summary($params)
|
||||
{
|
||||
if (empty($params)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
if(isset($params['promotion_type']) && $params['promotion_type'] != $this->promotion_type){
|
||||
return [];
|
||||
}
|
||||
|
||||
if (isset($params[ 'count' ]) || isset($params[ 'summary' ])) $config = ( new Config() )->getPointCashConfig($params[ 'site_id' ])[ 'data' ];
|
||||
//获取活动数量
|
||||
if (isset($params[ 'count' ])) {
|
||||
return [
|
||||
'count' => $config[ 'is_use' ]
|
||||
];
|
||||
}
|
||||
|
||||
//获取活动概况,需要获取开始时间与结束时间
|
||||
|
||||
if (isset($params[ 'summary' ])) {
|
||||
$value = $config[ 'value' ];
|
||||
return [
|
||||
'unlimited_time' => [
|
||||
'status' => $config[ 'is_use' ],
|
||||
'detail' => empty($value[ 'cash_rate' ]) ? '未配置活动' : $value[ 'cash_rate' ] . '积分可抵1元',
|
||||
'switch_type' => empty($value[ 'cash_rate' ]) ? 'jump' : 'switch',
|
||||
'config_key' => 'POINTCASH_CONFIG'
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
25
addon/pointcash/event/UnInstall.php
Executable file
25
addon/pointcash/event/UnInstall.php
Executable file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\pointcash\event;
|
||||
|
||||
/**
|
||||
* 应用卸载
|
||||
*/
|
||||
class UnInstall
|
||||
{
|
||||
/**
|
||||
* 执行卸载
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
return error("系统插件不能删除");
|
||||
}
|
||||
}
|
||||
BIN
addon/pointcash/icon.png
Executable file
BIN
addon/pointcash/icon.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
58
addon/pointcash/model/Config.php
Executable file
58
addon/pointcash/model/Config.php
Executable file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\pointcash\model;
|
||||
|
||||
use app\model\system\Config as ConfigModel;
|
||||
use app\model\BaseModel;
|
||||
|
||||
/**
|
||||
* 积分抵现配置
|
||||
*/
|
||||
class Config extends BaseModel
|
||||
{
|
||||
/**
|
||||
* 积分抵现设置
|
||||
* @param $data
|
||||
* @param $site_id
|
||||
* @param string $app_module
|
||||
* @return array
|
||||
*/
|
||||
public function setPointCashConfig($data, $is_use, $site_id, $app_module = 'shop')
|
||||
{
|
||||
$config = new ConfigModel();
|
||||
$res = $config->setConfig($data, '积分抵现', $is_use, [ [ 'site_id', '=', $site_id ], [ 'app_module', '=', $app_module ], [ 'config_key', '=', 'POINTCASH_CONFIG' ] ]);
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取积分抵现配置
|
||||
* @param $site_id
|
||||
* @param string $app_module
|
||||
* @return array
|
||||
*/
|
||||
public function getPointCashConfig($site_id, $app_module = 'shop')
|
||||
{
|
||||
$config = new ConfigModel();
|
||||
$res = $config->getConfig([ [ 'site_id', '=', $site_id ], [ 'app_module', '=', $app_module ], [ 'config_key', '=', 'POINTCASH_CONFIG' ] ]);
|
||||
if (empty($res[ 'data' ][ 'value' ])) {
|
||||
//默认值设置
|
||||
$res[ 'data' ][ 'value' ] = [
|
||||
'cash_rate' => 0, // 抵现比率
|
||||
'is_limit' => 0, // 是否限制订单金额门槛
|
||||
'limit' => 0.00, // 订单金额门槛
|
||||
'is_limit_use' => 0, // 是否限制使用上限
|
||||
'type' => 0, // 限制类型 0:固定金额 1:订单百分比
|
||||
'max_use' => 0 // 最大可用
|
||||
];
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
45
addon/pointcash/shop/controller/Config.php
Executable file
45
addon/pointcash/shop/controller/Config.php
Executable file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\pointcash\shop\controller;
|
||||
|
||||
use app\shop\controller\BaseShop;
|
||||
use addon\pointcash\model\Config as ConfigModel;
|
||||
|
||||
/**
|
||||
* 积分抵现
|
||||
* @author Administrator
|
||||
*
|
||||
*/
|
||||
class Config extends BaseShop
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$config = new ConfigModel();
|
||||
if (request()->isJson()) {
|
||||
$data = [
|
||||
'cash_rate' => input('cash_rate', 0), // 抵现比率
|
||||
'is_limit' => input('is_limit', 0), // 是否限制订单金额门槛
|
||||
'limit' => input('limit', 0.00), // 订单金额门槛
|
||||
'is_limit_use' => input('is_limit_use', 0), // 是否限制使用上限
|
||||
'type' => input('type', 0), // 限制类型 0:固定金额 1:订单百分比
|
||||
'max_use' => input('max_use', 0) // 最大可用
|
||||
];
|
||||
$is_use = input('is_use', 0);
|
||||
$res = $config->setPointCashConfig($data, $is_use, $this->site_id);
|
||||
return $res;
|
||||
} else {
|
||||
$info = $config->getPointCashConfig($this->site_id);
|
||||
$this->assign('config', $info[ 'data' ][ 'value' ]);
|
||||
$this->assign('is_use', $info['data']['is_use']);
|
||||
return $this->fetch('config/index');
|
||||
}
|
||||
}
|
||||
}
|
||||
196
addon/pointcash/shop/view/config/index.html
Executable file
196
addon/pointcash/shop/view/config/index.html
Executable file
@@ -0,0 +1,196 @@
|
||||
<style type="text/css">
|
||||
.limit .layui-input{display: inline-block;}
|
||||
.limit .layui-form-mid{float: none;margin-right: 0}
|
||||
.limit .layui-form-radio{padding: 0;margin: 0;}
|
||||
.limit .layui-input[disabled]{background: #eee;cursor:not-allowed}
|
||||
</style>
|
||||
|
||||
<div class="layui-form form-wrap">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>积分抵现:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" name="is_use" value="1" lay-filter="is_use" lay-skin="switch" {if condition="$is_use == 1"} checked {/if} >
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>积分抵现比例:</label>
|
||||
<div class="layui-input-inline limit">
|
||||
<input type="number" name="cash_rate" value="{$config.cash_rate}" lay-verify="cash_rate" autocomplete="off" class="layui-input len-short">
|
||||
<div class="layui-form-mid">积分可抵1元</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>订单金额门槛:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="radio" name="is_limit" value="0" title="不限制" lay-filter="is_limit" {if condition="$config.is_limit == 0"}checked{/if}>
|
||||
<input type="radio" name="is_limit" value="1" title="限制" lay-filter="is_limit" {if condition="$config.is_limit == 1"}checked{/if}>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item {if condition='$config.is_limit == 0'}layui-hide{/if} is-limit">
|
||||
<label class="layui-form-label"></label>
|
||||
<div class="layui-input-block limit">
|
||||
<div class="layui-form-mid">订单金额超出</div>
|
||||
<input type="number" name="limit" value="{$config.limit}" lay-verify="" autocomplete="off" class="layui-input len-short">
|
||||
<div class="layui-form-mid">元,可使用积分抵现</div>
|
||||
</div>
|
||||
<!-- <div class="word-aux">
|
||||
<p>订单金额最低为1元</p>
|
||||
</div> -->
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>抵现金额上限:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="radio" name="is_limit_use" value="0" title="不限制" lay-filter="is_limit_use" {if condition="$config.is_limit_use == 0"}checked{/if}>
|
||||
<input type="radio" name="is_limit_use" value="1" title="限制" lay-filter="is_limit_use" {if condition="$config.is_limit_use == 1"}checked{/if}>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item {if condition='$config.is_limit_use == 0'}layui-hide{/if} is-limit-use">
|
||||
<label class="layui-form-label"></label>
|
||||
<div class="layui-input-block limit">
|
||||
<div>
|
||||
<input type="radio" name="type" value="0" lay-filter="type" {if condition="$config.type == 0"}checked{/if}>
|
||||
<div class="layui-form-mid">每笔订单最多抵扣</div>
|
||||
<input type="number" name="money"
|
||||
{if condition="$config.type == 0"} value="{$config.max_use}"{else/} value="{$config.max_use}" disabled{/if}
|
||||
{if condition="$config.type == 0 && $config.is_limit_use == 1"} lay-verify="money" {else/} lay-verify="" {/if}
|
||||
autocomplete="off" class="layui-input len-short">
|
||||
<div class="layui-form-mid">元</div>
|
||||
</div>
|
||||
<div style="margin-top: 10px;">
|
||||
<input type="radio" name="type" value="1" lay-filter="type" {if condition="$config.type == 1"}checked{/if}>
|
||||
<div class="layui-form-mid">每笔订单最多抵扣订单金额的</div>
|
||||
<input type="number" name="ratio"
|
||||
{if condition="$config.type == 1"} value="{$config.max_use}"{else/} value="{$config.max_use}" disabled lay-verify=""{/if}
|
||||
{if condition="$config.type == 1 && $config.is_limit_use == 1"} lay-verify="ratio" {else/} lay-verify="" {/if}
|
||||
autocomplete="off" class="layui-input len-short" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')">
|
||||
<div class="layui-form-mid">%</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="backPromotionIndex()">返回</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
layui.use(['form', 'laydate'], function() {
|
||||
var form = layui.form,repeat_flag = false; //防重复标识
|
||||
|
||||
/**
|
||||
* 表单验证
|
||||
*/
|
||||
form.verify({
|
||||
cash_rate: function(value){
|
||||
if (!/[\S]+/.test(value)) {
|
||||
return '请输入积分抵现比例';
|
||||
}
|
||||
if (Number(value) <= 0) {
|
||||
return '积分抵现比不能小于等于0';
|
||||
}
|
||||
},
|
||||
limit: function(value) {
|
||||
if (!/[\S]+/.test(value)) {
|
||||
return '请输入订单金额';
|
||||
}
|
||||
if (Number(value) <= 1) {
|
||||
return '订单金额不能小于1元';
|
||||
}
|
||||
|
||||
var arrMen = value.split(".");
|
||||
var val = 0;
|
||||
if (arrMen.length == 2) {
|
||||
val = arrMen[1];
|
||||
}
|
||||
if (val.length > 2) {
|
||||
return '订单金额最多保留两位小数';
|
||||
}
|
||||
},
|
||||
money: function(value){
|
||||
if (!/[\S]+/.test(value)) {
|
||||
return '请输入每单最大可抵金额';
|
||||
}
|
||||
if (Number(value) <= 0) {
|
||||
return '可抵金额不能小于等于0元';
|
||||
}
|
||||
var arrMen = value.split(".");
|
||||
var val = 0;
|
||||
if (arrMen.length == 2) {
|
||||
val = arrMen[1];
|
||||
}
|
||||
if (val.length > 2) {
|
||||
return '可抵金额最多保留两位小数';
|
||||
}
|
||||
},
|
||||
ratio: function(value){
|
||||
if (!/[\S]+/.test(value)) {
|
||||
return '请输入每单最大抵现比率';
|
||||
}
|
||||
if (Number(value) <= 0 || Number(value) > 100) {
|
||||
return '抵现比率需在1-100之间';
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
form.on('radio(is_limit)', function(data){
|
||||
if (data.value == 1) {
|
||||
$(".is-limit").removeClass("layui-hide");
|
||||
$("[name='limit']").attr("lay-verify", 'limit');
|
||||
} else {
|
||||
$(".is-limit").addClass("layui-hide");
|
||||
$("[name='limit']").removeAttr("lay-verify");
|
||||
}
|
||||
});
|
||||
|
||||
form.on('radio(is_limit_use)', function(data){
|
||||
if (data.value == 1) {
|
||||
$(".is-limit-use").removeClass("layui-hide");
|
||||
} else {
|
||||
$(".is-limit-use").addClass("layui-hide");
|
||||
$("[name='ratio'],[name='money']").removeAttr("lay-verify");
|
||||
}
|
||||
});
|
||||
|
||||
form.on('radio(type)', function(data){
|
||||
if (data.value == 1) {
|
||||
$("[name='ratio']").prop({'disabled': false, 'lay-verify': 'ratio'});
|
||||
$("[name='money']").prop({'disabled': true, 'lay-verify': ''});
|
||||
} else {
|
||||
$("[name='money']").prop({'disabled': false, 'lay-verify': 'ratio'});
|
||||
$("[name='ratio']").prop({'disabled': true, 'lay-verify': ''});
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 监听提交
|
||||
*/
|
||||
form.on('submit(save)', function(data){
|
||||
data.field.max_use = data.field.type == 0 ? data.field.money : data.field.ratio;
|
||||
|
||||
if(repeat_flag) return;
|
||||
repeat_flag = true;
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
dataType: 'JSON',
|
||||
url: ns.url("pointcash://shop/config/index"),
|
||||
data: data.field,
|
||||
async: false,
|
||||
success: function(res){
|
||||
repeat_flag = false;
|
||||
layer.msg(res.message);
|
||||
}
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
function backPromotionIndex() {
|
||||
location.hash = ns.hash("shop/promotion/index");
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user