Sfoglia il codice sorgente

布局样式调整;全局数据null转为空字符串;全局引入加解密和脱敏方法

htc 9 mesi fa
parent
commit
d92aea7ace
4 ha cambiato i file con 62 aggiunte e 14 eliminazioni
  1. 25 3
      http/index.js
  2. 4 1
      main.js
  3. 10 3
      pages/house/orderDetails.vue
  4. 23 7
      pages/house/orderInfo.vue

+ 25 - 3
http/index.js

@@ -4,7 +4,8 @@ import {
 } from '../utils/aes.js'
 
 //解密脱敏字段集合 type(姓名 1、手机号 2、身份证 3)
-const tmList = [{
+const tmList = [
+	{
 		prop: 'card',
 		type: 3
 	},
@@ -116,7 +117,9 @@ const tmList = [{
 // 不做脱敏处理的api集合(页面上需要编辑单独处理的)
 const apiList = [
 	'/api/commonPerson/list',
-	'/scenic/api/order/scanCode'
+	'/scenic/api/order/scanCode',
+	'/merchant/hotel/order/getOrderDetail',
+	'/merchant/hotel/repast/getRepastOrderInfo'
 ]
 //解密脱敏处理
 function dealJmTmData(data, isTm) {
@@ -141,6 +144,25 @@ function dealJmTmData(data, isTm) {
 	})
 }
 
+//将null和undefined转为空字符串
+function nullToKongStr(data){
+	if (!data) return;
+	let keys = Object.keys(data);
+	keys.forEach(k => {
+		if(data[k]===null||data[k]===undefined) data[k] = "";
+	
+		if (typeof data[k] === 'object') {
+			nullToKongStr(data[k]);
+		} else if (Array.isArray(data[k])) {
+			data[k].forEach(dk => {
+				if (typeof dk === 'object') {
+					nullToKongStr(dk);
+				}
+			})
+		}
+	})
+}
+
 // 脱敏规则
 function tmRules(value, type) {
 	if (!value) return;
@@ -188,9 +210,9 @@ export const $http = (url, method, data, json, isAuth, isBuffer) => {
 		uni.hideLoading()
 		//数据解密脱敏处理
 		if (response.data && response.data.data) {
+			nullToKongStr(response.data.data);
 			if (url.indexOf('/merchant/hotel/order/getOrderDetail/') > -1) {
 				//房态入住人不脱敏不加密数据备份
-				console.log(response.data.data)
 				let checkInPersonList = response.data.data.detailFormList[0].checkInPersonList;
 				if (checkInPersonList.length != 0) {
 					checkInPersonList.forEach((ele, i) => {

+ 4 - 1
main.js

@@ -56,7 +56,10 @@ import wxShare from '@/utils/wxShare.js'
 Vue.mixin(wxShare);
 //全局属性
 import getSystemInfo from '@/utils/getSystemInfo.js'
-Vue.mixin(getSystemInfo);
+Vue.mixin(getSystemInfo);
+//加解密和脱敏
+import aesTm from '@/utils/aes.js'
+Vue.prototype.$aesTm = aesTm;
 
 // #ifdef VUE3
 import {

+ 10 - 3
pages/house/orderDetails.vue

@@ -79,7 +79,8 @@
 				<u-cell :border="false">
 					<text slot="icon" class="txt">预约手机号</text>
 					>
-					<text slot="title" class="val">{{list.guestPhone}}</text>
+					<text slot="title" class="val">{{list.guestPhoneCopy}}</text>
+					<image style="width: 48rpx;height: 48rpx;" slot="right-icon" src="https://i.ringzle.com/file/20240605/54be8cae94374d898e4f64ca1fc2b655.png" @click="callPhone(list.guestPhone)"></image>
 				</u-cell>
 
 				<u-cell :border="false" v-if="list.comboType==2">
@@ -173,7 +174,12 @@
 
 			this.getList()
 		},
-		methods: {
+		methods: {
+			callPhone(phoneNumber){
+				uni.makePhoneCall({
+					phoneNumber
+				})
+			},
 			copyOrderNo(no) {
 				let that = this;
 				// #ifdef H5
@@ -198,7 +204,8 @@
 			getList() {
 				this.$api.get(`/merchant/hotel/repast/getRepastOrderInfo/${this.id}`)
 					.then(res => {
-						this.list = res.data.data
+						this.list = res.data.data;
+						if(this.list.guestPhone) this.list.guestPhoneCopy = this.$aesTm.tuomin(this.list.guestPhone,2)
 					})
 			},
 			// 删除

+ 23 - 7
pages/house/orderInfo.vue

@@ -4,8 +4,9 @@
 		<view class="body" v-if="orderInfo.detailFormList[0]">
 			<!-- 个人信息 -->
 			<view class="uname">
-				<text style="margin-right: 20rpx;">{{orderInfo.guestName}}</text>
-				<text>{{orderInfo.guestPhone}}</text>
+				<text style="margin-right: 50rpx;">{{orderInfo.guestName}}</text>
+				<text style="margin-right: 20rpx;">{{orderInfo.guestPhoneCopy}}</text>
+				<image class="callphone" src="https://i.ringzle.com/file/20240605/54be8cae94374d898e4f64ca1fc2b655.png" @click="callPhone(orderInfo.guestPhone)"></image>
 			</view>
 			<!-- 房间信息  -->
 			<view class="room">
@@ -154,12 +155,18 @@
 			}
 
 		},
-		methods: {
+		methods: {
+			callPhone(phoneNumber){
+				uni.makePhoneCall({
+					phoneNumber
+				})
+			},
 			// 获取数据
 			getOrderInfo() {
 				this.$api.get(`/merchant/hotel/order/getOrderDetail/${this.orderId}`).then((res) => {
 					if (res.data.code == 0) {
-						this.orderInfo = res.data.data
+						this.orderInfo = res.data.data;
+						if(this.orderInfo.guestPhone) this.orderInfo.guestPhoneCopy = this.$aesTm.tuomin(this.orderInfo.guestPhone,2)
 						if (new Date(this.orderInfo.arriveDate).Format('yyyy-MM-dd') == new Date().Format(
 								'yyyy-MM-dd')) {
 							this.showRuzhu = true;
@@ -171,7 +178,8 @@
 			getrepast() {
 				this.$api.get(`/merchant/hotel/repast${this.id}`).then((res) => {
 					if (res.data.code == 0) {
-						this.orderInfo = res.data.data
+						this.orderInfo = res.data.data;
+						if(this.orderInfo.guestPhone) this.orderInfo.guestPhoneCopy = this.$aesTm.tuomin(this.orderInfo.guestPhone,2)
 						if (new Date(this.orderInfo.arriveDate).Format('yyyy-MM-dd') == new Date().Format(
 								'yyyy-MM-dd')) {
 							this.showRuzhu = true;
@@ -309,8 +317,16 @@
 		padding-left: 30rpx;
 		font-size: 30rpx;
 		border-radius: 10rpx;
-		box-sizing: border-box;
-
+		box-sizing: border-box;
+		position: relative;
+		.callphone{
+			width: 48rpx;
+			height: 48rpx;
+			position: absolute;
+			top: 50%;
+			margin-top: -24rpx;
+			right: 30rpx;
+		}
 	}
 
 	.room {