Преглед изворни кода

经销商新建编辑新增查重逻辑,销售订单新增科室字段

qymljy пре 4 месеци
родитељ
комит
44ebfa5041

+ 4 - 1
components/Yl_Filtrate1/index.js

@@ -184,9 +184,12 @@ Component({
                 name
             } = e.target.dataset;
             if (name == 'reset') {
+              console.log(this.data.startdate,'开始时间')
                 this.setData({
                     startdate: '',
-                    enddate: ''
+                    enddate: '',
+                    periodstart:'',
+                    periodend:''
                 })
                 this.setData({
                     list: this.data.list.map(v => {

+ 2 - 4
prsx/contract/detail.js

@@ -233,13 +233,11 @@ Page({
                 label: "跟进"
             });
         }
-
-        if (appAuth.update) tabbarList.push({
+        if (appAuth.options.includes("update")) tabbarList.push({
             icon: "color-bianji",
             label: "编辑"
         })
-
-        if (appAuth.delete) tabbarList.push({
+        if (appAuth.options.includes("delete")) tabbarList.push({
             icon: "icon-shanchu",
             label: "作废"
         })

+ 368 - 282
prsx/dealer/insert.js

@@ -1,296 +1,382 @@
 let _Http = getApp().globalData.http,
-    count = null;
+  count = null;
 
 Page({
-    data: {
-        loading: false,
-        showAll: false,
-        repetitionShow: false,
-        repetitionList: [],
-        content: {
-            sa_agentsid: 0
-        },
-        disabled: true,
+  data: {
+    loading: false,
+    showAll: false,
+    repetitionShow: false,
+    repetitionList: [],
+    content: {
+      sa_agentsid: 0
     },
-    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: "cooperatetype",
-            optionType: "radio", //复选   radio 单选
-            value: "",
-            placeholder: "合作类型",
-            valueName: "cooperatetype",
-            checking: "base",
-            required: true
-        }, {
-            label: "编号",
-            error: false,
-            errMsg: "",
-            type: "textarea",
-            value: "",
-            placeholder: "编号",
-            valueName: "agentnum",
-            checking: "base",
-            required: true
-        }, {
-            label: "erp编号",
-            error: false,
-            errMsg: "",
-            type: "textarea",
-            value: "",
-            placeholder: "erp编号",
-            valueName: "erpagentnum",
-            checking: "base",
-            required: false
-        }, {
-            label: "总经理姓名",
-            error: false,
-            errMsg: "",
-            type: "textarea",
-            value: "",
-            placeholder: "总经理姓名",
-            valueName: "gmname",
-            checking: "base",
-            required: true
-        }, {
-            label: "总经理电话",
-            error: false,
-            errMsg: "",
-            type: "number",
-            value: '',
-            placeholder: "总经理电话",
-            valueName: "gmphonenumber",
-            required: true,
-            checking: "phone"
-        }, {
-            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: "textarea",
-          value: "",
-          placeholder: "企业规模",
-          valueName: "scale",
-          checking: "base",
-          required: false
-      }, {
-        label: "主营产品/年营业额",
-        error: false,
-        errMsg: "",
-        type: "textarea",
-        value: "",
-        placeholder: "主营产品/年营业额",
-        valueName: "mainproducts",
-        checking: "base",
-        required: false
+    disabled: true,
+    countDown: "", //查重倒计时
+  },
+  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: "route",
-            url: "/prsx/select/firm/index",
-            value: "",
-            params: {
-                id: 20221011144903,
-                "content": {
-                    "pageSize": 20,
-                    "pageNumber": 1,
-                    "isAll": 1,
-                    "sa_saleareaids": [],
-                    "containssub": 1,
-                    "sa_saleareaid": "",
-                    "where": {}
-                },
-            },
-            query: "&radio=true",
-            placeholder: "选择上级企业",
-            valueName: "parentid",
-            checking: "base",
-            required: false
-        }, {
-            label: "备注",
-            error: false,
-            errMsg: "",
-            type: "textarea",
-            value: "",
-            placeholder: "备注",
-            valueName: "remarks",
-            checking: "base",
-            required: false
-        }]
-        if (options.data) {
-            let data = JSON.parse(options.data);
-            console.log("data", data)
-            data.parentid = [data.parent_enterprisename, [data.parentid]]
-            form = form.map(v => {
-                if (v.valueName != 'region') {
-                    v.value = data[v.valueName];
-                } else {
-                    v.value = data.province ? [data.province, data.city, data.county] : []
-                }
-                return v
-            })
-            this.setData({
-                disabled: false,
-                content: {
-                    sa_agentsid: data.sa_agentsid,
-                },
-                form
-            })
-        }
-        if (options.department) {
-            let department = JSON.parse(options.department);
-            let item = form.find(v => v.valueName == 'sa_hospitaldepid')
-            item.value = department;
-            item.disabled = true;
+      label: "合作类型",
+      error: false,
+      errMsg: "",
+      type: "option",
+      optionNmae: "cooperatetype",
+      optionType: "radio", //复选   radio 单选
+      value: "",
+      placeholder: "合作类型",
+      valueName: "cooperatetype",
+      checking: "base",
+      required: true
+    }, {
+      label: "编号",
+      error: false,
+      errMsg: "",
+      type: "textarea",
+      value: "",
+      placeholder: "编号",
+      valueName: "agentnum",
+      checking: "base",
+      required: true
+    }, {
+      label: "erp编号",
+      error: false,
+      errMsg: "",
+      type: "textarea",
+      value: "",
+      placeholder: "erp编号",
+      valueName: "erpagentnum",
+      checking: "base",
+      required: false
+    }, {
+      label: "总经理姓名",
+      error: false,
+      errMsg: "",
+      type: "textarea",
+      value: "",
+      placeholder: "总经理姓名",
+      valueName: "gmname",
+      checking: "base",
+      required: true
+    }, {
+      label: "总经理电话",
+      error: false,
+      errMsg: "",
+      type: "number",
+      value: '',
+      placeholder: "总经理电话",
+      valueName: "gmphonenumber",
+      required: true,
+      checking: "phone"
+    }, {
+      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: "textarea",
+      value: "",
+      placeholder: "企业规模",
+      valueName: "scale",
+      checking: "base",
+      required: false
+    }, {
+      label: "主营产品/年营业额",
+      error: false,
+      errMsg: "",
+      type: "textarea",
+      value: "",
+      placeholder: "主营产品/年营业额",
+      valueName: "mainproducts",
+      checking: "base",
+      required: false
+    }, {
+      label: "上级企业",
+      error: false,
+      errMsg: "",
+      type: "route",
+      url: "/prsx/select/firm/index",
+      value: "",
+      params: {
+        id: 20221011144903,
+        "content": {
+          "pageSize": 20,
+          "pageNumber": 1,
+          "isAll": 1,
+          "sa_saleareaids": [],
+          "containssub": 1,
+          "sa_saleareaid": "",
+          "where": {}
+        },
+      },
+      query: "&radio=true",
+      placeholder: "选择上级企业",
+      valueName: "parentid",
+      checking: "base",
+      required: false
+    }, {
+      label: "备注",
+      error: false,
+      errMsg: "",
+      type: "textarea",
+      value: "",
+      placeholder: "备注",
+      valueName: "remarks",
+      checking: "base",
+      required: false
+    }]
+    if (options.data) {
+      let data = JSON.parse(options.data);
+      console.log("data", data)
+      data.parentid = [data.parent_enterprisename, [data.parentid]]
+      form = form.map(v => {
+        if (v.valueName != 'region') {
+          v.value = data[v.valueName];
+        } else {
+          v.value = data.province ? [data.province, data.city, data.county] : []
         }
-        if (options.sa_customersid) {
-            let item = form.find(v => v.label == '所属科室')
-            item.params = {
-                "content": {
-                    "pageNumber": 1,
-                    "pageSize": 20,
-                    sa_customersid: options.sa_customersid,
-                    "where": {
-                        "condition": ""
-                    }
-                },
-                "id": 2025102310143002,
-            }
+        return v
+      })
+      this.setData({
+        disabled: false,
+        content: {
+          sa_agentsid: data.sa_agentsid,
+        },
+        form
+      })
+    }
+    if (options.department) {
+      let department = JSON.parse(options.department);
+      let item = form.find(v => v.valueName == 'sa_hospitaldepid')
+      item.value = department;
+      item.disabled = true;
+    }
+    if (options.sa_customersid) {
+      let item = form.find(v => v.label == '所属科室')
+      item.params = {
+        "content": {
+          "pageNumber": 1,
+          "pageSize": 20,
+          sa_customersid: options.sa_customersid,
+          "where": {
+            "condition": ""
+          }
+        },
+        "id": 2025102310143002,
+      }
+    }
+    this.setData({
+      form
+    })
+    getApp().globalData.Language.getLanguagePackage(this, options.data ? '编辑经销商' : '新建经销商');
+
+  },
+  /* 表单必填项是否完成 */
+  onConfirm({
+    detail
+  }) {
+    this.setData({
+      disabled: detail
+    })
+  },
+  // 是否显示全部
+  onChange({
+    detail
+  }) {
+    this.setData({
+      showAll: detail
+    })
+  },
+  async submit() {
+    this.setData({
+      loading: true
+    })
+    let data = this.selectComponent("#Form").submit(),
+      content = this.data.content;
+    data.parentid = data.parentid.length ? data.parentid[1][0] : 0
+    data.province = data.region[0] || "";
+    data.city = data.region[1] || "";
+    data.county = data.region[2] || "";
+    delete data.region
+    let query = await this.handleQueryRepetition({
+      sa_agentsid: this.data.content.sa_agentsid,
+      ...data
+  });
+  if (query.total != 0) {
+      wx.showModal({
+          content: `查询到“${query.total}”条疑似重复经销商信息,不可重复创建`,
+          confirmText: '我知道了',
+          showCancel: false
+      })
+      this.setData({
+          loading: false,
+          repetitionShow: true,
+          repetitionList: query.data.map(v => {
+              v.chars = v.chars.reduce((acc, item) => ({
+                  ...acc,
+                  ...item
+              }), {});
+              return v
+          }),
+          isSubmit: true
+      })
+  } else {
+      this.handleSubmit(data);
+  }
+  },
+  handleSubmit(data) {
+    _Http.basic({
+      "id": 2025102310145302,
+      "content": {
+        ...content,
+        ...data,
+      }
+    }).then(res => {
+      this.setData({
+        loading: false
+      })
+      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/dealer/detail') v.getDetail()
+      })
+      setTimeout(() => {
+        if (content.sa_agentsid == 0) {
+          wx.redirectTo({
+            url: '/prsx/dealer/detail?id=' + res.data.sa_agentsid,
+          })
+        } else {
+          wx.navigateBack()
         }
-        this.setData({
-            form
-        })
-        getApp().globalData.Language.getLanguagePackage(this, options.data ? '编辑经销商' : '新建经销商');
+      }, 300)
+    })
+  },
+  /* 工商查询 */
+  introduce({
+    detail
+  }) {
+    let item = detail;
+    let data = {
+      enterprisename: item.companyName, //企业名称
+      taxno: item.taxNum, //税号
+      contact: item.legalPerson, //法人
+      region: [item.regProvince ? item.regProvince : item.regCity, item.regCity, item.regArea], //地区
+      address: item.address, //地区
+      telephone: item.phone,
+    }
+    this.setData({
+      form: this.data.form.map(v => {
+        if (data[v.valueName]) v.value = data[v.valueName];
+        return v
+      }),
 
-    },
-    /* 表单必填项是否完成 */
-    onConfirm({
-        detail
-    }) {
-        this.setData({
-            disabled: detail
-        })
-    },
-    // 是否显示全部
-    onChange({
-        detail
-    }) {
+    })
+  },
+  /* 工商查询 */
+  queryClient() {
+    let data = this.selectComponent("#Form").query();
+    console.log("234243", data)
+    if (data.enterprisename == '') {
+      getApp().globalData.Language.showToast('您还未填写企业名称')
+    } else {
+      this.setData({
+        form: this.selectComponent("#Form").data.form,
+      })
+      this.selectComponent("#Info").queryClient(data.enterprisename)
+    }
+  },
+  repClose() {
+    this.setData({
+      repetitionShow: false,
+      isSubmit: false
+    })
+  },
+  /* 查询是否重复 */
+  async queryRepetition(e) {
+    let data = this.selectComponent("#Form").query();
+    data.province = data.region[0] || "";
+    data.city = data.region[1] || "";
+    data.county = data.region[2] || "";
+    let res = await this.handleQueryRepetition({
+      sa_agentsid: this.data.content.sa_agentsid,
+      ...data
+    });
+    console.log("查询重复", res)
+    if (res.code != '1') return wx.showToast({
+      title: res.msg,
+      icon: "none"
+    });
+    this.setData({
+      countDown: 6
+    });
+    count = setInterval(() => {
+      let countDown = this.data.countDown;
+      if (countDown == 0) {
+        clearInterval(count);
         this.setData({
-            showAll: detail
+          countDown: ""
         })
-    },
-    async submit() {
+      } else {
+        countDown--;
         this.setData({
-            loading: true
+          countDown
         })
-        let data = this.selectComponent("#Form").submit(),
-            content = this.data.content;
-        data.parentid = data.parentid.length ? data.parentid[1][0] : 0
-        data.province = data.region[0] || "";
-        data.city = data.region[1] || "";
-        data.county = data.region[2] || "";
-        delete data.region
-        _Http.basic({
-            "id": 2025102310145302,
-            "content": {
-                ...content,
-                ...data,
-            }
-        }).then(res => {
-            this.setData({
-                loading: false
-            })
-            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/dealer/detail') v.getDetail()
-            })
-            setTimeout(() => {
-                if (content.sa_agentsid == 0) {
-                    wx.redirectTo({
-                        url: '/prsx/dealer/detail?id=' + res.data.sa_agentsid,
-                    })
-                } else {
-                    wx.navigateBack()
-                }
-            }, 300)
+      }
+    }, 1000)
+    if (res.total == 0) {
+      getApp().globalData.Language.showToast('未查询到疑似重复的经销商信息')
+    } else {
+      wx.showToast({
+        title: getApp().globalData.Language.getMapText('查询到') + res.total + getApp().globalData.Language.getMapText('条疑似重复经销商信息'),
+        icon: "none"
+      })
+      this.setData({
+        repetitionShow: true,
+        repetitionList: res.data.map(v => {
+          v.chars = v.chars.reduce((acc, item) => ({
+            ...acc,
+            ...item
+          }), {});
+          return v
         })
-    },
-    /* 工商查询 */
-    introduce({
-        detail
-    }) {
-        let item = detail;
-        let data = {
-            enterprisename: item.companyName, //企业名称
-            taxno: item.taxNum, //税号
-            contact: item.legalPerson, //法人
-            region: [item.regProvince ? item.regProvince : item.regCity, item.regCity, item.regArea], //地区
-            address: item.address, //地区
-            telephone: item.phone,
-        }
-        this.setData({
-            form: this.data.form.map(v => {
-                if (data[v.valueName]) v.value = data[v.valueName];
-                return v
-            }),
-
-        })
-    },
-    /* 工商查询 */
-    queryClient() {
-        let data = this.selectComponent("#Form").query();
-        console.log("234243", data)
-        if (data.enterprisename == '') {
-            getApp().globalData.Language.showToast('您还未填写企业名称')
-        } else {
-            this.setData({
-                form: this.selectComponent("#Form").data.form,
-            })
-            this.selectComponent("#Info").queryClient(data.enterprisename)
-        }
-    },
-    repClose() {
-        this.setData({
-            repetitionShow: false,
-            isSubmit: false
-        })
-    },
+      })
+    }
+  },
+  /* 处理查重 */
+  handleQueryRepetition(content) {
+    return _Http.basic({
+      "id": 2025121613475302,
+      content
+    })
+  },
 })

+ 65 - 0
prsx/dealer/insert.scss

@@ -29,4 +29,69 @@
 		background: #F29C37;
 	}
 
+  .query {
+		border: 1rpx solid #CCCCCC !important;
+		background-color: #fff !important;
+		color: #666666 !important;
+	}
+}
+
+.popup {
+	.title {
+		position: sticky;
+		height: 80rpx;
+		line-height: 80rpx;
+		width: 100%;
+		text-align: center;
+		border-bottom: 1rpx solid #ddd;
+		font-weight: 600;
+		color: #333;
+		top: 0;
+		background-color: #fff;
+
+		.icon {
+			position: absolute;
+			right: 28rpx;
+			top: 22rpx;
+			color: #999;
+		}
+	}
+
+	.enterprise {
+		width: 100%;
+		box-sizing: border-box;
+		padding-left: 30rpx;
+		padding-right: 10rpx;
+		padding-bottom: 10rpx;
+		border-bottom: 1rpx solid #ddd;
+		margin-top: 10rpx;
+
+		&_title {
+			line-height: 40rpx;
+			font-size: 28rpx;
+			font-family: PingFang SC-Bold, PingFang SC;
+			font-weight: bold;
+			color: #333333;
+		}
+
+		.tag-box {
+			margin-top: 10rpx;
+
+			.tag {
+				height: 40rpx;
+				font-size: 20rpx;
+				font-family: PingFang SC-Regular, PingFang SC;
+				padding: 0 12rpx;
+				margin-right: 8rpx;
+			}
+		}
+
+		.exp {
+			line-height: 34rpx;
+			font-size: 24rpx;
+			font-family: PingFang SC-Regular, PingFang SC;
+			color: #666666;
+			margin-top: 8rpx;
+		}
+	}
 }

+ 30 - 1
prsx/dealer/insert.wxml

@@ -6,7 +6,36 @@
 </Yl_field>
 <view style="height: 160rpx;" />
 <view class="new-footer" style="padding-bottom:12rpx;">
+  <van-button custom-class='new-submit query' disabled='{{countDown || disabled}}' bindclick='queryRepetition'>{{countDown?countDown+'S':(language['查重']||'查重')}}</van-button>
 	<van-button custom-class="new-submit {{content.sa_agentsid ? 'orange' : 'blue' }}" disabled='{{disabled ||loading}}' loading='{{loading}}' bindclick='submit'>
 		{{content.sa_agentsid ? '保存' : '确定'}}
 	</van-button>
-</view>
+</view>
+
+<!-- 查重 -->
+<van-popup show="{{ repetitionShow }}" custom-class='popup' round position="bottom" custom-style="height: 100%;" bind:close="repClose">
+	<view class="title">
+		{{language['查重']||'查重'}}
+		<van-icon custom-class='icon' size='40rpx' name="cross" bindtap="repClose" />
+	</view>
+	<navigator url="#" class="enterprise" wx:for="{{repetitionList}}" wx:key="sys_enterpriseid" data-item="{{item}}" bindtap="toRepDetail">
+		<view class="enterprise_title" style="color: {{item.chars['enterprisename'] ? 'red' : '#666666'}}">{{item.enterprisename||" --"}}</view>
+		<view class="tag-box">
+			<van-tag custom-class='tag' wx:for="{{item.tag_sys}}" wx:key="index" wx:for-item='tag' color='#3874f6' text-color='#fff' round>{{language[tag]||tag}}</van-tag>
+			<van-tag custom-class='tag' wx:for="{{item.tag}}" wx:key="index" wx:for-item='tag' color='#FA8C16' text-color='#fff' round>{{language[tag]||tag}}</van-tag>
+		</view>
+		<view class="exp" style="color: {{item.chars['billno'] ? 'red' : '#666666'}}">编号:{{item.agentnum||" --"}}</view>
+    <view class="exp">状态:<text style="color: {{sColors[item.status]}}" F>{{item.status||" --"}}</text></view>
+    <view class="exp" style="color: {{item.chars['cooperatetype'] ? 'red' : '#666666'}}">合作类型:{{item.cooperatetype||" --"}}</view>
+    <view class="exp" style="color: {{item.chars['salernames'] ? 'red' : '#666666'}}">业务员:{{item.salernames||" --"}}</view>
+    <view class="exp" style="color: {{item.chars['areanames'] ? 'red' : '#666666'}}">营销区域:{{item.areanames||" --"}}</view>
+    <view class="exp" style="color: {{item.chars['gmname'] ? 'red' : '#666666'}}">总经理:{{item.gmname||" --"}}</view>
+    <view class="exp" style="color: {{item.chars['gmname'] ? 'red' : '#666666'}}">总经理电话:{{item.gmphonenumber||" --"}}</view>
+		<view class="exp" style="color: {{item.chars['province'] ||item.chars['city'] ||item.chars['county'] ? 'red' : '#666666'}}">省市县:{{(item.province + item.city +item.county) || ' --' }}</view>
+		<view class="exp" style="color: {{item.chars['address'] ? 'red' : '#666666'}}">详细地址:{{item.address||" --"}}</view>
+		<block wx:if="{{item.systemapp=='回收站'}}">
+			<icon style="padding-left:10rpx;" type="warn" size="11" color='red' />
+			<text style="color: red;margin-left: 2rpx;">{{language['当前重复客户归属回收站,请联系管理处理!']||'当前重复客户归属回收站,请联系管理处理!'}}</text>
+		</block>
+	</navigator>
+</van-popup>

+ 1 - 0
prsx/department/index.js

@@ -123,6 +123,7 @@ Page({
     navClick({
         detail
     }) {
+      console.log(this.data.content,'筛选222')
         switch (detail.id) {
             case '1':
                 this.setData({

+ 361 - 290
prsx/orderForm/add/add.js

@@ -1,306 +1,377 @@
 let _Http = getApp().globalData.http,
-    count = null;
+  count = null;
 
 Page({
-    data: {
-        loading: false,
-        showAll: false,
-        content: {
-            sa_orderid: 0
-        },
-        disabled: true,
+  data: {
+    loading: false,
+    showAll: false,
+    content: {
+      sa_orderid: 0
     },
-    onLoad(options) {
-        let type = '',
-            hrid = '';
-        if (options.type) type = options.type;
+    disabled: true,
+    sa_saleareaid: ''
+  },
+  onLoad(options) {
+    let type = '',
+      hrid = '';
+    if (options.type) type = options.type;
 
-        let form = [{
-            label: "经销商",
-            error: false,
-            errMsg: "",
-            type: "route",
-            url: "/prsx/select/firm/index",
-            value: "",
-            params: {
-                id: 2025102814092602,
-                "content": {
-                    "pageSize": 20,
-                    "pageNumber": 1,
-                    sa_customersid: 0
-                },
-            },
-            query: "&radio=true",
-            placeholder: "选择经销商",
-            valueName: "sa_agentsid",
-            checking: "base",
-            required: options.type == '经销商订单',
-            interrupt: options.type == '经销商订单',
-            disabled: options.type == '医院订单'
-        }, {
-            label: "合同",
-            error: false,
-            errMsg: "",
-            type: "route",
-            url: "/prsx/select/contract/index",
-            value: "",
-            params: {
-                "content": {
-                    "sa_customersid": 0, //医院订单时传医院id
-                    "sa_agentsid": 0, //经销商订单时传经销商id
-                    "pageNumber": 1,
-                    "pageSize": 20,
-                    "where": {
-                        "condition": ""
-                    }
-                },
-                "id": 2025102814112602,
-            },
-            query: "&radio=true",
-            placeholder: "选择合同",
-            valueName: "sa_contractid",
-            checking: "base",
-            disabled: true
-        }, {
-            label: "购货类型",
-            error: false,
-            errMsg: "",
-            type: "option",
-            optionNmae: "purchasetype",
-            optionType: "radio", //复选   radio 单选
-            value: "",
-            placeholder: "购货类型",
-            valueName: "shoppingtype",
-            checking: "base",
-            required: true
-        }, {
-            label: "交货日期",
-            error: false,
-            errMsg: "",
-            type: "date",
-            start: '',
-            value: '',
-            placeholder: "交货日期",
-            valueName: "deliverydate",
-            checking: "base",
-            required: false,
-        }, {
-            label: "业务员",
-            error: false,
-            errMsg: "",
-            type: "route",
-            url: "/prsx/select/saler/index",
-            value: "",
-            placeholder: "业务员",
-            valueName: "saler_hrid",
-            checking: "base",
-            required: true,
-            params: {
-                "content": {
-                    "sa_agentsid": 0, //经销商订单时传经销商id
-                    "pageNumber": 1,
-                    "pageSize": 20,
-                    "where": {
-                        "condition": ""
-                    }
-                },
-                "id": 2025102815162702,
-            },
-            query: "&radio=true",
-            interrupt: true,
-            disabled: 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: "remarks",
-            checking: "base",
-            required: false
-        }]
+    let form = [{
+      label: "购货类型",
+      error: false,
+      errMsg: "",
+      type: "option",
+      optionNmae: "purchasetype",
+      optionType: "radio", //复选   radio 单选
+      value: "",
+      placeholder: "购货类型",
+      valueName: "shoppingtype",
+      checking: "base",
+      required: true
+    }, {
+      label: "交货日期",
+      error: false,
+      errMsg: "",
+      type: "date",
+      start: '',
+      value: '',
+      placeholder: "交货日期",
+      valueName: "deliverydate",
+      checking: "base",
+      required: false,
+    }, {
+      label: "业务员",
+      error: false,
+      errMsg: "",
+      type: "route",
+      url: "/prsx/select/saler/index",
+      value: "",
+      placeholder: "业务员",
+      valueName: "saler_hrid",
+      checking: "base",
+      required: true,
+      params: {
+        "content": {
+          "sa_agentsid": 0, //经销商订单时传经销商id
+          "pageNumber": 1,
+          "pageSize": 20,
+          "where": {
+            "condition": ""
+          }
+        },
+        "id": 2025102815162702,
+      },
+      query: "&radio=true",
+      interrupt: true,
+      disabled: 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: "remarks",
+      checking: "base",
+      required: false
+    }]
 
-        if (type == '医院订单') form.unshift({
-            label: "医院",
-            error: false,
-            errMsg: "",
-            type: "route",
-            url: "/prsx/select/hospital/index",
-            value: "",
-            placeholder: "医院",
-            valueName: "sa_customersid",
-            checking: "base",
-            required: true,
-            params: {
-                "content": {
-                    "isExport": 0,
-                    "pageNumber": 1,
-                    "pageSize": 20,
-                    "where": {
-                        "condition": ""
-                    }
-                },
-                "id": 2025102814083902,
-            },
-            query: "&radio=true",
-            required: true,
-            interrupt: true,
-        })
+    if (type == '医院订单') form.unshift({
+      label: "医院",
+      error: false,
+      errMsg: "",
+      type: "route",
+      url: "/prsx/select/hospital/index",
+      value: "",
+      placeholder: "医院",
+      valueName: "sa_customersid",
+      checking: "base",
+      required: true,
+      params: {
+        "content": {
+          "isExport": 0,
+          "pageNumber": 1,
+          "pageSize": 20,
+          "where": {
+            "condition": ""
+          }
+        },
+        "id": 2025102814083902,
+      },
+      query: "&radio=true",
+      required: true,
+      interrupt: true,
+    }, {
+      label: "科室",
+      error: false,
+      errMsg: "",
+      type: "route",
+      url: "/prsx/select/department/index",
+      value: "",
+      placeholder: "科室",
+      valueName: "sa_hospitaldepid",
+      checking: "base",
+      required: true,
+      params: {
+        "content": {
+          "sa_customersid": 0, //经销商订单时传经销商id
+          "pageNumber": 1,
+          "pageSize": 20,
+          "where": {
+            "condition": ""
+          }
+        },
+        "id": 2025102310143002,
+      },
+      query: "&radio=true",
+      interrupt: true,
+      disabled: true
+    }, {
+      label: "经销商",
+      error: false,
+      errMsg: "",
+      type: "route",
+      url: "/prsx/select/firm/index",
+      value: "",
+      params: {
+        id: 2025102814092602,
+        "content": {
+          "pageSize": 20,
+          "pageNumber": 1,
+          sa_customersid: 0
+        },
+      },
+      query: "&radio=true",
+      placeholder: "选择经销商",
+      valueName: "sa_agentsid",
+      checking: "base",
+      required: options.type == '经销商订单',
+      interrupt: options.type == '经销商订单',
+      disabled: options.type == '医院订单'
+    })
 
-        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;
-                if (obj.range.length == 1) obj.value = obj.range[0].areaname;
-                obj.disabled = false;
-                this.setData({
-                    form
-                })
-            })
-        }
+    if (type == '经销商订单') form.unshift({
+      label: "经销商",
+      error: false,
+      errMsg: "",
+      type: "route",
+      url: "/prsx/select/firm/index",
+      value: "",
+      params: {
+        id: 2025102814092602,
+        "content": {
+          "pageSize": 20,
+          "pageNumber": 1,
+          sa_customersid: 0
+        },
+      },
+      query: "&radio=true",
+      placeholder: "选择经销商",
+      valueName: "sa_agentsid",
+      checking: "base",
+      required: options.type == '经销商订单',
+      interrupt: options.type == '经销商订单',
+      disabled: options.type == '医院订单'
+    }, {
+      label: "科室",
+      error: false,
+      errMsg: "",
+      type: "route",
+      url: "/prsx/select/department/index",
+      value: "",
+      placeholder: "科室",
+      valueName: "sa_hospitaldepid",
+      checking: "base",
+      required: true,
+      params: {
+        "content": {
+          "sa_agentsid": 0, //经销商订单时传经销商id
+          "pageNumber": 1,
+          "pageSize": 20,
+          "where": {
+            "condition": ""
+          }
+        },
+        "id": 2025111909582402,
+      },
+      query: "&radio=true",
+      interrupt: true,
+      disabled: true
+    })
+
+    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;
+        if (obj.range.length == 1) obj.value = obj.range[0].areaname;
+        obj.disabled = false;
         this.setData({
-            form,
-            type
+          form
         })
-        getApp().globalData.Language.getLanguagePackage(this, options.data ? '编辑' + type : '新建' + type);
+      })
+    }
+    this.setData({
+      form,
+      type
+    })
+    getApp().globalData.Language.getLanguagePackage(this, options.data ? '编辑' + type : '新建' + type);
 
-    },
-    interrupt(e) {
-        const {
-            data,
-            form,
-            temporary
-        } = e.detail;
-        console.log(data, form, temporary)
-        if (temporary.item.label == '业务员') {
-            form.find(v => v.label == '业务员').value = [data.item.name, [data.item.hrid]];
-            let obj = form.find(v => v.label == '营销区域')
-            obj.range = data.item.sa_saleareas;
-            obj.value = obj.range[0].areaname;
-            obj.disabled = false;
-            wx.navigateBack()
-        } else if (temporary.item.label == '医院') {
-            form.find(v => v.label == '医院').value = data.value;
-            let leader = data.item.leader[0];
-            let obj1 = form.find(v => v.label == '业务员')
-            obj1.value = [leader.name, ['']]
-            let obj = form.find(v => v.label == '营销区域')
-            obj.value = data.item.areaname;
-            obj.range = [{
-                areaname: data.item.areaname,
-                sa_saleareaid: ""
-            }];
+  },
+  interrupt(e) {
+    const {
+      data,
+      form,
+      temporary
+    } = e.detail;
+    console.log(data, form, temporary)
+    if (temporary.item.label == '业务员') {
+      form.find(v => v.label == '业务员').value = [data.item.name, [data.item.hrid]];
+      // form.find(v => v.label == '业务员').value = data.value;
+      let obj = form.find(v => v.label == '营销区域')
+      console.log(data.item, 'data.item')
+      obj.value = data.item.areaname;
+      this.setData({
+        sa_saleareaid: data.item.sa_saleareaid
+      })
+      wx.navigateBack()
+    } else if (temporary.item.label == '医院') {
+      form.find(v => v.label == '医院').value = data.value;
+      let leader = data.item.leader[0];
+      let obj1 = form.find(v => v.label == '业务员')
+      obj1.value = [leader.name, ['']]
+      let obj = form.find(v => v.label == '营销区域')
+      obj.value = data.item.areaname;
+      obj.range = [{
+        areaname: data.item.areaname,
+        sa_saleareaid: ""
+      }];
 
-            let obj2 = form.find(v => v.label == '经销商')
-            obj2.params.content.sa_customersid = data.id[0];
-            obj2.value = '';
-            obj2.disabled = false;
+      let obj2 = form.find(v => v.label == '经销商')
+      obj2.params.content.sa_customersid = data.id[0];
+      obj2.value = '';
+      obj2.disabled = false;
 
-            let obj3 = form.find(v => v.label == '合同')
-            obj3.params.content.sa_customersid = data.id[0];
-            obj3.disabled = false;
-            obj3.value = '';
+      let obj3 = form.find(v => v.label == '科室')
+      obj3.params.content.sa_customersid = data.id[0];
+      obj3.value = '';
+      obj3.disabled = false;
 
-            wx.navigateBack()
-        } else if (temporary.item.label == '经销商') {
-            form.find(v => v.label == '经销商').value = data.value;
-            let obj = form.find(v => v.label == '业务员')
-            obj.params.content.sa_agentsid = data.id[0]
-            obj.disabled = false;
-            if (this.data.type == '经销商订单') {
-                let obj3 = form.find(v => v.label == '合同')
-                obj3.params.content.sa_agentsid = data.id[0];
-                obj3.disabled = false;
-                obj3.value = '';
-            }
-            wx.navigateBack()
-        }
-        this.selectComponent("#Form").confirm();
-        this.setData({
-            form
-        })
-    },
-    /* 表单必填项是否完成 */
-    onConfirm({
-        detail
-    }) {
-        this.setData({
-            disabled: detail
-        })
-    },
-    // 是否显示全部
-    onChange({
-        detail
-    }) {
-        this.setData({
-            showAll: detail
-        })
-    },
-    async submit() {
-        this.setData({
-            loading: true
-        })
-        let data = this.selectComponent("#Form").submit(),
-            content = this.data.content
-        data.sa_agentsid = data.sa_agentsid.length ? data.sa_agentsid[1][0] : 0
-        data.saler_hrid = data.saler_hrid.length ? data.saler_hrid[1][0] : 0
-        try {
-            data.sa_customersid = data.sa_customersid.length ? data.sa_customersid[1][0] : 0
-        } catch (error) {
+      // let obj3 = form.find(v => v.label == '合同')
+      // obj3.params.content.sa_customersid = data.id[0];
+      // obj3.disabled = false;
+      // obj3.value = '';
+
+      wx.navigateBack()
+    } else if (temporary.item.label == '经销商') {
+      form.find(v => v.label == '经销商').value = data.value;
+      let obj = form.find(v => v.label == '业务员')
+      obj.params.content.sa_agentsid = data.id[0]
+      obj.disabled = false;
+
+      if (this.data.type == '经销商订单') {
+
+        let obj3 = form.find(v => v.label == '科室')
+        obj3.params.content.sa_agentsid = data.id[0];
+        obj3.value = '';
+        obj3.disabled = false;
 
+        // let obj3 = form.find(v => v.label == '合同')
+        // obj3.params.content.sa_agentsid = data.id[0];
+        // obj3.disabled = false;
+        // obj3.value = '';
+      }
+      wx.navigateBack()
+    } else if (temporary.item.label == '科室') {
+      form.find(v => v.label == '科室').value = data.value;
+      wx.navigateBack()
+    }
+    this.selectComponent("#Form").confirm();
+    this.setData({
+      form
+    })
+  },
+  /* 表单必填项是否完成 */
+  onConfirm({
+    detail
+  }) {
+    this.setData({
+      disabled: detail
+    })
+  },
+  // 是否显示全部
+  onChange({
+    detail
+  }) {
+    this.setData({
+      showAll: detail
+    })
+  },
+  async submit() {
+    this.setData({
+      loading: true
+    })
+    let data = this.selectComponent("#Form").submit(),
+      content = this.data.content
+    data.sa_agentsid = data.sa_agentsid.length ? data.sa_agentsid[1][0] : 0
+    data.saler_hrid = data.saler_hrid.length ? data.saler_hrid[1][0] : 0
+    data.sa_hospitaldepid = data.sa_hospitaldepid.length ? data.sa_hospitaldepid[1][0] : 0
+    try {
+      data.sa_customersid = data.sa_customersid.length ? data.sa_customersid[1][0] : 0
+    } catch (error) {
+
+    }
+    // data.sa_saleareaid = this.data.form.find(v => v.label == '营销区域').range.find(v => v.areaname == data.sa_saleareaid).sa_saleareaid || '';
+    data.sa_saleareaid = this.data.sa_saleareaid
+    // data.sa_contractid = data.sa_contractid.length ? data.sa_contractid[1][0] : 0
+    _Http.basic({
+      "id": 20221108111402,
+      "content": {
+        ...content,
+        ...data,
+      }
+    }).then(res => {
+      this.setData({
+        loading: false
+      })
+      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/orderForm/detail') v.getDetail()
+      })
+      setTimeout(() => {
+        if (content.sa_orderid == 0) {
+          wx.redirectTo({
+            url: '/prsx/orderForm/detail?id=' + res.data.sa_orderid,
+          })
+        } else {
+          wx.navigateBack()
         }
-        data.sa_saleareaid = this.data.form.find(v => v.label == '营销区域').range.find(v => v.areaname == data.sa_saleareaid).sa_saleareaid || '';
-        data.sa_contractid = data.sa_contractid.length ? data.sa_contractid[1][0] : 0
-        _Http.basic({
-            "id": 20221108111402,
-            "content": {
-                ...content,
-                ...data,
-            }
-        }).then(res => {
-            this.setData({
-                loading: false
-            })
-            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/orderForm/detail') v.getDetail()
-            })
-            setTimeout(() => {
-                if (content.sa_orderid == 0) {
-                    wx.redirectTo({
-                        url: '/prsx/orderForm/detail?id=' + res.data.sa_orderid,
-                    })
-                } else {
-                    wx.navigateBack()
-                }
-            }, 300)
-        })
-    },
+      }, 300)
+    })
+  },
 })

