<template> <view class="content"> <view class="container"> <view class="my-header"> <view class="my-icons" @click="goback"> <uni-icons type="left" size="16"></uni-icons> </view> <view class="my-text">商品详情</view> <view class="my-icons"></view> </view> <!-- 顶部区域 --> <view class=""> <u-swiper :list="giftImages" height="390" @change="change" @click="click"></u-swiper> </view> <view class="bai-box"> <view class="box-title">{{goodsInfo.giftName}}</view> <view class="box-jg"> <span v-if="goodsInfo.exchangeMethod == '积分' || goodsInfo.exchangeMethod == '积分+金额' || goodsInfo.exchangeMethod == '积分+加钱购'">{{goodsInfo.exchangePoints}}积分</span> <span v-if="goodsInfo.exchangeMethod == '积分+金额'">+</span> <span v-if="goodsInfo.exchangeMethod == '金额' || goodsInfo.exchangeMethod == '积分+金额'">¥{{goodsInfo.exchangeAmount}}</span> </view> <view class="dt-box"> <view class="" v-if="deliveryMethod"><u-tag :text='deliveryMethod' type="error" shape="circle"></u-tag></view> <view class="hui-time">市场价:{{goodsInfo.market}}</view> </view> </view> <view class="bai-box"> <view style="margin-bottom: 10px;">商品详情</view> <!-- <u-line v-html="goodsInfo.detailedDescription"></u-line> --> <!-- <view class="" v-html="html" ></view> --> <u-line></u-line> <u-parse :content="goodsInfo.detailedDescription"></u-parse> </view> <!-- <view class="centen-siez"> --> </view> <view class="bottom-d"> <view class="anniux" @click="goorder()"> <text>立即兑换</text> </view> </view> </view> </view> </template> <script> import config from '@/config' import request from '../../utils/request' export default { data() { return { title: '', goodsInfo: '', baseUrl: config.baseUrl, deliveryMethod: '', giftImages: [], } }, onLoad() { }, onShow() { uni.$on('goodsInfo', (data) => { this.goodsInfo = data if (this.goodsInfo != null) { this.dataProcessing() } }) uni.$emit('un') }, methods: { change() {}, click() {}, // 配送信息 dataProcessing() { this.giftImages = [] if (this.goodsInfo.giftImages != null && this.goodsInfo.giftImages != undefined) { const myGiftImages = JSON.parse(this.goodsInfo.giftImages); myGiftImages.forEach(res => { let url = this.baseUrl + res this.giftImages.push(url); }) } if (this.goodsInfo.deliveryMethod != null && this.goodsInfo.deliveryMethod != undefined) { const deliveryData = JSON.parse(this.goodsInfo.deliveryMethod); this.deliveryMethod = deliveryData.join('+'); } else { this.deliveryMethod = '无配送信息' } }, // 立即兑换 goorder() { // 先判断积分是否足够兑换 request({ url: 'business/userManager/user/getByUniApp', method: 'get', params: { chainStoreId: uni.getStorageSync('chainStoreId') } }).then((res) => { if (res.code == 200 && res.data) { this.myPoints = res.data.points console.log("this.goodsInfo1", this.goodsInfo) console.log("this.goodsInfo1", res.data) if (res.data.points != undefined) { if (!this.goodsInfo.exchangePoints) { uni.navigateTo({ url: '/pagesHome/order/order' }) } else if (res.data.points < this.goodsInfo.exchangePoints && ( this.goodsInfo.exchangeMethod == '积分' || this.goodsInfo.exchangeMethod == '积分+金额')) { // 积分不足 uni.showToast({ icon: 'none', title: "积分不足" }) } else { uni.navigateTo({ url: '/pagesHome/order/order' }) } } } else { // 错误处理 uni.showToast({ icon: 'none', title: "积分不足" }) } }) }, // 返回 goback() { uni.navigateBack() } } } </script> <style scoped lang="scss"> .content { background: #f4f5f6; width: 100%; height: 100vh; } .container { width: 100%; height: 100vh; box-sizing: border-box; padding-top: 88px; } .my-header { width: 100%; height: 88px; background: #ffffff; display: flex; align-items: center; justify-content: space-between; color: #000; box-sizing: border-box; padding: 0px 15px; padding-top: 40px; .my-icons { width: 20px; } position: fixed; top: 0px; } .bai-box { width: 100%; background-color: #ffffff; padding: 10px; margin: 10px auto; } .dt-box { width: 92%; display: flex; align-items: center; justify-content: space-between; } .box-title { font-weight: bold; font-size: 18px; } .box-jg { font-size: 20px; color: red; margin: 10px auto; } .hui-time { color: #999999; } .bottom-d { display: flex; align-items: center; justify-content: center; background-color: #ffffff; width: 100%; height: 88px; position: fixed; bottom: 0px; z-index: 99999; } .anniux { width: 90%; background: #1678ff; color: white; display: flex; align-items: center; justify-content: center; color: white; border-radius: 50px; height: 50px; } </style>