提交 c60861d4 authored 作者: lihuihui's avatar lihuihui

update

上级 251c4f3a
...@@ -131,7 +131,7 @@ ...@@ -131,7 +131,7 @@
import { Toast } from 'vant' import { Toast } from 'vant'
import BatchImport from '../components/BatchImport.vue' import BatchImport from '../components/BatchImport.vue'
import Commonheader from '../components/Commonheader.vue' import Commonheader from '../components/Commonheader.vue'
import { saveStepInfo } from '../api' import { saveStepInfo, getOpenid } from '../api'
import allFormList from '@/utils/formList' import allFormList from '@/utils/formList'
export default { export default {
components: { Commonheader, BatchImport }, components: { Commonheader, BatchImport },
...@@ -192,6 +192,17 @@ export default { ...@@ -192,6 +192,17 @@ export default {
isRemoveInfo(item) { isRemoveInfo(item) {
return !!item.find(f => f.enable_edit === false) return !!item.find(f => f.enable_edit === false)
}, },
// 微信授权
wxAuthorize() {
if (!this.$route.query.code) {
const url = encodeURIComponent(window.location.href)
window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa41d0081d4889921&redirect_uri=${url}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
} else {
getOpenid({ code: this.$route.query.code, identity: 'road' }).then(res => {
window.sessionStorage.openId = res.openid
})
}
},
// 提交 // 提交
onSubmit() { onSubmit() {
const params = { const params = {
...@@ -243,14 +254,22 @@ export default { ...@@ -243,14 +254,22 @@ export default {
// 完成步骤跳转 // 完成步骤跳转
this.$router.push({ path: '/' }) this.$router.push({ path: '/' })
} else { } else {
this.$emit('next', res.data) if (!window.sessionStorage.openId) {
this.wxAuthorize()
} else {
this.$emit('next', res.data)
}
} }
} else { } else {
if (this.stepList[this.stepList.length - 1].num === this.data.num) { if (this.stepList[this.stepList.length - 1].num === this.data.num) {
// 完成步骤跳转 // 完成步骤跳转
this.$router.push({ path: '/' }) this.$router.push({ path: '/' })
} else { } else {
this.$emit('next', res.data) if (!window.sessionStorage.openId) {
this.wxAuthorize()
} else {
this.$emit('next', res.data)
}
} }
} }
this.checkedPay = false this.checkedPay = false
......
...@@ -134,7 +134,7 @@ export default { ...@@ -134,7 +134,7 @@ export default {
stepOrderInfo: [], stepOrderInfo: [],
payType: [], payType: [],
// 判断是否是支付宝 // 判断是否是支付宝
isAlipay: /AlipayClient/.test(window.navigator.userAgent), isAlipay: !/AlipayClient/.test(window.navigator.userAgent),
// 判断微信 // 判断微信
isWx: /MicroMessenger/.test(window.navigator.userAgent) isWx: /MicroMessenger/.test(window.navigator.userAgent)
} }
...@@ -290,14 +290,14 @@ export default { ...@@ -290,14 +290,14 @@ export default {
if (this.isWx && parseInt(this.payMode) === 1) { if (this.isWx && parseInt(this.payMode) === 1) {
params.pay_type = '3' params.pay_type = '3'
// 没有openid去授权获取 // 没有openid去授权获取
if (!window.localStorage.openId) { if (!window.sessionStorage.openId) {
this.wxAuthorize(res => { this.wxAuthorize(res => {
params.openid = res.openid params.openid = res.openid
window.localStorage.openId = res.openid window.sessionStorage.openId = res.openid
this.getPayInfo(params) this.getPayInfo(params)
}) })
} else { } else {
params.openid = window.localStorage.openId params.openid = window.sessionStorage.openId
this.getPayInfo(params) this.getPayInfo(params)
} }
} else { } else {
...@@ -322,7 +322,8 @@ export default { ...@@ -322,7 +322,8 @@ export default {
window.localStorage.payDetail = JSON.stringify(this.payDetail) window.localStorage.payDetail = JSON.stringify(this.payDetail)
// 支付宝 // 支付宝
if (this.isAlipay && parseInt(this.payMode) === 2) { if (this.isAlipay && parseInt(this.payMode) === 2) {
window.location.href = res.data.url console.log(res.data.url, 'url')
// window.location.href = res.data.url
} }
if (this.isWx && parseInt(this.payMode) === 1) { if (this.isWx && parseInt(this.payMode) === 1) {
// 拉起微信支付 // 拉起微信支付
...@@ -333,7 +334,7 @@ export default { ...@@ -333,7 +334,7 @@ export default {
// console.log(res, 'zhifu2') // console.log(res, 'zhifu2')
// } // }
}) })
window.sessionStorage.isCodePage = 'wx' // window.sessionStorage.isCodePage = 'wx'
} }
this.isQrPageShow = true this.isQrPageShow = true
} }
......
...@@ -55,15 +55,7 @@ export default { ...@@ -55,15 +55,7 @@ export default {
}, },
computed: { computed: {
setpItem() { setpItem() {
let item = {} return this.stepList[this.stepIndex]
const queryIndex = parseInt(this.$route.query.index)
if (queryIndex && queryIndex !== 0) {
item = JSON.parse(window.localStorage.stepData).stepList[queryIndex]
} else {
item = this.stepList[this.stepIndex]
}
// return this.stepList[this.$route.query.index !== undefined ? parseInt(this.$route.query.index) : this.stepIndex]
return item
} }
}, },
mounted() { mounted() {
...@@ -239,7 +231,6 @@ export default { ...@@ -239,7 +231,6 @@ export default {
if (this.$route.query.stepIndex !== undefined) { if (this.$route.query.stepIndex !== undefined) {
this.stepIndex = this.$route.query.stepIndex this.stepIndex = this.$route.query.stepIndex
} }
console.log(this.stepList, '12331')
}, },
handlePrev() { handlePrev() {
if (this.stepIndex <= 0) { if (this.stepIndex <= 0) {
...@@ -247,7 +238,6 @@ export default { ...@@ -247,7 +238,6 @@ export default {
} else { } else {
this.stepIndex-- this.stepIndex--
} }
this.setQuery()
}, },
handleNext(data) { handleNext(data) {
if (this.setpItem.num !== this.stepList[this.stepList.length - 1].num) { if (this.setpItem.num !== this.stepList[this.stepList.length - 1].num) {
...@@ -259,9 +249,7 @@ export default { ...@@ -259,9 +249,7 @@ export default {
index: this.stepIndex, index: this.stepIndex,
stepList: this.stepList stepList: this.stepList
} }
this.setQuery()
window.localStorage.stepData = JSON.stringify(stringData) window.localStorage.stepData = JSON.stringify(stringData)
this.$route.query.index = this.stepIndex
} }
}, },
setQuery() { setQuery() {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论