Commit e70786d8 by huangzhi

feat: 支付成功页跳转 拼团首页二维码 加入分享参数

parent 77d41957
......@@ -78,6 +78,7 @@
"lodash": "^4.17.21",
"uview-ui": "^2.0.35",
"decimal.js": "^10.4.3",
"qs": "^6.11.0",
"vue": "^2.6.11",
"vuex": "^3.2.0"
},
......
......@@ -7,6 +7,7 @@
<script>
import { hostPrefix } from '@/config'
import Decimal from 'decimal.js'
import qs from 'qs'
// totalAmount 活动后实际的商品价格
// balance 可用余额
......@@ -38,17 +39,22 @@ export default {
name: 'OrderPay',
data() {
return {
buyType: undefined, // 1 拼团购买, 其他 为非拼团购买
groupRecordId: '', // 下单成功后,订单接口返回的成团记录id
courseId: '', // 课程id
orderId: '', // 订单id
payType: 1, // 支付方式,1: 余额 5: 微信 7: 微信 + 余额
totalAmount: 0, // 活动后实际的商品价格
balance: 0, // 账户余额
loading: false,
openId: this.$store.state.user.openId,
buyType: 1, // 1 是拼团购买,其他是 单独或券后购买
}
},
onLoad(options) {
const { orderId, totalAmount, balance, payType } = options
const { buyType, groupRecordId, courseId, orderId, totalAmount, balance, payType } = options
this.buyType = buyType
this.groupRecordId = groupRecordId
this.courseId = courseId
this.orderId = orderId
this.totalAmount = totalAmount ? Number(totalAmount) : 0
this.balance = balance ? Number(balance) : 0
......@@ -190,12 +196,22 @@ export default {
title: '支付成功',
duration: 1500,
})
// todo 如何是 非拼团购买,就跳普通页面。
// 当前只有拼团业务才会被分享出来,在微信小程序中支付
const url = `${hostPrefix}/h5-course/pay/groupSuccess?ccc=qwe&ttt=123`
// const url = `${hostPrefix}/h5-course/detail/7934?uid&accessToken&appId=wx1106c32a36d87d49&isFromMin=weapp&miniType=groupActivity&ffrom=AppletWechatCourseFuLi&timestamp=1678689403156`
const pageParams = {
uid: this.$store.state.user.uid || '',
accessToken: this.$store.state.user.accessToken || '',
isFromMin: 'weapp',
courseId: this.courseId,
groupRecordId: this.groupRecordId,
}
const urlStr = qs.stringify(pageParams)
console.log('urlStr', urlStr)
let pagePath = 'pay/success'
if (Number(this.buyType) === 1) {
pagePath = 'pay/groupSuccess'
}
const url = `${hostPrefix}/h5-course/${pagePath}?${urlStr}`
uni.navigateTo({
url: `/pages/web/web?title=${'支付成功'}&loadUrl=${encodeURIComponent(url)}`,
})
......
......@@ -63,12 +63,15 @@ export default {
this.cccc = options.scene
// todo
this.testScene = options.scene || 'a07f38fb0baa4e3a9388a44f662e1acb'
// 有scene,说明是扫描二维码进入
if (options.scene) {
if (this.testScene) {
uni.showLoading({
title: '加载中',
})
this.getParamsByScene(options.scene)
this.getParamsByScene(this.testScene)
}
},
// 移除登录成功事件
......@@ -77,7 +80,7 @@ export default {
},
mounted() {
// this.options.scene 无值,说明是非扫描二维码,此时自己拼装路径
if (!this.options.scene) {
if (!this.testScene) {
this.initWeviewUrl()
}
},
......
......@@ -104,14 +104,19 @@ export default {
// shareUid 分享人id
// moreId 待定
const params = ['activityId', 'channel', 'recordId', 'shareUid'].reduce((acc, key) => {
// groupRecordId
if (res[key] || res[key] === 0) {
// 为了保证参数连贯性,使用通用的 groupRecordId
// 为了保证参数连贯性,使用通用的 shareGroupRecordId 标识 分享的参团记录id
if (key === 'recordId') {
acc['groupRecordId'] = res[key]
} else {
acc[key] = res[key]
acc['shareGroupRecordId'] = res[key]
return acc
}
// 拼团分享渠道
if (key === 'channel') {
acc['groupChannel'] = res[key]
return acc
}
acc[key] = res[key]
return acc
}
return acc
}, {})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment