quanwei
2025-10-31 f226d5fe6327e31bb471a96b7370cf94689c6608
mobile/pages/plus/business/add.vue
@@ -74,7 +74,8 @@
            <view class="lxfx">
               <view class="lxfxbiaoti">名片类型:</view>
               <view class="lxfxnrr">
                  <picker @change="changeIlk" :range="ilkList" :range-key="'name'" class="lxfxneirong" mode="selector">
                  <picker @change="changeIlk" :range="ilkList" :range-key="'name'" class="lxfxneirong"
                     mode="selector">
                     <view class="picker-content">
                        {{selectedIlk.name || '请选择名片类型'}}
                        <text class="icon iconfont icon-jiantou"></text>
@@ -170,16 +171,20 @@
                     <view class="lxfxbiaoti">行业:</view>
                     <view class="lxfxnrr">
                        <input class="lxfxneirong" :value="industryNmae" disabled readonly>
                        <input style="display: none;" type="hidden" name="industry_id" v-model="business.industry_id">
                        <input style="display: none;" type="hidden" name="industry_id"
                           v-model="business.industry_id">
                     </view>
                  </view>
                  <view class="lxfx">
                     <view class="lxfxbiaoti">所在地区:</view>
                     <view class="lxfxnrr">
                        <input class="lxfxneirong" :value="selectCity" disabled="true" @click="showMulLinkageThreePicker" placeholder="请选择省市区">
                        <input style="display: none;" type="hidden" name="province_id" v-model="business.province_id">
                        <input class="lxfxneirong" :value="selectCity" disabled="true"
                           @click="showMulLinkageThreePicker" placeholder="请选择省市区">
                        <input style="display: none;" type="hidden" name="province_id"
                           v-model="business.province_id">
                        <input style="display: none;" type="hidden" name="city_id" v-model="business.city_id">
                        <input style="display: none;" type="hidden" name="region_id" v-model="business.region_id">
                        <input style="display: none;" type="hidden" name="region_id"
                           v-model="business.region_id">
                     </view>
                  </view>
                  <view class="lxfx">
@@ -205,22 +210,20 @@
               <input type="text" style="display: none;" name="logo_height" :value="logo_height">
               <input type="text" style="display: none;" name="logo_width" :value="logo_width">
            </view>
            <Popup :show="industryShow" :width="screenWidth"  type="bottom" :closeable="true" @close="industryClose">
            <Popup :show="industryShow" :width="screenWidth" type="bottom" :closeable="true" @close="industryClose">
               <view class="industry-popup">
                  <view class="industry-title">选择行业</view>
                  <scroll-view scroll-y="true" style="height: 600rpx;">
                     <!-- 递归展示行业树形结构 -->
                     <view v-for="item in industryList" :key="item.industry_id">
                        <view class="industry-item"
                           @tap="selectIndustry" :data-id="item.industry_id"
                        <view class="industry-item" @tap="selectIndustry" :data-id="item.industry_id"
                           :class="{ 'selected': business.industry_id == item.industry_id }">
                           {{ item.name }}
                        </view>
                        <!-- 显示子行业 -->
                        <view v-if="item.child && item.child.length > 0" class="industry-child">
                           <view class="industry-item industry-child-item"
                              v-for="child in item.child" :key="child.industry_id"
                              @tap="selectIndustry" :data-id="child.industry_id"
                           <view class="industry-item industry-child-item" v-for="child in item.child"
                              :key="child.industry_id" @tap="selectIndustry" :data-id="child.industry_id"
                              :class="{ 'selected': business.industry_id == child.industry_id }">
                              {{ child.name }}
                           </view>
@@ -229,7 +232,8 @@
                  </scroll-view>
               </view>
            </Popup>
            <mpvue-city-picker v-if="is_load" ref="mpvueCityPicker" :province="province" :city="city" :area="area" :pickerValueDefault="cityPickerValueDefault" @onConfirm="onConfirm"></mpvue-city-picker>
            <mpvue-city-picker v-if="is_load" ref="mpvueCityPicker" :province="province" :city="city" :area="area"
               :pickerValueDefault="cityPickerValueDefault" @onConfirm="onConfirm"></mpvue-city-picker>
         </view>
      </form>
   </view>
