第一次提交

This commit is contained in:
wangxiaowei
2025-06-11 10:21:51 +08:00
commit 52932d54b1
2341 changed files with 185283 additions and 0 deletions

View File

@ -0,0 +1,745 @@
<template>
<view class="bargain-detail">
<scroll-view scroll-y="true" class="scroll-Y" :style="'height:' + scrollviewHigh + 'px;'" v-if="!loadding">
<!--图片-->
<view class="product-pic">
<swiper class="swiper" :indicator-dots="indicatorDots" :autoplay="autoplay" :interval="interval" :duration="duration">
<swiper-item v-for="(item, index) in detail.product.image" :key="index">
<image :src="item.file_path" mode="aspectFit"></image>
</swiper-item>
</swiper>
</view>
<!--基本信息-->
<view class="bg-white m20 p30 br12">
<view class="price-wrap">
<view class="left">
<template>
<view class="new-price">
<text class="f24 redF6">¥</text>
<text class="num">{{ detail.bargain_price }}</text>
</view>
<text class="old-price">¥{{ detail.line_price }}</text>
</template>
</view>
</view>
<view class="product-name">{{ detail.product.product_name }}</view>
<!--砍价进行中-->
<view class="">
<view class="limited-spike d-b-c">
<text class="left-name"><text class="already-sale">已有{{ detail.product_sales }}人砍价成功</text></text>
<view class="right">
<countdown ref="countdown" :config="countdownConfig" @returnVal="returnValFunc"></countdown>
</view>
</view>
</view>
<!--邀请好友-->
<view class="d-b-c f24 gray3 mt20" @click="openRule">
<text class="f24 gray3">邀请朋友帮忙砍价,超低价购买心仪之物</text>
<view>
<text>玩法详情</text><text class="icon iconfont icon-jiantou" style="color: #333333;font-size:25rpx;"></text>
</view>
</view>
</view>
<view class="m20 br12 o-h bg-white">
<!--已选择-->
<view class="already-choice" :class="detail.server!=''?'border-b-d9':''" v-if="detail.spec_type == 20" @click="openPopup('order')">
<view class="group-hd">
<view class="left">
<text class="min-name gray9">选择:</text>
</view>
<view class="flex-1 p-0-20 center-content f28 text-ellipsis o-h">
{{alreadyChioce}}
</view>
<view class="right">
<text class="icon iconfont icon-jiantou" style="font-size: 22rpx;color: #9A9A9A;"></text>
</view>
</view>
</view>
<!-- 保障 -->
<view class="already-choice" @click="showGuarantee" v-if="detail.server!=''">
<view class="group-hd">
<view class="left">
<text class="min-name gray9">服务:</text>
</view>
<view class="flex-1 p-0-20 center-content f28 text-ellipsis o-h">
{{serverList}}
</view>
<view class="right">
<text class="icon iconfont icon-jiantou" style="font-size: 22rpx;color: #9A9A9A;"></text>
</view>
</view>
</view>
</view>
<!-- 店铺信息 -->
<view class="shop_head_info" v-if="store_open">
<view class="shop_list_body_item_shop">
<view class="shop_list_body_item_shop_logo">
<image :src="shop_info.logos" mode=""></image>
</view>
<view class="shop_list_body_item_shop_info flex-1">
<view class="f32 title fb">{{shop_info.name}}</view>
<view class="f26 brand gray9">主营品牌: {{shop_info.category_name}}</view>
<view class="f26 sales gray9">销量:{{shop_info.product_sales}}件</view>
</view>
<view class="shop_list_body_item_shop_others">
<view class="f26 collect">店铺评分:<text class="fb redF6">{{shop_info.server_score}}</text></view>
<button @click="goto_shop()">进店看看</button>
</view>
</view>
</view>
<!--详情内容-->
<view class="product-content">
<view class="group-hd border-b-e">
<view class="d-s-c">
<view class="pro_nameline"></view><text class="min-name f32 fb">商品介绍</text>
</view>
</view>
<view v-if="detail.product.is_picture == 0" class="content-box" v-html="detail.product.content"></view>
<view v-if="detail.product.is_picture == 1" class="content-box">
<view class="ww100" v-for="(item, index) in detail.product.contentImage" :key="index"><image class="ww100" :src="item.file_path" mode="widthFix"></image></view>
</view>
</view>
</scroll-view>
<!--底部按钮-->
<view class="btns-wrap d-s-c d-stretch">
<template v-if="!loadding">
<view class="customer-service d-c-c">
<view class="icon-box d-c-c" @click="gotoPage('/pages/index/index')">
<button class="d-c-c d-c bg-white">
<text class="btn_btom pr icon iconfont icon-Homehomepagemenu gray3" style="height: 50rpx;line-height: 60rpx;"></text>
<text class="f22 gray3" style="height: 50rpx;line-height: 40rpx;">首页</text>
</button>
</view>
<!-- #ifdef MP-WEIXIN -->
<view class="icon-box">
<button class="d-c-c d-c" open-type="contact" session-from="wxapp">
<text class="icon iconfont icon-kefu2 gray3" style="height: 50rpx;line-height: 60rpx;"></text>
<text class="f22 gray3" style="height: 50rpx;line-height: 40rpx;">客服</text>
</button>
</view>
<!-- #endif -->
<!-- #ifdef H5 -->
<view class="icon-box" @click="openMaservice">
<button class="d-c-c d-c">
<text class="icon iconfont icon-kefu2 gray3" style="height: 50rpx;line-height: 60rpx;"></text>
<text class="f22 gray3" style="height: 50rpx;line-height: 40rpx;">客服</text>
</button>
</view>
<!-- #endif -->
</view>
<view class="buy-alone flex-1 d-c-c d-c" @click="gotoProducntDetail()">
<text>{{ detail.product.product_price }}</text>
<button type="primary">单独购买</button>
</view>
<view class="make-group flex-1 d-c-c d-c" @click="openPopup('order')">
<text>{{ detail.bargain_price }}</text>
<button type="primary" class="buy" @click="openPopup('order')">砍价购</button>
</view>
</template>
</view>
<!--购物确定-->
<spec :isPopup="isPopup" @confirm="confirm" :productModel="productModel" @close="closePopup"></spec>
<!--规则-->
<Rule :isRule="isRule" :setting="setting" @close="closeRule"></Rule>
<!--客服-->
<Mpservice v-if="isMpservice" :isMpservice="isMpservice" @close="closeMpservice"></Mpservice>
<!-- 保障弹窗 -->
<guarantee :isguarantee="isguarantee" :server="detail.server" @close="closeGuarantee"></guarantee>
</view>
</template>
<script>
import countdown from '@/components/countdown/countdown.vue';
import Mpservice from '@/components/mpservice/Mpservice.vue';
import Spec from './popup/Spec.vue';
import Rule from './popup/Rule.vue';
import utils from '@/common/utils.js';
import guarantee from '@/components/guarantee.vue';
export default {
components: {
Spec,
Rule,
countdown,
Mpservice,
guarantee
},
data() {
return {
/*手机高度*/
phoneHeight: 0,
/*可滚动视图区域高度*/
scrollviewHigh: 0,
/*是否加载完成*/
loadding: true,
/*是否显示面板指示点*/
indicatorDots: true,
/*是否知道切换*/
autoplay: true,
/*自动切换时间间隔*/
interval: 2000,
/*滑动动画时长*/
duration: 500,
/*倒计时配置*/
countdownConfig: {
title: '',
/*开始时间*/
startstamp: 0,
/*结束时间*/
endstamp: 0
},
/*详情*/
detail: {
product_sku: {},
show_sku: {
product_price: '',
product_sku_id: 0,
line_price: '',
stock_num: 0,
sku_image: ''
},
show_point_sku: {}
},
alreadyChioce: '',
/*活动设置*/
setting: {},
/*是否确定购买弹窗*/
isPopup: false,
/*商品属性*/
specData: null,
/*子级页面传参*/
productModel: {},
/*规格数组*/
productSpecArr: [],
/*是否显示规则*/
isRule: false,
/*商品规格*/
productSku: [],
/*是否打开客服*/
isMpservice: false,
serverList: '', //保障
isguarantee: false,
shop_info: {},
store_open: 1
};
},
onLoad(e) {
uni.showLoading({
title: '加载中'
});
this.type_active = 0;
/*分类id*/
this.bargain_product_id = e.bargain_product_id;
},
mounted() {
this.init();
/*获取产品详情*/
this.getData();
},
methods: {
/*初始化*/
init() {
let _this = this;
uni.getSystemInfo({
success(res) {
_this.phoneHeight = res.windowHeight;
// 计算组件的高度
let view = uni.createSelectorQuery().select('.btns-wrap');
view.boundingClientRect(data => {
let h = _this.phoneHeight - data.height;
_this.scrollviewHigh = h;
}).exec();
}
});
},
/*获取数据*/
getData() {
let self = this;
let bargain_product_id = self.bargain_product_id;
self._get(
'plus.bargain.product/detail', {
bargain_product_id: bargain_product_id,
url: ''
},
function(res) {
self.countdownConfig.startstamp = res.data.active.start_time;
self.countdownConfig.endstamp = res.data.active.end_time;
/*详情内容格式化*/
res.data.detail.product.content = utils.format_content(res.data.detail.product.content);
/*初始化商品多规格*/
if (res.data.detail.product.spec_type == 20) {
self.initSpecData(res.data.detail.bargainSku, res.data.specData);
}
//#ifdef MP-WEIXIN
self.store_open = res.data.store_open;
//#endif
self.setting = res.data.setting;
self.detail = res.data.detail;
self.shop_info = res.data.detail.supplier;
self.getServer();
self.loadding = false;
uni.hideLoading();
}
);
},
confirm() {
this.$refs.countdown.clear()
},
getServer() {
let self = this;
let serverList = [];
if (self.detail.server) {
self.detail.server.forEach((item, index) => {
serverList.push(item.name)
})
self.serverList = serverList.join('·')
}
},
closeGuarantee() {
this.isguarantee = false;
},
showGuarantee() {
this.isguarantee = true;
},
/*多规格商品*/
initSpecData(list, data) {
for (let i = 0; i < list.length; i++) {
let item = list[i];
if (item.productSku) {
let arr = item.productSku.spec_sku_id.split('_').map(Number);
this.productSku.push(arr);
}
}
for (let i in data.spec_attr) {
for (let j = 0; j < data.spec_attr[i].spec_items.length; j++) {
let item = data.spec_attr[i].spec_items[j];
if (this.hasSpec(item.item_id, i)) {
item.checked = false;
item.disabled = false;
} else {
data.spec_attr[i].spec_items.splice(j, 1);
j--;
}
}
}
this.specData = data;
if (this.specData.spec_attr) {
this.specData.spec_attr.forEach(item => {
this.alreadyChioce += item.group_name;
this.alreadyChioce += ' / ';
});
this.alreadyChioce = this.alreadyChioce.replace(/(\s\/\s)$/gi, '');
}
},
/*判断有没有规格*/
hasSpec(id, _index) {
let flag = false;
for (let i = 0; i < this.productSku.length; i++) {
let arr = this.productSku[i];
if (arr[_index] == id) {
flag = true;
break;
}
}
return flag;
},
openPopup(e) {
let obj = {
specData: this.specData,
detail: this.detail,
productSpecArr: this.specData != null ? new Array(this.specData.spec_attr.length) : [],
show_sku: {
sku_image: '',
bargain_price: 0,
product_sku_id: 0,
line_price: 0,
bargain_stock: 0,
bargain_product_sku_id: 0,
sum: 1
},
productSku: this.productSku,
type: e
};
this.productModel = obj;
this.isPopup = true;
},
/*关闭弹窗*/
closePopup(e, cart_total_num) {
this.isPopup = false;
if (e && e.spec_attr) {
this.alreadyChioce = '';
let has = '已选:';
let noone = '';
e.spec_attr.forEach(item => {
if (item.spec_items) {
let h = '';
for (let i = 0; i < item.spec_items.length; i++) {
let child = item.spec_items[i];
if (child.checked) {
h = child.spec_value + ' / ';
break;
}
}
if (h != '') {
has += h;
} else {
noone += item.group_name;
}
}
});
if (noone != '') {
this.alreadyChioce = noone;
} else {
has = has.replace(/(\s\/\s)$/gi, '');
this.alreadyChioce = has;
}
}
if (cart_total_num) {
this.cart_total_num = cart_total_num;
}
},
/*打开客服*/
openMaservice() {
this.isMpservice = true;
},
/*关闭客服*/
closeMpservice() {
this.isMpservice = false;
},
/*跳转商品详情页面*/
gotoProducntDetail() {
this.gotoPage('/pages/product/detail/detail?product_id=' + this.detail.product_id);
},
/*规则*/
openRule() {
this.isRule = true;
},
/*关闭规则*/
closeRule() {
this.isRule = false;
},
/*倒计时返回*/
returnValFunc() {},
//跳转店铺首页
goto_shop() {
let self = this;
self.gotoPage('/pages/shop/shop?shop_supplier_id=' + self.detail.supplier.shop_supplier_id);
},
}
};
</script>
<style lang="scss">
.bargain-detail {
padding-bottom: 90rpx;
}
.bargain-detail .product-pic,
.bargain-detail .product-pic .swiper,
.bargain-detail .product-pic image {
width: 750rpx;
height: 750rpx;
}
.bargain-detail .price-wrap {
display: flex;
justify-content: space-between;
align-items: center;
}
.bargain-detail .price-wrap .left {
display: flex;
justify-content: flex-start;
align-items: flex-end;
}
.bargain-detail .price-wrap .new-price {
color: $dominant-color;
font-size: 30rpx;
}
.bargain-detail .price-wrap .new-price .num {
padding: 0 4rpx;
font-size: 40rpx;
}
.bargain-detail .price-wrap .old-price {
margin-left: 10rpx;
font-size: 24rpx;
color: #999999;
text-decoration: line-through;
}
.bargain-detail .product-name {
padding: 20rpx 0;
font-size: 32rpx;
font-weight: bold;
color: #333333;
}
.bargain-detail .product-describe {
padding: 20rpx;
font-size: 24rpx;
color: #999999;
}
.product-comment,
.product-content {
margin-top: 20rpx;
background: #ffffff;
}
.product-content .content-box p image {
width: 100%;
}
.product-content .content-box {
font-size: 36rpx;
}
.btns-wrap {
position: fixed;
height: 100rpx;
right: 0;
bottom: 0;
left: 0;
display: flex;
background: #ffffff;
align-items: center;
}
.btns-wrap .icon-box {
width: 90rpx;
height: 90rpx;
}
.btns-wrap .icon-box .iconfont {
font-size: 40rpx;
color: #888888;
}
.btns-wrap .customer-service button {
height: 80rpx;
background-color: #FFFFFF;
}
.btns-wrap button,
.btns-wrap button:after {
padding: 0;
margin: 0;
height: 30rpx;
line-height: 30rpx;
margin: 0;
padding: 0;
flex: 1;
border-radius: 0;
border: 0;
}
.btns-wrap .buy-alone {
width: 220rpx;
height: 80rpx;
border-top-left-radius: 40rpx;
border-bottom-left-radius: 40rpx;
margin-left: 10rpx;
}
.btns-wrap .make-group {
width: 220rpx;
height: 80rpx;
border-top-right-radius: 40rpx;
border-bottom-right-radius: 40rpx;
margin-right: 10rpx;
}
.btns-wrap .buy-alone button,
.btns-wrap .make-group button {
font-size: 26rpx;
background: none;
}
.btns-wrap .buy-alone,
.btns-wrap .buy-alone button {
background: #F6AC0C;
}
.btns-wrap .buy-alone text,
.btns-wrap .make-group text {
color: #ffffff;
font-size: 32rpx;
}
.btns-wrap .make-group,
.btns-wrap .make-group button {
background: #8D60FF;
}
.share-box {
position: fixed;
padding-right: 10rpx;
width: 80rpx;
height: 80rpx;
right: 0;
bottom: 180rpx;
display: flex;
justify-content: center;
align-items: center;
border-radius: 16rpx 0 0 16rpx;
background: rgba(0, 0, 0, 0.8);
}
.share-box button {
padding: 0;
background: 0;
line-height: 60rpx;
}
.share-box .iconfont {
margin-bottom: 10rpx;
font-size: 50rpx;
color: #ffffff;
}
.create-img {
width: 100%;
padding: 20rpx;
box-sizing: border-box;
}
.create-img image {
width: 100%;
}
.create-img button {
width: 100%;
}
.limited-spike {
padding: 0 35rpx;
height: 60rpx;
color: #ffffff;
border-radius: 6rpx;
background: linear-gradient(0deg, #EBE3FF 0%, #EEE6FF 100%);
// background: linear-gradient(to bottom, #ff6c65, #e2231a);
}
.limited-spike .left-name {
font-size: 24rpx;
color: #5C1CFF;
}
.limited-spike .right {
color: #5C1CFF;
font-size: 24rpx;
}
.limited-spike .right::v-deep .box {
height: 40rpx;
padding: 4rpx;
border-radius: 8rpx;
line-height: 40rpx;
text-align: center;
background: #EBE3FF;
color: #5C1CFF;
}
.limited-spike .right::v-deep text {
padding: 0;
}
.already-choice {
padding: 0 30rpx;
background: #ffffff;
}
.already-choice .center-content {
line-height: 90rpx;
}
.shop_head_info {
margin: 20rpx;
padding: 30rpx;
box-sizing: border-box;
background-color: white;
border-radius: 12rpx;
}
.shop_list_body_item_shop {
width: 100%;
height: 120rpx;
display: flex;
justify-content: space-between;
}
.shop_list_body_item_shop_logo {
width: 120rpx;
height: 120rpx;
}
.shop_list_body_item_shop_logo image {
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.1);
border-radius: 12rpx;
}
.shop_list_body_item_shop_info {
box-sizing: border-box;
margin-left: 20rpx;
padding-top: 0;
display: flex;
justify-content: space-between;
flex-direction: column;
}
.shop_list_body_item_shop_others {
box-sizing: border-box;
display: flex;
justify-content: space-between;
flex-direction: column;
text-align: right;
padding-top: 0;
}
.shop_list_body_item_shop_others button {
width: 160rpx;
height: 60rpx;
border: 1rpx solid #F6220C;
border-radius: 30rpx;
line-height: 60rpx;
font-size: 26rpx;
font-family: PingFang SC;
font-weight: 500;
color: #F6220C;
text-align: center;
padding: 0;
background-color: #ffffff;
}
.pro_nameline {
width: 4rpx;
height: 24rpx;
background-color: #f6220c;
margin-right: 12rpx;
}
</style>

