From e6b7b50a1e9c0297e38d0cd0a97e14403d248052 Mon Sep 17 00:00:00 2001 From: luyuan <1162963624@qq.com> Date: Thu, 6 Aug 2020 15:57:56 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E8=81=8A=E5=A4=A9=E6=9C=AC=E5=9C=B0?= =?UTF-8?q?=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pageD/privateChat/privateChat.vue | 87 ++++++++++++++++++++++++++++++- pages/information/information.vue | 5 +- static/imservice.js | 84 +++++++++++++++++++++++++---- 3 files changed, 161 insertions(+), 15 deletions(-) diff --git a/pageD/privateChat/privateChat.vue b/pageD/privateChat/privateChat.vue index 17aadff..b6ef7c7 100644 --- a/pageD/privateChat/privateChat.vue +++ b/pageD/privateChat/privateChat.vue @@ -193,6 +193,10 @@ sendMessage() {//发送消息 if (this.content.trim() != '') { this.imService.sendPrivateTextMessage(this.friend.uuid, this.content); + let that = this + setTimeout(function(){ + that.scrollToBottom(); + },500) } this.content = ""; }, @@ -322,7 +326,7 @@ } .chatInterface .message-item{ - max-height: 400rpx; + /* max-height: 400rpx; */ margin-top: 40rpx; overflow: hidden; } @@ -342,7 +346,7 @@ .chatInterface .content{ font-size: 34rpx; line-height: 44rpx; - max-height: 400rpx; + /* max-height: 400rpx; */ display: flex; align-items: center; justify-content: right; @@ -356,6 +360,7 @@ .chatInterface .content .text-content{ padding: 16rpx; border-radius: 12rpx; + max-width: 520rpx; } .chatInterface .content .pending{ background: url("../images/pending.gif") no-repeat center; @@ -528,5 +533,83 @@ left: 50%; margin:-20rpx; } + .chatInterface .avatar{ + overflow: hidden; + float: left; + } + .chatInterface .avatar img{ + width: 100%; + height: 100%; + display: block; + } + .chatInterface .content{ + float: left; + overflow: hidden; + } + .chatInterface .content span{ + font-family: Source Han Sans CN; + letter-spacing: -0.41px; + color: #262628; + background: #efefef; + display: inline-block; + word-break: break-all; + } + .chatInterface .message-item.self{ + margin-right: 0; + } + .chatInterface .message-item.self .avatar{ + margin-right: 0; + float: right; + } + .chatInterface .message-item.self .content{ + text-align: right; + float: right; + } + .chatInterface .message-item.self .content span{ + color: #ffffff; + background:#D02129; + word-break: break-all; + text-align: left; + max-width: 520rpx; + } + .chatInterface .action-box{ + background: #FAFAFA; + display: flex; + align-content: center; + align-items: center; + } + .chatInterface .message-input{ + background: #efefef; + border: 0; + outline: none; + } + + .chatInterface .send-message-btn{ + flex-grow: 1; + text-align: center; + color: #95949A; + } + + .chatInterface .member-layer{ + width:100%; + height: 100%; + background: #FFFFFF; + top: 0; + left: 0; + position: absolute; + } + .member-layer .member{ + display: flex; + flex-wrap: wrap; + } + + .chatInterface .group-icon{ + position: absolute; + } + + .chatInterface .gray{ + color: gray!important; + text-decoration: none!important; + } diff --git a/pages/information/information.vue b/pages/information/information.vue index 2bee790..d901848 100644 --- a/pages/information/information.vue +++ b/pages/information/information.vue @@ -21,7 +21,7 @@ {{item.name}} - {{item.text}} + {{item.text}} {{item.time}} @@ -129,7 +129,8 @@ onFriendListChange(onlineFriends) { //todo:比较垃圾的处理方式,因为Uniapp的基于MAP的双向绑定在H5端不稳定,H5端偶尔会抽风 // 下边这一行删掉,有时候页面可以更新,有时候不行,大家有优雅的方式,也欢迎跟我们沟通 - this.information_dl = this.imService.friends; + console.log(onlineFriends,121212) + this.information_dl = onlineFriends; this.$forceUpdate(); }, diff --git a/static/imservice.js b/static/imservice.js index 2fa0de8..23f1c56 100644 --- a/static/imservice.js +++ b/static/imservice.js @@ -8,14 +8,14 @@ import GoEasyIM from './goeasy-im-1.0.9'; import restApi from './restapi'; -function Friend(uuid, name, avatar) { +function Friend(uuid, name, avatar,time = "") { this.uuid = uuid; this.name = name; this.avatar = avatar; this.online = false; this.unReadMessage = 0; this.text = ""; - this.time = ""; + this.time = time; } function Group(uuid, name, avatar) { @@ -40,6 +40,7 @@ function IMService() { this.currentUser = null; //我的好友 this.friends = {}; + this.friendsarr = []; //我的群 this.groups = {}; //私聊消息记录,map格式,每个好友对应一个数组 @@ -74,7 +75,7 @@ IMService.prototype.login = function (uuid, name, avatar) { //初始化当前用户 this.currentUser = new CurrentUser(uuid, name, avatar); //初始化联系人信息,包括群 - // this.initialContacts(); + this.initialContacts(); return true; }; @@ -83,11 +84,36 @@ IMService.prototype.login = function (uuid, name, avatar) { IMService.prototype.initialContacts = function (friendList) { //查询并初始化好友信息 // let friendList = restApi.findFriends(this.currentUser); - + let value = uni.getStorageSync('imlist'); + if(value != undefined && !value){ + return ; + } + value = JSON.parse(value) + let that = this + for(let i of value){ + const token = uni.getStorageSync('token'); + console.log(token) + uni.request({ + url:"https://dmmall.sdbairui.com/api/Specialci/getAtwillUserInfo", + data:{ + userId:i[0] + }, + method:"POST", + header:{ + "Authorization" : 'Bearer' + " " + token + }, + success(res){ + console.log(res) + that.friends[i[0]] = new Friend(res.data.data.member_id, res.data.data.member_nickname, res.data.data.member_avatar,i[1]); + console.log(that.friends) + that.onFriendListChange(that.friends); + } + }) + } //将用户列表初始化为一个map,便于后续根据friendId得到friend - friendList.map(friend => { - this.friends[friend.uuid] = new Friend(friend.uuid, friend.name, friend.avatar); - }); + // friendList.map(friend => { + // this.friends[friend.uuid] = new Friend(friend.uuid, friend.name, friend.avatar); + // }); //查询并初始化与自己相关的群信息 // let groupList = restApi.findGroups(this.currentUser); @@ -207,6 +233,19 @@ IMService.prototype.initialIMListeners = function () { let friend = this.friends[message.senderId]; console.log(friend) // return ; + let sorts = function (friends){ + let paixu = function (a,b){ + if(a.item > b.item){ + return 0; + }else{ + return 1; + } + + } + friends.sort(paixu) + + } + let that = this if(!friend && friend == undefined){ const token = uni.getStorageSync('token'); @@ -229,8 +268,20 @@ IMService.prototype.initialIMListeners = function () { friend.text = message.type != "text" ? "其他消息" : message.payload.text let time = new Date(message.timestamp) friend.time = time.getHours() + ":" + time.getMinutes() + ":" + time.getSeconds() - that.onFriendListChange(that.friends); console.log(that.friends) + that.friendsarr = [] + for(let i in that.friends){ + console.log(i) + that.friendsarr.push(that.friends[i]) + } + sorts(that.friendsarr) + let arr = [] + for(let i in that.friends){ + arr.push([that.friends[i].uuid,that.friends[i].time]) + uni.setStorageSync('imlist',JSON.stringify(arr)) + } + that.onFriendListChange(that.friends); + } }) }else{ @@ -239,11 +290,22 @@ IMService.prototype.initialIMListeners = function () { friend.text = message.type != "text" ? "其他消息" : message.payload.text let time = new Date(message.timestamp) friend.time = time.getHours() + ":" + time.getMinutes() + ":" + time.getSeconds() - this.onFriendListChange(this.friends); console.log(this.friends) + that.friendsarr = [] + for(let i in this.friends){ + that.friendsarr.push(this.friends[i]) + } + sorts(that.friendsarr) + this.onFriendListChange(this.friends); + } - - + // let value = uni.getStorageSync('imlist'); + // value = JSON.parse(value) + // if(value.indexOf(message.senderId) == -1){ + // value.unshift(message.senderId) + // } + // uni.setStorageSync('imlist',JSON.stringify(value)) + } //更新私聊消息记录 let friendId; From e11f20885fb3d12f6b8e68277917451d3c9e0518 Mon Sep 17 00:00:00 2001 From: luyuan <1162963624@qq.com> Date: Thu, 6 Aug 2020 16:22:40 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/imservice.js | 43 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 37 insertions(+), 6 deletions(-) diff --git a/static/imservice.js b/static/imservice.js index 23f1c56..070908c 100644 --- a/static/imservice.js +++ b/static/imservice.js @@ -8,14 +8,15 @@ import GoEasyIM from './goeasy-im-1.0.9'; import restApi from './restapi'; -function Friend(uuid, name, avatar,time = "") { +function Friend(uuid, name, avatar,time = "", text = "",date = "") { this.uuid = uuid; this.name = name; this.avatar = avatar; this.online = false; this.unReadMessage = 0; - this.text = ""; + this.text = text; this.time = time; + this.date = date } function Group(uuid, name, avatar) { @@ -90,6 +91,7 @@ IMService.prototype.initialContacts = function (friendList) { } value = JSON.parse(value) let that = this + console.log(value) for(let i of value){ const token = uni.getStorageSync('token'); console.log(token) @@ -104,9 +106,28 @@ IMService.prototype.initialContacts = function (friendList) { }, success(res){ console.log(res) - that.friends[i[0]] = new Friend(res.data.data.member_id, res.data.data.member_nickname, res.data.data.member_avatar,i[1]); + that.friends[i[0]] = new Friend(res.data.data.member_id, res.data.data.member_nickname, res.data.data.member_avatar,i[1],i[2]); console.log(that.friends) + let sorts = function (friends){ + let paixu = function (a,b){ + if(a.date > b.date){ + return 0; + }else{ + return 1; + } + + } + friends.sort(paixu) + + } + that.friendsarr = [] + for(let i in that.friends){ + console.log(i) + that.friendsarr.push(that.friends[i]) + } + sorts(that.friendsarr) that.onFriendListChange(that.friends); + } }) } @@ -235,7 +256,7 @@ IMService.prototype.initialIMListeners = function () { // return ; let sorts = function (friends){ let paixu = function (a,b){ - if(a.item > b.item){ + if(a.date > b.date){ return 0; }else{ return 1; @@ -267,6 +288,7 @@ IMService.prototype.initialIMListeners = function () { friend.unReadMessage++; friend.text = message.type != "text" ? "其他消息" : message.payload.text let time = new Date(message.timestamp) + friend.date = message.timestamp friend.time = time.getHours() + ":" + time.getMinutes() + ":" + time.getSeconds() console.log(that.friends) that.friendsarr = [] @@ -277,9 +299,11 @@ IMService.prototype.initialIMListeners = function () { sorts(that.friendsarr) let arr = [] for(let i in that.friends){ - arr.push([that.friends[i].uuid,that.friends[i].time]) - uni.setStorageSync('imlist',JSON.stringify(arr)) + arr.push([that.friends[i].uuid,that.friends[i].time,that.friends[i].text,that.friends[i].date]) } + console.log(arr) + uni.setStorageSync('imlist',JSON.stringify(arr)) + that.onFriendListChange(that.friends); } @@ -289,6 +313,7 @@ IMService.prototype.initialIMListeners = function () { friend.unReadMessage++; friend.text = message.type != "text" ? "其他消息" : message.payload.text let time = new Date(message.timestamp) + friend.date = message.timestamp friend.time = time.getHours() + ":" + time.getMinutes() + ":" + time.getSeconds() console.log(this.friends) that.friendsarr = [] @@ -296,6 +321,12 @@ IMService.prototype.initialIMListeners = function () { that.friendsarr.push(this.friends[i]) } sorts(that.friendsarr) + let arr = [] + for(let i in that.friends){ + arr.push([that.friends[i].uuid,that.friends[i].time,that.friends[i].text,that.friends[i].date]) + } + console.log(arr) + uni.setStorageSync('imlist',JSON.stringify(arr)) this.onFriendListChange(this.friends); } From 1a1a0de460229a16601012b61b7526349b8e5634 Mon Sep 17 00:00:00 2001 From: ghusermoon <2673031505@qq.com> Date: Thu, 6 Aug 2020 17:52:25 +0800 Subject: [PATCH 3/3] upgrade 8.6 --- common/api/user.js | 5 +- common/http.interceptor.js | 2 +- components/mine/order-item/index.vue | 5 +- components/shop/group/index.vue | 2 +- pageB/components/sdetails/guige.vue | 1 + pageB/sdetails/index.vue | 66 ++++++++++++++++--------- pageC/cart/ConfirmOrder.vue | 7 ++- pageC/cart/index.vue | 25 ++++++++-- pageC/components/merchant/image-top.vue | 2 +- pageC/components/merchant/list-item.vue | 2 +- pageC/merchant/goods.vue | 2 +- pageC/merchant/index.vue | 58 ++++++++++++++++------ pageE/mine/EditUserInfo.vue | 8 ++- pageE/order/Details.vue | 2 +- pageE/order/Index.vue | 10 ++-- pageE/order/RefundOrder.vue | 49 +++++++++++++++--- pageE/tool/WashOrder.vue | 13 +++-- 17 files changed, 183 insertions(+), 76 deletions(-) diff --git a/common/api/user.js b/common/api/user.js index 19d6fd8..46e4557 100644 --- a/common/api/user.js +++ b/common/api/user.js @@ -259,12 +259,13 @@ export default { return vm.$u.post('Order/buyer_cancel', params); }, // add_refund - refundOrder({ order_id, goods_id, refund_amount, refund_type = 1 } = {}) { + refundOrder({ order_id, goods_id, goods_num, reason_info, refund_amount } = {}) { return vm.$u.post('order/add_refund', { order_id: order_id, goods_id: goods_id, refund_amount: refund_amount, - refund_type: refund_type, + goods_num: goods_num, + reason_info: reason_info, }); }, // 删除订单 diff --git a/common/http.interceptor.js b/common/http.interceptor.js index 5484ac8..551bdf3 100644 --- a/common/http.interceptor.js +++ b/common/http.interceptor.js @@ -36,7 +36,7 @@ const install = (Vue, vm) => { } else { // 如果返回false,则会调用Promise的reject回调, // 并将进入this.$u.post(url).then().catch(res=>{})的catch回调中,res为服务端的返回值 - return false; + return res; } } diff --git a/components/mine/order-item/index.vue b/components/mine/order-item/index.vue index c28721e..d2f0f48 100644 --- a/components/mine/order-item/index.vue +++ b/components/mine/order-item/index.vue @@ -25,7 +25,7 @@ - 申请退款 + 申请退款 查看物流 确认收货 立即评价 @@ -47,7 +47,7 @@ export default { props: { order: Object }, - created() { + mounted() { this.viewState(); }, methods: { @@ -81,6 +81,7 @@ export default { default: break; } + // console.log(state); this.state = state; }, cancelOrder() { diff --git a/components/shop/group/index.vue b/components/shop/group/index.vue index da692e1..1332e1f 100644 --- a/components/shop/group/index.vue +++ b/components/shop/group/index.vue @@ -10,7 +10,7 @@ - + diff --git a/pageB/components/sdetails/guige.vue b/pageB/components/sdetails/guige.vue index 7ba8a6e..e156f6b 100644 --- a/pageB/components/sdetails/guige.vue +++ b/pageB/components/sdetails/guige.vue @@ -36,6 +36,7 @@ box-sizing: border-box; border-radius: 6rpx; margin-right: 26rpx; + margin-bottom: 20rpx; } .xuanzhong{ border: #ff780f 1rpx solid; diff --git a/pageB/sdetails/index.vue b/pageB/sdetails/index.vue index 8b3237f..fc11d45 100644 --- a/pageB/sdetails/index.vue +++ b/pageB/sdetails/index.vue @@ -22,10 +22,17 @@ {{ goodsInfo.store_name }} {{ goodsInfo.goods_name }} - - ¥{{ goodsInfo.goods_price }} - ¥{{ goodsInfo.goods_marketprice }} - + + + ¥{{ goodsInfo.goods_price }} + ¥{{ goodsInfo.goods_marketprice }} + + + + + 收藏 + + @@ -135,11 +142,11 @@ - + 店铺 - + 客服 @@ -154,7 +161,7 @@ - + 店铺 @@ -222,7 +229,6 @@ export default { // console.log(option); this.type = Number(option.type); this.id = option.id; - this.getGoodsDetails(this.id); this.setTitle(); }, onShow() { @@ -230,6 +236,7 @@ export default { this.showSpec = false; this.showGroupUser = false; this.showInvolvementUser = false; + this.getGoodsDetails(this.id); }, onNavigationBarButtonTap(e) { if(e.index == 0) this.$u.route('/pageC/cart/index'); @@ -331,6 +338,7 @@ export default { this.glist = res.data.data.spec_list; this.user_suc = res.data.data.user_suc; this.groupUser =res.data.data.user; + console.log(this.groupUser); } }) }, @@ -372,13 +380,14 @@ export default { } if(this.type == 2) { if(type == 'involvement') { + // const userId = uni.getStorageSync('user_info').member.member_id; + this.$store.commit('setGroupHeadId', this.involvemenGroupInfo[0].user_id); + console.log(this.$store.state.pintuangroup_headid); Object.assign(params, { pintuan_id: this.id, pintuangroup_id: this.involvemenGroupInfo[0].pintuangroup_id, }) } else { - const userId = uni.getStorageSync('user_info').member.member_id; - this.$store.commit('setGroupHeadId', userId); Object.assign(params, { pintuan_id: this.id, }) @@ -552,18 +561,31 @@ export default { line-height: 1.5; } } - .pic{ - >text{ - font-size: 32rpx; - color: #FF3131; - } - >s{ - font-size: 26rpx; - color: #999; - display: inline-block; - margin-left: 30rpx; - } - } + .price-collect { + display: flex; + align-items: center; + justify-content: space-between; + .pic{ + >text{ + font-size: 32rpx; + color: #FF3131; + } + >s{ + font-size: 26rpx; + color: #999; + display: inline-block; + margin-left: 30rpx; + } + } + .collect { + margin-left: auto; + display: flex; + align-items: center; + > text { + margin-left: 12rpx; + } + } + } } .comment { margin-top: 20rpx; diff --git a/pageC/cart/ConfirmOrder.vue b/pageC/cart/ConfirmOrder.vue index 5437805..0b5ee0c 100644 --- a/pageC/cart/ConfirmOrder.vue +++ b/pageC/cart/ConfirmOrder.vue @@ -179,12 +179,13 @@ export default { let params = { pintuan_id: this.orderInfo.pintuan_id, } - // console.log(this.involvemenGroupInfo); + // console.log(this.orderInfo); + // console.log(this.$store.state.pintuangroup_headid); if(this.orderInfo.pintuangroup_id) { Object.assign(params, { pintuangroup_headid: this.$store.state.pintuangroup_headid }); Object.assign(params, { pintuangroup_id: this.orderInfo.pintuangroup_id }); } - // console.log(params); + console.log(params); this.$u.api.withImmediate(params).then(res => { this.showGroupUser = false; this.showInvolvementUser = false; @@ -200,7 +201,6 @@ export default { if(!this.debounce) return; this.debounce = false; if(this.orderType == 2) { - // this.sendOrder(0); this.withImmediate(); } else if(this.orderType == 1) { this.sendOrder(0); @@ -256,7 +256,6 @@ export default { // console.log(params); this.$u.api.sendOrder(params).then(res => { if(res.errCode == 0) { - // this.withImmediate(); this.$u.route({ type: 'redirect', url: '/pageC/cart/cashier', diff --git a/pageC/cart/index.vue b/pageC/cart/index.vue index d88b5bc..bb720dd 100644 --- a/pageC/cart/index.vue +++ b/pageC/cart/index.vue @@ -4,7 +4,7 @@ - + {{ store.store_name }} @@ -12,9 +12,9 @@ - - - + + + {{ goods.goods_name }} ¥{{ goods.goods_price }} @@ -204,6 +204,23 @@ export default { }) this.list[value[1]].checked = checked; this.storeChange(); + }, + viewStoreDetails(sid) { + this.$u.route({ + url: 'pageC/merchant/index', + params: { + id: sid + } + }) + }, + viewGoodsDetails(gid) { + this.$u.route({ + url: 'pageB/sdetails/index', + params: { + id: gid, + type: 1, + } + }) } }, onNavigationBarButtonTap(btn) { diff --git a/pageC/components/merchant/image-top.vue b/pageC/components/merchant/image-top.vue index a061379..2435234 100644 --- a/pageC/components/merchant/image-top.vue +++ b/pageC/components/merchant/image-top.vue @@ -1,6 +1,6 @@