|
@@ -25,9 +25,10 @@
|
|
|
<image :src="item.content" class="msg-img" mode="widthFix"></image>
|
|
|
</view>
|
|
|
<!-- 商品 -->
|
|
|
- <view class="message img" v-else-if="item.msg_type =='2'">
|
|
|
+ <view class="message img" v-else-if="item.msg_type =='2'" @tap="toView(item)">
|
|
|
<view class="msg-goods">
|
|
|
- <image :src="item.goodsInfo&&item.goodsInfo.file" class="image" mode="widthFix">
|
|
|
+ <image :src="item.goodsInfo&&item.goodsInfo.file" class="image"
|
|
|
+ mode="scaleToFill">
|
|
|
</image>
|
|
|
<view class="goods_1">
|
|
|
<view class="name textOver">{{item.goodsInfo&&item.goodsInfo.name}}</view>
|
|
@@ -45,15 +46,36 @@
|
|
|
<text class="label" v-for="(tag,index) in item.goodsInfo.act"
|
|
|
:key="index">{{tag}}</text>
|
|
|
</view>
|
|
|
- <view class="button" @tap="toSend(item)" v-if="item.is_send=='0'">
|
|
|
+ <view class="button" @tap.stop="toSend(item)" v-if="item.is_send=='0'">
|
|
|
<text>发送连接</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
<!-- 订单 -->
|
|
|
- <view class="message img" v-else-if="item.msg_type =='3'">
|
|
|
- <view class="msg-text">{{item.content}}</view>
|
|
|
+ <view class="message img" v-else-if="item.msg_type =='3'" @tap="toView(item)">
|
|
|
+ <view class="msg-order">
|
|
|
+ <view class="order_1">
|
|
|
+ <view class="image" v-for="(tago,index) in item.ordernfo.goods"
|
|
|
+ :key="index">
|
|
|
+ <image v-if="tago.file.length>0" :src="tago.file&&tago.file[0].url"
|
|
|
+ class="image" mode="scaleToFill">
|
|
|
+ </image>
|
|
|
+ <image v-else :src="tago.goods&&tago.goods.file[0].url" class="image"
|
|
|
+ mode="scaleToFill">
|
|
|
+ </image>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="order_2">
|
|
|
+ <view class="no">订单号:{{item.ordernfo.no}}</view>
|
|
|
+ <view class="status">
|
|
|
+ <text>{{item.ordernfo.status}}</text>
|
|
|
+ <view class="button" @tap.stop="toSend(item)" v-if="item.is_send=='0'">
|
|
|
+ <text>发送连接</text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="msg-m msg-right" v-else-if="item.speaker == user._id">
|
|
@@ -69,9 +91,10 @@
|
|
|
<image :src="item.content" class="msg-img" mode="widthFix"></image>
|
|
|
</view>
|
|
|
<!-- 商品 -->
|
|
|
- <view class="message img" v-else-if="item.msg_type =='2'">
|
|
|
+ <view class="message img" v-else-if="item.msg_type =='2'" @tap="toView(item)">
|
|
|
<view class="msg-goods">
|
|
|
- <image :src="item.goodsInfo&&item.goodsInfo.file" class="image" mode="widthFix">
|
|
|
+ <image :src="item.goodsInfo&&item.goodsInfo.file" class="image"
|
|
|
+ mode="scaleToFill">
|
|
|
</image>
|
|
|
<view class="goods_1">
|
|
|
<view class="name textOver">{{item.goodsInfo&&item.goodsInfo.name}}</view>
|
|
@@ -89,15 +112,36 @@
|
|
|
<text class="label" v-for="(tag,index) in item.goodsInfo.act"
|
|
|
:key="index">{{tag}}</text>
|
|
|
</view>
|
|
|
- <view class="button" @tap="toSend(item)" v-if="item.is_send=='0'">
|
|
|
+ <view class="button" @tap.stop="toSend(item)" v-if="item.is_send=='0'">
|
|
|
<text>发送连接</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
<!-- 订单 -->
|
|
|
- <view class="message img" v-else-if="item.msg_type =='3'">
|
|
|
- <view class="msg-text">{{item.content}}</view>
|
|
|
+ <view class="message img" v-else-if="item.msg_type =='3'" @tap="toView(item)">
|
|
|
+ <view class="msg-order">
|
|
|
+ <view class="order_1">
|
|
|
+ <view class="images" v-for="(tago,index) in item.ordernfo.goods"
|
|
|
+ :key="index">
|
|
|
+ <image v-if="tago.file.length>0" :src="tago.file&&tago.file[0].url"
|
|
|
+ class="image" mode="scaleToFill">
|
|
|
+ </image>
|
|
|
+ <image v-else :src="tago.goods&&tago.goods.file[0].url" class="image"
|
|
|
+ mode="scaleToFill">
|
|
|
+ </image>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="order_2">
|
|
|
+ <view class="no">订单号:{{item.ordernfo.no}}</view>
|
|
|
+ <view class="status">
|
|
|
+ <text>{{item.ordernfo.status}}</text>
|
|
|
+ <view class="button" @tap.stop="toSend(item)" v-if="item.is_send=='0'">
|
|
|
+ <text>发送连接</text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -105,18 +149,38 @@
|
|
|
</scroll-view>
|
|
|
</view>
|
|
|
<view class="two">
|
|
|
- <submit_1 @inputs="inputs" @heights="heights"></submit_1>
|
|
|
+ <submit_1 @inputs="inputs" @heights="heights" @sendGoods="sendGoods" @sendOrder="sendOrder"></submit_1>
|
|
|
</view>
|
|
|
</view>
|
|
|
+ <!-- 规格 -->
|
|
|
+ <uni-popup ref="specShow" background-color="#fff" type="bottom" :is-mask-click="false">
|
|
|
+ <view class="popup">
|
|
|
+ <view class="close">
|
|
|
+ <text @click="toClose" class="iconfont icon-shanchu"></text>
|
|
|
+ </view>
|
|
|
+ <view class="info_1" v-if="popupShow=='1'">
|
|
|
+ <goods_1 :marketList="list" @toPage="toPage" @toSend="toGoods"></goods_1>
|
|
|
+ </view>
|
|
|
+ <view class="info_1" v-else-if="popupShow=='2'">
|
|
|
+ <order_1 :tabs="tabs" :status="status" :orderList="list" @toPage="toPage" @toSend="toOrder"
|
|
|
+ @tabsChange="tabsChange">
|
|
|
+ </order_1>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </uni-popup>
|
|
|
</mobile-frame>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import moment from 'moment';
|
|
|
import submit_1 from './components/submit_1.vue';
|
|
|
+ import goods_1 from './components/goods_1.vue';
|
|
|
+ import order_1 from './components/order_1.vue';
|
|
|
export default {
|
|
|
components: {
|
|
|
submit_1,
|
|
|
+ goods_1,
|
|
|
+ order_1,
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
@@ -133,21 +197,33 @@
|
|
|
statusList: [],
|
|
|
// 历史记录
|
|
|
msgList: [],
|
|
|
+ // 订单列表
|
|
|
+ list: [],
|
|
|
+ status: '0',
|
|
|
+ tabs: {
|
|
|
+ active: '0',
|
|
|
+ menu: []
|
|
|
+ },
|
|
|
+ // 聊天记录
|
|
|
total: 0,
|
|
|
skip: 0,
|
|
|
- limit: 10,
|
|
|
+ limit: 6,
|
|
|
page: 0,
|
|
|
// 判断是否跳到最后一条
|
|
|
is_bottom: true,
|
|
|
// 判断是否下拉刷新复位
|
|
|
triggered: false,
|
|
|
scrollToView: '', //滑动最后一条信息
|
|
|
+ // 规格弹框
|
|
|
+ popupShow: '1',
|
|
|
};
|
|
|
},
|
|
|
onShow: async function() {
|
|
|
const that = this;
|
|
|
- that.clearPage();
|
|
|
- if (that.id) await that.search()
|
|
|
+ if (that.id) {
|
|
|
+ await that.clearPage();
|
|
|
+ await that.search()
|
|
|
+ }
|
|
|
await that.searchOther();
|
|
|
},
|
|
|
onLoad: async function(e) {
|
|
@@ -179,8 +255,11 @@
|
|
|
success: async function(res) {
|
|
|
let user = that.$jwt(res.data);
|
|
|
if (user) {
|
|
|
- let res;
|
|
|
-
|
|
|
+ // 查询状态
|
|
|
+ let arr = await that.$api(`/dictData`, 'GET', {
|
|
|
+ code: 'order_process'
|
|
|
+ })
|
|
|
+ if (arr.errcode == '0') that.$set(that, `statusList`, arr.data);
|
|
|
that.$set(that, `user`, user)
|
|
|
}
|
|
|
}
|
|
@@ -190,6 +269,16 @@
|
|
|
async searchOther() {
|
|
|
const that = this;
|
|
|
let res;
|
|
|
+ let statusList = that.statusList.filter((i) => {
|
|
|
+ return i.value != '-2' && i.value != '-3';
|
|
|
+ });
|
|
|
+ var menu = statusList.map((item) => {
|
|
|
+ return {
|
|
|
+ title: item.label,
|
|
|
+ active: item.value
|
|
|
+ }
|
|
|
+ })
|
|
|
+ that.$set(that.tabs, `menu`, menu)
|
|
|
// 发送商品信息
|
|
|
if (that.goods && that.goods.goods) {
|
|
|
// 商品
|
|
@@ -221,7 +310,7 @@
|
|
|
"act": act
|
|
|
}
|
|
|
let data = {
|
|
|
- "_id": 'xx' + moment(new Date()).valueOf(),
|
|
|
+ "_id": 'goods' + moment(new Date()).valueOf(),
|
|
|
"speaker": that.user._id,
|
|
|
"content": that.goods.goods,
|
|
|
"goodsInfo": goodsInfo,
|
|
@@ -232,32 +321,32 @@
|
|
|
if (!that.id) data.shop = that.shop_id
|
|
|
else data.room = that.id
|
|
|
that.msgList.push(data);
|
|
|
- // 跳转到最后一条数据 与前面的:id进行对照
|
|
|
- // 如果是下拉刷新聊天记录不跳到最后一条
|
|
|
- if (that.is_bottom == true) that.goBottom();
|
|
|
}
|
|
|
} else if (that.goods && that.goods.order) {
|
|
|
// 订单
|
|
|
if (that.goods.status == '0') res = await that.$api(`/order/${that.goods.order}`)
|
|
|
else res = await that.$api(`/orderDetail/${that.goods.order}`);
|
|
|
if (res.errcode == '0') {
|
|
|
- // 查询状态
|
|
|
- let arr = await that.$api(`/dictData`, 'GET', {
|
|
|
- code: 'order_process'
|
|
|
- })
|
|
|
- if (arr.errcode == '0') that.$set(that, `statusList`, arr.data);
|
|
|
- let status = arr.data.find(i => i.value == res.data.status)
|
|
|
+ let status = that.statusList.find(i => i.value == res.data.status)
|
|
|
// 过滤店铺订单
|
|
|
let shop_goods;
|
|
|
- if (!that.id) shop_goods = res.data.goods.filter(i => i.shop == that.shop_id)
|
|
|
- else shop_goods = res.data.goods.filter(i => i.shop == that.shop._id)
|
|
|
+ if (that.goods.status != '0') {
|
|
|
+ // 已支付订单
|
|
|
+ shop_goods = res.data.goods
|
|
|
+ } else {
|
|
|
+ // 未支付订单
|
|
|
+ if (!that.id) shop_goods = res.data.goods.filter(i => i.shop == that.shop_id)
|
|
|
+ else shop_goods = res.data.goods.filter(i => i.shop == that.shop._id)
|
|
|
+ if (shop_goods.length > 0) shop_goods = shop_goods[0].goods
|
|
|
+ }
|
|
|
let ordernfo = {
|
|
|
"no": res.data && res.data.no,
|
|
|
"goods": shop_goods,
|
|
|
- "status": status.label || '暂无'
|
|
|
+ "status": status.label || '暂无',
|
|
|
+ "is_status": res.data.status
|
|
|
}
|
|
|
let data = {
|
|
|
- "_id": 'dd' + moment(new Date()).valueOf(),
|
|
|
+ "_id": 'order' + moment(new Date()).valueOf(),
|
|
|
"speaker": that.user._id,
|
|
|
"content": that.goods.order,
|
|
|
"ordernfo": ordernfo,
|
|
@@ -268,16 +357,33 @@
|
|
|
if (!that.id) data.shop = that.shop_id
|
|
|
else data.room = that.id
|
|
|
that.msgList.push(data);
|
|
|
- console.log(data);
|
|
|
- // 跳转到最后一条数据 与前面的:id进行对照
|
|
|
- // 如果是下拉刷新聊天记录不跳到最后一条
|
|
|
- if (that.is_bottom == true) that.goBottom();
|
|
|
}
|
|
|
}
|
|
|
+ // 跳转到最后一条数据 与前面的:id进行对照
|
|
|
+ // 如果是下拉刷新聊天记录不跳到最后一条
|
|
|
+ if (that.is_bottom == true) that.goBottom();
|
|
|
},
|
|
|
// 查询历史记录
|
|
|
async search() {
|
|
|
const that = this;
|
|
|
+ // 查询房间信息
|
|
|
+ // 如果是下拉刷新聊天记录不请求房间信息
|
|
|
+ if (that.is_bottom == true) {
|
|
|
+ res = await that.$api(`/room/${that.id}`, `GET`, {}, 'chat')
|
|
|
+ if (res.errcode == '0') {
|
|
|
+ that.$set(that, `shop`, res.data && res.data.shop);
|
|
|
+ if (res.data && res.data.shop && res.data.shop.name) {
|
|
|
+ uni.setNavigationBarTitle({
|
|
|
+ title: res.data.shop.name
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ title: res.errmsg,
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
let info = {
|
|
|
skip: that.skip,
|
|
|
limit: that.limit,
|
|
@@ -292,6 +398,7 @@
|
|
|
msgList.sort(function(a, b) {
|
|
|
return a.time > b.time ? 1 : -1;
|
|
|
});
|
|
|
+ that.$set(that, `total`, res.total)
|
|
|
for (let val of msgList) {
|
|
|
if (val.msg_type == '2') {
|
|
|
// 商品
|
|
@@ -326,34 +433,40 @@
|
|
|
val.goodsInfo = goodsInfo
|
|
|
val.is_send = '1'
|
|
|
}
|
|
|
+ } else if (val.msg_type == '3') {
|
|
|
+ // 订单
|
|
|
+ res = await that.$api(`/viewOrder/getOrder/${val.content}`)
|
|
|
+ if (res.errcode == '0') {
|
|
|
+ let status = that.statusList.find(i => i.value == res.data.status)
|
|
|
+ // 过滤店铺订单
|
|
|
+ let shop_goods;
|
|
|
+ if (res.data.status != '0') {
|
|
|
+ // 已支付订单
|
|
|
+ shop_goods = res.data.goods
|
|
|
+ } else {
|
|
|
+ // 未支付订单
|
|
|
+ if (!that.id) shop_goods = res.data.goods.filter(i => i.shop == that.shop_id)
|
|
|
+ else shop_goods = res.data.goods.filter(i => i.shop == that.shop._id)
|
|
|
+ if (shop_goods.length > 0) shop_goods = shop_goods[0].goods
|
|
|
+ }
|
|
|
+ let ordernfo = {
|
|
|
+ "no": res.data && res.data.no,
|
|
|
+ "goods": shop_goods,
|
|
|
+ "status": status.label || '暂无',
|
|
|
+ "is_status": res.data.status
|
|
|
+ }
|
|
|
+ val.ordernfo = ordernfo
|
|
|
+ val.is_send = '1'
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
that.$set(that, `msgList`, msgList);
|
|
|
- that.$set(that, `total`, res.total)
|
|
|
} else {
|
|
|
uni.showToast({
|
|
|
title: res.errmsg,
|
|
|
icon: 'none'
|
|
|
})
|
|
|
}
|
|
|
- // 查询房间信息
|
|
|
- // 如果是下拉刷新聊天记录不请求房间信息
|
|
|
- if (that.is_bottom == true) {
|
|
|
- res = await that.$api(`/room/${that.id}`, `GET`, {}, 'chat')
|
|
|
- if (res.errcode == '0') {
|
|
|
- that.$set(that, `shop`, res.data && res.data.shop);
|
|
|
- if (res.data && res.data.shop && res.data.shop.name) {
|
|
|
- uni.setNavigationBarTitle({
|
|
|
- title: res.data.shop.name
|
|
|
- });
|
|
|
- }
|
|
|
- } else {
|
|
|
- uni.showToast({
|
|
|
- title: res.errmsg,
|
|
|
- icon: 'none'
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
let id = that.msgList.filter(i => {
|
|
|
if (i.speaker != that.user._id) return i.is_read = '0';
|
|
|
})
|
|
@@ -399,7 +512,6 @@
|
|
|
if (user._id) {
|
|
|
//时间间隔处理
|
|
|
let data = {
|
|
|
- "room": that.id,
|
|
|
"speaker": user._id,
|
|
|
"content": e.message,
|
|
|
"time": moment().format('YYYY-MM-DD HH:mm:ss'),
|
|
@@ -407,11 +519,10 @@
|
|
|
};
|
|
|
// 发送给服务器消息
|
|
|
if (!that.id) data.shop = that.shop_id
|
|
|
+ else data.room = that.id
|
|
|
let res = await that.$api(`/chatRecord`, `POST`, data, 'chat');
|
|
|
if (res.errcode == '0') {
|
|
|
that.msgList.push(res.data);
|
|
|
- // 发送websocket
|
|
|
- that.$store.dispatch('websocketSend', res.data)
|
|
|
} else {
|
|
|
uni.showToast({
|
|
|
title: res.errmsg,
|
|
@@ -452,6 +563,236 @@
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
+ // 发送商品
|
|
|
+ async sendGoods() {
|
|
|
+ const that = this;
|
|
|
+ let res;
|
|
|
+ let info = {
|
|
|
+ skip: that.skip,
|
|
|
+ limit: that.limit,
|
|
|
+ shop: that.shop._id || that.shop_id
|
|
|
+ };
|
|
|
+ // 首页产品列表
|
|
|
+ res = await that.$api(`/viewGoods/indexGoodsList`, `GET`, {
|
|
|
+ ...info
|
|
|
+ });
|
|
|
+ if (res.errcode == '0') {
|
|
|
+ let list = [...that.list, ...res.data];
|
|
|
+ that.$set(that, `list`, list);
|
|
|
+ that.$set(that, `total`, res.total)
|
|
|
+ that.$set(that, `popupShow`, '1')
|
|
|
+ that.$refs.specShow.open();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 发送商品
|
|
|
+ async toGoods(e) {
|
|
|
+ const that = this;
|
|
|
+ let user = that.user
|
|
|
+ if (user._id) {
|
|
|
+ let res;
|
|
|
+ // 商品
|
|
|
+ res = await that.$api(`/viewGoods/goodsDetail`, `POST`, {
|
|
|
+ id: e._id
|
|
|
+ });
|
|
|
+ if (res.errcode == '0') {
|
|
|
+ let indexSpecs;
|
|
|
+ // 显示最低价格的规格信息,不考虑库存问题
|
|
|
+ if (res.data.specs && res.data.specs.length > 0) {
|
|
|
+ // 规格排序
|
|
|
+ indexSpecs = res.data.specs.sort(function(a, b) {
|
|
|
+ let i, j;
|
|
|
+ if (a.price) i = 'price'
|
|
|
+ else i = 'sell_money'
|
|
|
+ if (b.price) j = 'price'
|
|
|
+ else j = 'sell_money'
|
|
|
+ return a[i] - b[j];
|
|
|
+ })
|
|
|
+ }
|
|
|
+ let act = res.data.act.map(i => {
|
|
|
+ return i.tag
|
|
|
+ })
|
|
|
+ let goodsInfo = {
|
|
|
+ "file": res.data && res.data.goods && res.data.goods.file && res.data.goods
|
|
|
+ .file[0]
|
|
|
+ .url,
|
|
|
+ "name": res.data && res.data.goods && res.data.goods.name,
|
|
|
+ "spec": indexSpecs[0],
|
|
|
+ "act": act,
|
|
|
+ }
|
|
|
+ //时间间隔处理
|
|
|
+ let data = {
|
|
|
+ "speaker": user._id,
|
|
|
+ "content": e._id,
|
|
|
+ "time": moment().format('YYYY-MM-DD HH:mm:ss'),
|
|
|
+ "msg_type": '2',
|
|
|
+ };
|
|
|
+ if (!that.id) data.shop = that.shop_id
|
|
|
+ else data.room = that.id
|
|
|
+ res = await that.$api(`/chatRecord`, `POST`, data, 'chat');
|
|
|
+ if (res.errcode == '0') {
|
|
|
+ res.data.goodsInfo = goodsInfo
|
|
|
+ res.data.is_send = '1'
|
|
|
+ that.msgList.push(res.data);
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ title: res.errmsg,
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 跳转到最后一条数据 与前面的:id进行对照
|
|
|
+ that.goBottom();
|
|
|
+ that.toClose();
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ title: '未登录账号无法发送消息 ,请及时登录!',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 分页
|
|
|
+ toPage(e) {
|
|
|
+ const that = this;
|
|
|
+ let list = that.list;
|
|
|
+ let limit = that.limit;
|
|
|
+ if (that.total > list.length) {
|
|
|
+ uni.showLoading({
|
|
|
+ title: '加载中',
|
|
|
+ mask: true
|
|
|
+ })
|
|
|
+ let page = that.page + 1;
|
|
|
+ that.$set(that, `page`, page)
|
|
|
+ let skip = page * limit;
|
|
|
+ that.$set(that, `skip`, skip)
|
|
|
+ if (that.popupShow == '1') that.sendGoods();
|
|
|
+ else that.sendOrder();
|
|
|
+ uni.hideLoading();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 发送订单
|
|
|
+ async sendOrder() {
|
|
|
+ const that = this;
|
|
|
+ let user = that.user;
|
|
|
+ let status = that.status;
|
|
|
+ let info = {
|
|
|
+ skip: that.skip,
|
|
|
+ limit: that.limit,
|
|
|
+ customer: user._id,
|
|
|
+ shop: that.shop._id || that.shop_id,
|
|
|
+ status: status
|
|
|
+ }
|
|
|
+ let res;
|
|
|
+ if (status == '0') {
|
|
|
+ res = await that.$api(`/order`, 'GET', {
|
|
|
+ ...info,
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ res = await that.$api(`/orderDetail`, 'GET', {
|
|
|
+ ...info,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (res.errcode == '0') {
|
|
|
+ let list = [...that.list, ...res.data];
|
|
|
+ for (let val of list) {
|
|
|
+ val.zhStatus = that.searchStatus(val.status)
|
|
|
+ }
|
|
|
+ that.$set(that, `list`, list);
|
|
|
+ that.$set(that, `total`, res.total)
|
|
|
+ that.$set(that, `popupShow`, '2')
|
|
|
+ that.$refs.specShow.open();
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ title: res.errmsg,
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 发送订单
|
|
|
+ async toOrder(e) {
|
|
|
+ const that = this;
|
|
|
+ let user = that.user
|
|
|
+ if (user._id) {
|
|
|
+ let res;
|
|
|
+ // 订单
|
|
|
+ if (e.status == '0') res = await that.$api(`/order/${e._id}`)
|
|
|
+ else res = await that.$api(`/orderDetail/${e._id}`);
|
|
|
+ if (res.errcode == '0') {
|
|
|
+ let status = that.statusList.find(i => i.value == res.data.status)
|
|
|
+ // 过滤店铺订单
|
|
|
+ let shop_goods;
|
|
|
+ if (e.status != '0') {
|
|
|
+ // 已支付订单
|
|
|
+ shop_goods = res.data.goods
|
|
|
+ } else {
|
|
|
+ // 未支付订单
|
|
|
+ if (!that.id) shop_goods = res.data.goods.filter(i => i.shop == that.shop_id)
|
|
|
+ else shop_goods = res.data.goods.filter(i => i.shop == that.shop._id)
|
|
|
+ if (shop_goods.length > 0) shop_goods = shop_goods[0].goods
|
|
|
+ }
|
|
|
+ let ordernfo = {
|
|
|
+ "no": res.data && res.data.no,
|
|
|
+ "goods": shop_goods,
|
|
|
+ "status": status.label || '暂无',
|
|
|
+ "is_status": res.data.status
|
|
|
+ }
|
|
|
+ //时间间隔处理
|
|
|
+ let data = {
|
|
|
+ "speaker": user._id,
|
|
|
+ "content": e._id,
|
|
|
+ "time": moment().format('YYYY-MM-DD HH:mm:ss'),
|
|
|
+ "msg_type": '3',
|
|
|
+ };
|
|
|
+ if (!that.id) data.shop = that.shop_id
|
|
|
+ else data.room = that.id
|
|
|
+ res = await that.$api(`/chatRecord`, `POST`, data, 'chat');
|
|
|
+ if (res.errcode == '0') {
|
|
|
+ res.data.ordernfo = ordernfo
|
|
|
+ res.data.is_send = '1'
|
|
|
+ that.msgList.push(res.data);
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ title: res.errmsg,
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 跳转到最后一条数据 与前面的:id进行对照
|
|
|
+ that.goBottom();
|
|
|
+ that.toClose();
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ title: '未登录账号无法发送消息 ,请及时登录!',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 查询状态
|
|
|
+ searchStatus(e) {
|
|
|
+ const that = this;
|
|
|
+ let data = that.statusList.find((i) => i.value == e);
|
|
|
+ if (data) return data.label
|
|
|
+ else return '暂无'
|
|
|
+ },
|
|
|
+ // 选择选项卡
|
|
|
+ tabsChange(e) {
|
|
|
+ const that = this;
|
|
|
+ that.$set(that.tabs, `active`, e.active)
|
|
|
+ that.$set(that, `status`, e.active);
|
|
|
+ that.$set(that, `list`, [])
|
|
|
+ that.$set(that, `skip`, 0)
|
|
|
+ that.$set(that, `limit`, 6)
|
|
|
+ that.$set(that, `page`, 0)
|
|
|
+ that.sendOrder()
|
|
|
+ },
|
|
|
+ // 关闭弹框
|
|
|
+ toClose() {
|
|
|
+ const that = this;
|
|
|
+ that.$refs.specShow.close();
|
|
|
+ that.$set(that, `list`, [])
|
|
|
+ that.$set(that, `skip`, 0)
|
|
|
+ that.$set(that, `limit`, 6)
|
|
|
+ that.$set(that, `page`, 0)
|
|
|
+ },
|
|
|
// 店铺
|
|
|
toShop() {
|
|
|
const that = this;
|
|
@@ -460,13 +801,28 @@
|
|
|
url: `/pagesHome/shop/index?id=${id}`
|
|
|
})
|
|
|
},
|
|
|
+ // 查看详情
|
|
|
+ toView(e) {
|
|
|
+ const that = this;
|
|
|
+ if (e.msg_type == '2') {
|
|
|
+ let id = e.content;
|
|
|
+ uni.navigateTo({
|
|
|
+ url: `/pagesHome/order/detail?id=${id}`
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ let status = e.ordernfo.is_status;
|
|
|
+ uni.navigateTo({
|
|
|
+ url: `/pagesMy/order/index?status=${status}`
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
//输入框高度
|
|
|
heights(e) {
|
|
|
const that = this;
|
|
|
that.goBottom();
|
|
|
},
|
|
|
// 滚动到底部
|
|
|
- goBottom() {
|
|
|
+ async goBottom() {
|
|
|
const that = this;
|
|
|
that.scrollToView = '';
|
|
|
let lastItem = that.msgList.at(-1);
|
|
@@ -478,10 +834,10 @@
|
|
|
getFresh(e) {
|
|
|
const that = this;
|
|
|
that.triggered = true;
|
|
|
- let list = that.msgList;
|
|
|
+ let msgList = that.msgList;
|
|
|
let limit = that.limit;
|
|
|
setTimeout(() => {
|
|
|
- if (that.total > list.length) {
|
|
|
+ if (that.total > msgList.length) {
|
|
|
uni.showLoading({
|
|
|
title: '加载中',
|
|
|
mask: true
|
|
@@ -506,7 +862,7 @@
|
|
|
const that = this;
|
|
|
that.$set(that, `msgList`, [])
|
|
|
that.$set(that, `skip`, 0)
|
|
|
- that.$set(that, `limit`, 10)
|
|
|
+ that.$set(that, `limit`, 6)
|
|
|
that.$set(that, `page`, 0)
|
|
|
},
|
|
|
}
|
|
@@ -647,6 +1003,60 @@
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ .msg-order {
|
|
|
+ width: 460rpx;
|
|
|
+ padding: 20rpx 10rpx;
|
|
|
+ background-color: #f0f0f0;
|
|
|
+ border-radius: 10rpx;
|
|
|
+
|
|
|
+ .order_1 {
|
|
|
+ display: flex;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ margin: 10rpx 0;
|
|
|
+
|
|
|
+ .image {
|
|
|
+ width: 100rpx;
|
|
|
+ height: 100rpx;
|
|
|
+ border-radius: 10rpx;
|
|
|
+ margin: 0 5rpx 0 0;
|
|
|
+ border: 1rpx solid #858585;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .order_2 {
|
|
|
+ margin: 10rpx 0;
|
|
|
+
|
|
|
+ .no {
|
|
|
+ font-size: 12px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .status {
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ margin: 5rpx 0;
|
|
|
+
|
|
|
+ text {
|
|
|
+ padding: 1rpx 2rpx;
|
|
|
+ border-radius: 5px;
|
|
|
+ font-size: 12px;
|
|
|
+ color: #ff0000;
|
|
|
+ }
|
|
|
+
|
|
|
+ .button {
|
|
|
+ text-align: right;
|
|
|
+
|
|
|
+ text {
|
|
|
+ font-size: 12px;
|
|
|
+ padding: 10rpx;
|
|
|
+ border-radius: 10rpx;
|
|
|
+ color: #FF4500;
|
|
|
+ background-color: #FFF8DC;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
.msg-left {
|
|
@@ -688,6 +1098,29 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ .uni-popup {
|
|
|
+ z-index: 9999 !important;
|
|
|
+ }
|
|
|
+
|
|
|
+ .popup {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ width: 100vw;
|
|
|
+ height: 80vh;
|
|
|
+
|
|
|
+ .close {
|
|
|
+ text-align: right;
|
|
|
+ padding: 2vw;
|
|
|
+ }
|
|
|
+
|
|
|
+ .info_1 {
|
|
|
+ position: relative;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ height: 74vh;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
.scroll-view {
|
|
|
position: absolute;
|
|
|
top: 0;
|