高敬炎 2 年 前
コミット
e6ac5ba2f4

+ 9 - 0
xiaochengxu/pages.json

@@ -193,6 +193,15 @@
             }
             
         }
+        ,{
+            "path" : "pages/cardHolder/scanCodeAddCard",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "添加名片",
+                "enablePullDownRefresh": false
+            }
+            
+        }
     ],
 	"tabBar": {
 		"custom": false,

+ 21 - 10
xiaochengxu/pages/cardHolder/cardHolder.vue

@@ -15,6 +15,8 @@
 				<view class="left flex">
 					<uni-icons type="search" size="24"></uni-icons>
 					<text class="search-val"> {{searchVal?searchVal:'搜索名片'}}</text>
+					<uni-icons type="closeempty" size="24" @click.native.stop="delSearchVal"
+						v-if="searchVal"></uni-icons>
 				</view>
 				<view class="right">
 					<uni-icons type="mic" size="24" @click.stop="micOpen"></uni-icons>
@@ -48,19 +50,19 @@
 		<view v-for='(item,index) in cardHolderList' @longpress="longpress" class="content3 flex">
 			<view class="left">
 				<view class="top flex-row-center">
-					<image :src="item.cardManagementInfo.headSculpture" mode="widthFix" class="img"></image>
+					<image :src="item.headSculpture" mode="widthFix" class="img"></image>
 				</view>
 				<view class="bottom flex flex-evenly">
-					<uni-icons type="home" size="20"></uni-icons>
+					<uni-icons @click="toHome(item)" type="home" size="20"></uni-icons>
 					<text @click='switchType(item)'>{{item.classify?item.classifyName:'默'}}</text>
 					<uni-icons @click='share(item)'  type="redo" size="20" color=''></uni-icons>
 				</view>
 			</view>
 			<view class="right">
 				<view class="row1 flex">
-					<text>{{item.cardManagementInfo.name}}</text>
+					<text>{{item.name}}</text>
 					<text class="line"></text>
-					<text>{{item.cardManagementInfo.post}}</text>
+					<text>{{item.post}}</text>
 					<u-checkbox-group v-if='islongPress' placement="column"
 						@change="checkboxChange($event,index)">
 						<u-checkbox :name='index+1' :checked='item.checked' :customStyle="{marginBottom: '8px'}">
@@ -68,15 +70,15 @@
 					</u-checkbox-group>
 				</view>
 				<view class="row2">
-					{{item.cardManagementInfo.companyName}}
+					{{item.companyName}}
 				</view>
 				<view class="row3" @click="toMap">
 					<uni-icons type="redo" size="20"></uni-icons>
-					<text>{{item.cardManagementInfo.province}}{{item.cardManagementInfo.city}}{{item.cardManagementInfo.area}}{{item.cardManagementInfo.detailedAddress}}</text>
+					<text>{{item.province}}{{item.city}}{{item.area}}{{item.detailedAddress}}</text>
 				</view>
 				<view class="row3">
 					<uni-icons type="redo" size="20"></uni-icons>
-					<text>{{item.cardManagementInfo.phone}}</text>
+					<text>{{item.phone}}</text>
 				</view>
 				<view @click='remarkEdit(item)' class="row3">
 					<uni-icons type="redo" size="20"></uni-icons>
@@ -101,7 +103,7 @@
 				<view style='text-align:right;'>
 					<uni-icons @click='qrcodeShow=false' type="close" size="20"></uni-icons>
 				</view>
-				<image :src="currectData.cardManagementInfo.qrCode" mode=""></image>
+				<image :src="currectData.qrCode" mode=""></image>
 			</view>
 			
 		</view>
@@ -191,6 +193,15 @@
 			// }
 		},
 		methods: {
+			toHome(item){
+				uni.navigateTo({
+					url: "/pages/mySet/myHome?id="+item.personalHomeId
+				})
+			},
+			delSearchVal() {
+				this.searchVal = ""
+				this.mescroll.resetUpScroll()
+			},
 			toUrl(){
 				console.log(this.currectData)
 				this.popupshow=false
@@ -232,7 +243,6 @@
 			},
 			del(){
 				this.delShow=true
-				
 			},
 			
 			longpress(){
@@ -352,7 +362,8 @@
 				this.$request.baseRequest('admin.unimall.cardHolderInfo', 'list',{
 					page:page.num,
 					limit:page.size,
-					commonId:uni.getStorageSync("userInfo").id
+					commonId:uni.getStorageSync("userInfo").id,
+					searchContent:this.searchVal
 				}, failres => {
 					console.log('res+++++', failres.errmsg)
 					this.$refs.uToast.show({

+ 193 - 0
xiaochengxu/pages/cardHolder/scanCodeAddCard.vue

@@ -0,0 +1,193 @@
+<template>
+	<view>
+		<view class="content1">
+			<view class="left">
+				<image src="../../static/c3.png" mode="widthFix" class="img"></image>
+			</view>
+			<view class="right">
+				<view class="row1">
+					{{cardInfo.name}}|{{cardInfo.post}}
+				</view>
+				<view class="">
+					{{cardInfo.companyName}}
+				</view>
+				<view class="">
+					地址{{cardInfo.province}}{{cardInfo.city}}{{cardInfo.area}}{{cardInfo.detailedAddress}}
+				</view>
+				<view class="">
+					联系电话{{cardInfo.phone}}
+				</view>
+				<view class="">
+					备注{{cardInfo.remark?cardInfo.remark:''}}
+				</view>
+			</view>
+		</view>
+		<u--form
+			labelPosition="left"
+			:model="cardInfo"
+			:rules="rules"
+			ref="uForm">
+			<u-form-item
+				label="名片分类"
+				prop="userInfo.name"
+				borderBottom
+				ref="item1">
+				<u-button @click="show = true">{{cardInfo.classify?cardInfo.classify:'默认分类'}}</u-button>
+			</u-form-item>
+			<u-form-item
+				label="备注(选填)"
+				prop="userInfo.name"
+				borderBottom
+				ref="item1">
+				<u--textarea v-model="cardInfo.remark" placeholder="输入备注,不超过150个字 " ></u--textarea>
+			</u-form-item>
+			<u-form-item
+				label="我的名片"
+				prop="userInfo.name"
+				borderBottom
+				ref="item1">
+				<u-button @click="show1 = true">{{cardInfo.cardBusiness?cardInfo.cardBusiness:'无名片'}}</u-button>
+			</u-form-item>
+		</u--form>
+		<u-picker keyName="cardBusiness" title="选择名片" @close="show1=false"
+			@cancel="show1=false" closeOnClickOverlay @confirm="cardConfirm" :show="show1" :columns="cardList"></u-picker>
+		<u-picker keyName="circleName" title="选择分类" @close="show=false"
+			@cancel="show=false" closeOnClickOverlay @confirm="typeConfirm" :show="show" :columns="columns"></u-picker>
+		<u-button @click='cancel' text="取消"></u-button>
+		<u-button @click='$u.debounce(save, 500)' text="保存"></u-button>
+		<u-toast ref="uToast"></u-toast>
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				id:'',
+				cardInfo:{},
+				show:false,
+				show1:false,
+				columns:[],
+				cardList:[],
+				rules: {
+					'userInfo.name': {
+						type: 'string',
+						required: true,
+						message: '请填写姓名',
+						trigger: ['blur', 'change']
+					},
+					'userInfo.sex': {
+						type: 'string',
+						max: 1,
+						required: true,
+						message: '请选择男或女',
+						trigger: ['blur', 'change']
+					},
+				},
+			}
+		},
+		onLoad(options) {
+				this.id=options.id
+				this.getList()
+		},
+		onShow() {
+			
+		},
+		methods: {
+			save(){
+				uni.showLoading({
+					title: '数据加载中',
+					mask:true
+				})
+				this.$request.baseRequest('admin.unimall.cardHolderInfo', 'add', {
+					cardHolderInfo:JSON.stringify({
+						cardId:this.cardInfo.id,
+						remark:this.cardInfo.remark,
+						cardCommonId:this.cardInfo.cardCommonId,
+						myCardId:this.cardInfo.myCardId,
+						commonId:uni.getStorageSync("userInfo").id,
+						classify:this.cardInfo.classify
+						})
+				}, failres => {
+					this.$refs.uToast.show({
+						type: 'error',
+						message: failres.errmsg,
+					})
+					uni.hideLoading()
+				}).then(res => {
+					this.$refs.uToast.show({
+						type: 'success',
+						message: '保存成功!',
+					})
+					uni.switchTab({
+						url:"/pages/cardHolder/cardHolder"
+						
+					})
+				})
+			},
+			cancel(){
+				uni.switchTab({
+					url:"/pages/cardHolder/cardHolder"
+					
+				})
+			},
+			cardConfirm(e){
+				console.log(e)
+				this.cardInfo.cardBusiness=e.value[0].cardBusiness
+				this.cardInfo.myCardId=e.value[0].id
+				this.show1=false
+			},
+			typeConfirm(e){
+				console.log(e)
+				this.cardInfo.classify=e.value[0].circleName
+				this.show=false
+			},
+			getList(){
+				this.$request.baseRequest('admin.unimall.cardManagementInfo', 'list', {
+					commonId: uni.getStorageSync("userInfo").id
+				}, failres => {
+					this.$refs.uToast.show({
+						type: 'error',
+						message: failres.errmsg,
+					})
+					uni.hideLoading()
+				}).then(res => {
+					this.cardList = [res.data.items]
+				})
+				this.$request.baseRequest('admin.unimall.cardClassifyInfo', 'list',{
+					page:1,
+					limit:9999,
+					commonId:uni.getStorageSync("userInfo").id
+				}, failres => {
+					console.log('res+++++', failres.errmsg)
+					this.$refs.uToast.show({
+						type: 'error',
+						message: failres.errmsg,
+					})
+				}).then(res => {
+					this.columns=[res.data.items]
+					console.log(this.columns)
+				})
+				this.$request.baseRequest('admin.unimall.cardManagementInfo', 'get',{
+						id:this.id
+					}, failres => {
+						console.log('res+++++', failres.errmsg)
+						this.$refs.uToast.show({
+							type: 'error',
+							message: failres.errmsg,
+						})
+						uni.hideLoading()
+					}).then(res => {
+						this.cardInfo=res.data
+						this.cardInfo.cardCommonId=res.data.commonId
+						console.log(res)
+					})
+					
+				}
+		}
+	}
+</script>
+
+<style>
+
+</style>

+ 71 - 38
xiaochengxu/pages/cardHolder/scancode.vue

@@ -4,19 +4,23 @@
 		 
 		 <!-- 扫描框 -->
 		 <view class="scanBox" >
-		     <camera class="camera" mode="scanCode" @scancode="scancode" :flash='flashBtn'>
-		         <image class="coverImg" :src="iconScanBgGif"></image>
+		     <camera :class="status==0?'scancode':'camera'" :mode="status==0?'scanCode':'normal'" @scancode="scancode" :flash='flashBtn'>
+		         <image v-if='status==0' class="coverImg" :src="iconScanBgGif"></image>
 		     </camera>
-		     <view style="text-align: center;margin: 80rpx 0 40rpx 0;">
-		         <button class="cu-btn scancodePic" bindtap="changeflashBtn">
-		             <!-- <image :src="flashBtn=='on'?scancodeOpen:scancodeClose"></image> -->
-		         </button>
-		     </view>
+			  
 		     <view class="scanTip">{{status==1?'请':'请扫描二维码'}}</view>
 		     <!-- 关闭扫码页面 -->
-		     <view class='scan-left' @click="scanClick(0)">扫码添加名片</view>
-			 <view class='scan' @click="scanClick(1)">名片识别</view>
-			 <div class="000"></div>
+			 <view class='wrap'>
+				 <view class='content'>
+					 <view class='scan-left' @click="scanClick(0)">扫码添加名片</view>
+					<view  v-if='status==0'></view>
+					<view @click='takePhoto' v-if='status==1' class='center-btn'><u-icon size="40" name="camera"></u-icon></view>
+					<view class='scan' @click="scanClick(1)">名片识别</view>
+				 </view>
+				
+			 </view>
+		     
+
 		 </view>
 	</view>
 </template>
@@ -35,7 +39,9 @@ export default {
         flashBtn: 'off', // off关闭   on  打开手电筒
         scanResult: '', // 扫描结果
 		isShow:false,
-		status:0
+		status:0,
+		flag:false,
+		src:''
     };
   },
   mounted() {
@@ -89,10 +95,16 @@ export default {
   					
   		})
   	},
-  methods: {
-     changeflashBtn(){
-           this.flashBtn=this.data.flashBtn=='off'?'on':'off'
-       },
+	methods: {
+		takePhoto() {
+	        const ctx = uni.createCameraContext();
+	        ctx.takePhoto({
+	            quality: 'high',
+	            success: (res) => {
+	                this.src = res.tempImagePath
+	            }
+	        });
+		},
        // 显示扫码界面(扫一扫)
        scanShowClick(){
 		   console.log('扫码',111111)
@@ -117,24 +129,33 @@ export default {
        },
        // 隐藏扫码界面
        scanClick(status){
-		   uni.scanCode({
-		   		scanType: ['barCode', 'qrCode'],
-		   		success: function(res) {
-					
-				}
-		    })
-          // this.status=status
+          this.status=status
        },
        // 扫一扫返回数据
        scancode(e) {
-           console.log(e.detail)
-			uni.scanCode({
-		   			scanType: ['barCode', 'qrCode'],
-		   			success: function(res) {
-						
-					}
-			})
-
+		   if(this.flag){
+			   return
+		   }else{
+			   this.flag=true
+			   if(e){
+				   console.log(e,1111111)
+				   if(e.target.result){
+					   
+						uni.navigateTo({
+							url: "/pages/cardHolder/scanCodeAddCard?id="+e.target.result
+						})
+						this.flag=false
+				   }else{
+					   uni.showModal({
+					   		content: '二维码无效',
+					   		showCancel: false
+					   	});
+					   	this.flag = false
+					   	return
+				   }
+			   }  
+		   }
+           
            // const {result:scanResult} = e.detail; 
            // if(result) {
            //     this.scanResult,canScan=false
@@ -157,12 +178,18 @@ export default {
     background-color: #000000;
 }
 
-.camera {
+.scancode {
     position: relative;
     width: 70vw;
     height: 70vw;
     margin: 20vh auto 0;
 }
+.camera {
+    position: relative;
+    width: 100vw;
+    height: 80vh;
+
+}
 .coverImg{
     position: absolute;
     top: 0;
@@ -191,16 +218,22 @@ export default {
 }
 /* 关闭按钮 */
 .scan,.scan-left{
-    position: absolute;
-    bottom: 0;
     padding: 20rpx 30rpx;
-    z-index: 99999;
     background: #fff;
 }
-.scan{
-	right:0;
-}
-.scan-left{
+.wrap{
+	width:100vw;
+	position:absolute;
+	z-index: 99999;
 	left:0;
+	bottom:0;
+	background-color: #000000;
+}
+.content{
+	display: flex;
+	justify-content: space-between;
+}
+.center-btn{
+	background:#fff;
 }
 </style>

+ 2 - 1
xiaochengxu/pages/cardHolder/search.vue

@@ -1,6 +1,6 @@
 <template>
 	<view>
-		<d-search-log :color_border="color_border" :color_text="color_border" :search_list_hot="search_list_hot"
+		<d-search-log :color_border="color_border" :color_text="color_border" :search_list_old_man_num='15' :search_list_hot="search_list_hot"
 			:store_key="store_key" @onClickDelAllApi="onClickDelAll" @onSearchNameApi="onSearchName"></d-search-log>
 
 	</view>
@@ -23,6 +23,7 @@
 			onClickDelAll() {
 			},
 			onSearchName(e) {
+				
 				uni.setStorageSync('search_val', e);
 				uni.switchTab({
 					url:"/pages/cardHolder/cardHolder"

+ 2 - 2
xiaochengxu/pages/circle/circle.vue

@@ -74,8 +74,7 @@
 				canReset: false,
 			};
 		},
-		onLoad(options) {
-			this.searchVal = options.val
+		onLoad() {
 		},
 		onShow() {
 			// this.searchVal = uni.getStorageSync("cirlce_search_val") ? uni.getStorageSync("cirlce_search_val") : ''
@@ -85,6 +84,7 @@
 				this.canReset && this.mescroll.scrollTo(0, 0) // 重置列表数据为第一页时,建议把滚动条也重置到顶部,避免无法再次翻页的问题  
 				this.canReset = true // 过滤第一次的onShow事件,避免初始化界面时重复触发upCallback, 无需配置auto:false
 			});
+			this.searchVal = uni.getStorageSync("cirlce_search_val") ? uni.getStorageSync("cirlce_search_val") : ''
 		},
 		methods: {
 			delSearchVal() {

+ 3 - 3
xiaochengxu/pages/circle/search.vue

@@ -1,6 +1,6 @@
 <template>
 	<view>
-		<d-search-log :color_border="color_border" :color_text="color_border" :search_list_hot="cirlce_search_list_hot"
+		<d-search-log :color_border="color_border" :color_text="color_border" :search_list_old_man_num='15' :search_list_hot="cirlce_search_list_hot"
 			:store_key="store_key" @onClickDelAllApi="onClickDelAll" @onSearchNameApi="onSearchName"></d-search-log>
 
 	</view>
@@ -24,8 +24,8 @@
 				console.log(val)
 			},
 			onSearchName(e) {
-				// uni.setStorageSync('cirlce_search_val', e);
-				uni.redirectTo({
+				uni.setStorageSync('cirlce_search_val', e);
+				uni.switchTab({
 					url:`/pages/circle/circle?val=${e}`
 				})
 				// uni.switchTab({

+ 21 - 6
xiaochengxu/pages/mySet/myHome.vue

@@ -82,9 +82,11 @@
 				fileList:[],
 				fileList1:[],
 				editstatus:false,
+				id:''
 			}
 		},
-		onLoad() {
+		onLoad(options) {
+			this.id=options.id
 			uni.showLoading({
 					title: '数据加载中'
 				})
@@ -99,13 +101,26 @@
 			// this.getList()
 			
 		},
+		onUnload(){
+			this.id=''
+		},
 		methods: {
 			getList(){
-				this.$request.baseRequest('admin.unimall.personalHomepageInfo', 'list',{
-					page:1,
-					limit:10,
-					commonId:uni.getStorageSync("userInfo").id
-				}, failres => {
+				var data={}
+				if(this.id){
+					data={
+						personalHomeId:this.id,
+						page:1,
+						limit:10,
+					}
+				}else{
+					data={
+						page:1,
+						limit:10,
+						commonId:uni.getStorageSync("userInfo").id
+					}
+				}
+				this.$request.baseRequest('admin.unimall.personalHomepageInfo', 'list',data, failres => {
 					console.log('res+++++', failres.errmsg)
 					this.$refs.uToast.show({
 						type: 'error',

+ 5 - 0
xiaochengxu/pages/mySet/myInfo.vue

@@ -99,6 +99,11 @@
 			this.init()
 		},
 		methods: {
+			toHome(item){
+				uni.navigateTo({
+					url: "/pages/mySet/myHome?id="+item.personalHomeId
+				})
+			},
 			radioChange(n) {
 				console.log('radioChange', n);
 			},