mao-mobile 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,142 @@
1
+ <!--
2
+ * @Description:
3
+ * @Author: wangzy
4
+ * @Date: 2023-07-27 15:25:34
5
+ * @LastEditTime: 2023-12-06 10:02:42
6
+ * @LastEditors: wangzy
7
+ -->
8
+
9
+ ### 属性
10
+
11
+ | 属性 | 类型 | 默认值 | 描述 |
12
+ | ------------ | ------- | ------------------ | ---------------- |
13
+ | list | Array | []:参考 goodsInfo | 传入的列表数据 |
14
+ | goodsStyle | Object | -- | 卡片自定义样式 |
15
+ | priceInfo | Object | -- | 价格相关信息 |
16
+ | goodsInfo | Object | -- | 卡片相关信息 |
17
+ | scrollY | Boolean | -- | 是否开启上拉加载 |
18
+ | scrollHeight | String | -- | 滚动高度 |
19
+
20
+ ### goodsStyle
21
+
22
+ | 属性 | 类型 | 默认值 | 描述 |
23
+ | ---------------------- | ------ | --------------- | ------------ |
24
+ | borderRadius | String | 16rpx | 卡片圆角 |
25
+ | rowGap | String | 24rpx | 行间距 |
26
+ | columnGap | String | 24rpx | 列间距 |
27
+ | firstTitle(参考 title) | Object | 参考 firstTitle | 一级标题信息 |
28
+ | secTitle(参考 title) | Object | 参考 secTitle | 二级标题信息 |
29
+ | secTitle(参考 title) | Object | 参考 secTitle | 二级标题信息 |
30
+
31
+ ### firtTitle
32
+
33
+ | 属性 | 类型 | 默认值 | 描述 |
34
+ | ---------- | ------ | ------------------------ | -------- |
35
+ | fontSize | String | 14rpx | 标题字号 |
36
+ | fontFamily | String | PingFang SC, PingFang SC | 标题字体 |
37
+ | color | String | #333 | 标题颜色 |
38
+
39
+ ### secTitle
40
+
41
+ | 属性 | 类型 | 默认值 | 描述 |
42
+ | ---------- | ------ | ------------------------ | -------- |
43
+ | fontSize | String | 11rpx | 标题字号 |
44
+ | fontFamily | String | PingFang SC, PingFang SC | 标题字体 |
45
+ | color | String | #666 | 标题颜色 |
46
+
47
+ ### priceInfo
48
+
49
+ | 属性 | 类型 | 默认值 | 描述 |
50
+ | ---- | ------ | ------ | ------------ |
51
+ | unit | String | ¥ | 价格头部单位 |
52
+ | des | String | 起 | 价格尾部文案 |
53
+
54
+ ### goodsInfo
55
+
56
+ | 属性 | 类型 | 默认值 | 描述 |
57
+ | ---------- | ------ | ------ | ------------ |
58
+ | picUrl | String | -- | 商品图片地址 |
59
+ | goodsName | String | -- | 商品名称 |
60
+ | goodsDes | String | -- | 商品描述 |
61
+ | showPrice | Number | -- | 显示价 |
62
+ | countPrice | Number | -- | 划线价 |
63
+
64
+ ### 示例
65
+
66
+ ```javascript
67
+ <template>
68
+ <view class="content">
69
+ <ProGoodsList
70
+ :list="list"
71
+ :scrollY="true"
72
+ :scrollHeight="scrollHeight"
73
+ @scroll="handleScroll"
74
+ @itemClick="handleItemClick"
75
+ ></ProGoodsList>
76
+ </view>
77
+ </template>
78
+
79
+ <script setup>
80
+ import { ref } from "vue";
81
+ import { ProGoodsList } from "@/packages/ProGoodsList/index.vue";
82
+ import { onReachBottom, onPullDownRefresh } from "@dcloudio/uni-app";
83
+
84
+ const list = ref([
85
+ {
86
+ picUrl: "https://calypso-public.oss-cn-hangzhou.aliyuncs.com/prod2lwqghp5hc59l0bav8vu.png",
87
+ goodsName: "瑞幸咖啡瑞幸咖啡瑞幸咖啡瑞幸咖啡瑞幸咖啡瑞幸咖啡瑞幸咖啡",
88
+ goodsDes: "手工现磨,来自法国大师佳作大师佳作大师佳作",
89
+ countPrice: "999",
90
+ showPrice: "1999",
91
+ },
92
+ {
93
+ picUrl: "https://calypso-public.oss-cn-hangzhou.aliyuncs.com/prod2lwqghp5hc59l0bav8vu.png",
94
+ goodsName: "瑞幸咖啡瑞幸咖啡瑞幸咖啡瑞幸咖啡瑞幸咖啡瑞幸咖啡瑞幸咖啡",
95
+ goodsDes: "手工现磨,来自法国大师佳作大师佳作大师佳作",
96
+ countPrice: "999",
97
+ showPrice: "1999",
98
+ },
99
+ {
100
+ picUrl: "https://calypso-public.oss-cn-hangzhou.aliyuncs.com/prod2lwqghp5hc59l0bav8vu.png",
101
+ goodsName: "瑞幸咖啡瑞幸咖啡瑞幸咖啡瑞幸咖啡瑞幸咖啡瑞幸咖啡瑞幸咖啡",
102
+ goodsDes: "手工现磨,来自法国大师佳作大师佳作大师佳作",
103
+ countPrice: "999",
104
+ showPrice: "1999",
105
+ },
106
+ {
107
+ picUrl: "https://calypso-public.oss-cn-hangzhou.aliyuncs.com/prod2lwqghp5hc59l0bav8vu.png",
108
+ goodsName: "瑞幸咖啡瑞幸咖啡瑞幸咖啡瑞幸咖啡瑞幸咖啡瑞幸咖啡瑞幸咖啡",
109
+ goodsDes: "手工现磨,来自法国大师佳作大师佳作大师佳作",
110
+ countPrice: "999",
111
+ showPrice: "1999",
112
+ },
113
+ {
114
+ picUrl: "https://calypso-public.oss-cn-hangzhou.aliyuncs.com/prod2lwqghp5hc59l0bav8vu.png",
115
+ goodsName: "瑞幸咖啡瑞幸咖啡瑞幸咖啡瑞幸咖啡瑞幸咖啡瑞幸咖啡瑞幸咖啡",
116
+ goodsDes: "手工现磨,来自法国大师佳作大师佳作大师佳作",
117
+ countPrice: "999",
118
+ showPrice: "1999",
119
+ },
120
+ ]);
121
+ const scrollHeight = "100%";
122
+ const handleScroll = () => {
123
+ console.log("请求分页");
124
+ };
125
+ const handleItemClick = () => {
126
+ console.log("点击");
127
+ };
128
+ </script>
129
+ <style lang="scss">
130
+ .content {
131
+ display: flex;
132
+ flex-direction: column;
133
+ align-items: center;
134
+ justify-content: center;
135
+ background: #ddd;
136
+ padding: 24rpx;
137
+ height: 100vh;
138
+ }
139
+ </style>
140
+
141
+
142
+ ```
@@ -0,0 +1,278 @@
1
+ <!--
2
+ * @Descripttion:
3
+ * @Author: lixingyun
4
+ * @Date: 2023-10-25 14:27:43
5
+ * @LastEditors: wangzy
6
+ * @LastEditTime: 2023-12-13 16:53:49
7
+ -->
8
+ <template>
9
+ <view class="goods">
10
+ <view v-if="list.length > 0" class="scroll-wrapper">
11
+ <scroll-view
12
+ :scroll-top="scrollTop"
13
+ :scroll-y="scrollY"
14
+ :class="scrollY && 'scroll-Y'"
15
+ @scrolltolower="onScrolltolower"
16
+ >
17
+ <view class="goods-card-wrapper">
18
+ <view
19
+ v-for="(item, index) in list"
20
+ :key="index"
21
+ @click.stop="itemClick(item)"
22
+ class="card-item"
23
+ >
24
+ <view class="pro-good-card">
25
+ <view class="img-wrapper-A" :class="cardType === 'B' && 'img-wrapper-B'">
26
+ <image class="pro-good-img" mode="widthFix" :src="item.picUrl" alt="" />
27
+ </view>
28
+ <view class="pro-good-info">
29
+ <view class="first-title">
30
+ {{ item.name }}
31
+ </view>
32
+ <view
33
+ v-if="item.goodsDes"
34
+ class="sec-title-A"
35
+ :class="cardType === 'B' && 'sec-title-A'"
36
+ >
37
+ {{ item.goodsDes }}
38
+ </view>
39
+ <view class="pro-good-price-A" :class="cardType === 'B' && 'pro-good-price-B'">
40
+ <view>
41
+ <text v-if="priceInfo.unit" class="price-unit">{{ priceInfo.unit }}</text>
42
+ <text class="retail-price">
43
+ {{ item.retailPrice }}
44
+ </text>
45
+ <text v-if="priceInfo.des" class="price-des">{{ priceInfo.des }}</text>
46
+ </view>
47
+ <view v-if="item.counterPrice" class="counter-price">
48
+ ¥{{ item.counterPrice }}
49
+ </view>
50
+ </view>
51
+ </view>
52
+ </view>
53
+ </view>
54
+ </view>
55
+ </scroll-view>
56
+ </view>
57
+ <view v-else>
58
+ <image
59
+ class="empty-img"
60
+ src="https://static.wxb.com.cn/frontEnd/images/benz-mp/goods-empty.png"
61
+ ></image>
62
+ <view class="empty-text">暂无商品</view>
63
+ </view>
64
+ </view>
65
+ </template>
66
+ <script setup>
67
+ import { ref, computed } from "vue";
68
+ const props = defineProps({
69
+ // 列表数据
70
+ list: {
71
+ type: Array,
72
+ required: true,
73
+ default: () => [],
74
+ },
75
+ // 卡片类型:A/B
76
+ cardType: {
77
+ type: String,
78
+ default: "A",
79
+ },
80
+ // 卡片样式
81
+ goodsStyle: {
82
+ type: Object,
83
+ default: () => {
84
+ return {};
85
+ },
86
+ },
87
+ // 价格相关的信息
88
+ priceInfo: {
89
+ type: Object,
90
+ default: () => {
91
+ return {
92
+ unit: "¥",
93
+ des: "起",
94
+ };
95
+ },
96
+ },
97
+ // 是否开启上拉加载
98
+ scrollY: {
99
+ type: Boolean,
100
+ default: false,
101
+ },
102
+ // 滚动高度
103
+ scrollHeight: {
104
+ type: Number,
105
+ default: 0,
106
+ },
107
+ });
108
+ const scrollHeight = props.scrollHeight;
109
+ const _goodsStyle = computed(() => {
110
+ const options = {
111
+ borderRadius: "16rpx", // 卡片圆角
112
+ bgColor: props.cardType === "A" ? "#fff" : "rgba(255, 255, 255, 0.74)", // 卡片背景颜色
113
+ //一级标题样式
114
+ firstTitle: {
115
+ fontSize: "28rpx",
116
+ color: "#333",
117
+ fontFamily: "PingFang SC, sans-serif",
118
+ },
119
+ //二级标题样式
120
+ secondTitle: {
121
+ fontSize: "22rpx",
122
+ color: "#666",
123
+ fontFamily: "PingFang SC, sans-serif",
124
+ },
125
+ priceColor: "#FF4D3B", // 价格字体颜色
126
+ columnGap: "24rpx", // 列间距
127
+ rowGap: "24rpx", // 行间距
128
+ };
129
+ return Object.assign(options, props.goodsStyle);
130
+ });
131
+ // 卡片圆角
132
+ const borderRadius = _goodsStyle.value.borderRadius;
133
+ // 一级标题样式
134
+ const { fontSize: ffs, color: fc, fontFamily: ffm } = _goodsStyle.value.firstTitle;
135
+ // 二级标题样式
136
+ const { fontSize: sfs, color: sc, fontFamily: sfm } = _goodsStyle.value.secondTitle;
137
+ // 价格颜色
138
+ const priceColor = _goodsStyle.value.priceColor;
139
+ // 卡片背景色
140
+ const bgColor = _goodsStyle.value.bgColor;
141
+ // 列间距
142
+ const columnGap = _goodsStyle.value.columnGap;
143
+ // 行间距
144
+ const rowGap = _goodsStyle.value.rowGap;
145
+
146
+ // 点击事件
147
+ const emits = defineEmits(["itemClick", "scroll"]);
148
+ const itemClick = (item) => {
149
+ emits("itemClick", item.id);
150
+ };
151
+
152
+ const onScrolltolower = () => {
153
+ console.log("上拉加载");
154
+ emits("scroll");
155
+ };
156
+ </script>
157
+ <style scoped lang="scss">
158
+ // 用于数字的特殊字体
159
+ @font-face {
160
+ font-family: "TCloudNumberRegular";
161
+ src: url("./fonts/TCloudNumber-Regular.ttf") format("truetype"),
162
+ url("./fonts/TCloudNumber-Regular.ttf") format("woff2");
163
+ }
164
+ .goods {
165
+ text-align: center;
166
+ height: v-bind(scrollHeight);
167
+ .scroll-wrapper {
168
+ height: 100%;
169
+ .scroll-Y {
170
+ height: 100%;
171
+ }
172
+ .goods-card-wrapper {
173
+ column-gap: v-bind(columnGap);
174
+ column-count: 2;
175
+ .card-item {
176
+ margin-bottom: 24rpx;
177
+ break-inside: avoid; //避免子元素内容被截取
178
+ .pro-good-card {
179
+ width: 100%;
180
+ background: v-bind(bgColor);
181
+ border-radius: v-bind(borderRadius);
182
+ overflow: hidden;
183
+ .img-wrapper-A {
184
+ padding: 12rpx 12rpx 0 12rpx;
185
+ .pro-good-img {
186
+ display: block;
187
+ width: 100%;
188
+ border-radius: 12rpx;
189
+ }
190
+ }
191
+ .img-wrapper-B {
192
+ padding: 0;
193
+ .pro-good-img {
194
+ display: block;
195
+ width: 100%;
196
+ border-radius: 0;
197
+ }
198
+ }
199
+
200
+ .pro-good-info {
201
+ padding: 0rpx 20rpx 28rpx 20rpx;
202
+ }
203
+ .first-title {
204
+ font-size: v-bind(ffs);
205
+ color: v-bind(fc);
206
+ font-family: v-bind(ffm);
207
+ font-weight: 500;
208
+ line-height: 36rpx;
209
+ overflow: hidden;
210
+ text-overflow: ellipsis;
211
+ display: -webkit-box;
212
+ -webkit-box-orient: vertical;
213
+ -webkit-line-clamp: 2;
214
+ margin-top: 20rpx;
215
+ text-align: left;
216
+ }
217
+ .first-title-B {
218
+ margin-top: 10rpx;
219
+ }
220
+ .sec-title-A {
221
+ font-size: v-bind(sfs);
222
+ color: v-bind(sc);
223
+ font-family: v-bind(sfm);
224
+ line-height: 32rpx;
225
+ margin-top: 8rpx;
226
+ overflow: hidden;
227
+ text-overflow: ellipsis;
228
+ display: -webkit-box;
229
+ -webkit-box-orient: vertical;
230
+ -webkit-line-clamp: 1;
231
+ text-align: left;
232
+ }
233
+ .sec-title-B {
234
+ margin-top: 4rpx;
235
+ }
236
+ .pro-good-price-A {
237
+ display: flex;
238
+ align-items: baseline;
239
+ margin-top: 24rpx;
240
+ .price-unit {
241
+ font-size: 20rpx;
242
+ font-family: "TCloudNumberRegular";
243
+ font-weight: 400;
244
+ color: v-bind(priceColor);
245
+ line-height: 24rpx;
246
+ }
247
+ .price-des {
248
+ font-size: 20rpx;
249
+ font-family: PingFang SC, sans-serif;
250
+ font-weight: 500;
251
+ color: v-bind(priceColor);
252
+ line-height: 28rpx;
253
+ margin-left: 4rpx;
254
+ }
255
+ .retail-price {
256
+ font-size: 40rpx;
257
+ color: v-bind(priceColor);
258
+ line-height: 44rpx;
259
+ font-family: "TCloudNumberRegular";
260
+ vertical-align: middle;
261
+ }
262
+ .counter-price {
263
+ font-size: 24rpx;
264
+ text-decoration: line-through;
265
+ margin-left: 12rpx;
266
+ color: #cecece;
267
+ font-family: "TCloudNumberRegular";
268
+ }
269
+ }
270
+ .pro-good-price-B {
271
+ margin-top: 20rpx;
272
+ }
273
+ }
274
+ }
275
+ }
276
+ }
277
+ }
278
+ </style>
@@ -0,0 +1,77 @@
1
+ <!--
2
+ * @Description:
3
+ * @Author: wangzy
4
+ * @Date: 2023-07-27 15:25:34
5
+ * @LastEditTime: 2023-11-29 17:52:45
6
+ * @LastEditors: wangzy
7
+ -->
8
+
9
+ ### 属性
10
+
11
+ | 属性 | 类型 | 默认值 | 描述 |
12
+ | ---------- | ------ | ------ | ------------ |
13
+ | cardHeight | String | 180rpx | 卡片高度 |
14
+ | orderInfo | Object | -- | 订单卡片信息 |
15
+
16
+ ### orderInfo
17
+
18
+ | 属性 | 类型 | 默认值 | 描述 |
19
+ | ---- | ---- | ------ | ---- |
20
+
21
+ | title | String | -- | 标题 |
22
+ | skuName | String | -- | sku 名称 |
23
+ | price | Number | -- | 价格 |
24
+ | number | Number | -- | 数量 |
25
+
26
+ ### 示例
27
+
28
+ ```javascript
29
+ <template>
30
+ <view class="content">
31
+ <ProOrderCard :orderInfo="orderInfo">
32
+ <template v-slot:tag>
33
+ <view class="tag">绿色环保</view>
34
+ </template>
35
+ <template v-slot:btn>
36
+ <view class="btn">购买</view>
37
+ </template>
38
+ </ProOrderCard>
39
+ </view>
40
+ </template>
41
+
42
+ <script setup>
43
+ import { ref } from "vue";
44
+ import { ProOrderCard } from "@/packages/ProOrderCard/index.vue";
45
+ import { onReachBottom, onPullDownRefresh } from "@dcloudio/uni-app";
46
+ const orderInfo = ref({
47
+ goodsName: "小青菜",
48
+ goodsSpecifications: "蔬菜/叶子菜",
49
+ price: 8.88,
50
+ number: 2,
51
+ });
52
+ </script>
53
+
54
+ <style lang="scss">
55
+ .content {
56
+ display: flex;
57
+ flex-direction: column;
58
+ align-items: center;
59
+ justify-content: center;
60
+ background: #ddd;
61
+ padding: 24rpx;
62
+ .tag {
63
+ color: green;
64
+ }
65
+ .btn {
66
+ width: 112rpx;
67
+ height: 56rpx;
68
+ opacity: 1;
69
+ border: 2rpx solid #dddddd;
70
+ text-align: center;
71
+ line-height: 56rpx;
72
+ border-radius: 20rpx;
73
+ color: #999;
74
+ }
75
+ }
76
+ </style>
77
+ ```
@@ -0,0 +1,165 @@
1
+ <!--
2
+ * @Description:
3
+ * @Author: wangzy
4
+ * @Date: 2023-11-29 15:34:29
5
+ * @LastEditTime: 2023-12-18 14:26:18
6
+ * @LastEditors: wangzy
7
+ -->
8
+ <template>
9
+ <view class="card">
10
+ <view class="card-left">
11
+ <image mode="heightFix" :src="orderInfo.goodsPic" class="goods-img"></image>
12
+ <view>
13
+ <view class="goods-name">{{ orderInfo.goodsName }}</view>
14
+ <view class="goods-sku">{{ orderInfo.goodsSpecifications }}</view>
15
+ <view class="slot-wrapper">
16
+ <slot name="tag"></slot>
17
+ </view>
18
+ </view>
19
+ </view>
20
+ <view class="card-right">
21
+ <view>
22
+ <view>
23
+ <text class="price-unit">¥</text>
24
+ <text class="price-number">{{ intPrice }}</text>
25
+ <text class="price-decimal">{{ decimalPrice }}</text>
26
+ </view>
27
+ <view class="number-wrapper">
28
+ <text class="goods-X">×</text>
29
+ <text class="goods-number">{{ orderInfo.goodsNumber }}</text>
30
+ </view>
31
+ </view>
32
+ <slot name="btn"></slot>
33
+ </view>
34
+ </view>
35
+ </template>
36
+ <script setup>
37
+ import { ref } from "vue";
38
+ const props = defineProps({
39
+ // 卡片高度
40
+ cardHeight: {
41
+ type: String,
42
+ default: "180rpx",
43
+ },
44
+
45
+ // 卡片信息
46
+ orderInfo: {
47
+ type: Object,
48
+ required: true,
49
+ },
50
+ });
51
+ const cardHeight = props.cardHeight;
52
+ const intPrice = ref(null);
53
+ const decimalPrice = ref(null);
54
+
55
+ const getDecimalValue = (price) => {
56
+ console.log(price, "priceprice");
57
+ const splitArr = price.toString().split(".");
58
+ intPrice.value = splitArr[0];
59
+ if (splitArr.length === 2) {
60
+ decimalPrice.value = "." + splitArr[1];
61
+ }
62
+ };
63
+ getDecimalValue(props.orderInfo.goodsPrice);
64
+ </script>
65
+ <style lang="scss">
66
+ // 用于数字的特殊字体
67
+ @font-face {
68
+ font-family: "TCloudNumberRegular";
69
+ src: url("./fonts/TCloudNumber-Regular.ttf") format("truetype"),
70
+ url("./fonts/TCloudNumber-Regular.ttf") format("woff2");
71
+ }
72
+ .card {
73
+ height: v-bind(cardHeight);
74
+ display: flex;
75
+ align-items: flex-start;
76
+ justify-content: space-between;
77
+ background: #fff;
78
+ width: 100%;
79
+ .card-left {
80
+ display: flex;
81
+ align-items: flex-start;
82
+ height: 100%;
83
+ .goods-img {
84
+ height: 180rpx;
85
+ width: 180rpx;
86
+ margin-right: 20rpx;
87
+ border-radius: 8rpx 8rpx 8rpx 8rpx;
88
+ }
89
+ .goods-name {
90
+ font-size: 30rpx;
91
+ font-family: PingFang SC, sans-serif;
92
+ font-weight: 500;
93
+ color: #333333;
94
+ line-height: 36rpx;
95
+ text-align: left;
96
+ overflow: hidden;
97
+ text-overflow: ellipsis;
98
+ display: -webkit-box;
99
+ -webkit-box-orient: vertical;
100
+ -webkit-line-clamp: 2;
101
+ }
102
+ .goods-sku {
103
+ font-size: 26rpx;
104
+ font-family: PingFang SC, sans-serif;
105
+ font-weight: 400;
106
+ color: #999999;
107
+ line-height: 32rpx;
108
+ margin-top: 16rpx;
109
+ text-align: left;
110
+ }
111
+ .slot-wrapper {
112
+ margin-top: 16rpx;
113
+ }
114
+ }
115
+ .card-right {
116
+ display: flex;
117
+ flex-direction: column;
118
+ justify-content: space-between;
119
+ align-content: flex-start;
120
+ height: 100%;
121
+ text-align: right;
122
+ .price-unit {
123
+ font-size: 20rpx;
124
+ font-family: "TCloudNumberRegular";
125
+ font-weight: 400;
126
+ color: #333333;
127
+ line-height: 28rpx;
128
+ }
129
+ .price-number {
130
+ font-size: 30rpx;
131
+ font-family: "TCloudNumberRegular";
132
+ font-weight: 400;
133
+ color: #333333;
134
+ line-height: 36rpx;
135
+ margin-left: 4rpx;
136
+ }
137
+ .price-decimal {
138
+ font-size: 24rpx;
139
+ font-family: "TCloudNumberRegular";
140
+ font-weight: 400;
141
+ color: #333333;
142
+ line-height: 28rpx;
143
+ }
144
+ .number-wrapper {
145
+ display: flex;
146
+ align-items: center;
147
+ justify-content: flex-end;
148
+ .goods-X {
149
+ font-size: 24rpx;
150
+ font-weight: 600;
151
+ color: #999999;
152
+ line-height: 32rpx;
153
+ margin-right: 8rpx;
154
+ }
155
+ .goods-number {
156
+ font-size: 26rpx;
157
+ font-family: "TCloudNumberRegular";
158
+ font-weight: 400;
159
+ color: #999999;
160
+ line-height: 32rpx;
161
+ }
162
+ }
163
+ }
164
+ }
165
+ </style>