From d78ab31401d89eea7c8b15dc47b588f6156736f4 Mon Sep 17 00:00:00 2001 From: 1191151619 <1191151619@qq.com> Date: Thu, 29 Jul 2021 18:31:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=B5=8B=E7=AE=97=E3=80=81?= =?UTF-8?q?=E6=97=A5=E5=8E=86=E3=80=81=E5=88=97=E8=A1=A8=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/detail-basis/detail-basis.js | 4 + components/detail-basis/detail-basis.wxml | 2 +- components/ec-canvas/ec-canvas.js | 13 +- components/ui-calendar/ui-calendar.wxml | 2 +- .../calculation-detail/calculation-detail.js | 198 +++++++++++------- .../calculation-detail.wxml | 13 +- pages/calendar/calendar.js | 10 +- pages/calendar/calendar.wxml | 2 + pages/history/history.js | 15 +- pages/history/history.wxml | 9 +- pages/look-detail/look-detail.wxml | 4 +- pages/look-list/look-list.js | 40 +++- pages/look-list/look-list.wxml | 20 +- pages/look-list/look-list.wxss | 10 +- project.private.config.json | 12 ++ utils/api.js | 2 +- 16 files changed, 246 insertions(+), 110 deletions(-) diff --git a/components/detail-basis/detail-basis.js b/components/detail-basis/detail-basis.js index 798f5d5..e3ccfb3 100644 --- a/components/detail-basis/detail-basis.js +++ b/components/detail-basis/detail-basis.js @@ -128,6 +128,8 @@ Component({ 'rowData[0].AllPrice':parseFloat(this.data.dataInfo.transferPrice).toFixed(3), 'rowData[1].AllPrice':parseFloat(this.data.dataInfo.transferPrice).toFixed(3), }) + + console.log(this.data.priceData); if(this.data.orgiData&&this.data.orgiData.measureType===0){ let data=JSON.parse(JSON.stringify(this.data.orgiData)) this.data.measureDataId=data.measureDataId @@ -193,6 +195,7 @@ Component({ // 测算 calculate(){ let table=this.selectComponent('#table'); + console.log(table.data.myData) if(table.data.myData){ this.setData({ 'priceData.forecastFloorPrice':table.data.myData @@ -204,6 +207,7 @@ Component({ 'priceData.forecastFloorPrice':this.data.measureData.forecastFloorPrice }) } + console.log(this.data.priceData); for(let key in this.data.priceData){ if(!this.data.priceData[key]){ wx.showToast({ diff --git a/components/detail-basis/detail-basis.wxml b/components/detail-basis/detail-basis.wxml index aacab11..fa4c6d0 100644 --- a/components/detail-basis/detail-basis.wxml +++ b/components/detail-basis/detail-basis.wxml @@ -20,7 +20,7 @@ 车位定价: - 元/m + 元/个 diff --git a/components/ec-canvas/ec-canvas.js b/components/ec-canvas/ec-canvas.js index 37ff834..f6e35c2 100644 --- a/components/ec-canvas/ec-canvas.js +++ b/components/ec-canvas/ec-canvas.js @@ -50,8 +50,15 @@ Component({ }, ready: function () { - // Disable prograssive because drawImage doesn't support DOM as parameter + + }, + + methods: { + initFun(){ + // Disable prograssive because drawImage doesn't support DOM as parameter // See https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.drawImage.html + console.log('------------') + console.log(this.data.ec) echarts.registerPreprocessor(option => { if (option && option.series) { if (option.series.length > 0) { @@ -74,9 +81,7 @@ Component({ if (!this.data.ec.lazyLoad) { this.init(); } - }, - - methods: { + }, init: function (callback) { const version = wx.getSystemInfoSync().SDKVersion diff --git a/components/ui-calendar/ui-calendar.wxml b/components/ui-calendar/ui-calendar.wxml index 5f02c42..53956ed 100644 --- a/components/ui-calendar/ui-calendar.wxml +++ b/components/ui-calendar/ui-calendar.wxml @@ -62,7 +62,7 @@ var changedMonth = parseInt(timer[1])-1 var my_month = parseInt(timer[1]) return { - str_month: monthClapFn(changedYear, changedMonth) + str_month: monthClapFn(changedYear, changedMonth), date: getDate(changedYear, changedMonth), year: changedYear, month: changedMonth, diff --git a/pages/calculation-detail/calculation-detail.js b/pages/calculation-detail/calculation-detail.js index d079aaa..ea932eb 100644 --- a/pages/calculation-detail/calculation-detail.js +++ b/pages/calculation-detail/calculation-detail.js @@ -2,7 +2,70 @@ import * as echarts from '../../components/ec-canvas/echarts'; const app = getApp(); +const $api = require('../../utils/api').API; + +var option = { + title: { + text: '我的预测与成交溢价率的差异', + left: 'center' + }, + legend: { + data: ['溢价率差异', '平均差异', '我的净利率'], + bottom: 50, + left: 'center', + z: 100 + }, + grid: { + containLabel: true + }, + tooltip: { + show: true, + trigger: 'axis' + }, + xAxis: { + type: 'category', + boundaryGap: false, + data: ['21001', '21002', '21003', '21004', '21005', '21006', '21007', '21008', '21009', '210010'], + show: false + }, + yAxis: { + x: 'center', + type: 'value', + position: 'right', + offset: 5, + axisLabel: { + formatter: '{value}.00%' + } + }, + series: [{ + name: '溢价率差异', + type: 'bar', + smooth: true, + data: [], + itemStyle: { + color: '#9BBB59' + } + }, { + name: '平均差异', + type: 'line', + data: [], + showSymbol: false, + lineStyle: { + color: '#76589B', + width: 5 + } + }, { + name: '我的净利率', + type: 'line', + showSymbol: false, + data: [], + lineStyle: { + color: '#4BACC6', + width: 5 + } + }] +}; function initChart(canvas, width, height, dpr) { const chart = echarts.init(canvas, null, { width: width, @@ -11,67 +74,7 @@ function initChart(canvas, width, height, dpr) { }); canvas.setChart(chart); - var option = { - title: { - text: '我的预测与成交溢价率的差异', - left: 'center' - }, - legend: { - data: ['溢价率差异', '平均差异', '我的净利率'], - bottom: 50, - left: 'center', - z: 100 - }, - grid: { - containLabel: true - }, - tooltip: { - show: true, - trigger: 'axis' - }, - xAxis: { - type: 'category', - boundaryGap: false, - data: ['21001', '21002', '21003', '21004', '21005', '21006', '21007', '21008', '21009', '210010'], - show: false - }, - yAxis: { - x: 'center', - type: 'value', - position: 'right', - offset: 5, - axisLabel: { - formatter: '{value}.00%' - } - }, - series: [{ - name: '溢价率差异', - type: 'bar', - smooth: true, - data: [17, 19, -16, -2, 8, 10, 5, 3, 2, 6], - itemStyle: { - color: '#9BBB59' - } - }, { - name: '平均差异', - type: 'line', - data: [3, 11, 13, -2, 8, 16, 3, 3, 2, 6], - showSymbol: false, - lineStyle: { - color: '#76589B', - width: 5 - } - }, { - name: '我的净利率', - type: 'line', - showSymbol: false, - data: [17, 19, -16, -2, 8, 10, 5, 3, 2, 6], - lineStyle: { - color: '#4BACC6', - width: 5 - } - }] - }; + chart.setOption(option); return chart; @@ -82,26 +85,77 @@ Page({ return { title: 'ECharts 可以在微信小程序中使用啦!', path: '/pages/index/index', - success: function () {}, - fail: function () {} + success: function () { }, + fail: function () { } } }, data: { ec: { - onInit: initChart - } + onInit: {}, + }, + totle: 0, + precision: 0, + error: 0, + + }, + // 测算结果统计 + getStatistics() { + $api.AJAX("GET", '/applets/measuredata/statistics', {}, true).then(res => { + this.setData({ + totle: res.data.totle, + precision: res.data.precision, + error: res.data.error, + }) + }) }, + // 测算趋势统计 + getTrend() { + console.log(option); + let premiumSpread = option.series[0].data; + let average = option.series[1].data; + let interestRate = option.series[2].data; + + $api.AJAX("GET", '/applets/measuredata/trend', {}, true).then(res => { + res.data.map(liem => { + average.push( + liem.average + ) + interestRate.push( + liem.interestRate + ) + premiumSpread.push( + liem.premiumSpread + ) + }) + option.series[0].data = premiumSpread; + option.series[1].data = average; + option.series[2].data = interestRate; - onShow(){ + this.setData({ + ['ec.onInit']: initChart + }) + this.instance(); + }) + }, + + instance() {//实例图表 + console.log('实例图表') + let myComponent = this.selectComponent('#mychart-dom-line'); + console.log(myComponent) + myComponent.initFun() // 调用自定义组件中的方法 + }, + onShow() { if (typeof this.getTabBar === 'function' && - this.getTabBar()) { - this.getTabBar().setData({ - selected: 3 - }) - } + this.getTabBar()) { + this.getTabBar().setData({ + selected: 3 + }) + } + this.getStatistics(); + this.getTrend(); }, - comeHistory(){ + comeHistory() { wx.navigateTo({ url: '../../pages/history/history', }) diff --git a/pages/calculation-detail/calculation-detail.wxml b/pages/calculation-detail/calculation-detail.wxml index f1217fb..138c440 100644 --- a/pages/calculation-detail/calculation-detail.wxml +++ b/pages/calculation-detail/calculation-detail.wxml @@ -2,33 +2,33 @@ - + - 128 + {{totle}} 测算宗数 - 39% + {{precision}}% 准确率 - 2.43% + {{error}}% 预测误差 @@ -53,7 +53,8 @@ - + diff --git a/pages/calendar/calendar.js b/pages/calendar/calendar.js index e31f2f4..f174f1d 100644 --- a/pages/calendar/calendar.js +++ b/pages/calendar/calendar.js @@ -37,7 +37,9 @@ Page({ calendarSelectedDateStr: '', region: ["500000", "500100"], cityName: '重庆', - info: [] + info: [], + + statistics:{},//日历展示数据 }, bindDateChange(res) { @@ -130,6 +132,12 @@ Page({ selected: 0 }) } + // 获取日历列表数据 + $api.AJAX("GET",'/applets/landlisted/statistics',{ + date: moment().format('YYYY-MM') + },true).then(res=>{ + this.statistics = res.data; + }) }, // 日历点击跳转(请求接口获取列表数据) diff --git a/pages/calendar/calendar.wxml b/pages/calendar/calendar.wxml index d110328..b92a075 100644 --- a/pages/calendar/calendar.wxml +++ b/pages/calendar/calendar.wxml @@ -20,6 +20,8 @@ 当前选择 + + {{cityName}} diff --git a/pages/history/history.js b/pages/history/history.js index 6192a16..462476b 100644 --- a/pages/history/history.js +++ b/pages/history/history.js @@ -1,11 +1,13 @@ // pages/history/history.js +const $api = require('../../utils/api').API; + Page({ /** * 页面的初始数据 */ data: { - + list:null, }, /** @@ -14,6 +16,15 @@ Page({ onLoad: function (options) { }, + getList(){ + $api.AJAX("GET", '/applets/measuredata/page', { + + }, true).then(res => { + this.setData({ + list:res.data.records + }) + }) + }, /** * 生命周期函数--监听页面初次渲染完成 @@ -26,7 +37,7 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function () { - + this.getList(); }, /** diff --git a/pages/history/history.wxml b/pages/history/history.wxml index 32e39c1..27fc8f1 100644 --- a/pages/history/history.wxml +++ b/pages/history/history.wxml @@ -1,11 +1,14 @@ - + - CQ210003-九龙坡区大桥石区大桥石区大桥石S区十组245-2 + {{item.landCode}} - 测算日期:2021/01/01 + 测算日期:{{item.createDate}} + + + 暂无数据 diff --git a/pages/look-detail/look-detail.wxml b/pages/look-detail/look-detail.wxml index 5fef687..32aa10a 100644 --- a/pages/look-detail/look-detail.wxml +++ b/pages/look-detail/look-detail.wxml @@ -25,7 +25,7 @@ - + diff --git a/pages/look-list/look-list.js b/pages/look-list/look-list.js index d8f8370..6d1888f 100644 --- a/pages/look-list/look-list.js +++ b/pages/look-list/look-list.js @@ -20,7 +20,7 @@ Page({ current:1, startDate:'', endDate:'', - city:'', + city:'重庆', transactionStatus:'', measureStatus:'', landCode:'' @@ -37,8 +37,22 @@ Page({ saleList:[], calcuList:[], saleNum:null, - calcuNum:null + calcuNum:null, + + region: ["500000", "500100"], + }, + // 选择城市 + bindAddressChangeCity(res) { + let cityName = res.detail.value[1]; + + if (cityName) { + this.setData({ + ['page.city']:cityName + }) + }; + this.refresh() }, + changeRadio(e){ let type=e.currentTarget.dataset.type; switch (type){ @@ -85,7 +99,26 @@ Page({ onReady: function () { this.refresh() }, - + // 清空 + empty(e){ + let name = e.currentTarget.dataset.name; + if(name == 'time'){ + this.setData({ + ['page.startDate']:'', + ['page.endDate']:'', + }) + }else if(name == 'saleNum'){ + this.setData({ + ['page.transactionStatus']:'', + [name]:null + }) + }else{ + this.setData({ + [name]:null + }) + } + + }, tabDowm(e){ let active = e.currentTarget.dataset.id if(active===this.data.active){ @@ -205,6 +238,7 @@ Page({ }, showDown(e){ const _this=this; + console.log(this.data.searchNode) for(let key in this.data.searchNode){ if(this.data.searchNode[key].height>0){ this.setData({ diff --git a/pages/look-list/look-list.wxml b/pages/look-list/look-list.wxml index 3a181bf..e84b373 100644 --- a/pages/look-list/look-list.wxml +++ b/pages/look-list/look-list.wxml @@ -47,9 +47,11 @@ 测算状态 - - 城市 - + + + {{page.city}} + + @@ -72,7 +74,7 @@ - 清空 + 清空 确定 @@ -84,7 +86,7 @@ - 清空 + 清空 确定 @@ -96,7 +98,7 @@ - 清空 + 清空 确定 @@ -116,12 +118,12 @@ {{item.landCode}} - 计容建筑面积:{{item.totalConsArea}}m + 计容建筑面积:{{item.totalConsArea}}m 起始总价:{{item.transferPrice}}万 - 起始楼面价:{{item.startingFloorPrice}}元/m + 起始楼面价:{{item.startingFloorPrice}}元/m 竞拍时间:{{item.auctionDate}} - {{item.annoDate}} + diff --git a/pages/look-list/look-list.wxss b/pages/look-list/look-list.wxss index 1af956c..044c50d 100644 --- a/pages/look-list/look-list.wxss +++ b/pages/look-list/look-list.wxss @@ -51,7 +51,7 @@ .list-item { width: 690rpx; - height: 218rpx; + height: 180rpx; background: #FFFFFF; box-shadow: 0 2rpx 23rpx 0 rgba(191, 191, 191, 0.15); border-radius: 18rpx; @@ -64,8 +64,8 @@ } .item-img { - width: 166rpx; - height: 100%; + width: 120rpx; + height: 120rpx; } .item-right { @@ -106,9 +106,9 @@ } .detail-item { - width: 50%; + /* width: 100% !important; */ line-height: 36rpx; - font-size: 22rpx; + font-size: 20rpx; color: #565A6B; white-space: nowrap; } diff --git a/project.private.config.json b/project.private.config.json index 0b6efd3..26fa769 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -89,6 +89,18 @@ "pathName": "pages/ucenter/ucenter", "query": "", "scene": null + }, + { + "name": "测试统计", + "pathName": "pages/calculation-detail/calculation-detail", + "query": "", + "scene": null + }, + { + "name": "测算历史记录", + "pathName": "pages/history/history", + "query": "", + "scene": null } ] } diff --git a/utils/api.js b/utils/api.js index 984c151..d73b9b4 100644 --- a/utils/api.js +++ b/utils/api.js @@ -7,7 +7,7 @@ const FORM = 'FORM'; const DELETE = 'DELETE'; -function request(method, url, data,hasToke) { +function request(method, url, data,hasToke=true) { let token = wx.getStorageSync('access_token') let Authorization =token&&hasToke?`Bearer ${token}`:'Basic YXBwOmFwcA==';