Commit 0b25889f by 匡雅琴

Merge branch 'v1.0.0' of http://192.168.3.233:8090/saas/mini-program/zhwy into v1.0.0

2 parents cecf7503 76f36651
......@@ -61,7 +61,8 @@
"root": "packageIndex",
"pages": [
"pages/carLife/index",
"pages/homeLife/index"
"pages/homeLife/index",
"pages/bannerJumpPage/bannerJumpPage"
]
},
{
......@@ -111,18 +112,7 @@
"pages/index/index"
],
"plugins": {
"ticketPlugin": {
"version": "2.0.2",
"provider": "wxd5b8312c3a09901a"
},
"express-plugin": {
"version": "1.2.0",
"provider": "wx1b1f66316b427c74"
},
"collectionPlugin": {
"version": "1.2.0",
"provider": "wx5e90fdd843841356"
}
}
},
{
......@@ -136,6 +126,13 @@
"pages": [
"pages/allEquity/allEquity"
]
},
{
"root": "packageEquity",
"pages": [
"pages/road/index/index",
"pages/road/roadInfo/roadInfo"
]
}
],
"usingComponents": {
......
// packageEquity/pages/road/index/index.js
import mapApi from '~/utils/mapapi/mapapi'
import { IMG_URL } from '~/config';
Page({
/**
* 页面的初始数据
*/
data: {
IMGURL:IMG_URL,
scale: 16,
flag: false,
editForm: {
rescueType: 0,
rescueTypeName: '紧急脱困'
},
rescueTypeList: [
{
confId: 0,
confName: '紧急脱困'
},
{
confId: 1,
confName: '拖车'
},
{
confId: 2,
confName: '换胎'
},
{
confId: 3,
confName: '送油'
},
{
confId: 4,
confName: '搭电'
},
{
confId: 5,
confName: '事故救援'
}
]
},
// onLoad: function (options) {},
onLoad(options) {
let { editForm } = this.data
if (options.confId + 1) {
editForm.rescueType = options.confId
editForm.rescueTypeName = options.name
}
if(options&&options.source=='GH'){
this.source = 'GH'
}
this.setData({
editForm
})
},
init() {
// this.getLocation()
},
/**授权位置成功 */
authSuccess() {
this.setData({
showAuth: false,
flag: true,
unauthorized: false
})
this.getLocation()
},
/**授权失败 */
authFail() {
this.setData({
showAuth: true,
unauthorized: true
})
},
/**授权弹窗取消 */
authCancel() {
wx.p.router.back()
},
// 切换线索
handleRescueType(e) {
var targetItem = e.currentTarget.dataset.item
this.setData({
'editForm.rescueType': targetItem.confId,
'editForm.rescueTypeName': targetItem.confName
})
},
// 下一步
handleNextStep() {
let otherParams = {}
if(this.source=='GH'){
otherParams.source='GH'
}
wx.p.router.go('/packageEquity/pages/road/roadInfo/roadInfo', {
editForm: this.data.editForm,
addressObj: this.data.addressObj,
isActivity: true,
notIntercept: true,
...otherParams
})
},
getLocation() {
wx.getLocation({
type: 'gcj02',
success: res => {
this.getCarPosition(res.latitude, res.longitude)
}
})
},
obtain(e) {
let { latitude, longitude } = e.detail
this.getCarPosition(latitude, longitude)
},
getCarPosition(latitude, longitude) {
mapApi.detailedAdrress([latitude, longitude]).then(data => {
this.setData({
addressObj: data,
latitude,
longitude
})
this.getControlHeight(map => {
map.addMarkers({
markers: [
{
id: 1,
iconPath: IMG_URL + 'equity/' + 'position.png' + `?v=${wx.$version}`,
latitude,
longitude,
width: 28,
height: 41,
callout: {
content: this.data.addressObj.formatted_addresses.recommend,
color: '#282829',
bgColor: '#FFFFFF',
borderRadius: 10,
padding: 14,
anchorY: -13,
borderWidth: 1,
borderColor: 'rgba(0, 0, 0, 0.1)',
display: 'ALWAYS'
}
}
],
clear: true,
success(res) {
console.log(res)
}
})
})
})
},
getControlHeight(callBack) {
wx.p.wxApi.getViewInfo('.control-box', ({ height }) => {
this.setData({
controlHeight: height
})
callBack(wx.createMapContext('map'))
})
}
})
{
"navigationBarTitleText": "救援服务"
}
\ No newline at end of file
<view class="layout" wx:if="{{flag}}">
<view class="map-box">
<map class="map" id="map" enable-traffic="{{enableTraffic}}" scale="{{scale}}" bindregionchange="regionchange" bindtap="obtain" longitude="{{longitude}}" latitude="{{latitude}}"></map>
</view>
<view class="control-box">
<view class="content">
<view class="content-title">请选择救援内容</view>
<view class="content-clue">
<view class="clue-item {{ editForm.rescueType == item.confId ? 'active' : ''}}" wx:for="{{rescueTypeList}}" wx:key="index" bindtap="handleRescueType" data-item="{{item}}">
{{ item.confName }}
<image webp wx:if="{{ editForm.rescueType == item.confId }}" class="clue-icon" src="{{IMGURL}}equity/icon-clue-active.png?v={{img_version}}"></image>
</view>
</view>
<view class="content-addr">
<view class="icon">
<image webp src="{{IMGURL}}equity/icon-addr.png?v={{img_version}}"></image>
</view>
<view class="text">
<view class="name">{{addressObj.formatted_addresses.recommend}}</view>
<view class="address">{{addressObj.address}}</view>
</view>
</view>
<view class="content-btn" bind:tap="handleNextStep">
<view>确定位置,下一步</view>
</view>
</view>
</view>
</view>
<authorize scopeType="userLocation" bindsuccess="authSuccess" bindfail="authFail" show="{{showAuth}}" bindcancel="authCancel">
</authorize>
<glsx-privacy appletName="车生活助手"></glsx-privacy>
\ No newline at end of file
page {
background: white;
}
.map-box {
position: relative;
height: 100vh;
}
.map {
width: 100%;
height: 100%;
}
.control-box {
position: absolute;
bottom: 48rpx;
margin: 0 32rpx;
width: calc(100% - 64rpx);
background: #FFFFFF;
border-radius: 16rpx;
}
.control-box .content {
padding: 20rpx;
}
.control-box .content .content-title {
font-weight: 500;
color: #2D2D2E;
margin: 12rpx 0 20rpx;
}
.control-box .content .content-clue {
display: flex;
flex-wrap: wrap;
border-bottom: 1rpx solid #E3E3E6;
margin-bottom: 32rpx;
}
.control-box .content .content-clue .clue-item {
position: relative;
background: #F7F8FA;
border-radius: 4rpx;
padding: 6rpx 30rpx;
margin: 0 20rpx 28rpx 0;
border: 2rpx solid #F7F8FA;
}
.control-box .content .content-clue .clue-item.active {
color: #FC5B32;
background: #FEEAE5;
border: 2rpx solid #FDCCC0;
}
.control-box .content .content-clue .clue-icon {
position: absolute;
bottom: -2rpx;
right: -2rpx;
width: 36rpx;
height: 32rpx;
}
.control-box .content .content-addr {
display: flex;
margin-bottom: 32rpx;
}
.control-box .content .icon {
width: 16rpx;
height: 20rpx;
flex-shrink: 0;
margin: 14rpx 18rpx 0 0;
overflow: hidden;
}
.control-box .content .name {
margin-bottom: 12rpx;
font-weight: 500;
font-size: 32rpx;
color: #282829;
}
.control-box .content .address {
color: #656566;
font-size: 24rpx;
}
.control-box .content .content-btn {
height: 80rpx;
line-height: 80rpx;
text-align: center;
color: #FFFFFF;
background: #FC5B32;
border-radius: 4px;
}
\ No newline at end of file
import { IMG_URL } from '~/config';
Page({
/**
* 页面的初始数据
*/
data: {
phone: '',
editForm: {},
addressObj: {},
merchantDetail: {},
IMGURL:IMG_URL,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
wx.p.router.getData(({ editForm, addressObj, isActivity = true,source='' }) => {
this.source = source
this.setData({
isActivity,
editForm,
addressObj
})
this.init()
})
},
init() {
// console.log(this.data)
this.setData({
phone: this.data.userInfo.phone
})
this.getUserCarList()
this.getMerchantInfo()
},
// 获取门店
getMerchantInfo() {
let merchantId = this.data.userInfo.merchantId
wx.p.api.mineApi
.getMerchantDetail({
merchantId
})
.then(data => {
this.setData({
merchantDetail: data
})
console.log(this.data.merchantDetail)
})
},
handleCallPhone() {
wx.makePhoneCall({
phoneNumber: this.data.merchantDetail.residentPhone || this.data.merchantDetail.merchantLegalPersonPhone
})
},
getUserCarList() {
wx.p.api.mineApi.getUserCarList().then(({ code, data }) => {
this.setData({
carFlag: true
})
if (code == '0') {
let carInfo = null
data.map(e => {
if (e.carTypeName) carInfo = e
})
this.setData({
carInfo
})
console.log(carInfo, 'carInfo')
}
})
},
handleInput(e) {
let attr = e.currentTarget.dataset.attr
this.setData({
[`${attr}`]: e.detail.value
})
},
handleConfirm() {
const phoneRex = /^[1]([3-9])[0-9]{9}$/
// console.log(this.data.carInfo)
let obj = {
channelType: 'DJ',
merchantId: this.data.userInfo.merchantId,
// 线索类型(1:客户意见,2:卖车询价,3:救援服务,4:新车询价,5:试驾预约,6:维保)
type: 3,
phone: this.data.phone,
vehicleShapeName: this.data.carInfo.seriseName + this.data.carInfo.carTypeName,
rescueAddress: this.data.addressObj.address + this.data.addressObj.formatted_addresses.recommend,
plateNum: this.data.carInfo ? this.data.carInfo.platPrefix + this.data.carInfo.platNumber : '',
...this.data.editForm
}
let validList = [
{
key: 'plateNum',
errorTxt: '请添加车辆信息'
},
{
key: 'name',
errorTxt: '请输入联系人'
},
{
key: 'phone',
errorTxt: '请输入手机号'
}
]
try {
validList.forEach(item => {
if (item.key == 'phone') {
if (!obj[item.key]) throw '请输入手机号'
if (!phoneRex.test(obj[item.key])) throw '请输入正确的手机号'
} else if (!obj[item.key]) {
throw item.errorTxt
}
})
} catch (error) {
wx.p.wxApi.showToast(error)
return
}
wx.p.wxApi.showLoading()
wx.p.api.equityApi.addClueRescue(obj).then(res => {
wx.hideLoading()
wx.showModal({
content: '您的救援服务单已提交成功',
confirmText: '返回',
showCancel: false,
confirmColor: '#FC5B32'
}).then(res => {
if (res.confirm) {
wx.p.router.goHome()
}
})
})
},
// 新增/更换车辆
handleEditCar(e) {
// this.data.carInfo ? '' : this.goto(e)
this.goto(e)
},
goto(e) {
console.log(e)
let { url, item, name } = e.currentTarget.dataset
let path = 'index'
if (name) path = name
console.log(`packageMine.${url}.${path}`)
wx.p.router.go('/packageMine/pages/vehicleInfo/index/index',item)
}
})
{
"usingComponents": {},
"navigationBarTitleText": "救援服务"
}
\ No newline at end of file
<!--packageEquity/pages/road/roadInfo/roadInfo.wxml-->
<view class="layout">
<view class="clue">{{editForm.rescueTypeName}}</view>
<view class="content addr-box">
<view class="icon">
<image webp src="{{IMGURL}}equity/icon-addr.png"></image>
</view>
<view class="text">
<view class="name">{{addressObj.formatted_addresses.recommend}}</view>
<view class="txt-grey">{{addressObj.address}}</view>
</view>
</view>
<view class="content form-box">
<view class="form-row">
<view class="title">车辆信息</view>
<view class="form-item flex-between-center">
<view class="text-hide form-name">{{carInfo.carTypeName}}</view>
<view class="txt-grey" bindtap="handleEditCar" data-url="vehicleInfo" data-item="{{carInfo}}">{{carInfo ? '编辑车辆' : '新增车辆'}}</view>
</view>
</view>
<view class="form-row">
<view class="title">联系人</view>
<input placeholder="请填写您的姓名" type="text" maxlength="20" value="{{editForm.name}}" catchinput="handleInput" data-attr="editForm.name"/>
</view>
<view class="form-row">
<view class="title">预约手机号</view>
<input class="count-box" placeholder="请填写您的手机号" type="number" maxlength="11" catchinput="handleInput" data-attr="phone" value="{{phone}}" />
</view>
</view>
<view class="content merchant-box">
<view class="flex-between-center m-b-32">
<view>{{merchantDetail.merchantName}}</view>
<view class="txt-grey">附近门店</view>
</view>
<scroll-view scroll-x="true" style="width: 100%;" class="brand-box">
<view class="flex">
<view class="brand-item flex" wx:for="{{merchantDetail.brandTreeList}}" wx:key="index">
<image webp class="brand-icon" src="{{item.logoUrl}}"></image>
{{item.name}}
</view>
</view>
</scroll-view>
<view class="flex" bind:tap="handleCallPhone">
<image webp class="phone_icon" src="{{IMGURL}}equity/phone.png" />
<view>{{merchantDetail.residentPhone || merchantDetail.merchantLegalPersonPhone}}</view>
</view>
</view>
<view class="btn-fixed text-center isFullSucreen">
<view class="default-btn" bindtap="handleConfirm">提交订单</view>
</view>
</view>
\ No newline at end of file
/* packageEquity/pages/road/roadInfo/roadInfo.wxss */
.layout {
margin: 20rpx 32rpx;
}
.layout .clue {
display: inline-block;
color: #FC5B32;
background: #FEEAE5;
border-radius: 4rpx;
padding: 8rpx 32rpx;
border: 1px solid #FDCCC0;
margin-bottom: 20rpx;
}
.layout .content {
background: #FFFFFF;
padding: 32rpx 20rpx;
margin-bottom: 20rpx;
border-radius: 8rpx;
}
.layout .content .flex-between-center {
display: flex;
justify-content: space-between;
align-items: center;
}
.layout .content .m-b-32 {
margin-bottom: 32rpx;
}
.layout .content .txt-grey {
color: #656566;
font-size: 24rpx;
}
.layout .addr-box {
display: flex;
}
.layout .addr-box .icon {
width: 16rpx;
height: 20rpx;
flex-shrink: 0;
margin: 14rpx 18rpx 0 0;
overflow: hidden;
}
.layout .addr-box .name {
margin-bottom: 12rpx;
font-weight: 500;
font-size: 32rpx;
color: #282829;
}
.layout .form-box .form-row {
padding: 30rpx 0 16rpx;
border-bottom: 1rpx solid #E3E3E6;
}
.layout .form-box .form-row:first-child {
padding-top: 0;
}
.layout .form-box .form-row:last-child {
border-width: 0;
}
.layout .form-box .form-row .title {
font-size: 32rpx;
font-weight: 500;
margin-bottom: 32rpx;
}
.layout .form-box .form-row .form-item .form-name {
width: calc(100% - 110rpx);
font-weight: 500;
}
.layout .merchant-box .brand-box {
border-bottom: 1rpx solid #E3E3E6;
padding-bottom: 16rpx;
margin-bottom: 16rpx;
}
.layout .merchant-box .brand-box .brand-item {
box-sizing: border-box;
flex-shrink: 0;
font-size: 24rpx;
padding: 4rpx 8rpx;
margin-right: 8rpx;
}
.layout .merchant-box .brand-box .brand-item:last-child {
margin-right: 0;
}
.phone_icon {
margin-right: 6rpx;
width: 40rpx;
height: 40rpx;
}
.brand-icon {
width: 68rpx;
height: 68rpx;
margin-right: 8rpx;
}
.btn-fixed {
position: fixed;
left: 0;
bottom: 0;
width: 100%;
height: 100rpx;
background: #FFFFFF;
}
.default-btn {
height: 80rpx !important;
}
\ No newline at end of file
......@@ -4,7 +4,46 @@ Component({
menuList: {
type: Array,
value: []
}
},
boxType: Number,//0 省心出行 1养车服务
},
methods: {}
methods: {
toJump(e) {
const { item } = e.currentTarget.dataset
console.log(item);
const { boxType } = this.data
if (boxType == 1) {
this.jump(e)
}
},
// 养车服务跳转
jump(e) {
let {
url,
item
} = e.currentTarget.dataset
if (item.tabBar) {
wx.p.router.getPageInstance().changeTabBar({
detail: 2
})
return
}
if (url) wx.p.router.go(`${url}`)
if (item) {
if (item.h5) wx.p.router.jumpH5(item.h5)
else {
if (item.url == 'navigation') wx.p.router.go(item.url)
else {
if (item.url) wx.p.router.go(item.url, item)
else wx.showModal({
content: '即将上线,敬请期待',
confirmText: '知道了',
showCancel: false,
confirmColor: '#F13C3D'
})
}
}
}
},
}
})
\ No newline at end of file
<view class="menu-box">
<view class="menu-item-box" wx:for="{{menuList}}" wx:key="index">
<view class="menu-item">
<glsx-image webp src="home/menu_icon/{{item.iconUrl}}" class="menu-item-icon"></glsx-image>
<view bind:tap="toJump" data-item="{{item}}" class="menu-item">
<glsx-image webp src="home/menu_icon/{{item.iconUrl}}.png" class="menu-item-icon"></glsx-image>
<view class="menu-item-text">
{{item.name}}
</view>
<view wx:if="{{item.sign}}" class="ranle_sing">{{item.sign}}</view>
</view>
</view>
</view>
\ No newline at end of file
......@@ -34,3 +34,19 @@
text-align: center;
margin-top: 12rpx;
}
.menu-item {
position: relative;
}
.menu-item .ranle_sing {
position: absolute;
right: -4rpx;
top: -8rpx;
padding: 2rpx 10rpx;
background: #F5222D;
border-radius: 16rpx;
font-weight: 400;
font-size: 20rpx;
color: #F9FAFB;
}
\ No newline at end of file
// packageIndex/pages/bannerJumpPage/bannerJumpPage.js
Page({
/**
* 页面的初始数据
*/
data: {
infoData: {},
titleList: ['商品', '图文介绍', '视频介绍']
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
onRoute(e) {
let { titleList } = this.data
if (e && e.title) {
wx.setNavigationBarTitle({
title: e.title
})
} else {
wx.setNavigationBarTitle({
title: titleList[e.bannerType - 1]
})
}
this.setData({
infoData: e || {}
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})
\ No newline at end of file
{
"usingComponents": {}
}
\ No newline at end of file
<!--packageIndex/pages/bannerJumpPage/bannerJumpPage.wxml-->
<view class="content">
<image wx:if="{{infoData.bannerType == 2}}" src="{{infoData.linkUrl}}" mode="widthFix"></image>
<video wx:if="{{infoData.bannerType == 3}}" src="{{infoData.linkUrl}}"></video>
</view>
/* packageIndex/pages/bannerJumpPage/bannerJumpPage.wxss */
.content{
width: 100%;
min-height: 100vh;
background: #000;
display: flex;
justify-content: center;
align-items: center;
}
.content video{
width: 100%;
height: 100vh;
}
\ No newline at end of file
// packageIndex/pages/carLife/index.js
import {tripMenu,maintainCarMenu,goodsList} from '../constant/lifeConstant'
import { tripMenu, goodsList } from '../constant/lifeConstant'
Page({
/**
......@@ -7,63 +7,87 @@ Page({
*/
data: {
tripMenu,
maintainCarMenu,
goodsList
goodsList,
utilList: []
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
this.getHomeConfig(wx.$merchant_id)
this.getAllMerchantList()
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
getHomeConfig(merchantId) {
wx.p.api.homeApi.getHomeConfig({ merchantId }).then(data => {
wx.hideLoading();
let utilList = []
if (data.clueList && data.clueList.length) {
data.clueList.map(e => {
if (e.clueId == 1) {
let rescueTypeList = [
{
confId: 5,
name: '事故救援',
iconUrl: 'accident_rescue_icon',
sign: '免费'
},
{
confId: 3,
name: '送油',
iconUrl: 'send_oil_icon'
},
{
confId: 4,
name: '搭电',
iconUrl: 'pick_up_power_icon'
},
{
confId: 2,
name: '换胎',
iconUrl: 'trie_change_icon'
},
{
confId: 0,
name: '紧急脱困',
iconUrl: 'emergency_relief_icon',
},
{
confId: 1,
name: '拖车',
iconUrl: 'trailer_icon'
},
]
rescueTypeList.forEach(v => {
utilList.push({
...v,
url: '/packageEquity/pages/road/index/index'
})
})
}
})
}
this.setData({
utilList
})
})
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
getAllMerchantList() {
let merchantId = wx.$merchant_id
let para = {
merchantId
}
wx.p.api.equityApi.getAllEquity(para).then(res => {
const carList = res.carServiceList
console.log(carList);
// let tempArr = res.goodsServiceList
// tempArr.unshift({
// goodsCategory: '汽车权益',
// equityGoodsGroupDescDtos: res.carServiceList
// })
})
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})
\ No newline at end of file
<view class="carlife-box">
<glsx-image webp src="home/carlife_bg.png" class="carlife-img"></glsx-image>
<view class="title-box">
<main-title title="省心出行" ></main-title>
<main-title title="省心出行"></main-title>
</view>
<menu-box menuList="{{tripMenu}}"></menu-box>
<view class="title-box">
<main-title title="养车服务"></main-title>
</view>
<menu-box menuList="{{maintainCarMenu}}"></menu-box>
<menu-box boxType="{{0}}" menuList="{{tripMenu}}"></menu-box>
<block wx:if="{{utilList.length}}">
<view class="title-box">
<main-title title="养车服务"></main-title>
</view>
<menu-box boxType="{{1}}" menuList="{{utilList}}"></menu-box>
</block>
<view class="title-box">
<main-title title="甄选车品"></main-title>
</view>
<goods-swiper goodsList="{{goodsList}}"></goods-swiper>
</view>
</view>
\ No newline at end of file
......@@ -41,49 +41,49 @@ const foodMenu = [
const tripMenu = [
{
iconUrl: 'movie.png',
iconUrl: 'movie',
name: '滴滴出行',
iconTip: '10元券'
},
{
iconUrl: 'movie.png',
iconUrl: 'movie',
name: '高德打车'
},
{
iconUrl: 'movie.png',
iconUrl: 'movie',
name: '美团骑车'
},
{
iconUrl: 'movie.png',
iconUrl: 'movie',
name: '青桔单车',
iconTip: '3元券'
},
{
iconUrl: 'movie.png',
iconUrl: 'movie',
name: '哈罗单车'
},
{
iconUrl: 'movie.png',
iconUrl: 'movie',
name: '哈罗单车'
}
]
const maintainCarMenu = [
{
iconUrl: 'movie.png',
iconUrl: 'movie',
name: '道路救援',
iconTip: '免费'
},
{
iconUrl: 'movie.png',
iconUrl: 'movie',
name: '送油'
},
{
iconUrl: 'movie.png',
iconUrl: 'movie',
name: '搭电'
},
{
iconUrl: 'movie.png',
iconUrl: 'movie',
name: '换胎'
}
]
......
......@@ -27,15 +27,15 @@ Component({
item
} = e.currentTarget.dataset
if (id) {
wx.$router.go('/packageShopmall/packageMall/pages/detail/detail', {
wx.p.router.go('/packageMall/pages/detail/detail', {
id,
isActivity: false,
notIntercept: true
})
} else if (equity) {
wx.$router.go('/packageShopmall/packageEquity/pages/allEquity/allEquity')
wx.p.router.go('/packageSaveMoney/pages/allEquity/allEquity')
} else {
if (url) wx.$router.go('/packageShopmall/packageIndex/pages/bannerJumpPage/bannerJumpPage', item)
if (url) wx.p.router.go('/packageIndex/pages/bannerJumpPage/bannerJumpPage', item)
}
},
changePage(e) {
......
const navStyle = "background-color: transparent;";
import { IMG_URL } from '~/config';
import {env} from '~/api/env/index'
import { env } from '~/api/env/index'
Page({
data: {
IMG_URL,
......@@ -20,7 +20,9 @@ Page({
}],
showModal: false,
urlName: '',
merchantName:'深圳中海美居'
merchantName: '深圳中海美居',
// 门店列表
storeList: []
},
navbarReady(e) {
let { height } = e.detail;
......@@ -37,7 +39,8 @@ Page({
});
},
onLoad() {
this.getHomeConfig()
this.defaultMerchant = wx.$merchant_id
this.getMerchantList()
this.getStrategyList();
},
......@@ -77,126 +80,64 @@ Page({
});
},
toHomeLife() {
wx.p.router.go("/packageIndex/pages/homeLife/index");
wx.p.router.go("/packageIndex/pages/homeLife/index", { notIntercept: true });
},
toCarLife() {
wx.p.router.go("/packageIndex/pages/carLife/index");
wx.p.router.go("/packageIndex/pages/carLife/index", { notIntercept: true });
},
getHomeConfig() {
wx.p.api.homeApi.getHomeConfig().then(data => {
let {
merchantName,
noticeContent
} = data
// let {
// userInfo
// } = this.data
//在线客服
// let customerlist = []
// if (data.customerServerName && data.customerServerOrCode) {
// customerlist.push({
// staffName: data.customerServerName,
// qrCode: data.customerServerOrCode,
// thumbAvatar: data.customerServerAvatar,
// staffPhone: data.customerServerPhone
// })
// }
// let utilList = [..._utilList_]
// if (data.clueList && data.clueList.length) {
// /**clueId 1:救援服务,2:维保预约,3:新车频道 */
// // const clueList = {
// // 2: {
// // name: '维保预约',
// // url: '/packageShopmall/packageIndex/pages/reservation/index/index',
// // icon: 'mainten-appoint',
// // hideMenu: true
// // },
// // 3: {
// // name: '新车频道',
// // url: '/packageShopmall/packageIndex/pages/newCars/index/index',
// // icon: 'new-car-channel',
// // badge: '特价新车'
// // },
// // 4: {
// // name: '代驾服务',
// // h5: '',
// // icon: 'sub-driving'
// // },
// // 5: {
// // name: '精品商城',
// // url: '',
// // icon: 'shop_icon',
// // tabBar: true
// // }
// // }
// // data.clueList.map(e => {
// // if (e.clueId == 1) {
// // let rescueTypeList = [{
// // confId: 0,
// // name: '紧急脱困',
// // icon: 'emergency_relief_icon'
// // },
// // {
// // confId: 1,
// // name: '拖车',
// // icon: 'trailer_icon'
// // },
// // {
// // confId: 2,
// // name: '换胎',
// // icon: 'trie_change_icon'
// // },
// // {
// // confId: 3,
// // name: '送油',
// // icon: 'send_oil_icon'
// // },
// // {
// // confId: 4,
// // name: '搭电',
// // icon: 'pick_up_power_icon'
// // },
// // {
// // confId: 5,
// // name: '事故救援',
// // icon: 'accident_rescue_icon'
// // }
// // ]
// // rescueTypeList.forEach(v => {
// // utilList.push({
// // ...v,
// // // url: 'packageEquity.road.index'
// // url: '/packageShopmall/packageEquity/pages/road/index/index'
// // })
// // })
// // } else utilList.push(clueList[e.clueId])
// // })
// }
let bannerList = []
if (data.bannerList && data.bannerList.length) bannerList = data.bannerList
bannerList.unshift({
bannerImg: `${this.data.IMG_URL}home/banner_test.png`,
equity: true
})
this.setData({
merchantName,
noticeContent,
bannerList
})
wx.hideLoading()
// 门店切换
changeStore(e) {
const index = +e.detail.value
const {storeList} = this.data
const currentStore = storeList[index]
wx.$merchant_id = currentStore.merchantId
this.setData({
currentStore
})
},
// 门店切换
changeStore(){
console.log(env);
const currentMerchantId = wx.$merchant_id
// 获取门店列表
getMerchantList() {
const merchantObj = {
'develop':[44211227,44209845],
'test':[44211651,44211654],
'beta':[],
'production':[44209566,44209565],
'develop': [44211227, 44209845],
'test': [44212577, 44212578],
'beta': [],
'production': [44209566, 44209565],
}
const MerchantList = merchantObj[env]
console.log(MerchantList);
let storeList = [],index = 0
MerchantList.forEach((el,i) => {
wx.$merchant_id = el
wx.p.api.homeApi.getHomeConfig({merchantId:el}).then(data => {
let {
merchantName,
noticeContent
} = data
let bannerList = []
if (data.bannerList && data.bannerList.length) bannerList = data.bannerList
storeList.push({
merchantName,
noticeContent,
bannerList,
merchantId:el
})
if(storeList.length==2){
storeList.forEach((ele,i)=>{
if( this.defaultMerchant==i){
index = i
}
})
const currentStore = storeList[index]
wx.$merchant_id = currentStore.merchantId
this.setData({
storeList,
currentStore
})
}
})
})
},
});
......@@ -6,17 +6,19 @@
<view class="store-wrap">
<view class="inner flex_sc">
<glsx-image class="logo" webp src="home/store_logo.png"></glsx-image>
<view class="store_name">{{merchantName}}</view>
<view bind:tap="changeStore" class="change_box">
<glsx-image class="icon" webp src="home/change_store_icon.png"></glsx-image>
</view>
<view class="store_name">{{currentStore.merchantName}}</view>
<picker mode="selector" bindchange="changeStore" range="{{storeList}}" range-key="merchantName" >
<view class="change_box">
<glsx-image class="icon" webp src="home/change_store_icon.png"></glsx-image>
</view>
</picker>
</view>
</view>
</view>
<!-- 公告 -->
<block wx:if="{{noticeContent}}">
<block wx:if="{{currentStore.noticeContent}}">
<view class="notice-bar">
<notice-bar data="{{noticeContent}}" speed="7500" id="com-1"></notice-bar>
<notice-bar data="{{currentStore.noticeContent}}" speed="7500" id="com-1"></notice-bar>
</view>
</block>
<!-- 家生活/车生活 -->
......@@ -25,8 +27,8 @@
<glsx-image class="cover" webp src="home/car_menu_banner.png" bind:tap="toCarLife"></glsx-image>
</view>
<!-- 轮播图 -->
<view class="banner-box" wx:if="{{bannerList.length > 0}}">
<banner bannerList="{{bannerList}}"></banner>
<view class="banner-box" wx:if="{{currentStore.bannerList.length > 0}}">
<banner bannerList="{{currentStore.bannerList}}"></banner>
</view>
<!-- 福利二维码 -->
<view class="code_wrap flex_scb">
......
// import GlMap from 'glsx-map-sdk'
// export default new GlMap()
\ No newline at end of file
import GlMap from 'glsx-map-sdk'
export default new GlMap()
\ 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!