|
@@ -10,7 +10,7 @@
|
|
|
</router-link>
|
|
|
</div>
|
|
|
<!--妥妥:本人-->
|
|
|
- <div class="footer myself" v-else-if="!recommendedUser.RId">
|
|
|
+ <div class="footer myself" v-else-if="!recommendedUser.id">
|
|
|
<!--可以分享-->
|
|
|
<template v-if="userShareConfig.share">
|
|
|
<router-link class="btn-apply double"
|
|
@@ -29,13 +29,13 @@
|
|
|
<!--妥妥:非本人-->
|
|
|
<div class="footer other" v-else>
|
|
|
<router-link class="btn-apply single"
|
|
|
- :to="{path: '/loan/apply/' + orderProductId, query: { RId: recommendedUser.RId }}">点击预约办理
|
|
|
+ :to="{path: '/loan/apply/' + orderProductId, query: { RId: recommendedUser.id }}">点击预约办理
|
|
|
</router-link>
|
|
|
<div class="partner-info">
|
|
|
<div class="partner-avatar">
|
|
|
- <img :src="recommendedUser.RImgUrl" alt="">
|
|
|
+ <img :src="recommendedUser.userImgUrl" alt="">
|
|
|
</div>
|
|
|
- <p class="name">{{ recommendedUser.RName }} 邀请你</p>
|
|
|
+ <p class="name">{{ recommendedUser.userName }} 邀请你</p>
|
|
|
</div>
|
|
|
</div>
|
|
|
<!--生成二维码使用-->
|
|
@@ -76,10 +76,11 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { Popup } from 'vant'
|
|
|
+import { Popup, Toast } from 'vant'
|
|
|
import { funWxShare } from '../../../utils/wxShareConfig'
|
|
|
import { getProductDetail } from '../../../api/common'
|
|
|
import QRCode from 'qrcodejs2'
|
|
|
+import { getUserShare } from './api'
|
|
|
|
|
|
export default {
|
|
|
name: 'explain',
|
|
@@ -111,28 +112,50 @@ export default {
|
|
|
qrcode: null,
|
|
|
codeUrl: '', // 二维码地址
|
|
|
showCode: false, // 是否显示二维码弹窗
|
|
|
- booShareTip: false // 分享朋友、朋友圈提示
|
|
|
- }
|
|
|
- },
|
|
|
- computed: {
|
|
|
- userShareConfig: {
|
|
|
- get () {
|
|
|
- return this.$store.state.loan.userShareConfig
|
|
|
- },
|
|
|
- set (val) {
|
|
|
- this.$store.commit('loan/UPDATE_USERSHARECONFIG', val)
|
|
|
+ booShareTip: false, // 分享朋友、朋友圈提示
|
|
|
+ userShareConfig: {
|
|
|
+ share: false, // 是否有权限分享(true是false无)
|
|
|
+ id: '', // 用户ID
|
|
|
+ userName: '', // 用户名称
|
|
|
+ userImgUrl: '' // 用户头像
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
+ created () {
|
|
|
+ this.fetchUserShare()
|
|
|
+ },
|
|
|
async mounted () {
|
|
|
- const shareHref = this.partnerId ? `${location.origin}${location.pathname}?partnerId=${this.partnerId}` : `${location.origin}${location.pathname}?recommendedUser=${encodeURIComponent(JSON.stringify(this.userShareConfig))}`
|
|
|
- console.log(shareHref)
|
|
|
- funWxShare('驼驼银服', '家里用钱,就找驼驼银服,省心,省力,妥妥的!', shareHref, location.protocol + '//api.tuotuoyinfu.com/img/logo.jpg')
|
|
|
await this.$nextTick()
|
|
|
this.funGetProductDetail()
|
|
|
- this.createQRCode(shareHref)
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 获取用户分享权限
|
|
|
+ fetchUserShare () {
|
|
|
+ getUserShare().then(res => {
|
|
|
+ let shareHref = `${location.origin}${location.pathname}`
|
|
|
+ if (res.status) {
|
|
|
+ if (Object.prototype.toString.call(res.data) === '[object Object]') {
|
|
|
+ this.userShareConfig = res.data
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ Toast(res.msg)
|
|
|
+ }
|
|
|
+ if (this.partnerId) { // 合伙人
|
|
|
+ shareHref += `?partnerId=${this.partnerId}`
|
|
|
+ } else if (this.recommendedUser.id) { // 打开含有推荐人信息链接
|
|
|
+ shareHref += `?recommendedUser=${encodeURIComponent(JSON.stringify(this.recommendedUser))}`
|
|
|
+ } else if (Object.keys(this.userShareConfig).length) { // 默认本人打开、且有分享权限
|
|
|
+ shareHref += `?recommendedUser=${encodeURIComponent(JSON.stringify(this.userShareConfig))}`
|
|
|
+ }
|
|
|
+ funWxShare('驼驼银服', '家里用钱,就找驼驼银服,省心,省力,妥妥的!', shareHref, location.protocol + '//api.tuotuoyinfu.com/img/logo.jpg')
|
|
|
+ console.log(shareHref)
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.createQRCode(shareHref)
|
|
|
+ })
|
|
|
+ }).catch(err => {
|
|
|
+ Toast(err)
|
|
|
+ })
|
|
|
+ },
|
|
|
funShowCode () {
|
|
|
this.booInvite = false
|
|
|
this.booCode = true
|