xiaohaizhao před 3 roky
rodič
revize
ffc0e970bd

+ 169 - 0
packageA/contract/add/setclient/select.js

@@ -0,0 +1,169 @@
+const _Http = getApp().globalData.http;
+
+Page({
+    data: {
+        params: {}, //请求体
+        result: [], //返回结果
+        radio: false, //是否为单选
+        idname: "sa_customersid", //idkey
+        showName: "enterprisename", //表单用 显示名称
+    },
+    onLoad(options) {
+        if (options.params) {
+            let params = JSON.parse(options.params);
+            if (!params.content.pageNumber || !params.content.pageTotal) {
+                params.content.pageNumber = 1;
+                params.content.pageTotal = 1;
+            }
+            this.setData({
+                params
+            });
+        }
+        if (options.title) wx.setNavigationBarTitle({
+            title: options.title,
+        })
+        this.setData({
+            radio: options.radio ? true : false,
+            idname: options.idname || this.data.idname,
+            showName: options.showName || this.data.showName,
+        });
+        this.getList()
+    },
+    getList(init = false) {
+        //init 用于初始化分页
+        if (init.detail != undefined) init = init.detail;
+        let params = this.data.params;
+        if (init) params.content.pageNumber = 1;
+        if (params.content.pageNumber > params.content.pageTotal) return;
+        _Http.basic(params).then(res => {
+            console.log("选择客户列表", res)
+            this.selectComponent('#ListBox').RefreshToComplete();
+            if (res.msg != '成功') return wx.showToast({
+                title: res.data,
+                icon: "none"
+            })
+            this.setData({
+                'params.content.pageNumber': res.pageNumber + 1,
+                'params.content.pageTotal': res.pageTotal,
+                'params.content.total': res.total,
+                list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data)
+            })
+            this.getTags();
+        })
+    },
+    tabChange(e) {
+        this.data.params.content.where.type = e.detail.title == '客户' ? 2 : 1;
+        this.getList(true);
+    },
+    /* 获取列表标签 */
+    getTags() {
+        let list = this.data.list,
+            ownerids = list.map(v => v.sa_customersid);
+        _Http.basic({
+            "id": 20221018102001,
+            "content": {
+                nocache: true,
+                "ownertable": "sa_customers",
+                ownerids
+            }
+        }).then(res => {
+            console.log("标签", res)
+            if (res.data == '失败') return this.getTags1();
+            for (let key in res.data) {
+                let index = list.findIndex(v => v.sa_customersid == key);
+                list[index].tags = res.data[key]
+            };
+            this.setData({
+                list
+            })
+        })
+    },
+    /* 竞争对手标签 */
+    getTags1() {
+        let list = this.data.list,
+            ownerids = list.map(v => v.sa_competitorid);
+        _Http.basic({
+            "id": 20221018102001,
+            "content": {
+                nocache: true,
+                "ownertable": "sa_competitor",
+                ownerids
+            }
+        }).then(res => {
+            console.log("标签1", res)
+            for (let key in res.data) {
+                let index = list.findIndex(v => v.sa_competitorid == key);
+                list[index].tags = res.data[key]
+            };
+            this.setData({
+                list
+            })
+        })
+    },
+    /* 删除项 */
+    deteleItem(id) {
+        this.setData({
+            list: this.data.list.filter(v => v[this.data.idname] != id),
+            "params.content.total": this.data.params.content.total - 1
+        })
+    },
+    /* 选中 */
+    changeResult(e) {
+        let {
+            id
+        } = e.currentTarget.dataset, result = this.data.result;
+        if (this.data.radio) {
+            result = [id];
+        } else {
+            result.some(v => v == id) ? result = result.filter(v => v != id) : result.push(id)
+        }
+        this.setData({
+            result
+        });
+        if (this.data.radio) this.submit();
+    },
+    /* 提交 */
+    submit() {
+        let result = this.data.result,
+            obj = this.data.radio ? {
+                id: result,
+                item: this.data.list.find(value => value[this.data.idname] == result),
+                value: [this.data.list.find(value => value[this.data.idname] == result)[this.data.showName], result]
+            } : {
+                result,
+                list: result.map(v => this.data.list.find(value => value[this.data.idname] == v)),
+                value: [result.map(v => {
+                    let data = this.data.list.find(value => value[this.data.idname] == v);
+                    return data ? data[this.data.showName] : ""
+                }), result]
+            }
+        getApp().globalData.handleSelect && getApp().globalData.handleSelect(obj)
+    },
+    /* 开始搜索 */
+    startSearch({
+        detail
+    }) {
+        let condition = this.data.content ? this.data.content.where.condition : this.data.params.content.where.condition;
+        if (detail == condition) return;
+        this.setData({
+            'content.where.condition': detail,
+            'params.content.where.condition': detail
+        });
+        this.getList(true);
+    },
+    /* 取消搜索 */
+    onClear() {
+        this.setData({
+            'content.where.condition': "",
+            'params.content.where.condition': ""
+        });
+        this.getList(true);
+    },
+    onReady() {
+        this.selectComponent("#ListBox").setHeight(".total", this);
+    },
+    onUnload() {
+        //回收数据
+        getApp().globalData.handleSelect = null;
+    }
+})

