sadjv1/anmo-user-uniapp/pages/index/index.vue

1295 lines
40 KiB
Vue
Raw Normal View History

2024-06-03 09:26:34 +08:00
<template>
<view style="padding-bottom: 80upx;">
<view class="bg">
<view class=" u-flex padding-lr" style="padding: 20px 30rpx 120px;align-items: center;">
<!-- <view class="u-m-r-10" >
<image :src="avatar" class="img-avatar"></image>
</view> -->
<view class="u-flex-1 u-m-l-10 text-white" v-if="!isLogin">
<view class="flex align-center justify-between">
<view class="">
<view class="u-font-18 text-white text-bold" @click="goNav('/pages/my/user')">欢迎{{userName}}</view>
<view class="labe margin-top-xs" @tap="stateSave" v-if="XCXIsSelect != '否'">
<view class="online-tag" v-if="isTrue">在线</view>
<view class="online-tag" v-if="!isTrue">离线</view>
<!-- <switch :checked="isTrue" disabled/> -->
<switch type="switch" :checked='isTrue'
style="padding: 0 10rpx;transform:scale(0.8)" color="#096f4b" disabled/>
</view>
</view>
<view class="gxbox" @click="goNavs('/my/qiandao/index')">
<template v-if="loglataddress">
<view class="flex align-center">
更新位置<text class="wztext">{{loglataddress}}</text>
</view>
<view class="flex align-center" style="margin-top: 5px;">
更新时间<text class="wztime">{{loglattime}}</text>
</view>
</template>
<template v-else>
<view class="flex align-center" style="justify-content: center;">
点击更新位置
</view>
</template>
</view>
<!-- <view class="flex margin-left-sm " style="font-size: 22rpx;font-weight: 500;"
v-if="XCXIsSelect != '否'">
<view v-if="renzheng == 0" @click.stop="goNav('/my/renzheng/rzType')">
暂未实名认证
</view>
<view v-if="renzheng == 1" @click.stop="goNav('/my/renzheng/index')">
实名审核中
</view>
<view v-if="renzheng == 2">
已实名认证
</view>
<view v-if="renzheng == 3" @click.stop="goNav('/my/renzheng/index')">
实名已拒绝
</view>
</view> -->
</view>
</view>
<view v-else class="text-xl text-white u-p-l-20 text-bold" @click="goLogin('/pages/public/login')">
登录
</view>
</view>
<!-- <view class="box" v-if="XCXIsSelect != '否'">
<view class="">
<text class="text-bold text-xl">{{sumMoney}}</text>
<view>总收益</view>
</view>
<view class="">
<text class="text-bold text-xl">{{countOrderNum}}</text>
<view>总销量</view>
</view>
<view class="">
<text class="text-bold text-xl">{{countTakingByUserId}}</text>
<view>用户评价</view>
</view>
<view class="">
<text class="text-bold text-xl">{{countByUserId}}</text>
<view>访客人数</view>
</view>
</view> -->
</view>
<view style="margin-top: -100px;padding: 30rpx;">
<view class="dengjibox" @click="getJqqd()">
<view class="djtit">当前等级</view>
<view class="djimg">
V1
</view>
<view class="" style="margin-top: 20px;">
<text style="font-size: 30px;font-weight: bold;">{{sumMoney}}</text>
<text style="font-size: 16px;">/6500</text>
</view>
<view class="tiaob">
<view class="xtiaob"></view>
</view>
<view class="" style="font-size: 15px;margin-top: 8px;text-align: center;">还差6102业绩 780积分可升级 V2</view>
<view class="flex align-center" style="justify-content: space-evenly;text-align: center;margin-top: 12px;">
<view class="">
<view class="" style="font-size: 22px;font-weight: bold;">{{sumMoney}}</view>
<view class="" style="font-size: 12px;">当期收益()</view>
</view>
<view class="xianb"></view>
<view class="">
<view class="" style="font-size: 22px;font-weight: bold;">5410</view>
<view class="" style="font-size: 12px;">当期积分</view>
</view>
</view>
</view>
<view class="csda" @click="getJqqd()">
<view class="flex align-center" style="font-size: 16px;font-weight: bold;color: #fff;margin-top: 8px;">
物料记录
<image src="../../static/images/index/yiwen.png" style="width: 16px;height: 17px;margin-left: 10px;"></image>
</view>
<view class="flex align-center justify-between zbhsga">
<view class="">护理包 0</view>
<view class="xianc"></view>
<view class="">精油 0</view>
<view class="xianc"></view>
<view class="">艾灸条 0</view>
<view class="xianc"></view>
<view class="">面膜 0</view>
</view>
</view>
<view class="flex align-center justify-between" style="margin-top: 20px;" @click="getJqqd()">
<view class="dsalk" style="border: 2px #cfede1 solid;background-color: #f6fcfa;">
<view class="sda flex align-center"><image src="../../static/images/index/dd01.png" style="width: 15px;height: 19px;"></image></view>
<view class="dqda">当期订单</view>
<view class="" style="font-size: 20px;color: #2FB57A;margin-top: 6px;font-weight: bold;">{{countOrderNum}}</view>
</view>
<view class="dsalk">
<view class="sda flex align-center"><image src="../../static/images/index/dd02.png" style="width: 20px;height: 20px;"></image></view>
<view class="dqda">当期加钟率</view>
<view class="" style="font-size: 20px;color: #333333;margin-top: 6px;font-weight: bold;">0%</view>
</view>
<view class="dsalk">
<view class="sda flex align-center"><image src="../../static/images/index/dd03.png" style="width: 20px;height: 20px;"></image></view>
<view class="dqda">当期充值率</view>
<view class="" style="font-size: 20px;color: #ff6c25;margin-top: 6px;font-weight: bold;">0%</view>
</view>
</view>
<!-- <view class="box1" @click="goNav('/my/shuju/index')">
<view class="text-bold text-lg margin-bottom-sm">订单数据</view>
<view class="orderbox ">
<view class="text-center">
<text class="text-bold text-xl">{{orderMoney}}</text>
<view class="margin-top-xs">订单收入</view>
</view>
<view class="text-center">
<text class="text-bold text-xl">{{countOrder}}</text>
<view class="margin-top-xs">总订单数</view>
</view>
<view class="text-center">
<text class="text-bold text-xl">{{sumRefund}}</text>
<view class="margin-top-xs">退款金额</view>
</view>
<view class="text-center">
<text class="text-bold text-xl">{{countByUserId}}</text>
<view class="margin-top-xs">访客人数</view>
</view>
</view>
</view> -->
<!-- <view class="guanlibox" @click="goDetail(1)" style="color: #FFFFFF; margin-top:30rpx;border-radius: 20rpx 20rpx 0 0; background-color: #FFFFFF;">
<view class="text-bold text-lg margin-bottom-sm flex justify-between">
<view>订单管理</view>
</view>
<view class="flex">
<view class="flex align-center radius" style="width: 33%;">
<view class="margin-left" style="text-align: center;margin: 0 auto;">
<view class="margin-top-xs">待服务</view>
<text class="text-bold text-xl">{{countOrderIng}}</text>
</view>
</view>
<view class="flex align-center radius "
style="padding: 10rpx auto;width: 33%;">
<view class="margin-left" style="text-align: center;margin: 0 auto;">
<view class="margin-top-xs">进行中</view>
<text class="text-bold text-xl">{{countOrderAppraise}}</text>
</view>
</view>
<view class="flex align-center radius "
style="width: 33%;">
<view class="margin-left" style="text-align: center; margin: 0 auto;">
<view class="margin-top-xs"style="width: 100%">已完成</view>
<text class="text-bold text-xl">{{countOrderEnd}}</text>
</view>
</view>
</view>
</view> -->
<!-- <view class="guanlibox2" style="border-radius: 0 0 20rpx 20rpx; background-color: #FFFFFF;">
<view class="text-bold text-lg margin-bottom-sm flex justify-between">
<view style="color: #FFFFFF;">订单数据</view>
</view>
<view class="flex" style="color: #FFFFFF;">
<view class="flex align-center" style="width: 33%;">
<view class="margin-left" style="text-align: center;margin: 0 auto;">
<view class="margin-top-xs" >订单收入</view>
<text class="text-bold text-xl" >{{orderMoney}}</text>
</view>
</view>
<view class="flex align-center"
style="padding: 10rpx auto;width: 33%;">
<view class="margin-left" style="text-align: center;margin: 0 auto;">
<view class="margin-top-xs">总订单数</view>
<text class="text-bold text-xl">{{countOrder}}</text>
</view>
</view>
<view class="flex align-center"
style="padding: 10rpx auto;width: 33%;">
<view class="margin-left" style="text-align: center;margin: 0 auto;">
<view class="margin-top-xs">退款金额</view>
<text class="text-bold text-xl">{{sumRefund}}</text>
</view>
</view>
</view>
</view> -->
<view class="flex align-center justify-between" style="margin-top: 20px;" v-if="XCXIsSelect != '否'">
<view class="text-center" @click="goNavs('/pages/my/mangshi')">
<image src="../../static/images/index/order1.png" style="width: 70rpx;height: 80rpx;"></image>
<view>忙时设置</view>
</view>
<view class="text-center" @click="goNav('/my/shuju/index')">
<image src="../../static/images/index/order2.png" style="width: 80rpx;height: 76rpx;"></image>
<view>数据统计</view>
</view>
<view class="text-center" @click="getJqqd()">
<image src="../../static/images/index/order3.png" style="width: 48rpx;height: 77rpx;"></image>
<view>分成明细</view>
</view>
<view class="text-center" @click="getJqqd()">
<image src="../../static/images/index/order4.png" style="width: 56rpx;height: 78rpx; "></image>
<view>资金明细</view>
</view>
<view class="text-center" @click="goNavs('/pages/index/jinji')">
<image src="../../static/images/index/order5.png" style="width: 76rpx;height: 78rpx;"></image>
<view>紧急报警</view>
</view>
</view>
<!-- <view class="flex justify-between margin-top" style="border: 1rpx solid #cccccc;background-color: #e1f5ea; border-radius: 20rpx;">
<view class="guanlibox" @click="goDetail(1)">
<view class="text-bold text-lg margin-bottom-sm flex justify-between">
<view>订单管理</view>
<view>
<image src="../../static/images/back.png" style="width: 12upx;height: 20upx;"></image>
</view>
</view>
<view class="flex align-center radius" style="background: #E8F9EF;padding: 10rpx 20rpx;">
<image src="../../static/images/index/order1.png"
style="width: 72rpx;height: 72rpx;border-radius: 50%;">
</image>
<view class="margin-left">
<view class="margin-top-xs">待服务</view>
<text class="text-bold text-xl">{{countOrderIng}}</text>
</view>
</view>
<view class="flex align-center radius margin-top-sm"
style="background: #EFF3FF;padding: 10rpx 20rpx;">
<image src="../../static/images/index/order2.png"
style="width: 72rpx;height: 72rpx;border-radius: 50%;">
</image>
<view class="margin-left">
<view class="margin-top-xs">进行中</view>
<text class="text-bold text-xl">{{countOrderAppraise}}</text>
</view>
</view>
<view class="flex align-center radius margin-top-sm"
style="background: #FEF8E8;padding: 10rpx 20rpx;">
<image src="../../static/images/index/order3.png"
style="width: 72rpx;height: 72rpx;border-radius: 50%;">
</image>
<view class="margin-left">
<view class="margin-top-xs">已完成</view>
<text class="text-bold text-xl">{{countOrderEnd}}</text>
</view>
</view>
</view>
<view style="border: 0.5rpx solid #EEEEEE;"></view>
<view class="guanlibox2" @click="goNav('/my/shuju/index')">
<view class="text-bold text-lg margin-bottom-sm flex justify-between">
<view>订单数据</view>
<view>
<image src="../../static/images/back.png" style="width: 12upx;height: 20upx;"></image>
</view>
</view>
<view class="flex align-center radius" style="background: #E8F9EF;padding: 10rpx 20rpx;">
<image src="../../static/images/index/order4.png"
style="width: 72rpx;height: 72rpx;border-radius: 50%;">
</image>
<view class="margin-left">
<view class="margin-top-xs">订单收入</view>
<text class="text-bold text-xl">{{orderMoney}}</text>
</view>
</view>
<view class="flex align-center radius margin-top-sm"
style="background: #EFF3FF;padding: 10rpx 20rpx;">
<image src="../../static/images/index/order5.png"
style="width: 72rpx;height: 72rpx;border-radius: 50%;">
</image>
<view class="margin-left">
<view class="margin-top-xs">总订单数</view>
<text class="text-bold text-xl">{{countOrder}}</text>
</view>
</view>
<view class="flex align-center radius margin-top-sm"
style="background: #FEF8E8;padding: 10rpx 20rpx;">
<image src="../../static/images/index/order6.png"
style="width: 72rpx;height: 72rpx;border-radius: 50%;">
</image>
<view class="margin-left">
<view class="margin-top-xs">退款金额</view>
<text class="text-bold text-xl">{{sumRefund}}</text>
</view>
</view>
</view>
</view> -->
<view style="margin-top: 40rpx;" v-if="goods.length > 0">
<view class="text-bold text-lg" style="border-bottom: 5rpx solid #2FB57A;">
<text style="border-radius: 10rpx 10rpx 0 0; background-color: #2FB57A;padding: 15rpx 15rpx 5rpx 15rpx;color: white;">今日服务</text>
</view>
<view class="bgwhite radius margin-top-sm padding-bottom-sm" style="border-radius: 15rpx;" v-for="(item,index) in goods" :key='index'
@click="goNav('/my/order/pay?ordersId='+item.ordersId)">
<view class="flex justify-between padding-sm">
<view class="text-green">预约时间{{item.serveTime}}</view>
<view class="text-green" v-if="item.status ==1">待付款...</view>
<view class="text-green" v-if="item.status ==2">待服务</view>
<view class="text-green" v-if="item.status ==5">已完成</view>
<view class="text-green" v-if="item.status ==6">进行中</view>
<view class="text-green" v-if="item.status ==7">已出发</view>
<view class="text-green" v-if="item.status ==8">已到达</view>
<view class="text-green" v-if="item.status ==3">待评价</view>
<view class="text-green" v-if="item.status ==4" style="color: #999999;">已取消</view>
<view v-if="item.overTimeOrders == 1" style="color: red;font-size:26rpx">(订单已超时)</view>
<!-- <view class="text-green" v-if="item.state ==1 ||item.state ==2">待完成</view>
<view class="text-green" v-if="item.state ==3||item.state ==4">已完成</view> -->
</view>
<view class="xian"></view>
<view class=" u-flex u-p-t-30 padding-sm">
<view class="u-m-r-10">
<u-avatar :src="item.massageImg?item.massageImg: '../../static/logo.png'" mode="square"
size="100">
</u-avatar>
</view>
<view class="u-flex-1 margin-left-xs">
<view class="u-font-18 text-bold u-line-1" style="width: 560rpx;">
<view class="margin-right-xs text-df margin-left-xs"
style="margin-top: 0rpx;display: inline-block;width: 400rpx; overflow: hidden;white-space: nowrap;text-overflow: ellipsis;">
{{item.title}}
</view>
</view>
<view class="margin-left-xs text-cut" style="width:550upx">{{item.address}}</view>
</view>
</view>
<view class="flex u-p-t-20 justify-between align-center padding-sm">
<view class=" flex-sub ">
实收<text class="text-df"></text><text
class="text-xl text-bold">{{item.sumArtificerMoney}}</text>
</view>
<view class="flex text-right">
<!-- <u-button v-if="item.status == 1" :custom-style="customStyle" shape="circle" :plain="true"
@click="cancelOrder(item)">取消订单</u-button> -->
<u-button v-if="item.status == 1" :custom-style="customStyle1" shape="circle" :plain="true"
@click="bindphone(item.phone)">联系TA</u-button>
<u-button v-if=" item.state==1" :custom-style="customStyle1" shape="circle" :plain="true"
@click="goNav('/my/order/pay?id='+item.ordersId+'&isTrue=1')">查看详情</u-button>
<u-button v-if="item.status == 6" :custom-style="customStyle" shape="circle" :plain="true"
@click="cancel(item)">订单完成</u-button>
</view>
</view>
<view class="xian" v-if="item.endTime && item.endTime.day && item.status == 6"></view>
<view class="pintuan_syrs flex justify-between"
v-if="item.endTime && item.endTime.day && item.status == 6">
<view style="font-size: 28rpx;font-family: PingFang SC;font-weight: bold;color: #2FB57A;">服务倒计时
</view>
<uni-countdown :day="item.endTime.day" :hour="item.endTime.hour" :minute="item.endTime.minute"
:second="item.endTime.second" color="#20C675">
</uni-countdown>
</view>
</view>
</view>
<uni-popup ref="popup" type="center">
<view style="background: #fff;width:658upx;height: 960upx; border-radius:17upx;position: relative;">
<image :src="Guanggao" style="width: 100%;height: 100%;" mode="aspectFill"
@tap="saveImgs(Guanggao)"></image>
</view>
</uni-popup>
</view>
</view>
</template>
<script>
import empty from '@/components/empty.vue'
import * as websocketUtils from 'utils/websocketUtils.js';
export default {
components: {
empty
},
data() {
return {
Guanggao: '',
ssDW: false,
stateName: '休息中',
avatar: '../../static/logo.png',
isLogin: true,
userName: '匿名',
renzheng: 0,
goods: [],
sumMoney: 0, //总收益
countOrderNum: 0, //总销量
countTakingByUserId: 0, //用户评价数
orderMoney: 0, //订单收入
countOrder: 0, //总订单数
sumRefund: 0, //退款金额
countByUserId: 0, //访客人数
countOrderIng: 0, //待接单
countOrderAppraise: 0, //待完成
countOrderEnd: 0, //已完成
putaway: 0, //上架中
soldOut: 0, //下架中
page: 1,
limit: 10,
longitude: '',
latitude: '',
isTrue: true,
showModal: true,
userId: '',
arr: [],
city: '',
invitationCode:'',
isCashDeposit: 0,
loglattime:'',
loglataddress:'',
switchList:[
{title:'在线',value:true},{title:'离线',value:false}
],
customStyle: {
color: '#999999',
border: '2rpx solid #999999',
// backgroundColor: '#1E1F31',
border: "8rpx",
width: '180rpx',
height: '54rpx',
margin: "0 0 0 20rpx"
},
customStyle1: {
color: '#2FB57A',
border: '2rpx solid #2FB57A',
border: "8rpx",
width: '180rpx',
height: '54rpx',
margin: "0 0 0 20rpx"
},
XCXIsSelect: '否',
time: ''
}
},
onShareAppMessage(res) { //发送给朋友
return {
title: this.tuiguang,
path: '/pages/index/index?invitation=' + this.invitationCode,
imageUrl: this.tuiguangImg,
}
},
onShareTimeline(res) { //分享到朋友圈
return {
title: this.tuiguang,
path: '/pages/index/index?invitation=' + this.invitationCode,
imageUrl: this.tuiguangImg,
}
},
onLoad(e) {
this.userId = uni.getStorageSync('userId')
// 获取邀请码保存到本地
if (e.invitation) {
this.$queue.setData('inviterCode', e.invitation);
}
// #ifdef MP-WEIXIN
if (e.scene) {
const scene = decodeURIComponent(e.scene);
this.$queue.setData('inviterCode', scene.split(',')[0]);
}
// #endif
this.$Request.getT('/app/common/type/247').then(res => { //下单成功
if (res.code == 0) {
if (res.data && res.data.value) {
this.arr.push(res.data.value)
}
}
})
this.$Request.getT('/app/common/type/249').then(res => { //用户完成成功
if (res.code == 0) {
if (res.data && res.data.value) {
this.arr.push(res.data.value)
}
}
})
this.$Request.getT('/app/common/type/309').then(res => { //用户完成成功
if (res.code == 0) {
if (res.data && res.data.value) {
this.arr.push(res.data.value)
}
}
})
// 理疗师端首页是否弹框 380
this.$Request.get('/app/common/type/380').then(res => {
if (res.code == 0 && res.data.value && res.data.value === '是') {
this.$Request.get('/app/common/type/379').then(res => {
if (res.code == 0 && res.data && res.data.value) {
this.Guanggao = res.data.value;
this.$refs.popup.open();
}
});
}
});
this.getcity()
},
onShow() {
//是否开启理疗师端实时定位 330
this.$Request.get('/app/common/type/330').then(res => {
if (res.code == 0 && res.data) {
if (res.data.value != '是') {
this.ssDW = true;
} else {
this.ssDW = false;
}
}
});
this.$Request.get('/app/common/type/238').then(res => {
if (res.code == 0) {
// #ifdef MP-WEIXIN
this.$queue.setData('XCXIsSelect', res.data.value);
// #endif
// #ifndef MP-WEIXIN
this.$queue.setData('XCXIsSelect', '是');
// #endif
this.XCXIsSelect = this.$queue.getData("XCXIsSelect");
}
});
this.userId = uni.getStorageSync('userId')
this.isCashDeposit = uni.getStorageSync('isCashDeposit')
if (this.userId) {
this.isLogin = false
this.getJinRiOrder();
this.getUserInfo()
this.getFb()
this.getArtificer()
this.getNewOrder()
// #ifdef MP-WEIXIN
//订阅
if (this.showModal) {
this.openMsg()
}
// #endif
let that = this
that.time = setInterval(function() {
that.getNewOrder()
},10000)
} else {
this.isLogin = true
this.userName = '匿名'
this.browse = 0
this.fans = 0
this.follow = 0
this.visitor = 0
this.avatar = '../../static/logo.png'
}
},
methods: {
getJqqd(){
this.$queue.showToast('敬请期待!')
},
getNewOrder() {
let data = {
page: 1,
limit: 100,
state: 51
}
this.$Request.getT('/app/message/selectMessageByUserIds', data).then(res => {
if (res.code == 0) {
if (res.data.totalCount > 0) {
this.aplayAudios()
}
} else {
this.$queue.showToast(res.msg);
}
});
},
// 新订单语音播放
aplayAudios() {
console.log('语音提示')
const innerAudioContext = uni.createInnerAudioContext();
innerAudioContext.autoplay = true;
innerAudioContext.src =
'https://pw.xianmxkj.com/file/uploadPath/2022/03/15/c096db4257ecc2547814d4f51c6518bd.mp3';
innerAudioContext.onPlay(() => {
console.log('开始播放');
});
innerAudioContext.onError((res) => {
console.log(res.errMsg);
console.log(res.errCode);
});
},
saveImgs(imgs) {
let imgArr = [];
imgArr.push(imgs);
// //预览图片
uni.previewImage({
urls: imgArr,
current: 0
});
},
stateSave() {
this.$Request.postT('/app/artificer/updateArtificer').then(res => {
if (res.code == 0) {
this.getArtificer();
this.$queue.showToast('切换成功!')
} else {
this.$queue.showToast(res.msg);
}
});
},
// 取消订单
cancelOrder(e) {
let that = this
uni.showModal({
title: '提示',
content: '确认取消并删除订单?',
success: function(res) {
if (res.confirm) {
let data = {
ordersId: e.ordersId,
}
that.$queue.showLoading('提交中...')
that.$Request.post('/app/artificer/deleteOrders', data).then(res => {
uni.hideLoading();
if (res.code == 0) {
that.getJinRiOrder();
} else {
that.$queue.showToast(res.msg);
}
})
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
},
// 完成订单
cancel(e) {
let that = this
uni.showModal({
title: '提示',
content: '如果服务未完成点击完成订单会遭到平台违规处理,请确认服务是否完毕?',
success: function(res) {
if (res.confirm) {
let data = {
ordersId: e.ordersId,
accomplishLongitude: that.longitude,
accomplishLatitude: that.latitude
}
that.$queue.showLoading('提交中...')
that.$Request.post('/app/artificer/accomplishOrders', data).then(res => {
uni.hideLoading();
if (res.code == 0) {
that.getJinRiOrder();
websocketUtils.uploadAudioEnd();//关闭音频上传
} else {
that.$queue.showToast(res.msg);
}
})
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
},
timeFormat(param) {
return param < 10 ? '0' + param : param;
},
getJinRiOrder() {
let data = {
type: 1,
page: 1,
limit: 10,
startTime: '',
endTime: ''
}
this.$Request.getT('/app/artificer/selectTodayOrder', data).then(res => {
if (res.code == 0) {
this.goods = [];
res.data.list.forEach(d => {
if (d.status == 6 && d.endTime) {
let data = {}
data.day = 0;
data.hour = 0;
data.minute = 0;
data.second = 0;
var now = new Date().getTime();
var endDate = new Date(d.endTime).getTime();
let time = (endDate - now) / 1000;
data.day = this.timeFormat(parseInt(time / (60 * 60 * 24)));
data.hour = this.timeFormat(parseInt(time % (60 * 60 * 24) / 3600));
data.minute = this.timeFormat(parseInt(time % (60 * 60 * 24) % 3600 / 60));
data.second = this.timeFormat(parseInt(time % (60 * 60 * 24) % 3600 % 60));
d.endTime = data;
}
this.goods.push(d);
});
}
})
},
getcity() {
let that = this
uni.getLocation({
type: 'wgs84',
success: function(res) {
console.log('当前位置的经度:' + res.longitude);
console.log('当前位置的纬度:' + res.latitude);
that.latitude = res.latitude
that.longitude = res.longitude
that.getcitys()
}
});
},
getcitys() {
this.$Request.get('/app/Login/selectCity?lat=' + this.latitude + '&lng=' + this.longitude).then(res => {
if (res.code == 0) {
this.city = res.data.city ? res.data.city : '未知'
// uni.setStorageSync('city', res.data.city)
// let data = {
// num: 1,
// size: 10
// }
// this.getData(data)
}
});
},
//上线开关
bindopen() {
let bzjCheck = this.$queue.getData("bzjCheck");
if (this.isCashDeposit == 0 && bzjCheck != '否') {
uni.showModal({
title: '提示',
content: '请先去缴纳保证金',
success: function(res) {
if (res.confirm) {
uni.navigateTo({
url: '/my/publish/money'
})
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
} else {
let data = {
longitude: this.longitude,
latitude: this.latitude,
// status: this.status,
city: this.city
}
this.$Request.post("/app/artificer/updateArtificer", data).then(res => {
if (res.code == 0) {
this.getArtificer()
this.getUserInfo()
} else {
// uni.showToast({
// title: res.msg,
// icon: 'none'
// })
uni.showModal({
title: '提示',
content: res.msg,
success: function(res) {
if (res.confirm) {
uni.navigateTo({
url: '/my/publish/money'
})
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
}
})
}
},
//获取理疗师的信息
getArtificer() {
this.$Request.getT("/app/artificer/selectArtificer").then(res => {
if (res.code == 0) {
// uni.setStorageSync("status", res.data.status)
if (res.data) {
if (res.data.status == 1) {
this.isTrue = true
} else if (res.data.status == 2) {
this.isTrue = false
}
} else {
this.isTrue = false
}
websocketUtils.changeGoLiveFn(this.isTrue);
uni.setStorageSync('artificerId', res.data.artificerId)
}
});
},
//获取用户发布
getFb() {
this.$Request.get("/app/artificer/selectArtificerIndex").then(res => {
if (res.code == 0) {
this.sumMoney = res.data.sumMoney //总收益
this.putaway = res.data.putaway //上架中
this.soldOut = res.data.soldOut //下架中
this.countOrderNum = res.data.countOrderNum //总销量
this.countTakingByUserId = res.data.countTakingByUserId //用户评价
this.orderMoney = res.data.orderMoney //订单收入
this.countOrder = res.data.countOrder //总订单数
this.sumRefund = res.data.sumRefund //退款金额
this.countByUserId = res.data.countByUserId //访客人数
this.countOrderIng = res.data.countOrderIng //进行中
this.countOrderEnd = res.data.countOrderEnd //已完成
this.countOrderAppraise = res.data.countOrderJin //进行中
}
})
},
goDetail(index) {
if (index == 1) {
uni.switchTab({
url: '/pages/order/index'
})
}
if (index == 2) {
uni.navigateTo({
url: '/my/publish/index'
})
}
},
bindFb() {
let userId = uni.getStorageSync('userId')
let renzheng = uni.getStorageSync('renzheng')
if (userId) {
if (renzheng == 2) {
uni.navigateTo({
url: '/my/publish/index'
})
} else {
uni.showModal({
title: '提示',
content: '您还未实名认证,请先认证',
success: function(res) {
if (res.confirm) {
console.log('用户点击确定');
uni.navigateTo({
url: '/my/renzheng/index'
})
} else if (res.cancel) {
console.log('用户点击取消');
}
}
})
}
} else {
uni.showModal({
title: '提示',
content: '您还未登录,请先登录',
success: function(res) {
if (res.confirm) {
console.log('用户点击确定');
uni.navigateTo({
url: '/pages/public/login'
})
} else if (res.cancel) {
console.log('用户点击取消');
}
}
})
}
},
goNavs(e, name) {
console.log(e)
if (this.userId) {
let renzheng = uni.getStorageSync('renzheng')
if (renzheng == 2) {
let bzjCheck = this.$queue.getData("bzjCheck");
if (bzjCheck != '否') {
if (this.isCashDeposit == 0) {
uni.showModal({
title: '提示',
content: '请先去缴纳保证金',
success: function(res) {
if (res.confirm) {
uni.navigateTo({
url: '/my/publish/money'
})
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
} else {
uni.navigateTo({
url: e,
})
}
} else {
uni.navigateTo({
url: e,
})
}
} else {
uni.showModal({
title: '提示',
content: '您还未实名认证,请先认证',
success: function(res) {
if (res.confirm) {
console.log('用户点击确定');
uni.navigateTo({
url: '/my/renzheng/rzType'
})
} else if (res.cancel) {
console.log('用户点击取消');
}
}
})
}
} else {
uni.showModal({
title: '提示',
content: '您还未登录,请先登录',
success: function(res) {
if (res.confirm) {
console.log('用户点击确定');
uni.navigateTo({
url: '/pages/public/login'
})
} else if (res.cancel) {
console.log('用户点击取消');
}
}
})
}
},
goNav(e, name) {
console.log(e)
if (this.userId) {
uni.navigateTo({
url: e
})
} else {
uni.showModal({
title: '提示',
content: '您还未登录,请先登录',
success: function(res) {
if (res.confirm) {
console.log('用户点击确定');
uni.navigateTo({
url: '/pages/public/login'
})
} else if (res.cancel) {
console.log('用户点击取消');
}
}
})
}
},
getUserInfo() {
this.$Request.get("/app/user/selectUserById").then(res => {
if (res.code == 0) {
this.userName = res.data.userName
this.invitationCode = res.data.invitationCode
this.avatar = res.data.avatar ? res.data.avatar : '../../static/logo.png'
this.isAuthentication = res.data.isAuthentication
this.isCashDeposit = res.data.isCashDeposit
this.loglattime = res.data.loglattime
this.loglataddress = res.data.loglataddress
uni.setStorageSync('avatar', res.data.avatar)
uni.setStorageSync('userName', res.data.userName)
uni.setStorageSync('invitationCode', res.data.invitationCode)
// uni.setStorageSync('zhiFuBao', res.data.zhiFuBao)
// uni.setStorageSync('zhiFuBaoName', res.data.zhiFuBaoName)
if (res.data.isAuthentication == 0 || res.data.isAuthentication == null) {
this.renzheng = 0
uni.setStorageSync("renzheng", this.renzheng)
} else if (res.data.isAuthentication == 1) {
this.renzheng = 1
uni.setStorageSync("renzheng", this.renzheng)
} else if (res.data.isAuthentication == 2) {
this.renzheng = 2
uni.setStorageSync("renzheng", this.renzheng)
} else if (res.data.isAuthentication == 3) {
this.renzheng = 3
uni.setStorageSync("renzheng", this.renzheng)
} else if (res.data.isAuthentication == 4) {
this.renzheng = 4
uni.setStorageSync("renzheng", this.renzheng)
} else if (res.data.isAuthentication == 5) {
this.renzheng = 5
uni.setStorageSync("renzheng", this.renzheng)
} else if (res.data.isAuthentication == 6) {
this.renzheng = 6
uni.setStorageSync("renzheng", this.renzheng)
}
}
});
},
goLogin(e) {
uni.navigateTo({
url: e
})
},
// 开启订阅消息
openMsg() {
console.log('订阅消息')
var that = this
uni.getSetting({
withSubscriptions: true, //是否获取用户订阅消息的订阅状态默认false不返回
success(ret) {
console.log(ret.subscriptionsSetting, '------------------')
// if (ret.subscriptionsSetting.itemSettings && Object.keys(ret.subscriptionsSetting.itemSettings).length == 2) {
if (ret.subscriptionsSetting.itemSettings) {
uni.setStorageSync('sendMsg', true)
uni.openSetting({ // 打开设置页
success(rea) {
console.log(rea.authSetting)
}
});
} else { // 用户没有点击“总是保持以上,不再询问”则每次都会调起订阅消息
console.log(99999)
uni.setStorageSync('sendMsg', false)
uni.showModal({
title: '提示',
content: '为了更好的体验,请绑定消息推送',
confirmText: '确定',
cancelText: '取消',
success: function(res) {
if (res.confirm) {
wx.requestSubscribeMessage({
tmplIds: that.arr,
success(re) {
console.log(JSON.stringify(re),
'++++++++++++++')
var datas = JSON.stringify(re);
if (datas.indexOf("accept") != -1) {
console.log(re)
// uni.setStorageSync('sendMsg', true)
}
},
fail: (res) => {
console.log(res)
}
})
// uni.setStorageSync('sendMsg', true)
console.log('确认')
that.showModal = false
} else if (res.cancel) {
console.log('取消')
// uni.setStorageSync('sendMsg', false)
that.showModal = true
}
}
})
}
}
})
},
}
}
</script>
<style lang="scss">
page {
background-color: #ffffff;
}
// .bg {
// background-color: #05C25C;
// }
.bg{
/* 定义一个线性渐变,从红色开始,到蓝色结束 */
background-image: linear-gradient(to bottom, #223845, #00a85b);
}
.gxbox{
font-size: 20rpx;
width: 160px;
background-color: #cbdad6;
color: #333333;
border-radius: 15px;
padding: 10px;
}
.wztext{
width: 80px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.dengjibox{
position: relative;
width: 100%;
background-image: linear-gradient(to right, #223845, #00a85b);
padding: 30rpx;
color: #ffffff;
border-radius: 10px;
}
.djtit{
position: absolute;
left: 0;
top: 0;
width: 80px;
height: 26px;
line-height: 26px;
text-align: center;
color: #e19722;
font-size: 26rpx;
background-color: #171717;
border-radius: 10px 0 10px 0;
}
.djimg{
position: absolute;
right: 40px;
top: 0;
background: url(../../static/images/index/vip.png) no-repeat center;
background-size: cover;
width: 198rpx;
height: 70px;
font-size: 22px;
text-align: center;
line-height: 84px;
}
.tiaob{
width: 100%;
height: 20px;
border-radius: 10px;
background-color: #111111;
padding: 3px;
margin-top: 8px;
}
.xtiaob{
width: 30%;
height: 100%;
border-radius: 10px;
background-color: #46a396;
}
.xianb{
width: 1px;
height: 26px;
background-color: #88baa8;
}
.xianc{
width: 1px;
height: 16px;
background-color: #88baa8;
}
.csda{
background: url(../../static/images/index/bhgc.png);
background-size: cover;
height: 108px;
border-radius: 10px;
padding: 30rpx 30rpx 14rpx 30rpx;
margin-top: 20px;
}
.zbhsga{
background-color: rgba(17, 114, 80, 0.8);
color: #ffffff;
width: 100%;
height: 38px;
line-height: 38px;
padding: 0 30rpx;
border-radius: 5px;
margin-top: 16px;
}
.dsalk{
width: 31%;
border: 2px #ededed solid;
border-radius: 10px;
padding: 30rpx;
}
.sda{
width: 36px;
height: 36px;
line-height: 30px;
text-align: center;
border-radius: 30px;
background-color: #f7f7f7;
justify-content: center;
}
.dqda{
font-size: 26rpx;
color: #999999;
margin-top: 6px;
}
.online-tag{
color: #ffffff;
font-size: 29rpx;
}
.img-avatar{
width: 100rpx;
height: 100rpx;
border-radius: 15rpx;
background-color: #FFFFFF;
}
.bgwhite {
background-color: #FFFFFF;
}
.xian {
width: 100%;
height: 1rpx;
border: 1rpx solid #f8f8f8;
margin-top: 20rpx;
}
.pintuan_syrs {
color: #999999;
font-size: 20upx;
margin: 20rpx 20rpx 0rpx;
display: flex;
padding-right: 18upx;
}
.box {
color: #FFFFFF;
padding: 40upx 40upx 60upx 40upx;
display: flex;
align-items: center;
justify-content: space-between;
text-align: center;
}
// uni-switch .uni-switch-input.uni-switch-input-checked{
// background-color: #ffffff !important;
// }
.box1 {
background: #FFFFFF;
border-radius: 24rpx;
padding: 30rpx;
margin-top: 30rpx;
}
.orderbox {
display: flex;
align-items: center;
justify-content: space-between;
}
.guanlibox {
border-left-radius: 24rpx;
padding: 30rpx;
background-image:linear-gradient(to bottom, #223845, #117250);
}
.guanlibox2 {
border-right-radius: 24rpx;
padding: 30rpx;
background-image: linear-gradient(to bottom, #117250, #00a85b);
}
.labe {
display: inline-flex;
align-items: center;
border-radius: 18rpx;
color: #ffffff;
font-size: 22rpx;
font-weight: 500;
height: 36rpx;
justify-content: center;
margin-top: 6px;
text {
width: 12rpx;
height: 12rpx;
background: #20C675;
border-radius: 50%;
margin-right: 8rpx;
}
}
uni-switch .wx-switch-input:not([class*="bg-"]), uni-switch .uni-switch-input:not([class*="bg-"]) {
background: #ffffff !important;
}
uni-switch .wx-switch-input::after, uni-switch .uni-switch-input::after{
background: #088951 !important;
}
uni-switch[disabled] .uni-switch-input{
opacity: 1 !important;
}
uni-switch::after, uni-switch::before{
display: none !important;
}
</style>