@@ -241,76 +245,76 @@
   import mpvueCityPicker from '@/components/mpvue-citypicker/mpvueCityPicker.vue';
   export default {
      components: {
            Upload,
            Popup,
            mpvueCityPicker
         },
         data() {
            return {
               // 模板相关
               templateList: [], // 模板列表
               templateShow: false, // 模板弹窗显示状态
               template_id: 0, // 当前选中的模板ID
               templateIndex: 0, // 当前选中的模板索引
               // 业务数据
               business: {
                  name: '', // 姓名
                  mobile: '', // 手机号
                  mobile_phone: '', // 备用手机号
                  duties: [], // 职位
                  phone: '', // 电话
                  mailbox: '', // 邮箱
                  wechat: '', // 微信
                  unit: [], // 单位名称
                  position: [], // 职位信息
                  address: [], // 地址
                  industry_id: 0, // 行业ID
                  province_id: 0, // 省份ID
                  city_id: 0, // 城市ID
                  region_id: 0, // 区域ID
                  Introduction: '', // 简介
                  ilk: '' // 名片类型
               },
               // 名片类型
               ilkList: [], // 类型列表
               selectedIlk: {}, // 选中的类型
               // 辅助输入
               mobile: '', // 用于输入的手机号(支持多手机号)
               // 业务状态
               business_card_id: 0, // 名片ID(用于编辑)
               // 图片相关
               file_id: 0, // 头像文件ID
               file_path: "https://thirdwx.qlogo.cn/mmopen/vi_32/POgEwh4mIHO4nibH0KlMECNjjGxQUq24ZEaGT4poC6icRiccVGKSyXwibcPq4BWmiaIGuG1icwxaQX6grC9VemZoJ8rg/132", // 头像路径
               logo_id: 0, // Logo文件ID
               logo_path: "http://lblmh.com/image/diy/logo_top.png", // Logo路径
               // 布局相关
               unit: [], // 单位信息数组
               logo_height: 0, // Logo高度
               logo_width: 0, // Logo宽度
               avatar_width: 0, // 头像宽度
               // 显示控制
               avatar_display: 1, // 头像显示状态
               logo_display: 1, // Logo显示状态
               position: [], // 位置信息
               is_business: 0, // 业务类型
               duties: '', // 职位字符串
               positionNum: 0, // 位置数量
               is_avatar: false, // 头像上传弹窗状态
               is_logo: false, // Logo上传弹窗状态
               // 行业相关
               industryList: [], // 行业列表
               industryShow: false, // 行业选择弹窗状态
               industryNmae:'请选择行业', // 选中的行业名称
               screenWidth:0, // 屏幕宽度
               // 区域选择相关
               cityPickerValueDefault: [0, 0, 0], // 地区选择器默认值
               selectCity: '选择省 市 区', // 选中的地区显示
               region: {}, // 地区信息
               is_load: false, // 数据加载状态
               province: [], // 省份数据
               city: [], // 城市数据
               area: [] // 区域数据
            }
         Upload,
         Popup,
         mpvueCityPicker
      },
      data() {
         return {
            // 模板相关
            templateList: [], // 模板列表
            templateShow: false, // 模板弹窗显示状态
            template_id: 0, // 当前选中的模板ID
            templateIndex: 0, // 当前选中的模板索引
            // 业务数据
            business: {
               name: '', // 姓名
               mobile: '', // 手机号
               mobile_phone: '', // 备用手机号
               duties: [], // 职位
               phone: '', // 电话
               mailbox: '', // 邮箱
               wechat: '', // 微信
               unit: [], // 单位名称
               position: [], // 职位信息
               address: [], // 地址
               industry_id: 0, // 行业ID
               province_id: 0, // 省份ID
               city_id: 0, // 城市ID
               region_id: 0, // 区域ID
               Introduction: '', // 简介
               ilk: '' // 名片类型
            },
            // 名片类型
            ilkList: [], // 类型列表
            selectedIlk: {}, // 选中的类型
            // 辅助输入
            mobile: '', // 用于输入的手机号(支持多手机号)
            // 业务状态
            business_card_id: 0, // 名片ID(用于编辑)
            // 图片相关
            file_id: 0, // 头像文件ID
            file_path: "https://thirdwx.qlogo.cn/mmopen/vi_32/POgEwh4mIHO4nibH0KlMECNjjGxQUq24ZEaGT4poC6icRiccVGKSyXwibcPq4BWmiaIGuG1icwxaQX6grC9VemZoJ8rg/132", // 头像路径
            logo_id: 0, // Logo文件ID
            logo_path: "http://lblmh.com/image/diy/logo_top.png", // Logo路径
            // 布局相关
            unit: [], // 单位信息数组
            logo_height: 0, // Logo高度
            logo_width: 0, // Logo宽度
            avatar_width: 0, // 头像宽度
            // 显示控制
            avatar_display: 1, // 头像显示状态
            logo_display: 1, // Logo显示状态
            position: [], // 位置信息
            is_business: 0, // 业务类型
            duties: '', // 职位字符串
            positionNum: 0, // 位置数量
            is_avatar: false, // 头像上传弹窗状态
            is_logo: false, // Logo上传弹窗状态
            // 行业相关
            industryList: [], // 行业列表
            industryShow: false, // 行业选择弹窗状态
            industryNmae: '请选择行业', // 选中的行业名称
            screenWidth: 0, // 屏幕宽度
            // 区域选择相关
            cityPickerValueDefault: [0, 0, 0], // 地区选择器默认值
            selectCity: '选择省 市 区', // 选中的地区显示
            region: {}, // 地区信息
            is_load: false, // 数据加载状态
            province: [], // 省份数据
            city: [], // 城市数据
            area: [] // 区域数据
         }
      },
      onLoad(e) {
         if (e.business_card_id) {
@@ -445,7 +449,7 @@
         getTemplate() {
            let _this = this;
            const systemInfo = uni.getSystemInfoSync()
            this.screenWidth=systemInfo.screenWidth*2-70;
            this.screenWidth = systemInfo.screenWidth * 2 - 70;
            this._post('plus.business.template/getList', {
               screenWidth: systemInfo.screenWidth
            }, res => {
@@ -499,8 +503,8 @@
                  res.data.logo ? this.logo_path = res.data.logo_image.file_path : "";
                  res.data.logo_width ? this.logo_width = res.data.logo_width : 0;
                  res.data.logo_height ? this.logo_height = res.data.logo_height : 0;
               // 设置名片类型
                  // 设置名片类型
                  if (this.business.ilk !== undefined && this.business.ilk !== '') {
                     // 等待类型列表加载完成后设置选中项
                     if (this.ilkList && this.ilkList.length > 0) {
@@ -517,11 +521,12 @@
                              }));
                              // 尝试根据id查找,id可能是字符串或数字
                              const ilkId = String(_this.business.ilk);
                              _this.selectedIlk = _this.ilkList.find(item => item.id === ilkId) || {};
                              _this.selectedIlk = _this.ilkList.find(item => item.id ===
                                 ilkId) || {};
                           }
                        })
                     }
                  }
                  }
                  // 设置行业名称
                  if (this.business.industry_id) {
                     // 先等待行业列表加载完成再查找名称
@@ -532,18 +537,19 @@
                        this._post('plus.business.industry/getIndustryTree', {}, res => {
                           if (res.data) {
                              _this.industryList = res.data.tree;
                              _this.findIndustryName(_this.industryList, _this.business.industry_id);
                              _this.findIndustryName(_this.industryList, _this.business
                                 .industry_id);
                           }
                        })
                     }
                  }
                  // 设置地区显示值
                  if (this.business.region && this.business.region.province) {
                     let region = this.business.region;
                     this.selectCity = `${region.province} ${region.city} ${region.region}`;
                  }
                  this.getTemplate();
               }
@@ -732,11 +738,11 @@
      margin-left: 35%;
      color: #fff;
   }
   .industry-popup {
      padding: 20rpx;
   }
   .industry-title {
      text-align: center;
      font-size: 36rpx;
@@ -744,26 +750,26 @@
      margin-bottom: 20rpx;
      color: #37bde6;
   }
   .industry-item {
      padding: 20rpx;
      border-bottom: 1rpx solid #e5e5e5;
      font-size: 32rpx;
   }
   .industry-item.selected {
      color: #37bde6;
   }
   .industry-item:active {
      background-color: #f5f5f5;
   }
   /* 子行业样式 */
   .industry-child {
      background-color: #f8f8f8;
   }
   .industry-child-item {
      padding-left: 60rpx;
      font-size: 30rpx;