+ 2 - 1
prsx/orderForm/detail.wxml

@@ -10,6 +10,7 @@
 		<text wx:if="{{detail.shoppingtype}}" style="background-color: #4BD863;">{{language[detail.shoppingtype]||detail.shoppingtype}}</text>
 	</view>
 	<view class="exp">医院:{{detail.hospitalname || ' --'}}</view>
+  <view class="exp">科室:{{detail.hospitaldepname || ' --'}}</view>
 	<view class="exp">经销商:{{detail.agentname || ' --'}}</view>
 	<view class="exp">订单状态:<text style="color:{{sColors[detail.status]}};">{{detail.status}}</text></view>
 	<view class="exp">单据日期:{{detail.billdate || ' --'}}</view>
@@ -17,7 +18,7 @@
 	<view class="exp">营销区域:{{detail.areaname || ' --'}}</view>
 	<view class="exp">订单数量:{{detail.qty}}</view>
 	<view class="exp">订单金额:<text style="color:#FF3B30;">{{detail.showAmount}}</text></view>
-	<view class="exp">关联合同:<text style="color: #3874F6;">{{detail.contract_billno || '--'}}</text></view>
+	<!-- <view class="exp">关联合同:<text style="color: #3874F6;">{{detail.contract_billno || '--'}}</text></view> -->
 </view>
 
 <view class="box" style="padding: 10rpx 30rpx;margin: 20rpx 0;">

