storeBelieveInLight 1 год назад
Родитель
Сommit
aa5f9d92e6

+ 1 - 0
shop/commodity/order.vue

@@ -245,6 +245,7 @@
245 245
 <style>
246 246
 	page {
247 247
 		background-color: #F7F8FC;
248
+		/* padding-top: 90rpx; */
248 249
 	}
249 250
 </style>
250 251
 <style lang="scss" scoped>

+ 1 - 1
shop/components/tabs/tabs/tabs.vue

@@ -7,7 +7,7 @@
7 7
 					<!-- 选项卡类别列表 -->
8 8
 					<view class="tab-scroll_item" v-for=" (item,index) in category" 
9 9
 					:key="index"  :class="{'active':isActive==index}" @click="chenked(index,item)">
10
-							<span>{{item.name}}</span><span v-if="isShowNumber && item.show">({{item.totalNum|| 0}})</span>
10
+							<text>{{item.name}}</text><text v-if="isShowNumber && item.show">({{item.totalNum|| 0}})</text>
11 11
 					</view>
12 12
 				</view>
13 13
 			</scroll-view>

+ 50 - 0
shop/productManagementModule/components/emptyData/emptyData.vue

@@ -0,0 +1,50 @@
1
+<template>
2
+	    <view class="flex-col">
3
+	      <image
4
+	        class="image_wrapper"
5
+	        src="/static/images/new_ui/empty_data.png"
6
+	      />
7
+	      <view class="text_tilte">{{title}}</view>
8
+	    </view>
9
+</template>
10
+
11
+<script>
12
+	export default {
13
+		props:{
14
+			title:{
15
+				type:String,
16
+				default:"暂无数据"
17
+			}
18
+		},
19
+		data() {
20
+			return {
21
+				
22
+			};
23
+		}
24
+	}
25
+</script>
26
+
27
+<style lang="scss">
28
+.flex-col{
29
+	user-select: none;
30
+	text-align: center;
31
+	width:100%;
32
+	position: absolute;
33
+	top:30%;
34
+	.text_tilte{
35
+		font-family: PingFangSC, PingFang SC;
36
+		font-weight: 400;
37
+		font-size: 30rpx;
38
+		color: #333333;
39
+		line-height: 30rpx;
40
+		text-align: center;
41
+		font-style: normal;
42
+	}
43
+	.image_wrapper{
44
+		     width: 327px;
45
+		      height: 257px;
46
+			  
47
+		
48
+	}
49
+}
50
+</style>

+ 87 - 0
shop/productManagementModule/components/search/search.vue

@@ -0,0 +1,87 @@
1
+<template>
2
+  <view class="search-wrapper">
3
+    <view class="flex-row justify-end">
4
+      <image
5
+        class="search__image"
6
+        referrerpolicy="no-referrer"
7
+        src="/static/images/new_ui/search_icon_blod.png"
8
+      />
9
+      <input
10
+        class="search__input"
11
+        v-model="searchValue"
12
+        type="text"
13
+        placeholder="输入商品名称/商品ID"
14
+      />
15
+      <button class="search__btn" @click="haandleSearch">搜索</button>
16
+    </view>
17
+  </view>
18
+</template>
19
+
20
+<script>
21
+export default {
22
+  data() {
23
+    return {
24
+      searchValue: ""
25
+    };
26
+  },
27
+  methods: {
28
+    haandleSearch() {
29
+      this.$emit("search", this.searchValue);
30
+    }
31
+  }
32
+};
33
+</script>
34
+
35
+<style lang="scss">
36
+.search-wrapper {
37
+  background: #ffffff;
38
+  height: 110rpx;
39
+  display: flex;
40
+  align-items: center;
41
+  width: 100%;
42
+
43
+  .search__image {
44
+    position: absolute;
45
+    width: 32rpx;
46
+    height: 32rpx;
47
+    left: 40rpx;
48
+    top: 18rpx;
49
+  }
50
+  .search__input {
51
+    border: 2rpx solid #000;
52
+    flex: 1;
53
+    height: 60rpx;
54
+    margin-left: 26rpx;
55
+    padding: 0 120rpx 0 55rpx;
56
+    border-radius: 30rpx;
57
+    margin-right: 20rpx;
58
+    border: none;
59
+    background: #f8f8f8;
60
+    font-size: 26rpx;
61
+    color: #333333;
62
+  }
63
+  .flex-row {
64
+    display: flex;
65
+    flex-direction: row;
66
+    align-items: center;
67
+  }
68
+  .justify-end {
69
+    position: relative;
70
+    border-radius: 30rpx;
71
+    flex: 1;
72
+  }
73
+  .search__btn {
74
+    position: absolute;
75
+    right: 20rpx;
76
+    width: 108rpx;
77
+    height: 60rpx;
78
+    white-space: nowrap;
79
+    background-color: rgba(31, 124, 255, 1);
80
+    border-radius: 30rpx;
81
+    text-align: center;
82
+    font-size: 28rpx;
83
+    line-height: 60rpx;
84
+    color: rgba(255, 255, 255, 1);
85
+  }
86
+}
87
+</style>

