| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202 |
- <template>
- <view class="content">
- <view class="service-header">
- <view class="tips">欢迎来到奥莱优品</view>
- <view class="title">需要一点帮助?</view>
- <view class="tips">售前、售后问题,随时为您解答</view>
- </view>
- <scroll-view class="service-body" scroll-y scroll-with-animation>
- <view class="body-list">
- <view class="title">
- <view class="title-tips">Message center</view>
- <view class="name">聊天列表</view>
- </view>
- <view class="empty-chat" v-if="dataList.length == 0">
- <view class="imgs">
- <image src="/static/image/empty.png" mode="widthFix"></image>
- <view class="tip">通过首页、订单、商品中可发起客服咨询</view>
- </view>
- <view class="re-btn" @click="toHome" v-if="isLogin">去下单</view>
- <view class="re-btn" @click="toLogin" v-else>立即登录</view>
- </view>
- <view class="list-service" v-else>
- <view class="service-item" @click="toChat" v-for="(item,index) in dataList" :key="index">
- <view class="avatar"><image :src="item.avatar"></image></view>
- <view class="info">
- <view class="name">{{ item.poi_name }}</view>
- <view class="desc" v-if="item.last.type=='text'">{{item.last.content}}</view>
- <view class="desc" v-if="item.last.type=='order'">[订单消息]</view>
- <view class="desc" v-if="item.last.type=='image'">[图片消息]</view>
- <view class="desc" v-if="item.last.type=='video'">[视频消息]</view>
- <view class="desc" v-if="item.last.type=='pay'">[支付消息]</view>
- <view class="desc" v-if="item.last.type=='address'">[地址消息]</view>
- </view>
- <view class="time">{{ item.last.create_at }}</view>
- </view>
- </view>
- </view>
- </scroll-view>
- <halfLogin ref="loginCom" @success="loginSuccess"></halfLogin>
- </view>
- </template>
- <script>
- var app;
- export default {
- data() {
- return {
- dataList:[],
- isLogin:true,
- userState:1
- }
- },
- onLoad() {
- app = this;
- app.getService()
- },
- methods: {
- loginSuccess(){
- app.getService()
- },
- toLogin(){
- app.$refs.loginCom.open(1);
- },
- async getService(){
- var formData = {};
- formData.page = 1;
- formData.size = 100;
- const tokenPoi = uni.getStorageSync("contact");
- formData.poi = tokenPoi.poi_id;
- var res = await app.$api.chat.list.get(formData);
- uni.hideLoading();
- if (res.code == 401) {
- app.isLogin = false;
- return ;
- }
- if (res.code == 0) {
- return app.$dialog.showSuccess(res.msg);
- }
- app.isLogin = true;
- app.dataList = res.data.data.rows;
- app.userState = res.data.user;
- },
- toChat(){
- if (app.userState == 0) {
- app.$refs.loginCom.open(2);
- return ;
- }
- uni.navigateTo({
- url:"/pages/service/chat"
- })
- },
- toHome(){
- uni.switchTab({
- url:"/pages/index/index"
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .content{
- position: fixed;
- z-index: 1;
- top: 0;
- left: 0;
- bottom: 0;
- right: 0;
- background-color: #ededed;
- display: flex;
- flex-direction: column;
- }
- .empty-chat{
- display: flex;align-items: center;justify-content: center;flex-direction: column;
- height: 50vh;
- .imgs{
- text-align: center;font-size: 28upx;color: #666;
- image{height: 160upx;width: 160upx;}
- .tip{margin-top: 20upx;}
- }
- .re-btn{
- width: 180upx;
- height: 80upx;
- line-height: 80upx;
- text-align: center;
- font-size: 28upx;
- color: #fff;
- background-color: $main-color;
- border-radius: 10upx;
- margin-top: 60upx;
- }
- }
- .service-header{
- background-color: $main-color;
- padding: 20rpx;
- .tips{
- color: $main-sub-color;
- font-size: 28rpx;line-height: 48rpx;
- }
- .title{
- font-size: 46rpx;
- color: #fff;
- font-weight: 900;
- margin: 10rpx 0;
- }
- }
- .service-body{
- height: 0;
- flex: 1;
- .body-list{
- width: 95%;
- margin: 20rpx auto;
- .title {
- .title-tips{
- color: $main-color;
- font-weight: 700;
- font-size: 24rpx;
- text-transform: uppercase;
- }
- .name {
- font-size: 38rpx;
- color: #333;
- font-weight: 900;
- }
- }
- .list-service {
- .service-item{
- display: flex;
- align-items: center;
- background-color: #fff;
- border-radius: 20rpx;
- margin-top: 20rpx;
- padding: 20rpx;
- gap: 20rpx;
- image {
- width: 100rpx;
- height: 100rpx;
- border-radius: 10rpx;
- border: 2rpx solid #f8f8f8;
- }
- .name {
- font-size: 32rpx;
- font-weight: 600;
- color: #333;
- }
- .desc {
- color: $main-text-color;
- font-size: 26rpx;
- margin-top: 10rpx;
- }
- .time {
- margin-left: auto;
- margin-right: 0;
- color: $main-text-color;
- font-size: 26rpx;
- }
- }
- }
- }
- }
- </style>
|