Files
youlegames/codes/agent/game/dlweb/api/web2/gift_pack.html
2026-03-15 01:27:05 +08:00

298 lines
8.8 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!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">
<link rel="stylesheet" href="./libs/bootstrap/bootstrap.min.css?__HTML_VERSION__=3">
<link rel="stylesheet" href="js/datetimepicker/bootstrap-datetimepicker.min.css?__HTML_VERSION__=3">
<link rel="stylesheet" href="css/style.css?__HTML_VERSION__=6">
</head>
<body class="bg_hui">
<div class="count_full" id="app" v-show="!isLoading" style="display: none">
<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">
<ul id="myTabs" class="nav nav-tabs" role="tablist">
<li id="li_gift" :class="{'active':selType=='gift'}" @click="selType='gift'">
<a href="javascript:;" id="gift-tab">礼包</a>
</li>
<li :class="{'active':selType=='giftlist'}" @click="selType='giftlist'">
<a href="javascript:;">礼包列表</a>
</li>
</ul>
</div>
</div>
</div>
</div>
<div id="myTabContent" class="tab-content">
<!-- 礼包 -->
<div class="tab-pane fade" id="gift" :class="{active: selType=='gift', in: selType=='gift'}">
<div class="chongka">
<div class="rowh he">
<span class="name">礼包大小:</span>
<input type="number" placeholder="请输入数量" class="input" v-model="giftAmount">
</div>
<div class="rowh text-center conkabtn">
<a href="javascript:;" class="btn btn-warning closes" @click="pack">打包</a>
</div>
</div>
</div>
<!-- /礼包 -->
<!-- 礼包列表 -->
<div class="tab-pane fade" :class="{active: selType=='giftlist', in: selType=='giftlist'}">
<div class="chongka">
<div class="rowh text-center conkabtn">
<a href="javascript:;" class="btn btn-warning closes" @click="getgiftList(0)">查询</a>
</div>
<table class="ckjr_table">
<tbody>
<tr v-for="(v,i) in giftList">
<td>
<p>数量:{{parseInt(v.amount)}}</p>
</td>
<td>
<button class="btn btn-primary" @click="shareGiftLink(v.id, 0)">复制链接</button>
<button class="btn btn-success" @click="shareGiftLink(v.id, 1)" v-if="isWxLogin">分享给朋友</button>
</td>
</tr>
</tbody>
<tfoot v-show="(giftList.length && giftList.length < count)">
<tr class="text-center">
<td colspan="2"><a href="javascript:;" @click="getgiftList(1)" class="btn btn-link" style="color: #23527c;">查看更多</a></td>
</tr>
</tfoot>
</table>
</div>
</div>
<!-- /礼包列表 -->
</div>
</section>
<div class="panel-img" style="position:fixed;top:0;left:0;bottom:0;right:0;z-index: 999;display: none" onclick="this.style.display='none';">
<img src="./images/share.png" style="width:100%;height: 100%;">
</div>
<home-nav></home-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="https://res.wx.qq.com/open/js/jweixin-1.2.0.js?__HTML_VERSION__=3"></script>
<script src="./libs/layer_mobile/layer.js?__HTML_VERSION__=3"></script>
<script src="js/datetimepicker/bootstrap-datetimepicker.min.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/home-nav.js?__HTML_VERSION__=12"></script>
<script src="./components/sales-info.js?__HTML_VERSION__=11"></script>
<script>
var vm = new Vue(
{
el: "#app",
components: {
'sales-info': salesInfo,
'home-nav': homeNav
},
data: {
isLoading: true,
isWeiXin: false,
lang: {},
agentInfo: {},
myInfo: {},
sidScode: {},
urlParam: {},
selType: "gift",
pageIndex: 1,
pageSize: 10,
count: 0,
wxSignature: {},
giftAmount: '',
giftList: []
},
computed: {
searchParams: function () {
return '?agentid=' + this.urlParam.agentid + '&channelid=' + this.urlParam.channelid;
},
isWxLogin: function () {
var type = parseInt(this.myInfo.logintype);
if(type === 0) {
return true;
}
return false;
},
/**
* 接收礼物的链接
* @returns {string}
*/
giftUrl:function () {
var url = window.location.origin + window.location.pathname;
url = url.replace('gift_pack', 'gift');
return url;
},
shareParams: function () {
// 获取微信签名参数
var that = this;
var shareParams = $.extend({}, that.sidScode, {
appid: that.agentInfo.youle_appid,
devkey: that.agentInfo.youle_devkey
});
return shareParams;
}
},
methods: {
pack: function () {
var that = this;
try {
if (this.giftAmount < 1) throw "请输入正确数量";
$.api(
'agent.gift.newgift',
{
agentid: that.urlParam.agentid,
channelid: that.urlParam.channelid,
salesid: that.myInfo.salesid,
type: 1,
amount: that.giftAmount
},
function (res) {
$.alert('礼包打包成功');
}, 1
);
} catch (e) {
$.alert(e);
}
},
getgiftList: function (type) {
var that = this;
if(type === 0) {
this.pageIndex = 1;
this.giftList = [];
} else {
this.pageIndex++;
}
$.api(
'agent.gift.querygift',
{
agentid: that.urlParam.agentid,
channelid: that.urlParam.channelid,
salesid: that.myInfo.salesid,
pageindex: that.pageIndex,
pagesize: that.pageSize
},
function (res) {
if(res.list.length > 0) {
that.count = res.recordcount;
that.giftList = that.giftList.concat(res.list);
}
else
$.alert('暂无记录')
}, 1
);
},
/**
* 分享链接
* 0、点击按钮自动复制链接到剪切板
* 1、分享给朋友
* @param giftid
*/
shareGiftLink: function (giftid, type) {
console.log(giftid);
var that = this;
var url = this.giftUrl+this.searchParams+'&giftid='+giftid;
if(type === 0) {
var oInput = document.createElement('input');
oInput.value = url;
document.body.appendChild(oInput);
if($.whichSystem()) {
oInput.setSelectionRange(0, oInput.value.length);
if(document.execCommand('copy', false, null)){
//success info
$.alert("复制成功")
} else{
//fail info
$.alert("复制失败")
}
} else {
oInput.select(); // 选择对象
if(document.execCommand('copy')){
//success info
$.alert("复制成功")
} else{
//fail info
$.alert("复制失败")
}
}
oInput.style.display = 'none';
//oInput.remove();
//$.alert('复制成功');
} else {
// 微信分享
if(this.isWxLogin) {
$(".panel-img").show();
if(that.wxSignature.appId) {
that.shareLinkPlayer(url);
} else {
$.shareLink(that.shareParams, function (data) {
that.wxSignature = data;
that.shareLinkPlayer(url);
})
}
}
}
},
shareLinkPlayer: function (url) {
var that = this;
var param = {
title: '礼包',
desc: '领取礼包',
link: url,
imgUrl: (this.agentInfo.share_img || this.agentInfo.agentlogo)
};
$.setShareLink(that.wxSignature, param);
}
},
created: function () {
this.urlParam = $.getQueryObj();
this.lang = lang[this.urlParam.agentid] ? lang[this.urlParam.agentid] : lang.default;
var that = this;
if(this.isWxLogin) {
$.getSidScode(function (sidScode) {
that.sidScode = sidScode;
});
}
$.getAgentInfo(function (agentInfo) {
that.agentInfo = agentInfo;
$.getUserInfo(function (r) {
that.myInfo = r;
that.isLoading = false;
});
});
}
});
</script>
</body>
</html>