View File

@ -0,0 +1,101 @@
<template>
<view class="rule-detail-wrap" v-show="openRule">
<view class="rule-bg" @click="closeRule" :class="openRule ? 'active' : ''"></view>
<view class="rule-content" v-on:click.stop>
<view class="title pr">
<text class="">活动规则</text>
<text class="iconfont icon-guanbi" @click="closeRule"></text>
</view>
<view class="content" v-html="setting.bargain_rules"></view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
/*是否显示*/
openRule: false
};
},
props: ['isRule', 'setting'],
watch: {
isRule: function(n, o) {
if (n != o) {
this.openRule = n;
}
}
},
methods: {
/*关闭规则*/
closeRule() {
this.openRule = false;
this.$emit('close');
}
}
};
</script>
<style>
.rule-detail-wrap {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
width: 100%;
z-index: 999;
}
.rule-detail-wrap .rule-bg {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background-color: rgb(0, 0, 0);
opacity: 0;
transition: all 0.3s ease-out;
}
.rule-detail-wrap .rule-bg.active {
opacity: 0.8;
}
.rule-detail-wrap .rule-content {
position: absolute;
top: 20vh;
left: 0;
right: 0;
margin: auto;
width: 80%;
background-color: #fff;
border-radius: 12rpx;
transition: all 0.3s ease-out;
box-sizing: border-box;
white-space: pre-wrap;
}
.rule-detail-wrap .rule-content .title {
height: 100rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 32rpx;
position: relative;
color: #333;
box-sizing: border-box;
}
.rule-detail-wrap .rule-content .iconfont {
position: absolute;
right: 20rpx;
top: 20rpx;
font-size: 32rpx;
color: #999999;
}
.rule-detail-wrap .rule-content .content {
padding: 30rpx;
max-height: 60vh;
font-size: 28rpx;
line-height: 150%;
overflow-y: auto;
box-sizing: border-box;
}
</style>

