Commit 231d5e09 by 李伟康

提交代码

1 parent 1bef357a
const url = '/rop-scrm-shopmall/router'
import { util } from 'utils'
export default {
/**众筹详情 */
getActivityDetail(id) {
getActivityDetail (id) {
return window.$HTTP({
url,
data: {
......@@ -12,7 +13,7 @@ export default {
})
},
/**参团人数 */
getActivityGroup(id) {
getActivityGroup (id) {
return window.$HTTP({
url,
data: {
......@@ -22,7 +23,7 @@ export default {
})
},
/** 创建订单(立即购买) */
createOrder(data) {
createOrder (data) {
data.method = 'scrm.api.shopmall.weapp.order.create'
return window.$HTTP({
url,
......@@ -31,7 +32,7 @@ export default {
})
},
/**创建支付订单(去付款) */
payOrder(data) {
payOrder (data) {
data.method = `scrm.api.shopmall.weapp.order.createPay`
return window.$HTTP({
url,
......@@ -40,7 +41,7 @@ export default {
})
},
/**海报 */
getPoster(data) {
getPoster (data) {
data.method = `scrm.api.shopmall.weapp.crowdFunding.poster`
return window.$HTTP({
url,
......@@ -48,7 +49,7 @@ export default {
})
},
/** 订单详情 */
getOrderList(activityId) {
getOrderList (activityId) {
let data = {
activityId,
method: 'scrm.api.shopmall.weapp.crowdFunding.order.list'
......@@ -59,7 +60,7 @@ export default {
})
},
// 根据众筹id获取直播详情
getLiveDetail(id) {
getLiveDetail (id) {
let data = {
id,
method: 'scrm.api.shopmall.weapp.activity.live.broadcast.detail'
......@@ -70,7 +71,7 @@ export default {
})
},
// 直播IM用户签名
getLiveSig(data) {
getLiveSig (data) {
data.method = 'scrm.api.shopmall.weapp.live.activity.usersig'
return window.$HTTP({
url,
......@@ -78,11 +79,37 @@ export default {
})
},
/** 查询分享人信息 */
getStaffInfo(data) {
getStaffInfo (data) {
data.method = 'scrm.api.shopmall.activity.share.user.info'
return window.$HTTP({
url,
data
})
},
/**直播间埋点*/
liveRoomReport (data) {
const userInfo = util.getUserInfo(),
params = util.getLocalStorage('wx_scrm_link_params') || {}
let obj = {
accountId: userInfo.accountId,
accountName: userInfo.nickName,
customerAvatar: userInfo.logo,
customerOpenId: userInfo.openid,
customerUnionId: '',
customerPhone: userInfo.phone || '',
merchantId: params.merchantId,
bizDataType: 1,
operationType: 3,
operationDate: new Date().format('yyyy-MM-dd hh:mm:ss')
}
data.method = 'scrm.api.shopmall.livebroadcast.report'
return window.$HTTP({
url,
data: {
...data,
...obj
},
})
},
}
<template>
<div
:class="['action isFullSucreen flex', { bgBlack: bgBlack }, { liveBtn: isImAction }]"
:class="['action isFullSucreen flex', { bgBlack: videoFullscreen }, { liveBtn: isImAction }]"
v-if="show"
>
<div
class="btn-box flex"
v-show="!bgBlack"
v-show="!videoFullscreen"
>
<div
class="item"
......@@ -131,7 +131,7 @@ export default {
}
},
props: {
bgBlack: {
videoFullscreen: {
type: Boolean,
default: false
},
......@@ -260,15 +260,15 @@ export default {
shopmallApi.payOrder({
orderCode: orderInfo.orderCode,
paymentSource: 2 //1128版本 支付来源(1:小程序,2:公众号)
}).then(({ code, data, message }) => {
}).then(async ({ code, data, message }) => {
this.hideLoading()
let [url] = window.location.href.split('?')
let redirectUrl = `${url}/success`
if (code == '0') {
this.showModal = false
let { needPay, payParams, order } = data
let { needPay, payParams, order } = data,
{ videoFullscreen } = this
if (needPay) {
if (order?.outTradeNo) orderInfo.outTradeNo = order.outTradeNo
let params = {
nonceStr: payParams.nonceStr,
paySign: payParams.paySign,
......@@ -294,6 +294,14 @@ export default {
})
else this.to('crowdfunding.success', { orderInfo })
}
if (videoFullscreen) {
console.log('直播间下单')
const res = await shopmallApi.liveRoomReport({
bizDataCode: orderInfo.orderCode,
liveBroadcastRoomId: 53
})
console.log(res)
}
} else this.showToast(message)
})
},
......
......@@ -48,7 +48,7 @@
<div v-show="videoFullscreen">
<!-- IM -->
<im v-if="LiveProps[liveDetail.status].isLive" :liveDetail="liveDetail" :isAction="isAction" class="Im"></im>
<action :bgBlack="true" class="BgAction" v-show="isAction && !LiveProps[liveDetail.status].isLive"></action>
<action :videoFullscreen="true" class="BgAction" v-show="isAction && !LiveProps[liveDetail.status].isLive"></action>
</div>
</div>
</div>
......
......@@ -37,7 +37,7 @@ export default {
userName,
userPhone,
goodsName,
outTradeNo,
orderCode,
orderStatus,
createdDate,
vehicleBrandName,
......@@ -85,9 +85,9 @@ export default {
}
labelList = [...labelList, '商品名称:', '支付时间:']
valueList = [...valueList, goodsName, new Date(createdDate).format('yyyy年M月d日 hh:mm:ss')]
if (orderStatus != 10 && outTradeNo) {
labelList.push('商户订单号:')
valueList.push(outTradeNo)
if (orderStatus != 10 && orderCode) {
labelList.push('订单号:')
valueList.push(orderCode)
}
if (formContentFirst) {
labelList.push(formDescribeFirst)
......@@ -119,7 +119,7 @@ export default {
}, () => {
if (orderStatus == 10) {
draw.drawText({
text: '商户订单号',
text: '订单号',
x: labelX - 1,
y: 24,
color: '#282829',
......@@ -127,7 +127,7 @@ export default {
textBaseline
})
draw.drawText({
text: outTradeNo || '',
text: orderCode || '',
x: labelX - 1,
y: 54,
color: '#282829',
......
......@@ -10,7 +10,7 @@
module.exports = {
title: '加载中...',
request: {
baseURL: 'http://scrm.test.glsx.com.cn', // 本地测试项目地址,
baseURL: 'http://scrm.dev.glsx.com.cn', // 本地测试项目地址,
// 设置超时时间
timeout: 180000,
// 携带凭证
......
......@@ -20,19 +20,19 @@ const state = {
isLiveFull: false
}
const mutations = {
SET_ACTIVITY_INFO(state, value) {
SET_ACTIVITY_INFO (state, value) {
state.activityInfo = value
state.updataCarInfo = Date.now()
},
SET_PAGE_META(state, meta) {
SET_PAGE_META (state, meta) {
state.pageMeta = meta
},
PUSH_KEEP(state, name) {
PUSH_KEEP (state, name) {
if (!state.keepAlives.includes(name)) {
state.keepAlives.push(name)
}
},
REMOVE_KEEP(state, names) {
REMOVE_KEEP (state, names) {
state.keepAlives = state.keepAlives.reduce((arr, name) => {
if (!names.includes(name)) {
return arr.push(name)
......@@ -40,37 +40,38 @@ const mutations = {
return arr
}, [])
},
SET_LAST_PATH(state, path) {
SET_LAST_PATH (state, path) {
state.lastPath = path
},
SET_LOGIN_STATUS(state, data) {
SET_LOGIN_STATUS (state, data) {
state.loginStatus = data
},
SET_LIVE_FULL(state, data) {
SET_LIVE_FULL (state, data) {
state.isLiveFull = data
}
}
const actions = {
setPageMeta({ commit }, meta) {
setPageMeta ({ commit }, meta) {
document.title = meta.title
commit('SET_PAGE_META', meta)
},
pushKeep({ commit }, name) {
pushKeep ({ commit }, name) {
commit('PUSH_KEEP', name)
},
removeKeep({ commit }, names) {
removeKeep ({ commit }, names) {
commit('REMOVE_KEEP', names)
},
setActivityInfo({ commit }, value) {
setActivityInfo ({ commit }, value) {
commit('SET_ACTIVITY_INFO', value)
},
setLoginStatus({ commit }, value) {
setLoginStatus ({ commit }, value) {
commit('SET_LOGIN_STATUS', value)
},
setIsLiveFull({ commit }, value) {
setIsLiveFull ({ commit }, value) {
commit('SET_LIVE_FULL', value)
},
wxLogin({ dispatch }, { code, redirectUrl, appId }) {
wxLogin ({ dispatch }, { code, redirectUrl, appId }) {
let code_back_time = new Date().format('yyyy-MM-dd hh:mm:ss')
ssoApi
.login({
code,
......@@ -81,6 +82,18 @@ const actions = {
let route = state.lastPath == 'crowdfunding' ? '' : state.lastPath || ''
route = route.replace('.', '/')
if (code == '0') {
if (route.startsWith('common/auth')) {
const params = {
nickName: data.nickName,
avatarUrl: data.logo,
code_back_time,
login_success_time: new Date().format('yyyy-MM-dd hh:mm:ss')
}
wx.miniProgram.redirectTo({
url: `/pages/crowdfunding/index/index?userProfile=${encodeURIComponent(JSON.stringify(params))}`
})
return
}
util.setUserInfo(data)
util.setSessionId(data.sessionId)
dispatch('registerHttp', data.sessionId)
......@@ -96,7 +109,7 @@ const actions = {
}
})
},
getWxCode({ dispatch }) {
getWxCode ({ dispatch }) {
let [redirectUrl] = window.location.href.split('?')
let params = util.getPageQuery()
let arr = []
......@@ -114,7 +127,7 @@ const actions = {
util.setAppId(appid)
window.location.href = `${wxUrl}&state=STATE#wechat_redirect`
},
login({ dispatch }) {
login ({ dispatch }) {
let [redirectUrl] = window.location.href.split('?')
const isWxWork = util.getLocalStorage('is_wxwork')
const code = util.getPageQuery('code')
......@@ -123,18 +136,19 @@ const actions = {
if (process.env.NODE_ENV == 'development') {
//本地开发
if (code) {
let code_back_time = new Date().format('yyyy-MM-dd hh:mm:ss')
const target = isWxWork ? 'wwLogin' : 'login'
const PARAMS = isWxWork
? {
code,
corpId: appId,
getUserInfoFlag: false
}
code,
corpId: appId,
getUserInfoFlag: false
}
: {
code,
appId: window.$fetchConfig.appid,
state: 'snsapi_userinfo'
}
code,
appId: window.$fetchConfig.appid,
state: 'snsapi_userinfo'
}
ssoApi[target](PARAMS).then(({ code, data, message }) => {
let route = state.lastPath == 'crowdfunding' ? '' : state.lastPath || ''
route = route.replace('.', '/')
......@@ -148,6 +162,18 @@ const actions = {
userInfo = data
sessionId = data.sessionId
}
if (route.startsWith('common/auth')) {
const params = {
nickName: data.nickName,
avatarUrl: data.logo,
code_back_time,
login_success_time: new Date().format('yyyy-MM-dd hh:mm:ss')
}
wx.miniProgram.redirectTo({
url: `/pages/crowdfunding/index/index?userProfile=${encodeURIComponent(JSON.stringify(params))}`
})
return
}
util.setUserInfo(userInfo)
util.setSessionId(sessionId)
dispatch('registerHttp', sessionId)
......@@ -157,7 +183,7 @@ const actions = {
pageQuery = pageQuery.replace(/\|/g, '&')
let url = `${redirectUrl}#/${route}`
if (pageQuery) url += `?${pageQuery}`
window.location.replace(url)
window.location.replace(url)
} else Notify(message)
})
} else dispatch('getWxCode')
......@@ -173,7 +199,7 @@ const actions = {
}
}
},
navigation({ dispatch }) {
navigation ({ dispatch }) {
const isWxWork = util.getLocalStorage('is_wxwork')
let params = util.getPageQuery() //从链接获取
if (Object.keys(params).length && params.id) util.setLocalStorage('wx_scrm_link_params', params)
......@@ -195,7 +221,7 @@ const actions = {
return
} else dispatch('login')
},
registerHttp({ dispatch }, sessionId = '') {
registerHttp ({ dispatch }, sessionId = '') {
window.$HTTP = new Http({ ...window.$fetchConfig, alert: Notify, headers: { token: sessionId } })
}
}
......
<template>
<div>
</div>
</template>
......@@ -9,21 +9,9 @@ export default {
name: '',
data () {
return {
userInfo: null
}
},
mounted () {
this.showLoading()
const userInfo = this.getUserInfo(),
data = {
nickName: userInfo.nickName,
avatarUrl: userInfo.logo,
time: new Date().format('yyyy-MM-dd hh:mm:ss')
}
this.userInfo = JSON.stringify(userInfo)
wx.miniProgram.redirectTo({
url: `/pages/crowdfunding/index/index?userProfile=${encodeURIComponent(JSON.stringify(data))}`
})
},
methods: {
}
......
......@@ -33,7 +33,7 @@ export default {
activityJoin,
payPrice,
orderGoods: [orderGoods],
outTradeNo
orderCode
} = orderInfo
this.orderInfo = {
userName: activityJoin.userName,
......@@ -51,7 +51,7 @@ export default {
formContentSecond: activityJoin.formContentSecond,
formDescribeFirst: activityJoin.formDescribeFirst,
formDescribeSecond: activityJoin.formDescribeSecond,
outTradeNo
orderCode
}
},
methods: {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!