uniapp调用微信支付功能

// 立即支付
			immediately() {
				let _this = this;
				uni.request({
					url:  _this.$api_host + '/payment/pay',
					data: {
						token: this.userInfo.token,
						number: _this.itemList.number,
						type: 1
					},
					header: {
					},
					method: 'get',
					success: (res) => {
						console.log(res,2223232355);
						console.log(res.data.data,2223232355);
						_this.obj.appId = res.data.data.appId;
						_this.obj.nonceStr = res.data.data.nonceStr;
						_this.obj.package = res.data.data.package;
						_this.obj.paySign = res.data.data.paySign;
						_this.obj.timeStamp = res.data.data.timeStamp;
						_this.obj.signType = res.data.data.signType;
						console.log(_this.obj,5555555);
						wx.requestPayment({
						    provider: 'wxpay',
							timeStamp: _this.obj.timeStamp,
							nonceStr: _this.obj.nonceStr,
							package: _this.obj.package,
							paySign: _this.obj.paySign,
							signType: _this.obj.signType,
						    success: function (res) {
						        console.log('success:' + JSON.stringify(res));
								uni.showToast({
									title: '支付成功',
									icon: 'none',
									mask: true,
									duration: 1000
								});
								uni.navigateTo({
									url: '/pagesC/warehousingInfoCon/warehousingToBeCon'
								})
						    },
						    fail: function (err) {
						        console.log('fail:' + JSON.stringify(err));
								uni.showToast({
									title: '支付失败',
									icon: 'none',
									mask: true,
									duration: 1000
								});return
						    }
						});
					}
				});
			},

你可能感兴趣的:(技术,小程序)