mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-uniapp.git
synced 2025-12-18 08:25:55 +08:00
Merge branch 'master' of https://gitee.com/beijing_hongye_huicheng/lilishop-uniapp
This commit is contained in:
@@ -2,28 +2,63 @@
|
||||
<view class="b-content">
|
||||
<view class="navbar">
|
||||
<!-- 循环出头部tab栏 -->
|
||||
<view v-for="(item, index) in navList" :key="index" class="nav-item" @click="handleTabClick(index)"><text
|
||||
:class="{ current: tabCurrentIndex === index }">{{
|
||||
<view
|
||||
v-for="(item, index) in navList"
|
||||
:key="index"
|
||||
class="nav-item"
|
||||
@click="handleTabClick(index)"
|
||||
><text :class="{ current: tabCurrentIndex === index }">{{
|
||||
item.text
|
||||
}}</text></view>
|
||||
}}</text></view
|
||||
>
|
||||
</view>
|
||||
<swiper :current="tabCurrentIndex" class="swiper-box" duration="300" @change="changeTab">
|
||||
<swiper-item class="tab-content" v-for="(navItem, navIndex) in navList" :key="navIndex">
|
||||
<scroll-view class="list-scroll-content" scroll-y @scrolltolower="loadData">
|
||||
<swiper
|
||||
:current="tabCurrentIndex"
|
||||
class="swiper-box"
|
||||
duration="300"
|
||||
@change="changeTab"
|
||||
>
|
||||
<swiper-item
|
||||
class="tab-content"
|
||||
v-for="(navItem, navIndex) in navList"
|
||||
:key="navIndex"
|
||||
>
|
||||
<scroll-view
|
||||
class="list-scroll-content"
|
||||
scroll-y
|
||||
@scrolltolower="loadData"
|
||||
>
|
||||
<!-- 空白页 -->
|
||||
<u-empty mode="coupon" text="暂无优惠券了" v-if="navItem.wheterEmpty"></u-empty>
|
||||
<u-empty
|
||||
mode="coupon"
|
||||
text="暂无优惠券了"
|
||||
v-if="navItem.wheterEmpty"
|
||||
></u-empty>
|
||||
|
||||
<!-- 数据 -->
|
||||
<view v-if="navItem.dataList && coupon" class="coupon-item" :class="{ 'coupon-used': navIndex != 0 }"
|
||||
v-for="(coupon, index) in navItem.dataList" :key="index">
|
||||
<view
|
||||
v-if="navItem.dataList && coupon"
|
||||
class="coupon-item"
|
||||
:class="{ 'coupon-used': navIndex != 0 }"
|
||||
v-for="(coupon, index) in navItem.dataList"
|
||||
:key="index"
|
||||
>
|
||||
<view class="left">
|
||||
<view class="wave-line">
|
||||
<view class="wave" v-for="(item, index) in 12" :key="index"></view>
|
||||
<view
|
||||
class="wave"
|
||||
v-for="(item, index) in 12"
|
||||
:key="index"
|
||||
></view>
|
||||
</view>
|
||||
<view class="message">
|
||||
<view class="price" v-if="coupon.couponType == 'DISCOUNT'">{{ coupon.discount }}折</view>
|
||||
<view class="price" v-if="coupon.couponType == 'DISCOUNT'"
|
||||
>{{ coupon.discount }}折</view
|
||||
>
|
||||
<view class="price" v-else>{{ coupon.price }}元</view>
|
||||
<view class="sub-price">满{{ coupon.consumeThreshold | unitPrice }}可用</view>
|
||||
<view class="sub-price"
|
||||
>满{{ coupon.consumeThreshold | unitPrice }}可用</view
|
||||
>
|
||||
</view>
|
||||
<view class="circle circle-top"></view>
|
||||
<view class="circle circle-bottom"></view>
|
||||
@@ -31,27 +66,47 @@
|
||||
<view class="right" v-if="coupon">
|
||||
<view class="content">
|
||||
<view class="title-1">{{ coupon.title }}</view>
|
||||
<view class="title-2">使用平台:{{
|
||||
coupon.scopeType == 'ALL' && coupon.storeId == '0'
|
||||
<view class="title-2"
|
||||
>使用平台:{{
|
||||
coupon.scopeType == "ALL" && coupon.storeId == "0"
|
||||
? "全平台"
|
||||
: coupon.scopeType == "PORTION_CATEGORY"
|
||||
? "仅限品类"
|
||||
: coupon.storeName == 'platform' ? '全平台' :coupon.storeName+''
|
||||
}}使用</view>
|
||||
<view v-if="coupon.endTime">{{
|
||||
coupon.endTime
|
||||
}}</view>
|
||||
<view @click="couponDetail(coupon)">详细说明
|
||||
<u-icon style="float: right; margin-top: 10rpx" name="arrow-right"></u-icon>
|
||||
: coupon.storeName == "platform"
|
||||
? "全平台"
|
||||
: coupon.storeName + ""
|
||||
}}使用</view
|
||||
>
|
||||
<view v-if="coupon.endTime">{{ coupon.endTime }}</view>
|
||||
<view @click="couponDetail(coupon)"
|
||||
>详细说明
|
||||
<u-icon
|
||||
style="float: right; margin-top: 10rpx"
|
||||
name="arrow-right"
|
||||
></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="jiao-1" v-if="navIndex == 0">
|
||||
<text class="text-1">新到</text>
|
||||
<text class="text-2" v-if="coupon.used_status == 1">将过期</text>
|
||||
<text class="text-2" v-if="coupon.used_status == 1"
|
||||
>将过期</text
|
||||
>
|
||||
</view>
|
||||
<image class="no-icon" v-if="navIndex == 1" src="@/static/img/used.png"></image>
|
||||
<image class="no-icon" v-if="navIndex == 2" src="@/static/img/overdue.png"></image>
|
||||
<view class="receive" v-if="navIndex == 0" @click="useItNow(coupon)">
|
||||
<image
|
||||
class="no-icon"
|
||||
v-if="navIndex == 1"
|
||||
src="@/static/img/used.png"
|
||||
></image>
|
||||
<image
|
||||
class="no-icon"
|
||||
v-if="navIndex == 2"
|
||||
src="@/static/img/overdue.png"
|
||||
></image>
|
||||
<view
|
||||
class="receive"
|
||||
v-if="navIndex == 0"
|
||||
@click="useItNow(coupon)"
|
||||
>
|
||||
<text>立即</text><br />
|
||||
<text>使用</text>
|
||||
</view>
|
||||
@@ -116,7 +171,7 @@ export default {
|
||||
},
|
||||
|
||||
onShow() {
|
||||
this.navList[this.tabCurrentIndex].params.pageNumber = 1
|
||||
this.navList[this.tabCurrentIndex].params.pageNumber = 1;
|
||||
this.navList[this.tabCurrentIndex].dataList = [];
|
||||
this.getData();
|
||||
},
|
||||
@@ -188,15 +243,9 @@ export default {
|
||||
* 立即使用优惠券
|
||||
*/
|
||||
useItNow(item) {
|
||||
if (item.storeId && item.storeId!='0') {
|
||||
uni.navigateTo({
|
||||
url: `/pages/product/shopPage?id=${item.storeId}`,
|
||||
});
|
||||
} else {
|
||||
uni.switchTab({
|
||||
url: "/pages/navigation/search/searchPage",
|
||||
});
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: `/pages/navigation/search/searchPage?promotionsId=${item.couponId}&promotionType=COUPON`,
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<view class="wrapper">
|
||||
<u-navbar class="my-title" title-size="32" :title="toUser.name"></u-navbar>
|
||||
<u-navbar class="my-title" title-size="32" :title="toUser.name"></u-navbar>
|
||||
<!-- 空盒子用来防止消息过少时 拉起键盘会遮盖消息 -->
|
||||
<view :animation="anData" style="height:0;">
|
||||
</view>
|
||||
@@ -8,10 +8,9 @@
|
||||
<!-- 用来获取消息体高度 -->
|
||||
<view id="msgList">
|
||||
<!-- 消息 -->
|
||||
<view class="flex-column-start" v-if="msgList.length" v-for="(item, index) in msgList" :key="index">
|
||||
<view class="flex-column-start" v-if="msgList.length" v-for="(item, index) in msgList" :key="index">
|
||||
<view class="flex-row-start column-time">
|
||||
<view v-show="compareTime(index, item.createTime)" class="flex-row-start date-text"
|
||||
>
|
||||
<view v-show="compareTime(index, item.createTime)" class="flex-row-start date-text">
|
||||
</view>
|
||||
</view>
|
||||
<!-- 用户消息 头像可选加入-->
|
||||
@@ -20,97 +19,103 @@
|
||||
<view>
|
||||
<view class="user-name">{{ user.nickName }}</view>
|
||||
<view class="margin-left padding-chat bg-user-orang" style="border-radius: 35rpx; ">
|
||||
<text style="word-break: break-all;" v-if="item.messageType === 'MESSAGE'">{{ item.text }}</text>
|
||||
<!-- <view v-if="item.messageType == 'GOODS'">
|
||||
<text style="word-break: break-all;"
|
||||
v-if="item.messageType === 'MESSAGE' && !emojistwo.includes(item.text)">{{ item.text }}</text>
|
||||
<view v-if="item.messageType === 'MESSAGE' && emojistwo.includes(item.text)"
|
||||
v-html="textReplaceEmoji(item.text)"></view>
|
||||
<view v-if="item.messageType == 'GOODS'">
|
||||
<view class="goodsCard u-flex u-row-between u-p-b-0" style="width:100%;margin: 0 0; ">
|
||||
<view class="imagebox" @click="jumpGoodDelic">
|
||||
<view class="imagebox" @click="jumpGoodDelic(item)">
|
||||
<image class="image" :src="JSON.parse(item.text)['thumbnail']" mode="widthFix"></image>
|
||||
</view>
|
||||
<view class="goodsdesc" @click="jumpGoodDelic">
|
||||
<view class="goodsdesc" @click="jumpGoodDelic(item)">
|
||||
<view class="goodsdesc-name">
|
||||
<text class="goodsCard_goodNmae">{{
|
||||
JSON.parse(item.text)['goodsName']
|
||||
}}</text>
|
||||
JSON.parse(item.text)['goodsName']
|
||||
}}</text>
|
||||
</view>
|
||||
<view class="goodsdesc-rice" style="margin-top:10rpx; color: orange;"><text
|
||||
style="font-size:20rpx;">¥{{
|
||||
JSON.parse(item.text)['price']
|
||||
}}</text>
|
||||
JSON.parse(item.text)['price']
|
||||
}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
<!-- <view v-if="item.messageType === 'ORDER'">
|
||||
</view>
|
||||
<view v-if="item.messageType == 'ORDER'">
|
||||
<view class="orderSn">
|
||||
<text>订单号:{{ JSON.parse(item.text)['sn'] }}</text>
|
||||
<view class="oederList">
|
||||
<img style="height: 120rpx; width: 120rpx; margin-top: 15rpx;"
|
||||
:src="JSON.parse(item.text)['groupImages']" mode="widthFix" />
|
||||
<view class="groupNameOrTime">
|
||||
<text @click="linkTosOrders(JSON.parse(item.text)['sn'])">{{ JSON.parse(item.text)['groupName']
|
||||
}}</text>
|
||||
<view class="orderTime"> <text>{{ JSON.parse(item.text)['paymentTime'] }}</text></view>
|
||||
<text @click="linkTosOrders(item.text)">{{
|
||||
JSON.parse(item.text)['groupName']
|
||||
}}</text>
|
||||
<view class="orderTime">
|
||||
<text>{{ JSON.parse(item.text)['paymentTime'] }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<u-avatar :src="user.face" :text="user.face ? '' : user.name" bg-color="#DDDDDD"></u-avatar>
|
||||
<!-- <u-image class="chat-img margin-left" style="height: 100rpx;width: 100rpx;" shape="circle"
|
||||
:src="user.face || 'https://avatars.dicebear.com/api/initials/' + user.nickName + '.svg?fontSize=38'"
|
||||
mode="aspectFill"></u-image> -->
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<!-- 接收人消息 -->
|
||||
<view v-else class="flex-row-start margin-left margin-top one-show">
|
||||
<view class="chat-img flex-row-center">
|
||||
<u-avatar :src="toUser.face" :text="toUser.face ? '' : toUser.name" bg-color="#DDDDDD"></u-avatar>
|
||||
<!-- <u-image style="height: 100rpx;width: 100rpx;" shape="circle"
|
||||
:src="toUser.face || 'https://avatars.dicebear.com/api/initials/' + toUser.name + '.svg?fontSize=38'"
|
||||
mode="aspectFit"></u-image> -->
|
||||
<u-avatar :src="toUser.face" :text="toUser.face ? '' : toUser.name" bg-color="#DDDDDD">
|
||||
</u-avatar>
|
||||
</view>
|
||||
<view class="flex" style="width: 500rpx;">
|
||||
<view>
|
||||
<view class="other-name">{{ toUser.name }}</view>
|
||||
<view class="margin-left padding-chat flex-column-start bg-to-color" style="border-radius: 35rpx;">
|
||||
<text style="word-break: break-all;" v-if="item.messageType === 'MESSAGE'">{{ item.text }}</text>
|
||||
<text style="word-break: break-all;"
|
||||
v-if="item.messageType === 'MESSAGE' && !emojistwo.includes(item.text)">{{ item.text }}</text>
|
||||
<view v-if="item.messageType === 'MESSAGE' && emojistwo.includes(item.text)"
|
||||
v-html="textReplaceEmoji(item.text)"></view>
|
||||
<view v-if="item.messageType === 'GOODS'">
|
||||
<!-- <view class="goodsCard u-flex u-row-between u-p-b-0" style="width:100%;margin: 0 0; ">
|
||||
<view class="imagebox" @click="jumpGoodDelic">
|
||||
<view class="goodsCard u-flex u-row-between u-p-b-0" style="width:100%;margin: 0 0; ">
|
||||
<view class="imagebox" @click="jumpGoodDelic(item)">
|
||||
<image class="image" :src="JSON.parse(item.text)['thumbnail']" mode="widthFix"></image>
|
||||
</view>
|
||||
<view class="goodsdesc" @click="jumpGoodDelic">
|
||||
<view class="goodsdesc" @click="jumpGoodDelic(item)">
|
||||
<view class="goodsdesc-name">
|
||||
<text class="goodsCard_goodNmae">{{
|
||||
JSON.parse(item.text)['goodsName']
|
||||
}}</text>
|
||||
JSON.parse(item.text)['goodsName']
|
||||
}}</text>
|
||||
</view>
|
||||
<view class="goodsdesc-rice" style="margin-top:10rpx; color: orange;"><text
|
||||
style="font-size:20rpx;">¥{{
|
||||
JSON.parse(item.text)['price']
|
||||
}}</text>
|
||||
JSON.parse(item.text)['price']
|
||||
}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view v-if="item.messageType === 'ORDER'">
|
||||
<view v-if="item.messageType === 'ORDER'">
|
||||
<view class="orderSn">
|
||||
<text>订单号:{{ JSON.parse(item.text)['sn'] }}</text>
|
||||
<view class="oederList">
|
||||
<img style="height: 120rpx; width: 120rpx; margin-top: 15rpx;"
|
||||
:src="JSON.parse(item.text)['groupImages']" mode="widthFix" />
|
||||
<view class="groupNameOrTime">
|
||||
<text @click="linkTosOrders(JSON.parse(item.text)['sn'])">{{ JSON.parse(item.text)['groupName']
|
||||
}}</text>
|
||||
<view class="orderTime"> <text>{{ JSON.parse(item.text)['paymentTime'] }}</text></view>
|
||||
<text @click="linkTosOrders(item.text)">{{
|
||||
JSON.parse(item.text)['groupName']
|
||||
}}</text>
|
||||
<view class="orderTime">
|
||||
<text>{{ JSON.parse(item.text)['paymentTime'] }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -122,18 +127,18 @@
|
||||
:style="{ position: msgList.length == 0 ? 'fixed' : '', bottom: msgList.length == 0 ? '50px' : '', width: msgList.length == 0 ? '100%' : '' }">
|
||||
<view class="cartMessage" v-if="showHide && !localImGoodsId && showHideModel">
|
||||
<view class="goodsCard u-flex u-row-between u-p-b-0">
|
||||
<view class="imagebox" @click="jumpGoodDelic">
|
||||
<view class="imagebox" @click="jumpGoodDelic(item)">
|
||||
<image class="image" :src="goodListData.thumbnail" mode="widthFix"></image>
|
||||
</view>
|
||||
<view class="goodsdesc" @click="jumpGoodDelic">
|
||||
<view class="goodsdesc" @click="jumpGoodDelic(item)">
|
||||
<view class="goodsdesc-name">
|
||||
<text class="goodsCard_goodNmae">{{
|
||||
goodListData.goodsName
|
||||
}}</text>
|
||||
goodListData.goodsName
|
||||
}}</text>
|
||||
</view>
|
||||
<view class="goodsdesc-rice" style="margin-top:10rpx; color: orange;"><text style="font-size:20rpx;">¥{{
|
||||
goodListData.price
|
||||
}}</text>
|
||||
goodListData.price
|
||||
}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="cancel" @click="cancelModel">X</view>
|
||||
@@ -151,9 +156,9 @@
|
||||
<view class="flex" style="width: 500rpx;">
|
||||
<view class="margin-left padding-chat flex-column-start"
|
||||
style="border-radius: 35rpx;background-color: #f9f9f9;">
|
||||
<view class="cuIcon-loading turn-load" style="font-size: 35rpx;color: #3e9982;">
|
||||
<!-- <view class="cuIcon-loading turn-load" style="font-size: 35rpx;color: #3e9982;">
|
||||
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -194,20 +199,38 @@ var l
|
||||
var wh
|
||||
// 顶部空盒子的高度
|
||||
var mgUpHeight
|
||||
import { getTalkMessage, getTalkByUser, jumpObtain } from "@/api/im.js";
|
||||
import {
|
||||
getTalkMessage,
|
||||
getTalkByUser,
|
||||
jumpObtain
|
||||
} from "@/api/im.js";
|
||||
import SocketService from "@/utils/socket_service.js";
|
||||
import storage from "@/utils/storage.js";
|
||||
import { beautifyTime } from "@/utils/filters.js"
|
||||
import {
|
||||
beautifyTime
|
||||
} from "@/utils/filters.js"
|
||||
import config from '@/config/config.js'
|
||||
import { textReplaceEmoji, emojistwo } from '@/utils/emojis.js';
|
||||
export default {
|
||||
// 页面卸载后清除imGoodId
|
||||
onUnload () {
|
||||
storage.setImGoodsLink('')
|
||||
// #ifdef H5
|
||||
uni.setStorageSync("imGoodId", '');
|
||||
// #endif
|
||||
|
||||
if (this.socketOpen == true) {
|
||||
uni.closeSocket();
|
||||
}
|
||||
},
|
||||
onLoad (options) {
|
||||
console.log(5555555555555555);
|
||||
console.log(emojistwo);
|
||||
// 没有goodsid则不显示 发送商品弹窗
|
||||
this.showHideModel = options.goodsid
|
||||
// 发送后刷新页面不显示 发送商品弹窗 local里面imGoodId不为空显示
|
||||
this.localImGoodsId = storage.getImGoodsLink()
|
||||
// #ifdef H5
|
||||
this.localImGoodsId = uni.getStorageSync("imGoodId");
|
||||
// #endif
|
||||
this.resolve = options
|
||||
// 请求商品信息
|
||||
if (this.resolve.goodsid) {
|
||||
@@ -249,8 +272,10 @@ export default {
|
||||
|
||||
}
|
||||
|
||||
this.ws.connect();
|
||||
// this.ws.connect();
|
||||
this.sokcet();
|
||||
},
|
||||
|
||||
onPullDownRefresh () {
|
||||
this.params.pageNumber = this.params.pageNumber + 1
|
||||
this.getTalkMessage()
|
||||
@@ -261,6 +286,9 @@ export default {
|
||||
|
||||
data () {
|
||||
return {
|
||||
textReplaceEmoji,
|
||||
emojistwo,
|
||||
socketOpen: false, //是否连接
|
||||
storage,
|
||||
fixed: 'fixed',
|
||||
bottom: '50px',
|
||||
@@ -273,7 +301,7 @@ export default {
|
||||
animationData: {},
|
||||
msgList: [],
|
||||
oldHeight: 0,
|
||||
params: { //搜索条件
|
||||
params: { //搜索条件
|
||||
talkId: '',
|
||||
pageSize: 10,
|
||||
pageNumber: 1,
|
||||
@@ -290,38 +318,54 @@ export default {
|
||||
goodListData: {}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'ws.callBackMapping': {
|
||||
handler: function (val) {
|
||||
val = JSON.parse(val)
|
||||
if (val.messageResultType == 'MESSAGE') {
|
||||
this.msgList.push(val.result)
|
||||
}
|
||||
this.newMessageNum++;
|
||||
//接收到消息后发送已读
|
||||
let msg = val
|
||||
msg.operation_type = 'READ'
|
||||
this.ws.send(JSON.stringify(msg))
|
||||
}
|
||||
}
|
||||
},
|
||||
// watch: {
|
||||
// 'ws.callBackMapping': {
|
||||
// handler: function (val) {
|
||||
// val = JSON.parse(val)
|
||||
// if (val.messageResultType == 'MESSAGE') {
|
||||
// this.msgList.push(val.result)
|
||||
// }
|
||||
// this.newMessageNum++;
|
||||
// //接收到消息后发送已读
|
||||
// let msg = val
|
||||
// msg.operation_type = 'READ'
|
||||
// this.ws.send(JSON.stringify(msg))
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
methods: {
|
||||
beautifyTime,
|
||||
//订单详情
|
||||
linkTosOrders (val) {
|
||||
console.log(val);
|
||||
uni.navigateTo({
|
||||
url: '/pages/order/orderDetail?sn=' + val,
|
||||
});
|
||||
|
||||
sendMessage () {
|
||||
if (this.msg == "") {
|
||||
return 0;
|
||||
}
|
||||
if (this.socketOpen == false) {
|
||||
return
|
||||
}
|
||||
let msg = {
|
||||
operation_type: "MESSAGE",
|
||||
to: this.toUser.userId,
|
||||
from: this.user.id,
|
||||
message_type: "MESSAGE",
|
||||
context: this.msg,
|
||||
talk_id: this.params.talkId,
|
||||
}
|
||||
let data = JSON.stringify(msg);
|
||||
try {
|
||||
uni.sendSocketMessage({
|
||||
data: data
|
||||
});
|
||||
this.msgList.push({
|
||||
"text": this.msg,
|
||||
"my": true,
|
||||
"messageType": 'MESSAGE'
|
||||
})
|
||||
let type = 'down';
|
||||
this.msgGo(type)
|
||||
this.msg = ""
|
||||
} catch (e) {
|
||||
uni.closeSocket();
|
||||
}
|
||||
},
|
||||
// 跳转商品详情页
|
||||
jumpGoodDelic () {
|
||||
uni.navigateTo({
|
||||
url: `/pages/product/goods?id=${this.resolve.skuid}&goodsId=${this.resolve.goodsid}`,
|
||||
});
|
||||
},
|
||||
//发送商品
|
||||
sendGoodsMessage () {
|
||||
let msg = {
|
||||
operation_type: "MESSAGE",
|
||||
@@ -331,19 +375,101 @@ export default {
|
||||
context: this.goodListData,
|
||||
talk_id: this.params.talkId,
|
||||
}
|
||||
this.ws.send(JSON.stringify(msg))
|
||||
this.msgList.push({ "text": JSON.stringify(this.goodListData), "my": true, "messageType": 'GOODS' })
|
||||
let data = JSON.stringify(msg);
|
||||
uni.sendSocketMessage({
|
||||
data: data
|
||||
});
|
||||
this.msgList.push({
|
||||
"text": JSON.stringify(this.goodListData),
|
||||
"my": true,
|
||||
"messageType": 'GOODS'
|
||||
})
|
||||
this.showHide = false
|
||||
storage.setImGoodsLink(this.params.talkId)
|
||||
//成功发送商品连接后,滚动到底部
|
||||
// #ifdef H5
|
||||
uni.setStorageSync("imGoodId", 1111111);
|
||||
// #endif
|
||||
this.$nextTick(() => {
|
||||
uni.pageScrollTo({
|
||||
scrollTop: 2000000,
|
||||
duration: 0
|
||||
duration: 300
|
||||
});
|
||||
|
||||
})
|
||||
},
|
||||
sokcet () {
|
||||
var _this = this;
|
||||
uni.closeSocket();
|
||||
this.socketOpen = false;
|
||||
try {
|
||||
//WebSocket的地址
|
||||
var url = config.baseWsUrl + '/' + storage.getAccessToken();
|
||||
// 连接
|
||||
uni.connectSocket({
|
||||
url: url,
|
||||
});
|
||||
// 监听WebSocket连接已打开
|
||||
uni.onSocketOpen(function (res) {
|
||||
_this.socketOpen = true;
|
||||
});
|
||||
if (!this.socketOpen) {
|
||||
// 监听连接失败
|
||||
uni.onSocketError(function (err) {
|
||||
let count = 0;
|
||||
if (count < 3) {
|
||||
if (err && err.code !== 1000) {
|
||||
_this.socketOpen = true;
|
||||
uni.connectSocket({
|
||||
url: url,
|
||||
});
|
||||
count = count + 1
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
// 监听连接关闭
|
||||
uni.onSocketClose(function (err) {
|
||||
if (err && err.code !== 1000) {
|
||||
setTimeout(function () {
|
||||
_this.socketOpen = true;
|
||||
uni.connectSocket({
|
||||
url: url,
|
||||
});
|
||||
}, 5 * 1000)
|
||||
}
|
||||
});
|
||||
// 监听收到信息
|
||||
uni.onSocketMessage(function (res) {
|
||||
console.log(res.data);
|
||||
res.data = JSON.parse(res.data)
|
||||
console.log(res.data.result);
|
||||
if (res.data.messageResultType == 'MESSAGE') {
|
||||
_this.msgList.push(res.data.result)
|
||||
console.log(_this.msgList)
|
||||
}
|
||||
console.log(res.data)
|
||||
_this.msgGo()
|
||||
})
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
beautifyTime,
|
||||
//订单详情
|
||||
linkTosOrders (val) {
|
||||
let order = JSON.parse(val)
|
||||
uni.navigateTo({
|
||||
url: '/pages/order/orderDetail?sn=' + order.sn,
|
||||
});
|
||||
|
||||
},
|
||||
// 跳转商品详情页
|
||||
jumpGoodDelic (item) {
|
||||
let info = JSON.parse(item.text)
|
||||
uni.navigateTo({
|
||||
url: `/pages/product/goods?id=${info.id}&goodsId=${info.goodsId}`,
|
||||
});
|
||||
},
|
||||
|
||||
//取消发送
|
||||
cancelModel () {
|
||||
this.showHide = false
|
||||
@@ -354,7 +480,7 @@ export default {
|
||||
this.goodListData = res.data.result.data
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
// 切换输入法时移动输入框(按照官方的上推页面的原理应该会自动适应不同的键盘高度-->官方bug)
|
||||
goPag (kh) {
|
||||
this.retractBox(0, 250)
|
||||
@@ -423,30 +549,35 @@ export default {
|
||||
// 这里应该传入问题的id,模拟就用index代替了
|
||||
|
||||
},
|
||||
sendMessage () {
|
||||
// 消息为空不做任何操作
|
||||
if (this.msg == "") {
|
||||
return 0;
|
||||
}
|
||||
// 显示消息 msg消息文本,my鉴别是谁发的消息(不能用俩个消息数组循环,否则消息不会穿插)
|
||||
let msg = {
|
||||
operation_type: "MESSAGE",
|
||||
to: this.toUser.userId,
|
||||
from: this.user.id,
|
||||
message_type: "MESSAGE",
|
||||
context: this.msg,
|
||||
talk_id: this.params.talkId,
|
||||
}
|
||||
this.ws.send(JSON.stringify(msg))
|
||||
this.msgList.push({ "text": this.msg, "my": true, "messageType": 'MESSAGE' })
|
||||
// 保证消息可见
|
||||
let type = 'down';
|
||||
this.msgGo(type)
|
||||
// 回答问题
|
||||
// this.msgKf(this.msg)
|
||||
// 清除消息
|
||||
this.msg = ""
|
||||
},
|
||||
// sendMessage() {
|
||||
// // 消息为空不做任何操作
|
||||
// if (this.msg == "") {
|
||||
// return 0;
|
||||
// }
|
||||
// // 显示消息 msg消息文本,my鉴别是谁发的消息(不能用俩个消息数组循环,否则消息不会穿插)
|
||||
// let msg = {
|
||||
// operation_type: "MESSAGE",
|
||||
// to: this.toUser.userId,
|
||||
// from: this.user.id,
|
||||
// message_type: "MESSAGE",
|
||||
// context: this.msg,
|
||||
// talk_id: this.params.talkId,
|
||||
// }
|
||||
// this.ws.send(JSON.stringify(msg))
|
||||
// this.msgList.push({
|
||||
// "text": this.msg,
|
||||
// "my": true,
|
||||
// "messageType": 'MESSAGE'
|
||||
// })
|
||||
// console.log(this.msgList, 'this.msgListthis.msgListthis.msgListthis.msgListthis.msgList')
|
||||
// // 保证消息可见
|
||||
// let type = 'down';
|
||||
// this.msgGo(type)
|
||||
// // 回答问题
|
||||
// // this.msgKf(this.msg)
|
||||
// // 清除消息
|
||||
// this.msg = ""
|
||||
// },
|
||||
// msgKf(x) {
|
||||
// // loading
|
||||
// // this.msgLoad = true
|
||||
@@ -503,7 +634,7 @@ export default {
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
console.log(this.msgList);
|
||||
this.msgGo(type)
|
||||
},
|
||||
touchMoreMessage (e) {
|
||||
@@ -534,8 +665,10 @@ export default {
|
||||
if (this.msgList[index].is_revoke == 1) {
|
||||
return false;
|
||||
}
|
||||
if (datetime) {
|
||||
datetime = datetime.replace(/-/g, "/");
|
||||
}
|
||||
|
||||
datetime = datetime.replace(/-/g, "/");
|
||||
let time = Math.floor(Date.parse(datetime) / 1000);
|
||||
let currTime = Math.floor(new Date().getTime() / 1000);
|
||||
|
||||
@@ -546,7 +679,7 @@ export default {
|
||||
return true;
|
||||
}
|
||||
let nextDate
|
||||
if (this.msgList[index + 1]) {
|
||||
if (this.msgList[index + 1] && this.msgList[index + 1].createTime) {
|
||||
nextDate = this.msgList[index + 1].createTime.replace(/-/g, "/");
|
||||
if (nextDate - datetime < 300) return false;
|
||||
}
|
||||
@@ -585,9 +718,9 @@ export default {
|
||||
if (new RegExp("(" + k + ")").test(_format))
|
||||
_format = _format.replace(
|
||||
RegExp.$1,
|
||||
RegExp.$1.length === 1
|
||||
? o[k]
|
||||
: ("00" + o[k]).substr(("" + o[k]).length)
|
||||
RegExp.$1.length === 1 ?
|
||||
o[k] :
|
||||
("00" + o[k]).substr(("" + o[k]).length)
|
||||
);
|
||||
return _format;
|
||||
},
|
||||
|
||||
166
pages/mine/im/socket.js
Normal file
166
pages/mine/im/socket.js
Normal file
@@ -0,0 +1,166 @@
|
||||
import config from '@/config/config.js'
|
||||
import storage from '@/utils/storage';
|
||||
class socketIO {
|
||||
constructor(data, time, url) {
|
||||
this.socketTask = null
|
||||
this.is_open_socket = false //避免重复连接
|
||||
this.url = config.baseWsUrl + '/' + storage.getAccessToken() //连接地址
|
||||
this.data = data ? data : null
|
||||
this.connectNum = 1 // 重连次数
|
||||
this.traderDetailIndex = 100 // traderDetailIndex ==2 重连
|
||||
this.accountStateIndex = 100 // traderDetailIndex ==1 重连
|
||||
this.followFlake = false // traderDetailIndex == true 重连
|
||||
//心跳检测
|
||||
this.timeout = time ? time : 15000 //多少秒执行检测
|
||||
this.heartbeatInterval = null //检测服务器端是否还活着
|
||||
this.reconnectTimeOut = null //重连之后多久再次重连
|
||||
}
|
||||
// 进入这个页面的时候创建websocket连接【整个页面随时使用】
|
||||
connectSocketInit (data) {
|
||||
this.data = data
|
||||
this.socketTask = uni.connectSocket({
|
||||
url: this.url,
|
||||
success: () => {
|
||||
console.log("正准备建立websocket中...");
|
||||
// 返回实例
|
||||
return this.socketTask
|
||||
},
|
||||
});
|
||||
this.socketTask.onOpen((res) => {
|
||||
this.connectNum = 1
|
||||
console.log("WebSocket连接正常!");
|
||||
this.send(data)
|
||||
clearInterval(this.reconnectTimeOut)
|
||||
clearInterval(this.heartbeatInterval)
|
||||
this.is_open_socket = true;
|
||||
this.start();
|
||||
// 注:只有连接正常打开中 ,才能正常收到消息
|
||||
this.socketTask.onMessage((e) => {
|
||||
// 字符串转json
|
||||
let res = JSON.parse(e.data);
|
||||
console.log("res---------->", res) // 这里 查看 推送过来的消息
|
||||
if (res.data) {
|
||||
uni.$emit('getPositonsOrder', res);
|
||||
}
|
||||
});
|
||||
})
|
||||
// 监听连接失败,这里代码我注释掉的原因是因为如果服务器关闭后,和下面的onclose方法一起发起重连操作,这样会导致重复连接
|
||||
uni.onSocketError((res) => {
|
||||
console.log('WebSocket连接打开失败,请检查!');
|
||||
this.socketTask = null
|
||||
this.is_open_socket = false;
|
||||
clearInterval(this.heartbeatInterval)
|
||||
clearInterval(this.reconnectTimeOut)
|
||||
uni.$off('getPositonsOrder')
|
||||
if (this.connectNum < 6) {
|
||||
uni.showToast({
|
||||
title: `WebSocket连接失败,正尝试第${this.connectNum}次连接`,
|
||||
icon: "none"
|
||||
})
|
||||
this.reconnect();
|
||||
this.connectNum += 1
|
||||
} else {
|
||||
uni.$emit('connectError');
|
||||
this.connectNum = 1
|
||||
}
|
||||
});
|
||||
// 这里仅是事件监听【如果socket关闭了会执行】
|
||||
this.socketTask.onClose(() => {
|
||||
console.log("已经被关闭了-------")
|
||||
clearInterval(this.heartbeatInterval)
|
||||
clearInterval(this.reconnectTimeOut)
|
||||
this.is_open_socket = false;
|
||||
this.socketTask = null
|
||||
uni.$off('getPositonsOrder')
|
||||
if (this.connectNum < 6) {
|
||||
this.reconnect();
|
||||
} else {
|
||||
uni.$emit('connectError');
|
||||
this.connectNum = 1
|
||||
}
|
||||
})
|
||||
}
|
||||
// 主动关闭socket连接
|
||||
Close () {
|
||||
if (!this.is_open_socket) {
|
||||
return
|
||||
}
|
||||
this.socketTask.close({
|
||||
success () {
|
||||
uni.showToast({
|
||||
title: 'SocketTask 关闭成功',
|
||||
icon: "none"
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
//发送消息
|
||||
send (data) {
|
||||
console.log("data---------->", data);
|
||||
// 注:只有连接正常打开中 ,才能正常成功发送消息
|
||||
if (this.socketTask) {
|
||||
this.socketTask.send({
|
||||
data: JSON.stringify(data),
|
||||
async success () {
|
||||
console.log("消息发送成功");
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
//开启心跳检测
|
||||
start () {
|
||||
this.heartbeatInterval = setInterval(() => {
|
||||
this.send({
|
||||
"traderid": 10260,
|
||||
"type": "Ping"
|
||||
});
|
||||
}, this.timeout)
|
||||
}
|
||||
//重新连接
|
||||
reconnect () {
|
||||
//停止发送心跳
|
||||
clearInterval(this.heartbeatInterval)
|
||||
//如果不是人为关闭的话,进行重连
|
||||
if (!this.is_open_socket && (this.traderDetailIndex == 2 || this.accountStateIndex == 0 || this
|
||||
.followFlake)) {
|
||||
this.reconnectTimeOut = setInterval(() => {
|
||||
this.connectSocketInit(this.data);
|
||||
}, 5000)
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @description 将 scoket 数据进行过滤
|
||||
* @param {array} array
|
||||
* @param {string} type 区分 弹窗 openposition 分为跟随和我的
|
||||
*/
|
||||
arrayFilter (array, type = 'normal', signalId = 0) {
|
||||
let arr1 = []
|
||||
let arr2 = []
|
||||
let obj = {
|
||||
arr1: [],
|
||||
arr2: []
|
||||
}
|
||||
arr1 = array.filter(v => v.flwsig == true)
|
||||
arr2 = array.filter(v => v.flwsig == false)
|
||||
if (type == 'normal') {
|
||||
if (signalId) {
|
||||
arr1 = array.filter(v => v.flwsig == true && v.sigtraderid == signalId)
|
||||
return arr1
|
||||
} else {
|
||||
return arr1.concat(arr2)
|
||||
}
|
||||
} else {
|
||||
if (signalId > 0) {
|
||||
arr1 = array.filter(v => v.flwsig == true && v.sigtraderid == signalId)
|
||||
obj.arr1 = arr1
|
||||
} else {
|
||||
obj.arr1 = arr1
|
||||
}
|
||||
obj.arr2 = arr2
|
||||
return obj
|
||||
}
|
||||
}
|
||||
}
|
||||
export {
|
||||
socketIO
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<view class="person" @click="checkUserInfo()">
|
||||
<u-image width=140 height="140" shape="circle" :src="userInfo.face || '/static/missing-face.png'" mode="">
|
||||
<u-image width=140 height="140" shape="circle" :src="userInfo.face || userImage" mode="">
|
||||
</u-image>
|
||||
<view class="user-name">
|
||||
|
||||
@@ -36,6 +36,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
config,
|
||||
userImage:config.defaultUserPhoto,
|
||||
lightColor: this.$lightColor,
|
||||
quitShow: false,
|
||||
isCertificate: false,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -3,7 +3,7 @@
|
||||
<view class="exaluate-member-view">
|
||||
<view class="member-view">
|
||||
<view class="member-img">
|
||||
<u-image width="82rpx" style="border: 1px solid #ededed" height="82rpx" shape="circle" :src="comment.memberProfile || '/static/missing-face.png'"></u-image>
|
||||
<u-image width="82rpx" style="border: 1px solid #ededed" height="82rpx" shape="circle" :src="comment.memberProfile || userImage"></u-image>
|
||||
</view>
|
||||
<view class="member-info">
|
||||
<view class="memName">{{ comment.memberName }}</view>
|
||||
@@ -41,9 +41,13 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import configs from '@/config/config'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
configs,
|
||||
userImage:configs.defaultUserPhoto,
|
||||
|
||||
comment: {}, //评论信息
|
||||
gradeList: {
|
||||
//评价grade
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
<view class="group">
|
||||
<view>
|
||||
<u-image borderRadius="50%" shape="square" class="head-img" width="81rpx" height="81rpx"
|
||||
:src="masterWay.face || '/static/missing-face.png'"></u-image>
|
||||
:src="masterWay.face || userImage"></u-image>
|
||||
<view class="btn-one">团长</view>
|
||||
</view>
|
||||
<view class="line"> </view>
|
||||
@@ -80,7 +80,7 @@
|
||||
<view slot="loading"></view>
|
||||
</u-image>
|
||||
<u-image class="head-img" borderRadius="50%" shape="square" v-else width="81rpx" height="81rpx"
|
||||
:src="endWay.face || '/static/missing-face.png'"></u-image>
|
||||
:src="endWay.face || userImage"></u-image>
|
||||
|
||||
<view class="wait">{{ endWay.nickname || "等待参团" }}</view>
|
||||
</view>
|
||||
@@ -265,7 +265,7 @@ import * as API_Order from "@/api/order";
|
||||
import invoices from "@/pages/order/invoice/setInvoice";
|
||||
|
||||
import LiLiWXPay from "@/js_sdk/lili-pay/wx-pay.js";
|
||||
|
||||
import configs from '@/config/config'
|
||||
export default {
|
||||
onLoad: function (val) {
|
||||
this.routerVal = val;
|
||||
@@ -277,6 +277,8 @@ export default {
|
||||
watch: {},
|
||||
data() {
|
||||
return {
|
||||
configs,
|
||||
userImage:configs.defaultUserPhoto,
|
||||
invoiceFlag: false, //开票开关
|
||||
shippingText: "LOGISTICS",
|
||||
shippingFlag: false,
|
||||
|
||||
@@ -343,7 +343,7 @@ export default {
|
||||
this.orderGoodsList = order.orderItems;
|
||||
this.orderDetail = res.data.result;
|
||||
if (this.order.deliveryMethod === 'LOGISTICS') {
|
||||
this.loadLogistics()
|
||||
this.loadLogistics(sn)
|
||||
}
|
||||
uni.hideLoading();
|
||||
});
|
||||
|
||||
@@ -564,6 +564,7 @@
|
||||
*/
|
||||
storage.setUserInfo(user.data.result);
|
||||
storage.setHasLogin(true);
|
||||
storage.setAutoCp(0)
|
||||
// 登录成功
|
||||
uni.showToast({
|
||||
title: "登录成功!",
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
</div>
|
||||
<view class="eva-box" v-for="(item, index) in commDetail" :key="index">
|
||||
<view class="section-info">
|
||||
<image class="portrait" :src="item.memberProfile || '/static/missing-face.png'" mode="aspectFill"></image>
|
||||
<image class="portrait" :src="item.memberProfile || userImage" mode="aspectFill"></image>
|
||||
<view class="star-content">
|
||||
<text class="name">{{ item.memberName | noPassByName }}</text>
|
||||
<text class="time">{{ item.createTime }}</text>
|
||||
@@ -65,11 +65,13 @@
|
||||
<script>
|
||||
// import { getGoodsDetail } from '@/api/goods.js';
|
||||
import * as membersApi from "@/api/members.js";
|
||||
|
||||
import configs from '@/config/config'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
configs,
|
||||
status: "loadmore", //底部刷新状态
|
||||
userImage:configs.defaultUserPhoto,
|
||||
commentDetail: "", //评价详情
|
||||
selectIndex: "0", //检索条件
|
||||
params: { // 评论分页提交数据
|
||||
|
||||
@@ -601,10 +601,10 @@ export default {
|
||||
|
||||
linkMsgDetail () {
|
||||
// lili 基础客服
|
||||
this.$options.filters.talkIm(this.storeDetail.storeId)
|
||||
// uni.navigateTo({
|
||||
// url: `/pages/mine/im/index?userId=${this.goodsDetail.storeId}&goodsid=${this.routerVal.goodsId}&skuid=${this.routerVal.id}`
|
||||
// });
|
||||
// this.$options.filters.talkIm(this.storeDetail.storeId)
|
||||
uni.navigateTo({
|
||||
url: `/pages/mine/im/index?userId=${this.goodsDetail.storeId}&goodsid=${this.routerVal.goodsId}&skuid=${this.routerVal.id}`
|
||||
});
|
||||
|
||||
// udesk 代码
|
||||
// if (this.storeDetail.merchantEuid) {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<view v-if="assembleOrder.length != 0">
|
||||
<view class="group-item" v-for="(order, index) in assembleOrder" :key="index">
|
||||
<view class="group-item-user">
|
||||
<u-image shape="circle" width="40px" height="40px" :src="order.face"></u-image>
|
||||
<u-image shape="circle" width="40px" height="40px" :src="order.face || userImage"></u-image>
|
||||
<span class="group-item-name">{{ order.nickName | noPassByName }}</span>
|
||||
</view>
|
||||
<view>
|
||||
@@ -25,9 +25,13 @@
|
||||
|
||||
<script>
|
||||
import * as API_Promotions from "@/api/promotions";
|
||||
import configs from '@/config/config'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
configs,
|
||||
userImage:configs.defaultUserPhoto,
|
||||
|
||||
customStyle: {
|
||||
background: this.$lightColor,
|
||||
color: "#fff",
|
||||
|
||||
@@ -14,6 +14,14 @@ export default {
|
||||
backgroundColor: "#fff",
|
||||
},
|
||||
};
|
||||
},
|
||||
onShow(){
|
||||
setTimeout(()=>{
|
||||
this.$refs.tpl.firstGetAuto();
|
||||
},1000)
|
||||
},
|
||||
methods: {
|
||||
|
||||
},
|
||||
onReachBottom(){
|
||||
// 给子级监听触底加载
|
||||
|
||||
@@ -187,7 +187,6 @@ $w_94: 94%;
|
||||
padding: 10px;
|
||||
transition: 0.35s;
|
||||
display: flex;
|
||||
cursor: pointer;
|
||||
|
||||
> .goods-item-title {
|
||||
flex: 1;
|
||||
|
||||
@@ -1,5 +1,37 @@
|
||||
<template>
|
||||
<div class="wrapper">
|
||||
<u-popup v-model="showCp" mode="center" width="550rpx" height="400px">
|
||||
<view style="height:130rpx;">
|
||||
<view style="width:200rpx;height:120rpx;float:left;line-height:120rpx;font-size:35rpx;color:#28A4F2;font-weight:600;margin-left:20rpx;">优惠券活动</view>
|
||||
<view style="width:120rpx;height:120rpx;float:right;">
|
||||
<image @click="showCp = false" src="/static/cpauto1.png" style="width:100%;height:100%;"></image>
|
||||
</view>
|
||||
</view>
|
||||
<scroll-view scroll-y="true" style="height: 620rpx;">
|
||||
<!-- {{coupList}} -->
|
||||
<view v-for="(item,index) in coupList" :key="index" >
|
||||
<view class="grad1">
|
||||
<view style="float:right;">
|
||||
<view v-if="item.couponType == 'DISCOUNT'">{{ item.couponDiscount }}折</view>
|
||||
<view v-else>优惠金额:<span style="color:red;font-size:32rpx;">{{ item.price | unitPrice}}</span>元</view>
|
||||
<view>满<span style="color:red;font-size:32rpx;">{{ item.consumeThreshold | unitPrice }}元</span>可用</view>
|
||||
<view v-if="item.scopeType == 'ALL' && item.storeId == '0'">全平台</view>
|
||||
<view v-if="item.scopeType == 'PORTION_GOODS_CATEGORY'">仅限品类</view>
|
||||
<view v-else>{{ item.storeName == 'platform' ? '全平台' :item.storeName+'店铺' }}使用
|
||||
</view>
|
||||
<view v-if="item.endTime">有效期至:{{ item.endTime.split(" ")[0] }}</view>
|
||||
</view>
|
||||
<view style="color:white;font-size:28rpx;font-weight:500;float:left;writing-mode:vertical-rl;flex: auto;height:100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;" @click="showCp = false">
|
||||
立即使用
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</u-popup>
|
||||
<!-- uni 中不能使用 vue component 所以用if判断每个组件 -->
|
||||
<div v-for="(item, index) in pageData.list" :key="index">
|
||||
<!-- 搜索栏,如果在楼层装修顶部则会自动浮动,否则不浮动 -->
|
||||
@@ -59,13 +91,19 @@ import tpl_goods from "@/pages/tabbar/home/template/tpl_goods"; //商品分类
|
||||
import { getFloorData } from "@/api/home"; //获取楼层装修接口
|
||||
import permision from "@/js_sdk/wa-permission/permission.js"; //权限工具类
|
||||
import config from "@/config/config";
|
||||
import {getAutoCoup} from "@/api/login"
|
||||
import tpl_notice from "@/pages/tabbar/home/template/tpl_notice"; //标题栏模块
|
||||
import tpl_promotions from "@/pages/tabbar/home/template/tpl_promotions_detail"; //标题栏模块
|
||||
import storage from "@/utils/storage.js";
|
||||
// import {receiveCoupons} from "@/api/members"
|
||||
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
config,
|
||||
storage,
|
||||
coupList:[],
|
||||
showCp:false,
|
||||
pageData: "", //楼层页面数据
|
||||
isIos: "",
|
||||
enableLoad: false, //触底加载 针对于商品模块
|
||||
@@ -98,9 +136,58 @@ export default {
|
||||
// 小程序默认分享
|
||||
uni.showShareMenu({ withShareTicket: true });
|
||||
// #endif
|
||||
this.firstGetAuto()
|
||||
},
|
||||
|
||||
methods: {
|
||||
firstGetAuto(){
|
||||
// console.log(123123213)
|
||||
let data = new Date()
|
||||
let datas = data.getDate()
|
||||
let huors = data.getHours()
|
||||
let flagCoup = storage.getAutoCp()
|
||||
console.log(flagCoup)
|
||||
console.log(datas)
|
||||
if(storage.getAutoCp() && storage.getAutoCp() != '' && storage.getAutoCp() != undefined && storage.getAutoCp() != null){
|
||||
if(Number(datas) > Number(flagCoup)){
|
||||
if(Number(huors) >= 6){
|
||||
storage.setAutoCp(datas)
|
||||
this.getAutoCp()
|
||||
}
|
||||
}
|
||||
}else{
|
||||
this.getAutoCp()
|
||||
}
|
||||
|
||||
},
|
||||
getAutoCp(){
|
||||
let data = new Date()
|
||||
let datas = data.getDate()
|
||||
getAutoCoup().then(res=>{
|
||||
console.log(res)
|
||||
if(res.data.success){
|
||||
this.coupList.push(...res.data.result)
|
||||
if(this.coupList != ''){
|
||||
this.showCp = true
|
||||
}else{
|
||||
this.showCp = false
|
||||
}
|
||||
storage.setAutoCp(datas)
|
||||
let objs = {};
|
||||
this.coupList = this.coupList.reduce((cur, next) => {
|
||||
//对象去重
|
||||
if (next.id != undefined) {
|
||||
objs[next.id]
|
||||
? ""
|
||||
: (objs[next.id] = true && cur.push(next));
|
||||
}
|
||||
return cur;
|
||||
}, []);
|
||||
}
|
||||
})
|
||||
},
|
||||
// receiveCoupons(v){
|
||||
|
||||
// },
|
||||
/**
|
||||
* 实例化首页数据楼层
|
||||
*/
|
||||
@@ -234,4 +321,30 @@ export default {
|
||||
.navbar-right {
|
||||
padding: 0 16rpx 0 0;
|
||||
}
|
||||
|
||||
.grad1 {
|
||||
width: 500rpx;
|
||||
height: 200rpx;
|
||||
background: radial-gradient(circle at right top, transparent 20rpx, #ff6b35 0) top left / 120rpx 51% no-repeat,
|
||||
radial-gradient(circle at right bottom, transparent 20rpx, #ff6b35 0) bottom left /120rpx 51% no-repeat,
|
||||
radial-gradient(circle at left top, transparent 20rpx, #ffffff 0) top right /380rpx 51% no-repeat,
|
||||
radial-gradient(circle at left bottom, transparent 20rpx, #ffffff 0) bottom right /380rpx 51% no-repeat;
|
||||
filter: drop-shadow(6rpx 6rpx 6rpx rgba(0,0,0,.3));
|
||||
margin: 30rpx auto;
|
||||
padding-top: 2rpx;
|
||||
padding-bottom: 10rpx;
|
||||
padding-left: 38rpx;
|
||||
padding-right: 30rpx;
|
||||
}
|
||||
// .grad2 {
|
||||
// width: 100px;
|
||||
// height: 120px;
|
||||
// background:
|
||||
// radial-gradient(circle at left bottom, transparent 10px, #28A4F2 0) top left /60px 30px no-repeat,
|
||||
// radial-gradient(circle at right bottom, transparent 10px, #28A4F2 0) top right /60px 30px no-repeat,
|
||||
// radial-gradient(circle at left top, transparent 10px, #EFEFF4 0) bottom left /60px 90px no-repeat,
|
||||
// radial-gradient(circle at right top, transparent 10px, #EFEFF4 0) bottom right /60px 90px no-repeat;
|
||||
// filter: drop-shadow(3rpx 3rpx 3rpx rgba(0,0,0,.3));
|
||||
// }
|
||||
|
||||
</style>
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
<view class="status_bar">
|
||||
<!-- 这里是状态栏 -->
|
||||
</view>
|
||||
<view class="header" @click="userDetail">
|
||||
<view class="header" @click="userDetail">
|
||||
<view class="head-1">
|
||||
<image :src="userInfo.face || '/static/missing-face.png'"></image>
|
||||
<image :src="userInfo.face || userImage"></image>
|
||||
</view>
|
||||
<view class="head-2" v-if="userInfo.id">
|
||||
<view class="user-name">{{ userInfo.nickName }}</view>
|
||||
@@ -78,12 +78,15 @@
|
||||
import tool from "@/pages/tabbar/user/utils/tool.vue";
|
||||
import { getCouponsNum, getFootprintNum } from "@/api/members.js";
|
||||
import { getUserWallet } from "@/api/members";
|
||||
import configs from '@/config/config'
|
||||
export default {
|
||||
components: {
|
||||
tool,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
configs,
|
||||
userImage:configs.defaultUserPhoto,
|
||||
coverTransform: "translateY(0px)",
|
||||
coverTransition: "0s",
|
||||
moving: false,
|
||||
|
||||
Reference in New Issue
Block a user