jufubao-admin-library 1.1.165 → 1.1.166

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,54 @@
1
+ import Layout from '@/layout'
2
+
3
+ import { setModuleName } from "@/utils/xd.base";
4
+ import roles from '@/constant/permissions';
5
+ const ppt = roles.ppt
6
+
7
+
8
+ const pptRouter = {
9
+ path: '/ppt',
10
+ component: Layout,
11
+ sort: 90,
12
+ name: 'PPT管理',
13
+ hidden: true,
14
+ redirect: '/ppt/ready',
15
+ meta: {
16
+ title: 'PPT已添加商品',
17
+ icon: 'el-icon-collection',
18
+ iconSize: 20,
19
+ },
20
+ children: [
21
+ {
22
+ path: '/ppt/ready',
23
+ name: 'PPTReady',
24
+ hidden: true,
25
+ component: () => setModuleName(import('@/viewsPPT/ready'), 'PPTReady'),
26
+ meta: {
27
+ title: 'PPT添加商品',
28
+ icon: 'el-icon-document',
29
+ }
30
+ },
31
+ {
32
+ path: '/ppt/already',
33
+ name: 'PPTAlready',
34
+ hidden: true,
35
+ component: () => setModuleName(import('@/viewsPPT/already'), 'PPTAlready'),
36
+ meta: {
37
+ title: 'PPT已添加商品',
38
+ icon: 'el-icon-document',
39
+ }
40
+ },
41
+ {
42
+ path: '/ppt/create',
43
+ name: 'PPTCreate',
44
+ hidden: true,
45
+ component: () => setModuleName(import('@/viewsPPT/create'), 'PPTAlready'),
46
+ meta: {
47
+ title: '生成PPT',
48
+ icon: 'el-icon-document',
49
+ }
50
+ },
51
+ ]
52
+ }
53
+
54
+ export default pptRouter
@@ -0,0 +1,110 @@
1
+ 'use strict'
2
+
3
+ module.exports = {
4
+ name: 'ppt',
5
+ title: 'ppt管理',
6
+ vuex: true,
7
+ model: [
8
+ {
9
+ "title": "ppt产品列表",
10
+ "mapFn": "getPPTProductList",
11
+ "path": "/export-partner/v1/:xsiteid/:xnamespace/ppt-product",
12
+ "isRule": false,
13
+ isPublic: true,
14
+ "params": {
15
+ "trace_id": ["trace_id", "string|number", "可选"],
16
+ "page_size": ["page_size", "string|number", "可选"],
17
+ filters: ["filters", "string", "可选"],
18
+ tab: ["tab", "string", "可选"],
19
+ "page_token": ["page_token", "string", "可选"],
20
+ },
21
+ "disabled": true,
22
+ },
23
+ {
24
+ "title": "ppt产品删除",
25
+ "mapFn": "deletePPTProduct",
26
+ "path": "/export-partner/v1/:xsiteid/:xnamespace/ppt-product/delete",
27
+ "isRule": false,
28
+ isPublic: true,
29
+ "data": {
30
+ "trace_id": ["trace_id", "string|number", "可选"],
31
+ "ids": ["ids", "string|number", "可选"],
32
+ },
33
+ "disabled": true,
34
+ },
35
+ {
36
+ "title": "ppt选择商品列表",
37
+ "mapFn": "getPPTChooseProductList",
38
+ "path": "/product-partner/v1/:xsiteid/:xnamespace/ppt_product/product-select/query",
39
+ "isRule": false,
40
+ isPublic: true,
41
+ "data": {
42
+ "trace_id": ["trace_id", "string|number", "可选"],
43
+ "filters": ["filters", "string|number", "可选"],
44
+ },
45
+ "disabled": true,
46
+ },
47
+ {
48
+ "title": "PPT商品 - 商品选择sku列表",
49
+ "mapFn": "getPPTChooseProductSkuList",
50
+ "path": "/product-partner/v1/:xsiteid/:xnamespace/ppt_product/product-select/sku",
51
+ "isRule": false,
52
+ isPublic: true,
53
+ "data": {
54
+ "product_id": ["商品ID", "string|number", "可选"],
55
+ },
56
+ "disabled": true,
57
+ },
58
+ {
59
+ "title": "ppt选择商品",
60
+ "mapFn": "selectPPTProduct",
61
+ "path": "/product-partner/v1/:xsiteid/:xnamespace/ppt_product/select",
62
+ "isRule": false,
63
+ isPublic: true,
64
+ "data": {
65
+ "trace_id": ["trace_id", "string|number", "可选"],
66
+ "products": ["产品", "string|number", "可选"],
67
+ },
68
+ "disabled": true,
69
+ },
70
+ {
71
+ "title": "ppt模版列表",
72
+ "mapFn": "getPPTTemplateList",
73
+ "path": "/export-partner/v1/ppt-template",
74
+ "isRule": false,
75
+ isPublic: true,
76
+ "params": {
77
+ "layout_id": ["布局id", "string|number", "可选"],
78
+ "category_id": ["分类id", "string|number", "可选"],
79
+ },
80
+ "disabled": true,
81
+ },
82
+ {
83
+ "title": "PPT商品 - 创建任务",
84
+ "mapFn": "createPPTTask",
85
+ "path": "/product-partner/v1/:xsiteid/:xnamespace/ppt_product/create-ppt-task",
86
+ "isRule": false,
87
+ isPublic: true,
88
+ "data": {
89
+ "data_params": ["data_params", "string|number", "可选"],
90
+ "export_data_tag": ["导出模版(传固定值:ExportPartnerSelectedProductListPPT)", "string|number", "可选"],
91
+ file_name: ["文件名", "string|number", "可选"],
92
+ file_ext: ["文件扩展名", "string|number", "可选"],
93
+ },
94
+ "disabled": true,
95
+ },
96
+ {
97
+ "title": "ppt产品调价",
98
+ "mapFn": "adjustPPTProductPrice",
99
+ "path": "/export-partner/v1/:xsiteid/:xnamespace/ppt-product/modify-price",
100
+ "isRule": false,
101
+ isPublic: true,
102
+ "data": {
103
+ "formula": ["formula", "string|number", "可选"],
104
+ "id": ["id", "string|number", "可选"],
105
+ trace_id: ["追踪ID", "string|number", "可选"],
106
+ },
107
+ "disabled": true,
108
+ },
109
+ ],
110
+ }
@@ -0,0 +1,453 @@
1
+ <template>
2
+ <div class="app-container">
3
+ <el-card class="app-container__search">
4
+ <xd-search
5
+ time-type
6
+ date-filter
7
+ v-if="searchForm.length > 0"
8
+ v-model="searchParams"
9
+ :list="searchForm"
10
+ @onSearch="handleSearch"
11
+ @onDone="getList"
12
+ >
13
+ </xd-search>
14
+ </el-card>
15
+ <el-card class="app-container__list">
16
+ <div class="app-container__list-pagination">
17
+ <div></div>
18
+ <div>
19
+ <el-button
20
+ :disabled="tables.length === 0"
21
+ @click="handleBatchPrice"
22
+ type="primary"
23
+ >批量调价</el-button
24
+ >
25
+ <el-button
26
+ @click="handleBatchDelete"
27
+ type="danger"
28
+ :disabled="tables.length === 0"
29
+ >全部删除</el-button
30
+ >
31
+ <el-button @click="handleToAddProduct" type="primary"
32
+ >添加商品</el-button
33
+ >
34
+ <el-button @click="handleToCreatePPT" type="primary"
35
+ >生成PPT</el-button
36
+ >
37
+ </div>
38
+ </div>
39
+ <div class="app-container__list-table">
40
+ <xd-table
41
+ :headers="headers"
42
+ :list="tables"
43
+ is-border
44
+ @onSelect="handleSelect"
45
+ @onClick="handleTableClick"
46
+ >
47
+ <template slot="prices" slot-scope="scope">
48
+ <div v-for="(item, index) in scope.row.prices_label" :key="index">
49
+ {{ item.label }}:{{ item.value }}
50
+ <span style="color: #656667; font-size: 8px"
51
+ >({{ item.notice }})</span
52
+ >
53
+ </div>
54
+ </template>
55
+ </xd-table>
56
+ </div>
57
+ <div class="app-container__list-pagination">
58
+ <xd-pagination
59
+ :total="total"
60
+ :limit.sync="limit"
61
+ :page="page"
62
+ :auto-scroll="false"
63
+ @onPagination="handlePagination"
64
+ ></xd-pagination>
65
+ </div>
66
+ </el-card>
67
+ <xd-dialog
68
+ :show.sync="dialogShow"
69
+ v-if="dialogShow"
70
+ :title="title"
71
+ width="800px"
72
+ @onConfirm="handleConfirmSave"
73
+ >
74
+ <xd-base-dynamic-field
75
+ ref="form"
76
+ v-if="status && listForm.length > 0"
77
+ v-model="listValue"
78
+ :list="listForm"
79
+ :key="formKey"
80
+ label-width="140px"
81
+ @success="handleSuccess"
82
+ @onApiSuccessUrl="handleApiSuccessUrl"
83
+ @onGetParamsAndHeader="handleGetParamsAndHeader"
84
+ ></xd-base-dynamic-field>
85
+ </xd-dialog>
86
+ </div>
87
+ </template>
88
+
89
+ <script>
90
+ import XdSearch from "@/components/XdSearch";
91
+ import XdTable from "@/components/XdTable";
92
+ import XdPagination from "@/components/XdPagination.vue";
93
+ import XdDialog from "@/components/XdDialog.vue";
94
+ import XdBaseDynamicField from "@/components/XdBaseDynamicField";
95
+ import { Loading } from "element-ui";
96
+ import { mapActions } from "vuex";
97
+ import { getOptions } from "@/utils/options";
98
+
99
+ // import Price from "@/utils/Price";
100
+ // const price = new Price(
101
+ // "tpl_select",
102
+ // "价格",
103
+ // 300,
104
+ // ["specs"],
105
+ // {},
106
+ // { ratio: "折" }
107
+ // );
108
+
109
+ export default {
110
+ components: {
111
+ XdSearch,
112
+ XdTable,
113
+ XdPagination,
114
+ XdDialog,
115
+ XdBaseDynamicField,
116
+ },
117
+ data() {
118
+ return {
119
+ searchForm: [
120
+ {
121
+ label: "商品ID",
122
+ ele: "el-input",
123
+ valueKey: "product_id",
124
+ value: "",
125
+ placeholder: "请输入商品ID",
126
+ },
127
+ {
128
+ label: "商品名称",
129
+ ele: "el-input",
130
+ valueKey: "product_name",
131
+ value: "",
132
+ placeholder: "请输入商品名称",
133
+ },
134
+ ],
135
+ searchParams: {},
136
+ tables: [],
137
+ tablesSelectList: [],
138
+ page: 1, //当前页面数量
139
+ total: 0,
140
+ limit: 20, //搜索参数
141
+ trace_id: "",
142
+ //增改操作
143
+ dialogShow: false,
144
+ title: "单独改价",
145
+ listForm: [],
146
+ listValue: {},
147
+ status: false,
148
+ formKey: "formKey",
149
+ adjustType: 1, //1单独改价 2批量改价
150
+ formulaList: [],
151
+ };
152
+ },
153
+ computed: {
154
+ headers() {
155
+ return [
156
+ {
157
+ type: "normal",
158
+ prop: "product_id",
159
+ align: "center",
160
+ label: "商品ID",
161
+ },
162
+ {
163
+ type: "normal",
164
+ prop: "product_name",
165
+ align: "center",
166
+ label: "商品名称",
167
+ },
168
+ {
169
+ type: "image",
170
+ prop: "thumb",
171
+ align: "center",
172
+ width: 200,
173
+ label: "商品图片",
174
+ },
175
+ // price.getHeader(120, "center"),
176
+ {
177
+ type: "normal",
178
+ prop: "product_sku_name",
179
+ align: "center",
180
+ label: "SKU",
181
+ },
182
+ {
183
+ type: "normal",
184
+ prop: "prices",
185
+ align: "center",
186
+ label: "价格",
187
+ },
188
+ {
189
+ type: "operate",
190
+ align: "center",
191
+ prop: "operate",
192
+ width: 100,
193
+ label: "操作",
194
+ values: [
195
+ {
196
+ ui: "text-button",
197
+ name: "修改价格",
198
+ event: "adjust",
199
+ type: "primary",
200
+ },
201
+ {
202
+ ui: "text-button",
203
+ name: "移除",
204
+ event: "delete",
205
+ type: "danger",
206
+ },
207
+ ],
208
+ },
209
+ ];
210
+ },
211
+ },
212
+ watch: {
213
+ "listValue.unit"() {
214
+ this.initForm(this.listValue);
215
+ },
216
+ },
217
+ created() {
218
+ getOptions({
219
+ server: "export-partner",
220
+ fn: "ppt-template-setting",
221
+ path: "p1",
222
+ }).then((res) => {
223
+ this.formulaList = res.data.formula;
224
+ });
225
+ },
226
+ methods: {
227
+ ...mapActions("ppt", [
228
+ "getPPTProductList",
229
+ "deletePPTProduct",
230
+ "adjustPPTProductPrice",
231
+ ]),
232
+ onJfbTagForReload() {
233
+ this.getList();
234
+ },
235
+ getList() {
236
+ let params = {
237
+ ...this.searchParams,
238
+ page_token: this.page + "",
239
+ page_size: this.limit + "",
240
+ trace_id: this.trace_id,
241
+ };
242
+ let loading = Loading.service({});
243
+ this.getPPTProductList(params)
244
+ .then((res) => {
245
+ res.data.list = res.data.list.map((item) => {
246
+ item.prices_label = item.prices_label.map((pItem) => {
247
+ pItem.value = this.$xdHelper.divisionFloatNumber(
248
+ pItem.value,
249
+ 100
250
+ );
251
+ return pItem;
252
+ });
253
+ return item;
254
+ });
255
+ this.tables = res.data.list;
256
+ this.trace_id = res.data.trace_id;
257
+ this.total = res.data.total_size;
258
+ loading.close();
259
+ })
260
+ .catch((err) => {
261
+ loading.close();
262
+ });
263
+ },
264
+ initForm(params = {}) {
265
+ this.listForm = [
266
+ {
267
+ label: "基于:",
268
+ ele: "xd-select-list",
269
+ valueKey: "base",
270
+ value: params["base"] || "",
271
+ placeholder: "请选择售价类型",
272
+ multiple: false,
273
+ list: this.formulaList.options,
274
+ rules: [
275
+ {
276
+ required: true,
277
+ message: "请选择调价基准",
278
+ trigger: "blur",
279
+ },
280
+ ],
281
+ notice:
282
+ '<span style="color:#000; font-size: 14px;">调整</span><span style="color:#f00; font-size: 14px;">售价</span>',
283
+ inline: true,
284
+ },
285
+ {
286
+ label: " ",
287
+ ele: "xd-radio",
288
+ valueKey: "unit",
289
+ value: params["unit"] || "",
290
+ list: [
291
+ { label: "按金额", value: "money" },
292
+ { label: "按比例", value: "ratio" },
293
+ ],
294
+ rules: [{ required: true, message: "请选择", trigger: "blur" }],
295
+ },
296
+ {
297
+ label: "上调/下调",
298
+ ele: "xd-input-unit",
299
+ valueKey: "value",
300
+ value: params["value"] === undefined ? "" : params["value"],
301
+ placeholder: {
302
+ unitPlaceholder: "请输入数值",
303
+ },
304
+ setting: {
305
+ unit: params["unit"] === "money" ? "元" : "%",
306
+ pos: "append",
307
+ type: "number",
308
+ },
309
+ rules: [
310
+ {
311
+ required: true,
312
+ message: params["unit"] === "money" ? "请输入金额" : "请输入比例",
313
+ trigger: "blur",
314
+ },
315
+ ],
316
+ notice: "可设置正负值,负值时为下调",
317
+ inline: false,
318
+ },
319
+ {
320
+ label: "不高于市场价:",
321
+ ele: "xd-radio",
322
+ valueKey: "no_high_market_price",
323
+ value:
324
+ params["no_high_market_price"] !== undefined
325
+ ? params["no_high_market_price"]
326
+ : false,
327
+ list: [
328
+ { label: "是", value: true },
329
+ { label: "否", value: false },
330
+ ],
331
+ inline: false,
332
+ notice: "若调价后大于市场价则使用市场价为售价",
333
+ },
334
+ {
335
+ label: "小数点保留位数:",
336
+ ele: "xd-select-list",
337
+ valueKey: "decimal",
338
+ value: params.decimal || 2,
339
+ placeholder: "请选择小数点保留位数",
340
+ multiple: false,
341
+ list: [
342
+ { label: "零位", value: -1 },
343
+ { label: "一位", value: 1 },
344
+ { label: "两位", value: 2 },
345
+ ],
346
+ rules: [
347
+ {
348
+ required: true,
349
+ message: "请选择小数点保留位数",
350
+ trigger: "blur",
351
+ },
352
+ ],
353
+ },
354
+ ];
355
+ this.formKey = Date.now();
356
+ this.status = true;
357
+ this.dialogShow = true;
358
+ },
359
+ handleSelect(val) {
360
+ this.tablesSelectList = val.ids;
361
+ },
362
+ handleSearch() {
363
+ this.getList();
364
+ },
365
+ handleTableClick({ row, value, index, rowIndex }) {
366
+ if (value.event === "delete") {
367
+ this.deletePPTProduct({ ids: [row.id], trace_id: this.trace_id })
368
+ .then((res) => {
369
+ this.getList();
370
+ })
371
+ .catch((err) => {
372
+ console.log(err);
373
+ });
374
+ } else if (value.event === "adjust") {
375
+ this.title = "单独改价";
376
+ this.adjustId = row.id;
377
+ this.adjustType = 1;
378
+ this.initForm(row);
379
+ }
380
+ },
381
+ handleBatchDelete() {
382
+ this.$confirm("您确定要删除所有商品吗?", "提示", {
383
+ confirmButtonText: "确定",
384
+ cancelButtonText: "取消",
385
+ type: "warning",
386
+ }).then((res) => {
387
+ this.deletePPTProduct({
388
+ ids: this.tablesSelectList,
389
+ trace_id: this.trace_id,
390
+ })
391
+ .then((res) => {
392
+ this.getList();
393
+ })
394
+ .catch((err) => {
395
+ console.log(err);
396
+ });
397
+ });
398
+ },
399
+ handleToCreatePPT() {
400
+ this.$router.push(`/ppt/create?trace_id=${this.trace_id}`);
401
+ },
402
+ handleToAddProduct() {
403
+ this.$router.push(`/ppt/ready?trace_id=${this.trace_id}`);
404
+ },
405
+ handlePagination(page) {
406
+ this.pageSize = page;
407
+ this.getList();
408
+ },
409
+ handleBatchPrice() {
410
+ this.title = "批量改价";
411
+ this.adjustType = 2;
412
+ this.initForm({});
413
+ },
414
+ handleConfirmSave() {
415
+ this.$refs.form.submit().then((res) => {
416
+ let data = {
417
+ formula: { ...this.listValue },
418
+ trace_id: this.trace_id,
419
+ };
420
+ data.formula.value = this.$xdHelper.multiplyFloatNumber(
421
+ data.formula.value,
422
+ 100
423
+ );
424
+ if (this.adjustType === 1) {
425
+ data.id = this.adjustId;
426
+ //单独
427
+ this.adjustPPTProductPrice(data)
428
+ .then((res) => {
429
+ this.dialogShow = false;
430
+ this.getList();
431
+ })
432
+ .catch((err) => {
433
+ console.log(err);
434
+ });
435
+ } else {
436
+ //批量
437
+ this.adjustPPTProductPrice(data)
438
+ .then((res) => {
439
+ this.dialogShow = false;
440
+ this.getList();
441
+ })
442
+ .catch((err) => {
443
+ console.log(err);
444
+ });
445
+ }
446
+ });
447
+ },
448
+ },
449
+ };
450
+ </script>
451
+
452
+ <style lang="scss" scoped>
453
+ </style>