添加后台代理代码

This commit is contained in:
2026-03-15 01:27:05 +08:00
parent 11f9ac4dc1
commit ea08c9366a
5254 changed files with 721042 additions and 0 deletions

View File

@@ -0,0 +1,749 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>充值中心</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="IE=8">
<meta http-equiv="Cache" content="no-cache">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Expires" content="0">
<link rel="stylesheet" href="./libs/bootstrap/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/style.css?__HTML_VERSION__=6">
<style>
.w60 {width: 60%;}
.mt15 {margin-top: 15px;}
.pt15 {padding-top: 15px;}
.question {
display: block;
float: right;
width: 32px;
height: 32px;
text-align: center;
border-radius: 50%;
background:url("images/timg.jpg");
color: #fff;
}
</style>
</head>
<body class="bg_hui">
<section id="app" v-show="!isLoading" style="display: none">
<div class="count_full">
<sales-info></sales-info>
<section class="buju">
<div class="bs-example bs-example-tabs">
<div class="nav-h" id="vuenum">
<div class="nav-h-x">
<div class="nav-h-x-a">
<!-- tabs -->
<ul id="myTabs" class="nav nav-tabs" role="tablist">
<li :class="{'active':selType=='yaqm'}" @click="selType='yaqm'">
<a href="javascript:;" id="yaqm-tab">绑定邀请码</a>
</li>
<!--<template v-if="parentInfo.parentid">-->
<template v-if="false">
<li :class="{'active':selType=='syfk'}" @click="selType='syfk'">
<a href="javascript:;" id="syfk-tab">索要房卡</a>
</li>
<li :class="{'active':selType=='requestStar'}" @click="selType='requestStar'" v-if="requestStarPower">
<a href="javascript:;">索要{{lang.starName}}</a>
</li>
<li :class="{'active':selType=='profile'}" @click="selType='profile'">
<a href="javascript:;" id="profile-tab">索卡记录</a>
</li>
<li :class="{'active':selType=='askStarRecord'}" @click="selType='askStarRecord'" v-if="requestStarPower">
<a href="javascript:;">索{{lang.singStarName}}记录</a>
</li>
</template>
<li :class="{'active':selType=='sales-buy-card'}" @click="selType='sales-buy-card'" v-if="buyPower">
<a href="javascript:;">充值中心</a>
</li>
<li :class="{'active':selType=='buy-record'}" @click="selType='buy-record'" v-if="buyPower">
<a href="javascript:;">获取记录</a>
</li>
<li>
<a :href="'transform_product.html?agentid=' + params.agentid + '&channelid=' + params.channelid">钻石兑换</a>
</li>
</ul>
<!-- /tabs -->
</div>
<!-- <div class="huad-left">
<img src="img/jiantou.png" width="50">
<img src="img/shoushi.png" class="shouzhi" height="35">
</div>-->
</div>
</div>
</div>
<div id="myTabContent" class="tab-content" style="padding-bottom: 55px;">
<!-- 绑定代理 -->
<div class="tab-pane fade" :class="{'active':selType=='yaqm','in':selType=='yaqm'}" id="yaqm">
<div class="yaoqingma mt_bt">
<div class="text-center bm" v-if="!parentInfo.parentid">
<input type="number" v-model="salesId" placeholder="请输入邀请码" class="bdyaoqingma_input">
<button @click="bindSales" class="btn btn-danger">绑定</button>
</div>
<div class="y_bdm" v-else>
<h4 class="text-center">你已绑定,用户信息如下</h4>
<section class="buju">
<div class="left">
<img :src="parentInfo.avatar" class="header_img">
</div>
<div class="count">
<p>&emsp;称:{{parentInfo.name}}</p>
<p>账号:<span>{{parentInfo.parentid}}</span></p>
</div>
<div class="right">
<img :src="agentInfo.agentlogo" class="logo">
</div>
</section>
</div>
</div>
</div>
<!-- /绑定代理 -->
<template v-if="parentInfo.parentid">
<!-- 索要房卡 -->
<div class="tab-pane fade" :class="{'active':selType=='syfk','in':selType=='syfk'}">
<div class="chongka mh-radio" id="fengwan" style="padding-bottom: 50px;">
<div class="rowh he checkbox" style="margin-top: 20px; margin-bottom: 0;">
<label>
<input type="radio" name="askRoomCard" value="1" v-model="cardCounts"> 1张房卡
</label>
<label>
<input type="radio" name="askRoomCard" value="10" v-model="cardCounts"> 10张房卡
</label>
<label>
<input type="radio" name="askRoomCard" value="20" v-model="cardCounts"> 20张房卡
</label>
<label>
<input type="radio" name="askRoomCard" value="50" v-model="cardCounts"> 50张房卡
</label>
<label>
<input type="radio" name="askRoomCard" value="100" v-model="cardCounts"> 100张房卡
</label>
<label>
<input type="radio" name="askRoomCard" value="200" v-model="cardCounts"> 200张房卡
</label>
</div>
<div class="text-center">
<button class="btn btn-suoka closes" @click="askCard">索要房卡</button>
<p v-if="lang.payWeChat"><small class="chengse">{{lang.payWeChat}}</small></p>
</div>
</div>
</div>
<!-- /索要房卡 -->
<!-- 索要星星 -->
<div class="tab-pane fade" :class="{'active':selType=='requestStar','in':selType=='requestStar'}"
v-if="requestStarPower">
<div class="chongka mh-radio" style="padding-bottom: 50px;">
<div class="rowh he checkbox" style="margin-top: 20px; margin-bottom: 0;">
<label>
<input type="radio" name="askStar" value="1000" v-model="starCounts"> 一千个{{lang.starName}}
</label>
<label>
<input type="radio" name="askStar" value="10000" v-model="starCounts"> 一万个{{lang.starName}}
</label>
<label>
<input type="radio" name="askStar" value="50000" v-model="starCounts"> 五万个{{lang.starName}}
</label>
<label>
<input type="radio" name="askStar" value="100000" v-model="starCounts"> 十万个{{lang.starName}}
</label>
<label>
<input type="radio" name="askStar" value="500000" v-model="starCounts"> 五十万个{{lang.starName}}
</label>
<label>
<input type="radio" name="askStar" value="1000000" v-model="starCounts"> 一百万个{{lang.starName}}
</label>
</div>
<div class="text-center">
<button class="btn btn-suoka closes" @click="askStar">索要{{lang.starName}}</button>
<p v-if="lang.payWeChat"><small class="chengse">{{lang.payWeChat}}</small></p>
</div>
</div>
</div>
<!-- /索要星星 -->
<!-- 索要房卡记录 -->
<div class="tab-pane fade" :class="{'active':selType=='profile','in':selType=='profile'}" id="profile">
<div class="gk_lsjir mt_bt">
<table class="gk_table">
<tbody>
<tr v-for="(v, i) in orderList" :key="i">
<td>{{v.asktime.substr(5,11)}}</td>
<td>{{v.amount}}张</td>
<td>{{orderState(v.state)}}</td>
</tr>
<tr v-show="!orderList[0]">
<td colspan="3" class="text-center">暂无记录</td>
</tr>
</tbody>
</table>
</div>
</div>
<!-- 索要房卡记录 -->
<!-- 索要星星记录 -->
<div class="tab-pane fade" :class="{'active':selType=='askStarRecord','in':selType=='askStarRecord'}" v-if="requestStarPower">
<div class="gk_lsjir mt_bt">
<table class="gk_table">
<tbody>
<tr v-for="(v, i) in orderStarList" :key="i">
<td>{{v.asktime.substr(5,11)}}</td>
<td>{{v.amount}}个</td>
<td>{{orderState(v.state)}}</td>
</tr>
<tr v-show="!orderStarList[0]">
<td colspan="3" class="text-center">暂无记录</td>
</tr>
</tbody>
</table>
</div>
</div>
<!-- 索要星星记录 -->
</template>
<!-- 代理自购 -->
<div class="tab-pane fade text-center"
:class="{'active':selType=='sales-buy-card','in':selType=='sales-buy-card'}" id="sales-buy-card"
v-if="buyPower">
<product-list :type="0" @update:change-product-id="changeProductInfo"></product-list>
<p class="money">金额:<span class="red">{{money}}</span></p>
<div class="text-left" style="padding: 10px 15px; text-indent: 2em;">
<p class="text-primary">1、房卡获取后在“可赠送房卡”账户中不能立即在游戏内使用需要赠送给需要的玩家ID账户中才可使用。</p>
<p class="text-primary">2、{{lang.starName}}获取后直接充值到玩家ID账户中可立即在游戏内使用。</p>
<div class="clearfix"><span class="question" @click="showNotice"></span></div>
</div>
<div style="position:fixed; bottom: 50px; left: 0; right: 0; height: 55px;">
<button @click="createBillV2" class="btn btn-success center-block" style="width: 80%;font-size: 16px;">支付</button>
</div>
</div>
<!-- /代理自购 -->
<!-- 获取记录 -->
<div class="tab-pane fade text-center"
:class="{'active':selType=='buy-record','in':selType=='buy-record'}" id="buy-record"
v-if="buyPower">
<div class="form-group" v-if="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="buyRecordV2" class="btn btn-primary center-block w60">查询</button>
</div>
<div style="padding: 8px;">
<div class="table-responsive mt15" v-show="queryCardList[0] || queryStarList[0]">
<table class="table">
<thead>
<tr>
<th>金额</th>
<th>数量</th>
<th>时间</th>
</tr>
</thead>
<tbody>
<tr v-for="(v, i) in queryCardList">
<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.product_money}}</td>
<td>{{v.star_amount}}</td>
<td>{{v.pay_time.substr(5,11)}}</td>
</tr>
</tbody>
</table>
</div>
<div class="table-responsive mt15" v-show="buyOrderList[0]">
<table class="table">
<thead>
<tr>
<th>产品类型</th>
<th>金额</th>
<th>数量</th>
<th>时间</th>
</tr>
</thead>
<tbody>
<tr v-for="(v, i) in buyOrderList">
<td>{{productType(v.product_type)}}</td>
<td>{{v.pay_money}}</td>
<td>{{v.product_amount}}</td>
<td>{{timeFormat(v.order_time)}}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- /获取记录 -->
</div>
</section>
</div>
<manage-nav></manage-nav>
</section>
<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="./lang/lang.js?__HTML_VERSION__=14"></script>
<script src="./js/function.js?__HTML_VERSION__=18"></script>
<script src="./components/home-nav.js?__HTML_VERSION__=12"></script>
<script src="./components/sales-info.js?__HTML_VERSION__=11"></script>
<script src="./components/product-list.js?__HTML_VERSION__=9"></script>
<script>
new Vue(
{
el: '#app',
components: {
'sales-info': salesInfo,
'manage-nav': homeNav,
'product-list': productList
},
data: {
isLoading: true,
salesId: '',
cardCounts: '',
starCounts: '',
lang: {},
params: {},
agentInfo: {},
parentInfo: {},
wxInfo: {},
userInfo: {},
isGetOrderList: false,
orderList: [], // 索要房卡订单列表
orderStarList: [], // 索要星星订单列表
checkedProductId: '',
index: 'card', // productList 返回的产品类型
type: 'card', // 查询记录的类型
money: 0,
billInfo: {},
queryCardList: [],
queryStarList: [],
buyOrderList: [],
selType: "sales-buy-card"
},
computed: {
buyPower: function () {
return true;
/*if (this.userInfo.salespower.substr(3, 4) == 2)
return true;
return false;*/
},
requestStarPower: function () {
return this.lang.openRequestStar;
}
},
methods: {
showNotice: function() {
var msg = '<div style="text-align: left;">'+
'<p style="text-indent: 2em">1、您支付充值钻石后将自动转换为鲜花道具同时赠送相应的房卡或星星等道具</p>' +
'<p style="text-indent: 2em">2、若获取道具有VIP标识则支付后会开通玩家的VIP权限</p></div>';
layer.open({
content: msg,
btn: '我知道了',
yes: function (i) {
layer.close(i);
},
no: function (i) {
layer.close(i);
}
})
},
// 订单状态
orderState: function (type) {
type = parseInt(type);
if (type === 0) return '待发放';
else if (type === 1) return '已发放';
else if (type === 2) return '已取消';
else if (type === 3) return '已忽略';
else return '异常';
},
askCard: function () {
try {
var that = this;
if (!this.cardCounts) throw '请选择数量';
if (!that.userInfo.salesid) throw '没有获取到你的ID';
$.api(
'agent.demand.newOrder',
{
agentid: that.params.agentid,
channelid: that.params.channelid,
billtype: 1,
askid: that.userInfo.salesid,
amount: that.cardCounts
},
function () {
$.alert('索要成功');
}, 1
)
} catch (e) {
$.alert(e);
}
},
// 索要星星
askStar: function () {
try {
var that = this;
if (!this.starCounts) throw '请选择数量';
if (!that.userInfo.salesid) throw '没有获取到你的ID';
$.api(
'agent.demand.newOrder',
{
agentid: that.params.agentid,
channelid: that.params.channelid,
billtype: 3,
askid: that.userInfo.salesid,
amount: that.starCounts
},
function () {
$.alert('索要成功');
}, 1
)
} catch (e) {
$.alert(e);
}
},
// 索要记录
getOrderList: function () {
if (!this.isGetOrderList && this.parentInfo.parentid) {
var that = this;
$.api(
'agent.demand.orderList',
{
agentid: that.params.agentid,
channelid: that.params.channelid,
askid: that.userInfo.salesid,
billtype: 1
},
function (orderList) {
that.isGetOrderList = true;
that.orderList = orderList.list;
}
)
}
},
// 索要星星记录
getOrderStarList: function () {
if (this.parentInfo.parentid) {
var that = this;
$.api(
'agent.demand.orderList',
{
agentid: that.params.agentid,
channelid: that.params.channelid,
askid: that.userInfo.salesid,
billtype: 3
},
function (orderList) {
that.orderStarList = orderList.list;
}
)
}
},
bindSales: function () {
try {
if (!this.salesId) throw '请输入邀请码';
if (!$.isRightId(this.salesId)) throw '请输入正确的邀请码';
var that = this;
$.confirm(function () {
$.api(
'agent.agent.bindRecommend',
{
agentid: that.params.agentid,
channelid: that.params.channelid,
openid: that.wxInfo.openid,
unionid: that.wxInfo.unionid,
salesid: that.salesId
},
function (res) {
that.parentInfo = {avatar: res.avatar, name: res.nickname, parentid: res.salesid};
$.alert('绑定成功');
}, true
)
})
} catch (e) {
$.alert(e);
}
},
changeProductInfo: function (v) {
this.checkedProductId = v.productid;
this.index = v.index;
this.money = v.money;
},
createBill: function () {
try {
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.userInfo.player_id,
salesid: that.userInfo.salesid
}
}
else {
method = 'agent.order.createOrder';
orderParams = {
agentid: that.params.agentid,
channelid: that.params.channelid,
openid: that.wxInfo.openid,
unionid: that.wxInfo.unionid,
billtype: 1,
productid: that.checkedProductId,
salesid: that.userInfo.salesid
};
}
$.api(
method,
orderParams,
function (r) {
that.billInfo = r;
layer.open(
{
content: '确认支付?',
btn: ['支付', '取消'],
yes: function (i) {
layer.close(i);
$.loading();
$.toPay(that.params, that.agentInfo, that.wxInfo, r, that.index, that.userInfo.salesid, 'sales');
}
});
}, 1)
} catch (e) {
$.alert(e);
}
},
createBillV2: function () {
try {
if (!this.checkedProductId) throw '请选择要获取的商品';
var that = this;
var method = 'agent.order.ordernew';
var orderParams = {
agentid: that.params.agentid,
channelid: that.params.channelid,
openid: that.wxInfo.openid,
unionid: that.wxInfo.unionid,
billtype: 1,
productid: that.checkedProductId,
salesid: that.userInfo.salesid,
playerid: that.userInfo.player_id
};
$.api(
method,
orderParams,
function (r) {
that.billInfo = r;
layer.open(
{
content: '确认支付?',
btn: ['支付', '取消'],
yes: function (i) {
layer.close(i);
$.loading();
$.toPay(that.params, that.agentInfo, that.wxInfo, r, that.index, that.userInfo.salesid, 'sales');
}
});
}, 1)
} catch (e) {
$.alert(e);
}
},
buyRecord: function () {
var that = this;
this.queryCardList = [];
this.queryStarList = [];
if (that.type === 'card') {
$.api(
'agent.card.buyCardRecord',
{agentid: that.params.agentid, openid: that.wxInfo.openid, type: 1},
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)
}
},
buyRecordV2: function () {
var that = this;
$.api(
'agent.order.orderlist',
{
agentid: that.params.agentid,
channelid: that.params.channelid,
salesid: that.userInfo.salesid,
player: that.userInfo.player_id,
ordertype: 1,
pageindex: 1,
pagesize: 10
},
function (res) {
if(res.length && res.length > 0)
that.buyOrderList = res;
else
$.alert('暂无记录');
}
)
},
productType: function (type) {
if(type == 0)
return '房卡';
else if(type == 1)
return this.lang.starName;
else if(type == 2)
return '钻石';
else
return '未定义';
},
timeFormat: function (timestamp) {
// 生成时间对象
var date = new Date(timestamp * 1000);
// 格式
var fmt = 'MM-dd hh:mm';
var o = {
"M+": date.getMonth() + 1, // 月份
"d+": date.getDate(), // 日
"h+": date.getHours(), // 小时
"m+": date.getMinutes(), // 分
"s+": date.getSeconds(), // 秒
"q+": Math.floor((date.getMonth() + 3) / 3), // 季度
"S": date.getMilliseconds() // 毫秒
};
if (/(y+)/.test(fmt))
fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o)
if (new RegExp("(" + k + ")").test(fmt))
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
return fmt;
}
},
created: function () {
this.params = $.getQueryObj();
this.lang = lang[this.params.agentid] ? lang[this.params.agentid] : lang.default;
var that = this;
$.getAgentInfo(function (agentInfo) {
that.agentInfo = agentInfo;
$.getWxInfo(function (wxInfo) {
that.wxInfo = wxInfo;
$.getUserInfo(function (userInfo) {
that.userInfo = userInfo;
// 我绑定的上级代理信息
$.api(
'agent.agent.myRecommend',
{
agentid: that.params.agentid,
channelid: that.params.channelid,
openid: wxInfo.openid,
unionid: wxInfo.unionid,
salesid: that.userInfo.salesid,
type: 0
},
function (parentInfo) {
that.parentInfo = parentInfo;
that.getOrderList();
if(that.lang.openRequestStar)
that.getOrderStarList();
that.isLoading = false;
}
)
})
})
})
}
}
)
</script>
<!--<script src="js/public-z.js?__HTML_VERSION__=3" type="text/javascript"></script>-->
<script>
$(".suoyaofk>a.faka").click(function () {
var obj = $(this);
obj.addClass("btn-fangka").removeClass("btn-default");
obj.siblings().removeClass("btn-fangka").addClass("btn-default");
});
$(".mh-radio .he label input[type='radio']").click(function () {
var obj = $(this);
obj.parent("label").addClass("active");
obj.parent("label").siblings("label").removeClass("active");
});
</script>
</body>
</html>