tmp: 部分代码与UnishopV5结合,但是代码有严重缺陷

This commit is contained in:
2025-12-20 15:30:39 +08:00
parent ed5181b382
commit e263a616f6
183 changed files with 31316 additions and 18590 deletions

View File

@@ -0,0 +1,471 @@
<template>
<page-meta :page-style="themeColor"></page-meta>
<view class="bargain">
<view class="bargain_top" :style="{ backgroundImage: 'url(' + $util.img('public/uniapp/bargain/bargain_background.png') + ')' }">
<view>{{ goodsDetail ? goodsDetail.browse_num : 0 }}人查看</view>
<view>|</view>
<view>{{ goodsDetail ? goodsDetail.share_num : 0 }}人分享</view>
<view>|</view>
<view>{{ goodsDetail ? goodsDetail.join_num : 0 }}人参与</view>
</view>
<view class="rule-mark-enter" @click="openRulePopup">活动规则</view>
<view class="bargin_content">
<view class="uer_info_base" v-if="launchInfo">
<view class="user_info_img">
<image :src="launchInfo.headimg == '' ? $util.img($util.getDefaultImage().head) : $util.img(launchInfo.headimg)" mode="widthFix"></image>
</view>
<text class="user_info_name">{{ launchInfo.nickname }}</text>
</view>
<!-- 宣传语 -->
<view class="bargin_propaganda" v-if="launchInfo">
<text class="marks"></text>
<text>我发现一件好物快来帮我砍一刀</text>
<text class="marks"></text>
</view>
<!-- 商品 -->
<view class="goods" v-if="goodsDetail">
<view class="goods_img"><image :src="$util.img(goodsDetail.sku_image, { size: 'mid' })" mode="aspectFit"></image></view>
<view class="goods_content" v-if="launchInfo">
<view class="goods_title">{{ goodsDetail.sku_name }}</view>
<view class="goods_price">
<view>
原价
<text class="original_price">{{ $lang('common.currencySymbol') }}{{ launchInfo.price }}</text>
</view>
<view>
最低可砍至
<text class="bottom_price">{{ $lang('common.currencySymbol') }}{{ launchInfo.floor_price }}</text>
</view>
</view>
<view class="partake_num" v-if="launchInfo">
已有
<text class="ident">{{ launchInfo.curr_num }}</text>
人帮砍
<text class="residue-num">
剩余库存
<text class="ident">{{ goodsDetail.bargain_stock }}{{ goodsDetail.unit }}</text>
</text>
</view>
<view v-if="launchInfo && timeMachine && goodsDetail.bargain_status == 1" class="count-down">
<uni-count-down
:day="timeMachine.d"
:hour="timeMachine.h"
:minute="timeMachine.i"
:second="timeMachine.s"
color="#fff"
splitorColor="#333 !important"
backgroundColor="#000"
border-color="transparent"
@timeup="timeUp()"
></uni-count-down>
<text>后结束</text>
</view>
</view>
<view class="goods_content launch" v-else>
<view class="goods_title">{{ goodsDetail.sku_name }}</view>
<view class="goods_price">
<view>
原价
<text class="original_price price-font">
<text class="price-style small">{{ $lang('common.currencySymbol') }}</text>
<text class="price price-style small">{{ parseFloat(goodsDetail.price).toFixed(2).split('.')[0] }}</text>
<text class="price-symbol price-style small">.{{ parseFloat(goodsDetail.price).toFixed(2).split('.')[1] }}</text>
</text>
</view>
<view>
最低可砍至
<text class="bottom_price price-style small">{{ $lang('common.currencySymbol') }}{{ goodsDetail.floor_price }}</text>
</view>
</view>
</view>
</view>
<!-- 进度 -->
<view class="progress">
<view class="progress_item" :style="{ width: (progress > 2 ? progress : 2) + '%' }"><text class="icon-futou iconfont"></text></view>
<view class="progress-point"></view>
</view>
<view class="info-bottom" v-if="goodsDetail">
<view class="price-box" v-if="launchInfo">
<view class="discount-price">
已砍
<text class="price price-font">
{{ $lang('common.currencySymbol') }}{{ parseFloat(parseFloat(launchInfo.price) - parseFloat(launchInfo.curr_price)).toFixed(2) }}
</text>
</view>
<view class="delete-price ">
还剩
<text class="price price-font">
{{ $lang('common.currencySymbol')
}}{{
parseFloat(
parseFloat(launchInfo.price) - parseFloat(launchInfo.floor_price) - (parseFloat(launchInfo.price) - parseFloat(launchInfo.curr_price))
).toFixed(2)
}}
</text>
</view>
</view>
<view class="price-box" v-else>
<view class="discount-price">
已砍
<text class="price price-font">{{ $lang('common.currencySymbol') }}0</text>
</view>
<view class="delete-price ">
还剩
<text class="price price-font">
{{ $lang('common.currencySymbol') }} {{ parseFloat(parseFloat(goodsDetail.price) - parseFloat(goodsDetail.floor_price)).toFixed(2) }}
</text>
</view>
</view>
<view class="pro-info" v-if="!parseFloat(goodsDetail.floor_price)"><view class="button-border">免费拿</view></view>
</view>
<!-- 邀请新用户 -->
<view class="invitation_peo" v-if="launchInfo">
<!-- <view class="tip">邀请新用户砍掉金额更多哦~</view> -->
<block v-if="launchInfo.self">
<view class="bargain-success" v-if="launchInfo.status == 1">
<text class="iconfont icon-kanjiachenggong"></text>
<text>恭喜您砍价成功快去支付吧</text>
</view>
<view class="bargain-success" v-if="launchInfo.status == 2">
<text class="iconfont icon-biaoqing_nanguo"></text>
<text v-if="launchInfo.buy_type == 0 && launchInfo.order_id == 0">很遗憾未能砍至最低价可立即支付带走您心仪的宝贝</text>
<text v-else-if="launchInfo.buy_type == 0 && launchInfo.order_id > 0">很遗憾未能砍至最低价</text>
<text v-else>很遗憾砍价未成单</text>
</view>
<view class="launch-success" v-if="launchInfo.status == 2 && launchInfo.buy_type == 0 && launchInfo.order_id > 0">恭喜您通过立即支付带走您心仪的宝贝</view>
</block>
<block v-if="goodsDetail.bargain_status == 1">
<view v-if="launchInfo.self" class="flex-box" :class="{ success: launchInfo.status == 1 }">
<block v-if="launchInfo.status != 1 && (goodsDetail.bargain_status != 1 || goodsDetail.bargain_stock == 0)">
<block v-if="goodsDetail.bargain_status != 1">
<button class="btn-vice disabled">活动已结束</button>
<button class="btn" @click="$util.redirectTo('/pages_promotion/bargain/list')">更多砍价商品</button>
</block>
<block v-else-if="goodsDetail.bargain_stock == 0">
<button class="btn-vice disabled">已售罄</button>
<button class="btn" @click="$util.redirectTo('/pages_promotion/bargain/list')">更多砍价商品</button>
</block>
</block>
<block v-else>
<block v-if="launchInfo.status == 0">
<button class="btn-vice" v-if="launchInfo.buy_type == 0" @click="buyNow">不砍了直接买</button>
<button class="btn" @click="openSharePopup">喊好友砍一刀</button>
</block>
<block v-if="launchInfo.status == 1">
<button class="btn" @click="buyNow" v-if="launchInfo.order_id == 0">立即支付</button>
<button class="btn" v-if="launchInfo.order_id > 0" @click="$util.redirectTo('/pages/order/detail', { order_id: launchInfo.order_id })">
查看订单
</button>
<button class="btn-vice" @click="$util.redirectTo('/pages/index/index')">低价拿更多商品</button>
</block>
<block v-if="launchInfo.status == 2">
<button class="btn" v-if="launchInfo.order_id > 0" @click="$util.redirectTo('/pages/order/detail', { order_id: launchInfo.order_id })">
查看订单
</button>
<button class="btn" @click="$util.redirectTo('/pages/index/index')">低价拿更多商品</button>
</block>
</block>
</view>
<view v-else class="flex-box">
<block v-if="launchInfo.status == 0">
<button class="btn" @click="bargain" v-if="!launchInfo.cut">帮好友砍一刀</button>
<button class="btn-vice" @click="$util.redirectTo('/pages_promotion/bargain/list')" v-else>我也要低价拿</button>
</block>
<button v-else class="btn" @click="$util.redirectTo('/pages_promotion/bargain/list')">我也要低价拿</button>
</view>
</block>
<block v-else>
<view class="flex-box success">
<button class="btn" v-if="launchInfo.self && launchInfo.order_id > 0" @click="$util.redirectTo('/pages/order/detail', { order_id: launchInfo.order_id })">
查看订单
</button>
<button class="btn-vice disabled">活动已结束</button>
</view>
</block>
</view>
<view class="invitation_peo" v-else>
<view class="flex-box">
<button class="btn" v-if="goodsDetail && goodsDetail.bargain_status == 1" @click="createBargain()">立即参与砍价</button>
<button class="btn-vice disabled" v-else>活动已结束</button>
</view>
</view>
</view>
<view class="bargin_introduction" v-if="launchInfo">
<view class="bargin_introduction_title">帮砍记录</view>
<view class="bargin_introduction_content">
<view class="bargin_invitation" v-if="bargainRecord.length">
<view class="item" v-for="(item, index) in bargainRecord" :key="index">
<view class="item_left">
<image :src="item.headimg == '' ? $util.img($util.getDefaultImage().head) : $util.img(item.headimg)"></image>
<view class="bargin_info">
<view>{{ item.nickname[0] }}*{{ item.nickname[item.nickname.length - 1] }}</view>
<view>{{ $util.timeStampTurnTime(item.bargain_time) }}</view>
</view>
</view>
<view class="item_right">
<image :src="$util.img('public/uniapp/bargain/bargain-icon.png')" class="bargain-icon"></image>
帮砍
<text>{{ item.money }}</text>
</view>
</view>
<view class="item_more" v-if="showMore" @click="scrolltolower()">加载更多</view>
</view>
<view v-else class="record-empty">现在还没有砍价记录</view>
</view>
</view>
<view class="bargin_introduction">
<view class="bargin_introduction_title">砍价流程</view>
<view class="bargin_introduction_content">
<view class="flow">
<view class="flow_item">
<image :src="$util.img('public/uniapp/bargain/bargain_kanjia.png')"></image>
<view>发起商品砍价</view>
</view>
<view class="flow_item">
<image :src="$util.img('public/uniapp/bargain/bargain_friend.png')"></image>
<view>邀请好友砍价达要求</view>
</view>
<view class="flow_item">
<image :src="$util.img('public/uniapp/bargain/bargain_good.png')"></image>
<view>领取商品带回家</view>
</view>
</view>
</view>
</view>
<view class="bargin_introduction" v-if="launchList && launchList.length > 0">
<view class="bargin_introduction_title">砍成晒单</view>
<view class="bargin_introduction_content">
<view class="bargain-list">
<swiper vertical="true" autoplay="true" interval="3000" :display-multiple-items="showNum" :circular="true" :class="'swiper-' + launchList.length">
<swiper-item v-for="(item, index) in launchList" :key="index">
<view class="bargain-item">
<view>
<view class="bargain-head"><image :src="item.headimg == '' ? $util.img($util.getDefaultImage().head) : $util.img(item.headimg)"></image></view>
<view class="bargain-info">
<view class="bargain-title">{{ item.nickname[0] }}*{{ item.nickname[item.nickname.length - 1] }}</view>
<view class="bargain-desc">{{ $util.timeStampTurnTime(item.end_time) }}</view>
</view>
</view>
<view class="bargain-price">
成功砍至
<text>{{ parseFloat(item.curr_price).toFixed(2) }}</text>
</view>
</view>
</swiper-item>
</swiper>
</view>
</view>
</view>
<view class="bargin_introduction">
<view class="bargin_introduction_title">商品详情</view>
<view class="bargin_introduction_content">
<view class="detail-content">
<view class="goods-details" v-if="goodsDetail && goodsDetail.goods_content">
<ns-mp-html :content="goodsDetail.goods_content"></ns-mp-html>
</view>
<view class="goods-details active" v-else>该商家暂无上传相关详情哦</view>
</view>
</view>
</view>
<ns-goods-sku
ref="goodsSku"
v-if="goodsDetail"
@refresh="refreshGoodsSkuDetail"
:goods-id="goodsDetail.goods_id"
:goods-detail="goodsDetail"
:maxBuy="maxBuy"
></ns-goods-sku>
<!-- 帮砍弹出 -->
<uni-popup ref="uniHelpPopup" type="center" :maskClick="false">
<view class="bargain-popup self help">
<image :src="$util.img('public/uniapp/bargain/bargain-pop-1.png')" mode="widthFix" class="head"></image>
<view class="bargain-content">
<view class="uer_info_base" v-if="launchInfo">
<view class="user_info_img">
<image :src="launchInfo.headimg == '' ? $util.img($util.getDefaultImage().head) : $util.img(launchInfo.headimg)" mode="widthFix"></image>
</view>
<text class="user_info_name">{{ launchInfo.nickname }}</text>
</view>
<view v-if="goodsDetail && launchInfo && timeMachine && goodsDetail.bargain_status == 1" class="count-down">
<text>还剩</text>
<uni-count-down
:day="timeMachine.d"
:hour="timeMachine.h"
:minute="timeMachine.i"
:second="timeMachine.s"
color="#fff"
splitorColor="#333 !important"
backgroundColor="#000"
border-color="transparent"
@timeup="timeUp()"
></uni-count-down>
<text>结束</text>
</view>
</view>
<button class="bargain-btn" type="primary" @click="bargain()">帮他砍价</button>
</view>
<text class="iconfont icon-round-close" @click="$refs.uniHelpPopup.close()"></text>
</uni-popup>
<!-- 帮砍成功 -->
<uni-popup ref="uniPopup" type="center" :maskClick="false">
<view class="bargain-popup self">
<image :src="$util.img('public/uniapp/bargain/bargain-pop-2.png')" mode="widthFix" class="head"></image>
<view class="bargain-content">
<text>您已帮砍</text>
<text class="money color-base-text">{{ bargainMoney }}</text>
<text>您也可以参与砍价快去挑选心仪的宝贝吧~~~</text>
</view>
<button class="bargain-btn" type="primary" @click="$util.redirectTo('/pages_promotion/bargain/list')">我也要参与</button>
</view>
<text class="iconfont icon-round-close" @click="closePopup"></text>
</uni-popup>
<!-- 自砍一刀展示 -->
<uni-popup ref="uniSelfBargainPopup" type="center" :maskClick="false">
<view class="bargain-popup self">
<image :src="$util.img('public/uniapp/bargain/bargain-pop-2.png')" mode="widthFix" class="head"></image>
<view class="bargain-content">
<text>您已砍掉</text>
<text class="money color-base-text">{{ my_bargain_money }}</text>
<text>听说分享次数越多砍价成功的机会越大哦</text>
</view>
<button class="bargain-btn" type="primary" @click="openSharePopup">邀请好友帮砍价</button>
</view>
<text class="iconfont icon-round-close" @click="closeSelfPop"></text>
</uni-popup>
<!-- 分享弹窗 -->
<view @touchmove.prevent.stop>
<uni-popup ref="sharePopup" type="bottom" class="share-popup">
<view>
<view class="share-title">分享</view>
<view class="share-content">
<!-- #ifdef MP -->
<view class="share-box">
<button class="share-btn" :plain="true" open-type="share">
<view class="iconfont icon-share-friend"></view>
<text>分享给好友</text>
</button>
</view>
<!-- #endif -->
<!-- #ifdef H5 -->
<view class="share-box" @click="copyUrl">
<button class="share-btn" :plain="true">
<view class="iconfont icon-fuzhilianjie"></view>
<text>复制链接</text>
</button>
</view>
<!-- #endif -->
<view class="share-box" @click="openPosterPopup">
<button class="share-btn" :plain="true">
<view class="iconfont icon-pengyouquan"></view>
<text>生成分享海报</text>
</button>
</view>
</view>
<view class="share-footer" @click="closeSharePopup"><text>取消分享</text></view>
</view>
</uni-popup>
</view>
<!-- 海报 -->
<view @touchmove.prevent.stop class="poster-layer">
<uni-popup ref="posterPopup" type="center">
<template v-if="poster != '-1'">
<view class="poster-wrap">
<view class="image-wrap">
<image :src="$util.img(poster)" :show-menu-by-longpress="true" mode="widthFix" />
<view class="close iconfont icon-close" @click="closePosterPopup()"></view>
</view>
<!-- #ifdef MP || APP-PLUS -->
<view class="save-btn" @click="saveGoodsPoster()">保存图片</view>
<!-- #endif -->
<!-- #ifdef H5 -->
<view class="save-btn">长按图片进行保存</view>
<!-- #endif -->
</view>
</template>
</uni-popup>
</view>
<!-- 悬浮按钮 -->
<hover-nav :need="true"></hover-nav>
<!-- 活动规则 -->
<uni-popup ref="rulePopup" type="center" :maskClick="false">
<view class="rule-wrap">
<view class="content-wrap">
<image :src="$util.img('public/uniapp/common/promotion_rule_head.png')" mode="widthFix" class="rule-head"></image>
<scroll-view scroll-y="true" class="rule">
<view class="text" v-if="goodsDetail && goodsDetail.remark != ''">{{ goodsDetail.remark }}</view>
</scroll-view>
<text class="iconfont icon-round-close" @click="closeRulePopup"></text>
</view>
</view>
</uni-popup>
<loading-cover ref="loadingCover"></loading-cover>
<ns-login ref="login"></ns-login>
<!-- #ifdef MP-WEIXIN -->
<!-- 小程序隐私协议 -->
<privacy-popup ref="privacyPopup"></privacy-popup>
<!-- #endif -->
</view>
</template>
<script>
import LTime from '@/pages_promotion/components/l-time/l-time.vue';
import uniPopup from '@/components/uni-popup/uni-popup.vue';
import goodsSku from '@/components/ns-goods-sku/ns-goods-sku.vue';
import detail from './public/js/detail.js';
export default {
components: {
LTime,
goodsSku,
uniPopup
},
mixins: [detail]
};
</script>
<style lang="scss">
@import './public/css/detail.scss';
</style>
<style scoped>
/deep/ .sku-layer .uni-popup__wrapper.uni-custom .uni-popup__wrapper-box {
max-height: unset !important;
}
/deep/.uni-popup__wrapper.uni-custom.center .uni-popup__wrapper-box {
overflow-y: unset;
background: none !important;
}
.detail-content >>> img {
max-width: 100% !important;
}
.detail-content >>> image {
max-width: 100% !important;
}
/deep/.uni-countdown__number {
padding: 0 4rpx;
line-height: 36rpx;
height: 36rpx;
}
/deep/ .uni-countdown__splitor.day {
line-height: 36rpx;
}
</style>