+ 4 - 0
packageA/contract/add/setclient/select.json

@@ -0,0 +1,4 @@
+{
+    "usingComponents": {},
+    "navigationBarTitleText": "选择客户"
+}

+ 119 - 0
packageA/contract/add/setclient/select.scss

@@ -0,0 +1,119 @@
+page {
+    height: 100vh;
+    overflow: hidden;
+}
+
+.total {
+    height: 60rpx;
+    line-height: 60rpx;
+    font-size: 24rpx;
+    font-family: PingFang SC-Regular, PingFang SC;
+    color: #666666;
+    padding-left: 30rpx;
+}
+
+.footer {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    padding: 0 30rpx;
+    position: fixed;
+    width: 100vw;
+    height: 130rpx;
+    background: #FFFFFF;
+    box-shadow: 0px -4rpx 16rpx 2rpx rgba(150, 157, 165, 0.16);
+    bottom: 0;
+    box-sizing: border-box;
+
+    .count {
+        font-size: 28rpx;
+        font-family: PingFang SC-Regular, PingFang SC;
+        color: #333333;
+    }
+
+    .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;
+    }
+}
+
+.setclient-list-item {
+    display: flex;
+    align-items: center;
+    width: 100vw;
+    padding-left: 30rpx;
+    background-color: #fff;
+    box-sizing: border-box;
+
+    .con {
+        display: flex;
+        width: 100%;
+        min-height: 136rpx;
+        border-bottom: 1px solid #EFEFEF;
+        box-sizing: border-box;
+        padding-top: 20rpx;
+
+        .portrait {
+            width: 96rpx;
+            height: 96rpx;
+            background: #E7EEFF;
+            border-radius: 16rpx;
+            font-size: 24rpx;
+            font-family: PingFang SC-Regular, PingFang SC;
+            color: #3874F6;
+            padding: 16rpx 24rpx;
+            box-sizing: border-box;
+            margin-right: 20rpx;
+            flex-shrink: 0;
+        }
+
+        .min-portrait {
+            display: flex;
+            align-items: center;
+            padding: 0 !important;
+            justify-content: center;
+        }
+
+        .mian {
+            flex: 1;
+            width: 0;
+            padding-right: 20rpx;
+            box-sizing: border-box;
+
+            .label {
+                font-size: 28rpx;
+                font-family: PingFang SC-Bold, PingFang SC;
+                font-weight: bold;
+                color: #333333;
+                height: 40rpx;
+                line-height: 40rpx;
+            }
+
+            .tag-box {
+                margin-top: 10rpx;
+
+                .tag {
+                    height: 40rpx;
+                    font-size: 20rpx;
+                    font-family: PingFang SC-Regular, PingFang SC;
+                    padding: 0 12rpx;
+                    margin-right: 10rpx;
+                }
+            }
+        }
+
+        .extend {
+            display: flex;
+            height: 116rpx;
+            width: 48rpx;
+            margin-right: 30rpx;
+            flex-shrink: 0;
+        }
+    }
+}

