|
|
@ -19,15 +19,7 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="wrapper bargain-box time on"> |
|
|
|
<view class="wrapper bargain-box time on"> |
|
|
|
<div class="pictxt "> |
|
|
|
<div class="pictxt "> |
|
|
|
<count-down |
|
|
|
<count-down :isDay="true" :tipText="'倒计时 '" :dayText="' 天 '" :hourText="' 时 '" :minuteText="' 分 '" :secondText="' 秒'" :datatime="goodsDetail.stopTime"></count-down> |
|
|
|
:isDay="true" |
|
|
|
|
|
|
|
:tipText="'倒计时 '" |
|
|
|
|
|
|
|
:dayText="' 天 '" |
|
|
|
|
|
|
|
:hourText="' 时 '" |
|
|
|
|
|
|
|
:minuteText="' 分 '" |
|
|
|
|
|
|
|
:secondText="' 秒'" |
|
|
|
|
|
|
|
:datatime="goodsDetail.stopTime" |
|
|
|
|
|
|
|
></count-down> |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="wrapper bargain-box bargain-product"> |
|
|
|
<view class="wrapper bargain-box bargain-product"> |
|
|
@ -156,28 +148,19 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
<script> |
|
|
|
<script> |
|
|
|
import CountDown from '@/components/CountDown'; |
|
|
|
import CountDown from '@/components/CountDown' |
|
|
|
import { |
|
|
|
import { getBargainDetail, getBargainShare, getBargainStart, getBargainHelp, getBargainHelpPrice, getBargainHelpList, getBargainHelpCount, getBargainStartUser } from '@/api/activity' |
|
|
|
getBargainDetail, |
|
|
|
import { postCartAdd } from '@/api/store' |
|
|
|
getBargainShare, |
|
|
|
import { mapGetters } from 'vuex' |
|
|
|
getBargainStart, |
|
|
|
import {} from '@/libs/wechat' |
|
|
|
getBargainHelp, |
|
|
|
import { isWeixin, parseQuery, handleQrCode } from '@/utils/index' |
|
|
|
getBargainHelpPrice, |
|
|
|
|
|
|
|
getBargainHelpList, |
|
|
|
|
|
|
|
getBargainHelpCount, |
|
|
|
|
|
|
|
getBargainStartUser |
|
|
|
|
|
|
|
} from '@/api/activity'; |
|
|
|
|
|
|
|
import { postCartAdd } from '@/api/store'; |
|
|
|
|
|
|
|
import { mapGetters } from 'vuex'; |
|
|
|
|
|
|
|
import {} from '@/libs/wechat'; |
|
|
|
|
|
|
|
import { isWeixin, parseQuery, handleQrCode } from '@/utils/index'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const NAME = 'DargainDetails'; |
|
|
|
const NAME = 'DargainDetails' |
|
|
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
export default { |
|
|
|
name: 'DargainDetails', |
|
|
|
name: 'DargainDetails', |
|
|
|
components: { |
|
|
|
components: { |
|
|
|
CountDown |
|
|
|
CountDown, |
|
|
|
}, |
|
|
|
}, |
|
|
|
props: {}, |
|
|
|
props: {}, |
|
|
|
data: function() { |
|
|
|
data: function() { |
|
|
@ -203,41 +186,41 @@ export default { |
|
|
|
inviteFriends: false, // 邀请好友 |
|
|
|
inviteFriends: false, // 邀请好友 |
|
|
|
helpFriendsBargain: false, // 帮好友砍 |
|
|
|
helpFriendsBargain: false, // 帮好友砍 |
|
|
|
bargainSuccess: false, // 帮好友砍价成功 |
|
|
|
bargainSuccess: false, // 帮好友砍价成功 |
|
|
|
mainBargainSuccess: false // 砍价成功 |
|
|
|
mainBargainSuccess: false, // 砍价成功 |
|
|
|
}; |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
computed: mapGetters(['userInfo', 'isLogin']), |
|
|
|
computed: mapGetters(['userInfo', 'isLogin']), |
|
|
|
mounted: function() { |
|
|
|
mounted: function() { |
|
|
|
this.mountedStart(); |
|
|
|
this.mountedStart() |
|
|
|
}, |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
methods: { |
|
|
|
// 开始处理砍价逻辑 |
|
|
|
// 开始处理砍价逻辑 |
|
|
|
mountedStart: function() { |
|
|
|
mountedStart: function() { |
|
|
|
var that = this; |
|
|
|
var that = this |
|
|
|
let url = handleQrCode(); |
|
|
|
let url = handleQrCode() |
|
|
|
// bargainId 砍价商品id |
|
|
|
// bargainId 砍价商品id |
|
|
|
// bargainUid 发起砍价人 |
|
|
|
// bargainUid 发起砍价人 |
|
|
|
if (url) { |
|
|
|
if (url) { |
|
|
|
// 通过二维码进来 |
|
|
|
// 通过二维码进来 |
|
|
|
that.bargainId = url.bargainId; |
|
|
|
that.bargainId = url.bargainId |
|
|
|
that.bargainUid = url.partake; |
|
|
|
that.bargainUid = url.partake |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
// 正常途径进来 |
|
|
|
// 正常途径进来 |
|
|
|
that.bargainId = that.$yroute.query.id; |
|
|
|
that.bargainId = that.$yroute.query.id |
|
|
|
that.bargainUid = that.$yroute.query.partake; |
|
|
|
that.bargainUid = that.$yroute.query.partake |
|
|
|
} |
|
|
|
} |
|
|
|
if (this.bargainUid == 0 || !this.bargainUid) { |
|
|
|
if (this.bargainUid == 0 || !this.bargainUid) { |
|
|
|
// url未携带用户uid,填上登录用户uid,跳转 |
|
|
|
// url未携带用户uid,填上登录用户uid,跳转 |
|
|
|
that.bargainUid = that.userInfo.uid; |
|
|
|
that.bargainUid = that.userInfo.uid |
|
|
|
} |
|
|
|
} |
|
|
|
console.log(this); |
|
|
|
console.log(this) |
|
|
|
|
|
|
|
|
|
|
|
// 获取商品详情 |
|
|
|
// 获取商品详情 |
|
|
|
that.getBargainDetail(); |
|
|
|
that.getBargainDetail() |
|
|
|
// 砍价数据统计 |
|
|
|
// 砍价数据统计 |
|
|
|
that.getBargainShare(0); |
|
|
|
that.getBargainShare(0) |
|
|
|
if (that.bargainUid !== that.userInfo.uid) { |
|
|
|
if (that.bargainUid !== that.userInfo.uid) { |
|
|
|
that.getBargainStartUser(); |
|
|
|
that.getBargainStartUser() |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 发起砍价 |
|
|
|
// 发起砍价 |
|
|
@ -245,255 +228,258 @@ export default { |
|
|
|
//发起人和当前用户为同一人 |
|
|
|
//发起人和当前用户为同一人 |
|
|
|
if (this.bargainUid === this.userInfo.uid) { |
|
|
|
if (this.bargainUid === this.userInfo.uid) { |
|
|
|
// 变更为当前用户砍价页面 |
|
|
|
// 变更为当前用户砍价页面 |
|
|
|
this.getBargainStart(); |
|
|
|
this.getBargainStart() |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
// 发起人与当前用户非同一人,变更为发起人的砍价页面 |
|
|
|
// 发起人与当前用户非同一人,变更为发起人的砍价页面 |
|
|
|
this.getBargainStartUser(); |
|
|
|
this.getBargainStartUser() |
|
|
|
} |
|
|
|
} |
|
|
|
this.getBargainHelpCount(); |
|
|
|
this.getBargainHelpCount() |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 查看商品 |
|
|
|
// 查看商品 |
|
|
|
openAlone: function() { |
|
|
|
openAlone: function() { |
|
|
|
this.$yrouter.push({ |
|
|
|
this.$yrouter.push({ |
|
|
|
path: '/pages/shop/GoodsCon/index', |
|
|
|
path: '/pages/shop/GoodsCon/index', |
|
|
|
query: { |
|
|
|
query: { |
|
|
|
id: this.goodsDetail.productId |
|
|
|
id: this.goodsDetail.productId, |
|
|
|
} |
|
|
|
}, |
|
|
|
}); |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 砍价完成,去支付 |
|
|
|
// 砍价完成,去支付 |
|
|
|
goPay: function() { |
|
|
|
goPay: function() { |
|
|
|
var data = {}; |
|
|
|
var data = {} |
|
|
|
var that = this; |
|
|
|
var that = this |
|
|
|
data.productId = that.goodsDetail.productId; |
|
|
|
data.productId = that.goodsDetail.productId |
|
|
|
data.cartNum = that.goodsDetail.num; |
|
|
|
data.cartNum = that.goodsDetail.num |
|
|
|
data.uniqueId = ''; |
|
|
|
data.uniqueId = '' |
|
|
|
data.bargainId = that.bargainId; |
|
|
|
data.bargainId = that.bargainId |
|
|
|
data.new = 1; |
|
|
|
data.new = 1 |
|
|
|
postCartAdd(data) |
|
|
|
postCartAdd(data) |
|
|
|
.then(res => { |
|
|
|
.then(res => { |
|
|
|
that.$yrouter.push({ |
|
|
|
that.$yrouter.push({ |
|
|
|
path: '/pages/order/OrderSubmission/index', |
|
|
|
path: '/pages/order/OrderSubmission/index', |
|
|
|
query: { |
|
|
|
query: { |
|
|
|
id: res.data.cartId |
|
|
|
id: res.data.cartId, |
|
|
|
} |
|
|
|
}, |
|
|
|
}); |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
.catch(err => { |
|
|
|
.catch(err => { |
|
|
|
uni.showToast({ |
|
|
|
uni.showToast({ |
|
|
|
title: err.msg || err.response.data.msg || err.response.data.message, |
|
|
|
title: err.msg || err.response.data.msg || err.response.data.message, |
|
|
|
icon: 'none', |
|
|
|
icon: 'none', |
|
|
|
duration: 2000 |
|
|
|
duration: 2000, |
|
|
|
}); |
|
|
|
}) |
|
|
|
}); |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 生成海报 |
|
|
|
// 生成海报 |
|
|
|
goPoster: function() { |
|
|
|
goPoster: function() { |
|
|
|
var that = this; |
|
|
|
var that = this |
|
|
|
that.getBargainShare(that.bargainId); |
|
|
|
that.getBargainShare(that.bargainId) |
|
|
|
this.$yrouter.push({ |
|
|
|
this.$yrouter.push({ |
|
|
|
path: '/pages/activity/Poster/index', |
|
|
|
path: '/pages/activity/Poster/index', |
|
|
|
query: { |
|
|
|
query: { |
|
|
|
id: that.bargainId, |
|
|
|
id: that.bargainId, |
|
|
|
type: 2 |
|
|
|
type: 2, |
|
|
|
} |
|
|
|
}, |
|
|
|
}); |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 跳转砍价商品列表 |
|
|
|
// 跳转砍价商品列表 |
|
|
|
goList: function() { |
|
|
|
goList: function() { |
|
|
|
this.$yrouter.push({ |
|
|
|
this.$yrouter.push({ |
|
|
|
path: '/pages/activity/GoodsBargain/index' |
|
|
|
path: '/pages/activity/GoodsBargain/index', |
|
|
|
}); |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
//砍价分享 |
|
|
|
//砍价分享 |
|
|
|
//bargainId 0 获取 查看人数 分享人数 参与人数 |
|
|
|
//bargainId 0 获取 查看人数 分享人数 参与人数 |
|
|
|
//bargainId 砍价产品编号 添加分享次数 获取 查看人数 分享人数 参与人数 |
|
|
|
//bargainId 砍价产品编号 添加分享次数 获取 查看人数 分享人数 参与人数 |
|
|
|
getBargainShare: function(bargainId) { |
|
|
|
getBargainShare: function(bargainId) { |
|
|
|
var that = this; |
|
|
|
var that = this |
|
|
|
getBargainShare({ |
|
|
|
getBargainShare({ |
|
|
|
bargainId: bargainId |
|
|
|
bargainId: bargainId, |
|
|
|
}).then(res => { |
|
|
|
}).then(res => { |
|
|
|
that.bargainShare = res.data; |
|
|
|
that.bargainShare = res.data |
|
|
|
}); |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 获取产品详情 |
|
|
|
// 获取产品详情 |
|
|
|
getBargainDetail: function() { |
|
|
|
getBargainDetail: function() { |
|
|
|
var that = this; |
|
|
|
var that = this |
|
|
|
uni.showLoading({ |
|
|
|
uni.showLoading({ |
|
|
|
title: '加载中', |
|
|
|
title: '加载中', |
|
|
|
mask: true |
|
|
|
mask: true, |
|
|
|
}); |
|
|
|
}) |
|
|
|
getBargainDetail(that.bargainId) |
|
|
|
getBargainDetail(that.bargainId) |
|
|
|
.then(res => { |
|
|
|
.then(res => { |
|
|
|
uni.hideLoading(); |
|
|
|
uni.hideLoading() |
|
|
|
that.goodsDetail = res.data.bargain; |
|
|
|
that.goodsDetail = res.data.bargain |
|
|
|
that.goodsDetail.description = that.goodsDetail.description.replace(/\<img/gi, '<img style="max-width:100%;height:auto;"'); |
|
|
|
that.goodsDetail.description = that.goodsDetail.description.replace(/\<img/gi, '<img style="max-width:100%;height:auto;"') |
|
|
|
that.goodsDetail.rule = that.goodsDetail.rule.replace(/\<img/gi, '<img style="max-width:100%;height:auto;"'); |
|
|
|
that.goodsDetail.rule = that.goodsDetail.rule.replace(/\<img/gi, '<img style="max-width:100%;height:auto;"') |
|
|
|
that.goodsDetail.stopTime = that.goodsDetail.stopTime / 1000; |
|
|
|
that.goodsDetail.stopTime = that.goodsDetail.stopTime / 1000 |
|
|
|
that.getBargainHelpCount(); |
|
|
|
that.getBargainHelpCount() |
|
|
|
}) |
|
|
|
}) |
|
|
|
.catch(res => { |
|
|
|
.catch(res => { |
|
|
|
uni.hideLoading(); |
|
|
|
uni.hideLoading() |
|
|
|
uni.showToast({ |
|
|
|
uni.showToast({ |
|
|
|
title: res.msg, |
|
|
|
title: res.msg, |
|
|
|
icon: 'none', |
|
|
|
icon: 'none', |
|
|
|
duration: 2000 |
|
|
|
duration: 2000, |
|
|
|
}); |
|
|
|
}) |
|
|
|
}); |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 开启砍价-发起人与当前用户非同一人 |
|
|
|
// 开启砍价-发起人与当前用户非同一人 |
|
|
|
getBargainStart: function() { |
|
|
|
getBargainStart: function() { |
|
|
|
var that = this; |
|
|
|
var that = this |
|
|
|
getBargainStart({ |
|
|
|
getBargainStart({ |
|
|
|
bargainId: that.bargainId |
|
|
|
bargainId: that.bargainId, |
|
|
|
}) |
|
|
|
}) |
|
|
|
.then(() => { |
|
|
|
.then(() => { |
|
|
|
that.bargainUid = that.userInfo.uid; |
|
|
|
that.bargainUid = that.userInfo.uid |
|
|
|
that.getBargainHelp(); |
|
|
|
that.getBargainHelp() |
|
|
|
that.getBargainHelpCount(); |
|
|
|
that.getBargainHelpCount() |
|
|
|
}) |
|
|
|
}) |
|
|
|
.catch(res => { |
|
|
|
.catch(res => { |
|
|
|
uni.showToast({ |
|
|
|
uni.showToast({ |
|
|
|
title: res.msg, |
|
|
|
title: res.msg, |
|
|
|
icon: 'none', |
|
|
|
icon: 'none', |
|
|
|
duration: 2000 |
|
|
|
duration: 2000, |
|
|
|
}); |
|
|
|
}) |
|
|
|
}); |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 参与砍价 |
|
|
|
// 参与砍价 |
|
|
|
getBargainHelp: function() { |
|
|
|
getBargainHelp: function() { |
|
|
|
var that = this; |
|
|
|
var that = this |
|
|
|
if (this.bargainHelpCount.price === 0 && that.bargainUid !== that.userInfo.uid) { |
|
|
|
if (this.bargainHelpCount.price === 0 && that.bargainUid !== that.userInfo.uid) { |
|
|
|
return uni.showToast({ |
|
|
|
return uni.showToast({ |
|
|
|
title: '好友已经砍价成功', |
|
|
|
title: '好友已经砍价成功', |
|
|
|
icon: 'success', |
|
|
|
icon: 'success', |
|
|
|
duration: 2000 |
|
|
|
duration: 2000, |
|
|
|
}); |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
var data = { |
|
|
|
var data = { |
|
|
|
bargainId: that.bargainId, |
|
|
|
bargainId: that.bargainId, |
|
|
|
bargainUserUid: that.bargainUid |
|
|
|
bargainUserUid: that.bargainUid, |
|
|
|
}; |
|
|
|
} |
|
|
|
getBargainHelp(data) |
|
|
|
getBargainHelp(data) |
|
|
|
.then(res => { |
|
|
|
.then(res => { |
|
|
|
that.activeMsg = res.data.status; |
|
|
|
that.activeMsg = res.data.status |
|
|
|
if (res.data.status === 'SUCCESSFUL' && that.bargainUid !== that.userInfo.uid) { |
|
|
|
if (res.data.status === 'SUCCESSFUL' && that.bargainUid !== that.userInfo.uid) { |
|
|
|
uni.showToast({ |
|
|
|
uni.showToast({ |
|
|
|
title: '您已经砍过了', |
|
|
|
title: '您已经砍过了', |
|
|
|
icon: 'none', |
|
|
|
icon: 'none', |
|
|
|
duration: 2000 |
|
|
|
duration: 2000, |
|
|
|
}); |
|
|
|
}) |
|
|
|
return; |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
that.helpListStatus = false; |
|
|
|
that.helpListStatus = false |
|
|
|
that.page = 1; |
|
|
|
that.page = 1 |
|
|
|
that.bargainHelpList = []; |
|
|
|
that.bargainHelpList = [] |
|
|
|
that.getBargainHelpPrice(); |
|
|
|
that.getBargainHelpPrice() |
|
|
|
}) |
|
|
|
}) |
|
|
|
.catch(res => { |
|
|
|
.catch(res => { |
|
|
|
uni.showToast({ |
|
|
|
uni.showToast({ |
|
|
|
title: res.msg, |
|
|
|
title: res.msg, |
|
|
|
icon: 'none', |
|
|
|
icon: 'none', |
|
|
|
duration: 2000 |
|
|
|
duration: 2000, |
|
|
|
}); |
|
|
|
}) |
|
|
|
}); |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
//获取砍掉的金额 |
|
|
|
//获取砍掉的金额 |
|
|
|
getBargainHelpPrice: function() { |
|
|
|
getBargainHelpPrice: function() { |
|
|
|
var that = this; |
|
|
|
var that = this |
|
|
|
getBargainHelpPrice({ |
|
|
|
getBargainHelpPrice({ |
|
|
|
bargainId: that.bargainId, |
|
|
|
bargainId: that.bargainId, |
|
|
|
bargainUserUid: that.bargainUid |
|
|
|
bargainUserUid: that.bargainUid, |
|
|
|
}) |
|
|
|
}) |
|
|
|
.then(res => { |
|
|
|
.then(res => { |
|
|
|
that.bargainHelpPrice = res.data.price; |
|
|
|
that.bargainHelpPrice = res.data.price |
|
|
|
that.getBargainHelpCount(); |
|
|
|
that.getBargainHelpCount() |
|
|
|
that.getBargainHelpList(); |
|
|
|
that.getBargainHelpList() |
|
|
|
switch (that.activeMsg) { |
|
|
|
switch (that.activeMsg) { |
|
|
|
case 'SUCCESSFUL': |
|
|
|
case 'SUCCESSFUL': |
|
|
|
break; |
|
|
|
break |
|
|
|
case 'SUCCESS': |
|
|
|
case 'SUCCESS': |
|
|
|
that.active = true; |
|
|
|
that.active = true |
|
|
|
break; |
|
|
|
break |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
.catch(res => { |
|
|
|
.catch(res => { |
|
|
|
uni.showToast({ |
|
|
|
uni.showToast({ |
|
|
|
title: res.msg, |
|
|
|
title: res.msg, |
|
|
|
icon: 'none', |
|
|
|
icon: 'none', |
|
|
|
duration: 2000 |
|
|
|
duration: 2000, |
|
|
|
}); |
|
|
|
}) |
|
|
|
}); |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 砍价帮助列表 |
|
|
|
// 砍价帮助列表 |
|
|
|
getBargainHelpList: function() { |
|
|
|
getBargainHelpList: function() { |
|
|
|
var that = this; |
|
|
|
var that = this |
|
|
|
if (that.helpListStatus === true) return; |
|
|
|
if (that.helpListStatus === true) return |
|
|
|
getBargainHelpList({ |
|
|
|
getBargainHelpList({ |
|
|
|
bargainId: that.bargainId, |
|
|
|
bargainId: that.bargainId, |
|
|
|
bargainUserUid: that.bargainUid, |
|
|
|
bargainUserUid: that.bargainUid, |
|
|
|
page: that.page, |
|
|
|
page: that.page, |
|
|
|
limit: that.limit |
|
|
|
limit: that.limit, |
|
|
|
}) |
|
|
|
}) |
|
|
|
.then(res => { |
|
|
|
.then(res => { |
|
|
|
that.helpListStatus = res.data.length < that.limit; |
|
|
|
that.helpListStatus = res.data.length < that.limit |
|
|
|
that.page++; |
|
|
|
if (that.page == 1) { |
|
|
|
|
|
|
|
that.bargainHelpList = [] |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
that.page++ |
|
|
|
if (res.data) { |
|
|
|
if (res.data) { |
|
|
|
that.bargainHelpList.push.apply(that.bargainHelpList, res.data); |
|
|
|
that.bargainHelpList.push.apply(that.bargainHelpList, res.data) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
.catch(err => { |
|
|
|
.catch(err => { |
|
|
|
if (!err.msg) { |
|
|
|
if (!err.msg) { |
|
|
|
return; |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
uni.showToast({ |
|
|
|
uni.showToast({ |
|
|
|
title: err.msg || err.response.data.msg || err.response.data.message, |
|
|
|
title: err.msg || err.response.data.msg || err.response.data.message, |
|
|
|
icon: 'none', |
|
|
|
icon: 'none', |
|
|
|
duration: 2000 |
|
|
|
duration: 2000, |
|
|
|
}); |
|
|
|
}) |
|
|
|
}); |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 砍价 砍价帮总人数、剩余金额、进度条、已经砍掉的价格 |
|
|
|
// 砍价 砍价帮总人数、剩余金额、进度条、已经砍掉的价格 |
|
|
|
getBargainHelpCount: function() { |
|
|
|
getBargainHelpCount: function() { |
|
|
|
getBargainHelpCount({ |
|
|
|
getBargainHelpCount({ |
|
|
|
bargainId: this.bargainId, |
|
|
|
bargainId: this.bargainId, |
|
|
|
bargainUserUid: this.bargainUid |
|
|
|
bargainUserUid: this.bargainUid, |
|
|
|
}) |
|
|
|
}) |
|
|
|
.then(res => { |
|
|
|
.then(res => { |
|
|
|
// 剩余砍价金额,显示已砍至¥** 使用 = 商品价格 - 已经砍掉的金额 |
|
|
|
// 剩余砍价金额,显示已砍至¥** 使用 = 商品价格 - 已经砍掉的金额 |
|
|
|
let remainingPrice = (this.goodsDetail.price - res.data.alreadyPrice).toFixed(2); |
|
|
|
let remainingPrice = (this.goodsDetail.price - res.data.alreadyPrice).toFixed(2) |
|
|
|
this.bargainHelpCount = { |
|
|
|
this.bargainHelpCount = { |
|
|
|
...res.data, |
|
|
|
...res.data, |
|
|
|
remainingPrice |
|
|
|
remainingPrice, |
|
|
|
}; |
|
|
|
} |
|
|
|
this.handleButtonStatus(); |
|
|
|
this.handleButtonStatus() |
|
|
|
}) |
|
|
|
}) |
|
|
|
.catch(err => { |
|
|
|
.catch(err => { |
|
|
|
if (!err.msg) { |
|
|
|
if (!err.msg) { |
|
|
|
return; |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
uni.showToast({ |
|
|
|
uni.showToast({ |
|
|
|
title: err.msg || err.response.data.msg || err.response.data.message, |
|
|
|
title: err.msg || err.response.data.msg || err.response.data.message, |
|
|
|
icon: 'none', |
|
|
|
icon: 'none', |
|
|
|
duration: 2000 |
|
|
|
duration: 2000, |
|
|
|
}); |
|
|
|
}) |
|
|
|
}); |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 判断是否可以支付 |
|
|
|
// 判断是否可以支付 |
|
|
|
handleButtonStatus() { |
|
|
|
handleButtonStatus() { |
|
|
|
// 砍价按钮分为 |
|
|
|
// 砍价按钮分为 |
|
|
|
// 1.参与砍价 ==> 发起人与当前用户为同一人 && 未参与 |
|
|
|
// 1.参与砍价 ==> 发起人与当前用户为同一人 && 未参与 |
|
|
|
if (this.bargainUid === this.userInfo.uid && this.bargainHelpCount.status == 0) { |
|
|
|
if (this.bargainUid === this.userInfo.uid && this.bargainHelpCount.status == 0) { |
|
|
|
this.participate = true; |
|
|
|
this.participate = true |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this.participate = false; |
|
|
|
this.participate = false |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 2.邀请好友 ==> 发起人与当前用户同一人 && 已参与未过期 && 剩余金额>0 |
|
|
|
// 2.邀请好友 ==> 发起人与当前用户同一人 && 已参与未过期 && 剩余金额>0 |
|
|
|
if (this.bargainUid === this.userInfo.uid && this.bargainHelpCount.status == 1 && this.bargainHelpCount.price > 0) { |
|
|
|
if (this.bargainUid === this.userInfo.uid && this.bargainHelpCount.status == 1 && this.bargainHelpCount.price > 0) { |
|
|
|
this.inviteFriends = true; |
|
|
|
this.inviteFriends = true |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this.inviteFriends = false; |
|
|
|
this.inviteFriends = false |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 3.帮好友砍价 ==> 发起人与当前用户非一人 && 未参与未过期 && 剩余金额>0 && 为砍价 |
|
|
|
// 3.帮好友砍价 ==> 发起人与当前用户非一人 && 未参与未过期 && 剩余金额>0 && 为砍价 |
|
|
@ -503,23 +489,23 @@ export default { |
|
|
|
// this.bargainHelpCount.userBargainStatus && |
|
|
|
// this.bargainHelpCount.userBargainStatus && |
|
|
|
this.bargainHelpCount.price > 0 |
|
|
|
this.bargainHelpCount.price > 0 |
|
|
|
) { |
|
|
|
) { |
|
|
|
this.helpFriendsBargain = true; |
|
|
|
this.helpFriendsBargain = true |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this.helpFriendsBargain = false; |
|
|
|
this.helpFriendsBargain = false |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 4.支付 ==> 发起人与当前用户同一人 && 已参与未过期 && 剩余金额<=0 |
|
|
|
// 4.支付 ==> 发起人与当前用户同一人 && 已参与未过期 && 剩余金额<=0 |
|
|
|
if (this.bargainUid === this.userInfo.uid && this.bargainHelpCount.status == 1 && this.bargainHelpCount.price <= 0) { |
|
|
|
if (this.bargainUid === this.userInfo.uid && this.bargainHelpCount.status == 1 && this.bargainHelpCount.price <= 0) { |
|
|
|
this.pay = true; |
|
|
|
this.pay = true |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this.pay = false; |
|
|
|
this.pay = false |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 5.砍价人发起新的砍价 ==> 发起人与当前用户非一人 && 未参与 |
|
|
|
// 5.砍价人发起新的砍价 ==> 发起人与当前用户非一人 && 未参与 |
|
|
|
if (this.bargainUid != this.userInfo.uid) { |
|
|
|
if (this.bargainUid != this.userInfo.uid) { |
|
|
|
this.bargain = true; |
|
|
|
this.bargain = true |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this.bargain = false; |
|
|
|
this.bargain = false |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 砍价弹窗 |
|
|
|
// 砍价弹窗 |
|
|
@ -530,26 +516,26 @@ export default { |
|
|
|
// 获取开启砍价用户信息 |
|
|
|
// 获取开启砍价用户信息 |
|
|
|
// 参与砍价,为同一人发起砍价后 |
|
|
|
// 参与砍价,为同一人发起砍价后 |
|
|
|
getBargainStartUser: function() { |
|
|
|
getBargainStartUser: function() { |
|
|
|
var that = this; |
|
|
|
var that = this |
|
|
|
getBargainStartUser({ |
|
|
|
getBargainStartUser({ |
|
|
|
bargainId: that.bargainId, |
|
|
|
bargainId: that.bargainId, |
|
|
|
bargainUserUid: that.bargainUid |
|
|
|
bargainUserUid: that.bargainUid, |
|
|
|
}) |
|
|
|
}) |
|
|
|
.then(res => { |
|
|
|
.then(res => { |
|
|
|
that.bargainUserInfo = res.data; |
|
|
|
that.bargainUserInfo = res.data |
|
|
|
that.getBargainHelpList(); |
|
|
|
that.getBargainHelpList() |
|
|
|
}) |
|
|
|
}) |
|
|
|
.catch(res => { |
|
|
|
.catch(res => { |
|
|
|
uni.showToast({ |
|
|
|
uni.showToast({ |
|
|
|
title: res.msg, |
|
|
|
title: res.msg, |
|
|
|
icon: 'none', |
|
|
|
icon: 'none', |
|
|
|
duration: 2000 |
|
|
|
duration: 2000, |
|
|
|
}); |
|
|
|
}) |
|
|
|
}); |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 关闭弹窗 |
|
|
|
// 关闭弹窗 |
|
|
|
close: function() { |
|
|
|
close: function() { |
|
|
|
this.active = false; |
|
|
|
this.active = false |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 设置微信分享 |
|
|
|
// 设置微信分享 |
|
|
|
onShareAppMessage: function() { |
|
|
|
onShareAppMessage: function() { |
|
|
@ -559,24 +545,24 @@ export default { |
|
|
|
path: 'pages/activity/DargainDetails/index?id=' + this.storeInfo.id + '&spread=' + uni.getStorageSync('uid'), |
|
|
|
path: 'pages/activity/DargainDetails/index?id=' + this.storeInfo.id + '&spread=' + uni.getStorageSync('uid'), |
|
|
|
success(res) { |
|
|
|
success(res) { |
|
|
|
uni.showToast({ |
|
|
|
uni.showToast({ |
|
|
|
title: '分享成功' |
|
|
|
title: '分享成功', |
|
|
|
}); |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
fail(res) { |
|
|
|
fail(res) { |
|
|
|
uni.showToast({ |
|
|
|
uni.showToast({ |
|
|
|
title: '分享失败', |
|
|
|
title: '分享失败', |
|
|
|
icon: 'none' |
|
|
|
icon: 'none', |
|
|
|
}); |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
}; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
}, |
|
|
|
onShareAppMessage() { |
|
|
|
onShareAppMessage() { |
|
|
|
return { |
|
|
|
return { |
|
|
|
path: `/pages/activity/DargainDetails/index/?id=${this.$yroute.query.id}&partake=${this.userInfo.uid}` |
|
|
|
path: `/pages/activity/DargainDetails/index/?id=${this.$yroute.query.id}&partake=${this.userInfo.uid}`, |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
<style lang="less"> |
|
|
|
<style lang="less"> |
|
|
|