添加后台代理代码
This commit is contained in:
271
codes/agent/game/dlweb/api/web2/player_buy.html
Normal file
271
codes/agent/game/dlweb/api/web2/player_buy.html
Normal file
@@ -0,0 +1,271 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>玩家充值</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||
<link rel="stylesheet" href="./libs/bootstrap/bootstrap.min.css?__HTML_VERSION__=3">
|
||||
<link rel="stylesheet" href="./libs/font-awesome.min.css?__HTML_VERSION__=3">
|
||||
<link rel="stylesheet" href="./css/common.css?__HTML_VERSION__=7">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container" id="app">
|
||||
|
||||
<beta-header></beta-header>
|
||||
|
||||
<div class="row">
|
||||
<ul class="nav nav-tabs flex-full" role="tablist">
|
||||
<li :class="{'active':selType=='buycard'}" @click="selType='buycard'"><a href="javascript:;">玩家充值</a></li>
|
||||
<li :class="{'active':selType=='record'}" @click="selType='record'"><a href="javascript:;">充值记录</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<section class="tab-content">
|
||||
<!--购买房卡-->
|
||||
<div role="tabpanel" class="tab-pane fade" :class="{'active':selType=='buycard','in':selType=='buycard'}" id="buycard">
|
||||
|
||||
<user-info v-if="isWeiXin"></user-info>
|
||||
|
||||
<div class="form-horizontal pt8">
|
||||
<div class="form-group">
|
||||
<label for="playerid" class="col-xs-3 control-label" style="line-height: 34px;">玩家ID</label>
|
||||
<div class="col-xs-9">
|
||||
<input id="playerid" class="form-control" type="number" placeholder="请输入玩家ID" v-model="playerId">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<product-list :type="0" @update:change-product-id="changeProductInfo"></product-list>
|
||||
|
||||
<p class="money">金额:<span class="red" v-html="money"></span>元</p>
|
||||
|
||||
<button @click="createBill" class="btn btn-success center-block w60">支付</button>
|
||||
|
||||
<p v-if="lang.payWeChat" class="pay-notice text-center pt8" v-html="lang.payWeChat"></p>
|
||||
<p v-if="lang.rechargeNotice" class="pay-notice text-center pt8" v-html="lang.rechargeNotice"></p>
|
||||
</div>
|
||||
<!--/购买房卡-->
|
||||
|
||||
<!--购买记录-->
|
||||
<div role="tabpanel" class="tab-pane fade" :class="{'active':selType=='record','in':selType=='record'}" id="record">
|
||||
|
||||
<div class="form-group" v-show="false">
|
||||
<label class="col-xs-6 control-label">
|
||||
<input type="radio" name="inlineRadioOptions" value="card" v-model="type"> 房卡
|
||||
</label>
|
||||
<label class="col-xs-6 control-label">
|
||||
<input type="radio" name="inlineRadioOptions" value="star" v-model="type"> {{lang.starName}}
|
||||
</label>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="pt15">
|
||||
<button @click="buyQueryCard" class="btn btn-primary center-block w60">查询</button>
|
||||
</div>
|
||||
|
||||
<div class="table-responsive mt15" v-show="queryCardList[0] || queryStarList[0]">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>金额</th>
|
||||
<th>数量</th>
|
||||
<th>时间</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(v, i) in queryCardList">
|
||||
<td>{{v.playerid}}</td>
|
||||
<td>{{v.money}}</td>
|
||||
<td>{{v.amount}}</td>
|
||||
<td>{{v.time.substr(5,11)}}</td>
|
||||
</tr>
|
||||
<tr v-for="(v, i) in queryStarList">
|
||||
<td>{{v.user_id || v.play_playerid}}</td>
|
||||
<td>{{v.product_money}}</td>
|
||||
<td>{{v.star_amount}}</td>
|
||||
<td>{{v.pay_time.substr(5,11)}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!--/购买记录-->
|
||||
</section>
|
||||
|
||||
<agent-nav></agent-nav>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="./libs/jquery.min.js?__HTML_VERSION__=3"></script>
|
||||
<script src="./libs/bootstrap/bootstrap.min.js?__HTML_VERSION__=3"></script>
|
||||
<script src="./libs/vue.min.js?__HTML_VERSION__=3"></script>
|
||||
<script src="./libs/layer_mobile/layer.js?__HTML_VERSION__=3"></script>
|
||||
<script src="./js/function.js?__HTML_VERSION__=18"></script>
|
||||
<script src="./lang/lang.js?__HTML_VERSION__=14"></script>
|
||||
<script src="./components/agent-nav.js?__HTML_VERSION__=8"></script>
|
||||
<script src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>
|
||||
<script src="./components/product-list.js?__HTML_VERSION__=4"></script>
|
||||
<script src="./components/user-info.js?__HTML_VERSION__=4"></script>
|
||||
<script src="./components/beta-header.js?__HTML_VERSION__=3"></script>
|
||||
|
||||
<script>
|
||||
new Vue(
|
||||
{
|
||||
el: "#app",
|
||||
components: {
|
||||
'agent-nav': agentNav,
|
||||
'product-list': productList,
|
||||
'user-info': userInfo,
|
||||
'beta-header': betaHeader
|
||||
},
|
||||
data: {
|
||||
isLoading: true,
|
||||
isWeiXin: false,
|
||||
params: {},
|
||||
lang: {},
|
||||
agentInfo: {},
|
||||
wxInfo: {},
|
||||
checkedProductId: '',
|
||||
playerId: '',
|
||||
billInfo: {},
|
||||
userInfo: {},
|
||||
index: 'card', // productList 返回的产品类型
|
||||
type: 'star', // 查询记录的类型
|
||||
money: 0,
|
||||
queryCardList: [],
|
||||
queryStarList: [],
|
||||
selType: 'buycard'
|
||||
},
|
||||
methods: {
|
||||
changeProductInfo: function (v) {
|
||||
this.checkedProductId = v.productid;
|
||||
this.index = v.index;
|
||||
this.money = v.money;
|
||||
},
|
||||
buyQueryCard: function () {
|
||||
|
||||
var that = this;
|
||||
|
||||
this.queryCardList = [];
|
||||
this.queryStarList = [];
|
||||
|
||||
if (that.type === 'card') {
|
||||
$.api(
|
||||
'agent.card.buyCardRecord',
|
||||
{agentid: that.params.agentid, openid: that.wxInfo.openid},
|
||||
function (res) {
|
||||
if (res.detail.length > 0)
|
||||
that.queryCardList = res.detail;
|
||||
else
|
||||
$.alert('暂无记录');
|
||||
}, 1)
|
||||
} else if (that.type === 'star') {
|
||||
$.api(
|
||||
'agent.order.buyStarRecord',
|
||||
{
|
||||
agentid: that.params.agentid,
|
||||
channelid: that.params.channelid,
|
||||
unionid: that.wxInfo.unionid,
|
||||
openid: that.wxInfo.openid,
|
||||
type: 0,
|
||||
page_index: 1
|
||||
},
|
||||
function (res) {
|
||||
if (res.detail.length > 0)
|
||||
that.queryStarList = res.detail;
|
||||
else
|
||||
$.alert('暂无记录');
|
||||
}, 1)
|
||||
}
|
||||
},
|
||||
createBill: function () {
|
||||
try {
|
||||
if (!this.playerId) throw '请输入玩家ID';
|
||||
if (!$.isRightId(this.playerId)) throw '请输入正确的玩家ID';
|
||||
|
||||
if (!this.checkedProductId) throw '请选择要购买的商品';
|
||||
|
||||
var that = this;
|
||||
var method;
|
||||
var orderParams;
|
||||
if (this.index === 'star') {
|
||||
method = 'agent.order.createStarOrder';
|
||||
orderParams = {
|
||||
agentid: that.params.agentid,
|
||||
channelid: that.params.channelid,
|
||||
openid: that.wxInfo.openid,
|
||||
unionid: that.wxInfo.unionid,
|
||||
billtype: 0,
|
||||
productid: that.checkedProductId,
|
||||
playerid: that.playerId,
|
||||
salesid: that.playerId
|
||||
}
|
||||
}
|
||||
else {
|
||||
method = 'agent.order.createOrder';
|
||||
orderParams = {
|
||||
agentid: that.params.agentid,
|
||||
channelid: that.params.channelid,
|
||||
openid: that.wxInfo.openid,
|
||||
unionid: that.wxInfo.unionid,
|
||||
billtype: 0,
|
||||
productid: that.checkedProductId,
|
||||
playerid: that.playerId
|
||||
}
|
||||
}
|
||||
|
||||
$.loading();
|
||||
$.api(
|
||||
method,
|
||||
orderParams,
|
||||
function (r) {
|
||||
that.billInfo = r;
|
||||
|
||||
var str = '<h4>订单详情</h4>' +
|
||||
'<p class="text-left">昵 称:' + r.playername +
|
||||
'</p><p class="text-left">数 量:' + r.productamount +
|
||||
'</p><p class="text-left">金 额:' + r.productmoney + '</p>';
|
||||
|
||||
layer.open(
|
||||
{
|
||||
content: str,
|
||||
btn: ['支付', '取消'],
|
||||
yes: function (i) {
|
||||
$.loading();
|
||||
$.toPay(that.params, that.agentInfo, that.wxInfo, r, that.index, that.playerId, 'player');
|
||||
layer.close(i);
|
||||
},
|
||||
no: function () { layer.closeAll() }
|
||||
});
|
||||
}, true)
|
||||
} catch (e) {
|
||||
$.alert(e);
|
||||
}
|
||||
}
|
||||
},
|
||||
created: function () {
|
||||
var that = this;
|
||||
this.params = $.getQueryObj();
|
||||
this.isWeiXin = $.isWeiXin();
|
||||
this.lang = lang[this.params.agentid] ? lang[this.params.agentid] : lang.default;
|
||||
|
||||
$.getAgentInfo(function (agentInfo) {
|
||||
that.agentInfo = agentInfo;
|
||||
$.getWxInfo(function (wxInfo) {
|
||||
that.wxInfo = wxInfo;
|
||||
//$.getUserInfoFirst(function (userInfo) {
|
||||
//that.userInfo = userInfo;
|
||||
that.isLoading = false;
|
||||
//})
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user