Commit c25042c6 by 李君
2 parents 8ecec743 253219f0
......@@ -3,6 +3,9 @@ import {
getAccountTrafficTrend,
getAccountMallRank
} from '../api/shop'
import {
getAccounts,
} from "../api/login";
import {getTime} from '../utils/util'
import moment from 'moment'
const App = getApp();
......@@ -14,15 +17,46 @@ Component({
// 当前页面的 tabBar 索引
curClick:1
},()=>{
// setTimeout(()=>{
// this.loadData()
// },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(){
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: {
navHeight: getApp().globalData.navHeight,
......@@ -68,6 +102,9 @@ Component({
name: '集客力',
val: 'PerAreaValue'
}],
accountList:[],
selectId:'',
columnsListName:[],
},
methods: {
toThousands(num) {
......@@ -97,6 +134,14 @@ Component({
this.getMallRank()
});
},
// 获取集团列表
// 跳转到集团选择
selectContent() {
wx.navigateTo({
url: '/pages/shopSelect/index?type=account&current=' + JSON.stringify(this.data.columnsListName),
})
},
// 点击自定义日期选择器的确定
onConfirm(event) {
this.getTabBar().setData({
......@@ -165,7 +210,7 @@ Component({
endDate:endTime,
}).then(res => {
this.setData({
selectName:res.data.name,
// selectName:res.data.name,
openMllNum:res.data.openMllNum,
exposure:this.toThousands(res.data.exposure),
traffic:this.toThousands(res.data.traffic),
......
......@@ -5,7 +5,12 @@
<!-- 名称 -->
<view class="contianer_shop">
<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">
<text>开业门店总数:{{openMllNum}}个</text>
</view>
......
......@@ -268,3 +268,15 @@
.alone_btn{
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
......@@ -44,7 +44,7 @@ Component({
})
})
} else {
this.getMallList()
}
}
},
......@@ -75,6 +75,11 @@ Component({
info: {}
},
attached(){
this.getMallList()
},
methods: {
// 获取门店列表
getMallList() {
getMalls({
url: '/report/malls',
accountId: wx.getStorageSync('accountId')
......@@ -104,9 +109,7 @@ Component({
})
})
})
},
methods: {
// 关闭自定义日期选择
onClose() {
this.getTabBar().setData({
......@@ -119,7 +122,7 @@ Component({
// 跳转到店铺选择
selectContent() {
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({
* 页面的初始数据
*/
data: {
type:'',
navHeight: App.globalData.navHeight,
value: '', //当前输入框的值
rest: [] //列表数据
......@@ -21,7 +22,11 @@ Page({
},
// 选中店铺,出入口触发
wxSortPickerViewItemTap(e) {
if(this.data.type == 'account') {
wx.setStorageSync('accountName', e.currentTarget.dataset.text)
} else {
wx.setStorageSync('shopName', e.currentTarget.dataset.text)
}
this.goBacks()
},
// 返回上一页
......@@ -35,6 +40,7 @@ Page({
*/
onLoad: function (options) {
this.setData({
type:options.type,
rest: JSON.parse(options.current)
})
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!