cb-biz-ui 1.7.1 → 1.7.3
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.
|
@@ -2,21 +2,23 @@
|
|
|
2
2
|
<view class="category-box">
|
|
3
3
|
<view class="left-box">
|
|
4
4
|
<vertical-nav
|
|
5
|
+
:selectedColor="addBtnBgColor"
|
|
5
6
|
:value="navIndex"
|
|
6
7
|
@change="navChange"
|
|
7
8
|
:list="navList"
|
|
8
9
|
:height="height"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
/>
|
|
11
|
+
</view>
|
|
12
|
+
<view class="right-box">
|
|
13
|
+
<scroll-view
|
|
12
14
|
scroll-y
|
|
13
|
-
:style="{ height: height ? `${height}px
|
|
15
|
+
:style="{ height: height ? `${height}px` : '100%' }"
|
|
14
16
|
:show-scrollbar="false"
|
|
15
17
|
:enhanced="true"
|
|
16
18
|
>
|
|
17
19
|
<view class="tools">
|
|
18
|
-
<view class="tools_item" @click="inventoryTypeChange"
|
|
19
|
-
|
|
20
|
+
<view class="tools_item" @click="inventoryTypeChange">
|
|
21
|
+
销量
|
|
20
22
|
<sort-icon
|
|
21
23
|
:scale="0.8"
|
|
22
24
|
:type="inventoryType"
|
|
@@ -24,8 +26,8 @@
|
|
|
24
26
|
borderColor="#6D7278"
|
|
25
27
|
/>
|
|
26
28
|
</view>
|
|
27
|
-
<view class="tools_item" @click="priceTypeChange"
|
|
28
|
-
|
|
29
|
+
<view class="tools_item" @click="priceTypeChange">
|
|
30
|
+
价格
|
|
29
31
|
<sort-icon
|
|
30
32
|
:scale="0.8"
|
|
31
33
|
:type="priceType"
|
|
@@ -38,18 +40,15 @@
|
|
|
38
40
|
<ui-loadmore :index="2" v-if="loading"></ui-loadmore>
|
|
39
41
|
|
|
40
42
|
<view class="goods-box" v-if="goodsList.length && !loading">
|
|
41
|
-
<view
|
|
42
|
-
class="item bottom-1px-border"
|
|
43
|
-
v-for="item in goodsList"
|
|
44
|
-
:key="item.shopSpuId"
|
|
45
|
-
>
|
|
43
|
+
<view class="item bottom-1px-border" v-for="item in goodsList" :key="item.shopSpuId">
|
|
46
44
|
<goods-card
|
|
47
45
|
:goods-count="countData[item.defaultShopSkuId]?.count"
|
|
48
46
|
:addBtnBgColor="addBtnBgColor"
|
|
49
47
|
@handleClick="goDetails"
|
|
50
48
|
@countChange="countChange"
|
|
51
49
|
:entity="item"
|
|
52
|
-
|
|
50
|
+
/>
|
|
51
|
+
</view>
|
|
53
52
|
</view>
|
|
54
53
|
<ui-no-data
|
|
55
54
|
:fixed="false"
|
|
@@ -59,111 +58,108 @@
|
|
|
59
58
|
>
|
|
60
59
|
<text class="tui-color__black">{{ noDataTip }}</text>
|
|
61
60
|
</ui-no-data>
|
|
62
|
-
</scroll-view
|
|
63
|
-
>
|
|
61
|
+
</scroll-view>
|
|
62
|
+
</view>
|
|
64
63
|
</view>
|
|
65
64
|
</template>
|
|
66
65
|
<script setup lang="ts">
|
|
67
|
-
import { computed } from 'vue'
|
|
68
|
-
import verticalNav from '../cb-vertical-nav/cb-vertical-nav.vue'
|
|
69
|
-
import GoodsCard from '../cb-goods-card/cb-goods-card.vue'
|
|
70
|
-
import SortIcon from '../cb-sort-icon/cb-sort-icon.vue'
|
|
71
|
-
import type {
|
|
72
|
-
GoodsDataType,
|
|
73
|
-
cartItemListType,
|
|
74
|
-
changeValueType
|
|
75
|
-
} from '../interface/types';
|
|
66
|
+
import { computed } from 'vue'
|
|
67
|
+
import verticalNav from '../cb-vertical-nav/cb-vertical-nav.vue'
|
|
68
|
+
import GoodsCard from '../cb-goods-card/cb-goods-card.vue'
|
|
69
|
+
import SortIcon from '../cb-sort-icon/cb-sort-icon.vue'
|
|
70
|
+
import type { GoodsDataType, cartItemListType, changeValueType } from '../interface/types'
|
|
76
71
|
|
|
77
72
|
interface IProps {
|
|
78
|
-
navList: { name: string; value: any }[]
|
|
79
|
-
loading: boolean
|
|
80
|
-
height: number
|
|
73
|
+
navList: { name: string; value: any }[]
|
|
74
|
+
loading: boolean
|
|
75
|
+
height: number
|
|
81
76
|
nullData?: {
|
|
82
|
-
url: string
|
|
83
|
-
text: string
|
|
84
|
-
}
|
|
85
|
-
navIndex: number
|
|
86
|
-
goodsList: GoodsDataType[]
|
|
87
|
-
cartItemList?: cartItemListType[]
|
|
88
|
-
inventoryType?: 'desc' | 'asc' | ''
|
|
89
|
-
priceType?: 'desc' | 'asc' | ''
|
|
90
|
-
addBtnBgColor: string
|
|
77
|
+
url: string
|
|
78
|
+
text: string
|
|
79
|
+
}
|
|
80
|
+
navIndex: number
|
|
81
|
+
goodsList: GoodsDataType[]
|
|
82
|
+
cartItemList?: cartItemListType[]
|
|
83
|
+
inventoryType?: 'desc' | 'asc' | ''
|
|
84
|
+
priceType?: 'desc' | 'asc' | ''
|
|
85
|
+
addBtnBgColor: string
|
|
91
86
|
}
|
|
92
87
|
|
|
93
88
|
const props = withDefaults(defineProps<IProps>(), {
|
|
94
89
|
navList: [],
|
|
95
|
-
height:
|
|
90
|
+
height: 0,
|
|
96
91
|
goodsList: [],
|
|
97
92
|
nullData: { url: '', text: '' },
|
|
98
93
|
cartItemList: [],
|
|
99
94
|
loading: false,
|
|
100
|
-
addBtnBgColor: 'rgba(255, 82, 79, 1)'
|
|
101
|
-
})
|
|
95
|
+
addBtnBgColor: 'rgba(255, 82, 79, 1)',
|
|
96
|
+
})
|
|
102
97
|
|
|
103
98
|
const countData = computed<{ [key: number]: any }>(() => {
|
|
104
|
-
const list = props.cartItemList || []
|
|
105
|
-
const data: { [key: number]: any } = {}
|
|
99
|
+
const list = props.cartItemList || []
|
|
100
|
+
const data: { [key: number]: any } = {}
|
|
106
101
|
list.forEach((v) => {
|
|
107
102
|
data[v.skuId] = {
|
|
108
103
|
id: v.id,
|
|
109
104
|
count: v.count,
|
|
110
|
-
skuId: v.skuId
|
|
111
|
-
}
|
|
112
|
-
})
|
|
113
|
-
return data
|
|
114
|
-
})
|
|
105
|
+
skuId: v.skuId,
|
|
106
|
+
}
|
|
107
|
+
})
|
|
108
|
+
return data
|
|
109
|
+
})
|
|
115
110
|
|
|
116
111
|
const emit = defineEmits<{
|
|
117
|
-
(e: 'goDetails', goodsItem: any): void
|
|
118
|
-
(e: 'countChange', val: changeValueType, goodsItem: GoodsDataType): void
|
|
119
|
-
(e: 'navChange', navItem: any): void
|
|
112
|
+
(e: 'goDetails', goodsItem: any): void
|
|
113
|
+
(e: 'countChange', val: changeValueType, goodsItem: GoodsDataType): void
|
|
114
|
+
(e: 'navChange', navItem: any): void
|
|
120
115
|
(
|
|
121
116
|
e: 'storeChange',
|
|
122
117
|
params: {
|
|
123
|
-
sortKey: 'spuSaleCnt' | 'price'
|
|
124
|
-
orderType: 'desc' | 'asc'
|
|
125
|
-
}
|
|
126
|
-
): void
|
|
127
|
-
}>()
|
|
118
|
+
sortKey: 'spuSaleCnt' | 'price'
|
|
119
|
+
orderType: 'desc' | 'asc'
|
|
120
|
+
},
|
|
121
|
+
): void
|
|
122
|
+
}>()
|
|
128
123
|
|
|
129
124
|
const noDataUrl = computed(() => {
|
|
130
125
|
return (
|
|
131
126
|
props.nullData.url ||
|
|
132
127
|
'https://edu-cdn.yunzhuxue.com/edub1429d21xcfds/img/f225d4d3d47140129d6a4dd77988afd6.png'
|
|
133
|
-
)
|
|
134
|
-
})
|
|
128
|
+
)
|
|
129
|
+
})
|
|
135
130
|
const noDataTip = computed(() => {
|
|
136
|
-
return props.nullData.text || '暂无数据~'
|
|
137
|
-
})
|
|
131
|
+
return props.nullData.text || '暂无数据~'
|
|
132
|
+
})
|
|
138
133
|
|
|
139
|
-
const nventoryTypeChange = () => {}
|
|
134
|
+
const nventoryTypeChange = () => {}
|
|
140
135
|
|
|
141
136
|
const priceTypeChange = () => {
|
|
142
|
-
const orderType = props.priceType === 'asc' ? 'desc' : 'asc'
|
|
137
|
+
const orderType = props.priceType === 'asc' ? 'desc' : 'asc'
|
|
143
138
|
emit('storeChange', {
|
|
144
139
|
sortKey: 'price',
|
|
145
|
-
orderType
|
|
146
|
-
})
|
|
147
|
-
}
|
|
140
|
+
orderType,
|
|
141
|
+
})
|
|
142
|
+
}
|
|
148
143
|
const inventoryTypeChange = () => {
|
|
149
|
-
const orderType = props.inventoryType === 'asc' ? 'desc' : 'asc'
|
|
144
|
+
const orderType = props.inventoryType === 'asc' ? 'desc' : 'asc'
|
|
150
145
|
emit('storeChange', {
|
|
151
146
|
sortKey: 'spuSaleCnt',
|
|
152
|
-
orderType
|
|
153
|
-
})
|
|
154
|
-
}
|
|
147
|
+
orderType,
|
|
148
|
+
})
|
|
149
|
+
}
|
|
155
150
|
|
|
156
151
|
const goDetails = (goodsItem: GoodsDataType) => {
|
|
157
|
-
emit('goDetails', goodsItem)
|
|
158
|
-
}
|
|
152
|
+
emit('goDetails', goodsItem)
|
|
153
|
+
}
|
|
159
154
|
|
|
160
155
|
const countChange = (val: changeValueType, goodsItem: GoodsDataType) => {
|
|
161
|
-
emit('countChange', val, goodsItem)
|
|
162
|
-
}
|
|
156
|
+
emit('countChange', val, goodsItem)
|
|
157
|
+
}
|
|
163
158
|
const navChange = (navItem: { name: string; value: any }) => {
|
|
164
|
-
emit('navChange', navItem)
|
|
165
|
-
}
|
|
159
|
+
emit('navChange', navItem)
|
|
160
|
+
}
|
|
166
161
|
</script>
|
|
167
162
|
<style scoped lang="scss">
|
|
168
163
|
@import '../../libs/css/category.scss';
|
|
169
164
|
</style>
|
|
165
|
+
|