This commit is contained in:
pplokijuhyg 2019-12-28 14:27:57 +08:00
parent 4140d8e8d6
commit 3f513f121a
5 changed files with 23 additions and 12 deletions

View File

@ -1,6 +1,7 @@
import bin from "../../../utils/bin" import bin from "../../../utils/bin"
Component({ Component({
properties: { properties: {
index:Number
}, },
data: { data: {
}, },

View File

@ -1,4 +1,4 @@
<van-tabs class="tab" swipe-threshold="5"> <van-tabs class="tab" swipe-threshold="5" active="{{index}}">
<van-tab title="待付款" bind:tap="todetail"> <van-tab title="待付款" bind:tap="todetail">
<commodity bind:shua="shua" wx:for="{{WAITPAY}}" wx:for-index="j" wx:key="{{j}}" data-id="{{item.order_id}}" num="{{item.goods_num}}" cprice="{{item.goods_price}}" freight="{{item.integral_money}}" goods="{{item.goods_list}}" gid="{{item.order_id}}" type="1"></commodity> <commodity bind:shua="shua" wx:for="{{WAITPAY}}" wx:for-index="j" wx:key="{{j}}" data-id="{{item.order_id}}" num="{{item.goods_num}}" cprice="{{item.goods_price}}" freight="{{item.integral_money}}" goods="{{item.goods_list}}" gid="{{item.order_id}}" type="1"></commodity>
</van-tab> </van-tab>

View File

@ -5,14 +5,16 @@ Page({
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
index:0
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
this.setData({
index: options.index == undefined ? 0:options.index
})
}, },
/** /**

View File

@ -1,3 +1,3 @@
<view class="box"> <view class="box">
<tab style="width:100%"></tab> <tab style="width:100%" index="{{index}}"></tab>
</view> </view>

View File

@ -77,13 +77,13 @@ Page({
}, },
sub() { sub() {
if(this.data.list.addressList == null){ if (this.data.list.addressList == null) {
wx.showToast({ wx.showToast({
title:"请先添加地址", title: "请先添加地址",
icon:"none" icon: "none"
}) })
console.log(123) console.log(123)
return ; return;
} }
bin.getuserid().then((res) => { bin.getuserid().then((res) => {
bin.request({ bin.request({
@ -104,12 +104,20 @@ Page({
console.log(r) console.log(r)
let { timeStamp, nonceStr, signType, sign } = r.data.data.wdata let { timeStamp, nonceStr, signType, sign } = r.data.data.wdata
// timeStamp = timeStamp // timeStamp = timeStamp
timeStamp = timeStamp.toString() timeStamp = timeStamp.toString()
console.log(timeStamp) console.log(timeStamp)
wx.requestPayment({ wx.requestPayment({
timeStamp, nonceStr, package:r.data.data.wdata.package, signType, paySign:sign, timeStamp, nonceStr, package: r.data.data.wdata.package, signType, paySign: sign,
success(res) {console.log("成功")}, success(res) {
fail(res) {console.log(res)} console.log("成功")
wx.redirectTo({
url: "/pages/order/order?index=1"
})
},
fail(res) { console.log(res)
wx.redirectTo({
url: "/pages/order/order?index=0"
})}
}) })
}) })
}) })