xiaohaizhao 6 månader sedan
förälder
incheckning
4bffcbb9d6

+ 9 - 2
project.private.config.json

@@ -10,12 +10,19 @@
     "condition": {
         "miniprogram": {
             "list": [
+                {
+                    "name": "prsx/hospital/insert",
+                    "pathName": "prsx/hospital/insert",
+                    "query": "",
+                    "scene": null,
+                    "launchMode": "default"
+                },
                 {
                     "name": "prsx/hospital/detail",
                     "pathName": "prsx/hospital/detail",
                     "query": "id=6710",
-                    "scene": null,
-                    "launchMode": "default"
+                    "launchMode": "default",
+                    "scene": null
                 },
                 {
                     "name": "prsx/hospital/index",

+ 22 - 0
prsx/department/index.js

@@ -78,6 +78,28 @@ Page({
                     title: res.msg,
                     icon: "none"
                 })
+                res.data = res.data.map(v => {
+                    v.totalstage = v.stages.length
+                    v.stage = v.stages.findIndex(s => s.stagename == v.stagename) + 1
+                    v.progress = v.stage / v.totalstage * 100;
+                    return v
+                })
+                setTimeout(() => {
+                    if (res.pageNumber == 1 && res.data.length && !this.data.filtratelist.some(v => v.label == '开发阶段')) {
+                        this.data.filtratelist.push({
+                            label: "开发阶段",
+                            index: null,
+                            showName: "stagename", //显示字段
+                            valueKey: "stagename", //返回Key
+                            selectKey: "stagename", //传参 代表选着字段 不传参返回整个选择对象
+                            value: "", //选中值
+                            list: res.data[0].stages
+                        })
+                        this.setData({
+                            filtratelist: this.data.filtratelist
+                        })
+                    }
+                }, 1500);
                 this.setData({
                     content: _Http.paging(content, res, this, 'sa_hospitaldep', res.data, _Http),
                     list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data)

+ 1 - 4
prsx/department/index.wxml

@@ -1,8 +1,5 @@
 <Yl_nav search list='{{navList}}' sort='{{content.sort}}' bind:onClick='navClick' bind:onSearch='onSearch' />
-<view class="global-total">
-	<text wx:if="{{language['总共']}}">{{language['总共']}}:{{content.total}}</text>
-	<text wx:else>总共{{content.total}}个</text>
-</view>
+<view class="global-total">总共{{content.total}}个</view>
 <Yl_ListBox id='ListBox' bind:getlist='getList'>
 	<navigator url="/prsx/department/detail?id={{item.sa_hospitaldepid}}" class="project-item" wx:for="{{list}}" wx:key="sa_hospitaldepid">
 		<view class="chart">

+ 77 - 31
prsx/hospital/detail.js

@@ -1,9 +1,4 @@
-const _Http = getApp().globalData.http,
-    currency = require("../../utils/currency"),
-    CNY = value => currency(value, {
-        symbol: "¥",
-        precision: 2
-    }).format();
+const _Http = getApp().globalData.http;
 Page({
     data: {
         loading: true,
@@ -11,6 +6,8 @@ Page({
         tabsActive: 0, //tabs 选中项
         sa_customersid: 0,
         sColors: getApp().globalData.sColors,
+        deletereasonShow: false,
+        deletereason: "",
     },
     onLoad(options) {
         const appAuth = wx.getStorageSync('auth').wCustomer;
@@ -53,7 +50,38 @@ Page({
             this.partialRenewal();
         });
     },
+    areaInput(e) {
+        this.setData({
+            deletereason: e.detail.value
+        })
+    },
+    onCancel() {
+        this.setData({
+            deletereasonShow: false,
+        })
+    },
+    deleteItem() {
+        _Http.basic({
+            id: 20221010164402,
+            content: {
+                deletereason: this.data.deletereason,
+                sa_customersids: [this.data.sa_customersid],
+                datastatus: '1'
+            }
+        }).then(res => {
+            console.log("作废", res)
+
+            wx.showToast({
+                title: res.code == 1 ? '作废成功' : res.msg,
+                icon: "none",
+                mask: res.code == 1
+            })
 
+            if (res.code == 1) setTimeout(() => {
+                wx.navigateBack()
+            }, 300)
+        })
+    },
     setPreview(res) {
         /* 摘要信息 */
         let briefs = [{
@@ -158,9 +186,13 @@ Page({
             that = this;
         switch (detail.label) {
             case "编辑":
-                data.parentid = data.superiorenterprisename ? [data.superiorenterprisename, [data.parentid]] : "";
                 wx.navigateTo({
-                    url: `/packageA/setclient/addAndEditor?data=${JSON.stringify(data)}`,
+                    url: `/prsx/hospital/insert?data=${JSON.stringify(data)}`,
+                })
+                break;
+            case "作废":
+                that.setData({
+                    deletereasonShow: true
                 })
                 break;
             case "更换负责人":
@@ -231,12 +263,6 @@ Page({
             isLeader = detail.leader.some(some => some.userid == wx.getStorageSync('userMsg').userid),
             editdataleader = isLeader ? 1 : 0,
             tabbarList = [];
-
-        if (this.data.appAuth.isdatafollowup && detail.status != '已终止') tabbarList.push({
-            icon: "color-genjin",
-            label: "跟进"
-        });
-
         if (!isLeader) {
             let res = await getApp().agentOrNot("sa_customers", this.data.sa_customersid),
                 data = res.code == '1' ? res.data : {
@@ -247,28 +273,22 @@ Page({
             if (!isLeader) isLeader = data.editable == 1;
             editdataleader = data.editdataleader;
         }
-
-        //负责人或管理员基础功能
-        if ((isLeader || isAdmin) && detail.status != '已终止') {
+        tabbarList.push({
+            icon: "color-bianji",
+            label: "编辑"
+        })
+        if (isLeader || isAdmin) {
+      
             tabbarList.push({
-                icon: "color-bianji",
-                label: "编辑"
-            })
-            if (editdataleader) tabbarList.push({
-                icon: "color-genghuanfuzeren",
-                label: "更换负责人"
-            })
-        }
-        if (detail.agentstatus == '启用' && detail.erpagentnum) {} else {
-            if (isLeader || isAdmin) tabbarList.push({
                 icon: "icon-shanchu",
                 label: "作废"
             })
         }
-        if (this.data.options.find(v => v == 'viewRepetition')) tabbarList.push({
-            icon: "icon-a-shouyejingangquhehuoren",
-            label: "查看重复"
-        });
+
+        // if (this.data.appAuth.options.find(v => v == 'viewRepetition')) tabbarList.push({
+        //     icon: "icon-a-shouyejingangquhehuoren",
+        //     label: "查看重复"
+        // });
         this.setData({
             tabbarList,
             isLeader
@@ -333,5 +353,31 @@ Page({
                 page.getTags()
             }
         })
+    },
+    onUnload() {
+        const page = getCurrentPages().find(v => v.__route__ == 'prsx/hospital/index');
+        if (!page) return;
+        let content = JSON.parse(JSON.stringify(page.data.content));
+        content.pageSize = (content.pageNumber - 1) * content.pageSize;
+        content.pageNumber = 1;
+        _Http.basic({
+            id: '20221012164402',
+            content
+        }).then(res => {
+            console.log("更新列表", res);
+            if (res.code == '1') {
+                res.data = res.data.map(v => {
+                    v.totalstage = v.stages.length
+                    v.stage = v.stages.findIndex(s => s.stagename == v.stagename) + 1
+                    v.progress = v.stage / v.totalstage * 100;
+                    return v
+                })
+                page.setData({
+                    list: res.data,
+                    "content.total": res.total
+                })
+                _Http.getTabs(page, 'sa_customers', res.data, _Http)
+            }
+        })
     }
 })

+ 3 - 1
prsx/hospital/detail.json

@@ -1,4 +1,6 @@
 {
-    "usingComponents": {},
+    "usingComponents": {
+        "van-dialog": "@vant/weapp/dialog/index"
+    },
     "navigationBarTitleText": "医院详情"
 }

+ 11 - 0
prsx/hospital/detail.scss

@@ -63,4 +63,15 @@
 	overflow: hidden;
 	white-space: nowrap;
 	text-overflow: ellipsis;
+}
+
+.textarea {
+	width: 90%;
+	height: 200rpx;
+	box-sizing: border-box;
+	padding: 20rpx 30rpx;
+	background-color: #FDF9FC;
+	margin: 20rpx auto;
+	border: 1rpx solid #EEECEF;
+	border-radius: 8rpx;
 }

+ 5 - 1
prsx/hospital/detail.wxml

@@ -20,4 +20,8 @@
 </Yl_FunTabs>
 <!-- 底部 -->
 <Yl_Tabbar wx:if="{{tabbarList.length}}" list='{{tabbarList}}' bind:callback="tabbarOnClick" />
-<wxs src='../../utils/wxmlQueryPer.wxs' module="per" />
+<wxs src='../../utils/wxmlQueryPer.wxs' module="per" />
+
+<van-dialog confirmButtonText="确定" cancelButtonText="取消" use-slot title="作废情况说明" show="{{ deletereasonShow }}" show-cancel-button confirm-button-color='#3874F6' bind:confirm='deleteItem' bind:cancel='onCancel'>
+    <textarea placeholder="情况说明" value="{{deletereason}}" data-name="deletereason" bindinput="areaInput" class="textarea" />
+</van-dialog>

+ 24 - 1
prsx/hospital/index.js

@@ -33,7 +33,8 @@ Page({
                 "type": "",
                 "stagename": ""
             }
-        }
+        },
+        filtratelist: []
     },
     async onLoad(options) {
         getApp().globalData.Language.getLanguagePackage(this);
@@ -125,6 +126,28 @@ Page({
                     title: res.msg,
                     icon: "none"
                 })
+                res.data = res.data.map(v => {
+                    v.totalstage = v.stages.length
+                    v.stage = v.stages.findIndex(s => s.stagename == v.stagename) + 1
+                    v.progress = v.stage / v.totalstage * 100;
+                    return v
+                })
+                setTimeout(() => {
+                    if (res.pageNumber == 1 && res.data.length && !this.data.filtratelist.some(v => v.label == '开发阶段')) {
+                        this.data.filtratelist.push({
+                            label: "开发阶段",
+                            index: null,
+                            showName: "stagename", //显示字段
+                            valueKey: "stagename", //返回Key
+                            selectKey: "stagename", //传参 代表选着字段 不传参返回整个选择对象
+                            value: "", //选中值
+                            list: res.data[0].stages
+                        })
+                        this.setData({
+                            filtratelist: this.data.filtratelist
+                        })
+                    }
+                }, 1500);
                 this.setData({
                     content: _Http.paging(content, res, this, 'sa_customers', res.data, _Http),
                     list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data)

+ 2 - 2
prsx/hospital/index.wxml

@@ -1,6 +1,6 @@
 <Yl_nav search list='{{navList}}' sort='{{content.sort}}' bind:onClick='navClick' bind:onSearch='onSearch' />
 <view class="global-total">
-	<text>总共{{content.total}}个</text>
+	总共{{content.total}}个
 </view>
 <Yl_ListBox id='ListBox' bind:getlist='getList'>
 	<navigator url="/prsx/hospital/detail?id={{item.sa_customersid}}" class="project-item" wx:for="{{list}}" wx:key="sa_customersid">
@@ -9,7 +9,7 @@
 				<view class="circle_left ab" style="{{render.leftRate(item.progress)}}" />
 				<view class="circle_right ab" style="{{render.rightRate(item.progress)}}" />
 				<view class="circle_text">
-					<!-- <text class="value">{{item.stage+'/'+item.totalstage}}</text> -->
+					<text class="value">{{item.stage+'/'+item.totalstage}}</text>
 					<text class="name">{{item.stagename}}</text>
 				</view>
 			</view>

+ 202 - 148
prsx/hospital/insert.js

@@ -8,164 +8,160 @@ Page({
         repetitionShow: false,
         repetitionList: [],
         content: {
-            sa_hospitaldepid: 0
+            sa_customersid: 0,
+            province: '',
+            city: '',
+            county: ''
         },
         disabled: true,
     },
     onLoad(options) {
         let form = [{
-            label: "医院名称",
-            error: false,
-            errMsg: "",
-            type: "textarea",
-            value: "",
-            placeholder: "医院名称",
-            valueName: "enterprisename",
-            checking: "base",
-            slot: "info",
-            required: true
-        }, {
-            label: "医院等级",
-            error: false,
-            errMsg: "",
-            type: "option",
-            optionNmae: "hospitalgrade",
-            optionType: "radio", //复选   radio 单选
-            value: "",
-            placeholder: "医院等级",
-            valueName: "grade",
-            checking: "base",
-            required: true
-        }, {
-            label: "医院类型",
-            error: false,
-            errMsg: "",
-            type: "option",
-            optionNmae: "hospitaltype",
-            optionType: "radio", //复选   radio 单选
-            value: "",
-            placeholder: "医院类型",
-            valueName: "type",
-            checking: "base",
-            required: true
-        }, {
-            label: "省市县",
-            error: false,
-            errMsg: "",
-            type: "region",
-            value: [],
-            placeholder: "省/市/县",
-            valueName: "region",
-            required: true
-        }, {
-            label: "详细地址",
-            error: false,
-            errMsg: "",
-            type: "textarea",
-            value: "",
-            placeholder: "详细地址",
-            valueName: "address",
-            checking: "base",
-            required: false
-        }, {
-            label: "负责人",
-            error: false,
-            errMsg: "",
-            type: "route",
-            url: "/prsx/select/saler/index",
-            value: "",
-            placeholder: "负责人",
-            valueName: "saler_userid",
-            checking: "base",
-            required: true,
-            params: {
-                "id": 20221011144603,
-                "content": {
-                    "sa_saleareaid": '',
-                    "isExport": 0,
-                    "pageNumber": 1,
-                    "pageSize": 20,
-                    "where": {
-                        "condition": ""
-                    }
-                },
-            },
-            query: "&radio=true",
-            required: true
-        }, {
-            label: "营销区域",
-            error: false,
-            errMsg: "",
-            type: "route",
-            url: "/prsx/select/area/index",
-            radio: true,
-            value: "",
-            placeholder: "营销区域",
-            valueName: "saler_userid",
-            checking: "base",
-            required: true,
-            params: {
-                "classname": "webmanage.sale.salearea.salearea",
-                "content": {},
-                "method": "query_area",
-            },
-            required: true
-        }, {
-            label: "医院规模",
-            error: false,
-            errMsg: "",
-            type: "textarea",
-            value: "",
-            placeholder: "医院规模",
-            valueName: "scale",
-            checking: "base",
-            required: false
-        }, {
-            label: "医院床位",
-            error: false,
-            errMsg: "",
-            type: "number",
-            value: "",
-            placeholder: "医院床位",
-            valueName: "bed",
-            checking: "base",
-            required: false
-        }, {
-            label: "手术间",
-            error: false,
-            errMsg: "",
-            type: "textarea",
-            value: "",
-            placeholder: "手术间",
-            valueName: "room",
-            checking: "base",
-            required: false
-        }, {
-            label: "主机数量",
-            error: false,
-            errMsg: "",
-            type: "number",
-            value: "",
-            placeholder: "主机数量",
-            valueName: "host",
-            checking: "base",
-            required: false
-        }]
+                label: "医院名称",
+                error: false,
+                errMsg: "",
+                type: "textarea",
+                value: "",
+                placeholder: "医院名称",
+                valueName: "enterprisename",
+                checking: "base",
+                slot: "info",
+                required: true
+            }, {
+                label: "医院等级",
+                error: false,
+                errMsg: "",
+                type: "option",
+                optionNmae: "hospitalgrade",
+                optionType: "radio", //复选   radio 单选
+                value: "",
+                placeholder: "医院等级",
+                valueName: "grade",
+                checking: "base",
+                required: true
+            }, {
+                label: "医院类型",
+                error: false,
+                errMsg: "",
+                type: "option",
+                optionNmae: "hospitaltype",
+                optionType: "radio", //复选   radio 单选
+                value: "",
+                placeholder: "医院类型",
+                valueName: "type",
+                checking: "base",
+                required: true
+            }, {
+                label: "省市县",
+                error: false,
+                errMsg: "",
+                type: "region",
+                value: [],
+                placeholder: "省/市/县",
+                valueName: "region",
+                required: true
+            }, {
+                label: "详细地址",
+                error: false,
+                errMsg: "",
+                type: "textarea",
+                value: "",
+                placeholder: "详细地址",
+                valueName: "address",
+                checking: "base",
+                required: false
+            }, {
+                label: "负责人",
+                error: false,
+                errMsg: "",
+                type: "route",
+                url: "/prsx/select/saler/index",
+                value: "",
+                placeholder: "负责人",
+                valueName: "saler_userid",
+                checking: "base",
+                required: true,
+                params: {},
+                query: "&radio=true",
+                required: true,
+                interrupt: true
+            }, {
+                label: "营销区域",
+                error: false,
+                errMsg: "",
+                type: "selector",
+                range: [],
+                rangeKey: "areaname",
+                selectKey: "areaname",
+                rangeIndex: "",
+                value: "",
+                placeholder: "营销区域",
+                valueName: "sa_saleareaid",
+                required: true, //必填
+                disabled: true
+            }, {
+                label: "医院规模",
+                error: false,
+                errMsg: "",
+                type: "textarea",
+                value: "",
+                placeholder: "医院规模",
+                valueName: "scale",
+                checking: "base",
+                required: false
+            }, {
+                label: "医院床位",
+                error: false,
+                errMsg: "",
+                type: "number",
+                value: "",
+                placeholder: "医院床位",
+                valueName: "bed",
+                checking: "base",
+                required: false
+            }, {
+                label: "手术间",
+                error: false,
+                errMsg: "",
+                type: "textarea",
+                value: "",
+                placeholder: "手术间",
+                valueName: "room",
+                checking: "base",
+                required: false
+            }, {
+                label: "主机数量",
+                error: false,
+                errMsg: "",
+                type: "number",
+                value: "",
+                placeholder: "主机数量",
+                valueName: "host",
+                checking: "base",
+                required: false
+            }],
+            hrid = '';
         if (options.data) {
             let data = JSON.parse(options.data);
             form = form.map(v => {
                 if (v.valueName != 'region') {
                     v.value = data[v.valueName] || "";
-                    if (v.valueName == "grade") v.value = data[v.valueName] + "";
+                    if (v.valueName == 'saler_userid') {
+                        let leader = data.leader[0];
+                        v.value = [leader.name, [leader.userid]]
+                    }
+                    if (v.valueName == 'sa_saleareaid') v.value = data.areaname;
                 } else {
                     v.value = data.province ? [data.province, data.city, data.county] : []
                 };
+                if (['省市县', '详细地址'].includes(v.label)) v.disabled = true;
                 return v
             })
+            hrid = data.leader[0].hr.hrid;
             this.setData({
                 disabled: false,
                 content: {
-                    sa_hospitaldepid: data.sa_hospitaldepid,
+                    sa_customersid: data.sa_customersid
                 },
                 form
             })
@@ -173,11 +169,29 @@ Page({
             // 业务员
             if (![0, 21].includes(wx.getStorageSync('userMsg').usertype)) {
                 let item = form.find(v => v.laber == '负责人');
-                if (item) {
-                    item.disabled = true;
-                }
+                if (item) item.disabled = true;
+                hrid = wx.getStorageSync('userMsg').hrid;
             }
         }
+
+        if (hrid) {
+            _Http.basic({
+                "method": "query_hrMain",
+                "classname": "webmanage.hr.hr",
+                "content": {
+                    hrid
+                },
+            }).then(res => {
+                if (res.code != 1) return;
+                let obj = form.find(v => v.label == '营销区域')
+                obj.range = res.data.salearea;
+                obj.value = obj.range[0].areaname;
+                obj.disabled = false;
+                this.setData({
+                    form
+                })
+            })
+        }
         this.setData({
             form
         })
@@ -200,11 +214,39 @@ Page({
             showAll: detail
         })
     },
+    interrupt(e) {
+        const {
+            data,
+            form,
+            temporary
+        } = e.detail;
+        console.log(data, form, temporary)
+        if (temporary.item.label == '负责人') {
+            form.find(v => v.label == '负责人').value = data.value;
+            let obj = form.find(v => v.label == '营销区域')
+            obj.range = data.item.sa_saleareas;
+            obj.value = obj.range[0].areaname;
+            obj.disabled = false;
+            wx.navigateBack()
+        }
+        this.selectComponent("#Form").confirm();
+        this.setData({
+            form
+        })
+    },
     async submit() {
         this.setData({
             loading: true
         })
         let data = this.selectComponent("#Form").submit();
+        data.saler_userid = data.saler_userid[1][0];
+        data.sa_saleareaid = this.data.form.find(v => v.label == '营销区域').range.find(v => v.areaname == data.sa_saleareaid).sa_saleareaid;
+        if (data.region.length) {
+            data.province = data.region[0];
+            data.city = data.region[1];
+            data.county = data.region[2];
+        }
+        delete data.region
         _Http.basic({
             "id": 20221012163902,
             "content": {
@@ -215,12 +257,24 @@ Page({
             this.setData({
                 loading: false
             })
-            console.log("新建医院", res)
-            if (res.code != '1') return wx.showToast({
-                title: res.msg,
-                icon: "none"
+            wx.showToast({
+                title: res.code != '1' ? res.msg : '保存成功',
+                icon: "none",
+                mask: res.code == '1'
+            })
+            if (res.code != '1') return;
+            getCurrentPages().forEach(v => {
+                if (v.route == 'prsx/hospital/detail') v.getDetail()
             })
-            getApp().globalData.Language.showToast('保存成功')
+            setTimeout(() => {
+                if (this.data.content.sa_customersid == 0) {
+                    wx.redirectTo({
+                        url: '/prsx/hospital/detail?id=' + res.data.sa_customersid,
+                    })
+                } else {
+                    wx.navigateBack()
+                }
+            }, 300)
         })
     },
 })

+ 2 - 2
prsx/hospital/insert.wxml

@@ -2,7 +2,7 @@
 <Yl_field id='Form' form='{{form}}' showAll='{{!showAll}}' bind:onConfirm='onConfirm' bind:interrupt='interrupt' />
 <view style="height: 160rpx;" />
 <view class="new-footer" style="padding-bottom:12rpx;">
-	<van-button custom-class="new-submit {{content.sa_hospitaldepid ? 'orange' : 'blue' }}" disabled='{{disabled ||loading}}' loading='{{loading}}' bindclick='submit'>
-		{{content.sa_hospitaldepid ? '保存' : '确定'}}
+	<van-button custom-class="new-submit {{content.sa_customersid ? 'orange' : 'blue' }}" disabled='{{disabled ||loading}}' loading='{{loading}}' bindclick='submit'>
+		{{content.sa_customersid ? '保存' : '确定'}}
 	</van-button>
 </view>

+ 6 - 0
prsx/select/hospital/index.js

@@ -40,6 +40,12 @@ Page({
                 title: res.data,
                 icon: "none"
             })
+            res.data = res.data.map(v => {
+                v.totalstage = v.stages.length
+                v.stage = v.stages.findIndex(s => s.stagename == v.stagename) + 1
+                v.progress = v.stage / v.totalstage * 100;
+                return v
+            })
             this.setData({
                 'params.content.pageNumber': res.pageNumber + 1,
                 'params.content.pageTotal': res.pageTotal,

+ 0 - 9
prsx/select/hospital/index.scss

@@ -1,12 +1,3 @@
-.total {
-	height: 60rpx;
-	line-height: 60rpx;
-	font-size: 24rpx;
-	font-family: PingFang SC-Regular, PingFang SC;
-	color: #666666;
-	padding-left: 30rpx;
-}
-
 .project-item {
 	display: flex;
 	align-items: center;

+ 1 - 4
prsx/select/hospital/index.wxml

@@ -1,9 +1,6 @@
 <van-search value="{{ params.content.where.condition }}" shape='round' placeholder="{{language['关键字']||'请输入搜索关键词'}}" use-action-slot bind:clear='onClear' bind:search="startSearch">
 </van-search>
-<view class="total">
-    <text wx:if="{{language['总共']}}">{{language['总共']}}:{{params.content.total}}</text>
-    <text wx:else>总共{{params.content.total}}个</text>
-</view>
+<view class="global-total">总共{{params.content.total}}个</view>
 <Yl_ListBox id='ListBox' bind:getlist='getList'>
     <navigator url="#" class="project-item" wx:for="{{list}}" wx:key="sa_customersid" data-id="{{item.sa_customersid}}" bind:tap="changeResult">
         <view class="chart">

+ 108 - 54
prsx/select/saler/index.js

@@ -1,66 +1,120 @@
-// prsx/select/saler/index.js
-Page({
+const _Http = getApp().globalData.http;
 
-    /**
-     * 页面的初始数据
-     */
+Page({
     data: {
-
+        params: {}, //请求体
+        result: [], //返回结果
+        radio: false, //是否为单选
+        idname: "userid", //idkey
+        showName: "name", //表单用 显示名称
     },
-
-    /**
-     * 生命周期函数--监听页面加载
-     */
     onLoad(options) {
-
+        _Http.basic({
+            "classname": "webmanage.sale.salearea.salearea",
+            "method": "query_area",
+            "content": {},
+        }).then(res => {
+            if (res.code == 1) {
+                this.setData({
+                    params: {
+                        "id": 20221011144603,
+                        "content": {
+                            "sa_saleareaid": res.data[0].sa_saleareaid,
+                            "isExport": 0,
+                            "pageNumber": 1,
+                            "pageSize": 20,
+                            pageTotal: 1,
+                            "where": {
+                                "condition": ""
+                            }
+                        },
+                    }
+                });
+                this.getList()
+            }
+        })
+        this.setData({
+            radio: options.radio ? true : false,
+            idname: options.idname || this.data.idname,
+            showName: options.showName || this.data.showName
+        });
     },
-
-    /**
-     * 生命周期函数--监听页面初次渲染完成
-     */
-    onReady() {
-
+    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;
+        //init 用于初始化分页
+        _Http.basic(params).then(res => {
+            console.log("选择联系人列表", res)
+            this.selectComponent('#ListBox').RefreshToComplete();
+            if (res.code != '1') 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)
+            })
+        })
     },
-
-    /**
-     * 生命周期函数--监听页面显示
-     */
-    onShow() {
-
+    /* 选中 */
+    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();
     },
-
-    /**
-     * 生命周期函数--监听页面隐藏
-     */
-    onHide() {
-
+    /* 提交 */
+    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)
     },
-
-    /**
-     * 生命周期函数--监听页面卸载
-     */
-    onUnload() {
-
+    /* 开始搜索 */
+    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);
     },
-
-    /**
-     * 页面相关事件处理函数--监听用户下拉动作
-     */
-    onPullDownRefresh() {
-
+    /* 取消搜索 */
+    onClear() {
+        this.setData({
+            'content.where.condition': "",
+            'params.content.where.condition': ""
+        });
+        this.getList(true);
     },
-
-    /**
-     * 页面上拉触底事件的处理函数
-     */
-    onReachBottom() {
-
+    onUnload() {
+        //回收数据
+        getApp().globalData.handleSelect = null;
     },
-
-    /**
-     * 用户点击右上角分享
-     */
-    onShareAppMessage() {
-
-    }
 })

+ 2 - 1
prsx/select/saler/index.json

@@ -1,3 +1,4 @@
 {
-    "usingComponents": {}
+    "usingComponents": {},
+    "navigationBarTitleText": "选择负责人"
 }

+ 52 - 1
prsx/select/saler/index.scss

@@ -1 +1,52 @@
-/* prsx/select/saler/index.wxss */
+.title {
+	font-size: 30rpx;
+	font-family: PingFang SC-Regular, PingFang SC;
+	color: #333333;
+}
+
+.row {
+	min-height: 34rpx;
+	font-size: 24rpx;
+	font-family: PingFang SC-Regular, PingFang SC;
+	color: #333333;
+	margin-top: 8rpx;
+}
+
+
+.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;
+	}
+}
+
+.iconfont {
+	font-size: 28rpx;
+	font-family: PingFang SC-Regular, PingFang SC;
+	color: #666666;
+	padding: 0 10rpx;
+}

+ 52 - 2
prsx/select/saler/index.wxml

@@ -1,2 +1,52 @@
-<!--prsx/select/saler/index.wxml-->
-<text>prsx/select/saler/index.wxml</text>
+<van-search value="{{ params.content.where.condition }}" shape='round' placeholder="{{language['关键字']||'请输入搜索关键词'}}" use-action-slot bind:clear='onClear' bind:search="startSearch">
+</van-search>
+<view class="global-total">总共{{params.content.total}}个</view>
+<Yl_ListBox id='ListBox' bind:getlist='getList'>
+	<view class="global-card" wx:for='{{list}}' hover-class="navigator-hover" wx:key="userid" data-id="{{item.userid}}" bind:tap="changeResult">
+		<view class="title">{{item.name || ' --'}}</view>
+		<view class="row">编号:{{item.accountno || ' --'}}</view>
+		<view class="row">手机号:{{item.phonenumber || ' --'}}</view>
+		<view class="row">营销区域:{{item.areaname || ' --'}}</view>
+		<view class="row">部门:{{item.depname || ' --'}}</view>
+		<view class="row">职位:{{item.position || ' --'}}</view>
+	</view>
+	<view wx:if="{{!radio}}" style="height: 70rpx;" />
+	<My_empty wx:if="{{!list.length}}" />
+</Yl_ListBox>
+<block wx:if="{{!radio}}">
+	<view class="footer">
+		<view class="count">
+			{{language['已选']||'已选'}}:{{result.length}}
+		</view>
+		<van-button custom-class='but' disabled='{{result.length==0}}' bind:click="submit">{{language['确定']||'确定'}}</van-button>
+	</view>
+	<wxs module="handle">
+		module.exports = {
+			isCheck: function (id, list) {
+				return list.some(function (v) {
+					return v == id
+				});
+			},
+		}
+	</wxs>
+</block>
+
+<wxs src="../../../utils/nominalpressure.wxs" module="join"></wxs>
+
+
+<wxs module="render">
+	module.exports = {
+		rightRate: function (rate) {
+			if (rate - 0 < 50) {
+				return 'transform: rotate(' + 3.6 * (rate - 0) + 'deg);';
+			} else {
+				return 'transform: rotate(0);border-color: var(--assist);';
+			}
+		},
+		leftRate: function (rate) {
+			if (rate - 0 >= 50) {
+				return 'transform: rotate(' + 3.6 * (rate - 50) + 'deg);';
+			}
+		}
+	}
+</wxs>