+ 3 - 2
prsx/orderForm/index.js

@@ -10,6 +10,7 @@ Page({
             "isExport": 0,
             "pageNumber": 1,
             "pageSize": 20,
+            "systemclient": "wechatsaletool",
             "where": {
                 "condition": "",
                 "status": [], //["新建","关闭"]
@@ -29,7 +30,7 @@ Page({
             label: "订单类型",
             index: null,
             showName: "value", //显示字段
-            valueKey: "shoppingtype", //返回Key
+            valueKey: "type", //返回Key
             selectKey: "value", //传参 代表选着字段 不传参返回整个选择对象
             value: "", //选中值
             list: [{
@@ -41,7 +42,7 @@ Page({
             label: "购货类型",
             index: null,
             showName: "value", //显示字段
-            valueKey: "purchasetype", //返回Key
+            valueKey: "shoppingtype", //返回Key
             selectKey: "value", //传参 代表选着字段 不传参返回整个选择对象
             value: "", //选中值
             list: await _Http.getTypes('purchasetype', _Http)

+ 1 - 1
prsx/select/area/index.js

@@ -33,7 +33,7 @@ Page({
       console.log(res.data, '输出区域数据')
       let list = res.data.map(v => {
         v.subarea.unshift({
-          areaname: v.areaname + ' (包含所有下级)',
+          areaname: v.areaname + ' (不含下级)',
           sa_saleareaid: v.sa_saleareaid
         })
         return {

+ 120 - 120
prsx/select/firm/index.js

@@ -1,125 +1,125 @@
 const _Http = getApp().globalData.http;
 
 Page({
-    data: {
-        params: {}, //请求体
-        result: [], //返回结果
-        radio: false, //是否为单选
-        idname: "sa_agentsid", //idkey
-        showName: "enterprisename", //表单用 显示名称
-        sColors: getApp().globalData.sColors,
-    },
-    onLoad(options) {
-        console.log("options", 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
-            });
-        }
-        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;
-        //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)
-            })
-        })
-    },
-    uploadList() {
-        let params = JSON.parse(JSON.stringify(this.data.params));
-        params.content.pageSize = (params.content.pageNumber - 1) * params.content.pageSize;
+  data: {
+    params: {}, //请求体
+    result: [], //返回结果
+    radio: false, //是否为单选
+    idname: "sa_agentsid", //idkey
+    showName: "enterprisename", //表单用 显示名称
+    sColors: getApp().globalData.sColors,
+  },
+  onLoad(options) {
+    console.log("options", options)
+    if (options.params) {
+      let params = JSON.parse(options.params);
+      if (!params.content.pageNumber || !params.content.pageTotal) {
         params.content.pageNumber = 1;
-        _Http.basic(params).then(res => {
-            console.log("更新列表", res);
-            if (res.code != '1') return wx.showToast({
-                title: res.data,
-                icon: "none"
-            })
-            this.setData({
-                'params.content.total': res.total,
-                list: res.data
-            })
-        })
-    },
-    /* 选中 */
-    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);
-    },
-    onUnload() {
-        //回收数据
-        getApp().globalData.handleSelect = null;
-    },
+        params.content.pageTotal = 1;
+      }
+      this.setData({
+        params
+      });
+    }
+    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;
+    //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)
+      })
+    })
+  },
+  uploadList() {
+    let params = JSON.parse(JSON.stringify(this.data.params));
+    params.content.pageSize = (params.content.pageNumber - 1) * params.content.pageSize;
+    params.content.pageNumber = 1;
+    _Http.basic(params).then(res => {
+      console.log("更新列表", res);
+      if (res.code != '1') return wx.showToast({
+        title: res.data,
+        icon: "none"
+      })
+      this.setData({
+        'params.content.total': res.total,
+        list: res.data
+      })
+    })
+  },
+  /* 选中 */
+  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);
+  },
+  onUnload() {
+    //回收数据
+    getApp().globalData.handleSelect = null;
+  },
 })