View File

@@ -0,0 +1,357 @@
<template>
<page-meta :page-style="themeColor"></page-meta>
<view class="page" :style="{ background: bgColor }">
<mescroll-uni @getData="getData" ref="mescroll" :size="10" v-if="addonIsExist.bargain">
<block slot="list">
<ns-adv keyword="NS_BARGAIN" class-name="adv-wrap"></ns-adv>
<block v-if="dataList.length > 0 || dataListing.length > 0">
<view class="goods-list single-column" v-if="dataListing.length">
<view class="goods-item margin-bottom" v-for="(item, index) in dataListing" :key="index">
<view class="goods-item-content">
<view class="goods-img" @click="toDetailP(item)">
<image :src="goodsImg(item.goods_image)" mode="widthFix" @error="imgError(index)"/>
<view class="color-base-bg goods-tag" v-if="goodsTag(item) != ''">{{ goodsTag(item) }}</view>
</view>
<view class="info-wrap">
<view class="name-wrap">
<view class="goods-name" @click="toDetailP(item)">{{ item.goods_name }}</view>
<text class="info-sub-title">已有{{ item.join_num }}人参与</text>
<view class="progress-wrap">
<progress percent="20" :show-info="false" stroke-width="8"
backgroundColor="#FFF4F4" :activeColor="themeStyle.main_color"
border-radius="6" :percent="progressP(item)" />
<view class="progress-point"></view>
<view class="progress-select icon"
:style="{ left: 'calc(' + progressP(item) + '% - 16rpx)' }">
<text class="iconfont icon-futou"></text>
</view>
</view>
</view>
<view class="info-bottom">
<view class="price-box">
<view class="discount-price">已砍<text class="price price-font">{{ (item.price - item.curr_price).toFixed(2) }}</text></view>
<view class="delete-price ">还剩<text class="price price-font">{{ $lang('common.currencySymbol') }}{{ (item.curr_price - item.floor_price).toFixed(2) }}</text></view>
</view>
<view class="pro-info">
<view class="button-border">免费拿</view>
</view>
</view>
</view>
</view>
<view class="goods-item-bottom">
<view class="item-bottom-left">
<uni-count-down :day="item.time.d" :hour="item.time.h" :minute="item.time.i" :second="item.time.s" color="#fff" borderColor="none" splitorColor="#303133" backgroundColor="#303133" />
<view class="color-sub txt">后结束</view>
</view>
<view class="item-bottom-right">
<button type="primary" @click="toDetailP(item)" size="mini" class="mini">继续砍价</button>
</view>
</view>
</view>
</view>
<view class="goods-list single-column" v-if="dataList.length">
<view class="goods-item margin-bottom" v-for="(item, index) in dataList" :key="index">
<view class="goods-item-content">
<view class="goods-img" @click="toDetail(item)">
<image :src="goodsImg(item.goods_image)" mode="widthFix" @error="imgError(index)"/>
<view class="color-base-bg goods-tag" v-if="goodsTag(item) != ''">{{ goodsTag(item) }}</view>
</view>
<view class="info-wrap">
<view class="name-wrap">
<view class="goods-name" @click="toDetail(item)">{{ item.sku_name }}</view>
<text class="info-sub-title">已有{{ item.join_num }}人参与</text>
<view class="progress-wrap"><progress percent="20" :show-info="false" stroke-width="8" backgroundColor="#FFF4F4" :activeColor="themeStyle.main_color" border-radius="6" :percent="progress(item)" />
<view class="progress-point"></view>
<view class="progress-select icon" :style="{ left: 'calc(' + progress(item) + '% - 8rpx)' }">
<text class="iconfont icon-futou"></text>
</view>
</view>
</view>
<view class="info-bottom">
<view class="sale-box price-font">已砍{{ item.sale_num }}</view>
<view class="pro-info">
<view class="button-border">免费拿</view>
</view>
</view>
</view>
</view>
<view class="goods-item-bottom">
<view class="item-bottom-left">
<view class="txt">底价</view>
<text class="unit price-style small">{{ $lang('common.currencySymbol') }}</text>
<text class="price price-style large">{{ parseFloat(item.floor_price).toFixed(2).split('.')[0] }}</text>
<text class="unit price-style large">.{{ parseFloat(item.floor_price).toFixed(2).split('.')[1] }}</text>
<view class="delete-pirce">{{ $lang('common.currencySymbol') }}{{ item.price }}</view>
</view>
<view class="item-bottom-right">
<button type="primary" @click="toDetail(item)" size="mini" class="mini">去砍价</button>
</view>
</view>
</view>
</view>
</block>
<ns-empty v-else-if="isLoad && isLoading" textColor="#fff" :isIndex="false" text="暂无砍价商品"></ns-empty>
</block>
</mescroll-uni>
<!-- 悬浮按钮 -->
<hover-nav></hover-nav>
<loading-cover ref="loadingCover"></loading-cover>
<!-- #ifdef MP-WEIXIN -->
<!-- 小程序隐私协议 -->
<privacy-popup ref="privacyPopup"></privacy-popup>
<!-- #endif -->
</view>
</template>
<script>
import uniCountDown from '@/components/uni-count-down/uni-count-down.vue';
export default {
components: {
uniCountDown
},
data() {
return {
dataList: [],
dataListing: [],
isLoading: false,
isLoad: false,
skuId: 0,
mpShareData: null, //小程序分享数据
progressBorder: '10',
bgColor: ''
};
},
onLoad(option) {
//小程序分享接收source_member
if (option.source_member) {
uni.setStorageSync('source_member', option.source_member);
}
// 小程序扫码进入接收source_member
if (option.scene) {
var sceneParams = decodeURIComponent(option.scene);
sceneParams = sceneParams.split('&');
if (sceneParams.length) {
sceneParams.forEach(item => {
if (item.indexOf('sku_id') != -1) this.skuId = item.split('-')[1];
if (item.indexOf('m') != -1) uni.setStorageSync('source_member', item.split('-')[1]);
if (item.indexOf('is_test') != -1) uni.setStorageSync('is_test', 1);
});
}
}
},
async onShow() {
setTimeout( () => {
if (!this.addonIsExist.bargain) {
this.$util.showToast({
title: '商家未开启砍价',
mask: true,
duration: 2000
});
setTimeout(() => {
this.$util.redirectTo('/pages/index/index');
}, 2000);
}
},1000);
//记录分享关系
if (this.storeToken && uni.getStorageSync('source_member')) {
this.$util.onSourceMember(uni.getStorageSync('source_member'));
}
//小程序分享
// #ifdef MP-WEIXIN
this.$util.getMpShare().then(res => {
this.mpShareData = res;
});
// #endif
await this.getZoneConfig();
if (this.$refs.mescroll) this.$refs.mescroll.refresh();
this.getDataing();
},
//分享给好友
onShareAppMessage() {
return this.mpShareData.appMessage;
},
//分享到朋友圈
onShareTimeline() {
return this.mpShareData.timeLine;
},
methods: {
// 活动页面配置
async getZoneConfig() {
let res = await this.$api.sendRequest({
url: '/api/config/promotionZoneConfig',
data: {
name: 'bargain'
},
async: false
});
let data = res.data;
if (data) {
this.bgColor = data.bg_color;
}
},
getData(mescroll) {
this.$api.sendRequest({
url: '/bargain/api/goods/page',
data: {
page_size: mescroll.size,
page: mescroll.num,
is_exclude_bargaining: 1
},
success: res => {
let newArr = [];
let msg = res.message;
if (res.code == 0 && res.data) {
newArr = res.data.list;
} else {
this.$util.showToast({
title: msg
});
}
if (mescroll.endSuccess) mescroll.endSuccess(newArr.length);
//设置列表数据
if (mescroll.num == 1) this.dataList = []; //如果是第一页需手动制空列表
this.dataList = this.dataList.concat(newArr); //追加新数据
this.isLoad = true;
this.$forceUpdate();
setTimeout(() => {
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
}, 300);
},
fail() {
//联网失败的回调
if (mescroll.endErr) mescroll.endErr();
setTimeout(() => {
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
}, 300);
}
});
},
getDataing() {
this.$api.sendRequest({
url: '/bargain/api/goods/bargainingList',
data: {},
success: res => {
this.dataListing = res.data;
for (var index in res.data) {
this.dataListing[index].time = this.$util.countDown(res.data[index].end_time - res.timestamp);
}
this.isLoading = true;
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
},
fail() {
//联网失败的回调
mescroll.endErr();
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
}
});
},
toDetail(e) {
this.$util.redirectTo('/pages_promotion/bargain/detail', {
b_id: e.bargain_id
});
},
toDetailP(e) {
this.$util.redirectTo('/pages_promotion/bargain/detail', {
b_id: e.bargain_id,
l_id: e.launch_id
});
},
imgError(index) {
this.dataList[index].goods_image = this.$util.getDefaultImage().goods;
this.$forceUpdate();
},
goodsImg(imgStr) {
let imgs = imgStr.split(',');
return imgs[0] ? this.$util.img(imgs[0], {
size: 'mid'
}) : this.$util.getDefaultImage().goods;
},
progress(data) {
let progress = ((parseInt(data.sale_num) / (parseInt(data.bargain_stock) + parseInt(data.sale_num))) * 100).toFixed();
if (progress == 'NaN') {
progress = 0;
}
return progress;
},
progressP(data) {
let progress = (((parseFloat(data.price) - parseFloat(data.curr_price)) / parseFloat(data.price)) * 100).toFixed();
if (progress == 'NaN') {
progress = 0;
}
return progress;
},
goodsTag(data) {
return data.label_name || '';
}
},
onHide() {
if (this.$refs.loadingCover) this.$refs.loadingCover.show();
}
};
</script>
<style lang="scss">
@import './public/css/list.scss';
</style>
<style lang="scss" scoped>
/deep/ .fixed {
position: relative;
top: 0;
}
/deep/ .empty {
margin-top: 0 !important;
}
.clockrun {
.delete-price {
max-width: 60%;
}
}
/deep/ .uni-countdown__number {
min-width: 32rpx;
height: 32rpx;
text-align: center;
line-height: 32rpx;
border-radius: 4px;
display: inline-block;
padding: 4rpx;
margin: 0;
border: none !important;
}
/deep/ .uni-countdown__splitor {
width: 10rpx;
height: 32rpx;
line-height: 36rpx;
text-align: center;
display: inline-block;
}
/deep/ .uni-countdown__splitor.day {
width: initial;
}
</style>
<style>
.progress-wrap>>>.uni-progress .uni-progress-bar {
border-radius: 16rpx;
overflow: hidden;
}
.progress-wrap>>>.uni-progress-bar .uni-progress-inner-bar {
background: linear-gradient(to left, var(--bargain-promotion-color), var(--bargain-promotion-aux-color)) !important;
}
</style>

