<template> <view class="flex-col page"> <image mode="aspectFit" class="self-stretch image" :src="goodObject.goodImg" /> <view class="flex-col self-stretch section_2"> <view class="self-start group"> <text class="font text_2">¥</text> <text class="text">{{ goodObject.price }}</text> </view> <view class="flex-row justify-between items-center self-stretch group_2"> <text class="text_4">{{ goodObject.name }}</text> <view class="flex-row items-center group_3"> <image class="image_2" src="https://ide.code.fun/api/image?token=675941ee797f850011f20adf&name=189b2a683cb0df7c43650ce019ff639d.png" /> <text class="font text_3 ml-5">中秋节限定</text> </view> </view> <view class="self-stretch divider view"></view> <view class="flex-col self-stretch group_4"> <text class="self-stretch font_2"> 商品简介:{{ goodObject.introDetail }} <br/> </text> </view> <view class="self-stretch divider view_2"></view> <view class="flex-row items-center self-stretch group_5"> <text class="font text_5">商品标签:</text> <view class="flex-col justify-start items-center text-wrapper ml-8" v-for="(item,index) in labelList" :key="index"> <text class="font_3 text_6">#{{ item }}</text> </view> </view> </view> <view class="flex-col self-stretch section_3"> <text class="self-start font_4 text_10">用户须知</text> <text class="self-start font text_11">1.发货后不接受退货、不接受7天无理由退货</text> <text class="self-start font text_12">2.商品购买后无法自主退款,需联系客服进行退款处理</text> <text class="self-stretch font_2 text_13"> 3.定制款商品购买后不接受退货退款,包售后需要录制开箱视频,并且开箱视频需要从拆包装开始 </text> <text class="self-start font text_14">4.商品售罄后的款式也可以重新预定,需等待并联系客服</text> <text class="self-start font text_15">5.定制商品的具体发货日期根据制作团队制作情况而定</text> <text class="self-start font text_16">6.只售后邮寄破损</text> </view> <image class="self-start image_3" :src="goodObject.detailImg" /> <view class="flex-row items-center self-stretch section_4"> <view class="flex-col items-center"> <image class="image_4" src="https://carbon2.obs.cn-north-4.myhuaweicloud.com:443/feiyi%2Ftest%2F0%2FbTRAhIQz-kefu.png" /> <text class="text_19 mt-3">客服</text> </view> <view class="flex-row flex-1 ml-34"> <view class="flex-col justify-start items-center text-wrapper_4" @click="loadPop"> <text class="font_4 text_17">加入购物车</text> </view> <view class="flex-col justify-start items-center text-wrapper_5 ml-9" @click="jump_buy"> <text class="font_4 text_18">立即购买</text> </view> </view> </view> </view> <uni-popup ref="popup" background-color="#fff"> <view> <addProduct></addProduct> </view> </uni-popup> </template> <script setup > import {onMounted, ref} from 'vue' import { onLoad , onShow } from "@dcloudio/uni-app"; import { baseUrl } from '../../../api/request'; import emitter from '../../../utils/emitter' import addProduct from '../../Shopping-cart/component/addProduct.vue'; const popup = ref(null) //弹窗对象 const goodObject = ref({}) //商品对象 // const checkedData = ref([{}]) //对齐批量购买 const idInfo = ref([]) //数量 + 商品id const userInfo = ref({}) //用户信息 const labelList = ref([]) //标签 //转换上一页面传来的商品 onLoad((options) => { goodObject.value = JSON.parse(options.info) //将string转为objec赋值给商品对象 idInfo.value = [{ goodId: goodObject.value.id, quantity: 1 //暂时为1 }] labelList.value = goodObject.value.label.split(";") //分割字符串,生成标签数组 labelList.value = labelList.value.filter((s)=>{ //使用filter将最后一个空值去掉 return s }) }) onShow(()=>{ userInfo.value = wx.getStorageSync('userInfo') //获取用户信息 console.log('商品对象--->',goodObject.value) }) onMounted(()=>{ emitter.on('close',()=>{ //将关闭弹窗方法传入组件 close() }) getFonts() }) const loadPop =()=>{ popup.value.open('bottom') //从底部弹出 emitter.emit('product',goodObject.value) } //关闭弹窗 const close =()=>{ popup.value.close() } //将商品对象发送到下一个页面 const jump_buy =()=> { uni.navigateTo({ url: '../../../pages/order/product-waitpay/product-waitpay?cartInfo=' + JSON.stringify(idInfo.value) }) } //获取字体 const getFonts =()=>{ uni.loadFontFace({ family: 'FangZhengFonts', source: `url("https://carbon2.obs.cn-north-4.myhuaweicloud.com/fonts/FangZhengFonts.TTF")`, success:(res) =>{ console.log('success',res); }, fail:(err) => { console.log('err',err); } }) } </script> <style lang="scss" scoped> .ml-5 { margin-left: 9.38rpx; } .mt-3 { margin-top: 5.63rpx; } .ml-9 { margin-left: 16.88rpx; } .page { background-image: url('https://carbon2.obs.cn-north-4.myhuaweicloud.com:443/feiyi%2Ftest%2F0%2FQfLHXSAU-feiyigongfangbeijin.png'); background-size: 100% 100%; background-repeat: no-repeat; height: 100%; width: 100%; overflow-y: auto; overflow-x: hidden; } .image { width: 100vw; height: 72vw; } .section_2 { margin-top: 20.63rpx; padding-left: 18.75rpx; padding-top: 19.2rpx; background-color: #ffffff; border-radius: 18.75rpx; } .group { margin-left: 14.16rpx; line-height: 30.06rpx; } .font { font-size: 26.25rpx; font-family: 'FangZhengFonts'; line-height: 25.84rpx; color: #323232; } .text_2 { color: #ff0000; line-height: 16.91rpx; } .text { color: #ff0000; font-size: 45rpx; font-family: 'FangZhengFonts'; line-height: 30.06rpx; } .group_2 { margin-top: 19.11rpx; } .text_4 { color: #323232; font-size: 33.75rpx; font-family: 'FangZhengFonts'; line-height: 32.7rpx; } .group_3 { margin-right: 19.63rpx; } .image_2 { width: 33.75rpx; height: 33.75rpx; } .text_3 { font-size: 28.13rpx; line-height: 27.24rpx; } .divider { background-color: #cdcdcd; height: 1.88rpx; } .view { margin-right: 41.27rpx; margin-top: 18.28rpx; } .group_4 { padding: 10.56rpx 0 32.04rpx; } .font_2 { font-size: 26.25rpx; font-family: 'FangZhengFonts'; line-height: 31.88rpx; color: #323232; } .view_2 { margin-right: 41.27rpx; } .group_5 { padding: 16.88rpx 0 20.63rpx; } .text_5 { color: #000000; line-height: 24.62rpx; } .text-wrapper { padding: 7.26rpx 10rpx 10.31rpx 10rpx; background-color: #fbdedf; border-radius: 9.38rpx; // width: 90rpx; height: 39.38rpx; } .font_3 { font-size: 22.5rpx; font-family: 'FangZhengFonts'; line-height: 21.71rpx; color: #323232; } .text_6 { line-height: 21.81rpx; } .text-wrapper_2 { padding: 7.35rpx 0 10.31rpx; background-color: #fbdedf; border-radius: 9.38rpx; height: 39.38rpx; } .text_7 { margin-left: 11.78rpx; margin-right: 8.83rpx; } .text-wrapper_1 { padding: 9.22rpx 0 9.15rpx; background-color: #fbdedf; border-radius: 9.38rpx; width: 105rpx; height: 39.38rpx; } .text_8 { line-height: 21rpx; } .text-wrapper_3 { padding: 9.13rpx 0 8.27rpx; background-color: #fbdedf; border-radius: 9.38rpx; width: 105rpx; height: 39.38rpx; } .text_9 { line-height: 21.98rpx; } .section_3 { margin-top: 35.63rpx; padding: 18.51rpx 11.72rpx 43.29rpx; background-color: #ffffff; border-radius: 18.75rpx; } .font_4 { font-size: 30rpx; font-family: 'FangZhengFonts'; color: #ffffff; } .text_10 { color: #000000; line-height: 28.01rpx; text-decoration: underline; } .text_11 { margin-left: 10.14rpx; margin-top: 21.23rpx; line-height: 25.74rpx; } .text_12 { margin-left: 9.53rpx; margin-top: 19.46rpx; line-height: 25.54rpx; } .text_13 { margin: 16.44rpx 15.69rpx 0 9.62rpx; } .text_14 { margin-left: 9.41rpx; margin-top: 21.36rpx; } .text_15 { margin-left: 9.62rpx; margin-top: 24.9rpx; line-height: 25.63rpx; } .text_16 { margin-left: 10.14rpx; margin-top: 23.01rpx; } .image_3 { margin: 20.88rpx 0 120rpx; width: 100vw; height: 100vw; } .section_4 { position: fixed; left: 0; right: 0; bottom: 0; margin-top: 31.88rpx; padding: 13.13rpx 26.25rpx 16.88rpx; background-color: #ffffff; } .image_4 { width: 46.88rpx; height: 46.88rpx; } .text_19 { color: #9d2624; font-size: 22.5rpx; font-family: Open Sans; line-height: 20.72rpx; } .text-wrapper_4 { padding: 20.38rpx 0 22.63rpx; flex: 1 1 283.13rpx; background-color: #e79ea1; border-radius: 93.75rpx; height: 71.25rpx; } .text_17 { line-height: 28.24rpx; } .text-wrapper_5 { padding: 20.51rpx 0 22.97rpx; flex: 1 1 283.13rpx; background-color: #c35c5d; border-radius: 93.75rpx; height: 71.25rpx; } .text_18 { line-height: 27.77rpx; } @import url(../../../common/css/global.css); </style>