<template>
	<view style="padding-bottom: 100upx">
		<view class="bg padding-bottom">
			<view class="u-flex padding">
				<view class="u-m-r-10">
					<!-- @click="goNav('/pages/my/userinfo')" -->
					<image :src="shopCover" style="width: 100rpx; height: 100rpx; border-radius: 100rpx" @click="goNavs(list[0].url)"></image>
				</view>
				<view class="u-flex-1 u-m-l-10 flex justify-between align-center" v-if="!isLogin">
					<view class="u-font-18 text-bold">
						<!-- #ifdef  MP-WEIXIN -->
						<view class="margin-left-sm margin-top-xs" style="width: 220rpx">{{ shopName }}</view>
						<!-- #endif -->
						<!-- #ifndef MP-WEIXIN -->
						<view class="margin-left-sm margin-top-xs" style="width: 220rpx">{{ shopName }}</view>
						<!-- #endif -->
					</view>
					<view class="erweima" @click="shopQr()">二维码</view>
					<view class="erweima" @click="shopQrSphere()">私域二维码</view>
				</view>
				<view v-else class="text-xl u-p-l-20 text-bold" @click="goLogin('/pages/my/loginphone')">登录</view>
			</view>
			<view class="moneybox" v-if="XCXIsSelect == '是'">
				<view class="padding" style="background: #fcd202; border-radius: 20upx 20upx 0upx 0upx">
					<view class="flex justify-between">
						<view>
							<view>累计收益(元)</view>
							<view class="margin-top-xs" style="font-size: 40upx">
								￥
								<text style="font-size: 55upx">{{ sumMoney }}</text>
							</view>
						</view>
						<view class="btn" @click="goQian()">立即提现</view>
					</view>
					<view class="flex justify-between align-center text-center margin-top">
						<view>
							<view>今日收益</view>
							<view class="margin-top-xs" style="font-size: 38upx">
								￥
								<text style="font-size: 48upx">{{ dayMoney ? dayMoney : '0' }}</text>
							</view>
						</view>
						<view>
							<view>本月收益</view>
							<view class="margin-top-xs" style="font-size: 38upx">
								￥
								<text style="font-size: 48upx">{{ monthMoney ? monthMoney : '0' }}</text>
							</view>
						</view>
						<view>
							<view>本月提现</view>
							<view class="margin-top-xs" style="font-size: 38upx">
								￥
								<text style="font-size: 48upx">{{ cashMoney ? cashMoney : '0' }}</text>
							</view>
						</view>
					</view>
				</view>
				<view class="flex align-center justify-between padding-lr padding-tb-sm" style="background: #fcb202; border-radius: 0upx 0upx 20upx 20upx">
					<view class="">每次提现平台将扣除相应手续费</view>
					<view class="xflist" @click="goNav('/my/other/cashList')">钱包明细</view>
				</view>
			</view>
		</view>

		<view class="bg margin-top-sm">
			<!-- 店铺管理 -->
			<view class="flex padding-lr padding-tb dfs" @click="goNavs(list[0].url)">
				<image :src="list[0].image" style="width: 50rpx; height: 50rpx" mode=""></image>
				<view class="flex-sub margin-left text-df" style="line-height: 50upx">{{ list[0].title }}</view>
				<image src="../../static/images/my/right.png" class="images" mode=""></image>
			</view>
			<!-- 订阅消息配置 -->
			<view class="flex padding-lr padding-tb dfs" v-if="userId">
				<image src="../../static/images/my/dianpu.png" style="width: 50rpx; height: 50rpx" mode=""></image>
				<view class="flex-sub margin-left text-df" style="line-height: 50upx">订阅消息配置</view>
				<switch color="#1677ff" :checked="isChecked" @change="switchChange" />
			</view>
			<!-- 商品管理 -->
			<view class="flex padding-lr padding-tb dfs" @click="goNavs(list[1].url)">
				<image :src="list[1].image" style="width: 50rpx; height: 50rpx" mode=""></image>
				<view class="flex-sub margin-left text-df" style="line-height: 50upx">{{ list[1].title }}</view>
				<image src="../../static/images/my/right.png" class="images" mode=""></image>
			</view>
			<!-- 销量管理 -->
			<view class="flex padding-lr padding-tb" @click="goNavs(list[18].url)">
				<image :src="list[18].image" style="width: 50rpx; height: 50rpx" mode=""></image>
				<view class="flex-sub margin-left text-df" style="line-height: 50upx">{{ list[18].title }}</view>
				<image src="../../static/images/my/right.png" class="images" mode=""></image>
			</view>
			<!-- 订单管理 -->
			<view class="flex padding-lr padding-tb" @click="goOrder()">
				<image :src="list[2].image" style="width: 50rpx; height: 50rpx" mode=""></image>
				<view class="flex-sub margin-left text-df" style="line-height: 50upx">{{ list[2].title }}</view>
				<image src="../../static/images/my/right.png" class="images" mode=""></image>
			</view>
			<!-- 分类管理 -->
			<view class="flex padding-lr padding-tb" @click="goNavs(list[3].url)">
				<image :src="list[3].image" style="width: 50rpx; height: 50rpx" mode=""></image>
				<view class="flex-sub margin-left text-df" style="line-height: 50upx">{{ list[3].title }}</view>
				<image src="../../static/images/my/right.png" class="images" mode=""></image>
			</view>
			<!-- 规格管理 -->
			<view class="flex padding-lr padding-tb" @click="goNavs(list[4].url)">
				<image :src="list[4].image" style="width: 50rpx; height: 50rpx" mode=""></image>
				<view class="flex-sub margin-left text-df" style="line-height: 50upx">{{ list[4].title }}</view>
				<image src="../../static/images/my/right.png" class="images" mode=""></image>
			</view>
			<!-- 保证金 -->
			<view class="flex padding-lr padding-tb" @click="goNav(list[5].url)" v-if="XCXIsSelect == '是'">
				<image :src="list[5].image" style="width: 50rpx; height: 50rpx" mode=""></image>
				<view class="flex-sub margin-left text-df" style="line-height: 50upx">{{ list[5].title }}</view>
				<image src="../../static/images/my/right.png" class="images" mode=""></image>
			</view>
			<!-- 规格管理 -->
			<view class="flex padding-lr padding-tb" @click="goNavs(list[13].url)">
				<image :src="list[13].image" style="width: 50rpx; height: 50rpx" mode=""></image>
				<view class="flex-sub margin-left text-df" style="line-height: 50upx">{{ list[13].title }}</view>
				<image src="../../static/images/my/right.png" class="images" mode=""></image>
			</view>
			<!-- 精选活动 -->
			<view class="flex padding-lr padding-tb" @click="goNavs(list[14].url)">
				<image :src="list[14].image" style="width: 50rpx; height: 50rpx" mode=""></image>
				<view class="flex-sub margin-left text-df" style="line-height: 50upx">{{ list[14].title }}</view>
				<image src="../../static/images/my/right.png" class="images" mode=""></image>
			</view>
			<!-- 优惠券管理 -->
			<view class="flex padding-lr padding-tb" @click="goNavs(list[15].url)">
				<image :src="list[15].image" style="width: 50rpx; height: 50rpx" mode=""></image>
				<view class="flex-sub margin-left text-df" style="line-height: 50upx">{{ list[15].title }}</view>
				<image src="../../static/images/my/right.png" class="images" mode=""></image>
			</view>
			<!-- 打印机配置 -->
			<view class="flex padding-lr padding-tb" @click="goNavs(list[16].url)">
				<image :src="list[16].image" style="width: 50rpx; height: 50rpx" mode=""></image>
				<view class="flex-sub margin-left text-df" style="line-height: 50upx">{{ list[16].title }}</view>
				<image src="../../static/images/my/right.png" class="images" mode=""></image>
			</view>
			<!-- 供货订购 -->
			<view class="flex padding-lr padding-tb" @click="goGong()">
				<image :src="list[17].image" style="width: 50rpx; height: 50rpx" mode=""></image>
				<view class="flex-sub margin-left text-df" style="line-height: 50upx">{{ list[17].title }}</view>
				<image src="../../static/images/my/right.png" class="images" mode=""></image>
			</view>
		</view>

		<view class="bg margin-top-sm">
			<!-- 聊天中心 -->
			<view class="flex padding-lr padding-tb dfs" @click="goNav(list[12].url)">
				<image :src="list[12].image" style="width: 50rpx; height: 50rpx" mode=""></image>
				<view class="flex-sub margin-left text-df" style="line-height: 50upx">{{ list[12].title }}</view>
				<view class="flex align-center">
					<view v-if="messageCount" class="bott">{{ messageCount }}</view>
					<image src="../../static/images/my/right.png" class="images" mode=""></image>
				</view>
			</view>
			<!-- 联系客服 -->
			<view class="flex padding-lr padding-tb dfs" @click="goNav(list[6].url)">
				<image :src="list[6].image" style="width: 50rpx; height: 50rpx" mode=""></image>
				<view class="flex-sub margin-left text-df" style="line-height: 50upx">{{ list[6].title }}</view>
				<image src="../../static/images/my/right.png" class="images" mode=""></image>
			</view>
			<!-- 关于我们 -->
			<!-- <view class="flex padding-lr padding-tb dfs" @click="goNav(list[7].url)">
				<image :src="list[7].image" style="width: 50rpx;height: 50rpx;" mode=""></image>
				<view class="flex-sub margin-left text-df" style="line-height: 50upx;">{{list[7].title}}</view>
				<image src="../../static/images/my/right.png" class="images" mode=""></image>
			</view> -->
			<!-- 意见反馈 -->
			<view class="flex padding-lr padding-tb dfs" @click="goNav(list[8].url)" v-if="XCXIsSelect == '是'">
				<image :src="list[8].image" style="width: 50rpx; height: 50rpx" mode=""></image>
				<view class="flex-sub margin-left text-df" style="line-height: 50upx">{{ list[8].title }}</view>
				<image src="../../static/images/my/right.png" class="images" mode=""></image>
			</view>
			<!-- 我的投诉 -->
			<view class="flex padding-lr padding-tb dfs" @click="goNav(list[9].url)">
				<image :src="list[9].image" style="width: 50rpx; height: 50rpx" mode=""></image>
				<view class="flex-sub margin-left text-df" style="line-height: 50upx">{{ list[9].title }}</view>
				<image src="../../static/images/my/right.png" class="images" mode=""></image>
			</view>
			<!-- #ifdef MP-WEIXIN -->
			<view class="flex padding-lr padding-tb dfs" @click="gouser()">
				<image :src="list[10].image" style="width: 50rpx; height: 50rpx" mode=""></image>
				<view class="flex-sub margin-left text-df" style="line-height: 50upx">{{ list[10].title }}</view>
				<image src="../../static/images/my/right.png" class="images" mode=""></image>
			</view>
			<!-- #endif -->
			<!-- 系统设置 -->
			<view class="flex padding-lr padding-tb dfs" @click="goset()">
				<image :src="list[11].image" style="width: 50rpx; height: 50rpx" mode=""></image>
				<view class="flex-sub margin-left text-df" style="line-height: 50upx">{{ list[11].title }}</view>
				<image src="../../static/images/my/right.png" class="images" mode=""></image>
			</view>

			<!-- 退出登录 -->
			<!-- <view class="flex padding-lr padding-tb dfs" @click="TuiLogin()" v-if="!isLogin">
				<image :src="list[10].image" style="width: 50rpx;height: 50rpx;" mode=""></image>
				<view class="flex-sub margin-left text-df" style="line-height: 50upx;">{{list[10].title}}</view>
				<image src="../../static/images/my/right.png" class="images" mode=""></image>
			</view> -->
		</view>
		<!-- 二维码弹窗 -->
		<u-popup v-model="show" mode="center" border-radius="14" width="500rpx" height="500rpx" closeable>
			<view style="width: 180px; height: 180px; margin: 40px auto">
				<image :src="shopQrImg" style="width: 100%; height: 100%" @click="previewImage(shopQrImg)"></image>
			</view>
		</u-popup>

		<!-- 私域二维码弹窗 -->
		<u-popup v-model="showSphere" mode="center" border-radius="14" width="500rpx" height="500rpx" closeable>
			<view style="width: 180px; height: 180px; margin: 40px auto">
				<image :src="shopQrImgSphere" style="width: 100%; height: 100%" @click="previewImage(shopQrImgSphere)"></image>
			</view>
		</u-popup>
	</view>
