|
@@ -0,0 +1,222 @@
|
|
|
+const _Http = getApp().globalData.http;
|
|
|
+import currency from "../../utils/currency";
|
|
|
+let CNY = value => currency(value, {
|
|
|
+ symbol: "",
|
|
|
+ precision: 2
|
|
|
+}).format();
|
|
|
+Page({
|
|
|
+ data: {
|
|
|
+ showFiltrate: false,
|
|
|
+ startUsing: false,
|
|
|
+ showList: [],
|
|
|
+ "content": {
|
|
|
+ "pageNumber": 1,
|
|
|
+ "pageSize": 40,
|
|
|
+ "type": "0", //1按部门 0按人员
|
|
|
+ "dataid": "0", //部门人员id
|
|
|
+ "querytype": "1", //0按业务员 1按客户
|
|
|
+ "point": "全部", // 入账节点
|
|
|
+ "where": {
|
|
|
+ "condition": ""
|
|
|
+ }
|
|
|
+ },
|
|
|
+ querytypes: [{
|
|
|
+ name: "按业务员",
|
|
|
+ value: 0
|
|
|
+ }, {
|
|
|
+ name: "按客户",
|
|
|
+ value: 1
|
|
|
+ }],
|
|
|
+ points: ['全部', '订单', '出货', '开票'],
|
|
|
+ filtratelist: [],
|
|
|
+ table: [{
|
|
|
+ title: '客户名称',
|
|
|
+ width: 330,
|
|
|
+ key: 'enterprisename',
|
|
|
+ fun: 'toDetail'
|
|
|
+ }, {
|
|
|
+ title: '业务员',
|
|
|
+ width: 200,
|
|
|
+ key: 'name'
|
|
|
+ }, {
|
|
|
+ title: '总应收',
|
|
|
+ width: 200,
|
|
|
+ key: 'allaoverduemount'
|
|
|
+ }, {
|
|
|
+ title: '逾期1月',
|
|
|
+ width: 200,
|
|
|
+ key: 'onemonthamount'
|
|
|
+ }, {
|
|
|
+ title: '逾期1-3月',
|
|
|
+ width: 200,
|
|
|
+ key: 'threemonthamount'
|
|
|
+ }, {
|
|
|
+ title: '逾期3月及以上',
|
|
|
+ width: 200,
|
|
|
+ key: 'upthreemonthamount'
|
|
|
+ }],
|
|
|
+ sumWidth: 0,
|
|
|
+
|
|
|
+ },
|
|
|
+ onLoad(options) {
|
|
|
+ this.setData({
|
|
|
+ sumWidth: this.data.table.reduce((prev, cur) => {
|
|
|
+ return prev.width ? prev.width + cur.width : prev + cur.width
|
|
|
+ })
|
|
|
+ })
|
|
|
+ _Http.basic({
|
|
|
+ "id": 20230620102004,
|
|
|
+ "content": {}
|
|
|
+ }).then(res => {
|
|
|
+ console.log("获取下级部门和下级人员", res)
|
|
|
+ if (res.msg != '成功') return wx.showToast({
|
|
|
+ title: res.data,
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ let data = {
|
|
|
+ label: "查询范围",
|
|
|
+ index: 0,
|
|
|
+ showName: "name", //显示字段
|
|
|
+ valueKey: "active", //返回Key
|
|
|
+ value: "id", //选中值
|
|
|
+ list: res.data.hr.map(v => {
|
|
|
+ v.id = v.userid;
|
|
|
+ // v.key = v.name + v.userid;
|
|
|
+ v.type = '人员'
|
|
|
+ delete(v.rowindex)
|
|
|
+ delete(v.userid)
|
|
|
+ return v
|
|
|
+ })
|
|
|
+ };
|
|
|
+ const mflat = (v, prefix) => {
|
|
|
+ v.subdep.forEach(s => mflat(s, v.depname));
|
|
|
+ v.name = v.depname; //prefix ? prefix + '/' + v.depname : v.depname
|
|
|
+ v.type = '部门';
|
|
|
+ v.id = v.departmentid;
|
|
|
+ // v.key = v.name + v.id;
|
|
|
+ delete(v.depname)
|
|
|
+ delete(v.departmentid)
|
|
|
+ delete(v.parentid)
|
|
|
+ delete(v.rowindex)
|
|
|
+ delete(v.subdep)
|
|
|
+ data.list.unshift(v)
|
|
|
+ };
|
|
|
+ res.data.dep.forEach(v => mflat(v))
|
|
|
+ data.list.map((v, i) => {
|
|
|
+ v.index = i;
|
|
|
+ if (v.type == '人员' && v.id == wx.getStorageSync('userMsg').userid) {
|
|
|
+ data.index = i;
|
|
|
+ this.data.content.dataid = v.id;
|
|
|
+ };
|
|
|
+ return v
|
|
|
+ })
|
|
|
+ this.setData({
|
|
|
+ "filtratelist[0]": data
|
|
|
+ });
|
|
|
+ this.getList()
|
|
|
+ });
|
|
|
+ },
|
|
|
+ getList(init = false) {
|
|
|
+ if (init.detail != undefined) init = init.detail;
|
|
|
+ let content = this.data.content;
|
|
|
+ if (init) content.pageNumber = 1;
|
|
|
+ if (content.pageNumber > content.pageTotal) return;
|
|
|
+ _Http.basic({
|
|
|
+ "id": 20240320111604,
|
|
|
+ content
|
|
|
+ }).then(res => {
|
|
|
+ this.setListHeight()
|
|
|
+ this.selectComponent('#ListBox').RefreshToComplete();
|
|
|
+ console.log("应收账款列表", res)
|
|
|
+ if (res.data.length) {
|
|
|
+ let showList = [],
|
|
|
+ obj = {
|
|
|
+ "sumallaoverduemount": '总应收',
|
|
|
+ "sumonemonthamount": '逾期1月',
|
|
|
+ "sumthreemonthamount": '逾期1-3月',
|
|
|
+ "sumupthreemonthamount": '逾期三月以上'
|
|
|
+ }
|
|
|
+ for (const key in obj) {
|
|
|
+ showList.push({
|
|
|
+ name: obj[key] + '(元)',
|
|
|
+ value: CNY(res.data[0][key])
|
|
|
+ })
|
|
|
+ }
|
|
|
+ this.setData({
|
|
|
+ showList
|
|
|
+ })
|
|
|
+ };
|
|
|
+ let list = res.data.map(v => {
|
|
|
+ v.allaoverduemount = CNY(v.allaoverduemount)
|
|
|
+ v.onemonthamount = CNY(v.onemonthamount)
|
|
|
+ v.threemonthamount = CNY(v.threemonthamount)
|
|
|
+ v.upthreemonthamount = CNY(v.upthreemonthamount)
|
|
|
+ return v
|
|
|
+ })
|
|
|
+ this.setData({
|
|
|
+ list: res.pageNumber == 1 ? list : this.data.list.concat(list),
|
|
|
+ "content.pageNumber": res.pageNumber + 1,
|
|
|
+ "content.pageTotal": res.pageTotal,
|
|
|
+ "content.total": res.total,
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ toDetail(e) {
|
|
|
+ wx.navigateTo({
|
|
|
+ url: '/packageA/receivables/detail?content=' + JSON.stringify(this.data.content),
|
|
|
+ })
|
|
|
+ },
|
|
|
+ querytypeChange(e) {
|
|
|
+ this.setData({
|
|
|
+ "content.querytype": e.detail.value
|
|
|
+ });
|
|
|
+ this.getList(true)
|
|
|
+ },
|
|
|
+ pointChange(e) {
|
|
|
+ this.data.content.querytype = this.data.points[e.detail.value]
|
|
|
+ this.getList(true)
|
|
|
+ },
|
|
|
+ onReady() {
|
|
|
+ this.setListHeight()
|
|
|
+ },
|
|
|
+ /* 设置页面高度 */
|
|
|
+ setListHeight() {
|
|
|
+ this.selectComponent("#ListBox").setHeight(".roof", this);
|
|
|
+ },
|
|
|
+ openFiltrate() {
|
|
|
+ this.setData({
|
|
|
+ showFiltrate: true
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleFilter({
|
|
|
+ detail
|
|
|
+ }) {
|
|
|
+ if (typeof detail == 'object') {
|
|
|
+ if (detail.active == 'id') return this.getList(true)
|
|
|
+ this.data.content.type = detail.active.type == '人员' ? 0 : 1;
|
|
|
+ this.data.content.dataid = detail.active.id;
|
|
|
+ } else {
|
|
|
+ this.data.content.type = 0;
|
|
|
+ this.data.content.dataid = 0;
|
|
|
+ }
|
|
|
+ this.getList(true)
|
|
|
+ },
|
|
|
+ startSearch({
|
|
|
+ detail
|
|
|
+ }) {
|
|
|
+ this.data.content.where.condition = detail;
|
|
|
+ this.getList(true)
|
|
|
+ },
|
|
|
+ onClear() {
|
|
|
+ this.data.content.where.condition = '';
|
|
|
+ this.getList(true)
|
|
|
+ },
|
|
|
+ showSearch() {
|
|
|
+ this.setData({
|
|
|
+ startUsing: !this.data.startUsing
|
|
|
+ })
|
|
|
+ setTimeout(() => {
|
|
|
+ this.setListHeight()
|
|
|
+ }, 400)
|
|
|
+ },
|
|
|
+})
|