leisure-core 0.4.1 → 0.4.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.
- package/index.js +3 -0
- package/le-area/src/main.vue +1 -1
- package/le-button/src/main.vue +5 -0
- package/le-button-qr/src/main.vue +5 -1
- package/le-promotions/index.js +2 -0
- package/le-promotions-activities/index.js +7 -0
- package/le-promotions-activities/src/main.vue +202 -0
- package/le-promotions-activities/src/sub.vue +197 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -35,6 +35,7 @@ import LeRate from "./le-rate/index.js";
|
|
|
35
35
|
import { LeCoupon, LeCouponSub, LeCouponDetails } from "./le-coupon/index.js";
|
|
36
36
|
import LeUpload from "./le-upload/index.js";
|
|
37
37
|
import LePromotions from "./le-promotions/index.js";
|
|
38
|
+
import LePromotionsActivities from "./le-promotions-activities/index.js";
|
|
38
39
|
import LeCommission from "./le-commission/index.js";
|
|
39
40
|
import LeMpurl from "./le-mpurl/index.js";
|
|
40
41
|
import { LeHelp, LeHelpDetail } from "./le-help/index.js";
|
|
@@ -75,6 +76,7 @@ const components = [
|
|
|
75
76
|
LeCouponSub,
|
|
76
77
|
LeCouponDetails,
|
|
77
78
|
LePromotions,
|
|
79
|
+
LePromotionsActivities,
|
|
78
80
|
LeCommission,
|
|
79
81
|
LeMpurl,
|
|
80
82
|
LeHelp,
|
|
@@ -186,6 +188,7 @@ export default {
|
|
|
186
188
|
LeCouponSub,
|
|
187
189
|
LeCouponDetails,
|
|
188
190
|
LePromotions,
|
|
191
|
+
LePromotionsActivities,
|
|
189
192
|
LeCommission,
|
|
190
193
|
LeMpurl,
|
|
191
194
|
LeHelp,
|
package/le-area/src/main.vue
CHANGED
package/le-button/src/main.vue
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
:size="size"
|
|
6
6
|
v-permission="$route.params.btns"
|
|
7
7
|
@click="click"
|
|
8
|
+
:disabled="disabled"
|
|
8
9
|
style="margin-left: 2px; margin-right: 2px"
|
|
9
10
|
v-if="disp"
|
|
10
11
|
>{{ text }}</el-button
|
|
@@ -38,6 +39,10 @@ export default {
|
|
|
38
39
|
type: Boolean,
|
|
39
40
|
default: true,
|
|
40
41
|
},
|
|
42
|
+
disabled: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
default: false,
|
|
45
|
+
},
|
|
41
46
|
},
|
|
42
47
|
methods: {
|
|
43
48
|
click(param) {
|
|
@@ -23,6 +23,10 @@ export default {
|
|
|
23
23
|
type: String,
|
|
24
24
|
default: "",
|
|
25
25
|
},
|
|
26
|
+
fileName: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: "二维码",
|
|
29
|
+
},
|
|
26
30
|
},
|
|
27
31
|
data() {
|
|
28
32
|
return {
|
|
@@ -66,7 +70,7 @@ export default {
|
|
|
66
70
|
.getElementsByTagName("canvas");
|
|
67
71
|
let a = document.createElement("a");
|
|
68
72
|
a.href = myCanvas[0].toDataURL("image/png");
|
|
69
|
-
a.download =
|
|
73
|
+
a.download = this.fileName;
|
|
70
74
|
a.click();
|
|
71
75
|
this.$message.success("正在进行下载保存");
|
|
72
76
|
},
|
package/le-promotions/index.js
CHANGED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<div ref="refSearch">
|
|
4
|
+
<el-form :inline="true" :model="searchData">
|
|
5
|
+
<el-form-item label="是否上架">
|
|
6
|
+
<el-select v-model="searchData.released" placeholder="选择" clearable>
|
|
7
|
+
<el-option
|
|
8
|
+
v-for="item in releaseOptions"
|
|
9
|
+
:label="item.name"
|
|
10
|
+
:value="item.value"
|
|
11
|
+
:key="item.value"
|
|
12
|
+
></el-option>
|
|
13
|
+
</el-select>
|
|
14
|
+
</el-form-item>
|
|
15
|
+
<el-form-item>
|
|
16
|
+
<el-button type="primary" @click="list">查询</el-button>
|
|
17
|
+
<el-button type="primary" @click="addPromotion">新增</el-button>
|
|
18
|
+
</el-form-item>
|
|
19
|
+
</el-form>
|
|
20
|
+
</div>
|
|
21
|
+
<div>
|
|
22
|
+
<el-table
|
|
23
|
+
:data="tableData"
|
|
24
|
+
:header-cell-style="{ 'text-align': 'center' }"
|
|
25
|
+
:cell-style="{ 'text-align': 'center' }"
|
|
26
|
+
border
|
|
27
|
+
row-key="id"
|
|
28
|
+
:max-height="tableHeight"
|
|
29
|
+
stripe
|
|
30
|
+
class="tableClass"
|
|
31
|
+
>
|
|
32
|
+
<el-table-column
|
|
33
|
+
prop="pname"
|
|
34
|
+
label="类型"
|
|
35
|
+
width="100"
|
|
36
|
+
></el-table-column>
|
|
37
|
+
<el-table-column prop="title" label="标题"></el-table-column>
|
|
38
|
+
<el-table-column prop="date_start" label="开始时间" width="130">
|
|
39
|
+
<template slot-scope="scope">
|
|
40
|
+
{{ parseTime(scope.row.date_start) }}
|
|
41
|
+
</template>
|
|
42
|
+
</el-table-column>
|
|
43
|
+
<el-table-column prop="date_end" label="结束时间" width="130">
|
|
44
|
+
<template slot-scope="scope">
|
|
45
|
+
{{ parseTime(scope.row.date_end) }}
|
|
46
|
+
</template>
|
|
47
|
+
</el-table-column>
|
|
48
|
+
<el-table-column prop="grang" label="适应商品" width="100">
|
|
49
|
+
<template slot-scope="scope">
|
|
50
|
+
<span v-if="scope.row.grang == 1">全部商品</span>
|
|
51
|
+
<span v-if="scope.row.grang == 2">部分商品</span>
|
|
52
|
+
</template>
|
|
53
|
+
</el-table-column>
|
|
54
|
+
<el-table-column prop="released" label="启用" width="80">
|
|
55
|
+
<template slot-scope="scope">
|
|
56
|
+
<span v-if="scope.row.released == 0">未启用</span>
|
|
57
|
+
<span v-if="scope.row.released == 1">已启用</span>
|
|
58
|
+
</template>
|
|
59
|
+
</el-table-column>
|
|
60
|
+
<el-table-column fixed="right" label="操作" align="center" width="248">
|
|
61
|
+
<template slot-scope="scope">
|
|
62
|
+
<le-button
|
|
63
|
+
id="btnDetail"
|
|
64
|
+
text="编辑"
|
|
65
|
+
@click="pEdit(scope.row)"
|
|
66
|
+
style="margin-right: 2px"
|
|
67
|
+
></le-button>
|
|
68
|
+
<le-button-msg
|
|
69
|
+
id="btnDel"
|
|
70
|
+
text="删除"
|
|
71
|
+
@click="deletepromotion(scope.row)"
|
|
72
|
+
></le-button-msg>
|
|
73
|
+
</template>
|
|
74
|
+
</el-table-column>
|
|
75
|
+
</el-table>
|
|
76
|
+
<div ref="refPagination" style="text-align: center; margin-top: 30px">
|
|
77
|
+
<el-pagination
|
|
78
|
+
background
|
|
79
|
+
layout="prev, pager, next"
|
|
80
|
+
:total="total"
|
|
81
|
+
:page-size="10"
|
|
82
|
+
@current-change="current_change"
|
|
83
|
+
></el-pagination>
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
<le-dialog-container
|
|
87
|
+
width="60%"
|
|
88
|
+
title="活动详情"
|
|
89
|
+
:showDialog="showDetails"
|
|
90
|
+
@close="closeDetailsDialog"
|
|
91
|
+
:showFooter="true"
|
|
92
|
+
saveBtnText="保存"
|
|
93
|
+
@saveData="onSubmit"
|
|
94
|
+
>
|
|
95
|
+
<le-promotions-activities-sub
|
|
96
|
+
ref="promotionDetail"
|
|
97
|
+
:editType="editType"
|
|
98
|
+
:rowData="rowData"
|
|
99
|
+
@list="list"
|
|
100
|
+
v-if="showDetails"
|
|
101
|
+
>
|
|
102
|
+
<template v-slot:default="data">
|
|
103
|
+
<!-- <slot :paid="rowData ? rowData.id : ''"></slot> -->
|
|
104
|
+
<slot :paid="data.paid"></slot>
|
|
105
|
+
</template>
|
|
106
|
+
</le-promotions-activities-sub>
|
|
107
|
+
</le-dialog-container>
|
|
108
|
+
</div>
|
|
109
|
+
</template>
|
|
110
|
+
<script>
|
|
111
|
+
import { delP, listP } from "@/api/mall_promotion_activities";
|
|
112
|
+
import LePromotionsActivitiesSub from "./sub.vue";
|
|
113
|
+
|
|
114
|
+
export default {
|
|
115
|
+
name: "le-promotions-activities",
|
|
116
|
+
components: { LePromotionsActivitiesSub },
|
|
117
|
+
data() {
|
|
118
|
+
return {
|
|
119
|
+
tableHeight: 200,
|
|
120
|
+
showDetails: false,
|
|
121
|
+
// showGoods: false,
|
|
122
|
+
rowData: null,
|
|
123
|
+
editType: 1,
|
|
124
|
+
tableData: [],
|
|
125
|
+
searchData: {
|
|
126
|
+
released: "",
|
|
127
|
+
pageNo: 1,
|
|
128
|
+
},
|
|
129
|
+
releaseOptions: [
|
|
130
|
+
{
|
|
131
|
+
value: 0,
|
|
132
|
+
name: "未上架",
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
value: 1,
|
|
136
|
+
name: "已上架",
|
|
137
|
+
},
|
|
138
|
+
],
|
|
139
|
+
total: 0,
|
|
140
|
+
timeArr: "",
|
|
141
|
+
};
|
|
142
|
+
},
|
|
143
|
+
mounted() {
|
|
144
|
+
this.list();
|
|
145
|
+
this.$nextTick(() => {
|
|
146
|
+
this.tableHeight =
|
|
147
|
+
window.innerHeight -
|
|
148
|
+
this.$refs.refSearch.offsetHeight -
|
|
149
|
+
this.$refs.refPagination.offsetHeight -
|
|
150
|
+
120;
|
|
151
|
+
});
|
|
152
|
+
},
|
|
153
|
+
methods: {
|
|
154
|
+
current_change(currentPage) {
|
|
155
|
+
this.searchData.pageNo = currentPage;
|
|
156
|
+
this.list();
|
|
157
|
+
},
|
|
158
|
+
list() {
|
|
159
|
+
let params = this.searchData;
|
|
160
|
+
listP(params).then((response) => {
|
|
161
|
+
this.tableData = response.data.data.list;
|
|
162
|
+
this.total = response.data.data.count;
|
|
163
|
+
if (this.showDetails) {
|
|
164
|
+
this.closeDetailsDialog();
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
},
|
|
168
|
+
addPromotion() {
|
|
169
|
+
this.showDetails = true;
|
|
170
|
+
},
|
|
171
|
+
pEdit(obj) {
|
|
172
|
+
this.rowData = JSON.parse(JSON.stringify(obj));
|
|
173
|
+
this.editType = 2;
|
|
174
|
+
this.showDetails = true;
|
|
175
|
+
},
|
|
176
|
+
closeDetailsDialog() {
|
|
177
|
+
this.rowData = null;
|
|
178
|
+
this.editType = 1;
|
|
179
|
+
this.showDetails = false;
|
|
180
|
+
},
|
|
181
|
+
deletepromotion(item) {
|
|
182
|
+
let param = {};
|
|
183
|
+
param.id = item.id;
|
|
184
|
+
delP(param).then(() => {
|
|
185
|
+
this.list();
|
|
186
|
+
this.$message.success("删除成功");
|
|
187
|
+
});
|
|
188
|
+
},
|
|
189
|
+
onSubmit() {
|
|
190
|
+
this.$refs.promotionDetail.onSave();
|
|
191
|
+
},
|
|
192
|
+
// selectGoods(goods) {
|
|
193
|
+
// console.log(goods);
|
|
194
|
+
// },
|
|
195
|
+
},
|
|
196
|
+
};
|
|
197
|
+
</script>
|
|
198
|
+
<style lang="scss" scoped>
|
|
199
|
+
.tableClass {
|
|
200
|
+
width: 100%;
|
|
201
|
+
}
|
|
202
|
+
</style>
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-form ref="form" :model="form" :rules="rules" label-width="130px">
|
|
3
|
+
<el-form-item label="活动标题" prop="title">
|
|
4
|
+
<el-input v-model="form.title"></el-input>
|
|
5
|
+
</el-form-item>
|
|
6
|
+
<el-form-item label="活动类型" prop="ptype">
|
|
7
|
+
<el-select v-model="form.ptype" placeholder="请选择活动类型">
|
|
8
|
+
<el-option
|
|
9
|
+
v-for="item in pTypeOptions"
|
|
10
|
+
:label="item.name"
|
|
11
|
+
:value="item.id"
|
|
12
|
+
:key="item.id"
|
|
13
|
+
></el-option>
|
|
14
|
+
</el-select>
|
|
15
|
+
</el-form-item>
|
|
16
|
+
<el-form-item label="启动数量" prop="minmoney">
|
|
17
|
+
<el-input-number
|
|
18
|
+
v-model="form.num_min"
|
|
19
|
+
:min="1"
|
|
20
|
+
:max="100"
|
|
21
|
+
@change="handleChange"
|
|
22
|
+
></el-input-number>
|
|
23
|
+
</el-form-item>
|
|
24
|
+
<el-form-item label="开始日期" prop="date_start">
|
|
25
|
+
<el-date-picker
|
|
26
|
+
value-format="timestamp"
|
|
27
|
+
v-model="form.date_start"
|
|
28
|
+
type="date"
|
|
29
|
+
placeholder="开始日期"
|
|
30
|
+
>
|
|
31
|
+
</el-date-picker>
|
|
32
|
+
</el-form-item>
|
|
33
|
+
<el-form-item label="结束日期" prop="date_end">
|
|
34
|
+
<el-date-picker
|
|
35
|
+
value-format="timestamp"
|
|
36
|
+
v-model="form.date_end"
|
|
37
|
+
type="date"
|
|
38
|
+
placeholder="结束日期"
|
|
39
|
+
>
|
|
40
|
+
</el-date-picker>
|
|
41
|
+
</el-form-item>
|
|
42
|
+
<el-form-item label="是否启用">
|
|
43
|
+
<el-select v-model="form.released">
|
|
44
|
+
<el-option label="是" value="1" key="1"></el-option>
|
|
45
|
+
<el-option label="否" value="0" key="0"></el-option>
|
|
46
|
+
</el-select>
|
|
47
|
+
</el-form-item>
|
|
48
|
+
<el-form-item label="适用范围">
|
|
49
|
+
<el-radio-group v-model="form.grang">
|
|
50
|
+
<el-radio :label="1">全部商品</el-radio>
|
|
51
|
+
<el-radio :label="2">部分商品可用</el-radio>
|
|
52
|
+
</el-radio-group>
|
|
53
|
+
</el-form-item>
|
|
54
|
+
<div v-if="form.grang == 2">
|
|
55
|
+
<slot :paid="rowData ? rowData.id : ''"></slot>
|
|
56
|
+
</div>
|
|
57
|
+
</el-form>
|
|
58
|
+
</template>
|
|
59
|
+
<script>
|
|
60
|
+
import { createP, editP } from "@/api/mall_promotion_activities";
|
|
61
|
+
import { list as promotionTypeList } from "@/api/mall_promotion_type";
|
|
62
|
+
import GoodsSpuApi from "@/api/goods_spu";
|
|
63
|
+
export default {
|
|
64
|
+
name: "le-promotions-activities-sub",
|
|
65
|
+
props: {
|
|
66
|
+
editType: {
|
|
67
|
+
type: Number,
|
|
68
|
+
default: 1, //新增模式 2:修改模式
|
|
69
|
+
},
|
|
70
|
+
rowData: {
|
|
71
|
+
type: Object,
|
|
72
|
+
default: () => {},
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
data() {
|
|
76
|
+
return {
|
|
77
|
+
form: {
|
|
78
|
+
id: "",
|
|
79
|
+
title: "",
|
|
80
|
+
ptype: "",
|
|
81
|
+
pname: "",
|
|
82
|
+
date_start: "",
|
|
83
|
+
date_end: "",
|
|
84
|
+
grang: 2,
|
|
85
|
+
num_min: 0,
|
|
86
|
+
num_give: 0,
|
|
87
|
+
// grang_product: [],
|
|
88
|
+
is_used_coupon: "0",
|
|
89
|
+
is_used_integral: "0",
|
|
90
|
+
released: "1",
|
|
91
|
+
note: "",
|
|
92
|
+
},
|
|
93
|
+
pTypeOptions: [],
|
|
94
|
+
goodsList: [],
|
|
95
|
+
loading: false,
|
|
96
|
+
rules: {
|
|
97
|
+
title: [
|
|
98
|
+
{ required: true, message: "请输入活动标题", trigger: "blur" },
|
|
99
|
+
{
|
|
100
|
+
min: 1,
|
|
101
|
+
max: 150,
|
|
102
|
+
message: "长度在 1 到 150 个字符",
|
|
103
|
+
trigger: "blur",
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
ptype: [
|
|
107
|
+
{ required: true, message: "必须选择活动类型", trigger: "blur" },
|
|
108
|
+
],
|
|
109
|
+
date_start: [
|
|
110
|
+
{ required: true, message: "必须设置开始时间", trigger: "blur" },
|
|
111
|
+
],
|
|
112
|
+
date_end: [
|
|
113
|
+
{ required: true, message: "必须设置结束时间", trigger: "blur" },
|
|
114
|
+
],
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
},
|
|
118
|
+
mounted() {
|
|
119
|
+
this.getPromotionTypes();
|
|
120
|
+
if (!this.editType || this.editType != 1) {
|
|
121
|
+
this.form = this.rowData;
|
|
122
|
+
this.form.date_start = new Date(this.rowData.date_start * 1000);
|
|
123
|
+
this.form.date_end = new Date(this.rowData.date_end * 1000);
|
|
124
|
+
this.form.is_used_coupon = "1";
|
|
125
|
+
this.form.is_used_integral = "1";
|
|
126
|
+
this.form.released = this.form.released.toString();
|
|
127
|
+
if (this.form.grang == 2) {
|
|
128
|
+
let products = this.form.grang_product;
|
|
129
|
+
if (products && products.length > 0) {
|
|
130
|
+
products = products.split(",");
|
|
131
|
+
this.form.grang_product = products;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
methods: {
|
|
137
|
+
handleChange() {},
|
|
138
|
+
onSave() {
|
|
139
|
+
this.$refs["form"].validate((valid) => {
|
|
140
|
+
if (valid) {
|
|
141
|
+
let param = JSON.parse(JSON.stringify(this.form));
|
|
142
|
+
if (param.date_start) {
|
|
143
|
+
param.date_start = new Date(param.date_start).getTime() / 1000;
|
|
144
|
+
}
|
|
145
|
+
if (param.date_end) {
|
|
146
|
+
param.date_end = new Date(param.date_end).getTime() / 1000;
|
|
147
|
+
}
|
|
148
|
+
param.is_used_coupon = Number(param.is_used_coupon);
|
|
149
|
+
param.is_used_integral = Number(param.is_used_integral);
|
|
150
|
+
param.released = Number(param.released);
|
|
151
|
+
if (param.grang == 2) {
|
|
152
|
+
param.grang_product = "";
|
|
153
|
+
} else {
|
|
154
|
+
param.grang_product = "";
|
|
155
|
+
}
|
|
156
|
+
if (this.editType == 1) {
|
|
157
|
+
createP(param).then(() => {
|
|
158
|
+
this.$message.success("提交成功!");
|
|
159
|
+
this.$refs["form"].resetFields();
|
|
160
|
+
this.$emit("list");
|
|
161
|
+
});
|
|
162
|
+
} else {
|
|
163
|
+
editP(param).then(() => {
|
|
164
|
+
this.$message.success("提交成功!");
|
|
165
|
+
this.$emit("list");
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
} else {
|
|
169
|
+
return false;
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
},
|
|
173
|
+
getPromotionTypes() {
|
|
174
|
+
promotionTypeList().then((res) => {
|
|
175
|
+
this.pTypeOptions = res.data.data;
|
|
176
|
+
});
|
|
177
|
+
},
|
|
178
|
+
getGoodsMethod(query) {
|
|
179
|
+
if (query !== "") {
|
|
180
|
+
this.loading = true;
|
|
181
|
+
let param = {};
|
|
182
|
+
param.searchComment = query;
|
|
183
|
+
GoodsSpuApi.listSearch({ params: param })
|
|
184
|
+
.then((res) => {
|
|
185
|
+
this.loading = false;
|
|
186
|
+
this.goodsList = res.data.data;
|
|
187
|
+
})
|
|
188
|
+
.catch(() => {
|
|
189
|
+
this.loading = false;
|
|
190
|
+
});
|
|
191
|
+
} else {
|
|
192
|
+
this.goodsList = [];
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
},
|
|
196
|
+
};
|
|
197
|
+
</script>
|