| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- const _Http = getApp().globalData.http,
- currency = require("../../../utils/currency"),
- CNY = (value, symbol = "", precision = 2) => currency(value, {
- symbol,
- precision
- }).format();
- Component({
- options: {
- addGlobalClass: true,
- },
- properties: {
- update: {
- type: Function
- }
- },
- lifetimes: {
- attached: function () {
- getApp().globalData.Language.getLanguagePackage(this)
- this.setData({
- dates: this.data.dates.map(v => {
- v.name = getApp().globalData.Language.getMapText(v.value);
- v.color = v.value == this.data.content.dateType ? "#3874F6" : "";
- return v
- }),
- "content.dataid": wx.getStorageSync('userMsg').userid,
- "content.username": wx.getStorageSync('userMsg').name,
- })
- }
- },
- data: {
- "content": {
- dateType: "本年",
- type: 0,
- "where": {
- isleave: "1"
- }
- },
- detaShow: false,
- dates: [{
- value: "全部"
- }, {
- value: "本年"
- }, {
- value: "本季"
- }, {
- value: "本月"
- }, {
- value: "上月"
- }, {
- value: "去年"
- }, ],
- },
- methods: {
- getList() {
- let content = this.data.content;
- const {
- dataid,
- type,
- username,
- isleave
- } = getCurrentPages()[getCurrentPages().length - 1].data;
- content.dataid = dataid;
- content.type = type;
- content.username = username;
- content.where.isleave = isleave;
- _Http.basic({
- "id": 2024062609373902,
- content
- }).then(res => {
- console.log("营销费用数据概况", res)
- if (res.code != '1') return wx.showToast({
- title: res.msg,
- icon: "none"
- })
- const getMapText = getApp().globalData.Language.getMapText;
- let list = [{
- title: '营销费用总金额',
- value: CNY(res.data.amount),
- tips: "",
- link: true
- },
- {
- title: '营销费用总数量',
- value: res.data.count,
- tips: '',
- link: true
- }
- ]
- this.setData({
- list,
- content
- })
- this.onCancel()
- })
- },
- showTips(e) {
- const {
- tips
- } = e.currentTarget.dataset;
- wx.showModal({
- content: tips,
- showCancel: false,
- confirmText: getApp().globalData.Language.getMapText('确定'),
- })
- },
- toDetail(e) {
- const {
- item
- } = e.currentTarget.dataset,
- content = this.data.content;
- content.typemx = item.title;
- wx.navigateTo({
- url: '/salesPanel/dataOverview/OverviewAndDetails/Costs?content=' + JSON.stringify(content),
- })
- },
- openDateType() {
- this.setData({
- detaShow: true
- })
- },
- dateOnSelect(event) {
- const {
- value
- } = event.detail;
- if (this.data.content.dateType == value) return this.onCancel();
- this.setData({
- "content.dateType": value,
- dates: this.data.dates.map(item => {
- item.color = item.value == value ? "#3874F6" : "";
- item.loading = item.value == value ? true : false;
- return item
- }),
- })
- this.getList(true)
- },
- onCancel() {
- this.setData({
- actionShow: false,
- detaShow: false,
- list: this.data.list.map(item => {
- item.loading = false;
- return item
- }),
- dates: this.data.dates.map(item => {
- item.loading = false;
- return item
- })
- })
- },
- }
- })
|