+ 245 - 0
shop/productManagementModule/components/tablist.vue

@@ -0,0 +1,245 @@
1
+<template>
2
+  <view class="content">
3
+    <view class="nav">
4
+      <!-- 选项卡水平方向滑动,scroll-with-animation是滑动到下一个选项时,有一个延时效果 -->
5
+      <scroll-view
6
+        class="tab-scroll"
7
+        scroll-x="true"
8
+        scroll-with-animation
9
+        :scroll-left="scrollLeft"
10
+      >
11
+        <view class="tab-scroll_box">
12
+          <!-- 选项卡类别列表 -->
13
+          <view
14
+            class="tab-scroll_item"
15
+            v-for="(item, index) in category"
16
+            :key="index"
17
+            :class="{ active: isActive == index }"
18
+            @click="chenked(index, item)"
19
+          >
20
+            <view class="tile-box">
21
+              <text class="name-box">{{ item.name }}</text>
22
+              <text class="count">
23
+                {{ item.count || 0 }}
24
+              </text>
25
+            </view>
26
+          </view>
27
+        </view>
28
+      </scroll-view>
29
+    </view>
30
+    <!-- <swiper @change="change" :current="isActive" class="swiper-content" :style="fullHeight">
31
+			<swiper-item class="swiperitem-content">
32
+				<scroll-view scroll-y style="height: 100%;">
33
+					<view class="nav_item" >
34
+						1
35
+					</view>
36
+				</scroll-view>	
37
+			</swiper-item>
38
+			<swiper-item class="swiperitem-content">
39
+				<scroll-view scroll-y style="height: 100%;">
40
+					<view class="nav_item" >
41
+						2
42
+					</view>
43
+				</scroll-view>	
44
+			</swiper-item>
45
+			<swiper-item class="swiperitem-content">
46
+				<scroll-view scroll-y style="height: 100%;">
47
+					<view class="nav_item" >
48
+						3
49
+					</view>
50
+				</scroll-view>
51
+			</swiper-item>
52
+			<swiper-item class="swiperitem-content">
53
+				<scroll-view scroll-y style="height: 100%;">
54
+					<view class="nav_item" >
55
+						4
56
+					</view>
57
+				</scroll-view>	
58
+			</swiper-item>
59
+			<swiper-item class="swiperitem-content">
60
+				<scroll-view scroll-y style="height: 100%;">
61
+					<view class="nav_item" >
62
+						5
63
+				    </view>
64
+				</scroll-view>	
65
+			</swiper-item>
66
+			<swiper-item class="swiperitem-content">
67
+				<scroll-view scroll-y style="height: 100%;">
68
+					<view class="nav_item" >
69
+						6
70
+				    </view>
71
+				</scroll-view>	
72
+			</swiper-item>
73
+		</swiper> -->
74
+  </view>
75
+</template>
76
+<script>
77
+export default {
78
+  props: {
79
+    category: {
80
+      type: Array,
81
+      default: () => []
82
+    },
83
+    isShowNumber: {
84
+      type: Boolean,
85
+      default: true
86
+    },
87
+    curruntActive: {
88
+      type: [Number, String],
89
+      default: 0
90
+    }
91
+  },
92
+  watch: {
93
+    // swiper与上面选项卡联动
94
+    currentindex(newval) {
95
+      this.isActive = newval;
96
+      this.scrollLeft = 0;
97
+      // 滑动swiper后,每个选项距离其父元素最左侧的距离
98
+      for (let i = 0; i < newval - 1; i++) {
99
+        this.scrollLeft += this.category[i].width;
100
+      }
101
+    }
102
+  },
103
+  data() {
104
+    return {
105
+      isActive: 0,
106
+      index: 0,
107
+      currentindex: 0,
108
+
109
+      contentScrollW: 0, // 导航区宽度
110
+      scrollLeft: 0, // 横向滚动条位置
111
+      fullHeight: ""
112
+    };
113
+  },
114
+  mounted() {
115
+    var that = this;
116
+    this.isActive = this.curruntActive;
117
+    //获取手机屏幕的高度,让其等于swiper的高度,从而使屏幕充满
118
+    uni.getSystemInfo({
119
+      success: function (res) {
120
+        that.fullHeight = "height:" + res.windowHeight + "px";
121
+      }
122
+    });
123
+    // 获取标题区域宽度,和每个子元素节点的宽度
124
+    this.getScrollW();
125
+  },
126
+  methods: {
127
+    // 获取标题区域宽度,和每个子元素节点的宽度以及元素距离左边栏的距离
128
+    getScrollW() {
129
+      const query = uni.createSelectorQuery().in(this);
130
+      query
131
+        .select(".tab-scroll")
132
+        .boundingClientRect((data) => {
133
+          this.contentScrollW = data.width;
134
+        })
135
+        .exec();
136
+      query
137
+        .selectAll(".tab-scroll_item")
138
+        .boundingClientRect((data) => {
139
+          let dataLen = data.length;
140
+          for (let i = 0; i < dataLen; i++) {
141
+            this.category[i].left = data[i].left;
142
+            this.category[i].width = data[i].width;
143
+          }
144
+        })
145
+        .exec();
146
+    },
147
+    // 当前点击子元素靠左留一个选项展示,子元素宽度不相同也可实现
148
+    chenked(index, item) {
149
+      this.isActive = index;
150
+      this.scrollLeft = 0;
151
+      for (let i = 0; i < index - 1; i++) {
152
+        this.scrollLeft += this.category[i].width;
153
+      }
154
+      this.$emit("tabs", { index, item });
155
+    },
156
+    // swiper滑动时,获取其索引,也就是第几个
157
+    change(e) {
158
+      const { current } = e.detail;
159
+      this.currentindex = current;
160
+    }
161
+  }
162
+};
163
+</script>
164
+<style lang="scss">
165
+.content {
166
+  display: flex;
167
+  flex-direction: column;
168
+  width: 100%;
169
+  flex: 1;
170
+  .nav {
171
+    background-color: #fff;
172
+    // position: fixed;
173
+    z-index: 99;
174
+    width: 100%;
175
+    align-items: center;
176
+    // min-height: 40rpx;
177
+    .tab-scroll {
178
+      flex: 1;
179
+      overflow: hidden;
180
+      box-sizing: border-box;
181
+      padding-left: 30rpx;
182
+      padding-right: 30rpx;
183
+      .tab-scroll_box {
184
+        display: flex;
185
+        align-items: center;
186
+        flex-wrap: nowrap;
187
+        box-sizing: border-box;
188
+        height: 100rpx;
189
+        .tab-scroll_item {
190
+          line-height: 80rpx;
191
+          margin-right: 35rpx;
192
+          flex-shrink: 0;
193
+          display: flex;
194
+          justify-content: center;
195
+          font-size: 30rpx;
196
+          padding-top: 10rpx;
197
+          color: #333;
198
+          .tile-box {
199
+            display: flex;
200
+            align-items: center;
201
+            flex-direction: column;
202
+            .count {
203
+              height: initial;
204
+            }
205
+          }
206
+        }
207
+      }
208
+    }
209
+  }
210
+  .swiper-content {
211
+    padding-top: 120rpx;
212
+    // flex: 1;
213
+    .swiperitem-content {
214
+      background-color: #ffffff;
215
+      .nav_item {
216
+        background-color: #ffffff;
217
+        padding: 20rpx 40rpx 0rpx 40rpx;
218
+      }
219
+    }
220
+  }
221
+}
222
+.active {
223
+  position: relative;
224
+  color: #1f7cff !important;
225
+  font-weight: 600;
226
+}
227
+.active::after {
228
+  content: "";
229
+  position: absolute;
230
+  width: 50rpx;
231
+  height: 8rpx;
232
+  background-color: #1f7cff;
233
+  left: 0px;
234
+  right: 0px;
235
+  bottom: 0px;
236
+  margin: auto;
237
+  border-radius: 8rpx;
238
+  margin-top: 10rpx;
239
+  transition: all 0.3s;
240
+}
241
+/* 隐藏滚动条,但依旧具备可以滚动的功能 */
242
+/deep/.uni-scroll-view::-webkit-scrollbar {
243
+  display: none;
244
+}
245
+</style>