View File

@ -0,0 +1,515 @@
<template>
<view :class="Visible ? 'product-popup open' : 'product-popup close'" @touchmove.stop.prevent="" @click="closePopup">
<view class="popup-bg"></view>
<view class="main" v-on:click.stop>
<view class="header">
<image :src="form.show_sku.sku_image" mode="aspectFit" class="avt"></image>
<view class="price d-s-c">
<template v-if="form.specData == null||isAll">
<text>¥</text>
<text class="num fb">{{ form.show_sku.bargain_price }}</text>
<text class="old-price">¥{{ form.show_sku.line_price }}</text>
</template>
<template v-else>
<text class="f22">¥</text>
<text class="f40 fb">{{ form.detail.bargain_price }}</text>
<!--<text class="fb">-</text>
<text class="f40 fb">{{ form.detail.bargain_high_price }}</text>-->
</template>
</view>
<view class="stock">库存:{{ form.show_sku.bargain_stock }}</view>
<view class="p-20-0 select_spec">{{ selectSpec }}</view>
<view class="close-btn" @click="closePopup"><text class="icon iconfont icon-guanbi"></text></view>
</view>
<view class="body">
<!--规格-->
<view v-if="form.specData != null">
<scroll-view scroll-y="true" class="specs mt20" style="max-height: 600rpx;" v-if="form.specData !=null">
<view class="specs mt20" v-for="(item_attr,attr_index) in form.specData.spec_attr" :key="attr_index">
<view class="specs-hd p-20-0">
<text class="f24 gray9">{{item_attr.group_name}}</text>
<text class="ml10 red" v-if="form.productSpecArr[attr_index]==null">
请选择{{item_attr.group_name}}
</text>
</view>
<view class="specs-list">
<button :class="item.checked ? 'btn-checked' : 'btn-checke'" v-for="(item,item_index) in item_attr.spec_items"
:key="item_index" @click="selectAttr(attr_index, item_index)">{{item.spec_value}}
</button>
</view>
</view>
</scroll-view>
</view>
<!--选择数量-->
<view class="level-box count_choose">
<text class="key">数量</text>
<view class="d-s-c">
<view class="icon-box minus d-c-c" @click="sub()" :class="{ 'num-wrap': !issub }"><text class="icon iconfont icon-jian"
style="font-size: 20rpx;color: #333333;"></text></view>
<view class="text-wrap"><input type="text" v-model="form.show_sku.sum" value="" /></view>
<view class="icon-box plus d-c-c" :class="{ 'num-wrap': !isadd }" @click="add()"><text class="icon iconfont icon-jia"
style="font-size: 20rpx;color: #333333;"></text></view>
</view>
</view>
</view>
<view class="btns white"><button class="confirm-btn" @click="confirmFunc(form)">确认</button></view>
</view>
</view>
</template>
<script>
import {
judgeSelect
} from '@/common/specSelect.js';
export default {
data() {
return {
/*是否可见*/
Visible: false,
form: {
detail: {
product_sku: {},
show_sku: {},
show_point_sku: {
bargain_price: 0
}
},
show_sku: {
sum: 1
}
},
/*当前商品总库存*/
stock: 0,
/*选择提示*/
selectSpec: '',
/*规格是否选择完整*/
isAll: false,
};
},
props: ['isPopup', 'productModel'],
onLoad() {},
mounted() {},
computed: {
/*判断增加数量*/
isadd: function() {
return this.form.show_sku.sum >= this.stock || this.form.show_sku.sum >= this.form.detail.limit_num;
},
/*判断减少数量*/
issub: function() {
return this.form.show_sku.sum <= 1;
}
},
watch: {
'isPopup': function(n, o) {
if (n != o) {
this.Visible = n;
if (!this.isOpenSpec) {
this.form = this.productModel;
this.isOpenSpec = true;
this.initShowSku();
this.form.specData.spec_attr.forEach((item,index)=>{
this.selectAttr(index,0);
})
}
this.form.type = this.productModel.type;
}
},
'form.specData': {
handler(n, o) {
let str = '',
select = '';
this.isAll = true;
if (n) {
for (let i = 0; i < n.spec_attr.length; i++) {
if (this.form.productSpecArr[i] == null) {
this.isAll = false;
str += n.spec_attr[i].group_name + ' ';
} else {
n.spec_attr[i].spec_items.forEach(item => {
if (this.form.productSpecArr[i] == item.item_id) {
select += '\"' + item.spec_value + '\" ';
}
});
}
}
if (!this.isAll) {
str = '请选择: ' + str;
} else {
select = '已选: ' + select;
}
}
this.selectSpec = this.isAll ? select : str;
},
deep: true,
immediate: true
}
},
methods: {
/*关闭弹窗*/
closePopup() {
this.$emit('close', this.form.specData, null);
},
/*确认提交*/
confirmFunc() {
if (this.form.specData != null && !this.isAll) {
uni.showToast({
title: '请选择规格',
icon: 'none',
duration: 2000
});
return;
}
this.createdOrder();
},
/*初始化*/
initShowSku() {
this.form.show_sku.sku_image = this.form.detail.product.image[0].file_path;
this.form.show_sku.bargain_price = this.form.detail.bargain_price;
this.form.show_sku.product_sku_id = 0;
this.form.show_sku.line_price = this.form.detail.line_price;
this.form.show_sku.bargain_stock = this.form.detail.stock;
this.form.show_sku.bargain_product_sku_id = this.form.detail.bargainSku[0].bargain_product_sku_id;
this.form.show_sku.sum = 1;
this.stock = this.form.detail.stock;
},
/*选择属性*/
selectAttr(attr_index, item_index) {
let self = this;
let items = self.form.specData.spec_attr[attr_index].spec_items;
let curItem = items[item_index];
if (curItem.checked) {
curItem.checked = false;
self.form.productSpecArr[attr_index] = null;
} else {
for (let i = 0; i < items.length; i++) {
items[i].checked = false;
}
curItem.checked = true;
self.form.productSpecArr[attr_index] = curItem.item_id;
}
/*判断哪些规格可以选*/
judgeSelect(self.form.specData.spec_attr, attr_index, self.form.productSpecArr, self.form.productSku);
let isall = true;
for (let i = 0; i < self.form.productSpecArr.length; i++) {
let item = self.form.productSpecArr[i];
if (item == null) {
isall = false;
self.initShowSku();
return;
}
}
if (!isall) {
self.initShowSku();
return;
}
// 更新商品规格信息
self.updateSpecProduct();
},
/*更新商品规格信息*/
updateSpecProduct() {
let self = this;
let specSkuId = self.form.productSpecArr.join('_');
// 查找skuItem
let spec_list = self.form.specData.spec_list,
skuItem = spec_list.find(val => {
return val.spec_sku_id == specSkuId;
});
// 记录product_sku_id
// 更新商品价格、划线价、库存
if (typeof skuItem === 'object') {
let point_sku_list = self.form.detail.bargainSku,
bargainSkuItem = point_sku_list.find(val => {
return val.product_sku_id == skuItem.product_sku_id;
});
/*保存当前规格*/
self.stock = bargainSkuItem.bargain_stock;
if (self.form.show_sku.sum > self.stock) {
self.form.show_sku.sum = self.stock > 0 ? self.stock : 1;
}
self.form.show_sku.product_sku_id = skuItem.spec_sku_id;
self.form.show_sku.bargain_price = bargainSkuItem.bargain_price;
self.form.show_sku.line_price = skuItem.spec_form.product_price;
self.form.show_sku.bargain_stock = bargainSkuItem.bargain_stock;
self.form.show_sku.bargain_product_sku_id = bargainSkuItem.bargain_product_sku_id;
if (skuItem.spec_form.image_id > 0) {
self.form.show_sku.sku_image = skuItem.spec_form.image_path;
} else {
self.form.show_sku.sku_image = self.form.detail.product.image[0].file_path;
}
}
},
/*创建订单*/
createdOrder() {
let self = this;
let bargain_activity_id = self.form.detail.bargain_activity_id;
let bargain_product_id = self.form.detail.bargain_product_id;
let bargain_product_sku_id = self.form.show_sku.bargain_product_sku_id;
let product_sku_id = self.form.show_sku.product_sku_id;
let product_id = self.form.detail.product_id;
self._get(
'plus.bargain.task/add', {
bargain_activity_id: bargain_activity_id,
bargain_product_id: bargain_product_id,
bargain_product_sku_id: bargain_product_sku_id,
product_sku_id: product_sku_id
},
function(res) {
self.$emit('confirm')
let bargain_task_id = res.data.bargain_task_id;
self.gotoPage('/pages/plus/bargain/haggle/haggle?bargain_task_id=' + bargain_task_id + '&order_type=bargain');
}
);
},
/*商品增加*/
add() {
if (this.stock <= 0) {
return;
}
if (this.form.show_sku.sum >= this.stock) {
uni.showToast({
title: '数量超过了库存',
icon: 'none',
duration: 2000
});
return false;
}
if (this.form.show_sku.sum >= this.form.detail.limit_num) {
uni.showToast({
title: '数量超过了限购数量',
icon: 'none',
duration: 2000
});
return false;
}
this.form.show_sku.sum++;
},
/*商品减少*/
sub() {
if (this.stock <= 0) {
return;
}
if (this.form.show_sku.sum < 2) {
uni.showToast({
title: '商品数量至少为1',
icon: 'none',
duration: 2000
});
return false;
}
this.form.show_sku.sum--;
}
}
};
</script>
<style lang="scss">
.product-popup {}
.product-popup .popup-bg {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: rgba(0, 0, 0, .6);
z-index: 99;
}
.product-popup .main {
position: fixed;
width: 100%;
bottom: 0;
min-height: 200rpx;
// max-height: 900rpx;
background-color: #fff;
transform: translate3d(0, 980rpx, 0);
transition: transform .2s cubic-bezier(0, 0, .25, 1);
border-radius: 12rpx;
// bottom: env(safe-area-inset-bottom);
}
.product-popup.open .main {
transform: translate3d(0, 0, 0);
z-index: 99;
}
.product-popup.close .popup-bg {
display: none;
}
.product-popup.close .main {
display: none;
z-index: -1;
}
.product-popup .header {
min-height: 120rpx;
padding: 40rpx 0 40rpx 250rpx;
position: relative;
border-bottom: 1px solid #eeeeee;
}
.product-popup .header .avt {
position: absolute;
top: 40rpx;
left: 30rpx;
width: 200rpx;
height: 200rpx;
border: 2px solid #ffffff;
background: #ffffff;
border-radius: 12rpx;
}
.product-popup .header .stock {
font-size: 26rpx;
color: #999999;
}
.product-popup .close-btn {
position: absolute;
width: 40rpx;
height: 40rpx;
top: 40rpx;
right: 30rpx;
}
.product-popup .price {
height: 80rpx;
color: $dominant-color;
font-size: 30rpx;
}
.product-popup .price .num {
padding: 0 4rpx;
font-size: 50rpx;
}
.product-popup .old-price {
margin-left: 10rpx;
font-size: 30rpx;
color: #999999;
text-decoration: line-through;
}
.product-popup .body {
padding: 20rpx 30rpx 39rpx 30rpx;
// max-height: 600rpx;
overflow-y: auto;
padding-bottom: 88rpx;
}
.product-popup .level-box {
display: flex;
justify-content: space-between;
align-items: center;
}
.product-popup .level-box .key {
font-size: 24rpx;
color: #999999;
}
.product-popup .level-box .icon-box {
width: 48rpx;
height: 40rpx;
background: #e0e0e0;
}
.product-popup .num-wrap .iconfont {
color: #666;
}
.product-popup .num-wrap.no-stock .iconfont {
color: #cccccc;
}
.product-popup .level-box .text-wrap {
margin: 0 4rpx;
height: 60rpx;
border: none;
background: #ffffff;
}
.product-popup .level-box .text-wrap input {
padding: 0 10rpx;
height: 60rpx;
line-height: 60rpx;
width: 80rpx;
text-align: center;
font-size: 32rpx;
}
.specs .specs-list {
display: flex;
justify-content: flex-start;
align-items: center;
flex-wrap: wrap;
}
.specs .specs-list button {
margin-right: 10rpx;
margin-bottom: 10rpx;
font-size: 24rpx;
}
.specs .specs-list button:after,
.product-popup .btns button,
.product-popup .btns button:after {
border: 0;
border-radius: 0;
margin-bottom: 55rpx;
}
.product-popup .btns .confirm-btn {
width: 710rpx;
height: 80rpx;
background: linear-gradient(90deg, #FF6B6B 4%, #F6220C 100%);
border-radius: 40rpx;
margin: 0 auto;
margin-bottom: 55rpx;
background-color: #FFFFFF;
color: #FFFFFF;
line-height: 80rpx;
font-size: 32rpx;
}
.select_spec {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.btn-checked {
border: 1px solid #F6220C;
border-radius: 6px;
color: #F6220C;
font-size: 26rpx;
background-color: #FFFFFF;
}
.btn-checke {
border: 1rpx solid #D9D9D9;
border-radius: 6rpx;
font-size: 26rpx;
color: #333333;
background-color: #FFFFFF;
}
</style>

View File

@ -0,0 +1,589 @@
<template>
<view class="haggle" v-if="!loadding">
<image class="bg_topimg" src="/static/haggle.png" mode=""></image>
<!-- #ifdef MP-WEIXIN || APP-PLUS -->
<view class="ww100" :style="'height:'+topBarTop()+'px;'"></view>
<view class="tc head_top" :style="topBarHeight() == 0 ? '': 'height:'+topBarHeight()+'px;'">
<view class="reg180" @click="goback"><text class="icon iconfont icon-jiantou"></text></view>
<view class="fb">砍价购</view>
</view>
<!-- #endif -->
<!--活动剩余时间-->
<view class="ad-datetime p-40-0 d-c-c" v-if="task.status==0">
<countdown ref="countdown" :config="countdownConfig"></countdown>
</view>
<view class="haggle-content">
<view class="goto-home d-c-c" @click="gotoHome"><text class="iconfont icon-Homehomepagemenu"></text></view>
<view class="rule" @click="openRule">活动规则 <text class="icon iconfont icon-jiantou" style="color: #333333;font-size: 26rpx;"></text></view>
<!--用户信息-->
<view class="user d-c-c d-c">
<image :src="task.user.avatarUrl" mode=""></image>
<text class="gray3 mt20 mb30 f26">{{ task.user.nickName }}</text>
</view>
<!-- <view class="tip p-20-0 d-c-c f30">“拿好物好朋友帮,快去邀请吧”</view> -->
<!--商品信息-->
<view class="product o-h d-b-s p-20-0 pb60" v-if="product">
<view class="pic">
<image :src="product.product.image[0].file_path" mode=""></image>
</view>
<view class="info flex-1 ml30">
<view class="text-ellipsis-2 f26 gray3" style="width: 360rpx;">{{ task.product_name }}</view>
<view class="pt10">
<text class="gray9">规格:</text>
<text>{{ task.product_attr }}</text>
</view>
<view class="" style="margin: 20rpx 0; margin-bottom: 16rpx;">
<text class="gray9 f26">剩余:</text>
<text class="gray9 f26">{{ product.stock }}件</text>
</view>
<view class="d-s-c p-10-0">
<view class="d-c-c">
<view class="gray9 haggle_btn_l">砍到底价</view>
<view class="haggle_btn_r"><text class="f20">¥</text>{{ task.bargain_price }}</view>
</view>
</view>
</view>
</view>
<!--砍价进度-->
<view class="f26 ww100 tc">已砍<text style="color: #723BFF;">{{ task.cut_money }}</text>元,继续加油</view>
<view class="progress pr">
<view class="progress-box">
<view class="progress-box-active" :style="'width:' + task.bargain_rate + '%;'"></view>
</view>
<view class="progressState" :style="'left:' + task.bargain_rate + '%;'">{{ task.bargain_rate + '%' }}</view>
</view>
<view class="d-b-c gray9" style="width: 80%; margin: 0 auto;margin-top: 20rpx;">
<text>¥{{ task.product_price }}</text>
<text class="f30 haggle-color fb">¥{{ task.bargain_price }}</text>
</view>
<!--按钮-->
<view class="btns mt30" v-if="task.status == 0||task.status == 1">
<template v-if="is_bargain">
<button type="primary" :disabled="submitting" @click="bargainFunc">
{{is_creater?'我要砍价':'帮好友砍一刀'}}
</button>
</template>
<template v-if="!is_bargain && task.is_floor != 1 && task.is_buy!=1">
<button type="primary" open-type="share" @click="shareFunc">邀请好友帮忙砍价</button>
</template>
<template v-if="is_creater === true && active != null">
<button type="primary" v-if="is_buy && active.conditions == 0" class="mt20" @click="buyNow">
<template v-if="task.is_floor == 0">当前价购买</template>
<template v-if="task.is_floor == 1">砍价成功 立即购买</template>
</button>
<button type="primary" v-if="is_buy && active.conditions == 1" class="mt20" @click="buyNow">砍价成功 立即购买</button>
<view class="mt20 f34 haggle-color tc" v-if="task.is_buy==1">砍价成功,已购买</view>
</template>
<template v-if="is_creater == false">
<button type="primary" class="buy-btn mt20" @click="involvedFunc">我要参与</button>
</template>
</view>
<!--砍价历史-->
<view class="help-list mt30">
<view class="p-30-0 border-b fb f30">砍价记录</view>
<view class="d-b-c p-20-0 border-b-e" v-for="(item, index) in help_list" :key="index">
<view class="user d-s-c">
<image :src="item.user.avatarUrl" mode="aspectFill"></image>
<text class="ml20">{{ item.user.nickName }}</text>
</view>
<view class="haggle-color" :class="{ fb: item.is_creater == 0 }">-{{ item.cut_money }}</view>
</view>
</view>
</view>
<!--规则-->
<Rule :isRule="isRule" :setting="setting" @close="closeRule"></Rule>
<!--分享-->
<share :isMpShare="isMpShare" @close="closeShare"></share>
<!--app分享-->
<AppShare :isAppShare="isAppShare" :appParams="appParams" @close="closeAppShare"></AppShare>
<!--弹出框-->
<Popup :show="isPopup" :width="400" :height="300" :padding="0" @hidePopup="hidePopupFunc">
<view class="d-c-c d-c ww100 p-30-0">
<text>本次砍掉</text>
<view class="pt10">
<text class="fb f34 haggle-color">{{ my_cut_money }}</text>
</view>
<view class="pt30"><button type="primary" class="btn-gray" @click="hidePopupFunc">关闭</button></view>
</view>
</Popup>
</view>
</template>
<script>
import Popup from '@/components/uni-popup.vue';
import countdown from '@/components/countdown/countdown.vue';
import Rule from './popup/Rule.vue';
import share from '@/components/mp-share.vue';
import AppShare from '@/components/app-share.vue';
export default {
components: {
Popup,
Rule,
countdown,
share,
AppShare
},
data() {
return {
/*是否加载完成*/
loadding: true,
/*砍价任务ID*/
bargain_task_id: 0,
/*是否显示规则*/
isRule: false,
/*倒计时配置*/
countdownConfig: {
/*开始时间*/
startstamp: 0,
/*结束时间*/
endstamp: 0,
// /*显示类别*/
// type: 'text',
/*文字*/
title: '活动剩余:'
},
/*任务对象*/
task: {},
/*商品对象*/
product: {},
/*活动*/
active: {},
/*活动设置*/
setting: {},
/*砍价历史*/
help_list: [],
/*是否分享*/
isMpShare: false,
/*是否是自己的*/
is_creater: false,
/*是否已经砍过*/
is_cut: false,
/*是否正在提交*/
submitting: false,
/*是否显示弹出框*/
isPopup: false,
/*我的砍价*/
my_cut_money: 0,
/*app分享*/
isAppShare: false,
appParams: {
title: '',
summary: '',
path: ''
}
};
},
onLoad(e) {
this.bargain_task_id = e.bargain_task_id;
//#ifdef H5
if (this.isWeixin()) {
this.url = window.location.href;
}
//#endif
},
mounted() {
},
onShow() {
this.submitting = false;
/*获取产品详情*/
this.getData();
},
computed: {
/*是否允许砍价*/
is_bargain: function() {
if (this.is_cut == false) {
return true;
} else {
return false;
}
},
/*是否允许购买、砍价过程中可购买或者砍到底价,并且砍价成功可购买*/
is_buy: function() {
if (this.active.conditions === 0 && this.task.is_buy != 1) {
console.log('aaaaa');
return true;
} else if (this.active.conditions === 1 && this.task.is_floor == 1 && this.task.is_buy != 1) {
console.log('bbbbbb');
return true;
} else {
return false;
}
}
},
methods: {
/*获取数据*/
getData() {
let self = this;
self.loading = true;
uni.showLoading({
title: '加载中'
});
self._get(
'plus.bargain.task/detail', {
bargain_task_id: self.bargain_task_id,
url: self.url
},
function(res) {
if (res.data.active != null) {
self.countdownConfig.startstamp = res.data.active.start_time;
}
self.countdownConfig.endstamp = res.data.task.end_time;
self.is_creater = res.data.is_creater;
self.is_cut = res.data.is_cut;
self.task = res.data.task;
self.active = res.data.active;
self.product = res.data.product;
self.setting = res.data.setting;
self.help_list = res.data.help_list;
// 配置微信分享参数
//#ifdef H5
if (self.url != '') {
let params = {
bargain_task_id: self.bargain_task_id
};
self.configWx(res.data.share.signPackage, res.data.share.shareParams, params);
}
//#endif
self.loadding = false;
uni.hideLoading();
}
);
},
/*我要砍价*/
bargainFunc() {
console.log(1111);
let self = this;
self.submitting = true;
self._post(
'plus.bargain.task/cut', {
bargain_task_id: self.bargain_task_id
},
function(res) {
self.my_cut_money = res.data.cut_money;
self.isPopup = true;
}
);
},
/*关闭弹出框*/
hidePopupFunc() {
this.isPopup = false;
this.getData();
this.submitting = false;
},
/*确认提交*/
buyNow() {
this.createdOrder();
},
/*规则*/
openRule() {
this.isRule = true;
},
/*关闭规则*/
closeRule() {
this.isRule = false;
},
/*跳转首页*/
gotoHome() {
this.gotoPage('/pages/index/index')
},
/*创建订单*/
createdOrder() {
let self = this;
let bargain_product_id = self.product.bargain_product_id;
let product_sku_id = self.task.product_sku_id;
let bargain_product_sku_id = self.task.bargain_product_sku_id;
self.gotoPage('/pages/order/confirm-order?bargain_product_id=' +
bargain_product_id +
'&product_sku_id=' +
product_sku_id +
'&bargain_product_sku_id=' +
bargain_product_sku_id +
'&order_type=bargain' +
'&bargain_task_id=' +
self.bargain_task_id);
},
goback() {
uni.navigateBack({
})
},
/*分享*/
shareFunc() {
let self = this;
//#ifndef APP-PLUS
this.isMpShare = true;
//#endif
//#ifdef APP-PLUS
self.appParams.title = '发现了一个好物,快来帮我砍一刀吧';
self.appParams.summary = self.product.product.product_name;
// 构建页面参数
let params = self.getShareUrlParams({
bargain_task_id: self.bargain_task_id
});
self.appParams.path = '/pages/plus/bargain/haggle/haggle?' + params;
self.appParams.image = self.product.product.image[0].file_path;
self.isAppShare = true;
//#endif
},
closeShare(){
this.isMpShare = false;
},
//关闭分享
closeAppShare(data) {
this.isAppShare = false;
},
/*我要参与*/
involvedFunc() {
let url = 'pages/plus/bargain/detail/detail?bargain_product_id=' + this.product.bargain_product_id;
this.gotoPage(url);
},
/*小程序分享*/
onShareAppMessage() {
let self = this;
// 构建页面参数
let params = self.getShareUrlParams({
bargain_task_id: self.bargain_task_id
});
return {
title: '发现了一个好物,快来帮我砍一刀吧',
path: '/pages/plus/bargain/haggle/haggle?' + params
};
},
}
};
</script>
<style lang="scss">
.haggle {
min-height: 100vh;
box-sizing: border-box;
}
.reg180 {
padding-right: 20rpx;
text-align: right;
transform: rotateY(180deg);
position: absolute;
bottom: 0;
}
.icon-jiantou {
color: #FFFFFF;
font-size: 30rpx;
}
.head_top {
position: relative;
height: 30px;
line-height: 30px;
color: #FFFFFF;
font-size: 32rpx;
}
.bg_topimg {
position: fixed;
top: 0;
width: 100%;
height: 400rpx;
z-index: -1;
}
.haggle .goto-home {
position: absolute;
top: 10rpx;
left: 0;
width: 80rpx;
height: 80rpx;
line-height: 60rpx;
border-radius: 50%;
background: #ffffff;
z-index: 20;
}
.haggle .goto-home .iconfont {
color: #333333;
font-weight: bold;
font-size: 36rpx;
}
.haggle-content {
position: relative;
padding: 30rpx;
box-sizing: border-box;
border-radius: 16rpx;
background: #ffffff;
margin: 0 20rpx;
margin-top: 72rpx;
}
.haggle-content .rule {
position: absolute;
font-size: 26rpx;
color: #333333;
top: 30rpx;
right: 30rpx;
}
.haggle-content .user image {
width: 120rpx;
height: 120rpx;
border-radius: 50%;
border: 6rpx solid #ffffff;
margin-top: -100rpx;
}
.help-list .user image {
margin-top: 0;
}
.haggle-content .product {
background: #FFFFFF;
}
.haggle-content .product .pic,
.haggle-content .product .pic image {
width: 240rpx;
height: 240rpx;
border-radius: 12rpx;
}
.haggle-content .title-2 text::before,
.haggle-content .title-2 text::after {
display: block;
content: '';
position: absolute;
width: 100rpx;
height: 2rpx;
top: 50%;
background: #cccccc;
}
.haggle-content .title-2 text::before {
left: -120rpx;
}
.haggle-content .title-2 text::after {
right: -120rpx;
}
.haggle-content .progress {
padding-top: 80rpx;
margin: 20rpx auto 0;
width: 80%;
}
.haggle-content .progress-box {
height: 20rpx;
background: #ECE4FF;
border-radius: 10rpx;
overflow: hidden;
}
.haggle-content .progress-box-active {
height: 20rpx;
border-radius: 10rpx;
background: linear-gradient(90deg, #CEBBFF 0%, #723BFF 100%);
}
.haggle-content .progressState {
top: 0;
left: 0;
padding: 0 15rpx;
position: absolute;
width: 80rpx;
height: 40rpx;
transform: translateX(-80rpx);
line-height: 40rpx;
border-radius: 20rpx;
font-size: 26rpx;
text-align: center;
background: #ECE4FF;
color: #723BFF;
}
.haggle-content .progressState::after {
position: absolute;
left: 50%;
margin-left: -6rpx;
display: block;
content: '';
border: 12rpx solid transparent;
border-top-color: #ECE4FF;
}
.haggle-content .btns button {
height: 88rpx;
line-height: 88rpx;
border-radius: 44rpx;
background: #8D60FF;
color: #ffffff;
}
.haggle-content .btns button.buy-btn {
background: #F6AC0C;
}
.haggle-content .help-list .user image {
width: 60rpx;
height: 60rpx;
}
.haggle .ad-datetime::v-deep .countdown {
color: #FFFFFF;
font-size: 26rpx;
margin-top: 50rpx;
}
.haggle .ad-datetime::v-deep .box {
padding: 0 7rpx;
min-width: 50rpx;
font-size: 26rpx;
border-radius: 6rpx;
background: #FFFFFF;
color: #8207FF;
}
.haggle_btn_l {
width: 150rpx;
height: 50rpx;
line-height: 50rpx;
border: 1rpx solid #F6AC0C;
font-size: 26rpx;
color: #E09900;
border-radius: 25rpx 0px 0px 25rpx;
text-align: center;
}
.haggle_btn_r {
// width: 150rpx;
height: 50rpx;
padding-right: 10rpx;
line-height: 50rpx;
border: 1rpx solid #F6AC0C;
background: #F6AC0C;
border-radius: 0px 25rpx 25rpx 0px;
font-size: 32rpx;
color: #FFFFFF;
text-align: center;
}
.haggle-color {
color: #723BFF;
}
</style>

View File

@ -0,0 +1,101 @@
<template>
<view class="rule-detail-wrap" v-show="openRule">
<view class="rule-bg" @click="closeRule" :class="openRule ? 'active' : ''"></view>
<view class="rule-content" v-on:click.stop>
<view class="title pr">
<text class="">活动规则</text>
<text class="iconfont icon-guanbi" @click="closeRule"></text>
</view>
<view class="content" v-html="setting.bargain_rules"></view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
/*是否显示*/
openRule: false
};
},
props: ['isRule', 'setting'],
watch: {
isRule: function(n, o) {
if (n != o) {
this.openRule = n;
}
}
},
methods: {
/*关闭规则*/
closeRule() {
this.openRule = false;
this.$emit('close');
}
}
};
</script>
<style>
.rule-detail-wrap {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
width: 100%;
z-index: 999;
}
.rule-detail-wrap .rule-bg {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background-color: rgb(0, 0, 0);
opacity: 0;
transition: all 0.3s ease-out;
}
.rule-detail-wrap .rule-bg.active {
opacity: 0.8;
}
.rule-detail-wrap .rule-content {
position: absolute;
top: 20vh;
left: 0;
right: 0;
margin: auto;
width: 80%;
background-color: #fff;
border-radius: 12rpx;
transition: all 0.3s ease-out;
box-sizing: border-box;
white-space: pre-wrap;
}
.rule-detail-wrap .rule-content .title {
height: 100rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 32rpx;
position: relative;
color: #333;
box-sizing: border-box;
}
.rule-detail-wrap .rule-content .iconfont {
position: absolute;
right: 20rpx;
top: 20rpx;
font-size: 32rpx;
color: #999999;
}
.rule-detail-wrap .rule-content .content {
padding: 30rpx;
max-height: 60vh;
font-size: 28rpx;
line-height: 150%;
overflow-y: auto;
box-sizing: border-box;
}
</style>

