leisure-core 0.4.0 → 0.4.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.
package/le-area/src/main.vue
CHANGED
|
@@ -15,6 +15,10 @@ export default {
|
|
|
15
15
|
type: String,
|
|
16
16
|
default: "2",
|
|
17
17
|
},
|
|
18
|
+
isAny: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: false,
|
|
21
|
+
},
|
|
18
22
|
initArea: {
|
|
19
23
|
type: Array,
|
|
20
24
|
default: () => [],
|
|
@@ -26,6 +30,7 @@ export default {
|
|
|
26
30
|
props: {
|
|
27
31
|
label: "name",
|
|
28
32
|
value: "code",
|
|
33
|
+
checkStrictly: false,
|
|
29
34
|
lazy: true,
|
|
30
35
|
lazyLoad: this.LoadData,
|
|
31
36
|
},
|
|
@@ -39,6 +44,12 @@ export default {
|
|
|
39
44
|
deep: true,
|
|
40
45
|
immediate: true,
|
|
41
46
|
},
|
|
47
|
+
isAny: {
|
|
48
|
+
handler(val) {
|
|
49
|
+
this.props.checkStrictly = val;
|
|
50
|
+
},
|
|
51
|
+
immediate: true,
|
|
52
|
+
},
|
|
42
53
|
},
|
|
43
54
|
mounted() {},
|
|
44
55
|
methods: {
|
|
@@ -56,7 +67,7 @@ export default {
|
|
|
56
67
|
});
|
|
57
68
|
},
|
|
58
69
|
handleChange(currentValue) {
|
|
59
|
-
this.$emit("areaChange", currentValue);
|
|
70
|
+
this.$emit("areaChange", JSON.stringify(currentValue));
|
|
60
71
|
},
|
|
61
72
|
},
|
|
62
73
|
};
|
|
@@ -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
|
},
|
|
@@ -0,0 +1,199 @@
|
|
|
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
|
+
{{ dateFormat(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
|
+
{{ dateFormat(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="180">
|
|
61
|
+
<template slot-scope="scope">
|
|
62
|
+
<le-button
|
|
63
|
+
id="btnGoods"
|
|
64
|
+
text="选择商品"
|
|
65
|
+
@click="choiceGoods(scope.row)"
|
|
66
|
+
style="margin-right: 2px"
|
|
67
|
+
></le-button>
|
|
68
|
+
<le-button
|
|
69
|
+
id="btnDetail"
|
|
70
|
+
text="编辑"
|
|
71
|
+
@click="pEdit(scope.row)"
|
|
72
|
+
style="margin-right: 2px"
|
|
73
|
+
></le-button>
|
|
74
|
+
<le-button-msg
|
|
75
|
+
id="btnDel"
|
|
76
|
+
text="删除"
|
|
77
|
+
@click="deletepromotion(scope.row)"
|
|
78
|
+
></le-button-msg>
|
|
79
|
+
</template>
|
|
80
|
+
</el-table-column>
|
|
81
|
+
</el-table>
|
|
82
|
+
<div ref="refPagination" style="text-align: center; margin-top: 30px">
|
|
83
|
+
<el-pagination
|
|
84
|
+
background
|
|
85
|
+
layout="prev, pager, next"
|
|
86
|
+
:total="total"
|
|
87
|
+
:page-size="10"
|
|
88
|
+
@current-change="current_change"
|
|
89
|
+
></el-pagination>
|
|
90
|
+
</div>
|
|
91
|
+
</div>
|
|
92
|
+
<le-dialog-container
|
|
93
|
+
width="60%"
|
|
94
|
+
title="促销详情"
|
|
95
|
+
:showDialog="showDetails"
|
|
96
|
+
@close="closeDetailsDialog"
|
|
97
|
+
:showFooter="true"
|
|
98
|
+
@saveData="onSubmit"
|
|
99
|
+
>
|
|
100
|
+
<le-promotions-activities-sub
|
|
101
|
+
ref="promotionDetail"
|
|
102
|
+
:editType="editType"
|
|
103
|
+
:rowData="rowData"
|
|
104
|
+
@list="list"
|
|
105
|
+
v-if="showDetails"
|
|
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
|
+
import moment from "moment";
|
|
114
|
+
|
|
115
|
+
export default {
|
|
116
|
+
name: "le-promotions-activities",
|
|
117
|
+
components: { LePromotionsActivitiesSub },
|
|
118
|
+
data() {
|
|
119
|
+
return {
|
|
120
|
+
tableHeight: 200,
|
|
121
|
+
showDetails: 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
|
+
});
|
|
164
|
+
},
|
|
165
|
+
addPromotion() {
|
|
166
|
+
this.showDetails = true;
|
|
167
|
+
},
|
|
168
|
+
pEdit(obj) {
|
|
169
|
+
this.rowData = JSON.parse(JSON.stringify(obj));
|
|
170
|
+
this.editType = 2;
|
|
171
|
+
this.showDetails = true;
|
|
172
|
+
},
|
|
173
|
+
closeDetailsDialog() {
|
|
174
|
+
this.rowData = null;
|
|
175
|
+
this.editType = 1;
|
|
176
|
+
this.showDetails = false;
|
|
177
|
+
},
|
|
178
|
+
dateFormat(data) {
|
|
179
|
+
return moment.unix(data).format("YYYY-MM-DD HH:mm");
|
|
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
|
+
},
|
|
193
|
+
};
|
|
194
|
+
</script>
|
|
195
|
+
<style lang="scss" scoped>
|
|
196
|
+
.tableClass {
|
|
197
|
+
width: 100%;
|
|
198
|
+
}
|
|
199
|
+
</style>
|
|
@@ -0,0 +1,234 @@
|
|
|
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
|
+
<!-- <span style="padding-left: 10px"
|
|
24
|
+
>例如:买五送一则该值为5;第二件半价该值为2</span
|
|
25
|
+
> -->
|
|
26
|
+
</el-form-item>
|
|
27
|
+
<!-- <el-form-item label="赠送数量" prop="minmoney">
|
|
28
|
+
<el-input-number
|
|
29
|
+
v-model="form.num_give"
|
|
30
|
+
:min="0"
|
|
31
|
+
:max="20"
|
|
32
|
+
></el-input-number>
|
|
33
|
+
<span style="padding-left: 10px">例如:买五送一则该值为1</span>
|
|
34
|
+
</el-form-item> -->
|
|
35
|
+
<el-form-item label="开始日期" prop="date_start">
|
|
36
|
+
<el-date-picker
|
|
37
|
+
value-format="timestamp"
|
|
38
|
+
v-model="form.date_start"
|
|
39
|
+
type="date"
|
|
40
|
+
placeholder="开始日期"
|
|
41
|
+
>
|
|
42
|
+
</el-date-picker>
|
|
43
|
+
</el-form-item>
|
|
44
|
+
<el-form-item label="结束日期" prop="date_end">
|
|
45
|
+
<el-date-picker
|
|
46
|
+
value-format="timestamp"
|
|
47
|
+
v-model="form.date_end"
|
|
48
|
+
type="date"
|
|
49
|
+
placeholder="结束日期"
|
|
50
|
+
>
|
|
51
|
+
</el-date-picker>
|
|
52
|
+
</el-form-item>
|
|
53
|
+
<el-form-item label="适用范围">
|
|
54
|
+
<el-radio-group v-model="form.grang">
|
|
55
|
+
<el-radio :label="1">全部商品</el-radio>
|
|
56
|
+
<el-radio :label="2">部分商品可用</el-radio>
|
|
57
|
+
</el-radio-group>
|
|
58
|
+
</el-form-item>
|
|
59
|
+
<!-- <el-form-item label="选择商品" v-if="form.grang == 2">
|
|
60
|
+
<el-select
|
|
61
|
+
v-model="form.grang_product"
|
|
62
|
+
multiple
|
|
63
|
+
filterable
|
|
64
|
+
remote
|
|
65
|
+
reserve-keyword
|
|
66
|
+
placeholder="输入商品编码或名称关键字"
|
|
67
|
+
:remote-method="getGoodsMethod"
|
|
68
|
+
:loading="loading"
|
|
69
|
+
>
|
|
70
|
+
<el-option
|
|
71
|
+
v-for="item in goodsList"
|
|
72
|
+
:key="item.gcode + '-' + item.gname"
|
|
73
|
+
:label="item.gcode + '-' + item.gname"
|
|
74
|
+
:value="item.gcode + '-' + item.gname"
|
|
75
|
+
>
|
|
76
|
+
</el-option>
|
|
77
|
+
</el-select>
|
|
78
|
+
</el-form-item> -->
|
|
79
|
+
<el-form-item label="是否启用">
|
|
80
|
+
<el-select v-model="form.released">
|
|
81
|
+
<el-option label="是" value="1" key="1"></el-option>
|
|
82
|
+
<el-option label="否" value="0" key="0"></el-option>
|
|
83
|
+
</el-select>
|
|
84
|
+
</el-form-item>
|
|
85
|
+
<el-form-item> </el-form-item>
|
|
86
|
+
</el-form>
|
|
87
|
+
</template>
|
|
88
|
+
<script>
|
|
89
|
+
import { createP, editP } from "@/api/mall_promotion_activities";
|
|
90
|
+
import { list as promotionTypeList } from "@/api/mall_promotion_type";
|
|
91
|
+
import GoodsSpuApi from "@/api/goods_spu";
|
|
92
|
+
export default {
|
|
93
|
+
name: "le-promotions-activities-sub",
|
|
94
|
+
props: {
|
|
95
|
+
editType: {
|
|
96
|
+
type: Number,
|
|
97
|
+
default: 1, //新增模式 2:修改模式
|
|
98
|
+
},
|
|
99
|
+
rowData: {
|
|
100
|
+
type: Object,
|
|
101
|
+
default: () => {},
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
data() {
|
|
105
|
+
return {
|
|
106
|
+
form: {
|
|
107
|
+
id: "",
|
|
108
|
+
title: "",
|
|
109
|
+
ptype: "",
|
|
110
|
+
pname: "",
|
|
111
|
+
date_start: "",
|
|
112
|
+
date_end: "",
|
|
113
|
+
grang: 2,
|
|
114
|
+
num_min: 0,
|
|
115
|
+
num_give: 0,
|
|
116
|
+
grang_product: [],
|
|
117
|
+
is_used_coupon: "0",
|
|
118
|
+
is_used_integral: "0",
|
|
119
|
+
released: "1",
|
|
120
|
+
note: "",
|
|
121
|
+
},
|
|
122
|
+
pTypeOptions: [],
|
|
123
|
+
goodsList: [],
|
|
124
|
+
loading: false,
|
|
125
|
+
rules: {
|
|
126
|
+
title: [
|
|
127
|
+
{ required: true, message: "请输入活动标题", trigger: "blur" },
|
|
128
|
+
{
|
|
129
|
+
min: 1,
|
|
130
|
+
max: 150,
|
|
131
|
+
message: "长度在 1 到 150 个字符",
|
|
132
|
+
trigger: "blur",
|
|
133
|
+
},
|
|
134
|
+
],
|
|
135
|
+
ptype: [
|
|
136
|
+
{ required: true, message: "必须选择活动类型", trigger: "blur" },
|
|
137
|
+
],
|
|
138
|
+
date_start: [
|
|
139
|
+
{ required: true, message: "必须设置开始时间", trigger: "blur" },
|
|
140
|
+
],
|
|
141
|
+
date_end: [
|
|
142
|
+
{ required: true, message: "必须设置结束时间", trigger: "blur" },
|
|
143
|
+
],
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
},
|
|
147
|
+
mounted() {
|
|
148
|
+
this.getPromotionTypes();
|
|
149
|
+
if (!this.editType || this.editType != 1) {
|
|
150
|
+
this.form = this.rowData;
|
|
151
|
+
this.form.date_start = new Date(this.rowData.date_start * 1000);
|
|
152
|
+
this.form.date_end = new Date(this.rowData.date_end * 1000);
|
|
153
|
+
this.form.is_used_coupon = "1";
|
|
154
|
+
this.form.is_used_integral = "1";
|
|
155
|
+
this.form.released = this.form.released.toString();
|
|
156
|
+
if (this.form.grang == 2) {
|
|
157
|
+
let products = this.form.grang_product;
|
|
158
|
+
if (products && products.length > 0) {
|
|
159
|
+
products = products.split(",");
|
|
160
|
+
this.form.grang_product = products;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
methods: {
|
|
166
|
+
handleChange() {},
|
|
167
|
+
onSave() {
|
|
168
|
+
this.$refs["form"].validate((valid) => {
|
|
169
|
+
if (valid) {
|
|
170
|
+
let param = JSON.parse(JSON.stringify(this.form));
|
|
171
|
+
if (param.date_start) {
|
|
172
|
+
param.date_start = new Date(param.date_start).getTime() / 1000;
|
|
173
|
+
}
|
|
174
|
+
if (param.date_end) {
|
|
175
|
+
param.date_end = new Date(param.date_end).getTime() / 1000;
|
|
176
|
+
}
|
|
177
|
+
param.is_used_coupon = Number(param.is_used_coupon);
|
|
178
|
+
param.is_used_integral = Number(param.is_used_integral);
|
|
179
|
+
param.released = Number(param.released);
|
|
180
|
+
if (param.grang == 2) {
|
|
181
|
+
param.grang_product = param.grang_product.toString();
|
|
182
|
+
} else {
|
|
183
|
+
param.grang_product = "";
|
|
184
|
+
}
|
|
185
|
+
if (this.editType == 1) {
|
|
186
|
+
createP(param).then(() => {
|
|
187
|
+
this.$message.success("提交成功!");
|
|
188
|
+
this.$refs["form"].resetFields();
|
|
189
|
+
this.$emit("list");
|
|
190
|
+
});
|
|
191
|
+
} else {
|
|
192
|
+
editP(param).then(() => {
|
|
193
|
+
this.$message.success("提交成功!");
|
|
194
|
+
this.$emit("list");
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
} else {
|
|
198
|
+
return false;
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
},
|
|
202
|
+
getPromotionTypes() {
|
|
203
|
+
promotionTypeList().then((res) => {
|
|
204
|
+
this.pTypeOptions = res.data.data;
|
|
205
|
+
});
|
|
206
|
+
},
|
|
207
|
+
// handlePromotionType(value) {
|
|
208
|
+
// if (value == undefined || value == "") return;
|
|
209
|
+
// let promotionTypes = this.pTypeOptions.find(function (item) {
|
|
210
|
+
// return item.id === value;
|
|
211
|
+
// });
|
|
212
|
+
// if (!promotionTypes) return;
|
|
213
|
+
// this.form.pname = promotionTypes.name;
|
|
214
|
+
// },
|
|
215
|
+
getGoodsMethod(query) {
|
|
216
|
+
if (query !== "") {
|
|
217
|
+
this.loading = true;
|
|
218
|
+
let param = {};
|
|
219
|
+
param.searchComment = query;
|
|
220
|
+
GoodsSpuApi.listSearch({ params: param })
|
|
221
|
+
.then((res) => {
|
|
222
|
+
this.loading = false;
|
|
223
|
+
this.goodsList = res.data.data;
|
|
224
|
+
})
|
|
225
|
+
.catch(() => {
|
|
226
|
+
this.loading = false;
|
|
227
|
+
});
|
|
228
|
+
} else {
|
|
229
|
+
this.goodsList = [];
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
},
|
|
233
|
+
};
|
|
234
|
+
</script>
|