浏览代码

客户财务信息

zhaoxiaohai 2 年之前
父节点
当前提交
4dad6ff6d2

+ 130 - 0
packageA/setclient/modules/financing/add/index.js

@@ -0,0 +1,130 @@
+const _Http = getApp().globalData.http;
+Page({
+    data: {
+        form: [{
+            label: "名称",
+            error: false,
+            errMsg: "",
+            type: "textarea",
+            value: "",
+            placeholder: "企业名称",
+            valueName: "enterprisename",
+            required: true,
+            checking: "base"
+        }, {
+            label: "纳税人识别号",
+            error: false,
+            errMsg: "",
+            type: "number",
+            value: "",
+            placeholder: "纳税人识别号",
+            valueName: "taxno",
+            required: true,
+            checking: "base"
+        }, {
+            label: "账号",
+            error: false,
+            errMsg: "",
+            type: "number",
+            value: [],
+            placeholder: "银行账户",
+            valueName: "bankcardno",
+            required: true
+        }, {
+            label: "开户行",
+            error: false,
+            errMsg: "",
+            type: "textarea",
+            value: [],
+            placeholder: "开户行",
+            valueName: "bank",
+            required: true
+        }, {
+            label: "详细地址",
+            error: false,
+            errMsg: "",
+            type: "textarea",
+            value: "",
+            placeholder: "例: 浙江省嘉兴市南湖区中山路...",
+            valueName: "address",
+            required: true,
+            checking: "base"
+        }, {
+            label: "联系人号码",
+            error: false,
+            errMsg: "",
+            type: "phone",
+            value: "",
+            placeholder: "联系人手机号码",
+            valueName: "phonenumber",
+            required: true,
+            checking: "phone"
+        }],
+        disabled: true,
+        "content": {
+            "sys_enterprise_financeid": 0,
+            "remarks": "",
+            "isdefault": 0
+        },
+    },
+    onLoad(options) {
+        if (options.data) {
+            let item = JSON.parse(options.data)
+            this.setData({
+                form: this.data.form.map(v => {
+                    v.value = item[v.valueName]
+                    return v
+                }),
+                "content.sys_enterprise_financeid": item.sys_enterprise_financeid,
+                "content.remarks": item.remarks,
+                "content.isdefault": item.isdefault,
+                disabled: false
+            })
+        }
+    },
+    /* 提交数据 */
+    submit() {
+        let data = this.selectComponent("#Form").submit();
+        if (!data || this.data.disabled) return;
+        let pages = getCurrentPages(),
+            content = {
+                ...this.data.content,
+                ...data
+            };
+        content.sys_enterpriseid = pages[pages.length - 2].data.detail.sys_enterpriseid;
+        _Http.basic({
+            "id": "20221013160402",
+            content
+        }).then(res => {
+            console.log("添加财务信息", res)
+            if (res.msg != '成功') return wx.showToast({
+                title: res.data,
+                icon: "none"
+            });
+            wx.showToast({
+                title: '保存成功',
+                icon: "none"
+            });
+            setTimeout(() => {
+                let pages = getCurrentPages();
+                pages[pages.length - 2].partialRenewal(true);
+                wx.navigateBack();
+            }, 500)
+        })
+    },
+    /* 设置默认 */
+    checkboxChange() {
+        this.setData({
+            "content.isdefault": this.data.content.isdefault == 1 ? 0 : 1
+        })
+    },
+    /* 表单是否填写完成 */
+    onConfirm({
+        detail
+    }) {
+        this.setData({
+            disabled: detail
+        })
+    },
+    onShareAppMessage() {}
+})

+ 4 - 0
packageA/setclient/modules/financing/add/index.json

@@ -0,0 +1,4 @@
+{
+    "usingComponents": {},
+    "navigationBarTitleText": "财务信息"
+}

+ 37 - 0
packageA/setclient/modules/financing/add/index.scss