+ 47 - 0
packageA/contract/add/setclient/select.wxml

@@ -0,0 +1,47 @@
+<van-tabs bindchange="tabChange" color='var(--assist)' custom-class='custom-class'>
+    <van-tab title="客户" />
+    <van-tab title="经销商" />
+</van-tabs>
+<van-search class="search" value="{{ params.content.where.condition }}" shape="round" placeholder="请输入搜索关键词" bind:search='startSearch' bind:clear='onClear' />
+<Yl_ListBox id='ListBox' bind:getlist='getList'>
+    <view class="total">共{{params.content.total}}个</view>
+    <navigator class="setclient-list-item" url="#" wx:for="{{list}}" wx:key="index" data-id="{{item[idname]}}" bindtap="changeResult">
+        <van-checkbox wx:if="{{!radio}}" value="{{ handle.isCheck(item[idname],result) }}" shape="square" icon-size='28rpx' />
+        <view class="con">
+            <view class="portrait {{item.enterprisename <=2?'min-portrait':''}}">
+                {{handle.getName(item.enterprisename)}}
+            </view>
+            <view class="mian">
+                <view class="label line-1">{{item.enterprisename}}</view>
+                <view class="tag-box">
+                    <van-tag custom-class='tag' wx:if="{{item.type}}" wx:for-item='tag' color='#FA8C16' text-color='#fff' round>{{item.type}}</van-tag>
+                    <van-tag custom-class='tag' wx:for="{{item.tags.systemtag}}" wx:key="index" wx:for-item='tag' color='#FA8C16' text-color='#fff' round>{{tag}}</van-tag>
+                    <van-tag custom-class='tag' wx:for="{{item.tags.datatag}}" wx:key="index" wx:for-item='tag' color='#FAAB16' text-color='#fff' round>{{tag}}</van-tag>
+                </view>
+            </view>
+        </view>
+    </navigator>
+    <view style="height: 230rpx;" />
+    <My_empty wx:if="{{!list.length}}" />
+</Yl_ListBox>
+<block wx:if="{{!radio}}">
+    <view style="height: 130rpx;" />
+    <view class="footer">
+        <view class="count">
+            已选:{{result.length}}
+        </view>
+        <van-button custom-class='but' disabled='{{result.length==0}}' bind:click="submit">确定</van-button>
+    </view>
+</block>
+<wxs module="handle">
+    module.exports = {
+        getName: function (name) {
+            return name.substring(0, 4)
+        },
+        isCheck: function (id, list) {
+            return list.some(function (v) {
+                return v == id
+            });
+        },
+    }
+</wxs>

+ 4 - 0
packageA/setclient/detail.js

@@ -39,6 +39,10 @@ Page({
             label: "账户余额",
             icon: "icon-tabkaipiaoxinxi",
             model: "#Account"
+        }, {
+            label: "银行卡信息",
+            icon: "icon-tabchanpin",
+            model: "#Bankcard"
         }, {
             label: "开票信息",
             icon: "icon-tabbaojiadan",

+ 2 - 1
packageA/setclient/detail.json

@@ -13,7 +13,8 @@
         "Files": "/packageA/public/files/index",
         "Project": "./modules/project/index",
         "Account": "./modules/account/index",
-        "Contract":"./modules/contract/index"
+        "Contract": "./modules/contract/index",
+        "Bankcard": "./modules/bankcard/index"
     },
     "navigationBarTitleText": "客户详情"
 }

+ 1 - 0
packageA/setclient/detail.wxml

