Browse Source

fix:新增和修复选择bug

storeBelieveInLight 1 year ago
parent
commit
e4ee823ec5

+ 7 - 0
pages.json

@@ -197,6 +197,13 @@
197 197
                 	"style" : {
198 198
                 		 "navigationStyle" : "custom"
199 199
                 	}
200
+                },
201
+                {
202
+                	"path" : "commodity/logisticsInformation",
203
+                	"style" : 
204
+                	{
205
+                		 "navigationStyle" : "custom"
206
+                	}
200 207
                 }
201 208
             ]
202 209
         },

+ 12 - 1
shop/commodity/components/fillLogisticsInfo.vue

@@ -31,6 +31,17 @@ export default {
31 31
   methods: {
32 32
     handleQrcode() {
33 33
       console.log("handleQrcode");
34
+      uni.showModal({
35
+        title: "提示",
36
+        content: "扫码功能快马加鞭开发中....",
37
+        success(res) {
38
+          if (res.confirm) {
39
+            console.log("用户点击了确定");
40
+          } else if (res.cancel) {
41
+            console.log("用户点击了取消");
42
+          }
43
+        },
44
+      });
34 45
     },
35 46
     changeInput(val) {
36 47
       console.log(val, "物流单号");
@@ -56,7 +67,7 @@ export default {
56 67
 .logistics-information {
57 68
   background: #ffffff;
58 69
   border-radius: 16rpx;
59
-  padding: 26rpx 21rpx 10rpx 32rpx;
70
+  padding: 26rpx 21rpx 0rpx 32rpx;
60 71
   display: flex;
61 72
   flex-direction: column;
62 73
   &__text {

+ 1 - 2
shop/commodity/components/popupSelect.vue

@@ -104,8 +104,7 @@ export default {
104 104
 			this.selectId = item.value || index
105 105
 		}
106 106
 		this.$emit("update:value",this.selectId)
107
-		console.log(this.selectId,"this.selectId")
108
-		const itemObj = this.selectId?item:{}
107
+		const itemObj = this.selectId !==''?item:{}
109 108
 		this.$emit("tabs",{selected:this.selectId,item:itemObj,index})
110 109
 		this.handleClose()
111 110
 		

+ 4 - 1
shop/commodity/components/popupSelectItem/popupSelectItem.vue

@@ -2,7 +2,10 @@
2 2
       <view class="form_item">
3 3
         <view class="form_item--left"> {{name}} </view>
4 4
         <view class="form_item--right">
5
-          <view class="upop" @click="handleSelect">
5
+		<template v-if="$slots.right">
6
+			<slot name="right"></slot>
7
+		</template>
8
+          <view class="upop" @click="handleSelect" v-else>
6 9
             <view class="title xcv">{{ logistics }}</view>
7 10
             <image src="/static/images/new_ui/arrow-right.png" mode=""></image>
8 11
           </view>

+ 37 - 10
shop/commodity/components/shipmentGoodsCard.vue

@@ -3,46 +3,70 @@
3 3
 	<view class="card-wrapper">
4 4
 	   <view class="card-wrapper__text">{{title}}</view>
5 5
 	   <view class="card-wrapper__address">
6
-		   北京市通州区经开壹中心14号楼9层北京市通州区经开壹中心14号楼9层
6
+		   {{address}}
7 7
 	   </view>
8 8
 	   
9 9
 	   <view class="card-wrapper__user">
10 10
 		   <view class="card-wrapper__user--info">
11 11
 		   	<view class="">
12
-		   		郭郭备份
12
+		   		{{userInfo}}
13 13
 		   	</view>
14 14
 		   		 <text class="user_phone" >
15
-		   		 	{{user_phone.substr(0, 3) + '****' + user_phone.substr(7)}}
15
+		   		 	{{phone_user}}
16 16
 		   		 </text>
17 17
 		   </view>
18
-		   <view class="card-wrapper__user--btn">
19
-		    <image src="/static/images/new_ui/look.png" ></image>
18
+		   <view class="card-wrapper__user--btn" @click="handleLooks">
19
+		    <!-- <image src="/static/images/new_ui/look.png" ></image> -->
20
+			<uni-icons :type="!showPhone?'eye-slash':'eye-slash-filled'" size="30" :color="showPhone?'#007aff':'#333'"></uni-icons>
21
+
20 22
 			</view>
21 23
 	   </view>
22 24
 	</view>
23 25
 </template>
24 26
 
25 27
 <script>
28
+	import {MaskRules} from "@/utils/index.js"
26 29
 	export default {
27 30
 		props:{
28 31
 			title:{
29 32
 				type:String,
30 33
 				default:"发货商品"
34
+			},
35
+			phone:{
36
+				type:String,
37
+				default:"18533332222"
38
+			},
39
+			userInfo:{
40
+				type:String,
41
+				default:"郭郭备份"
42
+			},
43
+			address:{
44
+				type:String,
45
+				default:"北京市通州区经开壹中心14号楼9层北京市通州区经开壹中心14号楼9层"
31 46
 			}
32 47
 		},
33 48
 		data() {
34 49
 			return {
35
-				showDetailInfo:false,
36
-				user_phone:"18533332222"
50
+				showPhone:false,
37 51
 			};
38 52
 		},
39 53
 		methods:{
54
+			handleLooks(){
55
+				this.showPhone = !this.showPhone
56
+			}
40 57
 			
41
-			changeDetailInfo(){
42
-				this.showDetailInfo = !this.showDetailInfo
58
+		},
59
+	  computed: {
60
+	  	phone_user() {
61
+			if(this.showPhone){
62
+				return this.phone
63
+			}else{
64
+				return MaskRules.mobile(this.phone)
43 65
 			}
44 66
 			
45
-		}
67
+	  	}
68
+	  },
69
+		
46 70
 	}
47 71
 </script>
48 72
 
@@ -99,4 +123,7 @@
99 123
 		}
100 124
 	}
101 125
 }
126
+
127
+
128
+
102 129
 </style>

+ 19 - 0
shop/commodity/logisticsInformation.vue

@@ -0,0 +1,19 @@
1
+<template>
2
+	<view>
3
+		物流信息详情
4
+	</view>
5
+</template>
6
+
7
+<script>
8
+	export default {
9
+		data() {
10
+			return {
11
+				
12
+			};
13
+		}
14
+	}
15
+</script>
16
+
17
+<style lang="scss">
18
+
19
+</style>

+ 38 - 3
shop/commodity/sendoutgoods.vue

@@ -12,10 +12,10 @@
12 12
         v-if="goodsCustomType === 'pickup'"
13 13
         class="inputInfo"
14 14
       ></reInputItemVue>
15
-	  <reInputItemVue
15
+<!-- 	  <reInputItemVue
16 16
 	    v-if="goodsCustomType === 'pickup'"
17 17
 	    class="inputInfo"
18
-	  ></reInputItemVue>
18
+	  ></reInputItemVue> -->
19 19
 	  <popupSelectItemVue  
20 20
 	  v-if="goodsCustomType === 'deliverGoods'"
21 21
 	    class="inputInfo"
@@ -24,7 +24,12 @@
24 24
 		title="送货人员信息"
25 25
 		:selectData="selectData"
26 26
 		@click-tabs="clickTabs"
27
-		></popupSelectItemVue>
27
+		>
28
+		<view class="upop" slot="right">
29
+			<view class="title xcv">{{ deliveryMan }}</view>
30
+			<image src="/static/images/new_ui/arrow-right.png" mode=""></image>
31
+		</view>
32
+		</popupSelectItemVue>
28 33
       <view class="btn-box">
29 34
         <button
30 35
           type="primary"
@@ -37,6 +42,7 @@
37 42
           type="primary"
38 43
           class="send-goods"
39 44
           v-if="goodsCustomType === 'pickup'"
45
+		  @click="copyHandle('请选择送货人员请选择送货人员请选择送货人员121212copy')"
40 46
         >
41 47
           自提
42 48
         </button>
@@ -52,6 +58,7 @@ import fillLogisticsInfoVue from "./components/fillLogisticsInfo.vue";
52 58
 import headersVue from "../components/headers/headers.vue";
53 59
 import reInputItemVue from "./components/reInputItem/reInputItem.vue";
54 60
 import popupSelectItemVue from "./components/popupSelectItem/popupSelectItem.vue";
61
+import {copy} from "@/utils/index.js"
55 62
 export default {
56 63
   components: {
57 64
     shipmentGoodsCardVue,
@@ -96,6 +103,7 @@ export default {
96 103
         sendGoods: "发货商品",
97 104
         pickup: "自提商品",
98 105
       },
106
+	  deliveryMan:"请选择送货人员"
99 107
     };
100 108
   },
101 109
   onLoad(e) {
@@ -107,6 +115,9 @@ export default {
107 115
     this.shipmentGoodsTitle = this.shipmentGoodsTitleMap[this.goodsCustomType];
108 116
   },
109 117
   methods: {
118
+	  copyHandle(val){
119
+		  copy(val)
120
+	  },
110 121
     topgi() {
111 122
       uni.redirectTo({
112 123
         url: "./order?status=" + this.status + "&index=" + this.indexs,
@@ -154,4 +165,28 @@ page {
154 165
   margin-top: 26rpx;
155 166
   padding: 0 26rpx;
156 167
 }
168
+.title {
169
+      font-family: PingFangSC, PingFang SC;
170
+      font-weight: 400;
171
+      font-size: 28rpx;
172
+      color: #999999;
173
+    }
174
+    .upop {
175
+      display: flex;
176
+      width: 100%;
177
+      align-items: center;
178
+      justify-content: flex-end;
179
+      image {
180
+        width: 30rpx;
181
+        height: 30rpx;
182
+        margin-left: 5rpx;
183
+      }
184
+      .image-box {
185
+        width: 40rpx;
186
+        height: 38rpx;
187
+      }
188
+    }
189
+	.xcv{
190
+		flex:1;
191
+	}
157 192
 </style>

+ 115 - 0
utils/index.js

@@ -0,0 +1,115 @@
1
+/**
2
+ * 复制文本到剪贴板
3
+ * @param {string} text 需要复制的文本
4
+ * @returns {Promise<boolean>} 是否复制成功
5
+ */
6
+function copyToClipboard(text) {
7
+	// 现代浏览器方案 (推荐)
8
+	if (navigator.clipboard && window.isSecureContext) {
9
+		return navigator.clipboard.writeText(text)
10
+			.then(() => true)
11
+			.catch(() => false);
12
+	}
13
+
14
+	// 传统浏览器兼容方案
15
+	return new Promise((resolve) => {
16
+		try {
17
+			// 创建临时文本域
18
+			const textarea = document.createElement('textarea');
19
+			textarea.value = text;
20
+			textarea.style.position = 'fixed'; // 防止滚动
21
+			textarea.style.opacity = '0'; // 透明化
22
+			document.body.appendChild(textarea);
23
+
24
+			// 选中内容 (兼容iOS)
25
+			if (navigator.userAgent.match(/ipad|ipod|iphone/i)) {
26
+				const range = document.createRange();
27
+				range.selectNodeContents(textarea);
28
+				const selection = window.getSelection();
29
+				selection.removeAllRanges();
30
+				selection.addRange(range);
31
+				textarea.setSelectionRange(0, 999999);
32
+			} else {
33
+				textarea.select();
34
+			}
35
+
36
+			// 执行复制命令
37
+			const success = document.execCommand('copy');
38
+			document.body.removeChild(textarea);
39
+			resolve(success);
40
+		} catch (err) {
41
+			resolve(false);
42
+		}
43
+	});
44
+}
45
+
46
+export async function copy(value) {
47
+	const success = await copyToClipboard(value);
48
+	if (success) {
49
+		uni.showToast({ //提示
50
+			title: '复制成功'
51
+		})
52
+	} else {
53
+		uni.showToast({ //提示
54
+			title: '复制失败',
55
+
56
+		})
57
+	}
58
+}
59
+
60
+
61
+/**
62
+ * 通用数据脱敏函数
63
+ * @param {string} str 原始字符串
64
+ * @param {number} start 脱敏起始位置(从0开始)
65
+ * @param {number} end 脱敏结束位置(不包含)
66
+ * @param {string} mask 替换字符(默认*)
67
+ * @returns {string} 脱敏后的字符串
68
+ */
69
+export function dataMasking(str, start = 0, end = 0, mask = '*') {
70
+	if (!str || typeof str !== 'string') return str
71
+	if (start >= end) return str
72
+
73
+	const head = str.slice(0, start)
74
+	const tail = str.slice(end)
75
+	const masked = mask.repeat(end - start)
76
+	return head + masked + tail
77
+}
78
+
79
+// 常用预定义规则
80
+export const MaskRules = {
81
+	// 手机号脱敏(显示前3后4)
82
+	mobile: (str) => dataMasking(str, 3, 7),
83
+
84
+	// 身份证号脱敏(显示前6后4)
85
+	idCard: (str) => {
86
+		if (str.length === 18) return dataMasking(str, 6, 14)
87
+		if (str.length === 15) return dataMasking(str, 6, 12)
88
+		return str
89
+	},
90
+
91
+	// 银行卡号脱敏(显示前6后4)
92
+	bankCard: (str) => dataMasking(str, 6, str.length - 4),
93
+
94
+	// 姓名脱敏(张三 → 张*,欧阳修 → 欧**)
95
+	name: (str) => {
96
+		if (str.length <= 1) return str
97
+		return dataMasking(str, 1, str.length - 1)
98
+	}
99
+}
100
+
101
+// 使用示例
102
+const sensitiveData = {
103
+	mobile: '13812345678',
104
+	idCard: '110101199003077654',
105
+	bankCard: '6225880136745321',
106
+	name: '张三丰'
107
+}
108
+
109
+// 脱敏处理
110
+const maskedData = {
111
+	mobile: MaskRules.mobile(sensitiveData.mobile), // 138****5678
112
+	idCard: MaskRules.idCard(sensitiveData.idCard), // 110101********7654
113
+	bankCard: MaskRules.bankCard(sensitiveData.bankCard), // 622588******5321
114
+	name: MaskRules.name(sensitiveData.name) // 张*丰
115
+}