@@ -0,0 +1,37 @@
+.radio-box {
+    display: flex;
+    padding-left: 20rpx;
+    height: 60rpx;
+    background-color: #fff;
+
+    .radio {
+        font-size: 26rpx;
+        font-family: PingFang SC-Regular, PingFang SC;
+        color: #666666;
+    }
+}
+
+
+.footer {
+    display: flex;
+    align-items: center;
+    justify-content: flex-end;
+    position: fixed;
+    width: 750rpx;
+    height: 130rpx;
+    background: #FFFFFF;
+    box-shadow: 0px -4rpx 16rpx 2rpx rgba(150, 157, 165, 0.16);
+    bottom: 0;
+
+    .but {
+        width: 156rpx;
+        height: 90rpx;
+        background: #3874F6;
+        border-radius: 8rpx;
+        font-size: 28rpx;
+        font-family: PingFang SC-Bold, PingFang SC;
+        font-weight: bold;
+        color: #FFFFFF;
+        margin-right: 30rpx;
+    }
+}

+ 8 - 0
packageA/setclient/modules/financing/add/index.wxml

@@ -0,0 +1,8 @@
+<Yl_field id='Form' form="{{form}}" bind:onConfirm='onConfirm' />
+<view class="radio-box">
+    <van-checkbox icon-size='14' label-class='radio' value="{{ content.isdefault == 1 }}" bind:change="checkboxChange">设置为默认</van-checkbox>
+</view>
+<view style="height: 130rpx;" />
+<view class="footer">
+    <van-button custom-class='but' disabled='{{disabled}}' bindtap="submit">确定</van-button>
+</view>

+ 191 - 0
packageA/setclient/modules/financing/list/index.js

@@ -0,0 +1,191 @@
+const _Http = getApp().globalData.http;
+Component({
+  options: {
+    addGlobalClass: true
+  },
+  properties: {
+    list: Array,
+    changeTotal: Function
+  },
+  data: {
+    radio: 0,
+    detail: {
+      item: {},
+      list: [],
+      show: false
+    },
+    tabbarList: [{
+      icon: "icon-bodadianhua",
+      label: "呼叫",
+      alias: "call"
+    }, {
+      icon: "icon-a-yingxiaowuliaofuzhi",
+      label: "复制",
+      alias: "copy"
+    }, {
+      icon: "icon-bianji",
+      label: "编辑",
+      alias: "edit"
+    }, {
+      icon: "icon-shanchu",
+      label: "删除",
+      alias: "delete"
+    }]
+  },
+  methods: {
+    //详情单元格单击复制
+    clickItem({
+      detail
+    }) {
+      wx.setClipboardData({
+        data: detail.value,
+        success: () => {
+          wx.hideToast();
+          wx.showToast({
+            title: `已复制${detail.label}`,
+            icon: "none"
+          })
+        }
+      })
+    },
+    //打开详情
+    onClick(e) {
+      const {
+        item
+      } = e.currentTarget.dataset;
+      this.setData({
+        "detail.show": true,
+        "detail.list": [{
+          label: "名称",
+          value: item.enterprisename
+        }, {
+          label: "纳税人识别号",
+          value: item.taxno
+        }, {
+          label: "地址",
+          value: item.address
+        }, {
+          label: "开户行",
+          value: item.bank
+        }, {
+          label: "账号",
+          value: item.bankcardno
+        }, {
+          label: "联系人号码",
+          value: item.phonenumber
+        }],
+        "detail.item": item
+      })
+    },
+    //关闭详情弹窗
+    onClose() {
+      this.setData({
+        detail: {
+          item: {},
+          list: [],
+          show: false
+        }
+      })
+    },
+    /* 处理快捷小按钮 */
+    handleItem(e) {
+      const {
+        name,
+        item
+      } = e.target.dataset,
+        that = this;
+      if (!name) return;
+      switch (name) {
+        case "call":
+          wx.makePhoneCall({
+            phoneNumber: item.phonenumber,
+          })
+          break;
+        case "copy":
+          wx.setClipboardData({
+            data: `名称:${item.enterprisename}\n纳税人识别号:${item.taxno}\n地址:${item.address}\n开户行:${item.bank}\n账号:${item.bankcardno}`,
+          })
+          break;
+        case "delete":
+          wx.showModal({
+            title: '提示',
+            content: '是否确认删除',
+            complete: (res) => {
+              if (res.confirm) {
+                _Http.basic({
+                  "id": 20221013160502,
+                  "content": {
+                    "sys_enterprise_financeids": [item.sys_enterprise_financeid]
+                  },
+                }).then(res => {
+                  if (res.msg != '成功') return wx.showToast({
+                    title: res.data,
+                    icon: "none"
+                  });
+                  that.setData({
+                    list: that.data.list.filter(v => v.sys_enterprise_financeid != item.sys_enterprise_financeid)
+                  });
+                  that.triggerEvent("changeTotal");
+                  that.onClose();
+                  wx.showToast({
+                    title: '删除成功',
+                    icon: "none"
+                  });
+                })
+              }
+            }
+          })
+          break;
+        case "edit":
+          wx.navigateTo({
+            url: '/packageA/setclient/modules/financing/add/index?data=' + JSON.stringify(item),
+          });
+          that.onClose();
+          break;
+      }
+    },
+    /* 查询默认项目 */
+    queryDefault() {
+      const item = this.data.list.find(v => v.isdefault == 1);
+      this.setData({
+        radio: item.sys_enterprise_financeid
+      })
+    },
+    /* 修改默认项 */
+    onChange({
+      detail
+    }) {
+      _Http.basic({
+        "id": 20221013160702,
+        "content": {
+          "sys_enterprise_financeid": detail
+        },
+      }).then(res => {
+        if (res.msg != '成功') return wx.showToast({
+          title: res.data,
+          icon: "none"
+        });
+        this.setData({
+          list: this.data.list.map(v => {
+            v.isdefault = v.sys_enterprise_financeid == detail ? 1 : 0
+            return v
+          }),
+          radio: detail
+        })
+      })
+    },
+    //详情按钮回调
+    tabbarOnClick({
+      detail
+    }) {
+      this.handleItem({
+        target: {
+          dataset: {
+            name: detail.alias,
+            item: this.data.detail.item
+          }
+        }
+      })
+    }
+  }
+})

