123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695 |
- <template>
- <view class="bargain-process-container">
- <!-- #ifdef H5 -->
- <download-nav v-if="showDownload"></download-nav>
- <!-- #endif -->
- <view v-show="status == -1">
- <view class="bargain-process-header">
- <view class="mt20 column status-container">
- <view class="white xxl">
- {{activityObj.bargain_tips}}
- </view>
- <view class="mt10 white xxs">
- {{activityObj.simple_tips}}
- </view>
- </view>
- </view>
- <view class="main">
- <navigator class="goods-planel row" :url="'/pages/goods_details/goods_details?id=' + activityObj.goods_id" hover-class="none">
- <custom-image width="180rpx" height="180rpx" :src="activityObj.image" radius="10rpx" />
- <view class="goods-info">
- <view class="goods-name line2 nr">
- {{activityObj.name}}
- </view>
- <view class="xs" style="color: #F95F2F;">
- 最低可砍至<text class="sm" style="line-height: 48rpx;">¥<text class="xl">{{activityObj.activity_price}}</text></text>
- </view>
- <view class="xs muted">
- 原价 <text style="text-decoration:line-through;">¥{{activityObj.price}}</text>
- </view>
- </view>
- </navigator>
- <view class="choose-container">
- <view class="title xl normal">
- 请选择商品规格
- </view>
- <view class="choose-content row-between" @click="showSpecPop">
- <view class="row">
- <view class="muted sm">已选:</view>
- <view class="md normal">
- {{userSpecText}}
- </view>
- </view>
- <u-icon name="arrow-right" size="28" color="#999" />
- </view>
- </view>
- <view class="lunch-btn white br60 row-center" @click="$launchBargain">发起砍价</view>
- </view>
- </view>
- <view v-show="status != -1">
- <view class="bargain-process-header">
- <view class="mt20 status-container row">
- <custom-image
- v-if="bargainObj.share_avatar"
- width="80rpx"
- height="80rpx"
- :src="bargainObj.share_avatar"
- round
- :customStyle="{'border': '2rpx solid #fff'}"
- />
- <view class="column ml20">
- <view class="white xxl">
- {{bargainObj.bargain_tips}}
- </view>
- <view class="mt10 white xxs">
- {{bargainObj.simple_tips || '邀请好友帮忙砍价 —— 砍至'+ bargainObj.current_price +'元即可发货'}}
- </view>
- </view>
- </view>
- </view>
- <view class="main">
- <navigator class="goods-planel row" :url="'/pages/goods_details/goods_details?id=' + bargainObj.goods_id" hover-class="none">
- <custom-image width="180rpx" height="180rpx" :src="bargainObj.image" radius="10rpx" />
- <view class="goods-info">
- <view class="goods-name line2 nr">
- {{bargainObj.name}}
- </view>
- <view class="xs muted">
- {{bargainObj.spec_value_str}}
- </view>
- <view class="row-between mt10">
- <view class="xs muted">
- 原价 ¥{{bargainObj.price || 0}}
- </view>
- <view class="row" v-show="showCountDown" v-if="timestamp > 0">
- <u-count-down
- :timestamp="timestamp"
- :bg-color="primaryColor"
- color="#fff"
- :separator-color="primaryColor"
- height="36"
- :show-days="true"
- @end="closeBargainOrderFun"
- />
- <text class="muted xs ml10">内可砍</text>
- </view>
- </view>
- </view>
- </navigator>
- <!-- 非被邀请状态 -->
- <view class="bargain-panel" v-if="status != 5">
- <view class="bargain-panel-header nr">
- 已砍¥{{bargainObj.knife_price || 0}},还差¥{{bargainObj.diff_price || 0}}
- </view>
- <view class="progress-container row">
- <view class="progress">
- <view class="progress-bar" :style="{'width': precent + '%'}">
- </view>
- </view>
- <view class="primary xs ml20">
- <text class="xxs">¥</text>{{bargainObj.activity_price}}
- </view>
- </view>
- <view class="nr lighter row-center" style="margin-top: 35rpx;" v-if="bargainObj.status != 0 && bargainObj != -1">
- {{bargainObj.status_tips}}
- </view>
- <view class="invite-btn1 br60 white row-center lg" @click="shareToBargain" v-if="bargainObj.direct_buy_btn != 1 && bargainObj.invite_btn">
- 邀请好友帮砍价
- </view>
- <view class="invite-btn1 br60 white row-center lg" v-if="bargainObj.buy_btn" @tap="handleClickBuy" >
- 立即购买
- </view>
- <view class="fail-btn br60 white row-center lg" v-if="bargainObj.status == 2">
- 砍价失败
- </view>
- <view class="invite-btn-group row-between" v-if="bargainObj.direct_buy_btn">
- <view class="buy-now-btn br60 md row-center" @click="handleClickBuy">
- ¥{{bargainObj.current_price}} 直接购买
- </view>
- <view class="invite-friend-btn white br60 md row-center" @click="shareToBargain">
- 邀请好友帮砍价
- </view>
- </view>
- <view class="invite-btn1 br60 white row-center lg" v-if="bargainObj.order_btn" @click="toOrderDetail">
- 查看订单
- </view>
- <view class="bargain-code-content">
- <view class="bargain-code-title row-between">
- <view class="md normal bold">
- 砍价记录
- </view>
- <view class="muted xs">
- 已有{{bargainObj.knife_list && bargainObj.knife_list.length}}人帮砍
- </view>
- </view>
- <view class="code-content">
- <view class="user-item row-between" v-for="(item, index) in bargainObj.knife_list" :key="item.id">
- <view class="user-content row">
- <custom-image width="80rpx" height="80rpx" radius="60rpx" :src="item.avatar" />
- <view class="ml20">
- <view class="sm normal">
- {{item.nickname}}
- </view>
- <view class="muted xxs">
- 小刀一砍,惊喜满满
- </view>
- </view>
- </view>
- <view class="bargain-price xs primary">
- ¥{{item.help_price || 0}}
- </view>
- </view>
- </view>
- </view>
- </view>
- <!-- end -->
- <!-- 被邀请状态 -->
- <view class="shared-panel" v-if="status == 5" >
- <view class="btn-container">
- <view class="nr muted row-center">
- {{bargainObj.status_tips}}
- </view>
- <view class="help-knife-btn row-center white lg br60" v-if="bargainObj.knife_btn" @click="$helpBargain">
- 帮忙砍一刀
- </view>
- <navigator hover-class="none" url="/pages/bundle/bargain/bargain" class="knife-btn row-center lg normal br60" v-if="bargainObj.sponsor_btn">
- 我也要砍价
- </navigator>
- </view>
- <view class="code-content">
- <view class="bargain-code-title row-between">
- <view class="md normal bold">
- 砍价记录
- </view>
- <view class="muted xs">
- 已有{{bargainObj.knife_list.length}}人帮砍
- </view>
- </view>
- <view class="user-item row-between" v-for="(item, index) in bargainObj.knife_list" :key="item.id">
- <view class="user-content row">
- <custom-image width="80rpx" height="80rpx" radius="60rpx" :src="item.avatar" />
- <view class="ml20">
- <view class="sm normal">
- {{item.nickname}}
- </view>
- <view class="muted xxs">
- 小刀一砍,惊喜满满
- </view>
- </view>
- </view>
- <view class="bargain-price xs primary">
- ¥{{item.help_price || 0}}
- </view>
- </view>
- </view>
- </view>
- <!-- end -->
- </view>
- </view>
- <loading-view v-if="showLoadingView" />
- <goods-bargain v-if="status != -1" ref="goodsBargain" />
- <u-popup v-model="showBargainPop" mode="center">
- <view class="bargain-pop-container">
- <view class="md normal bold row-center" style="padding-top: 64rpx;">
- 恭喜您成功砍下<text class="primary lg">{{knifePrice || 0}}</text>元
- </view>
- <view class="bold md row-center" style="margin-top: 38rpx;" v-if="!isHelpKnife">
- 还差<text class="ml20 differ-price primary">{{diffPrice || 0}}<text style="font-size: 40rpx;">元</text></text>
- </view>
- <view class="bold primary xxl row-center" style="margin-top: 38rpx;" v-else>
- 已为好友砍价成功
- </view>
- <view class="progress-container row-center">
- <view class="progress">
- <view class="progress-bar" :style="{'width': precent + '%'}" />
- </view>
- </view>
- <view class="row-center">
- <view class="invite-btn row-center md" @click="shareToBargain">
- {{isHelpKnife ? '确定' : '邀请好友帮砍'}}
- </view>
- </view>
- </view>
- <view class="close-icon row-center" @click="closeBargainPop" mode="bottom">
- <u-icon name="close-circle" size="68rpx" color="#fff"></u-icon>
- </view>
- </u-popup>
- <spec-popup
- :show="showPop"
- :goods="activityObj"
- :isBargain="true"
- :show-add="false"
- :show-buy="false"
- :showConfirm="true"
- :disabledNumberBox="true"
- :showStock="false"
- @confirm="chooseSpec"
- @close="showPop=false"
- />
- <share-popup :show="showSharePop" @close="showSharePop = false" :goodsId="bargainId" :isBargain="true" :shareTitle="bargainObj.share_titles || bargainObj.name" :summary="bargainObj.share_intros || bargainObj.simple_tips" :img-url="bargainObj.image" />
- <float-tab></float-tab>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- showPop: false,
- showBargainPop: false,
- showSharePop: false,
- activityObj: {},
- bargainObj: {},
- status: 1,
- precent: 0,
- timestamp: 0,
- userSpecText: '请选择商品规格',
- userSpec: {},
- bargainId: -1,
- activityId: -1,
- // 砍价弹窗变量
- knifePrice: 0,
- diffPrice: 0,
- isHelpKnife: false,
- showCountDown: true,
- showLoadingView: true,
- showDownload: false
- }
- },
- onLoad(options) {
- if (options && options.scene) {
- let scene = strToParams(decodeURIComponent(options.scene));
- options.bargainId = scene.id;
- }
- if(options && options.id) {
- options.bargainId = options.id
- }
- // #ifdef H5
- if(options && options.isapp == 1) {
- this.showDownload = true
- }
- // #endif
- // 活动详情ID
- this.bargainId = options.bargainId;
- // 砍价活动ID
- this.activityId = options.activityId;
- console.log(this.bargainId, this.activityId, "option")
- if(this.activityId && this.activityId != -1) {
- this.$getBargainDetail(this.activityId);
- }
- else if(this.bargainId && this.bargainId != -1) {
- this.$getBargainActivityDetail(this.bargainId)
- }
- },
- onReachBottom() {
- if(this.$refs.goodsBargain) {
- this.$refs.goodsBargain.$getBargainList();
- }
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function() {
- setTimeout(() => {
- uni.stopPullDownRefresh()
- }, 200);
- },
- // #ifdef MP-WEIXIN
- onShareAppMessage() {
- return {
- path: "pages/bundle/bargain_process/bargain_process?bargainId=" + this.bargainId,
- title: this.bargainObj.share_titles
- }
- },
- // #endif
- methods: {
- showSpecPop() {
- this.showPop = true;
- },
- closeBargainPop() {
- this.showBargainPop = false
- },
- $getBargainDetail(id) {
- getBargainDetail({bargain_id: id}).then(res => {
- if(res.code == 1) {
- this.activityObj = res.data;
- this.status = res.data.status;
- this.showLoadingView = false;
- this.userSpecText = res.data.goods_item[0].spec_value_str
- this.userSpec = {
- id: res.data.goods_item[0].id
- }
- // let url = config.baseURL.replace(/\/api\//g, "/mobile/");
- let options = {
- shareTitle: this.activityObj.name,
- shareLink: location.href + "&invite_code=" + this.$store.getters.inviteCode,
- shareImage: this.activityObj.image,
- shareDesc: this.activityObj.simple_tips
- }
- this.wxShare(options)
- console.log(options, "share-bargain-options1", location.href);
- }
- })
- },
- chooseSpec(e) {
- this.userSpec = e.detail;
- this.userSpecText = e.detail.spec_value_str;
- this.showPop = false;
- },
- $launchBargain() {
- let data = {
- // 砍价活动id
- bargain_id: this.activityId,
- item_id: this.userSpec.id
- }
- launchBargain(data).then(res => {
- if(res.code == 1) {
- this.$toast({title: res.msg});
- this.knifePrice = res.data.knife_price;
- this.diffPrice = res.data.diff_price;
- this.precent = res.data.progress * 100;
- if(this.precent > 100) {
- this.precent = 100
- }
- this.showBargainPop = true;
- this.bargainId = res.data.id;
- this.showLoadingView = true;
- uni.showLoading()
- this.$getBargainActivityDetail(res.data.id);
- }
- })
- },
- $getBargainActivityDetail(id) {
- let timestamp = 0;
- let now_time = (new Date().getTime()) / 1000
- getBargainActivityDetail({
- id: id
- }).then(res => {
- if(res.code == 1) {
- uni.hideLoading()
- this.status = res.data.status;
- this.bargainObj = res.data;
- timestamp = res.data.over_time;
- this.precent = res.data.progress * 100;
- if(this.precent > 100) {
- this.precent = 100
- }
- this.showLoadingView = false;
- this.timestamp = (timestamp - Math.floor(now_time));
- console.log('calc: ', timestamp, '-', Math.floor(now_time), '=', this.timestamp )
- let url = location.href.replace(/activityId=\d*/g, "bargainId=" + id);
- let options = {
- shareTitle: this.bargainObj.share_titles || this.bargainObj.name,
- shareLink: url + "&invite_code=" + this.$store.getters.inviteCode,
- shareImage: this.bargainObj.image,
- shareDesc: this.bargainObj.share_intros || this.bargainObj.simple_tips
- }
- this.wxShare(options)
- console.log(options, "share-bargain-options2", url);
- if(this.timestamp <= 0 || this.status == 1) {
- // 砍价已结束
- this.showCountDown = false;
- }
- else {
- this.showCountDown = true;
- }
- }
- })
- },
- shareToBargain() {
- this.showBargainPop = false
- if(this.isHelpKnife) {
- return;
- }
- this.showSharePop = true
- },
- $helpBargain() {
- // 帮好友砍价
- helpBargain({
- id: this.bargainId
- }).then(res => {
- if(res.code == 1) {
- this.knifePrice = res.data.knife_price;
- this.precent = res.data.progress * 100;
- if(this.precent > 100) {
- this.precent = 100
- }
- this.isHelpKnife = true;
- this.showBargainPop = true;
- this.$getBargainActivityDetail(this.bargainId)
- }
- })
- },
- toOrderDetail() {
- uni.navigateTo({
- url: "/pages/order_details/order_details?id=" + this.bargainObj.order_id
- })
- },
- closeBargainOrderFun() {
- // 计时结束后关闭订单
- closeBargainOrder({
- id: this.bargainObj.id
- }).then(res => {
- if(res.code == 1) {
- this.$toast({
- title: res.msg
- })
- this.$getBargainActivityDetail(this.bargainObj.id)
- }
- })
- },
- handleClickBuy() {
- let goods = [{
- num: 1,
- item_id: this.bargainObj.item_id
- }]
- let params = {
- goods
- }
- console.log(goods, 'handleClickBuy')
- uni.navigateTo({
- url: '/pages/confirm_order/confirm_order?data=' + encodeURIComponent(JSON.stringify(params)) + "&bargain_launch_id=" + this.bargainObj.id
- })
- }
- }
- }
- </script>
- <style lang="scss">
- .bargain-process-container {
- .bargain-process-header {
- background-image: url(https://daopic.samcms.com/xm_static/images/bg_hometop.png);
- height: 420rpx;
- background-size: 100% 100%;
- padding-top: 30rpx;
- .rule-contain {
- background-color: rgba(255, 255, 255, 0.8);
- border-radius: 100rpx;
- padding: 6rpx 10rpx;
- margin-right: 24rpx;
- }
- .status-container {
- margin-left: 24rpx;
- }
- }
- .main {
- padding: 0 24rpx;
- margin-top: -230rpx;
- .goods-planel {
- background-color: white;
- padding: 30rpx 24rpx;
- border-radius: 20rpx;
- box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.06);
- .goods-info {
- margin-left: 24rpx;
- flex: 1;
- .goods-name {
- line-height: 40rpx;
- }
- }
- }
- // 砍价状态2
- .bargain-panel {
- margin-top: 30rpx;
- padding: 24rpx 24rpx 20rpx;
- background-color: $-color-white;
- box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.06);
- border-radius: 20rpx;
- .bargain-panel-header {
- font-weight: bold;
- }
- .progress-container {
- margin-top: 33rpx;
- .progress {
- flex: 1;
- background-color: #FFEBE5;
- height: 20rpx;
- border-radius: 50rpx;
- .progress-bar {
- background: linear-gradient(90deg, #F95F2F 0%, #FF2C3C 100%);
- transition: width .5s ease;
- height: 100%;
- width: 0%;
- border-radius: 50rpx;
- }
- }
- }
- .invite-btn1 {
- background-color: $-color-primary;
- height: 84rpx;
- margin-top: 36rpx;
- box-shadow: 0px 3px 10px rgba(235, 36, 51, 0.5);
- }
- .fail-btn {
- background-color: #E5E5E5;
- height: 84rpx;
- margin-top: 30rpx;
- }
- .invite-btn-group {
- margin-top: 60rpx;
- .buy-now-btn {
- width: 316rpx;
- height: 84rpx;
- color: #F95F2F;
- font-size: 30rpx;
- background-color: rgba($color: #F95F2F, $alpha: 0.2);
- }
- .invite-friend-btn {
- width: 316rpx;
- height: 84rpx;
- background-color: $-color-primary;
- }
- }
- .bargain-code-content {
- margin-top: 62rpx;
- .bargain-code-title {
-
- }
- .code-content {
- margin-top: 30rpx;
- .user-item {
- padding: 15rpx 0;
- margin-bottom: 30rpx;
- }
- }
- }
- }
- // end
- // 被邀请状态
- .shared-panel {
- .btn-container {
- margin-top: 40rpx;
- .help-knife-btn {
- background-color: $-color-primary;
- height: 84rpx;
- box-shadow: 0px 3px 10px rgba(235, 36, 51, 0.5);
- }
- .knife-btn {
- height: 84rpx;
- background-color: $-color-white;
- border: 1px solid #BBBBBB;
- margin-top: 30rpx;
- }
- }
- .code-content {
- margin-top: 30rpx;
- padding: 27rpx 24rpx;
- background-color: $-color-white;
- .user-item {
- padding: 15rpx 0;
- margin-top: 10rpx;
- }
- }
- }
- // end
- .choose-container {
- margin: 40rpx 0;
- .title {
- font-weight: 500;
- margin-bottom: 30rpx;
- }
- .choose-content {
- padding: 30rpx 20rpx;
- background-color: $-color-white;
- border-radius: 10px;
- }
- }
- .lunch-btn {
- height: 84rpx;
- background-color: $-color-primary;
- box-shadow: 0px 3px 10px rgba(235, 36, 51, 0.5);
- }
- }
- .pop-container {
- height: 800rpx;
- .goods-info {
- padding: 20rpx 20rpx;
- .goods-spec {
- align-self: flex-end;
- }
- }
- .spec-selector {
- padding: 30rpx 20rpx;
- .title {
- line-height: 36rpx;
- }
- .spec-item {
- padding: 8rpx 28rpx;
- background-color: #F4F4F4;
- }
- .spec-active-item {
- padding: 8rpx 28rpx;
- color: white;
- background-color: $-color-primary;
- }
- }
- .pickup-number {
- margin-top: 30rpx;
- padding: 0 20rpx;
- }
- }
- .bargain-pop-container {
- width: 559rpx;
- height: 580rpx;
- background-image: url(../../static/images/bg_kanjia.png);
- background-size: 100% 100%;
- .differ-price {
- font-size: 58rpx;
- line-height: 38rpx;
- }
- .progress-container {
- margin-top: 26rpx;
- .progress {
- width: 409rpx;
- height: 20rpx;
- background-color: #FD498F1A;
- border-radius: 50rpx;
- .progress-bar {
- height: 100%;
- width: 0%;
- background: linear-gradient(90deg, #FA444D 0%, #FD498F 100%);
- border-radius: 50rpx;
- transition: width .5s ease;
- }
- }
- }
- .invite-btn {
- background-image: url(../../static/images/coupon_button.png);
- background-size: 100% 100%;
- height: 106rpx;
- color: #7B3200;
- font-weight: 500;
- margin-top: 180rpx;
- width: 478rpx;
- }
- }
- .close-icon {
- margin-top: 26rpx;
- }
- .share-pop-container {
- height: 500rpx;
- background-color: $-color-white;
- }
- }
- </style>
|