cb-biz-ui 1.1.4

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.
Files changed (76) hide show
  1. package/README.md +44 -0
  2. package/components/cb-address-list/cb-address-list.vue +133 -0
  3. package/components/cb-cart-bar/cb-cart-bar.vue +52 -0
  4. package/components/cb-cart-bar-button/cb-cart-bar-button.vue +36 -0
  5. package/components/cb-cart-bar-icon/cb-cart-bar-icon.vue +48 -0
  6. package/components/cb-category/cb-category.vue +163 -0
  7. package/components/cb-delivery-address/cb-delivery-address.vue +48 -0
  8. package/components/cb-discount-coupon/cb-discount-coupon.vue +124 -0
  9. package/components/cb-discount-coupon/interface.d.ts +32 -0
  10. package/components/cb-discount-coupon/utils.ts +23 -0
  11. package/components/cb-drag-list/cb-drag-list.vue +868 -0
  12. package/components/cb-drag-list/drag.wxs +366 -0
  13. package/components/cb-form-classify/cb-form-classify.vue +208 -0
  14. package/components/cb-form-select/cb-form-select.vue +250 -0
  15. package/components/cb-goods-card/cb-goods-card.vue +251 -0
  16. package/components/cb-goods-sku/cb-goods-sku.vue +270 -0
  17. package/components/cb-header/cb-header.vue +113 -0
  18. package/components/cb-inventory/cb-inventory.vue +161 -0
  19. package/components/cb-manage-goods-item/cb-manage-goods-item.vue +95 -0
  20. package/components/cb-money-input/cb-money-input.vue +90 -0
  21. package/components/cb-offline-stores-coupon/cb-offline-stores-coupon.vue +96 -0
  22. package/components/cb-offline-stores-coupon/interface.d.ts +29 -0
  23. package/components/cb-offline-stores-coupon/utils.ts +10 -0
  24. package/components/cb-order-card/cb-order-card.vue +187 -0
  25. package/components/cb-order-goods/cb-order-goods.vue +64 -0
  26. package/components/cb-order-info/cb-order-info.vue +112 -0
  27. package/components/cb-order-remark/cb-order-remark.vue +121 -0
  28. package/components/cb-shipping-coupon/cb-shipping-coupon.vue +112 -0
  29. package/components/cb-shipping-coupon/interface.d.ts +32 -0
  30. package/components/cb-shipping-coupon/utils.ts +23 -0
  31. package/components/cb-shopping-cart/cb-shopping-cart.vue +230 -0
  32. package/components/cb-shopping-cart-tabbar/cb-shopping-cart-tabbar.vue +147 -0
  33. package/components/cb-sort-icon/cb-sort-icon.vue +70 -0
  34. package/components/cb-store-location/cb-store-location.vue +85 -0
  35. package/components/cb-unit-select/cb-unit-select.vue +161 -0
  36. package/components/cb-vertical-nav/cb-vertical-nav.vue +102 -0
  37. package/components/interface/types.d.ts +246 -0
  38. package/index.js +39 -0
  39. package/index.scss +23 -0
  40. package/libs/config/index.js +20 -0
  41. package/libs/css/address-list.scss +143 -0
  42. package/libs/css/cart-bar-icon.scss +34 -0
  43. package/libs/css/category.scss +83 -0
  44. package/libs/css/common.scss +0 -0
  45. package/libs/css/delivery-address.scss +46 -0
  46. package/libs/css/discount-coupon.scss +237 -0
  47. package/libs/css/form-classify.scss +98 -0
  48. package/libs/css/form-select.scss +98 -0
  49. package/libs/css/global/color.scss +156 -0
  50. package/libs/css/global/common.scss +0 -0
  51. package/libs/css/global/style.h5.scss +8 -0
  52. package/libs/css/global/style.mp.scss +0 -0
  53. package/libs/css/global/style.nvue.scss +3 -0
  54. package/libs/css/global/style.vue.scss +0 -0
  55. package/libs/css/goods-card.scss +154 -0
  56. package/libs/css/inventory.scss +74 -0
  57. package/libs/css/manage-goods-item.scss +76 -0
  58. package/libs/css/offline-stores-coupon.scss +133 -0
  59. package/libs/css/order-goods.scss +63 -0
  60. package/libs/css/order-info.scss +89 -0
  61. package/libs/css/order-remark.scss +68 -0
  62. package/libs/css/shipping-coupon.scss +151 -0
  63. package/libs/css/shopping-cart.scss +50 -0
  64. package/libs/css/sort-icon.scss +34 -0
  65. package/libs/css/store-location.scss +66 -0
  66. package/libs/css/theme.json +10 -0
  67. package/libs/css/unit-select.scss +62 -0
  68. package/libs/css/vertical-nav.scss +27 -0
  69. package/libs/utils/deep-clone.js +36 -0
  70. package/libs/utils/deep-merge.js +37 -0
  71. package/libs/utils/guid.js +42 -0
  72. package/libs/utils/index.js +6 -0
  73. package/libs/utils/time-format.js +54 -0
  74. package/libs/utils/validate.js +238 -0
  75. package/package.json +24 -0
  76. package/theme.scss +39 -0
