Commit b698e735 by 张立顺

联调完成

2 parents 254749da 453f605c
Showing 46 changed files with 1371 additions and 569 deletions
import api from '~/utils/request/request' import api from '~/utils/request/request'
import ssoApi from './ssoApi'
const common = 'scrm.api.carlife.common.' const common = 'scrm.api.carlife.common.'
module.exports = { module.exports = {
ssoApi,
commonApi: { commonApi: {
/**上传图片 /**上传图片
*/ */
......
/**
* 申请门店开通
*/
// import api from '~/utils/request/request'
// const serverApi = {
// productByscene:'scrm.api.busassistant.activity.productByscene'
// }
// export const productBysceneApi = (data) =>{
// return api.post(
// {
// method: serverApi.productByscene,
// ...data
// },
// true
// )
// }
/** /**
* 拓客户,看线索接口 * 拓客户,看线索接口
*/ */
import api from '~/utils/request/request' import api from "~/utils/request/request";
const common = 'scrm.api.carlife.common.'
const serverApi = {
// 拓客户
productByscene: "scrm.api.busassistant.activity.findSceneProductStatus",
// 看线索
unread: "scrm.api.busassistant.clue.unread", //获取未读线索数量
page: "scrm.api.busassistant.clue.page", //分页查询线索列表
read: "scrm.api.busassistant.clue.read", //标记线索已读
tag: "scrm.api.busassistant.clue.tag", //线索标记意向客户
};
// 拓客户 // 拓客户
const productBysceneApi = (data) => {
return api.post(
{
method: serverApi.productByscene,
...data,
},
true
);
};
// 看线索 // 看线索
const unreadApi = (data) => {
return api.post(
{
method: serverApi.unread,
...data,
},
true
);
};
const pageApi = (data) => {
return api.post(
{
method: serverApi.page,
...data,
},
true
);
};
const readApi = (data) => {
return api.post(
{
method: serverApi.read,
...data,
},
true
);
};
const tagApi = (data) => {
return api.post(
{
method: serverApi.tag,
...data,
},
true
);
};
module.exports = {
/** 线索埋点数据上报
* operationType 操作类型(0:分享 1:浏览 2:申请活动)
*/
reportData(data = {}, operationType = 0) {
return api.post({
method: "scrm.api.busassistant.clue.report",
...data,
operationType,
operationDate: new Date().format("yyyy-MM-dd hh:mm:ss"),
});
},
productBysceneApi,
unreadApi,
pageApi,
readApi,
tagApi,
};
...@@ -47,5 +47,14 @@ class outputApi { ...@@ -47,5 +47,14 @@ class outputApi {
// true // true
) )
} }
/** 查找可开通的产品 */
getNoOpenPro(data) {
return api.post(
{
method: 'scrm.api.busassistant.activity.findNotOpenProducts',
...data
}
)
}
} }
export default outputApi export default outputApi
import api from '~/utils/request/request'
const path = 'scrm.api.sso.weapp.'
module.exports = {
/**wx.login登录 */
jsCodeLogin(data) {
return api.post(
{
method: `${path}jscode.login`,
...data
},
true
)
},
/**授权用户信息 */
authUserInfo(data) {
return api.post(
{
method: 'scrm.api.sso.weapp.auth.userinfo',
...data
},
true
)
},
/**授权手机号 */
authUserPhone(data) {
return api.post(
{
method: `${path}auth.phone`,
...data
},
true
)
},
/**退出 */
logout() {
return api.post(
{
method: `scrm.api.sso.user.logout`
},
true
)
},
//保存用户授权信息
saveuserProfile(data) {
return api.post(
{
method: `scrm.api.wechat.auth.userProfile.save`,
...data
},
true
)
},
/**更新客户手机号 */
updataCustomerPhone(data) {
return api.post({
method: `scrm.api.sso.weapp.mark.phone`,
...data
})
}
}
import api from '~/utils/request/request' import api from '~/utils/request/request'
const { appId } = wx.getAccountInfoSync().miniProgram const {
appId
} = wx.getAccountInfoSync().miniProgram
const CODE = { const CODE = {
platformEntrance: 'BUSINESS_ASSISTANT', platformEntrance: 'BUSINESS_ASSISTANT',
productCode: 'PC00c3' productCode: 'PC00c3'
...@@ -7,9 +9,10 @@ const CODE = { ...@@ -7,9 +9,10 @@ const CODE = {
class UsersApi { class UsersApi {
/**调用后台接口获取用户信息js_code换取sessionId */ /**调用后台接口获取用户信息js_code换取sessionId */
async wxCodeLogin() { async wxCodeLogin() {
const { code } = await this.getWxCode() const {
return await api.post( code
{ } = await this.getWxCode()
return await api.post({
method: 'scrm.api.sso.wechat.applets.jscode.login', method: 'scrm.api.sso.wechat.applets.jscode.login',
appId, appId,
code code
...@@ -19,8 +22,7 @@ class UsersApi { ...@@ -19,8 +22,7 @@ class UsersApi {
} }
/**退出登录 */ /**退出登录 */
logout() { logout() {
return api.post( return api.post({
{
method: 'scrm.api.sso.wechat.applets.logout' method: 'scrm.api.sso.wechat.applets.logout'
}, },
true true
...@@ -46,8 +48,7 @@ class UsersApi { ...@@ -46,8 +48,7 @@ class UsersApi {
delete detail.errMsg delete detail.errMsg
if (detail.iv && detail.encryptedData) { if (detail.iv && detail.encryptedData) {
detail.loginToken = loginToken detail.loginToken = loginToken
return api.post( return api.post({
{
method: 'scrm.api.sso.wechat.applets.auth.phone', method: 'scrm.api.sso.wechat.applets.auth.phone',
...detail, ...detail,
platformEntrance: 'BUSINESS_ASSISTANT' // 平台标识:生意助手-BUSINESS_ASSISTANT,门店助手-STORE_ASSISTANT platformEntrance: 'BUSINESS_ASSISTANT' // 平台标识:生意助手-BUSINESS_ASSISTANT,门店助手-STORE_ASSISTANT
...@@ -58,8 +59,7 @@ class UsersApi { ...@@ -58,8 +59,7 @@ class UsersApi {
} }
/**账号密码登录 */ /**账号密码登录 */
async accountLogin(data = {}) { async accountLogin(data = {}) {
return api.post( return api.post({
{
method: 'scrm.api.sso.wechat.applets.password.login', method: 'scrm.api.sso.wechat.applets.password.login',
...data, ...data,
...CODE ...CODE
...@@ -69,8 +69,7 @@ class UsersApi { ...@@ -69,8 +69,7 @@ class UsersApi {
} }
/** 手机号获取短信验证码 */ /** 手机号获取短信验证码 */
getSmsCode(mobile) { getSmsCode(mobile) {
return api.post( return api.post({
{
method: 'scrm.api.sso.wechat.applets.sms.get.code', method: 'scrm.api.sso.wechat.applets.sms.get.code',
mobile mobile
}, },
...@@ -79,8 +78,7 @@ class UsersApi { ...@@ -79,8 +78,7 @@ class UsersApi {
} }
/** 手机号短信验证码登录 */ /** 手机号短信验证码登录 */
phoneSmsLogin(data = {}) { phoneSmsLogin(data = {}) {
return api.post( return api.post({
{
method: 'scrm.api.sso.wechat.applets.sms.login', method: 'scrm.api.sso.wechat.applets.sms.login',
...data, ...data,
source: 'MINIAPP', source: 'MINIAPP',
...@@ -91,8 +89,7 @@ class UsersApi { ...@@ -91,8 +89,7 @@ class UsersApi {
} }
/** 获取登录账号列表 */ /** 获取登录账号列表 */
getAccountList(sessionId) { getAccountList(sessionId) {
return api.post( return api.post({
{
method: 'scrm.api.sso.wechat.applets.listSelectAccount', method: 'scrm.api.sso.wechat.applets.listSelectAccount',
...CODE, ...CODE,
sessionId sessionId
...@@ -103,8 +100,7 @@ class UsersApi { ...@@ -103,8 +100,7 @@ class UsersApi {
/** /**
* 选择账号登录(手机绑定多个账号时) */ * 选择账号登录(手机绑定多个账号时) */
selectAccountLogin(data) { selectAccountLogin(data) {
return api.post( return api.post({
{
method: 'scrm.api.sso.wechat.applets.selectAccountLogin', method: 'scrm.api.sso.wechat.applets.selectAccountLogin',
...CODE, ...CODE,
...data ...data
...@@ -114,8 +110,7 @@ class UsersApi { ...@@ -114,8 +110,7 @@ class UsersApi {
} }
/**检查sessionId 是否过期 */ /**检查sessionId 是否过期 */
checkSession() { checkSession() {
return api.post( return api.post({
{
method: 'scrm.api.sso.login.status.check' method: 'scrm.api.sso.login.status.check'
}, },
true true
...@@ -123,8 +118,7 @@ class UsersApi { ...@@ -123,8 +118,7 @@ class UsersApi {
} }
/** 超级管理员切换账号 */ /** 超级管理员切换账号 */
adminSelectLogin(data) { adminSelectLogin(data) {
return api.post( return api.post({
{
method: 'scrm.api.sso.super.administrator.select.login', method: 'scrm.api.sso.super.administrator.select.login',
...CODE, ...CODE,
...data ...data
...@@ -140,12 +134,40 @@ class UsersApi { ...@@ -140,12 +134,40 @@ class UsersApi {
...data ...data
}) })
} }
<<<<<<< HEAD
/** 退出登录 */ /** 退出登录 */
logout(data) { logout(data) {
return api.post({ return api.post({
method: 'scrm.api.sso.wechat.applets.logout', method: 'scrm.api.sso.wechat.applets.logout',
...CODE, ...CODE,
...data ...data
=======
/** 手机号授权解析(单纯解析内容返回前端)
* 只传loginToken就返回unionId和openid
* 传加密信息就解析手机号
*/
/**获取微信用户信息 */
async getWXUserInfo() {
let wx_user_info = wx.$storage.get('wx_user_info')
if (!wx_user_info) {
const data = await this.getUserProfile()
wx.$storage.set('wx_user_info', data)
return data
} else return wx_user_info
}
async getUserProfile(loginToken, detail = {}) {
if (detail.errMsg && detail.errMsg == 'getPhoneNumber:fail user deny') Promise.reject()
delete detail.errMsg
if (!loginToken) {
let res = await this.wxCodeLogin()
loginToken = res.data
}
detail.loginToken = loginToken
return api.post({
method: 'scrm.api.sso.wechat.applets.phone.grant.analysis',
...detail,
platformEntrance: 'BUSINESS_ASSISTANT'
>>>>>>> 453f605c17f20f69b383822ce6981abe179f022b
}) })
} }
} }
......
...@@ -12,7 +12,7 @@ import { setSystem_info } from '~/utils/cache/storageApi' ...@@ -12,7 +12,7 @@ import { setSystem_info } from '~/utils/cache/storageApi'
import getUpdateManager from './utils/lib/wxUpdateManager' import getUpdateManager from './utils/lib/wxUpdateManager'
// 埋点 // 埋点
import './utils/track/Track' // import './utils/track/Track'
import eventbus from './utils/evenbus' import eventbus from './utils/evenbus'
......
...@@ -28,9 +28,9 @@ Component({ ...@@ -28,9 +28,9 @@ Component({
value: '' value: ''
}, },
// 是否有红点 // 是否有红点
redpoint: { unreadClueCount: {
type: Array, type: Number,
value: ['看线索'] value: 0
}, },
}, },
...@@ -41,6 +41,11 @@ Component({ ...@@ -41,6 +41,11 @@ Component({
count: 0, count: 0,
to: '' to: ''
}, },
// lifetimes:{
// attached: function() {
// console.log('unreadClueCount',this.data.unreadClueCount)
// }
// },
/** /**
* 组件的方法列表 * 组件的方法列表
...@@ -50,7 +55,8 @@ Component({ ...@@ -50,7 +55,8 @@ Component({
let { count } = e.currentTarget.dataset let { count } = e.currentTarget.dataset
this.setData({ this.setData({
count, count,
to: `to-${count}` to: `to-${count}`,
unreadClueCount:0
}) })
this.triggerEvent('click', count) this.triggerEvent('click', count)
} }
......
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
enable-flex enable-flex
scroll-with-animation scroll-with-animation
scroll-into-view="{{to}}" scroll-into-view="{{to}}"
enhanced="{{true}}"
show-scrollbar="{{false}}"
> >
<block wx:for="{{tab}}" wx:key="index"> <block wx:for="{{tab}}" wx:key="index">
<view <view
...@@ -34,7 +36,8 @@ ...@@ -34,7 +36,8 @@
{{item}} {{item}}
</view> </view>
<view class="line" style="lineStyle" /> <view class="line" style="lineStyle" />
<view wx:if="{{filterUtils.hasRedpoint(redpoint,item)}}" class="redpoint" /> <!-- -->
<view wx:if="{{filterUtils.hasRedpoint(unreadClueCount)}}" class="redpoint" />
</view> </view>
</block> </block>
</view> </view>
......
/** var hasRedpoint = function (unreadClueCount) {
* // console.log('unreadClueCount: ', unreadClueCount);
* @param array 数组 if(unreadClueCount>0){
* @param item 数组中的某一项 return true
* @returns }else{
*/ return false;
var hasRedpoint = function (array, item) { }
// console.log('array: ', array);
return array.length > 0 && array.indexOf(item) != -1;
}; };
module.exports = { module.exports = {
hasRedpoint: hasRedpoint, hasRedpoint: hasRedpoint,
......
...@@ -71,10 +71,13 @@ ...@@ -71,10 +71,13 @@
height: 0; height: 0;
color: transparent; color: transparent;
} }
.active .redpoint{
display: none;
}
.redpoint { .redpoint {
position: absolute; position: absolute;
top: 0; top: 10px;
right: 0; right: 5px;
/* top: 8px; /* top: 8px;
right: 10px; */ right: 10px; */
width: 10px; width: 10px;
......
// login/index/components/LoginBox.js // login/index/components/LoginBox.js
import USERAPI from '~/api/usersApi/index' import USERAPI from '~/api/usersApi/index'
import { selectAccountLogin, setLoginInfo, loginModal } from '~/login/lib/index' import {
selectAccountLogin,
setLoginInfo,
loginModal
} from '~/login/lib/index'
import md5 from '~/utils/lib/md5' import md5 from '~/utils/lib/md5'
import network from '~/utils/network' import network from '~/utils/network'
import { imgUrlMixin } from '~/mixins/index' import {
imgUrlMixin
} from '~/mixins/index'
let thisPage let thisPage
Component({ Component({
behaviors: [imgUrlMixin], behaviors: [imgUrlMixin],
...@@ -43,8 +49,11 @@ Component({ ...@@ -43,8 +49,11 @@ Component({
}, },
/**输入回调 */ /**输入回调 */
input(e) { input(e) {
const { value } = e.detail, const {
{ name } = e.currentTarget.dataset value
} = e.detail, {
name
} = e.currentTarget.dataset
this.setData({ this.setData({
[`formData.${name}`]: value [`formData.${name}`]: value
}) })
...@@ -57,7 +66,9 @@ Component({ ...@@ -57,7 +66,9 @@ Component({
}, },
/**清除input value */ /**清除input value */
clear(e) { clear(e) {
const { name } = e.currentTarget.dataset const {
name
} = e.currentTarget.dataset
this.setData({ this.setData({
[`formData.${name}`]: '' [`formData.${name}`]: ''
}) })
...@@ -66,14 +77,21 @@ Component({ ...@@ -66,14 +77,21 @@ Component({
}, },
/**获取验证码 */ /**获取验证码 */
getSmsCode() { getSmsCode() {
const { phoneReady, formData, count } = this.data, const {
phoneReady,
formData,
count
} = this.data,
countDown = 60 countDown = 60
if (!phoneReady || count) return if (!phoneReady || count) return
this.setData({ this.setData({
smsLoading: true smsLoading: true
}) })
USERAPI.getSmsCode(formData.phone) USERAPI.getSmsCode(formData.phone)
.then(({ code, message }) => { .then(({
code,
message
}) => {
this.setData({ this.setData({
smsLoading: false smsLoading: false
}) })
...@@ -94,7 +112,9 @@ Component({ ...@@ -94,7 +112,9 @@ Component({
count: countDown count: countDown
}) })
setTimeout(() => { setTimeout(() => {
let { count } = this.data let {
count
} = this.data
this.setData({ this.setData({
count: --count count: --count
}) })
...@@ -107,11 +127,13 @@ Component({ ...@@ -107,11 +127,13 @@ Component({
}, },
/**检查输入框内容 */ /**检查输入框内容 */
checkFormData() { checkFormData() {
const { loginType, formData } = this.data const {
loginType,
formData
} = this.data
if (loginType != 0) { if (loginType != 0) {
if (loginType == 1) { if (loginType == 1) {
this.setData( this.setData({
{
phoneReady: formData.phone && thisPage.validate.methods.tel(formData.phone) phoneReady: formData.phone && thisPage.validate.methods.tel(formData.phone)
}, },
() => { () => {
...@@ -129,30 +151,39 @@ Component({ ...@@ -129,30 +151,39 @@ Component({
}, },
/**手机号&帐号密码登录 */ /**手机号&帐号密码登录 */
login() { login() {
const { formData, loginType } = this.data, const {
formData,
loginType
} = this.data,
target = { target = {
1: 'phoneSmsLogin', 1: 'phoneSmsLogin',
2: 'accountLogin' 2: 'accountLogin'
}[loginType], } [loginType],
obj = obj =
loginType == 1 loginType == 1 ? {
? {
mobile: formData.phone, mobile: formData.phone,
code: formData.code code: formData.code
} } : {
: {
userName: formData.account, userName: formData.account,
password: md5(formData.password) password: md5(formData.password)
} }
this.setBtnLoading() this.setBtnLoading()
USERAPI[target](obj) USERAPI[target](obj)
.then(({ code, data, message }) => { .then(({
code,
data,
message
}) => {
this.setBtnLoading(false) this.setBtnLoading(false)
if (code == '0') { if (code == '0') {
if (loginType == 1) this.checkLoginUserInfo(data) if (loginType == 1) this.checkLoginUserInfo(data)
else { else {
const { autoLogin } = thisPage.data, const {
{ sessionId } = data, autoLogin
} = thisPage.data, {
sessionId,
loginUserInfoList
} = data,
validTime = 3600 * 24 * 7 * 1e3, validTime = 3600 * 24 * 7 * 1e3,
autoLoginFailureTime = Date.now() + validTime autoLoginFailureTime = Date.now() + validTime
if (autoLogin) { if (autoLogin) {
...@@ -162,8 +193,7 @@ Component({ ...@@ -162,8 +193,7 @@ Component({
password: md5(formData.password) password: md5(formData.password)
}) })
} else wx.$storage.rm('auto_login_object') } else wx.$storage.rm('auto_login_object')
console.log(data) setLoginInfo(loginUserInfoList[0], sessionId)
setLoginInfo(data, sessionId)
} }
} else { } else {
if (loginType == 1) if (loginType == 1)
...@@ -179,29 +209,41 @@ Component({ ...@@ -179,29 +209,41 @@ Component({
}) })
}, },
/**微信登录 */ /**微信登录 */
wxLogin({ detail }) { wxLogin({
detail
}) {
if (!detail.code) return if (!detail.code) return
this.setBtnLoading() this.setBtnLoading()
USERAPI.authUserPhone(detail, this.loginToken) USERAPI.authUserPhone(detail, this.loginToken)
.then(({ code, data, message }) => { .then(({
code,
data,
message
}) => {
if (code == '0') this.checkLoginUserInfo(data) if (code == '0') this.checkLoginUserInfo(data)
else wx.$api.showToast(message || '系统异常') else wx.$api.showToast(message || '系统异常')
this.setBtnLoading(false) this.setBtnLoading(false)
}) })
.catch(({ errMsg }) => { .catch(({
errMsg
}) => {
wx.$api.showToast(errMsg || '系统异常') wx.$api.showToast(errMsg || '系统异常')
this.setBtnLoading(false) this.setBtnLoading(false)
}) })
}, },
/**手机号&微信登录:是否跳转登录列表页 */ /**手机号&微信登录:是否跳转登录列表页 */
checkLoginUserInfo({ loginUserInfoList, sessionId }) { checkLoginUserInfo({
loginUserInfoList,
sessionId
}) {
/**多个账号 */ /**多个账号 */
if (loginUserInfoList.length > 1) if (loginUserInfoList.length > 1)
wx.$router.go('login.accountItems', { wx.$router.go('login.accountItems', {
sessionId, sessionId,
...thisPage.options ...thisPage.options
}) })
/**只有一个账号 */ else /**只有一个账号 */
else
selectAccountLogin({ selectAccountLogin({
id: loginUserInfoList[0].uuid, id: loginUserInfoList[0].uuid,
sessionId sessionId
...@@ -221,15 +263,24 @@ Component({ ...@@ -221,15 +263,24 @@ Component({
network.getNetworkType() network.getNetworkType()
thisPage = wx.$router.getPageInstance() thisPage = wx.$router.getPageInstance()
try { try {
const { data, code, message } = await USERAPI.wxCodeLogin() const {
data,
code,
message
} = await USERAPI.wxCodeLogin()
if (code == '0') { if (code == '0') {
thisPage.setData({ thisPage.setData({
disabled: false disabled: false
}) })
this.loginToken = data this.loginToken = data
USERAPI.getUserProfile(data).then(data => {
wx.$storage.set('wx_user_info', data)
})
} else this.reLogin(message) } else this.reLogin(message)
wx.hideLoading() wx.hideLoading()
} catch ({ errMsg }) { } catch ({
errMsg
}) {
console.error(errMsg) console.error(errMsg)
this.reLogin() this.reLogin()
} }
......
...@@ -28,7 +28,6 @@ const selectAccountLogin = ({ id, sessionId }) => { ...@@ -28,7 +28,6 @@ const selectAccountLogin = ({ id, sessionId }) => {
} }
/**设置登录信息 */ /**设置登录信息 */
const setLoginInfo = (userInfo, sessionId) => { const setLoginInfo = (userInfo, sessionId) => {
console.log(userInfo)
setUserInfo(userInfo) setUserInfo(userInfo)
setSessionId(sessionId) setSessionId(sessionId)
loginSuccess() loginSuccess()
......
...@@ -108,7 +108,11 @@ Page({ ...@@ -108,7 +108,11 @@ Page({
message message
}) => { }) => {
if (code == '0') { if (code == '0') {
setLoginInfo(data, data.sessionId) const {
sessionId,
loginUserInfoList
} = data
setLoginInfo(loginUserInfoList[0], sessionId)
} else { } else {
try { try {
const reload = await loginModal({ const reload = await loginModal({
......
// packageOutput/pages/openBusiness/openBusiness.js // packageOutput/pages/openBusiness/openBusiness.js
import outputApi from '~/api/outputApi/index'
Page({ Page({
/** /**
...@@ -6,6 +7,8 @@ Page({ ...@@ -6,6 +7,8 @@ Page({
*/ */
data: { data: {
IMGURL: 'https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/', IMGURL: 'https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/',
merchantInfo: {},
sceneCodeList: [],
// 场景业务 // 场景业务
formData: { formData: {
scene1: true, scene1: true,
...@@ -17,90 +20,113 @@ Page({ ...@@ -17,90 +20,113 @@ Page({
// 活动内容 // 活动内容
activityList: [], activityList: [],
sceneActivityObj: { sceneActivityObj: {
scene1: [{ scene1: [],
name: '360实景导航', scene2: [],
price: 10 scene3: [],
}, { scene4: [],
name: 'AR实景导航', // scene1: [{
price: 20 // productName: '360实景导航',
}, { // price: 10
name: 'AR实景导航', // }, {
price: 20 // productName: 'AR实景导航',
}, { // price: 20
name: 'AR实景导航', // }, {
price: 20 // productName: 'AR实景导航',
}, { // price: 20
name: 'AR实景导航', // }, {
price: 20 // productName: 'AR实景导航',
}, { // price: 20
name: 'AR实景导航', // }, {
price: 20 // productName: 'AR实景导航',
}, { // price: 20
name: 'AR实景导航', // }, {
price: 20 // productName: 'AR实景导航',
}, { // price: 20
name: 'AR实景导航', // }, {
price: 20 // productName: 'AR实景导航',
}, { // price: 20
name: 'AR实景导航', // }, {
price: 20 // productName: 'AR实景导航',
}, { // price: 20
name: 'AR实景导航', // }, {
price: 20 // productName: 'AR实景导航',
}, { // price: 20
name: 'AR实景导航', // }, {
price: 20 // productName: 'AR实景导航',
}, { // price: 20
name: 'AR实景导航', // }, {
price: 20 // productName: 'AR实景导航',
}], // price: 20
scene2: [{ // }, {
name: '座椅通风', // productName: 'AR实景导航',
price: 30 // price: 20
}, { // }],
name: '座椅通风', // scene2: [{
price: 40 // productName: '座椅通风',
}], // price: 30
scene3: [{ // }, {
name: '氛围灯', // productName: '座椅通风',
price: 50 // price: 40
}, { // }],
name: '氛围灯', // scene3: [{
price: 60 // productName: '氛围灯',
}], // price: 50
scene4: [{ // }, {
name: '数字化', // productName: '氛围灯',
price: 70 // price: 60
}, { // }],
name: '数字化', // scene4: [{
price: 80 // productName: '数字化',
}, { // price: 70
name: '数字化', // }, {
price: 70 // productName: '数字化',
}, { // price: 80
name: '数字化', // }, {
price: 80 // productName: '数字化',
}, { // price: 70
name: '数字化', // }, {
price: 70 // productName: '数字化',
}, { // price: 80
name: '数字化', // }, {
price: 80 // productName: '数字化',
}, { // price: 70
name: '数字化', // }, {
price: 70 // productName: '数字化',
}, { // price: 80
name: '数字化', // }, {
price: 80 // productName: '数字化',
}] // price: 70
// }, {
// productName: '数字化',
// price: 80
// }]
} }
}, },
getNoOpenPro(sceneCode) {
var params = {
serviceMerchantId: this.data.merchantInfo.pMerchantId,
merchant4sId: this.data.merchantInfo.merchantId,
sceneCode: sceneCode
}
outputApi.getNoOpenPro(params).then(res => {
this.setData({
['sceneActivityObj.scene' + this.data.sceneActive]: res
})
this.setCurActivity()
})
},
// 场景切换
handleSceneChange(e) { handleSceneChange(e) {
var idx = e.detail.sceneIdx var idx = e.detail.sceneIdx
this.setData({ this.setData({
sceneActive: idx sceneActive: idx
}) })
if (!this.data.sceneActivityObj['scene' + this.data.sceneActive].length) {
this.getNoOpenPro(this.data.sceneCodeList[this.data.sceneActive - 1])
return true
}
this.setCurActivity() this.setCurActivity()
// console.log('换内容---') // console.log('换内容---')
}, },
...@@ -111,10 +137,11 @@ Page({ ...@@ -111,10 +137,11 @@ Page({
}) })
}, },
// 活动切换
handleActClick(e) { handleActClick(e) {
var idx = e.currentTarget.dataset.idx var idx = e.currentTarget.dataset.idx
this.setData({ this.setData({
['activityList[' + idx +'].checked']: !this.data.activityList[idx].checked ['activityList[' + idx + '].checked']: !this.data.activityList[idx].checked
}) })
}, },
...@@ -123,7 +150,7 @@ Page({ ...@@ -123,7 +150,7 @@ Page({
sceneActive: this.data.sceneActive, sceneActive: this.data.sceneActive,
activityIdxList: this.data.activityList.filter(item => item.checked == true) activityIdxList: this.data.activityList.filter(item => item.checked == true)
} }
if(!params.activityIdxList.length) { if (!params.activityIdxList.length) {
wx.$api.showToast('请选产品/活动') wx.$api.showToast('请选产品/活动')
return true return true
} }
...@@ -132,28 +159,22 @@ Page({ ...@@ -132,28 +159,22 @@ Page({
title: '提交成功', title: '提交成功',
icon: 'success' icon: 'success'
}) })
// equityApi.addClueRescue(obj).then(res => {
// wx.hideLoading()
// wx.showModal({
// content: '您的救援服务单已提交成功',
// confirmText: '返回',
// showCancel: false,
// confirmColor: '#FC5B32'
// }).then(res => {
// if (res.confirm) {
// wx.switchTab({
// url: '/pages/tab/index/index'
// })
// }
// })
// })
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
this.setCurActivity() wx.$router.getData(obj => {
console.log(obj)
this.setData({
merchantInfo: obj,
sceneActive: obj.sceneActive,
sceneCodeList: obj.sceneCodeList
})
this.getNoOpenPro(this.data.sceneCodeList[this.data.sceneActive - 1])
})
}, },
/** /**
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
<view class="box"> <view class="box">
<view class="box-title">产品/活动<text class="title-tip">(可多选)</text></view> <view class="box-title">产品/活动<text class="title-tip">(可多选)</text></view>
<view class="activity-box"> <view class="activity-box">
<view class="activity-item text-hide {{ item.checked ? 'active' : '' }}" wx:for="{{activityList}}" wx:key="index" bindtap="handleActClick" data-idx="{{index}}">{{item.name}}</view> <view class="activity-item text-hide {{ item.checked ? 'active' : '' }}" wx:for="{{activityList}}" wx:key="index" bindtap="handleActClick" data-idx="{{index}}">{{item.productName}}</view>
</view> </view>
</view> </view>
</view> </view>
......
...@@ -28,15 +28,15 @@ Component({ ...@@ -28,15 +28,15 @@ Component({
name: 'totalOrderMoney' name: 'totalOrderMoney'
}, { }, {
label: '客单价', label: '客单价',
name: '', name: 'calCustomerUnitPrice',
prefix: '¥' prefix: '¥'
}, { }, {
label: '引流体验量', label: '引流体验量',
name: '', name: 'calExperience',
suffix: '%' suffix: '%'
}, { }, {
label: '体验转化率', label: '体验转化率',
name: '', name: 'calTransform',
suffix: '%' suffix: '%'
}] }]
}, },
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<view class="block" wx:for="{{formDataList}}" wx:key="index"> <view class="block" wx:for="{{formDataList}}" wx:key="index">
<view> <view>
<text wx:if="{{item.prefix}}">{{item.prefix}}</text> <text wx:if="{{item.prefix}}">{{item.prefix}}</text>
{{formData[item.name]}} {{formData[item.name] || 0}}
<text wx:if="{{item.suffix}}">{{item.suffix}}</text> <text wx:if="{{item.suffix}}">{{item.suffix}}</text>
</view> </view>
<view class="label">{{item.label}}</view> <view class="label">{{item.label}}</view>
......
...@@ -7,7 +7,7 @@ Page({ ...@@ -7,7 +7,7 @@ Page({
*/ */
data: { data: {
IMGURL: 'https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/', IMGURL: 'https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/',
merchantName: '', sceneCodeList: ['SC001', 'SC002', 'SC003', 'SC004'],
merchantInfo: {}, merchantInfo: {},
sceneObj: { sceneObj: {
scene1: null, scene1: null,
...@@ -15,94 +15,98 @@ Page({ ...@@ -15,94 +15,98 @@ Page({
scene3: null, scene3: null,
scene4: null scene4: null
}, },
sceneActive: 1, sceneActive: 2,
scenePriceList: [{ scenePriceList: [{
total: 0 total: 0
}, { }, {
total: 1000.45 total: 0
}, { }, {
total: 0 total: 0
}, { }, {
total: 14580.45 total: 0
}], }],
// 活动内容 // 活动内容
scrollLeft: 0, scrollLeft: 0,
activityActive: 0, activityActive: 0,
activityList: [], activityList: [],
sceneActivityObj: { sceneActivityObj: {
scene1: [{ scene1: [],
name: '360实景导航', scene2: [],
price: 10 scene3: [],
}, { scene4: [],
name: 'AR实景导航', // [{
price: 20, // productName: '360实景导航',
isOpen: true // price: 10
}, { // }, {
name: 'AR实景导航', // productName: 'AR实景导航',
price: 20, // price: 20,
isOpen: true // openFlag: true
}, { // }, {
name: 'AR实景导航', // productName: 'AR实景导航',
price: 20, // price: 20,
isOpen: true // openFlag: true
}, { // }, {
name: 'AR实景导航', // productName: 'AR实景导航',
price: 20, // price: 20,
isOpen: false // openFlag: true
}, { // }, {
name: 'AR实景导航', // productName: 'AR实景导航',
price: 20, // price: 20,
isOpen: true // openFlag: false
}], // }, {
scene2: [{ // productName: 'AR实景导航',
name: '座椅通风', // price: 20,
price: 30, // openFlag: true
isOpen: true, // }],
toShopCount: 120, // scene2: [{
experienceCount: 200, // productName: '座椅通风',
upgradeCount: 300, // price: 30,
totalOrderMoney: 365 // openFlag: true,
}, { // toShopCount: 120,
name: '座椅通风', // experienceCount: 200,
price: 40 // upgradeCount: 300,
}], // totalOrderMoney: 365
scene3: [{ // }, {
name: '氛围灯', // productName: '座椅通风',
price: 50 // price: 40
}, { // }],
name: '氛围灯', // scene3: [{
price: 60, // productName: '氛围灯',
isOpen: true // price: 50
}], // }, {
scene4: [{ // productName: '氛围灯',
name: '数字化', // price: 60,
price: 70, // openFlag: true
isOpen: true // }],
}, { // scene4: [{
name: '数字化', // productName: '数字化',
price: 80 // price: 70,
}, { // openFlag: true
name: '数字化', // }, {
price: 70 // productName: '数字化',
}, { // price: 80
name: '数字化', // }, {
price: 80, // productName: '数字化',
isOpen: true // price: 70
}, { // }, {
name: '数字化', // productName: '数字化',
price: 70 // price: 80,
}, { // openFlag: true
name: '数字化', // }, {
price: 80, // productName: '数字化',
isOpen: true // price: 70
}, { // }, {
name: '数字化', // productName: '数字化',
price: 70 // price: 80,
}, { // openFlag: true
name: '数字化', // }, {
price: 80, // productName: '数字化',
isOpen: true // price: 70
}] // }, {
// productName: '数字化',
// price: 80,
// openFlag: true
// }]
}, },
// 产值 // 产值
searchForm: { searchForm: {
...@@ -123,6 +127,10 @@ Page({ ...@@ -123,6 +127,10 @@ Page({
sceneActive: idx, sceneActive: idx,
activityActive: 0 activityActive: 0
}) })
if (!this.data.sceneActivityObj['scene' + this.data.sceneActive].length) {
this.getNoOpenPro(this.data.sceneCodeList[this.data.sceneActive - 1])
return true
}
this.setCurActivity() this.setCurActivity()
// console.log('换内容---') // console.log('换内容---')
}, },
...@@ -165,8 +173,31 @@ Page({ ...@@ -165,8 +173,31 @@ Page({
}, },
handleJump(e) { handleJump(e) {
console.log(this.data.activityList[this.data.activityActive]) // console.log(this.data.activityList[this.data.activityActive])
wx.$router.go('packageOutput.openBusiness') var params = {
merchantInfo: this.data.merchantInfo,
sceneActive: this.data.sceneActive,
sceneCodeList: this.data.sceneCodeList
}
wx.$router.go('packageOutput.openBusiness', params)
},
getNoOpenPro(sceneCode) {
var params = {
serviceMerchantId: this.data.merchantInfo.pMerchantId,
merchant4sId: this.data.merchantInfo.merchantId,
sceneCode: sceneCode
}
outputApi.getNoOpenPro(params).then(res => {
this.setData({
['sceneActivityObj.scene' + this.data.sceneActive]: res
})
if ([2, 3].includes(+this.data.sceneActive)) {
this.getCustomerDetail()
} else {
this.setCurActivity()
}
})
}, },
dealSearchTime() { dealSearchTime() {
...@@ -190,10 +221,44 @@ Page({ ...@@ -190,10 +221,44 @@ Page({
return params return params
}, },
/** 1.1和1.2场景产品数据处理
* 调同一个接口,返回两个服务下面的全部产品的数据
*/
getCustomerDetail() { getCustomerDetail() {
var params = this.dealSearchTime() var params = this.dealSearchTime()
outputApi.getCustomerDetail({ merchantId: 44209390, ...params }).then(res => { outputApi.getCustomerDetail({ merchantId: this.data.merchantInfo.merchantId, ...params }).then(res => {
console.log(res) var actList = this.data.sceneActivityObj['scene' + this.data.sceneActive]
var actCodeList = actList.map(item => item.productCode)
console.log(actCodeList)
var curTotal = 0
var otherTotal = 0
var otherScene = this.data.sceneActive == 2 ? 3 : 2
res.forEach(item => {
var idx = actCodeList.findIndex(i => i == item.productCode)
if (idx != -1) {
var orderTotal = item.orderTotal
if (item.orderTotal) {
item.orderTotal.calCustomerUnitPrice = Math.round(orderTotal.totalSubOrderOrderMoney / orderTotal.upgradeCount).toFixed(0)
item.orderTotal.calExperience = Math.round((orderTotal.experienceCount * 100) / orderTotal.toShopCount).toFixed(0)
item.orderTotal.calTransform = Math.round((orderTotal.upgradeCount * 100) / orderTotal.experienceCount).toFixed(0)
}
actList[idx] = {
...actList[idx],
orderTotal: item.orderTotal
}
curTotal = curTotal + (item.orderTotal?.totalSubOrderOrderMoney || 0)
} else {
otherTotal = otherTotal + (item.orderTotal?.totalSubOrderOrderMoney || 0)
}
})
// 总金额
this.setData({
['sceneActivityObj.scene' + this.data.sceneActive]: actList,
['scenePriceList[' + (this.data.sceneActive - 1) + '].total']: curTotal,
['scenePriceList[' + (otherScene - 1) + '].total']: otherTotal
})
console.log(this.data.sceneActivityObj['scene' + this.data.sceneActive])
this.setCurActivity()
}) })
}, },
...@@ -202,13 +267,21 @@ Page({ ...@@ -202,13 +267,21 @@ Page({
*/ */
onLoad(options) { onLoad(options) {
wx.$router.getData(obj => { wx.$router.getData(obj => {
console.log(obj)
var scene = {}
Object.keys(this.data.sceneObj).forEach(item => {
scene[item] = obj[item]
})
this.setData({ this.setData({
merchantInfo: obj, merchantInfo: obj,
sceneObj: {} sceneObj: scene,
sceneCodeList: obj.sceneCodeList
}) })
this.getNoOpenPro(this.data.sceneCodeList[this.data.sceneActive - 1])
// this.getCustomerDetail()
// this.setCurActivity()
}) })
this.getCustomerDetail()
this.setCurActivity()
}, },
/** /**
......
<!--packageOutput/pages/summary/summary.wxml--> <!--packageOutput/pages/summary/summary.wxml-->
<view class="summary"> <view class="summary">
<view class="layout {{ (sceneActive == 4 && activityList[activityActive].isOpen) ? 'bg-grey' : 'bg-white'}}"> <view class="layout {{ (sceneActive == 4 && activityList[activityActive].openFlag) ? 'bg-grey' : 'bg-white'}}">
<view class="title bg-white">选产品/活动</view> <view class="title bg-white">选产品/活动</view>
<view class="scene-box bg-white"> <view class="scene-box bg-white">
<scene-box formData="{{sceneObj}}" scenePriceList="{{scenePriceList}}" sceneActive="{{sceneActive}}" bindhandleSceneChange="handleSceneChange"></scene-box> <scene-box formData="{{sceneObj}}" scenePriceList="{{scenePriceList}}" sceneActive="{{sceneActive}}" bindhandleSceneChange="handleSceneChange"></scene-box>
...@@ -9,13 +9,13 @@ ...@@ -9,13 +9,13 @@
<view class="p-rl-20 bg-white"> <view class="p-rl-20 bg-white">
<scroll-view scroll-x="{{true}}" class="activity-box" scroll-left="{{scrollLeft}}"> <scroll-view scroll-x="{{true}}" class="activity-box" scroll-left="{{scrollLeft}}">
<view class="flex"> <view class="flex">
<view class="activity-item {{ activityActive == index ? 'active' : ''}} {{item.isOpen ? 'open' : 'no-open'}}" wx:for="{{activityList}}" wx:key="index" bindtap="handleActChange" data-idx="{{index}}">{{item.name}}</view> <view class="activity-item {{ activityActive == index ? 'active' : ''}} {{item.openFlag ? 'open' : 'no-open'}}" wx:for="{{activityList}}" wx:key="index" bindtap="handleActChange" data-idx="{{index}}">{{item.productName}}</view>
</view> </view>
</scroll-view> </scroll-view>
</view> </view>
<!-- 活动内容 --> <!-- 活动内容 -->
<view class="activity-content"> <view class="activity-content">
<view wx:if="{{activityList[activityActive].isOpen && sceneActive != 1}}"> <view wx:if="{{activityList[activityActive].openFlag && sceneActive != 1}}">
<view class="activity-title title bg-white {{ sceneActive == 4 ? 'no-border' : ''}}"> <view class="activity-title title bg-white {{ sceneActive == 4 ? 'no-border' : ''}}">
<view>看产值</view> <view>看产值</view>
<view class="select" bindtap="handleSearch"> <view class="select" bindtap="handleSearch">
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<image class="icon-arrow" src="{{IMGURL}}output/arrow.png?v={{img_version}}"></image> <image class="icon-arrow" src="{{IMGURL}}output/arrow.png?v={{img_version}}"></image>
</view> </view>
</view> </view>
<output-transform wx:if="{{sceneActive == 2 || sceneActive == 3}}" formData="{{activityList[activityActive]}}"></output-transform> <output-transform wx:if="{{sceneActive == 2 || sceneActive == 3}}" formData="{{activityList[activityActive].orderTotal}}"></output-transform>
<output-crowdfund wx:if="{{sceneActive == 4}}"></output-crowdfund> <output-crowdfund wx:if="{{sceneActive == 4}}"></output-crowdfund>
</view> </view>
<view wx:else class="content-empty bg-white"> <view wx:else class="content-empty bg-white">
...@@ -32,5 +32,5 @@ ...@@ -32,5 +32,5 @@
</view> </view>
</view> </view>
</view> </view>
<view wx:if="{{!activityList[activityActive].isOpen}}" class="btn-blue" bindtap="handleJump">点击开通</view> <view wx:if="{{!activityList[activityActive].openFlag}}" class="btn-blue" bindtap="handleJump">点击开通</view>
</view> </view>
\ No newline at end of file \ No newline at end of file
// pages/checkProduct/checkProduct.js // pages/checkProduct/checkProduct.js
// const navStyle = "background-color: transparent;"; // const navStyle = "background-color: transparent;";
import {
IMG_URL
} from "~/utils/constantData.js";
const navStyle = "background-color: #fff"; const navStyle = "background-color: #fff";
import {
senceData
} from "~/pages/tab/index/constant/data";
import {
reportData
} from '~/api/index.js'
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
navStyle, navStyle,
headerHeight:0, headerHeight: 0,
senceData,
// 模态框
isShow: true,
}, },
// navbar高度设置 // navbar高度设置
navbarReady(e) { navbarReady(e) {
let { height, statusBarHeight } = e.detail; let {
height,
statusBarHeight
} = e.detail;
this.setData({ this.setData({
headerHeight: height / 2 + statusBarHeight, headerHeight: height / 2 + statusBarHeight,
// headerHeight: height / 2 + statusBarHeight,
// headerHeight: height / 2 + statusBarHeight + 88 * 2, // headerHeight: height / 2 + statusBarHeight + 88 * 2,
}); });
// console.log(e) // console.log(e)
// console.log(this.data.headerHeight) // console.log(this.data.headerHeight)
}, },
// 分项弹框关闭
modelcloseFn(e) {
this.setData({
isShow: e.detail,
});
},
// 分享按钮
sharehandle() {
this.setData({
isShow: true,
});
},
//接受跳转的路由参数
onRoute(options) {
// console.log("options: ", options);
//选中场景的index,和产品的index
let {
actNum,
activeNavIdx
} = options
this.setData({
actNum,
activeNavIdx
})
},
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
console.log(options)
if (options.shareOpenId) {
const WXUSERINFO = wx.$storage.get('wx_user_info'),
USERINFO = wx.$storage.get('userInfo')
reportData({
openId: WXUSERINFO.openId || '',
unionId: WXUSERINFO.unionId || '',
nickName: WXUSERINFO.nickName || '',
avatar: WXUSERINFO.avatarUrl || '',
phone: USERINFO.phone || '',
merchantId: options.merchantId || '',
shareOpenId: options.shareOpenId || '',
sharePhone: options.sharePhone || '',
productCode: options.productCode || '',
productDesc: options.productDesc || ''
}, 1)
// 禁用分享功能
wx.hideShareMenu()
}
// actNum,activeNavIdx isShare
}, },
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
onReady() { onReady() {},
},
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow() { onShow(options) {},
},
/** /**
* 生命周期函数--监听页面隐藏 * 生命周期函数--监听页面隐藏
*/ */
onHide() { onHide() {},
},
/** /**
* 生命周期函数--监听页面卸载 * 生命周期函数--监听页面卸载
*/ */
onUnload() { onUnload() {},
},
/** /**
* 页面相关事件处理函数--监听用户下拉动作 * 页面相关事件处理函数--监听用户下拉动作
*/ */
onPullDownRefresh() { onPullDownRefresh() {},
},
/** /**
* 页面上拉触底事件的处理函数 * 页面上拉触底事件的处理函数
*/ */
onReachBottom() { onReachBottom() {},
},
/** /**
* 用户点击右上角分享 * 用户点击右上角分享
*/ */
onShareAppMessage() {
}
})
\ No newline at end of file \ No newline at end of file
onShareAppMessage() {},
});
\ No newline at end of file \ No newline at end of file
{ {
"usingComponents": { "usingComponents": {
"product": "../tab/index/components/product/product" "product": "../tab/index/components/product/product",
"shareModel":"../tab/index/components/shareModel/shareModel"
}, },
"navigationStyle": "custom", "navigationStyle": "custom",
"onReachBottomDistance": 10, "onReachBottomDistance": 10,
......
<!--pages/checkProduct/checkProduct.wxml--> <!--pages/checkProduct/checkProduct.wxml-->
<navigation-bar bindnavbarReady="navbarReady" navStyle="{{navStyle}}">特色产品</navigation-bar> <navigation-bar showBack="{{true}}" bindnavbarReady="navbarReady" navStyle="{{navStyle}}">特色产品</navigation-bar>
<view style="height:{{headerHeight}}px"> <view style="height:{{headerHeight}}px">
</view> </view>
<product stickyTop="{{headerHeight}}" actNum="{{actNum}}" /> <product stickyTop="{{headerHeight}}" actNum="{{actNum}}" senceData="{{senceData}}" isShare="{{true}}"/>
<!-- 分享弹框 -->
<shareModel actNum="{{actNum}}" isShow="{{isShow}}" bindmodelclose="modelcloseFn" />
// pages/tab/index/components/chat/chat.js
import { IMG_URL } from "~/utils/constantData.js";
Component({
/**
* 组件的属性列表
*/
properties: {},
/**
* 组件的初始数据
*/
data: {
kfUrl: "",
widgetStatus: false,
IMG_URL,
img_version: Date.now(),
},
/**
* 组件的方法列表
*/
methods: {
openKF(e) {
let { kfUrl, widgetStatus } = this.data;
if (kfUrl)
wx.pro.openCustomerServiceChat({
extInfo: {
url: kfUrl,
},
corpId: "ww6fe4fbe0d050a2b5",
success(res) {
console.log(res);
},
fail({ errMsg }) {
console.log(errMsg);
wx.$util.showToast(errMsg);
},
});
else
this.setData({
widgetStatus: !widgetStatus,
});
},
},
});
/* pages/tab/index/components/chat/chat.wxss */
.widget-box {
position: fixed;
right: 40rpx;
bottom: 232rpx;
font-size: 20rpx;
color: #fff;
display: flex;
align-items: flex-end;
}
.widget {
height: 140rpx;
width: 112rpx;
box-sizing: border-box;
}
.widget-box .open {
position: relative;
z-index: 2;
}
.online-text {
position: absolute;
top: 74rpx;
left: 50%;
transform: translateX(-50%);
width: 80rpx;
height: 28rpx;
font-size: 20rpx;
}
\ No newline at end of file \ No newline at end of file
<!--pages/tab/index/components/chat/chat.wxml-->
<!-- wx:if="{{widgetStatus}}" -->
<view class="model" catchtouchmove="noScroll">
<view class="close-icon" bindtap="showFlex">
<image webp src="{{IMG_URL}}index/kf-close.png?v={{img_version}}"></image>
</view>
<view class="bgkf">
<image webp src="{{IMG_URL}}index/kfbg.png?v={{img_version}}"></image>
<view class="qr-box">
<view class="qr-icon">
<image webp src="{{IMG_URL}}index/qr-bg.png?v={{img_version}}"></image>
</view>
<view class="userinfo-wrap">
<view class="icon">
<image webp src="https://img02.glsx.com.cn/weapp/resource/miniprogram/cgacar/index/user.png"></image>
</view>
<view class="name">hello</view>
<view class="qr-code">
<image webp src="https://img02.glsx.com.cn/weapp/resource/miniprogram/cgacar/index/qr.png" show-menu-by-longpress="{{customerlist[0].qrCode}}"></image>
</view>
</view>
<view class="kf-text">
<image webp src="{{IMG_URL}}index/kf-text.png?v={{img_version}}"></image>
</view>
</view>
</view>
</view>
\ No newline at end of file \ No newline at end of file
// pages/tab/discovery/components/product/product.js // pages/tab/discovery/components/product/product.js
// import {imgUrlMixin} from '~/mixins/index' // import {imgUrlMixin} from '~/mixins/index'
import { IMG_URL } from "~/utils/constantData.js"; import { IMG_URL } from "~/utils/constantData.js";
const videoBaseUrl =
"https://img02.glsx.com.cn/weapp/resource/miniprogram/ai-card/";
Component({ Component({
// behaviors: [imgUrlMixin], // behaviors: [imgUrlMixin],
...@@ -10,7 +12,11 @@ Component({ ...@@ -10,7 +12,11 @@ Component({
properties: { properties: {
stickyTop: Number, stickyTop: Number,
actNum: Number, actNum: Number,
senceData:Object, senceData: Object,
isShare:{
type: Boolean,
value: false
}
}, },
/** /**
...@@ -32,11 +38,17 @@ Component({ ...@@ -32,11 +38,17 @@ Component({
curTabIdx: 0, curTabIdx: 0,
intoViewId: "to-0", intoViewId: "to-0",
IMGURL: `${IMG_URL}index/`, IMGURL: `${IMG_URL}index/`,
videoBaseUrl,
}, },
lifetimes: { lifetimes: {
ready: function () { ready: function () {
// console.log(11111) // console.log('stickyTop',this.data.stickyTop)
this.getImgHeight(); this.getImgHeight();
//如果不是分享,初始化的时候调用函数
if(!this.data.isShare){
// console.log(131546)
this.getMoreFn()
}
}, },
}, },
observers: { observers: {
...@@ -80,6 +92,7 @@ Component({ ...@@ -80,6 +92,7 @@ Component({
}); });
// 每次切换场景,重新获取流程图高度 // 每次切换场景,重新获取流程图高度
this.getImgHeight(); this.getImgHeight();
this.getMoreFn()
}, },
}, },
...@@ -87,9 +100,7 @@ Component({ ...@@ -87,9 +100,7 @@ Component({
* 组件的方法列表 * 组件的方法列表
*/ */
methods: { methods: {
saleTextChange(e){ saleTextChange(e) {},
},
changeTab(e) { changeTab(e) {
let idx = e.detail; let idx = e.detail;
this.setData({ this.setData({
...@@ -131,9 +142,8 @@ Component({ ...@@ -131,9 +142,8 @@ Component({
// 图片流程5 点击往下获取更多 // 图片流程5 点击往下获取更多
// 没登陆用户(登陆后解锁全部) // 没登陆用户(登陆后解锁全部)
getMoreFn(e) { getMoreFn(e) {
let { actNum } = this.data; let { actNum } = this.data;
console.log('inactNumdex: ', actNum); // console.log("inactNumdex: ", actNum);
let tab = [ let tab = [
"场景说明", "场景说明",
"营销链路", "营销链路",
...@@ -142,6 +152,7 @@ Component({ ...@@ -142,6 +152,7 @@ Component({
"合作流程", "合作流程",
// "合作案例", // "合作案例",
]; ];
switch (actNum) { switch (actNum) {
case 0: case 0:
tab.push("合作案例"); tab.push("合作案例");
...@@ -159,5 +170,11 @@ Component({ ...@@ -159,5 +170,11 @@ Component({
tab, tab,
}); });
}, },
onShareFn() {
// this.triggerEvent('sharehandle')
// wx.$router.go('apply',1235)
let { actNum, activeNavIdx } = this.data;
wx.$router.go("checkProduct", { actNum, activeNavIdx});
},
}, },
}); });
...@@ -146,7 +146,7 @@ ...@@ -146,7 +146,7 @@
} }
.project-img { .project-img {
height: 1200rpx; height: 1600rpx;
white-space: nowrap; white-space: nowrap;
.img-item { .img-item {
position: relative; position: relative;
...@@ -232,8 +232,14 @@ ...@@ -232,8 +232,14 @@
height: 490rpx; height: 490rpx;
} }
.img-item26 { .img-item26 {
width: 100%;
height: 752rpx; height: 752rpx;
.video-item{
width: 100%;
video{
border-radius: 16rpx;
height: 348rpx;
}
}
} }
// 流程图三 // 流程图三
...@@ -286,3 +292,64 @@ ...@@ -286,3 +292,64 @@
width: 100%; width: 100%;
height: 1666rpx; height: 1666rpx;
} }
/* 案例视频 */
.video-bg {
width: 100%;
position: absolute;
top: 280rpx;
}
.video-title {
position: relative;
padding: 96rpx 0 24rpx;
text-align: center;
font-size: 48rpx;
font-weight: 900;
color: #FFFFFF;
letter-spacing: 0;
line-height: 64rpx;
}
.video-title::after {
content: '';
display: block;
width: 48rpx;
height: 4rpx;
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
background-color: #ffffff;
}
.video-list {
display: flex;
flex-wrap: wrap;
padding: 0 32rpx;
font-size: 0;
}
.video-item {
width: calc(50% - 12rpx);
margin-bottom: 32rpx;
}
.video-item video {
width: 100%;
height: 588rpx;
border: 1rpx dashed #AFB0B2;
}
.video-item:nth-child(even) {
margin-left: 22rpx;
}
.video-text {
margin-top: 16rpx;
font-size: 24rpx;
font-weight: 500;
font-size: 24rpx;
color: #343456;
}
.video-tips {
width: 100%;
text-align: center;
font-size: 28rpx;
color: rgba(255,255,255,.6);
padding: 16rpx 0 92rpx;
}
\ No newline at end of file \ No newline at end of file
<!--pages/tab/discovery/components/product/product.wxml--> <!-- pages/tab/discovery/components/product/product.wxml -->
<view class="prod-wrap"> <view class="prod-wrap">
<text class="big-title">特色产品</text> <text class="big-title">特色产品</text>
<scroll-view class="nav-wrap" scroll-x="{{true}}"> <scroll-view class="nav-wrap" scroll-x="{{true}}" wx:if="{{!isShare}}">
<block wx:for="{{navList}}" wx:key="index"> <block wx:for="{{navList}}" wx:key="index">
<text class='nav {{activeNavIdx==index ? "active-nav": ""}}' bindtap="changeNav" data-index="{{index}}">{{item}}</text> <text class='nav {{activeNavIdx==index ? "active-nav": ""}}' bindtap="changeNav" data-index="{{index}}">{{item}}</text>
</block> </block>
...@@ -9,19 +9,18 @@ ...@@ -9,19 +9,18 @@
<view class="prod-item"> <view class="prod-item">
<view class="prod-card"> <view class="prod-card">
<view class="card-img"> <view class="card-img">
<text class="img-desc">轻改类</text> <!-- <text class="img-desc">轻改类</text>
<image src="{{IMGURL}}discovery_prod1.png" /> <image src="{{IMGURL}}discovery_prod1.png" /> -->
<image src="{{IMGURL}}prod/{{senceData[actNum].productList[activeNavIdx].img}}.png" />
</view> </view>
<view class="prod-info"> <view class="prod-info">
<text class="title">360全景导航</text> <text class="title">{{senceData[actNum].productList[activeNavIdx].proName}}</text>
<text class="sale">新车销量 <text class="sale-num">{{senceData[actNum]['productList'][activeNavIdx].changeSale || senceData[actNum]['productList'][activeNavIdx].sale}}</text> <text class="sale" decode="{{true}}">{{senceData[actNum]['productList'][activeNavIdx].varType == 1 ? '三年售后存量数':'新车销量'}}&nbsp;<text class="sale-num">{{senceData[actNum]['productList'][activeNavIdx].changeSale || senceData[actNum]['productList'][activeNavIdx].sale}}</text>
</text> </text>
<text class="earnings">预估收益 <text class="earnings-num">{{senceData[actNum]['productList'][activeNavIdx].profit}}</text> <text class="earnings" decode="{{true}}">{{stickyTop}}预估收益&nbsp;<text class="earnings-num">{{senceData[actNum]['productList'][activeNavIdx].profit}}</text>
</text> </text>
</view> </view>
<view class="share-btn" wx:if="{{!isShare}}" bindtap="onShareFn">
<view class="share-btn">
<image class="icon" src="{{IMGURL}}share.png" /> <image class="icon" src="{{IMGURL}}share.png" />
<text>分享</text> <text>分享</text>
</view> </view>
...@@ -30,7 +29,7 @@ ...@@ -30,7 +29,7 @@
</view> </view>
<view class="project-wrap"> <view class="project-wrap">
<!-- --> <!-- -->
<view class="stickyTab" style="top:{{stickyTop}}rpx"> <view class="stickyTab" style="top:{{isShare ? stickyTop+88 : stickyTop}}rpx">
<tab <tab
outClassName="project-tab" outClassName="project-tab"
openScroll="{{true}}" openScroll="{{true}}"
...@@ -50,7 +49,26 @@ ...@@ -50,7 +49,26 @@
<view id="to-{{index}}" class="img-item img-item{{actNum+1}}{{index+1}}"> <view id="to-{{index}}" class="img-item img-item{{actNum+1}}{{index+1}}">
<!-- {{item}} --> <!-- {{item}} -->
<image class="img-item{{actNum+1}}{{index+1}}" src="{{IMGURL}}scene{{actNum+1}}{{index+1}}.png" /> <image class="img-item{{actNum+1}}{{index+1}}" src="{{IMGURL}}scene{{actNum+1}}{{index+1}}.png" />
<button wx:if="{{ actNum != 2 && index == 4}}" class="more-btn" data-index="{{index}}" bindtap="getMoreFn">点击查看更多详情</button> <view class="video-bg" wx:if="{{index==5 && senceData[actNum].videoList.length}}">
<view class="video-list">
<block wx:for="{{senceData[actNum].videoList}}" wx:key="i">
<view class="video-item">
<video poster="{{videoBaseUrl}}video/{{item.posterUrl}}.png?v={{img_version}}" title="{{item.name}}" src="{{videoBaseUrl}}video/{{item.videoUrl}}.mp4?v={{img_version}}" />
<view class="video-text">{{item.name}}</view>
</view>
</block>
<!-- <view class="video-tips">- 如需开通请咨询客服 -</view> -->
</view>
</view>
<!-- wx:if="{{ actNum != 2 && index == 4}}" -->
<button
wx:if="{{isShare && actNum != 2 && index == 4}}"
class="more-btn"
data-index="{{index}}"
bindtap="getMoreFn"
>
点击查看更多详情
</button>
</view> </view>
</block> </block>
</scroll-view> </scroll-view>
......
// pages/tab/index/components/shareModel/shareModel.js
import { IMG_URL } from "~/utils/constantData.js";
import Draw from "~/utils/Draw.js";
Component({
/**
* 组件的属性列表
*/
properties: {
actNum: Number, //场景选择
isShow: Boolean,
// //分享方法
// onShareAppMessage:Function,
// onShareTimeline:Function,
},
/**
* 组件的初始数据
*/
data: {
IMG_URL: `${IMG_URL}index`,
btnList: [
{
src: `${IMG_URL}index/wechat.png`,
name: "微信转发",
},
// {
// src: `${IMG_URL}index/moments.png`,
// name: "朋友圈分享",
// },
{
src: `${IMG_URL}index/down.png`,
name: "下载为海报",
},
],
// 4种场景下图片所有的高 (单位 rpx)
imgHeightArr: [
[1110, 1290, 596, 744, 490, 1532],
[2168, 1290, 596, 830, 490, 752],
[1110, 1290, 596, 984, 490],
[678, 1266, 1398, 830, 490, 1666],
],
posterUrl: "", //海报url
noVideoimgList:[]
// imgList:[
// {
// src:`${IMG_URL}index/scene${actNum}1.png`,
// },
// ]
},
observers: {
actNum: function (actNum) {
let imgList = [
`${IMG_URL}index/scene${actNum + 1}1.png`,
`${IMG_URL}index/scene${actNum + 1}2.png`,
`${IMG_URL}index/scene${actNum + 1}3.png`,
`${IMG_URL}index/scene${actNum + 1}4.png`,
`${IMG_URL}index/scene${actNum + 1}5.png`,
];
this.setData({
noVideoimgList:imgList
});
if (actNum != 2) {
imgList.push(`${IMG_URL}index/scene${actNum + 1}6.png`);
}
this.setData({
imgList,
});
},
},
/**
* 组件的方法列表
*/
methods: {
// 分享按钮
handleClick(e) {
let { index } = e.currentTarget.dataset;
switch (index) {
case 0:
this.wechatFn();
break;
case 1:
this.download();
break;
}
},
// 微信转发
wechatFn() {
// this.data.onShareAppMessage()
this.modelClose();
},
// 下载海报
async download() {
let { actNum, imgHeightArr } = this.data;
//所有的长度
let imgAllHeight = imgHeightArr[actNum].reduce((total, current) => {
return total + current;
});
// 缺少视频的长度(前4张)+二维码的长度 (单位rpx)
let erCodeHeight =
imgHeightArr[actNum].slice(0, 4).reduce((total, current) => {
return total + current;
}) +
98 * 2;
// console.log("imgAllHeight: ", imgAllHeight);
let drawFun = new Draw({
width: 750,
height: imgAllHeight,
});
let imgList = [
{
x: 0,
y: 0,
width: 750,
height: imgAllHeight,
url: `https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/index/longpic${
actNum + 1
}.png`,
},
{
x: 245*2,
y: erCodeHeight-11,
width: 120*2,
height: 120*2,
url: `https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/index/discovery_prod1.png`, //二维码
},
];
let posterUrl = await drawFun.begin({
imageList: imgList,
});
this.setData({
posterUrl: posterUrl.path,
});
console.log('posterUrl.path',posterUrl.path)
if(this.data.posterUrl){
wx.pro.downloadFile({
url: this.data.posterUrl, //仅为示例,并非真实的资源
success (res) {
console.log('res: ', res);
}
})
}
this.modelClose();
},
//模态框关闭
modelClose() {
this.triggerEvent("modelclose", false);
},
// 图片加载事件
onloadFn(event) {
// console.log('event.detail',event.detail)
this.setData({
imgHeight: (event.detail.height * 0.2).toFixed(0),
});
},
},
});
/* pages/tab/index/components/shareModel/shareModel.wxss */
.share-wrap {
position: fixed;
top: 0;
left: 0;
bottom: 0;
right: 0;
background: rgba(0, 0, 0, 0.5);
z-index: 1;
.img-wrap {
position: absolute;
top: 20%;
left: 50%;
transform: translateX(-50%);
// width: 225px;
width: 60%;
height: 311px;
// background-color: red;
overflow: auto;
.img {
width: 100%;
// height: auto;
// height: 60%;
background-color: #fff;
}
}
.btns {
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 154px;
background: #ffffff;
border-radius: 8px 8px 0 0;
.top {
display: flex;
justify-content: space-around;
.btn {
padding-top: 16px;
}
.img {
display: block;
margin: 0 auto 8px;
width: 40px;
height: 40px;
}
.name {
font-size: 12px;
color: #323436;
text-align: center;
}
.btn-wechat{
width: auto;
margin: 0;
padding: 0;
background-color: #fff;
}
}
.btom {
margin: 18px auto 0;
width: 343px;
height: 44px;
line-height: 44px;
border: 1px solid #eeeeee;
border-radius: 4px;
text-align: center;
}
}
}
<!-- pages/tab/index/components/shareModel/shareModel.wxml -->
<view class="share-wrap" wx:if="{{isShow}}">
<view class="img-wrap">
<!-- <image class="img" style="height:{{imgHeight}}px" src="{{IMG_URL}}/longpic{{actNum+1}}.png" bindload="onloadFn" /> -->
<block wx:for="{{imgList}}" wx:key="*this">
<image mode="widthFix" class="img" src="{{item}}"/>
</block>
</view>
<button></button>
<view class="btns">
<view class="top">
<view class="btn" wx:for="{{btnList}}" wx:key="name" bindtap="handleClick" data-index="{{index}}">
<block wx:if="{{index == 0}}">
<button open-type="share" class="btn-wechat">
<image class="img" src="{{item.src}}" />
<view class="name">{{item.name}}</view>
</button>
</block>
<block wx:else>
<image class="img" src="{{item.src}}" />
<view class="name">{{item.name}}</view>
</block>
</view>
</view>
<view class="btom" bindtap="modelClose">取消</view>
</view>
</view>
\ No newline at end of file \ No newline at end of file
const navStyle = "background-color: transparent;"; const navStyle = "background-color: transparent;";
import { IMG_URL } from "~/utils/constantData.js"; import { IMG_URL } from "~/utils/constantData.js";
import pageData from "./constant/data"; import { senceData } from "./constant/data";
// `${IMG_URL}index/car2.png`, // `${IMG_URL}index/car2.png`,
//本地图片路径 //本地图片路径
let IMG_URLLocal = "../../../images/"; let IMG_URLLocal = "../../../images/";
import { productBysceneApi,unreadApi,pageApi,readApi,tagApi } from "~/api/index.js";
Page({ Page({
// behaviors: [kfMixin], // behaviors: [kfMixin],
...@@ -40,7 +41,8 @@ Page({ ...@@ -40,7 +41,8 @@ Page({
msg: "1.3 存量用户众筹", msg: "1.3 存量用户众筹",
}, },
], ],
actNum: 0, apiData: [],
actNum: 0, //car 场景选择
tabIndx: 1, tabIndx: 1,
navList: ["看线索", "看产品"], navList: ["看线索", "看产品"],
typeList: ["联系电话", "意向客户", "线索来源", "重置"], typeList: ["联系电话", "意向客户", "线索来源", "重置"],
...@@ -96,7 +98,7 @@ Page({ ...@@ -96,7 +98,7 @@ Page({
], ],
phone: 15718122929, phone: 15718122929,
isOpen: false, isOpen: false,
getMoreFlag: true, getMoreFlag: false,
}, },
{ {
source: "customer", source: "customer",
...@@ -145,7 +147,6 @@ Page({ ...@@ -145,7 +147,6 @@ Page({
isOpen: true, isOpen: true,
}, },
], ],
filterType: "", //看线索过滤类型
// 预估弹框 // 预估弹框
visible: false, visible: false,
isReset: false, isReset: false,
...@@ -160,8 +161,12 @@ Page({ ...@@ -160,8 +161,12 @@ Page({
isFirst: true, isFirst: true,
// tabList: pageData.tabList, // tabList: pageData.tabList,
// 定义数据 // 定义数据
senceData: pageData.senceData, senceData,
changeSale: 0, //每次改变的销量 isShow: false,
// 看线索部分
unreadClueCount: 0,
cluePageSize:10,
clueCurrentPage: 1
}, },
//引导图 //引导图
...@@ -197,6 +202,7 @@ Page({ ...@@ -197,6 +202,7 @@ Page({
// 选车场景切换 // 选车场景切换
selectCar(e) { selectCar(e) {
let actNum = e.currentTarget.dataset.num; let actNum = e.currentTarget.dataset.num;
// console.log('actNum: ', actNum);
this.setData({ this.setData({
actNum, actNum,
}); });
...@@ -204,9 +210,21 @@ Page({ ...@@ -204,9 +210,21 @@ Page({
// 头部看线索,产品切换 // 头部看线索,产品切换
changeTabIndx(e) { changeTabIndx(e) {
console.log("e.detail: ", e.detail); console.log("e.detail: ", e.detail);
let { sessionId } = wx.$storage.get();
// console.log("sessionId: ", sessionId);
let param = {
sessionId,
};
let first = true
this.setData({ this.setData({
tabIndx: e.detail, tabIndx: e.detail,
}); });
//标记线索已读
if(e.detail == 0 && first ){
first = false
readApi(param)
}
}, },
gotoApply() { gotoApply() {
// wx.$router.go('apply',1235) // wx.$router.go('apply',1235)
...@@ -293,16 +311,13 @@ Page({ ...@@ -293,16 +311,13 @@ Page({
this.data.senceData.forEach((item, index) => { this.data.senceData.forEach((item, index) => {
item.productList.forEach((i, lastIndex) => { item.productList.forEach((i, lastIndex) => {
if (i.profit) { if (i.profit) {
// let name = `senceData[${index}].productList[${lastIndex}].profit`;
let sale = `senceData[${index}].productList[${lastIndex}].sale`; let sale = `senceData[${index}].productList[${lastIndex}].sale`;
let name = `senceData[${index}].productList[${lastIndex}].profit`; let name = `senceData[${index}].productList[${lastIndex}].profit`;
// let changeSale = `senceData[${index}].productList[${lastIndex}].changeSale`;
let profit = _this.formula(i.productType, sales, flow); let profit = _this.formula(i.productType, sales, flow);
console.log(name, profit); console.log(name, profit);
this.setData({ this.setData({
[name]: profit, [name]: profit,
[sale]:sales [sale]: sales,
// [changeSale]: sales,
}); });
} }
}); });
...@@ -384,7 +399,7 @@ Page({ ...@@ -384,7 +399,7 @@ Page({
} }
console.log(profit.length); console.log(profit.length);
console.log(productType, sales, flow, profit); console.log(productType, sales, flow, profit);
if (profit.length > 6) { if (profit.length > 8) {
return (profit / 10000).toFixed(0) + "万"; return (profit / 10000).toFixed(0) + "万";
} else { } else {
return profit; return profit;
...@@ -405,11 +420,63 @@ Page({ ...@@ -405,11 +420,63 @@ Page({
}); });
return false; return false;
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) {}, onLoad: function (options) {
// console.log('options: ', options);
let { sessionId } = wx.$storage.get();
// console.log("sessionId: ", sessionId);
let param = {
sessionId,
};
// 看产品
productBysceneApi(param).then((res) => {
let { code, data } = res;
if (code == 0) {
this.setData({
apiData: data,
});
this.compositionData(senceData,this.data.apiData)
this.getFirstSenceIndex()
}
});
// 看线索
this.getClueInit()
},
//接口数据,本地数据对接
compositionData(localData, apiData) {
localData.forEach((item, index) => {
apiData.forEach((inner,idx)=>{
if(item.name == inner.stage){
item.sceneStatus = inner.sceneStatus
item.productList.forEach((outChild,outIndex)=>{
inner.productList.forEach((innerChild,innerIndex)=>{
if(outChild.proName == innerChild.productName){
outChild.productStatus = innerChild.productStatus
}
})
})
}
})
})
// console.log('localData, apiData: ', localData);
this.setData({
senceData:localData
})
},
getFirstSenceIndex(param){
let actTndex = this.data.apiData.findIndex(item =>item.sceneStatus == 1)
// console.log('actTndex: ', actTndex);
this.setData({
actNum:actTndex
})
},
// 看线索相关
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
...@@ -417,9 +484,10 @@ Page({ ...@@ -417,9 +484,10 @@ Page({
this.prompt = this.selectComponent("#toast"); this.prompt = this.selectComponent("#toast");
}, },
showToast: function (e) { showToast: function (e) {
let type = e.currentTarget.dataset.type; let {type,item} = e.currentTarget.dataset;
console.log('type,item: ', type,item);
let tipObj = {}; let tipObj = {};
if (type == "like") { if (item.starTag == 1) {
tipObj = { tipObj = {
type: "fail", type: "fail",
title: "取消标记为意向客户", title: "取消标记为意向客户",
...@@ -446,32 +514,63 @@ Page({ ...@@ -446,32 +514,63 @@ Page({
this.setData({ this.setData({
[completeStatus]: !this.data.clueList[index].like, [completeStatus]: !this.data.clueList[index].like,
}); });
//发请求
let { sessionId } = wx.$storage.get();
let params = {
clueId:item.clueId,
sessionId
}
this.getTagApi(params)
}, },
filterTypeFn(e) { filterTypeFn(e) {
let index = e.currentTarget.dataset.index; let index = e.currentTarget.dataset.index;
let itemList = []; let itemList = [];
// console.log("index: ", typeof index); let params = {
clueSource:'',
hasPhone:'',
starTag:''
}
console.log("index: ", index);
switch (index) { switch (index) {
case 0: case 0:
itemList = ["有", "无"]; itemList = ["无","有"];
break; break;
case 1: case 1:
itemList = ["是", "否"]; itemList = ["否","是"];
break; break;
case 2: case 2:
itemList = ["访客", "门店"]; itemList = ["访客", "门店"]; //线索来源(1访客,2门店)
break; break;
case 3: case 3:
console.log("重置"); params = {
return; clueSource:'',
hasPhone:'',
starTag:''
} }
this.setData({ break;
filterType: "", }
}); let _this = this;
wx.pro.showActionSheet({ wx.pro.showActionSheet({
itemList, itemList,
success(res) { success(res) {
console.log(res.tapIndex); let num
if(index == 2){
num = res.tapIndex+1
}else{
num = res.tapIndex
}
switch (index) {
case 0:
params.hasPhone = num
break;
case 1:
params.starTag = num
break;
case 2:
params.clueSource = num
break;
}
_this.getPageApi(params)
}, },
fail(res) { fail(res) {
console.log(res.errMsg); console.log(res.errMsg);
...@@ -480,6 +579,10 @@ Page({ ...@@ -480,6 +579,10 @@ Page({
console.log("res: ", res); console.log("res: ", res);
}, },
}); });
if(index == 3){
this.getPageApi(params)
}
}, },
// 打电话 // 打电话
phoneCallFn(e) { phoneCallFn(e) {
...@@ -492,6 +595,49 @@ Page({ ...@@ -492,6 +595,49 @@ Page({
let { phone } = e.currentTarget.dataset; let { phone } = e.currentTarget.dataset;
wx.$api.setCopyData(phone); wx.$api.setCopyData(phone);
}, },
getClueInit(param){
this.getUnreadApi(param)
this.getPageApi(param)
},
//未读消息
async getUnreadApi(param){
let {code,data} = await unreadApi(param)
if(code == 0){
this.setData({
unreadClueCount:data.unreadClueCount
})
}
},
//获取浏览线索数据列表
async getPageApi(param){
let {cluePageSize,clueCurrentPage} = this.data
let params = {
...param,
pageSize:1000,
currentPage:clueCurrentPage
}
let {code,data} = await pageApi(params)
if(code == 0){
let arr = data.list.map(item=>{
if(item.visitList.length >5){
item.getMoreFlag = true
}
return item
})
this.setData({
clueList: arr
})
}
},
//喜欢收藏功能
async getTagApi(param){
let res = await tagApi(param)
console.log('res: ', res);
this.getPageApi(param)
},
onReachBottom(){
console.log("滑到底部了")
},
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
...@@ -524,4 +670,5 @@ Page({ ...@@ -524,4 +670,5 @@ Page({
* 用户点击右上角分享 * 用户点击右上角分享
*/ */
onShareAppMessage: function () {}, onShareAppMessage: function () {},
onShareTimeline: function () {},
}); });
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
"usingComponents": { "usingComponents": {
"product": "./components/product/product", "product": "./components/product/product",
"vas-toast": "./components/likeToast/likeToast", "vas-toast": "./components/likeToast/likeToast",
"chat":"./components/chat/chat" "shareModel": "./components/shareModel/shareModel"
}, },
"navigationStyle": "custom" "navigationStyle": "custom",
"onReachBottomDistance":50
} }
...@@ -237,13 +237,13 @@ page { ...@@ -237,13 +237,13 @@ page {
.scene { .scene {
margin: 0 10px 16px; margin: 0 10px 16px;
display: flex; display: flex;
justify-content: space-between; // justify-content: space-between;
.item-wrap { .item-wrap {
margin-right: 4px;
position: relative; position: relative;
width: 86px; width: 86px;
height: 90px; height: 90px;
border-radius:10px; border-radius:10px;
} }
.item { .item {
// padding-top: 10px; // padding-top: 10px;
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<!-- 头部 --> <!-- 头部 -->
<view class="header-wrap" style="height:{{headerHeight}}rpx; background-image: url('{{IMG_URL}}index/head.png')"> <view class="header-wrap" style="height:{{headerHeight}}rpx; background-image: url('{{IMG_URL}}index/head.png')">
<view class="header"> <view class="header">
<tab tab="{{navList}}" itemWidth="{{'35%'}}" index="{{tabIndx}}" bindclick="changeTabIndx" class="tabContainer" /> <tab tab="{{navList}}" itemWidth="{{'35%'}}" index="{{tabIndx}}" unreadClueCount="{{unreadClueCount}}" bindclick="changeTabIndx" class="tabContainer" />
<view class="right" bindtap="gotoApply"> <view class="right" bindtap="gotoApply">
<image class="img" src="{{IMG_URL}}index/apply.png" /> <image class="img" src="{{IMG_URL}}index/apply.png" />
<view class="apply">申请业务</view> <view class="apply">申请业务</view>
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<!-- 托客户内容 --> <!-- 托客户内容 -->
<view class="content" wx:if="{{tabIndx == 1 }}" hover-class="none" hover-stop-propagation="false"> <view class="content" wx:if="{{tabIndx == 1 }}" hover-class="none" hover-stop-propagation="false">
<view class="scene"> <view class="scene">
<view class="item-wrap {{actNum== index ? 'act':''}}" data-num="{{index}}" bindtap="selectCar" wx:for="{{dataArr}}" wx:key="name"> <view class="item-wrap {{actNum== index ? 'act':''}}" wx:if="{{item.sceneStatus == 1}}" data-num="{{index}}" bindtap="selectCar" wx:for="{{senceData}}" wx:key="name">
<view class="item"> <view class="item">
<image class="img" src="{{item.src}}" /> <image class="img" src="{{item.src}}" />
<view class="name">{{item.name}}</view> <view class="name">{{item.name}}</view>
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
</view> </view>
</view> </view>
</view> </view>
<product stickyTop="{{headerHeight}}" actNum="{{actNum}}" senceData="{{senceData}}" /> <product stickyTop="{{headerHeight}}" actNum="{{actNum}}" senceData="{{senceData}}" bindsharehandle="sharehandle" />
</view> </view>
<!-- 看线索内容 --> <!-- 看线索内容 -->
<view class="clue" wx:if="{{tabIndx == 0 }}" hover-class="none" hover-stop-propagation="false"> <view class="clue" wx:if="{{tabIndx == 0 }}" hover-class="none" hover-stop-propagation="false">
...@@ -33,83 +33,81 @@ ...@@ -33,83 +33,81 @@
</view> </view>
</view> </view>
<view class="list" hover-class="none" hover-stop-propagation="false"> <view class="list" hover-class="none" hover-stop-propagation="false">
<view class="msg" wx:for="{{clueList}}" wx:key="phone"> <view class="msg" wx:for="{{clueList}}" wx:key="index">
<!-- 生意助手 --> <!-- 门店助手 -->
<view wx:if="{{item.source == 'customer'}}"> <view class="shop" wx:if="{{item.clueType == 2}}">
<image class="like" wx:if="{{item.like}}" src="{{IMG_URL}}index/like.png" data-type="like" data-outidx="{{index}}" bindtap="showToast" /> <view class="name-wrap">
<image class="like" wx:else src="{{IMG_URL}}index/dislike.png" data-type="dislike" data-outidx="{{index}}" bindtap="showToast" />
<view class="name" hover-class="none" hover-stop-propagation="false"> <view class="name" hover-class="none" hover-stop-propagation="false">
{{item.name}} {{item.nickName}}
<image class="avatar" src="{{IMG_URL}}index/avatar.png" /> <image class="avatar" src="{{IMG_URL}}index/avatar.png" />
</view> </view>
<view class="source" hover-class="none" hover-stop-propagation="false">通过门店助手申请</view>
</view>
<view class="line" hover-class="none" hover-stop-propagation="false" /> <view class="line" hover-class="none" hover-stop-propagation="false" />
<view class="want-more" style="height:{{item.getMoreFlag? 100: 'auto'}}px">
<view class="record" wx:for="{{item.records}}" wx:key="id" wx:for-index="idx" wx:for-item="itemName"> <view class="record" wx:for="{{item.records}}" wx:key="id" wx:for-index="idx" wx:for-item="itemName">
<view class="shop-record">
<view class="shop-action-wrap">
<view class="action-wrap"> <view class="action-wrap">
<view class="action" selectable="false" space="false" decode="false"> <view class="action" selectable="false" space="false" decode="false">访问页面:</view>
{{filterUtils.filterType(itemName.type)}}:
</view>
<view class="detail" selectable="false" space="false" decode="false"> <view class="detail" selectable="false" space="false" decode="false">
{{itemName.msg}} {{itemName.productDesc}}
</view> </view>
</view> </view>
<view class="time" selectable="false" space="false" decode="false"> <view class="time" selectable="false" space="false" decode="false">
{{itemName.time}} {{itemName.clueDate}}
</view>
</view> </view>
<view class="shop-source" hover-class="none" hover-stop-propagation="false">
所属门店:{{itemName.shopName}}
</view> </view>
</view> </view>
<view class="want-btn" wx:if="{{item.records.length > 5}}" hover-class="none" hover-stop-propagation="false" data-outidx="{{index}}" bindtap="getMore">
{{ item.getMoreFlag ? '更多数据' : '收起数据'}}
</view> </view>
<view class="info" hover-class="none" hover-stop-propagation="false"> <view class="info" hover-class="none" hover-stop-propagation="false">
<view class="phone-wrap"> <view>
<view class="phone-wrap" wx:if="{{item.phone}}">
<view class="phone">{{item.phone}}</view> <view class="phone">{{item.phone}}</view>
<image class="phone-img" data-phone="{{item.phone}}" bindtap="phoneCallFn" src="{{IMG_URL}}index/phone.png" /> <image class="phone-img" data-phone="{{item.phone}}" bindtap="phoneCallFn" src="{{IMG_URL}}index/phone.png" />
<image class="copy" data-phone="{{item.phone}}" bindtap="setCopyDataFn" src="{{IMG_URL}}index/copy.png" /> <image class="copy" data-phone="{{item.phone}}" bindtap="setCopyDataFn" src="{{IMG_URL}}index/copy.png" />
</view> </view>
</view>
<view class="btn" hover-class="none" hover-stop-propagation="false" bindtap="gotoApply"> <view class="btn" hover-class="none" hover-stop-propagation="false" bindtap="gotoApply">
+开店面 开通活动
</view> </view>
</view> </view>
</view> </view>
<!-- 门店助手 --> <!-- 生意助手 -->
<view class="shop" wx:else> <view wx:else>
<view class="name-wrap"> <image class="like" wx:if="{{item.starTag == 1}}" src="{{IMG_URL}}index/like.png" data-type="like" data-outidx="{{index}}" data-item="{{item}}" bindtap="showToast" />
<image class="like" wx:else src="{{IMG_URL}}index/dislike.png" data-type="dislike" data-outidx="{{index}}" data-item="{{item}}" bindtap="showToast" />
<view class="name" hover-class="none" hover-stop-propagation="false"> <view class="name" hover-class="none" hover-stop-propagation="false">
{{item.name}} {{item.nickName}}
<image class="avatar" src="{{IMG_URL}}index/avatar.png" /> <image class="avatar" src="{{IMG_URL}}index/avatar.png" />
</view> </view>
<view class="source" hover-class="none" hover-stop-propagation="false">通过门店助手申请</view>
</view>
<view class="line" hover-class="none" hover-stop-propagation="false" /> <view class="line" hover-class="none" hover-stop-propagation="false" />
<view class="record" wx:for="{{item.records}}" wx:key="id" wx:for-index="idx" wx:for-item="itemName"> <view class="want-more" style="height:{{item.getMoreFlag? 100: 'auto'}}px">
<view class="shop-record"> <view class="record" wx:for="{{item.visitList}}" wx:key="id" wx:for-index="idx" wx:for-item="itemName">
<view class="shop-action-wrap">
<view class="action-wrap"> <view class="action-wrap">
<view class="action" selectable="false" space="false" decode="false"> <view class="action" selectable="false" space="false" decode="false">访问页面:</view>
{{filterUtils.filterType(itemName.type)}}:
</view>
<view class="detail" selectable="false" space="false" decode="false"> <view class="detail" selectable="false" space="false" decode="false">
{{itemName.msg}} {{itemName.productDesc}}
</view> </view>
</view> </view>
<view class="time" selectable="false" space="false" decode="false"> <view class="time" selectable="false" space="false" decode="false">
{{itemName.time}} {{itemName.clueDate}}
</view>
</view> </view>
<view class="shop-source" hover-class="none" hover-stop-propagation="false">
所属门店:{{itemName.shop}}
</view> </view>
</view> </view>
<view class="want-btn" wx:if="{{item.visitList.length > 5}}" hover-class="none" hover-stop-propagation="false" data-outidx="{{index}}" bindtap="getMore">
{{ item.getMoreFlag ?'更多数据':'收起数据'}}
</view> </view>
<view class="info" hover-class="none" hover-stop-propagation="false"> <view class="info" hover-class="none" hover-stop-propagation="false" wx:if="{{item.phone}}">
<view class="phone-wrap"> <view class="phone-wrap">
<view class="phone">{{item.phone}}</view> <view class="phone">{{item.phone}}</view>
<image class="phone-img" data-phone="{{item.phone}}" bindtap="phoneCallFn" src="{{IMG_URL}}index/phone.png" /> <image class="phone-img" data-phone="{{item.phone}}" bindtap="phoneCallFn" src="{{IMG_URL}}index/phone.png" />
<image class="copy" data-phone="{{item.phone}}" bindtap="setCopyDataFn" src="{{IMG_URL}}index/copy.png" /> <image class="copy" data-phone="{{item.phone}}" bindtap="setCopyDataFn" src="{{IMG_URL}}index/copy.png" />
</view> </view>
<view class="btn" hover-class="none" hover-stop-propagation="false" bindtap="gotoApply"> <view class="btn" hover-class="none" hover-stop-propagation="false" bindtap="gotoApply" wx:if="{{item.applyStatus == 0}}">
开通活动 +开店面
</view> </view>
</view> </view>
</view> </view>
...@@ -155,4 +153,3 @@ ...@@ -155,4 +153,3 @@
</form> </form>
</view> </view>
</view> </view>
\ No newline at end of file \ No newline at end of file
<!-- <chat></chat> -->
\ No newline at end of file \ No newline at end of file
...@@ -18,17 +18,72 @@ Component({ ...@@ -18,17 +18,72 @@ Component({
data: { data: {
IMGURL: 'https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/', IMGURL: 'https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/',
pMerchantId: 44209845, pMerchantId: 44209845,
// pMerchantId: 41214,
totalProfit: 0, totalProfit: 0,
pageObj: { pageObj: {
currentPage: 1, currentPage: 1,
pageSize: 3 pageSize: 3
}, },
totalPages: -1, totalPages: -1,
list: [] list: [{
"totalMoney": 540967.00,
"merchantId": 44211468,
"merchantName": "明明长岭4s店A",
"sceneList": [{
"sceneCode": "SC001",
"flag": null
}, {
"sceneCode": "SC002",
"flag": true
}, {
"sceneCode": "SC003",
"flag": null
}, {
"sceneCode": "SC004",
"flag": null
}],
"msgList": null
}, {
"totalMoney": 67341.00,
"merchantId": 44211470,
"merchantName": "明明长岭4s店C",
"sceneList": [{
"sceneCode": "SC001",
"flag": null
}, {
"sceneCode": "SC002",
"flag": true
}, {
"sceneCode": "SC003",
"flag": null
}, {
"sceneCode": "SC004",
"flag": null
}],
"msgList": null
}, {
"totalMoney": 54146.00,
"merchantId": 44211469,
"merchantName": "明明长岭4s店B",
"sceneList": [{
"sceneCode": "SC001",
"flag": null
}, {
"sceneCode": "SC002",
"flag": true
}, {
"sceneCode": "SC003",
"flag": null
}, {
"sceneCode": "SC004",
"flag": null
}],
"msgList": null
}]
}, },
lifetimes: { lifetimes: {
attached() { attached() {
this.getClientApi() // this.getClientApi()
} }
}, },
...@@ -56,6 +111,11 @@ Component({ ...@@ -56,6 +111,11 @@ Component({
outputApi.getCustomerPageList({ merchantId: this.data.pMerchantId, ...this.data.pageObj }).then(res => { outputApi.getCustomerPageList({ merchantId: this.data.pMerchantId, ...this.data.pageObj }).then(res => {
var list = this.data.list var list = this.data.list
list = list.concat(res.list) list = list.concat(res.list)
list.forEach((item, index) => {
item.sceneList.forEach((k, idx) => {
item['scene' + (idx + 1)] = item.sceneList[idx].flag
})
})
this.setData({ this.setData({
list: list, list: list,
totalPages: res.pages totalPages: res.pages
...@@ -81,6 +141,7 @@ Component({ ...@@ -81,6 +141,7 @@ Component({
scene2: currentItem.scene2, scene2: currentItem.scene2,
scene3: currentItem.scene3, scene3: currentItem.scene3,
scene4: currentItem.scene4, scene4: currentItem.scene4,
sceneCodeList: currentItem.sceneList.map(item => item.sceneCode),
pMerchantId: this.data.pMerchantId pMerchantId: this.data.pMerchantId
} }
wx.$router.go('packageOutput.summary', params) wx.$router.go('packageOutput.summary', params)
......
...@@ -4,6 +4,11 @@ ...@@ -4,6 +4,11 @@
height: calc(100vh - 170rpx); height: calc(100vh - 170rpx);
color: #323436; color: #323436;
padding: 16rpx 0 60rpx; padding: 16rpx 0 60rpx;
background-color: #F2F3F7;
}
.client-box {
margin: 0 16rpx;
} }
.flex { .flex {
......
<!--pages/tab/output/components/client/client.wxml--> <!--pages/tab/output/components/client/client.wxml-->
<scroll-view class="client" scroll-y="{{true}}" bindscrolltolower="onReachBottom" lower-threshold='50' scroll-top="{{scrollTop}}"> <scroll-view class="client" scroll-y="{{true}}" bindscrolltolower="onReachBottom" lower-threshold='50' scroll-top="{{scrollTop}}">
<view class="client-box">
<view class="profit-box flex-between"> <view class="profit-box flex-between">
<text>总收益</text> <text>总收益</text>
<text class="price-txt">¥{{totalProfit}}</text> <text class="price-txt">¥{{totalProfit}}</text>
...@@ -35,4 +36,5 @@ ...@@ -35,4 +36,5 @@
</view> </view>
</view> </view>
<view wx:if="{{totalPages != -1 && pageObj.currentPage == totalPages}}" class="end-txt">到底啦!</view> <view wx:if="{{totalPages != -1 && pageObj.currentPage == totalPages}}" class="end-txt">到底啦!</view>
</view>
</scroll-view> </scroll-view>
\ No newline at end of file \ No newline at end of file
...@@ -29,7 +29,7 @@ Page({ ...@@ -29,7 +29,7 @@ Page({
let param = this.getParams(decodeUrl) let param = this.getParams(decodeUrl)
if (param.urlParam) { if (param.urlParam) {
let query = JSON.parse(param.urlParam) let query = JSON.parse(param.urlParam)
this.data.refresh = query.refresh this.refresh = query.refresh
} }
this.setData({ this.setData({
url: decodeUrl url: decodeUrl
...@@ -46,7 +46,7 @@ Page({ ...@@ -46,7 +46,7 @@ Page({
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow: function () { onShow: function () {
if (this.data.refresh) { if (this.refresh) {
this.setData( this.setData(
{ {
flag: true flag: true
...@@ -64,7 +64,7 @@ Page({ ...@@ -64,7 +64,7 @@ Page({
* 生命周期函数--监听页面隐藏 * 生命周期函数--监听页面隐藏
*/ */
onHide: function () { onHide: function () {
if (this.data.refresh) { if (this.refresh) {
this.setData({ this.setData({
flag: false flag: false
}) })
...@@ -75,7 +75,7 @@ Page({ ...@@ -75,7 +75,7 @@ Page({
* 生命周期函数--监听页面卸载 * 生命周期函数--监听页面卸载
*/ */
onUnload: function () { onUnload: function () {
if (this.data.refresh) { if (this.refresh) {
this.setData({ this.setData({
flag: false flag: false
}) })
......
...@@ -7,7 +7,7 @@ class Draw { ...@@ -7,7 +7,7 @@ class Draw {
[_pixelRatio_] = null; [_pixelRatio_] = null;
[_canvasObject_] = null; [_canvasObject_] = null;
[_canvas_] = null [_canvas_] = null
constructor(canvasObject) { constructor(canvasObject, isCompInst) {
this[_canvasObject_] = canvasObject this[_canvasObject_] = canvasObject
this[_pixelRatio_] = canvasObject.pixelRatio || 2 this[_pixelRatio_] = canvasObject.pixelRatio || 2
const height = this.toRpx(canvasObject.height), const height = this.toRpx(canvasObject.height),
...@@ -15,7 +15,8 @@ class Draw { ...@@ -15,7 +15,8 @@ class Draw {
canvas = wx.createOffscreenCanvas({ canvas = wx.createOffscreenCanvas({
type: '2d', type: '2d',
width, width,
height height,
compInst:isCompInst
}), }),
ctx = canvas.getContext('2d') ctx = canvas.getContext('2d')
this[_canvas_] = canvas this[_canvas_] = canvas
......
...@@ -10,5 +10,6 @@ export const STORAGE_OBJECTkEY = { ...@@ -10,5 +10,6 @@ export const STORAGE_OBJECTkEY = {
userInfo: 'userInfo', userInfo: 'userInfo',
system_info: 'systemInfo', system_info: 'systemInfo',
app_title: 'appTitle', app_title: 'appTitle',
auto_login_object: 'auto_login_object' auto_login_object: 'auto_login_object',
wx_user_info: 'wx_user_info'
} }
\ No newline at end of file \ No newline at end of file
import { secretKey, pathEnum, domain, sign } from './http.js' import {
import { getSessionId } from '~/utils/cache/storageApi' secretKey,
pathEnum,
domain,
sign
} from './http.js'
import {
getSessionId
} from '~/utils/cache/storageApi'
import network from '~/utils/network' import network from '~/utils/network'
/**接口 */ /**接口 */
class Request { class Request {
...@@ -15,14 +22,15 @@ class Request { ...@@ -15,14 +22,15 @@ class Request {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
wx.showNavigationBarLoading() wx.showNavigationBarLoading()
let header = let header =
RequestMethods === 'POST' RequestMethods === 'POST' ?
? { {
'content-type': 'application/x-www-form-urlencoded' 'content-type': 'application/x-www-form-urlencoded'
} } :
: {} {}
let projectName = this.getRopProject(params.method) let projectName = this.getRopProject(params.method)
if (!projectName) projectName = this.getRopProject(params.method) if (!projectName) projectName = this.getRopProject(params.method)
const path = pathEnum[projectName] let path = pathEnum[projectName]
if (!path) path = `/rop-scrm-${projectName}/`
params = this.getData(params) params = this.getData(params)
wx.request({ wx.request({
url: `${domain}${path}router?method=${params.method}`, url: `${domain}${path}router?method=${params.method}`,
...@@ -34,7 +42,10 @@ class Request { ...@@ -34,7 +42,10 @@ class Request {
success(response) { success(response) {
/**业务代码 */ /**业务代码 */
let { let {
data: { code, message }, data: {
code,
message
},
data data
} = response } = response
if (code == 20 || code == 21) { if (code == 20 || code == 21) {
......
...@@ -5,9 +5,16 @@ ...@@ -5,9 +5,16 @@
* @param {*} shareQuery 分享页面参数 * @param {*} shareQuery 分享页面参数
* @param {*} noPageAuth 分享页面是否需要登录拦截 * @param {*} noPageAuth 分享页面是否需要登录拦截
* @param {*} shareFun 分享页面 * @param {*} shareFun 分享页面
* @param {*} isShareTrack 是否分享埋点
* @returns * @returns
*/ */
import {
reportData
} from '~/api/index.js'
import USERAPI from '~/api/usersApi/index'
const _WXUSERINFO_ = Symbol('_WXUSERINFO_')
class Share { class Share {
[_WXUSERINFO_] = null
constructor() { constructor() {
console.log('---------------- 分享初始化 ----------------') console.log('---------------- 分享初始化 ----------------')
this.initPageProxy() this.initPageProxy()
...@@ -24,23 +31,35 @@ class Share { ...@@ -24,23 +31,35 @@ class Share {
} }
} }
} }
async checkWxUserInfo() {
if (!this[_WXUSERINFO_]) {
const data = await USERAPI.getWXUserInfo()
this[_WXUSERINFO_] = data
}
}
/**设置全局分享 */ /**设置全局分享 */
pageLeaveProxy(page) { pageLeaveProxy(page) {
if (page.onShareAppMessage) { if (page.onShareAppMessage) {
page.onShareAppMessage = () => { const that = this
this.checkWxUserInfo()
page.onShareAppMessage = function () {
let { let {
shareTitle, shareTitle,
sharePath, sharePath,
shareImage, shareImage,
shareQuery, shareQuery,
noPageAuth, noPageAuth,
shareFun shareFun,
shareTrackData
} = this, } = this,
path = `/${this.route}` path = `/${this.route}`
if (sharePath) path = `/${sharePath}` if (sharePath) path = `/${sharePath}`
if (shareQuery) path += `?${shareQuery}` path += that.setCommonShareQuery()
if (shareQuery) path += `&${shareQuery}`
console.log(path)
if (!noPageAuth) path = `/login/loading/loading?url=${encodeURIComponent(path)}` if (!noPageAuth) path = `/login/loading/loading?url=${encodeURIComponent(path)}`
if (shareFun) shareFun() if (shareFun) shareFun()
if (shareTrackData) that.reportShareData(shareTrackData)
return { return {
path, path,
title: shareTitle, title: shareTitle,
...@@ -49,14 +68,18 @@ class Share { ...@@ -49,14 +68,18 @@ class Share {
} }
} }
if (page.onShareTimeline) { if (page.onShareTimeline) {
page.onShareTimeline = () => { page.onShareTimeline = function () {
let { let {
shareTitle, shareTitle,
shareImage, shareImage,
shareQuery, shareQuery,
shareFun shareFun,
shareTrackData
} = this } = this
if (shareFun) shareFun() if (shareFun) shareFun()
if (shareTrackData) that.reportShareData(shareTrackData)
shareQuery = that.setCommonShareQuery(shareQuery)
console.log(shareQuery)
return { return {
query: shareQuery, query: shareQuery,
title: shareTitle, title: shareTitle,
...@@ -64,7 +87,42 @@ class Share { ...@@ -64,7 +87,42 @@ class Share {
} }
} }
} }
}
getCommonData() {
const WXUSERINFO = this[_WXUSERINFO_],
USERINFO = wx.$storage.get('userInfo')
return {
WXUSERINFO,
USERINFO
}
}
setCommonShareQuery(query) {
const {
WXUSERINFO,
USERINFO
} = this.getCommonData()
query = `${query? `?${query}&`:'?'}merchantId=${USERINFO.merchantId}&shareOpenId=${WXUSERINFO.openId}`
if (USERINFO.phone) query += `&sharePhone=${USERINFO.phone}`
return query
}
reportShareData(shareTrackData) {
const {
WXUSERINFO,
USERINFO
} = this.getCommonData()
reportData({
openId: WXUSERINFO.openId || '',
unionId: WXUSERINFO.unionId || '',
nickName: WXUSERINFO.nickName || '',
avatar: WXUSERINFO.avatarUrl || '',
phone: USERINFO.phone || '',
merchantId: USERINFO.merchantId || '',
shareOpenId: WXUSERINFO.openId || '',
sharePhone: USERINFO.phone || '',
...shareTrackData
}).then(res => {
console.log(res)
})
} }
} }
new Share() new Share()
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!