123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- import $request, {InstructionsCacheType} from "$utils/request";
- import personalDetail from '$utils/control/personal-detail';
- export default {
- data(){
- return {
- number:1
- }
- },
- methods:{
- // 下单
- placeOrder(){
- if (this.userInfo && this.userInfo.is_player) {
- return personalDetail.placeOrder(this.number || 1,this.userInfo.gameList,this.userInfo);
- }
- },
- // 获取陪玩信息
- getPlayerList(){
- this.number = 1;
- return this.$request({
- url:'player/get_player_list',
- data:{
- uid: this.uid,
- },
- token:true,
- page:{
- page:1,
- pageSize:1
- },
- cache:{
- type: InstructionsCacheType.memory,
- id:'get_player_list_'+this.uid
- }
- });
- },
- // 获取用户信息
- getUserInfo(requestUnique){
- this.getPlayerList().then((data)=>{
- if (this.requestUnique === requestUnique) {
- let requestAjax = [personalDetail.getPlayInfo({
- uid:this.uid
- })];
- let pid = 0;
- if (data.data && data.data.length > 0) {
- pid = data.data[0].pid;
- requestAjax.push(personalDetail.getPlayList({
- pid
- }));
- }
- Promise.all(requestAjax).then(([user,gameList])=>{
- if (this.requestUnique === requestUnique) {
- user = user.data || {};
- if (gameList) {
- gameList = gameList.data.palyer_game_list || [];
- let unshiftData = undefined;
- gameList.map((item,index)=>{
- if (this.pid && item.pid === this.pid) {
- unshiftData = item;
- }
- });
- if (!unshiftData && gameList[0]) {
- unshiftData = gameList[0];
- }
- user.gameList = gameList;
- user.gameItem = unshiftData;
- user.pid = this.pid || pid;
- user.is_player = !!user.pid;
- // 游戏列表
- let gameCate = this.$store.state.cate.gameCate || [];
- gameCate = gameCate[0] && gameCate[0].children || [];
- for (let i=0,count=gameCate.length;i<count;i++){
- if (gameCate[i] && gameCate[i].game_name === user.gameItem.game_name) {
- user.gameItem.gameInfo = gameCate[i];
- break;
- }
- }
- }
- if (data.data[0]) {
- let playInfo = data.data[0];
- user.stay_roominfo = playInfo.stay_roominfo;
- user.guanming = playInfo.guanming;
- user.is_business = playInfo.is_business;
- user.is_player = true;
- }
- this.userInfo = user || {};
- this.setFollow(user);
- this.sendMessageScroll();
- this.loadingStatus = false;
- // obj.success([{}]);
- }
- })
- }
- });
- },
- }
- }
|