增加武极天下的支付功能

This commit is contained in:
zhl 2021-08-20 20:13:05 +08:00
parent 41d5cff1f3
commit 771f1c2c9f
9 changed files with 654 additions and 80 deletions

View File

@ -1,76 +1,102 @@
{
"description": "游戏电商小程序",
"setting": {
"urlCheck": false,
"es6": false,
"postcss": false,
"minified": false,
"newFeature": true,
"autoAudits": false,
"checkInvalidKey": true
},
"compileType": "miniprogram",
"appid": "wx815bf59d472c0a63",
"projectname": "gamemall",
"miniprogramRoot": "dist/",
"simulatorType": "wechat",
"simulatorPluginLibVersion": {},
"condition": {
"search": {
"current": -1,
"list": []
},
"conversation": {
"current": -1,
"list": []
},
"plugin": {
"current": -1,
"list": []
},
"game": {
"list": []
},
"miniprogram": {
"current": 3,
"list": [
{
"id": 0,
"name": "product_page",
"pathName": "pages/product",
"query": "gid=7002058&token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVjN2Y1NWIyYzQ0NzVmMWMzMDg4YjcxOSIsImFjY291bnRfaWQiOiI2MDAxXzgwMDRfbzVGclg1WG45eHM4d1pmdHlSYVd4ZEVuQ2FyMCIsInNlc3Npb25faWQiOiIxNTUxODQ4ODgxXzE1NTE4NDg0NjVfNmFhZjNlMTQzNWMxNDNiODdkYzI0MWU2ZTQ0MGYwMmFfNjgxYzhiYWUxZGI0ODFiMDdkYmQxNzJjYmMwNDVlYWQiLCJpYXQiOjE1NTE4NDg4ODJ9.kdTs8UIGP9sxdZN7cpO047bBg69SBUQn6BMZ0Ndckgg",
"scene": null
},
{
"id": 1,
"name": "vip_page",
"pathName": "pages/buyvip",
"query": "token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVjNmUxYjk3NDA5MGY5NTYxM2M3YjgxOSIsImFjY291bnRfaWQiOiI2MDAxXzgwMDNfb0pZYXA1WlZSV0RGRm9Qd09GcGllQmVNRkVocyIsInNlc3Npb25faWQiOiIxNTUwNzU0Njg5XzE1NTA3MTc1OTRfYjA5YTVmOWYxODM0NDFmOWUxMDk1MGJmOTUyZTRjMjFfNTcyOWRkOWYyMzQ5NzdlM2IwMGNjOGFjYWRjMjFiOTQiLCJpYXQiOjE1NTA3NTQ2ODl9.GkUGGb2vwTE1xgZ-UKwl6Tfs3NFawE2V3ZAH91_syY4",
"scene": null
},
{
"id": 2,
"name": "exchange-result",
"pathName": "pages/exchange-result",
"query": "",
"scene": 1037,
"referrerInfo": {
"appId": "4562388888889",
"extraData": "{ \t\"accountId\": \"6001_1004_oQmL74u7TBo94aGpKIGNCZD9rKew\", \t\"sessionId\": \"1566525470_1563178315_f37bcfd5c3b82fd28d00d18273e7f1a5_53c8e916459a621c1e5021fba99c9212\", \t\"gameId\": \"8002\", \t\"channelId\": \"6001\", \"recordId\": \"5d5fa7ea6f8cb82bc0195750\" }"
}
},
{
"id": 3,
"name": "pages/exchange-record",
"pathName": "pages/exchange-record",
"query": "",
"scene": 1037,
"referrerInfo": {
"appId": "12344",
"extraData": "{ \t\"accountId\": \"6001_1004_oQmL74u7TBo94aGpKIGNCZD9rKew\", \t\"sessionId\": \"1566525470_1563178315_f37bcfd5c3b82fd28d00d18273e7f1a5_53c8e916459a621c1e5021fba99c9212\", \t\"gameId\": \"8002\", \t\"channelId\": \"6001\", \"recordId\": \"5d5e81eedfd349387cace22c\" }"
}
}
]
}
}
"description": "游戏电商小程序",
"setting": {
"urlCheck": false,
"es6": false,
"postcss": false,
"preloadBackgroundData": false,
"minified": false,
"newFeature": true,
"coverView": true,
"autoAudits": false,
"showShadowRootInWxmlPanel": true,
"scopeDataCheck": false,
"checkInvalidKey": true,
"checkSiteMap": true,
"uploadWithSourceMap": true,
"useMultiFrameRuntime": true,
"useApiHook": true,
"useApiHostProcess": false,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
"useIsolateContext": true,
"userConfirmedBundleSwitch": false,
"packNpmManually": false,
"packNpmRelationList": [],
"minifyWXSS": true,
"showES6CompileOption": false
},
"compileType": "miniprogram",
"appid": "wx815bf59d472c0a63",
"projectname": "gamemall",
"miniprogramRoot": "dist/",
"simulatorType": "wechat",
"simulatorPluginLibVersion": {},
"condition": {
"search": {
"list": []
},
"conversation": {
"list": []
},
"plugin": {
"list": []
},
"game": {
"list": []
},
"miniprogram": {
"list": [
{
"id": 0,
"name": "product_page",
"pathName": "pages/product",
"query": "gid=7002058&token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVjN2Y1NWIyYzQ0NzVmMWMzMDg4YjcxOSIsImFjY291bnRfaWQiOiI2MDAxXzgwMDRfbzVGclg1WG45eHM4d1pmdHlSYVd4ZEVuQ2FyMCIsInNlc3Npb25faWQiOiIxNTUxODQ4ODgxXzE1NTE4NDg0NjVfNmFhZjNlMTQzNWMxNDNiODdkYzI0MWU2ZTQ0MGYwMmFfNjgxYzhiYWUxZGI0ODFiMDdkYmQxNzJjYmMwNDVlYWQiLCJpYXQiOjE1NTE4NDg4ODJ9.kdTs8UIGP9sxdZN7cpO047bBg69SBUQn6BMZ0Ndckgg",
"scene": null
},
{
"id": 1,
"name": "vip_page",
"pathName": "pages/buyvip",
"query": "token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVjNmUxYjk3NDA5MGY5NTYxM2M3YjgxOSIsImFjY291bnRfaWQiOiI2MDAxXzgwMDNfb0pZYXA1WlZSV0RGRm9Qd09GcGllQmVNRkVocyIsInNlc3Npb25faWQiOiIxNTUwNzU0Njg5XzE1NTA3MTc1OTRfYjA5YTVmOWYxODM0NDFmOWUxMDk1MGJmOTUyZTRjMjFfNTcyOWRkOWYyMzQ5NzdlM2IwMGNjOGFjYWRjMjFiOTQiLCJpYXQiOjE1NTA3NTQ2ODl9.GkUGGb2vwTE1xgZ-UKwl6Tfs3NFawE2V3ZAH91_syY4",
"scene": null
},
{
"id": 2,
"name": "exchange-result",
"pathName": "pages/exchange-result",
"query": "",
"scene": 1037,
"referrerInfo": {
"appId": "4562388888889",
"extraData": "{ \t\"accountId\": \"6001_1004_oQmL74u7TBo94aGpKIGNCZD9rKew\", \t\"sessionId\": \"1566525470_1563178315_f37bcfd5c3b82fd28d00d18273e7f1a5_53c8e916459a621c1e5021fba99c9212\", \t\"gameId\": \"8002\", \t\"channelId\": \"6001\", \"recordId\": \"5d5fa7ea6f8cb82bc0195750\" }"
}
},
{
"id": 3,
"name": "pages/exchange-record",
"pathName": "pages/exchange-record",
"query": "",
"scene": 1037,
"referrerInfo": {
"appId": "12344",
"extraData": "{ \t\"accountId\": \"6001_1004_oQmL74u7TBo94aGpKIGNCZD9rKew\", \t\"sessionId\": \"1566525470_1563178315_f37bcfd5c3b82fd28d00d18273e7f1a5_53c8e916459a621c1e5021fba99c9212\", \t\"gameId\": \"8002\", \t\"channelId\": \"6001\", \"recordId\": \"5d5e81eedfd349387cace22c\" }"
}
},
{
"name": "普通支付",
"pathName": "pages/normal",
"query": "gname=武极天下&pname=首充6元礼包&price=600&sname=双线10服&uname=azwe&oid=1231231313&aid=123123",
"scene": 1037,
"referrerInfo": {
"appId": "wxf184833bbfdc3d78",
"extraData": "{}"
}
}
]
}
}
}

