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

优化

上级 d995b80b
......@@ -40,4 +40,8 @@ export const productLineUpload = (data: any) =>
request('/wx/productLine/upload', 'POST', data);
export const getLineSpecification = (data: any) =>
request('/wx/productLine/getSpecification', 'POST', data);
\ No newline at end of file
request('/wx/productLine/getSpecification', 'POST', data);
// 产品线-查看多个条详情
export const getProductLineMultipleDetail = (data: any) =>
request('/wx/productLine/detail', 'POST', data)
\ No newline at end of file
......@@ -53,21 +53,19 @@
]" @click="skuClick(item_value, index1, index2)">
{{ item_value.name }}
</view>
<!-- <view class="item-content" style=" width: 200rpx;">
<u-input v-model="item.custom" placeholder="自定义规格" type="text"
border-color="#2979ff" height="50" clearable border focus
@blur="onBlur($event, index1)" @confirm="onConfirm($event, index1)" />
</view> -->
<u-input v-if="item.isPlus && item.isCustom" style="width: 170rpx;"
v-model="item.custom" placeholder="自定义规格" placeholder-style="font-size: 12px"
type="text" border-color="#f4f4f4" height="50" clearable border focus
@blur="onBlur($event, index1)" @confirm="onConfirm($event, index1)" />
</view>
<view v-if="item.isPlus && item.isCustom">
<!-- <view v-if="item.isPlus && item.isCustom">
<u-icon name="plus-circle" color="#999" size="36" @click="onPlus(index1)"></u-icon>
</view>
<view v-if="!item.isPlus && item.isCustom" style="margin-bottom: 12rpx; width: 200rpx;">
<u-input v-model="item.custom" placeholder="自定义规格" type="text"
border-color="#2979ff" height="50" clearable border focus
@blur="onBlur($event, index1)" @confirm="onConfirm($event, index1)" />
</view>
</view> -->
</view>
</view>
<view v-if="JSON.stringify(partList) !== '[]' && partList" class="specification-item">
......
......@@ -61,9 +61,8 @@ let onPlus = (index: number) => {
// 失去输入自定义规格输入框焦点
let onBlur = (val: string, index: number) => {
if (!val) return goodsInfo.value.spec_list[index].isPlus = true
// console.log(val, 'zidinyi', index);
goodsInfo.value.spec_list[index].custom = val
console.log(goodsInfo.value.spec_list[index].custom);
// console.log(goodsInfo.value.spec_list[index].custom);
}
let onConfirm = (val: string, index: number) => {
......
<template>
<view class="container">
<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>
<block v-for="res in detailData">
<view style="margin-bottom: 20rpx; background-color: #fff;">
<view style="width: 100%; text-align: end; padding: 20rpx 20rpx 0 0;">{{
res.name
}}</view>
<block v-for="(item, index) in res.values">
<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>
<text style="display: flex; justify-content: flex-end; color: #969799; font-size: 12px;">
x{{ item.number }}
</text>
</view>
<text style="display: flex; justify-content: flex-end; color: #969799; font-size: 12px;">
x{{ item.number }}
</text>
</view>
</view>
<u-line v-if="detailData.length > 1" color="#e8e8e8" />
<u-line v-if="res.values.length >= 1" color="#e8e8e8" />
</block>
</view>
</block>
<view class="content-footer">
......@@ -37,18 +42,13 @@
</view>
</view>
<view style="height: 100rpx;"></view>
<view class="footer">
<text>商品总价:¥{{ totlePirce }}</text>
<text>含税商品总价:¥{{ taxTotlePirce }}</text>
</view>
</template>
<script setup lang="ts">
import { ref, computed } from 'vue';
import { ref } from 'vue';
import { onLoad, onBackPress } from '@dcloudio/uni-app';
import { orderDetail } from '@/api/index';
import { quotationInit } from '@/api/cart';
import { getProductLineIndex } from '@/api/productLine';
import { getProductLineMultipleDetail } from '@/api/productLine';
import { useStore } from '@/store/useStore';
import config from '@/utils/config';
......@@ -58,7 +58,6 @@ let enclosure = ref(''); // pdf key值
let detailData = ref([] as any);
let type = ref();
let orderId = ref();
let tax = ref(0); // 税率
onLoad((options: any) => {
type.value = options.type;
......@@ -82,29 +81,10 @@ let toIndex = () => {
// 生成报价
let generateQuote = () => {
uni.navigateTo({
url: `../order/quotation?orderId=${orderId.value}&lineId=${lineId.value}`,
url: `../order/quotation?orderId=${orderId.value}&lineId=${0}`,
});
};
// 总价格
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) * tax.value * 0.01;
return Number(taxTotlePic).toFixed(2);
});
// 下载技术规格书pdf
let download = () => {
open(baseUrl + '/wx/storage/downloadFile/' + enclosure.value)
......@@ -134,37 +114,44 @@ let download = () => {
// });
};
let initQuotationInit = (orderId: number) => {
quotationInit({ orderId }).then((res: any) => {
console.log(res, '产品线');
});
};
let lineId = ref();
let lineNames = ref([] as any)
// 获取goodsId
let initOrderData = (orderId: number) => {
orderDetail({ orderId }).then((res: any) => {
if (res.data.code === 200) {
enclosure.value = res.data.data.orderInfo.enclosure;
let lineArr = [] as any
res.data.data.orderGoods.map((item: any, i: number) => {
if (res.data.data.orderGoods.length - 1 === i) {
lineId.value = item.goodsId;
initProductLineIndex(item.goodsId);
if (item.goodsId) {
lineArr.push(item.goodsId)
lineNames.value.push({
id: item.goodsId,
name: item.goodsName
})
}
});
initProductLineMultipleDetail(lineArr)
}
});
};
// 通过goodsId查询产品线数据
let initProductLineIndex = (lineId: number) => {
getProductLineIndex({ lineId }).then((res: any) => {
let initProductLineMultipleDetail = (lineArr: []) => {
getProductLineMultipleDetail(lineArr).then((res: any) => {
if (res.data.code === 200) {
detailData.value = [...res.data.data.cartList, ...detailData.value];
console.log(res, 'lineId');
for (const key in res.data.data) {
lineNames.value.map((item: any) => {
if (key == item.id) {
detailData.value.push({
name: item.name,
values: res.data.data[key]
})
}
})
}
// console.log(detailData.value, 'getProductLineMultipleDetail', lineNames.value);
}
});
};
})
}
// 通过type判断返回页面
onBackPress((options: any) => {
......@@ -207,7 +194,7 @@ onBackPress((options: any) => {
.container {
box-sizing: border-box;
margin: 16rpx 32rpx;
background-color: #fff;
// background-color: #fff;
.details {
width: 100%;
......@@ -216,6 +203,7 @@ onBackPress((options: any) => {
flex-direction: row;
justify-content: flex-start;
align-items: center;
background-color: #fff;
.img {
margin-right: 20rpx;
......@@ -240,12 +228,13 @@ onBackPress((options: any) => {
}
.content-footer {
margin-top: 50rpx;
// margin-top: 50rpx;
padding: 50rpx;
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
background-color: #fff;
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论