提交 2a392919 authored 作者: 刘旭's avatar 刘旭

完成订单详情页面

上级 20578618
......@@ -133,7 +133,7 @@
}, {
"path": "pages/order/downPdf",
"style": {
"navigationBarTitleText": "",
"navigationBarTitleText": "订单详情",
"navigationBarBackgroundColor": "#fff"
}
}
......
......@@ -162,7 +162,6 @@ const checkboxGroupChange = (e: any) => {
// 单个删除
const deleteCart = (index: number) => {
delProductIds.value.push(cartList.value[index].productId);
console.log(delProductIds.value);
showModel.show = true;
};
......@@ -206,23 +205,27 @@ const onConfirm = () => {
if (delProductIds.value) {
if (delProductIds.value.length === 1) {
cartDelete({ productIds: delProductIds.value }).then((res: any) => {
delProductIds.value = [];
cartList.value = res.data.data.cartList;
allGoods.value = getAllList();
checkedGoods.value = getCheckedList(cartList.value);
totalPrice.value = res.data.data.cartTotal.checkedGoodsAmount.toFixed(2);
showModel.show = false;
if (res.data.code === 200) {
delProductIds.value = [];
cartList.value = res.data.data.cartList;
allGoods.value = getAllList();
checkedGoods.value = getCheckedList(cartList.value);
totalPrice.value = res.data.data.cartTotal.checkedGoodsAmount.toFixed(2);
showModel.show = false;
}
});
} else {
cartDelete({ productIds: delProductIds.value }).then((res: any) => {
delProductIds.value = [];
cartList.value = res.data.data.cartList;
allGoods.value = getAllList();
checkedGoods.value = getCheckedList(cartList.value);
totalPrice.value = res.data.data.cartTotal.checkedGoodsAmount.toFixed(2);
// 批量删除后,check的name属性没有更新,需要刷新当前页面
uni.reLaunch({ url: '../cart/index' });
showModel.show = false;
if (res.data.code === 200) {
delProductIds.value = [];
cartList.value = res.data.data.cartList;
allGoods.value = getAllList();
checkedGoods.value = getCheckedList(cartList.value);
totalPrice.value = res.data.data.cartTotal.checkedGoodsAmount.toFixed(2);
// 批量删除后,check的name属性没有更新,需要刷新当前页面
uni.reLaunch({ url: '../cart/index' });
showModel.show = false;
}
});
}
}
......@@ -269,7 +272,6 @@ const initCartIndex = () => {
if (sort === 0) checkedAll.value = true;
else checkedAll.value = false;
sort = 0;
console.log('购物车数据', cartList.value);
});
};
......
......@@ -48,7 +48,7 @@ const currentSubCategoryData = ref([] as any); //初始tabber数据
const listQuery = ref({
categoryId: 0,
page: 1,
limit: 10,
limit: 10
});
let status = ref('loadmore');
let total = ref(0);
......
......@@ -15,7 +15,7 @@
</view>
</view>
<!-- 商品详情 -->
<view v-for="(item, index) in buyNowData?.checkedGoodsList" class="details">
<view v-for="(item, index) in buyNowData?.checkedGoodsList" :key="item.id" class="details">
<u-image
width="140rpx"
height="200rpx"
......@@ -48,14 +48,6 @@
<view class="label">商品金额</view>
<view class="item-price">{{ buyNowData?.goodsTotalPrice.toFixed(2) }}</view>
</view>
<!-- <view class="item-list">
<view class="label">邮费</view>
<view class="item-price">{{ buyNowData?.freightPrice.toFixed(2) }}</view>
</view> -->
<!-- <view class="item-list">
<view class="label">优惠券</view>
<view class="item-price">¥12</view>
</view> -->
<view class="item-list-end">
<view class="label">订单备注</view>
<u-input v-model="remarks" />
......@@ -120,11 +112,8 @@ const onsubmit = () => {
}).then((res1: any) => {
console.log(res1, '订单详情信息');
uni.navigateTo({
url: `/pages/order/downPdf?enclosure=${res1.data.data.orderInfo.enclosure}`,
url: `/pages/order/downPdf?data=${JSON.stringify(res1.data.data)}`,
});
// uni.switchTab({
// url: '../profile/index',
// });
});
}
});
......
<template>
<u-button @tap="download" style="margin: 100px auto;">下载pdf</u-button>
<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>
<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>
</view>
</view>
<view class="footer">
<u-button shape="circle" type="error" size="mini" @tap="toIndex">返回首页</u-button>
<u-button shape="circle" size="mini" @tap="download">下载pdf</u-button>
</view>
</view>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { onLoad, onHide } from '@dcloudio/uni-app';
import config from '@/utils/config';
const baseUrl = config.baseUrl;
let enclosure = ref('');
let detailData = ref();
onLoad((options: any) => {
enclosure.value = options.enclosure;
let data = JSON.parse(options.data);
enclosure.value = data.orderInfo.enclosure;
detailData.value = data.orderGoods;
console.log(enclosure.value, data);
});
let toIndex = () => {
uni.reLaunch({
url: '../index/index'
})
}
// 下载pdf
let download = () => {
uni.showLoading({
......@@ -49,4 +93,46 @@ let download = () => {
// });
</script>
<style></style>
<style lang="scss" scoped>
.container {
box-sizing: border-box;
margin: 16rpx 32rpx;
background-color: #fff;
.details {
width: 100%;
padding: 16rpx 32rpx;
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
.img {
margin-right: 20rpx;
}
.tag {
margin-top: 1%;
display: flex;
flex-direction: row;
flex-wrap: wrap;
margin-bottom: 13%;
}
.right {
width: 80%;
.sum-price {
display: flex;
justify-content: space-between;
}
}
}
.footer {
margin-top: 50rpx;
padding: 50rpx 25%;
width: 100%;
display: flex;
align-items: center;
}
}
</style>
......@@ -6,6 +6,9 @@ const baseUrl = config.baseUrl;
function request(url: string, method: 'GET' | 'POST' | 'PUT' | 'DELETE', data?: object | any) {
return new Promise(function(resolve, reject) {
let header: any;
uni.showLoading({
title: '加载中...'
})
if (uni.getStorageSync('token') !== undefined && uni.getStorageSync('token') !== '') {
header = {
'content-type': 'application/json',
......@@ -54,12 +57,8 @@ function request(url: string, method: 'GET' | 'POST' | 'PUT' | 'DELETE', data?:
console.log('token', res);
uni.clearStorage();
} else {
console.log(res, '非200错误');
console.log(res.data, '非200错误');
//其余异样
uni.showToast({
title: res.data.msg,
icon: 'none',
});
reject(res);
}
},
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论