first commit
This commit is contained in:
701
pages/plus/bargain/detail/detail.vue
Normal file
701
pages/plus/bargain/detail/detail.vue
Normal file
@ -0,0 +1,701 @@
|
||||
<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=""></image>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</view>
|
||||
<!--基本信息-->
|
||||
<view class="bg-white m20 p30 br12">
|
||||
<view class="price-wrap pr">
|
||||
<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 class="share-box">
|
||||
<button @click="showShare" open-type="share">
|
||||
<image class="share_img" src="/static/icon/fenxiang.png" mode=""></image>
|
||||
</button>
|
||||
</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="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-shouye 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 bg-white" open-type="contact" session-from="wxapp" show-message-card="true">
|
||||
<text class="icon iconfont icon-kefu gray3" style="height: 50rpx;line-height: 60rpx;"></text>
|
||||
<text class="f22 gray3" style="height: 50rpx;line-height: 40rpx;">客服</text>
|
||||
</button>
|
||||
</view>
|
||||
<!-- #endif -->
|
||||
<!-- #ifndef MP-WEIXIN -->
|
||||
<view class="icon-box" @click="openMaservice">
|
||||
<button class="d-c-c d-c bg-white">
|
||||
<text class="icon iconfont icon-kefu 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" :productModel="productModel" @close="closePopup"></spec>
|
||||
|
||||
<!--规则-->
|
||||
<Rule :isRule="isRule" :setting="setting" @close="closeRule"></Rule>
|
||||
<!--底部弹窗-->
|
||||
<share :isMpShare="isMpShare" @close="closeBottmpanel"></share>
|
||||
<!--app分享-->
|
||||
<AppShare :isAppShare="isAppShare" :appParams="appParams" @close="closeAppShare"></AppShare>
|
||||
<!--客服-->
|
||||
<Mpservice v-if="isMpservice" :isMpservice="isMpservice" @close="closeMpservice"></Mpservice>
|
||||
</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 share from '@/components/mp-share.vue';
|
||||
import AppShare from '@/components/app-share.vue';
|
||||
export default {
|
||||
components: {
|
||||
Spec,
|
||||
Rule,
|
||||
countdown,
|
||||
Mpservice,
|
||||
share,
|
||||
AppShare
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
/*手机高度*/
|
||||
phoneHeight: 0,
|
||||
/*可滚动视图区域高度*/
|
||||
scrollviewHigh: 0,
|
||||
/*是否加载完成*/
|
||||
loadding: true,
|
||||
/*是否显示面板指示点*/
|
||||
indicatorDots: true,
|
||||
/*是否知道切换*/
|
||||
autoplay: true,
|
||||
/*自动切换时间间隔*/
|
||||
interval: 2000,
|
||||
/*滑动动画时长*/
|
||||
duration: 500,
|
||||
/*倒计时配置*/
|
||||
countdownConfig: {
|
||||
/*开始时间*/
|
||||
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: {}
|
||||
},
|
||||
/*活动设置*/
|
||||
setting: {},
|
||||
/*是否确定购买弹窗*/
|
||||
isPopup: false,
|
||||
/*商品属性*/
|
||||
specData: null,
|
||||
/*子级页面传参*/
|
||||
productModel: {},
|
||||
/*规格数组*/
|
||||
productSpecArr: [],
|
||||
/*是否显示规则*/
|
||||
isRule: false,
|
||||
/*商品规格*/
|
||||
productSku: [],
|
||||
/*是否打开客服*/
|
||||
isMpservice: false,
|
||||
/*分享*/
|
||||
isMpShare: false,
|
||||
/*app分享*/
|
||||
isAppShare: false,
|
||||
appParams: {
|
||||
title: '',
|
||||
summary: '',
|
||||
path: ''
|
||||
},
|
||||
url: '',
|
||||
};
|
||||
},
|
||||
onLoad(e) {
|
||||
uni.showLoading({
|
||||
title: '加载中'
|
||||
});
|
||||
this.type_active = 0;
|
||||
/*分类id*/
|
||||
this.bargain_product_id = e.bargain_product_id;
|
||||
//#ifdef H5
|
||||
this.url = window.location.href;
|
||||
//#endif
|
||||
},
|
||||
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: self.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);
|
||||
}
|
||||
|
||||
self.setting = res.data.setting;
|
||||
self.detail = res.data.detail;
|
||||
// 配置微信分享参数
|
||||
//#ifdef H5
|
||||
if (self.url != '') {
|
||||
let params = {
|
||||
bargain_product_id: self.bargain_product_id
|
||||
};
|
||||
self.configWx(res.data.share.signPackage, res.data.share.shareParams, params);
|
||||
}
|
||||
//#endif
|
||||
self.loadding = false;
|
||||
uni.hideLoading();
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
/*多规格商品*/
|
||||
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;
|
||||
},
|
||||
|
||||
/*判断有没有规格*/
|
||||
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() {
|
||||
this.isPopup = false;
|
||||
},
|
||||
|
||||
/*打开客服*/
|
||||
openMaservice() {
|
||||
this.isMpservice = true;
|
||||
},
|
||||
|
||||
/*关闭客服*/
|
||||
closeMpservice() {
|
||||
this.isMpservice = false;
|
||||
},
|
||||
|
||||
/*跳转商品详情页面*/
|
||||
gotoProducntDetail() {
|
||||
let url = '/pages/product/detail/detail?product_id=' + this.detail.product_id;
|
||||
this.gotoPage(url);
|
||||
},
|
||||
|
||||
/*规则*/
|
||||
openRule() {
|
||||
this.isRule = true;
|
||||
},
|
||||
|
||||
/*关闭规则*/
|
||||
closeRule() {
|
||||
this.isRule = false;
|
||||
},
|
||||
|
||||
/*倒计时返回*/
|
||||
returnValFunc() {},
|
||||
/*分享*/
|
||||
onShareAppMessage() {
|
||||
let self = this;
|
||||
// 构建页面参数
|
||||
let params = self.getShareUrlParams({
|
||||
bargain_product_id: self.bargain_product_id
|
||||
});
|
||||
return {
|
||||
title: self.detail.product.product_name,
|
||||
path: '/pages/plus/bargain/detail/detail?' + params
|
||||
};
|
||||
},
|
||||
//分享按钮
|
||||
showShare() {
|
||||
let self = this;
|
||||
//#ifdef MP-WEIXIN
|
||||
return;
|
||||
//#endif
|
||||
//#ifndef APP-PLUS
|
||||
self.isMpShare = true;
|
||||
//#endif
|
||||
//#ifdef APP-PLUS
|
||||
self.appParams.title = self.detail.product.product_name;
|
||||
self.appParams.summary = self.detail.product.product_name;
|
||||
// 构建页面参数
|
||||
let params = self.getShareUrlParams({
|
||||
bargain_product_id: self.bargain_product_id
|
||||
});
|
||||
self.appParams.path = '/pages/plus/bargain/detail/detail?' + params;
|
||||
self.appParams.image = self.detail.product.image[0].file_path;
|
||||
self.isAppShare = true;
|
||||
//#endif
|
||||
},
|
||||
//关闭分享
|
||||
closeBottmpanel(data) {
|
||||
this.isMpShare = false;
|
||||
},
|
||||
//关闭分享
|
||||
closeAppShare(data) {
|
||||
this.isAppShare = false;
|
||||
},
|
||||
}
|
||||
};
|
||||
</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;
|
||||
}
|
||||
|
||||
.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: absolute;
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
right: 0;
|
||||
bottom: -16rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.share-box button {
|
||||
padding: 0;
|
||||
background: 0;
|
||||
line-height: 60rpx;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.share-box .iconfont {
|
||||
margin-bottom: 10rpx;
|
||||
font-size: 50rpx;
|
||||
color: #ffffff;
|
||||
}
|
||||
.share_img {
|
||||
width: 30rpx;
|
||||
height: 30rpx;
|
||||
margin: 0 auto;
|
||||
margin-bottom: 4rpx;
|
||||
}
|
||||
|
||||
.share_text {
|
||||
line-height: 34rpx;
|
||||
}
|
||||
.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 {
|
||||
margin-top: 20rpx;
|
||||
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>
|
||||
96
pages/plus/bargain/detail/popup/Rule.vue
Normal file
96
pages/plus/bargain/detail/popup/Rule.vue
Normal file
@ -0,0 +1,96 @@
|
||||
<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">{{ 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;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
background-color: #fff;
|
||||
border-top-left-radius: 20rpx;
|
||||
border-top-right-radius: 20rpx;
|
||||
transition: all 0.3s ease-out;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.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;
|
||||
}
|
||||
.rule-detail-wrap .rule-content .content {
|
||||
padding: 30rpx;
|
||||
max-height: 600rpx;
|
||||
font-size: 28rpx;
|
||||
line-height: 150%;
|
||||
overflow-y: auto;
|
||||
}
|
||||
</style>
|
||||
527
pages/plus/bargain/detail/popup/Spec.vue
Normal file
527
pages/plus/bargain/detail/popup/Spec.vue
Normal file
@ -0,0 +1,527 @@
|
||||
<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" v-if="!clock" @click="confirmFunc(form)">确认</button>
|
||||
<button class="confirm-btn" v-else>暂无库存</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.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,
|
||||
clock: false
|
||||
}
|
||||
},
|
||||
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;
|
||||
console.log(self.form.specData);
|
||||
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 (!skuItem) {
|
||||
self.clock = true;
|
||||
return;
|
||||
} else {
|
||||
self.clock = false;
|
||||
}
|
||||
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;
|
||||
let url = '/pages/plus/bargain/haggle/haggle?bargain_task_id=' + bargain_task_id + '&order_type=bargain';
|
||||
self.gotoPage(url);
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
/*商品增加*/
|
||||
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, 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 0.2s cubic-bezier(0, 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>
|
||||
Reference in New Issue
Block a user