dengjie :解决点赞、收藏、客服电话等问题
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
<u-image src="/static/detail/xiangqing_icon_shoucang.png" width="119rpx" height="48rpx">
|
||||
</u-image>
|
||||
</view>
|
||||
<view class="collect" v-if="detailList.is_fav==1" @click="cancelStarTap(detailList.id)">
|
||||
<view class="collect" v-if="detailList.is_fav==1" @click="cancelStarTap(detailList.fav_id)">
|
||||
<view class="star">
|
||||
<u-image src="/static/detail/xp_icon_star.png" width="28rpx" height="28rpx">
|
||||
</u-image>
|
||||
@@ -34,19 +34,33 @@
|
||||
<view>
|
||||
<text class="tagOne" v-for="item in detailList.tags" :key="item.id">{{item}}</text>
|
||||
</view>
|
||||
<!-- thumb有值,显示数字+赞 -->
|
||||
<view v-if="detailList.thumb" class="heart">
|
||||
<u-image src="/static/detail/xp_icon_ysc.png" width="34rpx" height="32rpx">
|
||||
<!-- 如果用户对该商品没有点赞,显示灰星 -->
|
||||
<u-image v-if="detailList.is_thumb==0" src="/static/detail/xp_icon_heart.png" width="34rpx"
|
||||
height="32rpx" @click="heartTap">
|
||||
</u-image>
|
||||
<text class="thumb">{{detailList.thumb}}赞</text>
|
||||
<!-- 如果用户对该商品已经点赞,显示黄星-->
|
||||
<u-image v-if="detailList.is_thumb==1" src="/static/detail/xp_icon_ysc.png" width="34rpx"
|
||||
height="32rpx" @click="cancelHeartTap(detailList.thumb_id)">
|
||||
</u-image>
|
||||
<text class="thumb">{{detailList.thumb}} 赞</text>
|
||||
</view>
|
||||
<view v-else class="heart" @click="heartTap">
|
||||
<u-image v-if="showHeart==false" src="/static/detail/xp_icon_heart.png" width="34rpx"
|
||||
height="32rpx">
|
||||
</u-image>
|
||||
<u-image v-if="showHeart==true" src="/static/detail/xp_icon_ysc.png" width="34rpx"
|
||||
height="32rpx">
|
||||
</u-image>
|
||||
<text class="thumb">点赞</text>
|
||||
<!-- thumb无值,显示‘点赞’二字 ,用户进行一次点赞之后,显示1赞-->
|
||||
<view v-else class="heart">
|
||||
<view v-if="detailList.is_thumb==0">
|
||||
<u-image src="/static/detail/xp_icon_heart.png" width="34rpx" height="32rpx"
|
||||
@click="heartTap">
|
||||
</u-image>
|
||||
<text class="thumb" @click="heartTap">点赞</text>
|
||||
</view>
|
||||
<view v-if="detailList.is_thumb==1">
|
||||
<!-- 用户是否点赞字段 showHeart -->
|
||||
<u-image src="/static/detail/xp_icon_ysc.png" width="34rpx" height="32rpx"
|
||||
@click="cancelHeartTap(detailList.thumb_id)">
|
||||
</u-image>
|
||||
<text class="thumb">{{detailList.thumb}} 赞</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -75,7 +89,7 @@
|
||||
</u-overlay>
|
||||
</view>
|
||||
<u-modal :show="showM" :content='content' closeOnClickOverlay="false" showCancelButton="true"
|
||||
confirmText="升级VIP" @confirm="confirm" confirmColor="#0EBB5B">
|
||||
confirmText="升级VIP" @confirm="confirm" @cancel="cancel" confirmColor="#0EBB5B">
|
||||
<rich-text :nodes="content"></rich-text>
|
||||
</u-modal>
|
||||
</view>
|
||||
@@ -110,9 +124,6 @@
|
||||
this.imgUrl = uni.getStorageSync('img_url')
|
||||
if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
|
||||
this.isLoad = false
|
||||
// uni.navigateTo({
|
||||
// url: '../../pages/my/login/login'
|
||||
// })
|
||||
return
|
||||
}
|
||||
this.isLoad = true
|
||||
@@ -121,10 +132,7 @@
|
||||
//获取详情信息
|
||||
getProductDetail() {
|
||||
this.$apiServe.getProductDetail(this.id).then(res => {
|
||||
console.log('产品详情页', res.data)
|
||||
if (res.data.data.thumb) {
|
||||
this.isThumb = true
|
||||
}
|
||||
console.log('产品详情', res.data);
|
||||
if (res.data.msg == "没有权限访问" && uni.getStorageSync('loginToken')) {
|
||||
this.showM = true
|
||||
}
|
||||
@@ -132,16 +140,21 @@
|
||||
let detail = res.data.data
|
||||
detail.pub_time = dateFormatDetail(detail.pub_time)
|
||||
detail.tags = detail.tags.split(',')
|
||||
if (detail.is_thumb == 1) {
|
||||
detail.thumb = parseInt(detail.thumb) + parseInt(detail.thumbcount)
|
||||
} else {
|
||||
detail.thumb = parseInt(detail.thumb) - parseInt(detail.thumbcount)
|
||||
}
|
||||
this.detailList = detail
|
||||
} else {
|
||||
this.$toast.warn('没有更多详情了')
|
||||
}
|
||||
// else {
|
||||
// this.$toast.warn('没有更多详情了')
|
||||
// }
|
||||
}).finally(_ => {})
|
||||
},
|
||||
//点击star收藏
|
||||
starTap() {
|
||||
this.$apiServe.collect(this.id).then(res => {
|
||||
// console.log('收藏成功', res.data)
|
||||
if (res.data.code == 1) {
|
||||
this.$toast.warn('收藏成功')
|
||||
this.getProductDetail()
|
||||
@@ -151,31 +164,38 @@
|
||||
}).finally(_ => {})
|
||||
},
|
||||
//点击star取消收藏
|
||||
cancelStarTap(id) {
|
||||
// console.log('this.detailList.id', id);
|
||||
// this.$apiServe.deleteHistoryOrCollection(id).then(res => {
|
||||
// console.log('取消收藏', res.data);
|
||||
// // if (res.data.code == 1) {
|
||||
// // this.$toast.warn('取消收藏')
|
||||
// // this.getProductDetail()
|
||||
// // } else {
|
||||
// // this.$toast.warn('收藏失败')
|
||||
// // }
|
||||
// }).finally(_ => {})
|
||||
cancelStarTap(fav_id) {
|
||||
this.$apiServe.deleteHistoryOrCollection(fav_id).then(res => {
|
||||
if (res.data.code == 1) {
|
||||
this.$toast.warn('取消收藏')
|
||||
this.getProductDetail()
|
||||
} else {
|
||||
this.$toast.warn('取消收藏失败')
|
||||
}
|
||||
}).finally(_ => {})
|
||||
},
|
||||
//点赞按钮
|
||||
heartTap() {
|
||||
// this.showHeart = !this.showHeart
|
||||
this.$apiServe.thumb(this.id).then(res => {
|
||||
console.log('点赞成功', res.data)
|
||||
if (res.data.code == 1) {
|
||||
this.showHeart = 1
|
||||
this.getProductDetail()
|
||||
this.$toast.warn('点赞成功')
|
||||
} else {
|
||||
this.$toast.warn('点赞失败')
|
||||
}
|
||||
}).finally(_ => {})
|
||||
},
|
||||
//取消点赞
|
||||
cancelHeartTap(thumb_id) {
|
||||
this.$apiServe.cancelThumb(thumb_id).then(res => {
|
||||
if (res.data.code == 1) {
|
||||
this.getProductDetail()
|
||||
this.$toast.warn('取消点赞')
|
||||
} else {
|
||||
this.$toast.warn('取消点赞失败')
|
||||
}
|
||||
}).finally(_ => {})
|
||||
},
|
||||
reOnLoad() {
|
||||
if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
|
||||
this.$toast.warn('登录失败请重试')
|
||||
@@ -198,6 +218,11 @@
|
||||
url: '../../../packageMy/memberCenter/memberCenter?ask=' + 1
|
||||
})
|
||||
},
|
||||
cancel() {
|
||||
uni.reLaunch({
|
||||
url: '/pages/index/index'
|
||||
})
|
||||
},
|
||||
// 联系客服模态框
|
||||
showModal() {
|
||||
this.showCall = true
|
||||
|
||||
@@ -76,32 +76,12 @@
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
// this.login()
|
||||
this.getCategories()
|
||||
this.getBanner()
|
||||
this.getImgUrl()
|
||||
this.imgUrl = uni.getStorageSync('img_url')
|
||||
},
|
||||
methods: {
|
||||
// login() {
|
||||
// var that = this
|
||||
// uni.login({
|
||||
// "provider": "weixin",
|
||||
// "onlyAuthorize": true, // 微信登录仅请求授权认证
|
||||
// success: function(event) {
|
||||
// const {
|
||||
// code
|
||||
// } = event
|
||||
// that.$apiServe.login({
|
||||
// code: code
|
||||
// }).then(res => {
|
||||
// var data = res.data.data
|
||||
// // console.log('登录code换取的信息', data);
|
||||
// uni.setStorageSync('token', data.token);
|
||||
// })
|
||||
// },
|
||||
// })
|
||||
// },
|
||||
//获取按上架时间排列的产品列表length
|
||||
getTimeLength(e) {
|
||||
this.reachBottomLength = e
|
||||
|
||||
@@ -7,7 +7,10 @@
|
||||
<myAvatar ref="myavatar"></myAvatar>
|
||||
<view class="table">
|
||||
<u-cell-group>
|
||||
<u-cell size="large" title="绑定公司" icon="/static/my/wo_icon_bd.png" :isLink="true" value="未绑定公司"
|
||||
<u-cell v-if="is_bind" size="large" title="绑定公司" icon="/static/my/wo_icon_bd.png" :isLink="true"
|
||||
value="已绑定公司">
|
||||
</u-cell>
|
||||
<u-cell v-else size="large" title="绑定公司" icon="/static/my/wo_icon_bd.png" :isLink="true" value="未绑定公司"
|
||||
@click="bindCompany()">
|
||||
</u-cell>
|
||||
<u-cell size="large" title="会员中心" icon="/static/my/wo_icon_hyzx.png" :isLink="true"
|
||||
@@ -23,9 +26,9 @@
|
||||
</u-cell>
|
||||
</u-cell-group>
|
||||
<u-modal :show="showM" showCancelButton closeOnClickOverlay="false" confirmText="是" cancelText="否"
|
||||
@confirm="confirm" @cancel="cancel" @close="close">
|
||||
@confirm="confirm" @cancel="cancel">
|
||||
<view>
|
||||
<view>{{phone}}</view>
|
||||
<view>{{mobile}}</view>
|
||||
<text>是否拨打客服电话</text>
|
||||
</view>
|
||||
</u-modal>
|
||||
@@ -46,8 +49,9 @@
|
||||
data() {
|
||||
return {
|
||||
showM: false,
|
||||
phone: '138 1222 222',
|
||||
mobile: '',
|
||||
isLoad: true,
|
||||
is_bind: false
|
||||
}
|
||||
},
|
||||
onTabItemTap() {
|
||||
@@ -58,7 +62,19 @@
|
||||
}
|
||||
this.isLoad = true
|
||||
},
|
||||
onLoad() {
|
||||
if (uni.getStorageSync('com_mobile')) {
|
||||
this.is_bind = true
|
||||
}
|
||||
this.getCsTel()
|
||||
},
|
||||
methods: {
|
||||
//获取客服电话
|
||||
getCsTel() {
|
||||
this.$apiServe.getCsTel().then(res => {
|
||||
this.mobile = res.data.data.cs_tel
|
||||
}).finally(_ => {})
|
||||
},
|
||||
//跳转到绑定公司页面
|
||||
bindCompany() {
|
||||
uni.navigateTo({
|
||||
@@ -95,7 +111,7 @@
|
||||
},
|
||||
confirm() {
|
||||
this.showM = false
|
||||
let phone = '1381222222'
|
||||
let phone = ''
|
||||
uni.makePhoneCall({
|
||||
phoneNumber: phone,
|
||||
success: function() {
|
||||
@@ -109,9 +125,6 @@
|
||||
cancel() {
|
||||
this.showM = false
|
||||
},
|
||||
close() {
|
||||
this.showM = false
|
||||
},
|
||||
reOnLoad() {
|
||||
if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
|
||||
this.$toast.warn('登录失败请重试')
|
||||
|
||||
Reference in New Issue
Block a user