zhangxin hai 1 mes
pai
achega
da2da13f69

+ 5 - 4
pages/wareHouse/components/fakeRegistration.vue

@@ -12,9 +12,9 @@
12 12
             v-for="(item, index) in tableData" 
13 13
             :key="item.id || index"
14 14
             :class="{ 'selected': selectedIndex === index }"
15
+            @click="handleItemClick(index, item)"
15 16
             >
16
-            <!-- @click="handleItemClick(index, item)" -->
17
-            <u-swipe-action>
17
+            <u-swipe-action ref="swipeRef">
18 18
               <u-swipe-action-item :options="swipeOptions" @click="(e) => handleSwipeClick(item, e, index)">
19 19
                 <view class="item_header">
20 20
                   <view class="name">{{ item.name }}</view>
@@ -95,7 +95,7 @@ export default {
95 95
         {
96 96
           text: '编辑',
97 97
           style: {
98
-            backgroundColor: '#343a40',
98
+            backgroundColor: '#3c9cff',
99 99
             color: '#fff'
100 100
           }
101 101
         }
@@ -158,8 +158,8 @@ export default {
158 158
     },
159 159
     handleSwipeClick(item, e, index) {
160 160
       if(e.index == 0){//编辑
161
-        this.selectedIndex = index;
162 161
         setTimeout(() => {
162
+          this.selectedIndex = index;
163 163
           this.isAdd = false
164 164
           this.currentEditItem = item
165 165
           this.formData = {
@@ -189,6 +189,7 @@ export default {
189 189
           uni.$u.api.wareHouseFakeEdit(this.formData).then(res => {
190 190
             if (res.code == 200) {
191 191
               uni.$u.toast('编辑成功')
192
+              this.$refs.swipeRef[this.selectedIndex].closeOther()
192 193
               this.showEditDialog = false
193 194
               this.getWareHouseFakeList()
194 195
             }

+ 4 - 3
pages/wareHouse/index.vue

@@ -69,8 +69,8 @@
69 69
 			<scroll-view class="goods-list" scroll-y @scrolltolower="handleLoadMore" enable-back-to-top>
70 70
 				<view @click.stop="clickItem(goods)" class="goods-item" v-for="(goods, goodsIndex) in goodsList"
71 71
 					:key="`goods-${goodsIndex}`">
72
-					<u-swipe-action>
73
-						<u-swipe-action-item :options="swipeOptions" @click="(e) => handleSwipeClick(e, goods)">
72
+					<u-swipe-action ref="swipeRef">
73
+						<u-swipe-action-item :options="swipeOptions" @click="(e) => handleSwipeClick(e, goods, goodsIndex)">
74 74
 							<view class="goods-info">
75 75
 								<view class="goods-img-container">
76 76
 									<image class="goods-img" :src="goods.imgUrl ? goods.imgUrl : '/static/no-img.png'"
@@ -307,12 +307,13 @@ export default {
307 307
 				this.handleToDetail(item);
308 308
 			}
309 309
 		},
310
-		handleSwipeClick(e, item) {
310
+		handleSwipeClick(e, item,goodsIndex) {
311 311
 			if (e.index == 0) {//删除
312 312
 				this.isSwipeClick = true;
313 313
 				uni.$u.api.wareHouseDelete({
314 314
 					id: item.id
315 315
 				}).then(() => {
316
+					this.$refs.swipeRef[goodsIndex].closeOther()
316 317
 					uni.$u.toast("删除成功");
317 318
 					this.handleSearch();
318 319
 				}).catch((err) => {

+ 43 - 45
pages/wareHouse/styles/fakeRegistration.scss

@@ -1,15 +1,15 @@
1
-.fake_registration{
1
+.fake_registration {
2 2
     padding: 0 20rpx;
3 3
     min-height: 100vh;
4 4
     background-color: #f8f9fa;
5 5
     font-family: 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
6
-    
7
-    .fake_list_wrap{
6
+
7
+    .fake_list_wrap {
8 8
         margin-top: 20rpx;
9 9
         min-height: calc(100vh - 120rpx);
10
-        
11
-        .list_content{
12
-            .fake_item{
10
+
11
+        .list_content {
12
+            .fake_item {
13 13
                 background-color: #ffffff;
14 14
                 border-radius: 16rpx;
15 15
                 padding: 32rpx;
@@ -17,31 +17,29 @@
17 17
                 box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04);
18 18
                 transition: all 0.3s ease;
19 19
                 border: 1rpx solid #e9ecef;
20
-                
21
-                &.selected{
20
+
21
+                &.selected {
22 22
                     box-shadow: 0 12rpx 32rpx rgba(71, 130, 241, 0.2);
23
-                    transform: translateY(-5rpx) scale(1.02);
24 23
                     border-color: #4782f1;
25 24
                     border-width: 2rpx;
26
-                    z-index: 10;
27 25
                 }
28
-                
29
-                .item_header{
26
+
27
+                .item_header {
30 28
                     display: flex;
31 29
                     justify-content: space-between;
32 30
                     align-items: center;
33 31
                     margin-bottom: 24rpx;
34 32
                     padding-bottom: 20rpx;
35 33
                     border-bottom: 1rpx dashed #e9ecef;
36
-                    
37
-                    .name{
34
+
35
+                    .name {
38 36
                         font-size: 32rpx;
39 37
                         font-weight: 700;
40 38
                         color: #212529;
41 39
                         position: relative;
42 40
                         padding-left: 20rpx;
43
-                        
44
-                        &::before{
41
+
42
+                        &::before {
45 43
                             content: '';
46 44
                             position: absolute;
47 45
                             left: 0;
@@ -53,34 +51,34 @@
53 51
                             background-color: #4782f1;
54 52
                         }
55 53
                     }
56
-                    
57
-                    .phone{
54
+
55
+                    .phone {
58 56
                         font-size: 26rpx;
59 57
                         color: #6c757d;
60 58
                         padding: 6rpx 16rpx;
61 59
                         border-radius: 16rpx;
62 60
                     }
63 61
                 }
64
-                
65
-                .item_body{
66
-                    .info_item{
62
+
63
+                .item_body {
64
+                    .info_item {
67 65
                         display: flex;
68 66
                         align-items: center;
69 67
                         margin-bottom: 16rpx;
70 68
                         font-size: 26rpx;
71 69
                         line-height: 44rpx;
72
-                        
73
-                        &:last-child{
70
+
71
+                        &:last-child {
74 72
                             margin-bottom: 0;
75 73
                         }
76
-                        
77
-                        .label{
74
+
75
+                        .label {
78 76
                             color: #868e96;
79 77
                             min-width: 120rpx;
80 78
                             font-weight: 500;
81 79
                         }
82
-                        
83
-                        .value{
80
+
81
+                        .value {
84 82
                             color: #495057;
85 83
                             flex: 1;
86 84
                             word-break: break-word;
@@ -91,26 +89,26 @@
91 89
                     }
92 90
                 }
93 91
             }
94
-            
95
-            .u-loadmore{
92
+
93
+            .u-loadmore {
96 94
                 margin-top: 30rpx;
97 95
                 margin-bottom: 40rpx;
98 96
             }
99 97
         }
100
-        
101
-        .u-empty{
98
+
99
+        .u-empty {
102 100
             margin-top: 120rpx;
103 101
         }
104 102
     }
105
-    
103
+
106 104
     // 编辑弹窗样式
107
-    .edit_dialog{
105
+    .edit_dialog {
108 106
         width: 85%;
109 107
         max-width: 520rpx;
110 108
         border-radius: 16rpx;
111 109
         overflow: hidden;
112
-        
113
-        .dialog_title{
110
+
111
+        .dialog_title {
114 112
             font-size: 34rpx;
115 113
             font-weight: 700;
116 114
             color: #212529;
@@ -118,26 +116,26 @@
118 116
             padding: 36rpx 24rpx;
119 117
             border-bottom: 1rpx solid #e9ecef;
120 118
         }
121
-        
122
-        .dialog_content{
119
+
120
+        .dialog_content {
123 121
             padding: 36rpx 28rpx;
124
-            
125
-            .u-form-item{
126
-                
127
-                .u-form-item__label{
122
+
123
+            .u-form-item {
124
+
125
+                .u-form-item__label {
128 126
                     font-size: 28rpx;
129 127
                     font-weight: 600;
130 128
                     color: #495057;
131 129
                     margin-bottom: 12rpx;
132 130
                     display: block;
133 131
                 }
134
-                
135
-                .u-input{
132
+
133
+                .u-input {
136 134
                     border-radius: 8rpx;
137 135
                     border: 1rpx solid #ced4da;
138 136
                     transition: all 0.3s ease;
139
-                    
140
-                    &:focus{
137
+
138
+                    &:focus {
141 139
                         border-color: #4782f1;
142 140
                         box-shadow: 0 0 0 4rpx rgba(71, 130, 241, 0.1);
143 141
                         background-color: #ffffff;