package/README.md ADDED
@@ -0,0 +1,44 @@
1
+ ## 安装
2
+
3
+ ```bash
4
+ # npm方式安装
5
+ npm i cb-biz-ui
6
+ ```
7
+
8
+ ## 快速上手
9
+
10
+ 1. `main.js`引入uView库
11
+
12
+ ```js
13
+ // main.js
14
+ import CbBizUi from 'cb-biz-ui';
15
+ Vue.use(CbBizUi);
16
+ ```
17
+
18
+ 2. `App.vue`引入基础样式(注意style标签需声明scss属性支持)
19
+
20
+ ```css
21
+ /* App.vue */
22
+ <style lang="scss">
23
+ @import "cb-biz-ui/index.scss";
24
+ </style>
25
+ ```
26
+
27
+ 3. `uni.scss`引入全局scss变量文件
28
+ ```css
29
+ /* uni.scss */
30
+ @import "cb-biz-ui/theme.scss";
31
+ ```
32
+
33
+ 4. `pages.json`配置easycom规则(按需引入)
34
+
35
+ ```js
36
+ // pages.json
37
+ {
38
+ "easycom": {
39
+ // npm安装的方式不需要前面的"@/",下载安装的方式需要"@/"
40
+ // npm安装方式
41
+ "^cb-(.*)": "cb-biz-ui/components/cb-$1/cb-$1.vue"
42
+ }
43
+ }
44
+ ```
@@ -0,0 +1,133 @@
1
+ <template>
2
+ <view class="address">
3
+ <view v-for="(item, index) in addressList" :key="index" class="addressList">
4
+ <ui-slide-view
5
+ :buttons="buttons"
6
+ width="65rpx"
7
+ height="230rpx"
8
+ radius="16rpx"
9
+ padding="0rpx"
10
+ margin="0 0 0 29rpx"
11
+ minWidth="0rpx"
12
+ @click="handleClick(item.id)"
13
+ >
14
+ <view class="ui-list-cell" @click="select(item.id)">
15
+ <view class="top">
16
+ <view class="message">
17
+ <view v-if="item.isDefault == 1" class="default">默认</view>
18
+ <view class="notes">{{ item.addressTagName }}</view>
19
+ </view>
20
+ <view
21
+ :class="item.chosen ? 'chosen' : 'noChosen'"
22
+ @click="changeChosen(index)"
23
+ >
24
+ <ui-lazyload-img
25
+ backgroundColor="#ffffff00"
26
+ width="20rpx"
27
+ height="14rpx"
28
+ src="/static/images/chosen.png"
29
+ v-if="item.chosen"
30
+ />
31
+ <ui-lazyload-img
32
+ backgroundColor="#ffffff00"
33
+ width="20rpx"
34
+ height="14rpx"
35
+ src="/static/images/noChosen.png"
36
+ v-else
37
+ />
38
+ </view>
39
+ </view>
40
+ <view class="bottom">
41
+ <view class="con-l">
42
+ <view class="addressContent">{{
43
+ item.provinceName +
44
+ item.cityName +
45
+ item.districtName +
46
+ item.address
47
+ }}</view>
48
+ <view class="peopleMes">
49
+ <view>{{ item.name }}</view>
50
+ <view>{{ item.phone }}</view>
51
+ </view>
52
+ </view>
53
+ <view class="con-r" @tap.stop="toDetail(item)">
54
+ <ui-lazyload-img
55
+ backgroundColor="#ffffff00"
56
+ width="28rpx"
57
+ height="28rpx"
58
+ src="/static/images/change.png"
59
+ />
60
+ </view>
61
+ </view>
62
+ </view>
63
+ </ui-slide-view>
64
+ </view>
65
+ <view class="addAddress" @click="toDetail('')">
66
+ {{ addText }}
67
+ </view>
68
+ </view>
69
+ </template>
70
+
71
+ <script setup lang="ts">
72
+ type addressListType = {
73
+ id: number;
74
+ isDefault: boolean;
75
+ chosen: 'chosen' | 'noChosen';
76
+ provinceName: string;
77
+ cityName: string;
78
+ address: string;
79
+ districtName: string;
80
+ name: string;
81
+ phone: string;
82
+ addressTagName: string;
83
+ };
84
+ type buttonsType = {
85
+ src: string;
86
+ width: string;
87
+ height: string;
88
+ background: string;
89
+ };
90
+
91
+ const props = withDefaults(
92
+ defineProps<{
93
+ addressList: addressListType[];
94
+ buttons: buttonsType[];
95
+ addText: string;
96
+ }>(),
97
+ {
98
+ addressList: [],
99
+ button: [
100
+ {
101
+ src: '/static/images/delete_icon.png',
102
+ width: '20rpx',
103
+ height: '24rpx',
104
+ background: 'rgb(255, 82, 79)'
105
+ }
106
+ ],
107
+ addText: '新增收货地址'
108
+ }
109
+ );
110
+
111
+ const emit = defineEmits<{
112
+ (e: 'toDetail', item: addressListType): void;
113
+ (e: 'handleClick', id: number): void;
114
+ (e: 'select', id: number): void;
115
+ }>();
116
+
117
+ const changeChosen = (index: number) => {
118
+ props.addressList[index].chosen = !props.addressList[index].chosen;
119
+ };
120
+ const toDetail = (item) => {
121
+ emit('toDetail', item);
122
+ };
123
+ const handleClick = (id) => {
124
+ emit('handleClick', id);
125
+ };
126
+ const select = (id) => {
127
+ emit('select', id);
128
+ };
129
+ </script>
130
+
131
+ <style lang="scss">
132
+ @import '../../libs/css/address-list.scss';
133
+ </style>
@@ -0,0 +1,52 @@
1
+ <template>
2
+ <view
3
+ class="cart-bar"
4
+ :style="{
5
+ position: fixed ? 'fixed' : 'relative',
6
+ top: top ? top + 'rpx' : '',
7
+ bottom: bottom ? bottom + 'rpx' : ''
8
+ }"
9
+ >
10
+ <slot></slot>
11
+ </view>
12
+ </template>
13
+ <script setup lang="ts">
14
+ const props = withDefaults(
15
+ defineProps<{
16
+ fixed: boolean;
17
+ top: number;
18
+ bottom: number;
19
+ }>(),
20
+ {
21
+ fixed: true,
22
+ top: null,
23
+ bottom: 0
24
+ }
25
+ );
26
+ </script>
27
+ <style scoped lang="scss">
28
+ .cart-bar {
29
+ width: 100%;
30
+ height: 100rpx;
31
+ background: rgba(255, 255, 255, 0.98);
32
+ position: fixed;
33
+ display: flex;
34
+ align-items: center;
35
+ justify-content: space-between;
36
+ z-index: 10;
37
+ bottom: 0;
38
+ left: 0;
39
+ padding-bottom: env(safe-area-inset-bottom);
40
+
41
+ .cart-bar::before {
42
+ content: '';
43
+ position: absolute;
44
+ top: 0;
45
+ right: 0;
46
+ left: 0;
47
+ border-top: 1rpx solid #eaeef1;
48
+ -webkit-transform: scaleY(0.5);
49
+ transform: scaleY(0.5);
50
+ }
51
+ }
52
+ </style>
@@ -0,0 +1,36 @@
1
+ <template>
2
+ <view class="ui-flex-1 cart-bar-button" :style="{ width: width + 'rpx' }">
3
+ <ui-button
4
+ height="68rpx"
5
+ :size="26"
6
+ :type="type"
7
+ shape="circle"
8
+ @click="handleClick"
9
+ >{{ text }}</ui-button
10
+ >
11
+ </view>
12
+ </template>
13
+ <script setup lang="ts">
14
+ interface IProps {
15
+ width?: number | string;
16
+ text: string;
17
+ type?: 'danger' | 'warning';
18
+ }
19
+ const props = withDefaults(defineProps<IProps>(), { width: 200 });
20
+ const emit = defineEmits<{
21
+ (e: 'handleClick', data: IProps): void;
22
+ }>();
23
+
24
+ const handleClick = () => {
25
+ emit('handleClick', props);
26
+ };
27
+ </script>
28
+ <style scoped lang="scss">
29
+ .ui-flex-1 {
30
+ flex: 1;
31
+ padding: 6rpx;
32
+ }
33
+ .cart-bar-button {
34
+ width: 200rpx;
35
+ }
36
+ </style>
@@ -0,0 +1,48 @@
1
+ <template>
2
+ <view
3
+ class="cart-bar-item"
4
+ hover-class="ui-opcity"
5
+ :hover-stay-time="150"
6
+ @tap="handleClick"
7
+ :style="{
8
+ width: width + 'rpx'
9
+ }"
10
+ >
11
+ <view class="nut-badge"
12
+ ><ui-icon :name="icon" :size="22" color="#333"></ui-icon>
13
+ <view class="nut-badge__content"
14
+ ><ui-badge
15
+ v-if="badge"
16
+ type="red"
17
+ absolute
18
+ :scaleRatio="0.8"
19
+ right="10rpx"
20
+ top="-4rpx"
21
+ >{{ badge }}</ui-badge
22
+ ></view
23
+ >
24
+ </view>
25
+ <view class="cart-bar-text ui-scale-small">{{ text }}</view>
26
+ </view>
27
+ </template>
28
+ <script setup lang="ts">
29
+ interface IProps {
30
+ text: string;
31
+ icon: string;
32
+ badge?: number;
33
+ width: number;
34
+ }
35
+ const props = withDefaults(defineProps<IProps>(), {
36
+ width: 130
37
+ });
38
+ const emit = defineEmits<{
39
+ (e: 'handleClick', data: IProps): void;
40
+ }>();
41
+
42
+ const handleClick = () => {
43
+ emit('handleClick', props);
44
+ };
45
+ </script>
46
+ <style scoped lang="scss">
47
+ @import '../../libs//css/cart-bar-icon.scss';
48
+ </style>
@@ -0,0 +1,163 @@
1
+ <template>
2
+ <view class="category-box">
3
+ <view class="left-box">
4
+ <vertical-nav
5
+ :value="navIndex"
6
+ @change="navChange"
7
+ :list="navList"
8
+ :height="height"
9
+ /></view>
10
+ <view class="right-box"
11
+ ><scroll-view
12
+ scroll-y
13
+ :style="{ height: height + 'px' }"
14
+ :show-scrollbar="false"
15
+ :enhanced="true"
16
+ >
17
+ <view class="tools">
18
+ <view class="tools_item" @click="inventoryTypeChange"
19
+ >销量
20
+ <sort-icon
21
+ :scale="0.8"
22
+ :type="inventoryType"
23
+ borderActivedColor="#FF524F"
24
+ borderColor="#6D7278"
25
+ />
26
+ </view>
27
+ <view class="tools_item" @click="priceTypeChange"
28
+ >价格
29
+ <sort-icon
30
+ :scale="0.8"
31
+ :type="priceType"
32
+ borderActivedColor="#FF524F"
33
+ borderColor="#6D7278"
34
+ />
35
+ </view>
36
+ </view>
37
+ <!-- <ui-loading text="加载中" type="row"></ui-loading> -->
38
+ <ui-loadmore :index="2" v-if="loading"></ui-loadmore>
39
+
40
+ <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
+ >
46
+ <goods-card
47
+ :goods-count="countData[item.defaultShopSkuId]?.count"
48
+ @handleClick="goDetails"
49
+ @countChange="countChange"
50
+ :entity="item"
51
+ /></view>
52
+ </view>
53
+ <ui-no-data
54
+ :fixed="false"
55
+ :imgUrl="noDataUrl"
56
+ marginTop="50"
57
+ v-if="!goodsList.length && !loading"
58
+ >
59
+ <text class="tui-color__black">{{ noDataTip }}</text>
60
+ </ui-no-data>
61
+ </scroll-view></view
62
+ >
63
+ </view>
64
+ </template>
65
+ <script setup lang="ts">
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 {
71
+ GoodsDataType,
72
+ cartItemListType,
73
+ changeValueType
74
+ } from '../interface/types';
75
+
76
+ interface IProps {
77
+ navList: { name: string; value: any }[];
78
+ loading: boolean;
79
+ height: number;
80
+ nullData?: {
81
+ url: string;
82
+ text: string;
83
+ };
84
+ navIndex: number;
85
+ goodsList: GoodsDataType[];
86
+ cartItemList?: cartItemListType[];
87
+ inventoryType?: 'desc' | 'asc' | '';
88
+ priceType?: 'desc' | 'asc' | '';
89
+ }
90
+
91
+ const props = withDefaults(defineProps<IProps>(), {
92
+ navList: [],
93
+ height: 469,
94
+ goodsList: [],
95
+ nullData: { url: '', text: '' },
96
+ cartItemList: [],
97
+ loading: false
98
+ });
99
+
100
+ const countData = computed<{ [key: number]: any }>(() => {
101
+ const list = props.cartItemList || [];
102
+ const data: { [key: number]: any } = {};
103
+ list.forEach((v) => {
104
+ data[v.skuId] = {
105
+ id: v.id,
106
+ count: v.count,
107
+ skuId: v.skuId
108
+ };
109
+ });
110
+ return data;
111
+ });
112
+
113
+ const emit = defineEmits<{
114
+ (e: 'goDetails', goodsItem: any): void;
115
+ (e: 'countChange', val: changeValueType, goodsItem: GoodsDataType): void;
116
+ (e: 'navChange', navItem: any): void;
117
+ (
118
+ e: 'storeChange',
119
+ params: {
120
+ sortKey: 'spuSaleCnt' | 'price';
121
+ orderType: 'desc' | 'asc';
122
+ }
123
+ ): void;
124
+ }>();
125
+
126
+ const noDataUrl = computed(() => {
127
+ return props.nullData.url || '/static/images/img_noorder_3x.png';
128
+ });
129
+ const noDataTip = computed(() => {
130
+ return props.nullData.text || '暂无数据~';
131
+ });
132
+
133
+ const nventoryTypeChange = () => {};
134
+
135
+ const priceTypeChange = () => {
136
+ const orderType = props.priceType === 'asc' ? 'desc' : 'asc';
137
+ emit('storeChange', {
138
+ sortKey: 'price',
139
+ orderType
140
+ });
141
+ };
142
+ const inventoryTypeChange = () => {
143
+ const orderType = props.inventoryType === 'asc' ? 'desc' : 'asc';
144
+ emit('storeChange', {
145
+ sortKey: 'spuSaleCnt',
146
+ orderType
147
+ });
148
+ };
149
+
150
+ const goDetails = (goodsItem: GoodsDataType) => {
151
+ emit('goDetails', goodsItem);
152
+ };
153
+
154
+ const countChange = (val: changeValueType, goodsItem: GoodsDataType) => {
155
+ emit('countChange', val, goodsItem);
156
+ };
157
+ const navChange = (navItem: { name: string; value: any }) => {
158
+ emit('navChange', navItem);
159
+ };
160
+ </script>
161
+ <style scoped lang="scss">
162
+ @import '../../libs/css/category.scss';
163
+ </style>
@@ -0,0 +1,48 @@
1
+ <template>
2
+ <view class="delivery-address" @click="handleClick">
3
+ <view class="header">
4
+ <text class="text">{{ title }}</text>
5
+ <slot name="tools"></slot>
6
+ </view>
7
+ <view class="content">
8
+ <view class="user">
9
+ <view class="user-info">
10
+ <text>{{ data.receiverName }}</text>
11
+ <text>{{ data.receiverPhone }}</text>
12
+ </view>
13
+ <view class="address">
14
+ <text>收货地址:</text>
15
+ <text class="text">{{ data.address }}</text>
16
+ </view>
17
+ </view>
18
+ <view class="icon-box" v-if="arrow">
19
+ <ui-icon name="arrowright" :size="23" color="#B3BCCD"></ui-icon>
20
+ </view>
21
+ </view>
22
+ </view>
23
+ </template>
24
+ <script setup lang="ts">
25
+ import type { storeDeliveryType } from '../interface/types';
26
+
27
+ type IProps = {
28
+ title: string;
29
+ arrow?: boolean;
30
+ data: storeDeliveryType;
31
+ };
32
+
33
+ const props = withDefaults(defineProps<IProps>(), {
34
+ arrow: true,
35
+ title: '收货地址',
36
+ data: {}
37
+ });
38
+ const emit = defineEmits<{
39
+ (e: 'handleClick', data: storeDeliveryType): void;
40
+ }>();
41
+
42
+ const handleClick = () => {
43
+ emit('handleClick', props.data);
44
+ };
45
+ </script>
46
+ <style scoped lang="scss">
47
+ @import '../../libs/css/delivery-address.scss';
48
+ </style>
@@ -0,0 +1,124 @@
1
+ <template>
2
+ <view class="discount-coupon red-card">
3
+ <view class="background">
4
+ <view class="coupon-title">
5
+ <text class="text">{{ discountData[data.discountType] }}</text>
6
+ </view>
7
+ </view>
8
+ <view class="content">
9
+ <view class="info">
10
+ <view class="money" v-if="data.discountType === 2">
11
+ <text class="type">¥</text>
12
+ <text class="value">{{ data.amountStr }}</text>
13
+ </view>
14
+ <view class="discount" v-else>
15
+ <text class="value">{{ ` ` }}{{ data.discountStr }}折</text>
16
+ </view>
17
+
18
+ <view class="rule">
19
+ <view class="text value"
20
+ >使用规则:{{ returnWhenOrderCancelStr }}</view
21
+ >
22
+ <view class="text value">用户范围:{{ userRuleInfoStr }}</view>
23
+ </view>
24
+ </view>
25
+ <view class="tip-box">
26
+ <text class="tip">满{{ data.thresholdStr }}可用</text>
27
+ <view
28
+ class="button"
29
+ :class="{ disabled: data.isReceived === 0 ? false : true }"
30
+ @click="receive"
31
+ v-if="!use"
32
+ >{{ data.isReceived === 0 ? '立即领取' : '已领取' }}</view
33
+ >
34
+ <view class="radio" v-else>
35
+ <ui-radio
36
+ color="#6ba5fd"
37
+ borderColor="transparent"
38
+ :value="data.id"
39
+ :disabled="+data.status !== 0"
40
+ :checked="checked"
41
+ @change="select"
42
+ ></ui-radio>
43
+ </view>
44
+ </view>
45
+ <view class="validity"
46
+ ><text>有效期:</text><text class="date">{{ receiveEndTime }}</text
47
+ ><text>过期</text></view
48
+ >
49
+ </view>
50
+
51
+ <view v-if="showStatus" class="watermark">
52
+ {{ statusText }}
53
+ </view>
54
+ </view>
55
+ </template>
56
+ <script setup lang="ts">
57
+ import { computed, onMounted } from 'vue';
58
+ import { fmtTime } from './utils';
59
+
60
+ import type { dataTypes } from './interface';
61
+
62
+ interface IProps {
63
+ /**优惠劵数据 */
64
+ data: dataTypes;
65
+ /**是否使用 */
66
+ use?: boolean;
67
+ /**是否已选 */
68
+ checked?: boolean;
69
+ /** 是否展示优惠劵状态 */
70
+ showStatus?: boolean;
71
+ }
72
+
73
+ type stringObject = { [key: number | string]: string };
74
+ const discountData: {
75
+ [key: string]: string;
76
+ } = {
77
+ '1': '抵扣劵',
78
+ '2': '满减劵',
79
+ '3': '折扣劵'
80
+ };
81
+ // 用户劵状态
82
+ const statusTextData: stringObject = {
83
+ '-1': '未生效',
84
+ '0': '未使用',
85
+ '1': '已使用',
86
+ '2': '已过期'
87
+ };
88
+
89
+ const receiveEndTime = computed(() => {
90
+ return fmtTime('yyyy-MM-dd', new Date(props.data.receiveEndTime));
91
+ });
92
+ const returnWhenOrderCancelStr = computed(() => {
93
+ return props.data.useRule.returnWhenOrderCancel === 1
94
+ ? '退款时返还'
95
+ : '退款时不返还';
96
+ });
97
+ const userRuleInfoStr = computed(() => {
98
+ const arr = props.data.userRuleInfo.split(':');
99
+ return arr[arr.length - 1];
100
+ });
101
+
102
+ const statusText = computed(() => {
103
+ const status = props.data.status;
104
+ return statusTextData[status];
105
+ });
106
+
107
+ const props = defineProps<IProps>();
108
+ const emit = defineEmits<{
109
+ (e: 'receive', data: dataTypes): void;
110
+ (e: 'select', data: dataTypes): void;
111
+ }>();
112
+
113
+ const receive = () => {
114
+ emit('receive', props.data);
115
+ };
116
+ const select = () => {
117
+ emit('select', props.data);
118
+ };
119
+
120
+ onMounted(() => {});
121
+ </script>
122
+ <style scoped lang="scss">
123
+ @import '../../libs/css/discount-coupon.scss';
124
+ </style>
@@ -0,0 +1,32 @@
1
+ export interface dataTypes {
2
+ /** 折扣力度,打折券时候为 0-100,其他情况下为折扣金额 */
3
+ discount: number
4
+ /** 金额 */
5
+ amount: number
6
+ /** 金额 */
7
+ amountStr: string
8
+ /** 折扣力度 */
9
+ discountStr: string
10
+ /** 使用规则 */
11
+ userRuleInfo: string
12
+ /** 领取状态 0 未领取, 1 已领取 */
13
+ isReceived: number
14
+ /** 有效期 */
15
+ receiveEndTime: string
16
+ /** 折扣类型, 1 抵扣, 2 满减, 3 折扣 */
17
+ discountType: number
18
+ /** 门槛 单位分 */
19
+ threshold: number
20
+ /** 门槛 */
21
+ thresholdStr: string
22
+ /** 名称 */
23
+ name: string
24
+ /** //状态 用户券:-1 未生效, 0 未使用, 1 已使用, 2已过期, 店铺券: 0 未开始, 1 进行中, 2 已结束 */
25
+ status: '-1' | '0' | '1' | '2'
26
+ /** 优惠券id */
27
+ id: number
28
+ useRule: {
29
+ returnWhenOrderCancel: number // 退款时是否返还 0 不返还 1 返还
30
+ }
31
+ }
32
+