zouyanyan 3 weeks ago
parent a2cd86fd4e
commit c0f6c1743c

@ -227,16 +227,7 @@
// 使 res.tempFilePath // 使 res.tempFilePath
const filePath = res.tempFilePath; const filePath = res.tempFilePath;
console.log(filePath); console.log(filePath);
if(that.checkImageSize(filePath)){ that.checkImageSize(filePath,2);
that.send(filePath, 'video');
}
else{
that.$refs.uToast.show({
title: "视频大小不能超过20M...",
type: "error",
duration: 2000,
});
}
}, },
fail: function (err) { fail: function (err) {
console.error('选择视频失败:', err); console.error('选择视频失败:', err);
@ -245,6 +236,7 @@
}, },
// //
sendImg(e) { sendImg(e) {
var that =this;
let count = 9; let count = 9;
if (e == 'album') { if (e == 'album') {
count = 9; count = 9;
@ -260,40 +252,66 @@
console.log(JSON.stringify(res.tempFilePaths)); console.log(JSON.stringify(res.tempFilePaths));
const filePaths = res.tempFilePaths; const filePaths = res.tempFilePaths;
for (let i = 0; i < filePaths.length; i++) { for (let i = 0; i < filePaths.length; i++) {
if(this.checkImageSize(filePath)){ that.checkImageSize(filePaths[i],1);
this.send(filePaths[i], 'image')
}
else{
this.$refs.uToast.show({
title: "图片大小不能超过20M...",
type: "error",
duration: 2000,
});
}
} }
} }
}); });
}, },
checkImageSize(filePath) { checkImageSize(filePath,type) {
var ifsize= 0; var that = this;
uni.getFileInfo({ uni.getFileInfo({
filePath: filePath, filePath: filePath,
success: function (res) { success: function (res) {
console.log('文件大小(字节):', res.size); console.log('文件大小(字节):', res.size);
if (res.size > 20*1024 * 1024) { // 20MB if(type==1){
//
if (res.size > 2*1024*1024) { // 20MB
console.log('文件过大'); console.log('文件过大');
// //
ifsize=0; that.$refs.uToast.show({
title: "图片大小不能超过2M...",
type: "error",
duration: 2000,
});
} else { } else {
console.log('文件大小合适'); console.log('文件大小合适');
// //
ifsize=1; that.send(filePath, 'image');
}
}
else if(type==2){
//
if (res.size > 10*1024*1024) { // 20MB
console.log('文件过大');
//
that.$refs.uToast.show({
title: "视频大小不能超过10M...",
type: "error",
duration: 2000,
});
} else {
console.log('文件大小合适');
//
that.send(filePath, 'video');
}
} }
return ifsize;
}, },
fail: function (err) { fail: function (err) {
console.error('获取文件信息失败:', err); console.error('获取文件信息失败:', err);
return ifsize; if(type==1){
that.$refs.uToast.show({
title: "图片大小不能超过2M...",
type: "error",
duration: 2000,
});
}
else if(type==1){
that.$refs.uToast.show({
title: "视频大小不能超过10M...",
type: "error",
duration: 2000,
});
}
} }
}); });
}, },
@ -377,6 +395,7 @@
}, },
// //
send(msg, type) { send(msg, type) {
console.log("send")
console.log(msg, type) console.log(msg, type)
let date = { let date = {
message: msg, message: msg,

@ -2,8 +2,8 @@
"name" : "瑜伽汇", "name" : "瑜伽汇",
"appid" : "__UNI__B6E0086", "appid" : "__UNI__B6E0086",
"description" : "瑜伽汇", "description" : "瑜伽汇",
"versionName" : "1.0.0", "versionName" : "1.0.9",
"versionCode" : 100, "versionCode" : 109,
"transformPx" : false, "transformPx" : false,
"app-plus" : { "app-plus" : {
"flexible" : true, "flexible" : true,
@ -151,7 +151,47 @@
} }
} }
}, },
"nativePlugins" : {} "nativePlugins" : {
"JG-JCore" : {
"JPUSH_APPKEY_ANDROID" : "d5edb270e4b1cc29616e1dd5",
"JPUSH_APPKEY_IOS" : "",
"JPUSH_CHANNEL_ANDROID" : "",
"JPUSH_CHANNEL_IOS" : "",
"__plugin_info__" : {
"name" : "极光推送 JCore 官方 SDK",
"description" : "极光推送 JCore 官方 SDK HBuilder 插件版本",
"platforms" : "Android,iOS",
"url" : "https://ext.dcloud.net.cn/plugin?id=4028",
"android_package_name" : "com.sdlyoga.app",
"ios_bundle_id" : "",
"isCloud" : true,
"bought" : 1,
"pid" : "4028",
"parameters" : {
"JPUSH_APPKEY_ANDROID" : {
"des" : "[Android]极光portal配置应用信息时分配的AppKey",
"key" : "JPUSH_APPKEY",
"value" : ""
},
"JPUSH_APPKEY_IOS" : {
"des" : "[iOS]极光portal配置应用信息时分配的AppKey",
"key" : "JCore:APP_KEY",
"value" : ""
},
"JPUSH_CHANNEL_ANDROID" : {
"des" : "[Android]用于统计分发渠道不需要可填默认值developer-default",
"key" : "JPUSH_CHANNEL",
"value" : ""
},
"JPUSH_CHANNEL_IOS" : {
"des" : "[iOS]用于统计分发渠道不需要可填默认值developer-default",
"key" : "JCore:CHANNEL",
"value" : ""
}
}
}
}
}
}, },
"quickapp" : {}, "quickapp" : {},
"mp-weixin" : { "mp-weixin" : {

@ -161,10 +161,10 @@
} }
}, },
{ {
"path" : "pages/teacher/chat", "path" : "pages/chat/chat",
"style" : "style" :
{ {
"navigationBarTitleText": "咨询", "navigationBarTitleText": "教练咨询",
"enablePullDownRefresh": false "enablePullDownRefresh": false
} }
}, },
@ -214,11 +214,25 @@
} }
}, },
{ {
"path" : "pages/product/service", "path" : "pages/chat/groupchat",
"style" : "style" :
{ {
"navigationBarTitleText": "客服", "navigationBarTitleText": "客服",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"app-plus": {
"titleNView": {
"buttons": [
{
"fontSrc": "/static/qlfont.ttf",
"text": "\ue68e",
"fontSize": "28",
"color": "#ffffff",
"float": "right",
"background": "rgba(0,0,0,0)"
}
]
}
}
} }
}, },
{ {
@ -367,6 +381,14 @@
"enablePullDownRefresh": false "enablePullDownRefresh": false
} }
}, },
{
"path": "pages/book/bookshop",
"style" :
{
"navigationBarTitleText": "预约学员",
"enablePullDownRefresh": false
}
},
{ {
"path": "pages/book/book", "path": "pages/book/book",
"style" : "style" :

@ -21,9 +21,15 @@
</view> </view>
<view class="osname"> <view class="osname">
<view class="oscell"> <view class="oscell">
<view v-if="item.claName=='团课'" class="txtbg">{{item.claName}}</view> <!-- <view v-if="item.claName=='团课'" class="txtbg">{{item.claName}}</view>
<view v-else class="txtbg1">{{item.claName}}</view> <view v-else class="txtbg1">{{item.claName?item.claName:'--'}}</view> -->
<uni-rate :size="20" :readonly="true" :value="item.star" :max="item.star"/> <view v-if="item.claName" class="txtbg1" :style="{color:item.claColor?item.claColor:'#333'}">
{{item.claName}}
</view>
<view v-if="item.courseTypeName" style="color: #888;font-weight: 500;font-size: 28rpx;">
{{item.courseTypeName}}
</view>
<uni-rate :size="20" :readonly="true" :value="item.star?item.star:5" :max="5"/>
</view> </view>
<view class="oscell" v-if="item.storeName"> <view class="oscell" v-if="item.storeName">
<uni-icons type="shop" size="18" color="#00A99A"></uni-icons> <uni-icons type="shop" size="18" color="#00A99A"></uni-icons>
@ -60,7 +66,8 @@
<!-- 信息 --> <!-- 信息 -->
<view class="yycon tcon"> <view class="yycon tcon">
<view class="olist"> <mp-html v-if="remark" :content="remark" :markdown="true" :lazy-load="true"/>
<!-- <view class="olist">
<view class="ltxt">会籍类型</view> <view class="ltxt">会籍类型</view>
<view class="rtxt">精品团课</view> <view class="rtxt">精品团课</view>
</view> </view>
@ -83,7 +90,7 @@
请至少提前10分钟进教室保持手机静音<br> 请至少提前10分钟进教室保持手机静音<br>
课程中如有特殊情况请及时联系老师 课程中如有特殊情况请及时联系老师
</view> </view>
</view> </view> -->
</view> </view>
</view> </view>
@ -95,7 +102,7 @@
</template> </template>
<script> <script>
import { myCache } from '../../utils/utils.js'; import { myCache,getRemoteFile } from '../../utils/utils.js';
import openlogin from "../components/openlogin.vue"; import openlogin from "../components/openlogin.vue";
export default { export default {
components: { components: {
@ -125,7 +132,8 @@
"bookAttendCnt": "1", "bookAttendCnt": "1",
"atClassCnt": "5", "atClassCnt": "5",
"lessCnt": "3", "lessCnt": "3",
} },
remark:null
}; };
}, },
@ -133,7 +141,6 @@
// //
if(options.data){ if(options.data){
this.item = JSON.parse(decodeURIComponent(options.data)); this.item = JSON.parse(decodeURIComponent(options.data));
console.log(this.item)
this.id = this.item.courseTimeId; this.id = this.item.courseTimeId;
this.getinfo(); this.getinfo();
} }
@ -159,16 +166,6 @@
return require("@/static/image/theme/p1.jpg") return require("@/static/image/theme/p1.jpg")
} }
}, },
timestampToTime(timestamp) {
const date = new Date(timestamp*1000);
const Y = date.getFullYear() + '-';
const M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
const D = (date.getDate() < 10 ? '0'+(date.getDate()) : date.getDate()) + ' ';
const h = (date.getHours() < 10 ? '0'+(date.getHours()) : date.getHours()) + ':';
const m = (date.getMinutes() < 10 ? '0'+(date.getMinutes()) : date.getMinutes()) + ':';
const s = (date.getSeconds() < 10 ? '0'+(date.getSeconds()) : date.getSeconds());
return Y+M+D+h+m+s;
},
getPhoneNumber(e){ getPhoneNumber(e){
if(e.phone){ if(e.phone){
this.phone = e.phone this.phone = e.phone
@ -202,10 +199,13 @@
uni.showLoading({ uni.showLoading({
title: '数据加载中...' title: '数据加载中...'
}); });
const {data: res} = await uni.$http.post('/api/my/courseTimeDetail', {"courseTimeId":this.id}); // this.id // const {data: res} = await uni.$http.post('/api/my/courseTimeDetail', {"courseTimeId":this.id}); // this.id
if(res){ const {data: res} = await uni.$http.post('/api/course/getCourseDetail', {"courseTimeId":this.id}); // this.id
if(res&&res.data){
// //
this.info=res; this.item=res.data;
console.log(this.item)
this.remark=res.data.remark;
this.$forceUpdate(); this.$forceUpdate();
} }
}, },
@ -235,25 +235,38 @@
const {data: res} = await uni.$http.post('/api/course/bookCourse', param); const {data: res} = await uni.$http.post('/api/course/bookCourse', param);
console.log(res) console.log(res)
if(res.success){ if(res.success){
uni.showToast({ // uni.showToast({
title: '课程已预约!', // title: '',
icon: 'success', // icon: 'success',
duration: 2000 // duration: 2000
}); // });
// //
myCache('courserefresh',1); myCache('courserefresh',1);
uni.showModal({
title: '提示',
content: '课程已预约!',
cancelText: '返回',
confirmText: '确定',
success: ress => {
if (ress.confirm) {
// //
uni.navigateBack({ uni.navigateBack({
delta: 1 delta: 1
}); });
} }
else{ else{
// uni.showToast({ //
// title: res.message? res.message:'', uni.navigateBack({
// icon: 'error', delta: 1
// duration: 2000 });
// }); }
}
});
}
else{
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
content: res.message? res.message:'课程预约失败!', content: res.message? res.message:'课程预约失败!',

@ -7,25 +7,56 @@
<view class="yycon"> <view class="yycon">
<view class="oscon"> <view class="oscon">
<view class="osrcon"> <view class="osrcon">
<view class="osname"> <view class="ostop">
{{info.storeName?info.storeName:''}} <view class="osname">门店{{info.storeName?info.storeName:''}}</view>
<view class="qrimg" v-if="info.qrCode" @click="openQR(info.qrCode)">
<image class="qrimg" :src="'data:image/png;base64,'+info.qrCode" mode="aspectFill"></image>
</view>
</view> </view>
<view class="oscell"> <view class="oscell">
课程 上课课程
<text class="txt">{{info.claName }}</text>
<text class="txt">{{info.courseName }}</text> <text class="txt">{{info.courseName }}</text>
</view> </view>
<view v-if="info.claName" class="oscell">
上课班级
<text class="txt">{{info.claName }}</text>
</view>
<view class="oscell">
预约状态
<view v-if="info.bookStatus==1" class="ztip"></view>
<view v-else-if="info.bookStatus==0" class="jtip">预约中</view>
<view v-else-if="info.bookStatus==2" class="htip">待上课</view>
<view v-else-if="info.bookStatus==4" class="wtip">已完成</view>
<view v-else-if="info.bookStatus==3" class="ctip">已取消</view>
</view>
<view class="oscell"> <view class="oscell">
授课教练 授课教练
<text class="txt">{{info.teacherName }}</text> <text class="txt">{{info.teacherName }}</text>
</view> </view>
<view class="oscell"> <view class="oscell">
上课地点 上课教室
<text class="txt">{{info.roomName }}</text> <text class="txt">{{info.roomName }}</text>
</view> </view>
<view class="oscell"> <view class="oscell">
上课时间 上课时间
<text class="txt">{{ info.claDate+' '+ info.startTime +'-'+ info.endTime }}</text> <text class="txt">{{ (info.claDate?info.claDate:'')+' '+ (info.startTime?info.startTime:'') + (info.endTime?'-'+info.endTime:'') }}</text>
</view>
<view class="oscell" v-if="info.claTimeStatus">
课程状态
<text class="txt">{{info.claTimeStatus=='1'?'待上课':(info.claTimeStatus=='2'?'已上课':'') }}</text>
</view>
<view class="oscell">
创建日期
<text class="txt">{{info.createTime }}</text>
</view>
<view class="oscellqr">
<view class="ordtip">预约二维码(扫码签到)</view>
<view class="ordqr">
<image class="imgqr" :src="'data:image/png;base64,'+info.qrCode" mode="aspectFill"></image>
</view>
<view class="ordno">
<view class="txt"> 预约号 {{ info.code }}</view>
<view class="copy" @click="copydo(info.code)">.</view> </view>
</view> </view>
</view> </view>
</view> </view>
@ -33,14 +64,32 @@
<!-- 进度信息 --> <!-- 进度信息 -->
<view class="yycon"> <view class="yycon">
<uni-steps :options="steps" direction="column" :active="2"></uni-steps> <uni-steps v-if="ifshow" :options="steps" direction="column" :active="cur"></uni-steps>
</view> </view>
</view> </view>
<!-- 二维码 -->
<uni-popup ref="pfDialog" :mask-click="false">
<view class="pcon">
<view class="phtxt">预约二维码</view>
<view class="ptxt">
<image class="qrimg" :src="qr" mode="aspectFill"></image>
</view>
<view class="btn" @click="closeDialog">
关闭
</view>
</view>
</uni-popup>
<!-- 是否登录 --> <!-- 是否登录 -->
<openlogin ref="loginId" @getPhoneNumber="getPhoneNumber"></openlogin> <openlogin ref="loginId" @getPhoneNumber="getPhoneNumber"></openlogin>
<view v-if="ifscan" class="bottom"></view>
<view v-if="ifscan" class="submitcon">
<button type="primary" class="bbtn" @tap="goSign()"></button>
</view>
</view> </view>
</template> </template>
@ -57,25 +106,24 @@
phone:"", phone:"",
userid:"", userid:"",
id:"", id:"",
qr:'',
info: { info: {
"courseTimeId": 1935590110594646018, "claName": "",
"bookId": 1, "storeName": "",
"claName": "普拉提A班",
"storeName": "慢瑜伽-三台子店",
"pic": null, "pic": null,
"claDate": "2025-10-25", "claDate": "",
"weekDay": null, "weekDay": null,
"startTime": "16:00:00", "startTime": "",
"endTime": "17:30:00", "endTime": "",
"roomName": null, "roomName": null,
"claColor": null, "claColor": null,
"claTimeStatus": null, "claTimeStatus": null,
"bookStatus": 3, "bookStatus": null,
"createTime": "2025-08-28 14:46:24", "createTime": "",
"code": null, "code": null,
"courseName": null, "courseName": null,
"teacherId": null, "teacherId": null,
"teacherName": "乐乐老师", "teacherName": "",
"checkIn": 1, "checkIn": 1,
"statusTime": [ "statusTime": [
{ {
@ -96,21 +144,28 @@
} }
] ]
}, },
cur:0,
steps: steps:
[ [
{title:'已付款',desc:'2025-02-05 13:30'}, // {title:'',desc:'2025-02-05 13:30'},
{title:'已预约',desc:'2025-02-05 13:30'}, // {title:'',desc:'2025-02-05 13:30'},
{title:'教练已确认',desc:'2025-02-05 13:30'}, // {title:'',desc:''},
{title:'店长确认,准备上课',desc:''}, // {title:'',desc:''},
{title:'课程结束',desc:''}, // {title:'',desc:''},
], ],
ifshow:false,
ifscan:false,
}; };
}, },
onLoad(options) { onLoad(options) {
if(options.type&&options.type=='qd')
{
this.ifscan=true;
this.$forceUpdate();
}
if(options.id) if(options.id)
{ {
this.id=parseInt(options.id); this.id=options.id;
this.getinfo(); this.getinfo();
} }
}, },
@ -126,15 +181,35 @@
} }
}, },
methods: { methods: {
timestampToTime(timestamp) { copydo(text){
const date = new Date(timestamp*1000); if (!text) {
const Y = date.getFullYear() + '-'; uni.showToast({
const M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-'; title: '复制内容为空!',
const D = (date.getDate() < 10 ? '0'+(date.getDate()) : date.getDate()) + ' '; icon: 'none'
const h = (date.getHours() < 10 ? '0'+(date.getHours()) : date.getHours()) + ':'; })
const m = (date.getMinutes() < 10 ? '0'+(date.getMinutes()) : date.getMinutes()) + ':'; return;
const s = (date.getSeconds() < 10 ? '0'+(date.getSeconds()) : date.getSeconds()); }
return Y+M+D+h+m+s; uni.setClipboardData({
data: text,
success: () => {
uni.showToast({
title: '复制成功',
icon: 'success'
})
}
})
},
openQR(qr){
console.log("openQR")
this.qr='data:image/png;base64,'+qr;
this.$forceUpdate();
this.openDialog();
},
closeDialog(){
this.$refs.pfDialog.close();
},
openDialog(){
this.$refs.pfDialog.open();
}, },
getPhoneNumber(e){ getPhoneNumber(e){
if(e.phone){ if(e.phone){
@ -168,26 +243,33 @@
uni.showLoading({ uni.showLoading({
title: '数据加载中...' title: '数据加载中...'
}); });
const {data: res} = await uni.$http.post('/api/course/bookCourseDetail', {"bookId":this.id}); const {data: res} = await uni.$http.post('/api/course/bookCourseDetail', {"bookId":this.id});//"2037434363846811650"
if(res){ if(res&&res.data){
// //
this.info=res; this.info=res.data;
this.steps=[]; this.steps=[
// {title:'',desc:''},
// {title:'',desc:''},
// {title:'',desc:''},
// {title:'',desc:''},
// {title:'',desc:''},
];
// 0->1->2->// 3->;4- >/ // 0->1->2->// 3->;4- >/
// {title:'',desc:'2025-02-05 13:30'}, // {title:'',desc:'2025-02-05 13:30'},
// {title:'',desc:'2025-02-05 13:30'}, // {title:'',desc:'2025-02-05 13:30'},
// {title:'',desc:'2025-02-05 13:30'}, // {title:'',desc:'2025-02-05 13:30'},
// {title:'',desc:''}, // {title:'',desc:''},
// {title:'',desc:''}, // {title:'',desc:''},
if(res.statusTime&&res.statusTime.length>0){ var statusTime=res.data.statusTime?res.data.statusTime:[];
res.statusTime.forEach(cell=>{ if(statusTime&&statusTime.length>0){
statusTime.forEach(cell=>{
var ii={ var ii={
title: cell.status==0?'已预约':(cell.status==1?'教练已确认':(cell.status==2?'店长已确认':(cell.status==3?'预约已取消':cell.status==4?'课程已结束':''))), title: cell.status==0?'已预约':(cell.status==1?'教练已确认':(cell.status==2?'店长已确认':(cell.status==3?'预约已取消':cell.status==4?'课程已结束':''))),
desc: cell.time desc: cell.time
} }
this.steps.push(ii); this.steps.push(ii);
}); });
var lastStatus=res.statusTime[res.statusTim.length-1].status; var lastStatus=statusTime[statusTime.length-1].status;
if(lastStatus==0){ if(lastStatus==0){
this.steps.push({ this.steps.push({
title:'教练待确认',desc:'' title:'教练待确认',desc:''
@ -228,10 +310,71 @@
}); });
} }
this.$forceUpdate(); this.$forceUpdate();
this.cur=-1;
this.steps.forEach(cell=>{
if(cell.desc){
this.cur++;
this.$forceUpdate();
}
});
this.ifshow=true;
this.$forceUpdate();
}
else{
uni.showModal({
title: '提示',
content: res.message? res.message:'预约详情获取失败!请重试!',
cancelText: '取消',
confirmText: '确定',
success: ress => {
if (ress.confirm) {
//
uni.navigateBack({
delta: 1
});
}
else{
//
uni.navigateBack({
delta: 1
});
}
}
});
}
},
async goSign(){
uni.showLoading({
title: '学员签到中...'
});
const {data: res} = await uni.$http.post('/api/my/checkIn', {"code":this.info.code,"bookId":this.info.bookId});
if(res&&res.success){
uni.showModal({
title: '提示',
content: '学员签到成功!',
cancelText: '取消',
confirmText: '确定',
success: ress => {
//
uni.navigateBack({
delta: 1,
});
}
});
}
else{
uni.showModal({
title: '提示',
content: res.message? res.message:'学员签到失败!',
cancelText: '取消',
confirmText: '确定',
success: ress => {
if (ress.confirm) {
}
}
});
} }
}, },
} }
} }
</script> </script>
@ -264,130 +407,6 @@
line-height: 60rpx; line-height: 60rpx;
z-index: 9999; z-index: 9999;
} }
.submitcon{
position: fixed;
display: flex;
bottom: 0;
left: 0;
width: 100%;
height: 140rpx;
background-color: #FFFFFF;
.pcon{
margin-left: 20rpx;
margin-top: 28rpx;
height: 50rpx;
display: flex;
flex:1;
justify-content: flex-start;
align-items: baseline;
.hj{
font-size: 30rpx;
}
.rmb{
font-size: 30rpx;
font-family: smallYuan;
color:#00a89b ;
margin-left: 10rpx;
}
.zs{
font-size: 48rpx;
font-weight: 600;
font-family: smallYuan;
color:#00a89b ;
}
.xs{
font-size: 28rpx;
font-weight: 600;
font-family: smallYuan;
color:#00a89b ;
}
}
.btn{
background-color: #00a89b !important;
margin: 30rpx 20rpx 0 0;
border-radius: 50rpx;
height: 60rpx;
line-height: 60rpx;
width: 180rpx;
font-size: 26rpx;
}
.btn::after{
border:0 !important;
}
.gzbtn{
background-color: #4A4AFF !important;
margin: 30rpx 20rpx 0 0;
border-radius: 50rpx;
height: 60rpx;
line-height: 60rpx;
width: 180rpx;
font-size: 26rpx;
}
.gzbtn::after{
border:0 !important;
}
.cancelbtn{
background-color: #FFFFFF !important;
margin: 30rpx 20rpx 0 0;
border-radius: 50rpx;
height: 60rpx;
line-height: 60rpx;
width:180rpx;
font-size: 26rpx;
color:#333;
border:1rpx solid #dddddd;
}
.cancelbtn::after{
border:0 !important;
}
.returnbtn{
background-color: #ff3d0e !important;
margin: 30rpx 20rpx 0 0;
border-radius: 50rpx;
height: 60rpx;
line-height: 60rpx;
width:180rpx;
font-size: 26rpx;
border:1rpx solid #ff3d0e;
color:#FFF;
}
.returnbtn::after{
border:0 !important;
}
.pjbtn{
background-color: #FFFFFF !important;
margin: 30rpx 20rpx 0 0;
border-radius: 50rpx;
height: 60rpx;
line-height: 60rpx;
width:170rpx;
font-size: 26rpx;
border:1rpx solid #f5aa00;
color:#f5aa00;
}
.pjbtn::after{
border:0 !important;
}
.wlbtn{
background-color: #FFFFFF !important;
margin: 30rpx 20rpx 0 0;
border-radius: 50rpx;
height: 60rpx;
line-height: 60rpx;
width:170rpx;
font-size: 26rpx;
border:1rpx solid #00a89b;
color:#00a89b;
}
.wlbtn::after{
border:0 !important;
}
}
.signimg{
width: 150rpx;
height: 180rpx;
border-radius: 10rpx;
}
.oscon{ .oscon{
margin:0; margin:0;
background-color: #f3fafa; background-color: #f3fafa;
@ -408,13 +427,23 @@
justify-content: flex-start; justify-content: flex-start;
margin-left: 20rpx; margin-left: 20rpx;
} }
.ostop{
display: flex;
flex-direction: row;
border-bottom: 1rpx dotted #74defb;
padding-bottom: 15rpx;
.osname{ .osname{
line-height: 48rpx; line-height: 48rpx;
font-size:32rpx; font-size:32rpx;
font-weight: 600; font-weight: 600;
color:#009999; color:#009999;
padding-bottom: 15rpx; display: flex;
border-bottom: 1rpx dotted #74defb; flex:1;
}
.qrimg{
width: 50rpx;
height: 50rpx;
}
} }
.oscell{ .oscell{
display: flex; display: flex;
@ -427,19 +456,109 @@
display: flex; flex: 1; display: flex; flex: 1;
} }
} }
.oscellqr{
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
margin: 20rpx 20rpx 10rpx 20rpx;
.ordtip{
font-size: 28rpx;
color:#000;
margin-bottom: 10rpx;
} }
.ydcon{ .ordqr{
position: relative; display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 200rpx;
margin-bottom: 10rpx;
.imgqr{
width: 200rpx;
height: 200rpx;
}
}
.ordno{
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
.txt{
font-size: 28rpx;
color:#000;
}
.copy{
font-size: 28rpx;
color:#1296db;
margin-left: 6rpx;
}
}
}
.ztip{
color:#1296db;
font-size: 26rpx;
padding: 0;
height: 40rpx;
line-height: 40rpx;
}
.jtip{
color:#feb467;
font-size: 26rpx;
padding: 0;
height: 40rpx;
line-height: 40rpx;
}
.htip{
border-radius: 12rpx;
color:#fc6900;
font-size: 26rpx;
padding: 0;
height: 40rpx;
line-height: 40rpx;
}
.hwtip{
color:#FF0000;
font-size: 26rpx;
padding: 0;
height: 40rpx;
line-height: 40rpx;
}
.wtip{
color:#43cca4;
font-size: 26rpx;
padding: 0;
height: 40rpx;
line-height: 40rpx;
}
.gtip{
color:#0036D6;
font-size: 26rpx;
padding: 0;
height: 40rpx;
line-height: 40rpx;
} }
.yyright{ .ftip{
position: absolute; color:#6A81F1;
right: 100rpx; font-size: 26rpx;
top:50rpx; padding: 0;
height: 40rpx;
line-height: 40rpx;
} }
.ctip{
color:#888;
font-size: 26rpx;
padding: 0;
height: 40rpx;
line-height: 40rpx;
}
}
.oinfo{ .oinfo{
padding:20rpx; padding:20rpx;
position: relative; position: relative;
margin-bottom: 160rpx; margin-bottom: 20rpx;
.ozc{ .ozc{
display: flex; display: flex;
@ -578,13 +697,6 @@
} }
} }
.red{
color:#ff3d0e;
}
.green{
color:#00cd00;
}
::v-deep.uni-radio-input-checked{ ::v-deep.uni-radio-input-checked{
background-color: #00a89b !important; background-color: #00a89b !important;
border-color: #00a89b !important; border-color: #00a89b !important;
@ -595,4 +707,93 @@
display: none!important; display: none!important;
} }
.pcon{
width: 690rpx;
padding-top:30rpx;
padding-bottom:50rpx;
background: #FCFCFD;
box-shadow: 0rpx 128rpx 128rpx 2rpx rgba(31,47,70,0.12);
border-radius: 16rpx 16rpx 16rpx 16rpx;
position: relative;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.phtxt{
width: 600rpx;
margin: 20rpx auto 10rpx;
font-size: 36rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 600;
color: #23262F;
}
.ptxt
{
width: 620rpx;
display: flex;
align-items: center;
justify-content: center;
margin: 30rpx auto;
border-radius: 16rpx 16rpx 16rpx 16rpx;
opacity: 1;
border: 2rpx solid #F7F8FA;
padding: 30rpx;
.qrimg{
width: 400rpx;
height: 400rpx;
}
}
.btn{
width: 520rpx;
height: 80rpx;
line-height: 80rpx;
background: #00A99A;
box-shadow: 0rpx 12rpx 64rpx 2rpx rgba(0,169,154,0.4);
border-radius: 254rpx 254rpx 254rpx 254rpx;
text-align: center;
font-size: 32rpx;
font-family: PingFang SC-Medium, PingFang SC;
font-weight: 500;
color: #FCFCFD;
}
}
.bottom{
width: 100%;
margin-bottom: 148rpx;
}
.submitcon{
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 148rpx;
background: #FFFFFF;
box-shadow: 0rpx -4rpx 60rpx 2rpx rgba(1,31,63,0.1);
opacity: 1;
display: flex;
flex-direction: row;
}
.bbtn{
margin: 20rpx 50rpx 50rpx;
font-size: 32rpx;
font-family: PingFang SC-Medium, PingFang SC;
font-weight: 500;
color: #FCFCFD;
width: 650rpx;
height: 76rpx;
line-height: 76rpx;
background: #00a89b;
box-shadow: 0rpx 12rpx 64rpx 2rpx rgba(137,150,95,0.4);
border-radius: 10rpx;
opacity: 1;
&::after{
border:none;
}
}
</style> </style>