+ 7 - 0
packageA/setclient/modules/financing/list/index.json

@@ -0,0 +1,7 @@
+{
+    "component": true,
+    "usingComponents": {
+        "van-radio": "@vant/weapp/radio/index",
+        "van-radio-group": "@vant/weapp/radio-group/index"
+    }
+}

+ 16 - 0
packageA/setclient/modules/financing/list/index.scss

@@ -0,0 +1,16 @@
+@import "../../address/index.scss";
+
+.exp {
+  margin-top: 8rpx;
+  font-size: 24rpx;
+  font-family: PingFang SC-Regular, PingFang SC;
+  color: #333333;
+}
+
+.pop-title {
+  height: 90rpx;
+  line-height: 90rpx;
+  text-align: center;
+  border-bottom: 1px solid #dddddd;
+  font-weight: bold;
+}

+ 35 - 0
packageA/setclient/modules/financing/list/index.wxml

@@ -0,0 +1,35 @@
+<van-radio-group value="{{ radio }}" bind:change="onChange">
+  <view class="add-box" wx:for="{{list}}" wx:key="item.sys_enterprise_financeid">
+    <navigator url="#" class="detail" data-item="{{item}}" bindtap="onClick">
+      <view class="label">
+        {{item.enterprisename}}
+      </view>
+      <view class="exp">
+        银行账户:{{item.bankcardno}}
+      </view>
+      <view class="exp">
+        开户银行:{{item.bank}}
+      </view>
+      <view class="exp">
+        联系人电话:{{item.phonenumber}}
+      </view>
+    </navigator>
+    <view class="editor">
+      <van-radio icon-size='14' label-class='radio' name="{{item.sys_enterprise_financeid}}">默认收货地址</van-radio>
+      <view class="icon-but" bindtap="handleItem">
+        <navigator url="#" data-item="{{item}}" data-name="call" style="font-size: 26rpx;" class="iconfont icon-bodadianhua" />
+        <navigator url="#" data-item="{{item}}" data-name="copy" class="iconfont icon-a-yingxiaowuliaofuzhi" />
+        <navigator url="#" data-item="{{item}}" data-name="edit" class="iconfont icon-bianji" />
+        <navigator url="#" data-item="{{item}}" data-name="delete" class="iconfont icon-shanchu" />
+      </view>
+    </view>
+  </view>
+</van-radio-group>
+<My_empty wx:if="{{list.length==0}}" />
+
+
+<van-popup show="{{  detail.show }}" position="bottom" custom-style="height: 100%" round closeable safe-area-inset-bottom='{{false}}' bind:close='onClose' bind:cancel='onClose'>
+  <view class="pop-title">财务信息</view>
+  <Yl_ReportForms showAll='{{false}}' list='{{detail.list}}' bindclickItem='clickItem' />
+  <Yl_Tabbar list='{{tabbarList}}' bind:callback="tabbarOnClick" />
+</van-popup>