www.lightcourse.com/app/admin/view/vrorder/exchange.html

123 lines
4.8 KiB
HTML

{include file="public/header" /}
<div class="page">
<div class="fixed-bar">
<div class="item-title">
<div class="subject">
<h3>电子兑换码</h3>
<h5></h5>
</div>
{include file="public/admin_items" /}
</div>
</div>
<div class="fixed-empty"></div>
<div class="dssc-vr-order-exchange">
<dl>
<dt>
<h3>{$Think.lang.e_exchange_code}</h3></dt>
<dd>
<input class="vr-code" name="vr_code" type="text" id="vr_code" placeholder="{$Think.lang.enter_e_exchange_code}" maxlength="18"/>
<label class="error" id="vr_code_waring" for="vr_code" style="display: inline;"></label>
<span></span>
<div class="dssc-keyboard">
<button onclick="demo(this,1)">1</button>
<button onclick="demo(this,1)">2</button>
<button onclick="demo(this,1)">3</button>
<button onclick="demo(this,1)">4</button>
<button onclick="demo(this,1)">5</button>
<button onclick="demo(this,1)">6</button>
<button onclick="demo(this,1)">7</button>
<button onclick="demo(this,1)">8</button>
<button onclick="demo(this,1)">9</button>
<button onclick="demo(this,1)">0</button>
<button class="cn" onclick="demo(this,2)">{$Think.lang.order_clear}</button>
<button class="cn" onclick="demo(this,3)">{$Think.lang.order_back}</button>
<label class="enter-border">
<input type="button" id="_submit" class="enter" value="{$Think.lang.submit_validation}">
</label>
</div>
<p class="hint">{$Think.lang.exchange_codes_offset_consumption}</p>
</dd>
</dl>
<div class="bottom">
</div>
</div>
</div>
<table class="dssc-default-table order">
<thead>
<tr>
<th class="w10"></th>
<th colspan="20" class="tl"></th>
</tr>
<tr>
<th class="w10"></th>
<th class="w150">{$Think.lang.conversion_code}</th>
<th colspan="2">{$Think.lang.ds_goods}</th>
<th>{$Think.lang.order_number}</th>
<th>{$Think.lang.order_message}</th>
</tr>
</thead>
<tbody id="order_panel"></tbody>
</table>
<script>
function demo(obj, tip) {
if (tip == 1) {
var con = document.getElementById('vr_code').value;
document.getElementById('vr_code').value = con + obj.innerHTML;
} else if (tip == 2) {
document.getElementById('vr_code').value = "";
} else if (tip == 3) {
var con = document.getElementById('vr_code').value;
document.getElementById('vr_code').value = con.slice(0, -1);
}
}
</script>
<script>
$(document).ready(function () {
Tpl = "<tr id=\"PEND_ID\"><td class=\"bdl\"></td>\n";
Tpl += "<td>DS_CODE</td>\n";
Tpl += "<td class=\"w70\"><div class=\"dssc-goods-thumb\"><a target=\"_blank\" href=\"DS_GOODS_URL\"><img src=\"DS_IMG60\"></a></div></td>\n";
Tpl += "<td class=\"tl\"><a href=\"DS_GOODS_URL\" target=\"_blank\">DS_GOODS_NAME</a></td>\n";
Tpl += "<td><a target=\"_blank\" href=\"DS_ORDER_URL\">DS_ORDER_SN</a></td>\n";
Tpl += "<td class=\"bdr\">DS_ORDER_MSG</td></tr>\n";
function exPost() {
$('#vr_code_waring').html('');
$.getJSON('/admin/vrorder/exchange.html?submit_exchange=ok&vr_code=' + $("#vr_code").val(), null, function (data) {
if (data == null) return false;
if (data.error) {
$('#vr_code_waring').show().html(data.error);
return false;
}
content = Tpl.replace(/PEND_ID/g, $("#vr_code").val());
content = content.replace(/DS_CODE/g, $("#vr_code").val());
content = content.replace(/DS_GOODS_URL/g, data.data.goods_url);
content = content.replace(/DS_IMG60/g, data.data.img_240);
content = content.replace(/DS_GOODS_NAME/g, data.data.goods_name);
content = content.replace(/DS_ORDER_URL/g, data.data.order_url);
content = content.replace(/DS_ORDER_SN/g, data.data.order_sn);
content = content.replace(/DS_ORDER_MSG/g, data.data.buyer_msg);
$('#order_panel').prepend(content);
$('#vr_code').val('').focus();
layer.alert('{$Think.lang.exchange_successful}', {time: 2000}, function () {
location.reload();
});
});
}
$('#_submit').on('click', function () {
exPost();
});
$(document).keydown(function (e) {
if (e.keyCode == 13) {
exPost();
}
});
});
</script>