Commit 5aa89ee9 authored by Facius's avatar Facius

feat: 报价接口更换

parent a0c9a3cc
Pipeline #6461 canceled with stages
......@@ -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) {
return request({
url: `/rest/anno/offer/getOffer`,
......@@ -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) {
return request({
url: `/rest/offer/getOffer/${data}`,
......
......@@ -55,7 +55,7 @@
<script>
import QuotedPriceTips from '../components/quoted-price-tips.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 {
components: {
QuotedPriceTips,
......@@ -97,7 +97,8 @@ export default {
/* 等待滚动区域初始化完成 */
this.initScrollView().then(() => {
/* 获取列表数据,你的代码从此处开始 */
this.getList();
// this.getList();
this.getBrandV3()
});
}, 100);
},
......@@ -133,27 +134,41 @@ export default {
}).exec();
});
},
/* 获取列表数据 */
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(() => {
getBrandV3() {
getBrandV3().then((res)=> {
if (res.data) {
this.leftArray = res.data
this.mainArray = res.data
this.$nextTick(()=>{
this.getElementTop();
// }, 200);
})
} catch (e) {
console.log(e);
//TODO handle the exception
}
}
}).catch((err)=>{
console.log(err);
})
},
/* 获取列表数据 */
// 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() {
new Promise((resolve, reject) => {
......
<template>
<view class="collapse-body">
<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">
<text class="collapse-body-bottom-price">
<text>¥</text>
<text>{{ detail.chargeStandard }}{{detail.unit}}</text>
<text>{{ detail.chargeStandard }}{{unitText}}</text>
</text>
<view class="collapse-body-bottom-add">
<zb-tooltip placement="top-end" ref="tooltip1" color="#7f7f7f" :visible.sync="showTips">
......@@ -53,7 +53,11 @@ export default {
num: 0
};
},
computed:{
unitText() {
return this.detail && this.detail.unit.indexOf('\/') != -1 ? this.detail.unit : '\/' + this.detail.unit
}
},
watch: {
detail: {
handler(val, old) {
......
......@@ -59,7 +59,7 @@
<view class="">
<collapse-body
:detail="item3"
:parentTitle="item2.classBProject"
:parentTitle="item2.classB"
@add="addPrice"
v-for="(item3, index3) in item2.children"
:key="item3.classC"
......@@ -67,7 +67,7 @@
</view>
<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">
<text>¥</text>
<text>{{ item2.chargeStandard }}</text>
......@@ -97,7 +97,7 @@ import CollapseBody from './components/collapse-body.vue';
import ShoppingCart from './components/shopping-cart.vue';
import CartPopup from './components/cart-popup.vue';
import { mapGetters } from 'vuex';
import { getOffer } from '@/api/bill/quoted-price.js';
import { getOffer,getOfferV3 } from '@/api/bill/quoted-price.js';
export default {
components: { NoData,QuotedPriceCrumbs, UniCollapse, UniCollapseItem, QuotedPriceTips, CollapseBody, ShoppingCart, CartPopup },
data() {
......@@ -158,7 +158,8 @@ export default {
/* 等待滚动区域初始化完成 */
this.initScrollView().then(() => {
/* 获取列表数据,你的代码从此处开始 */
this.getListData();
// this.getListData();
this.getOfferV3()
});
}, 100);
},
......@@ -274,71 +275,89 @@ export default {
const res = new Map();
return arr.filter(item => !res.has(item[uniId]) && res.set(item[uniId], 1));
},
/* 获取列表数据 */
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);
}
getOfferV3() {
getOfferV3(this.form).then((res)=> {
if (res.data) {
for (var info of res.data) {
for (var item of info.children) {
item.open = false
}
});
});
// 第二层去重
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];
} catch (e) {
console.log(e);
//TODO handle the exception
}
this.loaded=true
}
}).catch((err)=>{
console.log(err);
})
},
/* 获取列表数据 */
// 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) {
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