View File

@@ -0,0 +1,432 @@
<template>
<page-meta :page-style="themeColor"></page-meta>
<view>
<view class="my_spell_category" v-if="storeToken">
<view class="category-item" v-for="(item, index) in statusList" :key="index" @click="categoryChange(item.id)">
<view class="item-con" :class="item.id == status ? 'active color-base-text color-base-bg-before' : ''">{{ item.name }}</view>
</view>
</view>
<mescroll-uni @getData="getData" top="90" ref="mescroll" :size="10" v-if="storeToken">
<block slot="list">
<view class="goods-list" v-for="(item, index) in dataList" :key="index">
<view class="goods-item-content" @click="goBargainDetail(item)">
<view class="goods-item-state">
<text class="state-time">发起砍价 {{ $util.timeStampTurnTime(item.start_time) }}</text>
<text class="state-sign" :style="{ color: bargainState[item.status].color }">{{ bargainState[item.status].text }}</text>
</view>
<view class="goods-item-wrap">
<view class="image-wrap">
<image :src="$util.img(item.sku_image,{'size':'mid'})" mode="aspectFit" @error="imageError(index)"></image>
</view>
<view class="content">
<view class="title">{{ item.sku_name }}</view>
<text class="residue-price color-base-text">已砍至{{ item.curr_price }}</text>
<view class="price-box">
<text class="original-price" v-if="item.status">{{ $lang('common.currencySymbol') }}{{ item.price }}</text>
<view class="time" v-if="item.timeMachine && item.status == 0">
<uni-count-down :day="item.timeMachine.d" :hour="item.timeMachine.h"
:minute="item.timeMachine.i" :second="item.timeMachine.s" color="#fff"
splitorColor="#000 !important" backgroundColorClass="color-base-bg"
border-color="transparent" />
<text class="end-txt">后结束</text>
</view>
</view>
</view>
</view>
</view>
<view class="goods-item-action">
<view class="invitation-bargain">
<image :src="recordItem.headimg == '' ? $util.img($util.getDefaultImage().head) : $util.img(recordItem.headimg)" v-for="(recordItem, recordIndex) in item.bargain_record" :key="recordIndex" @error="memberImageError(index, recordIndex)"/>
<text class="invitation-bargain-end color-base-text color-base-border" v-if="item.status == 0">+</text>
<text class="invitation-bargain-end color-base-text color-base-border " v-else>
<text class="icon-ellipsis iconfont"></text>
</text>
</view>
<button class="btn" type="default" v-if="item.status == 0 && item.bargain_status == 1" @click="goBargainDetail(item)">继续砍价</button>
<block v-if="item.status == 1 && item.bargain_status == 1">
<button class="btn" type="default" v-if="item.order_id == 0" @click="goBargainDetail(item)">购买商品</button>
<button class="btn" type="default" v-else @click="goBargainDetail(item)">查看详情</button>
</block>
<button class="btn" type="default" v-if="item.status == 2 && item.bargain_status == 1" @click="$util.redirectTo('/pages_promotion/bargain/list')">重新砍价</button>
</view>
</view>
<ns-empty v-if="dataList.length == 0" :isIndex="true" :emptyBtn="{url: '/pages_promotion/bargain/list',text: '去逛逛'}" text="暂无砍价订单"></ns-empty>
</block>
</mescroll-uni>
<ns-login ref="login"></ns-login>
<loading-cover ref="loadingCover"></loading-cover>
</view>
</template>
<script>
import uniCountDown from '@/components/uni-count-down/uni-count-down.vue';
export default {
components: {
uniCountDown
},
data() {
return {
mescroll: null,
dataList: [],
statusList: [{
id: 'all',
name: '全部'
},
{
id: 0,
name: '正在砍价'
},
{
id: 1,
name: '砍价成功'
},
{
id: 2,
name: '砍价失败'
}
],
status: 'all',
bargainState: [{
color: '#FFA044',
text: '正在砍价'
},
{
color: '#11BD64',
text: '砍价成功'
},
{
color: '#FF4544',
text: '砍价失败'
}
],
};
},
onShow() {
setTimeout( () => {
if (!this.addonIsExist.bargain) {
this.$util.showToast({
title: '商家未开启砍价',
mask: true,
duration: 2000
});
setTimeout(() => {
this.$util.redirectTo('/pages/index/index');
}, 2000);
}
},1000);
if (!this.storeToken) {
this.$nextTick(() => {
this.$refs.login.open('/pages_promotion/bargain/my_bargain');
});
}
},
methods: {
//请求列表数据
getData(mescroll) {
this.mescroll = mescroll;
this.$api.sendRequest({
url: '/bargain/api/bargain/launchPage',
data: {
page_size: mescroll.size,
page: mescroll.num,
status: this.status
},
success: res => {
let newArr = [];
let msg = res.message;
if (res.code == 0 && res.data) {
newArr = res.data.list;
} else {
this.$util.showToast({
title: msg
});
}
mescroll.endSuccess(newArr.length);
//设置列表数据
if (mescroll.num == 1) this.dataList = []; //如果是第一页需手动制空列表
newArr.forEach(v => {
if (v.end_time > res.timestamp) {
v.timeMachine = this.$util.countDown(v.end_time - res.timestamp);
} else {
v.timeMachine = null;
}
});
this.dataList = this.dataList.concat(newArr); //追加新数据
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
},
fail() {
//联网失败的回调
mescroll.endErr();
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
}
});
},
//砍价详情
goBargainDetail(data) {
this.$util.redirectTo('/pages_promotion/bargain/detail', {
l_id: data.launch_id,
b_id: data.bargain_id
});
},
//切换分类
categoryChange(e) {
this.status = e;
this.mescroll.resetUpScroll();
},
imageError(index) {
this.dataList[index].sku_image = this.$util.getDefaultImage().goods;
this.$forceUpdate();
},
memberImageError(index, j) {
this.dataList[index].bargain_record[j].headimg = this.$util.getDefaultImage().head;
this.$forceUpdate();
}
},
onBackPress(options) {
if (options.from === 'navigateBack') {
return false;
}
this.$util.redirectTo('/pages/member/index');
return true;
},
watch: {
storeToken: function(nVal, oVal) {
if (nVal) {
this.$refs.mescroll.refresh();
}
}
}
};
</script>
<style lang="scss">
.my_spell_category {
width: 100%;
height: 88rpx;
display: flex;
justify-content: space-around;
background: #fff;
position: fixed;
top: 0;
z-index: 999;
box-sizing: border-box;
.category-item {
width: 130rpx;
text-align: center;
.item-con {
display: inline-block;
height: 88rpx;
font-size: 30rpx;
position: relative;
line-height: 88rpx;
}
.item-con.active:after {
content: '';
display: block;
width: 100%;
height: 4rpx;
border-radius: 6rpx;
position: absolute;
left: 0;
bottom: 0;
}
&:last-of-type {
margin-right: 0;
}
}
}
.goods-list {
margin: 20rpx 30rpx 20rpx;
background-color: #fff;
border-radius: 10rpx;
height: 358rpx;
padding: 30rpx;
}
.goods-list .goods-item-content {
background-color: #fff;
border-radius: 10rpx;
box-sizing: border-box;
.goods-item-state {
display: flex;
align-items: center;
justify-content: space-between;
.state-time {
font-size: $font-size-base;
color: $color-title;
}
.state-sign {
font-size: $font-size-tag;
}
}
.goods-item-wrap {
display: flex;
margin-top: 42rpx;
}
.image-wrap {
display: flex;
align-items: center;
justify-content: center;
width: 170rpx;
height: 170rpx;
margin-right: 18rpx;
border-radius: 10rpx;
overflow: hidden;
image {
width: 170rpx;
height: 170rpx;
}
}
.content {
flex: 1;
position: relative;
line-height: 1;
width: calc(100% - 220rpx);
.title {
margin-top: -8rpx;
height: 84rpx;
font-size: $font-size-base;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
line-height: 42rpx;
color: $color-title;
}
.residue-price {
display: inline-block;
margin-top: 16rpx;
font-size: $font-size-sub;
padding: 2rpx 4rpx;
}
.price-box {
position: absolute;
bottom: 0;
line-height: 1.6;
font-size: $font-size-tag;
width: 100%;
.original-price {
color: $color-tip;
font-size: $font-size-tag;
text-decoration: line-through;
}
.time {
display: flex;
align-items: center;
margin-bottom: -12rpx;
font-size: $font-size-goods-tag;
.uni-countdown {
display: flex;
align-items: center;
}
.end-txt {
font-size: $font-size-base;
margin-left: 10rpx;
}
}
}
}
}
.goods-list .goods-item-action {
display: flex;
align-items: center;
justify-content: space-between;
height: 120rpx;
box-sizing: border-box;
.invitation-bargain {
display: flex;
flex-flow: wrap;
width: 510rpx;
image {
border: 2rpx solid #fff;
}
image,
.invitation-bargain-end {
margin-right: -24rpx;
width: 50rpx;
height: 50rpx;
border-radius: 50%;
border: 2rpx solid #fff;
}
.invitation-bargain-end {
display: flex;
align-items: center;
justify-content: center;
border: 2rpx dashed;
font-size: 24rpx;
background-color: #fff;
z-index: 999;
}
}
.btn {
display: flex;
justify-content: center;
align-items: center;
margin: 0;
padding: 0;
width: 130rpx;
height: 60rpx;
line-height: 1;
font-size: $font-size-tag;
border-radius: 60rpx;
border-color: #999999;
&.fail {
background-color: #aaa;
}
}
}
</style>
<style scoped>
>>>.uni-countdown__number,
>>>.uni-countdown__splitor {
margin: 0;
padding: 0;
}
.time>>>.uni-countdown__number {
min-width: 28rpx;
height: 28rpx;
text-align: center;
line-height: 28rpx;
background: #000;
border-radius: 4px;
display: inline-block;
padding: 4rpx;
margin: 0;
border: none;
}
.time>>>.uni-countdown__splitor {
margin: 0 4rpx;
}
</style>

View File

@@ -0,0 +1,52 @@
<template>
<page-meta :page-style="themeColor"></page-meta>
<view>
<common-payment :api="api" create-data-key="bargainOrderCreateData" ref="payment"></common-payment>
</view>
</template>
<script>
export default {
data() {
return {
api: {
payment: '/bargain/api/ordercreate/payment',
calculate: '/bargain/api/ordercreate/calculate',
create: '/bargain/api/ordercreate/create'
}
}
},
provide() {
return {
promotion: this.promotion.bind(this)
}
},
onShow() {
if (this.$refs.payment) this.$refs.payment.pageShow();
},
methods:{
/**
* 处理活动信息 如不需要则留空
*/
promotion(data){
if(data.bargain_info){
return {title: '砍价活动', content: '该商品参与砍价活动'}
}
}
}
};
</script>
<style scoped lang="scss">
/deep/ .uni-popup__wrapper.uni-custom .uni-popup__wrapper-box {
background: none;
max-height: unset !important;
overflow-y: hidden !important;
}
/deep/ .uni-popup__wrapper {
border-radius: 20rpx 20rpx 0 0;
}
/deep/ .uni-popup {
z-index: 8;
}
</style>

View File

@@ -0,0 +1,989 @@
.bargain {
background-size: cover;
background-repeat: repeat-y;
padding-bottom: 100rpx;
background: var(--bargain-promotion-color);
.bargain_top {
height: 360rpx;
background-size: 100% auto;
background-repeat: no-repeat;
display: flex;
color: #fff;
justify-content: center;
position: relative;
line-height: 1;
view {
color: #fff;
line-height: 50rpx;
height: 50rpx;
display: flex;
align-items: center;
font-size: 24rpx;
margin: 26rpx 2rpx;
}
}
.bargin_content {
background-color: #fff;
border-radius: 20rpx;
margin: 24rpx;
padding-bottom: 60rpx;
padding-top: 30rpx;
margin-top: 0;
.uer_info_base {
display: flex;
position: relative;
padding: 0 0;
flex-direction: column;
align-items: center;
justify-content: center;
margin-bottom: 20rpx;
.user_info_img {
background-color: #fff;
width: 120rpx;
height: 120rpx;
margin-top: -80rpx;
margin-left: 0;
border-radius: 50%;
border: 2px solid #fff;
overflow: hidden;
image {
width: 100%;
height: 100%;
}
}
.user_info_name {
margin-left: 0;
color: $color-tip;
align-self: center;
}
.rule_detail {
position: absolute;
height: 34rpx;
line-height: 34rpx;
padding: 0 12rpx;
font-size: 18rpx;
border: 1px solid;
right: 24rpx;
top: 30rpx;
border-radius: 34rpx;
}
}
.bargin_propaganda {
display: flex;
justify-content: space-between;
margin: 0 27rpx 30rpx;
font-size: 34rpx;
color: #333333;
font-weight: bold;
.marks {
font-size: 60rpx;
line-height: 1;
color: #b0b0b0;
}
}
.goods {
display: flex;
margin-top: 0;
margin-left: 24rpx;
margin-right: 24rpx;
padding: 24rpx;
background-color: #fafafa;
border-radius: 10rpx;
overflow: hidden;
.goods_img {
min-width: 180rpx;
width: 230rpx;
height: 230rpx;
margin-right: 20rpx;
border-radius: 10rpx;
image {
width: 100%;
height: 100%;
}
}
.goods_content {
flex: 1;
overflow: hidden;
.goods_title {
line-height: 1.3;
font-size: 30rpx;
margin-bottom: 10rpx;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
display: -moz-box;
-moz-line-clamp: 2;
-moz-box-orient: vertical;
word-wrap: break-word;
word-break: break-all;
white-space: normal;
height: 78rpx;
}
.goods_price {
display: flex;
> view {
color: #666666;
font-size: 22rpx;
.original_price {
margin-left: 3rpx;
}
.bottom_price {
color: var(--price-color);
margin-left: 3rpx;
}
&:first-child {
margin-right: 10rpx;
}
}
}
.partake_num {
font-size: 22rpx;
color: #666666;
margin-top: 4rpx;
.residue-num {
margin-left: 10rpx;
}
.ident {
color: #fe0b42;
margin: 0 4rpx;
}
}
.count-down {
color: #666666;
margin-top: 6rpx;
text {
margin-left: 16rpx;
}
}
&.launch {
.goods_price {
flex-direction: column;
.original_price {
text-decoration: unset;
color: var(--price-color);
}
}
}
}
}
.progress_info {
display: flex;
justify-content: space-between;
margin: 40rpx 24rpx 0;
> view {
font-size: $font-size-tag;
color: #666666;
text {
color: var(--price-color);
}
}
}
.progress {
position: relative;
margin: 40rpx 35rpx 0;
height: 20rpx;
background-color: #fff4f4;
border-radius: 30rpx;
.progress_item {
width: 5%;
position: absolute;
left: 0;
border-radius: 30rpx;
height: 20rpx;
background: linear-gradient(to left, var(--bargain-promotion-color), var(--bargain-promotion-aux-color));
animation: all 1s forwards;
.iconfont {
position: absolute;
right: -20rpx;
top: -10rpx;
height: 40rpx;
width: 40rpx;
color: #fff;
background-color: var(--bargain-promotion-color);
display: flex;
align-items: center;
justify-content: center;
line-height: 1;
border-radius: 50%;
font-size: 24rpx;
z-index: 1;
}
}
.progress-point {
position: absolute;
background-color: var(--bargain-promotion-color);
height: 26rpx;
width: 26rpx;
border-radius: 50%;
right: -13rpx;
top: -4rpx;
}
}
.info-bottom {
display: flex;
justify-content: space-between;
margin: 10px 12px 0;
align-items: center;
.sale-box {
color: var(--bargain-promotion-color);
}
.price-box {
display: flex;
line-height: 1;
.discount-price {
display: flex;
font-size: 26rpx;
line-height: 1;
margin-top: 4rpx;
.price {
}
}
.delete-price {
display: flex;
font-size: 26rpx;
line-height: 1;
margin-top: 4rpx;
}
.price {
line-height: 1.2;
color: var(--bargain-promotion-color);
}
}
.pro-info {
line-height: 1;
display: flex;
align-items: center;
.button-border {
border: 2rpx solid var(--bargain-promotion-color);
color: var(--bargain-promotion-color);
font-size: 24rpx;
padding: 4rpx 6rpx;
line-height: 1;
border-radius: 4rpx;
background-color: #fff4f4;
position: relative;
border-top-right-radius: 0;
}
.button-border::before {
content: '';
display: block;
position: absolute;
top: -10rpx;
right: -2rpx;
border-left: 10rpx solid transparent;
border-right: 0 solid transparent;
border-bottom: 10rpx solid var(--bargain-promotion-color);
}
.button-border::after {
content: '';
display: block;
position: absolute;
top: -6rpx;
right: 0rpx;
border-left: 10rpx solid transparent;
border-right: 0 solid transparent;
border-bottom: 10rpx solid #fff4f4;
}
}
}
.bragain_recode {
display: flex;
align-items: center;
justify-content: space-between;
margin: 58rpx 24rpx 20rpx;
.bragain_recode_list {
display: flex;
margin: 0 26rpx;
.bragain_recode_add {
margin-left: 44rpx;
}
image {
width: 84rpx;
height: 84rpx;
border: 4rpx solid #fe0b42;
border-radius: 50%;
margin-left: -22rpx;
&:first-child {
margin-left: 0;
}
}
}
.bragain_recode_more {
width: 84rpx;
height: 84rpx;
line-height: 84rpx;
text-align: center;
font-size: 12rpx;
color: #999999;
}
.bragain_recode_add {
width: 84rpx;
height: 84rpx;
line-height: 76rpx;
text-align: center;
border-radius: 50%;
border: 1px dashed #e6e6e6;
font-size: 60rpx;
color: #e6e6e6;
}
}
.bragain_recode_detail {
font-size: 24rpx;
color: #000;
margin: 0 34rpx 0;
.iconfont {
font-size: 24rpx;
color: #333333;
}
}
.invitation_peo {
margin: 28rpx 30rpx 0;
.bargain-success {
display: flex;
align-items: center;
justify-content: center;
font-size: $font-size-tag;
margin: 40rpx 0 0;
.iconfont {
margin-right: 8rpx;
color: rgb(250, 26, 26);
}
> view {
text-align: center;
}
}
.launch-success {
text-align: center;
font-size: $font-size-tag;
}
.tip {
text-align: center;
color: #fe0b42;
font-size: $font-size-goods-tag;
}
.flex-box {
display: flex;
margin-top: 20rpx;
button {
flex: 1;
&:nth-child(2) {
margin-left: 20rpx;
}
}
&.success {
flex-direction: column;
.btn {
margin: 0 !important;
}
.btn-vice {
background-color: #fff;
border: 2rpx solid var(--bargain-promotion-color);
color: var(--bargain-promotion-color);
margin: 0 !important;
margin-top: 20rpx !important;
}
}
}
.btn {
height: 80rpx;
line-height: 80rpx;
background: var(--bargain-promotion-color);
border-radius: $border-radius;
text-align: center;
font-size: 30rpx;
color: #fff;
font-weight: bold;
margin: 20rpx 0;
}
.btn-vice {
height: 80rpx;
line-height: 80rpx;
background: var(--bargain-promotion-aux-color);
border-radius: $border-radius;
text-align: center;
font-size: 30rpx;
color: #fff;
font-weight: bold;
margin: 20rpx 0;
}
}
}
.bargin_introduction {
margin: 24rpx;
background-color: #fff;
border-radius: 20rpx;
.record-empty {
text-align: center;
font-size: $font-size-tag;
color: #999;
padding: 100rpx 0;
background-color: #fff;
border-radius: 20rpx;
}
.bargin_introduction_title {
display: flex;
align-items: center;
justify-content: center;
font-size: 34rpx;
color: #222222;
padding: 36rpx 0 0;
font-weight: bold;
&::before {
content: '';
background-color: #222222;
width: 20rpx;
height: 5rpx;
display: block;
margin-right: 10rpx;
}
&::after {
content: '';
background-color: #222222;
width: 20rpx;
height: 5rpx;
display: block;
margin-left: 10rpx;
}
}
.detail-content {
padding: 20rpx;
overflow: hidden;
* {
max-width: 100%;
}
img {
width: 100%;
}
}
.flow {
display: flex;
background-color: #fff;
border-radius: 20rpx;
padding: 40rpx 0;
.flow_item {
position: relative;
flex: 1;
text-align: center;
image {
width: 88rpx;
height: 88rpx;
margin-bottom: 20rpx;
}
> view {
color: #333333;
font-size: 24rpx;
}
&::after {
position: absolute;
content: '';
height: 2rpx;
width: 100rpx;
background-color: #fd0742;
top: 44rpx;
right: -22%;
}
&:last-child::after {
width: 0;
}
}
}
.bargin_invitation {
background-color: #fff;
border-radius: 20rpx;
padding: 27rpx;
.item {
display: flex;
align-items: center;
padding: 20rpx 0;
border-bottom: 2rpx solid rgba(237, 237, 237, 0.5);
&:last-child {
border-bottom: 0;
}
.item_left {
flex: 1;
display: flex;
overflow: hidden;
align-items: center;
image {
height: 70rpx;
width: 70rpx;
border: 2rpx solid #979797;
border-radius: 50%;
margin-right: 20rpx;
}
> view {
overflow: hidden;
align-items: center;
display: flex;
color: #6d7278;
white-space: nowrap;
/* 不换行 */
text-overflow: ellipsis;
.tip {
font-size: 20rpx;
color: #666666;
}
}
.bargin_info {
display: flex;
flex-direction: column;
justify-content: left;
align-items: flex-start;
> view:last-child {
color: #999999;
font-size: $font-size-tag;
}
}
}
.item_right {
min-width: 100rpx;
color: var(--bargain-promotion-color);
font-size: $font-size-base;
font-weight: bold;
display: flex;
align-items: center;
text {
font-size: $font-size-base;
color: var(--bargain-promotion-color);
font-weight: bold;
}
.bargain-icon {
width: 44rpx;
height: 44rpx;
margin-right: 14rpx;
}
}
}
.item_more {
margin-top: 20rpx;
text-align: center;
font-size: $font-size-tag;
color: #999999;
}
}
.bargain-list {
padding: 40rpx 0;
margin: 0 24rpx;
swiper {
height: 360rpx;
&.swiper-1 {
height: 120rpx;
}
&.swiper-2 {
height: 240rpx;
}
}
.bargain-item {
background-color: #f2f2f2;
display: flex;
align-items: center;
justify-content: space-between;
padding: 16rpx 24rpx;
> view:first-child {
display: flex;
align-items: center;
}
.bargain-head {
width: 60rpx;
height: 60rpx;
margin-right: 20rpx;
border: 2rpx solid #979797;
border-radius: 50%;
overflow: hidden;
image {
width: 100%;
height: 100%;
}
}
.bargain-info {
.bargain-title {
font-size: 24rpx;
color: #333333;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
width: 260rpx;
}
.bargain-desc {
font-size: 22rpx;
color: #6d7278;
}
}
.bargain-price {
text {
color: var(--bargain-promotion-color);
margin-left: 4rpx;
}
}
}
}
}
}
.bargain-popup {
width: 70vw;
background-color: #fff;
position: relative;
box-sizing: border-box;
border-radius: 20rpx;
height: 650rpx;
.head {
width: 55%;
position: absolute;
left: 50%;
top: 0;
transform: translate(-50%, -70%);
}
.title {
text-align: center;
font-size: 38rpx;
margin-top: 40rpx;
}
.money {
text-align: center;
.num {
font-size: 36rpx;
font-weight: 600;
}
.unit {
font-size: 24rpx;
margin-left: 8rpx;
}
}
&.self {
.head {
position: unset;
transform: unset;
top: 0;
left: 0;
width: 100%;
max-height: 350rpx;
}
.bargain-content {
text-align: center;
padding: 60rpx 40rpx;
.money {
font-weight: bold;
}
}
.bargain-btn {
width: max-content;
margin: 0 auto;
font-weight: bold;
padding: 0 60rpx;
background-color: var(--bargain-promotion-color);
color: #ffffff;
}
}
&.help {
.bargain-content {
.uer_info_base {
display: flex;
position: relative;
padding: 0 0;
flex-direction: column;
align-items: center;
justify-content: center;
margin-bottom: 20rpx;
.user_info_img {
background-color: #fff;
width: 120rpx;
height: 120rpx;
margin-top: -240rpx;
margin-left: 0;
border-radius: 50%;
border: 2px solid var(--bargain-promotion-color);
overflow: hidden;
image {
width: 100%;
height: 100%;
}
}
.user_info_name {
margin-left: 0;
align-self: center;
font-size: 30rpx;
font-weight: bold;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
width: 100%;
}
}
.count-down {
> text {
color: #666;
margin: 0 6rpx;
}
}
}
}
}
.icon-round-close {
display: block;
font-size: 60rpx;
color: #ffffff;
text-align: center;
}
.share-popup,
.uni-popup__wrapper-box {
.share-title {
line-height: 60rpx;
font-size: $font-size-toolbar;
padding: 15rpx 0;
text-align: center;
}
.share-content {
display: flex;
display: -webkit-flex;
-webkit-flex-wrap: wrap;
-moz-flex-wrap: wrap;
-ms-flex-wrap: wrap;
-o-flex-wrap: wrap;
flex-wrap: wrap;
padding: 15rpx;
.share-box {
flex: 1;
text-align: center;
.share-btn {
margin: 0;
padding: 0;
border: none;
line-height: 1;
height: auto;
background-color: unset;
text {
margin-top: 20rpx;
font-size: $font-size-tag;
display: block;
color: $color-title;
}
}
.iconfont {
font-size: 80rpx;
line-height: initial;
}
.icon-fuzhilianjie,
.icon-pengyouquan,
.icon-haowuquan,
.icon-share-friend {
color: #07c160;
}
}
}
.share-footer {
height: 90rpx;
line-height: 90rpx;
border-top: 2rpx #f5f5f5 solid;
text-align: center;
color: #666;
}
}
.poster-layer {
/deep/ .uni-popup__wrapper.center {
width: 100vw!important;
height: 100vh!important;
background: none!important;
}
/deep/ .uni-popup__wrapper.uni-custom.center .uni-popup__wrapper-box {
max-width: 100vw!important;
max-height: 100vh!important;
background: none!important;
width: 100vw;
height: 100vh;
}
.poster-wrap {
display: flex;
align-items: center;
justify-content: center;
width: 100vw;
height: 100vh;
flex-direction: column;
}
.generate-poster {
padding: 40rpx 0;
.iconfont {
font-size: 80rpx;
color: #07c160;
line-height: initial;
}
> view {
text-align: center;
&:last-child {
margin-top: 20rpx;
}
}
}
.image-wrap {
width: 80%;
position: relative;
image {
width: 100%;
line-height: 1;
border-radius: 10rpx;
overflow: hidden;
}
}
.msg {
padding: 40rpx;
}
.save-btn {
text-align: center;
height: 80rpx;
line-height: 80rpx;
background-color: $base-color;
border-radius: 10rpx;
width: 80%;
color: #fff;
margin-top: 30rpx;
}
.save-text {
color: #fff;
margin-top: 10rpx;
}
.close {
position: absolute;
top: 0;
right: 20rpx;
width: 40rpx;
height: 80rpx;
font-size: 50rpx;
color: #999;
}
}
.goods-details img {
max-width: 100%;
}
.rule-mark-enter {
position: absolute;
top: 120rpx;
right: 0;
width: 20rpx;
height: 100rpx;
line-height: 1;
background: #fff4f4;
padding: 10rpx 20rpx 10rpx 20rpx;
border-radius: 20rpx 0 0 20rpx;
color: var(--bargain-promotion-color);
font-size: $font-size-tag;
z-index: 100;
}
.rule-wrap {
border-radius: 10rpx;
background-color: #fff;
width: 80vw;
padding: 12rpx;
box-sizing: border-box;
.content-wrap {
width: 100%;
border-radius: 8rpx;
position: relative;
.rule-head {
width: 100%;
position: absolute;
transform: translateY(-50%);
left: 0;
top: 0;
}
.rule {
max-height: 880rpx;
overflow: hidden;
padding: 80rpx 30rpx 0 30rpx;
box-sizing: border-box;
.text {
font-size: $font-size-sub;
}
}
.icon-round-close {
color: #fff;
text-align: center;
position: absolute;
bottom: -150rpx;
left: 50%;
transform: translateX(-50%);
font-size: 70rpx;
}
}
}