@@ -31,6 +31,7 @@
     <Offers slot='报价单' id='Offers' disabled="{{per.query(options,'offer')||isAdmin||isLeader}}" />
     <Contract slot='合同' id='Contract' />
     <Account slot='账户余额' id='Account' />
+    <Bankcard slot='银行卡信息' id="Bankcard" />
     <Financing slot='开票信息' id="Financing" disabled="{{per.query(options,'invoice')||isAdmin||isLeader}}" />
     <Record slot="操作" id="Record" ownertable='sa_customers' ownerid='{{detail.sa_customersid}}' />
     <Files slot="附件" id="Files" ownertable='sa_customers' ownerid='{{detail.sa_customersid}}' />

+ 1 - 1
packageA/setclient/index.json

@@ -2,5 +2,5 @@
     "usingComponents": {
         "list": "./modules/list/index"
     },
-    "navigationBarTitleText": "客户"
+    "navigationBarTitleText": "企业客户"
 }

+ 77 - 0
packageA/setclient/modules/bankcard/index.js

@@ -0,0 +1,77 @@
+const _Http = getApp().globalData.http;
+Component({
+    properties: {
+        disabled: Boolean
+    },
+    data: {
+        list: [],
+        sys_enterpriseid: "",
+        "content": {
+            "nocache": true,
+            "pageNumber": 1,
+            "pageTotal": 1,
+            "total": null,
+            "type": 1,
+            "where": {
+                "condition": ""
+            }
+        }
+    },
+    methods: {
+        getList(id, init) {
+            let content = this.data.content;
+            content.sys_enterpriseid = id;
+            if (init) content.pageNumber = 1
+            _Http.basic({
+                "id": "20221022165803",
+                content
+            }).then(res => {
+                console.log("银行卡信息", res)
+                if (res.msg != '成功') return wx.showToast({
+                    title: res.data,
+                    icon: "none"
+                })
+                this.setData({
+                    list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
+                    "content.pageNumber": res.pageNumber + 1,
+                    "content.pageSize": res.pageSize,
+                    "content.pageTotal": res.pageTotal,
+                    "content.total": res.total,
+                    sys_enterpriseid: id
+                });
+            })
+        },
+        addOffers() {
+            wx.navigateTo({
+                url: '/packageA/setclient/modules/bankcard/update?sys_enterpriseid=' + this.data.sys_enterpriseid,
+            })
+        },
+        /* 修改总数 */
+        changeTotal() {
+            this.setData({
+                "content.total": this.data.content.total - 1
+            })
+        },
+        deleteItem({
+            detail
+        }) {
+            _Http.basic({
+                "id": 20221022165903,
+                "content": {
+                    "sys_enterprise_bankids": [detail.sys_enterprise_bankid]
+                }
+            }).then(res => {
+                console.log("删除", res)
+                wx.showToast({
+                    title: res.msg == '成功' ? '删除成功' : res.msg,
+                    icon: "none",
+                    mask: true
+                })
+                if (res.msg == '成功') this.setData({
+                    list: this.data.list.filter(v => v.sys_enterprise_bankid != detail.sys_enterprise_bankid),
+                    "content.total": this.data.content.total - 1
+                })
+            })
+        }
+    }
+})

+ 6 - 0
packageA/setclient/modules/bankcard/index.json

@@ -0,0 +1,6 @@
+{
+    "component": true,
+    "usingComponents": {
+        "list": "./list/index"
+    }
+}

+ 1 - 0
packageA/setclient/modules/bankcard/index.scss

@@ -0,0 +1 @@
+@import "../address/head.scss";

+ 12 - 0
packageA/setclient/modules/bankcard/index.wxml

@@ -0,0 +1,12 @@
+<view class="head">
+	<view class="count">
+		总共{{content.total}}个
+	</view>
+	<view class="expand">
+		<navigator url="#" class="but" bindtap="addOffers">
+			<van-icon name="plus" />
+		</navigator>
+	</view>
+</view>
+<!-- wx:if="{{disabled}}" -->
+<list list='{{list}}' disabled='{{disabled}}' bind:deleteItem="deleteItem" />

