| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930 |
- <template>
- <view>
- <view class="flex_c page" @touchmove="touchmove">
- <scroll-view class="flex1 scroll-Y" @tap.stop="onPage" id="scroll-view" lower-threshold="100" scroll-y
- scroll-with-animation :scroll-top="scroll_top" @scroll="scroll" @scrolltoupper="scrolltoupper"
- @scrolltolower="scrolltolower">
- <view class="scroll-view-str" :style="{height: `${reserveHeight}px`}" v-if="reserveHeight>0"></view>
- <view class="messageList_">
- <template v-for="(item, index) in history.messages">
- <!-- #ifdef APP || H5 -->
- <view class="z_index2" :class="`oneheight_${index}`" style="transform: rotate(-180deg)"
- :key="item.messageId + index" v-if="!item.isHide">
- <view class="icon_ text_26 color__ time">
- {{ renderMessageDate(item, index) }}
- </view>
- <view :key="item.messageId + index" v-if="!item.recalled">
- <item :isMy="isSelf(item.senderId)" :myid="myid" :item="item" @onClick="onItem"
- @onLongpress="onLongpress" @mention="mention" @imgLoad="imgLoad"></item>
- </view>
- <view class="icon_ text_26 recalled" v-else>
- <view class="">
- <text v-if="isSelf(item.senderId)">你</text>
- <text v-else>{{ item.senderData.name }}</text>
- 撤回了一条消息
- </view>
- <view class="recalled-edit" v-if="item.type === 'text' && isSelf(item.senderId)"
- @click="recalledEdit(item)">重新编辑</view>
- </view>
- </view>
- <!-- #endif -->
- <!-- #ifdef MP -->
- <view class="z_index2" style="transform: rotate(-180deg)" :key="item.messageId"
- v-if="!item.isHide">
- <view class="icon_ text_26 color__ time">
- {{ renderMessageDate(item, index) }}
- </view>
- <view :key="item.messageIds" v-if="!item.recalled">
- <item :isMy="isSelf(item.senderId)" :myid="myid" :item="item" @onClick="onItem"
- @onLongpress="onLongpress" @mention="mention"></item>
- </view>
- <view class="icon_ text_26 recalled" v-else>
- <view class="">
- <text v-if="isSelf(item.senderId)">你</text>
- <text v-else>{{ item.senderData.name }}</text>
- 撤回了一条消息
- </view>
- <view class="recalled-edit" v-if="item.type === 'text' && isSelf(item.senderId)"
- @click="recalledEdit(item)">重新编辑</view>
- </view>
- </view>
- <!-- #endif -->
- </template>
- </view>
- </scroll-view>
- <view class="bottomOperationRef">
- <view class="bottom-btn-group">
- <!-- <view class="btn-item">
- <image src="https://jymini.oss-cn-guangzhou.aliyuncs.com/mini/star.svg"></image>
- <view class="name">评价服务</view>
- </view> -->
- <view class="btn-item" @click="showOrder(1)">
- <image src="https://jymini.oss-cn-guangzhou.aliyuncs.com/mini/order.svg"></image>
- <view class="name">我的订单</view>
- </view>
- </view>
- <view class="bottom-operation-box">
- <view class="input-text">
- <textarea class="input" placeholder="输入点什么呢..." auto-height="true" confirm-type="send" type="text" :focus="isFocus"
- :maxlength="-1" :adjust-position="false" v-model="text" confirm-hold
- :show-confirm-bar="false" @input="input" @confirm="sendingText" @focus="focus"
- @blur="blured" @keyboardheightchange="keyboardheightchange" />
- </view>
- <view class="check-img">
- <view class="check-icon" @click="tapEmoji"><image src="@/static/image/face.svg" mode="aspectFill"></image></view>
- <view class="check-icon" @click="tapMore"><image src="@/static/image/more.svg" mode="aspectFill"></image></view>
- </view>
- </view>
- <view class="safe-box"></view>
- <view class="keyboardheight" :style="{ height: keyboardHeight + 'px' }"></view>
- </view>
-
-
- <view>
- <emoji v-model="isEmoji" @onEmoji="onEmoji" @deleteFn="deleteFn" @sendingText="sendingText"
- @sendingEmojiPack="sendingEmojiPack"></emoji>
- </view>
- <view>
- <more v-model="isMore" @onMore="onMore"></more>
- </view>
-
- </view>
-
- <uni-popup ref="addresspopup" type="bottom" border-radius="10px 10px 0 0" background-color="#ffffff" :mask-click="false">
- <view class="order-popup">
- <view class="order-title">
- <view class="name">补充收货地址</view>
- <view class="close" @click="showAddress(2)"><image src="/static/image/close.png"></image></view>
- </view>
- <view class="order-body">
- <view class="form-feedbak">
- <view class="title"><text>*</text>收件人</view>
- <view class="form-textarea">
- <input v-model="addressForm.nickname" placeholder="请输入" class="u-input" />
- </view>
- </view>
- <view class="form-feedbak">
- <view class="title"><text>*</text>手机号码</view>
- <view class="form-textarea">
- <input v-model="addressForm.mobile" placeholder="请填写手机号码" class="u-input" />
- </view>
- </view>
- <view class="form-feedbak">
- <view class="title"><text>*</text>所属地区</view>
- <view class="form-textarea">
- <uni-data-picker placeholder="请选择地址" popup-title="请选择城市" :localdata="cityData" @change="addressChange" @nodeclick="addressChange">
- </uni-data-picker>
- </view>
- </view>
- <view class="form-feedbak">
- <view class="title"><text>*</text>详细地址</view>
- <view class="form-textarea">
- <input v-model="addressForm.address" placeholder="请输入" class="u-input" />
- </view>
- </view>
- <view class="submit-btn">
- <button class="btn" @click="submitForm" :loading="submitState" :disabled="submitState">{{submitState?'提交中':'提交'}}</button>
- </view>
- </view>
- </view>
- </uni-popup>
-
- <uni-popup ref="orderpopup" type="bottom" border-radius="10px 10px 0 0" background-color="#ffffff" :mask-click="false">
- <view class="order-popup">
- <view class="order-title">
- <view class="name">我的订单</view>
- <view class="close" @click="showOrder(2)"><image src="/static/image/close.png"></image></view>
- </view>
- <view class="order-body" v-if="orderData.length > 0">
- <view class="m-order-s" v-for="(items,index) in orderData" :key="index">
- <view class="order-img"><image :src="items.img" mode="widthFix"></image></view>
- <view class="order-info">
- <view class="title">{{items.product.product_name}}</view>
- <view class="desc">{{items.out_order_no}}</view>
- <view class="price">{{ $dialog.formatMoney(items.price,true) }}</view>
- </view>
- <view class="status-btn-group">
- <view class="status danger" @click="sendOrder(items)">发送</view>
- <view class="status info" v-if="items.status=='0'">未支付</view>
- <view class="status primary" v-if="items.status=='1'">待使用</view>
- <view class="status success" v-if="items.status=='2'">已完成</view>
- <view class="status danger" v-if="items.status=='3'">已退款</view>
- <view class="status warn" v-if="items.status=='4'">退款中</view>
- <view class="status info" v-if="items.status=='5'">已关闭</view>
- </view>
- </view>
- </view>
- <view class="order-body" v-else>
- <view class="empty-body">暂无数据...</view>
- </view>
- </view>
- </uni-popup>
- </view>
- </template>
- <script>
- var app;
- let getSelectedTextRangeSetInterval = null;
- let inputValue = '';
- let cursor = 0; //输入框光标
- let scroll_top = 0;
- import emoji from '@/components/bottom-operation/emoji.vue';
- import more from '@/components/bottom-operation/more.vue';
- import item from '@/components/item/index';
- // 浏览照片数组
- let imageList = [];
- // 是否是手动触发的列表滑动
- let isBottomOperationScrollToBottom = false;
- import {
- show,
- formatDate,
- throttle,
- openimg,
- getLocation,
- to as tofn
- } from '@/utils/index.js';
- import {
- mapState
- } from 'vuex';
- var {Push} = require("@/static/js/push.js")
- import * as Api from "@/static/api/service.js";
- import form from "@/static/js/form.js";
- export default {
- components: {
- emoji,
- more,
- item
- },
- data() {
- return {
- submitState:false,
- serviceId:null, // 客服ID
- reserveHeight:0,
- isFocus: false, //键盘焦点
- isEmoji:false,
- isMore:false,
- keyboardHeight:0,
- optionsData:null,
- testData:null,
- text:"",
- // 历史数据
- history: {
- messages: [],
- allLoaded: false
- },
- showOrderState:false,
- storeData:null,
- sendId:null,
- myid:"",
- pushObj:null,
- wsAuth:"https://tran.jsshuita.cn/plugin/webman/push/auth",
- wsUrl: 'wss://tran.jsshuita.cn/ws',
- page:2,
- size:10,
- orderPage:1,
- orderData:[],
- noService:false,
- addressData:null,
- addressForm:{},
- cityData:[]
- }
- },
- computed: mapState({
- //显示时间
- renderMessageDate() {
- return (message, index) => {
- if (message.timestamp - this.history.messages[index + 1]?.timestamp > 3 * 60 * 1000) {
- return formatDate(message.timestamp, 'timestamp');
- }
- return '';
- };
- },
- // 是否本人isMy
- isSelf() {
- return (senderId) => {
- const {
- member_id = this.myid
- } = {"member_id":this.myid};
- return senderId === `${member_id}`;
- };
- },
- }),
- onLoad(options) {
- var app = this;
- app.optionsData = options;
- uni.setNavigationBarTitle({
- title:"加载中..."
- });
- app.getService(options)
- },
- beforeDestroy() {
- cursor = 0;
- this.pushObj.disconnect()
- },
- onPageScroll(e) {
- // this.$refs.bottomOperationRef.closeAll();
- },
- onReady() {
- // this.videoPlayer.context = uni.createVideoContext('videoPlayer', this);
- },
- methods: {
- initPush(){
- var _this = this;
- this.pushObj = new Push({
- "url":this.wsUrl,
- "app_key":"265c33b73d5c04f918978577df2c48d2",
- "auth":this.wsAuth
- });
- var user_channel = this.pushObj.subscribe('user-' + this.myid);
- user_channel.on('message', function (data) {
- // console.log(data);
- _this.formatMsg(data);
- })
- },
- addressChange(data){
- if (data.detail) {
- this.addressForm.city = JSON.stringify(data.detail.value);
- }
- },
- submitForm(){
- var formData = this.addressForm;
- var validation = form.validation(formData,[
- {name:"nickname",rule:["required"],msg:["请输入"]},
- {name:"mobile",rule:["required","isMobile"],msg:["请填写手机号码","手机号码格式错误"]},
- {name:"city",rule:["required"],msg:["请选择地区"]},
- {name:"address",rule:["required"],msg:["请输入"]},
- ]);
- if(validation){
- this.$dialog.showSuccess(validation);
- return false;
- }
- formData.order = JSON.stringify(this.addressData);
- this.submitState = true;
- Api.address(formData).then((res)=>{
- if (res.code == 0) {
- return this.$dialog.showSuccess(res.msg);
- }
- this.$dialog.showSuccess(res.msg);
- this.showAddress(2)
- return
- })
- },
- imgLoad(data){},
- onItem(data,index){
- switch(data.type) {
- case "address":
- var order = data.payload.address;
- order.msgId = data.messageId;
- this.addressData = order;
- Api.city().then((res)=>{
- this.cityData = res.data;
- this.showAddress(1)
- })
- break;
- case "order":
- var order = data.payload.order;
- break;
- case "image":
- uni.previewImage({
- urls:[data.payload.url]
- })
- break;
- case "pay":
- var payInfo = data.payload.pay;
- if (payInfo.status == 1) {
- return this.$dialog.showSuccess("已完成支付")
- }
- uni.showLoading({
- title:"发起中..."
- })
- Api.pricePay({order:payInfo.order}).then((res)=>{
- uni.hideLoading()
- if (res.code == 0) {
- return app.$dialog.showSuccess(res.msg)
- }
- uni.requestPayment({
- orderInfo:res.data.pay,
- service:5,
- success(resp){
- if (resp.code == 0) { // res.code=0时,才表示支付成功
- app.$dialog.showSuccess("支付成功","none",function(){
- app.getService(app.optionsData)
- });
- }
- },
- fail(resp) {
- app.$dialog.showSuccess("支付失败,可再次重试","none");
- }
- })
- })
- break;
- default:
- break;
- }
- },
- onLongpress(data){
-
- },
- // 滚动中
- scroll(e) {
- scroll_top = e.detail.scrollTop;
- // this.$refs.operateRef.close();
- if (isBottomOperationScrollToBottom) return;
- // this.$refs.bottomOperationRef.closeAll();
- },
- // 滚动到底部
- scrolltolower() {
- if (this.history.allLoaded) return;
- console.log('触底')
- this.getMoreMsg()
- // this.loadHistoryMessage();
- },
- // 滚动到顶部
- scrolltoupper() {
- console.log('滚动到顶部')
- },
- showAddress(type){
- if (type == 2) {
- this.$refs.addresspopup.close()
- return ;
- }
- this.$refs.addresspopup.open()
- },
- showOrder(type){
- if (type == 2) {
- this.$refs.orderpopup.close()
- return ;
- }
- Api.order({"size":this.size,"page":this.orderPage}).then((res)=>{
- if (res.code == 0) {
- return this.$dialog.showSuccess(res.msg)
- }
- this.orderData = this.orderData.concat(res.data.rows);
- this.$refs.orderpopup.open()
- this.orderPage = res.data.page + 1;
- })
- },
- getMoreMsg(){
- this.history.allLoaded = true;
- var formData = this.optionsData;
- formData.page = this.page;
- Api.msg(formData).then((res)=>{
- if(res.code == 0) {
- return this.$dialog.showSuccess(res.msg)
- }
- if (res.data.rows.length > 0) {
- this.page ++;
- var msgData = []
- var list = res.data.rows
-
- // 同步混入数据
- list.forEach((item, ix) => {
- var payload = {};
- if (item.type == 'text') {
- payload.text = item.content
- }
- if (item.type == 'order') {
- var order = JSON.parse(item.content)
- payload.order = order
- }
- if (item.type == 'pay') {
- var order = JSON.parse(item.content)
- payload.pay = order
- }
- if (item.type == 'address') {
- var order = JSON.parse(item.content)
- payload.address = order
- }
- if (item.type == 'image') {
- payload = {
- contentType: 'image/png',
- name: 'uni-image.png',
- size: 82942,
- url: item.content,
- width: 2732,
- height: 2732,
- thumbnail: item.content
- };
- }
- const message = {
- groupId: item.poi_id,
- senderData: {
- avatar:item.avatar
- },
- senderId: (item.source==1?item.openid:item.service_id),
- messageId: item.msgId,
- payload: payload,
- timestamp: item.time,
- type: item.type,
- recalled: false,
- status: 'success',
- isHide: 0
- };
- msgData[ix] = message
- });
- // console.log(msgData)
- // 模拟只有少量数据
- // this.history.messages = [list[0],list[1],list[2]];
- this.history.messages = [...this.history.messages, ...msgData];
- this.history.allLoaded = false;
- // if (this.history.messages.length > 20) return;
- // msgData.forEach((item,index)=>{
- // this.formatMsg(item);
- // })
- } else {
- this.history.allLoaded = true;
- }
- })
- },
- getService(options){
- Api.shareout(options).then((res)=>{
- if (res.code && res.code == 0) {
- return app.$dialog.showSuccess(res.msg)
- }
- console.log(res.data)
- uni.setNavigationBarTitle({
- title:"与"+res.data.store.poi_name+"对话中"
- })
- this.storeData = res.data.store;
- this.sendId = res.data.sendId;
- this.serviceId = res.data.serviceId;
- this.myid = res.data.sendId;
- if (res.data.msg.rows.length > 0) {
- var msgData = res.data.msg.rows
- msgData.forEach((item,index)=>{
- this.formatMsg(item);
- })
- }
- if (res.data.code == 3) { // 无客服在线
- this.noService = true;
- this.emptyService()
- }
- this.initPush()
- })
- },
- emptyService(){
- const message = {
- groupId: this.storeData.poi_id,
- senderData: {
- avatar:"https://washmy.oss-cn-guangzhou.aliyuncs.com/storage/20260511/23627b2cb8f73a8a90b95c31d726e6ecad0cbb9a.png"
- },
- senderId: this.serviceId,
- messageId: Date.now(),
- payload: {
- text:"当前无客服在线"
- },
- timestamp: Date.now(),
- type: "text",
- recalled: false,
- status: 'success',
- isHide: 0
- };
- this.pushList(message);
- },
- formatMsg(item){
- var payload = {};
- if (item.type == 'text') {
- payload.text = item.content
- }
- if (item.type == 'order') {
- var order = JSON.parse(item.content)
- payload.order = order
- }
- if (item.type == 'pay') {
- var order = JSON.parse(item.content)
- payload.pay = order
- }
- if (item.type == 'address') {
- var order = JSON.parse(item.content)
- payload.address = order
- }
- if (item.type == 'image') {
- payload = {
- contentType: 'image/png',
- name: 'uni-image.png',
- size: 82942,
- url: item.content,
- width: 2732,
- height: 2732,
- thumbnail: item.content
- };
- }
- const message = {
- groupId: item.poi_id,
- senderData: {
- avatar:item.avatar
- },
- senderId: (item.source==1?item.openid:item.service_id),
- messageId: item.msgId,
- payload: payload,
- timestamp: item.time,
- type: item.type,
- recalled: false,
- status: 'success',
- isHide: 0
- };
- this.pushList(message);
- },
- // 更多操作相关===============
- onMore(item) {
- // console.log(item)
- switch (item.type) {
- case 'img':
- this.sendImageMessage();
- break;
- case 'video':
- this.sendVideoMessage();
- break;
- case 'order':
- this.showOrder(1);
- break;
- }
- },
- sendOrder(items){
- var orderData = {};
- orderData.img = items.img;
- orderData.name = items.product.product_name;
- orderData.goods_id = items.life_goods_id;
- orderData.order = items.out_order_no;
- orderData.price = (parseInt(items.pay_money) / 100).toFixed(2);
- orderData.status = items.status;
- Api.send({type:"order",content: JSON.stringify(orderData),sendId: this.serviceId,groupId: this.storeData.poi_id}).then((res)=>{
- if (res.code == 0) {
- return this.$dialog.showSuccess(res.msg)
- }
- this.showOrder(2);
- this.sendMessage({
- payload: {
- order: orderData
- },
- type: 'order'
- });
- })
- },
- // 创建发送照片内容
- sendImageMessage() {
- uni.chooseImage({
- count: 1,
- sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
- success: async (res) => {
- res.tempFiles.forEach((file) => {
- console.log(file);
- this.createImageMessage(file);
- });
- },
- fail(e) {
- console.log("选择失败",e)
- }
- });
- },
- // 创建发送照片内容
- createImageMessage(file) {
- Api.upload(file.path,{type:"image",sendId: this.serviceId,groupId: this.storeData.poi_id}).then((res)=>{
- var respData = JSON.parse(res);
- if (respData.code == 0) {
- return this.$dialog.showSuccess(respData.msg)
- }
- this.sendMessage({
- payload: {
- contentType: 'image/png',
- name: 'uni-image.png',
- size: 82942,
- url: respData.data.path,
- width: 2732,
- height: 2732,
- thumbnail: respData.data.path
- },
- type: 'image'
- });
- })
- },
- // 创建发送视频内容
- sendVideoMessage() {
- uni.chooseVideo({
- success: async (res) => {
- console.log(res);
- this.createVideoMessage(res);
- }
- });
- },
- createVideoMessage(file) {
- this.sendMessage({
- payload: {
- video: {
- name: '3003009356267921_uni-video.mp4',
- url: file.tempFilePath,
- width: 640,
- height: 352,
- contentType: 'video/mp4',
- size: 501774,
- duration: 8.32
- },
- thumbnail: {
- name: 'uni-thumbnail.jpg',
- url: '封面路径',
- width: 364,
- height: 200,
- contentType: 'image/jpg'
- }
- },
- type: 'video'
- });
- },
- sendMessage({payload,type}){
- const message = {
- groupId: this.storeData.poi_id,
- senderData: {},
- senderId: this.sendId,
- messageId: Date.now(),
- payload: payload,
- timestamp: Date.now(),
- type: type,
- recalled: false,
- status: 'success',
- isHide: 0
- };
- this.pushList(message);
- },
- // 组装item
- initMessageItem(message, index) {
- message['isHide'] = 0;
- if (index === 0 && (message.type === 'text' || message.type === 'text_quote')) {
- this.onSetText(message.payload.text);
- }
- },
- // 文本触发效果相关========
- onSetText(text) {
- // 触发礼花
- throttle(() => {
- if (text.includes('[彩带]')) {
- this.$refs.mScreenAnimationLihua.show();
- uni.vibrateLong();
- }
- }, 4000);
- },
- sendingEmojiPack(){
-
- },
- // 删除表情
- deleteFn() {
- const str = this.text.charAt(this.text.length - 1);
- if (str === ']') {
- let metaChars = /\[.*?(\u4e00*\u597d*)\]/g;
- let xstr = '';
- this.text.replace(metaChars, (match) => {
- xstr = match;
- });
- var text = this.text;
- function del(str) {
- return text.slice(0, text.length - str.length);
- }
- this.text = del(xstr);
- } else {
- this.text = this.text.substring(0, this.text.length - 1);
- }
- },
- onEmoji(key) {
- const text = `${this.text.slice(0, cursor)}${key}${this.text.slice(cursor)}`;
- this.text = text;
- },
- tapEmoji() {
- this.isEmoji = !this.isEmoji;
- if (this.isEmoji) {
- this.isKeyboard = true;
- }
- this.isMore = false;
- },
- tapMore() {
- this.isMore = !this.isMore;
- this.isEmoji = false;
- },
- touchmove(){
- this.isFocus = false;
- this.isFocisEmojius = false;
- this.isMore = false;
- this.isKeyboard = false;
- this.keyboardHeight = 0
- },
- onPage(){},
- // 监听输入
- input() {
- // if (inputValue.length > this.text.length) {} else {
- // const str = this.text.charAt(this.text.length - 1);
- // }
- // inputValue = this.text;
- },
- blured(){
- this.isFocus = false;
- this.keyboardHeight = 0
- },
- // 获取焦点
- focus(e) {
- this.testData = JSON.stringify(e.detail);
- this.isFocus = true;
- this.isEmoji = false;
- this.isMore = false;
- this.keyboardHeight = (e.detail.height==100)?0:e.detail.height
- },
- keyboardheightchange(e){
- // app.$dialog.showSuccess('asdasdasd')
- console.log(e)
- },
- sendingText() {
- if (this.text === '')
- return ;
- let body = this.text;
- if (this.text.length >= 50) {
- body = this.text.substring(0, 30) + '...';
- }
- Api.send({type:"text",content: this.text,sendId: this.serviceId,groupId: this.storeData.poi_id}).then((res)=>{
- if (res.code == 0) {
- return this.$dialog.showSuccess(res.msg)
- }
- this.sendMessage({
- payload: {
- text: this.text
- },
- type: 'text'
- });
- this.text = '';
- })
- },
- async pushList(message) {
- this.initMessageItem(message);
- this.history.messages.unshift(message);
- // 是否触发文字动效果
- if (message.type === 'text' || message.type === 'text_quote') {
- this.onSetText(message.payload.text);
- }
- // 缓存照片地址,
- if (message.type === 'image' || message.type === 'image_transmit') {
- imageList.push(message.payload.url);
- }
- },
-
- }
- }
- </script>
- <style lang="scss">
- @import '@/static/index.scss';
- .order-popup .order-title{display: flex;align-items: center;justify-content: space-between;font-size: 28upx;padding: 20upx;}
- .order-popup .order-title image{width: 40upx;height: 40upx;}
- .order-popup .order-body{height: 40vh;overflow: auto;padding: 20upx;}
- .submit-btn{
- background-color: #fff;
- border-radius: 20upx 0;
- padding: 20upx;
- }
- .submit-btn .btn{
- text-align: center;
- width: 100%;
- height: 80upx;
- line-height: 80upx;
- background-color: #956937;
- color: #fff;
- font-size: 30upx;
- border-radius: 40upx;
- }
- .form-feedbak{
- background-color: #fff;
- border-radius: 20upx;
- }
- .form-feedbak .title{
- line-height: 80upx;
- font-size: 28upx;
- }
- .form-feedbak .title text{
- color: #f00;
- margin-right: 10upx;
- }
- .form-feedbak .form-textarea{
- background-color: #f8f8f8;
- padding: 20upx;
- }
- .u-textarea{
- font-size: 24upx;
- }
- .u-input{
- font-size: 24upx;
- }
- .m-order-s{background-color: #f8f8f8;border-radius: 10upx;display: flex;font-size: 28upx;position: relative;margin-bottom: 20upx;}
- .m-order-s .order-img {display: flex;align-items: center;justify-content: center;}
- .m-order-s .order-img image{width: 150upx;height: 150upx;}
- .m-order-s .order-info {padding: 15upx;flex:1;overflow: hidden;}
- .m-order-s .order-info .title{font-size: 28upx;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;}
- .m-order-s .order-info .desc{font-size: 24upx;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;color: #999;}
- .m-order-s .order-info .price{font-size: 28upx;color: #f00;}
- .m-order-s .status-btn-group{position: absolute;right: 0;bottom: 0;display: flex;align-items: center;gap: 15upx;}
- .m-order-s .status{border-radius: 10upx 0 10upx 0;background-color: #909399;font-size: 24upx;color: #fff;padding: 10upx;}
- .m-order-s .status.info{background-color: #909399;}
- .m-order-s .status.primary{background-color: #409eff;}
- .m-order-s .status.success{background-color: #67c23a;}
- .m-order-s .status.danger{background-color: #f56c6c;}
- .m-order-s .status.warn{background-color: #e6a23c;}
- .bottomOperationRef{background-color: #f6f6f6;}
- .bottom-btn-group{display: flex;gap: 20upx;padding: 10rpx 14rpx;}
- .bottom-btn-group .btn-item{display: flex;align-items: center;gap: 10upx;font-size: 24upx;background-color: #f6f6f6;padding: 10rpx 14rpx;border-radius: 10upx;}
- .bottom-btn-group .btn-item image{width: 30upx;height: 30upx;}
- .bottom-operation-box{display: flex;padding: 20rpx 20rpx 0 20rpx;gap: 20rpx;align-items: flex-end;}
- .bottom-operation-box .check-img{display: flex;align-items: center;justify-content: center;}
- .bottom-operation-box .check-img .check-icon{width: 84rpx;height: 84rpx;display: flex;align-items: center;justify-content: center;}
- .bottom-operation-box .check-img image{width: 75%;height: 75%;}
- .bottom-operation-box .input-text{flex: 1;width: 100%;
- box-sizing: border-box;
- padding: 10rpx 14rpx;
- min-height: 84rpx;
- max-height: 300rpx;
- overflow: auto;
- border-radius: 10rpx;
- background-color: #fff}
- .bottom-operation-box .input{margin: 10rpx 0;width: 100%;font-size: 24upx;height: 100%;background-color: transparent;min-height: 48rpx;
- max-height: 300rpx;}
- .safe-box{width: 100%;height: env(safe-area-inset-bottom);background-color: #f6f6f6;}
- .page {
- position: fixed;
- z-index: 1;
- top: 0;
- left: 0;
- bottom: 0;
- right: 0;
- background-color: #ededed;
- }
- .scroll-Y {
- width: 100%;
- height: 0;
- transition: all 0.2s;
- transform: rotate(180deg);
- background-color: #ededed;
- padding: 20upx 0;
- ::-webkit-scrollbar {
- display: none;
- }
- }
- .scroll-view-str {
- width: 100%;
- }
- .time {
- width: 100%;
- color: #a3a3a3;
- line-height: 100rpx;
- }
- .recalled {
- width: 100%;
- height: 50rpx;
- margin: 20rpx 0;
- color: #a3a3a3;
- .recalled-edit {
- color: #5a6693;
- margin-left: 14rpx;
- }
- }
- </style>
|