wangyingjie пре 2 година
родитељ
комит
b408ba69af

+ 7 - 9
app.json

@@ -66,26 +66,21 @@
             "root": "package-inventory",
             "name": "package-inventory",
             "pages": [
-
-                "pages/choose-product/choose-product",  
-
+                "pages/choose-product/choose-product",
                 "pages/warehousing-processing/warehousing-processing",
                 "pages/warehousing-processing/add/add",
                 "pages/warehousing-processing/detail/detail",
                 "pages/warehousing-processing/choose-sku-product/choose-sku-product",
                 "pages/other-warehousing/other-warehousing",
-
                 "pages/outbound-processing/outbound-processing",
                 "pages/outbound-processing/add/add",
-                "pages/outbound-processing/choose-product/choose-product",                
+                "pages/outbound-processing/choose-product/choose-product",
                 "pages/outbound-processing/detail/detail",
                 "pages/other-outbound/other-outbound",
                 "pages/choose-storage-object/choose-storage-object",
-
                 "pages/inventory-adjustment/inventory-adjustment",
                 "pages/inventory-adjustment/add/add",
                 "pages/inventory-adjustment/detail/detail"
-
             ]
         },
         {
@@ -139,7 +134,7 @@
                 "pages/fund-journal/fund-journal",
                 "pages/supplier-transaction-table/supplier-transaction-table"
             ]
-        },  
+        },
         {
             "root": "package-business-analysis",
             "name": "package-business-analysis",
@@ -151,7 +146,10 @@
                 "pages/cost-analysis/cost-analysis",
                 "pages/profit-analysis/profit-analysis",
                 "pages/business-analysis/business-analysis",
-                "pages/sales-kit/sales-kit"
+                "pages/sales-kit/sales-kit",
+                "pages/collection-analysis/collection-analysis",
+                "pages/customer-analysis/customer-analysis",
+                "pages/customer-from-analysis/customer-from-analysis"
             ]
         }
     ],

+ 296 - 0
package-business-analysis/pages/collection-analysis/collection-analysis.js

@@ -0,0 +1,296 @@
+// package5/pages/report/detail/detail.js
+
+const api = require('../../../utils/api.js');
+const util = require('../../../utils/util.js')
+const app = getApp()
+const Constants = require('../../../utils/Constants.js');
+
+
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    active: 0,
+    createTimeType: {
+      "text": "本月",
+      "value": 3
+    },
+    month: [
+      "2024-01-01",
+      "2024-01-31"
+    ],
+    monthFlag: false,
+    monthName: "2024年1月",
+    monthOnChoose: 1706679819268,
+    option1: [
+      {
+        "text": "本日",
+        "value": 1
+      },
+      {
+        "text": "本周",
+        "value": 2
+      },
+      {
+        "text": "本月",
+        "value": 3
+      },
+      {
+        "text": "本年",
+        "value": 5
+      },
+      {
+        "text": "自定义",
+        "value": 0
+      }
+    ],
+    orgFlag: false,
+    orgIds: [],
+    orgNames: null,
+    tab1Columns: [
+      {
+        "name": "orgName",
+        "title": "门店名称",
+        "width": "35%"
+      },
+      {
+        "name": "repayAmount",
+        "title": "收款金额(万)",
+        "type": "amount",
+        "width": "25%"
+      },
+      {
+        "ifNull": "-",
+        "name": "kpiRepayAmount",
+        "title": "任务目标(万)",
+        "type": "amount",
+        "width": "20%"
+      },
+      {
+        "after": "%",
+        "name": "kpiRepayRate",
+        "title": "完成率",
+        "width": "20%"
+      }
+    ],
+    tab1TableData: [
+      {
+        "kpiIndex": 1,
+        "kpiRepayAmount": null,
+        "kpiRepayRate": 0,
+        "orgName": "北海富安居店",
+        "repayAmount": "17.96"
+      }
+    ],
+    tab1TopData: [
+      {
+        "title": "收款额(总额:万)",
+        "type": "amount",
+        "value": "17.96"
+      },
+      {
+        "title": "收款额(均值:万)",
+        "type": "amount",
+        "value": "17.96"
+      }
+    ],
+    tab2Columns: [
+      {
+        "name": "orgName",
+        "title": "门店名称",
+        "width": "35%"
+      },
+      {
+        "name": "receivable",
+        "title": "欠款额(万)",
+        "type": "amount",
+        "width": "25%"
+      },
+      {
+        "name": "orderAmount",
+        "title": "成交额(万)",
+        "type": "amount",
+        "width": "25%"
+      },
+      {
+        "name": "csmCount",
+        "title": "欠款户数",
+        "width": "15%"
+      }
+    ],
+    tab2TableData: [
+      {
+        "csmCount": 12,
+        "kpiIndex": 1,
+        "orderAmount": "98.54",
+        "orgName": "北海富安居店",
+        "receivable": "80.26"
+      }
+    ],
+    tab2TopData: [
+      {
+        "title": "欠款额(总额:万)",
+        "type": "amount",
+        "value": "80.26"
+      },
+      {
+        "title": "欠款额(均值:万)",
+        "type": "amount",
+        "value": "80.26"
+      }
+    ],
+    tabs: [
+      "收款任务",
+      "欠款情况"
+    ],
+    value1: 3, 
+  },
+  dateClick(e){
+    if(e.detail === 0){
+      this.selectComponent("#month-components").toggle(true)  
+      this.dropdowncommit({currentTarget:{dataset:{type:'month'}}})
+    }else{
+      this.getReportData()
+    }
+  },
+  onConfirmChooseDate(e) {
+    this.setData({
+      month: this.data.monthOnChoose,
+      monthName: this.formatDate(this.data.monthOnChoose)
+    })
+    this.setData({
+      monthFlag: false
+    })
+    let option1 = this.data.option1
+    option1[option1.length-1].text = this.data.monthName
+    this.setData({
+      option1: option1
+    })
+    this.selectComponent("#month-components").toggle(false)
+    this.getReportData()
+  },
+  onCloseChooseDate(e) {
+    this.setData({
+      // monthOnChoose: this.data.month
+      value1: 3,
+
+    })
+    this.setData({
+      monthFlag: false
+    })
+    this.selectComponent("#month-components").toggle()
+    this.getReportData()
+  },
+  getBeginDateAndEndDate(timestamp) {
+    let month = this.data.month
+    let monthStart = month[0] ? month[0] : ''
+    let monthEnd = month[1] ? month[1] : ''
+    if (month && month[0] && (month[0].indexOf('/') != -1)) {
+      monthStart = month[0].replaceAll('/', '-')
+    }
+    if (month && month[1] && (month[1].indexOf('/') != -1)) {
+      monthEnd = month[1].replaceAll('/', '-')
+    }
+    return { beginDate: monthStart, endDate: monthEnd }
+  },
+
+   /**
+   * @desc : 日期组件后的回调
+   * @author : 于继渤
+   * @date : 2022/5/24 12:16
+   */
+  dateCommit(e) {
+    let dateType = e.detail.dateType
+    if (dateType === 'accountdate') {
+      if(e.detail.dateDefault.text === '自定义'){
+        this.setData({
+          value1: 0,
+        })
+      }
+      if(e.detail.dateDefault.text === '本月'){
+        this.setData({
+          value1: 3,
+        })
+      }
+      let data = e.detail.date
+      console.log(e)
+      this.setData({
+        month: data,
+        createTimeType: e.detail.dateDefault
+      })
+      this.selectComponent('#create-time-type').toggle();
+    }
+     this.getReportData()
+  },
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad(options) {
+  
+  },
+
+
+  /** 查询页面展示的所有 */
+  getReportData() {
+    let params = {
+      tab1:  Object.assign(this.getBeginDateAndEndDate(this.data.month),
+      { userId:app.globalData.user.userId,type: 'f_report_s001_index_org_repay',cpId:app.globalData.user.ascpId,orgIds:this.data.orgIds,dateType:this.data.value1}),
+      tab2:   Object.assign(this.getBeginDateAndEndDate(this.data.month),
+      { userId:app.globalData.user.userId,type: 'f_report_s001_repay_debt',cpId:app.globalData.user.ascpId,orgIds:this.data.orgIds,dateType:this.data.value1})
+    };
+    api.request(Constants.WX_REPORT + 'select_report_batch', 'POST', params).then(res => {
+      if (res.data.code === 200) {
+        this.setData({
+          tab1TopData:[{title:'收款额(总额:万)',type:'amount',value:util.parseFloatFixed2(res.data.data.tab1.sumAmount/10000)},{title:'收款额(均值:万)',type:'amount',value:util.parseFloatFixed2(res.data.data.tab1.avgAmount/10000)}],
+          tab1TableData:util.calc10000(res.data.data.tab1.items,['kpiRepayAmount','repayAmount']),
+          tab2TopData:[{title:'欠款额(总额:万)',type:'amount',value:util.parseFloatFixed2(res.data.data.tab2.receivable/10000)},{title:'欠款额(均值:万)',type:'amount',value:util.parseFloatFixed2(res.data.data.tab2.avgAmount/10000)}],
+          tab2TableData:util.calc10000(res.data.data.tab2.items,['orderAmount','receivable'])
+        })
+        
+      } else {
+        console.error("获取报表失败", res)
+      }
+    })
+  },
+
+  formatDate(value) {
+    var time = new Date(value);
+    var year = time.getFullYear();
+    var month = time.getMonth() + 1;
+    return year + "年" + month + "月"
+  },
+  onInput(e) {
+    this.setData({
+      monthOnChoose: e.detail
+    })
+  },
+
+
+  dropdowncommit(e) {
+    this.setData({
+      [e.currentTarget.dataset.type + 'Flag']: true
+    })
+  },
+
+  /** 下拉多选关闭 */
+  muticloseAll(e) {
+    this.setData({
+      orgFlag: false
+    })
+    this.selectComponent("#org-components").toggle()
+  },
+
+  /** 下拉多选确定 */
+  mutiSearchAll(e) {
+    this.setData({
+      orgIds: e.detail.idList,
+      orgNames: e.detail.names,
+      orgFlag: false
+    })
+    this.selectComponent("#org-components").toggle(false)
+    this.getReportData()
+  },
+
+})

+ 4 - 0
package-business-analysis/pages/collection-analysis/collection-analysis.json

@@ -0,0 +1,4 @@
+{
+    "usingComponents": {},
+    "navigationBarTitleText": "收款分析"
+  }

+ 42 - 0
package-business-analysis/pages/collection-analysis/collection-analysis.wxml

@@ -0,0 +1,42 @@
+<view>
+  <!-- 顶部筛选条件 -->
+<van-dropdown-menu>
+  <van-dropdown-item id="org-components" title="{{orgNames?orgNames:'全部门店' }}" data-type="org" bind:open="dropdowncommit">
+  </van-dropdown-item>
+  <!-- <van-dropdown-item id="month-components" title="{{monthName?monthName:'本月' }}" data-type="month" bind:open="dropdowncommit">
+  </van-dropdown-item> -->
+  <!-- <van-dropdown-item id="month-components" model:value="{{ value1 }}" options="{{ option1 }}" data-type="month"  bind:click="dateClick" /> -->
+
+  <van-dropdown-item id="create-time-type" title="{{createTimeType.text}}">
+    <dk-dropdown-date id="month-components"  dateType="accountdate" blankFlag="{{false}}" dateDefault='{{createTimeType}}' defaultValue='{{createTimeType.value}}' bind:dateCommit='dateCommit'></dk-dropdown-date>
+  </van-dropdown-item>
+
+</van-dropdown-menu>
+
+
+  <van-tabs tab-class="tab-class" tab-active-class="tab-active-class" color="#00A7B5" animated active="{{ active }}" bind:change="onChange">
+    <van-tab title="收款任务">
+      <view style="width: calc(100% - 68rpx);padding: 40rpx 34rpx;">
+        <dk-table columns="{{tab1Columns}}" table-data="{{tab1TableData}}" top-data="{{tab1TopData}}" />
+      </view>
+    </van-tab>
+    <van-tab title="欠款情况">
+      <view style="width: calc(100% - 68rpx);padding: 40rpx 34rpx;">
+        <dk-table columns="{{tab2Columns}}" table-data="{{tab2TableData}}" top-data="{{tab2TopData}}" />
+      </view>
+    </van-tab>
+  </van-tabs>
+</view>
+
+<!-- 选门店 -->
+<dk-muti-dropdown-item show="{{orgFlag}}" docName="客户资料" id='org' typeName='org' bind:muticommit='mutiSearchAll' bind:muticlose='muticloseAll'></dk-muti-dropdown-item>
+
+<!-- 选时间 -->
+<van-popup position="bottom" show="{{ monthFlag }}" bind:close="onCloseChooseDate" class="popup" style="width:100%" custom-style="border-radius:15rpx;">
+  <view style="display:flex;justify-content: space-around;height:80rpx;">
+    <view style="width:45%;text-align: left;color:#b6b6b6;line-height:80rpx;" catchtap="onCloseChooseDate">取消</view>
+    <view style="width:45%;text-align: right;color:#00A7B5;line-height:80rpx;" catchtap="onConfirmChooseDate">确定</view>
+  </view>
+  <van-datetime-picker type="year-month" value="{{ monthOnChoose }}" bind:input="onInput" show-toolbar="{{false}}" formatter="{{formatter}}" />
+</van-popup>
+

+ 15 - 0
package-business-analysis/pages/collection-analysis/collection-analysis.wxss

@@ -0,0 +1,15 @@
+/* package5/pages/report/detail/detail.wxss */
+page{
+    background: #f8f9fd;
+  }
+  
+  .tab-class{
+    color:  #95A8CB;
+    font-family: 'PingFang SC';
+    font-style: normal;
+    font-weight: 500;
+    font-size: 14px;
+  }
+  .tab-active-class{
+    color: #00A7B5 !important;
+  }

+ 299 - 0
package-business-analysis/pages/customer-analysis/customer-analysis.js

@@ -0,0 +1,299 @@
+// package5/pages/report/detail/detail.js
+
+const api = require('../../../utils/api.js');
+const util = require('../../../utils/util.js')
+const app = getApp()
+const Constants = require('../../../utils/Constants.js');
+
+
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    active: 0,
+    createTimeType: {
+      "text": "本月",
+      "value": 3
+    },
+    month: [
+      "2024-01-01",
+      "2024-01-31"
+    ],
+    monthFlag: false,
+    monthName: "2024年1月",
+    monthOnChoose: 1706679819269,
+    option1: [
+      {
+        "text": "本日",
+        "value": 1
+      },
+      {
+        "text": "本周",
+        "value": 2
+      },
+      {
+        "text": "本月",
+        "value": 3
+      },
+      {
+        "text": "本年",
+        "value": 5
+      },
+      {
+        "text": "自定义",
+        "value": 0
+      }
+    ],
+    orgFlag: false,
+    orgIds: [],
+    orgNames: null,
+    tab1Columns: [
+      {
+        "name": "orgName",
+        "title": "门店名称",
+        "width": "35%"
+      },
+      {
+        "name": "offerAmount",
+        "title": "收款金额(万)",
+        "type": "amount",
+        "width": "25%"
+      },
+      {
+        "name": "offerCsmCount",
+        "title": "报价客户",
+        "width": "20%"
+      },
+      {
+        "after": "%",
+        "name": "offerRate",
+        "title": "报价率",
+        "width": "20%"
+      }
+    ],
+    tab1TopData: [
+      {
+        "title": "报价(总额:万)",
+        "type": "amount",
+        "value": "12.82"
+      },
+      {
+        "title": "报价额(均值:万)",
+        "type": "amount",
+        "value": "12.82"
+      }
+    ],
+    tab2Columns: [
+      {
+        "name": "orgName",
+        "title": "门店名称",
+        "width": "35%"
+      },
+      {
+        "name": "csmCount",
+        "title": "潜在客户",
+        "width": "20%"
+      },
+      {
+        "name": "measureCsmCount",
+        "title": "量尺",
+        "width": "10%"
+      },
+      {
+        "name": "designCsmCount",
+        "title": "设计制图",
+        "width": "15%"
+      },
+      {
+        "after": "%",
+        "name": "orderRate",
+        "title": "成交率",
+        "width": "20%"
+      }
+    ],
+    tab2TableData: [
+      {
+        "csmCount": 0,
+        "designCsmCount": 1,
+        "kpiIndex": 1,
+        "measureCsmCount": 0,
+        "orderCsmCount": 0,
+        "orderRate": 0,
+        "orgName": "北海富安居店"
+      }
+    ],
+    value1: 3, 
+    tab1TableData: [
+      {
+        "csmCount": 0,
+        "kpiIndex": 1,
+        "offerAmount": "12.82",
+        "offerCsmCount": 3,
+        "offerRate": 0,
+        "orgName": "北海富安居店"
+      }
+    ],
+    tab2TopData: [
+      {
+        "title": "新增潜客",
+        "value": 0
+      },
+      {
+        "title": "新增成交",
+        "value": 0
+      },
+      {
+        "title": "设计制图",
+        "value": 1
+      }
+    ]
+  },
+   dateClick(e){
+     if(e.detail === 0){
+       this.selectComponent("#month-components").toggle(true)  
+       this.dropdowncommit({currentTarget:{dataset:{type:'month'}}})
+     }else{
+       this.getReportData()
+     }
+   },
+   onConfirmChooseDate(e) {
+     this.setData({
+       month: this.data.monthOnChoose,
+       monthName: this.formatDate(this.data.monthOnChoose)
+     })
+     this.setData({
+       monthFlag: false
+     })
+     let option1 = this.data.option1
+     option1[option1.length-1].text = this.data.monthName
+     this.setData({
+       option1: option1
+     })
+     this.selectComponent("#month-components").toggle(false)
+     this.getReportData()
+   },
+   onCloseChooseDate(e) {
+     this.setData({
+       // monthOnChoose: this.data.month
+       value1: 3,
+ 
+     })
+     this.setData({
+       monthFlag: false
+     })
+     this.selectComponent("#month-components").toggle()
+     this.getReportData()
+   },
+ 
+     /**
+   * @desc : 日期组件后的回调
+   * @author : 于继渤
+   * @date : 2022/5/24 12:16
+   */
+  dateCommit(e) {
+    let dateType = e.detail.dateType
+    if (dateType === 'accountdate') {
+      if(e.detail.dateDefault.text === '自定义'){
+        this.setData({
+          value1: 0,
+        })
+      }
+      if(e.detail.dateDefault.text === '本月'){
+        this.setData({
+          value1: 3,
+        })
+      }
+      let data = e.detail.date
+      console.log(e)
+      this.setData({
+        month: data,
+        createTimeType: e.detail.dateDefault
+      })
+      this.selectComponent('#create-time-type').toggle();
+    }
+     this.getReportData()
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad(options) {
+ 
+  },
+
+
+  /** 查询页面展示的所有 */
+  getReportData() {
+    let params = {
+      tab1: Object.assign(this.getBeginDateAndEndDate(this.data.month), { userId:app.globalData.user.userId,type: 'f_report_s001_csm_analysis_offer', cpId: app.globalData.user.ascpId, orgIds: this.data.orgIds,dateType:this.data.value1 }),
+      tab2: Object.assign(this.getBeginDateAndEndDate(this.data.month), { userId:app.globalData.user.userId,type: 'f_report_s001_csm_analysis_order', cpId: app.globalData.user.ascpId, orgIds: this.data.orgIds,dateType:this.data.value1 }),
+    };
+    api.request(Constants.WX_REPORT + 'select_report_batch', 'POST', params).then(res => {
+      if (res.data.code === 200) {
+        this.setData({
+          tab1TopData: [{ title: '报价(总额:万)', type: 'amount', value: util.parseFloatFixed2(res.data.data.tab1.offerAmount/10000) }, { title: '报价额(均值:万)', type: 'amount', value: util.parseFloatFixed2(res.data.data.tab1.avgAmount/10000) }],
+          tab1TableData: util.calc10000(res.data.data.tab1.items,['offerAmount']),
+          tab2TopData: [{ title: '新增潜客', value: res.data.data.tab2.csmCount }, { title: '新增成交', value: res.data.data.tab2.orderCsmCount }, { title: '设计制图', value: res.data.data.tab2.designCsmCount }],
+          tab2TableData: res.data.data.tab2.items
+        })
+      } else {
+        console.error("获取报表失败", res)
+      }
+    })
+  },
+
+  //#region 基础内容
+  /** 根据月份查出第一天和最后一天 参数是时间戳*/
+  getBeginDateAndEndDate(timestamp) {
+    let month = this.data.month
+    let monthStart = month[0] ? month[0] : ''
+    let monthEnd = month[1] ? month[1] : ''
+    if (month && month[0] && (month[0].indexOf('/') != -1)) {
+      monthStart = month[0].replaceAll('/', '-')
+    }
+    if (month && month[1] && (month[1].indexOf('/') != -1)) {
+      monthEnd = month[1].replaceAll('/', '-')
+    }
+    console.log(' { beginDate: monthStart, endDate: monthEnd }', { beginDate: monthStart, endDate: monthEnd })
+    return { beginDate: monthStart, endDate: monthEnd }
+  },
+  formatDate(value) {
+    var time = new Date(value);
+    var year = time.getFullYear();
+    var month = time.getMonth() + 1;
+    return year + "年" + month + "月"
+  },
+  onInput(e) {
+    this.setData({
+      monthOnChoose: e.detail
+    })
+  },
+
+  dropdowncommit(e) {
+    this.setData({
+      [e.currentTarget.dataset.type + 'Flag']: true
+    })
+  },
+
+  /** 下拉多选关闭 */
+  muticloseAll(e) {
+    this.setData({
+      orgFlag: false
+    })
+    this.selectComponent("#org-components").toggle()
+  },
+
+  /** 下拉多选确定 */
+  mutiSearchAll(e) {
+    this.setData({
+      orgIds: e.detail.idList,
+      orgNames: e.detail.names,
+      orgFlag: false
+    })
+    this.selectComponent("#org-components").toggle(false)
+    this.getReportData()
+  },
+  //#endregion
+})

+ 4 - 0
package-business-analysis/pages/customer-analysis/customer-analysis.json

@@ -0,0 +1,4 @@
+{
+    "usingComponents": {},
+    "navigationBarTitleText": "客户分析"
+  }

+ 40 - 0
package-business-analysis/pages/customer-analysis/customer-analysis.wxml

@@ -0,0 +1,40 @@
+<view>
+  <!-- 顶部筛选条件 -->
+<van-dropdown-menu>
+  <van-dropdown-item id="org-components" title="{{orgNames?orgNames:'全部门店' }}" data-type="org" bind:open="dropdowncommit">
+  </van-dropdown-item>
+  <!-- <van-dropdown-item id="month-components" title="{{monthName?monthName:'本月' }}" data-type="month" bind:open="dropdowncommit">
+  </van-dropdown-item> -->
+  <!-- <van-dropdown-item id="month-components" model:value="{{ value1 }}" options="{{ option1 }}" data-type="month"  bind:click="dateClick" /> -->
+
+  <van-dropdown-item id="create-time-type" title="{{createTimeType.text}}">
+    <dk-dropdown-date id="month-components"  dateType="accountdate" blankFlag="{{false}}" dateDefault='{{createTimeType}}' defaultValue='{{createTimeType.value}}' bind:dateCommit='dateCommit'></dk-dropdown-date>
+  </van-dropdown-item>
+</van-dropdown-menu>
+
+
+  <van-tabs tab-class="tab-class" tab-active-class="tab-active-class" color="#00A7B5" animated active="{{ active }}" bind:change="onChange">
+    <van-tab title="预算报价">
+      <view style="width: calc(100% - 68rpx);padding: 40rpx 34rpx;">
+        <dk-table columns="{{tab1Columns}}" table-data="{{tab1TableData}}" top-data="{{tab1TopData}}" />
+      </view>
+    </van-tab>
+    <van-tab title="潜客分析">
+      <view style="width: calc(100% - 68rpx);padding: 40rpx 34rpx;">
+        <dk-table columns="{{tab2Columns}}" table-data="{{tab2TableData}}" top-data="{{tab2TopData}}" />
+      </view>
+    </van-tab>
+  </van-tabs>
+</view>
+
+<!-- 选门店 -->
+<dk-muti-dropdown-item show="{{orgFlag}}" docName="客户资料" id='org' typeName='org' bind:muticommit='mutiSearchAll' bind:muticlose='muticloseAll'></dk-muti-dropdown-item>
+
+<!-- 选时间 -->
+<van-popup position="bottom" show="{{ monthFlag }}" bind:close="onCloseChooseDate" class="popup" style="width:100%" custom-style="border-radius:15rpx;">
+  <view style="display:flex;justify-content: space-around;height:80rpx;">
+    <view style="width:45%;text-align: left;color:#b6b6b6;line-height:80rpx;" catchtap="onCloseChooseDate">取消</view>
+    <view style="width:45%;text-align: right;color:#00A7B5;line-height:80rpx;" catchtap="onConfirmChooseDate">确定</view>
+  </view>
+  <van-datetime-picker type="year-month" value="{{ monthOnChoose }}" bind:input="onInput" show-toolbar="{{false}}" formatter="{{formatter}}" />
+</van-popup>

+ 15 - 0
package-business-analysis/pages/customer-analysis/customer-analysis.wxss

@@ -0,0 +1,15 @@
+/* package5/pages/report/detail/detail.wxss */
+page{
+    background: #f8f9fd;
+  }
+  
+  .tab-class{
+    color:  #95A8CB;
+    font-family: 'PingFang SC';
+    font-style: normal;
+    font-weight: 500;
+    font-size: 14px;
+  }
+  .tab-active-class{
+    color: #00A7B5 !important;
+  }

+ 373 - 0
package-business-analysis/pages/customer-from-analysis/customer-from-analysis.js

@@ -0,0 +1,373 @@
+// package5/pages/report/detail/detail.js
+
+const api = require('../../../utils/api.js');
+const util = require('../../../utils/util.js')
+const app = getApp()
+const Constants = require('../../../utils/Constants.js');
+
+
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data:{
+    active: 0,
+    createTimeType: {
+      "text": "本月",
+      "value": 3
+    },
+    month: [
+      "2024-01-01",
+      "2024-01-31"
+    ],
+    monthFlag: false,
+    monthName: "2024年1月",
+    monthOnChoose: 1706679819270,
+    option1: [
+      {
+        "text": "本日",
+        "value": 1
+      },
+      {
+        "text": "本周",
+        "value": 2
+      },
+      {
+        "text": "本月",
+        "value": 3
+      },
+      {
+        "text": "本年",
+        "value": 5
+      },
+      {
+        "text": "自定义",
+        "value": 0
+      }
+    ],
+    orgFlag: false,
+    orgIds: [],
+    orgNames: null,
+    tab1Columns: [
+      {
+        "name": "fromName",
+        "title": "客户来源",
+        "width": "25%"
+      },
+      {
+        "name": "orderAmount",
+        "title": "成交金额",
+        "type": "amount",
+        "width": "35%"
+      },
+      {
+        "name": "customerQty",
+        "title": "成交客户",
+        "width": "20%"
+      },
+      {
+        "after": "%",
+        "name": "rate",
+        "title": "占比",
+        "width": "20%"
+      }
+    ],
+    tab1TopData: [
+      {
+        "title": "成交额(总额:万)",
+        "type": "amount",
+        "value": "98.17"
+      },
+      {
+        "title": "成交额(均值:万)",
+        "type": "amount",
+        "value": "32.72"
+      }
+    ],
+    tab2Columns: [
+      {
+        "name": "fromName",
+        "title": "客户来源",
+        "width": "25%"
+      },
+      {
+        "name": "orderAmount",
+        "title": "报价金额",
+        "type": "amount",
+        "width": "35%"
+      },
+      {
+        "name": "customerQty",
+        "title": "报价客户",
+        "width": "20%"
+      },
+      {
+        "after": "%",
+        "name": "rate",
+        "title": "占比",
+        "width": "20%"
+      }
+    ],
+    tab2TableData: [
+      {
+        "customerQty": 2,
+        "fromName": "自然客流",
+        "kpiIndex": 1,
+        "orderAmount": "10.55",
+        "rate": 82.26
+      },
+      {
+        "customerQty": 1,
+        "fromName": "自然进店",
+        "kpiIndex": 2,
+        "orderAmount": "2.28",
+        "rate": 17.74
+      }
+    ],
+    tab3Columns: [
+      {
+        "name": "fromName",
+        "title": "客户来源",
+        "width": "25%"
+      },
+      {
+        "name": "csmCount",
+        "title": "潜在客户",
+        "width": "25%"
+      },
+      {
+        "name": "orderCsmCount",
+        "title": "成交客户",
+        "width": "25%"
+      },
+      {
+        "name": "designCsmCount",
+        "title": "设计制图",
+        "width": "25%"
+      }
+    ],
+    tab3TableData: [
+      {
+        "csmCount": 0,
+        "designCsmCount": 1,
+        "fromName": "自然客流",
+        "kpiIndex": 1,
+        "orderCsmCount": 11
+      },
+      {
+        "csmCount": 0,
+        "designCsmCount": 0,
+        "fromName": "自然进店",
+        "kpiIndex": 1,
+        "orderCsmCount": 1
+      },
+      {
+        "csmCount": 0,
+        "designCsmCount": 0,
+        "fromName": "选用1",
+        "kpiIndex": 1,
+        "orderCsmCount": 1
+      }
+    ],
+    tab3TopData: [
+      {
+        "title": "新增潜客",
+        "value": 0
+      },
+      {
+        "title": "新增成交",
+        "value": 13
+      },
+      {
+        "title": "设计制图",
+        "value": 1
+      }
+    ],
+    value1: 3, 
+    tab1TableData: [
+      {
+        "customerQty": 11,
+        "fromName": "自然客流",
+        "kpiIndex": 1,
+        "orderAmount": "67.13",
+        "rate": 68.38
+      },
+      {
+        "customerQty": 1,
+        "fromName": "选用1",
+        "kpiIndex": 2,
+        "orderAmount": "16.48",
+        "rate": 16.79
+      },
+      {
+        "customerQty": 1,
+        "fromName": "自然进店",
+        "kpiIndex": 3,
+        "orderAmount": "14.56",
+        "rate": 14.83
+      }
+    ],
+    tab2TopData: [
+      {
+        "title": "报价(总额:万)",
+        "type": "amount",
+        "value": "12.82"
+      },
+      {
+        "title": "报价额(均值:万)",
+        "type": "amount",
+        "value": "6.41"
+      }
+    ]
+  },
+  dateClick(e){
+    if(e.detail === 0){
+      this.selectComponent("#month-components").toggle(true)  
+      this.dropdowncommit({currentTarget:{dataset:{type:'month'}}})
+    }else{
+      this.getReportData()
+    }
+  },
+  onConfirmChooseDate(e) {
+    this.setData({
+      month: this.data.monthOnChoose,
+      monthName: this.formatDate(this.data.monthOnChoose)
+    })
+    this.setData({
+      monthFlag: false
+    })
+    let option1 = this.data.option1
+    option1[option1.length-1].text = this.data.monthName
+    this.setData({
+      option1: option1
+    })
+    this.selectComponent("#month-components").toggle(false)
+    this.getReportData()
+  },
+  onCloseChooseDate(e) {
+    this.setData({
+      // monthOnChoose: this.data.month
+      value1: 3,
+
+    })
+    this.setData({
+      monthFlag: false
+    })
+    this.selectComponent("#month-components").toggle()
+    this.getReportData()
+  },
+
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad(options) {
+     
+  },
+
+
+  /** 查询页面展示的所有 */
+  getReportData() {
+    let params = {
+      tab1: Object.assign(this.getBeginDateAndEndDate(this.data.month), { userId:app.globalData.user.userId,type: 'f_report_s001_csm_from_order', cpId: app.globalData.user.ascpId, orgIds: this.data.orgIds,dateType:this.data.value1 }),
+      tab2: Object.assign(this.getBeginDateAndEndDate(this.data.month), { userId:app.globalData.user.userId,type: 'f_report_s001_csm_from_offer', cpId: app.globalData.user.ascpId, orgIds: this.data.orgIds,dateType:this.data.value1 }),
+      tab3: Object.assign(this.getBeginDateAndEndDate(this.data.month), { userId:app.globalData.user.userId,type: 'f_report_s001_csm_from_filing', cpId: app.globalData.user.ascpId, orgIds: this.data.orgIds,dateType:this.data.value1 }),
+    };
+    api.request(Constants.WX_REPORT + 'select_report_batch', 'POST', params).then(res => {
+      if (res.data.code === 200) {
+        this.setData({
+          tab1TopData: [{ title: '成交额(总额:万)', type: 'amount', value: util.parseFloatFixed2(res.data.data.tab1.sumAmount/10000) }, { title: '成交额(均值:万)', type: 'amount', value: util.parseFloatFixed2(res.data.data.tab1.avgAmount/10000) }],
+          tab1TableData: util.calc10000(res.data.data.tab1.items,['orderAmount']),
+          tab2TopData: [{ title: '报价(总额:万)',type: 'amount', value: util.parseFloatFixed2(res.data.data.tab2.sumAmount/10000) }, { title: '报价额(均值:万)',type: 'amount', value: util.parseFloatFixed2(res.data.data.tab2.avgAmount/10000) }],
+          tab2TableData: util.calc10000(res.data.data.tab2.items,['orderAmount']),
+          tab3TopData: [{ title: '新增潜客', value: res.data.data.tab3.csmCount }, { title: '新增成交', value: res.data.data.tab3.orderCsmCount }, { title: '设计制图', value: res.data.data.tab3.designCsmCount }],
+          tab3TableData: res.data.data.tab3.items
+        })
+      } else {
+        console.error("获取报表失败", res)
+      }
+    })
+  },
+ 
+     /**
+   * @desc : 日期组件后的回调
+   * @author : 于继渤
+   * @date : 2022/5/24 12:16
+   */
+  dateCommit(e) {
+    let dateType = e.detail.dateType
+    if (dateType === 'accountdate') {
+      if(e.detail.dateDefault.text === '自定义'){
+        this.setData({
+          value1: 0,
+        })
+      }
+      if(e.detail.dateDefault.text === '本月'){
+        this.setData({
+          value1: 3,
+        })
+      }
+      let data = e.detail.date
+      console.log(e)
+      this.setData({
+        month: data,
+        createTimeType: e.detail.dateDefault
+      })
+      this.selectComponent('#create-time-type').toggle();
+    }
+     this.getReportData()
+  },
+  //#region 基础内容
+  /** 根据月份查出第一天和最后一天 参数是时间戳*/
+  getBeginDateAndEndDate(timestamp) {
+    let month = this.data.month
+    let monthStart = month[0] ? month[0] : ''
+    let monthEnd = month[1] ? month[1] : ''
+    if (month && month[0] && (month[0].indexOf('/') != -1)) {
+      monthStart = month[0].replaceAll('/', '-')
+    }
+    if (month && month[1] && (month[1].indexOf('/') != -1)) {
+      monthEnd = month[1].replaceAll('/', '-')
+    }
+    return { beginDate: monthStart, endDate: monthEnd }
+  },
+  formatDate(value) {
+    var time = new Date(value);
+    var year = time.getFullYear();
+    var month = time.getMonth() + 1;
+    return year + "年" + month + "月"
+  },
+  onInput(e) {
+    this.setData({
+      monthOnChoose: e.detail
+    })
+  },
+
+
+  dropdowncommit(e) {
+    this.setData({
+      [e.currentTarget.dataset.type + 'Flag']: true
+    })
+  },
+
+  /** 下拉多选关闭 */
+  muticloseAll(e) {
+    this.setData({
+      orgFlag: false
+    })
+    this.selectComponent("#org-components").toggle()
+  },
+
+  /** 下拉多选确定 */
+  mutiSearchAll(e) {
+    this.setData({
+      orgIds: e.detail.idList,
+      orgNames: e.detail.names,
+      orgFlag: false
+    })
+    this.selectComponent("#org-components").toggle(false)
+    this.getReportData()
+  },
+  //#endregion
+})

