Commit 5aa89ee9 authored by Facius's avatar Facius

feat: 报价接口更换

parent a0c9a3cc
Pipeline #6461 canceled with stages
...@@ -7,6 +7,14 @@ export function getBrand(data) { ...@@ -7,6 +7,14 @@ export function getBrand(data) {
}) })
} }
export async function getBrandV3(data) {
return request({
url: `/rest/anno/offer/v3/getProductInfo`,
method: 'GET',
data
})
}
export function getOffer(data) { export function getOffer(data) {
return request({ return request({
url: `/rest/anno/offer/getOffer`, url: `/rest/anno/offer/getOffer`,
...@@ -15,6 +23,14 @@ export function getOffer(data) { ...@@ -15,6 +23,14 @@ export function getOffer(data) {
}) })
} }
export async function getOfferV3(data) {
return request({
url: `/rest/anno/offer/v3/getOffer`,
method: 'GET',
data
})
}
export function getCustomOffer(data) { export function getCustomOffer(data) {
return request({ return request({
url: `/rest/offer/getOffer/${data}`, url: `/rest/offer/getOffer/${data}`,
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
<script> <script>
import QuotedPriceTips from '../components/quoted-price-tips.vue'; import QuotedPriceTips from '../components/quoted-price-tips.vue';
import QuotedPriceCrumbs from '../components/quoted-price-crumbs.vue'; import QuotedPriceCrumbs from '../components/quoted-price-crumbs.vue';
import { getBrand } from '@/api/bill/quoted-price.js'; import { getBrand,getBrandV3 } from '@/api/bill/quoted-price.js';
export default { export default {
components: { components: {
QuotedPriceTips, QuotedPriceTips,
...@@ -97,7 +97,8 @@ export default { ...@@ -97,7 +97,8 @@ export default {
/* 等待滚动区域初始化完成 */ /* 等待滚动区域初始化完成 */
this.initScrollView().then(() => { this.initScrollView().then(() => {
/* 获取列表数据,你的代码从此处开始 */ /* 获取列表数据,你的代码从此处开始 */
this.getList(); // this.getList();
this.getBrandV3()
}); });
}, 100); }, 100);
}, },
...@@ -133,27 +134,41 @@ export default { ...@@ -133,27 +134,41 @@ export default {
}).exec(); }).exec();
}); });
}, },
/* 获取列表数据 */
async getList() { getBrandV3() {
try { getBrandV3().then((res)=> {
let res = await getBrand(); if (res.data) {
let { code, data, msg } = res; this.leftArray = res.data
// let index=data.findIndex(item=>item.brandCode===this.brandCode) this.mainArray = res.data
this.leftArray = data.productTypeDTOList; this.$nextTick(()=>{
this.mainArray = data.productTypeDTOList;
this.brandCode = data.brandCode;
// DOM 挂载后 再调用 getElementTop 获取高度的方法。
this.$nextTick(()=>{
// setTimeout(() => {
this.getElementTop(); this.getElementTop();
// }, 200);
}) })
}
} catch (e) { }).catch((err)=>{
console.log(e); console.log(err);
//TODO handle the exception })
}
}, },
/* 获取列表数据 */
// async getList() {
// try {
// let res = await getBrand();
// let { code, data, msg } = res;
// // let index=data.findIndex(item=>item.brandCode===this.brandCode)
// this.leftArray = data.productTypeDTOList;
// this.mainArray = data.productTypeDTOList;
// this.brandCode = data.brandCode;
// // DOM 挂载后 再调用 getElementTop 获取高度的方法。
// this.$nextTick(()=>{
// // setTimeout(() => {
// this.getElementTop();
// // }, 200);
// })
// } catch (e) {
// console.log(e);
// //TODO handle the exception
// }
// },
/* 获取元素顶部信息 */ /* 获取元素顶部信息 */
getElementTop() { getElementTop() {
new Promise((resolve, reject) => { new Promise((resolve, reject) => {
......
<template> <template>
<view class="collapse-body"> <view class="collapse-body">
<view class="collapse-body-title">{{detail.classCProject}}</view> <view class="collapse-body-title">{{detail.classCProject}}</view>
<view class="collapse-body-desc">{{detail.pubRemark}}</view> <view class="collapse-body-desc">{{detail.pubRemark || detail.chargeDesc}}</view>
<view class="collapse-body-bottom"> <view class="collapse-body-bottom">
<text class="collapse-body-bottom-price"> <text class="collapse-body-bottom-price">
<text>¥</text> <text>¥</text>
<text>{{ detail.chargeStandard }}{{detail.unit}}</text> <text>{{ detail.chargeStandard }}{{unitText}}</text>
</text> </text>
<view class="collapse-body-bottom-add"> <view class="collapse-body-bottom-add">
<zb-tooltip placement="top-end" ref="tooltip1" color="#7f7f7f" :visible.sync="showTips"> <zb-tooltip placement="top-end" ref="tooltip1" color="#7f7f7f" :visible.sync="showTips">
...@@ -53,7 +53,11 @@ export default { ...@@ -53,7 +53,11 @@ export default {
num: 0 num: 0
}; };
}, },
computed:{
unitText() {
return this.detail && this.detail.unit.indexOf('\/') != -1 ? this.detail.unit : '\/' + this.detail.unit
}
},
watch: { watch: {
detail: { detail: {
handler(val, old) { handler(val, old) {
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<view class=""> <view class="">
<collapse-body <collapse-body
:detail="item3" :detail="item3"
:parentTitle="item2.classBProject" :parentTitle="item2.classB"
@add="addPrice" @add="addPrice"
v-for="(item3, index3) in item2.children" v-for="(item3, index3) in item2.children"
:key="item3.classC" :key="item3.classC"
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
</view> </view>
<view class="collapse-title" slot="title"> <view class="collapse-title" slot="title">
<view class="collapse-title-left">{{ item2.classBProject }}</view> <view class="collapse-title-left">{{ item2.classB }}</view>
<view class="collapse-title-right"> <view class="collapse-title-right">
<text>¥</text> <text>¥</text>
<text>{{ item2.chargeStandard }}</text> <text>{{ item2.chargeStandard }}</text>
...@@ -97,7 +97,7 @@ import CollapseBody from './components/collapse-body.vue'; ...@@ -97,7 +97,7 @@ import CollapseBody from './components/collapse-body.vue';
import ShoppingCart from './components/shopping-cart.vue'; import ShoppingCart from './components/shopping-cart.vue';
import CartPopup from './components/cart-popup.vue'; import CartPopup from './components/cart-popup.vue';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { getOffer } from '@/api/bill/quoted-price.js'; import { getOffer,getOfferV3 } from '@/api/bill/quoted-price.js';
export default { export default {
components: { NoData,QuotedPriceCrumbs, UniCollapse, UniCollapseItem, QuotedPriceTips, CollapseBody, ShoppingCart, CartPopup }, components: { NoData,QuotedPriceCrumbs, UniCollapse, UniCollapseItem, QuotedPriceTips, CollapseBody, ShoppingCart, CartPopup },
data() { data() {
...@@ -158,7 +158,8 @@ export default { ...@@ -158,7 +158,8 @@ export default {
/* 等待滚动区域初始化完成 */ /* 等待滚动区域初始化完成 */
this.initScrollView().then(() => { this.initScrollView().then(() => {
/* 获取列表数据,你的代码从此处开始 */ /* 获取列表数据,你的代码从此处开始 */
this.getListData(); // this.getListData();
this.getOfferV3()
}); });
}, 100); }, 100);
}, },
...@@ -274,71 +275,89 @@ export default { ...@@ -274,71 +275,89 @@ export default {
const res = new Map(); const res = new Map();
return arr.filter(item => !res.has(item[uniId]) && res.set(item[uniId], 1)); return arr.filter(item => !res.has(item[uniId]) && res.set(item[uniId], 1));
}, },
/* 获取列表数据 */ getOfferV3() {
async getListData() { getOfferV3(this.form).then((res)=> {
try { if (res.data) {
let res = await getOffer(this.form); for (var info of res.data) {
let { code, data, msg } = res; for (var item of info.children) {
//第一层 item.open = false
let newList = JSON.parse(JSON.stringify(data));
// 去重
newList = this.uniqueFunc(newList, 'classA');
// 移除 "备件费"
newList.splice(newList.findIndex(item => item.classA === 'T12'), 1);
// 左侧列表赋值
// this.leftArray = this.deepClone(newList);
this.leftArray = JSON.parse(JSON.stringify(newList));
// 第二层
newList.map(el => {
el.id=el.classC
data.map((item, index) => {
if (item.classA === el.classA) {
// let item1 = this.deepClone(item);
let item1 = JSON.parse(JSON.stringify(item));
item1.open = false;
if (!el.children) {
el.children = [item1];
} else {
el.children.push(item1);
}
} }
}); }
});
// 第二层去重
newList = newList.map(item => {
// let arr = this.deepClone(item.children);
let arr = JSON.parse(JSON.stringify(item.children));
item.children = this.uniqueFunc(arr, 'classB');
return item;
});
// 第三层
newList.map(el => {
el.children.map(el2 => {
data.map((item, index) => {
if (item.classB === el2.classB) {
// let item1 = this.deepClone(item);
let item1 = JSON.parse(JSON.stringify(item));
item1.num = 0;
item1.id=item1.classC
if (!el2.children) {
el2.children = [{...item1}];
} else {
el2.children.push({...item1});
}
}
});
});
});
// 总列表赋值 // 总列表赋值
this.totalArray = newList; this.leftArray = res.data
this.totalArray = res.data;
// 右侧列表赋值 // 右侧列表赋值
this.mainData = this.totalArray[this.leftIndex]; this.mainData = this.totalArray[this.leftIndex];
} catch (e) { }
console.log(e); }).catch((err)=>{
//TODO handle the exception console.log(err);
} })
this.loaded=true
}, },
/* 获取列表数据 */
// async getListData() {
// try {
// let res = await getOffer(this.form);
// let { code, data, msg } = res;
// //第一层
// let newList = JSON.parse(JSON.stringify(data));
// // 去重
// newList = this.uniqueFunc(newList, 'classA');
// // 移除 "备件费"
// newList.splice(newList.findIndex(item => item.classA === 'T12'), 1);
// // 左侧列表赋值
// // this.leftArray = this.deepClone(newList);
// this.leftArray = JSON.parse(JSON.stringify(newList));
// // 第二层
// newList.map(el => {
// el.id=el.classC
// data.map((item, index) => {
// if (item.classA === el.classA) {
// // let item1 = this.deepClone(item);
// let item1 = JSON.parse(JSON.stringify(item));
// item1.open = false;
// if (!el.children) {
// el.children = [item1];
// } else {
// el.children.push(item1);
// }
// }
// });
// });
// // 第二层去重
// newList = newList.map(item => {
// // let arr = this.deepClone(item.children);
// let arr = JSON.parse(JSON.stringify(item.children));
// item.children = this.uniqueFunc(arr, 'classB');
// return item;
// });
// // 第三层
// newList.map(el => {
// el.children.map(el2 => {
// data.map((item, index) => {
// if (item.classB === el2.classB) {
// // let item1 = this.deepClone(item);
// let item1 = JSON.parse(JSON.stringify(item));
// item1.num = 0;
// item1.id=item1.classC
// if (!el2.children) {
// el2.children = [{...item1}];
// } else {
// el2.children.push({...item1});
// }
// }
// });
// });
// });
// // 总列表赋值
// this.totalArray = newList;
// // 右侧列表赋值
// this.mainData = this.totalArray[this.leftIndex];
// } catch (e) {
// console.log(e);
// //TODO handle the exception
// }
// this.loaded=true
// },
/* 左侧导航点击 */ /* 左侧导航点击 */
leftTap(item, index) { leftTap(item, index) {
this.leftIndex = index; this.leftIndex = index;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment