From a345e57300e7ea667da2ef7e837612c22d98bc3c Mon Sep 17 00:00:00 2001
From: quanwei <419654421@qq.com>
Date: Wed, 12 Nov 2025 18:29:44 +0800
Subject: [PATCH] 名片收银台
---
mobile/pages/plus/business/add.vue | 258 +++++++++++++++++++++++++++++---------------------
1 files changed, 149 insertions(+), 109 deletions(-)
diff --git a/mobile/pages/plus/business/add.vue b/mobile/pages/plus/business/add.vue
index 7380bae..f3e00fc 100644
--- a/mobile/pages/plus/business/add.vue
+++ b/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>
@@ -88,7 +89,7 @@
头像
</view>
<view class="tx" style="margin-left: 30rpx;">
- <image class="logo" :src="file_path" mode="heightFix"></image>
+ <image class="logo" :src="file_path||'@/static/shop/login/qietu_1054.png'" mode="heightFix"></image>
<Upload v-if="is_avatar" @getImgs="handleAvatarUpload" :imageList="[file_path]"></Upload>
</view>
</view>
@@ -97,7 +98,7 @@
logo
</view>
<view class="logo" style="overflow: hidden;">
- <image class="logo" :src="logo_path" mode="heightFix"></image>
+ <image class="logo" :src="logo_path||'@/static/shop/login/qietu_1054.png'" mode="heightFix"></image>
<Upload v-if="is_logo" @getImgs="handleLogoUpload" :imageList="[logo_path]"></Upload>
</view>
</view>
@@ -116,7 +117,7 @@
<view class="lxfx">
<view class="lxfxbiaoti"><text style="color: #fa3534;">*</text>手机:</view>
<view class="lxfxnrr">
- <input @input="sjh" placeholder="输入手机号,多个手机号用/隔开" v-model="mobile" class="lxfxneirong"
+ <input @input="sjh" placeholder="输入手机号" v-model="mobile" class="lxfxneirong"
type="text">
<input style="display: none;" name="mobile" v-model="business.mobile"
class="lxfxneirong" type="text">
@@ -170,19 +171,23 @@
<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="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="chooseLocation" 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">
+ <view class="lxfx" >
<view class="lxfxbiaoti"><text style="color: #fa3534;">*</text>地址:</view>
<view class="lxfxnrr">
<input placeholder="请输入详细地址" name="address[0]" v-model="business.address[0]"
@@ -204,23 +209,23 @@
<input type="text" style="display: none;" name="logo" :value="logo_id">
<input type="text" style="display: none;" name="logo_height" :value="logo_height">
<input type="text" style="display: none;" name="logo_width" :value="logo_width">
+ <input type="text" style="display: none;" name="longitude" :value="business.longitude">
+ <input type="text" style="display: none;" name="latitude" :value="business.latitude">
</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 +234,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 +247,78 @@
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: '' ,// 名片类型
+ latitude:0,
+ longitude:0
+ },
+ // 名片类型
+ ilkList: [], // 类型列表
+ selectedIlk: {}, // 选中的类型
+ // 辅助输入
+ mobile: '', // 用于输入的手机号(支持多手机号)
+ // 业务状态
+ business_card_id: 0, // 名片ID(用于编辑)
+ // 图片相关
+ file_id: 0, // 头像文件ID
+ file_path: "", // 头像路径
+ logo_id: 0, // Logo文件ID
+ logo_path: "", // 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) {
@@ -327,6 +335,35 @@
this.initRegionData();
},
methods: {
+ // 打开地图选择地址 by lyzflash
+ chooseLocation(n) {
+ let self=this;
+ uni.chooseLocation({
+ success: function (res) {
+ console.log(res);
+ self.business.longitude=res.longitude;
+ self.business.latitude=res.latitude;
+ self.location_address=res.address;
+ self.business.address[0]=res.name;
+ // 获取省市区
+ self.setLocationAddress();
+ }
+ });
+ },
+
+ // 获取掉省市区 by lyzflash
+ setLocationAddress() {
+ let self = this;
+ self._get('user.address/setLocationAddress', {
+ address: self.location_address
+ }, function(res) {
+ /* self.address.location_address = res.data.short_address; */
+ self.business.province_id = res.data.cityCode[0];
+ self.business.city_id = res.data.cityCode[1];
+ self.business.region_id = res.data.cityCode[2];
+ self.selectCity = res.data.region;
+ });
+ },
templateClose() {
this.templateShow = !this.templateShow
},
@@ -411,13 +448,14 @@
this.business.duties = duties
},
handleAvatarUpload(imgs) {
+ this.is_avatar = false
if (imgs && imgs.length > 0) {
this.file_path = imgs[0].file_path
this.file_id = imgs[0].file_id
- this.is_avatar = false
}
},
handleLogoUpload(imgs) {
+ this.is_logo = false
if (imgs && imgs.length > 0) {
this.logo_path = imgs[0].file_path
this.logo_id = imgs[0].file_id
@@ -445,7 +483,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 => {
@@ -495,12 +533,12 @@
})
this.file_id = res.data.file_id;
this.logo_id = res.data.logo
- res.data.file_path ? this.file_path = res.data.file_path : "";
- res.data.logo ? this.logo_path = res.data.logo_image.file_path : "";
+ res.data.file_id ? this.file_path = res.data.file_path : "";
+ res.data.logo ? this.logo_path = res.data.logoImage.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 +555,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 +571,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();
}
@@ -660,7 +700,7 @@
}
.biaoti {
- color: #37bde6;
+ color: #D41003;
font-size: 40rpx;
padding: 20rpx 0rpx;
}
@@ -728,42 +768,42 @@
.tijiao {
width: 30%;
- background-color: #37bde6;
+ background-color: #D41003;
margin-left: 35%;
color: #fff;
}
-
+
.industry-popup {
padding: 20rpx;
}
-
+
.industry-title {
text-align: center;
font-size: 36rpx;
font-weight: bold;
margin-bottom: 20rpx;
- color: #37bde6;
+ color: #D41003;
}
-
+
.industry-item {
padding: 20rpx;
border-bottom: 1rpx solid #e5e5e5;
font-size: 32rpx;
}
-
+
.industry-item.selected {
- color: #37bde6;
+ color: #D41003;
}
-
+
.industry-item:active {
background-color: #f5f5f5;
}
-
+
/* 子行业样式 */
.industry-child {
background-color: #f8f8f8;
}
-
+
.industry-child-item {
padding-left: 60rpx;
font-size: 30rpx;
--
Gitblit v1.9.2