</template>

<script>
import configurl from '../../common/config.js'
import { encrypt, decrypt, urlSafeBase64Decode, urlSafeBase64Encode } from '@/utils/cryptojs.js'
export default {
	data() {
		return {
			shopCover: '../../static/logo.png',
			isLogin: true,
			shopName: '匿名',
			sumMoney: 0, //累计余额
			dayMoney: 0, //今日收益
			monthMoney: 0, //本月预估收益
			cashMoney: 0, // 本月预估提现
			shopToken: '',
			isVip: false,
			invitationCode: '', //邀请码
			list: [
				{
					image: '../../static/images/my/dianpu.png',
					title: '店铺管理',
					url: '/my/store/index'
				},
				{
					image: '../../static/images/my/shangpin.png',
					title: '商品管理',
					url: '/my/store/addgood'
				},
				{
					image: '../../static/images/my/order.png',
					title: '订单管理',
					url: '/pages/order/index'
				},
				{
					image: '../../static/images/my/fenlei.png',
					title: '分类管理',
					url: '/my/store/fenlei'
				},
				{
					image: '../../static/images/my/guige.png',
					title: '规格管理',
					url: '/my/store/guige'
				},
				{
					image: '../../static/images/my/baozhengjin.png',
					title: '保证金',
					url: '/my/other/money'
				},
				{
					image: '../../static/images/my/kefu.png',
					title: '联系客服',
					url: '/pages/my/chat'
				},
				{
					image: '../../static/images/my/guanyu.png',
					title: '关于我们',
					url: '/my/other/about'
				},
				{
					image: '../../static/images/my/yijian.png',
					title: '意见反馈',
					url: '/my/feedback/index'
				},
				{
					image: '../../static/images/my/00.png',
					title: '我的投诉',
					url: '/my/other/tousu'
				},
				{
					image: '../../static/images/my/user.png',
					title: '前往用户端',
					url: ''
				},
				{
					image: '../../static/images/my/set1.png',
					title: '系统设置',
					url: '/my/other/set'
				},
				{
					image: '../../static/images/my/liaotian.png',
					title: '聊天中心',
					url: '/pages/my/liaotian'
				},
				{
					image: '../../static/images/order/pinglun.png',
					title: '店铺评价',
					url: '/my/store/pingjia'
				},
				{
					image: '../../static/images/order/hd.png',
					title: '精选活动',
					url: '/my/store/huodong'
				},
				{
					image: '../../static/images/order/yhq.png',
					title: '优惠券管理',
					url: '/my/yhq/yhq'
				},
				{
					image: '../../static/images/order/print.png',
					title: '打印机配置',
					url: '/my/print/print'
				},
				{
					image: '../../static/images/order/gonghuo.png',
					title: '供货订购',
					url: ''
				},
				{
					image: '../../static/images/order/yhq.png',
					title: '销量管理',
					url: '/pages/my/sales/sales'
				}
			],
			renzheng: 0,
			XCXIsSelect: '否',
			isCashDeposit: '',
			show: false,
			showSphere: false,
			shopQrImg: '',
			shopQrImgSphere: '',
			open: true,
			arr: [],
			messageCount: '',
			isChecked: false,
			userId: '',
			messageConfiguration: '',
			timer: null,
			errCount: 0
		}
	},
	onLoad() {
		// this.messageCount = uni.getStorageSync('messageCount')
		this.XCXIsSelect = this.$queue.getData('XCXIsSelect')
		this.shopToken = uni.getStorageSync('shopToken') ? uni.getStorageSync('shopToken') : ''
		this.userId = uni.getStorageSync('userId')
		this.open = uni.getStorageSync('open')
		this.$Request.getT('/app/common/type/354').then((res) => {
			//订单取消通知
			if (res.code == 0) {
				if (res.data && res.data.value) {
					this.arr.push(res.data.value)
				}
			}
		})
		this.$Request.getT('/app/common/type/353').then((res) => {
			//订单取消通知
			if (res.code == 0) {
				if (res.data && res.data.value) {
					this.arr.push(res.data.value)
				}
			}
		})
		this.$Request.getT('/app/common/type/352').then((res) => {
			//新订单通知
			if (res.code == 0) {
				if (res.data && res.data.value) {
					this.arr.push(res.data.value)
				}
			}
		})
		// let that= this
		// if (this.open = true) {
		// 	uni.showModal({
		// 		title: '提示',
		// 		content: '请先去完善店铺信息,上线店铺后同城外卖用户端首页展示您的店铺。',
		// 		success: function(res) {
		// 			if (res.confirm) {
		// 				console.log('用户点击确定');
		// 				that.open = false
		// 				that.$queue.setData("open", that.open);
		// 			} else if (res.cancel) {
		// 				console.log('用户点击取消');
		// 				that.open = false
		// 				that.$queue.setData("open", that.open);
		// 			}
		// 		}
		// 	})
		// }
	},
	onShow() {
		this.userId = uni.getStorageSync('userId')
		this.shopToken = uni.getStorageSync('shopToken') ? uni.getStorageSync('shopToken') : ''
		if (this.shopToken) {
			this.messageCount = uni.getStorageSync('messageCount')
			this.isLogin = false
			this.getUserInfo()
			this.getshanghuinfo()
			this.getAmount()
		} else {
			this.isLogin = true
			this.shopName = '匿名'
			this.shopCover = '../../static/logo.png'
			this.sumMoney = 0 //累计余额
			this.dayMoney = 0 //今日收益
			this.monthMoney = 0 //本月收益
			this.cashMoney = 0 //本月提现
		}
		if (this.userId) {
			this.getSetData()
		}
	},
	onHide() {
		if (this.timer) {
			clearInterval(this.timer)
		}
	},
	methods: {
		getSetData() {
			// 获取订阅消息配置
			let data = {
				shopId: uni.getStorageSync('shopId')
			}
			this.$Request.getT('/app/goods/selectGoodShop', data).then((res) => {
				// console.log(res, '888')
				if (res.code == 0) {
					if (res.data.messageConfiguration == 1) {
						this.isChecked = false
					} else {
						this.isChecked = true
					}

					this.messageConfiguration = res.data.messageConfiguration

					if (this.messageConfiguration == 0) {
						this.timer = setInterval(() => {
							// 订单消息提醒
							let data = {
								shopIds: this.$queue.getData('shopId')
							}
							this.$Request.post('/admin/ordermessage/selectReadFlagCount', data).then((res) => {
								console.log(res, '999')
								if (res.code === 0) {
									if (res.data > 0) {
										if (this.errCount != res.data) {
											this.errCount = res.data
											this.aplayAudio()
											uni.showModal({
												title: '消息',
												content: '有' + res.data + '条订单，请前往订单中心处理。',
												success: (ret) => {
													if (ret.confirm) {
														uni.switchTab({
															url: '/pages/order/index'
														})
													} else {
														console.log('else', ret)
														this.defineCallBack()
													}
												}
											})
											// this.chatNum = data.data
										}
									} else {
										this.errCount = 0
									}
								}
							})
						}, 10000)
					}
				}
			})
		},
		aplayAudio() {
			const innerAudioContext = uni.createInnerAudioContext()
			innerAudioContext.autoplay = true
			innerAudioContext.src = 'https://pw.xianmxkj.com/file/uploadPath/2022/01/19/0753211f78d718d44ee6372e33eae9ee.mp3'
			innerAudioContext.onPlay(() => {
				console.log('开始播放')
			})
			innerAudioContext.onError((res) => {
				console.log(res.errMsg)
				console.log(res.errCode)
			})
		},
		defineCallBack() {
			let data = {
				shopIds: this.$queue.getData('shopId')
			}
			this.$Request.post('/admin/ordermessage/allcheckOrderMessage', data).then((res) => {
				if (res.code === 0) {
					this.errCount = 0
				}
			})
		},
		previewImage(img) {
			let arr = []
			arr.push(img)
			//uniapp预览轮播图方法
			uni.previewImage({
				current: 0, //预览图片的下标
				urls: arr //预览图片的地址，必须要数组形式
			})
		},
		//跳转设置
		goset() {
			uni.navigateTo({
				url: '/my/other/set'
			})
		},
		//生成二维码
		shopQr() {
			// uni.showLoading({
			// 	title: '二维码生成中',
			// 	duration: 1000,
			// 	icon: 'none'
			// });
			this.show = true

			let shopid = urlSafeBase64Encode(encrypt(uni.getStorageSync('shopId').toString()))
			this.shopQrImg = configurl.APIHOSTsss + '/sqx_fast/invite/shopQr?shopId=' + shopid
			console.log(this.shopQrImg, 'oooo')
		},
		//生成私域二维码
		shopQrSphere() {
			this.showSphere = true

			let shopid = urlSafeBase64Encode(encrypt(uni.getStorageSync('shopId').toString()))
			this.shopQrImgSphere = configurl.APIHOSTsss + '/sqx_fast/invite/shopQr2?shopId=' + shopid
			console.log(this.shopQrImgSphere, 'oooo——Sphere')
		},
		//跳转用户端
		gouser() {
			wx.navigateToMiniProgram({
				appId: 'wx45ab46867002aa0b',
				path: '/pages/index/index',
				envVersion: 'release', // 打开正式版
				success(res) {
					// 打开成功
				},
				fail: function (err) {
					console.log(err)
				}
			})
		},
		//跳转供货商
		goGong() {
			wx.navigateToMiniProgram({
				appId: 'wx45ab46867002aa0b',
				path: '/pages/index/shopList/indexShop',
				envVersion: 'release', // 打开正式版release
				success(res) {
					// 打开成功
				},
				fail: function (err) {
					console.log(err)
				}
			})
		},
		goQian() {
			if (this.shopToken) {
				// #ifdef MP-WEIXIN
				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)
						}
					})
				}
				// #endif
				uni.navigateTo({
					url: '/my/other/wallet'
				})
			} else {
				uni.showModal({
					title: '提示',
					content: '您还未登录,请先登录',
					success: function (res) {
						if (res.confirm) {
							console.log('用户点击确定')
							uni.navigateTo({
								url: '/pages/my/loginphone'
							})
						} else if (res.cancel) {
							console.log('用户点击取消')
						}
					}
				})
			}
		},
		bindFb() {
			let renzheng = uni.getStorageSync('renzheng')
			console.log(this.userId, renzheng)

			if (this.shopToken) {
				// #ifdef MP-WEIXIN
				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)
						}
					})
				}
				// #endif
				uni.navigateTo({
					url: '/my/publish/editor'
				})
			} else {
				uni.showModal({
					title: '提示',
					content: '您还未登录,请先登录',
					success: function (res) {
						if (res.confirm) {
							console.log('用户点击确定')
							uni.navigateTo({
								url: '/pages/my/loginphone'
							})
						} else if (res.cancel) {
							console.log('用户点击取消')
						}
					}
				})
			}
		},
		goOrder() {
			uni.switchTab({
				url: '/pages/order/index'
			})
		},
		//列表跳转
		goNav(e, name) {
			console.log(e)
			if (this.shopToken) {
				// #ifdef MP-WEIXIN
				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)
						}
					})
				}
				// #endif
				uni.navigateTo({
					url: e
				})
			} else {
				uni.showModal({
					title: '提示',
					content: '您还未登录,请先登录',
					success: function (res) {
						if (res.confirm) {
							console.log('用户点击确定')
							uni.navigateTo({
								url: '/pages/my/loginphone'
							})
						} else if (res.cancel) {
							console.log('用户点击取消')
						}
					}
				})
			}
		},
		//列表跳转
		goNavs(e, name) {
			console.log(e)
			let cashDeposit = uni.getStorageSync('cashDeposit')
			if (this.shopToken) {
				// #ifdef MP-WEIXIN
				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)
						}
					})
				}
				// #endif
				if (cashDeposit == 0 || cashDeposit == 'null') {
					uni.showModal({
						title: '提示',
						content: '您还未缴纳保证金，请先去缴纳保证金',
						success: function (res) {
							if (res.confirm) {
								console.log('用户点击确定')
								uni.navigateTo({
									url: '/my/other/money'
								})
							} else if (res.cancel) {
								console.log('用户点击取消')
							}
						}
					})
				} else {
					uni.navigateTo({
						url: e
					})
				}
			} else {
				uni.showModal({
					title: '提示',
					content: '您还未登录,请先登录',
					success: function (res) {
						if (res.confirm) {
							console.log('用户点击确定')
							uni.navigateTo({
								url: '/pages/my/loginphone'
							})
						} else if (res.cancel) {
							console.log('用户点击取消')
						}
					}
				})
			}
		},
		goLogin(e) {
			uni.navigateTo({
				url: e
			})
		},
		//我的收益
		getAmount() {
			let data = {
				shopId: uni.getStorageSync('shopId')
			}
			this.$Request.get('/app/shop/shopEarnings', data).then((res) => {
				if (res.code == 0) {
					this.sumMoney = parseFloat(res.data.shopAllEarnings).toFixed(2) //累计余额
					this.dayMoney = parseFloat(res.data.shopEarningsDay).toFixed(2) //今日收益
					this.monthMoney = parseFloat(res.data.shopEarningsMonth).toFixed(2) //本月收益
					this.cashMoney = parseFloat(res.data.cashMoney).toFixed(2) //本月提现
				}
			})
		},
		getshanghuinfo() {
			let data = {
				shopId: uni.getStorageSync('shopId')
			}
			this.$Request.get('/app/shop/selectShopMessage', data).then((res) => {
				if (res.code == 0) {
					uni.setStorageSync('cashDeposit', res.data.cashDeposit)
				}
			})
		},
		goNav(url) {
			if (this.shopToken) {
				// #ifdef MP-WEIXIN
				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)
						}
					})
				}
				// #endif
				uni.navigateTo({
					url
				})
			} else {
				uni.navigateTo({
					url: '/pages/my/loginphone'
				})
			}
		},
		getUserInfo() {
			this.$Request.getA('/sys/user/info').then((res) => {
				console.log(res, 'ljh')
				if (res.code == 0) {
					this.shopName = res.user.shopList[0].shopName
					this.shopCover = res.user.shopList[0].shopCover ? res.user.shopList[0].shopCover : '../../static/logo.png'
					this.$queue.setData('avatar', res.user.shopList[0].shopCover)
					this.$queue.setData('userId', res.user.userId)
					this.$queue.setData('shopId', res.user.shopList[0].shopId)
					this.$queue.setData('mobile', res.user.mobile)
					this.$queue.setData('shopUserName', res.user.shopList[0].shopName)
					if (res.user.userEntity) {
						this.$queue.setData('zhiFuBao', res.user.userEntity.zhiFuBao)
						this.$queue.setData('zhiFuBaoName', res.user.userEntity.zhiFuBaoName)
					}
				}
			})
		},
		// switch切换回调
		switchChange(e) {
			let data = {
				shopId: uni.getStorageSync('shopId'),
				messageConfiguration: e.detail.value ? 0 : 1
			}

			this.$Request.postJson('/app/goods/updateGoodShop', data).then((res) => {
				if (res.code == 0) {
					uni.showToast({
						title: this.isChecked ? '关闭成功' : '开启成功',
						icon: 'none',
						mask: true
					})

					setTimeout(() => {
						if (this.timer) {
							clearInterval(this.timer)
						}
						this.getSetData()
					}, 1500)
				}
			})
		}
	}
}
</script>

