|
@@ -0,0 +1,232 @@
|
|
|
+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,
|
|
|
+ "content": {
|
|
|
+ "pageNumber": 1,
|
|
|
+ "pageSize": 40,
|
|
|
+ "type": "0", //1按部门 0按人员
|
|
|
+ "dataid": wx.getStorageSync('userMsg').userid, //部门人员id
|
|
|
+ "querytype": "1", //0按业务员 1按客户
|
|
|
+ "point": "开票", // 入账节点
|
|
|
+ "where": {
|
|
|
+ "condition": ""
|
|
|
+ }
|
|
|
+ },
|
|
|
+ querytypes: [{
|
|
|
+ name: getApp().globalData.Language.getMapText('按业务员'),
|
|
|
+ value: 0
|
|
|
+ }, {
|
|
|
+ name: getApp().globalData.Language.getMapText('按客户'),
|
|
|
+ value: 1
|
|
|
+ }],
|
|
|
+ points: ['开票', '出货'],
|
|
|
+ filtratelist: [],
|
|
|
+ table: [{
|
|
|
+ title: '客户名称',
|
|
|
+ width: 330,
|
|
|
+ key: 'enterprisename',
|
|
|
+ fun: 'toDetail'
|
|
|
+ }, {
|
|
|
+ title: '业务员',
|
|
|
+ width: 200,
|
|
|
+ key: 'name'
|
|
|
+ }, {
|
|
|
+ title: '期初余额(2021-12-31)',
|
|
|
+ width: 330,
|
|
|
+ key: 'openingbalance'
|
|
|
+ }, {
|
|
|
+ title: '开票总金额(2022-01-01至今)',
|
|
|
+ width: 400,
|
|
|
+ key: 'receivableamount'
|
|
|
+ }, {
|
|
|
+ title: '收入总金额(2022-01-01至今)',
|
|
|
+ width: 400,
|
|
|
+ key: 'revenueamount'
|
|
|
+ }, {
|
|
|
+ title: '开票总应收',
|
|
|
+ width: 200,
|
|
|
+ key: 'totalamount'
|
|
|
+ }],
|
|
|
+ sumWidth: 0,
|
|
|
+ sumtotalamount: "0.00"
|
|
|
+ },
|
|
|
+ onLoad(options) {
|
|
|
+ this.setData({
|
|
|
+ pointsL: this.data.points.map(v => getApp().globalData.Language.getMapText(v))
|
|
|
+ })
|
|
|
+ this.getList()
|
|
|
+ getApp().globalData.Language.getLanguagePackage(this, 'E-订单');
|
|
|
+ this.setSumWidth()
|
|
|
+ },
|
|
|
+ setSumWidth() {
|
|
|
+ this.setData({
|
|
|
+ sumWidth: this.data.table.reduce((prev, cur) => {
|
|
|
+ return prev.width ? prev.width + cur.width : prev + cur.width
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ 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": 20241217135703,
|
|
|
+ content
|
|
|
+ }).then(res => {
|
|
|
+ if (res.code != '1') return wx.showToast({
|
|
|
+ title: res.msg,
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ this.setListHeight()
|
|
|
+ this.selectComponent('#ListBox').RefreshToComplete();
|
|
|
+ console.log("应收账款列表", res)
|
|
|
+ let list = res.data.map(v => {
|
|
|
+ v.openingbalance = CNY(v.openingbalance)
|
|
|
+ v.sumreceivableamount = CNY(v.sumreceivableamount)
|
|
|
+ v.sumrevenueamount = CNY(v.sumrevenueamount)
|
|
|
+ v.receivableamount = CNY(v.receivableamount)
|
|
|
+ v.revenueamount = CNY(v.revenueamount)
|
|
|
+ v.totalamount = CNY(v.totalamount)
|
|
|
+ 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,
|
|
|
+ sumtotalamount: list.length ? CNY(list[0].sumtotalamount) : '0.00'
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ toDetail(e) {
|
|
|
+ let {
|
|
|
+ item
|
|
|
+ } = e.currentTarget.dataset;
|
|
|
+ let content = {
|
|
|
+ ...this.data.content
|
|
|
+ };
|
|
|
+ content.dataid = item.userid || item.sa_customersid;
|
|
|
+ console.log(content)
|
|
|
+ wx.navigateTo({
|
|
|
+ url: '/packageA/accountReceivable/detail?content=' + JSON.stringify(content),
|
|
|
+ })
|
|
|
+ },
|
|
|
+ querytypeChange(e) {
|
|
|
+ this.setData({
|
|
|
+ "content.querytype": e.detail.value
|
|
|
+ });
|
|
|
+ if (e.detail.value == 0) {
|
|
|
+ this.data.table[0] = {
|
|
|
+ title: '部门',
|
|
|
+ width: 230,
|
|
|
+ key: 'depname',
|
|
|
+ fun: 'toDetail'
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.data.table[0] = {
|
|
|
+ title: '客户名称',
|
|
|
+ width: 330,
|
|
|
+ key: 'enterprisename',
|
|
|
+ fun: 'toDetail'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.setData({
|
|
|
+ table: this.data.table
|
|
|
+ })
|
|
|
+ this.getList(true)
|
|
|
+ },
|
|
|
+ pointChange(e) {
|
|
|
+ this.setData({
|
|
|
+ 'content.point': this.data.points[e.detail.value],
|
|
|
+ table: [{
|
|
|
+ title: '客户名称',
|
|
|
+ width: 330,
|
|
|
+ key: 'enterprisename',
|
|
|
+ fun: 'toDetail'
|
|
|
+ }, {
|
|
|
+ title: '业务员',
|
|
|
+ width: 200,
|
|
|
+ key: 'name'
|
|
|
+ }, {
|
|
|
+ title: '期初余额(2021-12-31)',
|
|
|
+ width: 330,
|
|
|
+ key: 'openingbalance'
|
|
|
+ }, {
|
|
|
+ title: this.data.points[e.detail.value] + '总金额(2022-01-01至今)',
|
|
|
+ width: 400,
|
|
|
+ key: 'receivableamount'
|
|
|
+ }, {
|
|
|
+ title: '收入总金额(2022-01-01至今)',
|
|
|
+ width: 400,
|
|
|
+ key: 'revenueamount'
|
|
|
+ }, {
|
|
|
+ title: this.data.points[e.detail.value] + '总应收',
|
|
|
+ width: 200,
|
|
|
+ key: 'totalamount'
|
|
|
+ }],
|
|
|
+ })
|
|
|
+ this.getList(true)
|
|
|
+ },
|
|
|
+ onReady() {
|
|
|
+ this.setListHeight()
|
|
|
+ this.selectComponent("#organization").initDepAndUser();
|
|
|
+ },
|
|
|
+ /* 设置页面高度 */
|
|
|
+ setListHeight() {
|
|
|
+ this.selectComponent("#ListBox").setHeight(".roof", this);
|
|
|
+ },
|
|
|
+ openFiltrate() {
|
|
|
+ this.setData({
|
|
|
+ showFiltrate: true
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleFilter({
|
|
|
+ detail
|
|
|
+ }) {
|
|
|
+
|
|
|
+ if (detail.name == 'reset') {
|
|
|
+ this.selectComponent("#organization").initDepAndUser()
|
|
|
+ this.setData({
|
|
|
+ 'content.dataid': wx.getStorageSync('userMsg').userid,
|
|
|
+ 'content.type': 0,
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ let active = this.selectComponent("#organization").data.result;
|
|
|
+ let type = active.userid ? 0 : 1,
|
|
|
+ dataid = type == 0 ? active.userid : active.departmentid
|
|
|
+ this.setData({
|
|
|
+ 'content.dataid': dataid,
|
|
|
+ 'content.type': type
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ 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)
|
|
|
+ },
|
|
|
+})
|