【前端】云工厂的纸掌柜app
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.

312 lines
8.8 KiB

<template>
<view class="paper-detail">
<view>
<uni-nav-bar left-icon="back" @clickLeft="back" statusBar fixed title="">
<view class="paper-detail-title">纸品详情</view>
<view slot="left"></view>
<view slot="right" class="paper-detail-right-title" @tap="shareTap">分享</view>
</uni-nav-bar>
</view>
<view class="paper-detail-info">
<view class="">
<text class="paper-detail-info-text">纸品名称</text>
<text class="paper-detail-info-subtext">{{ form.name }}</text>
</view>
<view class="">
<text class="paper-detail-info-text">纸厂信息</text>
<text class="paper-detail-info-subtext">{{ form.manufacturerName }}</text>
</view>
<view class="">
<text class="paper-detail-info-text">品牌信息</text>
<text class="paper-detail-info-subtext">{{ form.brandName }}</text>
</view>
<view class="">
<text class="paper-detail-info-text">纸种信息</text>
<text class="paper-detail-info-subtext">{{ form.categoryName }}</text>
</view>
</view>
<uGap></uGap>
<view class="paper-datail-list">
<view class="paper-datail-list-title paper-bottom-border">纸品售价</view>
<view class="">
<uni-table emptyText="暂无更多数据">
<!-- 表头行 -->
<uni-tr class="paper-table-title">
<uni-th align="left" width="55">克重</uni-th>
<!-- <uni-th align="left" width="65">规格</uni-th> -->
<uni-th align="left" width="65">售价</uni-th>
<uni-th align="left" width="65">库存</uni-th>
<uni-th align="left" width="75">是否特价</uni-th>
</uni-tr>
<!-- 表格数据行 -->
<uni-tr v-for="(item, index) in skuList" :key="index">
<uni-td>{{ item.weight }}</uni-td>
<!-- <uni-td>779*1092</uni-td> -->
<uni-td>{{ item.listPrice }}</uni-td>
<uni-td>{{ transformStock(item.stock, item.stockUnit) }}</uni-td>
<uni-td>{{ item.isPromoting === true ? '是' : '否' }}</uni-td>
</uni-tr>
</uni-table>
</view>
</view>
<uGap></uGap>
<view class="paper-datail-list">
<view class="paper-datail-list-title">纸品图片</view>
<view class="paper-list-view">
<image v-for="(item, index) in imgList" :key="index" class="paper-datail-list-image" :src="item" mode=""></image>
</view>
</view>
<uGap></uGap>
<view class="paper-datail-list paper-bottom-border">
<view class="paper-datail-list-title">商品买点</view>
<view class="paper-datail-list-text">
<text>{{ form.sellingProposition }}</text>
</view>
</view>
<view class="paper-datail-list paper-bottom-border">
<view class="paper-datail-list-title">商品描述</view>
<view class="paper-datail-list-text">
<text>{{ form.description }}</text>
</view>
</view>
<view class="paper-datail-list paper-bottom-border">
<view class="paper-datail-list-title">送货说明</view>
<view class="paper-datail-list-text">
<text>{{ form.shippingNote }}</text>
</view>
</view>
<view class="paper-datail-list paper-bottom-border">
<view class="paper-datail-list-title">其他说明</view>
<view class="paper-datail-list-text">
<text>{{ form.otherNote }}</text>
</view>
</view>
<view class="share-area" v-if="visible" @click="closeShare">
<view class="share-content">
<image class="bg" src="https://qncloud.oss-cn-shenzhen.aliyuncs.com/paper_shopkeeper/qrCode-bg.png"></image>
<view class="flex-col-center-start code">
<view class="border flex-row-center-center">
<image style="width: 480rpx; height: 480rpx" :src="shareInfo.storeCodeImg"></image>
</view>
<view class="down-button flex-row-center-center" @click.stop="makeScreenShot">
<text class="text">下载二维码</text>
</view>
<text style="font-size: 46rpx; color: #333333">{{ shareInfo.storeName }}</text>
<text style="font-size: 32rpx; color: #888888; margin-top: 14rpx">{{ shareInfo.paperName }}</text>
</view>
</view>
</view>
</view>
</template>
<script>
import { back, go2 } from '@/utils/hook.js'
import uGap from '@/components/u-gap/u-gap.vue'
import { getSupplierDetail, getPaperQrCode } from '@/apis/add-paper.js'
export default {
components: {
uGap
},
data() {
return {
shareInfo: {
storeCodeImg: '',
storeName: '',
paperName: ''
},
visible: false, // 分享弹窗
form: {},
skuList: [],
imgList: [],
id: null
}
},
onLoad(option) {
if (option.id) {
this.id = option.id
this.getDetailList()
} else {
uni.showToast({
title: '参数错误',
icon: 'none',
success: () => {
setTimeout(() => {
back()
}, 2000)
}
})
}
},
methods: {
back,
//获取详情
getDetailList() {
var params = {
mallSupplierIds: this.$store.state.supplierInfo.supplierId,
productId: this.id
}
getSupplierDetail(params).then((res) => {
if (res) {
this.form = res
this.skuList = res.skuList
this.imgList = res.imgList
this.$set(this.form, 'categoryName', res.categoryName)
}
})
},
transformStock(num, unit) {
if (unit == 2) {
return `${num}吨`
}
if (unit == 1) {
return `${num}张`
}
},
// 分享
shareTap() {
getPaperQrCode({ mallSupplierId: this.$store.state.supplierInfo.supplierId, paperId: this.id }).then((res) => {
if (res) {
this.visible = true
this.shareInfo.storeCodeImg = `data:image/png;base64,${res}`
this.shareInfo.storeName = this.$store.state.supplierInfo.name
this.shareInfo.paperName = this.form.name
}
})
},
closeShare() {
this.visible = false
}
}
}
</script>
<style lang="scss">
.paper-detail {
.paper-detail-title {
width: 100%;
font-size: 36rpx;
color: #000000;
letter-spacing: 0;
text-align: center;
font-weight: 500;
}
.paper-detail-right-title {
font-size: 28rpx;
color: #007aff;
text-align: right;
line-height: 40rpx;
font-weight: 500;
}
.paper-detail-info {
height: 260rpx;
background: #ffffff;
padding: 24rpx 32rpx;
line-height: 56rpx;
}
.paper-detail-info-text {
font-size: 28rrpx;
color: #888888;
letter-spacing: 0;
font-weight: 400;
}
.paper-detail-info-subtext {
font-size: 28rpx;
color: #333333;
letter-spacing: 0;
font-weight: 400;
}
.paper-datail-list {
background: #ffffff;
.paper-datail-list-title {
font-size: 28rpx;
color: #000000;
letter-spacing: 0;
font-weight: 600;
height: 80rpx;
align-items: center;
display: flex;
padding-left: 32rpx;
}
.paper-datail-list-text {
font-size: 28rpx;
color: #333333;
letter-spacing: 0;
font-weight: 400;
align-items: center;
line-height: 50rpx;
padding: 0rpx 32rpx 20rpx 32rpx;
}
.paper-table-title {
font-size: 24rpx;
color: rgba(0, 0, 0, 0.5);
letter-spacing: 0;
font-weight: 400;
background: #f7f8fa;
}
.paper-list-view {
line-height: 40rpx;
}
.paper-datail-list-image {
width: 120rpx;
height: 120rpx;
padding: 32rpx 32rpx;
}
}
.paper-bottom-border {
border-bottom: 2rpx solid #d8d8d8;
}
}
.share-area {
width: 750rpx;
height: 100vh;
background: #888888;
position: fixed;
z-index: 998;
top: 0;
left: 0;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
.share-content {
width: 750rpx;
background-color: #fff;
border-radius: 20rpx;
padding: 64rpx 34rpx 70rpx;
position: relative;
.bg {
position: absolute;
top: 0;
left: 0;
width: 750rpx;
height: 944rpx;
}
.code {
position: relative;
z-index: 10;
background-color: #fff;
width: 680rpx;
border-radius: 20rpx;
box-shadow: 0px 3rpx 13rpx 0px rgba(0, 0, 0, 0.1);
padding: 40rpx 70rpx 64rpx;
.border {
width: 540rpx;
height: 540rpx;
background: url('https://qncloud.oss-cn-shenzhen.aliyuncs.com/paper_shopkeeper/qrCode-border.png') no-repeat center/cover;
}
}
.down-button {
width: 540rpx;
height: 90rpx;
margin: 40rpx 0 76rpx;
background-image: linear-gradient(180deg, #6092ec 0%, #225dd4 100%);
border-radius: 45rpx;
.text {
font-size: 48rpx;
color: #ffffff;
}
}
}
}
</style>