+ 1 - 1
prsx/select/firm/index.wxml

@@ -1,4 +1,4 @@
-<van-search value="{{ params.content.where.condition }}" shape='round' placeholder="请输入搜索关键词" use-action-slot bind:clear='onClear' bind:search="startSearch">
+<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'>

+ 78 - 39
prsx/select/product/index.js

@@ -13,7 +13,7 @@ Page({
     filterSearchShow: false,
     filtratelist: []
   },
-  onLoad(options) {
+  async onLoad(options) {
     if (options.params) {
       let params = JSON.parse(options.params);
       if (!params.content.pageNumber || !params.content.pageTotal) {
@@ -24,10 +24,45 @@ Page({
         params
       });
     }
+    let filtratelist = [{
+      label: "品牌",
+      index: null,
+      showName: "brandname", //显示字段
+      valueKey: "sa_brandid", //返回Key
+      selectKey: "sa_brandid", //传参 代表选着字段 不传参返回整个选择对象
+      value: '', //选中值
+      interrupt: true,
+      list: await _Http.basic({
+        "id": "20220922085103",
+        "content": {},
+      }).then(res => {
+        console.log("获取品牌", res)
+        // this.data.sa_brandid = res.data[0].sa_brandid
+        return res.code == 1 ? res.data : []
+      })
+    }, {
+      label: "营销类别",
+      index: null,
+      showName: "itemclassname", //显示字段
+      valueKey: "itemclassid", //返回Key
+      selectKey: "itemclassid", //传参 代表选着字段 不传参返回整个选择对象
+      value: "", //选中值
+      type: 'multilevelClass',
+      list: []
+    }, {
+      label: "备货分类",
+      index: null,
+      showName: "value", //显示字段
+      valueKey: "goodstype", //返回Key
+      selectKey: "value", //传参 代表选着字段 不传参返回整个选择对象
+      value: "需定制", //选中值
+      list: await _Http.getTypes('goodstype', _Http)
+    }]
     this.setData({
       radio: options.radio ? true : false,
       idname: options.idname || this.data.idname,
-      showName: options.showName || this.data.showName
+      showName: options.showName || this.data.showName,
+      filtratelist
     });
     this.getList()
   },
@@ -49,10 +84,49 @@ Page({
         v.cover = v.attinfos.length ? _Http.getSpecifiedImage(v.attinfos[0]) : ''
         return v
       })
+      // setTimeout(async() => {
+      //   if (res.pageNumber == 1 && res.data.length && !this.data.filtratelist.some(v => v.label == '品牌')) {
+      //     this.data.filtratelist.push({
+      //       label: "品牌",
+      //       index: null,
+      //       showName: "brandname", //显示字段
+      //       valueKey: "sa_brandid", //返回Key
+      //       selectKey: "sa_brandid", //传参 代表选着字段 不传参返回整个选择对象
+      //       value: '', //选中值
+      //       interrupt: true,
+      //       list: await _Http.basic({
+      //         "id": "20220922085103",
+      //         "content": {},
+      //       }).then(res => {
+      //         console.log("获取品牌", res)
+      //         // this.data.sa_brandid = res.data[0].sa_brandid
+      //         return res.code == 1 ? res.data : []
+      //       })
+      //     })
+      //     this.setData({
+      //       filtratelist: this.data.filtratelist
+      //     })
+      //   } else if (res.pageNumber == 1 && res.data.length && !this.data.filtratelist.some(v => v.label == '营销类别')) {
+      //     this.data.filtratelist.push({
+      //       label: "营销类别",
+      //       index: null,
+      //       showName: "itemclassname", //显示字段
+      //       valueKey: "itemclassid", //返回Key
+      //       selectKey: "itemclassid", //传参 代表选着字段 不传参返回整个选择对象
+      //       value: "", //选中值
+      //       type: 'multilevelClass',
+      //       list: []
+      //     })
+      //     this.setData({
+      //       filtratelist: this.data.filtratelist
+      //     })
+      //   }
+      // }, 1500);
       this.setData({
         'params.content.pageNumber': res.pageNumber + 1,
         'params.content.pageTotal': res.pageTotal,
         'params.content.total': res.total,
+        params: _Http.paging(params, res),
         list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data)
       })
     })
