leisure-core 0.1.9 → 0.2.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,130 @@
1
+ <template>
2
+ <div class="le-depart-container">
3
+ <el-form :inline="true">
4
+ <el-form-item>
5
+ <el-button type="primary" @click="addHelp()">新建</el-button>
6
+ </el-form-item>
7
+ </el-form>
8
+ <el-table :data="tableData" border row-key="id" stripe style="width: 100%">
9
+ <el-table-column prop="type" label="类型" align="center">
10
+ </el-table-column>
11
+ <el-table-column prop="title" label="标题" align="center">
12
+ </el-table-column>
13
+ <el-table-column fixed="right" label="操作" align="center" width="180">
14
+ <template slot-scope="scope">
15
+ <le-button text="编辑" @click="edit(scope.row)"></le-button>
16
+ <le-button-msg @click="del(scope.row.id)"></le-button-msg>
17
+ </template>
18
+ </el-table-column>
19
+ </el-table>
20
+ <le-dialog-container
21
+ title="新建/编辑帮助文档"
22
+ :showDialog="showDialog"
23
+ :showFooter="true"
24
+ @close="handleClose"
25
+ @saveData="savedepart"
26
+ >
27
+ <el-form
28
+ :model="ruleForm"
29
+ :rules="rules"
30
+ ref="ruleForm"
31
+ label-width="140px"
32
+ v-if="showDialog"
33
+ >
34
+ <el-form-item label="类型" prop="type">
35
+ <el-input v-model="ruleForm.type"></el-input>
36
+ </el-form-item>
37
+ <el-form-item label="标题" prop="title">
38
+ <el-input v-model="ruleForm.title"></el-input>
39
+ </el-form-item>
40
+ <el-form-item label="内容" prop="comment">
41
+ <le-editor v-model="ruleForm.comment"></le-editor>
42
+ </el-form-item>
43
+ </el-form>
44
+ </le-dialog-container>
45
+ </div>
46
+ </template>
47
+ <script>
48
+ import { list, edit, del } from "@/api/SystemHelp";
49
+ import { LeEditor } from "leisure-editor";
50
+ export default {
51
+ name: "le-help",
52
+ components: {
53
+ LeEditor,
54
+ },
55
+ data() {
56
+ return {
57
+ tableData: [],
58
+ ruleForm: {
59
+ id: "",
60
+ type: "",
61
+ title: "",
62
+ comment: "",
63
+ },
64
+ rules: {
65
+ type: [
66
+ { required: true, message: "请输入类型", trigger: "blur" },
67
+ { max: 6, message: "长度在 1 到 6个字符", trigger: "blur" },
68
+ ],
69
+ title: [
70
+ { required: true, message: "请输入标题", trigger: "blur" },
71
+ { max: 20, message: "长度在 1 到 20个字符", trigger: "blur" },
72
+ ],
73
+ comment: [{ required: true, message: "请输入类型", trigger: "blur" }],
74
+ },
75
+ showDialog: false,
76
+ };
77
+ },
78
+ computed: {},
79
+ mounted() {
80
+ this.getList();
81
+ },
82
+ methods: {
83
+ addHelp() {
84
+ this.showDialog = true;
85
+ },
86
+ edit(row) {
87
+ this.ruleForm = JSON.parse(JSON.stringify(row));
88
+ this.showDialog = true;
89
+ },
90
+ savedepart() {
91
+ let params = JSON.parse(JSON.stringify(this.ruleForm));
92
+ this.$refs["ruleForm"].validate((valid) => {
93
+ if (valid) {
94
+ edit(params).then(() => {
95
+ this.$message.success("提交成功~");
96
+ this.getList();
97
+ this.handleClose();
98
+ });
99
+ } else {
100
+ console.log("error submit!!");
101
+ return false;
102
+ }
103
+ });
104
+ },
105
+ handleClose() {
106
+ this.showDialog = false;
107
+ this.initForm();
108
+ },
109
+ getList() {
110
+ list().then((res) => {
111
+ this.tableData = res.data.data || [];
112
+ });
113
+ },
114
+ del(id) {
115
+ del({
116
+ id: id,
117
+ }).then((response) => {
118
+ this.getList();
119
+ this.$message.success("删除成功");
120
+ });
121
+ },
122
+ initForm() {
123
+ this.ruleForm.id = "";
124
+ this.ruleForm.type = "";
125
+ this.ruleForm.title = "";
126
+ this.ruleForm.comment = "";
127
+ },
128
+ },
129
+ };
130
+ </script>
@@ -6,15 +6,13 @@ const leMixins = {
6
6
  },
7
7
 