+ 4 - 0
package-business-analysis/pages/customer-from-analysis/customer-from-analysis.json

@@ -0,0 +1,4 @@
+{
+    "usingComponents": {},
+    "navigationBarTitleText": "客户来源分布"
+  }

+ 43 - 0
package-business-analysis/pages/customer-from-analysis/customer-from-analysis.wxml

@@ -0,0 +1,43 @@
+<view>
+  <!-- 顶部筛选条件 -->
+<van-dropdown-menu>
+  <van-dropdown-item id="org-components" title="{{orgNames?orgNames:'全部门店' }}" data-type="org" bind:open="dropdowncommit">
+  </van-dropdown-item>
+  <!-- <van-dropdown-item id="month-components" title="{{monthName?monthName:'本月' }}" data-type="month" bind:open="dropdowncommit">
+  </van-dropdown-item> -->
+  <van-dropdown-item id="create-time-type" title="{{createTimeType.text}}">
+    <dk-dropdown-date id="month-components"  dateType="accountdate" blankFlag="{{false}}" dateDefault='{{createTimeType}}' defaultValue='{{createTimeType.value}}' bind:dateCommit='dateCommit'></dk-dropdown-date>
+  </van-dropdown-item>
+
+
+</van-dropdown-menu>
+
+
+  <van-tabs tab-class="tab-class" tab-active-class="tab-active-class" color="#00A7B5" animated active="{{ active }}" bind:change="onChange">
+    <van-tab title="成交情况">
+      <view style="width: calc(100% - 68rpx);padding: 40rpx 34rpx;">
+        <dk-table columns="{{tab1Columns}}" table-data="{{tab1TableData}}" top-data="{{tab1TopData}}" />
+        <view style="height: 40rpx;"></view>
+        <dk-table  columns="{{tab2Columns}}" table-data="{{tab2TableData}}" top-data="{{tab2TopData}}" />
+
+      </view>
+    </van-tab>
+    <van-tab title="潜客分析">
+      <view style="width: calc(100% - 68rpx);padding: 40rpx 34rpx;">
+        <dk-table columns="{{tab3Columns}}" table-data="{{tab3TableData}}" top-data="{{tab3TopData}}" />
+      </view>
+    </van-tab>
+  </van-tabs>
+</view>
+
+<!-- 选门店 -->
+<dk-muti-dropdown-item show="{{orgFlag}}" docName="客户资料" id='org' typeName='org' bind:muticommit='mutiSearchAll' bind:muticlose='muticloseAll'></dk-muti-dropdown-item>
+
+<!-- 选时间 -->
+<van-popup position="bottom" show="{{ monthFlag }}" bind:close="onCloseChooseDate" class="popup" style="width:100%" custom-style="border-radius:15rpx;">
+  <view style="display:flex;justify-content: space-around;height:80rpx;">
+    <view style="width:45%;text-align: left;color:#b6b6b6;line-height:80rpx;" catchtap="onCloseChooseDate">取消</view>
+    <view style="width:45%;text-align: right;color:#00A7B5;line-height:80rpx;" catchtap="onConfirmChooseDate">确定</view>
+  </view>
+  <van-datetime-picker type="year-month" value="{{ monthOnChoose }}" bind:input="onInput" show-toolbar="{{false}}" formatter="{{formatter}}" />
+</van-popup>

