增加微信抽奖活动
145
app/data/controller/LuckdrawConfig.php
Normal file
@ -0,0 +1,145 @@
|
||||
<?php
|
||||
|
||||
namespace app\data\controller;
|
||||
|
||||
use app\wechat\service\WechatService;
|
||||
use think\admin\Controller;
|
||||
use think\admin\extend\CodeExtend;
|
||||
|
||||
/**
|
||||
* 抽奖活动配置
|
||||
* Class LuckdrawConfig
|
||||
* @package app\data\controller
|
||||
*/
|
||||
class LuckdrawConfig extends Controller
|
||||
{
|
||||
/**
|
||||
* 绑定数据表
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'ActivityLuckdrawConfig';
|
||||
|
||||
/**
|
||||
* 抽奖活动配置
|
||||
* @auth true
|
||||
* @menu true
|
||||
* @throws \think\Exception
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @throws \think\exception\DbException
|
||||
* @throws \think\exception\PDOException
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
if ($this->request->get('action') === 'qrc') try {
|
||||
[$wechat, $code] = [WechatService::WeChatQrcode(), $this->request->get('code', '')];
|
||||
$short = $wechat->shortUrl(url("@data/api.luckdraw/index/code/{$code}", [], false, true)->build());
|
||||
$result = $wechat->create("reply#text:活动地址:\n{$short['short_url']}");
|
||||
$this->success('生成二维码成功!', "javascript:$.previewImage('{$wechat->url($result['ticket'])}')");
|
||||
} catch (\think\exception\HttpResponseException $exception) {
|
||||
throw $exception;
|
||||
} catch (\Exception $exception) {
|
||||
$this->error("生成二维码失败,请稍候再试!<br> {$exception->getMessage()}");
|
||||
}
|
||||
$this->title = '抽奖活动管理';
|
||||
$query = $this->_query($this->table)->like('code,name')->equal('status');
|
||||
$query->dateBetween('create_at')->where(['deleted' => 0])->order('sort desc,id desc')->page();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加抽奖活动
|
||||
* @auth true
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$this->title = '添加抽奖活动';
|
||||
$this->_form($this->table, 'form', 'code');
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑抽奖活动
|
||||
* @auth true
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$this->title = '编辑抽奖活动';
|
||||
$this->_form($this->table, 'form', 'code');
|
||||
}
|
||||
|
||||
/**
|
||||
* 表单数据处理
|
||||
* @param array $vo
|
||||
* @throws \think\Exception
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @throws \think\exception\DbException
|
||||
* @throws \think\exception\PDOException
|
||||
*/
|
||||
protected function _form_filter(array &$vo)
|
||||
{
|
||||
$vo['code'] = $vo['code'] ?? CodeExtend::uniqidDate(16, 'A');
|
||||
if ($this->request->isGet()) {
|
||||
$this->prizes = $this->app->db->name('ActivityLuckdrawPrize')->where(['deleted' => 0, 'status' => 1])->select()->toArray();
|
||||
$this->selectPrizes = $this->app->db->name('ActivityLuckdrawConfigRecord')->where(['code' => $vo['code']])->select()->toArray();
|
||||
} elseif ($this->request->isPost()) {
|
||||
[$post, $records] = [$this->request->post(), []];
|
||||
if (empty($post['cover'])) $this->error('活动图片不能为空!');
|
||||
if (empty($post['prize_code']) || !is_array($post['prize_code'])) $this->error('请配置奖品信息!');
|
||||
$prizes = $this->app->db->name('ActivityLuckdrawPrize')->whereIn('code', $post['prize_code'])->select();
|
||||
foreach (array_keys($post['prize_code']) as $key) foreach ($prizes as $pz) {
|
||||
if (intval($pz['code']) === intval($post['prize_code'][$key])) $records[] = [
|
||||
'code' => $vo['code'],
|
||||
'prize_code' => $pz['code'],
|
||||
'prize_name' => $pz['name'],
|
||||
'prize_cover' => $pz['cover'],
|
||||
'prize_num' => $post['prize_num'][$key],
|
||||
'prize_rate' => $post['prize_rate'][$key],
|
||||
'prize_level' => $post['prize_level'][$key],
|
||||
];
|
||||
}
|
||||
$this->app->db->name('ActivityLuckdrawConfigRecord')->where(['code' => $vo['code']])->delete();
|
||||
$this->app->db->name('ActivityLuckdrawConfigRecord')->insertAll($records);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存成功后的处理
|
||||
* @param boolean $result
|
||||
*/
|
||||
protected function _form_result(bool $result)
|
||||
{
|
||||
if ($result) {
|
||||
$this->success('活动配置成功!', 'javascript:history.back()');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改活动状态
|
||||
* @auth true
|
||||
* @throws \think\db\exception\DbException
|
||||
*/
|
||||
public function state()
|
||||
{
|
||||
$this->_save($this->table, $this->_vali([
|
||||
'status.in:0,1' => '状态值范围异常!',
|
||||
'status.require' => '状态值不能为空!',
|
||||
]));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除抽奖活动
|
||||
* @auth true
|
||||
* @throws \think\db\exception\DbException
|
||||
*/
|
||||
public function remove()
|
||||
{
|
||||
$this->_delete($this->table);
|
||||
}
|
||||
|
||||
}
|
94
app/data/controller/LuckdrawPrize.php
Normal file
@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
namespace app\data\controller;
|
||||
|
||||
use think\admin\Controller;
|
||||
use think\admin\extend\CodeExtend;
|
||||
|
||||
/**
|
||||
* 活动奖品管理
|
||||
* Class LuckdrawPrize
|
||||
* @package app\data\controller
|
||||
*/
|
||||
class LuckdrawPrize extends Controller
|
||||
{
|
||||
/**
|
||||
* 绑定数据表
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'ActivityLuckdrawPrize';
|
||||
|
||||
/**
|
||||
* 活动奖品管理
|
||||
* @auth true
|
||||
* @menu true
|
||||
* @throws \think\Exception
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @throws \think\exception\DbException
|
||||
* @throws \think\exception\PDOException
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$this->title = '活动奖品管理';
|
||||
$query = $this->_query($this->table)->like('code,name');
|
||||
$query->equal('status')->dateBetween('create_at')->page();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加活动奖品
|
||||
* @auth true
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$this->_form($this->table, 'form', 'code');
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑活动奖品
|
||||
* @auth true
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$this->_form($this->table, 'form', 'code');
|
||||
}
|
||||
|
||||
/**
|
||||
* 表单数据处理
|
||||
* @param array $data
|
||||
*/
|
||||
protected function _form_filter(array &$data)
|
||||
{
|
||||
$data['code'] = $data['code'] ?? CodeExtend::uniqidNumber(16, 'P');
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改奖品状态
|
||||
* @auth true
|
||||
* @throws \think\db\exception\DbException
|
||||
*/
|
||||
public function state()
|
||||
{
|
||||
$this->_save($this->table, $this->_vali([
|
||||
'status.in:0,1' => '状态值范围异常!',
|
||||
'status.require' => '状态值不能为空!',
|
||||
]));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除活动奖品
|
||||
* @auth true
|
||||
* @throws \think\db\exception\DbException
|
||||
*/
|
||||
public function remove()
|
||||
{
|
||||
$this->_delete($this->table);
|
||||
}
|
||||
|
||||
}
|
55
app/data/controller/LuckdrawRecord.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace app\data\controller;
|
||||
|
||||
use think\admin\Controller;
|
||||
|
||||
/**
|
||||
* 奖品领取记录
|
||||
* Class LuckdrawRecord
|
||||
* @package app\activity\controller
|
||||
*/
|
||||
class LuckdrawRecord extends Controller
|
||||
{
|
||||
/**
|
||||
* 绑定数据表
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'ActivityLuckdrawRecord';
|
||||
|
||||
/**
|
||||
* 中奖管理
|
||||
* @auth true
|
||||
* @menu true
|
||||
* @throws \think\Exception
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @throws \think\exception\DbException
|
||||
* @throws \think\exception\PDOException
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$this->title = '中奖管理';
|
||||
$query = $this->_query($this->table)->like('username,prize_name,prize_level');
|
||||
$query->equal('uncode_status,code')->dateBetween('create_at,uncode_datetime')->page();
|
||||
}
|
||||
|
||||
/**
|
||||
* 页面数据处理
|
||||
* @param array $data
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
protected function _page_filter(array &$data)
|
||||
{
|
||||
$this->prizes = $this->app->db->name('ActivityLuckdrawConfig')->where(['deleted' => 0])->order('id desc')->select()->toArray();
|
||||
$members = $this->app->db->name('ActivityLuckdrawMember')->whereIn('id', array_unique(array_column($data, 'mid')))->column('*', 'mid');
|
||||
$acitves = $this->app->db->name('ActivityLuckdrawConfig')->whereIn('code', array_unique(array_column($data, 'code')))->column('*', 'code');
|
||||
foreach ($data as &$vo) {
|
||||
$vo['info'] = $acitves[$vo['code']] ?? [];
|
||||
$vo['member'] = $members[$vo['mid']] ?? [];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
183
app/data/controller/api/Luckdraw.php
Normal file
@ -0,0 +1,183 @@
|
||||
<?php
|
||||
|
||||
namespace app\data\controller\api;
|
||||
|
||||
use app\wechat\service\WechatService;
|
||||
use think\admin\Controller;
|
||||
|
||||
/**
|
||||
* 抽奖活动管理
|
||||
* Class Luckdraw
|
||||
* @package app\data\controller\wap
|
||||
*/
|
||||
class Luckdraw extends Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* 当前活动
|
||||
* @var array
|
||||
*/
|
||||
protected $vo;
|
||||
|
||||
/**
|
||||
* 活动编号
|
||||
* @var string
|
||||
*/
|
||||
protected $code;
|
||||
|
||||
/**
|
||||
* 当前会员数据
|
||||
* @var array
|
||||
*/
|
||||
protected $member;
|
||||
|
||||
/**
|
||||
* 当前中奖记录
|
||||
* @var array
|
||||
*/
|
||||
protected $record;
|
||||
|
||||
/**
|
||||
* 活动规则
|
||||
* @var string
|
||||
*/
|
||||
protected $rules;
|
||||
|
||||
/**
|
||||
* 控制器初始化
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
* @throws \think\Exception
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
protected function initialize()
|
||||
{
|
||||
$this->code = $this->request->param('code');
|
||||
if (empty($this->code)) $this->error('活动编号不能为空!');
|
||||
// 微信网页授权
|
||||
$this->jsoptin = json_encode(WechatService::instance()->getWebJssdkSign(), 256);
|
||||
$this->openid = WechatService::instance()->getWebOauthInfo($this->request->url(true), 0, true)['openid'];
|
||||
// 活动数据初始化
|
||||
$map = ['code' => $this->code, 'deleted' => 0];
|
||||
$this->vo = $this->app->db->name('ActivityLuckdrawConfig')->where($map)->find();
|
||||
if (empty($this->vo)) $this->error('活动不存在,请通过邀请二维码进入!');
|
||||
// 活动会员信息
|
||||
$map = ['openid' => $this->openid];
|
||||
$this->member = $this->app->db->name('ActivityLuckdrawMember')->where($map)->find();
|
||||
// 会员中奖数据
|
||||
$map = ['mid' => $this->member['id'], 'code' => $this->vo['code']];
|
||||
$this->record = $this->app->db->name('ActivityLuckdrawRecord')->where($map)->find();
|
||||
// 抽奖活动规则
|
||||
$this->rules = explode("\n", $this->vo['content']);
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入活动列表
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$map = [['prize_code', '<>', ''], ['code', '=', $this->vo['code']]];
|
||||
$this->records = $this->app->db->name('ActivityLuckdrawRecord')->where($map)->order('id desc')->select()->toArray();
|
||||
foreach ($this->records as &$vo) $vo['username'] = mb_substr($vo['username'], 0, 1) . '**';
|
||||
$this->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户信息录入
|
||||
* @throws \think\Exception
|
||||
* @throws \think\exception\PDOException
|
||||
*/
|
||||
public function info()
|
||||
{
|
||||
$data = $this->_vali([
|
||||
'openid.value' => $this->openid,
|
||||
'username.require' => '请输入您的姓名!',
|
||||
'phone.require' => '请输入您的手机!',
|
||||
'phone.mobile' => '请输入正确的手机号!',
|
||||
]);
|
||||
if (data_save('ActivityLuckdrawMember', $data, 'openid')) {
|
||||
$this->success('信息录入成功,可以进行抽奖了!');
|
||||
}
|
||||
$this->error('信息录入失败,请稍候再试!');
|
||||
}
|
||||
|
||||
/**
|
||||
* 进行抽奖
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function prize()
|
||||
{
|
||||
if ($this->record) $this->error('已经参与抽奖,不能再抽奖了!');
|
||||
/* 统计已经发出的奖品 */
|
||||
$query = $this->app->db->name('ActivityLuckdrawRecord')->group('prize_code');
|
||||
$useds = $query->where(['code' => $this->code])->column('count(1) count', 'prize_code');
|
||||
/* 统计活动的奖品数据 */
|
||||
$query = $this->app->db->name('ActivityLuckdrawConfigRecord');
|
||||
$query->field('prize_num,prize_rate,prize_level,prize_code');
|
||||
$prizes = $query->where(['code' => $this->code])->select()->toArray();
|
||||
$prizesNum = array_combine(array_column($prizes, 'prize_code'), array_pad([], count($prizes), 0));
|
||||
foreach ($prizes as $item) $prizesNum[$item['prize_code']] += $item['prize_num'];
|
||||
/* 计算抽奖的中奖数据 */
|
||||
[$prize, $tempRate, $tempNumber] = [[], 0, rand(1, 1000000) / 10000];
|
||||
foreach ($prizes as $key => $item) {
|
||||
if (isset($useds[$item['prize_code']]) && $useds[$item['prize_code']] >= $prizesNum[$item['prize_code']]) {
|
||||
unset($prizes[$key]);
|
||||
continue 1;
|
||||
}
|
||||
if ($tempNumber <= ($tempRate += $item['prize_rate'])) {
|
||||
$prize = $item;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (empty($prize)) {
|
||||
$data = [
|
||||
'mid' => $this->member['id'],
|
||||
'username' => $this->member['username'],
|
||||
'code' => $this->vo['code'],
|
||||
'prize_level' => '未中奖',
|
||||
'prize_code' => '',
|
||||
];
|
||||
if ($this->app->db->name('ActivityLuckdrawRecord')->insert($data) !== false) {
|
||||
$this->success('抱歉没有抽到奖品哦!');
|
||||
}
|
||||
} else {
|
||||
$_prize = $this->app->db->name('ActivityLuckdrawPrize')->where(['code' => $prize['prize_code']])->find();
|
||||
$data = [
|
||||
'mid' => $this->member['id'],
|
||||
'username' => $this->member['username'],
|
||||
'code' => $this->code,
|
||||
'prize_level' => $prize['prize_level'],
|
||||
'prize_code' => $_prize['code'],
|
||||
'prize_name' => $_prize['name'],
|
||||
'prize_cover' => $_prize['cover'],
|
||||
'prize_remark' => $_prize['remark'],
|
||||
'prize_express' => $_prize['express'],
|
||||
];
|
||||
if ($this->app->db->name('ActivityLuckdrawRecord')->insert($data) !== false) {
|
||||
$this->success('奖品抽取成功!', $data);
|
||||
}
|
||||
}
|
||||
$this->error('抽奖失败,请稍候再试!');
|
||||
}
|
||||
|
||||
/**
|
||||
* 奖品记录核销
|
||||
* @throws \think\db\exception\DbException
|
||||
*/
|
||||
public function used()
|
||||
{
|
||||
$map = $this->_vali(['uncode.require' => '奖品核销码不能为空!']);
|
||||
if ($this->vo['uncode'] !== $map['uncode']) $this->error('核销码错误,请重新输入!');
|
||||
if ($this->vo['uncode_status'] > 0) $this->error('该奖品已经核销,请勿重复核销!');
|
||||
$data = ['uncode_code' => $map['uncode'], 'uncode_status' => 1, 'uncode_datatime' => date('Y-m-d H:i:s')];
|
||||
$result = $this->app->db->name('ActivityLuckdrawRecord')->where(['id' => $this->record['id']])->update($data);
|
||||
$result !== false ? $this->success('奖品核销成功!') : $this->error('奖品核销失败,请稍候再试!');
|
||||
}
|
||||
}
|
4735
app/data/data.sql
243
app/data/view/api/luckdraw/index.html
Normal file
@ -0,0 +1,243 @@
|
||||
<!doctype html>
|
||||
<html lang="zh">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>{$vo.title|default=''}</title>
|
||||
<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
|
||||
<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,initial-scale=1.0,width=device-width">
|
||||
<link rel="stylesheet" href="__ROOT__/static/luckdraw/css/style.css">
|
||||
<link rel="stylesheet" href="__ROOT__/static/luckdraw/lib/swiper/swiper.min.css">
|
||||
<script src="__ROOT__/static/plugs/jquery/jquery.min.js"></script>
|
||||
<script src="__ROOT__/static/luckdraw/layer.mobile/layer.js"></script>
|
||||
<script src="__ROOT__/static/luckdraw/lib/swiper/swiper.min.js"></script>
|
||||
<script src="//res.wx.qq.com/open/js/jweixin-1.4.0.js"></script>
|
||||
<script>
|
||||
window.onresize = function () {
|
||||
this.deviceWidth = document.documentElement.clientWidth;
|
||||
if (this.deviceWidth > 640) this.deviceWidth = 640;
|
||||
document.documentElement.style.fontSize = this.deviceWidth / 7.5 + 'px';
|
||||
};
|
||||
window.onresize();
|
||||
|
||||
var ApiFun = new function () {
|
||||
this.doDraw = function () {
|
||||
|
||||
/* {if empty($member)} */
|
||||
|
||||
document.querySelector('#mask1').className = 'mask show';
|
||||
document.querySelector('.info-dialog').className = 'info-dialog show';
|
||||
|
||||
/* {else} */
|
||||
|
||||
var index = layer.open({type: 2, content: '抽奖中...'});
|
||||
$.post('{:url("@data/api.luckdraw/prize/code/".$vo.code)}', {}, function (ret) {
|
||||
layer.close(index);
|
||||
return location.reload();
|
||||
if (ret.code > 0) return location.reload();
|
||||
return layer.open({
|
||||
content: ret.info, skin: 'msg', time: 2, end: function () {
|
||||
location.reload();
|
||||
}, shade: true
|
||||
});
|
||||
});
|
||||
|
||||
/* {/if} */
|
||||
|
||||
};
|
||||
/* 补充用户数据 */
|
||||
this.doInfo = function () {
|
||||
var phone = $('#phone').val() || '', username = $('#username').val() || '';
|
||||
if (!/.{1}/.test(username)) return layer.open({content: '请输入您的姓名!', skin: 'msg', time: 2, shade: true});
|
||||
if (!/^1\d{10}$/.test(phone)) return layer.open({content: '请输入正确的手机号!', skin: 'msg', time: 2, shade: true});
|
||||
var index = layer.open({type: 2, content: '提交中...', shade: true});
|
||||
$.post('{:url("@data/api.luckdraw/info/code/".$vo.code)}', {phone: phone, username: username}, function (ret) {
|
||||
layer.close(index);
|
||||
if (ret.code > 0) return window.location.reload();
|
||||
return layer.open({content: ret.info, skin: 'msg', time: 2, shade: true});
|
||||
});
|
||||
};
|
||||
|
||||
this.doUsed = function () {
|
||||
var uncode = $('#uncode').val() || '';
|
||||
if (!uncode) return layer.open({content: '请输入核销码再操作!', skin: 'msg', time: 2, shade: true});
|
||||
var index = layer.open({type: 2, content: '正在核销奖品...', shade: true});
|
||||
$.post('{:url("@data/api.luckdraw/used/code/".$vo.code)}', {uncode: uncode}, function (ret) {
|
||||
layer.close(index);
|
||||
if (ret.code > 0) return location.reload();
|
||||
return layer.open({content: ret.info, skin: 'msg', time: 2, shade: true});
|
||||
});
|
||||
}
|
||||
};
|
||||
(function () {
|
||||
wx.config(JSON.parse('{$jsoptin|raw}'));
|
||||
wx.ready(function () {
|
||||
wx.hideAllNonBaseMenuItem();
|
||||
wx.hideMenuItems({
|
||||
menuList: ['updateAppMessageShareData', 'updateTimelineShareData']
|
||||
});
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="page index-page">
|
||||
{if !empty($vo.status) and empty($vo.is_deleted)}
|
||||
<img src="__ROOT__/static/luckdraw/images/bg2.jpg" alt="一尚美术">
|
||||
<div class="page-body">
|
||||
<img onclick="showRule()" class="rule" src="__ROOT__/static/luckdraw/images/rule.png" alt="活动规则">
|
||||
<!-- 抽奖按钮 -->
|
||||
{empty name='record'}
|
||||
<img class="btn" src="__ROOT__/static/luckdraw/images/yu.png" alt="点我抽奖" onclick="ApiFun.doDraw()">
|
||||
{else}
|
||||
<!-- 已中奖的点击按钮变成 查看奖品 -->
|
||||
<img class="btn" src="__ROOT__/static/luckdraw/images/yu1.png" alt="查看奖品" onclick="ApiFun.doDraw()">
|
||||
{/empty}
|
||||
|
||||
<!-- 中奖明细 -->
|
||||
<div class="detail">
|
||||
<img class="title" src="__ROOT__/static/luckdraw/images/t1.png" alt="中奖明细">
|
||||
<div class="swiper-container ls-box">
|
||||
<img class="icon1" src="__ROOT__/static/luckdraw/images/icon1.png" alt="一尚美术">
|
||||
<img class="icon1 icon2" src="__ROOT__/static/luckdraw/images/icon1.png" alt="一尚美术">
|
||||
<ul class="swiper-wrapper">
|
||||
{foreach $records as $vo}
|
||||
<li class="swiper-slide">
|
||||
<div class="ls-title">
|
||||
<span>{$vo.username|default=''}</span>
|
||||
<span>{$vo.prize_level|default='特等奖'}</span>
|
||||
</div>
|
||||
<div class="ls-text">{$vo.prize_title|default=''}</div>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 填写信息 -->
|
||||
{if empty($member)}
|
||||
<div id="mask1" class="mask show" onclick="hideDraw()"></div>
|
||||
<div class="info-dialog show">
|
||||
<h2>填写信息即可参与抽奖哦~</h2>
|
||||
<div class="form">
|
||||
<label>
|
||||
<span>您的姓名:</span>
|
||||
<input id="username" type="text" maxlength="20">
|
||||
</label>
|
||||
<label>
|
||||
<span>手机号码:</span>
|
||||
<input id="phone" type="tel" maxlength="11">
|
||||
</label>
|
||||
</div>
|
||||
<div class="btns">
|
||||
<span onclick="hideDraw()">取消</span>
|
||||
<span onclick="ApiFun.doInfo()">确认</span>
|
||||
</div>
|
||||
</div>
|
||||
{elseif !empty($record)}
|
||||
<!-- 中奖弹窗 -->
|
||||
<div class="luck-mask show">
|
||||
<img onclick="this.parentNode.className='luck-mask'" class="close" src="__ROOT__/static/luckdraw/images/close.png" alt="关闭">
|
||||
<img src="__ROOT__/static/luckdraw/images/luck.png" alt="中奖了">
|
||||
<div class="luck-dialog">
|
||||
{if $record.prize_code neq ''}
|
||||
<h1>{$record.prize_level|default='特等奖'}</h1>
|
||||
<h3>{$record.prize_name|default='未中奖'}</h3>
|
||||
{if empty($record.uncode_status)}
|
||||
<div>
|
||||
<label>
|
||||
<input id="uncode" type="text" placeholder="请输入核销码">
|
||||
</label>
|
||||
<div onclick="ApiFun.doUsed()" class="dialog-btn">确认核销</div>
|
||||
</div>
|
||||
{else}
|
||||
<div class="dialog-btn btn1">奖品已核销</div>
|
||||
{/if}
|
||||
{else}
|
||||
<div class="dialog-btn btn1">未中奖</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- 规则说明 -->
|
||||
<div class="rule-mask">
|
||||
<img onclick="this.parentNode.className='rule-mask'" class="close" src="__ROOT__/static/luckdraw/images/close.png" alt="关闭">
|
||||
<div class="rule-dialog">
|
||||
<h1 class="dialog-title">活动规则</h1>
|
||||
<div class="rule-content">{foreach $rules as $r}<p>{$r}</p>{/foreach}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{else}
|
||||
<script>
|
||||
alert('活动已经结束');
|
||||
wx.ready(function () {
|
||||
wx.closeWindow();
|
||||
});
|
||||
</script>
|
||||
{/if}
|
||||
|
||||
<!-- script -->
|
||||
<script>
|
||||
|
||||
// 显示活动规则
|
||||
function showRule() {
|
||||
document.querySelector('.rule-mask').className = 'rule-mask show';
|
||||
};
|
||||
|
||||
// 显示填写信息弹窗
|
||||
function draw() {
|
||||
document.querySelector('#mask1').className = 'mask show';
|
||||
document.querySelector('.info-dialog').className = 'info-dialog show';
|
||||
};
|
||||
|
||||
// 隐藏填写信息弹窗
|
||||
function hideDraw() {
|
||||
document.querySelector('#mask1').className = 'mask';
|
||||
document.querySelector('.info-dialog').className = 'info-dialog';
|
||||
};
|
||||
|
||||
// 显示中奖
|
||||
function showLuck() {
|
||||
document.querySelector('.luck-mask').className = 'luck-mask show';
|
||||
};
|
||||
|
||||
|
||||
window.onload = function () {
|
||||
var winH = document.body.clientHeight; // 可视区高度
|
||||
var n = 4; // 列表默认个数
|
||||
|
||||
// 根据不同屏幕高度改变列表高度+数据个数
|
||||
if (winH > 720) {
|
||||
n = parseInt(winH / 130);
|
||||
document.querySelector('.index-page .ls-box').style.height = (n * 0.82) + 'rem';
|
||||
}
|
||||
|
||||
// 列表轮播默认参数,默认不自动轮播
|
||||
var option = {
|
||||
direction: 'vertical',
|
||||
slidesPerView: n,
|
||||
};
|
||||
// 列表数据个数
|
||||
var len = document.querySelectorAll('.ls-box li').length;
|
||||
|
||||
// 列表数量大于默认数量 循环+自动轮播
|
||||
if (len > n) {
|
||||
option.autoplay = {
|
||||
delay: 1500,
|
||||
disableOnInteraction: false,
|
||||
}
|
||||
option.loop = true;
|
||||
}
|
||||
// swiper 轮播实例化
|
||||
new Swiper('.swiper-container', option);
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
153
app/data/view/luckdraw_config/form.html
Normal file
@ -0,0 +1,153 @@
|
||||
{extend name="../../admin/view/main"}
|
||||
|
||||
{block name="content"}
|
||||
<table class="layui-hide">
|
||||
<tbody id='add-item-tpl'>
|
||||
<tr>
|
||||
<td class="padding-0">
|
||||
<select name='prize_code[]' class="layui-select full-width border-0" lay-ignore>
|
||||
{foreach $prizes as $prize}
|
||||
<option value="{$prize.code}">{$prize.name}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</td>
|
||||
<td class="nowrap padding-0">
|
||||
<label class="label-required-null">
|
||||
<input name="prize_level[]" placeholder="请输入奖项" required value="特等奖" class="layui-input border-0 text-center">
|
||||
</label>
|
||||
</td>
|
||||
<td class="nowrap padding-0">
|
||||
<label class="label-required-null">
|
||||
<input name="prize_num[]" data-blur-number="0" value="1" class="layui-input border-0 text-center">
|
||||
</label>
|
||||
</td>
|
||||
<td class="nowrap padding-0">
|
||||
<label class="label-required-null">
|
||||
<input name="prize_rate[]" data-blur-number="4" value="0.0001" class="layui-input border-0 text-center inline-block">
|
||||
<span class="absolute font-s14" style='right:10px;width:39px;text-align:center;height:39px;line-height:39px;display:inline-block'>%</span>
|
||||
</label>
|
||||
</td>
|
||||
<td class="nowrap padding-0 text-center">
|
||||
<a onclick="moveUp(this)" class="layui-btn layui-btn-xs layui-icon layui-icon-up"></a>
|
||||
<a onclick="moveDn(this)" class="layui-btn layui-btn-xs layui-icon layui-icon-down"></a>
|
||||
<a onclick="moveRm(this)" class="layui-btn layui-btn-danger layui-btn-xs layui-icon layui-icon-close"></a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<form class="layui-form layui-card" action="{:request()->url()}" data-auto="true" method="post" autocomplete="off">
|
||||
<div class="layui-card-body padding-40 padding-bottom-20">
|
||||
|
||||
<div class="layui-form-item">
|
||||
<span class="color-green font-w7 label-required-prev">活动图片</span>
|
||||
<label class="relative block">
|
||||
<input name="cover" value='{$vo.cover|default=""}' class="layui-input">
|
||||
<a data-file data-field="cover" data-type="png,jpg,gif" class="layui-icon layui-icon-upload input-right-icon"></a>
|
||||
<script>$('[name=cover]').uploadOneImage()</script>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<label class="layui-form-item relative block">
|
||||
<span class="color-green font-w7 label-required-prev">活动名称</span>
|
||||
<input name="name" value='{$vo.name|default=""}' autofocus required placeholder="请输入活动名称" class="layui-input">
|
||||
</label>
|
||||
|
||||
<label class="layui-form-item relative block">
|
||||
<span class="color-green font-w7 label-required-prev">奖品核销码</span>
|
||||
<input name="uncode" value='{$vo.uncode|default=""}' autofocus required placeholder="请输入奖品核销码" class="layui-input">
|
||||
</label>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<span class="color-green font-w7 label-required-prev">活动奖品规则</span>
|
||||
<table class="layui-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="nowrap">奖品名称</th>
|
||||
<th class="nowrap text-center" style="width:200px">奖项名称</th>
|
||||
<th class="nowrap text-center" style="width:120px">奖品数量</th>
|
||||
<th class="nowrap text-center" style="width:100px">中奖率(总概率100%)</th>
|
||||
<th style="width:100px"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="layui-bg-gray">
|
||||
{foreach $selectPrizes as $pz}
|
||||
<tr>
|
||||
<td class="nowrap padding-0">
|
||||
<select name='prize_code[]' class="layui-select full-width border-0" lay-ignore>
|
||||
{foreach $prizes as $prize}
|
||||
{if $pz.prize_code eq $prize.code}
|
||||
<option selected value="{$prize.code}">{$prize.name}</option>
|
||||
{else}
|
||||
<option value="{$prize.code}">{$prize.name}</option>
|
||||
{/if}{/foreach}
|
||||
</select>
|
||||
</td>
|
||||
<td class="nowrap padding-0 relative">
|
||||
<label class="label-required-null">
|
||||
<input name="prize_level[]" placeholder="请输入奖项" required value="{$pz.prize_level|default=''}" class="layui-input text-center border-0">
|
||||
</label>
|
||||
</td>
|
||||
<td class="nowrap padding-0 text-center">
|
||||
<label class="label-required-null">
|
||||
<input name="prize_num[]" data-blur-number="0" value="{$pz.prize_num|default='1'}" class="layui-input border-0 text-center">
|
||||
</label>
|
||||
</td>
|
||||
<td class="nowrap padding-0 text-center">
|
||||
<label class="label-required-null">
|
||||
<input name="prize_rate[]" data-blur-number="4" value="{$pz.prize_rate|default='0.0001'}" class="layui-input border-0 inline-block text-center">
|
||||
<span class="absolute font-s14" style='right:10px;width:39px;text-align:center;height:39px;line-height:39px;display:inline-block'>%</span>
|
||||
</label>
|
||||
</td>
|
||||
<td class="nowrap padding-0 text-center">
|
||||
<a onclick="moveUp(this)" class="layui-btn layui-btn-xs layui-icon layui-icon-up"></a>
|
||||
<a onclick="moveDn(this)" class="layui-btn layui-btn-xs layui-icon layui-icon-down"></a>
|
||||
<a onclick="moveRm(this)" class="layui-btn layui-btn-danger layui-btn-xs layui-icon layui-icon-close"></a>
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
<tr>
|
||||
<td colspan="5"><a onclick="$(this).parents('tr').before($('#add-item-tpl').html()),form.render();" class="layui-btn layui-btn-xs">添加奖项</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<label class="layui-form-item relative block">
|
||||
<span class="color-green font-w7 label-required-prev">活动规则</span>
|
||||
<textarea class="layui-textarea" name="content" placeholder="请输入活动规则">{$vo.content|default=''}</textarea>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="hr-line-dashed"></div>
|
||||
|
||||
<!--{notempty name='vo.code'}-->
|
||||
<input type='hidden' value='{$vo.code}' name='code'>
|
||||
<!--{/notempty}-->
|
||||
|
||||
<div class="layui-form-item text-center">
|
||||
<button class="layui-btn" type='submit'>保存数据</button>
|
||||
<button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消编辑吗?" data-history-back>取消编辑</button>
|
||||
</div>
|
||||
<script>
|
||||
window.form.render();
|
||||
|
||||
function moveRm(that) {
|
||||
$.msg.confirm('确定要移除这个选项吗?', function (index) {
|
||||
$(that).parents('tr').remove(), $.msg.close(index);
|
||||
})
|
||||
}
|
||||
|
||||
function moveUp(that) {
|
||||
this.$item = $(that).parents("tr");
|
||||
if (this.$item.index() > 0) this.$item.prev().before(this.$item);
|
||||
}
|
||||
|
||||
function moveDn(that) {
|
||||
this.$item = $(that).parents("tr");
|
||||
if (this.$item.index() < this.$item.siblings('tr').size()) {
|
||||
this.$item.next().after(this.$item);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</form>
|
||||
{/block}
|
63
app/data/view/luckdraw_config/index.html
Normal file
@ -0,0 +1,63 @@
|
||||
{extend name="../../admin/view/main"}
|
||||
|
||||
{block name="button"}
|
||||
<!--{if auth("add")}-->
|
||||
<button data-open='{:url("add")}' class='layui-btn layui-btn-sm layui-btn-primary'>添加活动</button>
|
||||
<!--{/if}-->
|
||||
<!--{if auth("del")}-->
|
||||
<button data-action='{:url("del")}' data-rule="id#{key}" data-confirm="确定要删除这些活动吗?" class='layui-btn layui-btn-sm layui-btn-primary'>删除活动</button>
|
||||
<!--{/if}-->
|
||||
{/block}
|
||||
|
||||
{block name="content"}
|
||||
<div class="think-box-shadow table-block">
|
||||
{include file='luckdraw_config/index_search'}
|
||||
<table class="layui-table" lay-skin="line">
|
||||
{notempty name='list'}
|
||||
<thead>
|
||||
<tr>
|
||||
<th class='list-table-check-td think-checkbox'>
|
||||
<label><input data-auto-none="" data-check-target='.list-check-box' type='checkbox'></label>
|
||||
</th>
|
||||
<th class='text-left nowrap'>活动编号</th>
|
||||
<th class='text-left nowrap'>活动名称</th>
|
||||
<th class='text-left nowrap'>创建时间</th>
|
||||
<th class='text-left nowrap'>活动状态</th>
|
||||
<th class='text-left nowrap'></th>
|
||||
</tr>
|
||||
</thead>
|
||||
{/notempty}
|
||||
<tbody>
|
||||
{foreach $list as $key=>$vo}
|
||||
<tr>
|
||||
<td class='list-table-check-td think-checkbox'>
|
||||
<input class="list-check-box" value='{$vo.id}' type='checkbox'>
|
||||
</td>
|
||||
<td class='text-left nowrap'>{$vo.code}</td>
|
||||
<td class='text-left nowrap'><i class="fa fa-qrcode fa-lg margin-right-5 pointer" data-load="{:url('index')}?action=qrc&code={$vo.code}" data-time="false"></i>{$vo.name|default=''}</td>
|
||||
<td class='text-left nowrap'>{$vo.create_at|format_datetime|raw}</td>
|
||||
<td class='text-left nowrap'>{eq name='vo.status' value='0'}<span class="layui-badge">已停止</span>{else}<span class="layui-badge layui-bg-green">进行中</span>{/eq}</td>
|
||||
<td class='text-left nowrap'>
|
||||
<!--{if auth("edit")}-->
|
||||
<a class="layui-btn layui-btn-xs" data-title="编辑活动" data-open='{:url("edit")}?code={$vo.code}'>编 辑</a>
|
||||
<!--{/if}-->
|
||||
|
||||
<!--{if $vo.status eq 1 and auth("state")}-->
|
||||
<a class="layui-btn layui-btn-xs layui-btn-warm" data-action="{:url('state')}" data-value="id#{$vo.id};status#0">停 止</a>
|
||||
<!--{/if}-->
|
||||
|
||||
<!--{if $vo.status eq 0 and auth("state")}-->
|
||||
<a class="layui-btn layui-btn-xs layui-btn-warm" data-action="{:url('state')}" data-value="id#{$vo.id};status#1">进 行</a>
|
||||
<!--{/if}-->
|
||||
|
||||
<!--{if auth("remove")}-->
|
||||
<a class="layui-btn layui-btn-xs layui-btn-danger" data-confirm="确定要删除该活动吗?" data-action="{:url('remove')}" data-value="id#{$vo.id}">删 除</a>
|
||||
<!--{/if}-->
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
{empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
|
||||
</div>
|
||||
{/block}
|
40
app/data/view/luckdraw_config/index_search.html
Normal file
@ -0,0 +1,40 @@
|
||||
<fieldset>
|
||||
<legend>条件搜索</legend>
|
||||
<form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">活动编号</label>
|
||||
<label class="layui-input-inline">
|
||||
<input name="code" value="{:input('code','')}" placeholder="请输入活动编号" class="layui-input">
|
||||
</label>
|
||||
</div>
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">活动名称</label>
|
||||
<label class="layui-input-inline">
|
||||
<input name="name" value="{:input('name','')}" placeholder="请输入活动名称" class="layui-input">
|
||||
</label>
|
||||
</div>
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">使用状态</label>
|
||||
<label class="layui-input-inline">
|
||||
<select class="layui-select" name="status">
|
||||
{foreach [''=>'-- 全部 --','0'=>'已停止的活动','1'=>'进行中的活动'] as $k=>$v}
|
||||
{if input('status') eq $k.''}
|
||||
<option selected value="{$k}">{$v}</option>
|
||||
{else}
|
||||
<option value="{$k}">{$v}</option>
|
||||
{/if}{/foreach}
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">创建时间</label>
|
||||
<label class="layui-input-inline">
|
||||
<input data-date-range name="create_at" value="{:input('create_at','')}" placeholder="请选择创建时间" class="layui-input">
|
||||
</label>
|
||||
</div>
|
||||
<div class="layui-form-item layui-inline">
|
||||
<button class="layui-btn layui-btn-primary"><i class="layui-icon"></i> 搜 索</button>
|
||||
</div>
|
||||
</form>
|
||||
<script>form.render()</script>
|
||||
</fieldset>
|
47
app/data/view/luckdraw_prize/form.html
Normal file
@ -0,0 +1,47 @@
|
||||
<form class="layui-form layui-card" action="{:request()->url()}" data-auto="true" method="post" autocomplete="off">
|
||||
<div class="layui-card-body padding-left-40">
|
||||
|
||||
<label class="layui-form-item relative block">
|
||||
<span class="color-green font-w7 label-required-prev">奖品名称</span>
|
||||
<input name="name" autofocus value='{$vo.name|default=""}' required placeholder="请输入奖品名称" class="layui-input">
|
||||
</label>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<span class="color-green font-w7 label-required-prev">是否需要发货</span>
|
||||
{php} $vo['express'] = $vo['express'] ?? 0; {/php}
|
||||
<div class="layui-input">
|
||||
{foreach ['无需发货','需要发货'] as $k=>$v}
|
||||
{if isset($vo.express) and $k eq $vo.express}
|
||||
<label class="think-radio"><input checked name="express" type="radio" value="{$k}" lay-ignore>{$v}</label>
|
||||
{else}
|
||||
<label class="think-radio"><input name="express" type="radio" value="{$k}" lay-ignore>{$v}</label>
|
||||
{/if}{/foreach}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<span class="color-green font-w7 label-required-prev">奖品图片</span>
|
||||
<label class="relative block label-required-null">
|
||||
<input name="cover" value='{$vo.cover|default=""}' required placeholder="请上传奖品图片链接 " class="layui-input">
|
||||
<a data-file data-type="png,jpg,gif" data-field="cover" class="input-right-icon"><i class="layui-icon layui-icon-upload"></i></a>
|
||||
<script>$('[name=cover]').uploadOneImage()</script>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<label class="layui-form-item relative block">
|
||||
<span class="color-green font-w7">奖品描述</span>
|
||||
<textarea name="remark" class="layui-textarea">{$vo.remark|default=""}</textarea>
|
||||
</label>
|
||||
|
||||
<div class="hr-line-dashed"></div>
|
||||
|
||||
<!--{notempty name='vo.code'}-->
|
||||
<input type='hidden' value='{$vo.code}' name='code'>
|
||||
<!--{/notempty}-->
|
||||
|
||||
<div class="layui-form-item text-center">
|
||||
<button class="layui-btn" type='submit'>保存数据</button>
|
||||
<button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消编辑吗?" data-close>取消编辑</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
65
app/data/view/luckdraw_prize/index.html
Normal file
@ -0,0 +1,65 @@
|
||||
{extend name="../../admin/view/main"}
|
||||
|
||||
{block name="button"}
|
||||
<!--{if auth("add")}-->
|
||||
<button data-modal='{:url("add")}' data-title="添加奖品" class='layui-btn layui-btn-sm layui-btn-primary'>添加奖品</button>
|
||||
<!--{/if}-->
|
||||
|
||||
<!--{if auth("del")}-->
|
||||
<button data-action='{:url("del")}' data-rule="id#{key}" data-confirm="确定要删除这些奖品吗?" class='layui-btn layui-btn-sm layui-btn-primary'>删除奖品</button>
|
||||
<!--{/if}-->
|
||||
{/block}
|
||||
|
||||
{block name="content"}
|
||||
<div class="think-box-shadow table-block">
|
||||
{include file='luckdraw_prize/index_search'}
|
||||
<table class="layui-table" lay-skin="line">
|
||||
{notempty name='list'}
|
||||
<thead>
|
||||
<tr>
|
||||
<th class='list-table-check-td think-checkbox'>
|
||||
<label><input data-auto-none data-check-target='.list-check-box' type='checkbox'></label>
|
||||
</th>
|
||||
<th class='text-left nowrap'>奖品编号</th>
|
||||
<th class='text-left nowrap'>奖品名称</th>
|
||||
<th class='text-left nowrap'>创建时间</th>
|
||||
<th class='text-left nowrap'>账号状态</th>
|
||||
<th class='text-left nowrap'></th>
|
||||
</tr>
|
||||
</thead>
|
||||
{/notempty}
|
||||
<tbody>
|
||||
{foreach $list as $key=>$vo}
|
||||
<tr>
|
||||
<td class='list-table-check-td think-checkbox'>
|
||||
<label><input class="list-check-box" value='{$vo.id}' type='checkbox'></label>
|
||||
</td>
|
||||
<td class='text-left nowrap'>{$vo.code|default=''}</td>
|
||||
<td class='text-left nowrap'>{$vo.name|default=''}</td>
|
||||
<td class='text-left nowrap'>{$vo.create_at|format_datetime}</td>
|
||||
<td class='text-left nowrap'>{eq name='vo.status' value='0'}<span class="layui-badge">已禁用</span>{else}<span class="layui-badge layui-bg-green">使用中</span>{/eq}</td>
|
||||
<td class='text-left nowrap'>
|
||||
|
||||
<!--{if auth("edit")}-->
|
||||
<a class="layui-btn layui-btn-xs" data-title="编辑奖品" data-modal='{:url("edit")}?code={$vo.code}'>编 辑</a>
|
||||
<!--{/if}-->
|
||||
|
||||
<!--{if auth('state') and $vo.status eq 1}-->
|
||||
<a class="layui-btn layui-btn-xs layui-btn-warm" data-action="{:url('state')}" data-value="id#{$vo.id};status#0">禁 用</a>
|
||||
<!--{/if}-->
|
||||
|
||||
<!--{if auth("state") and $vo.status eq 0}-->
|
||||
<a class="layui-btn layui-btn-xs layui-btn-warm" data-action="{:url('state')}" data-value="id#{$vo.id};status#1">启 用</a>
|
||||
<!--{/if}-->
|
||||
|
||||
<!--{if auth("remove")}-->
|
||||
<a class="layui-btn layui-btn-xs layui-btn-danger" data-confirm="确定要删除该奖品吗?" data-action="{:url('del')}" data-value="id#{$vo.id}">删 除</a>
|
||||
<!--{/if}-->
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
{empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
|
||||
</div>
|
||||
{/block}
|
40
app/data/view/luckdraw_prize/index_search.html
Normal file
@ -0,0 +1,40 @@
|
||||
<fieldset>
|
||||
<legend>条件搜索</legend>
|
||||
<form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">奖品编号</label>
|
||||
<label class="layui-input-inline">
|
||||
<input name="code" value="{:input('code','')}" placeholder="请输入奖品编号" class="layui-input">
|
||||
</label>
|
||||
</div>
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">奖品名称</label>
|
||||
<label class="layui-input-inline">
|
||||
<input name="name" value="{:input('name','')}" placeholder="请输入奖品名称" class="layui-input">
|
||||
</label>
|
||||
</div>
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">使用状态</label>
|
||||
<div class="layui-input-inline">
|
||||
<select class="layui-select" name="status">
|
||||
{foreach [''=>'-- 全部 --','0'=>'已禁用的奖品','1'=>'使用中的奖品'] as $k=>$v}
|
||||
{if input('status') eq $k.''}
|
||||
<option selected value="{$k}">{$v}</option>
|
||||
{else}
|
||||
<option value="{$k}">{$v}</option>
|
||||
{/if}{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">创建时间</label>
|
||||
<label class="layui-input-inline">
|
||||
<input data-date-range name="create_at" value="{:input('create_at','')}" placeholder="请选择创建时间" class="layui-input">
|
||||
</label>
|
||||
</div>
|
||||
<div class="layui-form-item layui-inline">
|
||||
<button class="layui-btn layui-btn-primary"><i class="layui-icon"></i> 搜 索</button>
|
||||
</div>
|
||||
</form>
|
||||
<script>window.form.render()</script>
|
||||
</fieldset>
|
53
app/data/view/luckdraw_record/index.html
Normal file
@ -0,0 +1,53 @@
|
||||
{extend name="../../admin/view/main"}
|
||||
|
||||
|
||||
{block name="content"}
|
||||
<div class="think-box-shadow table-block">
|
||||
{include file='luckdraw_record/index_search'}
|
||||
<table class="layui-table" lay-skin="line">
|
||||
{notempty name='list'}
|
||||
<thead>
|
||||
<tr>
|
||||
<th class='list-table-check-td think-checkbox'>
|
||||
<input data-auto-none="" data-check-target='.list-check-box' type='checkbox'>
|
||||
</th>
|
||||
<th class='text-left nowrap'>中奖人</th>
|
||||
<th class='text-left nowrap'>活动信息</th>
|
||||
<th class='text-left nowrap'>奖品信息</th>
|
||||
<th class='text-left nowrap'>中奖时间</th>
|
||||
<th class='text-left nowrap'>核销时间</th>
|
||||
</tr>
|
||||
</thead>
|
||||
{/notempty}
|
||||
<tbody>
|
||||
{foreach $list as $key=>$vo}
|
||||
<tr>
|
||||
<td class='list-table-check-td think-checkbox'>
|
||||
<input class="list-check-box" value='{$vo.id}' type='checkbox'>
|
||||
</td>
|
||||
<td class='text-left nowrap'>
|
||||
{$vo.username|default=''}
|
||||
{notempty name='vo.member.phone'}
|
||||
<span class="margin-left-5 layui-badge layui-bg-gray">{$vo.member.phone|default=''}</span>
|
||||
{/notempty}
|
||||
</td>
|
||||
<td class='text-left nowrap'>{$vo.info.name|default=''}</td>
|
||||
<td class='text-left nowrap'>
|
||||
{if $vo.prize_code neq ''}
|
||||
{$vo.prize_name|default=''}( {$vo.prize_level|default=''} )
|
||||
{$vo.prize_express ? "<span class='color-blue'>需要发货</span>":"<span class='color-desc'>无需发货</span>"}
|
||||
{else}<span class="layui-badge layui-bg-gray">未中奖</span>{/if}
|
||||
</td>
|
||||
<td class='text-left nowrap'>
|
||||
{$vo.create_at|format_datetime}
|
||||
</td>
|
||||
<td class='text-left nowrap'>
|
||||
{$vo.uncode_datetime|default='未核销'}
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
{empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
|
||||
</div>
|
||||
{/block}
|
73
app/data/view/luckdraw_record/index_search.html
Normal file
@ -0,0 +1,73 @@
|
||||
<fieldset>
|
||||
|
||||
<legend>条件搜索</legend>
|
||||
|
||||
<form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
|
||||
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">中奖姓名</label>
|
||||
<div class="layui-input-inline">
|
||||
<input name="username" value="{:input('username','')}" placeholder="请输入中奖姓名" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">中奖级别</label>
|
||||
<div class="layui-input-inline">
|
||||
<input name="prize_level" value="{:input('prize_level','')}" placeholder="请输入中奖级别" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">活动名称</label>
|
||||
<div class="layui-input-inline">
|
||||
<select class="layui-select" name="code" lay-search>
|
||||
<option value="">- 全部记录 -</option>
|
||||
{foreach $prizes as $k => $v}
|
||||
{if input('code','') eq $v.code}
|
||||
<option selected value="{$v.code}">{$v.name}</option>
|
||||
{else}
|
||||
<option value="{$v.code}">{$v.name}</option>
|
||||
{/if}{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">核销状态</label>
|
||||
<div class="layui-input-inline">
|
||||
<select class="layui-select" name="uncode_status">
|
||||
{foreach [''=>'-- 全部 --','0'=>'未核销的奖品','1'=>'已核销的奖品'] as $k=>$v}
|
||||
{if input('uncode_status') eq $k.''}
|
||||
<option selected value="{$k}">{$v}</option>
|
||||
{else}
|
||||
<option value="{$k}">{$v}</option>
|
||||
{/if}{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">中奖时间</label>
|
||||
<div class="layui-input-inline">
|
||||
<input data-date-range name="create_at" value="{:input('create_at','')}" placeholder="请选择中奖时间" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">核销时间</label>
|
||||
<div class="layui-input-inline">
|
||||
<input data-date-range name="uncode_datetime" value="{:input('uncode_datetime','')}" placeholder="请选择核销时间" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-inline">
|
||||
<button class="layui-btn layui-btn-primary"><i class="layui-icon"></i> 搜 索</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</fieldset>
|
||||
|
||||
<script>
|
||||
window.form.render();
|
||||
</script>
|
520
public/static/luckdraw/css/style.css
Normal file
@ -0,0 +1,520 @@
|
||||
@charset "UTF-8";
|
||||
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite,
|
||||
code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li,
|
||||
fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure,
|
||||
figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video, input, textarea, button,
|
||||
::after, ::before {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
outline: none;
|
||||
font-style: normal;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
-webkit-touch-callout: none;
|
||||
-webkit-user-select: none;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
}
|
||||
|
||||
html, body {
|
||||
width: 100%;
|
||||
font-family: "PingFang SC", Helvetica, Arial, sans-serif;
|
||||
-webkit-user-select: none; /*文本不能被选择*/
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
-webkit-text-size-adjust: 100% !important; /*阻止文字被放大*/
|
||||
-moz-text-size-adjust: 100% !important;
|
||||
-ms-text-size-adjust: 100% !important;
|
||||
text-size-adjust: 100% !important;
|
||||
-webkit-font-smoothing: antialiased; /*抗锯齿*/
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: #fff;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
font-size: initial;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {
|
||||
display: block;
|
||||
}
|
||||
|
||||
a, button, em, del, strong, var, label, cite, small, time, mark, code {
|
||||
display: inline-block;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
a, a:visited, a:active, a:hover {
|
||||
text-decoration: none;
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
img {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
ol, ul, li {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
input, button, textarea {
|
||||
background-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
input, textarea {
|
||||
min-width: .1rem;
|
||||
border-radius: 0;
|
||||
-webkit-user-select: auto;
|
||||
-moz-user-select: auto;
|
||||
-ms-user-select: auto;
|
||||
user-select: auto;
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
appearance: none;
|
||||
}
|
||||
|
||||
textarea {
|
||||
resize: none;
|
||||
display: block;
|
||||
}
|
||||
|
||||
label, textarea, .word-wrap {
|
||||
word-wrap: break-word;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
input::-webkit-input-placeholder {
|
||||
color: #bbb;
|
||||
}
|
||||
|
||||
blockquote, q {
|
||||
quotes: none;
|
||||
}
|
||||
|
||||
blockquote:before, blockquote:after, q:before, q:after {
|
||||
content: '';
|
||||
content: none;
|
||||
}
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
}
|
||||
|
||||
.clearfix:after {
|
||||
content: ' ';
|
||||
display: block;
|
||||
clear: both;
|
||||
visibility: hidden;
|
||||
line-height: 0;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* reset end */
|
||||
|
||||
/* 首页 */
|
||||
html {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
min-height: 100%;
|
||||
background: url('../images/bg_rp.jpg') repeat-y;
|
||||
background-size: 100%;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.page {
|
||||
position: relative;
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
.index-page::before {
|
||||
content: ' ';
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 4.36rem;
|
||||
background: url('../images/bottom.png') no-repeat;
|
||||
background-size: cover;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.index-page .page-body {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 5;
|
||||
padding-top: 32%;
|
||||
}
|
||||
|
||||
.index-page .rule {
|
||||
position: absolute;
|
||||
top: 2.3%;
|
||||
right: 3.3%;
|
||||
width: 1.46rem;
|
||||
height: auto;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.index-page .btn {
|
||||
width: 4.58rem;
|
||||
margin: 0 auto;
|
||||
-webkit-animation: ripple 3s infinite;
|
||||
animation: ripple 3s infinite;
|
||||
}
|
||||
|
||||
@-webkit-keyframes ripple {
|
||||
0% {
|
||||
-webkit-transform: scale(1);
|
||||
transform: scale(1)
|
||||
}
|
||||
50% {
|
||||
-webkit-transform: scale(1.1);
|
||||
transform: scale(1.1)
|
||||
}
|
||||
100% {
|
||||
-webkit-transform: scale(1);
|
||||
transform: scale(1)
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes ripple {
|
||||
0% {
|
||||
-webkit-transform: scale(1);
|
||||
transform: scale(1)
|
||||
}
|
||||
50% {
|
||||
-webkit-transform: scale(1.1);
|
||||
transform: scale(1.1)
|
||||
}
|
||||
100% {
|
||||
-webkit-transform: scale(1);
|
||||
transform: scale(1)
|
||||
}
|
||||
}
|
||||
|
||||
.index-page .detail {
|
||||
position: relative;
|
||||
z-index: 3;
|
||||
margin-top: 11%;
|
||||
}
|
||||
|
||||
.index-page .title {
|
||||
width: 1.16rem;
|
||||
margin: 0 auto .18rem;
|
||||
}
|
||||
|
||||
.index-page .ls-box {
|
||||
width: 5.4rem;
|
||||
height: 3.3rem;
|
||||
margin: 0 auto;
|
||||
background: #fff0e8;
|
||||
border: 1px solid #e60b11;
|
||||
border-radius: 2px;
|
||||
position: relative;
|
||||
-webkit-box-shadow: 0 0 18px 2px rgba(122, 0, 9, .7);
|
||||
box-shadow: 0 0 18px 2px rgba(122, 0, 9, .7);
|
||||
}
|
||||
|
||||
.index-page .icon1 {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: .62rem;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.index-page .icon2 {
|
||||
left: initial;
|
||||
right: 0;
|
||||
-webkit-transform: rotate(90deg);
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
|
||||
.index-page .ls-box ul {
|
||||
padding: 0 .26rem;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.index-page .ls-box ul li {
|
||||
display: -webkit-box;
|
||||
display: -webkit-flex;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-webkit-box-align: center;
|
||||
-webkit-align-items: center;
|
||||
-ms-flex-align: center;
|
||||
align-items: center;
|
||||
-webkit-box-pack: justify;
|
||||
-webkit-justify-content: space-between;
|
||||
-ms-flex-pack: justify;
|
||||
justify-content: space-between;
|
||||
border-bottom: 1px dashed #acacac;
|
||||
height: .8rem;
|
||||
font-size: 0;
|
||||
}
|
||||
|
||||
.index-page .ls-box ul span {
|
||||
font-size: .24rem;
|
||||
color: #530006;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.index-page .ls-box ul span:first-child {
|
||||
margin-right: .12rem;
|
||||
max-width: 4.2em;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.index-page .ls-box .ls-title {
|
||||
-webkit-box-flex: 1;
|
||||
-webkit-flex: 1;
|
||||
-ms-flex: 1;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.index-page .ls-box .ls-text {
|
||||
font-size: .24rem;
|
||||
color: #dd0d1d;
|
||||
padding-left: .1rem;
|
||||
}
|
||||
|
||||
|
||||
/* 填写信息 */
|
||||
|
||||
.mask,
|
||||
.luck-mask,
|
||||
.rule-mask,
|
||||
.info-dialog {
|
||||
-webkit-transition: all .3s;
|
||||
transition: all .3s;
|
||||
}
|
||||
|
||||
.mask,
|
||||
.luck-mask,
|
||||
.rule-mask {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: rgba(0, 0, 0, .7);
|
||||
z-index: -1;
|
||||
opacity: 0;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.info-dialog {
|
||||
position: fixed;
|
||||
top: 27%;
|
||||
left: 50%;
|
||||
width: 6rem;
|
||||
height: 5.2rem;
|
||||
margin-left: -3rem;
|
||||
background: url('../images/info_bg.jpg') no-repeat;
|
||||
background-size: 100% 100%;
|
||||
z-index: -1;
|
||||
border-radius: 2px;
|
||||
overflow: hidden;
|
||||
opacity: 0;
|
||||
visibility: hidden;
|
||||
-webkit-transform: scale(.8);
|
||||
transform: scale(.8);
|
||||
}
|
||||
|
||||
.info-dialog h2 {
|
||||
font-size: .36rem;
|
||||
color: #dd0d1d;
|
||||
text-align: center;
|
||||
line-height: 1;
|
||||
padding: .4rem 0 .56rem;
|
||||
}
|
||||
|
||||
.info-dialog .form {
|
||||
padding: 0 .5rem;
|
||||
}
|
||||
|
||||
.info-dialog label {
|
||||
display: -webkit-box;
|
||||
display: -webkit-flex;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-webkit-box-align: center;
|
||||
-webkit-align-items: center;
|
||||
-ms-flex-align: center;
|
||||
align-items: center;
|
||||
margin-bottom: .4rem;
|
||||
}
|
||||
|
||||
.info-dialog label span {
|
||||
font-size: .26rem;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.info-dialog input {
|
||||
-webkit-box-flex: 1;
|
||||
-webkit-flex: 1;
|
||||
-ms-flex: 1;
|
||||
flex: 1;
|
||||
border: 1px solid #333;
|
||||
height: .6rem;
|
||||
border-radius: .6rem;
|
||||
line-height: .4rem;
|
||||
font-size: .28rem;
|
||||
color: #333;
|
||||
padding-left: .28rem;
|
||||
}
|
||||
|
||||
.btns {
|
||||
font-size: 0;
|
||||
text-align: center;
|
||||
margin-top: .5rem;
|
||||
}
|
||||
|
||||
.btns span {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
width: 1.8rem;
|
||||
line-height: .6rem;
|
||||
border-radius: .6rem;
|
||||
text-align: center;
|
||||
font-size: .24rem;
|
||||
color: #fff;
|
||||
background: #c8c8c8;
|
||||
margin: 0 .2rem;
|
||||
}
|
||||
|
||||
.btns span:last-child {
|
||||
background: #dd0d1d;
|
||||
}
|
||||
|
||||
.show.mask {
|
||||
opacity: 1;
|
||||
visibility: visible;
|
||||
z-index: 20;
|
||||
}
|
||||
|
||||
.show.info-dialog {
|
||||
opacity: 1;
|
||||
visibility: visible;
|
||||
-webkit-transform: scale(1);
|
||||
transform: scale(1);
|
||||
z-index: 33;
|
||||
}
|
||||
|
||||
|
||||
/* 中奖弹窗 */
|
||||
|
||||
.luck-dialog {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 38;
|
||||
text-align: center;
|
||||
padding-top: 58%;
|
||||
}
|
||||
|
||||
.luck-dialog h1 {
|
||||
font-size: .64rem;
|
||||
color: #ffe100;
|
||||
margin-bottom: .2rem;
|
||||
}
|
||||
|
||||
.luck-dialog h3 {
|
||||
font-size: .36rem;
|
||||
color: #ffe100;
|
||||
margin-bottom: .8rem;
|
||||
}
|
||||
|
||||
.luck-dialog input {
|
||||
font-size: .26rem;
|
||||
display: block;
|
||||
width: 4.7rem;
|
||||
height: .8rem;
|
||||
line-height: .4rem;
|
||||
background: #fff;
|
||||
border-radius: .8rem;
|
||||
margin: 0 auto .4rem;
|
||||
text-align: left;
|
||||
padding-left: .3rem;
|
||||
}
|
||||
|
||||
.luck-dialog .dialog-btn {
|
||||
width: 4.7rem;
|
||||
line-height: .8rem;
|
||||
border-radius: .8rem;
|
||||
margin: 0 auto;
|
||||
font-size: .3rem;
|
||||
color: #dd0d1d;
|
||||
background: #ffe100;
|
||||
}
|
||||
|
||||
.luck-dialog .btn1 {
|
||||
background: #fff0e8;
|
||||
color: #dd0d1d;
|
||||
}
|
||||
|
||||
.show.luck-mask,
|
||||
.show.rule-mask {
|
||||
opacity: 1;
|
||||
visibility: visible;
|
||||
z-index: 35;
|
||||
}
|
||||
|
||||
.rule-mask {
|
||||
padding-top: 24%;
|
||||
}
|
||||
|
||||
.rule-dialog {
|
||||
width: 6rem;
|
||||
height: 8.8rem;
|
||||
background: url('../images/rule_bg.jpg') no-repeat;
|
||||
background-size: 100% 100%;
|
||||
border-radius: 2px;
|
||||
overflow: hidden;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.rule-dialog .dialog-title {
|
||||
font-size: .36rem;
|
||||
color: #dd0d1d;
|
||||
text-align: center;
|
||||
padding: .4rem 0 .3rem;
|
||||
}
|
||||
|
||||
.rule-content {
|
||||
padding: 0 .3rem;
|
||||
font-size: .24rem;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.close {
|
||||
position: absolute;
|
||||
top: 6.8%;
|
||||
right: 6.8%;
|
||||
width: .5rem;
|
||||
z-index: 99;
|
||||
}
|
||||
|
||||
.hide {
|
||||
display: none !important;
|
||||
}
|
BIN
public/static/luckdraw/images/bg.jpg
Normal file
After Width: | Height: | Size: 61 KiB |
BIN
public/static/luckdraw/images/bg2.jpg
Normal file
After Width: | Height: | Size: 114 KiB |
BIN
public/static/luckdraw/images/bg_rp.jpg
Normal file
After Width: | Height: | Size: 451 B |
BIN
public/static/luckdraw/images/bottom.png
Normal file
After Width: | Height: | Size: 61 KiB |
BIN
public/static/luckdraw/images/close.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
public/static/luckdraw/images/icon1.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
public/static/luckdraw/images/info_bg.jpg
Normal file
After Width: | Height: | Size: 72 KiB |
BIN
public/static/luckdraw/images/luck.png
Normal file
After Width: | Height: | Size: 107 KiB |
BIN
public/static/luckdraw/images/rule.png
Normal file
After Width: | Height: | Size: 9.2 KiB |
BIN
public/static/luckdraw/images/rule_bg.jpg
Normal file
After Width: | Height: | Size: 148 KiB |
BIN
public/static/luckdraw/images/t1.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
public/static/luckdraw/images/yu.png
Normal file
After Width: | Height: | Size: 39 KiB |
BIN
public/static/luckdraw/images/yu1.png
Normal file
After Width: | Height: | Size: 38 KiB |
177
public/static/luckdraw/index.html
Normal file
@ -0,0 +1,177 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,initial-scale=1.0,width=device-width">
|
||||
<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
|
||||
<title>标题</title>
|
||||
<link rel="stylesheet" href="./lib/swiper/swiper.min.css">
|
||||
<link rel="stylesheet" href="./css/style.css">
|
||||
<script>
|
||||
fontsize();
|
||||
window.onresize = function () {
|
||||
fontsize();
|
||||
};
|
||||
|
||||
function fontsize() {
|
||||
var deviceWidth = document.documentElement.clientWidth;
|
||||
if (deviceWidth > 640) deviceWidth = 640;
|
||||
document.documentElement.style.fontSize = deviceWidth / 7.5 + 'px'; // 750 设计稿
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="page index-page">
|
||||
<img src="./images/bg2.jpg" alt="一尚美术">
|
||||
<div class="page-body">
|
||||
<img onclick="showRule()" class="rule" src="./images/rule.png" alt="活动规则">
|
||||
<!-- 抽奖按钮 -->
|
||||
<img class="btn" src="./images/yu.png" alt="点我抽奖" onclick="draw()">
|
||||
<!-- 已中奖的点击按钮变成 查看奖品 -->
|
||||
<!-- <img class="btn" src="./images/yu1.png" alt="查看奖品" > -->
|
||||
|
||||
<!-- 中奖明细 -->
|
||||
<div class="detail">
|
||||
<img class="title" src="./images/t1.png" alt="中奖明细">
|
||||
|
||||
<div>
|
||||
<!-- <img class="icon1" src="./images/icon1.png" alt="一尚美术">
|
||||
<img class="icon1 icon2" src="./images/icon1.png" alt="一尚美术"> -->
|
||||
|
||||
<div class="swiper-container ls-box">
|
||||
<img class="icon1" src="./images/icon1.png" alt="一尚美术">
|
||||
<img class="icon1 icon2" src="./images/icon1.png" alt="一尚美术">
|
||||
|
||||
<ul class="swiper-wrapper">
|
||||
<li class="swiper-slide">
|
||||
<div class="ls-title">
|
||||
<span>林烨林</span>
|
||||
<span>获得一等奖</span>
|
||||
</div>
|
||||
<div class="ls-text">多功能数据线1条</div>
|
||||
</li>
|
||||
<li class="swiper-slide">
|
||||
<div class="ls-title">
|
||||
<span>林烨林</span>
|
||||
<span>获得一等奖</span>
|
||||
</div>
|
||||
<div class="ls-text">多功能数据线2条</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 填写信息 -->
|
||||
<div id="mask1" class="mask" onclick="hideDraw()"></div>
|
||||
<div class="info-dialog">
|
||||
<h2>填写信息即可参与抽奖哦~</h2>
|
||||
<div class="form">
|
||||
<label>
|
||||
<span>您的姓名:</span>
|
||||
<input type="text" maxlength="20">
|
||||
</label>
|
||||
<label>
|
||||
<span>手机号码:</span>
|
||||
<input type="tel" maxlength="11">
|
||||
</label>
|
||||
</div>
|
||||
<div class="btns">
|
||||
<span onclick="hideDraw()">取消</span>
|
||||
<span onclick="showLuck()">确认</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 中奖弹窗 -->
|
||||
<div class="luck-mask">
|
||||
<img onclick="this.parentNode.className='luck-mask'" class="close" src="./images/close.png" alt="关闭">
|
||||
<img src="./images/luck.png" alt="中奖了">
|
||||
<div class="luck-dialog">
|
||||
<h1>一等奖</h1>
|
||||
<h3>蓝牙音箱一台</h3>
|
||||
|
||||
<div>
|
||||
<input type="text" placeholder="请输入核销码">
|
||||
<div class="dialog-btn">确认核销</div>
|
||||
</div>
|
||||
<!-- 奖品已核销 -->
|
||||
<div class="dialog-btn btn1 hide">奖品已核销</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 规则说明 -->
|
||||
<div class="rule-mask">
|
||||
<img onclick="this.parentNode.className='rule-mask'" class="close" src="./images/close.png" alt="关闭">
|
||||
<div class="rule-dialog">
|
||||
<h1 class="dialog-title">活动规则</h1>
|
||||
<div class="rule-content">
|
||||
<p>这是内容这是内容这是内容这是内容这是内容这是内容</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- script -->
|
||||
<script src="./lib/swiper/swiper.min.js"></script>
|
||||
<script>
|
||||
// 显示活动规则
|
||||
function showRule() {
|
||||
document.querySelector('.rule-mask').className = 'rule-mask show';
|
||||
};
|
||||
|
||||
// 显示填写信息弹窗
|
||||
function draw() {
|
||||
document.querySelector('#mask1').className = 'mask show';
|
||||
document.querySelector('.info-dialog').className = 'info-dialog show';
|
||||
};
|
||||
|
||||
// 隐藏填写信息弹窗
|
||||
function hideDraw() {
|
||||
document.querySelector('#mask1').className = 'mask';
|
||||
document.querySelector('.info-dialog').className = 'info-dialog';
|
||||
};
|
||||
|
||||
// 显示中奖
|
||||
function showLuck() {
|
||||
document.querySelector('.luck-mask').className = 'luck-mask show';
|
||||
};
|
||||
|
||||
window.onload = function () {
|
||||
var winH = document.body.clientHeight; // 可视区高度
|
||||
var n = 5; // 列表默认5个数据
|
||||
// 根据不同屏幕高度改变列表高度+数据个数
|
||||
if (winH > 645) {
|
||||
n = parseInt(winH / 100);
|
||||
document.querySelector('.index-page .ls-box').style.height = (n * 0.92) + 'rem';
|
||||
}
|
||||
// 列表轮播默认参数,默认不自动轮播
|
||||
var option = {
|
||||
direction: 'vertical',
|
||||
slidesPerView: n,
|
||||
};
|
||||
// 列表数据个数
|
||||
var len = document.querySelectorAll('.ls-box li').length;
|
||||
|
||||
// 列表数量大于默认数量 循环+自动轮播
|
||||
if (len > n) {
|
||||
option.autoplay = {
|
||||
delay: 5000,
|
||||
disableOnInteraction: false,
|
||||
}
|
||||
option.loop = true;
|
||||
}
|
||||
// swiper 轮播实例化
|
||||
new Swiper('.swiper-container', option);
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
2
public/static/luckdraw/layer.mobile/layer.js
Normal file
@ -0,0 +1,2 @@
|
||||
/*! layer mobile-v2.0 弹层组件移动版 License LGPL http://layer.layui.com/mobile By 贤心 */
|
||||
;!function(a){"use strict";var b=document,c="querySelectorAll",d="getElementsByClassName",e=function(a){return b[c](a)},f={type:0,shade:!0,shadeClose:!0,fixed:!0,anim:"scale"},g={extend:function(a){var b=JSON.parse(JSON.stringify(f));for(var c in a)b[c]=a[c];return b},timer:{},end:{}};g.touch=function(a,b){a.addEventListener("click",function(a){b.call(this,a)},!1)};var h=0,i=["layui-m-layer"],j=function(a){var b=this;b.config=g.extend(a),b.view()};j.prototype.view=function(){var a=this,c=a.config,f=b.createElement("div");a.id=f.id=i[0]+h,f.setAttribute("class",i[0]+" "+i[0]+(c.type||0)),f.setAttribute("index",h);var g=function(){var a="object"==typeof c.title;return c.title?'<h3 style="'+(a?c.title[1]:"")+'">'+(a?c.title[0]:c.title)+"</h3>":""}(),j=function(){"string"==typeof c.btn&&(c.btn=[c.btn]);var a,b=(c.btn||[]).length;return 0!==b&&c.btn?(a='<span yes type="1">'+c.btn[0]+"</span>",2===b&&(a='<span no type="0">'+c.btn[1]+"</span>"+a),'<div class="layui-m-layerbtn">'+a+"</div>"):""}();if(c.fixed||(c.top=c.hasOwnProperty("top")?c.top:100,c.style=c.style||"",c.style+=" top:"+(b.body.scrollTop+c.top)+"px"),2===c.type&&(c.content='<i></i><i class="layui-m-layerload"></i><i></i><p>'+(c.content||"")+"</p>"),c.skin&&(c.anim="up"),"msg"===c.skin&&(c.shade=!1),f.innerHTML=(c.shade?"<div "+("string"==typeof c.shade?'style="'+c.shade+'"':"")+' class="layui-m-layershade"></div>':"")+'<div class="layui-m-layermain" '+(c.fixed?"":'style="position:static;"')+'><div class="layui-m-layersection"><div class="layui-m-layerchild '+(c.skin?"layui-m-layer-"+c.skin+" ":"")+(c.className?c.className:"")+" "+(c.anim?"layui-m-anim-"+c.anim:"")+'" '+(c.style?'style="'+c.style+'"':"")+">"+g+'<div class="layui-m-layercont">'+c.content+"</div>"+j+"</div></div></div>",!c.type||2===c.type){var k=b[d](i[0]+c.type),l=k.length;l>=1&&layer.close(k[0].getAttribute("index"))}document.body.appendChild(f);var m=a.elem=e("#"+a.id)[0];c.success&&c.success(m),a.index=h++,a.action(c,m)},j.prototype.action=function(a,b){var c=this;a.time&&(g.timer[c.index]=setTimeout(function(){layer.close(c.index)},1e3*a.time));var e=function(){var b=this.getAttribute("type");0==b?(a.no&&a.no(),layer.close(c.index)):a.yes?a.yes(c.index):layer.close(c.index)};if(a.btn)for(var f=b[d]("layui-m-layerbtn")[0].children,h=f.length,i=0;h>i;i++)g.touch(f[i],e);if(a.shade&&a.shadeClose){var j=b[d]("layui-m-layershade")[0];g.touch(j,function(){layer.close(c.index,a.end)})}a.end&&(g.end[c.index]=a.end)},a.layer={v:"2.0",index:h,open:function(a){var b=new j(a||{});return b.index},close:function(a){var c=e("#"+i[0]+a)[0];c&&(c.innerHTML="",b.body.removeChild(c),clearTimeout(g.timer[a]),delete g.timer[a],"function"==typeof g.end[a]&&g.end[a](),delete g.end[a])},closeAll:function(){for(var a=b[d](i[0]),c=0,e=a.length;e>c;c++)layer.close(0|a[0].getAttribute("index"))}},"function"==typeof define?define(function(){return layer}):function(){var a=document.scripts,c=a[a.length-1],d=c.src,e=d.substring(0,d.lastIndexOf("/")+1);c.getAttribute("merge")||document.head.appendChild(function(){var a=b.createElement("link");return a.href=e+"need/layer.css?2.0",a.type="text/css",a.rel="styleSheet",a.id="layermcss",a}())}()}(window);
|