forked from angelo/web-retail-h5
644 lines
15 KiB
Vue
644 lines
15 KiB
Vue
<!--
|
|
* @Descripttion:
|
|
* @version:
|
|
* @Author: 王三华
|
|
* @Date: 2023-06-02 15:08:25
|
|
-->
|
|
<!--
|
|
* @Descripttion:
|
|
* @version:
|
|
* @Author: 王三华
|
|
* @Date: 2023-05-26 09:39:11
|
|
-->
|
|
<template>
|
|
<view class="content1">
|
|
<backIcon></backIcon>
|
|
<!-- 轮播图 -->
|
|
<u-swiper :list="imgUrlList"
|
|
height="266"
|
|
circular
|
|
:autoplay="false"
|
|
indicator
|
|
indicatorMode="dot"></u-swiper>
|
|
<view class="contxt">
|
|
<view class="kuang">
|
|
<view class="disFlex">
|
|
<view class="t_red">{{ goodDetail.waresPrice | numberToCurrency | isLocal }}</view>
|
|
<view class="t_hui">{{ goodDetail.waresAchieve | numberToCurrency | isLocal }}</view>
|
|
</view>
|
|
<view class="disFlex">
|
|
<view class="bao"
|
|
v-if="goodDetail.prefixLabelTarget">[{{ goodDetail.prefixLabelTarget.label }}]
|
|
</view>
|
|
<view class="t_hei">{{ goodDetail.waresName }}</view>
|
|
</view>
|
|
</view>
|
|
<view class="kuang t_hei">
|
|
{{ $t('w_0258') }}
|
|
</view>
|
|
<view class="kuang">
|
|
<view class="heng"
|
|
@tap="selSku = true">
|
|
<view class="disFlex">
|
|
<view class="label">{{ $t('w_0107') }}</view>
|
|
<view class="label1">{{ $t('w_0119') }}: {{ skuString }}</view>
|
|
</view>
|
|
<u-icon name="arrow-right"></u-icon>
|
|
</view>
|
|
<view class="heng">
|
|
<view class="disFlex">
|
|
<view class="label">{{ $t('w_0122') }}</view>
|
|
<view class="label1"
|
|
v-for="item in goodDetail.ensureLabelList"
|
|
:key="item.pkId">{{ item.label }}</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="bTit">
|
|
<view>{{ $t('w_0115') }}</view>
|
|
<view class="btm"></view>
|
|
</view>
|
|
<u-parse :content="goodDetail.details"></u-parse>
|
|
</view>
|
|
|
|
<!-- 占空 -->
|
|
<view style="height:150rpx"></view>
|
|
<!-- 底部 -->
|
|
<view class="footer_f">
|
|
<view class="footer">
|
|
<view class="footer_l">
|
|
<view class="footer_li footer_ll"
|
|
@click="toIndex"
|
|
v-if="user.registerShare!=0">
|
|
<u-icon size="18"
|
|
name="home"></u-icon>
|
|
<view>{{ $t('ENU_MENU_10') }}</view>
|
|
</view>
|
|
<view class="footer_li footer_ll">
|
|
<u-icon size="18"
|
|
name="server-fill"></u-icon>
|
|
<view @click="openKf">{{ $t('w_0259') }}</view>
|
|
</view>
|
|
<view class="footer_li footer_ll"
|
|
|
|
@click="toCart">
|
|
<u-icon size="20"
|
|
name="shopping-cart"></u-icon>
|
|
<view class="qiu">{{ shopCarLength }}</view>
|
|
<view>{{ $t('N_I_194') }}</view>
|
|
</view>
|
|
</view>
|
|
<view class="footer_r">
|
|
<!-- <u-button type="success"
|
|
class="uBtn"
|
|
@tap="goBuy"
|
|
shape="circle"
|
|
color="linear-gradient(to right, #fb3024, #fb3024 )">{{$t('w_0163')}} </u-button> -->
|
|
<view class="btn1"
|
|
@click="toAddCar()">{{ $t('N_I_192') }}</view>
|
|
<!-- <view class="btn2">{{$t('w_0163')}}</view> -->
|
|
</view>
|
|
<!-- <view class="footer_r"
|
|
v-if="user.registerShare!=0">
|
|
<view class="btn1"
|
|
@click="toAddCar">{{ $t('N_I_192') }}</view>
|
|
|
|
</view> -->
|
|
</view>
|
|
</view>
|
|
<!-- 选择规格 -->
|
|
<u-popup :show="selSku"
|
|
mode="bottom"
|
|
closeable
|
|
@close="close">
|
|
<view class="pop_a">
|
|
<view class="pop_tt">
|
|
<view class="pop_t">
|
|
<img :src="imgUrlList[0]"
|
|
alt="">
|
|
<view>{{ goodDetail.waresPrice | numberToCurrency | isLocal }}</view>
|
|
</view>
|
|
</view>
|
|
<view class="zhan"></view>
|
|
<view class="pop">
|
|
<view class="ggTit">{{ $t('w_0107') }}</view>
|
|
<view v-for="item,index in goodDetail.waresSkuList"
|
|
:key="item.pkId"
|
|
class="pop_c" @click="selCheck(item,index)">
|
|
<view :class="['pop_cl',hasChecked==item.pkId?'gui_a':'']">
|
|
<img :src="item.image"
|
|
alt="">
|
|
<view class="gui_iit">{{ item.specValueNames}}</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="zhan1"></view>
|
|
<view class="pop_b">
|
|
<view class="pop_bb">
|
|
<u-button type="success"
|
|
class="uBtn"
|
|
shape="circle"
|
|
color="linear-gradient(to right, #fb3024, #fb3024 )"
|
|
@click="close">{{ $t('MY_WAL_23') }}</u-button>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</u-popup>
|
|
<u-popup :show="downShow" mode="bottom" closeOnClickOverlay closeable
|
|
round="10" @close="close1">
|
|
<view class="title">{{ $t('N_I_194') }}</view>
|
|
<cartBtmList ref='cartBtmList'></cartBtmList>
|
|
</u-popup>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import backIcon from '@/components/backIcon.vue'
|
|
import * as api from '@/config/goods'
|
|
import { mapGetters } from 'vuex'
|
|
import cartBtmList from '@/components/cartBtmList.vue'
|
|
|
|
export default {
|
|
components: {
|
|
backIcon,
|
|
cartBtmList,
|
|
|
|
},
|
|
data() {
|
|
return {
|
|
downShow:false,
|
|
waresCode: '',
|
|
specialArea: '',
|
|
goodDetail: '',
|
|
imgUrlList: [],
|
|
selSku: false,
|
|
skuString: '',
|
|
hasChecked: '',
|
|
}
|
|
},
|
|
computed: {
|
|
...mapGetters(['user', 'shopCarLength']),
|
|
},
|
|
onLoad(options) {
|
|
// this.waresCode = options.waresCode
|
|
// this.specialArea = options.specialArea
|
|
this.specialArea = this.$route.query.specialArea
|
|
this.pkId = this.$route.query.pkId
|
|
this.source = this.$route.query.source
|
|
this.getDetails()
|
|
},
|
|
methods: {
|
|
selCheck(item,index){
|
|
this.hasChecked = item.pkId
|
|
this.$set(this.goodDetail,'waresPrice',this.goodDetail.waresSkuList[index].price)
|
|
this.$set(this.goodDetail,'waresAchieve',this.goodDetail.waresSkuList[index].achieve)
|
|
this.ggString()
|
|
},
|
|
openKf() {
|
|
let userInfo = uni.getStorageSync('User')
|
|
let src =
|
|
'https://im1c5366d.7x24cc.com/phone_webChat.html?accountId=N000000033467&chatId=302384fb-eda1-436e-a5e9-c03a2dbd6e97&visitorId=' +
|
|
userInfo.memberCode +
|
|
'&nickName=' +
|
|
userInfo.memberCode
|
|
window.open(src, '_blank')
|
|
},
|
|
toCart() {
|
|
this.downShow = true
|
|
this.$nextTick(()=>{
|
|
this.$refs.cartBtmList.getCarList(this.specialArea)
|
|
})
|
|
// uni.switchTab({ url: '/pages/shoppingCar/index' })
|
|
},
|
|
toAddCar() {
|
|
let obj = {
|
|
specialArea: 21,
|
|
number: 1,
|
|
pkId: this.pkId, // 海粉商品ID
|
|
source: 0, // 海粉商品渠道ID
|
|
productGroup: [],
|
|
}
|
|
this.goodDetail.waresSkuList.forEach((item) => {
|
|
if (item.pkId == this.hasChecked) {
|
|
obj.productGroup.push(item.productGroup[0])
|
|
}
|
|
})
|
|
api.addShopping(obj).then((res) => {
|
|
if(res.code == 200) {
|
|
uni.showToast({
|
|
title: this.$t('w_0036') ,
|
|
icon: 'none',
|
|
duration: 1500,
|
|
})
|
|
this.$store.dispatch('getCarLength')
|
|
}
|
|
})
|
|
},
|
|
toIndex() {
|
|
uni.switchTab({ url: '/pages/index/index' })
|
|
},
|
|
close() {
|
|
this.selSku = false
|
|
},
|
|
close1(){
|
|
this.downShow =false
|
|
},
|
|
goBuy() {
|
|
let data = {
|
|
quantity: 1,
|
|
pkId: this.pkId,
|
|
source: 0, // 海粉商品渠道ID
|
|
waresSkuList: [],
|
|
}
|
|
this.goodDetail.waresSkuList.forEach((item) => {
|
|
if (item.pkId == this.hasChecked) {
|
|
data.waresSkuList.push({ pkTWares: this.goodDetail.pkId,pkTWaresSku:item.pkId})
|
|
}
|
|
})
|
|
uni.navigateTo({
|
|
url:
|
|
'/pages/shareArea/haiShare?allData=' +
|
|
JSON.stringify([data]) +
|
|
'&hasChecked=' +
|
|
this.hasChecked,
|
|
})
|
|
},
|
|
getDetails() {
|
|
api
|
|
.sharingWaresDetail({
|
|
pkId: this.pkId,
|
|
source: this.source,
|
|
})
|
|
.then((res) => {
|
|
this.goodDetail = res.data
|
|
// let sl = this.goodDetail.sales + ''
|
|
// if (sl >= 10000) {
|
|
// sl = sl.substring(0, sl.length - 4) + '万+'
|
|
// }
|
|
// this.goodDetail.sales = sl
|
|
// this.mainImgUrl = res.data.videoUrl
|
|
this.imgUrlList = [
|
|
res.data.videoUrl,
|
|
res.data.cover,
|
|
res.data.cover1,
|
|
res.data.cover2,
|
|
res.data.cover3,
|
|
res.data.cover4,
|
|
res.data.cover5,
|
|
res.data.cover6,
|
|
]
|
|
this.imgUrlList = this.imgUrlList.filter(
|
|
|
|
(item) => item && item.trim()
|
|
)
|
|
this.hasChecked = this.goodDetail.waresSkuList[0].pkId
|
|
this.$set(this.goodDetail,'waresPrice',this.goodDetail.waresSkuList[0].price)
|
|
this.$set(this.goodDetail,'waresAchieve',this.goodDetail.waresSkuList[0].achieve)
|
|
this.ggString()
|
|
})
|
|
},
|
|
// 拼接已选
|
|
ggString() {
|
|
let skuString
|
|
this.goodDetail.waresSkuList.forEach((item) => {
|
|
if (item.pkId == this.hasChecked) {
|
|
skuString = item.specValueNames
|
|
}
|
|
})
|
|
if (skuString.length > 19) {
|
|
this.skuString = skuString.substring(0, 19) + '...'
|
|
} else {
|
|
this.skuString = skuString
|
|
}
|
|
},
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.content1 {
|
|
background: #f8f8f8;
|
|
min-height: 100vh;
|
|
}
|
|
.title {
|
|
font-size: 40rpx;
|
|
text-align: center;
|
|
margin: 20rpx auto;
|
|
color: #333;
|
|
font-weight: bold;
|
|
}
|
|
.contxt {
|
|
padding: 0 24rpx 20rpx 24rpx;
|
|
}
|
|
.kuang {
|
|
margin-top: 20rpx;
|
|
padding: 20rpx;
|
|
background: #fff;
|
|
box-shadow: 0px 2px 10px 0px rgba(204, 204, 204, 0.5);
|
|
border-radius: 10px 10px 10px 10px;
|
|
.disFlex {
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
.t_red {
|
|
font-size: 16px;
|
|
font-family: Arial-Bold, Arial;
|
|
font-weight: bold;
|
|
color: #b42b2a;
|
|
margin-right: 20px;
|
|
}
|
|
.t_hui {
|
|
font-size: 11px;
|
|
font-family: Arial-Bold, Arial;
|
|
font-weight: bold;
|
|
color: #999;
|
|
}
|
|
.bao {
|
|
font-size: 13px;
|
|
color: #de0214;
|
|
font-weight: 600;
|
|
}
|
|
}
|
|
.t_hei {
|
|
font-size: 13px;
|
|
font-family: PingFang SC-Semibold, PingFang SC;
|
|
font-weight: 600;
|
|
color: #333;
|
|
}
|
|
.heng {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
font-size: 12px;
|
|
font-family: PingFang SC-Medium, PingFang SC;
|
|
font-weight: 500;
|
|
color: #999999;
|
|
margin-bottom: 10rpx;
|
|
}
|
|
.label {
|
|
margin-right: 40rpx;
|
|
}
|
|
.label1 {
|
|
font-size: 13px;
|
|
font-family: PingFang SC-Semibold, PingFang SC;
|
|
font-weight: 600;
|
|
color: #333333;
|
|
}
|
|
.bTit {
|
|
text-align: center;
|
|
margin: 30rpx 0;
|
|
font-size: 16px;
|
|
font-family: PingFang SC-Semibold, PingFang SC;
|
|
font-weight: 600;
|
|
color: #333333;
|
|
.btm {
|
|
width: 26px;
|
|
height: 2px;
|
|
background: #15b84b;
|
|
border-radius: 2px 2px 2px 2px;
|
|
margin: 10rpx auto;
|
|
}
|
|
}
|
|
.pop_a {
|
|
background: #f7f7f7;
|
|
max-height: 80vh;
|
|
overflow-y: auto;
|
|
}
|
|
.pop_tt {
|
|
padding: 0 10rpx;
|
|
margin: 0rpx 10rpx;
|
|
height: 172rpx;
|
|
background: #fff;
|
|
position: fixed;
|
|
width: calc(100% - 40rpx);
|
|
display: flex;
|
|
align-items: center;
|
|
z-index: 1;
|
|
.pop_t {
|
|
display: flex;
|
|
align-items: center;
|
|
img {
|
|
width: 58px;
|
|
height: 58px;
|
|
border-radius: 8px 8px 8px 8px;
|
|
margin-right: 40rpx;
|
|
}
|
|
font-size: 28px;
|
|
font-family: Arial-Bold, Arial;
|
|
font-weight: bold;
|
|
color: #b42b2a;
|
|
}
|
|
}
|
|
.zhan {
|
|
height: 172rpx;
|
|
}
|
|
.zhan1 {
|
|
height: 130rpx;
|
|
}
|
|
.pop {
|
|
padding: 10rpx 20rpx;
|
|
margin: 20rpx 10rpx;
|
|
box-shadow: 0px 2px 10px 0px rgba(204, 204, 204, 0.5);
|
|
border-radius: 8px 8px 8px 8px;
|
|
background: #fff;
|
|
.ggTit {
|
|
font-size: 12px;
|
|
font-family: PingFang SC-Medium, PingFang SC;
|
|
font-weight: 500;
|
|
color: #999999;
|
|
}
|
|
.pop_c {
|
|
border-bottom: 8rpx solid rgba(0, 0, 0, 0.05);
|
|
padding: 10rpx 0 20rpx 0;
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
|
|
.pop_cl {
|
|
display: flex;
|
|
align-items: center;
|
|
background: #eeeeee;
|
|
border-radius: 4px 4px 4px 4px;
|
|
padding: 5px;
|
|
.gui_iit {
|
|
margin-left: 20rpx;
|
|
}
|
|
}
|
|
.gui_a {
|
|
background: #e40301;
|
|
color: #fff;
|
|
}
|
|
|
|
img {
|
|
width: 48rpx;
|
|
height: 48rpx;
|
|
border-radius: 4px 4px 4px 4px;
|
|
}
|
|
}
|
|
}
|
|
::v-deep .u-popup__content__close {
|
|
z-index: 2;
|
|
}
|
|
.hui {
|
|
width: 22px;
|
|
height: 22px;
|
|
background: #dbdbdb;
|
|
border-radius: 3px 3px 3px 3px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
.minus {
|
|
width: 22px;
|
|
height: 22px;
|
|
background: rgba(249, 2, 0, 0.48);
|
|
border-radius: 3px 3px 3px 3px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
.plus {
|
|
width: 22px;
|
|
height: 22px;
|
|
background: #e40301;
|
|
border-radius: 3px 3px 3px 3px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
.input {
|
|
width: 50px;
|
|
text-align: center;
|
|
background: #fff;
|
|
margin: 0 10rpx;
|
|
border-radius: 3px 3px 3px 3px;
|
|
}
|
|
.pop_b {
|
|
position: fixed;
|
|
bottom: 0;
|
|
height: 166rpx;
|
|
background: #ffffff;
|
|
width: 100%;
|
|
}
|
|
.pop_bb {
|
|
padding: 20rpx 40rpx;
|
|
}
|
|
.footer_f {
|
|
position: fixed;
|
|
bottom: 0;
|
|
width: 100%;
|
|
z-index: 10;
|
|
box-shadow: 0px -2px 20px 0px rgba(204, 204, 204, 0.5);
|
|
}
|
|
.footer {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
padding: 20rpx;
|
|
background: #fff;
|
|
.footer_l {
|
|
flex: 1;
|
|
display: flex;
|
|
align-items: center;
|
|
font-size: 20rpx;
|
|
font-family: PingFang SC;
|
|
font-weight: 400;
|
|
color: #222222;
|
|
// justify-content: space-between;
|
|
}
|
|
.footer_li {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
font-size: 10px;
|
|
font-family: PingFang SC-Medium, PingFang SC;
|
|
font-weight: 500;
|
|
color: #333333;
|
|
}
|
|
.flout {
|
|
position: absolute;
|
|
top: -4px;
|
|
right: -10px;
|
|
background: #f56c6c;
|
|
border-radius: 50%;
|
|
width: 32rpx;
|
|
height: 32rpx;
|
|
color: #fff;
|
|
text-align: center;
|
|
}
|
|
.footer_ll {
|
|
margin-right: 40rpx;
|
|
position: relative;
|
|
}
|
|
.qiu {
|
|
position: absolute;
|
|
width: 30rpx;
|
|
height: 30rpx;
|
|
background: #e03030;
|
|
border-radius: 50%;
|
|
color: #fff;
|
|
text-align: center;
|
|
line-height: 30rpx;
|
|
right: 0;
|
|
top: -10rpx;
|
|
font-size: 10px;
|
|
}
|
|
.btns {
|
|
border-radius: 18px;
|
|
border: 1px solid #fbb61e;
|
|
padding: 12rpx 0;
|
|
width: 176rpx;
|
|
text-align: center;
|
|
font-size: 12px;
|
|
font-weight: 500;
|
|
}
|
|
.btn3 {
|
|
background: rgba(255, 255, 255, 0);
|
|
color: #fbb61e;
|
|
margin-right: 20rpx;
|
|
}
|
|
.btn4 {
|
|
background: #fbb61e;
|
|
color: #fff;
|
|
}
|
|
}
|
|
.footer_r {
|
|
display: flex;
|
|
.btn1 {
|
|
background: #e03030;
|
|
color: #fff;
|
|
// padding: 0rpx 33rpx 0rpx 43rpx;
|
|
border-radius: 50px;
|
|
height: 75rpx;
|
|
width: 214rpx;
|
|
line-height: 75rpx;
|
|
text-align: center;
|
|
}
|
|
.btn2 {
|
|
background: #3d3d3d;
|
|
color: #fff;
|
|
// padding: 0rpx 43rpx 0rpx 33rpx;
|
|
border-radius: 0px 50px 50px 0;
|
|
height: 75rpx;
|
|
width: 214rpx;
|
|
line-height: 75rpx;
|
|
text-align: center;
|
|
}
|
|
}
|
|
.uBtnl{
|
|
width: 214rpx;
|
|
height: 75rpx;
|
|
background: #E03030;
|
|
color: #fff;
|
|
text-align: center;
|
|
line-height: 75rpx;
|
|
border-radius: 20px 0 0 20px;
|
|
}
|
|
.uBtnr{
|
|
width: 214rpx;
|
|
height: 75rpx;
|
|
background: #3D3D3D;
|
|
color: #fff;
|
|
text-align: center;
|
|
line-height: 75rpx;
|
|
border-radius:0 20px 20px 0;
|
|
}
|
|
</style> |