|
|
@@ -0,0 +1,147 @@
|
|
|
+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,
|
|
|
+ unwriteoffamounttype: "订单",
|
|
|
+ where: {}
|
|
|
+ },
|
|
|
+ pages: {
|
|
|
+ pageNumber: 1,
|
|
|
+ pageTotal: 1,
|
|
|
+ pageSize: 20
|
|
|
+ },
|
|
|
+ list: []
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ async getList(init = false) {
|
|
|
+ if (init.detail != undefined) init = init.detail;
|
|
|
+ let content = this.data.content,
|
|
|
+ pages = this.data.pages;
|
|
|
+ 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;
|
|
|
+ if (init) {
|
|
|
+ pages.pageNumber = 1;
|
|
|
+ pages.pageTotal = 1;
|
|
|
+ }
|
|
|
+ if (pages.pageNumber <= pages.pageTotal) _Http.basic({
|
|
|
+ "id": 20231016163904,
|
|
|
+ content: Object.assign(content, pages)
|
|
|
+ }).then(res => {
|
|
|
+ console.log("出货未开票分析", res)
|
|
|
+ this.selectComponent('#ListBox').RefreshToComplete();
|
|
|
+ if (res.code != '1') return wx.showToast({
|
|
|
+ title: res.data,
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ res.data = res.data.map(v => {
|
|
|
+ v.zerotothree = CNY(v.zerotothree)
|
|
|
+ v.threetosix = CNY(v.threetosix)
|
|
|
+ v.sixtotwelve = CNY(v.sixtotwelve)
|
|
|
+ v.twelveup = CNY(v.twelveup)
|
|
|
+ v.total = CNY(v.total)
|
|
|
+ return v
|
|
|
+ })
|
|
|
+ pages.pageNumber++;
|
|
|
+ pages.pageTotal = res.pageTotal;
|
|
|
+ this.setData({
|
|
|
+ list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
|
|
|
+ pages
|
|
|
+ })
|
|
|
+ if (init) this.initChart(res.data[0].Trend)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ toDetail(e) {
|
|
|
+ let content = this.data.content;
|
|
|
+ content.sys_enterpriseid = e.currentTarget.dataset.item.sys_enterpriseid;
|
|
|
+ content.enterprisename = e.currentTarget.dataset.item.enterprisename;
|
|
|
+ wx.navigateTo({
|
|
|
+ url: '/salesPanel/AnalysisOfUninvoicedShipments/detail?content=' + JSON.stringify(content)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ initChart(data) {
|
|
|
+ console.log("data", data)
|
|
|
+ let dividend = wx.getStorageSync('languagecode') == 'ZH' ? 10000 : 1000;
|
|
|
+ let series = data.map(item => ({
|
|
|
+ name: getApp().globalData.Language.getMapText(item.key),
|
|
|
+ type: 'bar',
|
|
|
+ stack: 'total',
|
|
|
+ label: {
|
|
|
+ show: true
|
|
|
+ },
|
|
|
+ emphasis: {
|
|
|
+ focus: 'series'
|
|
|
+ },
|
|
|
+ itemStyle: {
|
|
|
+ color: "#5F9DFC"
|
|
|
+ },
|
|
|
+ data: (item.value / dividend).toFixed(2)
|
|
|
+ }));
|
|
|
+ console.log("series", series)
|
|
|
+ let option = {
|
|
|
+ legend: {
|
|
|
+ data: [getApp().globalData.Language.getMapText('出货未开票金额') + '(' + getApp().globalData.Language.getMapText('万元') + ')']
|
|
|
+ },
|
|
|
+ grid: {
|
|
|
+ left: '3%',
|
|
|
+ right: '4%',
|
|
|
+ bottom: '3%',
|
|
|
+ containLabel: true
|
|
|
+ },
|
|
|
+ xAxis: {
|
|
|
+ type: 'value'
|
|
|
+ },
|
|
|
+ yAxis: {
|
|
|
+ type: 'category',
|
|
|
+ data: data.map(v => getApp().globalData.Language.getMapText(v.key))
|
|
|
+ },
|
|
|
+ series
|
|
|
+ };
|
|
|
+ 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;
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ showExplain(e) {
|
|
|
+ const {
|
|
|
+ name
|
|
|
+ } = e.currentTarget.dataset;
|
|
|
+ getApp().globalData.Language.modeBoxPrompts(getApp().globalData.Language.getMapText('统计到当前查询时间为止的') + name + "(" + getApp().globalData.Language.getMapText('审核状态') + ")")
|
|
|
+ },
|
|
|
+ }
|
|
|
+})
|