+ 15 - 0
package-business-analysis/pages/customer-from-analysis/customer-from-analysis.wxss

@@ -0,0 +1,15 @@
+/* package5/pages/report/detail/detail.wxss */
+page{
+    background: #f8f9fd;
+  }
+  
+  .tab-class{
+    color:  #95A8CB;
+    font-family: 'PingFang SC';
+    font-style: normal;
+    font-weight: 500;
+    font-size: 14px;
+  }
+  .tab-active-class{
+    color: #00A7B5 !important;
+  }

+ 1 - 1
package-business-analysis/pages/sales-kit/sales-kit.js

@@ -301,7 +301,7 @@ Page({
   /** 去详细 */
   toDetail(e){
     wx.navigateTo({
-      url: '/package-business-analysis/pages/'+e.currentTarget.dataset.url +'?orgIds='+encodeURIComponent(JSON.stringify(this.data.orgIds))+ '&orgNames=' + encodeURIComponent(JSON.stringify(this.data.orgNames))
+      url: '/package-business-analysis/pages'+e.currentTarget.dataset.url +'?orgIds='+encodeURIComponent(JSON.stringify(this.data.orgIds))+ '&orgNames=' + encodeURIComponent(JSON.stringify(this.data.orgNames))
       +'&dateType='+this.data.value1 + '&date='+this.data.month
     })
   },