123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218 |
- <!doctype html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
- <title>兑奖中心</title>
- <link rel="stylesheet" href="__STATIC__/box/css/_flexible.css?v={:config('js_version')}">
- <link rel="stylesheet" href="__STATIC__/box/css/exchange.css?v={:config('js_version')}">
- <script src="__STATIC__/box/js/flexible375.js?v={:config('js_version')}"></script>
- </head>
- <body>
- <div class="exchange">
- <div class="exchange_top">
- 可用金币:{$integral}
- </div>
- <div class="article">
- <foreach name="list" item="vo">
- <div class="article_cell <if condition=" $vo.object_type eq 'rp'">article_red<else/>article_entity</if>">
- <div class="article_img">
- <img id="good_img_{$vo.good_id}" src="{$vo.original_img}" alt="">
- <if condition="$vo.object_type eq 'rp'">
- <span>{:intval($vo.market_price)}元</span>
- </if>
- </div>
- <p class="article_name" <if
- condition="$vo.object_type eq 'rp'">style='display:none;'</if>>{$vo.goods_name}</p>
- <p class="article_price">
- <img src="__STATIC__/box/images/jinbi.png" alt="">
- <span>{:intval($vo.integral)}金币</span>
- </p>
- <div class="article_exchange">
- <button class="js-exchange" name="{$vo.goods_name}" gid="{$vo.good_id}"
- integral="{:intval($vo.integral)}"
- genre="<if condition=" $vo.object_type eq 'rp'">red<else/>entity</if>">兑换</button>
- </div>
- </div>
- </foreach>
- </div>
- <div class="exchange_footer">
- <a href="{:url('exchange/log/'.$wx_app_id)}?v={:config('js_version')}" class="item f">我的奖品</a>
- <a href="{:url('index/settle/'.$wx_app_id)}?v={:config('js_version')}" class="item l">红包提现</a>
- </div>
- </div>
- <div class="dialog js-dialog-error">
- <div class="dialog_mask"></div>
- <div class="dialog_cnt">
- <div class="dialog_red">
- <h1 class="title" style="color:#9E9E9E">兑换失败</h1>
- <p class="info">
- <span id="err_msg"></span>
- </p>
- <button class="save js-close">确定</button>
- </div>
- </div>
- </div>
- <div class="dialog js-dialog-tips">
- <div class="dialog_mask"></div>
- <div class="dialog_cnt">
- <div class="dialog_red">
- <h1 class="title" style="color:#9E9E9E">确定要兑换么?</h1>
- <p class="info">
- <span id="tips_msg">确定要兑换么?</span>
- </p>
- <div>
- <button class="save js-close">确定</button>
- <button class="save js-cancel" style="background-color:#9E9E9E;">取消</button>
- </div>
- </div>
- </div>
- </div>
- <div class="dialog js-dialog-red">
- <div class="dialog_mask"></div>
- <div class="dialog_cnt">
- <div class="dialog_red">
- <h1 class="title">恭喜,兑换成功</h1>
- <p class="info">
- 获得 <img id="red-img" src="__STATIC__/box/images/xiaohongb.png" alt=""> <span id="red-title">100元</span>
- </p>
- <button class="save js-close">确定</button>
- </div>
- </div>
- </div>
- <div class="dialog js-dialog-entity">
- <div class="dialog_mask"></div>
- <div class="dialog_cnt">
- <div class="dialog_entity">
- <p class="prompt">请输入您的联系方式,稍后客服将会联系您</p>
- <input class="input js-name" type="text" placeholder="姓名:">
- <input class="input js-mobile" type="text" placeholder="手机号:">
- <div>
- <button class="save js-close">确定</button>
- <button class="save js-cancel" style="background-color:#9E9E9E;">取消</button>
- </div>
- </div>
- </div>
- </div>
- <div class="pop_outer" id="pop" style="display: none;">
- <div class="pop_inner">
- <div class="pop_title">温馨提示</div>
- <div class="pop_content" id="popContent">
- </div>
- <div class="pop_btn-group">
- <button class="pop_btn pop_btn__block" id="popBtn">确定</button>
- </div>
- </div>
- </div>
- <script src="__STATIC__/box/js/jquery.js"></script>
- <script>
- var total_integral = '{$integral}';
- var gid = 0;
- var name = '';
- $(function () {
- $('.article .js-exchange').on('click', function () {
- var type = $(this).attr('genre');
- var integral = $(this).attr('integral');
- gid = $(this).attr('gid');
- name = $(this).attr('name');
- if (+ total_integral < + integral) {
- showError('金币余额不足!');
- return false;
- }
- if (type === 'entity') {
- $('.js-dialog-entity').fadeIn(200);
- $('.js-cancel').unbind('click').bind('click', function () {
- $(this).closest('.dialog').fadeOut(200)
- });
- $('.js-close').unbind('click').bind('click', function () {
- var mobile = $('.js-close').parent().siblings('.js-mobile').val();
- var mem = $('.js-close').parent().siblings('.js-name').val();
- if (mobile == '' || mem == '') {
- $('#popContent').text('请输入您的完整信息!');
- $('#pop').show();
- return false;
- }
- var params = {
- format: 'json',
- mobile: mobile,
- mem : mem,
- gid : gid,
- };
- $.ajax({
- url : '/exchange/good/{$wx_app_id}',
- type : 'post',
- data : params,
- success: function (res) {
- if (res.code === 200) {
- var path = $('#good_img_' + gid).attr('src');
- $("#red-img").attr('src', path);
- $("#red-title").text(name);
- $('.js-dialog-red').fadeIn(200);
- $('.js-close').unbind('click').bind('click', function () {
- $(this).closest('.js-dialog-red').fadeOut(200)
- location.href = '/exchange/log/{$wx_app_id}.html'
- })
- } else {
- showError(res.msg);
- return false;
- }
- }
- });
- $(this).closest('.js-dialog-entity').fadeOut(200)
- })
- } else if (type === 'red') {
- var tips_msg = '您正在花费' + integral + '金币兑换:' + name;
- $('#tips_msg').text(tips_msg);
- $('.js-dialog-tips').fadeIn(200);
- $('.js-cancel').unbind('click').bind('click', function () {
- $(this).closest('.dialog').fadeOut(200)
- });
- $('.js-close').unbind('click').bind('click', function () {
- $(this).closest('.dialog').fadeOut(200)
- var params = {
- format: 'json',
- gid : gid,
- };
- $.ajax({
- url : '/exchange/good/{$wx_app_id}',
- type : 'post',
- data : params,
- success: function (res) {
- if (res.code === 200) {
- $("#red-title").text(name);
- $('.js-dialog-red').fadeIn(200);
- $('.js-close').unbind('click').bind('click', function () {
- $(this).closest('.js-dialog-red').fadeOut(200)
- location.href = '/exchange/log/{$wx_app_id}.html'
- })
- } else {
- showError(res.msg);
- return false;
- }
- }
- });
- });
- }
- });
- $('#popBtn').on('click', function () {
- $('#pop').hide()
- });
- })
- function showError(msg) {
- $('.js-dialog-error').fadeIn(200);
- if (msg != '') {
- $('#err_msg').text(msg);
- }
- $('.js-close').unbind('click').bind('click', function () {
- $(this).closest('.js-dialog-error').fadeOut(200)
- })
- }
- </script>
- </body>
- </html>
|