提交 f99fdf75 authored 作者: 刘旭's avatar 刘旭

优化

上级 0c534802
......@@ -36,7 +36,8 @@
</view>
<view class="sum-price">
<text>{{ item.price.toFixed(2) }}</text>
<!-- <text>{{ item.price.toFixed(2) }}</text> -->
<text></text>
<text style="color: #969799; font-size: 12px;">x{{ item.number }}</text>
</view>
</view>
......@@ -80,7 +81,7 @@ let baseUrl = config.baseUrl;
const buyNowId = ref(uni.getStorageSync('buyNowId') || 0);
const buyNowData = ref();
const remarks = ref(); // 订单备注
const type = ref('');
const type = ref(''); // 何种方式下单
onLoad((options: any) => {
type.value = options.type;
......@@ -108,16 +109,17 @@ const onsubmit = () => {
// 提交订单
orderSubmit(data).then((res: any) => {
if (res.data.code === 200) {
orderDetail({
orderId: res.data.data.orderId,
}).then((res1: any) => {
console.log(res1, '订单详情信息');
uni.navigateTo({
url: `/pages/order/downPdf?data=${JSON.stringify(res1.data.data)}&type=${
type.value
}`,
});
uni.navigateTo({
url: `/pages/order/downPdf?orderId=${res.data.data.orderId}&type=${
type.value
}`,
});
// orderDetail({
// orderId: res.data.data.orderId,
// }).then((res1: any) => {
// console.log(res1, '订单详情信息');
// });
}
});
};
......
<template>
<!-- <u-navbar back-text="" title="订单详情" title-color="#000"></u-navbar> -->
<view class="container">
<view v-for="(item, index) in detailData" class="details">
<u-image
width="140rpx"
height="200rpx"
:src="item.picUrl.split('http').length > 1 ? item.picUrl : baseUrl + item.picUrl"
class="img"
></u-image>
<view class="right">
<view class="name">{{ item.goodsName }}</view>
<view class="tag">
<block v-for="(item1, index1) in item.specifications.length" :key="index1">
<u-tag
:text="item.specifications[index1]"
type="info"
size="mini"
style="margin: 8rpx 8rpx 8rpx 0pt;"
/>
</block>
</view>
<block v-for="(item, index) in detailData">
<view>
<view class="details">
<u-image
width="140rpx"
height="200rpx"
:src="
item.picUrl.split('http').length > 1
? item.picUrl
: baseUrl + item.picUrl
"
class="img"
></u-image>
<view class="right">
<view class="name">{{ item.goodsName }}</view>
<view class="tag">
<block
v-for="(item1, index1) in item.specifications.length"
:key="index1"
>
<u-tag
:text="item.specifications[index1]"
type="info"
size="mini"
style="margin: 8rpx 8rpx 8rpx 0;"
/>
</block>
</view>
<view class="sum-price">
<text style="color: red;">{{ item.price.toFixed(2) }}</text>
<text style="color: #969799; font-size: 12px;">x{{ item.number }}</text>
<view class="sum-price">
<!-- <text style="color: red;">{{ item.price.toFixed(2) }}</text> -->
<view style="display: flex; flex-direction: column;">
<view
style="display: flex; flex-direction: row; align-items: center; margin-bottom: 10rpx;"
>
<text>设置单价:</text>
<u-input
v-model="item.unitPrice"
type="number"
height="50"
placeholder="请输入单价"
style="width: 200rpx;"
/>
</view>
<view style="margin-bottom: 10rpx;">
金额:¥{{
item.unitPrice
? (Number(item.unitPrice) * item.number).toFixed(2)
: 0
}}
</view>
<view style="margin-bottom: 10rpx;">
含税金额:¥{{
item.unitPrice
? (
Number(item.unitPrice) * item.number +
Number(item.unitPrice) * item.number * 0.13
).toFixed(2)
: 0
}}
</view>
</view>
<text style="color: #969799; font-size: 12px;">x{{ item.number }}</text>
</view>
</view>
</view>
<u-line v-if="detailData.length > 1" color="#e8e8e8" />
</view>
</view>
<view class="footer">
</block>
<view class="content-footer">
<u-button
shape="circle"
type="error"
......@@ -45,14 +88,19 @@
</view>
</view>
</view>
<view class="footer">
<text>商品总价:¥{{ totlePirce }}</text>
<text>含税商品总价:¥{{ taxTotlePirce }}</text>
</view>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { onLoad, onHide, onBackPress } from '@dcloudio/uni-app';
import { ref, computed } from 'vue';
import { onLoad, onBackPress } from '@dcloudio/uni-app';
import config from '@/utils/config';
import { useStore } from '@/store/useStore';
import { getOrderPdf } from '@/api/cart';
import { orderDetail } from '@/api/index';
let baseUrl = config.baseUrl;
let store = useStore();
......@@ -63,13 +111,24 @@ let orderId = ref();
onLoad((options: any) => {
type.value = options.type;
let data = JSON.parse(options.data);
enclosure.value = data.orderInfo.enclosure;
detailData.value = data.orderGoods;
orderId.value = data.orderInfo.id;
initPdf(data.orderInfo.id);
orderDetail({
orderId: options.orderId,
}).then((res: any) => {
if (res.data.code === 200) {
enclosure.value = res.data.data.orderInfo.enclosure;
detailData.value = res.data.data.orderGoods;
orderId.value = res.data.data.orderInfo.id;
}
console.log(res, '订单详情信息');
});
// let data = JSON.parse(options.data);
// enclosure.value = data.orderInfo.enclosure;
// detailData.value = data.orderGoods;
// orderId.value = data.orderInfo.id;
initPdf(options.orderId);
});
// 返回首页
let toIndex = () => {
uni.reLaunch({
url: '../index/index',
......@@ -79,10 +138,27 @@ let toIndex = () => {
// 生成报价
let generateQuote = () => {
uni.navigateTo({
url: './quotation?orderId=' + orderId.value,
url: `./quotation?orderId=${orderId.value}&data=${detailData.value}`,
});
};
let totlePirce: any = computed(() => {
let totlePic = 0;
if (detailData.value) {
detailData.value.map((item: any) => {
if (typeof item.unitPrice !== 'undefined') {
totlePic += Number(item.unitPrice);
}
});
}
return totlePic.toFixed(2);
});
let taxTotlePirce = computed(() => {
let taxTotlePic = Number(totlePirce.value) + Number(totlePirce.value) * 0.13;
return Number(taxTotlePic).toFixed(2);
});
// 下载pdf
let download = () => {
uni.showLoading({
......@@ -155,7 +231,7 @@ onBackPress(() => {
display: flex;
flex-direction: row;
flex-wrap: wrap;
margin-bottom: 13%;
margin-bottom: 5%;
}
.right {
......@@ -168,7 +244,7 @@ onBackPress(() => {
}
}
.footer {
.content-footer {
margin-top: 50rpx;
padding: 50rpx;
width: 100%;
......@@ -177,4 +253,18 @@ onBackPress(() => {
align-items: center;
}
}
.footer {
position: fixed;
bottom: 0;
width: 100%;
height: 100rpx;
background-color: #fff;
padding: 0 32rpx;
line-height: 100rpx;
font-size: 30rpx;
font-weight: 600;
display: flex;
justify-content: space-between;
}
</style>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论