|
|
@@ -0,0 +1,217 @@
|
|
|
+const _Http = getApp().globalData.http,
|
|
|
+ currency = require("../../utils/currency"),
|
|
|
+ CNY = (value, symbol = "¥", precision = 2) => currency(value, {
|
|
|
+ symbol,
|
|
|
+ precision
|
|
|
+ }).format();
|
|
|
+
|
|
|
+import * as echarts from '../ec-canvas/echarts';
|
|
|
+Component({
|
|
|
+ properties: {
|
|
|
+
|
|
|
+ },
|
|
|
+ options: {
|
|
|
+ addGlobalClass: true
|
|
|
+ },
|
|
|
+ lifetimes: {
|
|
|
+ attached: function () {
|
|
|
+ getApp().globalData.Language.getLanguagePackage(this)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ data: {
|
|
|
+ "content": {
|
|
|
+ dataid: wx.getStorageSync('userMsg').userid,
|
|
|
+ username: wx.getStorageSync('userMsg').name,
|
|
|
+ enddate: new Date().toISOString().split('T')[0],
|
|
|
+ where: {}
|
|
|
+ },
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ async getList(init = false) {
|
|
|
+ let content = this.data.content
|
|
|
+ const {
|
|
|
+ dataid,
|
|
|
+ type,
|
|
|
+ username,
|
|
|
+ isleave
|
|
|
+ } = getCurrentPages()[getCurrentPages().length - 1].data;
|
|
|
+ if (content.dataid != dataid || content.type != type || isleave != isleave) init = true
|
|
|
+ content.dataid = dataid;
|
|
|
+ content.type = type;
|
|
|
+ content.username = username;
|
|
|
+ content.where.isleave = isleave;
|
|
|
+ let dividend = wx.getStorageSync('languagecode') == 'ZH' ? 10000 : 1000,
|
|
|
+ getMapText = getApp().globalData.Language.getMapText;
|
|
|
+
|
|
|
+ _Http.basic({
|
|
|
+ "id": 20231011201004,
|
|
|
+ content
|
|
|
+ }).then(res => {
|
|
|
+ console.log("报价分析", res)
|
|
|
+ if (res.code != '1') return wx.showToast({
|
|
|
+ title: res.data,
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ this.setData({
|
|
|
+ list: [{
|
|
|
+ name: getMapText("报价总次数"),
|
|
|
+ value: res.data.totalqty
|
|
|
+ }, {
|
|
|
+ name: getMapText("客户报价次数"),
|
|
|
+ text: getMapText("客户报价总次数"),
|
|
|
+ value: res.data.cusqty
|
|
|
+ }, {
|
|
|
+ name: getMapText("项目报价次数"),
|
|
|
+ text: getMapText("客户报价总次数"),
|
|
|
+ value: res.data.proqty
|
|
|
+ }, {
|
|
|
+ name: getMapText("报价总金额"),
|
|
|
+ value: CNY(res.data.totalamount >= dividend ? (res.data.totalamount / dividend) : res.data.totalamount),
|
|
|
+ suffix: res.data.totalamount >= dividend ? getMapText("万") : ""
|
|
|
+ }, {
|
|
|
+ name: getMapText("客户报价金额"),
|
|
|
+ value: CNY(res.data.cusamount >= dividend ? (res.data.cusamount / dividend) : res.data.cusamount),
|
|
|
+ suffix: res.data.cusamount >= dividend ? getMapText("万") : ""
|
|
|
+ }, {
|
|
|
+ name: getMapText("项目报价金额"),
|
|
|
+ value: CNY(res.data.proamount >= dividend ? (res.data.proamount / dividend) : res.data.proamount),
|
|
|
+ suffix: res.data.proamount >= dividend ? getMapText("万") : ""
|
|
|
+ }]
|
|
|
+ })
|
|
|
+ })
|
|
|
+
|
|
|
+ _Http.basic({
|
|
|
+ "id": 20231011154704,
|
|
|
+ content
|
|
|
+ }).then(res => {
|
|
|
+ console.log("报价分析图表", res)
|
|
|
+ if (res.code != '1') return wx.showToast({
|
|
|
+ title: res.data,
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+
|
|
|
+ })
|
|
|
+ },
|
|
|
+ initChart(data) {
|
|
|
+ const dividend = wx.getStorageSync('languagecode') == 'ZH' ? 10000 : 1000,
|
|
|
+ colors = ['#6CD2A1', '#5F9DFC', '#ECB937'],
|
|
|
+ getMapText = getApp().globalData.Language.getMapText;
|
|
|
+ const option = {
|
|
|
+ color: colors,
|
|
|
+ tooltip: {
|
|
|
+ trigger: 'axis',
|
|
|
+ },
|
|
|
+ legend: {
|
|
|
+ data: [`${getMapText('去年同期金额')}(${getMapText('万元')})`, `${getMapText('本期金额')}(${getMapText('万元')})`, `${getMapText('同比增长率')}`],
|
|
|
+ },
|
|
|
+ xAxis: [{
|
|
|
+ type: 'category',
|
|
|
+ axisTick: {
|
|
|
+ alignWithLabel: true
|
|
|
+ },
|
|
|
+ data: data.tbzzl.map(v => v.date),
|
|
|
+ axisLabel: {
|
|
|
+ interval: 0,
|
|
|
+ rotate: 45
|
|
|
+ }
|
|
|
+ }],
|
|
|
+ yAxis: [{
|
|
|
+ type: 'value',
|
|
|
+ name: '',
|
|
|
+ position: 'right',
|
|
|
+ offset: 80,
|
|
|
+ alignTicks: true,
|
|
|
+ axisLine: {
|
|
|
+ show: true,
|
|
|
+ },
|
|
|
+ axisLabel: {
|
|
|
+ formatter: '{value}'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: 'value',
|
|
|
+ name: '',
|
|
|
+ position: 'left',
|
|
|
+ alignTicks: true,
|
|
|
+ axisLine: {
|
|
|
+ show: false,
|
|
|
+ },
|
|
|
+ axisLabel: {
|
|
|
+ formatter: '{value}',
|
|
|
+ rotate: 45
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: 'value',
|
|
|
+ name: '',
|
|
|
+ position: 'right',
|
|
|
+ alignTicks: true,
|
|
|
+ offset: 80,
|
|
|
+ axisLine: {
|
|
|
+ show: false,
|
|
|
+ lineStyle: {
|
|
|
+ color: colors[1]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ axisLabel: {
|
|
|
+ formatter: '{value}'
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ ],
|
|
|
+ dataZoom: [{
|
|
|
+ type: 'slider',
|
|
|
+ show: true,
|
|
|
+ xAxisIndex: 0,
|
|
|
+ start: 0,
|
|
|
+ end: 100
|
|
|
+ }],
|
|
|
+ series: [{
|
|
|
+ name: `${getMapText('去年同期金额')}(${getMapText('万元')})`,
|
|
|
+ type: 'bar',
|
|
|
+ data: data.balance.filter(v => v.name == '去年同期金额').map(v => (v.value / dividend).toFixed(2)),
|
|
|
+ smooth: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: `${getMapText('本期金额')}(${getMapText('万元')})`,
|
|
|
+ type: 'bar',
|
|
|
+ yAxisIndex: 1,
|
|
|
+ data: data.balance.filter(v => v.name == '本年金额').map(v => (v.value / dividend).toFixed(2)),
|
|
|
+ smooth: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: getMapText('同比增长率'),
|
|
|
+ type: 'line',
|
|
|
+ yAxisIndex: 2,
|
|
|
+ data: data.tbzzl.map(v => (v.value * 100).toFixed(2)),
|
|
|
+ smooth: true
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ };
|
|
|
+ this.chartComponent = this.selectComponent('#mychart');
|
|
|
+ this.chartComponent.init((canvas, width, height, dpr) => {
|
|
|
+ const chart = echarts.init(canvas, null, {
|
|
|
+ width,
|
|
|
+ height,
|
|
|
+ devicePixelRatio: dpr
|
|
|
+ });
|
|
|
+ chart.setOption(option);
|
|
|
+ return chart;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ changeDate({
|
|
|
+ detail
|
|
|
+ }) {
|
|
|
+ this.setData({
|
|
|
+ "content.enddate": detail
|
|
|
+ })
|
|
|
+ this.getList(true)
|
|
|
+ },
|
|
|
+ showExplain(e) {
|
|
|
+ const {
|
|
|
+ name
|
|
|
+ } = e.currentTarget.dataset;
|
|
|
+ getApp().globalData.Language.modeBoxPrompts(getApp().globalData.Language.getMapText('统计到当前查询时间为止的') + name + "(" + getApp().globalData.Language.getMapText('审核状态')) + ")"
|
|
|
+ },
|
|
|
+ }
|
|
|
+})
|