You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

709 lines
17 KiB

<template>
<view class="container">
<view class="header">
<view class="shopName">
<u-dropdown :active-color="colors" title-size='34' style="position: absolute;width: 93%;">
<u-dropdown-item v-model="value1" height='600rpx' :title="title" :options="options1"
@change="changes">
</u-dropdown-item>
</u-dropdown>
</view>
<view style="height: 120rpx;">
<view class="header_Left">
<view class="left_top">
<image class="logo" :src="merchantLogo"></image>
</view>
<view class="left_down">
<image class="icons1" src="../../static/img/home/datas.png"></image>
<view class="times"><span @tap="times(1)" style="text-decoration:underline">{{startTime}}
</span>至<span @tap="times(2)" style="text-decoration:underline">{{endTime}}</span></view>
<u-picker mode="time" v-model="show1" title="开始时间" @confirm="times1()" :params="params">
</u-picker>
<u-picker mode="time" v-model="show2" title="截止时间" @confirm="times2()" :params="params">
</u-picker>
</view>
</view>
<view class="header_Right" @tap="release()">
<image class="showaddImg" src="../../static/img/home/shop.png"></image>
<view class="showAdd">新增店铺</view>
</view>
</view>
<view class="home-bgi">
<swiper class="swiper" autoplay="1500" :indicator-dots="true" :circular='true'
indicator-active-color="#ffffff" indicator-color="#cccccc">
<swiper-item class="swiper-wrap" v-for="(item,index) in banners" :key='index'
@tap="toGoodsInfo(item.url)">
<image :src="item.imageUrl"></image>
</swiper-item>
</swiper>
</view>
<view class="header_cont">
<view class="header_datas" v-for="(item,index) in headerData" :key="index">
<view class="numbers">{{item.num}}</view>
<view class="shuoming">{{item.name}}</view>
</view>
</view>
</view>
<view class="conters">
<view class="title">活动数据</view>
<view class="dosj">
<view class="dosj_cont" v-for="(item,index) in activityData" :key="index">
<view class="hdsj">{{item.num}}</view>
<view class="hdsj_sm">{{item.name}}</view>
</view>
</view>
<view style="margin-top: 40rpx;">
<view class="title">账单查询</view>
<view class="dosj">
<!-- <view class="dosj_cont" v-for="(item,index) in zhangdanData" :key="index" @tap="goOrder">
<view class="hdsj">{{item.num}}</view>
<view class="hdsj_sm">{{item.name}}</view>
</view> -->
<view v-for="(item,index) in zhangdanData" :key="index" @tap="goOrder">
<view style="display: flex;width: 100%;padding: 30rpx;align-content: center;">
<view style="width: 45%;text-align: left;">
<view class="hdsj">{{item.name}}</view>
</view>
<view style="width: 50%;text-align: right;">
<view class="hdsj_sm">{{item.num}}</view>
</view>
<view style="width: 5%;text-align: right;">
<image src="../../static/img/my/right_icon.png" style="width: 12rpx;height: 22rpx;">
</image>
</view>
</view>
</view>
</view>
</view>
<view style="margin-top: 40rpx;" v-if="options1.length > 0">
<view class="title">店铺管理</view>
<view class="shopList" v-for="(item,index) in options1">
<view class="shopManagement">
<image class="shopLoge" :src="item.merchantLogo"></image>
<view class="shop_r">
<view class="shop_name">{{item.merchantName}}</view>
<view class="shuoDz">
<image class="dizhiIcon" src="../../static/img/home/dizhi.png"
style="width: 28rpx;padding-right: 10rpx;" mode="widthFix"></image>
<span>{{item.merchantAddress}}</span>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import RenDropdownFilter from '@/components/ren-dropdown-filter/ren-dropdown-filter.vue'
import wPicker from "@/components/w-picker/w-picker.vue";
export default {
components: {
wPicker,
RenDropdownFilter
},
data() {
return {
colors: '#FF4701',
merchantLogo: '../../static/img/logo.jpg',
merchantId: 0,
startDate: 0,
endDate: 0,
title: '暂无店铺',
headerData: [{
name: '返利金额', //fanLiMoney
num: 0
},
{
name: '审核通过订单', //shenHeCount
num: 0
}
],
activityData: [{
name: '活动总数据', //huoDongCount
num: 0
},
{
name: '报名数量', //baoMingCount
num: 0
},
{
name: '曝光量', //baoGuangCount
num: 0
},
{
name: '客户支付金额', //keHuMoney
num: 0
},
{
name: '提交作业数', //keHuCount
num: 0
}
],
zhangdanData: [{
name: '今日活动预估金额', //dayMoney
num: 0
},
{
name: '已出账单', //yiMoney
num: 0
},
{
name: '未出账单', //weiMoney
num: 0
}
],
options1: [],
banners: [],
show: false,
value1: 1,
page: 1,
limit: 15,
show1: false,
show2: false,
params: {
year: true,
month: true,
day: true,
hour: false,
minute: false,
second: false
},
startTime: new Date().toISOString().slice(0, 10),
endTime: new Date().toISOString().slice(0, 10),
arr: [],
showModal: true
}
},
onLoad(e) {
let that = this;
this.startDate = parseInt(new Date().toISOString().slice(0, 10).replace(/-/g, ""));
// 商家提现审核提醒 210
// 商家审核结果通知 211
// 商家订单完成通知 212
// 商家活动反馈推送提醒 213
that.$Request.getT('/common/type/213').then(res => { //订单审核提醒
if (res.code == 0) {
if (res.data && res.data.value) {
// that.orderStart = res.data;
that.arr.push(res.data.value)
}
}
})
that.$Request.getT('/common/type/211').then(res => { //最新活动通知
if (res.code == 0) {
if (res.data && res.data.value) {
// that.orderStart = res.data;
that.arr.push(res.data.value)
}
}
})
that.$Request.getT('/common/type/212').then(res => { //积分变动提醒
if (res.code == 0) {
if (res.data && res.data.value) {
// that.orderStart = res.data;
that.arr.push(res.data.value)
}
}
})
// console.log("data_____:" + parseInt(data.toISOString().slice(0, 10).replace(/-/g,"")))
},
onShow() {
let startTime = this.$queue.getData('startTime');
let endTime = this.$queue.getData('endTime');
if(startTime){
this.startTime = startTime;
}
if(endTime){
this.endTime = endTime;
}
let userId = this.$queue.getData('userId');
if (userId) {
this.getShopList(userId);
//订阅
if (this.showModal) {
this.openMsg()
}
}
this.getBannerList();
},
methods: {
// 开启订阅消息
openMsg() {
var that = this
wx.getSetting({
withSubscriptions: true, //是否获取用户订阅消息的订阅状态,默认false不返回
success(ret) {
// console.log(ret,'------------------')
// console.log(Object.keys(ret.subscriptionsSetting.itemSettings).length)
// if (JSON.stringify(ret.subscriptionsSetting.itemSettings).indexOf('accept')!=-1) {
if (ret.subscriptionsSetting.itemSettings) {
uni.setStorageSync('sendindexMsg', true)
uni.openSetting({ // 打开设置页
success(rea) {
console.log(rea.authSetting)
}
});
} else { // 用户没有点击“总是保持以上,不再询问”则每次都会调起订阅消息
uni.setStorageSync('sendindexMsg', false)
uni.showModal({
title: '提示',
content: '为了更好的体验,请绑定消息推送',
confirmText: '确定',
cancelText: '取消',
success: function(res) {
if (res.confirm) {
uni.requestSubscribeMessage({
tmplIds: that.arr,
success(re) {
// console.log(re,'**********')
var datas = JSON.stringify(re);
if (datas.indexOf("accept") != -1) {
console.log(re)
}
},
fail: (res) => {
console.log(res)
}
})
that.showModal = false
} else if (res.cancel) {
that.showModal = true
}
}
})
}
}
})
},
getBannerList() {
this.$Request.getT('/banner/selectBannerList?state=-1&classify=7').then(res => {
if (res.code === 0) {
this.banners = [];
res.data.forEach(d => {
if (d.state == 1) {
this.banners.push(d);
}
});
}
});
},
// 轮播图跳转小程序
toGoodsInfo: function(url) {
let token = this.$queue.getData('token');
let userId = this.$queue.getData('userId');
if (token) {
if (uni.getStorageSync('sendindexMsg')) {
uni.requestSubscribeMessage({
tmplIds: this.arr,
success(re) {
// console.log(re,'**********')
var datas = JSON.stringify(re);
if (datas.indexOf("accept") != -1) {
console.log(re)
}
},
fail: (res) => {
console.log(res)
}
})
}
if (url) {
if (url.indexOf('/pages/') !== -1) {
uni.navigateTo({
url
});
} else {
//#ifndef H5
uni.navigateTo({
url: '/pages/public/webview?url=' + url
});
//#endif
//#ifdef H5
window.location.href = url;
//#endif
}
}
} else {
this.goLogin();
}
},
goLogin() {
uni.navigateTo({
url: '/pages/public/login'
});
},
goOrder() {
if (uni.getStorageSync('sendindexMsg')) {
uni.requestSubscribeMessage({
tmplIds: this.arr,
success(re) {
// console.log(re,'**********')
var datas = JSON.stringify(re);
if (datas.indexOf("accept") != -1) {
console.log(re)
}
},
fail: (res) => {
console.log(res)
}
})
}
if (this.merchantId != 0) {
uni.navigateTo({
url: '/pages/my/toExamine'
});
}
},
selectMerchantDataAnalysis() {
this.$Request.getT('/goodsMerchant/selectMerchantDataAnalysis?merchantId=' + this.merchantId +
'&startTime=' + this.startTime + '&endTime=' + this.endTime).then(res => {
if (res.code == 0) {
this.headerData[0].num = res.fanLiMoney ? res.fanLiMoney : 0;
this.headerData[1].num = res.shenHeCount ? res.shenHeCount : 0;
this.activityData[0].num = res.huoDongCount ? res.huoDongCount : 0;
this.activityData[1].num = res.baoMingCount ? res.baoMingCount : 0;
this.activityData[2].num = res.baoGuangCount ? res.baoGuangCount : 0;
this.activityData[3].num = res.keHuMoney ? res.keHuMoney : 0;
this.activityData[4].num = res.keHuCount ? res.keHuCount : 0;
this.zhangdanData[0].num = res.dayMoney ? res.dayMoney : 0;
this.zhangdanData[1].num = res.yiMoney ? res.yiMoney : 0;
this.zhangdanData[2].num = res.weiMoney ? res.weiMoney : 0;
}
});
},
getShopList(userId) {
this.$Request.getT('/goodsMerchant/selectGoodsMerchantPage?page=' + this.page + '&limit=' + this.limit +
'&userId=' + userId + '&status=2').then(res => {
if (res.code == 0) {
if (res.data.records.length > 0) {
if (this.options1.length == 0) {
this.title = res.data.records[0].merchantName;
this.merchantLogo = res.data.records[0].merchantLogo;
this.merchantId = res.data.records[0].merchantId;
this.$queue.setData('merchantId', this.merchantId);
}
this.selectMerchantDataAnalysis();
this.options1 = [];
this.options1 = res.data.records;
}
}
});
},
changeDate(data) {
console.log(data)
},
shopBtn() {
this.show = true
console.log('1111')
},
release() {
let token = this.$queue.getData('token');
if (token) {
if (uni.getStorageSync('sendindexMsg')) {
uni.requestSubscribeMessage({
tmplIds: this.arr,
success(re) {
// console.log(re,'**********')
var datas = JSON.stringify(re);
if (datas.indexOf("accept") != -1) {
console.log(re)
}
},
fail: (res) => {
console.log(res)
}
})
}
uni.navigateTo({
url: '/pages/index/addShop'
});
} else {
this.goLogin();
}
},
changes(item) {
console.log(item)
this.title = item.merchantName;
this.merchantLogo = item.merchantLogo;
this.merchantId = item.merchantId;
this.selectMerchantDataAnalysis();
this.$queue.setData('merchantId', item.merchantId);
// this.value1 = index
// for (var i in this.options1) {
// if (index == this.options1[i].value) {
// this.title = this.options1[i].label
// }
// }
},
times(index) {
if (index == 1) {
this.show1 = true
}
if (index == 2) {
this.show2 = true
}
},
times1(e) {
this.startTime = e.year + '-' + e.month + '-' + e.day
this.$queue.setData('startTime', this.startTime);
this.startDate = parseInt(e.year + e.month + e.day);
console.log(this.startDate)
console.log('shijian', e, this.startTime);
let userId = this.$queue.getData('userId');
if (userId) {
this.selectMerchantDataAnalysis();
}
},
times2(e) {
if (this.startDate == 0) {
this.$queue.showToast('请先选择开始时间!')
return;
}
this.endDate = parseInt(e.year + e.month + e.day);
console.log(this.endDate - this.startDate)
if ((this.endDate - this.startDate) < 0) {
this.$queue.showToast('结束时间不能小于开始时间!')
return;
}
this.endTime = e.year + '-' + e.month + '-' + e.day
this.$queue.setData('endTime', this.endTime);
console.log('shijian', e, this.endTime);
let userId = this.$queue.getData('userId');
if (userId) {
this.selectMerchantDataAnalysis();
}
},
}
}
</script>
<style lang="scss">
page {
width: 100%;
// background: #000000;
background: #F5F5F5;
}
.tui-scroll-h {
height: 100%;
}
.home-bgi {
width: 100%;
height: 260rpx;
background: #FFF;
.swiper {
width: 100%;
height: 100%;
.swiper-wrap {
width: 100%;
height: 100%;
image {
width: 100%;
height: 100%;
border-radius: 20rpx;
display: block;
}
}
}
}
.hdsj {
font-size: 28rpx;
font-weight: 600;
}
.hdsj_sm {
font-size: 28rpx;
}
.container {
.header {
width: 100%;
background: #FFFFFF;
padding: 30rpx;
.header_Left {
height: 120rpx;
width: 70%;
float: left;
.left_top {
.logo {
width: 60rpx;
height: 60rpx;
border-radius: 10rpx;
// float: left;
margin-right: 20rpx;
}
.shopName {
position: relative;
line-height: 60rpx;
font-size: 36rpx;
font-weight: 600;
.icons {
width: 30rpx;
margin-left: 10rpx;
padding-left: 10rpx;
}
}
}
.left_down {
clear: both;
display: flex;
align-items: center;
height: 40rpx;
color: #999;
font-size: 32rpx;
.icons1 {
width: 28rpx;
height: 28rpx;
margin-right: 10rpx;
}
.times {
font-size: 28rpx;
color: #777777;
}
}
}
.header_Right {
// float: right;
width: 20%;
text-align: center;
font-size: 26rpx;
height: 120rpx;
padding: 20rpx 0;
position: absolute;
right: 0;
top: 0;
z-index: 999999;
.showaddImg {
width: 50rpx;
height: 50rpx;
}
}
.header_cont {
clear: both;
background-color: #FF4701;
width: 100%;
border-radius: 10rpx;
height: 100rpx;
margin-top: 20rpx;
color: #FFFFFF;
.header_datas {
display: inline-block;
width: 50%;
text-align: center;
padding: 10rpx 0;
.numbers {
font-size: 40rpx;
}
}
}
}
.conters {
width: 100%;
background: #FFFFFF;
padding: 10rpx 30rpx 30rpx;
.title {
color: #474747;
font-size: 30rpx;
margin: 20rpx 0;
font-weight: 600;
}
.dosj {
background: #FFF6F2;
border-radius: 15rpx;
.dosj_cont {
display: inline-block;
width: 33.3%;
text-align: center;
padding: 20rpx 0;
color: #333333;
.hdsj {
font-size: 40rpx;
font-weight: 600;
}
.hdsj_sm {
font-size: 26rpx;
}
}
}
.shopList {
.shopManagement {
background: #FFF6F2;
border-radius: 15rpx;
padding: 20rpx;
.shopLoge {
width: 120rpx;
height: 120rpx;
float: left;
margin-right: 15rpx;
}
.shop_r {
height: 120rpx;
.shop_name {
padding-left: 20rpx;
font-size: 30rpx;
color: #333333;
font-weight: 600;
line-height: 60rpx;
}
.shuoDz {
font-size: 28rpx;
color: #999999;
}
}
}
}
}
}
.u-dropdown__menu__item.data-v-4e830e53 {
position: absolute !important;
left: 70rpx !important;
}
.u-dropdown__menu__item {
position: absolute !important;
left: 70rpx !important;
bottom: 30rpx !important;
}
</style>