<style lang="scss">
page {
	background-color: #f2f2f2;
}

.bg {
	background: #ffffff;
}

.camera {
	width: 54px;
	height: 44px;

	&:active {
		background-color: #ededed;
	}
}

.btn-bg {
	width: 64px;
	height: 28px;
	background: linear-gradient(90deg, #cda26e 0%, #dcb78a 100%);
	border-radius: 28px;
	text-align: center;
	line-height: 28px;
	margin-top: 4px;
	color: '#604320';
}

.images {
	width: 18rpx;
	height: 30rpx;
}

.dfs {
	display: flex;
	align-items: center;
}

.moneybox {
	width: 690upx;
	margin: 0 auto;
	// height: 369upx;
	// background: #2FB57A;
	border-radius: 20upx 20upx 20upx 20upx;
}

.btn {
	width: 160upx;
	height: 60upx;
	background: linear-gradient(90deg, #3d3734 0%, #252323 100%);
	border-radius: 50upx;
	text-align: center;
	line-height: 60upx;
	color: #ffffff;
}

.xflist {
	width: 150upx;
	height: 50upx;
	background: #211d2c;
	color: #ffffff;
	border-radius: 5upx;
	text-align: center;
	line-height: 50upx;
}

.erweima {
	background: #fcd202;
	padding: 5px 10px;
	border-radius: 20px;
}

.bott {
	background: red;
	color: #ffffff;
	width: 30upx;
	height: 30upx;
	text-align: center;
	line-height: 26upx;
	padding: 5rpx;
	border-radius: 60%;
	font-size: 23rpx;
	margin-right: 15rpx;
}
</style>