View File

@ -0,0 +1,64 @@
{
"setting": {},
"condition": {
"plugin": {
"list": []
},
"game": {
"list": []
},
"gamePlugin": {
"list": []
},
"miniprogram": {
"list": [
{
"id": 0,
"name": "product_page",
"pathName": "pages/product",
"query": "gid=7002058&token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVjN2Y1NWIyYzQ0NzVmMWMzMDg4YjcxOSIsImFjY291bnRfaWQiOiI2MDAxXzgwMDRfbzVGclg1WG45eHM4d1pmdHlSYVd4ZEVuQ2FyMCIsInNlc3Npb25faWQiOiIxNTUxODQ4ODgxXzE1NTE4NDg0NjVfNmFhZjNlMTQzNWMxNDNiODdkYzI0MWU2ZTQ0MGYwMmFfNjgxYzhiYWUxZGI0ODFiMDdkYmQxNzJjYmMwNDVlYWQiLCJpYXQiOjE1NTE4NDg4ODJ9.kdTs8UIGP9sxdZN7cpO047bBg69SBUQn6BMZ0Ndckgg",
"scene": null
},
{
"id": 1,
"name": "vip_page",
"pathName": "pages/buyvip",
"query": "token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVjNmUxYjk3NDA5MGY5NTYxM2M3YjgxOSIsImFjY291bnRfaWQiOiI2MDAxXzgwMDNfb0pZYXA1WlZSV0RGRm9Qd09GcGllQmVNRkVocyIsInNlc3Npb25faWQiOiIxNTUwNzU0Njg5XzE1NTA3MTc1OTRfYjA5YTVmOWYxODM0NDFmOWUxMDk1MGJmOTUyZTRjMjFfNTcyOWRkOWYyMzQ5NzdlM2IwMGNjOGFjYWRjMjFiOTQiLCJpYXQiOjE1NTA3NTQ2ODl9.GkUGGb2vwTE1xgZ-UKwl6Tfs3NFawE2V3ZAH91_syY4",
"scene": null
},
{
"id": 2,
"name": "exchange-result",
"pathName": "pages/exchange-result",
"query": "",
"scene": 1037,
"referrerInfo": {
"appId": "4562388888889",
"extraData": "{ \t\"accountId\": \"6001_1004_oQmL74u7TBo94aGpKIGNCZD9rKew\", \t\"sessionId\": \"1566525470_1563178315_f37bcfd5c3b82fd28d00d18273e7f1a5_53c8e916459a621c1e5021fba99c9212\", \t\"gameId\": \"8002\", \t\"channelId\": \"6001\", \"recordId\": \"5d5fa7ea6f8cb82bc0195750\" }"
}
},
{
"id": 3,
"name": "pages/exchange-record",
"pathName": "pages/exchange-record",
"query": "",
"scene": 1037,
"referrerInfo": {
"appId": "12344",
"extraData": "{ \t\"accountId\": \"6001_1004_oQmL74u7TBo94aGpKIGNCZD9rKew\", \t\"sessionId\": \"1566525470_1563178315_f37bcfd5c3b82fd28d00d18273e7f1a5_53c8e916459a621c1e5021fba99c9212\", \t\"gameId\": \"8002\", \t\"channelId\": \"6001\", \"recordId\": \"5d5e81eedfd349387cace22c\" }"
}
},
{
"name": "武极支付",
"pathName": "pages/normal",
"query": "pname=首充6元礼包&price=600&sname=双线10服&uname=azwe&aid=123123&pid=7&uid=zhl&sid=10000&openid=oSsQK41xNe4ZSJI76wwVE3aNA_jM",
"scene": 1037,
"referrerInfo": {
"appId": "wxf184833bbfdc3d78",
"extraData": "{}"
}
}
]
}
}
}

