payOrder
parent
<script>
export default class Parents extends wepy.page {
data = {
tabdata:{}, //下面要用这里必须要写上
}
async onLoad() {
let data = await getData(,"public/data",{session_key:"1234456"});
this.tabdata= data.tab;
this.$apply();//必须
}
}
</script>
<template lang="wxml">
<view class="title" slot="title"></view>
<view class="title" slot="content">
<Tab :tab.sync="tabdata" ></Tab>
</view>
</template>
child
<template lang="wxml">
<view class="title" slot="title">{{tab}}</view>
</template>
export default class Tab extends wepy.component {
props = {
tab:{
type:Object,
default:null,
twoWay:true
}
}
payOrder(e) {
let _this = this
payOrder(e.currentTarget.id).then(res => {
if (res && res.data) {
if (res.data.code) {
_this.$invoke('toast', 'showToast', {
title: res.data.message,
time: 1000
})
_this.isClick = false
return
}
}
wx.requestPayment({
timeStamp: res.timeStamp,
nonceStr: res.nonceStr,
package: res.package,
signType: 'MD5',
paySign: res.sign,
success: function(_res) {
console.log('orderItem=>payOrder=>支付成功', _res)
wx.navigateTo({
url: `/pages/pay-success-page?orderNo=${res.orderNo}`
})
_this.toDoWhatUShouldDo(e, 2)
},
fail: function(err) {
console.log('orderItem=>payOrder=>支付失败', err)
}
})
})
},
this.couponList[e.currentTarget.id].type
chooseCoupon(e) {
// 是否用默认优惠券
this.useDefaultCoupon = 0
// 判断选择优惠券类型 不同型要取消重选
if (!this.couponList[e.currentTarget.id].chosen) {
let isChangeType = this.judgeChosen(
this.couponList[e.currentTarget.id].type
)
if (isChangeType === 0) {
this.$invoke('toast', 'showToast', {
title: '如需更换优惠券,请先取消当前优惠券',
time: 500
})
return
}
}
_getOrderList(status, fn, refresh) {
let _status = ''
if (parseInt(status)) {
_status = status
}
if (this.over) {
return
}
getOrderList(_status, this.page++)
.then(res => {
if (res.length === 0) {
this.over = true
} else {
// 初始化列表 添加唯一标识index 倒计时初始值
res &&
res.map((el, index) => {
// 订单商品奇偶背景色
el.detailList.map(e => {
e.odd = this.pNum % 2
this.pNum++
})
el.index = index + (this.page - 2) * 10
el.createTime = format(el.createTime, 8)
el.currentPage = _status
console.log('order-page==>expireTime', el.expireTime)
let minutes = parseInt((el.expireTime / 1000 / 60) % 60, 10)
let seconds = parseInt((el.expireTime / 1000) % 60, 10)
el.overTime = `${minutes >= 10 ? minutes : '0' + minutes}:${
seconds >= 10 ? seconds : '0' + seconds
}`
console.log('order-page==>el.overTime', el.overTime)
})
if (refresh) {
this.orderList = []
}
this.orderList = this.orderList.concat(res)
this.delay = false
fn && fn()
}
this.showEmpty = true
this.$apply()
console.log('order-page=>getOrderList=>订单列表', this.orderList)
})
.catch(err => {
this.delay = false
console.log('order-page=>getOrderList=>订单列表错了err', err)
})
}
payOrder的更多相关文章
- iOS中支付宝集成
iOS中支付宝集成 如今各种的App中都使用了三方支付的功能,现在将我在使用支付宝支付集成过程的心得分享一下,希望对大家都能有所帮助 要集成一个支付宝支付过程的环境,大致需要: 1>公司:先与支 ...
- 在多线程编程中lock(string){...}隐藏的机关
常见误用场景:在订单支付环节中,为了防止用户不小心多次点击支付按钮而导致的订单重复支付问题,我们用 lock(订单号) 来保证对该订单的操作同时只允许一个线程执行. 这样的想法很好,至少比 lock( ...
- iOS-集成支付宝支付、微信支付简单总结
支付宝快捷支付: 官方文档中,支付宝说建议我们使用支付时要讲签名过程放在服务器端,这样安全.同时给的demo中签名是在本地移动端做的...不过支付宝的集成还是较简单的. 为了安全签名当然放后台做了.我 ...
- WebService的使用
转载至http://blog.csdn.net/yexuanbaby/article/details/9029605/ 第一次选择WebService,是为了替代数据库远程连接.我们都知道当SQL允许 ...
- iOS支付宝支付总结
1.按照http://doc.open.alipay.com/doc2/detail?spm=0.0.0.0.SWdJgo&treeId=59&articleId=103676& ...
- ***CodeIgniter集成微信支付(转)
微信支付Native扫码支付模式二之CodeIgniter集成篇 http://www.cnblogs.com/24la/p/wxpay-native-qrcode-codeigniter.html ...
- iOS----支付(微信支付、支付宝支付、银联支付控件集成支付)(转)
资料 支付宝 //文档idk都包含了安卓.iOS版 银 联 银联官网资料 Demo Demo给了一个订单号,做测试使用,若出现支付失败什么的,可能是已经被别人给支付了,或者是服务器订单过期了 ~ 一. ...
- Batsing的网页编程规范(HTML/CSS/JS/PHP)
特别注意!!!我这里的前端编程规范不苟同于Bootstrap的前端规范. 因为我和它的目的不同,Bootstrap规范是极简主义,甚至有些没有考虑到兼容性的问题. 我的规范是自己从编程实践中总结出来的 ...
- 微信支付Native扫码支付模式二之CodeIgniter集成篇
CI:3.0.5 微信支付API类库来自:https://github.com/zhangv/wechat-pay 请先看一眼官方场景及支付时序图:https://pay.weixin.qq.com/ ...
随机推荐
- hdu 6625 three array (01-trie)
大意: 给两个数组$a,b$, 要求重排使得$c_i=a_i\oplus b_i$字典序最小. 字典树上贪心取$n$次, 然后排序, 还不知道怎么证. #include <iostream> ...
- Netty服务端创建流程及组件职责
public class NettyServer { public static void main(String[] args) throws InterruptedException { NioE ...
- sqlserver2008+日志收缩sql语句命令
USE[master] GO ALTER DATABASE 数据库 SET RECOVERY SIMPLE WITH NO_WAIT GO ALTER DATABASE 数据库 SET RECOVER ...
- linux 基础指令
df -h 查看磁盘空间 root@ubuntu:/etc# df -h Filesystem Size Used Avail Use% Mounted on udev 970M 0 970M 0% ...
- 使用httpwebrequest发送http请求
HttpWebRequest request = WebRequest.Create("url") as HttpWebRequest; request.Timeout = * * ...
- sed 查询特定内容
查询命令对照表 打印/etc/passwd中第10行的内容 sed -n '10p' /etc/passwd 打印/etc/passwd中第8行开始,到第15行结束的内容 sed -n '8,15p' ...
- 《Python编程:从入门到实践》第二章 变量和简单数据类型 习题答案
#2.1 print("Hello world!"); #2.2 message="Hello,Python!"; print(message); #2.3 n ...
- kubernetes---ConfigMap管理应用配置
1.拆分环境 主机名 角色 ip hdss7-11.host.com zk1.od.com(Test环境) 10.4.7.11 hdss7-12.host.com zk2.od.com(Prod环境) ...
- jade变量声明和数据传递
声明一个变量 - var course = 'jade'; 取得一个变量 #{course} 大括号里面写入变量命,前面加个#号就可以取得变量 在括号里面可以进行诸多都运行操作,比如大小写 #{cou ...
- 请求类型 GET 和 POST 的区别
一.GET 一个简单的 GET 请求: xmlhttp.open("GET","demo_get.asp",true); xmlhttp.send(); 在上面 ...