You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
480 lines
12 KiB
480 lines
12 KiB
<template> |
|
<view class="wrap"> |
|
<view class="banner-wrap bg-wh"> |
|
<view class="pic-wrap"> |
|
<image class="pic" :src="form.mall.coverDrawing" mode="widthFix"></image> |
|
<view class="pro-title">{{ form.mall.productName }}</view> |
|
</view> |
|
<view class="fields"> |
|
<view class="field"> |
|
<image class="icon" src="@/static/image/product/1.png"></image> |
|
市场建议价:{{ form.mall.marketUnitPrice }}元/年 |
|
</view> |
|
<view class="field"> |
|
<image class="icon" src="@/static/image/product/2.png"></image> |
|
产品类型:{{ form.goodsRes.typeName }} |
|
</view> |
|
</view> |
|
</view> |
|
|
|
<view class="detail"> |
|
<ul class="tabs"> |
|
<li v-for="(tab, i) in tabs" :class="{active: curTab === tab.id}" @click="tabChange(tab)">{{ tab.name }}</li> |
|
</ul> |
|
<view class="title"> |
|
<image class="icon" src="@/static/image/product/3.png"></image> |
|
产品详情 |
|
</view> |
|
<view class="texts"> |
|
<view class="line"> |
|
<text class="name">产品简介:</text> |
|
<text class="val">{{ form.mall.productIntroduction }}</text> |
|
</view> |
|
<view class="line"> |
|
<text class="name">适用专业:</text> |
|
<text class="val">{{ form.goodsRes.professionalName }}</text> |
|
</view> |
|
<view v-if="form.mall.courseHours" class="line"> |
|
<text class="name">预计课时:</text> |
|
<text class="val">{{ form.mall.courseHours }}</text> |
|
</view> |
|
<view v-if="form.mall.matchingCourse" class="line"> |
|
<text class="name">匹配课程:</text> |
|
<text class="val">{{ form.mall.matchingCourse }}</text> |
|
</view> |
|
<view v-if="form.mall.applicationScenario" class="line"> |
|
<text class="name">适用场景:</text> |
|
<text class="val">{{ form.mall.applicationScenario }}</text> |
|
</view> |
|
<view class="line"> |
|
<text class="name">详情介绍:</text> |
|
<!-- <view class="des-html" v-html="form.mall.detailedIntroduction"></view> --> |
|
<mp-html class="des-html" :tag-style="mpStyle" :content="form.mall.detailedIntroduction"/> |
|
<!-- <rich-text class="des-html" :nodes="form.mall.detailedIntroduction"></rich-text> --> |
|
<!-- <text class="val">{{ form.mall.detailedIntroduction }}</text> --> |
|
</view> |
|
</view> |
|
</view> |
|
|
|
<view v-if="form.interfaceDiagram" class="detail" id="pics"> |
|
<view class="title mb"> |
|
<image class="icon" src="@/static/image/product/4.png"></image> |
|
产品界面图 |
|
</view> |
|
<uni-swiper-dot :info="form.interfaceDiagram.length > 1 ? form.interfaceDiagram : 0" field="content" mode="round" :dotsStyles="dotsStyles"> |
|
<swiper class="swiper-box" autoplay> |
|
<swiper-item v-for="(pic, i) in form.interfaceDiagram" :key="i"> |
|
<image class="pic" mode="widthFix" :src="pic"></image> |
|
</swiper-item> |
|
</swiper> |
|
</uni-swiper-dot> |
|
</view> |
|
|
|
<view v-if="form.mallAnnex && form.mallAnnex.length" class="detail" id="annex"> |
|
<view class="title-wrap"> |
|
<view class="title"> |
|
<image class="icon" src="@/static/image/product/5.png"></image> |
|
产品参数 |
|
</view> |
|
<view class="download" @click="downloadAll"> |
|
下载全部 |
|
<image class="icon" src="@/static/image/product/6.png"></image> |
|
</view> |
|
</view> |
|
|
|
<view v-if="form.mallAnnex" class="files"> |
|
<view v-for="(file, i) in form.mallAnnex" :key="i" class="file" @click="download(file)"> |
|
<view class="text"> |
|
<image class="icon" src="@/static/image/product/ppt.png"></image> |
|
{{ file.fileName }} |
|
</view> |
|
<view v-if="auth('产品:下载')" class="download" @click="download(file)">下载</view> |
|
</view> |
|
</view> |
|
</view> |
|
|
|
<view class="footer"> |
|
<view v-if="auth('产品:购物车')" class="shop" @click="$util.to('../shopCart/shopCart')"> |
|
<uni-badge size="small" :text="shopCartTotal" absolute="topRight" type="error"> |
|
<image class="icon" src="@/static/image/product/shop-blue1.png" mode="widthFix"></image> |
|
</uni-badge> |
|
<view>购物车</view> |
|
</view> |
|
|
|
<view class="btns"> |
|
<view v-if="auth('产品:加入购物车')" class="btn" @click="addShop">加入购物车</view> |
|
<view v-if="auth('产品:下单')" class="btn order" @click="order">下单</view> |
|
</view> |
|
</view> |
|
</view> |
|
</template> |
|
|
|
<script> |
|
import { detailsOfGoods, addToShoppingCart, shoppingCartList, productCategoryList } from '@/apis/modules/product.js' |
|
export default { |
|
data() { |
|
return { |
|
id: '', |
|
curTab: 0, |
|
tabs: [ |
|
{ |
|
name: '详情介绍', |
|
id: 0 |
|
} |
|
], |
|
form: { |
|
classificationIds: [], |
|
interfaceDiagram: [], |
|
mall: { |
|
coverDrawing: '' |
|
}, |
|
goodsRes: {}, |
|
mallAnnex: [] |
|
}, |
|
shopCartTotal: 0, |
|
types: [], |
|
dotsStyles: { |
|
backgroundColor: 'rgba(83, 200, 249,0.3)', |
|
border: '1px rgba(83, 200, 249,0.3) solid', |
|
color: '#fff', |
|
selectedBackgroundColor: 'rgba(83, 200, 249,0.9)', |
|
selectedBorder: '1px rgba(83, 200, 249,0.9) solid' |
|
}, |
|
mpStyle: { |
|
p: 'font-size: 26rpx !important;font-family: Microsoft Yahei !important;color: #333 !important;', |
|
span: 'font-size: 26rpx !important;font-family: Microsoft Yahei !important;color: #333 !important;' |
|
} |
|
} |
|
}, |
|
onShow() { |
|
this.tabs = [ |
|
{ |
|
name: '详情介绍', |
|
id: 0 |
|
} |
|
] |
|
const pages = getCurrentPages() |
|
const { options } = pages[pages.length - 1] |
|
this.id = options.id |
|
this.getInfo() |
|
this.getShopCart() |
|
this.getTypes() |
|
}, |
|
methods: { |
|
// 获取详情 |
|
getInfo() { |
|
uni.showLoading({ |
|
title: '加载中' |
|
}) |
|
detailsOfGoods(this.id).then(res => { |
|
const e = res.orderDetails |
|
e.mall.productIntroduction = this.$util.removeTag(e.mall.productIntroduction) |
|
// e.mall.detailedIntroduction = this.$util.removeTag(e.mall.detailedIntroduction) |
|
this.form = e |
|
const pics = this.form.mall.interfaceDiagram |
|
if (pics) { |
|
this.form.interfaceDiagram = pics.split(',') |
|
this.tabs.push({ |
|
name: '界面图', |
|
id: 1 |
|
}) |
|
} |
|
this.form.mallAnnex && this.form.mallAnnex.length && this.tabs.push({ |
|
name: '参数', |
|
id: 2 |
|
}) |
|
uni.hideLoading() |
|
}).catch(e => { |
|
uni.hideLoading() |
|
}) |
|
}, |
|
// 获取购物车数量 |
|
getShopCart() { |
|
shoppingCartList({ |
|
pageNum: 1, |
|
pageSize: 1000, |
|
}).then(({ data }) => { |
|
this.shopCartTotal = data.total |
|
}).catch(e => {}) |
|
}, |
|
// 产品分类 |
|
getTypes() { |
|
productCategoryList().then(res => { |
|
this.types = res.classificationList |
|
}).catch(e => {}) |
|
}, |
|
// tab切换 |
|
tabChange({ id }) { |
|
this.curTab = id |
|
id == 1 && uni.pageScrollTo({ |
|
selector: '#pics', |
|
}) |
|
id == 2 && uni.pageScrollTo({ |
|
selector: '#annex', |
|
}) |
|
}, |
|
// 下载全部 |
|
downloadAll() { |
|
const fileName = [] |
|
const urls = [] |
|
this.form.mallAnnex.forEach(e => { |
|
fileName.push(e.fileName) |
|
urls.push(e.filePath) |
|
}) |
|
uni.setStorageSync('files', { |
|
copyWriting: this.form.mall.productName, |
|
fileName, |
|
urls |
|
}) |
|
this.$util.to(`/team/send/send`) |
|
}, |
|
// 下载附件 |
|
download(item) { |
|
uni.setStorageSync('files', { |
|
copyWriting: this.form.mall.productName, |
|
fileName: [item.fileName], |
|
urls: [item.filePath] |
|
}) |
|
this.$util.to(`/team/send/send`) |
|
}, |
|
// 加入购物车 |
|
addShop() { |
|
uni.showLoading({ |
|
title: '加载中' |
|
}) |
|
addToShoppingCart({ |
|
mallId: this.id |
|
}).then(res => { |
|
this.$util.sucMsg('加购成功') |
|
uni.hideLoading() |
|
this.getShopCart() |
|
}).catch(e => { |
|
uni.hideLoading() |
|
}) |
|
}, |
|
// 下单 |
|
order() { |
|
const { mall } = this.form |
|
const classificationId = this.form.classificationIds[0] |
|
const authority = this.$util.getOrderType(classificationId) |
|
// 把该产品添加至缓存 |
|
uni.setStorageSync('courses', [{ |
|
dataOrCourseId: mall.associatedProduct, // id |
|
mallId: mall.mallId, |
|
productName: mall.productName, // 名称 |
|
periodOfUse: '', // 使用期限 |
|
startTime: this.$util.formatDate(new Date(), 'yyyy-MM-dd'), // 开始 |
|
endTime: '', // 终止 |
|
remainingPeriod: '', // 剩余期限 |
|
marketValue: '', // 市场价 |
|
marketPrice: mall.marketUnitPrice, // 市场单价 |
|
finalPrice: 0, // 成交价 |
|
finalValue: 0, // 成交单价(数据产品特有) |
|
discountRate: '0%', // 折扣率 |
|
accountNum: 1, // 账号数 |
|
totalAmount: '', // 总价 |
|
isEnable: 0, // 启用否:1启用,0禁用 |
|
ship: 0, // 发货否(0未发货,1已发货,默认不发货) |
|
authority, // 区分权限 |
|
options: 2, |
|
miniProgramPictureAddress: mall.appletIcon || '', // 图标 |
|
settlementPrice: 0, // 结算价 |
|
settlementPriceUnit: 0, // 结算单价 |
|
serviceFee: 0 // 平台服务费(前端计算后展示,不入库) |
|
}]) |
|
this.$util.to(`/order/editCourse/editCourse`) |
|
} |
|
} |
|
} |
|
</script> |
|
|
|
<style scoped lang="scss"> |
|
.wrap { |
|
padding-bottom: 140rpx; |
|
} |
|
.banner-wrap { |
|
width: 100%; |
|
border-radius: 0px 0px 20px 20px; |
|
.pic-wrap { |
|
padding: 20rpx 32rpx; |
|
border-bottom: 1px solid #E2E2E2; |
|
} |
|
.pic { |
|
width: 100%; |
|
} |
|
.pro-title { |
|
margin-top: 22rpx; |
|
font-size: 30rpx; |
|
font-weight: 600; |
|
color: #333; |
|
} |
|
.fields { |
|
padding: 26rpx 32rpx; |
|
} |
|
.field { |
|
display: flex; |
|
align-items: center; |
|
font-size: 28rpx; |
|
color: #333; |
|
&:first-child { |
|
margin-bottom: 22rpx; |
|
} |
|
.icon { |
|
width: 36rpx; |
|
height: 36rpx; |
|
margin-right: 12rpx ; |
|
} |
|
} |
|
} |
|
.tabs { |
|
display: flex; |
|
margin-bottom: 32rpx; |
|
li { |
|
width: 33.33%; |
|
text-align: center; |
|
font-size: 28rpx; |
|
color: #333; |
|
white-space: nowrap; |
|
} |
|
.active { |
|
color: #007EFF; |
|
&:after { |
|
content: ''; |
|
display: block; |
|
width: 40rpx; |
|
height: 8rpx; |
|
margin: 18rpx auto 0; |
|
border-radius: 4px; |
|
background-color: #007EFF; |
|
} |
|
} |
|
} |
|
.detail { |
|
padding: 34rpx 32rpx; |
|
margin: 16rpx 0; |
|
border-radius: 20px; |
|
background-color: #fff; |
|
.title-wrap { |
|
display: flex; |
|
justify-content: space-between; |
|
align-items: center; |
|
.download { |
|
display: inline-flex; |
|
align-items: center; |
|
padding: 7rpx 16rpx; |
|
font-size: 24rpx; |
|
color: #007EFF; |
|
text-align: center; |
|
background-color: #F2F8FF; |
|
.icon { |
|
width: 30rpx; |
|
height: 30rpx; |
|
margin-left: 4rpx; |
|
} |
|
} |
|
} |
|
.title { |
|
display: flex; |
|
align-items: center; |
|
font-size: 30rpx; |
|
font-weight: 600; |
|
color: #333 ; |
|
.icon { |
|
width: 36rpx; |
|
height: 36rpx; |
|
margin-right: 11rpx; |
|
} |
|
&.mb { |
|
margin-bottom: 32rpx; |
|
} |
|
} |
|
.texts { |
|
margin-top: 32rpx; |
|
} |
|
.line { |
|
display: flex; |
|
margin-bottom: 18rpx; |
|
line-height: 40rpx; |
|
text { |
|
font-size: 26rpx; |
|
color: #333; |
|
} |
|
.name { |
|
font-weight: 600; |
|
white-space: nowrap; |
|
} |
|
.des-html { |
|
width: 100%;; |
|
font-size: 28rpx !important; |
|
} |
|
.rich-text-content span { |
|
font-size: 28rpx; |
|
color: #f00; |
|
} |
|
} |
|
.pic { |
|
width: 100%; |
|
} |
|
.files { |
|
margin-top: 34rpx; |
|
.file { |
|
display: flex; |
|
justify-content: space-between; |
|
align-items: center; |
|
margin-bottom: 24rpx; |
|
.text { |
|
display: inline-flex; |
|
align-items: center; |
|
font-size: 26rpx; |
|
color: #333; |
|
} |
|
.icon { |
|
width: 36rpx; |
|
height: 36rpx; |
|
margin-right: 14rpx; |
|
} |
|
.download { |
|
font-size: 26rpx; |
|
color: #007EFF; |
|
} |
|
} |
|
} |
|
} |
|
.footer { |
|
position: fixed; |
|
bottom: 0; |
|
left: 0; |
|
display: flex; |
|
justify-content: space-between; |
|
align-items: center; |
|
width: 100%; |
|
padding: 24rpx 32rpx 24rpx 73rpx; |
|
background-color: #fff; |
|
box-sizing: border-box; |
|
.shop { |
|
text-align: center; |
|
font-size: 24rpx; |
|
color: #333; |
|
.icon { |
|
width: 56rpx; |
|
} |
|
} |
|
.btns { |
|
display: inline-flex; |
|
.btn { |
|
width: 229rpx; |
|
line-height: 80rpx; |
|
text-align: center; |
|
font-size: 32rpx; |
|
color: #333; |
|
background-color: #E5EEF7; |
|
border-radius: 100px 0px 0px 100px; |
|
} |
|
.order { |
|
color: #fff; |
|
background-color: #007EFF; |
|
border-radius: 0px 100px 100px 0px; |
|
} |
|
} |
|
} |
|
</style>
|
|
|