0518
This commit is contained in:
@@ -57,8 +57,7 @@
|
||||
<image src="../../static/icon/midBtn_06.png" mode="aspectFit"></image>
|
||||
古 籍
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class="head_line" v-if="seckillList!=null">
|
||||
<b></b>
|
||||
<text>商品秒杀</text>
|
||||
@@ -190,9 +189,22 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import repciptData from '@/static/json/repcipt.json'
|
||||
import $http from '@/config/requestConfig.js';
|
||||
import {
|
||||
mapState,mapMutations
|
||||
} from 'vuex';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
transaction: { // 成功回调
|
||||
|
||||
},
|
||||
maxTimes:1, // 轮询最大次数
|
||||
ComplateRequestInterval:null, // 轮询定时器
|
||||
checking:false, // 正在检测
|
||||
ComplateRequestArr:[],
|
||||
iapChannel:null,
|
||||
scrollTop: 0,
|
||||
list3: [
|
||||
// '../../static/icon/home_ban_1.jpg',
|
||||
@@ -205,7 +217,7 @@
|
||||
seckillList: [],
|
||||
goodsList: [],
|
||||
bgiStyle: {
|
||||
background: '#2ab58833'
|
||||
background: '#2ab588'
|
||||
},
|
||||
iconStyle: {
|
||||
fontSize: '40rpx',
|
||||
@@ -221,18 +233,25 @@
|
||||
onLoad(e) {
|
||||
// 隐藏原生的tabbar
|
||||
uni.hideTabBar();
|
||||
// this.requestIapOrder()
|
||||
},
|
||||
//页面显示
|
||||
onShow() {
|
||||
// 隐藏原生的tabbar
|
||||
uni.hideTabBar();
|
||||
this.getData();
|
||||
this.getData();
|
||||
|
||||
|
||||
},
|
||||
// 页面加载完毕
|
||||
onReady() {
|
||||
this.requestIapOrder()
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.getData()
|
||||
uni.stopPullDownRefresh()
|
||||
this.requestIapOrder()
|
||||
},
|
||||
|
||||
|
||||
@@ -249,9 +268,177 @@
|
||||
return value
|
||||
},
|
||||
},
|
||||
|
||||
computed: {
|
||||
...mapState(['userInfo']),
|
||||
},
|
||||
//方法
|
||||
methods: {
|
||||
...mapMutations(['setUserInfo']),
|
||||
// 检测未完成订单
|
||||
requestIapOrder(){
|
||||
console.log('检测支付环境...')
|
||||
plus.payment.getChannels((channels) => {
|
||||
console.log(channels, 'channels')
|
||||
for (var i in channels) {
|
||||
// 判断是否苹果支付1
|
||||
if (channels[i].id === 'appleiap') {
|
||||
this.iapChannel = channels[i]
|
||||
// console.log(this.userInfo.restoreFlag,'this.userInfo.restoreFlag')
|
||||
if(this.userInfo.restoreFlag){ // 如果存在异常回调订单
|
||||
this.restoreComplateRequest()
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
// 查询未关闭订单
|
||||
restoreComplateRequest(){
|
||||
let that = this
|
||||
console.log('检测未完成订单')
|
||||
console.log(this.iapChannel,'this.iapChannel')
|
||||
|
||||
this.iapChannel.restoreComplateRequest({
|
||||
manualFinishTransaction: true
|
||||
}, function(results) {
|
||||
if(!that.checking){
|
||||
that.checking = true
|
||||
// console.log(that.checking)
|
||||
// results 格式为数组存放恢复的IAP商品交易信息对象 IAPTransaction,通用需将返回的支付凭证传给后端进行二次认证
|
||||
that.ComplateRequestArr = results
|
||||
console.log(that.ComplateRequestArr,'未完成订单数组')
|
||||
if(results && results.length>0){
|
||||
// for(var j = 0; j<results.length; j++){
|
||||
// if(results[j].transactionState == '1'){
|
||||
// // 已经支付,但是没有走逻辑的内购订单
|
||||
// that.iapCheck(results[j])
|
||||
// // that.iapCheck(repciptData)
|
||||
// }else{
|
||||
// // 其他状态的内购订单 直接关闭
|
||||
// that.finishTransaction(results[j])
|
||||
|
||||
// }
|
||||
// }
|
||||
results.map((item,index)=>{
|
||||
// "0"为正在支付;"1"为支付成功;"2"为支付失败;"3"为支付已恢复。
|
||||
if(item.transactionState == '1'){
|
||||
// 已经支付,但是没有走逻辑的内购订单
|
||||
that.iapCheck(item,index)
|
||||
}else{
|
||||
// 其他状态的内购订单
|
||||
that.finishTransaction(item)
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
},
|
||||
// 关闭交易订单
|
||||
finishTransaction(trans,index){
|
||||
this.iapChannel.finishTransaction(trans, (success) => {
|
||||
console.log('关闭订单成功',index);
|
||||
|
||||
if(index == this.ComplateRequestArr.length-1){ // 最后一个支付订单
|
||||
this.setUserInfo({restoreFlag:false});
|
||||
// console.log(this.userInfo.restoreFlag,'this.ComplateRequestArr.length+++')
|
||||
}
|
||||
|
||||
}, (fail) => {
|
||||
console.log('关闭订单失败');
|
||||
});
|
||||
},
|
||||
iapCheck(result,index) {
|
||||
const that = this
|
||||
console.log('进入后台验证')
|
||||
let data = {
|
||||
transactionId: result.transactionIdentifier, // 支付交易id
|
||||
customerOid: that.userInfo.id,
|
||||
productId: result.payment.productid, // 产品id
|
||||
orderId: result.payment.username, // 系统订单号
|
||||
receiptData: result.transactionReceipt ,// 苹果返回收据
|
||||
loadAnimate:'none', // 请求加载动画
|
||||
}
|
||||
console.log(data,'data')
|
||||
$http.request({
|
||||
url: "/Ipa/veri",
|
||||
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||
data,
|
||||
header: { //默认 无 说明:请求头
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
}).then(res => {
|
||||
console.log(JSON.stringify(res))
|
||||
console.log(res.code)
|
||||
if(res.code == 0){
|
||||
// uni.hideLoading()
|
||||
console.log('充值订单已处理,请留意账户金额变动....')
|
||||
// 服务器验证票据有效后在客户端关闭订单
|
||||
that.finishTransaction(result,index)
|
||||
}else if(res.code == 200){ // 重复验证订单
|
||||
console.log('重复验证....')
|
||||
that.finishTransaction(result,index)
|
||||
}
|
||||
}).catch(e => {
|
||||
console.log('支付验证失败,进入轮询程序...')
|
||||
that.getIapPayResult(result,index)
|
||||
})
|
||||
console.log('--------------')
|
||||
},
|
||||
|
||||
// 轮询验证支付结果
|
||||
getIapPayResult(result,index){
|
||||
// let interval = null
|
||||
this.ComplateRequestInterval = setTimeout(() => {
|
||||
if(this.maxTimes <= 3){
|
||||
this.iapCheck(result,index)
|
||||
console.log('执行1', this.maxTimes,this.ComplateRequestInterval)
|
||||
this.maxTimes += 1
|
||||
}else{
|
||||
this.maxTimes = 0
|
||||
console.log('停止轮询', this.maxTimes,this.ComplateRequestInterval, this.maxTimes)
|
||||
this.checking = false
|
||||
this.saveErrorIapOrder(result,index)
|
||||
clearTimeout(this.ComplateRequestInterval)
|
||||
|
||||
}
|
||||
},10000)
|
||||
|
||||
},
|
||||
// 轮询失败接口
|
||||
saveErrorIapOrder(result,index){
|
||||
console.log('提交到充值问题单里面...')
|
||||
let data = {
|
||||
transactionId : result.transactionIdentifier,
|
||||
failureflag: 1,
|
||||
orderId:result.payment.username,
|
||||
receiptData:result.transactionReceipt,
|
||||
productId:result.payment.productid,
|
||||
customerOid:this.userInfo.id
|
||||
|
||||
}
|
||||
console.log(data,'data')
|
||||
$http.request({
|
||||
url: "Ipa/failure",
|
||||
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||
data,
|
||||
header: { //默认 无 说明:请求头
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
}).then(res => {
|
||||
console.log(JSON.stringify(res))
|
||||
if(res.code == 200){
|
||||
console.log('提交成功,关闭订单')
|
||||
this.finishTransaction(result,index)
|
||||
}
|
||||
}).catch(e => {
|
||||
console.log(e)
|
||||
if(e.statusCode == 0){ // 重复提交,直接关闭订单
|
||||
this.finishTransaction(result,index)
|
||||
}
|
||||
})
|
||||
},
|
||||
// 获取列表数据
|
||||
getData() {
|
||||
this.$http
|
||||
@@ -266,8 +453,8 @@
|
||||
this.$http
|
||||
.get(`book/shopseckill/getSeckillProd`)
|
||||
.then(res => {
|
||||
//this.seckillList = res.list
|
||||
this.seckillList = null
|
||||
this.seckillList = res.list
|
||||
// this.seckillList = null
|
||||
})
|
||||
|
||||
// 获取精选商品
|
||||
|
||||
@@ -20,47 +20,48 @@
|
||||
|
||||
<view class="cf_radio">
|
||||
<u-radio-group v-model="payType">
|
||||
|
||||
|
||||
<view style="width: 100%;" v-if="isAndroid">
|
||||
<view v-for="(item, index) in paylist" @click="choseType(item.id)"
|
||||
:class="payType == item.id?'Tab_xf cf_xuanx':'cf_xuanx'">
|
||||
<image :src="item.img"></image>
|
||||
{{item.title}}
|
||||
<u-radio :key="index" activeColor="#fe6e09" :name='item.id'
|
||||
<u-radio :key="index" activeColor="#fe6e09" :name='item.id'
|
||||
style="float: right;margin-top: 5rpx;"></u-radio>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<view style="width: 100%;" v-else>
|
||||
<view v-for="(item, index) in iosPaylist" @click="choseType(item.id)"
|
||||
:class="payType == item.id?'Tab_xf cf_xuanx':'cf_xuanx'">
|
||||
<image :src="item.img"></image>
|
||||
{{item.title}}
|
||||
<u-radio :key="index" activeColor="#fe6e09" :name='item.id'
|
||||
<u-radio :key="index" activeColor="#fe6e09" :name='item.id'
|
||||
style="float: right;margin-top: 5rpx;"></u-radio>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
</u-radio-group>
|
||||
</view>
|
||||
</view>
|
||||
<view class="agree_wo flexbox" style="float: left; display: flex;" >
|
||||
<view class="agree_wo flexbox" style="float: left; display: flex;">
|
||||
<radio-group class="agree">
|
||||
<view v-for="(item, index) in argee" :key="index" >
|
||||
<radio class="agreeRadio" :value="item.id" :checked="item.id==radioValue" @click="radioCheck(index)"></radio>
|
||||
|
||||
</view>
|
||||
</radio-group>
|
||||
<view v-for="(item, index) in argee" :key="index">
|
||||
<radio class="agreeRadio" :value="item.id" :checked="item.id==radioValue"
|
||||
@click="radioCheck(index)"></radio>
|
||||
|
||||
</view>
|
||||
</radio-group>
|
||||
<view>* 我已阅读并同意<span class="highlight" @click="showXieyi">《增值服务协议》</span></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="char_btn">
|
||||
|
||||
|
||||
<view @click="kaiChar">立即充值</view>
|
||||
|
||||
<!-- <view @click="iosPay" >立即充值</view> -->
|
||||
|
||||
|
||||
<!-- <view @click="iosPay" >立即充值</view> -->
|
||||
|
||||
</view>
|
||||
<!-- 充值协议 -->
|
||||
<u-popup :show="xieyiShow" :round="10" @close="xieyiShow=false">
|
||||
@@ -68,7 +69,7 @@
|
||||
<view class="dp_title">{{xieyi.title}}</view>
|
||||
<view style="max-height: 1000rpx;overflow-y: scroll;">
|
||||
<view v-html="xieyi.content"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
</view>
|
||||
@@ -76,39 +77,44 @@
|
||||
|
||||
<script>
|
||||
import $http from '@/config/requestConfig.js';
|
||||
import {
|
||||
checkIapOrder
|
||||
} from '@/store/modules/common.js';
|
||||
// import { // 引入ios支付
|
||||
// Iap,
|
||||
// IapTransactionState
|
||||
// } from "@/utils/iap.js"
|
||||
import {
|
||||
mapState
|
||||
mapState,mapMutations
|
||||
} from 'vuex';
|
||||
import {
|
||||
setPay,
|
||||
setPayAssign
|
||||
} from '@/config/utils';
|
||||
const IAPOrders = [
|
||||
'add69'
|
||||
] // 根据这些ids获取到苹果app内商品信息,这些ids就是你上面设置的产品id
|
||||
// const IAPOrders = [ // 根据这些ids获取到苹果app内商品信息,这些ids就是你上面设置的产品id
|
||||
// 'add69'
|
||||
// ]
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
xieyi:{
|
||||
title:'',
|
||||
content:''
|
||||
xieyi: {
|
||||
title: '',
|
||||
content: ''
|
||||
},
|
||||
xieyiShow:false,
|
||||
xieyiShow: false,
|
||||
stepsCj: {},
|
||||
cjList: [],
|
||||
argee:[
|
||||
{value:false,id:'1'}
|
||||
|
||||
] ,// 同意权限
|
||||
radioValue:'',
|
||||
orderSn:'', // 订单sn
|
||||
argee: [{
|
||||
value: false,
|
||||
id: '1'
|
||||
}
|
||||
|
||||
], // 同意权限
|
||||
radioValue: '',
|
||||
orderSn: '', // 订单sn
|
||||
productid: '',
|
||||
isAndroid: true, // 是否为安卓环境
|
||||
|
||||
|
||||
payType: 2,
|
||||
// #ifdef APP-IOS
|
||||
payType: 3,
|
||||
@@ -129,63 +135,72 @@
|
||||
id: 3,
|
||||
img: '../../static/icon/pay_2.png'
|
||||
}],
|
||||
transaction: { // 成功回调
|
||||
|
||||
},
|
||||
};
|
||||
},
|
||||
//第一次加载
|
||||
onLoad(e) {
|
||||
// 隐藏原生的tabbar
|
||||
uni.hideTabBar();
|
||||
this.getData();
|
||||
|
||||
},
|
||||
//页面显示
|
||||
onShow() {
|
||||
// 隐藏原生的tabbar
|
||||
// this.iphonepay()
|
||||
uni.hideTabBar();
|
||||
this.getDevName()
|
||||
// this.requestIapOrder()
|
||||
this.getDevName()
|
||||
},
|
||||
computed: {
|
||||
...mapState(['userInfo']),
|
||||
},
|
||||
//方法
|
||||
methods: {
|
||||
showXieyi(){
|
||||
...mapMutations(['setUserInfo']),
|
||||
// 关闭交易订单
|
||||
finishTransaction(trans){
|
||||
this.iapChannel.finishTransaction(trans, (success) => {
|
||||
console.log('关闭订单成功');
|
||||
}, (fail) => {
|
||||
console.log('关闭订单失败');
|
||||
});
|
||||
},
|
||||
showXieyi() {
|
||||
this.$http
|
||||
.get(`sys/agreement/list?key=pay`)
|
||||
.then(res => {
|
||||
.then(res => {
|
||||
this.xieyi = res.page.list[0]
|
||||
this.xieyiShow = true
|
||||
})
|
||||
|
||||
|
||||
},
|
||||
radioCheck(index) { // 勾选用户协议
|
||||
this.argee.forEach((item => {
|
||||
item.isCheck = false
|
||||
}))
|
||||
if (this.radioValue == this.argee[index].id) {
|
||||
this.radioValue = null
|
||||
} else {
|
||||
this.radioValue = this.argee[index].id
|
||||
}
|
||||
// console.log(this.radioValue)
|
||||
},
|
||||
radioCheck (index) { // 勾选用户协议
|
||||
this.argee.forEach((item =>{
|
||||
item.isCheck = false
|
||||
}))
|
||||
if(this.radioValue==this.argee[index].id) {
|
||||
this.radioValue =null
|
||||
}else {
|
||||
this.radioValue = this.argee[index].id
|
||||
}
|
||||
// console.log(this.radioValue)
|
||||
},
|
||||
iphonepay() {
|
||||
const that = this
|
||||
uni.showLoading({
|
||||
title: '检测支付环境...',
|
||||
mask: true
|
||||
})
|
||||
console.log('检测支付环境...')
|
||||
plus.payment.getChannels((channels) => {
|
||||
console.log(channels,'channels')
|
||||
console.log(channels, 'channels')
|
||||
for (var i in channels) {
|
||||
// 判断是否苹果支付
|
||||
// 判断是否苹果支付1
|
||||
if (channels[i].id === 'appleiap') {
|
||||
that.iapChannel = channels[i]
|
||||
that.requestOrder()
|
||||
that.requestOrder()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
},
|
||||
requestOrder() {
|
||||
uni.showLoading({
|
||||
@@ -193,197 +208,187 @@
|
||||
mask: true
|
||||
})
|
||||
const that = this
|
||||
console.log(that.stepsCj.priceTypeId,88888888)
|
||||
console.log(that.stepsCj.priceTypeId, 88888888)
|
||||
// ['xxxxx'] 是平台申请拿到的内购商品的id
|
||||
console.log(IAPOrders,'IAPOrders')
|
||||
let IAPOrders = []
|
||||
IAPOrders.push(that.stepsCj.priceTypeId+'')
|
||||
console.log(IAPOrders, 'IAPOrders')
|
||||
// 新建订单
|
||||
that.iapChannel.requestOrder(IAPOrders, function(event) {
|
||||
// uni.hideLoading()
|
||||
console.log(event,'event')
|
||||
console.log(event, 'event')
|
||||
for (var index in event) {
|
||||
var OrderItem = event[index]
|
||||
console.log(OrderItem, 'OrderItem')
|
||||
// console.log(OrderItem, 'OrderItem')
|
||||
console.log(OrderItem.productid,'OrderItem.productid')
|
||||
that.topay(OrderItem.productid)
|
||||
}
|
||||
}, function(erroemsg) {
|
||||
//uni.hideLoading()
|
||||
// uni.showToast({
|
||||
|
||||
// })
|
||||
uni.showToast({
|
||||
title: "获取订单失败,请重试:",
|
||||
title: "商品获取失败",
|
||||
icon: 'none'
|
||||
})
|
||||
})
|
||||
},
|
||||
topay(id) {
|
||||
const that = this
|
||||
uni.showLoading({
|
||||
title: '充值中请勿离开',
|
||||
mask: true
|
||||
})
|
||||
uni.requestPayment({
|
||||
provider: 'appleiap',
|
||||
orderInfo: {
|
||||
productid: id,
|
||||
// username: 'ordersn', // 用户标识
|
||||
username: that.orderSn, // 用户标识
|
||||
optimize: false // 设置 optimize: true 解决丢单问题
|
||||
uni.hideLoading()
|
||||
// uni.showLoading({
|
||||
// title: '充值中请勿离开',
|
||||
// mask: true
|
||||
// })
|
||||
|
||||
// var restoreFlag = true; // 调用支付接口时标记 restoreFlag = true , 实际应用请将标记存储在 storage 中
|
||||
this.setUserInfo({restoreFlag:true});
|
||||
console.log(this.userInfo,'更新后的用户信息')
|
||||
plus.payment.request(that.iapChannel, {
|
||||
productid: id,
|
||||
username: that.orderSn, // 用户标识/订单标识
|
||||
manualFinishTransaction: true // 3.5.1+ 支持,设置此参数后需要开发者主动关闭订单,参见下面的关闭订单方法 finishTransaction()
|
||||
|
||||
}, function(result) {
|
||||
// restoreFlag = false; // 支付成功清除标记 restoreFlag = false
|
||||
that.transaction = result
|
||||
// 支付成功,result 为 IAP商品交易信息对象 IAPTransaction 需将返回的支付凭证传给后端进行二次认证
|
||||
uni.hideLoading()
|
||||
that.iapCheck(result)
|
||||
}, function(e) {
|
||||
// restoreFlag = false; // 支付失败清楚标记
|
||||
that.setUserInfo({restoreFlag:false});
|
||||
that.finishTransaction(result);
|
||||
//console.log('订单关闭后的用户信息', that.userInfo);
|
||||
console.log(e)
|
||||
//console.log(e.message)
|
||||
uni.hideLoading()
|
||||
});
|
||||
},
|
||||
iapCheck(result) {
|
||||
let that = this
|
||||
console.log('进入后台验证')
|
||||
let data = {
|
||||
transactionId: result.transactionIdentifier, // 支付交易id
|
||||
customerOid: that.userInfo.id,
|
||||
productId: result.payment.productid, // 产品id
|
||||
orderId: result.payment.username, // 系统订单号
|
||||
receiptData: result.transactionReceipt ,// 苹果返回收据
|
||||
// body: that.stepsCj.priceTypeId // 充值类型id
|
||||
}
|
||||
console.log(data,'data')
|
||||
$http.request({
|
||||
url: "/Ipa/veri",
|
||||
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||
data,
|
||||
header: { //默认 无 说明:请求头
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
success: (res => {
|
||||
console.log(res,'成功的返回值') // 成功的返回值
|
||||
uni.hideLoading()
|
||||
let data= {
|
||||
receipt:res.transactionReceipt, // 校验体
|
||||
orderId: this.orderSn,
|
||||
transactionIdentifier: res.transactionIdentifier //交易id
|
||||
}
|
||||
// const orderId = this.orderId //这个订单id 是由后端返回的
|
||||
// const transactionIdentifier = res.transactionIdentifier //交易id
|
||||
// const payload = res.transactionReceipt //校验体
|
||||
$http.request({
|
||||
url: "/apple/applePay",
|
||||
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||
data,
|
||||
header: { //默认 无 说明:请求头
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
}).then(res => {
|
||||
// 发送给后台逻辑处理
|
||||
// 进行后续操作
|
||||
console.log(res)
|
||||
let data= {
|
||||
// receipt: 'MIIUKAYJKoZIhvcNAQcCoIIUGTCCFBUCAQExCzAJBgUrDgMCGgUAMIIDZgYJKoZIhvcNAQcBoIIDVwSCA1MxggNPMAoCAQgCAQEEAhYAMAoCARQCAQEEAgwAMAsCAQECAQEEAwIBADALAgELAgEBBAMCAQAwCwIBDwIBAQQDAgEAMAsCARACAQEEAwIBADALAgEZAgEBBAMCAQMwDAIBCgIBAQQEFgI0KzAMAgEOAgEBBAQCAgCJMA0CAQMCAQEEBQwDMTEwMA0CAQ0CAQEEBQIDAf4oMA0CARMCAQEEBQwDMS4wMA4CAQkCAQEEBgIEUDI2MDAYAgEEAgECBBAX4ibAXjZ7IAwLx10evzedMBsCAQACAQEEEwwRUHJvZHVjdGlvblNhbmRib3gwHAIBBQIBAQQUYpDtGI14h',
|
||||
transactionId: res.transactionIdentifier, // 支付交易id
|
||||
// userId: that.userInfo.id,
|
||||
// productId: 'add69',
|
||||
orderId: res.payment.username // 系统订单号
|
||||
receiptData: res.transactionReceipt //苹果返回状态码
|
||||
}
|
||||
$http.request({
|
||||
url: "/Ipa/veri",
|
||||
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||
data,
|
||||
header: { //默认 无 说明:请求头
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
}).then(res => {
|
||||
// alert(res)
|
||||
uni.showToast({
|
||||
title: '充值成功'
|
||||
})
|
||||
})
|
||||
|
||||
})
|
||||
}),
|
||||
fail: (e) => {
|
||||
uni.hideLoading()
|
||||
uni.showModal({
|
||||
content: "支付失败",
|
||||
showCancel: false
|
||||
})
|
||||
}).then(res => {
|
||||
console.log(JSON.stringify(res))
|
||||
if(res.code == 0){
|
||||
//uni.hideLoading()
|
||||
that.userInfo.restoreFlag == true ? that.setUserInfo({restoreFlag:false}) : ''
|
||||
console.log(that.userInfo.restoreFlag)
|
||||
console.log('充值订单已处理,请留意账户金额变动....')
|
||||
// 服务器验证票据有效后在客户端关闭订单 (iapChannel.finishTransaction)
|
||||
that.finishTransaction(result);
|
||||
}
|
||||
}).catch(e => {
|
||||
uni.showToast({
|
||||
title:'支付验证失败,请稍后重启app,如不能解决您的问题,可联系官方客服',
|
||||
icon: 'none',
|
||||
duration:5000
|
||||
})
|
||||
})
|
||||
},
|
||||
getDevName() {
|
||||
// 获取使用环境
|
||||
if (uni.getSystemInfoSync().platform === 'android') {
|
||||
this.isAndroid = true
|
||||
// console.log('运行Android上')
|
||||
} else {
|
||||
this.isAndroid = false
|
||||
// console.log('运行iOS上')
|
||||
}
|
||||
},
|
||||
// 获取充值金额
|
||||
getData() {
|
||||
this.$http
|
||||
.post('book/bookbuyconfig/getVipOrPoint', {
|
||||
type: 'point',
|
||||
qudao: 'Android'
|
||||
})
|
||||
.then(res => {
|
||||
this.cjList = res.list
|
||||
this.stepsCj = res.list[0]
|
||||
});
|
||||
},
|
||||
},
|
||||
getDevName() {
|
||||
// 获取使用环境
|
||||
if (uni.getSystemInfoSync().platform === 'android') {
|
||||
this.isAndroid = true
|
||||
// console.log('运行Android上')
|
||||
} else {
|
||||
this.isAndroid = false
|
||||
// console.log('运行iOS上')
|
||||
}
|
||||
this.getData();
|
||||
},
|
||||
// 获取充值金额
|
||||
getData() {
|
||||
// console.log(this.isAndroid)
|
||||
if(this.isAndroid){
|
||||
this.getAndorList()
|
||||
}else{
|
||||
this.getAppleList()
|
||||
}
|
||||
|
||||
},
|
||||
// 安卓充值列表
|
||||
getAndorList(){
|
||||
this.$http
|
||||
.post('book/bookbuyconfig/getVipOrPoint', {
|
||||
type: 'point',
|
||||
qudao: 'Android'
|
||||
})
|
||||
.then(res => {
|
||||
this.cjList = res.list
|
||||
this.stepsCj = res.list[0]
|
||||
});
|
||||
},
|
||||
// 苹果充值列表
|
||||
getAppleList(){
|
||||
this.$http
|
||||
.post('book/bookbuyconfig/getVipOrPoint', {
|
||||
type: 'point',
|
||||
qudao: 'IOS'
|
||||
})
|
||||
.then(res => {
|
||||
this.cjList = res.list
|
||||
this.stepsCj = res.list[0]
|
||||
});
|
||||
},
|
||||
// 点击充值金额
|
||||
chosPric(e) {
|
||||
this.stepsCj = e
|
||||
console.log(e)
|
||||
},
|
||||
|
||||
// 点击充值金额
|
||||
chosPric(e) {
|
||||
this.stepsCj = e
|
||||
console.log(e)
|
||||
},
|
||||
|
||||
// 选择支付方式
|
||||
choseType(e) {
|
||||
let that = this
|
||||
that.payType = e
|
||||
},
|
||||
//ios充值
|
||||
iosPay() {
|
||||
// if(this.radioValue == '1'){
|
||||
let that = this
|
||||
|
||||
let data = {
|
||||
userId: that.userInfo.id, //下单人ID
|
||||
userPhone: that.userInfo.tel, //收货人手机号
|
||||
paymentMethod: that.payType,
|
||||
orderMoney: that.stepsCj.money * 1, //订单金额
|
||||
districtMoney: 0, //优惠金额
|
||||
realMoney: that.stepsCj.money * 1, //实收金额
|
||||
orderStatus: 0, //订单状态
|
||||
orderType: "point", //订单类型
|
||||
}
|
||||
|
||||
$http.request({
|
||||
url: "book/buyorder/rechargeSave",
|
||||
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||
data,
|
||||
header: { //默认 无 说明:请求头
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
}).then(res => {
|
||||
console.log(res)
|
||||
this.orderSn = res.orderSn
|
||||
// this.topay(15)
|
||||
this.iphonepay()
|
||||
})
|
||||
// }else{
|
||||
// uni.showToast({
|
||||
// title:'请勾选服务协议',
|
||||
// icon:'error'
|
||||
// })
|
||||
// }
|
||||
},
|
||||
// 充值
|
||||
kaiChar() {
|
||||
if(this.radioValue == '1'){
|
||||
uni.showLoading({
|
||||
title:'支付中,请勿离开',
|
||||
icon:'loading'
|
||||
})
|
||||
let that = this
|
||||
let data = {
|
||||
userId: that.userInfo.id, //下单人ID
|
||||
userPhone: that.userInfo.tel, //收货人手机号
|
||||
paymentMethod: that.payType, //2支付宝,1微信,3ios内购
|
||||
orderMoney: that.stepsCj.money * 1, //订单金额
|
||||
districtMoney: 0, //优惠金额
|
||||
realMoney: that.stepsCj.money * 1, //实收金额
|
||||
orderStatus: 0, //订单状态
|
||||
orderType: "point", //订单类型
|
||||
}
|
||||
|
||||
$http.request({
|
||||
url: "book/buyorder/rechargeSave",
|
||||
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||
data,
|
||||
header: { //默认 无 说明:请求头1
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
}).then(res => {
|
||||
uni.hideLoading()
|
||||
if (res.code == 0) {
|
||||
if(that.payType == 2){
|
||||
// 选择支付方式1
|
||||
choseType(e) {
|
||||
let that = this
|
||||
that.payType = e
|
||||
},
|
||||
//ios充值
|
||||
iosPay() {
|
||||
this.iphonepay()
|
||||
},
|
||||
// 充值
|
||||
kaiChar() {
|
||||
if (this.radioValue == '1') {
|
||||
uni.showLoading({
|
||||
title: '支付中,请勿离开',
|
||||
icon: 'loading'
|
||||
})
|
||||
let that = this
|
||||
let data = {
|
||||
userId: that.userInfo.id, //下单人ID
|
||||
userPhone: that.userInfo.tel, //收货人手机号
|
||||
paymentMethod: that.payType, //2支付宝,1微信,3ios内购
|
||||
orderMoney: that.stepsCj.money * 1, //订单金额
|
||||
districtMoney: 0, //优惠金额
|
||||
realMoney: that.stepsCj.money * 1, //实收金额
|
||||
orderStatus: 0, //订单状态
|
||||
orderType: "point", //订单类型
|
||||
}
|
||||
$http.request({
|
||||
url: "book/buyorder/rechargeSave",
|
||||
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||
data,
|
||||
header: { //默认 无 说明:请求头1
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
}).then(res => {
|
||||
that.orderSn = res.orderSn
|
||||
uni.hideLoading()
|
||||
if (res.code == 0) {
|
||||
if (that.payType == 2) {
|
||||
setPay({
|
||||
typePay: 'alipay',
|
||||
subject: 'point',
|
||||
@@ -404,43 +409,44 @@
|
||||
});
|
||||
}
|
||||
})
|
||||
}else if(that.payType == 1){
|
||||
// 微信支付
|
||||
uni.showToast({
|
||||
title:'微信支付',
|
||||
none: 'none'
|
||||
})
|
||||
}else if(that.payType == 3){
|
||||
console.log('苹果支付',)
|
||||
that.iosPay()
|
||||
}
|
||||
} else if (that.payType == 1) {
|
||||
// 微信支付
|
||||
uni.showToast({
|
||||
title: '微信支付',
|
||||
none: 'none'
|
||||
})
|
||||
} else if (that.payType == 3) {
|
||||
console.log('苹果支付', )
|
||||
that.iosPay()
|
||||
}
|
||||
})
|
||||
}else{
|
||||
uni.showToast({
|
||||
title:'请勾选 已阅读会员服务协议',
|
||||
icon:'none'
|
||||
})
|
||||
return false
|
||||
}
|
||||
})
|
||||
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '请勾选 已阅读会员服务协议',
|
||||
icon: 'none'
|
||||
})
|
||||
return false
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
// 跳转
|
||||
onPageJump(url) {
|
||||
uni.navigateTo({
|
||||
url: url
|
||||
});
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
};
|
||||
// 跳转
|
||||
onPageJump(url) {
|
||||
uni.navigateTo({
|
||||
url: url
|
||||
});
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@import '@/style/mixin.scss';
|
||||
|
||||
.tanchu {
|
||||
padding: 40rpx 30rpx 40rpx 30rpx;
|
||||
position: relative;
|
||||
@@ -549,8 +555,11 @@
|
||||
border-color: #fd6004;
|
||||
}
|
||||
}
|
||||
.agreeRadio{ zoom: .8;}
|
||||
|
||||
|
||||
.agreeRadio {
|
||||
zoom: .8;
|
||||
}
|
||||
|
||||
.cha_jine {
|
||||
margin: 40rpx 50rpx 0 50rpx;
|
||||
|
||||
@@ -609,7 +618,11 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
.highlight{color: $uni-color-primary;}
|
||||
|
||||
.highlight {
|
||||
color: $uni-color-primary;
|
||||
}
|
||||
|
||||
.cha_fangsh {
|
||||
margin: 40rpx 50rpx 0 50rpx;
|
||||
|
||||
|
||||
663
pages/peanut/reCharge1.vue
Normal file
663
pages/peanut/reCharge1.vue
Normal file
@@ -0,0 +1,663 @@
|
||||
<template>
|
||||
<view>
|
||||
<!-- 公共组件-每个页面必须引入 -->
|
||||
<public-module></public-module>
|
||||
<z-nav-bar title="充值"></z-nav-bar>
|
||||
<view class="cha_jine">
|
||||
<view class="cj_title">充值金额</view>
|
||||
<view class="cj_xiang">
|
||||
<view v-for="(item, index) in cjList" @click="chosPric(item)"
|
||||
:class="stepsCj.priceTypeId == item.priceTypeId?'Tab_cj cj_price':'cj_price'">
|
||||
<view class="pr_jg">¥{{item.realMoney}}</view>
|
||||
<view class="pr_yl">{{item.money}} 疯币</view>
|
||||
<view class="pr_lj">限时特惠</view>
|
||||
</view>
|
||||
<br clear="both">
|
||||
</view>
|
||||
</view>
|
||||
<view class="cha_fangsh">
|
||||
<view class="cf_title">支付方式</view>
|
||||
|
||||
<view class="cf_radio">
|
||||
<u-radio-group v-model="payType">
|
||||
|
||||
<view style="width: 100%;" v-if="isAndroid">
|
||||
<view v-for="(item, index) in paylist" @click="choseType(item.id)"
|
||||
:class="payType == item.id?'Tab_xf cf_xuanx':'cf_xuanx'">
|
||||
<image :src="item.img"></image>
|
||||
{{item.title}}
|
||||
<u-radio :key="index" activeColor="#fe6e09" :name='item.id'
|
||||
style="float: right;margin-top: 5rpx;"></u-radio>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view style="width: 100%;" v-else>
|
||||
<view v-for="(item, index) in iosPaylist" @click="choseType(item.id)"
|
||||
:class="payType == item.id?'Tab_xf cf_xuanx':'cf_xuanx'">
|
||||
<image :src="item.img"></image>
|
||||
{{item.title}}
|
||||
<u-radio :key="index" activeColor="#fe6e09" :name='item.id'
|
||||
style="float: right;margin-top: 5rpx;"></u-radio>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</u-radio-group>
|
||||
</view>
|
||||
</view>
|
||||
<view class="agree_wo flexbox" style="float: left; display: flex;">
|
||||
<radio-group class="agree">
|
||||
<view v-for="(item, index) in argee" :key="index">
|
||||
<radio class="agreeRadio" :value="item.id" :checked="item.id==radioValue"
|
||||
@click="radioCheck(index)"></radio>
|
||||
|
||||
</view>
|
||||
</radio-group>
|
||||
<view>* 我已阅读并同意<span class="highlight" @click="showXieyi">《增值服务协议》</span></view>
|
||||
</view>
|
||||
<view class="char_btn">
|
||||
|
||||
<view @click="kaiChar">立即充值</view>
|
||||
|
||||
<!-- <view @click="iosPay" >立即充值</view> -->
|
||||
|
||||
</view>
|
||||
<!-- 充值协议 -->
|
||||
<u-popup :show="xieyiShow" :round="10" @close="xieyiShow=false">
|
||||
<view class="tanchu">
|
||||
<view class="dp_title">{{xieyi.title}}</view>
|
||||
<view style="max-height: 1000rpx;overflow-y: scroll;">
|
||||
<view v-html="xieyi.content"></view>
|
||||
</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import $http from '@/config/requestConfig.js';
|
||||
// import { // 引入ios支付
|
||||
// Iap,
|
||||
// IapTransactionState
|
||||
// } from "@/utils/iap.js"
|
||||
import {
|
||||
mapState
|
||||
} from 'vuex';
|
||||
import {
|
||||
setPay,
|
||||
setPayAssign
|
||||
} from '@/config/utils';
|
||||
const IAPOrders = [
|
||||
'add69'
|
||||
] // 根据这些ids获取到苹果app内商品信息,这些ids就是你上面设置的产品id
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
xieyi: {
|
||||
title: '',
|
||||
content: ''
|
||||
},
|
||||
xieyiShow: false,
|
||||
stepsCj: {},
|
||||
cjList: [],
|
||||
argee: [{
|
||||
value: false,
|
||||
id: '1'
|
||||
}
|
||||
|
||||
], // 同意权限
|
||||
radioValue: '',
|
||||
orderSn: '', // 订单sn
|
||||
productid: '',
|
||||
isAndroid: true, // 是否为安卓环境
|
||||
|
||||
payType: 2,
|
||||
// #ifdef APP-IOS
|
||||
payType: 3,
|
||||
// #endif
|
||||
paylist: [{
|
||||
title: '支付宝',
|
||||
id: 2,
|
||||
img: '../../static/icon/pay_1.png'
|
||||
},
|
||||
{
|
||||
title: '微信',
|
||||
id: 1,
|
||||
img: '../../static/icon/pay_2.png'
|
||||
}
|
||||
],
|
||||
iosPaylist: [{
|
||||
title: 'apple pay支付',
|
||||
id: 3,
|
||||
img: '../../static/icon/pay_2.png'
|
||||
}],
|
||||
transaction: { // 成功回调
|
||||
|
||||
},
|
||||
};
|
||||
},
|
||||
//第一次加载
|
||||
onLoad(e) {
|
||||
// 隐藏原生的tabbar
|
||||
uni.hideTabBar();
|
||||
this.getData();
|
||||
},
|
||||
//页面显示
|
||||
onShow() {
|
||||
// 隐藏原生的tabbar
|
||||
uni.hideTabBar();
|
||||
this.getDevName()
|
||||
// this.requestIapOrder()
|
||||
},
|
||||
computed: {
|
||||
...mapState(['userInfo']),
|
||||
},
|
||||
//方法
|
||||
methods: {
|
||||
showXieyi() {
|
||||
this.$http
|
||||
.get(`sys/agreement/list?key=pay`)
|
||||
.then(res => {
|
||||
this.xieyi = res.page.list[0]
|
||||
this.xieyiShow = true
|
||||
})
|
||||
|
||||
},
|
||||
radioCheck(index) { // 勾选用户协议
|
||||
this.argee.forEach((item => {
|
||||
item.isCheck = false
|
||||
}))
|
||||
if (this.radioValue == this.argee[index].id) {
|
||||
this.radioValue = null
|
||||
} else {
|
||||
this.radioValue = this.argee[index].id
|
||||
}
|
||||
// console.log(this.radioValue)
|
||||
},
|
||||
iphonepay() {
|
||||
const that = this
|
||||
uni.showLoading({
|
||||
title: '检测支付环境...',
|
||||
mask: true
|
||||
})
|
||||
plus.payment.getChannels((channels) => {
|
||||
console.log(channels, 'channels')
|
||||
for (var i in channels) {
|
||||
// 判断是否苹果支付1
|
||||
if (channels[i].id === 'appleiap') {
|
||||
that.iapChannel = channels[i]
|
||||
that.requestOrder()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
requestOrder() {
|
||||
uni.showLoading({
|
||||
title: '获取商品信息',
|
||||
mask: true
|
||||
})
|
||||
const that = this
|
||||
console.log(that.stepsCj.priceTypeId, 88888888)
|
||||
// ['xxxxx'] 是平台申请拿到的内购商品的id
|
||||
console.log(IAPOrders, 'IAPOrders')
|
||||
// 新建订单
|
||||
that.iapChannel.requestOrder(IAPOrders, function(event) {
|
||||
// uni.hideLoading()
|
||||
console.log(event, 'event')
|
||||
for (var index in event) {
|
||||
var OrderItem = event[index]
|
||||
// console.log(OrderItem, 'OrderItem')
|
||||
that.topay(OrderItem.productid)
|
||||
}
|
||||
}, function(erroemsg) {
|
||||
uni.showToast({
|
||||
title: "获取信息失败,请重试:",
|
||||
icon: 'none'
|
||||
})
|
||||
})
|
||||
},
|
||||
topay(id) {
|
||||
|
||||
const that = this
|
||||
// uni.showLoading({
|
||||
// title: '充值中请勿离开',
|
||||
// mask: true
|
||||
// })
|
||||
|
||||
var restoreFlag = true; // 调用支付接口时标记 restoreFlag = true , 实际应用请将标记存储在 storage 中
|
||||
plus.payment.request(that.iapChannel, {
|
||||
productid: id,
|
||||
username: that.userInfo.userId, // 用户标识
|
||||
manualFinishTransaction: false, // 3.5.1+ 支持,设置此参数后需要开发者主动关闭订单,参见下面的关闭订单方法 finishTransaction()
|
||||
paymentDiscount: { // 促销优惠参数说明
|
||||
offerIdentifier: "",
|
||||
keyIdentifier: "",
|
||||
nonce: "",
|
||||
signature: "",
|
||||
timestamp: 0
|
||||
} // 3.7.0+ 支持
|
||||
}, function(result) {
|
||||
restoreFlag = false; // 支付成功清除标记 restoreFlag = false
|
||||
console.log(result, '支付成功回调')
|
||||
that.transaction = result
|
||||
// 支付成功,result 为 IAP商品交易信息对象 IAPTransaction 需将返回的支付凭证传给后端进行二次认证
|
||||
//uni.hideLoading()
|
||||
// uni.showLoading({
|
||||
// title: '验证支付结果',
|
||||
// mask: true
|
||||
// })
|
||||
// console.log('传值到后台')
|
||||
that.iapCheck(result)
|
||||
}, function(e) {
|
||||
restoreFlag = true; // 支付成功清除标记 restoreFlag = false
|
||||
console.log(e)
|
||||
console.log('走这了')
|
||||
// uni.hideLoading()
|
||||
if (e.code == 2) {
|
||||
uni.showToast({
|
||||
title: '无法链接Itunes Store',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
// 支付失败 返回错误信息
|
||||
});
|
||||
|
||||
},
|
||||
iapCheck(result) {
|
||||
console.log('here')
|
||||
let data = {
|
||||
transactionId: result.transactionIdentifier, // 支付交易id
|
||||
// userId: that.userInfo.id,
|
||||
productId: result.payment.productid,
|
||||
// orderId: result.payment.username, // 系统订单号
|
||||
receiptData: result.transactionReceipt //苹果返回状态码
|
||||
}
|
||||
$http.request({
|
||||
url: "/Ipa/veri",
|
||||
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||
data,
|
||||
header: { //默认 无 说明:请求头
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
}).then(res => {
|
||||
console.log(JSON.stringify(res))
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: '充值成功'
|
||||
})
|
||||
// 服务器验证票据有效后在客户端关闭订单 (iapChannel.finishTransaction)
|
||||
// that.iapChannel.finishTransaction(result,(res) => {
|
||||
// console.log(res,'关闭订单')
|
||||
// resolve(res);
|
||||
// }, (err) => {
|
||||
// reject(err);
|
||||
// })
|
||||
})
|
||||
},
|
||||
getDevName() {
|
||||
// 获取使用环境
|
||||
if (uni.getSystemInfoSync().platform === 'android') {
|
||||
this.isAndroid = true
|
||||
// console.log('运行Android上')
|
||||
} else {
|
||||
this.isAndroid = false
|
||||
// console.log('运行iOS上')
|
||||
}
|
||||
},
|
||||
// 获取充值金额
|
||||
getData() {
|
||||
this.$http
|
||||
.post('book/bookbuyconfig/getVipOrPoint', {
|
||||
type: 'point',
|
||||
qudao: 'Android'
|
||||
})
|
||||
.then(res => {
|
||||
this.cjList = res.list
|
||||
this.stepsCj = res.list[0]
|
||||
});
|
||||
},
|
||||
|
||||
// 点击充值金额
|
||||
chosPric(e) {
|
||||
this.stepsCj = e
|
||||
console.log(e)
|
||||
},
|
||||
|
||||
// 选择支付方式1
|
||||
choseType(e) {
|
||||
let that = this
|
||||
that.payType = e
|
||||
},
|
||||
//ios充值
|
||||
iosPay() {
|
||||
this.iphonepay()
|
||||
},
|
||||
// 充值
|
||||
kaiChar() {
|
||||
if (this.radioValue == '1') {
|
||||
uni.showLoading({
|
||||
title: '支付中,请勿离开',
|
||||
icon: 'loading'
|
||||
})
|
||||
let that = this
|
||||
let data = {
|
||||
userId: that.userInfo.id, //下单人ID
|
||||
userPhone: that.userInfo.tel, //收货人手机号
|
||||
paymentMethod: that.payType, //2支付宝,1微信,3ios内购
|
||||
orderMoney: that.stepsCj.money * 1, //订单金额
|
||||
districtMoney: 0, //优惠金额
|
||||
realMoney: that.stepsCj.money * 1, //实收金额
|
||||
orderStatus: 0, //订单状态
|
||||
orderType: "point", //订单类型
|
||||
}
|
||||
$http.request({
|
||||
url: "book/buyorder/rechargeSave",
|
||||
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||
data,
|
||||
header: { //默认 无 说明:请求头1
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
}).then(res => {
|
||||
that.orderSn = res.orderSn
|
||||
uni.hideLoading()
|
||||
if (res.code == 0) {
|
||||
if (that.payType == 2) {
|
||||
setPay({
|
||||
typePay: 'alipay',
|
||||
subject: 'point',
|
||||
totalAmount: that.stepsCj.money,
|
||||
type: that.payType,
|
||||
relevanceoid: res.orderSn,
|
||||
body: that.stepsCj.priceTypeId,
|
||||
}, res => {
|
||||
if (res.success) {
|
||||
uni.showToast({
|
||||
title: "支付成功"
|
||||
});
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: "支付失败",
|
||||
icon: "none",
|
||||
image: '../../static/icon/ic_close.png'
|
||||
});
|
||||
}
|
||||
})
|
||||
} else if (that.payType == 1) {
|
||||
// 微信支付
|
||||
uni.showToast({
|
||||
title: '微信支付',
|
||||
none: 'none'
|
||||
})
|
||||
} else if (that.payType == 3) {
|
||||
console.log('苹果支付', )
|
||||
that.iosPay()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '请勾选 已阅读会员服务协议',
|
||||
icon: 'none'
|
||||
})
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
|
||||
// 跳转
|
||||
onPageJump(url) {
|
||||
uni.navigateTo({
|
||||
url: url
|
||||
});
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
@import '@/style/mixin.scss';
|
||||
|
||||
.tanchu {
|
||||
padding: 40rpx 30rpx 40rpx 30rpx;
|
||||
position: relative;
|
||||
|
||||
|
||||
.dp_title {
|
||||
font-size: 32rpx;
|
||||
margin-bottom: 50rpx;
|
||||
color: #555;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.dp_add {
|
||||
position: absolute;
|
||||
top: 40rpx;
|
||||
right: 30rpx;
|
||||
font-size: 22rpx;
|
||||
background-color: #fd6004;
|
||||
color: #fff;
|
||||
border-radius: 10rpx;
|
||||
padding: 5rpx 10rpx;
|
||||
|
||||
.u-icon {
|
||||
display: inline-block;
|
||||
margin-right: 5rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.addressItem {
|
||||
border: 2px dashed #d9d9d9;
|
||||
border-radius: 10rpx;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
padding: 20rpx 10rpx;
|
||||
margin: 25rpx 0 0 0;
|
||||
align-items: center;
|
||||
background-color: #fff;
|
||||
|
||||
.addrContent {
|
||||
margin-left: 40rpx;
|
||||
flex: 1;
|
||||
|
||||
.addrContentTop {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
margin: 0 0 15rpx 0;
|
||||
position: relative;
|
||||
|
||||
.userName {
|
||||
font-size: 35rpx;
|
||||
font-weight: bold;
|
||||
margin-right: 30rpx;
|
||||
}
|
||||
|
||||
.userTel {
|
||||
font-size: 25rpx;
|
||||
color: #888;
|
||||
}
|
||||
|
||||
.userMoren {
|
||||
border: 1px solid #fd6004;
|
||||
color: #fd6004;
|
||||
padding: 3rpx 10rpx;
|
||||
font-size: 22rpx;
|
||||
border-radius: 10rpx;
|
||||
margin: 0 0 0 20rpx;
|
||||
}
|
||||
|
||||
|
||||
.chooseCheck {
|
||||
position: absolute;
|
||||
top: 3rpx;
|
||||
right: 6rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.addrContentBottom {
|
||||
font-size: 32rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.addressItem.addItem_style {
|
||||
border-color: #fd6004;
|
||||
}
|
||||
|
||||
.youhuiItem {
|
||||
border: 1px solid #d9d9d9;
|
||||
border-radius: 10rpx;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
padding: 20rpx 10rpx;
|
||||
margin: 25rpx 0 0 0;
|
||||
align-items: center;
|
||||
background-color: #fff;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
|
||||
.youhuiItem>view {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.youhuiItem.youItem_style {
|
||||
border-color: #fd6004;
|
||||
}
|
||||
}
|
||||
|
||||
.agreeRadio {
|
||||
zoom: .8;
|
||||
}
|
||||
|
||||
.cha_jine {
|
||||
margin: 40rpx 50rpx 0 50rpx;
|
||||
|
||||
.cj_title {
|
||||
font-size: 36rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.cj_xiang {
|
||||
margin-top: 50rpx;
|
||||
|
||||
.cj_price {
|
||||
box-shadow: 0 0 20rpx 0 #0000001a;
|
||||
float: left;
|
||||
width: 47%;
|
||||
margin: 0 30rpx 30rpx 0;
|
||||
text-align: center;
|
||||
padding: 25rpx 0 30rpx 0;
|
||||
border-radius: 20rpx;
|
||||
position: relative;
|
||||
color: #2d2d2d;
|
||||
|
||||
.pr_jg {
|
||||
font-size: 45rpx;
|
||||
margin: 20rpx 0 10rpx 0;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.pr_yl {
|
||||
font-size: 30rpx;
|
||||
// text-decoration: line-through;
|
||||
color: #b1b1b1;
|
||||
}
|
||||
|
||||
.pr_lj {
|
||||
background-image: linear-gradient(90deg, #fe6e09 0%, #efa574 100%);
|
||||
color: #fff;
|
||||
position: absolute;
|
||||
top: -10rpx;
|
||||
right: 0;
|
||||
font-size: 24rpx;
|
||||
padding: 5rpx 10rpx;
|
||||
border-top-left-radius: 20rpx;
|
||||
border-bottom-right-radius: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.cj_price:nth-child(2n) {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.Tab_cj {
|
||||
box-shadow: 0 0 20rpx 0 #fe700bcc;
|
||||
color: #7b4c0a;
|
||||
background: #fff9f5cc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.highlight {
|
||||
color: $uni-color-primary;
|
||||
}
|
||||
|
||||
.cha_fangsh {
|
||||
margin: 40rpx 50rpx 0 50rpx;
|
||||
|
||||
.cf_title {
|
||||
font-size: 36rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.cf_radio {
|
||||
margin-top: 20rpx;
|
||||
|
||||
.cf_xuanx {
|
||||
font-size: 32rpx;
|
||||
padding: 20rpx;
|
||||
margin-bottom: 20rpx;
|
||||
border-bottom: 1px solid #ededed;
|
||||
|
||||
image {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
display: inline-block;
|
||||
margin-right: 20rpx;
|
||||
vertical-align: bottom;
|
||||
}
|
||||
}
|
||||
|
||||
.Tab_xf {
|
||||
background-color: #fdf1e9cc;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
.agree_wo {
|
||||
color: #aaa;
|
||||
font-size: 25rpx;
|
||||
margin-top: 30rpx;
|
||||
margin: 40rpx 50rpx 0 50rpx;
|
||||
padding-bottom: 180rpx;
|
||||
}
|
||||
|
||||
.char_btn {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 30rpx;
|
||||
|
||||
view {
|
||||
background-image: linear-gradient(90deg, #ed7161 0%, #efa574 100%);
|
||||
color: #fff;
|
||||
width: 90%;
|
||||
margin: 0 auto;
|
||||
text-align: center;
|
||||
font-size: 35rpx;
|
||||
font-weight: bold;
|
||||
padding: 25rpx 0;
|
||||
border-radius: 50rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -17,7 +17,7 @@
|
||||
</view>
|
||||
<view class="input_tit">手机号</view>
|
||||
<view class="input_box triangle" :clasfs="[type == 1000 ? 'left_triangle': 'right_triangle']">
|
||||
<input type="text" v-model="phone" @input="onInput" placeholder="请输入您的手机号" placeholder-class="grey" />
|
||||
<input type="number" v-model="phone" @input="onInput" placeholder="请输入您的手机号" placeholder-class="grey" />
|
||||
</view>
|
||||
<view class="input_tit" v-if="type == 1000">密码</view>
|
||||
<view class="input_box" v-if="type == 1000">
|
||||
|
||||
@@ -2304,18 +2304,19 @@ import { nextTick } from "vue";
|
||||
/*****************************************/
|
||||
return
|
||||
}
|
||||
if (!this.nextPage.ready && !this.nextChapter.ready) {
|
||||
this.waitForNext = true
|
||||
uni.showLoading({
|
||||
title: '正在准备下一章',
|
||||
mask: true
|
||||
})
|
||||
return
|
||||
}
|
||||
// if (!this.nextPage.ready && !this.nextChapter.ready) {
|
||||
// this.waitForNext = true
|
||||
// uni.showLoading({
|
||||
// title: '正在准备下一章',
|
||||
// mask: true
|
||||
// })
|
||||
// return
|
||||
// }
|
||||
this.currentPage += 1
|
||||
let showChapter = false
|
||||
console.log(this.currentPage, this.curChapter.totalPage)
|
||||
if (this.currentPage === this.curChapter.totalPage) { //翻至下一章了
|
||||
return
|
||||
showChapter = true
|
||||
this.currentPage = 0
|
||||
this.chapterRotate('next')
|
||||
|
||||
Reference in New Issue
Block a user