8
8
  mounted() {
9
- this.$nextTick(() => {
10
- if (!this.$refs.eltablemain) return;
11
- this.elTableMaxHeight =
12
- window.innerHeight -
13
- this.$refs.eltablemain.$el.getBoundingClientRect().top -
14
- 90;
15
- });
9
+ window.addEventListener("resize", this.changeHeight);
10
+ this.changeHeight();
16
11
  },
17
12
 
13
+ destroyed() {
14
+ window.removeEventListener("resize", this.changeHeight);
15
+ },
18
16
  methods: {
19
17
  renderHeader(h, { column, $index }) {
20
18
  const opts = document.getElementsByClassName("le-table-btn-container");
@@ -31,6 +29,16 @@ const leMixins = {
31
29
  return h("span", column.label);
32
30
  }
33
31
  },
32
+ changeHeight() {
33
+ this.$nextTick(() => {
34
+ if (!this.$refs.eltablemain) return;
35
+ let dyHeight = this.elTableMaxHeight;
36
+ let all = window.innerHeight;
37
+ let top = this.$refs.eltablemain.$el.getBoundingClientRect().top;
38
+ dyHeight = all - top - 90;
39
+ this.elTableMaxHeight = dyHeight;
40
+ });
41
+ },
34
42
  },
35
43
  };
36
44
 
