Commit b698e735 by 张立顺

联调完成

2 parents 254749da 453f605c
Showing 46 changed files with 1386 additions and 581 deletions
import api from '~/utils/request/request'
import ssoApi from './ssoApi'
const common = 'scrm.api.carlife.common.'
module.exports = {
ssoApi,
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'
const common = 'scrm.api.carlife.common.'
import api from "~/utils/request/request";
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 {
// true
)
}
/** 查找可开通的产品 */
getNoOpenPro(data) {
return api.post(
{
method: 'scrm.api.busassistant.activity.findNotOpenProducts',
...data
}
)
}
}
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'
const { appId } = wx.getAccountInfoSync().miniProgram
const {
appId
} = wx.getAccountInfoSync().miniProgram
const CODE = {
platformEntrance: 'BUSINESS_ASSISTANT',
productCode: 'PC00c3'
......@@ -7,9 +9,10 @@ const CODE = {
class UsersApi {
/**调用后台接口获取用户信息js_code换取sessionId */
async wxCodeLogin() {
const { code } = await this.getWxCode()
return await api.post(
{
const {
code
} = await this.getWxCode()
return await api.post({
method: 'scrm.api.sso.wechat.applets.jscode.login',
appId,
code
......@@ -19,8 +22,7 @@ class UsersApi {
}
/**退出登录 */
logout() {
return api.post(
{
return api.post({
method: 'scrm.api.sso.wechat.applets.logout'
},
true
......@@ -46,8 +48,7 @@ class UsersApi {
delete detail.errMsg
if (detail.iv && detail.encryptedData) {
detail.loginToken = loginToken
return api.post(
{
return api.post({
method: 'scrm.api.sso.wechat.applets.auth.phone',
...detail,
platformEntrance: 'BUSINESS_ASSISTANT' // 平台标识:生意助手-BUSINESS_ASSISTANT,门店助手-STORE_ASSISTANT
......@@ -58,8 +59,7 @@ class UsersApi {
}
/**账号密码登录 */
async accountLogin(data = {}) {
return api.post(
{
return api.post({
method: 'scrm.api.sso.wechat.applets.password.login',
...data,
...CODE
......@@ -69,8 +69,7 @@ class UsersApi {
}
/** 手机号获取短信验证码 */
getSmsCode(mobile) {
return api.post(
{
return api.post({
method: 'scrm.api.sso.wechat.applets.sms.get.code',
mobile
},
......@@ -79,8 +78,7 @@ class UsersApi {
}
/** 手机号短信验证码登录 */
phoneSmsLogin(data = {}) {
return api.post(
{
return api.post({
method: 'scrm.api.sso.wechat.applets.sms.login',
...data,
source: 'MINIAPP',
......@@ -91,8 +89,7 @@ class UsersApi {
}
/** 获取登录账号列表 */
getAccountList(sessionId) {
return api.post(
{
return api.post({
method: 'scrm.api.sso.wechat.applets.listSelectAccount',
...CODE,
sessionId
......@@ -103,8 +100,7 @@ class UsersApi {
/**
* 选择账号登录(手机绑定多个账号时) */
selectAccountLogin(data) {
return api.post(
{
return api.post({
method: 'scrm.api.sso.wechat.applets.selectAccountLogin',
...CODE,
...data
......@@ -114,8 +110,7 @@ class UsersApi {
}
/**检查sessionId 是否过期 */
checkSession() {
return api.post(
{
return api.post({
method: 'scrm.api.sso.login.status.check'
},
true
......@@ -123,8 +118,7 @@ class UsersApi {
}
/** 超级管理员切换账号 */
adminSelectLogin(data) {
return api.post(
{
return api.post({
method: 'scrm.api.sso.super.administrator.select.login',
...CODE,
...data
......@@ -140,13 +134,41 @@ class UsersApi {
...data
})
}
<<<<<<< HEAD
/** 退出登录 */
logout(data) {
return api.post({
method: 'scrm.api.sso.wechat.applets.logout',
...CODE,
...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
})
}
}
export default UsersApi
export default UsersApi
\ No newline at end of file
......@@ -12,7 +12,7 @@ import { setSystem_info } from '~/utils/cache/storageApi'
import getUpdateManager from './utils/lib/wxUpdateManager'
// 埋点
import './utils/track/Track'
// import './utils/track/Track'
import eventbus from './utils/evenbus'
......
......@@ -28,9 +28,9 @@ Component({
value: ''
},
// 是否有红点
redpoint: {
type: Array,
value: ['看线索']
unreadClueCount: {
type: Number,
value: 0
},
},
......@@ -41,6 +41,11 @@ Component({
count: 0,
to: ''
},
// lifetimes:{
// attached: function() {
// console.log('unreadClueCount',this.data.unreadClueCount)
// }
// },
/**
* 组件的方法列表
......@@ -50,7 +55,8 @@ Component({
let { count } = e.currentTarget.dataset
this.setData({
count,
to: `to-${count}`
to: `to-${count}`,
unreadClueCount:0
})
this.triggerEvent('click', count)
}
......
......@@ -6,6 +6,8 @@
enable-flex
scroll-with-animation
scroll-into-view="{{to}}"
enhanced="{{true}}"
show-scrollbar="{{false}}"
>
<block wx:for="{{tab}}" wx:key="index">
<view
......@@ -34,7 +36,8 @@
{{item}}
</view>
<view class="line" style="lineStyle" />
<view wx:if="{{filterUtils.hasRedpoint(redpoint,item)}}" class="redpoint" />
<!-- -->
<view wx:if="{{filterUtils.hasRedpoint(unreadClueCount)}}" class="redpoint" />
</view>
</block>
</view>
......
/**
*
* @param array 数组
* @param item 数组中的某一项
* @returns
*/
var hasRedpoint = function (array, item) {
// console.log('array: ', array);
return array.length > 0 && array.indexOf(item) != -1;
var hasRedpoint = function (unreadClueCount) {
// console.log('unreadClueCount: ', unreadClueCount);
if(unreadClueCount>0){
return true
}else{
return false;
}
};
module.exports = {
hasRedpoint: hasRedpoint,
......
......@@ -71,10 +71,13 @@
height: 0;
color: transparent;
}
.active .redpoint{
display: none;
}
.redpoint {
position: absolute;
top: 0;
right: 0;
top: 10px;
right: 5px;
/* top: 8px;
right: 10px; */
width: 10px;
......
// login/index/components/LoginBox.js
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 network from '~/utils/network'
import { imgUrlMixin } from '~/mixins/index'
import {
imgUrlMixin
} from '~/mixins/index'
let thisPage
Component({
behaviors: [imgUrlMixin],
......@@ -43,8 +49,11 @@ Component({
},
/**输入回调 */
input(e) {
const { value } = e.detail,
{ name } = e.currentTarget.dataset
const {
value
} = e.detail, {
name
} = e.currentTarget.dataset
this.setData({
[`formData.${name}`]: value
})
......@@ -57,7 +66,9 @@ Component({
},
/**清除input value */
clear(e) {
const { name } = e.currentTarget.dataset
const {
name
} = e.currentTarget.dataset
this.setData({
[`formData.${name}`]: ''
})
......@@ -66,14 +77,21 @@ Component({
},
/**获取验证码 */
getSmsCode() {
const { phoneReady, formData, count } = this.data,
const {
phoneReady,
formData,
count
} = this.data,
countDown = 60
if (!phoneReady || count) return
this.setData({
smsLoading: true
})
USERAPI.getSmsCode(formData.phone)
.then(({ code, message }) => {
.then(({
code,
message
}) => {
this.setData({
smsLoading: false
})
......@@ -94,7 +112,9 @@ Component({
count: countDown
})
setTimeout(() => {
let { count } = this.data
let {
count
} = this.data
this.setData({
count: --count
})
......@@ -107,11 +127,13 @@ Component({
},
/**检查输入框内容 */
checkFormData() {
const { loginType, formData } = this.data
const {
loginType,
formData
} = this.data
if (loginType != 0) {
if (loginType == 1) {
this.setData(
{
this.setData({
phoneReady: formData.phone && thisPage.validate.methods.tel(formData.phone)
},
() => {
......@@ -129,30 +151,39 @@ Component({
},
/**手机号&帐号密码登录 */
login() {
const { formData, loginType } = this.data,
const {
formData,
loginType
} = this.data,
target = {
1: 'phoneSmsLogin',
2: 'accountLogin'
}[loginType],
} [loginType],
obj =
loginType == 1
? {
mobile: formData.phone,
code: formData.code
}
: {
userName: formData.account,
password: md5(formData.password)
}
loginType == 1 ? {
mobile: formData.phone,
code: formData.code
} : {
userName: formData.account,
password: md5(formData.password)
}
this.setBtnLoading()
USERAPI[target](obj)
.then(({ code, data, message }) => {
.then(({
code,
data,
message
}) => {
this.setBtnLoading(false)
if (code == '0') {
if (loginType == 1) this.checkLoginUserInfo(data)
else {
const { autoLogin } = thisPage.data,
{ sessionId } = data,
const {
autoLogin
} = thisPage.data, {
sessionId,
loginUserInfoList
} = data,
validTime = 3600 * 24 * 7 * 1e3,
autoLoginFailureTime = Date.now() + validTime
if (autoLogin) {
......@@ -162,8 +193,7 @@ Component({
password: md5(formData.password)
})
} else wx.$storage.rm('auto_login_object')
console.log(data)
setLoginInfo(data, sessionId)
setLoginInfo(loginUserInfoList[0], sessionId)
}
} else {
if (loginType == 1)
......@@ -179,29 +209,41 @@ Component({
})
},
/**微信登录 */
wxLogin({ detail }) {
wxLogin({
detail
}) {
if (!detail.code) return
this.setBtnLoading()
USERAPI.authUserPhone(detail, this.loginToken)
.then(({ code, data, message }) => {
.then(({
code,
data,
message
}) => {
if (code == '0') this.checkLoginUserInfo(data)
else wx.$api.showToast(message || '系统异常')
this.setBtnLoading(false)
})
.catch(({ errMsg }) => {
.catch(({
errMsg
}) => {
wx.$api.showToast(errMsg || '系统异常')
this.setBtnLoading(false)
})
},
/**手机号&微信登录:是否跳转登录列表页 */
checkLoginUserInfo({ loginUserInfoList, sessionId }) {
checkLoginUserInfo({
loginUserInfoList,
sessionId
}) {
/**多个账号 */
if (loginUserInfoList.length > 1)
wx.$router.go('login.accountItems', {
sessionId,
...thisPage.options
})
/**只有一个账号 */ else
/**只有一个账号 */
else
selectAccountLogin({
id: loginUserInfoList[0].uuid,
sessionId
......@@ -221,15 +263,24 @@ Component({
network.getNetworkType()
thisPage = wx.$router.getPageInstance()
try {
const { data, code, message } = await USERAPI.wxCodeLogin()
const {
data,
code,
message
} = await USERAPI.wxCodeLogin()
if (code == '0') {
thisPage.setData({
disabled: false
})
this.loginToken = data
USERAPI.getUserProfile(data).then(data => {
wx.$storage.set('wx_user_info', data)
})
} else this.reLogin(message)
wx.hideLoading()
} catch ({ errMsg }) {
} catch ({
errMsg
}) {
console.error(errMsg)
this.reLogin()
}
......@@ -242,4 +293,4 @@ Component({
if (reload) this.init()
}
}
})
})
\ No newline at end of file
......@@ -28,7 +28,6 @@ const selectAccountLogin = ({ id, sessionId }) => {
}
/**设置登录信息 */
const setLoginInfo = (userInfo, sessionId) => {
console.log(userInfo)
setUserInfo(userInfo)
setSessionId(sessionId)
loginSuccess()
......
......@@ -21,7 +21,7 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
......@@ -108,7 +108,11 @@ Page({
message
}) => {
if (code == '0') {
setLoginInfo(data, data.sessionId)
const {
sessionId,
loginUserInfoList
} = data
setLoginInfo(loginUserInfoList[0], sessionId)
} else {
try {
const reload = await loginModal({
......
// packageOutput/pages/openBusiness/openBusiness.js
import outputApi from '~/api/outputApi/index'
Page({
/**
......@@ -6,6 +7,8 @@ Page({
*/
data: {
IMGURL: 'https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/',
merchantInfo: {},
sceneCodeList: [],
// 场景业务
formData: {
scene1: true,
......@@ -17,90 +20,113 @@ Page({
// 活动内容
activityList: [],
sceneActivityObj: {
scene1: [{
name: '360实景导航',
price: 10
}, {
name: 'AR实景导航',
price: 20
}, {
name: 'AR实景导航',
price: 20
}, {
name: 'AR实景导航',
price: 20
}, {
name: 'AR实景导航',
price: 20
}, {
name: 'AR实景导航',
price: 20
}, {
name: 'AR实景导航',
price: 20
}, {
name: 'AR实景导航',
price: 20
}, {
name: 'AR实景导航',
price: 20
}, {
name: 'AR实景导航',
price: 20
}, {
name: 'AR实景导航',
price: 20
}, {
name: 'AR实景导航',
price: 20
}],
scene2: [{
name: '座椅通风',
price: 30
}, {
name: '座椅通风',
price: 40
}],
scene3: [{
name: '氛围灯',
price: 50
}, {
name: '氛围灯',
price: 60
}],
scene4: [{
name: '数字化',
price: 70
}, {
name: '数字化',
price: 80
}, {
name: '数字化',
price: 70
}, {
name: '数字化',
price: 80
}, {
name: '数字化',
price: 70
}, {
name: '数字化',
price: 80
}, {
name: '数字化',
price: 70
}, {
name: '数字化',
price: 80
}]
scene1: [],
scene2: [],
scene3: [],
scene4: [],
// scene1: [{
// productName: '360实景导航',
// price: 10
// }, {
// productName: 'AR实景导航',
// price: 20
// }, {
// productName: 'AR实景导航',
// price: 20
// }, {
// productName: 'AR实景导航',
// price: 20
// }, {
// productName: 'AR实景导航',
// price: 20
// }, {
// productName: 'AR实景导航',
// price: 20
// }, {
// productName: 'AR实景导航',
// price: 20
// }, {
// productName: 'AR实景导航',
// price: 20
// }, {
// productName: 'AR实景导航',
// price: 20
// }, {
// productName: 'AR实景导航',
// price: 20
// }, {
// productName: 'AR实景导航',
// price: 20
// }, {
// productName: 'AR实景导航',
// price: 20
// }],
// scene2: [{
// productName: '座椅通风',
// price: 30
// }, {
// productName: '座椅通风',
// price: 40
// }],
// scene3: [{
// productName: '氛围灯',
// price: 50
// }, {
// productName: '氛围灯',
// price: 60
// }],
// scene4: [{
// productName: '数字化',
// price: 70
// }, {
// productName: '数字化',
// price: 80
// }, {
// productName: '数字化',
// price: 70
// }, {
// productName: '数字化',
// price: 80
// }, {
// productName: '数字化',
// price: 70
// }, {
// productName: '数字化',
// 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) {
var idx = e.detail.sceneIdx
this.setData({
sceneActive: idx
})
if (!this.data.sceneActivityObj['scene' + this.data.sceneActive].length) {
this.getNoOpenPro(this.data.sceneCodeList[this.data.sceneActive - 1])
return true
}
this.setCurActivity()
// console.log('换内容---')
},
......@@ -111,10 +137,11 @@ Page({
})
},
// 活动切换
handleActClick(e) {
var idx = e.currentTarget.dataset.idx
this.setData({
['activityList[' + idx +'].checked']: !this.data.activityList[idx].checked
['activityList[' + idx + '].checked']: !this.data.activityList[idx].checked
})
},
......@@ -123,7 +150,7 @@ Page({
sceneActive: this.data.sceneActive,
activityIdxList: this.data.activityList.filter(item => item.checked == true)
}
if(!params.activityIdxList.length) {
if (!params.activityIdxList.length) {
wx.$api.showToast('请选产品/活动')
return true
}
......@@ -132,28 +159,22 @@ Page({
title: '提交成功',
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) {
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 @@
<view class="box">
<view class="box-title">产品/活动<text class="title-tip">(可多选)</text></view>
<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>
......
......@@ -28,15 +28,15 @@ Component({
name: 'totalOrderMoney'
}, {
label: '客单价',
name: '',
name: 'calCustomerUnitPrice',
prefix: '¥'
}, {
label: '引流体验量',
name: '',
name: 'calExperience',
suffix: '%'
}, {
label: '体验转化率',
name: '',
name: 'calTransform',
suffix: '%'
}]
},
......
......@@ -3,7 +3,7 @@
<view class="block" wx:for="{{formDataList}}" wx:key="index">
<view>
<text wx:if="{{item.prefix}}">{{item.prefix}}</text>
{{formData[item.name]}}
{{formData[item.name] || 0}}
<text wx:if="{{item.suffix}}">{{item.suffix}}</text>
</view>
<view class="label">{{item.label}}</view>
......
......@@ -7,7 +7,7 @@ Page({
*/
data: {
IMGURL: 'https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/',
merchantName: '',
sceneCodeList: ['SC001', 'SC002', 'SC003', 'SC004'],
merchantInfo: {},
sceneObj: {
scene1: null,
......@@ -15,94 +15,98 @@ Page({
scene3: null,
scene4: null
},
sceneActive: 1,
sceneActive: 2,
scenePriceList: [{
total: 0
}, {
total: 1000.45
total: 0
}, {
total: 0
}, {
total: 14580.45
total: 0
}],
// 活动内容
scrollLeft: 0,
activityActive: 0,
activityList: [],
sceneActivityObj: {
scene1: [{
name: '360实景导航',
price: 10
}, {
name: 'AR实景导航',
price: 20,
isOpen: true
}, {
name: 'AR实景导航',
price: 20,
isOpen: true
}, {
name: 'AR实景导航',
price: 20,
isOpen: true
}, {
name: 'AR实景导航',
price: 20,
isOpen: false
}, {
name: 'AR实景导航',
price: 20,
isOpen: true
}],
scene2: [{
name: '座椅通风',
price: 30,
isOpen: true,
toShopCount: 120,
experienceCount: 200,
upgradeCount: 300,
totalOrderMoney: 365
}, {
name: '座椅通风',
price: 40
}],
scene3: [{
name: '氛围灯',
price: 50
}, {
name: '氛围灯',
price: 60,
isOpen: true
}],
scene4: [{
name: '数字化',
price: 70,
isOpen: true
}, {
name: '数字化',
price: 80
}, {
name: '数字化',
price: 70
}, {
name: '数字化',
price: 80,
isOpen: true
}, {
name: '数字化',
price: 70
}, {
name: '数字化',
price: 80,
isOpen: true
}, {
name: '数字化',
price: 70
}, {
name: '数字化',
price: 80,
isOpen: true
}]
scene1: [],
scene2: [],
scene3: [],
scene4: [],
// [{
// productName: '360实景导航',
// price: 10
// }, {
// productName: 'AR实景导航',
// price: 20,
// openFlag: true
// }, {
// productName: 'AR实景导航',
// price: 20,
// openFlag: true
// }, {
// productName: 'AR实景导航',
// price: 20,
// openFlag: true
// }, {
// productName: 'AR实景导航',
// price: 20,
// openFlag: false
// }, {
// productName: 'AR实景导航',
// price: 20,
// openFlag: true
// }],
// scene2: [{
// productName: '座椅通风',
// price: 30,
// openFlag: true,
// toShopCount: 120,
// experienceCount: 200,
// upgradeCount: 300,
// totalOrderMoney: 365
// }, {
// productName: '座椅通风',
// price: 40
// }],
// scene3: [{
// productName: '氛围灯',
// price: 50
// }, {
// productName: '氛围灯',
// price: 60,
// openFlag: true
// }],
// scene4: [{
// productName: '数字化',
// price: 70,
// openFlag: true
// }, {
// productName: '数字化',
// price: 80
// }, {
// productName: '数字化',
// price: 70
// }, {
// productName: '数字化',
// price: 80,
// openFlag: true
// }, {
// productName: '数字化',
// price: 70
// }, {
// productName: '数字化',
// price: 80,
// openFlag: true
// }, {
// productName: '数字化',
// price: 70
// }, {
// productName: '数字化',
// price: 80,
// openFlag: true
// }]
},
// 产值
searchForm: {
......@@ -123,6 +127,10 @@ Page({
sceneActive: idx,
activityActive: 0
})
if (!this.data.sceneActivityObj['scene' + this.data.sceneActive].length) {
this.getNoOpenPro(this.data.sceneCodeList[this.data.sceneActive - 1])
return true
}
this.setCurActivity()
// console.log('换内容---')
},
......@@ -165,8 +173,31 @@ Page({
},
handleJump(e) {
console.log(this.data.activityList[this.data.activityActive])
wx.$router.go('packageOutput.openBusiness')
// console.log(this.data.activityList[this.data.activityActive])
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() {
......@@ -190,10 +221,44 @@ Page({
return params
},
/** 1.1和1.2场景产品数据处理
* 调同一个接口,返回两个服务下面的全部产品的数据
*/
getCustomerDetail() {
var params = this.dealSearchTime()
outputApi.getCustomerDetail({ merchantId: 44209390, ...params }).then(res => {
console.log(res)
outputApi.getCustomerDetail({ merchantId: this.data.merchantInfo.merchantId, ...params }).then(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({
*/
onLoad(options) {
wx.$router.getData(obj => {
console.log(obj)
var scene = {}
Object.keys(this.data.sceneObj).forEach(item => {
scene[item] = obj[item]
})
this.setData({
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-->
<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="scene-box bg-white">
<scene-box formData="{{sceneObj}}" scenePriceList="{{scenePriceList}}" sceneActive="{{sceneActive}}" bindhandleSceneChange="handleSceneChange"></scene-box>
......@@ -9,13 +9,13 @@
<view class="p-rl-20 bg-white">
<scroll-view scroll-x="{{true}}" class="activity-box" scroll-left="{{scrollLeft}}">
<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>
</scroll-view>
</view>
<!-- 活动内容 -->
<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>看产值</view>
<view class="select" bindtap="handleSearch">
......@@ -24,7 +24,7 @@
<image class="icon-arrow" src="{{IMGURL}}output/arrow.png?v={{img_version}}"></image>
</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>
</view>
<view wx:else class="content-empty bg-white">
......@@ -32,5 +32,5 @@
</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>
\ No newline at end of file
// pages/checkProduct/checkProduct.js
// const navStyle = "background-color: transparent;";
import {
IMG_URL
} from "~/utils/constantData.js";
const navStyle = "background-color: #fff";
import {
senceData
} from "~/pages/tab/index/constant/data";
import {
reportData
} from '~/api/index.js'
Page({
/**
* 页面的初始数据
*/
data: {
navStyle,
headerHeight:0,
headerHeight: 0,
senceData,
// 模态框
isShow: true,
},
// navbar高度设置
navbarReady(e) {
let {
height,
statusBarHeight
} = e.detail;
this.setData({
headerHeight: height / 2 + statusBarHeight,
// headerHeight: height / 2 + statusBarHeight,
// headerHeight: height / 2 + statusBarHeight + 88 * 2,
});
// console.log(e)
// 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
})
},
// navbar高度设置
navbarReady(e) {
let { height, statusBarHeight } = e.detail;
this.setData({
headerHeight: height / 2 + statusBarHeight,
// headerHeight: height / 2 + statusBarHeight + 88 * 2,
});
// console.log(e)
// console.log(this.data.headerHeight)
},
/**
* 生命周期函数--监听页面加载
*/
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
onShareAppMessage() {},
});
\ No newline at end of file
{
"usingComponents": {
"product": "../tab/index/components/product/product"
"product": "../tab/index/components/product/product",
"shareModel":"../tab/index/components/shareModel/shareModel"
},
"navigationStyle": "custom",
"onReachBottomDistance": 10,
......
<!--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>
<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
<!--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
// pages/tab/discovery/components/product/product.js
// import {imgUrlMixin} from '~/mixins/index'
import { IMG_URL } from "~/utils/constantData.js";
const videoBaseUrl =
"https://img02.glsx.com.cn/weapp/resource/miniprogram/ai-card/";
Component({
// behaviors: [imgUrlMixin],
......@@ -10,7 +12,11 @@ Component({
properties: {
stickyTop: Number,
actNum: Number,
senceData:Object,
senceData: Object,
isShare:{
type: Boolean,
value: false
}
},
/**
......@@ -32,11 +38,17 @@ Component({
curTabIdx: 0,
intoViewId: "to-0",
IMGURL: `${IMG_URL}index/`,
videoBaseUrl,
},
lifetimes: {
ready: function () {
// console.log(11111)
// console.log('stickyTop',this.data.stickyTop)
this.getImgHeight();
//如果不是分享,初始化的时候调用函数
if(!this.data.isShare){
// console.log(131546)
this.getMoreFn()
}
},
},
observers: {
......@@ -80,6 +92,7 @@ Component({
});
// 每次切换场景,重新获取流程图高度
this.getImgHeight();
this.getMoreFn()
},
},
......@@ -87,9 +100,7 @@ Component({
* 组件的方法列表
*/
methods: {
saleTextChange(e){
},
saleTextChange(e) {},
changeTab(e) {
let idx = e.detail;
this.setData({
......@@ -131,9 +142,8 @@ Component({
// 图片流程5 点击往下获取更多
// 没登陆用户(登陆后解锁全部)
getMoreFn(e) {
let { actNum } = this.data;
console.log('inactNumdex: ', actNum);
// console.log("inactNumdex: ", actNum);
let tab = [
"场景说明",
"营销链路",
......@@ -142,6 +152,7 @@ Component({
"合作流程",
// "合作案例",
];
switch (actNum) {
case 0:
tab.push("合作案例");
......@@ -159,5 +170,11 @@ Component({
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 @@
}
.project-img {
height: 1200rpx;
height: 1600rpx;
white-space: nowrap;
.img-item {
position: relative;
......@@ -232,8 +232,14 @@
height: 490rpx;
}
.img-item26 {
width: 100%;
height: 752rpx;
.video-item{
width: 100%;
video{
border-radius: 16rpx;
height: 348rpx;
}
}
}
// 流程图三
......@@ -286,3 +292,64 @@
width: 100%;
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
<!--pages/tab/discovery/components/product/product.wxml-->
<!-- pages/tab/discovery/components/product/product.wxml -->
<view class="prod-wrap">
<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">
<text class='nav {{activeNavIdx==index ? "active-nav": ""}}' bindtap="changeNav" data-index="{{index}}">{{item}}</text>
</block>
......@@ -9,19 +9,18 @@
<view class="prod-item">
<view class="prod-card">
<view class="card-img">
<text class="img-desc">轻改类</text>
<image src="{{IMGURL}}discovery_prod1.png" />
<!-- <text class="img-desc">轻改类</text>
<image src="{{IMGURL}}discovery_prod1.png" /> -->
<image src="{{IMGURL}}prod/{{senceData[actNum].productList[activeNavIdx].img}}.png" />
</view>
<view class="prod-info">
<text class="title">360全景导航</text>
<text class="sale">新车销量 <text class="sale-num">{{senceData[actNum]['productList'][activeNavIdx].changeSale || senceData[actNum]['productList'][activeNavIdx].sale}}</text>
</text>
<text class="earnings">预估收益 <text class="earnings-num">{{senceData[actNum]['productList'][activeNavIdx].profit}}</text>
</text>
</view>
<view class="share-btn">
<text class="title">{{senceData[actNum].productList[activeNavIdx].proName}}</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 class="earnings" decode="{{true}}">{{stickyTop}}预估收益&nbsp;<text class="earnings-num">{{senceData[actNum]['productList'][activeNavIdx].profit}}</text>
</text>
</view>
<view class="share-btn" wx:if="{{!isShare}}" bindtap="onShareFn">
<image class="icon" src="{{IMGURL}}share.png" />
<text>分享</text>
</view>
......@@ -29,8 +28,8 @@
</view>
</view>
<view class="project-wrap">
<!-- -->
<view class="stickyTab" style="top:{{stickyTop}}rpx">
<!-- -->
<view class="stickyTab" style="top:{{isShare ? stickyTop+88 : stickyTop}}rpx">
<tab
outClassName="project-tab"
openScroll="{{true}}"
......@@ -39,7 +38,7 @@
bindclick="changeTab"
/>
</view>
<!-- style="{height:{{allHeight}}px}" -->
<!-- style="{height:{{allHeight}}px}" -->
<scroll-view
class="project-img"
scroll-into-view="{{intoViewId}}"
......@@ -50,7 +49,26 @@
<view id="to-{{index}}" class="img-item img-item{{actNum+1}}{{index+1}}">
<!-- {{item}} -->
<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>
</block>
</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
const navStyle = "background-color: transparent;";
import { IMG_URL } from "~/utils/constantData.js";
import pageData from "./constant/data";
import { senceData } from "./constant/data";
// `${IMG_URL}index/car2.png`,
//本地图片路径
let IMG_URLLocal = "../../../images/";
import { productBysceneApi,unreadApi,pageApi,readApi,tagApi } from "~/api/index.js";
Page({
// behaviors: [kfMixin],
......@@ -40,7 +41,8 @@ Page({
msg: "1.3 存量用户众筹",
},
],
actNum: 0,
apiData: [],
actNum: 0, //car 场景选择
tabIndx: 1,
navList: ["看线索", "看产品"],
typeList: ["联系电话", "意向客户", "线索来源", "重置"],
......@@ -96,7 +98,7 @@ Page({
],
phone: 15718122929,
isOpen: false,
getMoreFlag: true,
getMoreFlag: false,
},
{
source: "customer",
......@@ -145,7 +147,6 @@ Page({
isOpen: true,
},
],
filterType: "", //看线索过滤类型
// 预估弹框
visible: false,
isReset: false,
......@@ -160,8 +161,12 @@ Page({
isFirst: true,
// tabList: pageData.tabList,
// 定义数据
senceData: pageData.senceData,
changeSale: 0, //每次改变的销量
senceData,
isShow: false,
// 看线索部分
unreadClueCount: 0,
cluePageSize:10,
clueCurrentPage: 1
},
//引导图
......@@ -197,6 +202,7 @@ Page({
// 选车场景切换
selectCar(e) {
let actNum = e.currentTarget.dataset.num;
// console.log('actNum: ', actNum);
this.setData({
actNum,
});
......@@ -204,9 +210,21 @@ Page({
// 头部看线索,产品切换
changeTabIndx(e) {
console.log("e.detail: ", e.detail);
let { sessionId } = wx.$storage.get();
// console.log("sessionId: ", sessionId);
let param = {
sessionId,
};
let first = true
this.setData({
tabIndx: e.detail,
});
//标记线索已读
if(e.detail == 0 && first ){
first = false
readApi(param)
}
},
gotoApply() {
// wx.$router.go('apply',1235)
......@@ -293,16 +311,13 @@ Page({
this.data.senceData.forEach((item, index) => {
item.productList.forEach((i, lastIndex) => {
if (i.profit) {
// let name = `senceData[${index}].productList[${lastIndex}].profit`;
let sale = `senceData[${index}].productList[${lastIndex}].sale`;
let name = `senceData[${index}].productList[${lastIndex}].profit`;
// let changeSale = `senceData[${index}].productList[${lastIndex}].changeSale`;
let profit = _this.formula(i.productType, sales, flow);
console.log(name, profit);
this.setData({
[name]: profit,
[sale]:sales
// [changeSale]: sales,
[sale]: sales,
});
}
});
......@@ -384,7 +399,7 @@ Page({
}
console.log(profit.length);
console.log(productType, sales, flow, profit);
if (profit.length > 6) {
if (profit.length > 8) {
return (profit / 10000).toFixed(0) + "万";
} else {
return profit;
......@@ -405,11 +420,63 @@ Page({
});
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({
this.prompt = this.selectComponent("#toast");
},
showToast: function (e) {
let type = e.currentTarget.dataset.type;
let {type,item} = e.currentTarget.dataset;
console.log('type,item: ', type,item);
let tipObj = {};
if (type == "like") {
if (item.starTag == 1) {
tipObj = {
type: "fail",
title: "取消标记为意向客户",
......@@ -446,32 +514,63 @@ Page({
this.setData({
[completeStatus]: !this.data.clueList[index].like,
});
//发请求
let { sessionId } = wx.$storage.get();
let params = {
clueId:item.clueId,
sessionId
}
this.getTagApi(params)
},
filterTypeFn(e) {
let index = e.currentTarget.dataset.index;
let itemList = [];
// console.log("index: ", typeof index);
let params = {
clueSource:'',
hasPhone:'',
starTag:''
}
console.log("index: ", index);
switch (index) {
case 0:
itemList = ["有", "无"];
itemList = ["无","有"];
break;
case 1:
itemList = ["是", "否"];
itemList = ["否","是"];
break;
case 2:
itemList = ["访客", "门店"];
itemList = ["访客", "门店"]; //线索来源(1访客,2门店)
break;
case 3:
console.log("重置");
return;
params = {
clueSource:'',
hasPhone:'',
starTag:''
}
break;
}
this.setData({
filterType: "",
});
let _this = this;
wx.pro.showActionSheet({
itemList,
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) {
console.log(res.errMsg);
......@@ -480,6 +579,10 @@ Page({
console.log("res: ", res);
},
});
if(index == 3){
this.getPageApi(params)
}
},
// 打电话
phoneCallFn(e) {
......@@ -492,6 +595,49 @@ Page({
let { phone } = e.currentTarget.dataset;
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({
* 用户点击右上角分享
*/
onShareAppMessage: function () {},
onShareTimeline: function () {},
});
......@@ -2,7 +2,8 @@
"usingComponents": {
"product": "./components/product/product",
"vas-toast": "./components/likeToast/likeToast",
"chat":"./components/chat/chat"
"shareModel": "./components/shareModel/shareModel"
},
"navigationStyle": "custom"
"navigationStyle": "custom",
"onReachBottomDistance":50
}
......@@ -237,13 +237,13 @@ page {
.scene {
margin: 0 10px 16px;
display: flex;
justify-content: space-between;
// justify-content: space-between;
.item-wrap {
margin-right: 4px;
position: relative;
width: 86px;
height: 90px;
border-radius:10px;
}
.item {
// padding-top: 10px;
......
......@@ -18,17 +18,72 @@ Component({
data: {
IMGURL: 'https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/',
pMerchantId: 44209845,
// pMerchantId: 41214,
totalProfit: 0,
pageObj: {
currentPage: 1,
pageSize: 3
},
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: {
attached() {
this.getClientApi()
// this.getClientApi()
}
},
......@@ -56,6 +111,11 @@ Component({
outputApi.getCustomerPageList({ merchantId: this.data.pMerchantId, ...this.data.pageObj }).then(res => {
var list = this.data.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({
list: list,
totalPages: res.pages
......@@ -81,6 +141,7 @@ Component({
scene2: currentItem.scene2,
scene3: currentItem.scene3,
scene4: currentItem.scene4,
sceneCodeList: currentItem.sceneList.map(item => item.sceneCode),
pMerchantId: this.data.pMerchantId
}
wx.$router.go('packageOutput.summary', params)
......
......@@ -4,6 +4,11 @@
height: calc(100vh - 170rpx);
color: #323436;
padding: 16rpx 0 60rpx;
background-color: #F2F3F7;
}
.client-box {
margin: 0 16rpx;
}
.flex {
......
<!--pages/tab/output/components/client/client.wxml-->
<scroll-view class="client" scroll-y="{{true}}" bindscrolltolower="onReachBottom" lower-threshold='50' scroll-top="{{scrollTop}}">
<view class="profit-box flex-between">
<text>总收益</text>
<text class="price-txt">¥{{totalProfit}}</text>
</view>
<view class="box" wx:for="{{list}}" wx:key="index" bindtap="handleJump" data-idx="{{index}}">
<view class="head flex-between">
<view class="name text-hide">{{item.merchantName}}</view>
<view class="price-txt">¥{{item.totalMoney}}</view>
<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">
<text>总收益</text>
<text class="price-txt">¥{{totalProfit}}</text>
</view>
<!-- 场景内容 -->
<view class="box-content">
<scene-box formData="{{item}}"></scene-box>
<!-- 通知 -->
<view class="box-bottom">
<view wx:if="{{item.msgList.length}}" class="flex">
<view class="tip-blue">最新</view>
<view class="bottom-content">
<view class="flex-between tip-row" wx:for="{{item.msgList}}" wx:for-item="subItem" wx:for-index="idx" wx:key="idx">
<view>{{subItem.msg}}</view>
<view class="time">{{subItem.createTime}}</view>
<view class="box" wx:for="{{list}}" wx:key="index" bindtap="handleJump" data-idx="{{index}}">
<view class="head flex-between">
<view class="name text-hide">{{item.merchantName}}</view>
<view class="price-txt">¥{{item.totalMoney}}</view>
</view>
<!-- 场景内容 -->
<view class="box-content">
<scene-box formData="{{item}}"></scene-box>
<!-- 通知 -->
<view class="box-bottom">
<view wx:if="{{item.msgList.length}}" class="flex">
<view class="tip-blue">最新</view>
<view class="bottom-content">
<view class="flex-between tip-row" wx:for="{{item.msgList}}" wx:for-item="subItem" wx:for-index="idx" wx:key="idx">
<view>{{subItem.msg}}</view>
<view class="time">{{subItem.createTime}}</view>
</view>
</view>
</view>
</view>
<view wx:else class="flex">
<view class="tip-blue">通知</view>
<view class="bottom-content">
<view class="tip-row">
<view>运营建议:您的门店尚未开展活动,暂无产值。建议开通新产品拓展营收范围。</view>
<view wx:else class="flex">
<view class="tip-blue">通知</view>
<view class="bottom-content">
<view class="tip-row">
<view>运营建议:您的门店尚未开展活动,暂无产值。建议开通新产品拓展营收范围。</view>
</view>
</view>
</view>
</view>
</view>
</view>
<view wx:if="{{totalPages != -1 && pageObj.currentPage == totalPages}}" class="end-txt">到底啦!</view>
</view>
<view wx:if="{{totalPages != -1 && pageObj.currentPage == totalPages}}" class="end-txt">到底啦!</view>
</scroll-view>
\ No newline at end of file
......@@ -29,7 +29,7 @@ Page({
let param = this.getParams(decodeUrl)
if (param.urlParam) {
let query = JSON.parse(param.urlParam)
this.data.refresh = query.refresh
this.refresh = query.refresh
}
this.setData({
url: decodeUrl
......@@ -46,7 +46,7 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function () {
if (this.data.refresh) {
if (this.refresh) {
this.setData(
{
flag: true
......@@ -64,7 +64,7 @@ Page({
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
if (this.data.refresh) {
if (this.refresh) {
this.setData({
flag: false
})
......@@ -75,7 +75,7 @@ Page({
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
if (this.data.refresh) {
if (this.refresh) {
this.setData({
flag: false
})
......
......@@ -7,7 +7,7 @@ class Draw {
[_pixelRatio_] = null;
[_canvasObject_] = null;
[_canvas_] = null
constructor(canvasObject) {
constructor(canvasObject, isCompInst) {
this[_canvasObject_] = canvasObject
this[_pixelRatio_] = canvasObject.pixelRatio || 2
const height = this.toRpx(canvasObject.height),
......@@ -15,7 +15,8 @@ class Draw {
canvas = wx.createOffscreenCanvas({
type: '2d',
width,
height
height,
compInst:isCompInst
}),
ctx = canvas.getContext('2d')
this[_canvas_] = canvas
......
......@@ -10,5 +10,6 @@ export const STORAGE_OBJECTkEY = {
userInfo: 'userInfo',
system_info: 'systemInfo',
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
import { secretKey, pathEnum, domain, sign } from './http.js'
import { getSessionId } from '~/utils/cache/storageApi'
import {
secretKey,
pathEnum,
domain,
sign
} from './http.js'
import {
getSessionId
} from '~/utils/cache/storageApi'
import network from '~/utils/network'
/**接口 */
class Request {
......@@ -15,14 +22,15 @@ class Request {
return new Promise((resolve, reject) => {
wx.showNavigationBarLoading()
let header =
RequestMethods === 'POST'
? {
'content-type': 'application/x-www-form-urlencoded'
}
: {}
RequestMethods === 'POST' ?
{
'content-type': 'application/x-www-form-urlencoded'
} :
{}
let 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)
wx.request({
url: `${domain}${path}router?method=${params.method}`,
......@@ -34,7 +42,10 @@ class Request {
success(response) {
/**业务代码 */
let {
data: { code, message },
data: {
code,
message
},
data
} = response
if (code == 20 || code == 21) {
......@@ -110,4 +121,4 @@ class Request {
return projectName
}
}
export default new Request()
export default new Request()
\ No newline at end of file
......@@ -5,9 +5,16 @@
* @param {*} shareQuery 分享页面参数
* @param {*} noPageAuth 分享页面是否需要登录拦截
* @param {*} shareFun 分享页面
* @param {*} isShareTrack 是否分享埋点
* @returns
*/
import {
reportData
} from '~/api/index.js'
import USERAPI from '~/api/usersApi/index'
const _WXUSERINFO_ = Symbol('_WXUSERINFO_')
class Share {
[_WXUSERINFO_] = null
constructor() {
console.log('---------------- 分享初始化 ----------------')
this.initPageProxy()
......@@ -24,23 +31,35 @@ class Share {
}
}
}
async checkWxUserInfo() {
if (!this[_WXUSERINFO_]) {
const data = await USERAPI.getWXUserInfo()
this[_WXUSERINFO_] = data
}
}
/**设置全局分享 */
pageLeaveProxy(page) {
if (page.onShareAppMessage) {
page.onShareAppMessage = () => {
const that = this
this.checkWxUserInfo()
page.onShareAppMessage = function () {
let {
shareTitle,
sharePath,
shareImage,
shareQuery,
noPageAuth,
shareFun
shareFun,
shareTrackData
} = this,
path = `/${this.route}`
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 (shareFun) shareFun()
if (shareTrackData) that.reportShareData(shareTrackData)
return {
path,
title: shareTitle,
......@@ -49,14 +68,18 @@ class Share {
}
}
if (page.onShareTimeline) {
page.onShareTimeline = () => {
page.onShareTimeline = function () {
let {
shareTitle,
shareImage,
shareQuery,
shareFun
shareFun,
shareTrackData
} = this
if (shareFun) shareFun()
if (shareTrackData) that.reportShareData(shareTrackData)
shareQuery = that.setCommonShareQuery(shareQuery)
console.log(shareQuery)
return {
query: shareQuery,
title: shareTitle,
......@@ -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()
\ 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!