zhangxin 1 ヶ月 前
コミット
da2da13f69
共有3 個のファイルを変更した52 個の追加52 個の削除を含む
  1. 5 4
      pages/wareHouse/components/fakeRegistration.vue
  2. 4 3
      pages/wareHouse/index.vue
  3. 43 45
      pages/wareHouse/styles/fakeRegistration.scss

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

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

+ 4 - 3
pages/wareHouse/index.vue

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

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

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