@@ -0,0 +1,7 @@
1
+ import LeMpurl from "./src/main.vue";
2
+
3
+ LeMpurl.install = function (Vue) {
4
+ Vue.component(LeMpurl.name, LeMpurl);
5
+ };
6
+
7
+ export default LeMpurl;
@@ -0,0 +1,51 @@
1
+ <template>
2
+ <el-table
3
+ :data="tableData"
4
+ :header-cell-style="{ 'text-align': 'center' }"
5
+ :cell-style="{ 'text-align': 'center' }"
6
+ border
7
+ row-key="id"
8
+ stripe
9
+ style="width: 100%"
10
+ >
11
+ <el-table-column label="类型" width="100">
12
+ <template slot-scope="scope">
13
+ <span v-if="scope.row.url_type == 1">商城版块</span>
14
+ <span v-if="scope.row.url_type == 2">旅游版块</span>
15
+ </template>
16
+ </el-table-column>
17
+ <el-table-column prop="url_path" label="首页" width="150">
18
+ </el-table-column>
19
+ <el-table-column prop="url_param" label="参数" width="100">
20
+ </el-table-column>
21
+ <el-table-column prop="url_jump" label="推广链接"> </el-table-column>
22
+ <!-- <el-table-column prop="url_wx" label="小程序url地址"> </el-table-column> -->
23
+ <el-table-column prop="cdate" label="时间" width="160">
24
+ <template slot-scope="scope">
25
+ <span v-if="scope.row.cdate">{{ parseTime(scope.row.cdate) }}</span>
26
+ </template>
27
+ </el-table-column>
28
+ <el-table-column prop="note" label="备注"> </el-table-column>
29
+ </el-table>
30
+ </template>
31
+ <script>
32
+ import { mpUrlList } from "@/api/market";
33
+ export default {
34
+ name: "le-mpurl",
35
+ data() {
36
+ return {
37
+ tableData: [],
38
+ };
39
+ },
40
+ mounted() {
41
+ this.list();
42
+ },
43
+ methods: {
44
+ list() {
45
+ mpUrlList().then((res) => {
46
+ this.tableData = res.data.data;
47
+ });
48
+ },
49
+ },
50
+ };
51
+ </script>
@@ -0,0 +1,7 @@
1
+ import LePromotions from "./src/main.vue";
2
+
3
+ LePromotions.install = function (Vue) {
4
+ Vue.component(LePromotions.name, LePromotions);
5
+ };
6
+
7
+ export default LePromotions;
@@ -0,0 +1,220 @@
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="is_used_coupon" label="优惠券" width="80">
55
+ <template slot-scope="scope">
56
+ <span v-if="scope.row.is_used_coupon == 0">不能使用</span>
57
+ <span v-if="scope.row.is_used_coupon == 1">能使用</span>
58
+ </template>
59
+ </el-table-column>
60
+ <el-table-column prop="is_used_integral" label="积分" width="80">
61
+ <template slot-scope="scope">
62
+ <span v-if="scope.row.is_used_integral == 0">不能使用</span>
63
+ <span v-if="scope.row.is_used_integral == 1">能使用</span>
64
+ </template>
65
+ </el-table-column> -->
66
+ <el-table-column prop="released" label="启用" width="80">
67
+ <template slot-scope="scope">
68
+ <span v-if="scope.row.released == 0">未启用</span>
69
+ <span v-if="scope.row.released == 1">已启用</span>
70
+ </template>
71
+ </el-table-column>
72
+ <el-table-column fixed="right" label="操作" align="center" width="180">
73
+ <template slot-scope="scope">
74
+ <el-button
75
+ type="primary"
76
+ size="small"
77
+ id="btnDetail"
78
+ v-permission="$route.params.btns"
79
+ @click="pEdit(scope.row)"
80
+ style="margin-right: 2px"
81
+ >
82
+ 编辑
83
+ </el-button>
84
+ <el-popconfirm
85
+ id="btnDel"
86
+ v-permission="$route.params.btns"
87
+ :title="`该操作不可逆,确定退款?`"
88
+ @confirm="deletepromotion(scope.row)"
89
+ >
90
+ <template #reference>
91
+ <el-button
92
+ type="primary"
93
+ size="small"
94
+ style="margin-right: 2px"
95
+ >
96
+ 删除
97
+ </el-button>
98
+ </template>
99
+ </el-popconfirm>
100
+ </template>
101
+ </el-table-column>
102
+ </el-table>
103
+ <div ref="refPagination" style="text-align: center; margin-top: 30px">
104
+ <el-pagination
105
+ background
106
+ layout="prev, pager, next"
107
+ :total="total"
108
+ :page-size="10"
109
+ @current-change="current_change"
110
+ ></el-pagination>
111
+ </div>
112
+ </div>
113
+ <le-dialog-container
114
+ width="60%"
115
+ title="促销详情"
116
+ :showDialog="showDetails"
117
+ @close="closeDetailsDialog"
118
+ :showFooter="true"
119
+ @saveData="onSubmit"
120
+ >
121
+ <le-promotions-sub
122
+ ref="promotionDetail"
123
+ :editType="editType"
124
+ :rowData="rowData"
125
+ @list="list"
126
+ v-if="showDetails"
127
+ ></le-promotions-sub>
128
+ </le-dialog-container>
129
+ </div>
130
+ </template>
131
+ <script>
132
+ import { delP, listP } from "@/api/mall_promotion";
133
+ import LePromotionsSub from "./sub.vue";
134
+ import moment from "moment";
135
+
136
+ export default {
137
+ name: "le-promotions",
138
+ components: { LePromotionsSub },
139
+ data() {
140
+ return {
141
+ tableHeight: 200,
142
+ showDetails: false,
143
+ rowData: null,
144
+ editType: 1,
145
+ tableData: [],
146
+ searchData: {
147
+ released: "",
148
+ pageNo: 1,
149
+ },
150
+ releaseOptions: [
151
+ {
152
+ value: 0,
153
+ name: "未上架",
154
+ },
155
+ {
156
+ value: 1,
157
+ name: "已上架",
158
+ },
159
+ ],
160
+ total: 0,
161
+ timeArr: "",
162
+ };
163
+ },
164
+ mounted() {
165
+ this.list();
166
+ this.$nextTick(() => {
167
+ this.tableHeight =
168
+ window.innerHeight -
169
+ this.$refs.refSearch.offsetHeight -
170
+ this.$refs.refPagination.offsetHeight -
171
+ 120;
172
+ });
173
+ },
174
+ methods: {
175
+ current_change(currentPage) {
176
+ this.searchData.pageNo = currentPage;
177
+ this.list();
178
+ },
179
+ list() {
180
+ let params = this.searchData;
181
+ listP(params).then((response) => {
182
+ this.tableData = response.data.data.list;
183
+ this.total = response.data.data.count;
184
+ });
185
+ },
186
+ addPromotion() {
187
+ this.showDetails = true;
188
+ },
189
+ pEdit(obj) {
190
+ this.rowData = JSON.parse(JSON.stringify(obj));
191
+ this.editType = 2;
192
+ this.showDetails = true;
193
+ },
194
+ closeDetailsDialog() {
195
+ this.rowData = null;
196
+ this.editType = 1;
197
+ this.showDetails = false;
198
+ },
199
+ dateFormat(data) {
200
+ return moment.unix(data).format("YYYY-MM-DD HH:mm");
201
+ },
202
+ deletepromotion(item) {
203
+ let param = {};
204
+ param.id = item.id;
205
+ delP(param).then(() => {
206
+ this.list();
207
+ this.$message.success("删除成功");
208
+ });
209
+ },
210
+ onSubmit() {
211
+ this.$refs.promotionDetail.onSave();
212
+ },
213
+ },
214
+ };
215
+ </script>
216
+ <style lang="scss" scoped>
217
+ .tableClass {
218
+ width: 100%;
219
+ }
220
+ </style>