View File

@@ -0,0 +1,243 @@
.page {
width: 100%;
min-height: 100vh;
background: var(--bargain-promotion-color);
}
.adv-wrap {
margin: $margin-updown $margin-both;
width: auto;
}
.lineheight-clear {
line-height: 1 !important;
}
// 商品列表单列样式
.goods-list.single-column {
.goods-item {
padding: 26rpx 26rpx 20rpx;
background: #fff;
margin: $margin-updown $margin-both;
border-radius: 24rpx;
display: flex;
position: relative;
flex-direction: column;
.goods-item-content {
display: flex;
}
.goods-item-bottom {
display: flex;
justify-content: space-between;
margin-top: 10rpx;
line-height: 1;
.item-bottom-left {
display: flex;
align-items: baseline;
margin-top: 10rpx;
.delete-pirce {
text-decoration: line-through;
color: $color-sub;
margin-left: 20rpx;
}
.txt {
margin-left: 10rpx;
font-weight: 26rpx;
}
.unit,
.price {
color: var(--bargain-promotion-color) !important;
}
}
.item-bottom-right {
display: flex;
align-items: center;
font-weight: bold;
button {
color: #fff;
background-color: var(--bargain-promotion-color);
}
}
}
.goods-img {
width: 200rpx;
height: 200rpx;
overflow: hidden;
border-radius: $border-radius;
margin-right: 20rpx;
image {
width: 100%;
height: 100%;
}
}
.goods-tag {
color: #fff;
line-height: 1;
padding: 8rpx 12rpx;
position: absolute;
border-top-left-radius: $border-radius;
border-bottom-right-radius: $border-radius;
top: 26rpx;
left: 26rpx;
font-size: $font-size-goods-tag;
}
.info-wrap {
flex: 1;
display: flex;
flex-direction: column;
width: calc(100% - 220rpx);
.info-sub-title {
color: $color-tip;
font-size: $font-size-tag;
margin-top: 6rpx;
}
}
.info-bottom {
display: flex;
justify-content: space-between;
margin-top: 10rpx;
align-items: center;
.sale-box {
color: var(--bargain-promotion-color);
}
.price-box {
display: flex;
line-height: 1;
.discount-price {
display: flex;
font-size: 26rpx;
line-height: 1;
margin-top: 4rpx;
}
.delete-price {
display: flex;
font-size: 26rpx;
line-height: 1;
margin-top: 4rpx;
}
.price {
line-height: 1.2;
color: var(--bargain-promotion-color);
}
}
.pro-info {
line-height: 1;
display: flex;
align-items: center;
.button-border {
border: 2rpx solid var(--bargain-promotion-color);
color: var(--bargain-promotion-color);
font-size: 24rpx;
padding: 4rpx 6rpx;
line-height: 1;
border-radius: 4rpx;
background-color: var(--bargain-promotion-color-shallow);
position: relative;
border-top-right-radius: 0;
}
.button-border::before {
content: '';
display: block;
position: absolute;
top: -10rpx;
right: -2rpx;
border-left: 10rpx solid transparent;
border-right: 0 solid transparent;
border-bottom: 10rpx solid var(--bargain-promotion-color);
}
.button-border::after {
content: '';
display: block;
position: absolute;
top: -6rpx;
right: 0rpx;
border-left: 10rpx solid transparent;
border-right: 0 solid transparent;
border-bottom: 10rpx solid var(--bargain-promotion-color-shallow);
}
}
}
.name-wrap {
flex: 1;
}
.goods-name {
font-size: $font-size-base;
line-height: 1.4;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
font-weight: bold;
word-wrap: break-word;
height: 80rpx;
}
.progress-wrap {
display: flex;
position: relative;
width: calc(100% - 32rpx);
margin: 10rpx auto;
progress {
flex: 1;
}
.progress-point {
background: var(--bargain-promotion-color);
width: 24rpx;
height: 24rpx;
border-radius: 50%;
position: absolute;
right: -12rpx;
top: -4rpx;
z-index: 1;
}
.progress-select {
background-color: var(--bargain-promotion-color);
color: var(--bargain-promotion-aux-color);
width: 24rpx;
height: 24rpx;
border-radius: 50%;
position: absolute;
left: 0;
top: -4rpx;
font-size: 24rpx;
z-index: 11;
&.icon {
width: 34rpx;
height: 34rpx;
display: flex;
align-items: center;
justify-content: center;
top: -10rpx;
}
.iconfont {
background-color: unset;
color: #fff;
font-size: 20rpx;
}
}
.txt {
margin: 0 100rpx 0 20rpx;
}
}
.member-price-tag {
display: inline-block;
width: 60rpx;
line-height: 1;
margin-left: 6rpx;
image {
width: 100%;
}
}
}
}

