Commit c25042c6 by 李君
2 parents 8ecec743 253219f0
...@@ -3,6 +3,9 @@ import { ...@@ -3,6 +3,9 @@ import {
getAccountTrafficTrend, getAccountTrafficTrend,
getAccountMallRank getAccountMallRank
} from '../api/shop' } from '../api/shop'
import {
getAccounts,
} from "../api/login";
import {getTime} from '../utils/util' import {getTime} from '../utils/util'
import moment from 'moment' import moment from 'moment'
const App = getApp(); const App = getApp();
...@@ -14,15 +17,46 @@ Component({ ...@@ -14,15 +17,46 @@ Component({
// 当前页面的 tabBar 索引 // 当前页面的 tabBar 索引
curClick:1 curClick:1
},()=>{ },()=>{
setTimeout(()=>{ // setTimeout(()=>{
this.loadData() // this.loadData()
},1000) // },1000)
})
}
if (wx.getStorageSync('accountName') && this.data.accountList.length > 0) {
let selectId = this.data.accountList.find(item => item.name == wx.getStorageSync('accountName')).id
wx.setStorageSync('accountId', selectId)
if(wx.getStorageSync('accountName') != this.data.selectName) {
wx.setStorageSync('shopName', '')
}
this.setData({
selectName: wx.getStorageSync('accountName'),
selectId
}, () => {
this.loadData()
}) })
} else if (typeof this.getTabBar === 'function' && this.getTabBar()) {
setTimeout(()=>{
this.loadData()
},1000)
} }
} }
}, },
attached(){ attached(){
this.loadData() getAccounts({
url: '/report/accounts',
accountId: wx.getStorageSync('accountId')
}).then((res) => {
let selectName = res.data.find(item => item.id == wx.getStorageSync('accountId')).name
this.setData({
accountList: res.data,
selectName: selectName,
selectId: wx.getStorageSync('accountId'),
columnsListName: res.data && res.data.map(item => item.name)
}, () => {
wx.setStorageSync('accountName', selectName)
this.loadData()
})
})
}, },
data: { data: {
navHeight: getApp().globalData.navHeight, navHeight: getApp().globalData.navHeight,
...@@ -68,6 +102,9 @@ Component({ ...@@ -68,6 +102,9 @@ Component({
name: '集客力', name: '集客力',
val: 'PerAreaValue' val: 'PerAreaValue'
}], }],
accountList:[],
selectId:'',
columnsListName:[],
}, },
methods: { methods: {
toThousands(num) { toThousands(num) {
...@@ -97,6 +134,14 @@ Component({ ...@@ -97,6 +134,14 @@ Component({
this.getMallRank() this.getMallRank()
}); });
}, },
// 获取集团列表
// 跳转到集团选择
selectContent() {
wx.navigateTo({
url: '/pages/shopSelect/index?type=account&current=' + JSON.stringify(this.data.columnsListName),
})
},
// 点击自定义日期选择器的确定 // 点击自定义日期选择器的确定
onConfirm(event) { onConfirm(event) {
this.getTabBar().setData({ this.getTabBar().setData({
...@@ -165,7 +210,7 @@ Component({ ...@@ -165,7 +210,7 @@ Component({
endDate:endTime, endDate:endTime,
}).then(res => { }).then(res => {
this.setData({ this.setData({
selectName:res.data.name, // selectName:res.data.name,
openMllNum:res.data.openMllNum, openMllNum:res.data.openMllNum,
exposure:this.toThousands(res.data.exposure), exposure:this.toThousands(res.data.exposure),
traffic:this.toThousands(res.data.traffic), traffic:this.toThousands(res.data.traffic),
......
...@@ -5,7 +5,12 @@ ...@@ -5,7 +5,12 @@
<!-- 名称 --> <!-- 名称 -->
<view class="contianer_shop"> <view class="contianer_shop">
<image src="../images/banner.png" class='images'></image> <image src="../images/banner.png" class='images'></image>
<view class="shop_name">{{selectName}}</view> <view class="shop_name" bindtap="selectContent">
<text class="nameContent">{{selectName}}</text>
<view class="iconDown">
<image src="../images/icdown.svg" class="imagesvg" mode=""/>
</view>
</view>
<view class="shop_time"> <view class="shop_time">
<text>开业门店总数:{{openMllNum}}个</text> <text>开业门店总数:{{openMllNum}}个</text>
</view> </view>
......
...@@ -267,4 +267,16 @@ ...@@ -267,4 +267,16 @@
} }
.alone_btn{ .alone_btn{
margin-left: auto; margin-left: auto;
}
.iconDown{
/* width: 35rpx; */
height: 56rpx;
display: inline-block;
vertical-align: top;
}
.imagesvg{
margin-left: 20rpx;
width: 35rpx;
height: 30rpx;
} }
\ No newline at end of file \ No newline at end of file
...@@ -44,7 +44,7 @@ Component({ ...@@ -44,7 +44,7 @@ Component({
}) })
}) })
} else { } else {
this.getMallList()
} }
} }
}, },
...@@ -75,38 +75,41 @@ Component({ ...@@ -75,38 +75,41 @@ Component({
info: {} info: {}
}, },
attached(){ attached(){
getMalls({ this.getMallList()
url: '/report/malls',
accountId: wx.getStorageSync('accountId')
}).then((res) => {
this.setData({
shopList: res.data,
selectName: res.data[0] && res.data[0].name,
selectId: res.data[0] && res.data[0].id,
columnsListName: res.data && res.data.map(item => item.name)
}, () => {
wx.setStorageSync('shopName', res.data[0] && res.data[0].name)
this.loadData()
getShopDetailData({
id: this.data.selectId
}).then(res => {
if (res.code == 200) {
let startTime = res.data.startTime.split(' ')[1].slice(0, 5)
let endTime = res.data.endTime.split(' ')[1].slice(0, 5)
this.setData({
info: {
...res.data,
startTime,
endTime
}
})
}
})
})
})
}, },
methods: { methods: {
// 获取门店列表
getMallList() {
getMalls({
url: '/report/malls',
accountId: wx.getStorageSync('accountId')
}).then((res) => {
this.setData({
shopList: res.data,
selectName: res.data[0] && res.data[0].name,
selectId: res.data[0] && res.data[0].id,
columnsListName: res.data && res.data.map(item => item.name)
}, () => {
wx.setStorageSync('shopName', res.data[0] && res.data[0].name)
this.loadData()
getShopDetailData({
id: this.data.selectId
}).then(res => {
if (res.code == 200) {
let startTime = res.data.startTime.split(' ')[1].slice(0, 5)
let endTime = res.data.endTime.split(' ')[1].slice(0, 5)
this.setData({
info: {
...res.data,
startTime,
endTime
}
})
}
})
})
})
},
// 关闭自定义日期选择 // 关闭自定义日期选择
onClose() { onClose() {
this.getTabBar().setData({ this.getTabBar().setData({
...@@ -119,7 +122,7 @@ Component({ ...@@ -119,7 +122,7 @@ Component({
// 跳转到店铺选择 // 跳转到店铺选择
selectContent() { selectContent() {
wx.navigateTo({ wx.navigateTo({
url: '/pages/shopSelect/index?current=' + JSON.stringify(this.data.columnsListName), url: '/pages/shopSelect/index?type=shop&current=' + JSON.stringify(this.data.columnsListName),
}) })
}, },
// 点击自定义日期选择器的确定 // 点击自定义日期选择器的确定
......
...@@ -10,6 +10,7 @@ Page({ ...@@ -10,6 +10,7 @@ Page({
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
type:'',
navHeight: App.globalData.navHeight, navHeight: App.globalData.navHeight,
value: '', //当前输入框的值 value: '', //当前输入框的值
rest: [] //列表数据 rest: [] //列表数据
...@@ -21,7 +22,11 @@ Page({ ...@@ -21,7 +22,11 @@ Page({
}, },
// 选中店铺,出入口触发 // 选中店铺,出入口触发
wxSortPickerViewItemTap(e) { wxSortPickerViewItemTap(e) {
wx.setStorageSync('shopName', e.currentTarget.dataset.text) if(this.data.type == 'account') {
wx.setStorageSync('accountName', e.currentTarget.dataset.text)
} else {
wx.setStorageSync('shopName', e.currentTarget.dataset.text)
}
this.goBacks() this.goBacks()
}, },
// 返回上一页 // 返回上一页
...@@ -35,6 +40,7 @@ Page({ ...@@ -35,6 +40,7 @@ Page({
*/ */
onLoad: function (options) { onLoad: function (options) {
this.setData({ this.setData({
type:options.type,
rest: JSON.parse(options.current) rest: JSON.parse(options.current)
}) })
init(JSON.parse(options.current),this) init(JSON.parse(options.current),this)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!