+ 34 - 0
packageA/setclient/modules/bankcard/list/index.js

@@ -0,0 +1,34 @@
+Component({
+    properties: {
+        list: Array,
+        deleteItem: Function
+    },
+    options: {
+        addGlobalClass: true
+    },
+    methods: {
+        handleItem(e) {
+            const {
+                item,
+                name
+            } = e.target.dataset,
+                that = this;
+            if (!item) return;
+            if (name == 'edit') {
+                wx.navigateTo({
+                    url: '/packageA/setclient/modules/bankcard/update?data=' + JSON.stringify(item)
+                })
+            } else {
+                wx.showModal({
+                    title: `提示`,
+                    content: '是否确定删除?',
+                    complete: ({
+                        confirm
+                    }) => {
+                        if (confirm) that.triggerEvent("deleteItem", item)
+                    }
+                })
+            }
+        }
+    }
+})

+ 4 - 0
packageA/setclient/modules/bankcard/list/index.json

@@ -0,0 +1,4 @@
+{
+    "component": true,
+    "usingComponents": {}
+}

+ 86 - 0
packageA/setclient/modules/bankcard/list/index.scss

@@ -0,0 +1,86 @@
+.offer-list {
+	width: 100%;
+	padding: 20rpx 30rpx;
+	box-sizing: border-box;
+	background-color: #fff;
+	border-bottom: 1rpx solid #ddd;
+	font-family: PingFang SC-Regular, PingFang SC;
+	position: relative;
+	margin-bottom: 20rpx;
+	padding-bottom: 0;
+
+	.haed {
+		.action {
+			position: absolute;
+			right: 0;
+			bottom: 30rpx;
+		}
+
+		.title {
+			position: relative;
+			display: flex;
+			height: 42rpx;
+			align-items: center;
+
+			>text {
+				display: inline-block;
+				width: 80%;
+				font-size: 30rpx;
+				color: #333333;
+			}
+
+			.status {
+				position: absolute;
+				right: -30rpx;
+				width: 132rpx;
+				height: 40rpx;
+				border-radius: 20rpx 0px 0px 20rpx;
+				box-sizing: border-box;
+				padding-left: 30rpx;
+				line-height: 40rpx;
+				font-size: 24rpx;
+				font-family: PingFang SC-Regular, PingFang SC;
+				color: #FFFFFF;
+			}
+		}
+
+		.exp {
+			height: 34rpx;
+			font-size: 24rpx;
+			color: #666;
+			margin-top: 8rpx;
+
+			text {
+				color: #333333;
+			}
+		}
+	}
+
+
+	.editor {
+		display: flex;
+		justify-content: flex-end;
+		width: 100%;
+		border-top: 1px solid #ddd;
+		.icon-but {
+			padding-right: 30rpx;
+
+			navigator {
+				display: inline-block;
+				width: 60rpx;
+				height: 60rpx;
+				line-height: 60rpx;
+				text-align: center;
+				margin-left: 30rpx;
+				width: 32px;
+				color: #707070;
+			}
+		}
+	}
+}
+
+.line-1 {
+	overflow: hidden;
+	white-space: nowrap;
+	text-overflow: ellipsis;
+}

+ 22 - 0
packageA/setclient/modules/bankcard/list/index.wxml

@@ -0,0 +1,22 @@
+<view class="offer-list" wx:for="{{list}}" wx:key="index">
+	<view class="haed">
+		<view class="title">
+			<text class="line-1">{{item.bank || " --"}}</text>
+		</view>
+		<view class="exp line-1">开户人:{{item.name||" --"}}</view>
+		<view class="exp line-1">手机号码:{{item.phonenumber||" --"}}</view>
+		<view class="exp line-1">银行名称:{{item.bank||" --"}}</view>
+		<view class="exp line-1">银行卡号:{{item.bankcardno||" --"}}</view>
+	</view>
+	<!--  wx:if="{{disabled}}"
+ wx:if="{{disabled}}" -->
+	<view style="height: 20rpx;" />
+	<view class="editor">
+		<view class="icon-but" bindtap="handleItem">
+			<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>
+
+<My_empty wx:if="{{!list.length}}" />