View File

@@ -0,0 +1,537 @@
import htmlParser from '@/common/js/html-parser';
export default {
data() {
return {
windowHeight: 0,
launch_id: 0,
bargain_id: 0,
info: {
headimg: ''
},
bargainRecord: [],
page: 1,
totalPage: 1,
load: false,
timeMachine: null,
bargainMoney: '0.00',
poster: '-1', //海报
posterMsg: '', //海报错误信息
posterHeight: 0,
goodsDetail: null,
launchInfo: null,
maxBuy: 1,
launchList: null,
showMore: false,
isOwn: 0, //是否自己砍了一刀
my_bargain_money: 0,
shareImg: ''
};
},
onLoad(data) {
setTimeout(() => {
if (!this.addonIsExist.bargain) {
this.$util.showToast({
title: '商家未开启砍价',
mask: true,
duration: 2000
});
setTimeout(() => {
this.$util.redirectTo('/pages/index/index');
}, 2000);
}
}, 1000);
// #ifdef MP-ALIPAY
let options = my.getLaunchOptionsSync();
options.query && Object.assign(data, options.query);
// #endif
this.getHeight();
if (data.l_id) this.launch_id = data.l_id;
if (data.b_id) this.bargain_id = data.b_id;
if (data.is_own) this.isOwn = data.is_own;
if (data.scene) {
var sceneParams = decodeURIComponent(data.scene);
sceneParams = sceneParams.split('&');
if (sceneParams.length) {
sceneParams.forEach(item => {
if (item.indexOf('m') != -1) uni.setStorageSync('source_member', item.split('-')[1]);
if (item.indexOf('l_id') != -1) this.id = item.split('-')[1];
if (item.indexOf('b_id') != -1) this.bargain_id = item.split('-')[1];
if (item.indexOf('is_own') != -1) this.isOwn = item.split('-')[1];
});
}
}
// #ifdef MP-WEIXIN
this.getShareImg();
// #endif
},
onShow() {
this.getBargainInfo();
},
computed: {
progress() {
if (this.launchInfo && this.goodsDetail) {
let total = this.goodsDetail.price - this.launchInfo.floor_price,
progress = parseInt(((this.goodsDetail.price - this.launchInfo.curr_price) / total) * 100);
return isNaN(progress) ? 0 : progress;
} else {
return 0;
}
},
showNum() {
if (this.launchList && this.launchList.length < 3) {
return this.launchList.length;
} else {
return 3;
}
}
},
methods: {
timeUp() {
this.getBargainInfo();
},
getHeight() {
var self = this;
uni.getSystemInfo({
success: function (res) {
self.windowHeight = res.windowHeight - 44;
if (self.iphoneX) {
self.windowHeight = self.windowHeight - 33;
}
}
});
},
getBargainInfo() {
if (this.load) return;
this.load = true;
this.$api.sendRequest({
url: '/bargain/api/bargain/detail',
data: {
launch_id: this.launch_id,
bargain_id: this.bargain_id
},
success: res => {
if (res.code == 0) {
this.goodsDetail = res.data.goods_sku_detail;
if (this.goodsDetail.sku_spec_format) this.goodsDetail.sku_spec_format = JSON.parse(this.goodsDetail.sku_spec_format);
this.$langConfig.title(this.goodsDetail.sku_name);
this.goodsDetail.unit = this.goodsDetail.unit || "件";
// 商品SKU格式
if (this.goodsDetail.goods_spec_format) this.goodsDetail.goods_spec_format = JSON.parse(this.goodsDetail.goods_spec_format);
// if (this.goodsDetail.goods_content) this.goodsDetail.goods_content = htmlParser(this.goodsDetail.goods_content);
if (this.addonIsExist.form) {
this.getGoodsForm();
}
if (res.data.launch_info && Object.keys(res.data.launch_info).length > 0) {
this.launchInfo = res.data.launch_info;
if (this.launchInfo.status == 0) {
this.timeMachine = this.$util.countDown(this.launchInfo.end_time - res.timestamp);
}
this.launch_id = this.launchInfo.launch_id;
}
if (res.data.launch_list && Object.keys(res.data.launch_list).length > 0) {
this.launchList = res.data.launch_list;
}
//发起砍价后自砍一刀展示
if (this.isOwn && this.goodsDetail.is_own > 0 && this.launchInfo && this.launchInfo.self && this.launchInfo.my_bargain_money) {
this.my_bargain_money = this.launchInfo.my_bargain_money;
this.$refs.uniSelfBargainPopup.open();
}
//好友进来后帮砍弹出
if (this.launchInfo && !this.launchInfo.self && !this.launchInfo.cut && this.goodsDetail.bargain_status == 1) this.$refs.uniHelpPopup.open();
this.load = false;
this.getBargainRecord(1);
this.setPublicShare();
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
} else {
this.load = false;
this.$util.redirectTo('/pages_promotion/bargain/my_bargain');
}
},
fail: res => {
this.load = false;
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
}
});
},
getBargainRecord(page) {
if (this.load) return;
if (!this.launchInfo) return;
this.load = true;
this.$api.sendRequest({
url: '/bargain/api/bargain/record',
data: {
page: page,
id: this.launchInfo.launch_id
},
success: res => {
this.load = false;
this.totalPage = res.data.page_count;
this.page = page;
if (res.code == 0 && res.data.list.length) {
if (page == 1) {
this.bargainRecord = res.data.list;
} else {
this.bargainRecord = this.bargainRecord.concat(res.data.list);
}
}
this.showMore = false;
if (page < this.totalPage) {
this.showMore = true;
}
}
});
},
scrolltolower() {
let next = this.page + 1;
if (!this.load && next <= this.totalPage) {
this.getBargainRecord(next);
}
},
browse() {
this.$api.sendRequest({
url: '/bargain/api/bargain/browse',
data: {
bargain_id: this.goodsDetail.bargain_id
},
success: res => {
}
});
},
share() {
this.$api.sendRequest({
url: '/bargain/api/bargain/share',
data: {
bargain_id: this.goodsDetail.bargain_id
},
success: res => {
}
});
},
/**
* 刷新商品详情数据
* @param {Object} goodsSkuDetail
*/
refreshGoodsSkuDetail(goodsSkuDetail) {
Object.assign(this.goodsDetail, goodsSkuDetail);
},
// 发起砍价
createBargain() {
if (!this.storeToken) {
this.$refs.login.open('/pages_promotion/bargain/detail?l_id=' + this.launch_id + '&b_id=' + this.bargain_id);
return;
}
// #ifdef MP
this.$util.subscribeMessage('BARGAIN_COMPLETE');
// #endif
if (this.goodsDetail.sku_spec_format || this.goodsDetail.goods_form) {
this.$refs.goodsSku.show('bargain');
} else {
this.$api.sendRequest({
url: '/bargain/api/bargain/launch',
data: {
id: this.goodsDetail.id
},
success: res => {
if (res.code == 0) {
let params = {
l_id: res.data,
b_id: this.bargain_id
};
if (this.goodsDetail.is_own) params.is_own = 1;
this.$util.redirectTo('/pages_promotion/bargain/detail', params, 'redirectTo');
} else {
this.$util.showToast({
title: res.message
});
}
}
});
}
},
/**
* 立即购买,不砍了,直接买
*/
buyNow() {
let goodsFormData = uni.getStorageSync('goodFormData');
let fn = ()=>{
uni.setStorage({
key: 'bargainOrderCreateData',
data: {
launch_id: this.launchInfo.launch_id
},
success: () => {
this.$util.redirectTo('/pages_promotion/bargain/payment');
}
});
};
if(!goodsFormData && this.goodsDetail.goods_form){
this.$refs.goodsSku.show('bargain',()=>{
fn();
});
}else{
fn();
}
},
/**
* 帮好友砍价
*/
bargain() {
if (this.storeToken) {
this.$api.sendRequest({
url: '/bargain/api/bargain/bargain',
data: {
id: this.launchInfo.launch_id
},
success: res => {
if (res.code == 0) {
this.bargainMoney = parseFloat(res.data.bargain_money).toFixed(2);
this.$refs.uniHelpPopup.close();
this.$refs.uniPopup.open();
this.getBargainInfo();
} else {
this.$util.showToast({
title: res.message
});
}
}
});
} else {
this.$refs.login.open('/pages_promotion/bargain/detail?l_id=' + this.launch_id + '&b_id=' + this.bargain_id);
}
},
closePopup() {
this.$refs.uniPopup.close();
},
closeSelfPop() {
this.$refs.uniSelfBargainPopup.close();
},
// 打开分享弹出层
openSharePopup() {
this.$refs.uniSelfBargainPopup.close();
this.$refs.sharePopup.open();
this.share();
},
// 关闭分享弹出层
closeSharePopup() {
this.$refs.sharePopup.close();
},
copyUrl() {
let text = '嘿!朋友就差你这一刀了,帮一下忙呗~' + this.$config.h5Domain + '/pages_promotion/bargain/detail?l_id=' + this.launch_id + '&b_id=' + this.bargain_id;
if (this.memberInfo && this.memberInfo.member_id) text += '&source_member=' + this.memberInfo.member_id;
this.$util.copy(text, () => {
this.closeSharePopup();
});
},
toBargainRecode() {
let view = uni.createSelectorQuery().select('.bargin_introduction');
view.boundingClientRect(data => {
uni.pageScrollTo({
duration: 100,
scrollTop: data.top + 100
});
}).exec();
},
/**
* 设置公众号分享
*/
setPublicShare() {
let shareUrl = this.$config.h5Domain + '/pages_promotion/bargain/detail?l_id=' + this.launch_id + '&b_id=' + this.bargain_id;
if (this.memberInfo && this.memberInfo.member_id) shareUrl += '&source_member=' + this.memberInfo.member_id;
this.$util.setPublicShare({
title: this.goodsDetail.sku_name,
desc: '嘿!朋友就差你这一刀了,帮一下忙呗~',
link: shareUrl,
imgUrl: this.goodsDetail.sku_image
},
res => {
// console.log('公众号分享成功');
// this.share();
}
);
},
//-------------------------------------海报-------------------------------------
// 打开海报弹出层
openPosterPopup() {
this.getGoodsPoster();
this.$refs.sharePopup.close();
},
// 关闭海报弹出层
closePosterPopup() {
this.$refs.posterPopup.close();
},
/**
* 获取海报
*/
getGoodsPoster() {
uni.showLoading({
title: '海报生成中...'
});
//活动海报信息
let posterParams = {
l_id: this.launch_id,
b_id: this.bargain_id,
bargain_id: this.goodsDetail.bargain_id
};
if (this.memberInfo && this.memberInfo.member_id) posterParams.source_member = this.memberInfo.member_id;
this.$api.sendRequest({
url: '/bargain/api/goods/poster',
data: {
page: '/pages_promotion/bargain/detail',
qrcode_param: JSON.stringify(posterParams)
},
success: res => {
if (res.code == 0) {
this.poster = res.data.path + '?time=' + new Date().getTime();
this.$refs.posterPopup.open();
} else {
this.posterMsg = res.message;
this.$util.showToast({
title: this.posterMsg
})
}
uni.hideLoading();
},
fail: err => {
uni.hideLoading();
}
});
},
getNewArray(array, subGroupLength) {
if (array) {
let index = 0;
let newArray = [];
while (index < array.length) {
newArray.push(array.slice(index, (index += subGroupLength)));
}
return newArray;
}
},
toDetail(goods_id) {
this.$util.redirectTo('/pages/goods/detail', {
goods_id: goods_id
});
},
/**
* 获取分享图
*/
getShareImg() {
let posterParams = {
l_id: this.launch_id,
b_id: this.bargain_id,
bargain_id: this.bargain_id
};
this.$api.sendRequest({
url: '/bargain/api/goods/shareimg',
data: {
page: '/pages_promotion/bargain/launch',
qrcode_param: JSON.stringify(posterParams)
},
success: res => {
if (res.code == 0) this.shareImg = res.data.path;
}
});
},
openRulePopup() {
this.$refs.rulePopup.open();
},
closeRulePopup() {
this.$refs.rulePopup.close();
},
/**
* 获取商品表单
*/
getGoodsForm() {
this.$api.sendRequest({
url: "/form/api/form/goodsform",
data: {
goods_id: this.goodsDetail.goods_id
},
success: res => {
if (res.code == 0 && res.data) {
this.$set(this.goodsDetail, 'goods_form', res.data);
let goodsFormData = uni.getStorageSync('goodFormData');
// 检测是否填写过自定义表单,已经发起砍价后,禁止切换规格
if (!goodsFormData && this.launchInfo && this.goodsDetail.goods_spec_format) {
this.goodsDetail.goods_spec_format.forEach(item => {
item.value.forEach(specItem => {
for (var i = 0; i < this.goodsDetail.sku_spec_format.length; i++) {
let skuItem = this.goodsDetail.sku_spec_format[i];
if (skuItem.spec_id == specItem.spec_id && skuItem.spec_value_id != specItem.spec_value_id) {
specItem.disabled = true;
break;
}
}
});
});
}
}
}
});
}
},
filters: {
/**
* 字符掩饰输出
* @param {Object} str
*/
cover(str) {
if (typeof str == 'string' && str.length > 0) {
return str.substr(0, 1) + '******' + str.substr(-1);
} else {
return '';
}
}
},
/**
* 自定义分享内容
*/
onShareAppMessage() {
var path = '/pages_promotion/bargain/detail?l_id=' + this.launch_id + '&b_id=' + this.bargain_id;
if (this.memberInfo && this.memberInfo.member_id) path += '&source_member=' + this.memberInfo.member_id;
this.share();
return {
title: '嘿!朋友就差你这一刀了,帮一下忙呗~',
imageUrl: this.shareImg ? this.$util.img(this.shareImg) : this.$util.img(this.goodsDetail.sku_image, {
size: 'big'
}),
path: path,
success: res => {
},
fail: res => {
},
complete: res => {
}
};
}
}