|
|
@@ -0,0 +1,129 @@
|
|
|
+const _Http = getApp().globalData.http,
|
|
|
+ currency = require("../../../utils/currency"),
|
|
|
+ CNY = (value, symbol = "¥", precision = 2) => currency(value, {
|
|
|
+ symbol,
|
|
|
+ precision
|
|
|
+ }).format();
|
|
|
+
|
|
|
+Component({
|
|
|
+ properties: {
|
|
|
+
|
|
|
+ },
|
|
|
+ options: {
|
|
|
+ addGlobalClass: true
|
|
|
+ },
|
|
|
+ lifetimes: {
|
|
|
+ attached: function () {}
|
|
|
+ },
|
|
|
+ data: {
|
|
|
+ content: {
|
|
|
+ year: new Date().getFullYear(),
|
|
|
+ sa_saleareaid: 0,
|
|
|
+ "type": 1, //1:人员,2:医院,3:经销商
|
|
|
+ "month_start": 1,
|
|
|
+ "month_end": 12,
|
|
|
+ "userid": 0,
|
|
|
+ "sa_customersid": 0,
|
|
|
+ "sa_agentsid": 0,
|
|
|
+ where: {}
|
|
|
+ },
|
|
|
+ detail: {},
|
|
|
+ showFiltrate: false,
|
|
|
+ areaname: "",
|
|
|
+ userName: ""
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ async getList(init = false) {
|
|
|
+ if (init) this.getData()
|
|
|
+ },
|
|
|
+ async getData() {
|
|
|
+ let content = this.data.content;
|
|
|
+ if (content.sa_saleareaid == 0) {
|
|
|
+ let organization = this.selectComponent("#organization");
|
|
|
+ await organization.initDepAndUser().then(res => {
|
|
|
+ if (res.sa_saleareaid) {
|
|
|
+ this.data.content.sa_saleareaid = res.sa_saleareaid
|
|
|
+ this.setData({
|
|
|
+ areaname: res.areaname
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ _Http.basic({
|
|
|
+ "id": 2026010610085402,
|
|
|
+ content
|
|
|
+ }).then(res => {
|
|
|
+ console.log("目标", res)
|
|
|
+ if (res.code != 1) return wx.showToast({
|
|
|
+ title: res.msg,
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ let item = res.data[0];
|
|
|
+ item.m_balanceamount = CNY(item.m_balanceamount)
|
|
|
+ item.m_saleamount = CNY(item.m_saleamount)
|
|
|
+ item.m_targetamount = CNY(item.m_targetamount)
|
|
|
+ this.setData({
|
|
|
+ detail: item
|
|
|
+ })
|
|
|
+ console.log(this.data.detail)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ changeDate({
|
|
|
+ detail
|
|
|
+ }) {
|
|
|
+ this.setData({
|
|
|
+ "content.year": detail.year,
|
|
|
+ "content.month_start": detail.startMonth,
|
|
|
+ "content.month_end": detail.endMonth,
|
|
|
+ })
|
|
|
+ this.getData()
|
|
|
+ },
|
|
|
+ openFiltrate() {
|
|
|
+ this.setData({
|
|
|
+ showFiltrate: true
|
|
|
+ })
|
|
|
+ },
|
|
|
+ async handleFilter({
|
|
|
+ detail
|
|
|
+ }) {
|
|
|
+ let organization = this.selectComponent("#organization");
|
|
|
+
|
|
|
+ if (detail.name == "close") return;
|
|
|
+ if (detail.name == 'reset') {
|
|
|
+ organization.setData({
|
|
|
+ isleave: "0"
|
|
|
+ })
|
|
|
+ await organization.initDepAndUser().then(res => {
|
|
|
+ if (res.sa_saleareaid) {
|
|
|
+ this.data.content.sa_saleareaid = res.sa_saleareaid
|
|
|
+ this.data.content.userid = ''
|
|
|
+ this.setData({
|
|
|
+ areaname: res.areaname,
|
|
|
+ userName: ""
|
|
|
+ })
|
|
|
+ this.getData()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ let res = organization.data.result;
|
|
|
+ if (res.userid) {
|
|
|
+ let dep = organization.data.selectDepObj;
|
|
|
+ this.data.content.sa_saleareaid = dep.sa_saleareaid;
|
|
|
+ this.data.content.userid = res.userid;
|
|
|
+ this.setData({
|
|
|
+ areaname: dep.areaname,
|
|
|
+ userName: res.name
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.data.content.sa_saleareaid = res.sa_saleareaid
|
|
|
+ this.data.content.userid = 0
|
|
|
+ this.setData({
|
|
|
+ areaname: res.areaname,
|
|
|
+ userName: ''
|
|
|
+ })
|
|
|
+ }
|
|
|
+ this.getData()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ }
|
|
|
+})
|