+ 114 - 24
shop/productManagementModule/productManagement.vue

@@ -1,31 +1,121 @@
1 1
 <template>
2
-	<view>
3
-		<headersVue headerTitle="商品管理" @headerJump="headerJump"></headersVue>
4
-	</view>
2
+  <view class="product-manger-wrapper">
3
+    <headersVue headerTitle="商品管理" @headerJump="headerJump"></headersVue>
4
+    <view class="product-manger-content">
5
+      <view class="product-manger-content--top">
6
+        <searchVue @search="search" class="search-box"></searchVue>
7
+        <view class="btn-product" @click="onHandleAddProduct">
8
+          <image
9
+            src="/static/images/new_ui/tianjiachanping.png"
10
+            mode="scaleToFill"
11
+          />
12
+          <view class="txt">添加商品</view>
13
+        </view>
14
+      </view>
15
+      <view class="product-manger-content--tab">
16
+        <tabsVue :category="dataList"  />
17
+      </view>
18
+    </view>
19
+  </view>
5 20
 </template>
6 21
 
7 22
 <script>
8
-import headersVue from '../components/headers/headers.vue';
23
+import headersVue from "../components/headers/headers.vue";
24
+import searchVue from "./components/search/search.vue";
25
+import tabsVue from "./components/tablist.vue";
26
+//商品列表
27
+export default {
28
+  components: {
29
+    headersVue,
30
+    searchVue,
31
+	tabsVue
32
+  },
33
+  methods: {
34
+    headerJump() {
35
+      console.log("点击了返回");
36
+      uni.switchTab({ url: "/pages/my/index" });
37
+    },
38
+    onHandleAddProduct() {}
39
+  },
40
+  data() {
41
+    return {
42
+      dataList: [
43
+        {
44
+          type: 1,
45
+          name: "出售中商品",
46
+          count: 10
47
+        },
48
+        {
49
+          type: 2,
50
+          name: "仓库中商品",
51
+          count: 31
52
+        },
53
+        {
54
+          type: 3,
55
+          name: "已售罄商品",
56
+          count: 0
57
+        },
58
+        {
59
+          type: 4,
60
+          name: "警戒库存",
61
+          count: 0
62
+        },
63
+        {
64
+          type: 5,
65
+          name: "回收站商品",
66
+          count: 0
67
+        },
68
+        {
69
+          type: 6,
70
+          name: "待审核商品",
71
+          count: 0
72
+        },
73
+        {
74
+          type: 7,
75
+          name: "审核未通过商品",
76
+          count: 0
77
+        }
78
+      ],
9 79
 
10
-	//商品列表
11
-	export default {
12
-		components: {
13
-			headersVue
14
-		},
15
-		methods: {
16
-			headerJump(){
17
-				console.log('点击了返回')
18
-				 uni.switchTab ({ url: '/pages/my/index' })
19
-			}
20
-		},
21
-		data() {
22
-			return {
23
-				
24
-			};
25
-		}
26
-	}
80
+    };
81
+  }
82
+};
27 83
 </script>
28
-
29
-<style lang="scss">
30
-
84
+<style>
85
+page {
86
+  background-color: #f7f8fc;
87
+}
88
+</style>
89
+<style lang="scss" scoped>
90
+.product-manger-wrapper {
91
+  margin-top: 96rpx;
92
+  border: 2rpx solid #f00;
93
+  background: #fff;
94
+  .product-manger-content {
95
+    &--top {
96
+      display: flex;
97
+      .search-box {
98
+        flex: 1;
99
+      }
100
+      .btn-product {
101
+        user-select: none;
102
+        width: 160rpx;
103
+        flex-shrink: 0;
104
+        display: flex;
105
+        align-items: center;
106
+        gap: 15rpx;
107
+        image {
108
+          width: 32rpx;
109
+          height: 32rpx;
110
+        }
111
+        .txt {
112
+          font-weight: 400;
113
+          font-size: 26rpx;
114
+          color: #666666;
115
+          word-break: break-all;
116
+        }
117
+      }
118
+    }
119
+  }
120
+}
31 121
 </style>