From eb0d648f6aab155c22f88d9f03b40acc29d2d977 Mon Sep 17 00:00:00 2001 From: luyuan <1162963624@qq.com> Date: Fri, 7 Aug 2020 11:40:13 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/api/shop.js | 4 ++++ common/http.interceptor.js | 8 +++---- pageB/sdetails/index.vue | 35 +++++++++++++++++++++++++++++-- pages/index/index.vue | 19 ++++++++++++++++- pages/information/information.vue | 16 +------------- 5 files changed, 60 insertions(+), 22 deletions(-) diff --git a/common/api/shop.js b/common/api/shop.js index 2db23d5..d3c4551 100644 --- a/common/api/shop.js +++ b/common/api/shop.js @@ -318,6 +318,10 @@ export default { addFavoriteStore({ id }) { return vm.$u.post('member/addFavoriteStore',{ fid: id }) }, + //店家id获取用户信息 + getAtwillUserInfo({ id }) { + return vm.$u.post('Specialci/getAtwillUserInfo',{ store_id: id }) + }, } } diff --git a/common/http.interceptor.js b/common/http.interceptor.js index 5484ac8..c1b271c 100644 --- a/common/http.interceptor.js +++ b/common/http.interceptor.js @@ -4,7 +4,7 @@ const install = (Vue, vm) => { baseUrl: 'https://dmmall.sdbairui.com/api', loadingText: '努力加载中~', loadingTime: 800, - // originalData: true + originalData: true }); // 请求拦截,配置Token等参数 @@ -20,12 +20,12 @@ const install = (Vue, vm) => { // 响应拦截,如配置,每次请求结束都会执行本方法 Vue.prototype.$u.http.interceptor.response = (res) => { - if(parseInt(res.errCode) == 0) { + if(parseInt(res.data.errCode) == 0) { // res为服务端返回值,可能有errCode,result等字段 // 这里对res.result进行返回,将会在this.$u.post(url).then(res => {})的then回调中的res的到 // 如果配置了originalData为true,请留意这里的返回值 - return res; - } else if(res.errCode == 401) { + return res.data; + } else if(res.data.errCode == 401) { // 假设201为token失效,这里跳转登录 vm.$u.toast('验证失败,请重新登录'); setTimeout(() => { diff --git a/pageB/sdetails/index.vue b/pageB/sdetails/index.vue index 8b3237f..15b5768 100644 --- a/pageB/sdetails/index.vue +++ b/pageB/sdetails/index.vue @@ -139,7 +139,7 @@ 店铺 - + 客服 @@ -159,7 +159,7 @@ 店铺 - + 客服 @@ -204,6 +204,7 @@ export default { sel: "", // 拼接的规格 quanxuan: false, // 规格是否选择 debounce: true, + storeid:0 //店铺id } }, components: { @@ -238,6 +239,34 @@ export default { clearInterval(this.timer); }, methods: { + customers(){ + 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 = text; + this.time = time; + this.date = date + } + console.log(123) + this.$u.api.getAtwillUserInfo({ + id:this.storeid + }).then((res)=>{ + console.log(res) + let user = new Friend(res.data.member_id,res.data.member_nickname,res.data.member_avatar) + this.$u.route({ + url:"/pageD/privateChat/privateChat", + params:{ + id:JSON.stringify(user) + } + + }) + }).catch((err)=>{ + console.log(err) + }) + }, setSwiperList(list) { let img = []; list.forEach(item => { @@ -309,12 +338,14 @@ export default { // 普通商品详情 ordinaryDetails(id) { this.$u.api.getGoodsDetails({ id: id }).then((res)=>{ + console.log(res) if (res.errCode == 0) { this.evaluate = res.data.goods_evaluate_info; this.goodsInfo = res.data.goods; this.storeInfo = res.data.store; this.setSwiperList(res.data.goods_image); this.glist = res.data.spec_list; + this.storeid = res.data.store.store_id // console.log(this.goodsInfo.mobile_body); } }) diff --git a/pages/index/index.vue b/pages/index/index.vue index 6107732..97074b8 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -231,6 +231,23 @@ this.tabLiveList(); this.getFollowList(); }, + onLoad(){ + if(this.$store.state.hasLogin){ + const user = uni.getStorageSync('user_info'); + console.log(user) + this.imService.login(user.member.member_id,user.member.member_nickname,user.member.member_avatar) + this.imService.connectIM() + let that = this + setTimeout(function(){ + that.imService.disconnect() + console.log("guanbi") + },1000) + setTimeout(function(){ + console.log("lianjie") + that.imService.connectIM() + },2000) + } + }, onPullDownRefresh() { this.getArticlelist(); // this.getManicureList({ load: 'reload' }); @@ -356,4 +373,4 @@ }, }, } - + diff --git a/pages/information/information.vue b/pages/information/information.vue index d901848..5f7d672 100644 --- a/pages/information/information.vue +++ b/pages/information/information.vue @@ -100,21 +100,7 @@ if (this.hasLogin) { this.messageIndex(); } - if(this.$store.state.hasLogin){ - const user = uni.getStorageSync('user_info'); - console.log(user) - this.imService.login(user.member.member_id,user.member.member_nickname,user.member.member_avatar) - this.imService.connectIM() - let that = this - setTimeout(function(){ - that.imService.disconnect() - console.log("guanbi") - },1000) - setTimeout(function(){ - console.log("lianjie") - that.imService.connectIM() - },2000) - } + }, methods: { gochat(id){ From a088c895d229a6b3365e6c2b1fbd9db4196f3e3c Mon Sep 17 00:00:00 2001 From: ghusermoon <2673031505@qq.com> Date: Fri, 7 Aug 2020 11:59:08 +0800 Subject: [PATCH 2/7] collect 8.7 --- common/api/shop.js | 13 +++++- common/http.interceptor.js | 3 +- components/mine/collection-item/index.vue | 17 +++++--- components/mine/coupon/mine.vue | 2 +- components/shop/list/index.vue | 4 +- pageB/sdetails/index.vue | 51 +++++++++++++++++------ pageE/mine/StoreCollection.vue | 1 - pageE/order/Index.vue | 2 +- pages.json | 1 - pages/mine/index.vue | 12 ++++-- 10 files changed, 76 insertions(+), 30 deletions(-) diff --git a/common/api/shop.js b/common/api/shop.js index 2db23d5..94feed6 100644 --- a/common/api/shop.js +++ b/common/api/shop.js @@ -314,10 +314,21 @@ export default { goodsShelves({live_id}){ return vm.$u.post('Specialci/goodsShelves',{live_id}) }, - // + // 收藏店铺 addFavoriteStore({ id }) { return vm.$u.post('member/addFavoriteStore',{ fid: id }) }, + // 收藏商品 + addFavoriteGoods({ fid }) { + return vm.$u.post('member/addFavoriteGoods',{ fid: fid }) + }, + // 取消收藏(商品/店铺) + removeFavorite({ fid, type }) { + return vm.$u.post('Member/removeFavorite',{ + fav_id: fid, + type: type + }) + } } } diff --git a/common/http.interceptor.js b/common/http.interceptor.js index d27505a..79483b9 100644 --- a/common/http.interceptor.js +++ b/common/http.interceptor.js @@ -48,7 +48,8 @@ const install = (Vue, vm) => { } return false; } else if (res.errCode == 1) { - console.log(res.message); + // console.log(res.message); + return res; } else { // 如果返回false,则会调用Promise的reject回调, // 并将进入this.$u.post(url).then().catch(res=>{})的catch回调中,res为服务端的返回值 diff --git a/components/mine/collection-item/index.vue b/components/mine/collection-item/index.vue index 8c81c56..95c511c 100644 --- a/components/mine/collection-item/index.vue +++ b/components/mine/collection-item/index.vue @@ -3,7 +3,7 @@ ¥{{ item.favlog_price }} - {{ item.fav_time }} + {{ item.fav_time | date }} @@ -31,7 +31,6 @@ export default { data() { return { list: [], - show: false, options: [ { text: '删除', @@ -50,16 +49,22 @@ export default { this.$u.api.getFavoritesList().then(res => { if(res.errCode == 0) { this.list = res.data; + this.list.forEach(item => { + Object.assign(item, { show: false }); + }) } }) }, - removeFavorite(id) { + removeFavorite(index) { + const id = this.list[index].fav_id; this.$u.api.removeFavorite({ - id: id + fid: id, + type: 'goods' }).then(res => { - this.$u.toast(res.message); if(res.errCode == 0) { this.getGoodsFavoritesList(); + } else { + this.$u.toast(res.message); } }) }, diff --git a/components/mine/coupon/mine.vue b/components/mine/coupon/mine.vue index 30813ec..a41172a 100644 --- a/components/mine/coupon/mine.vue +++ b/components/mine/coupon/mine.vue @@ -10,7 +10,7 @@ {{ couponInfo.voucher_price }} 满{{ couponInfo.voucher_limit }}使用 - 仅限{{ couponInfo.type == 1 ? '平台' : couponInfo.store_name }}{{ couponInfo.gc_id | showClass(goodsClass) }}商品使用 + 仅限{{ couponInfo.type == 1 ? '指定商品' : couponInfo.store_name }}{{ couponInfo.gc_id | showClass(goodsClass) }}商品使用 兑换积分:{{ couponInfo.voucher_points }}积分 有效期{{ couponInfo.voucher_startdate }}-{{ couponInfo.voucher_enddate }} diff --git a/components/shop/list/index.vue b/components/shop/list/index.vue index 0f607b6..f524ac9 100644 --- a/components/shop/list/index.vue +++ b/components/shop/list/index.vue @@ -13,7 +13,7 @@ - + diff --git a/pageE/mine/StoreCollection.vue b/pageE/mine/StoreCollection.vue index fd796ca..78325a1 100644 --- a/pageE/mine/StoreCollection.vue +++ b/pageE/mine/StoreCollection.vue @@ -51,7 +51,6 @@ export default { }) }, removeFavorite(id) { - console.log(id); this.$u.api.removeFavorite({ id: id, type: 'store' diff --git a/pageE/order/Index.vue b/pageE/order/Index.vue index 90ac9a8..d7d149e 100644 --- a/pageE/order/Index.vue +++ b/pageE/order/Index.vue @@ -13,7 +13,7 @@ - + diff --git a/pages.json b/pages.json index 1eca007..e0be766 100644 --- a/pages.json +++ b/pages.json @@ -1030,7 +1030,6 @@ { "path": "pages/mine/index", "style": { - "enablePullDownRefresh": true, "navigationBarTitleText": "我的", "app-plus": { "titleSize": "36px", diff --git a/pages/mine/index.vue b/pages/mine/index.vue index 1dd2aa2..9b9650e 100644 --- a/pages/mine/index.vue +++ b/pages/mine/index.vue @@ -19,10 +19,10 @@ 会员服务 - + @@ -45,6 +45,18 @@ export default { this.getGoodsFavoritesList(); }, methods: { + viewGoodsDetails(item) { + const list = this.list.filter(item => { + return item.show; + }) + if(list.length) return false; + this.$u.route({ + url: 'pageB/sdetails/index', + params: { + id: item.fav_id, + } + }) + }, getGoodsFavoritesList() { this.$u.api.getFavoritesList().then(res => { if(res.errCode == 0) { @@ -75,6 +87,7 @@ export default { this.list.map((val, idx) => { if(index != idx) this.list[idx].show = false; }) + this.$forceUpdate(); } }, }; diff --git a/components/mine/coupon/index.vue b/components/mine/coupon/index.vue index 67bbb89..f9648e3 100644 --- a/components/mine/coupon/index.vue +++ b/components/mine/coupon/index.vue @@ -10,7 +10,7 @@ {{ couponInfo.vouchertemplate_price }} 满{{ couponInfo.vouchertemplate_limit }}使用 - 仅限{{ couponInfo.vouchertemplate_storename }}商品使用 + 仅限{{ couponInfo.type == 2 ? couponInfo.vouchertemplate_storename : '指定商品' }}使用 兑换积分:{{ couponInfo.vouchertemplate_points }}积分 有效期{{ couponInfo.vouchertemplate_startdate }}-{{ couponInfo.vouchertemplate_enddate }} diff --git a/components/shop/recommend/pintuan.vue b/components/shop/recommend/pintuan.vue index f27c76e..25a7589 100644 --- a/components/shop/recommend/pintuan.vue +++ b/components/shop/recommend/pintuan.vue @@ -60,8 +60,9 @@ export default { this.$u.route({ url: 'pageB/sdetails/index', params: { - id: this.recommendData.pintuan_id, - type: 2, + // id: this.recommendData.pintuan_id, + id: this.recommendData.groupbuy_id, + // type: 2, } }) } diff --git a/components/shop/seckill/item.vue b/components/shop/seckill/item.vue index efebd34..1dc7258 100644 --- a/components/shop/seckill/item.vue +++ b/components/shop/seckill/item.vue @@ -45,8 +45,9 @@ export default { this.$u.route({ url: 'pageB/sdetails/index', params: { - id: this.item.groupbuy_id, - type: 3, + // id: this.item.groupbuy_id, + id: this.item.goods_id, + // type: 3, } }) }, diff --git a/pageB/sdetails/index.vue b/pageB/sdetails/index.vue index 3e16d25..d937efc 100644 --- a/pageB/sdetails/index.vue +++ b/pageB/sdetails/index.vue @@ -133,7 +133,7 @@ 购买数量 - + @@ -230,7 +230,6 @@ export default { // this.type = Number(option.type); // this.type = 1; this.id = option.id; - this.setTitle(); // 先请求普通商品详情获取商品类型再渲染页面 this.ordinaryDetails(this.id); }, @@ -299,9 +298,9 @@ export default { }, getGoodsDetails(id) { switch (this.type) { - // case 1: - // this.ordinaryDetails(id); - // break; + case 1: + this.ordinaryDetails(id); + break; case 2: this.pinTuanDetails(id); break; @@ -322,7 +321,16 @@ export default { this.setSwiperList(res.data.goods_image); this.glist = res.data.spec_list; this.type = res.data.view_type; - this.getGoodsDetails(this.type); + this.setTitle(); + if(this.type == 1) { + this.id = res.data.goods.goods_id; + } else if(this.type == 2) { + this.id = res.data.goods.pintuan_id; + this.getGoodsDetails(this.id); + } else if(this.type == 3) { + this.id = res.data.goods.groupbuy_id; + this.getGoodsDetails(this.id); + } } }) }, @@ -338,7 +346,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); + // console.log(this.groupUser); } }) }, @@ -348,6 +356,7 @@ export default { groupbuy_id: id }).then(res => { if(res.errCode == 0) { + this.id = res.data.groupbuy_id; this.groupbuyInfo = res.data.groupbuyInfo; this.evaluate = res.data.goodsInfo.goods_evaluate_info; this.goodsInfo = res.data.goodsInfo.goods; @@ -361,7 +370,7 @@ export default { this.$u.route({ url: '/pageB/triedDress/index', params: { - id: this.id, + id: this.goodsInfo.goods_id, } }) }, @@ -412,9 +421,6 @@ export default { this.showInvolvementUser = true; // console.log(this.involvemenGroupInfo); }, - valChange(e) { - // console.log(this.value) - }, self(){ // console.log(this.$refs.guige) let index = 0; @@ -490,7 +496,7 @@ export default { } }, addFavoriteGoods() { - this.$u.api.addFavoriteGoods({ fid: this.id }).then(res => { + this.$u.api.addFavoriteGoods({ fid: this.goodsInfo.goods_id }).then(res => { if(res.errCode == 0) { this.getGoodsDetails(this.id); } else { @@ -499,7 +505,7 @@ export default { }) }, removeFavorite() { - this.$u.api.removeFavorite({ fid: this.id, type: 'goods' }).then(res => { + this.$u.api.removeFavorite({ fid: this.goodsInfo.goods_id, type: 'goods' }).then(res => { if(res.errCode == 0) { this.getGoodsDetails(this.id); } else { diff --git a/pageC/cart/index.vue b/pageC/cart/index.vue index bb720dd..6e49827 100644 --- a/pageC/cart/index.vue +++ b/pageC/cart/index.vue @@ -14,8 +14,8 @@ - - {{ goods.goods_name }} + + {{ goods.goods_name }} ¥{{ goods.goods_price }} @@ -238,7 +238,7 @@ export default { // #ifdef APP-PLUS let currentWebview = page.$getAppWebview(); let titleObj = currentWebview.getStyle().titleNView; - console.log(JSON.stringify(titleObj.buttons[0])); + // console.log(JSON.stringify(titleObj.buttons[0])); if (!titleObj.buttons) { return; } diff --git a/pageE/mine/MemberServeCoupon.vue b/pageE/mine/MemberServeCoupon.vue index e9a9a0b..f2694f0 100644 --- a/pageE/mine/MemberServeCoupon.vue +++ b/pageE/mine/MemberServeCoupon.vue @@ -1,9 +1,11 @@ \ No newline at end of file diff --git a/pageE/order/Index.vue b/pageE/order/Index.vue index d7d149e..f2c2e82 100644 --- a/pageE/order/Index.vue +++ b/pageE/order/Index.vue @@ -5,7 +5,7 @@ - + @@ -13,7 +13,7 @@ - + @@ -162,8 +162,7 @@ export default { return res.data.list.length; }, reachBottom() { - // 大于15条才会加载更多 - if(this.orderList.length < 15) return false; + if(this.current == 4) return; if(!this.timer) return false; this.timer = false; this.loadStatus.splice(this.current, 1, "loading"); @@ -171,8 +170,8 @@ export default { let promise; // if(this.current == 6) promise = this.getAfterSaleList(); // else - if(this.current == 4) promise = this.goodsTryOrderList(); - else promise = this.getOrderList(); + // if(this.current == 4) promise = this.goodsTryOrderList(); + promise = this.getOrderList(); promise.then(length => { this.loadStatus.splice(this.current, 1, "nomore"); if(length == 0) this.page--; @@ -204,8 +203,10 @@ export default { display: flex; flex-direction: column; .swiper-item { - .item-container { - padding: 20rpx 30rpx; + .order-scroll { + .item-container { + padding: 20rpx 30rpx; + } } } } From 6eeebf25c021a79185b6c1821f39fdc99f3bcf26 Mon Sep 17 00:00:00 2001 From: luyuan <1162963624@qq.com> Date: Fri, 7 Aug 2020 17:37:23 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E6=B8=85=E7=A9=BA=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/information/information.vue | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pages/information/information.vue b/pages/information/information.vue index 726086f..f44ad09 100644 --- a/pages/information/information.vue +++ b/pages/information/information.vue @@ -161,10 +161,14 @@ }, // 清空消息 delMessage(){ + this.$u.api.delMessage({ type : "all" }).then((res)=>{ console.log(res) + this.imService.friends = {}; + this.information_dl = []; + uni.setStorageSync('imlist',JSON.stringify([])); if(res.errCode == 0){ this.$refs.uToast.show({ title: '清除成功', From 07e1661a18e2ff63072072d6cf884102b55d4ce8 Mon Sep 17 00:00:00 2001 From: luyuan <1162963624@qq.com> Date: Fri, 7 Aug 2020 18:03:40 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/http.interceptor.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/http.interceptor.js b/common/http.interceptor.js index c21e20c..26cec89 100644 --- a/common/http.interceptor.js +++ b/common/http.interceptor.js @@ -65,13 +65,13 @@ const install = (Vue, vm) => { }) } return false; - } else if (res.errCode == 1) { + } else if (res.data.errCode == 1) { // console.log(res.message); - return res; + return res.data; } else { // 如果返回false,则会调用Promise的reject回调, // 并将进入this.$u.post(url).then().catch(res=>{})的catch回调中,res为服务端的返回值 - return res; + return res.data; } }