@ -6,13 +6,13 @@
<view class="pline"></view> <view class="pline"></view>
</view> </view>
</scroll-view> </scroll-view>
<swiper class="swiper-box" :duration="300" :current="tabCurrentIndex" @animationfinish="animationfinish"> <swiper class="swiper-box" :duration="300" :current="tabCurrentIndex" @animationfinish="animationfinish" @change="handleChange">
<swiper-item class="swiper-item" v-for="tabItem in list" :key="tabItem.id"> <swiper-item class="swiper-item" v-for="tabItem in list" :key="tabItem.id">
<scroll-view scroll-y style="height: 100%;width: 100%;"> <scroll-view scroll-y style="height: 100%;width: 100%;">
<view class="scell" v-if="tabItem.slist.length>0"> <view class="scell" v-if="tabItem.slist.length>0">
<view v-for="(item, index) in tabItem.slist" :key="index" class="oitem"> <view v-for="(item, index) in tabItem.slist" :key="index" class="oitem">
<view class="otop" @click="gotoInfo(item.courseTimeId)"> <view class="otop" @click="gotoInfo(item.bookId)">
<view class="hleft"> <view class="hleft">
<text>{{item.storeName?item.storeName:'门店'}}</text> <text>{{item.storeName?item.storeName:'门店'}}</text>
</view> </view>
@ -27,19 +27,24 @@
</view> </view>
</view> </view>
<view class="oscon" @click="gotoInfo(item.courseTimeId)"> <view class="oscon" @click="gotoInfo(item.bookId)">
<view class="osimg imgload"> <view class="osimg imgload">
<image class="osimg" v-if="item.pic" :src="getimgRemoteFile(item.pic)" mode="aspectFill"></image> <image class="osimg" v-if="item.pic" :src="getimgRemoteFile(item.pic)" mode="aspectFill"></image>
</view> </view>
<view class="osname"> <view class="osname">
<text class="ntxt">{{item.courseName}} {{item.claName}} </text> <text class="ntxt">{{item.courseName}} {{item.claName}} </text>
<text class="txt"> 教练{{item.teacherName }}</text> <text class="txt"> 教练{{item.teacherName || '-'}}</text>
<text class="txt">上课时间{{ item.claDate+' '+item.startTime+'-'+item.endTime}}</text> <text class="txt"> 上课时间{{ item.claDate+' '+item.startTime+'-'+item.endTime}}</text>
<text class="txt">教室{{item.roomName}}</text> <text class="txt"> 教室{{item.roomName}}</text>
</view> </view>
</view> </view>
<view class="obtn"> <view class="obtn">
<view class="omoney"></view> <view class="qr">
<view class="qrimg" v-if="item.qrCode" @click="openQR(item.qrCode)">
<image class="qrimg" :src="'data:image/png;base64,'+item.qrCode" mode="aspectFill"></image>
</view>
</view>
<!-- 1待上课2预约中3待评价 4已完成 5已取消--> <!-- 1待上课2预约中3待评价 4已完成 5已取消-->
<!-- 描述:0->预约中;1->教练确认;2->店长确认/预约成功/待上课 3->已取消;4->已完成/待评价; --> <!-- 描述:0->预约中;1->教练确认;2->店长确认/预约成功/待上课 3->已取消;4->已完成/待评价; -->
<button type="primary" class="conbtn" @click="gototeacher(item)"></button> <button type="primary" class="conbtn" @click="gototeacher(item)"></button>
@ -49,6 +54,7 @@
<button v-if="item.orderstate==4" type="primary" class="viewbtn" :data-id="item.courseTimeId" @click="orderdo($event,item)"></button> <button v-if="item.orderstate==4" type="primary" class="viewbtn" :data-id="item.courseTimeId" @click="orderdo($event,item)"></button>
<button v-if="item.orderstate==4" type="primary" class="gzbtn" :data-id="item.courseTimeId" @click="gotoevaluate($event,item)"></button> <button v-if="item.orderstate==4" type="primary" class="gzbtn" :data-id="item.courseTimeId" @click="gotoevaluate($event,item)"></button>
</view> </view>
</view> </view>
</view> </view>
@ -59,6 +65,19 @@
</swiper-item> </swiper-item>
</swiper> </swiper>
<!-- 二维码 -->
<uni-popup ref="pfDialog" :mask-click="false">
<view class="pcon">
<view class="phtxt">预约二维码</view>
<view class="ptxt">
<image class="qrimg" :src="qr" mode="aspectFill"></image>
</view>
<view class="btn" @click="closeDialog">
关闭
</view>
</view>
</uni-popup>
<!-- 是否登录 --> <!-- 是否登录 -->
<openlogin ref="loginId" @getPhoneNumber="getPhoneNumber"></openlogin> <openlogin ref="loginId" @getPhoneNumber="getPhoneNumber"></openlogin>
@ -79,6 +98,7 @@
userid:"", userid:"",
tabCurrentIndex: 0, tabCurrentIndex: 0,
scrollLeft: 0,//tabs scrollLeft: 0,//tabs
qr:'', //
// 123 // 123
list:[ list:[
{ {
@ -370,6 +390,18 @@
},100); },100);
}, },
methods: { methods: {
openQR(qr){
console.log("openQR")
this.qr='data:image/png;base64,'+qr;
this.$forceUpdate();
this.openDialog();
},
closeDialog(){
this.$refs.pfDialog.close();
},
openDialog(){
this.$refs.pfDialog.open();
},
getimgRemoteFile(img){ getimgRemoteFile(img){
if(img){ if(img){
img=img.split(',')[0]; img=img.split(',')[0];
@ -442,17 +474,26 @@
tabSelect(e) { tabSelect(e) {
console.log(e) console.log(e)
this.tabCurrentIndex = e.currentTarget.dataset.id; this.tabCurrentIndex = e.currentTarget.dataset.id;
this.scrollLeft = (e.currentTarget.dataset.id - 1) * 60; this.$forceUpdate();
// //
// this.list[this.tabCurrentIndex].loadStatus="more"; // this.list[this.tabCurrentIndex].loadStatus="more";
// this.list[this.tabCurrentIndex].slist=[]; // this.list[this.tabCurrentIndex].slist=[];
this.loadData(); // this.loadData();
}, },
animationfinish({ detail: { current } }) { animationfinish({ detail: { current } }) {
this.tabCurrentIndex = current; // this.tabCurrentIndex = current;
// this.loadData();
},
handleChange(e) {
//animationfinish
console.log("handleChange");
this.tabCurrentIndex = e.detail.current;
this.scrollLeft = (e.currentTarget.dataset.id - 1) * 60;
this.$forceUpdate();
this.loadData(); this.loadData();
}, },
gotoInfo(id){ gotoInfo(id){
id=id+"";
// //
uni.navigateTo({ uni.navigateTo({
url: `/pages/book/bookinfo?id=${id}` url: `/pages/book/bookinfo?id=${id}`
@ -460,15 +501,41 @@
}, },
// //
gototeacher(item){ gototeacher(item){
var data={ console.log(item);
id:item.id, if(item.teacherId){
name:"教练A" uni.showLoading({
} title: '会话创建中...'
// });
var data=encodeURIComponent(JSON.stringify(data)); //
var chatid="privatechat-" + this.userid +"-"+ item.teacherId;
var timestamp = new Date().getTime();
var info={
chatId: "privatechat-" + this.userid +"-"+ item.teacherId,
chatType: "coach",
chatName: item.teacherName,
chatAvatar: item.pic?item.pic:'/static/image/kf.png',
chatTime: timestamp,
userid: this.userid,
friendId: item.teacherId, // userid
minId: "", // id
sort:"privatechat", // privatechat groupchat
from:"yh" // yh message
}
var data=encodeURIComponent(JSON.stringify(info));
uni.navigateTo({ uni.navigateTo({
url: `/pages/teacher/chat?data=${data}` url: `/pages/chat/chat?data=${data}`
}) });
}
else{
uni.showModal({
title: '提示',
content: '抱歉!当前预约尚未配置教练在线服务..',
cancelText: '取消',
confirmText: '确定',
success: ress => {
}
});
}
}, },
// //
gotoevaluate(item){ gotoevaluate(item){
@ -530,11 +597,6 @@
this.reset(); this.reset();
} }
else{ else{
// uni.showToast({
// title: res.msg? res.msg:'',
// icon: 'error',
// duration: 2000
// });
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
content: res.message? res.message:'课程预约失败!', content: res.message? res.message:'课程预约失败!',
@ -891,18 +953,16 @@
flex-direction: row; flex-direction: row;
justify-content: flex-end; justify-content: flex-end;
border-top: 1rpx solid #eee; border-top: 1rpx solid #eee;
padding: 20rpx 0 10rpx; padding: 20rpx 0 0;
width: 100%; width: 100%;
.omoney{ .qr{
display: flex; display: flex;
flex:1; flex:1;
height: 60rpx;
width: 100%;
color:#333; color:#333;
align-items: center; align-items: center;
.omtip{ .qrimg{
font-size: 36rpx; width: 50rpx;
color:rgb(252, 105, 0); height: 50rpx;
} }
} }
.cancelbtn{ .cancelbtn{
@ -991,19 +1051,6 @@
.gzbtn::after{ .gzbtn::after{
border:0 !important; border:0 !important;
} }
.gzbtn{
background-color: #f5aa00 !important;
margin-left: 20rpx;
border-radius: 50rpx;
height: 50rpx;
line-height: 48rpx;
padding: 0 20rpx;
font-size: 24rpx;
border:1rpx solid #f5aa00;
}
.gzbtn::after{
border:0 !important;
}
} }
.oscon{ .oscon{
margin:20rpx 0; margin:20rpx 0;
@ -1022,7 +1069,7 @@
flex: 1; flex: 1;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
margin-left: 26rpx; margin-left: 20rpx;
.ntxt{ .ntxt{
font-size: 28rpx; font-size: 28rpx;
color:#000; color:#000;
@ -1099,4 +1146,56 @@
} }
.pcon{
width: 690rpx;
padding-top:30rpx;
padding-bottom:50rpx;
background: #FCFCFD;
box-shadow: 0rpx 128rpx 128rpx 2rpx rgba(31,47,70,0.12);
border-radius: 16rpx 16rpx 16rpx 16rpx;
position: relative;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.phtxt{
width: 600rpx;
margin: 20rpx auto 10rpx;
font-size: 36rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 600;
color: #23262F;
}
.ptxt
{
width: 620rpx;
display: flex;
align-items: center;
justify-content: center;
margin: 30rpx auto;
border-radius: 16rpx 16rpx 16rpx 16rpx;
opacity: 1;
border: 2rpx solid #F7F8FA;
padding: 30rpx;
.qrimg{
width: 400rpx;
height: 400rpx;
}
}
.btn{
width: 520rpx;
height: 80rpx;
line-height: 80rpx;
background: #00A99A;
box-shadow: 0rpx 12rpx 64rpx 2rpx rgba(0,169,154,0.4);
border-radius: 254rpx 254rpx 254rpx 254rpx;
text-align: center;
font-size: 32rpx;
font-family: PingFang SC-Medium, PingFang SC;
font-weight: 500;
color: #FCFCFD;
}
}
</style> </style>

@ -5,9 +5,13 @@
<view class="scell" v-if="list.length>0"> <view class="scell" v-if="list.length>0">
<view v-for="(item, index) in list" :key="index" class="oitem"> <view v-for="(item, index) in list" :key="index" class="oitem">
<view class="otop" @click="gotoInfo(item.courseTimeId)"> <view class="otop">
<view class="hleft"> <view class="hleft">
<text>{{item.storeName?item.storeName:'门店'}}</text> <view>
<text>姓名{{item.studentName?item.studentName:'-'}}</text>
<text style="margin-left: 30rpx;">性别{{item.sex==2?'男':(item.sex==1?'女':'未知')}}</text>
</view>
<text>电话{{item.phone?item.phone:'-'}}</text>
</view> </view>
<view class="hright"> <view class="hright">
<!-- 1待上课2预约中3待评价 4已完成 5已取消 --> <!-- 1待上课2预约中3待评价 4已完成 5已取消 -->
@ -20,27 +24,29 @@
</view> </view>
</view> </view>
<view class="oscon" @click="gotoInfo(item.courseTimeId)"> <view class="oscon">
<view class="osimg imgload">
<image class="osimg" v-if="item.pic" :src="getimgRemoteFile(item.pic)" mode="aspectFill"></image>
</view>
<view class="osname"> <view class="osname">
<text class="ntxt">{{item.courseName}} {{item.claName}} </text> <view>
<text class="txt"> 教练{{item.teacherName }}</text> <text class="txt">课程{{item.courseName}}</text>
<text class="txt">上课时间{{ item.claDate+' '+item.startTime+'-'+item.endTime}}</text> <text class="txt" style="margin-left: 30rpx;">班级{{item.claName}} </text>
<text class="txt">教室{{item.roomName}}</text> </view>
<view>
<text class="txt">教练{{item.teacherName }}</text>
<text class="txt" style="margin-left: 30rpx;">教室{{item.roomName}}</text>
</view>
<text class="txt">上课时间{{ item.claDate+' '+item.startTime+(item.endTime?'-'+item.endTime:'')}}</text>
<view>
<text class="txt">预约人数{{item.bookAttendCnt}}</text>
<text class="txt" style="margin-left: 30rpx;">可容纳人数{{item.atClassCnt}} </text>
</view>
</view> </view>
</view> </view>
<view class="obtn"> <view class="obtn">
<view class="omoney"></view> <view class="omoney"></view>
<!-- 1待上课2预约中3待评价 4已完成 5已取消--> <!-- 1待上课2预约中3待评价 4已完成 5已取消-->
<!-- 描述:0->预约中;1->教练确认;2->店长确认/预约成功/待上课 3->已取消;4->已完成/待评价; --> <!-- 描述:0->预约中;1->教练确认;2->店长确认/预约成功/待上课 3->已取消;4->已完成/待评价; -->
<button type="primary" class="conbtn" @click="gototeacher(item)"></button> <button v-if="item.bookStatus==1" type="primary" class="stopbtn" :data-id="item.courseTimeId" @click="stopdo($event,item)"></button>
<button v-if="item.orderstate==2||item.orderstate==1" type="primary" class="cancelbtn" :data-id="item.courseTimeId" @click="cancelkcdo"></button> <button v-if="item.bookStatus==1" type="primary" class="orderbtn" :data-id="item.courseTimeId" @click="checkdo($event,item)"></button>
<button v-if="item.orderstate==0" type="primary" class="cancelbtn" :data-id="item.courseTimeId" @click="cancelyydo"></button>
<button v-if="item.orderstate==0" type="primary" class="paybtn" :data-id="item.courseTimeId" @click="checkdo($event,item)"></button>
<button v-if="item.orderstate==4" type="primary" class="viewbtn" :data-id="item.courseTimeId" @click="orderdo($event,item)"></button>
<button v-if="item.orderstate==4" type="primary" class="gzbtn" :data-id="item.courseTimeId" @click="gotoevaluate($event,item)"></button>
</view> </view>
</view> </view>
</view> </view>
@ -123,7 +129,7 @@
uni.showLoading({ uni.showLoading({
title: '数据加载中...' title: '数据加载中...'
}); });
const {data: res} = await uni.$http.get('/api/my/appointmentListForTeacher'); const {data: res} = await uni.$http.get('/api/my/appointmentListForManager');
if(res&&res.data){ if(res&&res.data){
// //
this.loadStatus="noMore"; this.loadStatus="noMore";
@ -137,7 +143,6 @@
} }
}, },
loadData(){ loadData(){
console.log('loadData');
// //
if(this.loadStatus=="more") { if(this.loadStatus=="more") {
this.loadStatus="loading"; this.loadStatus="loading";
@ -152,18 +157,6 @@
url: `/pages/book/bookinfo?id=${id}` url: `/pages/book/bookinfo?id=${id}`
}); });
}, },
//
gototeacher(item){
var data={
id:item.id,
name:"教练A"
}
//
var data=encodeURIComponent(JSON.stringify(data));
uni.navigateTo({
url: `/pages/teacher/chat?data=${data}`
})
},
// //
gotoevaluate(item){ gotoevaluate(item){
var data=encodeURIComponent(JSON.stringify(item)); var data=encodeURIComponent(JSON.stringify(item));
@ -186,52 +179,47 @@
return true; return true;
} }
}, },
// //
orderdo(e,item){ stopdo(e,item){
console.log(id,item);
var that = this; var that = this;
// //
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
content: '确定再次预约吗?', content: '确定禁止预约吗?',
cancelText: '取消', cancelText: '取消',
confirmText: '确定', confirmText: '确定',
success: ress => { success: ress => {
if (ress.confirm) { if (ress.confirm) {
that.checkdodo(id,item); that.stopdodo(item);
} }
} }
}); });
}, },
// //
async orderdodo(id,item){ async stopdodo(item){
var param={ var param={
"courseTimeId": item.courseTimeId "bookId": item.bookId,
"bookStatus": 2
}; };
uni.showToast({ uni.showLoading({
title: '再次预约中...', title: '禁止预约中...'
icon: 'success',
duration: 2000
}); });
const {data: res} = await uni.$http.post('/api/course/bookCourse', param); const {data: res} = await uni.$http.post('/api/my/checkAppointment', param);
if(res.success){ if(res.success){
uni.showToast({ uni.showToast({
title: '上课已预约!', title: '禁止预约!',
icon: 'success', icon: 'success',
duration: 2000 duration: 2000
}); });
// //
this.loadStatus="more";
this.$forceUpdate();
this.loadData(); this.loadData();
} }
else{ else{
// uni.showToast({
// title: res.msg? res.msg:'',
// icon: 'error',
// duration: 2000
// });
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
content: res.message? res.message:'课程预约失败!', content: res.message? res.message:'禁止预约失败!',
cancelText: '取消', cancelText: '取消',
confirmText: '确定', confirmText: '确定',
success: ress => { success: ress => {
@ -241,146 +229,59 @@
}); });
} }
}, },
// //
checkdo(e,item){ checkdo(e,item){
console.log(e); console.log(e);
var id= e.currentTarget.dataset.id; var id= e.currentTarget.dataset.id;
var that = this; var that = this;
// //
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
content: '确定上课吗?', content: '确认预约吗?',
cancelText: '取消', cancelText: '取消',
confirmText: '确定', confirmText: '确定',
success: ress => { success: ress => {
if (ress.confirm) { if (ress.confirm) {
that.checkdodo(id,item); that.checkdodo(item);
} }
} }
}); });
}, },
// //
async checkdodo(id,item){ async checkdodo(item){
var param={ var param={
"courseTimeId": item.courseTimeId, "bookId": item.bookId,
"startTime": item.startTime, "bookStatus": 1
"endTime": item.endTime
}; };
uni.showToast({ uni.showLoading({
title: '确定上课中...', title: '确认预约中...'
icon: 'success',
duration: 2000
}); });
const {data: res} = await uni.$http.post('/api/my/confirmClass', param); const {data: res} = await uni.$http.post('/api/my/checkAppointment', param);
if(res.msg=="successed"){ if(res.success){
uni.showToast({ uni.showToast({
title: '上课已确认!', title: '已确认预约',
icon: 'success', icon: 'success',
duration: 2000 duration: 2000
}); });
// //
this.loadStatus="more";
this.$forceUpdate();
this.loadData(); this.loadData();
} }
else{ else{
uni.showToast({
title: res.msg? res.msg:'上课确认失败!',
icon: 'error',
duration: 2000
});
}
},
//
cancelyydo(e){
console.log(e);
var id= e.currentTarget.dataset.id;
var that = this;
//
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
content: '确定要取消预约吗?', content: res.message? res.message:'确认预约失败!',
cancelText: '取消', cancelText: '取消',
confirmText: '确定', confirmText: '确定',
success: ress => { success: ress => {
if (ress.confirm) { if (ress.confirm) {
that.delyydo(id);
}
} }
});
},
//
async delyydo(id){
var param={
"courseTimeId":id
};
uni.showToast({
title: '取消中...',
icon: 'success',
duration: 2000
});
const {data: res} = await uni.$http.post('/api/course/cancelCourse', param);
if(res.msg=="successed"){
uni.showToast({
title: '预约已取消!',
icon: 'success',
duration: 2000
});
//
this.loadData();
} }
else{
uni.showToast({
title: res.msg? res.msg:'预约取消失败!',
icon: 'error',
duration: 2000
}); });
} }
}, },
//
cancelkcdo(e){
console.log(e);
var id= e.currentTarget.dataset.id;
var that = this;
//
uni.showModal({
title: '提示',
content: '确定要取消课程吗?',
cancelText: '取消',
confirmText: '确定',
success: ress => {
if (ress.confirm) {
that.delkcdo(id);
}
}
});
},
//
async delkcdo(id){
var param={
"courseTimeId":id
};
uni.showToast({
title: '取消中...',
icon: 'success',
duration: 2000
});
const {data: res} = await uni.$http.post('/api/course/cancelCourse', param);
if(res.msg=="successed"){
uni.showToast({
title: '课程已取消!',
icon: 'success',
duration: 2000
});
//
this.loadData();
}
else{
uni.showToast({
title: res.msg? res.msg:'课程取消失败!',
icon: 'error',
duration: 2000
});
}
}
} }
} }
</script> </script>
@ -482,28 +383,26 @@
flex-direction: column; flex-direction: column;
background-color: #FFFFFF; background-color: #FFFFFF;
border-radius: 6rpx; border-radius: 6rpx;
padding: 20rpx; padding: 20rpx 30rpx;
width: 100%; width: 100%;
margin-bottom: 20rpx; margin-bottom: 20rpx;
.otop{ .otop{
display: flex; display: flex;
flex-direction: row; flex-direction: row;
padding: 10rpx 0 0;
height: 60rpx;
line-height: 60rpx;
width: 100%; width: 100%;
padding: 10rpx 0 10rpx;
border-bottom: 1rpx solid #eee;
.hleft{ .hleft{
display: flex; display: flex;
flex-direction: row; flex-direction: column;
flex:1; flex:1;
align-items: center; justify-content: flex-start;
font-size: 30rpx; font-size: 28rpx;
color: #000; color: #000;
} }
.hright{ .hright{
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
align-items: center;
// <!--123 4 56--> // <!--123 4 56-->
.ztip{ .ztip{
border-radius: 12rpx; border-radius: 12rpx;
@ -576,19 +475,14 @@
flex-direction: row; flex-direction: row;
justify-content: flex-end; justify-content: flex-end;
border-top: 1rpx solid #eee; border-top: 1rpx solid #eee;
padding: 20rpx 0 10rpx; padding: 20rpx 0 2rpx;
width: 100%; width: 100%;
.omoney{ .omoney{
display: flex; display: flex;
flex:1; flex:1;
height: 60rpx;
width: 100%; width: 100%;
color:#333; color:#333;
align-items: center; align-items: center;
.omtip{
font-size: 36rpx;
color:rgb(252, 105, 0);
}
} }
.cancelbtn{ .cancelbtn{
background-color: #FFFFFF !important; background-color: #FFFFFF !important;
@ -619,37 +513,7 @@
.viewbtn::after{ .viewbtn::after{
border:0 !important; border:0 !important;
} }
.pjbtn{ .orderbtn{
background-color: #FFFFFF !important;
margin-left: 20rpx;
border-radius: 50rpx;
border-radius: 50rpx;
height: 50rpx;
line-height: 48rpx;
padding: 0 20rpx;
font-size: 24rpx;
border:1rpx solid rgb(252, 105, 0);
color:rgb(252, 105, 0);
}
.pjbtn::after{
border:0 !important;
}
.conbtn{
background-color: #f3f4ef !important;
margin-left: 20rpx;
border-radius: 50rpx;
border-radius: 50rpx;
height: 50rpx;
line-height: 48rpx;
padding: 0 20rpx;
font-size: 24rpx;
border:1rpx solid #00a89b;
color:#595d4d;
}
.conbtn::after{
border:0 !important;
}
.paybtn{
background-color: #00a89b !important; background-color: #00a89b !important;
margin-left: 20rpx; margin-left: 20rpx;
border-radius: 50rpx; border-radius: 50rpx;
@ -660,38 +524,25 @@
font-size: 24rpx; font-size: 24rpx;
border:1rpx solid #00a89b; border:1rpx solid #00a89b;
} }
.paybtn::after{ .orderbtn::after{
border:0 !important;
}
.gzbtn{
background-color: #f5aa00 !important;
margin-left: 20rpx;
border-radius: 50rpx;
height: 50rpx;
line-height: 48rpx;
padding: 0 20rpx;
font-size: 24rpx;
border:1rpx solid #f5aa00;
}
.gzbtn::after{
border:0 !important; border:0 !important;
} }
.gzbtn{ .stopbtn{
background-color: #f5aa00 !important; background-color: #f47fa0 !important;
margin-left: 20rpx; margin-left: 20rpx;
border-radius: 50rpx; border-radius: 50rpx;
height: 50rpx; height: 50rpx;
line-height: 48rpx; line-height: 48rpx;
padding: 0 20rpx; padding: 0 20rpx;
font-size: 24rpx; font-size: 24rpx;
border:1rpx solid #f5aa00; border:1rpx solid #f47fa0;
} }
.gzbtn::after{ .stopbtn::after{
border:0 !important; border:0 !important;
} }
} }
.oscon{ .oscon{
margin:20rpx 0; margin:16rpx 0;
border-radius: 16rpx; border-radius: 16rpx;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
@ -707,24 +558,16 @@
flex: 1; flex: 1;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
margin-left: 26rpx;
.ntxt{ .ntxt{
font-size: 28rpx; font-size: 26rpx;
color:#000; color:#333;
line-height: 36rpx; line-height: 36rpx;
margin-bottom: 8rpx; margin-bottom: 8rpx;
} }
.txt{ .txt{
font-size: 24rpx; font-size: 26rpx;
color:#666; color:#333;
}
} }
.osprice{
display: flex;
justify-content: flex-end;
margin-right: 10rpx;
font-size: 30rpx;
color:#666;
} }
} }
} }

@ -5,9 +5,13 @@
<view class="scell" v-if="list.length>0"> <view class="scell" v-if="list.length>0">
<view v-for="(item, index) in list" :key="index" class="oitem"> <view v-for="(item, index) in list" :key="index" class="oitem">
<view class="otop" @click="gotoInfo(item.courseTimeId)"> <view class="otop">
<view class="hleft"> <view class="hleft">
<text>{{item.storeName?item.storeName:'门店'}}</text> <view>
<text>姓名{{item.studentName?item.studentName:'-'}}</text>
<text style="margin-left: 30rpx;">性别{{item.sex==2?'男':(item.sex==1?'女':'未知')}}</text>
</view>
<text>电话{{item.phone?item.phone:'-'}}</text>
</view> </view>
<view class="hright"> <view class="hright">
<!-- 1待上课2预约中3待评价 4已完成 5已取消 --> <!-- 1待上课2预约中3待评价 4已完成 5已取消 -->
@ -20,27 +24,29 @@
</view> </view>
</view> </view>
<view class="oscon" @click="gotoInfo(item.courseTimeId)"> <view class="oscon">
<view class="osimg imgload">
<image class="osimg" v-if="item.pic" :src="getimgRemoteFile(item.pic)" mode="aspectFill"></image>
</view>
<view class="osname"> <view class="osname">
<text class="ntxt">{{item.courseName}} {{item.claName}} </text> <view>
<text class="txt"> 教练{{item.teacherName }}</text> <text class="txt">课程{{item.courseName}}</text>
<text class="txt">上课时间{{ item.claDate+' '+item.startTime+'-'+item.endTime}}</text> <text class="txt" style="margin-left: 30rpx;">班级{{item.claName}} </text>
<text class="txt">教室{{item.roomName}}</text> </view>
<view>
<text class="txt">教练{{item.teacherName }}</text>
<text class="txt" style="margin-left: 30rpx;">教室{{item.roomName}}</text>
</view>
<text class="txt">上课时间{{ item.claDate+' '+item.startTime+(item.endTime?'-'+item.endTime:'')}}</text>
<view>
<text class="txt">预约人数{{item.bookAttendCnt}}</text>
<text class="txt" style="margin-left: 30rpx;">可容纳人数{{item.atClassCnt}} </text>
</view>
</view> </view>
</view> </view>
<view class="obtn"> <view class="obtn">
<view class="omoney"></view> <view class="omoney"></view>
<!-- 1待上课2预约中3待评价 4已完成 5已取消--> <!-- 1待上课2预约中3待评价 4已完成 5已取消-->
<!-- 描述:0->预约中;1->教练确认;2->店长确认/预约成功/待上课 3->已取消;4->已完成/待评价; --> <!-- 描述:0->预约中;1->教练确认;2->店长确认/预约成功/待上课 3->已取消;4->已完成/待评价; -->
<button type="primary" class="conbtn" @click="gototeacher(item)"></button> <button v-if="item.bookStatus==0" type="primary" class="stopbtn" :data-id="item.courseTimeId" @click="stopdo($event,item)"></button>
<button v-if="item.orderstate==2||item.orderstate==1" type="primary" class="cancelbtn" :data-id="item.courseTimeId" @click="cancelkcdo"></button> <button v-if="item.bookStatus==0" type="primary" class="orderbtn" :data-id="item.courseTimeId" @click="checkdo($event,item)"></button>
<button v-if="item.orderstate==0" type="primary" class="cancelbtn" :data-id="item.courseTimeId" @click="cancelyydo"></button>
<button v-if="item.orderstate==0" type="primary" class="paybtn" :data-id="item.courseTimeId" @click="checkdo($event,item)"></button>
<button v-if="item.orderstate==4" type="primary" class="viewbtn" :data-id="item.courseTimeId" @click="orderdo($event,item)"></button>
<button v-if="item.orderstate==4" type="primary" class="gzbtn" :data-id="item.courseTimeId" @click="gotoevaluate($event,item)"></button>
</view> </view>
</view> </view>
</view> </view>
@ -137,7 +143,6 @@
} }
}, },
loadData(){ loadData(){
console.log('loadData');
// //
if(this.loadStatus=="more") { if(this.loadStatus=="more") {
this.loadStatus="loading"; this.loadStatus="loading";
@ -152,18 +157,6 @@
url: `/pages/book/bookinfo?id=${id}` url: `/pages/book/bookinfo?id=${id}`
}); });
}, },
//
gototeacher(item){
var data={
id:item.id,
name:"教练A"
}
//
var data=encodeURIComponent(JSON.stringify(data));
uni.navigateTo({
url: `/pages/teacher/chat?data=${data}`
})
},
// //
gotoevaluate(item){ gotoevaluate(item){
var data=encodeURIComponent(JSON.stringify(item)); var data=encodeURIComponent(JSON.stringify(item));
@ -186,52 +179,47 @@
return true; return true;
} }
}, },
// //
orderdo(e,item){ stopdo(e,item){
console.log(id,item);
var that = this; var that = this;
// //
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
content: '确定再次预约吗?', content: '确定禁止预约吗?',
cancelText: '取消', cancelText: '取消',
confirmText: '确定', confirmText: '确定',
success: ress => { success: ress => {
if (ress.confirm) { if (ress.confirm) {
that.checkdodo(id,item); that.stopdodo(item);
} }
} }
}); });
}, },
// //
async orderdodo(id,item){ async stopdodo(item){
var param={ var param={
"courseTimeId": item.courseTimeId "bookId": item.bookId,
"bookStatus": 2
}; };
uni.showToast({ uni.showLoading({
title: '再次预约中...', title: '禁止预约中...'
icon: 'success',
duration: 2000
}); });
const {data: res} = await uni.$http.post('/api/course/bookCourse', param); const {data: res} = await uni.$http.post('/api/my/checkAppointment', param);
if(res.success){ if(res.success){
uni.showToast({ uni.showToast({
title: '上课已预约!', title: '禁止预约!',
icon: 'success', icon: 'success',
duration: 2000 duration: 2000
}); });
// //
this.loadStatus="more";
this.$forceUpdate();
this.loadData(); this.loadData();
} }
else{ else{
// uni.showToast({
// title: res.msg? res.msg:'',
// icon: 'error',
// duration: 2000
// });
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
content: res.message? res.message:'课程预约失败!', content: res.message? res.message:'禁止预约失败!',
cancelText: '取消', cancelText: '取消',
confirmText: '确定', confirmText: '确定',
success: ress => { success: ress => {
@ -241,146 +229,59 @@
}); });
} }
}, },
// //
checkdo(e,item){ checkdo(e,item){
console.log(e); console.log(e);
var id= e.currentTarget.dataset.id; var id= e.currentTarget.dataset.id;
var that = this; var that = this;
// //
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
content: '确定上课吗?', content: '确认预约吗?',
cancelText: '取消', cancelText: '取消',
confirmText: '确定', confirmText: '确定',
success: ress => { success: ress => {
if (ress.confirm) { if (ress.confirm) {
that.checkdodo(id,item); that.checkdodo(item);
} }
} }
}); });
}, },
// //
async checkdodo(id,item){ async checkdodo(item){
var param={ var param={
"courseTimeId": item.courseTimeId, "bookId": item.bookId,
"startTime": item.startTime, "bookStatus": 1
"endTime": item.endTime
}; };
uni.showToast({ uni.showLoading({
title: '确定上课中...', title: '确认预约中...'
icon: 'success',
duration: 2000
}); });
const {data: res} = await uni.$http.post('/api/my/confirmClass', param); const {data: res} = await uni.$http.post('/api/my/checkAppointment', param);
if(res.msg=="successed"){ if(res.success){
uni.showToast({ uni.showToast({
title: '上课已确认!', title: '已确认预约',
icon: 'success', icon: 'success',
duration: 2000 duration: 2000
}); });
// //
this.loadStatus="more";
this.$forceUpdate();
this.loadData(); this.loadData();
} }
else{ else{
uni.showToast({
title: res.msg? res.msg:'上课确认失败!',
icon: 'error',
duration: 2000
});
}
},
//
cancelyydo(e){
console.log(e);
var id= e.currentTarget.dataset.id;
var that = this;
//
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
content: '确定要取消预约吗?', content: res.message? res.message:'确认预约失败!',
cancelText: '取消', cancelText: '取消',
confirmText: '确定', confirmText: '确定',
success: ress => { success: ress => {
if (ress.confirm) { if (ress.confirm) {
that.delyydo(id);
}
} }
});
},
//
async delyydo(id){
var param={
"courseTimeId":id
};
uni.showToast({
title: '取消中...',
icon: 'success',
duration: 2000
});
const {data: res} = await uni.$http.post('/api/course/cancelCourse', param);
if(res.msg=="successed"){
uni.showToast({
title: '预约已取消!',
icon: 'success',
duration: 2000
});
//
this.loadData();
} }
else{
uni.showToast({
title: res.msg? res.msg:'预约取消失败!',
icon: 'error',
duration: 2000
}); });
} }
}, },
//
cancelkcdo(e){
console.log(e);
var id= e.currentTarget.dataset.id;
var that = this;
//
uni.showModal({
title: '提示',
content: '确定要取消课程吗?',
cancelText: '取消',
confirmText: '确定',
success: ress => {
if (ress.confirm) {
that.delkcdo(id);
}
}
});
},
//
async delkcdo(id){
var param={
"courseTimeId":id
};
uni.showToast({
title: '取消中...',
icon: 'success',
duration: 2000
});
const {data: res} = await uni.$http.post('/api/course/cancelCourse', param);
if(res.msg=="successed"){
uni.showToast({
title: '课程已取消!',
icon: 'success',
duration: 2000
});
//
this.loadData();
}
else{
uni.showToast({
title: res.msg? res.msg:'课程取消失败!',
icon: 'error',
duration: 2000
});
}
}
} }
} }
</script> </script>
@ -482,28 +383,26 @@
flex-direction: column; flex-direction: column;
background-color: #FFFFFF; background-color: #FFFFFF;
border-radius: 6rpx; border-radius: 6rpx;
padding: 20rpx; padding: 20rpx 30rpx;
width: 100%; width: 100%;
margin-bottom: 20rpx; margin-bottom: 20rpx;
.otop{ .otop{
display: flex; display: flex;
flex-direction: row; flex-direction: row;
padding: 10rpx 0 0;
height: 60rpx;
line-height: 60rpx;
width: 100%; width: 100%;
padding: 10rpx 0 10rpx;
border-bottom: 1rpx solid #eee;
.hleft{ .hleft{
display: flex; display: flex;
flex-direction: row; flex-direction: column;
flex:1; flex:1;
align-items: center; justify-content: flex-start;
font-size: 30rpx; font-size: 28rpx;
color: #000; color: #000;
} }
.hright{ .hright{
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
align-items: center;
// <!--123 4 56--> // <!--123 4 56-->
.ztip{ .ztip{
border-radius: 12rpx; border-radius: 12rpx;
@ -576,19 +475,14 @@
flex-direction: row; flex-direction: row;
justify-content: flex-end; justify-content: flex-end;
border-top: 1rpx solid #eee; border-top: 1rpx solid #eee;
padding: 20rpx 0 10rpx; padding: 20rpx 0 2rpx;
width: 100%; width: 100%;
.omoney{ .omoney{
display: flex; display: flex;
flex:1; flex:1;
height: 60rpx;
width: 100%; width: 100%;
color:#333; color:#333;
align-items: center; align-items: center;
.omtip{
font-size: 36rpx;
color:rgb(252, 105, 0);
}
} }
.cancelbtn{ .cancelbtn{
background-color: #FFFFFF !important; background-color: #FFFFFF !important;
@ -619,37 +513,7 @@
.viewbtn::after{ .viewbtn::after{
border:0 !important; border:0 !important;
} }
.pjbtn{ .orderbtn{
background-color: #FFFFFF !important;
margin-left: 20rpx;
border-radius: 50rpx;
border-radius: 50rpx;
height: 50rpx;
line-height: 48rpx;
padding: 0 20rpx;
font-size: 24rpx;
border:1rpx solid rgb(252, 105, 0);
color:rgb(252, 105, 0);
}
.pjbtn::after{
border:0 !important;
}
.conbtn{
background-color: #f3f4ef !important;
margin-left: 20rpx;
border-radius: 50rpx;
border-radius: 50rpx;
height: 50rpx;
line-height: 48rpx;
padding: 0 20rpx;
font-size: 24rpx;
border:1rpx solid #00a89b;
color:#595d4d;
}
.conbtn::after{
border:0 !important;
}
.paybtn{
background-color: #00a89b !important; background-color: #00a89b !important;
margin-left: 20rpx; margin-left: 20rpx;
border-radius: 50rpx; border-radius: 50rpx;
@ -660,38 +524,25 @@
font-size: 24rpx; font-size: 24rpx;
border:1rpx solid #00a89b; border:1rpx solid #00a89b;
} }
.paybtn::after{ .orderbtn::after{
border:0 !important;
}
.gzbtn{
background-color: #f5aa00 !important;
margin-left: 20rpx;
border-radius: 50rpx;
height: 50rpx;
line-height: 48rpx;
padding: 0 20rpx;
font-size: 24rpx;
border:1rpx solid #f5aa00;
}
.gzbtn::after{
border:0 !important; border:0 !important;
} }
.gzbtn{ .stopbtn{
background-color: #f5aa00 !important; background-color: #f47fa0 !important;
margin-left: 20rpx; margin-left: 20rpx;
border-radius: 50rpx; border-radius: 50rpx;
height: 50rpx; height: 50rpx;
line-height: 48rpx; line-height: 48rpx;
padding: 0 20rpx; padding: 0 20rpx;
font-size: 24rpx; font-size: 24rpx;
border:1rpx solid #f5aa00; border:1rpx solid #f47fa0;
} }
.gzbtn::after{ .stopbtn::after{
border:0 !important; border:0 !important;
} }
} }
.oscon{ .oscon{
margin:20rpx 0; margin:16rpx 0;
border-radius: 16rpx; border-radius: 16rpx;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
@ -707,24 +558,16 @@
flex: 1; flex: 1;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
margin-left: 26rpx;
.ntxt{ .ntxt{
font-size: 28rpx; font-size: 26rpx;
color:#000; color:#333;
line-height: 36rpx; line-height: 36rpx;
margin-bottom: 8rpx; margin-bottom: 8rpx;
} }
.txt{ .txt{
font-size: 24rpx; font-size: 26rpx;
color:#666; color:#333;
}
} }
.osprice{
display: flex;
justify-content: flex-end;
margin-right: 10rpx;
font-size: 30rpx;
color:#666;
} }
} }
} }

@ -79,8 +79,8 @@
</view> </view>
<uni-load-more iconType="circle" :status="tabItem.loadStatus" /> <uni-load-more iconType="circle" :status="tabItem.loadStatus" />
</scroll-view> </scroll-view>
<!-- 健康指数体质测评 --> <!-- 健康指数-->
<scroll-view v-else-if="list[index].id==2||list[index].id==10" scroll-y style="height: 100%;width: 100%;"> <scroll-view v-else-if="list[index].id==2" scroll-y style="height: 100%;width: 100%;">
<view class="scontent"> <view class="scontent">
<uni-forms ref="valiForm" :modelValue="valiFormData"> <uni-forms ref="valiForm" :modelValue="valiFormData">
<uni-forms-item label="性别" labelWidth="180rpx" required name="contact"> <uni-forms-item label="性别" labelWidth="180rpx" required name="contact">
@ -100,6 +100,28 @@
</view> </view>
</scroll-view> </scroll-view>
<!-- 体质测评 -->
<scroll-view v-else-if="list[index].id==10" scroll-y style="height: 100%;width: 100%;">
<view class="tzcontent">
<view class="tztitle">{{title}}</view>
<view class="tztxt">
{{description}}
</view>
<uni-forms ref="valiForm1" label-position="top">
<view class="example">
<uni-forms-item v-for="(item, i) in list[index].slist" :key="i" :name="item.name+'('+item.description+')'"
:label="numberToChinese(i+1)+'、'+item.name+'('+item.description+') 得分:'+(item.score?item.score:0)" labelWidth="700rpx" >
<view v-if="item.questions" class="uni-list" v-for="(cell, j) in item.questions" :key="'c'+j">
<view class="optxt">{{(j+1)+'、'+cell.content}}</view>
<uni-data-checkbox v-model="cell.score" :localdata="getoption(cell.options)" @change="checkboxChange($event,i,j)"></uni-data-checkbox>
</view>
</uni-forms-item>
</view>
</uni-forms>
<button type="primary" class="btn" @click="tzsubmit('valiForm1')"></button>
</view>
</scroll-view>
<scroll-view v-else scroll-y style="height: 100%;width: 100%;"> <scroll-view v-else scroll-y style="height: 100%;width: 100%;">
<view class="card" v-for="(item, i) in tabItem.slist" :key="i" @tap="gotoDetail(item,tabItem.name,index)"> <view class="card" v-for="(item, i) in tabItem.slist" :key="i" @tap="gotoDetail(item,tabItem.name,index)">
<view class="limg imgload"> <view class="limg imgload">
@ -148,7 +170,7 @@
userid:"", userid:"",
tabCurrentIndex: 0, tabCurrentIndex: 0,
scrollLeft: 0, scrollLeft: 0,
shopid:myCache('myshopid')?myCache('myshopid'):'', shopid:myCache('myshopid')?myCache('myshopid'):null,
shop:myCache('myshop')?myCache('myshop'):'', shop:myCache('myshop')?myCache('myshop'):'',
tabIndex: 0, tabIndex: 0,
id:1, id:1,
@ -254,6 +276,30 @@
}] }]
}, },
}, },
items: [
{
value: '2',
name: '2',
text: '2'
},
{
value: '1',
text: '1',
name: '1'
},
{
value: '0',
text: '0',
name: '0'
}
],
description:"(亲爱的伽人欢迎来到中医九种体质自测普查此版本适用人群全年龄段评分标准请根据近1年真实情况勾选。打分规则完全符合 = 2分 | 偶尔有 = 1分 | 完全不符合 = 0分请选择)",
title:"中医九种体质自测普查",
surveyId:null,
scores:0,
sessionId:null,
}; };
}, },
onLoad(option) { onLoad(option) {
@ -296,6 +342,199 @@
},100); },100);
}, },
methods: { methods: {
numberToChinese(num) {
const chineseNums = ['零', '一', '二', '三', '四', '五', '六', '七', '八', '九'];
const sections = ['', '十', '百', '千'];
const units = ['', '万', '亿'];
num = String(num).split("").reverse().join(""); // 便
let result = '';
let unitIndex = 0;
for (let i = 0; i < num.length; i++) {
let n = Number(num[i]);
if (n !== 0) {
result = chineseNums[n] + sections[i % 4] + result;
if (i % 4 === 0 && i !== 0) {
result = units[unitIndex] + result;
unitIndex++;
}
} else {
if (result.charAt(0) !== chineseNums[0]) { //
result = chineseNums[0] + result;
}
}
}
return result.replace(/零([亿万])/g, "$1").replace(/零+/g, "零"); //
},
getoption(options){
var arrs=[];
if(options&&options.length>0){
options.forEach(option=>{
arrs.push({value:option.score,text:option.optionText})
})
}
return arrs;
},
checkboxChange(e,i,j){
console.log('e:',e,i,j);
if(e.detail.data){
this.list[this.tabCurrentIndex].slist[i].questions[j]["score"]=e.detail.value;
this.$forceUpdate();
this.list[this.tabCurrentIndex].slist[i].questions[j].options.forEach(op=>{
if(e.detail.value==op.score){
this.list[this.tabCurrentIndex].slist[i].questions[j]["optionId"]=op.optionId;
this.$forceUpdate();
}
})
this.scores=0;
this.list[this.tabCurrentIndex].slist.forEach((item,ind) => {
var score=0
if(item.questions){
item.questions.forEach(cell => {
if(cell.score){
this.scores+=cell.score;
score+=cell.score;
this.$forceUpdate();
}
});
}
this.list[this.tabCurrentIndex].slist[ind]["score"]=score;
this.$forceUpdate();
});
this.$forceUpdate();
}
},
tzsubmit(ref) {
var answers=[];
var tj=0;
this.list[this.tabCurrentIndex].slist.forEach(item => {
if(item.questions){
item.questions.forEach(cell => {
if(cell.optionId){
tj++;
answers.push({
questionId:cell.questionId,
optionId:cell.optionId
});
}
});
}
})
if(tj>0){
this.tzsavedo(answers)
}
else{
uni.showModal({
title: '提示',
content: "请选择体质测评数据后提交!",
cancelText: '取消',
confirmText: '确定',
success: ress => {
if (ress.confirm) {
}
}
});
}
},
async tzsavedo(answers){
var params={
answers:answers,
surveyId:this.surveyId,
sessionId:this.sessionId,
}
try{
const {data: res} = await uni.$http.post('/api/questionnaire/submit', params);
if(res&&res.success){
var data=res.data;
var constitutionScores=data.constitutionScores?data.constitutionScores:[];
// 1. 8 6
//
// 2.// 8
// //
// 3. 6 7
// //
// 4.77
//
var ifone=0,iftwo=0,ifthree=0,iffour=0;
var twostr=[],threestr=[];
constitutionScores.forEach(item=>{
// 1. 8 6
if(item.constitutionAlias=="pinghe"){
if(item.totalScore>=8)
{
ifone=2;
}
}
else{
if(item.totalScore>6)
{
ifone=ifone-1;
}
if(item.totalScore>=8)
{
iftwo=iftwo+1;
twostr.push(item.constitutionName.replace("体质",""))
}
if(item.totalScore>=7&&item.totalScore<=6)
{
ifthree=ifthree+1;
threestr.push(item.constitutionName.replace("体质",""))
}
if(item.totalScore>=7)
{
iffour=iffour+1;
}
}
});
var tips=data.resultText?data.resultText:"体质测评提交成功!";
if(ifone==2){
tips="恭喜您,您的体质为“为平和体质”,非常完美。请联系您的馆主或教练,领取训练及生活方案,继续保持哦。"
}
else if(iftwo>0){
tips="亲爱的伽人您好,您的体质为典型"+twostr.toString('/')+"体质。请联系您的馆主或教练,领取训练机生活方案,快速调整哦。"
}
else if(ifthree>0){
tips="亲爱的伽人您好,您的体质为典型"+threestr.toString('/')+"倾向体质。请联系您的馆主或教练,领取训练机生活方案,快速调整哦。"
}
else if(iffour>1){
tips="亲爱的伽人您好,您的体质为复合型体质典型,建议综合调理。请联系您的馆主或教练,领取训练机生活方案,快速调整哦。"
}
uni.showModal({
title: '提示',
content: tips,
cancelText: '取消',
confirmText: '确定',
success: ress => {
if (ress.confirm) {}
}
});
}
else{
uni.showModal({
title: '提示',
content: res.message? res.message:'体质测评提交失败!请重试!',
cancelText: '取消',
confirmText: '确定'
});
}
}
catch{
uni.showModal({
title: '提示',
content: '计算异常!请重试!',
cancelText: '取消',
confirmText: '确定'
});
}
},
async getSort() { async getSort() {
// //
const {data: res} = await uni.$http.get('/api/index/getIndex'); const {data: res} = await uni.$http.get('/api/index/getIndex');
@ -413,12 +652,78 @@
// () // ()
url="/api/healthy/getList"; url="/api/healthy/getList";
} }
else if(this.list[this.tabCurrentIndex].id==10){
//
url="/api/questionnaire/getOne";
}
else{ else{
return false; return false;
} }
uni.showLoading({ uni.showLoading({
title: '数据加载中...' title: '数据加载中...'
}); });
//
if(this.list[this.tabCurrentIndex].id==10){
//
const {data: res} = await uni.$http.get(url);
if(res.data){
var data=res.data;
this.list[this.tabCurrentIndex].loadStatus="noMore";
this.list[this.tabCurrentIndex].slist=data.constitutions?data.constitutions:[];
this.description=data.description;
this.title=data.title;
this.surveyId=data.surveyId;
this.sessionId=data.sessionId;
this.$forceUpdate();
if(this.userid){
//
const {data: rest} = await uni.$http.get("/api/questionnaire/result");
if(rest.data){
var resultText=rest.data.resultText;
if(resultText){
uni.showModal({
title: '上次测评结果',
content: resultText,
cancelText: '取消',
confirmText: '确定',
success: ress => {
if (ress.confirm) {}
}
});
}
// var constitutionScores=rest.data.constitutionScores?rest.data.constitutionScores:[];
// var answers=rest.data.answers?rest.data.answers:[];
// answers.forEach(cell=>{
// this.list[this.tabCurrentIndex].slist.forEach((item,ii)=>{
// if(item.questions&&item.questions.length>0){
// item.questions.forEach((qt,kk)=>{
// if(qt.questionId==answers.questionId){
// if(qt.options){
// qt.options.forEach((opt,hh)=>{
// if(opt.optionId==answers.optionId){
// this.list[this.tabCurrentIndex].slist[ii].questions[kk]["score"]=opt.score;
// this.$forceUpdate();
// }
// });
// }
// }
// })
// }
// });
// });
}
}
}
else{
this.list[this.tabCurrentIndex].loadStatus="noMore";
this.$forceUpdate();
}
}
else{
// //
const {data: res} = await uni.$http.post(url, para); const {data: res} = await uni.$http.post(url, para);
if(res.data){ if(res.data){
@ -445,6 +750,7 @@
this.$forceUpdate(); this.$forceUpdate();
} }
} }
}
}, },
loadData(){ loadData(){
// //
@ -488,7 +794,7 @@
}, },
animationfinish({ detail: { current } }) { animationfinish({ detail: { current } }) {
console.log("animationfinish") // console.log("animationfinish")
// this.tabCurrentIndex = current; // this.tabCurrentIndex = current;
}, },
handleChange(e) { handleChange(e) {
@ -526,7 +832,7 @@
}, },
tabChangeDo(){ tabChangeDo(){
this.scrollLeft = (this.tabCurrentIndex - 1) * 90; this.scrollLeft = (this.tabCurrentIndex - 1) * 90;
if(this.list[this.tabCurrentIndex].id==2||this.list[this.tabCurrentIndex].id==10){ if(this.list[this.tabCurrentIndex].id==2){
var that=this; var that=this;
// //
setTimeout(() => { setTimeout(() => {
@ -674,7 +980,7 @@
} }
.swiper-box { .swiper-box {
flex: 1; flex: 1;
height: calc(100vh - var(--window-top) - var(--window-bottom) - 280rpx) !important; height: calc(100vh - var(--window-top) - var(--window-bottom) - 200rpx) !important;
} }
.swiper-item { .swiper-item {
height: 100%; height: 100%;
@ -866,8 +1172,6 @@
/* autoprefixer: off */ /* autoprefixer: off */
-webkit-box-orient: vertical; // -webkit-box-orient: vertical; //
/* autoprefixer: on */ /* autoprefixer: on */
} }
} }
} }
@ -934,5 +1238,110 @@
} }
} }
::v-deep.uni-data-checklist .checklist-group .checklist-box .checklist-content .checklist-text{
line-height: 40rpx !important;
font-size: 28rpx !important;
font-family: PingFang SC-Regular, PingFang SC !important;
font-weight: 400 !important;
color: #23262F !important;
}
::v-deep .uni-forms-item.is-direction-top .uni-forms-item__label{
font-size: 30rpx !important;
font-family: PingFang SC-Semibold, PingFang SC !important;
font-weight: 500 !important;
color: #333333 !important;
}
::v-deep .uni-forms-item__label{
height: auto !important;
}
::v-deep .uni-forms-item__error{
display: none !important;
}
::v-deep .uni-forms-item{
margin-bottom: 16rpx !important;
}
.uni-list-cell{
display: flex;
flex-direction: row;
padding: 20rpx 0;
}
.rtxt{
margin-left: 16rpx;
font-size: 28rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #23262F;
}
.rtip{
font-size: 28rpx;
color:#F45A45;
margin-right: 5rpx;
}
.rtitle{
color:#666666;
height: 40rpx;
line-height: 40rpx;
font-size: 28rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #23262F;
}
.tvalue{
display: flex;
flex:1;
justify-content: flex-end;
font-size: 24rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #666666;
height: 40rpx;
line-height: 40rpx;
margin-left: 16rpx;
}
.nvalue{
display: flex;
flex:1;
justify-content: flex-end;
font-size: 24rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #999999;
height: 40rpx;
line-height: 40rpx;
margin-left: 16rpx;
}
.example {
margin: 20rpx 8rpx 0;
padding: 20rpx;
background-color: #FFFFFF;
border-radius: 16rpx;
}
.optxt{
width: 100%;
line-height: 40rpx;
font-size: 28rpx;
color: #23262F;
text-align: left;
}
.tztitle{
width: 100%;
line-height: 60rpx;
font-size: 36rpx;
font-weight: 600;
color: #000;
}
.tztxt{
width: 100%;
line-height: 32rpx;
font-size: 28rpx;
color: #000;
text-align: left;
}
.tzcontent{
background-color: rgba(255, 255,255, 0.5);
border-radius: 20rpx;
margin: 30rpx;
padding:20rpx 20rpx;
text-align: center;
}
</style> </style>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -217,17 +217,6 @@
// WebSocket // WebSocket
this.closeWebSocket(); this.closeWebSocket();
}, },
// buttons
onNavigationBarButtonTap: async function(e) {
const _that = this;
const index = e.index;
if (index === 0) {
var data=encodeURIComponent(JSON.stringify(_that.info));
uni.navigateTo({
url: `/pages/chat/chatset?data=${data}`
});
}
},
methods: { methods: {
gotoInfo(item){ gotoInfo(item){
var data=encodeURIComponent(JSON.stringify(item)); var data=encodeURIComponent(JSON.stringify(item));
@ -237,7 +226,7 @@
}, },
handleImageError(e,index){ handleImageError(e,index){
console.log(e,index); console.log(e,index);
this.unshiftmsg[index]["headimg"]= require("@/static/image/girl.jpg"); this.unshiftmsg[index]["headimg"]= require("@/static/image/girl.png");
this.$forceUpdate(); this.$forceUpdate();
}, },
// //
@ -263,7 +252,7 @@
else if(cell.type=='txt'){ else if(cell.type=='txt'){
cell.content=decodeURIComponent(cell.content); cell.content=decodeURIComponent(cell.content);
} }
cell["headimg"]=require("@/static/image/girl.jpg"); //this.imgurl+'/images/'+ cell.fromuser+".jpg?id="+Math.random()*100; cell["headimg"]=require("@/static/image/girl.png"); //this.imgurl+'/images/'+ cell.fromuser+".jpg?id="+Math.random()*100;
this.unshiftmsg.push(cell); this.unshiftmsg.push(cell);
// :id // :id
setTimeout(() => { setTimeout(() => {
@ -567,7 +556,7 @@
let data = { let data = {
"fromname": this.friendName, "fromname": this.friendName,
"fromuser": this.friendcode, "fromuser": this.friendcode,
"headimg":require("@/static/image/girl.jpg"), "headimg":require("@/static/image/girl.png"),
"toname": this.info.name, // "toname": this.info.name, //
"touser": this.info.id, // "touser": this.info.id, //
"content": e.type=='audio'?e.message.voice:e.message, "content": e.type=='audio'?e.message.voice:e.message,

File diff suppressed because it is too large Load Diff

@ -203,7 +203,7 @@ export default {
spData:JSON.stringify(this.product.spData),// this.retSku(this.product.spData) , // this.product.spData, spData:JSON.stringify(this.product.spData),// this.retSku(this.product.spData) , // this.product.spData,
skuId:this.product.skuId, skuId:this.product.skuId,
quantity:this.product.quantity, quantity:this.product.quantity,
storeId:myCache('myshopid')?myCache('myshopid'):'', storeId:this.product.storeId,
isCourse:this.product.isCourse, isCourse:this.product.isCourse,
}; };
const {data: res1} = await uni.$http.post('/api/cart/add',param); const {data: res1} = await uni.$http.post('/api/cart/add',param);

@ -27,8 +27,11 @@
<view class="selcon"> <view class="selcon">
<view v-for="(item,index) in areas" :key="index" > <view v-for="(item,index) in areas" :key="index" >
<view class="sitem" :class="item.id==shopid?'cur':''"> <view class="sitem" :class="item.id==shopid?'cur':''">
<view class="sarr" v-if="item.childList&&item.childList.length>0">
<uni-icons v-if="item.expanded" type="down" size="20" color="#666" @click="expandDO(index)"></uni-icons> <uni-icons v-if="item.expanded" type="down" size="20" color="#666" @click="expandDO(index)"></uni-icons>
<uni-icons v-else type="right" size="20" color="#666" @click="expandDO(index)"></uni-icons> <uni-icons v-else type="right" size="20" color="#666" @click="expandDO(index)"></uni-icons>
</view>
<view class="sarr" v-else></view>
<image class="stimg" :src="getimgRemoteFile(item.banner)" mode="aspectFill" @click="expandDO(index)"></image> <image class="stimg" :src="getimgRemoteFile(item.banner)" mode="aspectFill" @click="expandDO(index)"></image>
<view class="sname" @click="expandDO(index)"> <view class="sname" @click="expandDO(index)">
<view class="stxt"> <view class="stxt">
@ -86,8 +89,8 @@ export default {
default: false, default: false,
}, },
shopid: { shopid: {
type: Number, type: String,
default: 0, default: '0',
}, },
shop: { shop: {
type: String, type: String,
@ -111,11 +114,28 @@ export default {
} }
}, },
// //
changeArea(item){ async changeArea(item){
myCache('myshop',item.storeName); uni.showLoading({
myCache('myshopid',item.id); title: '门店切换中...'
});
const {data: res} = await uni.$http.post('/api/index/changeStore',{"visitStoreId":item.id});
if(res&&res.success){
var data=res.data;
myCache('myshop',data.storeName);
myCache('myshopid',data.id);
this._hide(); this._hide();
this.$emit("changeArea", item); this.$emit("changeArea", data);
}
else{
//
uni.showModal({
title: '提示',
content: res.message? res.message : '切换门店失败!请重试!',
cancelText: '取消',
confirmText: '确定',
success: ress => {}
});
}
}, },
_show() { _show() {
this.areas= myCache('shoplist'); this.areas= myCache('shoplist');
@ -276,6 +296,10 @@ export default {
padding: 20rpx 0 20rpx 10rpx; padding: 20rpx 0 20rpx 10rpx;
margin: 10rpx 30rpx 0 30rpx; margin: 10rpx 30rpx 0 30rpx;
align-items: center; align-items: center;
.sarr{
width: 30rpx;
margin-right: 10rpx;
}
.stimg{ .stimg{
width: 80rpx; width: 80rpx;
height: 80rpx; height: 80rpx;

@ -13,8 +13,9 @@ export default {
}, },
methods: { methods: {
goservice(){ goservice(){
console.log('linemobile',myCache('linemobile')) var shop=myCache('shop');
myCache('linemobile','18900000001') var phone=shop&&shop.phone?shop.phone:"";
myCache('linemobile',phone)
// 线 // 线
if(myCache('linemobile')){ if(myCache('linemobile')){
// 线 // 线
@ -28,38 +29,7 @@ export default {
} }
}); });
} }
else{
// this.getlinemobile();
}
this.$emit("goservice", "goservice"); this.$emit("goservice", "goservice");
},
async getlinemobile(){
const {data: res} = await uni.$http.get('/platform/getHotline');
console.log(res)
if (res) {
myCache('linemobile',res);
uni.makePhoneCall({
phoneNumber: String(myCache('linemobile')),
success:function(){
console.log('拨打电话成功');
},
fail() {
console.log('打电话失败了');
}
});
}
else{
uni.showModal({
title: '提示',
content: '在线电话获取失败!请稍后再试!',
cancelText: '取消',
confirmText: '确定',
success: ress => {
if (ress.confirm) {
}
}
});
}
} }
} }
} }

@ -18,8 +18,8 @@
:duration="1000" :duration="1000"
:circular="true"> :circular="true">
<swiper-item v-for="(item, i) in swiperList" :key="i"> <swiper-item v-for="(item, i) in swiperList" :key="i">
<view class="swiper-item" @click="goto(item.ban_url)"> <view class="swiper-item" @click="goto(item)">
<image :src="item.ban_img" mode="aspectFill"></image> <image :src="item" mode="aspectFill"></image>
</view> </view>
</swiper-item> </swiper-item>
</swiper> </swiper>
@ -104,16 +104,12 @@
openId:"", openId:"",
phone:"", phone:"",
userid:"", userid:"",
shopid: myCache('myshopid'), shopid: myCache('myshopid')?myCache('myshopid'):null,
shop: myCache('myshop'), shop: myCache('myshop'),
// banner // banner
swiperList:[ swiperList:[
{ "../../static/image/b1.jpg",
ban_img:"../../static/image/b1.jpg" "../../static/image/b2.png"
},
{
ban_img:"../../static/image/b2.png"
}
],// myCache('swiperCache'), ],// myCache('swiperCache'),
colors:[ colors:[
"#f9d1c8","#c7d7bd","#c4dfe4","#efdddd","#c4ccdf","#fceaac","#d5e7c1", "#f9d1c8","#c7d7bd","#c4dfe4","#efdddd","#c4ccdf","#fceaac","#d5e7c1",
@ -199,11 +195,18 @@
page: { page: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
visitStore: myCache('myshopid')?myCache('myshopid'):'', visitStore: myCache('myshopid')?myCache('myshopid'):null,
}, },
}; };
}, },
onLoad() { onLoad() {
var shop=myCache('shop');
var banner=shop&&shop.banner?shop.banner:"";
banner=banner.split(',');
if(banner.length>0){
this.swiperList=banner;
this.$forceUpdate();
}
// //
this.getSort(); this.getSort();
@ -212,20 +215,34 @@
this.getservice(); this.getservice();
// //
this.loadData(); // this.loadData();
// setTimeout(() => {
// console.log("getCurrentActivity")
// this.getCurrentActivity();
// },2000);
}, },
onShow() { onShow() {
this.shopid = myCache('myshopid')?myCache('myshopid'):''; this.shopid = myCache('myshopid')?myCache('myshopid'):null;
this.shop = myCache('myshop')?myCache('myshop'):''; this.shop = myCache('myshop')?myCache('myshop'):'';
this.$forceUpdate(); this.$forceUpdate();
if(myCache("loginindex")=="1"){
uni.setStorageSync("loginindex", "");
// //
this.loadData(); this.teacherList=[];
this.loadStatus="more";
this.page={
pageNum: 1,
pageSize: 10,
visitStore:this.shopid
} }
this.loadData();
// if(myCache("loginindex")=="1"){
// uni.setStorageSync("loginindex", "");
// //
// this.loadData();
// }
this.openId = myCache('openId'); this.openId = myCache('openId');
var user = myCache('user'); var user = myCache('user');
@ -286,6 +303,22 @@
this.$refs.topId.topData(e.scrollTop); this.$refs.topId.topData(e.scrollTop);
}, },
methods: { methods: {
getCurrentActivity() {
// ActivityApp
const mainActivity = plus.android.runtimeMainActivity();
if (mainActivity) {
console.log('获取到Activity对象:', mainActivity);
// Activityplus.android.importClass
plus.android.importClass(mainActivity);
//console.log('Activity:', mainActivity.getClass().getSimpleName());
//console.log('Activity:', mainActivity.getClass());
console.log('Activity类名:', mainActivity.getClassName());
return mainActivity;
} else {
console.error('无法获取Activity对象');
return null;
}
},
getimgRemoteFile(img){ getimgRemoteFile(img){
if(img){ if(img){
img=img.split(',')[0]; img=img.split(',')[0];
@ -391,18 +424,26 @@
this.loadStatus="loading"; this.loadStatus="loading";
setTimeout(() => { setTimeout(() => {
this.getTeacherList(); this.getTeacherList();
this.getBanner();
}, 300); }, 300);
} }
}, },
async getBanner() { async getBanner() {
// banner // banner
const {data: res} = await uni.$http.post('/platform/getbanner'); const {data: res} = await uni.$http.get('/api/getInfo');
if (res&&res.length>0) { if(res&&res.visitStore){
this.swiperList=res; var shop=res.visitStore;
// var banner=shop&&shop.banner?shop.banner:"";
myCache('swiperCache',this.swiperList); banner=banner.split(',');
if(banner.length>0){
this.swiperList=banner;
this.$forceUpdate(); this.$forceUpdate();
} }
myCache('shop',shop);
myCache('myshop',shop.storeName);
myCache('myshopid',shop.id);
}
}, },
async getSort() { async getSort() {
// //
@ -574,7 +615,7 @@
gotoTeacherMore(){ gotoTeacherMore(){
// //
uni.reLaunch({ uni.reLaunch({
url: `/pages/category/category?id=2` url: `/pages/category/category?id=5`
}); });
}, },
gotoTeacher(info){ gotoTeacher(info){

@ -259,7 +259,7 @@
// phonenumber:"", // phonenumber:"",
// userid:"1", // userid:"1",
// userphone:"18900000001", // userphone:"18900000001",
// avatar:"/static/image/girl.jpg" // avatar:"/static/image/girl.png"
// }); // });
// this.$refs.uToast.show({ // this.$refs.uToast.show({
// title: '', // title: '',
@ -363,6 +363,12 @@
if(res.data&&res.data.length>0){ if(res.data&&res.data.length>0){
myCache('shoplist',res.data); myCache('shoplist',res.data);
} }
else{
console.log("shoplist")
var shop=myCache('shop');
var shoplist=shop?[shop]:[];
myCache('shoplist',shoplist);
}
}, },
async getUserShopList(){ async getUserShopList(){
var _this=this; var _this=this;
@ -435,10 +441,10 @@
} }
.checkimg{ .checkimg{
position: absolute; position: absolute;
top:14rpx; top: 8rpx;
right: 130rpx; right: 130rpx;
width: 150rpx; width: 160rpx;
height: 50rpx; height: 66rpx;
} }
.codebtn{ .codebtn{
position: absolute; position: absolute;

@ -9,25 +9,35 @@
<!-- <uni-icons type="personadd" size="30" color="#ffffff" @click="$u.throttle(addContacts(), 2000)"></uni-icons> --> <!-- <uni-icons type="personadd" size="30" color="#ffffff" @click="$u.throttle(addContacts(), 2000)"></uni-icons> -->
</view> </view>
<view class="concon"> <view class="concon">
<view class="concell" @click="tabSelect(0)"> <!-- coach -->
<view v-if="ifxy" class="concell" @click="tabSelect(0)">
<image class="cimg" src="/static/image/jl.png"></image> <image class="cimg" src="/static/image/jl.png"></image>
<view class="ctxt" :class="tabCurrentIndex==0?'cur1':''">教练</view> <view class="ctxt" :class="list[tabCurrentIndex].id=='coach'?'cur1':''">教练</view>
</view> </view>
<view class="concell" @click="tabSelect(1)"> <!-- customerService -->
<view v-if="ifxy" class="concell" @click="tabSelect(1)">
<image class="cimg" src="/static/image/kff.png"></image> <image class="cimg" src="/static/image/kff.png"></image>
<view class="ctxt" :class="tabCurrentIndex==1?'cur2':''">客服</view> <view class="ctxt" :class="list[tabCurrentIndex].id=='customerService'?'cur2':''">客服</view>
</view> </view>
<view class="concell" @click="tabSelect(2)"> <!-- adviser -->
<view v-if="ifxy" class="concell" @click="tabSelect(2)">
<image class="cimg" src="/static/image/gw.png"></image> <image class="cimg" src="/static/image/gw.png"></image>
<view class="ctxt" :class="tabCurrentIndex==2?'cur3':''">课程顾问</view> <view class="ctxt" :class="list[tabCurrentIndex].id=='adviser'?'cur3':''">课程顾问</view>
</view> </view>
<view class="concell" @click="tabSelect(3)"> <!-- storeManager -->
<view v-if="ifxy" class="concell" @click="tabSelect(3)">
<image class="cimg" src="/static/image/dzh.png"></image> <image class="cimg" src="/static/image/dzh.png"></image>
<view class="ctxt" :class="tabCurrentIndex==3?'cur4':''">店长</view> <view class="ctxt" :class="list[tabCurrentIndex].id=='storeManager'?'cur4':''">店长</view>
</view> </view>
<!-- consumer -->
<view v-if="!ifxy" class="concell" @click="tabSelect(5)">
<image class="cimg" src="/static/image/xy.png"></image>
<view class="ctxt" :class="list[tabCurrentIndex].id=='consumer'?'cur6':''">学员</view>
</view>
<!-- groupchat -->
<view class="concell" @click="tabSelect(4)"> <view class="concell" @click="tabSelect(4)">
<image class="cimg" src="/static/image/ql.png"></image> <image class="cimg" src="/static/image/ql.png"></image>
<view class="ctxt" :class="tabCurrentIndex==4?'cur5':''" >群聊</view> <view class="ctxt" :class="list[tabCurrentIndex].id=='groupchat'?'cur5':''" >群聊</view>
</view> </view>
</view> </view>
</view> </view>
@ -40,10 +50,10 @@
<view class="listcell"> <view class="listcell">
<view class="lcon" v-for="(info, index) in list[tabCurrentIndex].grouplist" :key="index" @click="gotoGroup(info)"> <view class="lcon" v-for="(info, index) in list[tabCurrentIndex].grouplist" :key="index" @click="gotoGroup(info)">
<view class="limg"> <view class="limg">
<image class="img" :src="info.img" mode="aspectFill"></image> <image class="img" :src="info.friendHeadImage?info.friendHeadImage:(tabCurrentIndex==0?'/static/image/kff.png':(tabCurrentIndex==1?'/static/image/gw.png':(tabCurrentIndex==2?'/static/image/gw.png':(tabCurrentIndex==3?'/static/image/dzh.png':'/static/image/ql.png'))))" mode="aspectFill"></image>
</view> </view>
<view class="lright"> <view class="lright">
<view class="pname">{{info.name}}</view> <view class="pname">{{info.friendNickName}}</view>
</view> </view>
</view> </view>
</view> </view>
@ -65,83 +75,84 @@
export default { export default {
data() { data() {
return { return {
userid:"",
userName:"",
messageText:'', // messageText:'', //
msgType :'error', msgType :'error',
tabCurrentIndex:0, tabCurrentIndex:0,
imgurl:uni.$http.baseUrl, imgurl:uni.$http.baseUrl,
list:[ list:[
{ {
id:0, id:"coach",
name:'教练', name:'教练',
loadStatus:'loadmore', loadStatus:'loadmore',
grouplist:[ grouplist:[]
// {
// id:1,
// name:"A",
// img:"/static/image/jl.png"
// },
]
}, },
{ {
id:1, id:"customerService",
name:'客服', name:'客服',
loadStatus:'loadmore', loadStatus:'loadmore',
grouplist:[ grouplist:[]
// {
// id:1,
// name:"-",
// img:"/static/image/kff.png"
// },
]
}, },
{ {
id:2, id:"adviser",
name:'课程顾问', name:'课程顾问',
loadStatus:'more', loadStatus:'more',
grouplist:[ grouplist:[]
// {
// id:1,
// name:"1",
// img:"/static/image/gw.png"
// },
]
}, },
{ {
id:3, id:"storeManager",
name:'店长', name:'店长',
loadStatus:'more', loadStatus:'more',
grouplist:[ grouplist:[]
// {
// id:1,
// name:"1",
// img:"/static/image/dzh.png"
// },
]
}, },
{ {
id:4, id:"groupchat",
name:'群聊', name:'群聊',
loadStatus:'loadmore', loadStatus:'loadmore',
grouplist:[ grouplist:[]
// { },
// id:1, {
// name:"1", id:"consumer",
// img:"/static/image/ql.png" name:'学员',
// }, loadStatus:'loadmore',
] grouplist:[]
} },
], ],
page:{ ifxy:false,
// pageNum:'1',
// pageSize: '10'
}
} }
}, },
onLoad(options) { onLoad(options) {
// 退 var userInfo=myCache('userInfo');
if(myCache('myshopid')){ this.userid = userInfo.userId? userInfo.userId:'';
this.userName = userInfo.nickName?userInfo.nickName:"";
var roleId=userInfo&&userInfo.roleId?userInfo.roleId:[];
if(roleId.length<1){
this.ifxy=true;
this.$forceUpdate();
}
roleId.forEach(cell=>{
if(cell=='107'&&roleId.length<2){
this.ifxy=true;
this.$forceUpdate();
}
else{
this.ifxy=false;
this.$forceUpdate();
}
});
if(this.ifxy){
this.tabCurrentIndex=0;
this.$forceUpdate();
}
else{
this.tabCurrentIndex=5;
this.$forceUpdate();
} }
// 退
if(myCache('myshopid')){}
this.loadData(); this.loadData();
}, },
onShow(){ onShow(){
@ -159,44 +170,86 @@
this.loadData(); this.loadData();
}, },
methods: { methods: {
addContacts(){ //
}, addContacts(){},
gotoBack(){ gotoBack(){
// //
uni.navigateBack({ uni.navigateBack({
delta: 1 delta: 1
}); });
}, },
changeTime(date) { //
return dateTime.dateTime(date); gotoGroup(item){
}, console.log(item);
gotoGroup(info){ //
var timestamp = new Date().getTime();
var info={
chatId: "privatechat-" + this.userid +"-"+ item.friendId,
chatType: (this.tabCurrentIndex==0?"coach":(this.tabCurrentIndex==1?"customerService":(this.tabCurrentIndex==2?"adviser":
(this.tabCurrentIndex==3?"storeManager":(this.tabCurrentIndex==4?"groupchat":(this.tabCurrentIndex==5?"consumer":"")))))),
chatName: item.friendNickName,
chatAvatar: item.friendHeadImage,
chatTime: timestamp,
userid: this.userid,
friendId: item.friendId, //
minId: null, // id
sort: this.tabCurrentIndex==4?"groupchat":"privatechat", // privatechat groupchat
from: "message" // yh message
}
// id:"coach",
// name:'',
// id:"customerService",
// name:'',
// id:"adviser",
// name:'',
// id:"storeManager",
// name:'',
// id:"groupchat",
// name:'',
// id:"consumer",
// name:'',
console.log(info);
if(this.tabCurrentIndex==0){ if(this.tabCurrentIndex==0){
// //
var data=encodeURIComponent(JSON.stringify(info)); var data=encodeURIComponent(JSON.stringify(info));
uni.navigateTo({ uni.navigateTo({
url: `/pages/teacher/chat?data=${data}` url: `/pages/chat/chat?data=${data}`
}); });
} }
else if(this.tabCurrentIndex==1){ else if(this.tabCurrentIndex==1){
// //
var data=encodeURIComponent(JSON.stringify(info)); var data=encodeURIComponent(JSON.stringify(info));
uni.navigateTo({ uni.navigateTo({
url: `/pages/product/service?data=${data}` url: `/pages/chat/chat?data=${data}`
}); });
} }
else if(this.tabCurrentIndex==2){ else if(this.tabCurrentIndex==2){
// //
var data=encodeURIComponent(JSON.stringify(info)); var data=encodeURIComponent(JSON.stringify(info));
uni.navigateTo({ uni.navigateTo({
url: `/pages/product/service?data=${data}` url: `/pages/chat/chat?data=${data}`
}); });
} }
else if(this.tabCurrentIndex==3){ else if(this.tabCurrentIndex==3){
//
var data=encodeURIComponent(JSON.stringify(info));
uni.navigateTo({
url: `/pages/chat/chat?data=${data}`
});
}
else if(this.tabCurrentIndex==4){
// //
var data=encodeURIComponent(JSON.stringify(info)); var data=encodeURIComponent(JSON.stringify(info));
uni.navigateTo({ uni.navigateTo({
url: `/pages/product/service?data=${data}` url: `/pages/chat/groupchat?data=${data}`
});
}
else if(this.tabCurrentIndex==5){
//
var data=encodeURIComponent(JSON.stringify(info));
uni.navigateTo({
url: `/pages/chat/chat?data=${data}`
}); });
} }
}, },
@ -219,7 +272,7 @@
if(this.list[this.tabCurrentIndex].loadStatus!=="nomore") if(this.list[this.tabCurrentIndex].loadStatus!=="nomore")
{ {
// //
if(this.tabCurrentIndex==0||this.tabCurrentIndex==1||this.tabCurrentIndex==2||this.tabCurrentIndex==3){ if(this.tabCurrentIndex==0||this.tabCurrentIndex==1||this.tabCurrentIndex==2||this.tabCurrentIndex==3||this.tabCurrentIndex==5){
const {data: res} = await uni.$http.get('/api/friend/list'); const {data: res} = await uni.$http.get('/api/friend/list');
this.list[0].loadStatus="nomore"; this.list[0].loadStatus="nomore";
this.list[0].grouplist=[]; this.list[0].grouplist=[];
@ -229,48 +282,32 @@
this.list[2].grouplist=[]; this.list[2].grouplist=[];
this.list[3].loadStatus="nomore"; this.list[3].loadStatus="nomore";
this.list[3].grouplist=[]; this.list[3].grouplist=[];
this.list[5].loadStatus="nomore";
this.list[5].grouplist=[];
// //
if(res.data&&res.data.customerService&&res.data.customerService.length>0){ if(res.data&&res.data.coach&&res.data.coach.length>0){
res.data.customerService.forEach(cell => { this.list[0].grouplist=res.data.coach;
this.list[0].grouplist.push({
id: cell.friendId,
name: cell.friendNickName,
img: cell.friendHeadImage?cell.friendHeadImage:'/static/image/ql.png'
})
});
this.$forceUpdate(); this.$forceUpdate();
} }
// //
if(res.data&&res.data.coach&&res.data.coach.length>0){ if(res.data&&res.data.customerService&&res.data.customerService.length>0){
res.data.coach.forEach(cell => { this.list[1].grouplist=res.data.customerService;
this.list[1].grouplist.push({
id: cell.friendId,
name: cell.friendNickName,
img: cell.friendHeadImage?cell.friendHeadImage:'/static/image/kff.png'
})
});
this.$forceUpdate(); this.$forceUpdate();
} }
// //
if(res.data&&res.data.adviser&&res.data.adviser.length>0){ if(res.data&&res.data.adviser&&res.data.adviser.length>0){
res.data.adviser.forEach(cell => { this.list[2].grouplist=res.data.adviser;
this.list[2].grouplist.push({
id: cell.friendId,
name: cell.friendNickName,
img: cell.friendHeadImage?cell.friendHeadImage:'/static/image/gw.png'
})
});
this.$forceUpdate(); this.$forceUpdate();
} }
// //
if(res.data&&res.data.storeManager&&res.data.storeManager.length>0){ if(res.data&&res.data.storeManager&&res.data.storeManager.length>0){
res.data.storeManager.forEach(cell => { this.list[3].grouplist=res.data.storeManager;
this.list[3].grouplist.push({ this.$forceUpdate();
id: cell.friendId, }
name: cell.friendNickName,
img: cell.friendHeadImage?cell.friendHeadImage:'/static/image/dzh.png' //
}) if(res.data&&res.data.consumer&&res.data.consumer.length>0){
}); this.list[5].grouplist=res.data.consumer;
this.$forceUpdate(); this.$forceUpdate();
} }
} }
@ -282,16 +319,14 @@
this.list[this.tabCurrentIndex].grouplist=[]; this.list[this.tabCurrentIndex].grouplist=[];
if(res.data&&res.data.length>0){ if(res.data&&res.data.length>0){
res.data.forEach(cell => { res.data.forEach(cell => {
this.list[this.tabCurrentIndex].grouplist.push({ this.list[this.tabCurrentIndex].grouplist.push({...cell,
id: cell.id, friendNickName: cell.name,
name: cell.name, friendHeadImage: cell.headImage?cell.headImage:'/static/image/ql.png'
img: cell.headImage?cell.headImage:'/static/image/ql.png'
}) })
}); });
this.$forceUpdate(); this.$forceUpdate();
} }
} }
} }
}, },
// //
@ -322,10 +357,7 @@
width: 100%; width: 100%;
z-index: 999; z-index: 999;
background-color: #00a89b; background-color: #00a89b;
.text-center {
width: 100%;
text-align: center;
}
.edit { .edit {
position: absolute; position: absolute;
top: 50%; top: 50%;
@ -338,25 +370,39 @@
width: 100%; width: 100%;
background-color: #00a89b; background-color: #00a89b;
margin: 0; margin: 0;
padding: 26rpx 30rpx; padding: 0 30rpx;
height: 100rpx;
display: flex; display: flex;
flex-direction: row;
color: #fff; color: #fff;
font-size: 36rpx; font-size: 36rpx;
align-items: center;
.leftarr{ .leftarr{
background-color: rgba(255, 255,255, 0.3); background-color: rgba(255, 255,255, 0.3);
padding: 5rpx;
border-radius: 10rpx; border-radius: 10rpx;
width: 60rpx; width: 60rpx;
height: 60rpx;
display: flex;
align-items: center;
justify-content: center;
}
.text-center {
display: flex;
flex: 1;
width: 100%;
align-items: center;
justify-content: center;
} }
} }
.concon{ .concon{
display: flex; display: flex;
flex-direction: row; flex-direction: row;
background: #fff; background: #fff;
padding: 30rpx 20rpx 20rpx 20rpx; padding: 20rpx 0;
margin: 0; margin: 0;
height: 190rpx;
align-items: center; align-items: center;
justify-content: center; justify-content: left;
.concell{ .concell{
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@ -364,8 +410,8 @@
justify-content: center; justify-content: center;
width: 20%; width: 20%;
.cimg{ .cimg{
width: 100rpx; width: 90rpx;
height: 100rpx; height: 90rpx;
} }
.ctxt{ .ctxt{
font-size: 28rpx; font-size: 28rpx;
@ -374,33 +420,41 @@
} }
.cur1{ .cur1{
color:#ff7530; color:#ff7530;
font-size: 30rpx; font-size: 32rpx;
font-weight: 600; font-weight: 600;
} }
.cur2{ .cur2{
color:#46a0fb; color:#46a0fb;
font-size: 30rpx; font-size: 32rpx;
font-weight: 600; font-weight: 600;
} }
.cur3{ .cur3{
color:#5bd171; color:#5bd171;
font-size: 30rpx; font-size: 32rpx;
font-weight: 600; font-weight: 600;
} }
.cur5{ .cur5{
color:#d4237a; color:#d4237a;
font-size: 30rpx; font-size: 32rpx;
font-weight: 600;
}
.cur6{
color:#00a89b;
font-size: 32rpx;
font-weight: 600; font-weight: 600;
} }
.cur4{ .cur4{
color:#fca600; color:#fca600;
font-size: 30rpx; font-size: 32rpx;
font-weight: 600; font-weight: 600;
} }
} }
} }
.wrapcon{ .wrapcon{
margin: 400rpx 0 0 0; margin: 370rpx 0 0 0;
/* #ifdef H5 */
margin: 300rpx 0 0 0;
/* #endif */
padding: 0; padding: 0;
width: 100%; width: 100%;
position: relative; position: relative;
@ -433,8 +487,8 @@
justify-content: center; justify-content: center;
border-radius: 50%; border-radius: 50%;
.img{ .img{
width: 100rpx; width: 80rpx;
height: 100rpx; height: 80rpx;
border-radius: 10rpx; border-radius: 10rpx;
} }
} }

@ -6,13 +6,14 @@
<uni-icons type="staff-filled" size="30" color="#ffffff" @click="$u.throttle(gotoContacts(), 2000)"></uni-icons> <uni-icons type="staff-filled" size="30" color="#ffffff" @click="$u.throttle(gotoContacts(), 2000)"></uni-icons>
</view> </view>
<view class="wrapcon"> <view class="wrapcon">
<!-- 列表 --> <!-- 列表 -->
<view v-if="grouplist.length==0 && loadStatus=='nomore'" class="nodata">~</view> <view v-if="grouplist.length==0 && loadStatus=='nomore'" class="nodata">~</view>
<view class="listcell"> <view class="listcell">
<view class="lcon" v-for="(info, index) in grouplist" :key="index" @click="gotoGroup(info)"> <u-swipe-action :options="options" v-for="(info, index) in grouplist" :key="index" @click="$u.throttle(actionClick(info,index), 2000)" >
<view class="lcon" @click="gotoGroup(info,index)">
<view class="limg"> <view class="limg">
<image class="img" :src="info.img" mode="aspectFill"></image> <image class="img" :src="info.img" mode="aspectFill"></image>
</view> </view>
@ -23,18 +24,20 @@
</view> </view>
<view class="lrow"> <view class="lrow">
<view class="pnr"> <view class="pnr">
{{info.content}} {{ info.type==0?info.content:(info.type==1?"图片":(info.type==2?"文件":(info.type==3?"语音":(info.type==4?"视频":
(info.type==5?"订单咨询":(info.type==6?"商品咨询":info.content))))))}}
</view> </view>
<!-- <view class="lnum">
{{ getgroupsnums(info.minId)}}
</view> -->
<view class="lnum" v-if="info.sl>0"> <view class="lnum" v-if="info.sl>0">
{{ info.sl}} {{ info.sl}}
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</u-swipe-action>
</view> </view>
<u-loadmore v-if="grouplist.length==0 && loadStatus=='loading'" :status="loadStatus" :marginTop="20"></u-loadmore> <u-loadmore v-if="grouplist.length==0 && loadStatus=='loading'" :status="loadStatus" :marginTop="20"></u-loadmore>
</view> </view>
@ -53,92 +56,47 @@
export default { export default {
data() { data() {
return { return {
openId:"",
phone:"",
userid:"",
userName:"",
userheadimg:"",
messageText:'', // messageText:'', //
msgType :'error', msgType :'error',
loadStatus:'loadmore', loadStatus:'loadmore',
options: [
{
text: '删除',
style: {
backgroundColor: '#ed2a28'
}
}
], //u-swipe-action
imgurl:uni.$http.baseUrl, imgurl:uni.$http.baseUrl,
grouplist:[ grouplist:[],
// { socketTask: null,
// id:1, isConnected: false, // WebSocket
// sl:25, socketmsg:[],//
// name:"-", heartbeatInterval: null, // 20
// img:"../../static/image/girl.jpg", heartbeatTimeout: 20000, // 20
// content:"1",
// datetime:"2025-07-10 12:18",
// type:1, //
// },
// {
// id:2,
// sl:8,
// name:"A",
// img:"../../static/image/girl.jpg",
// content:"2",
// datetime:"2025-07-05 12:18",
// type:2, //
// },
// {
// id:1,
// sl:25,
// name:"-",
// img:"../../static/image/girl.jpg",
// content:"1",
// datetime:"2025-07-10 12:18",
// type:1, //
// },
// {
// id:2,
// sl:8,
// name:"A",
// img:"../../static/image/girl.jpg",
// content:"2",
// datetime:"2025-07-05 12:18",
// type:2, //
// },
// {
// id:1,
// sl:25,
// name:"-",
// img:"../../static/image/girl.jpg",
// content:"1",
// datetime:"2025-07-10 12:18",
// type:1, //
// },
// {
// id:2,
// sl:8,
// name:"A",
// img:"../../static/image/girl.jpg",
// content:"2",
// datetime:"2025-07-05 12:18",
// type:2, //
// },
// {
// id:1,
// sl:25,
// name:"-",
// img:"../../static/image/girl.jpg",
// content:"1",
// datetime:"2025-07-10 12:18",
// type:1, //
// },
// {
// id:2,
// sl:8,
// name:"A",
// img:"../../static/image/girl.jpg",
// content:"2",
// datetime:"2025-07-05 12:18",
// type:2, //
// }
],
} }
}, },
onLoad(options) { onLoad(options) {
// this.getgroupsmembers(); // socket
// this.socketinit();
}, },
onShow(){ onShow(){
this.loadStatus='loadmore'; this.openId = myCache('openId');
var user = myCache('user');
this.userid = user.userid? user.userid:'';
this.userName=user.nickName?user.nickName:"";
this.userheadimg=user.avatar?user.avatar:require("@/static/image/girl.png");
this.phone = user.userphone;
//
if(this.heartbeatInterval){
clearInterval(this.heartbeatInterval); //
}
// chatlist
this.loadData(); this.loadData();
}, },
onPullDownRefresh() { onPullDownRefresh() {
@ -147,12 +105,250 @@
uni.stopPullDownRefresh() uni.stopPullDownRefresh()
},500); },500);
}, },
onReachBottom() { onBackPress(options) {
console.log('onReachBottom'); if (options.from === 'backbutton') {
// //
// this.loadData(); //
console.log('返回按钮被点击');
this.closeWebSocket();
uni.onSocketClose(function (res) {
console.log('WebSocket 已关闭!');
});
return false;
}
},
beforeDestroy() {
console.log('界面关闭socketbeforeDestroy');
// WebSocket
this.closeWebSocket();
clearInterval(this.heartbeatInterval); //
},
beforeRouteLeave(to, from, next) {
console.log('界面关闭socketbeforeRouteLeave');
next();
}, },
methods: { methods: {
//
actionClick(info,index) {
console.log(info,index);
var that=this;
uni.showModal({
title: '提示',
content: "确定要删除此聊天记录吗?",
cancelText: '取消',
confirmText: '确定',
success: ress => {
if (ress.confirm) {
myCache(info.id,"");
that.grouplist.splice(index, 1);
that.$forceUpdate();
myCache("chatlist",that.grouplist);
}
}
});
},
//
startHeartbeat() {
console.log("startHeartbeat")
this.heartbeatInterval = setInterval(() => {
if (this.socketTask) {
this.socketTask.send({
data: JSON.stringify({
'cmd': 1,//
'data': {
'accessToken':uni.getStorageSync("token")
},
}) //
});
}
}, this.heartbeatTimeout);
},
// ws
socketinit(){
var that = this;
// if (!that.isConnected) {
that.socketTask=uni.connectSocket({
url: "wss://www.sanduolantoyoga.com/yoga-imserver/",
header: {
// 'content-type': 'application/json',
Authorization: uni.getStorageSync("token"),
},
success: (res) => {
console.log(res, 'socket连接成功success');
},
fail: (res) => {
console.log(res, 'socket连接失败')
},
complete: (res) => {
console.log(res,'socket连接成功complete');
}
});
uni.onSocketOpen(resopen => {
console.log('WebSocket连接已打开');
that.isConnected = true;
that.$forceUpdate()
uni.sendSocketMessage({
data: JSON.stringify({
"cmd": 0,//
"data": {
"accessToken":uni.getStorageSync("token"),
},
}), // //
success(re) {
console.log(re);
console.log('消息发送成功!')
},
fail(err) {
console.log(err);
console.log('消息发送失败!')
}
});
//
this.startHeartbeat();
});
uni.onSocketMessage(res => {
console.log('收到WebSocket服务器消息');
if(res.data){
var rs=JSON.parse(res.data);
console.log(rs);
if(rs.cmd==3){
//
if(rs.data){
var data=rs.data;
if(data.recvId&&(data.recvId).toString()==(that.userid).toString()){
//
//
// 0: 1: 2: 3: 4: 10, "" 11, " "12, " " 30,""
if(data.type==0){
data.content=decodeURIComponent(data.content);
}
if(data.type==0||data.type==1||data.type==2||data.type==3||data.type==4||data.type==5||data.type==6){
var ifexist=0,idx=null;
that.grouplist.forEach((cell,index)=>{
if(cell.fromuser==data.sendId&&cell.userid==data.recvId&&cell.sort=="privatechat"){
ifexist=1;
idx=index;
that.grouplist[index].sl=(that.grouplist[index].sl?that.grouplist[index].sl+1:1);
that.grouplist[index].content=data.content;
that.grouplist[index].datetime=data.sendTime;
that.grouplist[index].type=data.type;
that.$forceUpdate();
}
});
if(ifexist==0){
//
// socket
var chatlastinfo={
id: "privatechat-" + data.recvId +"-" + data.sendId,
content: data.content,
minId: data.id,
sl:1,
datetime: data.sendTime,
type: data.type,
name: "",
userid: data.recvId,
fromuser: data.sendId,
img: "",
sort:"privatechat"
};
that.updateChatList(chatlastinfo,ifexist);
}
else{
that.updateChatList(that.grouplist[idx],ifexist);
}
}
else{
// 10, "" 11, " " 12, " " 30,""
}
}
}
}
else if(rs.cmd==4){
//
if(rs.data){
var data=rs.data;
if(data.atUserIds&&data.atUserIds.includes(that.userid)){
//
//
// 0: 1: 2: 3: 4: 10, "" 11, " "12, " " 30,""
if(data.type==0){
data.content=decodeURIComponent(data.content);
}
if(data.type==0||data.type==1||data.type==2||data.type==3||data.type==4||data.type==5||data.type==6){
var ifexist=0,idx=null;
that.grouplist.forEach((cell,index)=>{
if(cell.groupId==data.groupId&&cell.sort=="groupchat"){
ifexist=1;
idx=index;
that.grouplist[index].sl=(that.grouplist[index].sl?that.grouplist[index].sl+1:1);
that.grouplist[index].content=data.content;
that.grouplist[index].datetime=data.sendTime;
that.grouplist[index].fromuser=data.sendId;
that.grouplist[index].type=data.type;
that.$forceUpdate();
}
});
if(ifexist==0){
//
// socket
var chatlastinfo={
id: "groupchat-" + data.groupId,
groupId:data.groupId,
content: data.content,
minId: data.id,
sl:1,
datetime: data.sendTime,
type: data.type,
name: "",
userid: this.userid,
fromuser: data.sendId,
img: "",
sendId: data.sendId,
sendNickName: data.sendNickName,
sort:"groupchat"
};
that.getGroupInfo(chatlastinfo,ifexist);
}
else{
that.getGroupInfo(that.grouplist[idx],ifexist);
}
}
else{
// 10, "" 11, " " 12, " " 30,""
}
}
}
}
}
});
uni.onSocketClose(res => {
console.log('WebSocket连接已关闭',res);
that.isConnected = false;
that.$forceUpdate();
clearInterval(that.heartbeatInterval); //
});
uni.onSocketError(err => {
console.error('WebSocket连接打开失败请检查', err);
that.isConnected = false;
that.$forceUpdate();
clearInterval(that.heartbeatInterval); //
});
// }
},
// WebSocket
closeWebSocket() {
uni.closeSocket();
this.isConnected = false;
this.$forceUpdate()
},
gotoContacts(){ gotoContacts(){
uni.navigateTo({ uni.navigateTo({
url: `/pages/message/contact` url: `/pages/message/contact`
@ -161,57 +357,448 @@
changeTime(date) { changeTime(date) {
return dateTime.dateTime(date); return dateTime.dateTime(date);
}, },
gotoGroup(info){ gotoGroup(chat,index){
//
this.grouplist[index]["sl"]=0;
this.$forceUpdate();
myCache("chatlist",this.grouplist);
// //
if(info.type==1){ if(chat.sort=="privatechat"){
// //
var info={
chatId: chat.id,
chatName: chat.name,
chatAvatar: chat.img,
chatTime: chat.datetime,
friendId: chat.fromuser,
minId: chat.minId,
sort:"privatechat",
from:"message" // yh message
}
var data=encodeURIComponent(JSON.stringify(info)); var data=encodeURIComponent(JSON.stringify(info));
uni.navigateTo({ uni.navigateTo({
url: `/pages/product/service?data=${data}` url: `/pages/chat/chat?data=${data}`
}); });
} }
else if(info.type==2){ else if(chat.sort=="groupchat"){
// //
var info={
chatId: chat.id,
groupId: chat.groupId,
chatName: chat.name,
chatAvatar: chat.img,
chatTime: chat.datetime,
friendId: chat.fromuser,
teacherId: chat.teacherId,
minId: chat.minId,
sort:"groupchat", // privatechat groupchat
from:"message", // yh message
notice: chat.notice,
remarkNickName: chat.remarkNickName,
showNickName: chat.showNickName,
showGroupName: chat.showGroupName,
remarkGroupName: chat.remarkGroupName,
reason: chat.reason,
customerService: chat.customerService,
instructor: chat.instructor,
productId: chat.productId,
productName: chat.productName
}
var data=encodeURIComponent(JSON.stringify(info)); var data=encodeURIComponent(JSON.stringify(info));
console.log(data);
uni.navigateTo({ uni.navigateTo({
url: `/pages/teacher/chat?data=${data}` url: `/pages/chat/groupchat?data=${data}`
}); });
} }
}, },
loadData(){ loadData(){
// //
if(this.loadStatus=="loadmore") {
this.loadStatus="loading"; this.loadStatus="loading";
setTimeout(() => { setTimeout(() => {
this.getgroupsmembers(); this.getgroupsmembers();
}, 300); }, 300);
}
}, },
// //
async getgroupsmembers(){ async getgroupsmembers(){
if(this.loadStatus!=="nomore") //
{ this.grouplist=[];
this.loadStatus="nomore"; var chatlist=myCache("chatlist")?myCache("chatlist"):[];
var chatlist=myCache("chatlist"); chatlist.forEach(cell=>{
this.grouplist=chatlist?chatlist:[]; if(cell.userid==this.userid){
this.grouplist.push(cell);
}
});
this.grouplist.forEach((cell,i)=>{ this.grouplist.forEach((cell,i)=>{
this.grouplist[i]["sl"]=this.getgroupsnums(cell.minId) if(cell.minId){
// id 线
this.readUp(i,cell);
}
}); });
this.loadStatus="nomore"; this.loadStatus="nomore";
this.$forceUpdate(); this.$forceUpdate();
var that=this;
setTimeout(() => {
that.reorder();
myCache("chatlist",that.grouplist);
}, 300);
// socket
this.socketinit();
},
//
reorder(){
this.grouplist.sort((a, b) => b.datetime - a.datetime);
this.$forceUpdate();
},
//
async readUp(i,item) {
if(item.sort=="groupchat"){
const {data: res} = await uni.$http.put('/api/message/group/readed?groupId='+item.groupId);
this.getgroupsnums(i,item);
}
else{
const {data: res} = await uni.$http.put('/api/message/private/readed?friendId='+item.fromuser);
this.getgroupsnums(i,item);
} }
}, },
// // 线
async getgroupsnums(id){ async getgroupsnums(i,item){
var nums=0 if(item.sort=="groupchat"){
const {data: res} = await uni.$http.get("/api/message/private/pullOfflineMessage",{"minId":id}); //
const {data: res} = await uni.$http.get("/api/message/group/pullOfflineMessage",{minId:item.minId});
if(res.data&&res.data.length>0){ if(res.data&&res.data.length>0){
nums=res.data.length; //
return nums; var data=res.data;
// 线
this.grouplist[i]["sl"]=res.data.length;
var last=res.data[res.data.length-1];
if(last.type==0){
last.content=decodeURIComponent(last.content);
}
if(last.type==0||last.type==1||last.type==2||last.type==3||last.type==4||data.type==5||data.type==6){
this.grouplist[i].content=last.content;
this.grouplist[i].type=last.type;
this.grouplist[i].datetime=last.datetime;
this.$forceUpdate();
//
this.reorder();
myCache("chatlist",this.grouplist);
}
}
}
else{
//
const {data: res} = await uni.$http.get("/api/message/private/pullOfflineMessage",{minId:item.minId});
if(res.data&&res.data.length>0){
//
var data=res.data;
// 线
this.grouplist[i]["sl"]=res.data.length;
var last=res.data[res.data.length-1];
if(last.type==0){
last.content=decodeURIComponent(last.content);
}
if(last.type==0||last.type==1||last.type==2||last.type==3||last.type==4||data.type==5||data.type==6){
this.grouplist[i].content=last.content;
this.grouplist[i].type=last.type;
this.grouplist[i].datetime=last.datetime;
this.$forceUpdate();
//
this.reorder();
myCache("chatlist",this.grouplist);
}
}
}
},
//
async getGroupInfo(info,ifexist) {
const {data: res} = await uni.$http.get('/api/group/find/'+info.groupId);
if(res.data){
var data = res.data;
info.name=data.name;
info.img=data.headImage||'/static/image/qltx.png';
info.notice=data.notice;
info.remarkNickName=data.remarkNickName;
info.showNickName=data.showNickName;
info.showGroupName=data.showGroupName;
info.remarkGroupName=data.remarkGroupName;
info.customerService=data.customerService;
info.instructor=data.instructor;
info.productId=data.productId;
info.productName=data.productName;
this.updateChatGroupList(info,ifexist);
}
},
async updateChatGroupList(info,ifexist){
var name=info.name,img=info.img||require("@/static/image/girl.png");
const {data: res} = await uni.$http.get("/api/friend/find/"+info.sendId);
if(res.data){
var data=res.data;
name=data.nickName?data.nickName:"匿名";
img=data.headImage?data.headImage:require("@/static/image/girl.png");
if(ifexist==0){
this.grouplist.push(info);
this.$forceUpdate();
}
//
this.reorder();
myCache("chatlist",this.grouplist);
//
var msgchat=myCache(info.id);
if(ifexist==0||!msgchat){
//
let firstmsg = [{
"fromname": name, //
"fromuser": info.fromuser, //
"headimg": img, //
"toname": this.userName, //
"touser": this.userid, //
"content": info.content,
"time": info.type==3?5:0,
"ifaudio":info.type==3? true:false,
"fromtime": info.datetime,
"type": info.type==0?'txt':(info.type==1?'image':info.type==3?'audio':(info.type==4?'video':'product')),
"id": info.id,
"minId": info.minId,
"sendId": info.sendId,
"send": info.type==6?await this.getProduct(info.content):(info.type==5?await this.getOrder(info.content):null)
}];
console.log("firstmsg",firstmsg)
myCache(info.id,firstmsg);
} }
else{ else{
console.log("nums",nums) //
return nums; let firstmsg = {
"fromname": name, //
"fromuser": info.fromuser, //
"headimg": img, //
"toname": this.userName, //
"touser": this.userid, //
"content": info.content,
"time": info.type==3?5:0,
"ifaudio":info.type==3? true:false,
"fromtime": info.datetime,
"type": info.type==0?'txt':(info.type==1?'image':info.type==3?'audio':(info.type==4?'video':'product')),
"id": info.id,
"minId": info.minId,
"sendId": info.sendId,
"send": info.type==6?await this.getProduct(info.content):(info.type==5?await this.getOrder(info.content):null)
};
msgchat.push(firstmsg);
myCache(info.id,msgchat);
}
}
else{
name="匿名";
img="../../static/image/girl.png";
if(ifexist==0){
this.grouplist.push(info);
this.$forceUpdate();
}
//
this.reorder();
myCache("chatlist",this.grouplist);
var msgchat=myCache(info.id);
if(ifexist==0||!msgchat){
//
let firstmsg = [{
"fromname": name, //
"fromuser": info.fromuser, //
"headimg": img, //
"toname": this.userName, //
"touser": this.userid, //
"content": info.content,
"time": info.type==3?5:0,
"ifaudio":info.type==3? true:false,
"fromtime": info.datetime,
"type": info.type==0?'txt':(info.type==1?'image':info.type==3?'audio':(info.type==4?'video':'product')),
"id": info.id,
"minId": info.minId,
"sendId": info.sendId,
"send": info.type==6?await this.getProduct(info.content):(info.type==5?await this.getOrder(info.content):null)
}];
myCache(info.id,firstmsg);
}
else{
//
let firstmsg = {
"fromname": name, //
"fromuser": info.fromuser, //
"headimg": img, //
"toname": this.userName, //
"touser": this.userid, //
"content": info.content,
"time": info.type==3?5:0,
"ifaudio":info.type==3? true:false,
"fromtime": info.datetime,
"type": info.type==0?'txt':(info.type==1?'image':info.type==3?'audio':(info.type==4?'video':'product')),
"id": info.id,
"minId": info.minId,
"sendId": info.sendId,
"send": info.type==6?await this.getProduct(info.content):(info.type==5?await this.getOrder(info.content):null)
};
msgchat.push(firstmsg);
myCache(info.id,msgchat);
}
}
},
async updateChatList(info,ifexist){
const {data: res} = await uni.$http.get("/api/friend/find/"+info.fromuser);
if(res.data){
var data=res.data;
info.name=data.nickName?data.nickName:"匿名";
info.img=data.headImage?data.headImage:require("@/static/image/girl.png");
if(ifexist==0){
this.grouplist.push(info);
this.$forceUpdate();
}
//
this.reorder();
myCache("chatlist",this.grouplist);
//
var msgchat=myCache(info.id);
if(ifexist==0||!msgchat){
//
let firstmsg = [{
"fromname": info.name, //
"fromuser": info.fromuser, //
"headimg": info.img, //
"toname": this.userName, //
"touser": this.userid, //
"content": info.content,
"time": info.type==3?5:0,
"ifaudio":info.type==3? true:false,
"fromtime": info.datetime,
"type": info.type==0?'txt':(info.type==1?'image':info.type==3?'audio':(info.type==4?'video':'product')),
"id": info.id,
"minId": info.minId,
"recvId": info.recvId,
"sendId": info.sendId,
"send": info.type==6?await this.getProduct(info.content):(info.type==5?await this.getOrder(info.content):null)
}];
myCache(info.id,firstmsg);
}
else{
//
let firstmsg = {
"fromname": info.name, //
"fromuser": info.fromuser, //
"headimg": info.img, //
"toname": this.userName, //
"touser": this.userid, //
"content": info.content,
"time": info.type==3?5:0,
"ifaudio":info.type==3? true:false,
"fromtime": info.datetime,
"type": info.type==0?'txt':(info.type==1?'image':info.type==3?'audio':(info.type==4?'video':'product')),
"id": info.id,
"minId": info.minId,
"recvId": info.recvId,
"sendId": info.sendId,
"send": info.type==6?await this.getProduct(info.content):(info.type==5?await this.getOrder(info.content):null)
};
msgchat.push(firstmsg);
myCache(info.id,msgchat);
}
}
else{
info.name="匿名";
info.img="../../static/image/girl.png";
if(ifexist==0){
this.grouplist.push(info);
this.$forceUpdate();
}
//
this.reorder();
myCache("chatlist",this.grouplist);
var msgchat=myCache(info.id);
if(ifexist==0||!msgchat){
//
let firstmsg = [{
"fromname": info.name, //
"fromuser": info.fromuser, //
"headimg": info.img, //
"toname": this.userName, //
"touser": this.userid, //
"content": info.content,
"time": info.type==3?5:0,
"ifaudio":info.type==3? true:false,
"fromtime": info.datetime,
"type": info.type==0?'txt':(info.type==1?'image':info.type==3?'audio':(info.type==4?'video':'product')),
"id": info.id,
"minId": info.minId,
"recvId": info.recvId,
"sendId": info.sendId,
"send": info.type==6?await this.getProduct(info.content):(info.type==5?await this.getOrder(info.content):null)
}];
myCache(info.id,firstmsg);
}
else{
//
let firstmsg = {
"fromname": info.name, //
"fromuser": info.fromuser, //
"headimg": info.img, //
"toname": this.userName, //
"touser": this.userid, //
"content": info.content,
"time": info.type==3?5:0,
"ifaudio":info.type==3? true:false,
"fromtime": info.datetime,
"type": info.type==0?'txt':(info.type==1?'image':info.type==3?'audio':(info.type==4?'video':'product')),
"id": info.id,
"minId": info.minId,
"recvId": info.recvId,
"sendId": info.sendId,
"send": info.type==6?await this.getProduct(info.content):(info.type==5?await this.getOrder(info.content):null)
};
msgchat.push(firstmsg);
myCache(info.id,msgchat);
}
}
},
async getProduct(id){
console.log("getProduct",id)
var rets=null;
const {data: res} = await uni.$http.post("/api/message/private/getProductForIm",{"productId":id});
if(res.data){
var data=res.data;
rets={
type:data.isCourse==0?1:2,// 1 2 3
id:data.id,
name:data.name,
pic:data.pic,
price:data.price,
unit: data.unit,
brandName:data.brandName,
isCourse:data.isCourse
}
console.log(rets)
return rets;
}
else{
return rets;
}
},
async getOrder(id){
var rets=null;
const {data: res} = await uni.$http.post("/api/message/private/getOrderForIm",{"orderItemId":id});
if(res.data){
var data=res.data;
rets={
type:3,// 1 2 3
id:data.id,
orderId:data.orderId,
name:data.productName,
pic:data.pic?data.pic:'/static/image/nopic.png',
price:data.totalAmount,
quantity:data.quantity,
spData: data.spData? JSON.parse(data.spData):null
}
return rets;
}
else{
return rets;
} }
}, },
// //
@ -263,29 +850,31 @@
width: 100%; width: 100%;
position: relative; position: relative;
margin: 180rpx 0 0 0; margin: 180rpx 0 0 0;
min-height: calc(100vh - 100rpx); min-height: calc(100vh - 180rpx);
/* #ifdef H5 */ /* #ifdef H5 */
margin: calc( 110rpx + var(--window-top)) 0 0 0; margin: calc( 110rpx + var(--window-top)) 0 0 0;
min-height: calc(100vh - var(--window-top) - var(--window-bottom) - 100rpx); min-height: calc(100vh - var(--window-top) - var(--window-bottom) - 180rpx);
/* #endif */ /* #endif */
overflow-y: auto; overflow-y: auto;
} }
.listcell{ .listcell{
background: #fff; background: #fff;
margin: 0; margin: 0;
width: 100%;
.lcon{ .lcon{
border-bottom: 1rpx solid #eee; border-bottom: 1rpx solid #eee;
padding-top: 28rpx; padding-top: 20rpx;
padding-bottom: 28rpx; padding-bottom: 20rpx;
opacity: 1; opacity: 1;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
width: 100%;
.limg{ .limg{
width: 120rpx; width: 100rpx;
height: 120rpx; height: 100rpx;
margin-right: 24rpx; margin-right: 20rpx;
margin-left: 24rpx; margin-left: 20rpx;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
flex-wrap: wrap; flex-wrap: wrap;
@ -293,8 +882,8 @@
justify-content: center; justify-content: center;
border-radius: 50%; border-radius: 50%;
.img{ .img{
width: 120rpx; width: 100rpx;
height: 120rpx; height: 100rpx;
} }
} }
.lright{ .lright{

@ -0,0 +1,505 @@
<template>
<view class="page">
<view class="page-header" :style="{ paddingTop: geStatusBarHeight()+ 8 + 'px'}">
<view class="text-center">消息</view>
<uni-icons type="staff-filled" size="30" color="#ffffff" @click="$u.throttle(gotoContacts(), 2000)"></uni-icons>
</view>
<view class="wrapcon">
<!-- 列表 -->
<view v-if="grouplist.length==0 && loadStatus=='nomore'" class="nodata">~</view>
<view class="listcell">
<view class="lcon" v-for="(info, index) in grouplist" :key="index" @click="gotoGroup(info)">
<view class="limg">
<image class="img" :src="info.img" mode="aspectFill"></image>
</view>
<view class="lright">
<view class="lrow">
<view class="pname">{{info.name}}</view>
<view class="ptime"> {{ changeTime(info.datetime)}}</view>
</view>
<view class="lrow">
<view class="pnr">
{{info.content}}
</view>
<!-- <view class="lnum">
{{ getgroupsnums(info.minId)}}
</view> -->
<view class="lnum" v-if="info.sl>0">
{{ info.sl}}
</view>
</view>
</view>
</view>
</view>
<u-loadmore v-if="grouplist.length==0 && loadStatus=='loading'" :status="loadStatus" :marginTop="20"></u-loadmore>
</view>
<!-- 提示信息弹窗 -->
<uni-popup ref="message" type="message">
<uni-popup-message :type="msgType" :message="messageText" :duration="2000"></uni-popup-message>
</uni-popup>
</view>
</template>
<script>
import { myCache } from '../../utils/utils.js';
import dateTime from '@/common/dateTime.js';
export default {
data() {
return {
openId:"",
phone:"",
userid:"",
messageText:'', //
msgType :'error',
loadStatus:'loadmore',
imgurl:uni.$http.baseUrl,
grouplist:[
// {
// id:1,
// sl:25,
// name:"-",
// img:"../../static/image/girl.png",
// content:"1",
// datetime:"2025-07-10 12:18",
// type:1, //
// },
// {
// id:2,
// sl:8,
// name:"A",
// img:"../../static/image/girl.png",
// content:"2",
// datetime:"2025-07-05 12:18",
// type:2, //
// },
],
socketTask: null,
isConnected: false, // WebSocket
socketmsg:[],//
heartbeatInterval: null, // 20
heartbeatTimeout: 20000, // 20
}
},
onLoad(options) {
// socket
// this.socketinit();
},
onShow(){
this.openId = myCache('openId');
var user = myCache('user');
this.userid = user.userid? user.userid:'';
this.phone = user.userphone;
// chatlist
this.loadData();
// socket
this.socketinit();
},
onPullDownRefresh() {
console.log('onPullDownRefresh');
setTimeout(()=>{
uni.stopPullDownRefresh()
},500);
},
onBackPress(options) {
if (options.from === 'backbutton') {
//
//
console.log('返回按钮被点击');
this.closeWebSocket();
uni.onSocketClose(function (res) {
console.log('WebSocket 已关闭!');
});
return false;
}
},
beforeDestroy() {
console.log('界面关闭socketbeforeDestroy');
// WebSocket
this.closeWebSocket();
},
beforeRouteLeave(to, from, next) {
console.log('界面关闭socketbeforeRouteLeave');
next();
},
methods: {
// ws
socketinit(){
var that = this;
if (!that.isConnected) {
console.log("wss://www.sanduolantoyoga.com/yoga-imserver/")
this.socketTask=uni.connectSocket({
url: "wss://www.sanduolantoyoga.com/yoga-imserver/",
header: {
// 'content-type': 'application/json',
Authorization: uni.getStorageSync("token"),
},
success: (res) => {
console.log(res, 'socket连接成功success');
},
fail: (res) => {
console.log(res, 'socket连接失败')
},
complete: (res) => {
console.log(res,'socket连接成功complete');
}
});
uni.onSocketOpen(resopen => {
console.log('WebSocket连接已打开');
that.isConnected = true;
uni.sendSocketMessage({
data: JSON.stringify({
"cmd": 0,//
"data": {
"accessToken":uni.getStorageSync("token"),
},
}), // //
success(re) {
console.log(re);
console.log('消息发送成功!')
},
fail(err) {
console.log(err);
console.log('消息发送失败!')
}
});
//
// this.startHeartbeat();
//
// this.sendWebSocketMessage();
});
uni.onSocketMessage(res => {
console.log('收到WebSocket服务器消息', res);
if(res.data){
var cmd=res.cmd;
let data=JSON.parse(res.data);
console.log(data);
// if(data){
// //
// // 0: 1: 2: 3: 4: 10, "" 11, " "12, " " 30,""
// if(data.type=='0'){
// data.content=decodeURIComponent(data.content);
// }
// let mdata = {
// "fromname": that.friendName,
// "fromuser": that.friendcode,
// "headimg": that.friendheadimg,
// "toname": that.info.chatName, //
// "touser": that.info.friendId, //
// "content": data.content,
// "time": data.type==3?5:0,
// "ifaudio":data.type==3? true:false,
// "fromtime": data.sendTime,
// "type": data.type==0?'txt':(data.type==1?'image':data.type==3?'audio':(data.type==4?'video':'')),
// "id": data.id,
// "recvId": data.recvId,
// "sendId": data.sendId,
// };
// if(data.type==0||data.type==1||data.type==3||data.type==4){
// that.socketmsg.push(data);
// that.$forceUpdate();
// }
// else{
// // 10, "" 11, " " 12, " " 30,""
// }
// }
}
});
uni.onSocketClose(res => {
console.log('WebSocket连接已关闭');
that.isConnected = false;
clearInterval(that.heartbeatInterval); //
});
uni.onSocketError(err => {
console.error('WebSocket连接打开失败请检查', err);
clearInterval(that.heartbeatInterval); //
});
}
},
startHeartbeat() {
console.log("startHeartbeat")
this.heartbeatInterval = setInterval(() => {
if (this.socketTask) {
this.socketTask.send({
data: JSON.stringify({
'cmd': 1,//
'data': {
'accessToken':uni.getStorageSync("token")
},
}) //
});
}
}, this.heartbeatTimeout);
},
sendWebSocketMessage(){
uni.sendSocketMessage({
data: '这是一条测试消息', //
success(re) {
console.log(re);
console.log('消息发送成功!')
},
fail(err) {
console.log(err);
console.log('消息发送失败!')
}
});
},
// WebSocket
closeWebSocket() {
uni.closeSocket();
this.isConnected = false;
clearInterval(this.heartbeatInterval); //
},
gotoContacts(){
uni.navigateTo({
url: `/pages/message/contact`
});
},
changeTime(date) {
return dateTime.dateTime(date);
},
gotoGroup(info){
//
if(info.type==1){
//
var data=encodeURIComponent(JSON.stringify(info));
uni.navigateTo({
url: `/pages/chat/groupchat?data=${data}`
});
}
else if(info.type==2){
//
var data=encodeURIComponent(JSON.stringify(info));
uni.navigateTo({
url: `/pages/chat/chat?data=${data}`
});
}
},
loadData(){
//
this.loadStatus="loading";
setTimeout(() => {
this.getgroupsmembers();
}, 300);
},
//
async getgroupsmembers(){
//
this.grouplist=[];
var chatlist=myCache("chatlist")?myCache("chatlist"):[];
chatlist.forEach(cell=>{
if(cell.fromuser==this.userid){
this.grouplist.push(cell);
}
});
this.grouplist.forEach((cell,i)=>{
if(cell.minId){
// id 线
this.getgroupsnums(i,cell.minId)
}
});
this.loadStatus="nomore";
this.$forceUpdate();
},
// 线
async getgroupsnums(i,id){
const {data: res} = await uni.$http.get("/api/message/private/pullOfflineMessage",{"minId":id});
if(res.data&&res.data.length>0){
//
var data=res.data;
// 线
this.grouplist[i]["sl"]=res.data.length;
this.$forceUpdate();
}
},
//
geStatusBarHeight(){
return uni.getSystemInfoSync()['statusBarHeight'];
},
//
getNavBarHeight(){
return 45+uni.getSystemInfoSync()['statusBarHeight'];
},
}
}
</script>
<style lang="scss" scoped>
.page{
padding: 0;
position: relative;
background-image: url('@/static/image/bg.jpg');
background-attachment: fixed;
background-size: cover;
background-position: center center;
min-height: calc(100vh - var(--window-top) - var(--window-bottom));
}
.page-header {
position: fixed;
width: 100%;
z-index: 999;
padding: 40rpx 30rpx 30rpx 30rpx;
display: flex;
color: #fff;
font-size: 36rpx;
background-color: #00a89b;
.text-center {
width: 100%;
text-align: center;
}
.edit {
position: absolute;
top: 50%;
transform: translateY(-50%);
right: 30rpx;
font-size: 32rpx;
}
}
.wrapcon{
padding: 0;
width: 100%;
position: relative;
margin: 180rpx 0 0 0;
min-height: calc(100vh - 100rpx);
/* #ifdef H5 */
margin: calc( 110rpx + var(--window-top)) 0 0 0;
min-height: calc(100vh - var(--window-top) - var(--window-bottom) - 100rpx);
/* #endif */
overflow-y: auto;
}
.listcell{
background: #fff;
margin: 0;
.lcon{
border-bottom: 1rpx solid #eee;
padding-top: 20rpx;
padding-bottom: 20rpx;
opacity: 1;
display: flex;
flex-direction: row;
align-items: center;
.limg{
width: 100rpx;
height: 100rpx;
margin-right: 20rpx;
margin-left: 20rpx;
display: flex;
flex-direction: row;
flex-wrap: wrap;
align-items: center;
justify-content: center;
border-radius: 50%;
.img{
width: 100rpx;
height: 100rpx;
}
}
.lright{
display: flex;
flex: 1;
flex-direction: column;
}
.lrow{
display: flex;
flex-direction: row;
margin-bottom: 20rpx;
margin-right: 20rpx;
}
.pname{
display: flex;
flex: 1;
line-height: 50rpx;
font-size: 32rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 600;
color: #000000;
}
.ptime{
line-height: 50rpx;
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
color: #595959;
}
.pnr{
display: flex;
flex: 1;
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #595959;
}
.lnum{
background-color: #de0000;
padding: 0 10rpx;
min-width: 32rpx;
height: 32rpx;
line-height: 32rpx;
color: #fff;
font-size: 24rpx;
border-radius: 28rpx;
}
}
}
.tips{
margin-top: 20rpx;
margin-bottom: 20rpx;
width: 100%;
line-height: 44rpx;
font-size: 26rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #595959;
text-align: center;
}
.submitcon{
margin-top: 200rpx;
display: flex;
align-items: center;
justify-content: center;
}
.bbtn{
margin: 20rpx 30rpx 54rpx;
font-size: 32rpx;
font-family: PingFang SC-Medium, PingFang SC;
font-weight: 500;
color: #FCFCFD;
width: 560rpx;
height: 96rpx;
line-height: 96rpx;
background: #367FFA;
box-shadow: 0rpx 12rpx 64rpx 2rpx rgba(67,110,255,0.4);
border-radius: 254rpx 254rpx 254rpx 254rpx;
opacity: 1;
&::after{
border:none;
}
}
.nodata{
background-image: url('../../static/image/nomsg.png');
background-repeat: no-repeat;
background-position: center center;
background-size: 100%;
height: 376rpx;
width: 256rpx;
color: #00a89b;
display: flex;
align-items: center;
justify-content: flex-end;
flex-direction: column;
padding-bottom: 40rpx;
margin: 100rpx auto;
}
</style>

@ -0,0 +1,731 @@
<template>
<view class="page">
<view class="page-header" :style="{ paddingTop: geStatusBarHeight()+ 8 + 'px'}">
<view class="text-center">消息</view>
<uni-icons type="staff-filled" size="30" color="#ffffff" @click="$u.throttle(gotoContacts(), 2000)"></uni-icons>
</view>
<view class="wrapcon">
<!-- 列表 -->
<view v-if="grouplist.length==0 && loadStatus=='nomore'" class="nodata">~</view>
<view class="listcell">
<u-swipe-action :options="options" v-for="(info, index) in grouplist" :key="index" @click="$u.throttle(actionClick(info,index), 2000)" >
<view class="lcon" @click="gotoGroup(info,index)">
<view class="limg">
<image class="img" :src="info.img" mode="aspectFill"></image>
</view>
<view class="lright">
<view class="lrow">
<view class="pname">{{info.name}}</view>
<view class="ptime"> {{ changeTime(info.datetime)}}</view>
</view>
<view class="lrow">
<view class="pnr">
{{ info.type==0?info.content:(info.type==1?"图片":(info.type==2?"文件":(info.type==3?"语音":(info.type==4?"视频":(info.type==5||info.type==6?
(info.chatType=='customerService'?(info.send&&info.send.type==3?'订单咨询':((info.send&&info.send.type==2?'课程咨询':'商品咨询'))):""):"")))))}}
</view>
<view class="lnum" v-if="info.sl>0">
{{ info.sl}}
</view>
</view>
</view>
</view>
</u-swipe-action>
</view>
<u-loadmore v-if="grouplist.length==0 && loadStatus=='loading'" :status="loadStatus" :marginTop="20"></u-loadmore>
</view>
<!-- 提示信息弹窗 -->
<uni-popup ref="message" type="message">
<uni-popup-message :type="msgType" :message="messageText" :duration="2000"></uni-popup-message>
</uni-popup>
</view>
</template>
<script>
import { myCache } from '../../utils/utils.js';
import dateTime from '@/common/dateTime.js';
export default {
data() {
return {
openId:"",
phone:"",
userid:"",
userName:"",
userheadimg:"",
messageText:'', //
msgType :'error',
loadStatus:'loadmore',
options: [
{
text: '删除',
style: {
backgroundColor: '#ed2a28'
}
}
], //u-swipe-action
imgurl:uni.$http.baseUrl,
grouplist:[],
socketTask: null,
isConnected: false, // WebSocket
socketmsg:[],//
heartbeatInterval: null, // 20
heartbeatTimeout: 20000, // 20
}
},
onLoad(options) {
// socket
// this.socketinit();
},
onShow(){
this.openId = myCache('openId');
var user = myCache('user');
this.userid = user.userid? user.userid:'';
this.userName=user.nickName?user.nickName:"";
this.userheadimg=user.avatar?user.avatar:require("@/static/image/girl.png");
this.phone = user.userphone;
//
if(this.heartbeatInterval){
clearInterval(this.heartbeatInterval); //
}
// chatlist
this.loadData();
},
onPullDownRefresh() {
console.log('onPullDownRefresh');
setTimeout(()=>{
uni.stopPullDownRefresh()
},500);
},
onBackPress(options) {
if (options.from === 'backbutton') {
//
//
console.log('返回按钮被点击');
this.closeWebSocket();
uni.onSocketClose(function (res) {
console.log('WebSocket 已关闭!');
});
return false;
}
},
beforeDestroy() {
console.log('界面关闭socketbeforeDestroy');
// WebSocket
this.closeWebSocket();
clearInterval(this.heartbeatInterval); //
},
beforeRouteLeave(to, from, next) {
console.log('界面关闭socketbeforeRouteLeave');
next();
},
methods: {
//
actionClick(info,index) {
console.log(info,index);
var that=this;
uni.showModal({
title: '提示',
content: "确定要删除此聊天记录吗?",
cancelText: '取消',
confirmText: '确定',
success: ress => {
if (ress.confirm) {
myCache(info.id,"");
that.grouplist.splice(index, 1);
that.$forceUpdate();
myCache("chatlist",that.grouplist);
}
}
});
},
//
startHeartbeat() {
console.log("startHeartbeat")
this.heartbeatInterval = setInterval(() => {
if (this.socketTask) {
this.socketTask.send({
data: JSON.stringify({
'cmd': 1,//
'data': {
'accessToken':uni.getStorageSync("token")
},
}) //
});
}
}, this.heartbeatTimeout);
},
// ws
socketinit(){
var that = this;
// if (!that.isConnected) {
that.socketTask=uni.connectSocket({
url: "wss://www.sanduolantoyoga.com/yoga-imserver/",
header: {
// 'content-type': 'application/json',
Authorization: uni.getStorageSync("token"),
},
success: (res) => {
console.log(res, 'socket连接成功success');
},
fail: (res) => {
console.log(res, 'socket连接失败')
},
complete: (res) => {
console.log(res,'socket连接成功complete');
}
});
uni.onSocketOpen(resopen => {
console.log('WebSocket连接已打开');
that.isConnected = true;
that.$forceUpdate()
uni.sendSocketMessage({
data: JSON.stringify({
"cmd": 0,//
"data": {
"accessToken":uni.getStorageSync("token"),
},
}), // //
success(re) {
console.log(re);
console.log('消息发送成功!')
},
fail(err) {
console.log(err);
console.log('消息发送失败!')
}
});
//
this.startHeartbeat();
});
uni.onSocketMessage(res => {
console.log('收到WebSocket服务器消息');
if(res.data){
var rs=JSON.parse(res.data);
console.log(rs);
if(rs.data){
var data=rs.data;
if(data){
if(data.recvId==that.userid){
//
//
// 0: 1: 2: 3: 4: 10, "" 11, " "12, " " 30,""
if(data.type==0){
data.content=decodeURIComponent(data.content);
}
// else if(data.type==1){
// data.content="";
// }
// else if(data.type==2){
// data.content="";
// }
// else if(data.type==3){
// data.content="";
// }
// else if(data.type==4){
// data.content="";
// }
else if(data.type==5){
data.content="订单";
}
else if(data.type==6){
data.content="商品";
}
if(data.type==0||data.type==1||data.type==2||data.type==3||data.type==4||data.type==5||data.type==6){
var ifexist=0;
that.grouplist.forEach((cell,index)=>{
if(cell.fromuser==data.sendId&&cell.userid==data.recvId){
ifexist=1;
that.grouplist[index].sl=(that.grouplist[index].sl?that.grouplist[index].sl+1:1);
that.grouplist[index].content=data.content;
that.grouplist[index].datetime=data.sendTime;
that.grouplist[index].type=data.type;
that.$forceUpdate();
}
});
if(ifexist==0){
//
// socket
var chatlastinfo={
id: "privatechat-" + data.recvId +"-" + data.sendId,
content: data.content,
minId: data.id,
sl:1,
datetime: data.sendTime,
chatType: "",
type: data.type,
name: "",
userid: data.recvId,
fromuser: data.sendId,
img: "",
sort:"privatechat"
};
that.updateChatList(chatlastinfo,ifexist);
}
else{
that.updateChatList(that.grouplist[that.grouplist.length-1],ifexist);
}
}
else{
// 10, "" 11, " " 12, " " 30,""
}
}
}
}
}
});
uni.onSocketClose(res => {
console.log('WebSocket连接已关闭',res);
that.isConnected = false;
that.$forceUpdate();
clearInterval(that.heartbeatInterval); //
});
uni.onSocketError(err => {
console.error('WebSocket连接打开失败请检查', err);
that.isConnected = false;
that.$forceUpdate();
clearInterval(that.heartbeatInterval); //
});
// }
},
// WebSocket
closeWebSocket() {
uni.closeSocket();
this.isConnected = false;
this.$forceUpdate()
},
gotoContacts(){
uni.navigateTo({
url: `/pages/message/contact`
});
},
changeTime(date) {
return dateTime.dateTime(date);
},
gotoGroup(chat,index){
console.log("gotoGroup",chat);
//
this.grouplist[index]["sl"]=0;
this.$forceUpdate();
myCache("chatlist",this.grouplist);
//
if(chat.sort=="privatechat"){
//
var info={
chatId: chat.id,
chatType: chat.chatType,
chatName: chat.name,
chatAvatar: chat.img,
chatTime: chat.datetime,
friendId: chat.fromuser,
minId: chat.minId,
sort:"privatechat",
from:"message" // yh message
}
var data=encodeURIComponent(JSON.stringify(info));
uni.navigateTo({
url: `/pages/chat/chat?data=${data}`
});
}
else if(chat.type=="groupchat"){
//
var data=encodeURIComponent(JSON.stringify(info));
uni.navigateTo({
url: `/pages/chat/groupchat?data=${data}`
});
}
},
loadData(){
//
this.loadStatus="loading";
setTimeout(() => {
this.getgroupsmembers();
}, 300);
},
//
async getgroupsmembers(){
//
this.grouplist=[];
var chatlist=myCache("chatlist")?myCache("chatlist"):[];
chatlist.forEach(cell=>{
if(cell.userid==this.userid){
this.grouplist.push(cell);
}
});
this.grouplist.forEach((cell,i)=>{
if(cell.minId){
// id 线
this.readUp(i,cell.minId,cell.fromuser);
}
});
this.loadStatus="nomore";
this.$forceUpdate();
var that=this;
setTimeout(() => {
that.reorder();
myCache("chatlist",that.grouplist);
}, 300);
// socket
this.socketinit();
},
//
reorder(){
this.grouplist.sort((a, b) => b.datetime - a.datetime);
this.$forceUpdate();
},
//
async readUp(i,id,fromuser) {
const {data: res} = await uni.$http.put('/api/message/private/readed?friendId='+fromuser);
this.getgroupsnums(i,id);
},
// 线
async getgroupsnums(i,id){
const {data: res} = await uni.$http.get("/api/message/private/pullOfflineMessage",{minId:id});
if(res.data&&res.data.length>0){
//
var data=res.data;
// 线
this.grouplist[i]["sl"]=res.data.length;
var last=res.data[res.data.length-1];
if(last.type==0){
last.content=decodeURIComponent(last.content);
}
else if(last.type==1){
last.content="图片";
}
else if(last.type==2){
last.content="文件";
}
else if(last.type==3){
last.content="语音";
}
else if(last.type==4){
last.content="视频";
}
else if(last.type==5){
last.content="订单";
}
else if(last.type==6){
last.content="商品";
}
if(last.type==0||last.type==1||last.type==2||last.type==3||last.type==4||data.type==5||data.type==6){
this.grouplist[i].content=last.content;
this.grouplist[i].type=last.type;
this.grouplist[i].datetime=last.datetime;
this.$forceUpdate();
//
this.reorder();
myCache("chatlist",this.grouplist);
}
}
},
async updateChatList(info,ifexist){
const {data: res} = await uni.$http.get("/api/friend/find/"+info.fromuser);
if(res.data){
var data=res.data;
info.name=data.nickName?data.nickName:"匿名";
info.img=data.headImage?data.headImage:require("@/static/image/girl.png");
if(ifexist==0){
this.grouplist.push(info);
this.$forceUpdate();
}
//
this.reorder();
myCache("chatlist",this.grouplist);
//
var msgchat=myCache(info.id);
if(ifexist==0||!msgchat){
//
let firstmsg = [{
"fromname": info.name, //
"fromuser": info.fromuser, //
"headimg": info.img, //
"toname": this.userName, //
"touser": this.userid, //
"content": info.content,
"time": info.type==3?5:0,
"ifaudio":info.type==3? true:false,
"fromtime": info.datetime,
"type": info.type==0?'txt':(info.type==1?'image':info.type==3?'audio':(info.type==4?'video':'product')),
"id": info.id,
"minId": info.minId,
"recvId": info.recvId,
"sendId": info.sendId
}];
myCache(info.id,firstmsg);
}
else{
//
let firstmsg = {
"fromname": info.name, //
"fromuser": info.fromuser, //
"headimg": info.img, //
"toname": this.userName, //
"touser": this.userid, //
"content": info.content,
"time": info.type==3?5:0,
"ifaudio":info.type==3? true:false,
"fromtime": info.datetime,
"type": info.type==0?'txt':(info.type==1?'image':info.type==3?'audio':(info.type==4?'video':'product')),
"id": info.id,
"minId": info.minId,
"recvId": info.recvId,
"sendId": info.sendId
};
msgchat.push(firstmsg);
myCache(info.id,msgchat);
}
}
else{
info.name="匿名";
info.img="../../static/image/girl.png";
if(ifexist==0){
this.grouplist.push(info);
this.$forceUpdate();
}
//
this.reorder();
myCache("chatlist",this.grouplist);
var msgchat=myCache(info.id);
if(ifexist==0||!msgchat){
//
let firstmsg = [{
"fromname": info.name, //
"fromuser": info.fromuser, //
"headimg": info.img, //
"toname": this.userName, //
"touser": this.userid, //
"content": info.content,
"time": info.type==3?5:0,
"ifaudio":info.type==3? true:false,
"fromtime": info.datetime,
"type": info.type==0?'txt':(info.type==1?'image':info.type==3?'audio':(info.type==4?'video':'product')),
"id": info.id,
"minId": info.minId,
"recvId": info.recvId,
"sendId": info.sendId
}];
myCache(info.id,firstmsg);
}
else{
//
let firstmsg = {
"fromname": info.name, //
"fromuser": info.fromuser, //
"headimg": info.img, //
"toname": this.userName, //
"touser": this.userid, //
"content": info.content,
"time": info.type==3?5:0,
"ifaudio":info.type==3? true:false,
"fromtime": info.datetime,
"type": info.type==0?'txt':(info.type==1?'image':info.type==3?'audio':(info.type==4?'video':'product')),
"id": info.id,
"minId": info.minId,
"recvId": info.recvId,
"sendId": info.sendId
};
msgchat.push(firstmsg);
myCache(info.id,msgchat);
}
}
},
//
geStatusBarHeight(){
return uni.getSystemInfoSync()['statusBarHeight'];
},
//
getNavBarHeight(){
return 45+uni.getSystemInfoSync()['statusBarHeight'];
},
}
}
</script>
<style lang="scss" scoped>
.page{
padding: 0;
position: relative;
background-image: url('@/static/image/bg.jpg');
background-attachment: fixed;
background-size: cover;
background-position: center center;
min-height: calc(100vh - var(--window-top) - var(--window-bottom));
}
.page-header {
position: fixed;
width: 100%;
z-index: 999;
padding: 40rpx 30rpx 30rpx 30rpx;
display: flex;
color: #fff;
font-size: 36rpx;
background-color: #00a89b;
.text-center {
width: 100%;
text-align: center;
}
.edit {
position: absolute;
top: 50%;
transform: translateY(-50%);
right: 30rpx;
font-size: 32rpx;
}
}
.wrapcon{
padding: 0;
width: 100%;
position: relative;
margin: 180rpx 0 0 0;
min-height: calc(100vh - 180rpx);
/* #ifdef H5 */
margin: calc( 110rpx + var(--window-top)) 0 0 0;
min-height: calc(100vh - var(--window-top) - var(--window-bottom) - 180rpx);
/* #endif */
overflow-y: auto;
}
.listcell{
background: #fff;
margin: 0;
width: 100%;
.lcon{
border-bottom: 1rpx solid #eee;
padding-top: 20rpx;
padding-bottom: 20rpx;
opacity: 1;
display: flex;
flex-direction: row;
align-items: center;
width: 100%;
.limg{
width: 100rpx;
height: 100rpx;
margin-right: 20rpx;
margin-left: 20rpx;
display: flex;
flex-direction: row;
flex-wrap: wrap;
align-items: center;
justify-content: center;
border-radius: 50%;
.img{
width: 100rpx;
height: 100rpx;
}
}
.lright{
display: flex;
flex: 1;
flex-direction: column;
}
.lrow{
display: flex;
flex-direction: row;
margin-bottom: 20rpx;
margin-right: 20rpx;
}
.pname{
display: flex;
flex: 1;
line-height: 50rpx;
font-size: 32rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 600;
color: #000000;
}
.ptime{
line-height: 50rpx;
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
color: #595959;
}
.pnr{
display: flex;
flex: 1;
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #595959;
}
.lnum{
background-color: #de0000;
padding: 0 10rpx;
min-width: 32rpx;
height: 32rpx;
line-height: 32rpx;
color: #fff;
font-size: 24rpx;
border-radius: 28rpx;
}
}
}
.tips{
margin-top: 20rpx;
margin-bottom: 20rpx;
width: 100%;
line-height: 44rpx;
font-size: 26rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #595959;
text-align: center;
}
.submitcon{
margin-top: 200rpx;
display: flex;
align-items: center;
justify-content: center;
}
.bbtn{
margin: 20rpx 30rpx 54rpx;
font-size: 32rpx;
font-family: PingFang SC-Medium, PingFang SC;
font-weight: 500;
color: #FCFCFD;
width: 560rpx;
height: 96rpx;
line-height: 96rpx;
background: #367FFA;
box-shadow: 0rpx 12rpx 64rpx 2rpx rgba(67,110,255,0.4);
border-radius: 254rpx 254rpx 254rpx 254rpx;
opacity: 1;
&::after{
border:none;
}
}
.nodata{
background-image: url('../../static/image/nomsg.png');
background-repeat: no-repeat;
background-position: center center;
background-size: 100%;
height: 376rpx;
width: 256rpx;
color: #00a89b;
display: flex;
align-items: center;
justify-content: flex-end;
flex-direction: column;
padding-bottom: 40rpx;
margin: 100rpx auto;
}
</style>

@ -173,7 +173,7 @@
<button v-if="info.status==3" type="primary" class="pjbtn" @click="gotopj"></button> <button v-if="info.status==3" type="primary" class="pjbtn" @click="gotopj"></button>
<button v-if="info.status==3" type="primary" class="gzbtn" @click="gotosh"></button> <button v-if="info.status==3" type="primary" class="gzbtn" @click="gotosh"></button>
<button v-if="info.status==3&&info.aftersaleStatus==0" type="primary" class="gzbtn" @click="gotoshcancel"></button> <button v-if="info.status==3&&info.aftersaleStatus==0" type="primary" class="gzbtn" @click="gotoshcancel"></button>
<button type="primary" class="btn" @click="gotosj"></button> <button type="primary" class="btn" @click="gotoSevice"></button>
</view> </view>
@ -447,18 +447,104 @@
url: `/pages/order/orderpj?data=${id}` url: `/pages/order/orderpj?data=${id}`
}); });
}, },
gotosj(){
// 线 // 线
uni.makePhoneCall({ async gotoSevice(){
phoneNumber: "18900000001", //
success:function(){ var orderItemList=this.info.orderItemList?this.info.orderItemList[0]:null;
console.log('拨打电话成功'); if(orderItemList)
}, {
fail() { const {data: res1} = await uni.$http.get('/api/product/detail/'+orderItemList.productId);
console.log('打电话失败了'); if(res1&&res1.product){
var product=res1.product;
var customerService=product.customerService;// id;
if(!customerService){
uni.showModal({
title: '提示',
content: '抱歉!当前订单尚未配置客服服务..',
cancelText: '取消',
confirmText: '确定',
success: ress => {
}
});
return false;
}
var nickName="客服";
var headImage="/static/image/kfr.png";
uni.showLoading({
title: '会话创建中...'
});
const {data: res} = await uni.$http.get("/api/friend/find/"+customerService);
console.log(res)
if(res.data){
//
var data = res.data;
nickName=data.nickName?data.nickName:"客服";
headImage=data.headImage?data.headImage:'/static/image/kfr.png';
this.gotoSeviceTZ(nickName,headImage,customerService);
}
else{
this.gotoSeviceTZ(nickName,headImage,customerService);
}
}
else{
uni.showModal({
title: '提示',
content: '抱歉!当前订单尚未配置客服服务..',
cancelText: '取消',
confirmText: '确定',
success: ress => {
} }
}); });
return false;
}
}
else{
uni.showModal({
title: '提示',
content: '抱歉!当前订单尚未配置客服服务..',
cancelText: '取消',
confirmText: '确定',
success: ress => {
}
});
return false;
}
}, },
gotoSeviceTZ(nickName,headImage,customerService){
// 线
//
//
var chatid="privatechat-" + this.userid +"-"+ customerService;
var timestamp = new Date().getTime();
var sp=this.info.orderItemList[0];
var info={
chatId: chatid,
chatType: "customerService", //
chatName: nickName,
chatAvatar: headImage,
chatTime: timestamp,
userid: this.userid,
friendId: customerService, // userid
minId: "", // id
sort:"privatechat", // privatechat groupchat
from:"yh", // yh message
sendinfo:{
type:3,// 1 2 3
id:sp.id,
orderId:sp.orderId,
name:sp.productName,
pic:sp.pic?sp.pic:'/static/image/nopic.png',
price:this.info.totalAmount,
quantity:sp.quantity,
spData: sp.spData? JSON.parse(sp.spData):null
}
}
var data=encodeURIComponent(JSON.stringify(info));
uni.navigateTo({
url: `/pages/chat/chat?data=${data}`
});
},
async getinfo() { async getinfo() {
uni.showLoading({ uni.showLoading({
title: '数据加载中...' title: '数据加载中...'

@ -452,7 +452,8 @@
img:product.pic?product.pic:'',// img:product.pic?product.pic:'',//
img1:product.pic?getRemoteFile(product.pic):'../../static/image/imgicon.png', // img1:product.pic?getRemoteFile(product.pic):'../../static/image/imgicon.png', //
state:product.showStatus, // 1 2 3 4 5稿 state:product.showStatus, // 1 2 3 4 5稿
customerService:product.scustomerService,// id storeId:product.storeId,
customerService:product.customerService,// id
pjnum:0, // pjnum:0, //
quantity:1, // quantity:1, //
ifspec: res1.skus&&res1.skus.length>0?'1':'0', ifspec: res1.skus&&res1.skus.length>0?'1':'0',
@ -609,7 +610,7 @@
spData:this.product.spData, spData:this.product.spData,
skuId:this.product.skuId, skuId:this.product.skuId,
quantity:this.product.quantity, quantity:this.product.quantity,
storeId:myCache('myshopid')?myCache('myshopid'):'', storeId:this.product.storeId,
isCourse:this.product.isCourse, isCourse:this.product.isCourse,
}; };
// //
@ -680,11 +681,133 @@
url: `/pages/cart/cart` url: `/pages/cart/cart`
}); });
}, },
gotoSevice(){ async gotoSevice(){
if(!this.product.instructor&&!this.product.customerService){
uni.showModal({
title: '提示',
content: '抱歉!当前课程暂未配置客服咨询..',
cancelText: '取消',
confirmText: '确定',
success: ress => {
}
});
return false;
}
var nickName="客服";
var headImage="/static/image/kfr.png";
uni.showLoading({
title: '会话创建中...'
});
const {data: res} = await uni.$http.get("/api/friend/find/"+this.product.customerService);
if(res.data){
//
var data = res.data;
nickName=data.nickName?data.nickName:"客服";
headImage=data.headImage?data.headImage:'/static/image/kfr.png';
this.gotoSeviceTZ(nickName,headImage);
}
else{
this.gotoSeviceTZ(nickName,headImage);
}
},
async gotoSeviceTZ(nickName,headImage){
// 线 // 线
if(this.product.instructor&&this.product.customerService&&this.product.instructor!=this.product.customerService)
{
//
//
var params={
"productId": this.product.id, //id
"productName": this.product.name, //
"customerService": this.product.customerService, //id
"instructor": this.product.instructor //id
}
const {data: res} = await uni.$http.post("/api/group/create",params);
console.log(res)
if(res&&res.data){
var data=res.data;
var timestamp = new Date().getTime();
var chatid="groupchat-" + data.id;
var info={
chatId: chatid,
groupId: data.id,
chatName: data.name,
chatAvatar: data.headImage?data.headImage:'/static/image/kfr.png',
chatTime: timestamp,
userid: data.ownerId,
friendId: this.product.customerService, // userid
teacherId: this.product.instructor, // userid
minId: "", // id
sort:"groupchat", // privatechat groupchat
from:"yh", // yh message
notice: data.notice,
remarkNickName: data.remarkNickName,
showNickName: data.showNickName,
showGroupName: data.showGroupName,
remarkGroupName: data.remarkGroupName,
reason: data.reason,
customerService: data.customerService,
instructor: data.instructor,
productId: data.productId,
productName: data.productName,
sendinfo:{
type:1,// 1 2 3
id:this.product.id,
name:this.product.name,
pic:this.product.pic,
price:this.product.price,
unit: this.product.unit,
brandName:this.product.brandName,
isCourse:this.product.isCourse
}
}
var data=encodeURIComponent(JSON.stringify(info));
uni.navigateTo({
url: `/pages/chat/groupchat?data=${data}`
});
}
else{
uni.showModal({
title: '提示',
content: res.msg? res.msg:'当前会话创建失败..',
cancelText: '取消',
confirmText: '确定',
success: ress => {}
});
}
}
else{
//
//
var chatid="privatechat-" + this.userid +"-"+ this.product.customerService;
var timestamp = new Date().getTime();
var info={
chatId: chatid,
chatName: nickName,
chatAvatar: headImage,
chatTime: timestamp,
userid: this.userid,
friendId: this.product.customerService, // userid
minId: "", // id
sort:"privatechat", // privatechat groupchat
from:"yh", // yh message
sendinfo:{
type:2,// 1 2 3
id:this.product.id,
name:this.product.name,
pic:this.product.pic,
price:this.product.price,
unit: this.product.unit,
brandName:this.product.brandName,
isCourse:this.product.isCourse
}
}
var data=encodeURIComponent(JSON.stringify(info));
uni.navigateTo({ uni.navigateTo({
url: `/pages/product/service` url: `/pages/chat/chat?data=${data}`
}); });
}
}, },
gotoCourse(){ gotoCourse(){
// //

@ -96,7 +96,7 @@
searchValue:"", searchValue:"",
cartnum:getcartNum(),// cartnum:getcartNum(),//
ifsear:false, ifsear:false,
shopid:myCache('myshopid')?myCache('myshopid'):'', shopid:myCache('myshopid')?myCache('myshopid'):null,
shop:myCache('myshop')?myCache('myshop'):'', shop:myCache('myshop')?myCache('myshop'):'',
contentText: { contentText: {
contentdown: '查看更多', contentdown: '查看更多',
@ -274,6 +274,7 @@
img:product.pic?product.pic:'',// img:product.pic?product.pic:'',//
img1:product.pic?getRemoteFile(product.pic):'../../static/image/imgicon.png', // img1:product.pic?getRemoteFile(product.pic):'../../static/image/imgicon.png', //
state:product.showStatus, // 1 2 3 4 5稿 state:product.showStatus, // 1 2 3 4 5稿
storeId:product.storeId,
customerService:product.scustomerService,// id customerService:product.scustomerService,// id
quantity:1, // quantity:1, //
ifspec: res1.skus&&res1.skus.length>0?'1':'0', ifspec: res1.skus&&res1.skus.length>0?'1':'0',
@ -321,7 +322,7 @@
spData:this.product.spData, spData:this.product.spData,
skuId:this.product.skuId, skuId:this.product.skuId,
quantity:this.product.quantity, quantity:this.product.quantity,
storeId:myCache('myshopid')?myCache('myshopid'):'', storeId:this.product.storeId,
isCourse:this.product.isCourse, isCourse:this.product.isCourse,
}; };
// //
@ -439,10 +440,11 @@
return text.replace(regex, `<span style="color:#00a89b">${keyword}</span>`); return text.replace(regex, `<span style="color:#00a89b">${keyword}</span>`);
}, },
input(res) { input(res) {
if(!this.ifsear){ console.log('input',res);
this.ifsear=true; // if(!this.ifsear){
this.getld(res); // this.ifsear=true;
} // this.getld(res);
// }
}, },
async getld(keywords) { async getld(keywords) {
const {data: res} = await uni.$http.post('/yoga/getProductsBykeywords',{keywords:keywords}); const {data: res} = await uni.$http.post('/yoga/getProductsBykeywords',{keywords:keywords});
@ -458,18 +460,26 @@
}, },
focus(res){ focus(res){
console.log('focus',res); console.log('focus',res);
this.ifshow=false; // this.ifshow=false;
this.$forceUpdate(); this.$forceUpdate();
}, },
search(res) { search(res) {
//
console.log('search',res);
this.ifsear=false; this.ifsear=false;
this.ifshow=true; // this.ifshow=true;
this.$forceUpdate();
if(res.value){
this.loadStatus="more";
this.goodsList=[];
this.page.pageNum=1;
this.$forceUpdate(); this.$forceUpdate();
this.getList(); this.getList();
}
}, },
clear(res) { clear(res) {
this.searchValue=""; this.searchValue="";
this.ifshow=true; // this.ifshow=true;
this.$forceUpdate(); this.$forceUpdate();
this.getList(); this.getList();
}, },
@ -479,7 +489,7 @@
// icon: 'none' // icon: 'none'
// }) // })
this.searchValue=""; this.searchValue="";
this.ifshow=true; // this.ifshow=true;
this.$forceUpdate(); this.$forceUpdate();
this.getList(); this.getList();
}, },

@ -406,7 +406,8 @@
img:product.pic?product.pic:'',// img:product.pic?product.pic:'',//
img1:product.pic?getRemoteFile(product.pic):'../../static/image/imgicon.png', // img1:product.pic?getRemoteFile(product.pic):'../../static/image/imgicon.png', //
state:product.showStatus, // 1 2 3 4 5稿 state:product.showStatus, // 1 2 3 4 5稿
customerService:product.scustomerService,// id storeId:product.storeId,
customerService:product.customerService,// id
pjnum:0, // pjnum:0, //
quantity:1, // quantity:1, //
ifspec: res1.skus&&res1.skus.length>0?'1':'0', ifspec: res1.skus&&res1.skus.length>0?'1':'0',
@ -564,7 +565,7 @@
spData:this.product.spData, spData:this.product.spData,
skuId:this.product.skuId, skuId:this.product.skuId,
quantity:this.product.quantity, quantity:this.product.quantity,
storeId:myCache('myshopid')?myCache('myshopid'):'', storeId:this.product.storeId,
isCourse:this.product.isCourse, isCourse:this.product.isCourse,
}; };
// //
@ -638,10 +639,67 @@
url: `/pages/cart/cart` url: `/pages/cart/cart`
}); });
}, },
gotoSevice(){ async gotoSevice(){
if(!this.product.instructor&&!this.product.customerService){
uni.showModal({
title: '提示',
content: '抱歉!当前课商品未配置客服咨询..',
cancelText: '取消',
confirmText: '确定',
success: ress => {
}
});
return false;
}
var nickName="客服";
var headImage="/static/image/kfr.png";
uni.showLoading({
title: '会话创建中...'
});
const {data: res} = await uni.$http.get("/api/friend/find/"+this.product.customerService);
if(res.data){
//
var data = res.data;
nickName=data.nickName?data.nickName:"客服";
headImage=data.headImage?data.headImage:'/static/image/kfr.png';
this.gotoSeviceTZ(nickName,headImage);
}
else{
this.gotoSeviceTZ(nickName,headImage);
}
},
async gotoSeviceTZ(nickName,headImage){
console.log(this.product.instructor,this.product.customerService)
// 线 // 线
//
//
var timestamp = new Date().getTime();
var chatid="privatechat-" + this.userid +"-"+ this.product.customerService;
var info={
chatId: chatid,
chatName: nickName,
chatAvatar: headImage,
chatTime: timestamp,
userid: this.userid,
friendId: this.product.customerService, // userid
minId: "", // id
sort:"privatechat", // privatechat groupchat
from:"yh", // yh message
sendinfo:{
type:1,// 1 2 3
id:this.product.id,
name:this.product.name,
pic:this.product.pic,
price:this.product.price,
unit: this.product.unit,
brandName:this.product.brandName,
isCourse:this.product.isCourse
}
}
var data=encodeURIComponent(JSON.stringify(info));
uni.navigateTo({ uni.navigateTo({
url: `/pages/product/service` url: `/pages/chat/chat?data=${data}`
}); });
}, },
gotoShop(){ gotoShop(){

@ -24,8 +24,8 @@
<!-- 商品列表 --> <!-- 商品列表 -->
<view v-else class="f-list"> <view v-else class="f-list">
<!-- 广告 --> <!-- 广告 -->
<view class="adcon" v-if="adcoursesList.length>0||adgoodsList.length>0"> <view class="adcon" v-if="(adcoursesList&&adcoursesList.length>0)||(adgoodsList&&adgoodsList.length>0)">
<view class="adrow" v-if="adgoodsList.length>0" style="background: #f8f6f9;"> <view class="adrow" v-if="(adgoodsList&&adgoodsList.length>0)" style="background: #f8f6f9;">
<view class="adhead"> <view class="adhead">
<view class="txt">达人好物</view> <view class="txt">达人好物</view>
<view class="tip">买贵双倍赔</view> <view class="tip">买贵双倍赔</view>
@ -37,7 +37,7 @@
</view> </view>
</scroll-view> </scroll-view>
</view> </view>
<view class="adrow" v-if="adcoursesList.length>0" style="margin-left: 2%; background: #f5f9fa;"> <view class="adrow" v-if="adcoursesList&&adcoursesList.length>0" style="margin-left: 2%; background: #f5f9fa;">
<view class="adhead"> <view class="adhead">
<view class="txt">精品课程</view> <view class="txt">精品课程</view>
<view class="tip"></view> <view class="tip"></view>
@ -52,7 +52,7 @@
</view> </view>
<view v-for="(tabItem,ii) in list" :key="tabItem.id"> <view v-for="(tabItem,ii) in list" :key="tabItem.id">
<view v-show="ii==tabCurrentIndex"> <view v-show="ii==tabCurrentIndex">
<view class="guess-section" v-if="tabItem.goodsList.length>0"> <view class="guess-section" v-if="tabItem.goodsList&&tabItem.goodsList.length>0">
<view <view
v-for="(item, index) in tabItem.goodsList" :key="index" v-for="(item, index) in tabItem.goodsList" :key="index"
class="guess-item" class="guess-item"
@ -71,7 +71,7 @@
</view> </view>
</view> </view>
</view> </view>
<view v-if="tabItem.goodsList.length<1&&tabItem.loadStatus=='noMore'" class="skcon"> <view v-if="tabItem.goodsList&&tabItem.goodsList.length<1&&tabItem.loadStatus=='noMore'" class="skcon">
<image class="skimg" src="@/static/image/nodata.png" mode="aspectFill" ></image> <image class="skimg" src="@/static/image/nodata.png" mode="aspectFill" ></image>
</view> </view>
<uni-load-more v-if="tabItem.loadStatus!=='noMore'" iconType="circle" :status="tabItem.loadStatus" :content-text="contentText" /> <uni-load-more v-if="tabItem.loadStatus!=='noMore'" iconType="circle" :status="tabItem.loadStatus" :content-text="contentText" />
@ -118,7 +118,7 @@
ifshow:true, // ifshow:true, //
searchValue:"", searchValue:"",
ifsear:false, ifsear:false,
shopid: myCache('myshopid'), shopid: myCache('myshopid')?myCache('myshopid'):null,
shop: myCache('myshop'), shop: myCache('myshop'),
scrollLeft: 0, scrollLeft: 0,
tabCurrentIndex:0, tabCurrentIndex:0,
@ -300,6 +300,7 @@
img:product.pic?product.pic:'',// img:product.pic?product.pic:'',//
img1:product.pic?getRemoteFile(product.pic):'../../static/image/imgicon.png', // img1:product.pic?getRemoteFile(product.pic):'../../static/image/imgicon.png', //
state:product.showStatus, // 1 2 3 4 5稿 state:product.showStatus, // 1 2 3 4 5稿
storeId:product.storeId,
customerService:product.scustomerService,// id customerService:product.scustomerService,// id
quantity:1, // quantity:1, //
ifspec: res1.skus&&res1.skus.length>0?'1':'0', ifspec: res1.skus&&res1.skus.length>0?'1':'0',
@ -347,7 +348,7 @@
spData:this.product.spData, spData:this.product.spData,
skuId:this.product.skuId, skuId:this.product.skuId,
quantity:this.product.quantity, quantity:this.product.quantity,
storeId:myCache('myshopid')?myCache('myshopid'):'', storeId:this.product.storeId,
isCourse:this.product.isCourse, isCourse:this.product.isCourse,
}; };
const {data: res1} = await uni.$http.post('/api/cart/add',param); const {data: res1} = await uni.$http.post('/api/cart/add',param);
@ -644,6 +645,7 @@
res.content.forEach((cell,idx)=>{ res.content.forEach((cell,idx)=>{
var celnew={ var celnew={
id:cell.id, id:cell.id,
isCourse:cell.isCourse,
name:cell.name, name:cell.name,
type:cell.isCourse=='1'?'2':'1', type:cell.isCourse=='1'?'2':'1',
img: cell.pic, img: cell.pic,
@ -704,6 +706,7 @@
}) })
}, },
navToList(item){ navToList(item){
console.log("item",item)
if(item.isCourse==1){ if(item.isCourse==1){
uni.navigateTo({ uni.navigateTo({
url: `/pages/product/cdetail?id=${item.id}` url: `/pages/product/cdetail?id=${item.id}`

@ -661,7 +661,7 @@
}); });
}, },
adrchange(e){ adrchange(e){
console.log(e); // console.log(e);
if(e.detail.value||e.detail.value=='0'){ if(e.detail.value||e.detail.value=='0'){
var data= this.myaddresslist[parseInt(e.detail.value)]; var data= this.myaddresslist[parseInt(e.detail.value)];
// //

File diff suppressed because it is too large Load Diff

@ -30,8 +30,14 @@
<block v-for="(cc, kk) in item.claTimeWeekDayMap" :key="kk"> <block v-for="(cc, kk) in item.claTimeWeekDayMap" :key="kk">
<block v-for="(dd, mm) in cc" :key="mm"> <block v-for="(dd, mm) in cc" :key="mm">
<!-- dd.weekDay==cell.weekName && --> <!-- dd.weekDay==cell.weekName && -->
<!-- :style="{color:colorlist[index].fcolor,backgroundColor:colorlist[index].color,borderLeftColor:colorlist[index].fcolor}" -->
<view class="courheadtext" v-if="dd.claDate==cell.day" <view class="courheadtext" v-if="dd.claDate==cell.day"
:style="{color:colorlist[index].fcolor,backgroundColor:colorlist[index].color,borderLeftColor:colorlist[index].fcolor}" > :style="{
fontSize:(dd.fontSize?dd.fontSize+'px':'26rpx'),
color: (dd.fontColor?dd.fontColor:'#000'),
backgroundColor:( dd.claColor?dd.claColor:colorlist[index].color),
borderLeftColor: '#fef2ce'
}" >
<view class="ctxt">{{dd.startTime}}-{{dd.endTime}}</view> <view class="ctxt">{{dd.startTime}}-{{dd.endTime}}</view>
<view class="ctxt" style="font-weight: 600;">{{dd.courseName}}</view> <view class="ctxt" style="font-weight: 600;">{{dd.courseName}}</view>
<view class="ctxt">{{dd.claName}}</view> <view class="ctxt">{{dd.claName}}</view>
@ -794,11 +800,12 @@
flex-direction: column; flex-direction: column;
width: 100%; width: 100%;
height: 240rpx; height: 240rpx;
justify-content: center; justify-content:flex-start;
align-items: center; align-items: center;
border-bottom: 1rpx dotted #ccc; border-bottom: 1rpx dotted #ccc;
color:#000; color:#000;
font-size: 28rpx; font-size: 28rpx;
padding-top: 10rpx;
} }
.courheadtext{ .courheadtext{
display: flex; display: flex;
@ -808,13 +815,12 @@
justify-content: center; justify-content: center;
align-items: center; align-items: center;
border-radius: 10rpx; border-radius: 10rpx;
border-radius: 10rpx; border-left-width: 6rpx;
border-left-width: 10rpx;
border-left: solid; border-left: solid;
} }
.ctxt{ .ctxt{
font-size: 24rpx;
line-height: 30rpx; line-height: 30rpx;
padding-bottom: 4rpx;
margin-bottom: 6rpx; margin-bottom: 6rpx;
} }
} }

@ -44,8 +44,8 @@
</view> </view>
<view class="submitcon"> <view class="submitcon">
<button type="primary" class="bbtn" @tap="goconsult()"></button> <button type="primary" class="bbtn" @click="goconsult()"></button>
<button type="primary" class="bbtn" @tap="gocourse()"></button> <button type="primary" class="bbtn" @click="gocourse()"></button>
</view> </view>
<!-- 是否登录 --> <!-- 是否登录 -->
@ -79,6 +79,7 @@
nickName:"", nickName:"",
html:``, html:``,
id:'', id:'',
appUserId:'',
intro:'', intro:'',
teacherName:'', teacherName:'',
sex:'', sex:'',
@ -164,9 +165,9 @@
}; };
try{ try{
const {data: res} = await uni.$http.post('/api/context/getOne',params); const {data: res} = await uni.$http.post('/api/context/getOne',params);
console.log(res.data);
if (res&&res.success) { if (res&&res.success) {
var data=res.data; var data=res.data;
this.appUserId=data.appUserId;
this.teacherName=data.userName; this.teacherName=data.userName;
this.sex=data.sex=='1'?'女':(data.sex=='2'?'男':'未知'); this.sex=data.sex=='1'?'女':(data.sex=='2'?'男':'未知');
this.html=getRemoteHtmlFile(data.context); this.html=getRemoteHtmlFile(data.context);
@ -178,7 +179,6 @@
ban_img:item ban_img:item
}) })
}) })
console.log(this.swiperList);
this.$forceUpdate(); this.$forceUpdate();
} }
else{ else{
@ -222,27 +222,29 @@
}, },
// //
async goconsult(){ async goconsult(){
// id // uni.showLoading({
uni.showLoading("会话创建中.."); // title: '...'
var params = { // });
friendId: this.id
};
try{ try{
const {data: res} = await uni.$http.get("/api/message/private/maxReadedId",params); //
var chatid="privatechat-" + this.userid +"-"+ this.id;
var timestamp = new Date().getTime(); var timestamp = new Date().getTime();
var info={ var info={
chatId: "teacher-" + this.userid +"-"+ this.id, chatId: "privatechat-" + this.userid +"-"+ this.id,
chatType: "teacher", chatType: "coach",
chatName: this.teacherName, chatName: this.teacherName,
chatAvatar: this.avatar, chatAvatar: this.avatar,
chatTime: timestamp, chatTime: timestamp,
minId: res.data, // id userid: this.userid,
friendId: this.id, // id friendId: this.appUserId, // userid
minId: "", // id
sort: "privatechat", // privatechat groupchat
from: "yh" // yh message
} }
var data=encodeURIComponent(JSON.stringify(info)); var data=encodeURIComponent(JSON.stringify(info));
uni.navigateTo({ uni.navigateTo({
url: `/pages/teacher/chat?data=${data}` url: `/pages/chat/chat?data=${data}`
}) });
} }
catch(e){ catch(e){
console.log(e); console.log(e);
@ -255,6 +257,31 @@
}); });
} }
}, },
groupListChange(chatlastinfo){
//
var chatlist = myCache("chatlist");
if(chatlist&&chatlist.length>0){
var ifexist=0;
chatlist.forEach((cell,i)=>{
if(cell.id==chatlastinfo.id){
ifexist++;
chatlist[i]=chatlastinfo;
}
});
if(ifexist==0){
//
chatlist.unshift(chatlastinfo);
}
//
myCache("chatlist",chatlist);
}
else{
chatlist=[];
chatlist.push(chatlastinfo);
myCache("chatlist",chatlist);
}
},
gocourse(){ gocourse(){
// //
uni.navigateTo({ uni.navigateTo({

@ -275,18 +275,6 @@
url: `/pages/book/bookinfo?id=${id}` url: `/pages/book/bookinfo?id=${id}`
}); });
}, },
//
gototeacher(item){
var data={
id:item.id,
name:"教练A"
}
//
var data=encodeURIComponent(JSON.stringify(data));
uni.navigateTo({
url: `/pages/teacher/chat?data=${data}`
})
},
// //
gotoevaluate(info){ gotoevaluate(info){
var data=encodeURIComponent(JSON.stringify(info)); var data=encodeURIComponent(JSON.stringify(info));

@ -36,7 +36,7 @@
<view class="otop"> <view class="otop">
<view class="hleft"> <view class="hleft">
{{item.courseName}} {{item.courseName||'-'}}
</view> </view>
<view class="hright"> <view class="hright">
{{item.startTime+'-'+item.endTime}} {{item.startTime+'-'+item.endTime}}
@ -49,9 +49,10 @@
</view> </view>
<view class="osname"> <view class="osname">
<view class="oscell"> <view class="oscell">
<view v-if="item.claName=='团课'" class="txtbg">{{item.claName}}</view> <!-- <view v-if="item.claName=='团课'" class="txtbg">{{item.claName}}</view>
<view v-else class="txtbg1">{{item.claName}}</view> <view v-else class="txtbg1">{{item.claName}}</view> -->
<uni-rate :size="15" :readonly="true" :value="item.star" :max="item.star"/> <view v-if="item.claName" class="txtbg1">{{item.claName}}</view>
<uni-rate :size="15" :readonly="true" :value="item.star?item.star:5" :max="5"/>
</view> </view>
<view class="oscell" v-if="item.storeName"> <view class="oscell" v-if="item.storeName">
<uni-icons type="paperclip" size="18" color="#00A99A"></uni-icons> <uni-icons type="paperclip" size="18" color="#00A99A"></uni-icons>
@ -126,15 +127,22 @@
<uni-td width="80" align="center" v-for="(cell, ii) in columnTitles" :key="ii"> <uni-td width="80" align="center" v-for="(cell, ii) in columnTitles" :key="ii">
<block v-for="(cc, kk) in item.claTimeWeekDayMap" :key="kk"> <block v-for="(cc, kk) in item.claTimeWeekDayMap" :key="kk">
<block v-for="(dd, mm) in cc" :key="mm"> <block v-for="(dd, mm) in cc" :key="mm">
<!-- :style="{color:colorlist[index].fcolor,backgroundColor:colorlist[index].color,borderLeftColor:colorlist[index].fcolor}" -->
<view class="courheadtext" v-if="dd.claDate==cell.day" <view class="courheadtext" v-if="dd.claDate==cell.day"
:style="{color:colorlist[index].fcolor,backgroundColor:colorlist[index].color,borderLeftColor:colorlist[index].fcolor}" > :style="{
fontSize:(dd.fontSize?dd.fontSize+'px':'26rpx'),
color: (dd.fontColor?dd.fontColor:'#000'),
backgroundColor: ( dd.claColor?dd.claColor:colorlist[index].color),
borderLeftColor: '#fef2ce'
}">
<!-- (dd.fontColor?dd.fontColor:'#000') -->
<view class="ctxt">{{dd.startTime}}-{{dd.endTime}}</view> <view class="ctxt">{{dd.startTime}}-{{dd.endTime}}</view>
<view class="ctxt" style="font-weight: 600;">{{dd.courseName}}</view> <view class="ctxt" style="font-weight: 600;">{{dd.courseName}}</view>
<view class="ctxt">{{dd.claName}}</view> <view class="ctxt">{{dd.claName}}</view>
<view class="ctxt" v-if="dd.staffName">{{dd.staffName}}</view> <view class="ctxt" v-if="dd.staffName">{{dd.staffName}}</view>
<view class="ctxt" v-if="dd.roomName">{{dd.roomName}}</view> <view class="ctxt" v-if="dd.roomName">{{dd.roomName}}</view>
<button v-if="dd.claTimeStatus=='1'" type="primary" class="orderbtn" @click="gotoorder(dd)"></button> <button v-if="dd.claTimeStatus=='1'" type="primary" class="orderbtn" @click="gotoorder(dd)"></button>
<view v-else class="noorderbtn">预约</view> <view v-else class="noorderbtn">不可预约</view>
</view> </view>
</block> </block>
</block> </block>
@ -143,7 +151,6 @@
</view> </view>
</uni-table> </uni-table>
</view> </view>
@ -697,11 +704,11 @@
uni.showLoading(); uni.showLoading();
this.loading=true; this.loading=true;
try{ try{
const {data: res1} = await uni.$http.get('/api/course/getCourseList'); const {data: res} = await uni.$http.get('/api/course/getCourseList');
console.log(res1); console.log(res);
this.loading=false; this.loading=false;
if (res1.success) { if (res.success) {
var data = res1.data; var data = res.data;
this.columnTitles=data.columnTitles?data.columnTitles:[]; this.columnTitles=data.columnTitles?data.columnTitles:[];
this.claTimeContainer=data.claTimeContainer?data.claTimeContainer:[]; this.claTimeContainer=data.claTimeContainer?data.claTimeContainer:[];
this.list=[]; this.list=[];
@ -715,9 +722,9 @@
week:item.weekName, week:item.weekName,
slist:[] slist:[]
} }
this.list.push(lcell) this.list.push(lcell);
})
this.$forceUpdate(); this.$forceUpdate();
});
this.getOrderList(); this.getOrderList();
} }
else{ else{
@ -1229,10 +1236,10 @@
position: sticky; position: sticky;
top: 0; top: 0;
z-index: 19; z-index: 19;
height: calc(100vh - 240rpx); // height: calc(100vh - 240rpx);
/* #ifdef H5 */ // /* #ifdef H5 */
height: calc(100vh - 240rpx - var(--window-top)); // height: calc(100vh - 240rpx - var(--window-top));
/* #endif */ // /* #endif */
background: #f8f8f8; background: #f8f8f8;
} }
::v-deep .uni-table-tr{ ::v-deep .uni-table-tr{
@ -1265,7 +1272,7 @@
} }
.courcon{ .courcon{
width: 100%; width: 100%;
height: calc(100vh); height: calc(100vh - 100rpx);
/* #ifdef H5 */ /* #ifdef H5 */
height: calc(100vh - 100rpx - var(--window-top)); height: calc(100vh - 100rpx - var(--window-top));
/* #endif */ /* #endif */
@ -1342,11 +1349,12 @@
width: 100%; width: 100%;
height: 280rpx; height: 280rpx;
background-color: #F2F2F2; background-color: #F2F2F2;
justify-content: center; justify-content: flex-start;
align-items: center; align-items: center;
border-bottom: 1rpx dotted #ccc; border-bottom: 1rpx dotted #ccc;
color:#000; color:#000;
font-size: 28rpx; font-size: 28rpx;
padding-top: 10rpx;
} }
.courheadtext{ .courheadtext{
display: flex; display: flex;
@ -1356,38 +1364,41 @@
justify-content: center; justify-content: center;
align-items: center; align-items: center;
border-radius: 10rpx; border-radius: 10rpx;
border-radius: 10rpx; border-left-width: 6rpx;
border-left-width: 10rpx;
border-left: solid; border-left: solid;
} }
.ctxt{ .ctxt{
font-size: 24rpx;
line-height: 30rpx; line-height: 30rpx;
padding-bottom: 4rpx;
margin-bottom: 6rpx; margin-bottom: 6rpx;
} }
.orderbtn{ .orderbtn{
background-color: #00A99A !important; background-color: #ddd !important;
border-radius: 40rpx; border-radius: 40rpx;
height: 40rpx; height: 40rpx;
line-height: 38rpx; line-height: 38rpx;
padding: 0 20rpx; padding: 0 16rpx;
font-size: 24rpx; font-size: 24rpx;
border:1rpx solid #00A99A; border:1rpx solid #ddd;
margin-top: 6rpx; margin-top: 6rpx;
color:#000;
} }
.orderbtn::after{ .orderbtn::after{
border:0 !important; border:0 !important;
} }
.noorderbtn{ .noorderbtn{
background-color: #c8c8c8 !important; background-color: #eee !important;
border-radius: 40rpx; border-radius: 40rpx;
height: 40rpx; height: 40rpx;
line-height: 38rpx; line-height: 38rpx;
padding: 0 20rpx; padding: 0 16rpx;
font-size: 24rpx; font-size: 24rpx;
border:1rpx solid #c8c8c8; border:1rpx solid #eee;
margin-top: 6rpx; margin-top: 6rpx;
color:#666; color:#888;
}
.noorderbtn::after{
border:0 !important;
} }
} }
.bbtn{ .bbtn{

@ -283,18 +283,6 @@
this.tabCurrentIndex = current; this.tabCurrentIndex = current;
this.loadData(); this.loadData();
}, },
//
gototeacher(item){
var data={
id:item.id,
name:"教练A"
}
//
var data=encodeURIComponent(JSON.stringify(data));
uni.navigateTo({
url: `/pages/teacher/chat?data=${data}`
})
},
reset(){ reset(){
// //
this.list.forEach((cell,idx)=>{ this.list.forEach((cell,idx)=>{

@ -272,6 +272,7 @@
img:product.pic?product.pic:'',// img:product.pic?product.pic:'',//
img1:product.pic?product.pic:'../../static/image/imgicon.png', // img1:product.pic?product.pic:'../../static/image/imgicon.png', //
state:product.showStatus, // 1 2 3 4 5稿 state:product.showStatus, // 1 2 3 4 5稿
storeId:product.storeId,
customerService:product.scustomerService,// id customerService:product.scustomerService,// id
quantity:1, // quantity:1, //
ifspec: res1.skus&&res1.skus.length>0?'1':'0', ifspec: res1.skus&&res1.skus.length>0?'1':'0',
@ -319,7 +320,7 @@
spData:this.product.spData, spData:this.product.spData,
skuId:this.product.skuId, skuId:this.product.skuId,
quantity:this.product.quantity, quantity:this.product.quantity,
storeId:myCache('myshopid')?myCache('myshopid'):'', storeId:this.product.storeId,
isCourse:this.product.isCourse, isCourse:this.product.isCourse,
}; };
const {data: res1} = await uni.$http.post('/api/cart/add',param); const {data: res1} = await uni.$http.post('/api/cart/add',param);

@ -433,18 +433,6 @@
url: `/pages/book/bookinfo?id=${id}` url: `/pages/book/bookinfo?id=${id}`
}); });
}, },
//
gototeacher(item){
var data={
id:item.id,
name:"教练A"
}
//
var data=encodeURIComponent(JSON.stringify(data));
uni.navigateTo({
url: `/pages/teacher/chat?data=${data}`
})
},
iflogin(){ iflogin(){
this.openId = myCache('openId'); this.openId = myCache('openId');
var user = myCache('user'); var user = myCache('user');

@ -87,63 +87,70 @@
<view class="title">{{servers[3].name}}</view> <view class="title">{{servers[3].name}}</view>
</view> </view>
<!-- 预约学员 教练--> <!-- 预约学员 教练-->
<view v-if="ifview(104)" class="product-item" @click="gotoServe(12)"> <view v-if="ifview('104')" class="product-item" @click="gotoServe(12)">
<view class="image-wrapper"> <view class="image-wrapper">
<image class="imgicon" :src="servers[12].img" mode="aspectFill" lazy-load></image> <image class="imgicon" :src="servers[12].img" mode="aspectFill" lazy-load></image>
</view> </view>
<view class="title">{{servers[12].name}}</view> <view class="title">{{servers[12].name}}</view>
</view> </view>
<!-- 预约学员 店长 --> <!-- 预约学员 店长 -->
<view v-if="ifview(105)" class="product-item" @click="gotoServe(13)"> <view v-if="ifview('105')" class="product-item" @click="gotoServe(13)">
<view class="image-wrapper"> <view class="image-wrapper">
<image class="imgicon" :src="servers[13].img" mode="aspectFill" lazy-load></image> <image class="imgicon" :src="servers[13].img" mode="aspectFill" lazy-load></image>
</view> </view>
<view class="title">{{servers[13].name}}</view> <view class="title">{{servers[13].name}}</view>
</view> </view>
<!-- 学员签到 教练/顾问 -->
<view v-if="ifview('103,104')" class="product-item" @click="gotoServe(14)">
<view class="image-wrapper">
<image class="imgicon" :src="servers[14].img" mode="aspectFill" lazy-load></image>
</view>
<view class="title">{{servers[14].name}}</view>
</view>
<!-- 我的客户 --> <!-- 我的客户 -->
<view v-if="ifview(103)" class="product-item" @click="gotoServe(4)"> <view v-if="ifview('103')" class="product-item" @click="gotoServe(4)">
<view class="image-wrapper"> <view class="image-wrapper">
<image class="imgicon" :src="servers[4].img" mode="aspectFill" lazy-load></image> <image class="imgicon" :src="servers[4].img" mode="aspectFill" lazy-load></image>
</view> </view>
<view class="title">{{servers[4].name}}</view> <view class="title">{{servers[4].name}}</view>
</view> </view>
<!-- 提成统计 --> <!-- 提成统计 -->
<view v-if="ifview(103)" class="product-item" @click="gotoServe(6)"> <view v-if="ifview('103')" class="product-item" @click="gotoServe(6)">
<view class="image-wrapper"> <view class="image-wrapper">
<image class="imgicon" :src="servers[6].img" mode="aspectFill" lazy-load></image> <image class="imgicon" :src="servers[6].img" mode="aspectFill" lazy-load></image>
</view> </view>
<view class="title">{{servers[6].name}}</view> <view class="title">{{servers[6].name}}</view>
</view> </view>
<!-- 我的排课 --> <!-- 我的排课 -->
<view v-if="ifview(104)" class="product-item" @click="gotoServe(7)"> <view v-if="ifview('104')" class="product-item" @click="gotoServe(7)">
<view class="image-wrapper"> <view class="image-wrapper">
<image class="imgicon" :src="servers[7].img" mode="aspectFill" lazy-load></image> <image class="imgicon" :src="servers[7].img" mode="aspectFill" lazy-load></image>
</view> </view>
<view class="title">{{servers[7].name}}</view> <view class="title">{{servers[7].name}}</view>
</view> </view>
<!-- 课时统计 --> <!-- 课时统计 -->
<view v-if="ifview(104)" class="product-item" @click="gotoServe(8)"> <view v-if="ifview('104')" class="product-item" @click="gotoServe(8)">
<view class="image-wrapper"> <view class="image-wrapper">
<image class="imgicon" :src="servers[8].img" mode="aspectFill" lazy-load></image> <image class="imgicon" :src="servers[8].img" mode="aspectFill" lazy-load></image>
</view> </view>
<view class="title">{{servers[8].name}}</view> <view class="title">{{servers[8].name}}</view>
</view> </view>
<!-- 销售信息 --> <!-- 销售信息 -->
<view v-if="ifview(105)" class="product-item" @click="gotoServe(9)"> <view v-if="ifview('105')" class="product-item" @click="gotoServe(9)">
<view class="image-wrapper"> <view class="image-wrapper">
<image class="imgicon" :src="servers[9].img" mode="aspectFill" lazy-load></image> <image class="imgicon" :src="servers[9].img" mode="aspectFill" lazy-load></image>
</view> </view>
<view class="title">{{servers[9].name}}</view> <view class="title">{{servers[9].name}}</view>
</view> </view>
<!-- 场地费用 --> <!-- 场地费用 -->
<view v-if="ifview(105)" class="product-item" @click="gotoServe(10)"> <view v-if="ifview('105')" class="product-item" @click="gotoServe(10)">
<view class="image-wrapper"> <view class="image-wrapper">
<image class="imgicon" :src="servers[10].img" mode="aspectFill" lazy-load></image> <image class="imgicon" :src="servers[10].img" mode="aspectFill" lazy-load></image>
</view> </view>
<view class="title">{{servers[10].name}}</view> <view class="title">{{servers[10].name}}</view>
</view> </view>
<!-- 教练费用 --> <!-- 教练费用 -->
<view v-if="ifview(105)" class="product-item" @click="gotoServe(11)"> <view v-if="ifview('105')" class="product-item" @click="gotoServe(11)">
<view class="image-wrapper"> <view class="image-wrapper">
<image class="imgicon" :src="servers[11].img" mode="aspectFill" lazy-load></image> <image class="imgicon" :src="servers[11].img" mode="aspectFill" lazy-load></image>
</view> </view>
@ -151,9 +158,9 @@
</view> </view>
<view v-if="userid" class="product-item" @click="gotoServe(99)"> <view v-if="userid" class="product-item" @click="gotoServe(99)">
<view class="image-wrapper"> <view class="image-wrapper">
<image class="imgicon" :src="servers[14].img" mode="aspectFill" lazy-load></image> <image class="imgicon" :src="servers[15].img" mode="aspectFill" lazy-load></image>
</view> </view>
<view class="title">{{servers[14].name}}</view> <view class="title">{{servers[15].name}}</view>
</view> </view>
</scroll-view> </scroll-view>
</view> </view>
@ -286,6 +293,11 @@
img:'../../static/image/yyjl.png', img:'../../static/image/yyjl.png',
name:'预约学员',// name:'预约学员',//
}, },
{
key:14,
img:'../../static/image/qd.png',
name:'学员签到',// /
},
{ {
key:99, key:99,
img:'../../static/image/tc.png', img:'../../static/image/tc.png',
@ -348,16 +360,25 @@
uni.stopPullDownRefresh() uni.stopPullDownRefresh()
},500); },500);
}, },
// onTabItemTap(){
// console.log('socketonTabItemTap');
// // WebSocket
// uni.closeSocket();
// },
methods: { methods: {
ifview(value){ ifview(value){
// ID103 104 105 107 // ID103 104 105 107
var str=false; var str=false;
var arrs= value.split(',');
this.roleId.forEach(item=>{ this.roleId.forEach(item=>{
if(item==value) arrs.forEach(cell=>{
if(item==cell)
{ {
str=true; str=true;
return true;
} }
}); });
});
return str; return str;
}, },
gotoHome(){ gotoHome(){
@ -491,9 +512,13 @@
else if(ii==13){ else if(ii==13){
// - // -
uni.navigateTo({ uni.navigateTo({
url: `/pages/book/booktshop` url: `/pages/book/bookshop`
}); });
} }
else if(ii==14){
//
this.scando();
}
else if(ii==99){ else if(ii==99){
// 退 // 退
uni.showModal({ uni.showModal({
@ -580,6 +605,44 @@
}); });
} }
}, },
//
scando(){
var _this=this;
//
//qrCode,barCode
// #ifdef APP-PLUS
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
console.log(res);
console.log('条码类型:' + res.scanType);
console.log('条码内容:' + res.result);
//
var rmbm=res.result;
console.log(rmbm);
if(rmbm){
//
uni.navigateTo({
url: `/pages/book/bookinfo?id=${rmbm}&type=qd`
});
}
else{
uni.showModal({
title: '提示',
content: '扫码异常,请正确扫码绑定推广员!',
cancelText: '取消',
confirmText: '确定',
success: ress => {
if (ress.confirm) {
}
}
});
}
}
});
// #endif
},
async logoff(){ async logoff(){
uni.showLoading({ uni.showLoading({
title: '账号注销中...' title: '账号注销中...'
@ -946,7 +1009,7 @@
height: 32rpx; height: 32rpx;
line-height: 32rpx; line-height: 32rpx;
padding: 0 2rpx; padding: 0 2rpx;
border-radius: 50% 50%; border-radius: 32rpx;
background-color: #ff0000; background-color: #ff0000;
color: #FFF; color: #FFF;
font-size: 22rpx; font-size: 22rpx;

@ -307,18 +307,6 @@
this.tabCurrentIndex = current; this.tabCurrentIndex = current;
this.loadData(); this.loadData();
}, },
//
gototeacher(item){
var data={
id:item.id,
name:"教练A"
}
//
var data=encodeURIComponent(JSON.stringify(data));
uni.navigateTo({
url: `/pages/teacher/chat?data=${data}`
})
},
reset(){ reset(){
this.orderlists=[]; this.orderlists=[];
// //

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 911 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 912 B

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 960 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.
Loading…
Cancel
Save