View File

@ -0,0 +1,363 @@
<template>
<view class="bargain-container">
<view class="top-box">
<view class="inner-tab">
<scroll-view scroll-X="true" show-scrollbar="false" class="scroll-X">
<view class="tab-list">
<view
:class="bargain_activity_id == item.bargain_activity_id ? 'item active' : 'item'"
v-for="(item, index) in categorys"
:key="index"
@click="tabTypeFunc(index, item.bargain_activity_id)"
>
{{ item.title }}
</view>
</view>
</scroll-view>
</view>
<!--图片-->
<view class="banner-image d-c-c" v-if="listData.detail && categorys.length > 0"><image :src="listData.detail.file_path" mode="widthFix"></image></view>
<!--活动时间-->
<view class="ad-datetime p-30-0 d-c-c pb20" v-if="listData.detail && categorys.length > 0">
<Countdown ref="countdown" :config="countdownConfig" @returnVal="returnValFunc"></Countdown>
</view>
<view v-else class="p30 pt200 d-c-c d-c gray6 f26">
<image style="width: 532rpx;margin-bottom: 80rpx;" src="/static/active-null.png" mode="widthFix"></image>
<view class="tc gray9">暂无活动~~</view>
</view>
</view>
<!--内容-->
<view class="bargain-list" v-if="!loading">
<!--列表-->
<view class="list d-s-c f-w">
<view class="item d-s-s d-stretch" v-for="(item, index) in listData.list" :key="index">
<view class="product-cover pr"><image :src="item.product.file_path" mode="aspectFit"></image></view>
<view class="product-info d-b-c d-c">
<view class="product-title text-ellipsis-2 f26 gray3">{{ item.product.product_name }}</view>
<view class="people-num price">
<text class="f24"></text>
<text class="f36 fb">{{ item.bargain_price }}</text>
<text class="ml10 text-d-line gray9 f24">{{ item.product_price }}</text>
</view>
<view class="d-b-c ww100">
<view class="f24"></view>
<view class="right-btn"><button type="primary" @click="gotoDetail(item)">去砍价</button></view>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import Countdown from '@/components/countdown/countdown.vue';
export default {
components: {
Countdown
},
data() {
return {
/*手机高度*/
phoneHeight: 0,
/*可滚动视图区域高度*/
scrollviewHigh: 0,
/*活动类别*/
categorys: [],
/*当前活动Is*/
bargain_activity_id: 0,
/*商品列表*/
listData: {
list: [],
detail: null
},
/*倒计时配置*/
countdownConfig: {
/*开始时间*/
startstamp: 0,
/*结束时间*/
endstamp: 0
},
/*是否正在加载*/
loading: true
};
},
computed: {},
onLoad(e) {},
onShow() {
/*获取产品列表*/
this.getCategory();
},
onReachBottom() {},
methods: {
/*初始化*/
/*类别切换*/
tabTypeFunc(e, n) {
this.type_active = e;
this.bargain_activity_id = n;
this.productList = [];
this.getProdct();
},
/*获取数据*/
getCategory() {
let self = this;
let param = {};
let index = self.type_active;
self._get(
'plus.bargain.product/active',
{
param
},
function(res) {
self.categorys = res.data.list;
if (self.categorys.length > 0) {
self.bargain_activity_id = self.categorys[0].bargain_activity_id;
}
self.getProdct();
}
);
},
/*获取商品*/
getProdct() {
let self = this;
uni.showLoading({
title: '加载中'
});
let bargain_activity_id = self.bargain_activity_id;
self.loading = true;
self._get(
'plus.bargain.product/product',
{
bargain_activity_id: bargain_activity_id
},
function(res) {
self.listData = res.data;
self.countdownConfig.endstamp = res.data.detail.end_time;
self.countdownConfig.startstamp = res.data.detail.start_time;
uni.hideLoading();
self.loading = false;
}
);
},
/*跳转产品详情*/
gotoDetail(e) {
this.$refs.countdown.clear();
let url = 'pages/plus/bargain/detail/detail?bargain_product_id=' + e.bargain_product_id;
this.gotoPage(url);
},
/*跳转搜索页面*/
gotoSearch() {
this.page = 1;
this.getData();
},
/*倒计时返回值*/
returnValFunc(e) {
console.log(e);
}
}
};
</script>
<style lang="scss">
.top-box {
position: sticky;
top: 0;
left: 0;
background: #f2f2f2;
z-index: 10;
}
page {
background: #f2f2f2;
}
.bargain-container .inner-tab {
background: #ffffff;
}
.bargain-container .inner-tab .tab-list {
height: 100rpx;
display: flex;
justify-content: flex-start;
align-items: center;
background: #ffffff;
}
.bargain-container .inner-tab .item {
height: 100rpx;
line-height: 100rpx;
white-space: nowrap;
padding: 0 30rpx;
font-size: 30rpx;
color: #333333;
}
.bargain-container .inner-tab .item.active,
.bargain-container .inner-tab .item .arrow.active .iconfont {
background: #ffffff;
font-size: 32rpx;
color: #f6220c;
position: relative;
}
.bargain-container .inner-tab .item.active::after {
content: '';
width: 60%;
height: 4rpx;
background: #f6220c;
border-radius: 2rpx;
position: absolute;
bottom: 17rpx;
left: 0;
right: 0;
margin: auto;
}
.bargain-container .inner-tab .box {
display: flex;
justify-content: center;
align-items: center;
flex-direction: row;
}
.bargain-container .inner-tab .arrows {
margin-left: 10rpx;
line-height: 0;
}
.bargain-container .inner-tab .iconfont {
line-height: 24rpx;
font-size: 24rpx;
}
.bargain-container .inner-tab .arrow,
.bargain-container .inner-tab .svg-icon {
width: 20rpx;
height: 20rpx;
}
.bargain-container .banner-image {
width: 100%;
box-sizing: border-box;
}
.bargain-container .banner-image image {
width: 750rpx;
height: 365rpx;
}
.bargain-container .ad-datetime::v-deep text {
color: #333333;
font-size: 28rpx;
}
.bargain-container .ad-datetime::v-deep .box {
padding: 4rpx;
border-radius: 4rpx;
background: #f6220c;
color: #ffffff;
}
.bargain-list .list {
padding: 20rpx;
}
.bargain-list .list .item {
width: 100%;
padding: 30rpx;
margin-bottom: 20rpx;
box-sizing: border-box;
border-radius: 16rpx;
background: #ffffff;
}
.bargain-list .product-cover {
padding: 4rpx;
}
.bargain-list .product-cover image {
width: 200rpx;
height: 200rpx;
border-radius: 12rpx;
}
.bargain-list .product-info {
flex: 1;
padding-left: 20rpx;
overflow: hidden;
}
.bargain-list .product-cover .people-num {
position: absolute;
right: 0;
bottom: 0;
left: 0;
height: 50rpx;
padding: 0 20rpx;
line-height: 50rpx;
font-size: 24rpx;
box-sizing: border-box;
background: rgba(0, 0, 0, 0.6);
}
.bargain-list .ad-datetime .box {
padding: 4rpx;
border-radius: 4rpx;
background: #000000;
color: #ffffff;
}
.bargain-list .product-title {
width: 100%;
height: 40rpx;
line-height: 40rpx;
font-size: 26rpx;
color: #333333;
}
.bargain-list .people-num {
width: 100%;
}
.bargain-list .already-sale {
padding: 4rpx 0;
color: #999;
font-size: 24rpx;
}
.bargain-list .price {
width: 100%;
color: $dominant-color;
font-size: 24rpx;
}
.bargain-list .price .num {
padding: 0 4rpx;
}
.bargain-list .slider-box .slider {
margin-top: 10rpx;
height: 10rpx;
background: #cccccc;
border-radius: 5rpx;
}
.bargain-list .slider-box .slider-inner {
height: 10rpx;
background: $dominant-color;
border-radius: 5rpx;
}
.bargain-list .right-btn button {
height: 60rpx;
line-height: 60rpx;
border-radius: 30rpx;
background: #8d60ff;
color: #ffffff;
font-size: 32rpx;
}
</style>