Commit ffbb52bb by 陈婉清

Merge branch 'v3.11.1' into 'develop'

V3.11.1和v4.23.0上线后,代码合并。

See merge request !30
2 parents 27de45e6 3a0b0755
Showing 43 changed files with 1832 additions and 466 deletions
...@@ -88,6 +88,46 @@ const getActivityDetailApi = data => { ...@@ -88,6 +88,46 @@ const getActivityDetailApi = data => {
}) })
} }
// 获取小程序首页数据列表
const getDiscoverList = (data) => {
return api.post({
method: 'scrm.api.busassistant.discover.weapp.list',
...data
},
true
)
}
// 获取特色产品内容详情
const getDiscoverDetail = (data) => {
return api.post({
method: 'scrm.api.busassistant.discover.content.detail',
...data
},
true
)
}
// 获取案例视频、操作指引详情
const getDetailWithLike = (data) => {
return api.post({
method: 'scrm.api.busassistant.discover.content.detailWithLike',
...data
},
true
)
}
// 获取一级菜单下所在类别所有数据
const getContentList = (data) => {
return api.post({
method: 'scrm.api.busassistant.discover.weapp.contentList',
...data
},
true
)
}
module.exports = { module.exports = {
/** 线索埋点数据上报 /** 线索埋点数据上报
* operationType 操作类型(0:分享 1:浏览 2:申请活动) * operationType 操作类型(0:分享 1:浏览 2:申请活动)
...@@ -107,5 +147,9 @@ module.exports = { ...@@ -107,5 +147,9 @@ module.exports = {
tagApi, tagApi,
battleMessageApi, battleMessageApi,
getActivityRecordApi, getActivityRecordApi,
getActivityDetailApi getActivityDetailApi,
getDiscoverList,
getDiscoverDetail,
getDetailWithLike,
getContentList
} }
...@@ -93,5 +93,25 @@ class mineApi { ...@@ -93,5 +93,25 @@ class mineApi {
} }
) )
} }
/** 获取车品牌列表 */
getCarBrandList() {
return api.post({
method: 'scrm.api.busassistant.serviceCenter.getCarbrandTree'
})
}
/** 获取车系列表 */
// getCarSeriesList(data) {
// return api.post({
// method: 'scrm.api.carlife.common.getCarSeriesList',
// ...data
// })
// }
/** 获取车型 */
// getCarTypeList(carSeriesId) {
// return api.post({
// method: 'scrm.api.carlife.common.getCarTypeList',
// carSeriesId
// })
// }
} }
export default mineApi export default mineApi
...@@ -96,6 +96,16 @@ const getReviewList = data => { ...@@ -96,6 +96,16 @@ const getReviewList = data => {
) )
} }
// 查询商户详情
const getMerchantInfo = data => {
return api.post(
{
method: 'scrm.api.busassistant.serviceCenter.merchantInfo',
...data
}
)
}
export default { export default {
getAllServiceList, getAllServiceList,
getServiceList, getServiceList,
...@@ -105,5 +115,6 @@ export default { ...@@ -105,5 +115,6 @@ export default {
addTechnician, addTechnician,
updateTechnician, updateTechnician,
deleteTechnician, deleteTechnician,
getReviewList getReviewList,
getMerchantInfo
} }
\ No newline at end of file \ No newline at end of file
...@@ -37,6 +37,8 @@ import './utils/share' ...@@ -37,6 +37,8 @@ import './utils/share'
//监听网络状态 //监听网络状态
import './utils/network' import './utils/network'
import { getDiscoverList } from '~/api/index.js'
App({ App({
onLaunch(options) { onLaunch(options) {
/**挂载到wx对象 */ /**挂载到wx对象 */
...@@ -53,6 +55,17 @@ App({ ...@@ -53,6 +55,17 @@ App({
// console.log('test') // console.log('test')
}, },
// 获取公共数据
getBaseData() {
console.log("method")
return new Promise((resolve, reject) => {
getDiscoverList().then(res => {
console.log(res, '555');
resolve(res.data)
})
})
},
onShow(options) { onShow(options) {
getUpdateManager() getUpdateManager()
}, },
......
...@@ -15,7 +15,8 @@ ...@@ -15,7 +15,8 @@
"packagesList/activityDetail/activityDetail" "packagesList/activityDetail/activityDetail"
], ],
"requiredPrivateInfos": [ "requiredPrivateInfos": [
"getLocation" "getLocation",
"chooseLocation"
], ],
"lazyCodeLoading": "requiredComponents", "lazyCodeLoading": "requiredComponents",
"window": { "window": {
...@@ -122,7 +123,8 @@ ...@@ -122,7 +123,8 @@
"popup": "/components/Popup/Popup", "popup": "/components/Popup/Popup",
"nothing-tips": "/components/Nothing-tips/nothingTips", "nothing-tips": "/components/Nothing-tips/nothingTips",
"crowdfund-poster": "/components/CrowdfundPoster/CrowdfundPoster", "crowdfund-poster": "/components/CrowdfundPoster/CrowdfundPoster",
"glsx-image": "/components/image/index" "glsx-image": "/components/image/index",
"no-product": "/components/NoProduct/index"
}, },
"resolveAlias": { "resolveAlias": {
"~/*": "/*" "~/*": "/*"
......
...@@ -5,6 +5,8 @@ Component({ ...@@ -5,6 +5,8 @@ Component({
*/ */
properties: { properties: {
navStyle: String, navStyle: String,
navBarBoxStyle: String,
navTitleStyle: String,
custom: Boolean, custom: Boolean,
showBack: Boolean, showBack: Boolean,
customBack: Boolean, customBack: Boolean,
......
<view class="navigation-bar" id="navigation-bar" style="padding-top:{{statusBarHeight}}px;height:{{navigationBarHeight}}px;{{navStyle}}"> <view class="navigation-bar" id="navigation-bar" style="padding-top:{{statusBarHeight}}px;height:{{navigationBarHeight}}px;{{navStyle}}">
<block wx:if="{{!custom}}"> <block wx:if="{{!custom}}">
<view class="navigation-bar-box" wx:if="{{showNavBar}}" style="{{navigationBarStyle}}"> <view class="navigation-bar-box" wx:if="{{showNavBar}}" style="{{navigationBarStyle}}{{navBarBoxStyle}}">
<block wx:if="{{SHOWBACK}}"> <block wx:if="{{SHOWBACK}}">
<view class="back " bindtap="back"> <view class="back " bindtap="back">
<image class="img" src="./images/icon-back.png" /> <image class="img" src="./images/icon-back.png" />
</view> </view>
</block> </block>
<view class="navigation-bar-titleText" style="{{navigationBarTextWidth}}"> <view class="navigation-bar-titleText" style="{{navigationBarTextWidth}}{{navTitleStyle}}">
<slot/> <slot/>
</view> </view>
</view> </view>
......
// components/NoProduct/index.js
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
IMG_URL: 'https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/',
img_version: 'v1.0.0'
},
/**
* 组件的方法列表
*/
methods: {
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
/* components/NoProduct/index.wxss */
.no-product {
height: 100vh;
font-weight: 500;
font-size: 48rpx;
color: #2D2D33;
text-align: center;
margin-top: 340rpx;
&-img {
width: 434rpx;
height: 276rpx;
margin-bottom: 50rpx;
}
}
\ No newline at end of file \ No newline at end of file
<!--components/NoProduct/index.wxml-->
<view class="no-product">
<image class="no-product-img" src="{{IMG_URL}}index/productImgs/no-product.png?v={{img_version}}" />
<view>产品已下架</view>
</view>
...@@ -8,30 +8,30 @@ Component({ ...@@ -8,30 +8,30 @@ Component({
*/ */
properties: { properties: {
// 场景值下标 // 场景值下标
actNum: { // actNum: {
type: Number, // type: Number,
value: -1, // value: -1,
observer(n) { // observer(n) {
this.getInfo() // this.getInfo()
if (n == 3) { // if (n == 3) {
this.setVideoCtx() // this.setVideoCtx()
} // }
} // }
}, // },
// 选中的产品 // // 选中的产品
activeNavIdx: { // activeNavIdx: {
type: Number, // type: Number,
value: 0 // value: 0
}, // },
cardInfo: { // cardInfo: {
type: Object, // type: Object,
value: {} // value: {}
}, // },
// 配置url // // 配置url
activeUrl: { // activeUrl: {
type: String, // type: String,
value: '' // value: ''
}, // },
sharephone: { sharephone: {
type: String, type: String,
value: '' value: ''
...@@ -39,6 +39,14 @@ Component({ ...@@ -39,6 +39,14 @@ Component({
showLeftFlag: { showLeftFlag: {
type: Boolean, type: Boolean,
value: false value: false
},
detailType: {
type: String,
value: 'pro'
},
proDetail: {
type: Object,
value: {}
} }
}, },
...@@ -82,25 +90,57 @@ Component({ ...@@ -82,25 +90,57 @@ Component({
let { attr } = e.currentTarget.dataset let { attr } = e.currentTarget.dataset
this.data[attr] && this.data[attr].pause() this.data[attr] && this.data[attr].pause()
}, },
getInfo() { // getInfo() {
let { activeNavIdx, actNum } = this.data // let { activeNavIdx, actNum } = this.data
const spcList = [99] // 订阅模块需要特殊处理 // const spcList = [99] // 订阅模块需要特殊处理
const senceList = this.data.productData[actNum].filter(item => item.name != '全部') // const senceList = this.data.productData[actNum].filter(item => item.name != '全部')
for (let i = 0; i < senceList.length; i++) { // for (let i = 0; i < senceList.length; i++) {
let item = senceList[i] // let item = senceList[i]
let proIdList = item?.productList.map(k => k.id) // let proIdList = item?.productList.map(k => k.id)
if (proIdList.includes(activeNavIdx)) { // if (proIdList.includes(activeNavIdx)) {
let proInfo = item.productList.find(k => k.id == activeNavIdx) // let proInfo = item.productList.find(k => k.id == activeNavIdx)
// this.setData({
// proInfo,
// productImgs: spcList.includes(actNum) ? proInfo.sceneImgs : (proInfo.productImgs ? proInfo.productImgs : item.productImgs),
// tabList: spcList.includes(actNum) ? proInfo.tabList : norTabList,
// prodItemVideo: item.videoList.length ? spcList.includes(actNum) ? item.videoList[proInfo.currentIndex] : item.videoList[activeNavIdx] : item.noVideoPicture[0]
// })
// break
// }
// }
// },
async loadImg(e){
this.data.loadedNum += 1
if(e.currentTarget.dataset.len==this.data.loadedNum){
let imgTopArr = [];
const topList = await this.getDomInfo('.calc-wrap')
const top = topList.reduce((prev, cur)=>{
return prev + cur.height;
}, 0)
imgTopArr.push(top)
const imgList = await this.getDomInfo('.img-items')
imgList.reduce((prev, cur, index)=>{
if(index<imgList.length-1){
imgTopArr.push(prev + cur.height)
}
return prev + cur.height;
}, top)
this.setData({ this.setData({
proInfo, imgTopArr
productImgs: spcList.includes(actNum) ? proInfo.sceneImgs : (proInfo.productImgs ? proInfo.productImgs : item.productImgs),
tabList: spcList.includes(actNum) ? proInfo.tabList : norTabList,
prodItemVideo: item.videoList.length ? spcList.includes(actNum) ? item.videoList[proInfo.currentIndex] : item.videoList[activeNavIdx] : item.noVideoPicture[0]
}) })
break
}
} }
}, },
getDomInfo(dom){
return new Promise((resolve,reject)=>{
let query = wx.createSelectorQuery().in(this);
query
.selectAll(dom)
.boundingClientRect((rt) => {
resolve(rt)
})
.exec();
})
},
getImgHeight() { getImgHeight() {
let query = wx.createSelectorQuery().in(this) let query = wx.createSelectorQuery().in(this)
let heightArr = [] let heightArr = []
...@@ -111,7 +151,7 @@ Component({ ...@@ -111,7 +151,7 @@ Component({
let _this = this let _this = this
query query
.selectAll('.img-item') .selectAll('.img-items')
.boundingClientRect(react => { .boundingClientRect(react => {
react.forEach((item, index) => { react.forEach((item, index) => {
//44 tab的高度 //44 tab的高度
...@@ -128,10 +168,12 @@ Component({ ...@@ -128,10 +168,12 @@ Component({
// },500) // },500)
}, },
// 1.3查看活动详情按钮 // 1.3查看活动详情按钮
checkActive() { checkActive(e) {
let { activeUrl } = this.data // let { activeUrl } = this.data
wx.$router.jumpH5(activeUrl); // wx.$router.jumpH5(activeUrl);
console.log(e);
let { url } = e.currentTarget.dataset
wx.$router.jumpH5(url);
}, },
onClickTab(event) { onClickTab(event) {
// console.log('event: ', event); // console.log('event: ', event);
...@@ -177,25 +219,20 @@ Component({ ...@@ -177,25 +219,20 @@ Component({
}, },
// 膨胀金-二维码-长按图片 // 膨胀金-二维码-长按图片
handleLongPress(e) { handleLongPress(e) {
let { index } = e.target.dataset let {item} = e.currentTarget.dataset
let { activeNavIdx, actNum } = this.data // 如果图片有长按事件 posterEventType: 1-无 2-有
// 膨胀金活动,合作方式 if (item.posterEventType == 1) return
if (actNum == 99 && activeNavIdx == 3 && index == 4) {
wx.downloadFile({ wx.downloadFile({
// 示例 url,并非真实存在 url: item.posterEventUrl,
url: 'https://scrm.glsx.com.cn/frontpdf/expand_agreement.pdf',
success: function (res) { success: function (res) {
console.log(res)
const filePath = res.tempFilePath const filePath = res.tempFilePath
wx.openDocument({ wx.openDocument({
filePath: filePath, filePath: filePath,
success: function (res) { success: function (res) {
console.log('打开文档成功')
} }
}) })
} }
}) })
}
}, },
} }
}) })
...@@ -78,6 +78,9 @@ page { ...@@ -78,6 +78,9 @@ page {
} }
.prod-detail { .prod-detail {
.img-items {
position: relative;
}
.occupancy { .occupancy {
height: 120rpx; height: 120rpx;
......
<!-- packagesList/pages/productDetail/components/proDetail/proDetail.wxml --> <!-- packagesList/pages/productDetail/components/proDetail/proDetail.wxml -->
<view class="view-prod custom-class"> <view class="view-prod custom-class">
<view class="pro-head"> <view class="pro-head">
<!-- 有视频 --> <!-- 产品详情是视频 -->
<video class="frame" id="video" wx:if="{{actNum != 2}}" src="{{prodItemVideo.videoUrl}}" bindplay="handleVideoPlay" data-attr="crowdVideoCtx" /> <!-- mediaType: 1-图片,2-视频 -->
<image class="no-video" wx:if="{{actNum == 2}}" src="{{prodItemVideo.posterUrl}}?v={{img_version}}" /> <video class="frame" id="video" wx:if="{{proDetail.mediaType == '2'}}" src="{{proDetail.vedioUrl}}" bindplay="handleVideoPlay" data-attr="crowdVideoCtx" />
<!-- 产品详情是图片 -->
<image class="no-video" wx:if="{{proDetail.mediaType == '1'}}" src="{{proDetail.imageUrl}}?v={{img_version}}" />
<!-- 标题+视频时展示观看人数 -->
<view class="title-wrap"> <view class="title-wrap">
<view class="title">{{prodItemVideo.name}}</view> <view class="title">{{proDetail.title}}</view>
<image class="check" wx:if="{{actNum != 2}}" src="{{IMG_URL}}index/poster/check.png?v={{img_version}}" /> <image class="check" wx:if="{{proDetail.mediaType != '1'}}" src="{{IMG_URL}}index/poster/check.png?v={{img_version}}" />
<view class="num" wx:if="{{actNum != 2}}">{{prodItemVideo.view}}</view> <view class="num" wx:if="{{proDetail.mediaType != '1'}}">{{proDetail.view}}</view>
</view> </view>
</view> </view>
<view class="tab-wrap">
<view wx:if="{{proDetail.detailList}}" class="tab-wrap">
<van-tabs sticky bind:click="onClickTab" active="{{tabAct}}"> <van-tabs sticky bind:click="onClickTab" active="{{tabAct}}">
<van-tab wx:for="{{tabList}}" title="{{item}}" wx:key="idnex" /> <van-tab wx:for="{{proDetail.detailList}}" title="{{item.name}}" wx:key="idnex" />
<!-- <van-tab title="合作案例" />
<van-tab title="合作方式" />
<van-tab title="适配产品" /> -->
</van-tabs> </van-tabs>
</view> </view>
<view class="prod-detail"> <view class="prod-detail">
<block wx:for="{{productImgs}}" wx:key="index"> <block wx:for="{{proDetail.detailList}}" wx:key="index">
<image webp wx:if="{{ index < 3}}" webp mode="widthFix" class="img-item {{item.className?item.className:''}}" src="{{item.url?item.url:item}}?v={{img_version}}"> <image webp mode="widthFix" class="img-items" src="{{item.posterUrl}}?v={{img_version}}" bindlongpress="handleLongPress" data-item="{{item}}">
<!-- 第一张图的点击拨打电话事件 -->
<block wx:if="{{ index == 0}}"> <block wx:if="{{ index == 0}}">
<!-- && phone -->
<view class="phone" bindtap="phoneCall" data-phone="{{sharephone}}"> <view class="phone" bindtap="phoneCall" data-phone="{{sharephone}}">
<!-- <image src="{{IMGURL}}share-phone.png?v={{img_version}}" class="icon"></image> --> <image src="{{IMGURL}}share-phone.png?v={{img_version}}" class="icon"></image>
<glsx-image webp src="index/phone.png" class="icon" /> <glsx-image webp src="index/phone.png" class="icon" />
请联系我 请联系我
<view style="color:#3666fe">{{sharephone}}</view> <view style="color:#3666fe">{{sharephone}}</view>
</view> </view>
</block> </block>
<!-- 查看活动那个详情 1.3才有 -->
<block wx:if="{{ index == 0 && actNum == 3 && activeUrl}}"> <!-- 如果有活动跳转 -->
<view class="check-act" bindtap="checkActive">点击查看活动页面</view> <!-- 按钮点击事件 buttonClickEvent:1-无 2-有 -->
<block wx:if="{{ item.buttonEventType == 2 }}">
<view class="check-act" bindtap="checkActive" data-url="{{item.buttonEventUrl}}">{{item.buttonEventName}}</view>
</block> </block>
<!-- 获取更多详情 --> <!-- 获取更多详情 -->
<block wx:if="{{ index == 2 && showLeftFlag}}"> <!-- <block wx:if="{{ index == 2 && showLeftFlag}}">
<button class="more-btn" data-index="{{index}}" bindgetphonenumber="getUserInfo" open-type="getPhoneNumber"> <button class="more-btn" data-index="{{index}}" bindgetphonenumber="getUserInfo" open-type="getPhoneNumber">
点击查看更多详情 点击查看更多详情
</button> </button>
</block> -->
<!-- 如果有视频 -->
<block wx:if="{{ item.videoUrl }}">
<video class="crowd-video" id="crowd-video" bindplay="handleVideoPlay" data-attr="videoCtx" src="{{item.videoUrl}}" />
</block> </block>
</image> </image>
<image webp wx:if="{{ index >= 3 && !showLeftFlag}}" mode="widthFix" webp class="img-item {{item.className?item.className:''}}" src="{{item.url?item.url:item}}?v={{img_version}}" data-index="{{index}}" bindlongpress="handleLongPress">
<!-- 众筹-视频 -->
<block wx:if="{{ index == 3 && actNum == 3 }}">
<video class="crowd-video" id="crowd-video" bindplay="handleVideoPlay" data-attr="videoCtx" src="{{videoBaseUrl}}video/crowd-detail.mp4" />
</block>
</image>
</block> </block>
<view class="occupancy" wx:if="{{!isShare}}"> <view class="occupancy" wx:if="{{!isShare}}">
<!-- padding底部 占位元素 -->
</view> </view>
</view> </view>
</view> </view>
......
/* login/index/components/LoginBox.wxss */ /* login/index/components/LoginBox.wxss */
.wx { .wx {
height: 922rpx; // height: 922rpx;
height: 63vh;
.title { .title {
font-weight: 600; font-weight: 600;
font-size: 60rpx; font-size: 60rpx;
color: #323436; color: #323436;
padding: 216rpx 0 24rpx; // padding: 216rpx 0 24rpx;
padding: 13vh 0 24rpx;
} }
.subtitle { .subtitle {
...@@ -18,7 +20,7 @@ ...@@ -18,7 +20,7 @@
width: 378rpx; width: 378rpx;
height: 364rpx; height: 364rpx;
display: block; display: block;
margin: 0 auto; margin: 0 auto 40rpx;
} }
} }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
position: fixed; position: fixed;
width: 100%; width: 100%;
left: 0; left: 0;
bottom: 60rpx; bottom: 40rpx;
font-size: 24rpx; font-size: 24rpx;
color: #999; color: #999;
letter-spacing: 2rpx; letter-spacing: 2rpx;
......
...@@ -10,9 +10,9 @@ ...@@ -10,9 +10,9 @@
"integrity": "sha512-R2FyCk0mK2xvUX2dMgVZjVG512RKBj7ELMDxjRJjhQWtw4495WBgbl5Yb4v2A6d4vWJe6z9toKgDJTciN0Bo9A==" "integrity": "sha512-R2FyCk0mK2xvUX2dMgVZjVG512RKBj7ELMDxjRJjhQWtw4495WBgbl5Yb4v2A6d4vWJe6z9toKgDJTciN0Bo9A=="
}, },
"glsx-applet-component": { "glsx-applet-component": {
"version": "1.1.3", "version": "1.1.16",
"resolved": "https://registry.npmjs.org/glsx-applet-component/-/glsx-applet-component-1.1.3.tgz", "resolved": "https://registry.npmjs.org/glsx-applet-component/-/glsx-applet-component-1.1.16.tgz",
"integrity": "sha512-Ze+HdtFJImhOsWLfV+ZzB86Kf18pm9M9CZWhctPel/qJNMEn29g9ywC16NXmeac+gTu07MOpURyF+YmO8ojkJA==" "integrity": "sha512-XlBqP5ja4TqGB0nTW4dW6fdSQ9m/hAspbBKTJZ9CNUGVCKorkyjv/RfY85ta4OU5PiQCKTFZBbTELtz5MoxaVQ=="
} }
} }
} }
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
"main": "app.js", "main": "app.js",
"dependencies": { "dependencies": {
"@vant/weapp": "^1.10.7", "@vant/weapp": "^1.10.7",
"glsx-applet-component": "^1.1.3" "glsx-applet-component": "^1.1.16"
}, },
"devDependencies": {}, "devDependencies": {},
"scripts": { "scripts": {
......
// packageMine/components/CarBrand/CarBrand.js
import mineApi from '~/api/mineApi/index'
import Util from '~/utils/util'
Component({
/**
* 组件的属性列表
*/
properties: {
popupShow: {
type: Boolean,
value: false,
observer: function (n) {
if (n) {
this.getBrandList()
}
}
},
selectedList: {
type: Array,
value: []
}
},
/**
* 组件的初始数据
*/
data: {
selectingList: []
},
/**
* 组件的方法列表
*/
methods: {
dealSelectedList(brandList) {
return new Promise(resolve => {
let { selectedList } = this.data
selectedList.forEach((item, idx) => {
let brandIdx = brandList.findIndex(k => k.id == item.id)
let brandChildList = brandList[brandIdx].children
item.label = item.name
item.children.forEach((subItem, subIdx) => {
let cIdx = brandChildList.findIndex(k => k.id == subItem.id)
brandList[brandIdx].children[cIdx].active = true
subItem.active = true
subItem.label = subItem.name
})
})
this.setData({
selectingList: Util.deepClone(selectedList)
})
resolve(brandList)
})
},
getBrandList() {
let data = wx.$storage.get('car_brand_list')
if (data) {
this.dealSelectedList(Util.deepClone(data)).then(brandlist => {
this.formatData(brandlist)
})
} else {
mineApi.getCarBrandList().then(data => {
wx.$storage.set('car_brand_list', data)
this.dealSelectedList(Util.deepClone(data)).then(brandlist => {
this.formatData(brandlist)
})
})
}
},
formatData(data) {
let letterList = Array.from(new Set([...data.map(e => e.letter)]))
let brandList = letterList.map(e => {
let list = []
data.map(i => {
if (e === i.letter) {
list.push(i)
}
})
return {
letter: e,
list
}
})
this.setCarData(brandList)
},
setCarData(brandList) {
wx.$api.showLoading('加载中...')
let count = 0
let settime = setInterval(() => {
if (null != brandList[count].list && brandList[count].list.length > 0) {
this.setData({
[`brandList[${count}]`]: brandList[count]
})
}
count++
if (count >= brandList.length) {
clearInterval(settime)
this.getLetter()
}
}, 10)
},
getLetter() {
wx.hideLoading()
let { brandList, letter } = this.data
let arr = []
if (brandList.length > 0) {
brandList.forEach(e => {
arr.push(e.letter)
})
this.setData({
arr,
letter,
flag: true
})
}
setTimeout(() => {
this.getSideBarInfo()
}, 500)
},
getSideBarInfo() {
let _this = this
wx.$api.getViewInfo('#letter-A', res => {
wx.$api.getViewInfo('#side-bar', _res => {
_this.setData({
letterHeight: res.height,
toTop: res.height + _res.top,
height: _res.bottom
})
})
})
},
dealSelectList(index, pidx, cidx) {
let { selectingList } = this.data
let pItem = Util.deepClone(this.data.brandList[index].list[pidx])
// 已选列表中,当前选中的品牌是否存在
let selectPItemId = selectingList.findIndex(item => item.id == pItem.id)
// 不存在该品牌,插入;存在该品牌,替换
if (selectPItemId == -1) {
selectingList.push(pItem)
this.setData({
selectingList
})
return true
}
this.setData({
[`selectingList[${selectPItemId}]`]: pItem
})
},
// 选中/取消子品牌
clickChild(e) {
let { index, pidx, cidx } = e.currentTarget.dataset
let childItem = this.data.brandList[index].list[pidx].children[cidx]
this.setData({
[`brandList[${index}].list[${pidx}].children[${cidx}].active`]: !childItem.active
})
this.dealSelectList(index, pidx, cidx)
},
handleConfirm() {
let { selectingList } = this.data
let _list = []
let idx = 0
selectingList.forEach(item => {
if (item.children.some(k => k.active == true)) {
_list.push({
id: item.id,
name: item.label,
logoUrl: item.logoUrl,
children: []
})
item.children.forEach(k => {
if (k.active) {
_list[idx].children.push({
id: k.id,
name: k.label
})
}
})
idx = idx + 1
}
})
console.log(_list, '_list处理后---')
return _list
},
start(e) {
let { letter } = e.target.dataset
this.setData({
showTip: true,
letter
})
},
move(e) {
let { letterHeight, showTip, height, toTop, arr } = this.data
let { y, num, isNum } = this
if (showTip) {
y = e.touches[0].clientY
num = Math.ceil((y - toTop) / letterHeight)
if (num < 0) num = 0
if (y < height && isNum != num) {
clearTimeout(this.time)
isNum = num
this.time = setTimeout(() => {
this.setData({
letter: arr[num]
})
}, 1000 / 60)
}
}
},
end(e) {
clearTimeout(this.time)
this.setData({
showTip: false
})
}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
/* packageMine/components/CarBrand/CarBrand.wxss */
.y-center {
display: flex;
align-items: center;
transform: translateY(0);
}
.car-brands-box {
width: 100%;
height: calc(100% - 120rpx);
background: #FFFFFF;
// padding-top: 20rpx;
}
.car-brands {
height: 100%;
position: relative;
}
.box-title {
height: 112rpx;
line-height: 112rpx;
font-size: 32rpx;
font-weight: 600;
color: #323436;
text-align: center;
}
.car-brands .title {
position: sticky;
top: 0;
z-index: 2;
background: #F7F8FA;
font-size: 24rpx;
color: #969799;
padding-left: 24rpx;
height: 64rpx;
line-height: 64rpx;
}
.pBrand {
display: flex;
align-items: center;
width: 100%;
height: 88rpx;
line-height: 88rpx;
margin-right: 24rpx;
background: #F8F9FC;
}
.list {
height: 88rpx;
padding-left: 32rpx;
font-weight: 500;
}
.logo {
width: 40rpx;
height: 40rpx;
margin: 0 14rpx 0 20rpx;
}
.child {
font-weight: normal;
// padding-left: 82rpx;
font-size: 28rpx;
color: #323436;
position: relative;
animation: show-child .25s forwards;
}
.child.active {
box-sizing: border-box;
display: flex;
justify-content: space-between;
color: #3666FE;
padding-right: 44rpx;
.icon {
width: 32rpx;
height: 32rpx;
}
}
@keyframes show-child {
0% {
height: 0;
}
100% {
height: 88rpx;
}
}
.side-bar {
z-index: 999;
position: fixed;
top: 50%;
transform: translateY(-50%);
font-size: 24rpx;
color: #4c4c4c;
width: 10%;
opacity: 0;
animation: show-side-bar .5s forwards;
}
@keyframes show-side-bar {
0% {
opacity: 0;
right: -100%;
}
100% {
opacity: 1;
right: 0;
}
}
.side-bar .view {
width: 100%;
text-align: center;
}
.tips {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 140rpx;
height: 140rpx;
border-radius: 50%;
color: #fff;
background: rgba(153, 153, 153, 0.7);
z-index: 9999;
font-size: 60rpx;
font-weight: 500;
display: flex;
align-items: center;
justify-content: center;
}
.nothing {
padding: 100rpx;
text-align: center;
color: #999;
}
.car-type-box {
position: fixed;
left: 0;
top: 0;
width: 100vw;
height: 100vh;
font-size: 28rpx;
color: #333;
z-index: 9999;
}
.car-type-box .bg {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.5);
}
.car-type-box .brands-box {
position: absolute;
top: 0;
right: 0;
width: 60.5%;
height: 100%;
overflow-y: scroll;
background: #fff;
-webkit-overflow-scrolling: touch;
animation: move 0.4s;
box-sizing: border-box;
padding-bottom: 40rpx;
}
.car-type-box .title {
width: 100%;
height: 64rpx;
box-sizing: border-box;
padding-left: 32rpx;
color: #969799;
background: #F7F8FA;
top: 0;
}
.car-type-box .brands-box .brands-list {
width: 100%;
box-sizing: border-box;
padding-left: 32rpx;
border-bottom: 1rpx solid #e9e9e9;
animation: show-car-type .25s forwards;
}
@keyframes show-car-type {
0% {
min-height: 0;
opacity: 0;
}
100% {
min-height: 100rpx;
opacity: 1;
}
}
@keyframes move {
from {
right: -60.5%;
}
to {
right: 0;
}
}
.btn-box {
width: 100%;
position: fixed;
bottom: 0;
display: flex;
padding: 8rpx 32rpx 16rpx;
background: #FFFFFF;
.btn {
box-sizing: border-box;
width: calc((100% - 78rpx) / 2);
height: 88rpx;
line-height: 88rpx;
text-align: center;
font-size: 28rpx;
color: #FFFFFF;
background: #3666FE;
border-radius: 12rpx;
border: 2rpx solid #3666FE;
}
.btn-cancel {
color: #8A8C90;
border: 2rpx solid #EEEEEE;
background: #FFFFFF;
margin-right: 14rpx;
}
}
\ No newline at end of file \ No newline at end of file
<!--packageMine/components/CarBrand/CarBrand.wxml-->
<view class="car-brands-box">
<view class="box-title">选择品牌</view>
<view class="car-brands">
<scroll-view style="height:100%;" scroll-y scroll-into-view="{{letter}}">
<block wx:if="{{flag}}">
<block wx:if="{{brandList.length > 0}}">
<block wx:for="{{brandList}}" wx:key="index">
<view id="{{item.letter}}">
<!-- <view class="title y-center">{{item.letter}}</view> -->
<view class="box">
<block wx:for="{{item.list}}" wx:for-item="i" wx:key="ind" wx:for-index="ind">
<!-- <view class="brands" catchtap="showChilds" data-index='{{index}}' data-ind='{{ind}}'> -->
<view class="brands" data-index='{{index}}' data-ind='{{ind}}'>
<view class="list y-center">
<view class="pBrand">
<image class="logo" src="{{i.logoUrl}}"></image>
{{i.label}}
</view>
</view>
<!-- <block wx:if="{{i.active && i.childs}}"> -->
<block wx:if="{{i.children}}">
<block wx:for="{{i.children}}" wx:key="cind" wx:for-item="c" wx:for-index="cind">
<!-- <view class="list y-center child" catchtap="showCarSeriesList" data-item="{{i}}" data-that="{{c}}"> -->
<view class="list y-center child {{c.active ? 'active' : ''}}" catchtap="clickChild" data-index="{{index}}" data-pidx="{{ind}}" data-cidx="{{cind}}" data-pitem="{{i}}" data-that="{{c}}">
{{c.label}}
<glsx-image src="personal/checked.png" class="icon" />
</view>
</block>
</block>
</view>
</block>
</view>
</view>
</block>
</block>
<block wx:else>
<view class="nothing">暂无数据</view>
</block>
</block>
</scroll-view>
<view class="side-bar" id="side-bar">
<block wx:for="{{brandList}}" wx:key="index">
<view data-letter="{{item.letter}}" class="view {{item.active?'active':''}}" capture-catch:touchstart="start" id="letter-{{item.letter}}" data-index="{{index}}" capture-catch:touchmove="move" capture-catch:touchend="end">{{item.letter}}
</view>
</block>
</view>
<!-- 提示 -->
<view class='tips' hidden='{{!showTip}}'>{{letter}}</view>
</view>
<!-- 车系车型 -->
<!-- <block wx:if="{{carSeriesList.length}}">
<view class="car-type-box">
<view class="bg" bindtap="cancel" catchtouchmove="noScroll"></view>
<view class="brands-box">
<block wx:for="{{carSeriesList}}" wx:key="index">
<view class="title y-center" bindtap="toggle" data-index="{{index}}" data-id="{{item.id}}">{{item.name}}
</view>
<view class="box" hidden="{{!item.active}}">
<block wx:for="{{item.list}}" wx:for-item="i" wx:key="id">
<view class="brands-list y-center" bindtap="choose" data-item="{{item}}" data-that="{{i}}">{{i.name}}
</view>
</block>
</view>
</block>
</view>
</view>
</block> -->
</view>
<!-- <view class="btn-box">
<view class="btn btn-cancel">取消</view>
<view class="btn" bindtap="handleConfirm">确定</view>
</view> -->
\ No newline at end of file \ No newline at end of file
...@@ -10,7 +10,9 @@ const formRule = { ...@@ -10,7 +10,9 @@ const formRule = {
return !phoneRex.test(value) ? { message: '请输入正确的手机号' } : null return !phoneRex.test(value) ? { message: '请输入正确的手机号' } : null
} }
} }
] ],
longitude: [{ required: true, message: '地址不能为空' }],
merchantAddress: [{ required: true, message: '详细地址不能为空' }],
} }
const formItems = [{ const formItems = [{
...@@ -40,6 +42,16 @@ const formItems = [{ ...@@ -40,6 +42,16 @@ const formItems = [{
placeholder: '请输入手机号码', placeholder: '请输入手机号码',
maxlength: 11 maxlength: 11
}, { }, {
label: '地址',
props: '',
type: 'map',
detailAddr: {
props: 'merchantAddress',
maxlength: 50
}
}]
const formItemsThird = [{
label: '业务开通', label: '业务开通',
props: '', props: '',
type: 'business' type: 'business'
...@@ -47,5 +59,6 @@ const formItems = [{ ...@@ -47,5 +59,6 @@ const formItems = [{
export default { export default {
formRule, formRule,
formItems formItems,
formItemsThird
} }
\ No newline at end of file \ No newline at end of file
...@@ -5,6 +5,7 @@ import { IMG_URL } from '~/utils/constantData' ...@@ -5,6 +5,7 @@ import { IMG_URL } from '~/utils/constantData'
import mineServiceApi from '~/api/mineApi/mineService' import mineServiceApi from '~/api/mineApi/mineService'
import mineCustomerApi from '~/api/mineApi/mineCustomer' import mineCustomerApi from '~/api/mineApi/mineCustomer'
import outputApi from '~/api/outputApi/index' import outputApi from '~/api/outputApi/index'
import mapApi from '~/utils/mapapi/mapapi'
const sceneCodeList = ['SC002', 'SC003', 'SC004', 'SC001'] const sceneCodeList = ['SC002', 'SC003', 'SC004', 'SC001']
Page({ Page({
...@@ -16,6 +17,7 @@ Page({ ...@@ -16,6 +17,7 @@ Page({
addOrEdit: '', addOrEdit: '',
formData: {}, formData: {},
formItems: constantData.formItems, formItems: constantData.formItems,
formItemsThird: constantData.formItemsThird,
apiNameObj: { apiNameObj: {
'add': 'saveCustomer', 'add': 'saveCustomer',
'edit': 'updateCustomer' 'edit': 'updateCustomer'
...@@ -29,7 +31,120 @@ Page({ ...@@ -29,7 +31,120 @@ Page({
isConfirm: false, isConfirm: false,
baseData: { baseData: {
proList: [] proList: []
},
// 车品牌popup
popupShow: false,
selectedBrandList: []
},
// 地址解析(地址转坐标)https://apis.map.qq.com/ws/geocoder/v1/?address=
getGeocoder() {
let { formData } = this.data
// let address = formData.provinceName || '' + formData.cityName || '' + formData.merchantAddress || ''
let address = (formData.provinceName || '') + (formData.cityName || '')
mapApi.geocoder(address).then(res => {
this.setData({
['formData.longitude']: res?.location?.lng,
['formData.latitude']: res?.location?.lat,
})
})
},
// 省市改变
bindRegionChange(e) {
let { detail } = e
this.setData({
['formData.provinceName']: detail?.value[0],
['formData.provinceCode']: detail?.code[0],
['formData.cityName']: detail?.value[1],
['formData.cityCode']: detail?.code[1],
['formData.latitude']: '',
['formData.longitude']: '',
['formData.merchantAddress']: '',
region: detail?.value
})
this.getGeocoder()
},
brandConfirm() {
let brandMoudle = this.selectComponent('#car-brand')
this.setData({
selectedBrandList: brandMoudle && brandMoudle.handleConfirm() || []
})
this.hideBrandPopup()
},
hideBrandPopup() {
this.setData({
popupShow: !this.data.popupShow
})
},
handleChooseBrand() {
// wx.$router.go('packageMine.carBrandList')
this.hideBrandPopup()
},
deleteBrand(e) {
let { pidx, cidx } = e.currentTarget.dataset
let { selectedBrandList } = this.data
selectedBrandList[pidx].children.splice(cidx, 1)
if (!selectedBrandList[pidx].children.length) {
selectedBrandList.splice(pidx, 1)
}
this.setData({
selectedBrandList
})
},
// 经纬度存在与否,不存在则通过ip获取
getLngLat(obj) {
return new Promise(resolve => {
if (obj.longitude && obj.latitude) {
resolve(obj)
} }
mapApi.getLocationByIp().then(res => {
let { location } = res
resolve({
longitude: location.lng,
latitude: location.lat
})
})
})
},
// 地图
handleMap() {
const _this = this
let { formData } = this.data
// wx.$router.go('packageMine.map', formData)
this.getLngLat(formData).then(location => {
this.setData({
['formData.latitude']: location.latitude,
['formData.longitude']: location.longitude,
})
wx.chooseLocation({
latitude: parseFloat(location.latitude),
longitude: parseFloat(location.longitude),
address: formData.merchantAddress || '',
success: function (res) {
// 逆地址解析
// 代码共6位,前两位代表省(一级)、中间两位为市/地区(二级),最后两位为区县(三级),区code获取省code和市code
mapApi.detailedAdrress([res.latitude, res.longitude]).then(obj => {
_this.setData({
['formData.latitude']: obj?.location?.lat,
['formData.longitude']: obj?.location?.lng,
['formData.provinceName']: obj?.ad_info?.province,
['formData.provinceCode']: obj?.ad_info?.adcode.slice(0, 2) + '0000',
['formData.cityName']: obj?.ad_info?.city,
['formData.cityCode']: obj?.ad_info?.adcode.slice(0, 4) + '00',
['formData.merchantAddress']: res?.name,
region: [obj?.ad_info?.province, obj?.ad_info?.city]
})
})
}
})
})
}, },
getProList(sceneCode) { getProList(sceneCode) {
...@@ -44,7 +159,7 @@ Page({ ...@@ -44,7 +159,7 @@ Page({
let target = scenceList.find(k => k.sceneCode == item) let target = scenceList.find(k => k.sceneCode == item)
if (addOrEdit == 'edit') { if (addOrEdit == 'edit') {
proList.forEach(k => { proList.forEach(k => {
if(proActList.includes(k.productCode)) { if (proActList.includes(k.productCode)) {
k.isCheck = true k.isCheck = true
} }
}) })
...@@ -65,7 +180,6 @@ Page({ ...@@ -65,7 +180,6 @@ Page({
} }
let proActList = [] let proActList = []
outputApi.getSceneProStatus(params).then(res => { outputApi.getSceneProStatus(params).then(res => {
console.log(res)
res.forEach(item => { res.forEach(item => {
item.productList.forEach(k => { item.productList.forEach(k => {
if (k.productStatus == 2) { if (k.productStatus == 2) {
...@@ -147,9 +261,26 @@ Page({ ...@@ -147,9 +261,26 @@ Page({
return { sceneList: sceneArr, productCodeList: arr } return { sceneList: sceneArr, productCodeList: arr }
}, },
dealBrandList() {
let { formData, selectedBrandList } = this.data
formData.merchantBrandList = []
selectedBrandList.forEach(item => {
formData.merchantBrandList.push({
merchantFirstBrandDetail: {
id: item.id,
name: item.name
},
merchantSecondBrandDetailList: item.children
})
})
this.setData({
formData
})
},
handleConfirm() { handleConfirm() {
let { userInfo } = wx.$storage.get() let { userInfo } = wx.$storage.get()
let { apiNameObj, addOrEdit, formData, isConfirm } = this.data let { apiNameObj, addOrEdit, formData, isConfirm, selectedBrandList } = this.data
let _this = this let _this = this
if (isConfirm) { if (isConfirm) {
return true return true
...@@ -162,10 +293,15 @@ Page({ ...@@ -162,10 +293,15 @@ Page({
wx.$api.showToast(validObj.message) wx.$api.showToast(validObj.message)
return return
} }
if(!selectedBrandList.length) {
wx.$api.showToast('至少选择一个主营品牌')
return
}
if (!formData.productCodeList.length) { if (!formData.productCodeList.length) {
wx.$api.showToast('请至少选择一个产品') wx.$api.showToast('请至少选择一个产品')
return return
} }
this.dealBrandList()
let message = addOrEdit == 'add' ? '是否确定提交客户开通申请?' : '是否确定修改客户?' let message = addOrEdit == 'add' ? '是否确定提交客户开通申请?' : '是否确定修改客户?'
delete formData.serviceCenterMerchantName delete formData.serviceCenterMerchantName
wx.showModal({ wx.showModal({
...@@ -190,7 +326,15 @@ Page({ ...@@ -190,7 +326,15 @@ Page({
productCodeList: formData.productCodeList, productCodeList: formData.productCodeList,
oldPhone: formData?.oldPhone, oldPhone: formData?.oldPhone,
oldMerchantName: formData.oldMerchantName, oldMerchantName: formData.oldMerchantName,
serviceMerchantName: userInfo.merchantName serviceMerchantName: userInfo.merchantName,
merchantBrandList: _this.data.formData.merchantBrandList,
longitude: formData.longitude,
latitude: formData.latitude,
provinceCode: formData.provinceCode,
provinceName: formData.provinceName,
cityCode: formData.cityCode,
cityName: formData.cityName,
merchantAddress: formData.merchantAddress,
} }
if (addOrEdit == 'edit') { if (addOrEdit == 'edit') {
params.merchantId = formData.merchantId params.merchantId = formData.merchantId
...@@ -226,6 +370,40 @@ Page({ ...@@ -226,6 +370,40 @@ Page({
}) })
}, },
infoToBrandList(list) {
let brandList = []
if (!list.length) {
return brandList
}
list.forEach(item => {
brandList.push({
id: item.id,
name: item.name,
logoUrl: item.logoUrl,
children: item.subList
})
})
return brandList
},
getMerchantInfo() {
let { formData } = this.data
let params = {
merchantId: formData.merchantId
}
const attrList = [{ name: 'provinceCode' }, { name: 'provinceName' }, { name: 'cityCode' }, { name: 'cityName' }, { name: 'merchantAddress' }, { name: 'latitude', attrName: 'lat' }, { name: 'longitude', attrName: 'lng' }]
mineServiceApi.getMerchantInfo(params).then(res => {
attrList.forEach(item => {
formData[item.name] = res[item.attrName || item.name]
})
this.setData({
formData,
selectedBrandList: this.infoToBrandList(res.brandTreeList || []),
region: [res?.provinceName, res?.cityName]
})
})
},
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
...@@ -253,6 +431,7 @@ Page({ ...@@ -253,6 +431,7 @@ Page({
yqMerchantName: target.serviceCenterMerchantName yqMerchantName: target.serviceCenterMerchantName
} }
}) })
this.getMerchantInfo()
this.getSceneProStatus() this.getSceneProStatus()
} else { } else {
this.getProList() this.getProList()
......
{ {
"navigationBarTitleText": "创建客户", "navigationBarTitleText": "创建客户",
"usingComponents": { "usingComponents": {
"select-service-confirm": "../../../components/selectServiceConfirm/selectServiceConfirm" "select-service-confirm": "../../../components/selectServiceConfirm/selectServiceConfirm",
"car-brand": "../../../components/CarBrand/CarBrand"
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -12,7 +12,8 @@ ...@@ -12,7 +12,8 @@
.form-content { .form-content {
background: #FFFFFF; background: #FFFFFF;
border-radius: 16rpx; border-radius: 16rpx;
padding: 44rpx 40rpx 200rpx; padding: 44rpx 40rpx;
margin-bottom: 16rpx;
.label { .label {
font-size: 28rpx; font-size: 28rpx;
...@@ -53,29 +54,129 @@ ...@@ -53,29 +54,129 @@
} }
} }
.addr {
.row {
height: 40rpx;
background: #F8F9FC;
border-radius: 12rpx;
padding: 28rpx 32rpx;
}
.province {
display: flex;
justify-content: space-between;
margin-bottom: 16rpx;
.placeholder {
color: #CCCED1;
}
.icon {
width: 36rpx;
height: 36rpx;
}
}
}
.disabled { .disabled {
background: #E1E2E6; background: #E1E2E6;
} }
} }
.brand {
// margin: 16rpx 0 200rpx;
padding: 32rpx 40rpx 40rpx;
.label {
display: flex;
justify-content: space-between;
align-items: center;
}
.label-btn {
font-size: 24rpx;
color: #3666FE;
}
.pBrand {
display: flex;
align-items: center;
width: 100%;
height: 40rpx;
line-height: 40rpx;
margin-bottom: 12rpx;
color: #6C737A;
.logo {
width: 40rpx;
height: 40rpx;
margin: 0 14rpx 0 0;
}
}
.cBrand {
display: flex;
flex-wrap: wrap;
.item {
position: relative;
display: flex;
align-items: center;
box-sizing: border-box;
flex-shrink: 1;
height: 64rpx;
background: #F0F7FF;
border-radius: 8rpx;
margin: 0 16rpx 16rpx 0;
padding: 10rpx 60rpx 10rpx 20rpx;
.logo {
position: absolute;
width: 28rpx;
height: 28rpx;
right: 10rpx;
top: 10rpx;
}
}
}
.add {
padding: 32rpx 0 8rpx;
text-align: center;
font-weight: 400;
font-size: 26rpx;
color: #3666FE;
.icon {
width: 56rpx;
height: 56rpx;
margin-bottom: 16rpx;
}
}
}
.bussiness {
padding-bottom: 200rpx;
}
.btn { .btn {
position: fixed; position: fixed;
bottom: 0; bottom: 16rpx;
left: 0; left: 0;
width: 100%; width: calc(100% - 64rpx);
height: 88rpx; height: 88rpx;
background-color: #FFFFFF;
line-height: 88rpx; line-height: 88rpx;
text-align: center; text-align: center;
font-size: 28rpx; font-size: 28rpx;
color: #FFFFFF; color: #FFFFFF;
margin: 0 32rpx;
} }
.btn-blue { .btn-blue {
width: calc(100% - 64rpx);
background: var(--btnColor); background: var(--btnColor);
border-radius: 8rpx; border-radius: 8rpx;
margin: 20rpx 32rpx 0;
} }
} }
......
...@@ -12,6 +12,59 @@ ...@@ -12,6 +12,59 @@
<view class="placeholder-text" wx:else>{{item.placeholder}}</view> <view class="placeholder-text" wx:else>{{item.placeholder}}</view>
<glsx-image src="personal/arrow_right.png" class="arrow_right" /> <glsx-image src="personal/arrow_right.png" class="arrow_right" />
</view> </view>
<view wx:if="{{item.type == 'map'}}" class="addr">
<picker mode="region" level="city" bindchange="bindRegionChange" value="{{region}}">
<!-- <picker mode="region" bindchange="bindRegionChange" value="{{region}}"> -->
<view class="row province">
<view wx:if="{{formData.provinceCode}}">{{region[0]}} {{region[1]}}</view>
<view class="placeholder" wx:else>请选择省市</view>
<glsx-image webp src="personal/icon-point.png" class="icon" catchtap="handleMap" />
</view>
</picker>
<input placeholder="请输入详细地址" maxlength="{{item.detailAddr.maxlength}}" class="row" value="{{formData[item.detailAddr.props]}}" disabled="{{item.detailAddr.disabled}}" data-attr="{{item.detailAddr.props}}" bindinput="handleInput" />
</view>
<view wx:if="{{item.type == 'business'}}">
<view wx:for="{{scenceList}}" wx:key="index" class="scene">
<view class="scene-item">
<image webp class="scene-img" src="{{IMGURL}}output/caracticon0{{item.sceneid + 1}}.png?v={{img_version}}"></image>
<view>{{item.name}}</view>
</view>
<view class="pro-box">
<view wx:for="{{item.proList}}" wx:for-item="subItem" wx:for-index="idx" wx:key="idx" class="pro-item {{subItem.isCheck ? 'active' : ''}}" bindtap="handleProClick" data-sceneIdx="{{index}}" data-proIdx="{{idx}}">
<glsx-image wx:if="{{subItem.isCheck}}" src="personal/scene-check.png" class="check-icon" />
{{subItem.productName}}
</view>
</view>
</view>
</view>
</block>
</view>
<view class="form-content brand">
<view class="label">主营品牌<text class="label-btn" wx:if="{{selectedBrandList.length}}" bindtap="handleChooseBrand">选择</text></view>
<view class="add" wx:if="{{!selectedBrandList.length}}" bindtap="handleChooseBrand">
<glsx-image src="index/apply.png" class="icon" />
<view>添加主营品牌</view>
</view>
<view wx:for="{{selectedBrandList}}" wx:key="index">
<view class="pBrand">
<image class="logo" src="{{item.logoUrl}}"></image>
{{item.name}}
</view>
<view class="cBrand">
<view wx:for="{{item.children}}" wx:for-item="subItem" wx:for-index="subIndex" wx:key="subIndex">
<view class="item">
{{subItem.name}}
<glsx-image src="personal/icon-delete.png" class="logo" catchtap="deleteBrand" data-pidx="{{index}}" data-cidx="{{subIndex}}" />
</view>
</view>
</view>
</view>
</view>
<view class="form-content bussiness">
<block wx:for="{{formItemsThird}}" wx:key="index">
<view class="label">{{item.label}}<text class="tips">{{item.tips}}</text></view>
<view wx:if="{{item.type == 'business'}}"> <view wx:if="{{item.type == 'business'}}">
<view wx:for="{{scenceList}}" wx:key="index" class="scene"> <view wx:for="{{scenceList}}" wx:key="index" class="scene">
<view class="scene-item"> <view class="scene-item">
...@@ -33,3 +86,7 @@ ...@@ -33,3 +86,7 @@
</view> </view>
</view> </view>
<select-service-confirm show="{{showServiceConfirm}}" tabBarStyle="{{tabBarStyle}}" serviceList="{{serviceList}}" selectInfo="{{formData.selectInfo}}" bind:hiddenSelectConfirm="hiddenSelectConfirm"></select-service-confirm> <select-service-confirm show="{{showServiceConfirm}}" tabBarStyle="{{tabBarStyle}}" serviceList="{{serviceList}}" selectInfo="{{formData.selectInfo}}" bind:hiddenSelectConfirm="hiddenSelectConfirm"></select-service-confirm>
<!-- 车品牌 -->
<popup show="{{popupShow}}" bind:hidePopup="hideBrandPopup" bindconfirm="brandConfirm" height="95%">
<car-brand id="car-brand" popupShow="{{popupShow}}" selectedList="{{selectedBrandList}}"></car-brand>
</popup>
\ No newline at end of file \ No newline at end of file
...@@ -18,6 +18,8 @@ const formRule = { ...@@ -18,6 +18,8 @@ const formRule = {
} }
} }
], ],
longitude: [{ required: true, message: '地址不能为空' }],
merchantAddress: [{ required: true, message: '详细地址不能为空' }],
} }
var formItems = [{ var formItems = [{
...@@ -53,7 +55,15 @@ var formItems = [{ ...@@ -53,7 +55,15 @@ var formItems = [{
showPwd: false, showPwd: false,
placeholder: '请输入登录密码(6-20位字母+数字)', placeholder: '请输入登录密码(6-20位字母+数字)',
maxlength: 20 maxlength: 20
}] }, {
label: '地址',
props: '',
type: 'map',
detailAddr: {
props: 'merchantAddress',
maxlength: 50
}
},]
export default { export default {
formRule, formRule,
......
// packageMine/pages/serviceManage/editService/editService.js // packageMine/pages/serviceManage/editService/editService.js
import constantData from './constant/data' import constantData from './constant/data'
import mineServiceApi from '~/api/mineApi/mineService' import mineServiceApi from '~/api/mineApi/mineService'
import mapApi from '~/utils/mapapi/mapapi'
Page({ Page({
/** /**
...@@ -8,13 +9,79 @@ Page({ ...@@ -8,13 +9,79 @@ Page({
*/ */
data: { data: {
addOrEdit: '', addOrEdit: '',
formData: {}, formData: {
merchantBrandList: []
},
formItems: constantData.formItems, formItems: constantData.formItems,
apiNameObj: { apiNameObj: {
'add': 'saveService', 'add': 'saveService',
'edit': 'updateService' 'edit': 'updateService'
}, },
isConfirm: false region: [],
isConfirm: false,
// 车品牌popup
popupShow: false,
selectedBrandList: []
},
// 地址解析(地址转坐标)https://apis.map.qq.com/ws/geocoder/v1/?address=
getGeocoder() {
let { formData } = this.data
// let address = formData.provinceName || '' + formData.cityName || '' + formData.merchantAddress || ''
let address = (formData.provinceName || '') + (formData.cityName || '')
mapApi.geocoder(address).then(res => {
this.setData({
['formData.longitude']: res?.location?.lng,
['formData.latitude']: res?.location?.lat,
})
})
},
// 省市改变
bindRegionChange(e) {
let { detail } = e
this.setData({
['formData.provinceName']: detail?.value[0],
['formData.provinceCode']: detail?.code[0],
['formData.cityName']: detail?.value[1],
['formData.cityCode']: detail?.code[1],
['formData.latitude']: '',
['formData.longitude']: '',
['formData.merchantAddress']: '',
region: detail?.value
})
this.getGeocoder()
},
brandConfirm() {
let brandMoudle = this.selectComponent('#car-brand')
this.setData({
selectedBrandList: brandMoudle && brandMoudle.handleConfirm() || []
})
this.hideBrandPopup()
},
hideBrandPopup() {
this.setData({
popupShow: !this.data.popupShow
})
},
handleChooseBrand() {
// wx.$router.go('packageMine.carBrandList')
this.hideBrandPopup()
},
deleteBrand(e) {
let { pidx, cidx } = e.currentTarget.dataset
let { selectedBrandList } = this.data
selectedBrandList[pidx].children.splice(cidx, 1)
if (!selectedBrandList[pidx].children.length) {
selectedBrandList.splice(pidx, 1)
}
this.setData({
selectedBrandList
})
}, },
handleInput(e) { handleInput(e) {
...@@ -32,6 +99,56 @@ Page({ ...@@ -32,6 +99,56 @@ Page({
}) })
}, },
// 经纬度存在与否,不存在则通过ip获取
getLngLat(obj) {
return new Promise(resolve => {
if (obj.longitude && obj.latitude) {
resolve(obj)
}
mapApi.getLocationByIp().then(res => {
let { location } = res
resolve({
longitude: location.lng,
latitude: location.lat
})
})
})
},
// 地图
handleMap() {
const _this = this
let { formData } = this.data
// wx.$router.go('packageMine.map', formData)
this.getLngLat(formData).then(location => {
this.setData({
['formData.latitude']: location.latitude,
['formData.longitude']: location.longitude,
})
wx.chooseLocation({
latitude: parseFloat(location.latitude),
longitude: parseFloat(location.longitude),
address: formData.merchantAddress || '',
success: function (res) {
// 逆地址解析
// 代码共6位,前两位代表省(一级)、中间两位为市/地区(二级),最后两位为区县(三级),区code获取省code和市code
mapApi.detailedAdrress([res.latitude, res.longitude]).then(obj => {
_this.setData({
['formData.latitude']: obj?.location?.lat,
['formData.longitude']: obj?.location?.lng,
['formData.provinceName']: obj?.ad_info?.province,
['formData.provinceCode']: obj?.ad_info?.adcode.slice(0, 2) + '0000',
['formData.cityName']: obj?.ad_info?.city,
['formData.cityCode']: obj?.ad_info?.adcode.slice(0, 4) + '00',
['formData.merchantAddress']: res?.name,
region: [obj?.ad_info?.province, obj?.ad_info?.city]
})
})
}
})
})
},
// 密码清空 // 密码清空
handlePwdClear(e) { handlePwdClear(e) {
let { attr } = e.currentTarget.dataset let { attr } = e.currentTarget.dataset
...@@ -40,9 +157,26 @@ Page({ ...@@ -40,9 +157,26 @@ Page({
}) })
}, },
dealBrandList() {
let { formData, selectedBrandList } = this.data
formData.merchantBrandList = []
selectedBrandList.forEach(item => {
formData.merchantBrandList.push({
merchantFirstBrandDetail: {
id: item.id,
name: item.name
},
merchantSecondBrandDetailList: item.children
})
})
this.setData({
formData
})
},
handleConfirm() { handleConfirm() {
let { userInfo } = wx.$storage.get() let { userInfo } = wx.$storage.get()
let { apiNameObj, addOrEdit, formData, isConfirm } = this.data let { apiNameObj, addOrEdit, formData, isConfirm, selectedBrandList } = this.data
let _this = this let _this = this
if (isConfirm) { if (isConfirm) {
return true return true
...@@ -52,6 +186,11 @@ Page({ ...@@ -52,6 +186,11 @@ Page({
wx.$api.showToast(validObj.message) wx.$api.showToast(validObj.message)
return return
} }
if(!selectedBrandList.length) {
wx.$api.showToast('至少选择一个主营品牌')
return
}
this.dealBrandList()
let message = addOrEdit == 'add' ? '是否确定提交服务中心开通申请?' : '是否确定修改服务中心信息?' let message = addOrEdit == 'add' ? '是否确定提交服务中心开通申请?' : '是否确定修改服务中心信息?'
wx.showModal({ wx.showModal({
title: '提示', title: '提示',
...@@ -67,7 +206,7 @@ Page({ ...@@ -67,7 +206,7 @@ Page({
wx.$api.showLoading('加载中...') wx.$api.showLoading('加载中...')
// 创建/编辑接口 // 创建/编辑接口
mineServiceApi[apiNameObj[addOrEdit]]({ mineServiceApi[apiNameObj[addOrEdit]]({
...formData, ..._this.data.formData,
serviceMerchantName: userInfo.merchantName serviceMerchantName: userInfo.merchantName
}).then(res => { }).then(res => {
let { code, message } = res let { code, message } = res
...@@ -94,6 +233,40 @@ Page({ ...@@ -94,6 +233,40 @@ Page({
}) })
}, },
infoToBrandList(list) {
let brandList = []
if (!list.length) {
return brandList
}
list.forEach(item => {
brandList.push({
id: item.id,
name: item.name,
logoUrl: item.logoUrl,
children: item.subList
})
})
return brandList
},
getMerchantInfo() {
let { formData } = this.data
let params = {
merchantId: formData.merchantId
}
const attrList = [{ name: 'provinceCode' }, { name: 'provinceName' }, { name: 'cityCode' }, { name: 'cityName' }, { name: 'merchantAddress' }, { name: 'latitude', attrName: 'lat' }, { name: 'longitude', attrName: 'lng' }, { name: 'password', attrName: 'merchantLoginPassword' }]
mineServiceApi.getMerchantInfo(params).then(res => {
attrList.forEach(item => {
formData[item.name] = res[item.attrName || item.name]
})
this.setData({
formData,
selectedBrandList: this.infoToBrandList(res.brandTreeList || []),
region: [res?.provinceName, res?.cityName]
})
})
},
dealFormItem() { dealFormItem() {
let { formItems } = this.data let { formItems } = this.data
if (this.data.addOrEdit == 'add') { if (this.data.addOrEdit == 'add') {
...@@ -102,6 +275,7 @@ Page({ ...@@ -102,6 +275,7 @@ Page({
formItems formItems
}) })
} else { } else {
this.getMerchantInfo()
wx.setNavigationBarTitle({ title: '编辑服务中心' }) wx.setNavigationBarTitle({ title: '编辑服务中心' })
} }
}, },
......
{ {
"navigationBarTitleText": "创建服务中心", "navigationBarTitleText": "创建服务中心",
"usingComponents": { "usingComponents": {
"input-icon": "/login/index/components/InputIcon/InputIcon" "input-icon": "/login/index/components/InputIcon/InputIcon",
"car-brand": "../../../components/CarBrand/CarBrand"
} }
} }
\ No newline at end of file \ No newline at end of file
/* packageMine/pages/serviceManage/editService/editService.wxss */ /* packageMine/pages/serviceManage/editService/editService.wxss */
.create-service-page { .create-service-page {
margin: 20rpx; margin: 20rpx;
overflow: scroll;
.tips { .tips {
padding: 12rpx; padding: 12rpx;
...@@ -69,6 +70,102 @@ ...@@ -69,6 +70,102 @@
white-space: nowrap; white-space: nowrap;
} }
} }
.addr {
.row {
height: 40rpx;
background: #F8F9FC;
border-radius: 12rpx;
padding: 28rpx 32rpx;
}
.province {
display: flex;
justify-content: space-between;
margin-bottom: 16rpx;
.placeholder {
color: #CCCED1;
}
.icon {
width: 36rpx;
height: 36rpx;
}
}
}
}
.brand {
margin: 16rpx 0 200rpx;
padding: 32rpx 40rpx 40rpx;
.label {
display: flex;
justify-content: space-between;
align-items: center;
}
.label-btn {
font-size: 24rpx;
color: #3666FE;
}
.pBrand {
display: flex;
align-items: center;
width: 100%;
height: 40rpx;
line-height: 40rpx;
margin-bottom: 12rpx;
color: #6C737A;
.logo {
width: 40rpx;
height: 40rpx;
margin: 0 14rpx 0 0;
}
}
.cBrand {
display: flex;
flex-wrap: wrap;
.item {
position: relative;
display: flex;
align-items: center;
box-sizing: border-box;
flex-shrink: 1;
height: 64rpx;
background: #F0F7FF;
border-radius: 8rpx;
margin: 0 16rpx 16rpx 0;
padding: 10rpx 60rpx 10rpx 20rpx;
.logo {
position: absolute;
width: 28rpx;
height: 28rpx;
right: 10rpx;
top: 10rpx;
}
}
}
.add {
padding: 32rpx 0 8rpx;
text-align: center;
font-weight: 400;
font-size: 26rpx;
color: #3666FE;
.icon {
width: 56rpx;
height: 56rpx;
margin-bottom: 16rpx;
}
}
} }
.btn { .btn {
......
...@@ -19,9 +19,44 @@ ...@@ -19,9 +19,44 @@
<view class="placeholder-text" wx:else>{{item.placeholder}}</view> <view class="placeholder-text" wx:else>{{item.placeholder}}</view>
<glsx-image src="personal/arrow_right.png" class="arrow_right" /> <glsx-image src="personal/arrow_right.png" class="arrow_right" />
</view> </view>
<view wx:if="{{item.type == 'map'}}" class="addr">
<picker mode="region" level="city" bindchange="bindRegionChange" value="{{region}}">
<!-- <picker mode="region" bindchange="bindRegionChange" value="{{region}}"> -->
<view class="row province">
<view wx:if="{{formData.provinceCode}}">{{region[0]}} {{region[1]}}</view>
<view class="placeholder" wx:else>请选择省市</view>
<glsx-image webp src="personal/icon-point.png" class="icon" catchtap="handleMap" />
</view>
</picker>
<input placeholder="请输入详细地址" maxlength="{{item.detailAddr.maxlength}}" class="row" value="{{formData[item.detailAddr.props]}}" disabled="{{item.detailAddr.disabled}}" data-attr="{{item.detailAddr.props}}" bindinput="handleInput" />
</view>
</block> </block>
</view> </view>
<view class="form-content brand">
<view class="label">主营品牌<text class="label-btn" wx:if="{{selectedBrandList.length}}" bindtap="handleChooseBrand">选择</text></view>
<view class="add" wx:if="{{!selectedBrandList.length}}" bindtap="handleChooseBrand">
<glsx-image src="index/apply.png" class="icon" />
<view>添加主营品牌</view>
</view>
<view wx:for="{{selectedBrandList}}" wx:key="index">
<view class="pBrand">
<image class="logo" src="{{item.logoUrl}}"></image>
{{item.name}}
</view>
<view class="cBrand">
<view wx:for="{{item.children}}" wx:for-item="subItem" wx:for-index="subIndex" wx:key="subIndex">
<view class="item">
{{subItem.name}}
<glsx-image src="personal/icon-delete.png" class="logo" catchtap="deleteBrand" data-pidx="{{index}}" data-cidx="{{subIndex}}" />
</view>
</view>
</view>
</view>
</view>
<view class="isFullSucreen btn"> <view class="isFullSucreen btn">
<view class="btn-blue" bindtap="handleConfirm">{{addOrEdit == 'add' ? '提交' : '保存'}}</view> <view class="btn-blue" bindtap="handleConfirm">{{addOrEdit == 'add' ? '提交' : '保存'}}</view>
</view> </view>
</view> </view>
<popup show="{{popupShow}}" bind:hidePopup="hideBrandPopup" bindconfirm="brandConfirm" height="95%">
<car-brand id="car-brand" popupShow="{{popupShow}}" selectedList="{{selectedBrandList}}"></car-brand>
</popup>
\ No newline at end of file \ No newline at end of file
...@@ -17,7 +17,7 @@ Page({ ...@@ -17,7 +17,7 @@ Page({
formData: { formData: {
selectedConnectionIds: [], selectedConnectionIds: [],
connectionValue: '全部', connectionValue: '全部',
visualType: 0 visualType: 0 // 0:全部 1:选中部分可见客户
}, },
showServiceConfirm: false, showServiceConfirm: false,
isConfirm: false isConfirm: false
...@@ -26,7 +26,7 @@ Page({ ...@@ -26,7 +26,7 @@ Page({
watch: { watch: {
'formData.selectInfo.yqMerchantId': function (e) { 'formData.selectInfo.yqMerchantId': function (e) {
// 获取当前服务中心下的客户列表 // 获取当前服务中心下的客户列表
this.getConnectionList(e) // this.getConnectionList(e)
let { optionsInfo } = this.data let { optionsInfo } = this.data
if (e == optionsInfo?.merchantNo) return if (e == optionsInfo?.merchantNo) return
// 将可见客户置为全部 // 将可见客户置为全部
...@@ -176,7 +176,7 @@ Page({ ...@@ -176,7 +176,7 @@ Page({
staffPhone: formData?.staffPhone, staffPhone: formData?.staffPhone,
createdSource: 3, // 创建来源 固定3 生意助手 createdSource: 3, // 创建来源 固定3 生意助手
visualType: formData?.visualType, visualType: formData?.visualType,
visibleMerchantNoList: formData?.visualType == 0 ? allConnectionIds : formData?.selectedConnectionIds visibleMerchantNoList: formData?.visualType == 0 ? undefined : formData?.selectedConnectionIds // 全部 无需传可见客户数据
} }
let message = addOrEdit == 'add' ? '是否确定创建员工?' : '是否确定修改员工信息?' let message = addOrEdit == 'add' ? '是否确定创建员工?' : '是否确定修改员工信息?'
wx.showModal({ wx.showModal({
......
// pages/viewProd/index.js // pages/viewProd/index.js
import { behavior as computedBehavior } from '~/utils/lib/miniprogram-computed' import { behavior as computedBehavior } from '~/utils/lib/miniprogram-computed'
import { IMG_URL } from "~/utils/constantData.js"; import { IMG_URL } from "~/utils/constantData.js";
import { scenceList } from '~/pages/tab/index/constant/data' // import { scenceList } from '~/pages/tab/index/constant/data'
import { senceData, productData } from '~/pages/tab/index/constant/senceData' // import { senceData, productData } from '~/pages/tab/index/constant/senceData'
import USERAPI from '~/api/usersApi/index' import USERAPI from '~/api/usersApi/index'
import utils from '~/utils/util.js' import utils from '~/utils/util.js'
import {getActiveApi} from "~/api/viewprod" import {getActiveApi} from "~/api/viewprod"
import {getDiscoverDetail} from "~/api/index.js"
Page({ Page({
/** /**
...@@ -28,7 +29,9 @@ Page({ ...@@ -28,7 +29,9 @@ Page({
// phone: '', //授权手机号 // phone: '', //授权手机号
prodItemVideo:'', //选中的场景下的video的第一个 prodItemVideo:'', //选中的场景下的video的第一个
activeUrl:'', // 1.3场景才有的活动配置 activeUrl:'', // 1.3场景才有的活动配置
sharephone:'' //主要微信用户,服务商 sharephone:'', //主要微信用户,服务商
productData: {}, // 场景详情数据
hasProduct: true
}, },
// 计算属性 // 计算属性
computed: { computed: {
...@@ -51,84 +54,113 @@ Page({ ...@@ -51,84 +54,113 @@ Page({
} }
}, },
// 获取产品详情
getProductDetail(id) {
return new Promise((resolve) => {
let _data;
getDiscoverDetail({id}).then((res) => {
console.log(res);
_data = res.data;
resolve(_data);
});
});
},
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
* 分享出去,或扫码进来 * 分享出去,或扫码进来
*/ */
onLoad(options) { async onLoad(options) {
this.getActiveApiFn() this.getActiveApiFn()
// 是否已经查看详情 // 是否已经查看详情
this.isgetAuthphone() this.isgetAuthphone()
if (!options || utils.isEmptyObj(options)) return if (!options || utils.isEmptyObj(options)) return
let { actNum, activeNavIdx, isShare,sharephone, sceneCode } = options // let { actNum, activeNavIdx, isShare,sharephone, sceneCode } = options
let { isShare,sharephone, sceneCode, id } = options
let proData = await this.getProductDetail(id);
// 1-上架;2-下架
if (!proData || proData?.status == 2) {
this.setData({
hasProduct: false
})
return
}
if(isShare){ if(isShare){
wx.hideHomeButton() wx.hideHomeButton()
} }
let sceneObj = {}
if(actNum != 99) {
sceneObj = scenceList.find(item => item.sceneid == actNum)
} else {
sceneObj = productData[99].find(item => item.sceneCode == sceneCode)
}
let proInfo = sceneObj?.productList.find(item => item.id == activeNavIdx)
this.setData({ this.setData({
actNum, //选中的场景下标/sceneid productData: proData,
activeNavIdx, //选中的产品
isShare, isShare,
sharephone sharephone
}); });
let userInfoObj = wx.$storage.get("userInfo");
// #服务商账号#取该分享者商户的联系人字段,无则取商户简称,无则取商户全称
let name = userInfoObj.merchantName;
this.shareTitle = `${name || ''}给你分享一个活动${proData?.proName},戳我参与~`;
// let sceneObj = {}
// if(actNum != 99) {
// sceneObj = scenceList.find(item => item.sceneid == actNum)
// } else {
// sceneObj = productData[99].find(item => item.sceneCode == sceneCode)
// }
// let proInfo = sceneObj?.productList.find(item => item.id == activeNavIdx)
// this.setData({
// actNum, //选中的场景下标/sceneid
// activeNavIdx, //选中的产品
// isShare,
// sharephone
// });
let wx_user_info = wx.$storage.get('wx_user_info'), let wx_user_info = wx.$storage.get('wx_user_info'),
shareOpenId = wx_user_info.openId || '' shareOpenId = wx_user_info.openId || ''
setTimeout(() => { setTimeout(() => {
utils.setNavigationBarTitle(proInfo?.productName) utils.setNavigationBarTitle(proData?.proName)
},100) },100)
this.shareQuery = `sceneCode=${sceneObj.sceneCode}&productCode=${proInfo?.productCode}&isShare=${true}&productDesc=${proInfo?.productName}&category=${proInfo?.category}&actNum=${actNum}&activeNavIdx=${activeNavIdx}&sharephone=${sharephone}` // this.shareQuery = `sceneCode=${sceneObj.sceneCode}&productCode=${proInfo?.productCode}&isShare=${true}&productDesc=${proInfo?.productName}&category=${proInfo?.category}&actNum=${actNum}&activeNavIdx=${activeNavIdx}&sharephone=${sharephone}`
console.log(this.shareQuery, 'onload----') this.shareQuery = `id=${id}&sceneCode=${sceneCode}&productCode=${proData?.productCode}&isShare=${true}&sharephone=${sharephone}`
this.shareTrackData = { // this.shareTrackData = {
sceneCode: sceneObj.sceneCode, // sceneCode: sceneObj.sceneCode,
productCode: proInfo?.productCode, // productCode: proInfo?.productCode,
productName: proInfo?.productName, // productName: proInfo?.productName,
category: proInfo?.category, // category: proInfo?.category,
productDesc: proInfo?.productName, // productDesc: proInfo?.productName,
shareOpenId: shareOpenId // shareOpenId: shareOpenId
// actNum, // // actNum,
// activeNavIdx, // // activeNavIdx,
} // }
console.log(this.shareTrackData, 'onload----shareTrackData')
}, },
//接受跳转的路由参数(小程序页面跳转) //接受跳转的路由参数(小程序页面跳转)
onRoute(options) { async onRoute(options) {
if (!options || utils.isEmptyObj(options)) return if (!options || utils.isEmptyObj(options)) return
let { actNum = 0, activeNavIdx = 0,phone=123, sceneid99=0 } = options; let { phone=123, id, sceneCode } = options;
let proData = await this.getProductDetail(id);
let data = actNum != 99 ? scenceList : productData[actNum] // 1-上架;2-下架
let value = actNum != 99 ? actNum : sceneid99 if (!proData || proData?.status == 2) {
let sceneObj = data.find(item => item.sceneid == value)
let proInfo = sceneObj?.productList.find(item => item.id == activeNavIdx)
this.setData({ this.setData({
actNum, //选中的场景下标 hasProduct: false
activeNavIdx, //选中的产品 })
sharephone:phone //联系电话 (登陆的用户) return
}
this.setData({
sharephone:phone, //联系电话 (登陆的用户)
productData: proData,
}); });
// 设置转发标题 // 设置转发标题
let userInfoObj = wx.$storage.get("userInfo"); let userInfoObj = wx.$storage.get("userInfo");
// #服务商账号#取该分享者商户的联系人字段,无则取商户简称,无则取商户全称 // #服务商账号#取该分享者商户的联系人字段,无则取商户简称,无则取商户全称
let name = userInfoObj.merchantName; let name = userInfoObj.merchantName;
this.shareTitle = `${name}给你分享一个活动${proInfo?.productName},戳我参与~`; this.shareTitle = `${name || ''}给你分享一个活动${proData?.proName},戳我参与~`;
//分享数据 //分享数据
// let item = this.data.proInfo || {} // let item = this.data.proInfo || {}
setTimeout(() => { setTimeout(() => {
utils.setNavigationBarTitle(proInfo?.productName) utils.setNavigationBarTitle(proData?.proName)
},100) },100)
//分享人openId //分享人openId
...@@ -136,20 +168,31 @@ Page({ ...@@ -136,20 +168,31 @@ Page({
shareOpenId = wx_user_info.openId || '' shareOpenId = wx_user_info.openId || ''
// &shareOpenId=${shareOpenId} // &shareOpenId=${shareOpenId}
this.shareQuery = `sceneCode=${sceneObj?.sceneCode}&productCode=${proInfo?.productCode}&isShare=${true}&productDesc=${proInfo?.productName}&category=${proInfo?.category}&actNum=${actNum}&activeNavIdx=${activeNavIdx}&sharephone=${phone}` // this.shareQuery = `sceneCode=${sceneObj?.sceneCode}&productCode=${proInfo?.productCode}&isShare=${true}&productDesc=${proInfo?.productName}&category=${proInfo?.category}&actNum=${actNum}&activeNavIdx=${activeNavIdx}&sharephone=${phone}`
this.shareQuery = `id=${id}&sceneCode=${sceneCode}&productCode=${proData?.productCode}&isShare=${true}&sharephone=${phone}`
console.log(this.shareQuery, 'onrouter----') console.log(this.shareQuery, 'onrouter----')
this.shareTrackData = { // this.shareTrackData = {
sceneCode: sceneObj?.sceneCode, // sceneCode: sceneObj?.sceneCode,
productCode: proInfo?.productCode, // productCode: proInfo?.productCode,
productName: proInfo?.productName, // productName: proInfo?.productName,
category: proInfo?.category, // category: proInfo?.category,
productDesc: proInfo?.productName, // productDesc: proInfo?.productName,
shareOpenId:shareOpenId // shareOpenId:shareOpenId
// actNum, // // actNum,
// activeNavIdx, // // activeNavIdx,
// apiData, // // apiData,
} // }
console.log(this.shareTrackData, 'onrouter----shareTrackData') // this.shareTrackData = {
// sceneCode: sceneCode,
// productCode: proData?.productCode,
// productName: proData?.productName,
// category: proData?.category,
// productDesc: proData?.productName,
// shareOpenId:shareOpenId
// // actNum,
// // activeNavIdx,
// // apiData,
// }
}, },
//获取配置url //获取配置url
...@@ -324,5 +367,5 @@ Page({ ...@@ -324,5 +367,5 @@ Page({
* 浏览埋点 * 浏览埋点
*/ */
onShareTimeline() {}, onShareTimeline() {},
onViewTrack: true onViewTrack: false
}); });
<!--packagesList/pages/productDetail/productDetail.wxml--> <!--packagesList/pages/productDetail/productDetail.wxml-->
<pro-detail id="pro-detail" showLeftFlag="{{showLeftFlag}}" sharephone="{{sharephone}}" actNum="{{actNum}}" activeNavIdx="{{activeNavIdx}}" activeUrl="{{activeUrl}}" bind:getUserInfo="getUserInfo"></pro-detail> <!-- <pro-detail id="pro-detail" showLeftFlag="{{showLeftFlag}}" sharephone="{{sharephone}}" actNum="{{actNum}}" activeNavIdx="{{activeNavIdx}}" activeUrl="{{activeUrl}}" bind:getUserInfo="getUserInfo"></pro-detail> -->
<block wx:if="{{!hasProduct}}">
<no-product></no-product>
</block>
<block wx:else>
<pro-detail id="pro-detail" showLeftFlag="{{showLeftFlag}}" sharephone="{{sharephone}}" proDetail="{{productData}}" bind:getUserInfo="getUserInfo"></pro-detail>
<!-- <block wx:if="{{showLeftFlag}}"> <!-- <block wx:if="{{showLeftFlag}}">
<button class="more-btn" bindgetphonenumber="getUserInfo" open-type="getPhoneNumber"> <button class="more-btn" bindgetphonenumber="getUserInfo" open-type="getPhoneNumber">
...@@ -10,3 +15,4 @@ ...@@ -10,3 +15,4 @@
<apply-button wx:if="{{!isShare}}" downShow="{{false}}"></apply-button> <apply-button wx:if="{{!isShare}}" downShow="{{false}}"></apply-button>
<!-- 授权昵称 --> <!-- 授权昵称 -->
<view wx:if="{{authNcknameShow}}" class="user-profile" bindtap="getUserProfile"></view> <view wx:if="{{authNcknameShow}}" class="user-profile" bindtap="getUserProfile"></view>
</block>
\ No newline at end of file \ No newline at end of file
// packagesList/pages/videoDetal/videoDetal.js // packagesList/pages/videoDetal/videoDetal.js
import { IMG_URL } from "~/utils/constantData.js"; import { IMG_URL } from "~/utils/constantData.js";
import { senceData, productData } from "~/pages/tab/index/constant/senceData"; // import { senceData, productData } from "~/pages/tab/index/constant/senceData";
// 导入方法 // 导入方法
import { behavior as computedBehavior } from "~/utils/lib/miniprogram-computed"; import { behavior as computedBehavior } from "~/utils/lib/miniprogram-computed";
import utils from '~/utils/util.js' import utils from '~/utils/util.js'
import { getDetailWithLike, getContentList } from "~/api/index.js"
Page({ Page({
noPageAuth: true, noPageAuth: true,
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
senceData, // senceData,
productData, // productData,
videoItem: { videoItem: {
index: 0, index: 0,
videoList: [], videoList: [],
...@@ -20,102 +21,162 @@ Page({ ...@@ -20,102 +21,162 @@ Page({
tabsActive: 1 tabsActive: 1
}, },
videoObj: {}, videoObj: {},
showAuth: false showAuth: false,
videoData: {},
videoId: '',
hasProduct: true
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { async onLoad(options) {
wx.$router.getData(res => { if (utils.isEmptyObj(options)) return
const { id, isShare, typeId, isDigitalCase, tabsActive } = options;
let videoLikeList = [];
let videoData = await this.getDetailWithLike(id);
videoLikeList = videoData.likeList
// 判断是不是在数字化转型案例菜单下
if (isDigitalCase == 'true') {
// 调接口获取当前一级菜单下所有视频
videoLikeList = await this.getVideoLikeList(typeId, tabsActive);
this.setData({ this.setData({
videoItem: res isDigitalCase: true
}) })
})
if (!utils.isEmptyObj(options)) {
let { isShare, videoIndex, tabActive, sceneCode, leftMenuIndex = 0, tabsActive } = options;
let item = this.data.productData[tabActive].find(item => item.sceneCode == sceneCode)
let videoList = []
let videoUrl = ''
let videoObj = {}
if (tabsActive === '3') {
videoList = item?.operationVideoList
videoUrl = item?.operationVideoList[videoIndex]?.videoUrl
videoObj = item?.operationVideoList[videoIndex]
} else {
videoList = item?.videoList,
videoUrl = item.videoList[videoIndex]?.videoUrl
videoObj = item?.videoList[videoIndex]
}
let videoItem = {
index: videoIndex,
videoList: videoList,
videoUrl: videoUrl,
tabsActive: tabsActive
} }
// 1-上架;2-下架
if (!videoData || videoData?.status == 2) {
this.setData({ this.setData({
videoItem: videoItem, isLoadding: false,
isShare: isShare, hasProduct: false
videoObj: videoObj,
leftMenuIndex: leftMenuIndex
}) })
this.setpagesTitle() return
this.shareDataFn(options)
} }
this.setData({
videoData,
videoLikeList,
videoId: id,
isShare,
isLoadding: false,
typeId,
tabsActive
});
this.setpagesTitle(videoData.proName)
this.changeShareData()
}, },
//接受跳转的路由参数(小程序页面跳转) //接受跳转的路由参数(小程序页面跳转)
onRoute(options) { async onRoute(options) {
if (!options || utils.isEmptyObj(options)) return if (!options || utils.isEmptyObj(options)) return
let { scenIndex, videoList, index, leftMenuIndex = 0 } = options let { id, sceneCode, typeId, tabsActive } = options;
options.videoIndex = index let videoLikeList = [];
options.tabActive = scenIndex
let videoData = await this.getDetailWithLike(id);
videoLikeList = videoData.likeList
// 判断是不是在数字化转型案例菜单下
if (!sceneCode) {
// 调接口获取当前一级菜单下所有视频
videoLikeList = await this.getVideoLikeList(typeId,tabsActive);
this.setData({ this.setData({
videoObj: videoList[index], isDigitalCase: true
leftMenuIndex: leftMenuIndex
}) })
this.setpagesTitle() }
this.shareDataFn(options) // 1-上架;2-下架
},// 分享数据函数 if (!videoData || videoData?.status == 2) {
shareDataFn(options) {
if (!options || utils.isEmptyObj(options)) return
let { tabActive, videoIndex, tabsActive } = options
this.setData({ this.setData({
tabsActive, isLoadding: false,
tabActive: tabActive, hasProduct: false
videoIndex: videoIndex, })
}, () => { return
//分享的数据 }
this.setData({
videoData,
videoLikeList,
isLoadding: false,
videoId: id,
sceneCode,
typeId,
tabsActive
});
this.setpagesTitle(videoData.proName)
this.changeShareData() this.changeShareData()
},
// 获取一级菜单下所有视频
getVideoLikeList(id,type) {
return new Promise((resolve) => {
let _data;
let params = {
menuId: id,
// 内容专区(1:特色产品,2:案例视频,3:营销海报,4:操作指引,5:banner)
type: type == 1 ? 2 : 4
}
getContentList(params).then((res) => {
_data = res.data;
resolve(_data);
});
});
},
// 获取视频详情
getDetailWithLike(id) {
return new Promise((resolve) => {
let _data;
getDetailWithLike({ id }).then((res) => {
_data = res.data;
resolve(_data);
});
}); });
}, },
// 分享数据函数
// shareDataFn(options) {
// if (!options || utils.isEmptyObj(options)) return
// let { tabActive, videoIndex, tabsActive } = options
// this.setData({
// tabsActive,
// tabActive: tabActive,
// videoIndex: videoIndex,
// }, () => {
// //分享的数据
// this.changeShareData()
// });
// },
changeShareData() { changeShareData() {
let { senceData, tabActive, videoIndex, videoObj, leftMenuIndex = 0, tabsActive } = this.data // let { senceData, tabActive, videoIndex, videoObj, leftMenuIndex = 0, tabsActive } = this.data
// // 设置转发标题 // // 设置转发标题
// let userInfoObj = wx.$storage.get("userInfo"); // let userInfoObj = wx.$storage.get("userInfo");
// // #服务商账号#取该分享者商户的联系人字段,无则取商户简称,无则取商户全称 // // #服务商账号#取该分享者商户的联系人字段,无则取商户简称,无则取商户全称
// let name = userInfoObj.merchantName; // let name = userInfoObj.merchantName;
this.shareTitle = `给您分享一个${videoObj.name} 视频`; let { proName } = this.data.videoData
let { sceneCode, videoId, isDigitalCase, typeId, tabsActive } = this.data
this.shareTitle = `给您分享一个${proName} 视频`;
//分享的数据 //分享的数据
let senceItem = productData[tabActive][leftMenuIndex] // let senceItem = productData[tabActive][leftMenuIndex]
this.shareQuery = `sceneCode=${senceItem?.sceneCode}&isShare=${true}&tabActive=${tabActive}&videoIndex=${videoIndex}&leftMenuIndex=${leftMenuIndex}&tabsActive=${tabsActive}` // this.shareQuery = `sceneCode=${senceItem?.sceneCode}&isShare=${true}&tabActive=${tabActive}&videoIndex=${videoIndex}&leftMenuIndex=${leftMenuIndex}&tabsActive=${tabsActive}`
this.shareQuery = `sceneCode=${sceneCode}&isShare=${true}&id=${videoId}&isDigitalCase=${isDigitalCase}&typeId=${typeId}&tabsActive=${tabsActive}`
}, },
// 切换视频 // 切换视频
chooseVideo(e) { async chooseVideo(e) {
let { detail } = e // let { detail } = e
// this.setData({
// videoIndex: detail.index,
// ['videoItem.index']: detail.index,
// ['videoItem.videoUrl']: detail?.info?.videoUrl,
// videoObj: detail?.info
// })
const { proName, id } = e.detail
let videoData = await this.getDetailWithLike(id)
this.setData({ this.setData({
videoIndex: detail.index, videoId: id,
['videoItem.index']: detail.index, videoData
['videoItem.videoUrl']: detail?.info?.videoUrl,
videoObj: detail?.info
}) })
this.setpagesTitle() this.setpagesTitle(proName)
this.changeShareData() this.changeShareData()
}, },
// 下载视频 // 下载视频
downVideo() { downVideo() {
const _this = this const _this = this
let { videoObj } = this.data // let { videoObj } = this.data
let url = videoObj.videoUrl // let url = videoObj.videoUrl
let { videoId } = this.data
const { vedioUrl } = this.data.videoLikeList.find(item => item.id == videoId)
wx.getSetting({ wx.getSetting({
success: (res) => { success: (res) => {
if (res.authSetting['scope.writePhotosAlbum'] === false) { if (res.authSetting['scope.writePhotosAlbum'] === false) {
...@@ -125,7 +186,7 @@ Page({ ...@@ -125,7 +186,7 @@ Page({
} else { } else {
wx.$api.showToast('正在下载视频...') wx.$api.showToast('正在下载视频...')
wx.downloadFile({ wx.downloadFile({
url: url, url: vedioUrl,
success(res) { success(res) {
if (res.statusCode === 200) { if (res.statusCode === 200) {
wx.saveVideoToPhotosAlbum({ wx.saveVideoToPhotosAlbum({
...@@ -162,11 +223,10 @@ Page({ ...@@ -162,11 +223,10 @@ Page({
*/ */
onReady() { }, onReady() { },
//设置标题 //设置标题
setpagesTitle() { setpagesTitle(title) {
//设置标题 //设置标题
let { videoObj } = this.data
setTimeout(() => { setTimeout(() => {
utils.setNavigationBarTitle(videoObj.name) utils.setNavigationBarTitle(title)
}, 100) }, 100)
}, },
......
<!--packagesList/pages/videoDetal/videoDetal.wxml--> <!--packagesList/pages/videoDetal/videoDetal.wxml-->
<gl-video-detail list="{{videoItem.videoList}}" index="{{videoItem.index}}" bindchooseVideo="chooseVideo"></gl-video-detail> <!-- <gl-video-detail list="{{videoItem.videoList}}" index="{{videoItem.index}}" bindchooseVideo="chooseVideo"></gl-video-detail> -->
<block wx:if="{{!hasProduct}}">
<no-product></no-product>
</block>
<block wx:else>
<gl-video-detail list="{{videoData}}" likeList="{{videoLikeList}}" bindchooseVideo="chooseVideo"></gl-video-detail>
<!-- 申请按钮 --> <!-- 申请按钮 -->
<apply-button wx:if="{{!isShare}}" bindvideodown="downVideo"></apply-button> <apply-button wx:if="{{!isShare}}" bindvideodown="downVideo"></apply-button>
<block wx:if="{{showAuth}}"> <block wx:if="{{showAuth}}">
<authorize title="下载前需要获取您的‘添加到相册’权限,是否打开授权设置?" scopeType="writePhotosAlbum" buttonType="openSetting" bindfail="authFail" bindsuccess="authSuccess" show="{{showAuth}}"></authorize> <authorize title="下载前需要获取您的‘添加到相册’权限,是否打开授权设置?" scopeType="writePhotosAlbum" buttonType="openSetting" bindfail="authFail" bindsuccess="authSuccess" show="{{showAuth}}"></authorize>
</block> </block>
</block>
\ No newline at end of file \ No newline at end of file
...@@ -3,9 +3,9 @@ import { IMG_URL } from '~/utils/constantData.js' ...@@ -3,9 +3,9 @@ import { IMG_URL } from '~/utils/constantData.js'
// import Util from '~/utils/util.js' // import Util from '~/utils/util.js'
import { deleteSecond } from '~/utils/format' import { deleteSecond } from '~/utils/format'
// import { senceData } from './constant/data' // import { senceData } from './constant/data'
import { scenceList } from './constant/data' // import { scenceList } from './constant/data'
// import { senceData, productData } from './constant/senceData' // import { senceData, productData } from './constant/senceData'
import { subscriptionBannerUrl, subscriptionSystemData } from './constant/systemData' // import { subscriptionBannerUrl, subscriptionSystemData } from './constant/systemData'
import { getMockData } from '~/api/api' import { getMockData } from '~/api/api'
const IMAGES = Object.freeze({ const IMAGES = Object.freeze({
arrow: `${IMG_URL}/index/point.png`, arrow: `${IMG_URL}/index/point.png`,
...@@ -36,6 +36,8 @@ Page({ ...@@ -36,6 +36,8 @@ Page({
// navList: ['看线索', '看产品'], // navList: ['看线索', '看产品'],
navList: ["看产品", "客户数字化"], navList: ["看产品", "客户数字化"],
isShowService: false, isShowService: false,
navBarBoxStyle: "justify-content: start;",
navTitleStyle: "width: 80%",
// 固定按钮 // 固定按钮
btnList: [ btnList: [
...@@ -77,7 +79,7 @@ Page({ ...@@ -77,7 +79,7 @@ Page({
isFirst: true, isFirst: true,
// tabList: pageData.tabList, // tabList: pageData.tabList,
// 定义数据 // 定义数据
scenceList, // scenceList,
// senceData, // senceData,
isShow: false, isShow: false,
// productData, // productData,
...@@ -88,43 +90,42 @@ Page({ ...@@ -88,43 +90,42 @@ Page({
headerHeight: 0, headerHeight: 0,
unreadClueCount: 0, unreadClueCount: 0,
img_version: "0.1.1", img_version: "0.1.1",
subscriptionBannerUrl: Object.freeze(subscriptionBannerUrl), // subscriptionBannerUrl: Object.freeze(subscriptionBannerUrl),
subscriptionSystemData: Object.freeze(subscriptionSystemData), // subscriptionSystemData: Object.freeze(subscriptionSystemData),
systemData: [],
productData: [],
}, },
proClick(e) { proClick(e) {
let { detail } = e; // let { detail } = e;
//登录的用户手机号 // //登录的用户手机号
// let userInfo = wx.$storage.get("userInfo");
// let obj = {
// actNum: isNaN(detail.scenIndex) ? 99 : detail.scenIndex, //选中的场景 没有就是订阅系统的
// sceneid99: detail.sceneid,
// activeNavIdx: detail.id, //选中的产品,
// phone: userInfo.phone,
// };
let userInfo = wx.$storage.get("userInfo"); let userInfo = wx.$storage.get("userInfo");
const { info, sceneCode } = e.detail
let obj = { let obj = {
actNum: isNaN(detail.scenIndex) ? 99 : detail.scenIndex, //选中的场景 没有就是订阅系统的
sceneid99: detail.sceneid,
activeNavIdx: detail.id, //选中的产品,
phone: userInfo.phone, phone: userInfo.phone,
}; id:info.id,
sceneCode
}
wx.$router.go("/packagesList/pages/productDetail/productDetail", obj); wx.$router.go("/packagesList/pages/productDetail/productDetail", obj);
}, },
// 跳转视频详情 // 跳转视频详情
videoClick(e) { videoClick(e) {
const { name } = e.target.dataset; const { info, sceneCode } = e.detail
const {
index,
info: { videoUrl },
scenIndex,
list,
tabsActive,
} = e.detail;
const videoList = list;
let userInfo = wx.$storage.get("userInfo"); let userInfo = wx.$storage.get("userInfo");
// 一级菜单ID
const typeId = this.data.tabIndx == 0 ? this.data.productDataId : this.data.systemDataId
const obj = { const obj = {
index,
videoList,
scenIndex: isNaN(scenIndex) ? 99 : scenIndex,
videoUrl: videoUrl,
phone: userInfo.phone, phone: userInfo.phone,
tabsActive, id: info.info.id,
}; tabsActive: info.tabsActive,
if (name == "客户数字化") { sceneCode,
obj.leftMenuIndex = leftMenuIndex; typeId
} }
wx.$router.go("/packagesList/pages/videoDetal/videoDetal", obj); wx.$router.go("/packagesList/pages/videoDetal/videoDetal", obj);
}, },
...@@ -145,12 +146,23 @@ Page({ ...@@ -145,12 +146,23 @@ Page({
// phone: userInfo.phone, // phone: userInfo.phone,
// }; // };
// wx.$router.go("/pages/viewProdBanner/index", obj); // wx.$router.go("/pages/viewProdBanner/index", obj);
const { scenIndex } = e.detail; // const { scenIndex } = e.detail;
// let userInfo = wx.$storage.get("userInfo");
// wx.$router.go("/packagesList/pages/scenarioDetail/scenarioDetail", {
// actNum: scenIndex,
// phone: userInfo.phone,
// });
// 如果没有sceneCode,或者没有配置banner跳转 isBannerLink 1-有配置 2-没有配置
if (!e.detail.sceneCode || e.detail.isBannerLink == 2) return
let userInfo = wx.$storage.get("userInfo"); let userInfo = wx.$storage.get("userInfo");
wx.$router.go("/packagesList/pages/scenarioDetail/scenarioDetail", { // 获取场景
actNum: scenIndex, let systemItem = this.data.systemData.find(item => item.sceneCode == e.detail.sceneCode)
phone: userInfo.phone, let productItem = this.data.productData.find(item => item.sceneCode == e.detail.sceneCode)
}); // const id = systemItem?.productList[0].id || productItem?.productList[0].id
let obj = systemItem || productItem
const id = obj?.subList.length ? obj?.subList[0]?.productList[0]?.id : obj?.productList[0]?.id
if (!id) return
wx.$router.go('/packagesList/pages/productDetail/productDetail', { phone: userInfo.phone, id })
}, },
// 获取全部活动列表 // 获取全部活动列表
getActivityRecord() { getActivityRecord() {
...@@ -241,13 +253,6 @@ Page({ ...@@ -241,13 +253,6 @@ Page({
openBus() { openBus() {
wx.$router.go("/packagesList/apply/pages/apply"); wx.$router.go("/packagesList/apply/pages/apply");
}, },
// 开通产品
// openPro() {
// let obj = {
// scene:3
// }
// wx.$router.go("/packagesList/applyProd/pages/apply",obj);
// },
// 预估产值 // 预估产值
showCalculate() { showCalculate() {
wx.$router.go("measure"); wx.$router.go("measure");
...@@ -256,143 +261,6 @@ Page({ ...@@ -256,143 +261,6 @@ Page({
// isReset: false // isReset: false
// }) // })
}, },
// clickDialog(e) {
// // console.log(e.changedTouches[0].clientY)
// if (e.changedTouches[0].clientY < 352) {
// this.setData({
// visible: false,
// isReset: false,
// formData: this.data.lastFormData
// })
// }
// },
// 提交测算
// submit(e) {
// let sales = e ? +e.detail.value.sales : this.data.formData.sales
// let flow = e ? +e.detail.value.flow : this.data.formData.flow
// // console.log('flow', sales, flow)
// const reg = /^[1-9]\d*$/
// // console.log(reg.test(sales), flow, '---')
// if (!reg.test(sales)) {
// wx.showToast({
// title: '门店月平均新车销量应为正整数',
// icon: 'none',
// duration: 2000
// })
// return
// }
// if (!reg.test(flow)) {
// wx.showToast({
// title: '3年内售后存量用户应为正整数',
// icon: 'none',
// duration: 2000
// })
// return
// }
// this.setData({
// 'lastFormData.sales': sales,
// 'lastFormData.flow': flow
// })
// const _this = this
// this.data.senceData.forEach((item, index) => {
// item.productList.forEach((i, lastIndex) => {
// if (i.profit) {
// let sale = `senceData[${index}].productList[${lastIndex}].sale`
// let name = `senceData[${index}].productList[${lastIndex}].profit`
// let flowKey = `senceData[${index}].productList[${lastIndex}].flow`
// let profit = _this.formula(i.productType, sales, flow)
// // console.log(name, profit)
// this.setData({
// [name]: profit,
// [sale]: sales,
// [flowKey]: flow
// })
// }
// })
// })
// // 触发自定义事件 利润 数量
// // this.triggerEvent('countProfit', profit, sales)
// // let type = this.getProductType(sceneIndex, tabIndex);
// // let profit = this.formula(type, sales, flow);
// // console.log('profit: ', profit);
// this.setData({
// visible: false
// })
// // this.showCase();
// // if (!this.data.isFirst) {
// wx.showToast({
// title: '测算结果已在页面内同步展示',
// icon: 'none',
// duration: 2000
// })
// // } else {
// // this.setData({
// // isFirst: false
// // })
// // }
// },
// // 获取场景下的产品类型
// getProductType(sceneIndex, tabIndex) {
// let typeArray = [
// ["benefitCard"], //数字无忧权益卡
// ["sunMembrane"], //汽车太阳膜
// ["protectMembrane", "colorMembrane"], //'漆面保护膜','改色膜'
// ["digitBeauty", "chair", "ar", "lamp", "navigation"], //'数字化美容','座椅通风','AR导航','氛围灯','360全景导航'
// ];
// return typeArray[sceneIndex][tabIndex];
// },
// 计算公式,参数:productType
// formula(productType, sales, flow) {
// let profit = 0
// switch (productType) {
// case 'benefitCard':
// // 数字无忧权益卡
// profit = (sales * 0.5 * 2000 * 12).toFixed(0)
// break
// case 'sunMembrane':
// // 汽车太阳膜
// profit = (sales * 0.8 * 0.7 * 1500 * 12).toFixed(0)
// break
// case 'protectMembrane':
// // 漆面保护膜
// profit = (sales * 0.05 * 3000 * 12).toFixed(0)
// break
// case 'colorMembrane':
// // 改色膜
// profit = (sales * 0.05 * 5000 * 12).toFixed(0)
// break
// case 'digitBeauty':
// // 数字化美容
// profit = (sales * 0.2 * 300 * 12).toFixed(0)
// break
// case 'chair':
// // 座椅通风
// profit = (flow * 2580 * 0.9 * 0.01).toFixed(0)
// break
// case 'ar':
// // AR导航
// profit = (flow * 1680 * 0.9 * 0.015).toFixed(0)
// break
// case 'lamp':
// // 氛围灯
// profit = (flow * 2680 * 0.9 * 0.015).toFixed(0)
// break
// case 'navigation':
// // 360全景导航
// profit = (flow * 2880 * 0.9 * 0.015).toFixed(0)
// break
// }
// // console.log(profit.length)
// // console.log(productType, sales, flow, profit)
// if (profit.length > 9) {
// return (profit / 10000).toFixed(0) + '万'
// } else {
// return profit
// }
// },
// reset() { // reset() {
// this.setData({ // this.setData({
// isReset: false, // isReset: false,
...@@ -430,6 +298,20 @@ Page({ ...@@ -430,6 +298,20 @@ Page({
this.getProductByscene(); this.getProductByscene();
// // 看线索 // // 看线索
// this.getClueInit() // this.getClueInit()
// 获取看产值数据
const app = getApp()
app.getBaseData().then(res => {
const productData = res[0].subList
const systemData = res[1].subList
this.setData({
systemData,
systemDataId: res[1].id,
productData,
productDataId: res[0].id,
['navList[0]']: res[0].name || '看产品',
['navList[1]']: res[1].name || '客户数字化'
})
})
this.setData({ this.setData({
productData: this.addAll(this.data.productData), productData: this.addAll(this.data.productData),
......
...@@ -10,6 +10,14 @@ page { ...@@ -10,6 +10,14 @@ page {
color: transparent; color: transparent;
} }
.sub-menu-active-custom {
background: #F0F4FF !important;
color: #3666FE !important;
}
.sidebar-active-custom::after {
background: #3666FE !important;
}
.reclaim { .reclaim {
background: #fff; background: #fff;
......
<wxs src="./index.wxs" module="filterUtils" /> <wxs src="./index.wxs" module="filterUtils" />
<navigation-bar bindnavbarReady="navbarReady" navStyle="{{navStyle}}"> <navigation-bar bindnavbarReady="navbarReady" navStyle="{{navStyle}}" navBarBoxStyle="{{navBarBoxStyle}}" navTitleStyle="{{navTitleStyle}}">
<tab tab="{{navList}}" itemWidth="{{'38%'}}" index="{{tabIndx}}" tabHeight unreadClueCount="{{unreadClueCount}}" bindclick="changeTabIndx" class="tabContainer" /> <tab tab="{{navList}}" itemWidth="{{'40%'}}" index="{{tabIndx}}" tabHeight unreadClueCount="{{unreadClueCount}}" bindclick="changeTabIndx" class="tabContainer" />
</navigation-bar> </navigation-bar>
<view class="reclaim"> <view class="reclaim">
<!-- 头部 --> <!-- 头部 -->
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
headerHeight="{{headerHeight}}" headerHeight="{{headerHeight}}"
bindrefresherrefresh="refresherrefresh" /> --> bindrefresherrefresh="refresherrefresh" /> -->
<block wx:if="{{tabIndx == 0}}"> <block wx:if="{{tabIndx == 0}}">
<gl-scenario currentScenIndex="{{3}}" discoverIndex="{{2}}" list="{{scenceList}}" activityList="{{activityList}}" bindactivityClick="activityClick" bindproClick="proClick" bind:videoClick="videoClick" bindsenceClick="senceClick" bindleftClick="leftClick"></gl-scenario> <gl-scenario list="{{productData}}" activityList="{{activityList}}" sub-menu-active-custom="sub-menu-active-custom" sidebar-active-custom="sidebar-active-custom" bindactivityClick="activityClick" bindproClick="proClick" bind:videoClick="videoClick" bindsenceClick="senceClick" bindleftClick="leftClick"></gl-scenario>
</block> </block>
<!-- 看线索内容 --> <!-- 看线索内容 -->
<!-- <indexClue <!-- <indexClue
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
bindshowToggleToast="showToggleToast" /> --> bindshowToggleToast="showToggleToast" /> -->
<!-- <view wx:if="{{tabIndx == 1}}">客户数字化</view> --> <!-- <view wx:if="{{tabIndx == 1}}">客户数字化</view> -->
<block wx:if="{{tabIndx == 1}}"> <block wx:if="{{tabIndx == 1}}">
<gl-subscription list="{{subscriptionSystemData}}" bindmenuClick="sysMenuClick" bannerUrl="{{subscriptionBannerUrl}}" bind:proClick="proClick" bind:videoClick="videoClick" bindcurrentScen="getCurrentScen" data-name="客户数字化" /> <gl-subscription list="{{systemData}}" bindmenuClick="sysMenuClick" bind:proClick="proClick" bind:videoClick="videoClick" bindcurrentScen="getCurrentScen" bindsenceClick="senceClick" data-name="客户数字化" />
</block> </block>
</view> </view>
<!-- 收藏、取消提示框 --> <!-- 收藏、取消提示框 -->
...@@ -51,47 +51,6 @@ ...@@ -51,47 +51,6 @@
<!-- 加微 --> <!-- 加微 -->
<service wx:if="{{isShowService}}" isFixed="{{false}}"></service> <service wx:if="{{isShowService}}" isFixed="{{false}}"></service>
</view> </view>
<!-- 预估产值弹框 -->
<!-- <view class="dialog-wrapper" bindtap="clickDialog" hidden="{{!visible}}">
<view class="dialog-box">
<form bindsubmit="submit">
<view class="dialog-header">
<view wx:if="{{!isReset}}" class="header-btn btn-gray" bindtap="showCalculate">取消</view>
<view wx:if="{{isReset}}" class="header-btn btn-gray" bindtap="reset">重置</view>
<button class="header-btn btn-primary" form-type="submit">确定</button>
</view>
<view class="dialog-content">
<view class="dialog-title">输入您门店的基本情况</view>
<view class="dialog-form">
<view class="form-item">
<view class="form-label">门店月平均新车销量</view>
<input
class="form-input"
bindfocus="focus"
maxlength="8"
name="sales"
cursor-spacing="10"
value="{{formData.sales}}"
type="number" />
</view>
<view class="form-item">
<view class="form-label">3年内售后存量用户</view>
<input
class="form-input"
bindfocus="focus"
maxlength="8"
name="flow"
type="number"
cursor-spacing="10"
value="{{formData.flow}}" />
</view>
<button class="dialog-btn" form-type="submit">提交测算</button>
</view>
</view>
</form>
</view>
</view> -->
<!-- -->
<crowdfund-poster wx:if="{{!guideShow}}" item="{{posterItem}}" /> <crowdfund-poster wx:if="{{!guideShow}}" item="{{posterItem}}" />
<!-- 全屏视频组件 --> <!-- 全屏视频组件 -->
<!-- <FullscreenVideo id="videocomp" src="{{videoSrc}}" title="{{videoTitle}}" /> --> <!-- <FullscreenVideo id="videocomp" src="{{videoSrc}}" title="{{videoTitle}}" /> -->
\ No newline at end of file \ No newline at end of file
...@@ -18,7 +18,8 @@ export const STORAGE_OBJECTkEY = { ...@@ -18,7 +18,8 @@ export const STORAGE_OBJECTkEY = {
disLikeRecordFlag: 'disLikeRecordFlag', disLikeRecordFlag: 'disLikeRecordFlag',
fileList: 'fileList', fileList: 'fileList',
posterId: 'posterId', posterId: 'posterId',
mock_data: 'mock_data' mock_data: 'mock_data',
car_brand_list: 'car_brand_list'
} }
export const IMG_VERSION = () => { export const IMG_VERSION = () => {
......
...@@ -25,7 +25,7 @@ const systemInfo = wx.getSystemInfoSync() ...@@ -25,7 +25,7 @@ const systemInfo = wx.getSystemInfoSync()
const manual = false const manual = false
const release = false const release = false
let index = 2 let index = 1
// 判断小程序环境 // 判断小程序环境
// develop:开发版(正常开发工具,测试时) // develop:开发版(正常开发工具,测试时)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!