<template> <view> <image class="width90" mode="widthFix" :src="imagewxUrl+imgadres" @click="jumpunionpay"></image> <image class="width90" mode="widthFix" :src="imagewxUrl+imgadres1" @click="jumpMp"></image> </view> </template> <script> import { setUserParam, HandleCode } from '../../Utils/Api.js'; let app = getApp(); export default { data() { return { imagewxUrl: app.globalData.imageWxImg, imgadres: 'union1.jpg', imgadres1: 'union2.jpg', codes: '', url: 'https://base.95516.com/s/wl/WebAPP/helpAgree/page/help/shareRutineHelp.html?params=eyJlbmNyeXB0QXBwSWQiOiIxOTAwYmM4NDQ5N2NhYjNiIiwidG9MaW5rIjoiaHR0cHMlM0ElMkYlMkZoc2cuZGN0cGF5LmNvbSUyRnVuaW9uUGF5JTJGIn0' } }, onLoad(options) { var arr1 = decodeURIComponent(options.q); var arr2 = arr1.split('='); this.codes = arr2[2]; }, methods: { //跳转银联支付 jumpunionpay() { if (!app.globalData.userInfo) { uni.login({ provider: 'weixin', success: function(loginRes) { app.globalData.code = loginRes.code; // 请求接口 let params = { code: app.globalData.code } HandleCode(params).then(res => { if (res.return_code == '000000') { app.globalData.openId = res.return_data.openId; uni.navigateTo({ url: '../../pages/userLogin/userLogin' }) } }) } }) return; } let params = { param: this.codes } setUserParam(params).then(res => { if (res.return_code == '000000') { location.href = this.url; } else { uni.showToast({ title: res.return_msg, icon: 'none', duration: 2000 }) } }) }, //跳转到小程序 jumpMp() { uni.reLaunch({ url: '../../pages/goods/externalCoupon/externalCoupon?id=' + this.codes }) } } } </script> <style> </style>