Commit 231d5e09 by 李伟康

提交代码

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