+ 103 - 0
packageA/setclient/modules/bankcard/update.js

@@ -0,0 +1,103 @@
+const _Http = getApp().globalData.http;
+
+Page({
+    data: {
+        form: [{
+            label: "银行名称",
+            error: false,
+            errMsg: "",
+            type: "textarea",
+            value: "",
+            placeholder: "银行名称",
+            valueName: "bank",
+            required: true,
+            checking: "base"
+        }, {
+            label: "卡号",
+            error: false,
+            errMsg: "",
+            type: "number",
+            value: "",
+            placeholder: "卡号",
+            valueName: "bankcardno",
+            required: true,
+            checking: "base"
+        }, {
+            label: "开户人",
+            error: false,
+            errMsg: "",
+            type: "textarea",
+            value: "",
+            placeholder: "开户人",
+            valueName: "name",
+            required: true
+        }, {
+            label: "手机号码",
+            error: false,
+            errMsg: "",
+            type: "phone",
+            value: "",
+            placeholder: "手机号码",
+            valueName: "phonenumber",
+            required: false,
+            checking: "phone"
+        }],
+        disabled: true,
+        "content": {
+            "sys_enterprise_bankid": 0
+        },
+    },
+    onLoad(options) {
+        this.data.content.sys_enterpriseid = options.sys_enterpriseid || 0;
+        console.log(options)
+        if (options.data) {
+            let data = JSON.parse(options.data);
+            this.setData({
+                disabled: false,
+                content: {
+                    sys_enterpriseid: data.sys_enterpriseid,
+                    sys_enterprise_bankid: data.sys_enterprise_bankid,
+                },
+                form: this.data.form.map(v => {
+                    v.value = data[v.valueName] || "";
+                    return v
+                })
+            })
+        }
+    },
+    submit() {
+        let content = Object.assign(this.data.content, this.selectComponent("#Form").submit());
+        wx.showModal({
+            title: '提示',
+            content: '是否确定添加银行卡',
+            complete: ({
+                confirm
+            }) => {
+                if (confirm) _Http.basic({
+                    "id": 20221022165703,
+                    content
+                }).then(res => {
+                    console.log("创建银行卡信息", res)
+                    wx.showToast({
+                        title: res.msg != '成功' ? '添加成功' : res.msg,
+                        icon: "none",
+                        mask: true
+                    });
+                    if (res.msg == '成功') setTimeout(() => {
+                        let pages = getCurrentPages()[getCurrentPages().length - 2];
+                        pages.selectComponent("#Bankcard").getList(content.sys_enterpriseid, true);
+                        wx.navigateBack()
+                    }, 500)
+                })
+            }
+        })
+    },
+    /* 表单是否填写完成 */
+    onConfirm({
+        detail
+    }) {
+        this.setData({
+            disabled: detail
+        })
+    },
+})

+ 4 - 0
packageA/setclient/modules/bankcard/update.json

@@ -0,0 +1,4 @@
+{
+    "usingComponents": {},
+    "navigationBarTitleText": "银行卡信息"
+}

+ 37 - 0
packageA/setclient/modules/bankcard/update.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;
+    }
+}

+ 4 - 0
packageA/setclient/modules/bankcard/update.wxml

@@ -0,0 +1,4 @@
+<Yl_field id='Form' form="{{form}}" bind:onConfirm='onConfirm' />
+<view class="footer">
+	<van-button custom-class='but' disabled='{{disabled}}' bindclick="submit">确定</van-button>
+</view>