@@ -138,6 +212,8 @@ Page({
   handleFilter({
     detail
   }) {
+    console.log('执行筛选的功能')
+    detail.condition = this.data.params.content.where.condition;
     this.data.params.content.where = detail;
     this.getList(true);
   },
@@ -148,46 +224,9 @@ Page({
     console.log(this.filterShow, '返回结果')
   },
   async selsectClick() {
-    let filtratelist = [{
-      label: "品牌",
-      index: null,
-      showName: "brandname", //显示字段
-      valueKey: "sa_brandid", //返回Key
-      selectKey: "sa_brandid", //传参 代表选着字段 不传参返回整个选择对象
-      value: '', //选中值
-      interrupt: true,
-      list: await _Http.basic({
-        "id": "20220922085103",
-        "content": {},
-      }).then(res => {
-        console.log("获取品牌", res)
-        // this.data.sa_brandid = res.data[0].sa_brandid
-        return res.code == 1 ? res.data : []
-      })
-    }, {
-      label: "营销类别",
-      index: null,
-      showName: "itemclassname", //显示字段
-      valueKey: "itemclassid", //返回Key
-      selectKey: "itemclassid", //传参 代表选着字段 不传参返回整个选择对象
-      value: "", //选中值
-      type: 'multilevelClass',
-      list: []
-    }, {
-      label: "备货分类",
-      index: null,
-      showName: "value", //显示字段
-      valueKey: "goodstype", //返回Key
-      selectKey: "value", //传参 代表选着字段 不传参返回整个选择对象
-      value: "", //选中值
-      list: await _Http.getTypes('goodstype', _Http)
-    }]
     this.setData({
       filterSearchShow: true,
-      filtratelist: filtratelist
     })
-
-
   },
   interrupt(e) {
     console.log("2323", e)

+ 4 - 0
prsx/select/saler/index.js

@@ -85,6 +85,10 @@ Page({
     },
     /* 提交 */
     submit() {
+      console.log(this.data.radio,'radio11')
+      // console.log(this.data.list.find(value => value[this.data.idname] == result)[this.data.showName])
+      console.log(this.data.list,'list2222')
+      console.log(this.data.idname)
         let result = this.data.result,
             obj = this.data.radio ? {
                 id: result,

+ 1 - 1
prsx/tryOut/detail.js

@@ -416,7 +416,7 @@ Page({
         label: "跟进"
       });
     }
-
+console.log(appAuth.options.map(item => item == 'update'),'111')
     if (appAuth.update || isLeader && detail.status == '新建') tabbarList.push({
       icon: "color-bianji",
       label: "编辑"