View File

@ -31,6 +31,7 @@ export default class extends wepy.app {
'pages/product',
'pages/buyvip',
'pages/detail',
'pages/normal',
'pages/exchange-result',
'pages/exchange-record',
],
@ -55,6 +56,7 @@ export default class extends wepy.app {
sdkManage.init()
sdkManage.Login(() => {
jcEvent.emit(jcEvent.events.NEED_UPDATE_CFG, {})
jcEvent.emit(jcEvent.events.LOGIN_FINISHED, {})
console.log('finish parse jcfw')
})
//全局拦截器

View File

@ -2,11 +2,12 @@ const env = process.env.NODE_ENV === 'production' ? 'product' : 'test'; //produc
export default {
env: env,
// apiBase: 'http://192.168.100.232',
apiBase: env === 'test'? 'https://ghost-test.kingsome.cn' : 'https://ghost.kingsome.cn',
apiBase: env === 'test' ? 'https://ghost-test.kingsome.cn' : 'https://ghost.kingsome.cn',
wjtxPayUrl: env === 'test' ? 'https://game1009proxy-test.kingsome.cn/webapp/index.php?c=Pay&a=preOrder' : 'https://game1009proxy.kingsome.cn/webapp/index.php?c=Pay&a=preOrder',
version: '1.0.1',
gameTypes: ['射击','格斗', '角色扮演','动作角色扮演',
'赛车', '动作游戏','策略战棋', '其他',
gameTypes: ['射击', '格斗', '角色扮演', '动作角色扮演',
'赛车', '动作游戏', '策略战棋', '其他',
'益智游戏', '体育游戏', '冒险游戏', '模拟战略',
'桌面游戏', '音乐游戏', '第一人称射击'
]
}
};

View File

@ -9,6 +9,7 @@ var SDKManage = function() {
this.hasLogin = false;
this.vision = '1.0.0';
this.ChannelId = 6001;
this.gamelog = jcgamelog;
this.init = function() {
jcfw.init(this.ChannelId, this.gameId, this.isoffical);
};
@ -47,6 +48,7 @@ var SDKManage = function() {
console.log(res);
wx.setStorageSync('account', res);
self.account_id = res.account_id;
self.session_id = res.session_id;
self.doLogin();
},
(neterr, logicerr, errmsg) => {
@ -67,7 +69,14 @@ var SDKManage = function() {
};
var cbf = function(res) {
console.log('getGameConfig fail');
self.getGameConfig();
if (!self.cfgTryCount) {
self.cfgTryCount = 1;
} else {
self.cfgTryCount += 1;
}
if (self.cfgTryCount < 10) {
self.getGameConfig();
}
};
jcfw.cloud.initConfig(cb, cbf);
// jcfw.getConfig('',cb,cbf);

133
src/pages/io.wpy Normal file
View File

@ -0,0 +1,133 @@
<style lang="less">
.qrimg_content {
display: flex;
position: absolute;
width: 100%;
height: 300px;
top: 0;
justify-content: center;
background-color: white;
}
#myQrcode{
}
</style>
<template>
<view class="qrimg_content">
<canvas style="width: 300px; height: 300px;" canvas-id="myQrcode"></canvas>
</view>
<view class="qrimg_content">
<image class="qrimg" @tap="imageTap" src="{{imgData}}" show-menu-by-longpress style="width: 300px; height:300px;"></image>
</view>
</template>
<script>
import wepy from 'wepy';
import cfg from '../mixins/cfg';
import http from '../utils/http';
import g from '../common/global';
import jcEvent from '../common/jc-event';
let sdkManage = require('../jcfw/SDKManage');
export default class ProductPage extends wepy.page {
mixins = [cfg];
components = {
};
config = {
navigationBarTitleText: '购买产品'
};
data = {
imgData: ''
};
methods = {
imageTap: function(e) {
wepy.previewImage({
current: this.imgData,
urls: [this.imgData]
});
},
};
async onLoad(params) {
console.log('io page onload,', params);
if (this.$parent.globalData.isPay) {
if (sdkManage.session_id) {
this.prePay();
} else {
jcEvent.on(jcEvent.events.LOGIN_FINISHED, this, data => {
this.prePay();
})
}
} else {
wepy.reLaunch({
url: '/pages/index'
})
}
}
onShow(){
}
async prePay() {
wepy.showLoading({
title: '支付中'
});
this.payData = this.$parent.globalData.extraData;
if (this.payData) {
let url = `${g.payUrl(this.payData.isoffical)}&session_id=${sdkManage.session_id}&account_id=${sdkManage.account_id}&data=${encodeURIComponent(this.payData.data)}`
sdkManage.gamelog.logButtonClick('pay', {data: this.payData}, 'payBegin');
try {
let res = await http.get(url);
if (res.errcode === 0) {
let payInfo = JSON.parse(res.pay_str);
this.orderId = res.orderid;
console.log(payInfo);
this.beginPay(payInfo);
}
this.$apply();
} catch (err) {
sdkManage.gamelog.logButtonClick('pay', {data: this.payData, errMsg: 'requestPayment:fail prepay'}, 'parError');
wepy.hideLoading();
this.backToApp('requestPayment:fail prepay');
}
} else {
wepy.hideLoading();
sdkManage.gamelog.logButtonClick('pay', {errMsg: 'requestPayment:fail no pay data'}, 'parError');
}
}
beginPay(payInfo) {
let self = this;
wx.requestPayment({
'timeStamp': payInfo.timeStamp,
'nonceStr': payInfo.nonceStr,
'package': payInfo.package,
'signType': payInfo.signType,
'paySign': payInfo.paySign,
complete: (res) => {
wepy.hideLoading();
console.log('支付结果:', res);
if (res.errMsg === 'requestPayment:ok') {
console.log('支付成功')
sdkManage.gamelog.logButtonClick('pay', {data: self.payData, orderId: self.orderId}, 'parSuccess');
} else if (res.errMsg === 'requestPayment:fail cancel' || res.errMsg === 'requestPayment:cancel') {
sdkManage.gamelog.logButtonClick('pay', {data: self.payData, orderId: self.orderId, errMsg: res.errMsg}, 'parError');
} else {
console.log('支付失败');
sdkManage.gamelog.logButtonClick('pay', {data: self.payData, orderId: self.orderId, errMsg: res.errMsg}, 'parError');
}
self.backToApp(res.errMsg);
}
})
}
backToApp(errMsg) {
wepy.navigateBackMiniProgram({
extraData: {
payData: errMsg,
orderid: this.orderId
},
complete: (res) => {
console.log('navigateBackMiniProgram success, now to index');
}
})
}
}
</script>

314
src/pages/normal.wpy Normal file
View File

@ -0,0 +1,314 @@
<template>
<view class="container">
<view class="weui-form-preview">
<view class="weui-form-preview__hd">
<view class="weui-form-preview__item">
<view class="weui-form-preview__label">付款金额</view>
<view class="weui-form-preview__value_in-hd">¥{{money}}</view>
</view>
</view>
<view class="weui-form-preview__bd">
<view class="weui-form-preview__item">
<view class="weui-form-preview__label">商品</view>
<view class="weui-form-preview__value">{{productName}}</view>
</view>
<view class="weui-form-preview__item">
<view class="weui-form-preview__label">区服</view>
<view class="weui-form-preview__value">{{svrName}}</view>
</view>
<view class="weui-form-preview__item">
<view class="weui-form-preview__label">角色名称</view>
<view class="weui-form-preview__value">{{uname}}</view>
</view>
<!-- <view class="weui-form-preview__item">-->
<!-- <view class="weui-form-preview__label">订单编号</view>-->
<!-- <view class="weui-form-preview__value">{{orderId}}</view>-->
<!-- </view>-->
</view>
<view class="weui-form-preview__ft">
<button class="weui-btn" type="primary" @tap="buy">购买</button>
<button class="weui-btn" type="default" @tap="cancelBuy">取消</button>
</view>
</view>
</view>
</template>
<script>
import wepy from 'wepy';
import jcEvent from '../common/jc-event';
import cfg from '../mixins/cfg';
import g from '../common/global';
import http from '../utils/http';
const sdkManage = require('../jcfw/SDKManage')
export default class NormalPage extends wepy.page {
mixins = [cfg];
components = {
};
config = {
navigationBarTitleText: '武极天下'
};
data = {
gid: '',
gameName: '武极天下',
productName: '',
svrName: '',
uname: '',
orderId: '',
price: 100,
account: '',
money: '',
pid: '',
uid: '',
sid: '',
platform: 6001,
gameId: 1009,
openId: ''
};
methods = {
buy() {
console.log('buy click')
this.$apply();
},
cancelBuy() {
console.log('user cancel')
},
};
async onLoad(params) {
// gname=武极天下&pname=首充6元礼包&price=600&sname=双线10服&uname=azwe&oid=1231231313&aid=123123
// 游戏名称
// this.gameName = decodeURIComponent(params.gname);
// wepy.setNavigationBarTitle({
// title: this.gameName
// })
// 订单id
// this.orderId = decodeURIComponent(params.oid);
// 产品编号
this.pid = params.pid;
this.uid = decodeURIComponent(params.uid);
// 服务器id
this.sid = params.sid;
if (!this.pid) {
wepy.reLaunch({
url: '/pages/index'
})
return
}
// 以下都为了显示
// 产品名称
this.productName = decodeURIComponent(params.pname);
// 价格
this.price = decodeURIComponent(params.price);
this.money = `${(this.price / 100).toFixed(2)}`;
// 服务器名称
this.svrName = decodeURIComponent(params.sname);
// 角色名
this.uname = decodeURIComponent(params.uname);
this.openId = decodeURIComponent(params.openid);
params.gameid && (this.gameId = params.gameid);
params.platform && (this.platform = params.platform);
// 以上都是为了显示
this.$apply();
if (sdkManage.session_id) {
this.prePay();
} else {
jcEvent.on(jcEvent.events.LOGIN_FINISHED, this, data => {
this.prePay();
})
}
}
onShow(){
}
async prePay() {
wepy.showLoading({
title: '支付中'
});
let url = g.wjtxPayUrl
let account = wepy.getStorageSync('account');
const payData = {
uid: this.uid,
produce: this.pid,
server: this.sid,
unified_openid: account.openid,
unified_channel: 9002,
platform: this.platform,
gameid: this.gameId,
openid: this.openId
}
url = this.appendMoreParam(url, payData)
sdkManage.gamelog.logButtonClick('pay', {data: payData}, 'payBegin');
try {
let res = await http.get(url);
wepy.hideLoading();
if (res.errcode === 0) {
try {
let orderData = JSON.parse(res.prepayId);
console.log(orderData)
this.beginPay(orderData);
} catch (err) {
sdkManage.gamelog.logButtonClick('pay', {data: payData, errMsg: 'requestPayment:fail prepay'}, 'parError');
wepy.hideLoading();
this.backToApp('requestPayment:fail prepay');
}
}
this.$apply();
} catch (err) {
sdkManage.gamelog.logButtonClick('pay', {data: payData, errMsg: 'requestPayment:fail prepay'}, 'parError');
wepy.hideLoading();
this.backToApp('requestPayment:fail prepay');
}
}
appendMoreParam(url, data) {
let paramStr = "";
if (data) {
if (typeof data === 'string') {
paramStr = data;
} else {
for (let key in data) {
if (paramStr !== "") {
paramStr += "&";
}
paramStr += key + "=" + encodeURIComponent(data[key]);
}
}
if (paramStr !== "") {
paramStr = (url.indexOf("?") === -1 ? "?" : "&") + paramStr;
}
}
return url + paramStr;
}
beginPay(payInfo) {
let self = this;
if (payInfo.timeStamp) {
payInfo.timeStamp = payInfo.timeStamp + ''
}
if (!payInfo.signType) {
payInfo.signType = 'RSA'
}
payInfo.complete = (res) => {
wepy.hideLoading();
console.log('支付结果:', res);
if (res.errMsg === 'requestPayment:ok') {
console.log('支付成功')
sdkManage.gamelog.logButtonClick('pay', {data: self.payData, orderId: self.orderId}, 'parSuccess');
} else if (res.errMsg === 'requestPayment:fail cancel' || res.errMsg === 'requestPayment:cancel') {
sdkManage.gamelog.logButtonClick('pay', {data: self.payData, orderId: self.orderId, errMsg: res.errMsg}, 'parError');
} else {
console.log('支付失败');
sdkManage.gamelog.logButtonClick('pay', {data: self.payData, orderId: self.orderId, errMsg: res.errMsg}, 'parError');
}
self.backToApp(res.errMsg);
}
wx.requestPayment(payInfo)
}
backToApp(errMsg) {
wepy.navigateBackMiniProgram({
extraData: {
payData: errMsg,
orderid: this.orderId,
type: 'payresult'
},
complete: (res) => {
console.log('navigateBackMiniProgram success, now to index');
}
})
}
}
</script>
<style lang="less">
.weui-form-preview {
position: relative;
background-color: #FFFFFF;
margin-bottom: 25px;
width: 100%;
}
.weui-form-preview:before {
content: " ";
position: absolute;
left: 0;
top: 0;
right: 0;
height: 1px;
border-top: 1rpx solid #D9D9D9;
color: #D9D9D9;
border-top-width: 1px;
border-top-style: solid;
border-top-color: rgb(217, 217, 217);
}
.weui-form-preview__hd:after {
content: " ";
position: absolute;
left: 0;
bottom: 0;
right: 0;
height: 1px;
border-bottom: 1rpx solid #D9D9D9;
color: #D9D9D9;
left: 15px;
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: rgb(217, 217, 217);
}
.weui-form-preview__hd {
position: relative;
padding: 10px 15px;
text-align: right;
line-height: 2.5em;
}
.weui-form-preview__item {
overflow: hidden;
display: block;
}
.weui-form-preview__label {
float: left;
margin-right: 1em;
min-width: 4em;
color: #999999;
text-align: justify;
text-align-last: justify;
}
.weui-form-preview__bd {
padding: 10px 15px;
font-size: 0.9em;
text-align: right;
color: #999999;
line-height: 2;
}
.weui-form-preview__value {
display: block;
overflow: hidden;
word-break: normal;
word-wrap: break-word;
}
.weui-form-preview__value_in-hd {
font-size: 26px;
color: #E64340;
}
.weui-form-preview__ft {
position: relative;
line-height: 50px;
padding: 20px 15px 10px;
}
.weui-form-preview__ft:after {
content: " ";
position: absolute;
left: 0;
top: 0;
right: 0;
height: 1px;
border-top: 1rpx solid #D5D5D6;
color: #D5D5D6;
border-top-width: 1px;
border-top-style: solid;
border-top-color: rgb(213, 213, 214);
}
</style>

25
src/sitemap.json Normal file
View File

@ -0,0 +1,25 @@
{
"rules":[{
"action": "allow",
"page": "pages/index"
}, {
"action": "allow",
"page": "pages/detail"
}, {
"action": "disallow",
"page": "pages/product"
}, {
"action": "disallow",
"page": "pages/buyvip"
}, {
"action": "disallow",
"page": "pages/normal"
}, {
"action": "disallow",
"page": "pages/exchange-result"
}, {
"action": "disallow",
"page": "pages/exchange-record"
}
]
}

View File

@ -15,7 +15,7 @@ const post = (url, data, header) => {
}
const Ajax = (url, method, data, header) => {
url = g.apiBase + url
url = url.startsWith('http') ? url : g.apiBase + url;
header = header || {}
return new Promise((resolve, reject) => {