Authored by 肖亚东

我的门票接口联调等

Component({
properties: {
undoneData: null,
data: {
type: Array,
value: [],
},
},
data: {
list: ['a', 'b', 'c', 'd', 'e'],
swiperCurrent: 0,
ticketCode: ''
},
ready: function() {
let swiperCurrent = this.data.swiperCurrent;
if (swiperCurrent < this.properties.data.length) {
let ticket = this.properties.data[swiperCurrent].ticks[0];
let ticketCode = ticket.ticket_code || '';
this.setData({
ticketCode
});
}
},
methods: {
swiperChange: function (e) {
... ... @@ -17,9 +30,14 @@ Component({
rightSlide() {
let swiperCurrent = this.data.swiperCurrent;
swiperCurrent += 1;
if (swiperCurrent < this.data.list.length) {
let ticketCode = this.data.ticketCode;
if (swiperCurrent < this.properties.data.length) {
let ticket = this.properties.data[swiperCurrent].ticks[0];
let ticketCode = ticket.ticket_code || '';
this.setData({
swiperCurrent
swiperCurrent,
ticketCode
});
}
},
... ... @@ -28,8 +46,12 @@ Component({
let swiperCurrent = this.data.swiperCurrent;
if (swiperCurrent > 0) {
swiperCurrent -= 1;
let ticket = this.properties.data[swiperCurrent].ticks[0];
let ticketCode = ticket.ticket_code || '';
this.setData({
swiperCurrent
swiperCurrent,
ticketCode
});
}
},
... ...
<view class="container">
<view class="ticket-number">取票号:19941214</view>
<view class="ticket-number">取票号:{{ticketCode}}</view>
<view class="ticket-content">
<image src="../../../static/images/left_arraw@3x.png" class="left-slide" bindtap="leftSlide"></image>
<swiper class="scroll-box" wx:if="{{list.length > 0}}" bindchange="swiperChange" current="{{swiperCurrent}}">
<block wx:for="{{list}}" wx:key="index">
<swiper class="scroll-box" wx:if="{{data.length > 0}}" bindchange="swiperChange" current="{{swiperCurrent}}">
<block wx:for="{{data}}" wx:key="index">
<swiper-item>
<view class="card">
<text>{{item}}</text>
<image src="{{item.ticks[0].qr_image}}" class="qr-image"></image>
</view>
</swiper-item>
</block>
... ... @@ -18,6 +17,6 @@
</view>
<view class="ticket-index">{{swiperCurrent+1}}/{{list.length}}</view>
<view class="ticket-index">{{swiperCurrent+1}}/{{data.length}}</view>
</view>
... ...
... ... @@ -54,11 +54,11 @@
}
.card{
display: flex;
justify-content: center;
align-items: center;
width: 300rpx;
height: 300rpx;
font-size: 40px;
background: lightblue;
}
.qr-image {
width: 300rpx;
height: 300rpx;
}
... ...
//****** 线上环境url,提交代码务必检查确认 ******
export const API_HOST = 'https://api.yoho.cn';
export const SERVICE_HOST = 'https://api.yoho.cn';
export const APP_REPORT_HOST = 'https://app.yoho.cn/collect/v3';
export const LOG_EVENT_HOST = 'https://analysis.yohobuy.com/yas_mobile';
export const ACTIVITY_HOST = 'https://action.yoho.cn';
// export const API_HOST = 'https://api.yoho.cn';
// export const SERVICE_HOST = 'https://api.yoho.cn';
// export const APP_REPORT_HOST = 'https://app.yoho.cn/collect/v3';
// export const LOG_EVENT_HOST = 'https://analysis.yohobuy.com/yas_mobile';
// export const ACTIVITY_HOST = 'https://action.yoho.cn';
// export const ACTIVITY_HOST = 'http://192.168.102.49:6006';
// *********开发环境*********
// export const API_HOST = 'http://dev-api.yohops.com:9999';
// export const SERVICE_HOST = 'http://dev-api.yohops.com:9999/';
// *********测试1环境*********
// export const API_HOST = 'http://api-test1.yohops.com:9999';
// export const SERVICE_HOST = 'http://api-test1.yohops.com:9999/';
// *********测试2环境*********
// export const API_HOST = 'http://api-test2.dev.yohocorp.com';
// export const SERVICE_HOST = 'http://api-test2.dev.yohocorp.com';
// *********测试3环境*********
// export const API_HOST = 'http://api-test3.dev.yohocorp.com';
// export const SERVICE_HOST = 'http://api-test3.dev.yohocorp.com';
export const API_HOST = 'http://api-test3.dev.yohocorp.com';
export const SERVICE_HOST = 'http://api-test3.dev.yohocorp.com';
export const ACTIVITY_HOST = 'http://192.168.102.49:6006';
// *********灰度环境*********
// export const API_HOST = 'https://apigray.yoho.cn';
// export const SERVICE_HOST = 'https://apigray.yoho.cn';
//yohood
export const APP_ID = 'wxcb240985c23923fd';
export const CLIENT_TYPE = 'miniapp';
export const BUSINESS_LINE = 'miniappYHD';
export const MINI_APP_TYPE = '66';
export const PAYMENT_CODE = '45';
export const PRIVATE_KEY = 'b43890b0a296ff3c7b8c260ca763980b';
export const OS_VERSION = 'yohobuy:h5';
export const APP_VERSION = '2.9.7';
export const PAYMENT_CODE = '45';
export const OS_VERSION = 'yohobuy:h5';
export const APP_VERSION = '6.9.0';
export const APP_BUILD = '1046';
export const APP_ID = 'wxcb240985c23923fd';
export const PRIVATE_KEY = 'b43890b0a296ff3c7b8c260ca763980b';
export const CLIENT_TYPE = 'miniapp';
export const BUSINESS_LINE = 'miniappYHD';
export const JUMP_BRAND = 'go.brand';
export const JUMP_DETAIL = 'go.detail';
... ...
... ... @@ -4,10 +4,7 @@ import { jumpByUrl } from '../../libs/urlRoute';
let app = getApp();
let bannerW = 640;
let bannerH = 310;
let itemWidth = Math.ceil((app.globalData.systemInfo.windowWidth - 40) / 3);
let itemHeight = itemWidth - 40;
const windowWidth = app.globalData.systemInfo.windowWidth;
const windowHeight = app.globalData.systemInfo.windowHeight;
const scrollHeight = windowHeight;
... ... @@ -17,10 +14,10 @@ Page({
*/
data: {
scrollHeight,
itemWidth,
itemHeight,
scrollToView: '',
floatViewTop: 70,
showFloatView: false,
brandsList: [],
all_list: [],
... ... @@ -94,7 +91,27 @@ Page({
handlerAlphaTap(e) {
let { ap } = e.target.dataset;
this.setData({ scrollToView: ap });
let query = '#' + ap;
let pixelRatio = windowWidth/750;
let that = this;
wx.createSelectorQuery().selectAll(query).boundingClientRect(function (res) {
if(res && !that.data.showFloatView) {
var floatViewTop = (res[0].top + res[0].height/2) / pixelRatio;
floatViewTop += 70;
that.setData({
scrollToView: ap,
floatViewTop,
showFloatView: true
});
setTimeout(() => {
that.setData({
showFloatView: false
});
}, 500);
}
}).exec()
},
dismissSearchView(e) {
... ...
... ... @@ -25,8 +25,12 @@
</scroll-view>
<view class="alphanet-selector" data-id="selector" catchtouchstart="handlerAlphaTap" catchtouchmove="handlerMove">
<view class="float-view">{{item.letter}}</view>
<view class="selector-one" hover-class="hover-class" data-ap="{{item.letter=='#' ? 'last' : item.letter}}" wx:for="{{brandsList}}" wx:key="unique">
<view class="float-view" style="top:{{floatViewTop}}rpx;display:{{showFloatView?'':'none'}};">
<image class="bubble" src="../../static/images/bubble@3x.png">
<view class="float-letter">{{scrollToView}}</view>
</image>
</view>
<view id="{{item.letter == '#' ? 'last' : item.letter}}" class="selector-one" hover-class="hover-class" data-ap="{{item.letter=='#' ? 'last' : item.letter}}" wx:for="{{brandsList}}" wx:key="unique">
{{item.letter}}
</view>
</view>
... ...
... ... @@ -57,7 +57,7 @@
}
.alphanet-selector {
position: absolute;
position: fixed;
top: 0px;
bottom: 0px;
right: 0;
... ... @@ -95,14 +95,28 @@
.float-view {
width: 72rpx;
height: 72rpx;
background-color: #D8D8D8;
text-align: center;
position: absolute;
right: 50rpx;
}
.bubble {
position: absolute;
left: 0;
top: 0;
width: 88rpx;
height: 72rpx;
}
.float-letter {
position: absolute;
left: 0;
top: 8rpx;
width: 72rpx;
height: 72rpx;
font-family: SanFranciscoText-Semibold;
font-weight: bold;
font-size: 40rpx;
color: #FFFFFF;
letter-spacing: 0;
text-align: center;
margin-right: 34rpx;
}
.selector-one_serachIcon {
... ...
... ... @@ -2,7 +2,7 @@ import {API_HOST, SERVICE_HOST} from '../../libs/config';
import {GET, POST} from '../../libs/request';
import jumpToMiniapp from '../../router/jump-to-miniapp';
import wx from '../../utils/wx';
import { decodePhoneNumber, wechatLoginAction, getUnionID, decodeUnionId, openAuthorizeSettings, listen} from '../../utils/login';
import { decodePhoneNumber, getUnionID, decodeUnionId, openAuthorizeSettings, listen} from '../../utils/login';
const ACTION_TYPE = {
GOBUY: 0, //去购买
... ... @@ -32,12 +32,12 @@ Page({
},
noTicket: true,
noActivity: true,
array: [ { 'applyed': false, 'activityId': '123' }, { 'applyed': false, 'activityId': '456' }],
isLogin: false,
userInfo: {},
hasUnionID: '',
ticketData: [],
},
onLoad: function(options) {
//Do some initialize when page load.
... ... @@ -54,6 +54,9 @@ Page({
this.showUserInfo();
}
}.bind(this))
this.fetchTicketInfo();
},
onReady: function() {
//Do some when page ready.
... ... @@ -73,6 +76,29 @@ Page({
},
fetchTicketInfo() {
// if (app.getUid()) {
let that = this;
let param = {
debug: 'XYZ',
method: "app.SpaceOrders.getQrByUid",
uid: '50000452'//app.getUid()
}
GET(API_HOST, param)
.then((json) => {
if (json && json.code && json.code == 200 && json.data) {
let ticketData = json.data;
that.setData({
ticketData
})
}
})
.catch(error => {
})
// }
},
//点击我的二维码
tapMyQRCode() {
... ...
... ... @@ -31,17 +31,17 @@
<!-- 我的门票 -->
<section-header title="我的门票" more-title="全部订单" has-more="true" bind:tapMore="jumpAllOrders"></section-header>
<block wx:if="{{noTicket}}">
<block wx:if="{{ticketData.length==0}}">
<undone-view undone-data="{{cur_undoneTicket}}" bind:jumpAllOrders="jumpAllOrders" bind:tapButton="tapButton"></undone-view>
</block>
<block wx:else>
<ticket-slide></ticket-slide>
<ticket-slide data="{{ticketData}}"></ticket-slide>
</block>
<view class="space-view"></view>
<!-- <view class="space-view"></view> -->
<!-- 我的活动 -->
<section-header title="我的活动" more-title="更多活动" has-more="{{!noActivity}}" bind:tapMore="jumpMoreActivity"></section-header>
<!-- <section-header title="我的活动" more-title="更多活动" has-more="{{!noActivity}}" bind:tapMore="jumpMoreActivity"></section-header>
<block wx:if="{{noActivity}}">
<undone-view undone-data="{{notJionActivity}}" bind:tapButton="tapButton"></undone-view>
</block>
... ... @@ -63,7 +63,8 @@
<view wx:if="{{index!=array.length-1}}" class="space-view40"></view>
</block>
</scroll-view>
</block>
</block> -->
</block>
</view>
... ...