jufubao-admin-library 1.1.4 → 1.1.6
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,35 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
import Layout from '@/layout'
|
|
4
|
+
import roles from '@/constant/permissions' //引用权限值
|
|
5
|
+
const freight_set = roles.freight_set;
|
|
6
|
+
|
|
7
|
+
const freightSetRouter = {
|
|
8
|
+
path: '/delivery',
|
|
9
|
+
sort: 95,
|
|
10
|
+
component: Layout,
|
|
11
|
+
name: '运费模版设置',
|
|
12
|
+
redirect: '/delivery/freight_set',
|
|
13
|
+
meta: {
|
|
14
|
+
title: '运费模版设置',
|
|
15
|
+
icon: 'xdicon_kuaidi',
|
|
16
|
+
iconSize: 21,
|
|
17
|
+
roles: [freight_set.postageChangeGet]
|
|
18
|
+
},
|
|
19
|
+
children: [
|
|
20
|
+
{
|
|
21
|
+
path: 'freight_set',
|
|
22
|
+
name: 'freight_set',
|
|
23
|
+
component: () => import('@/viewsFreightSet/freight_set'),
|
|
24
|
+
meta: {
|
|
25
|
+
title: '运费模版设置',
|
|
26
|
+
icon: 'xdicon_kuaidi',
|
|
27
|
+
iconSize: 21,
|
|
28
|
+
roles: [freight_set.postageChangeGet, freight_set.postageChangeCreate, freight_set.postageChangeUpdate]
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export default freightSetRouter
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
name: 'freight_set',
|
|
5
|
+
title: '运费模版设置',
|
|
6
|
+
vuex: true,
|
|
7
|
+
model: [
|
|
8
|
+
{
|
|
9
|
+
title: '运费模版设置 - 详情',
|
|
10
|
+
mapFn: "postageChangeGet",
|
|
11
|
+
isPublic: true,
|
|
12
|
+
// #ifdef partner-mall
|
|
13
|
+
path: '/supplier-partner/v1/:xsiteid/:xnamespace/postage-change/get',
|
|
14
|
+
// #endif
|
|
15
|
+
// #ifdef supplier
|
|
16
|
+
path: '/supplier/v1/postage-change/get',
|
|
17
|
+
// #endif
|
|
18
|
+
isRule: false,
|
|
19
|
+
params: {
|
|
20
|
+
xsiteid: ['站点Id', 'String', '必填'],
|
|
21
|
+
xnamespace: ['命名空间', 'String', '必填'],
|
|
22
|
+
support_delivery: ['配送类型', 'String', '是']
|
|
23
|
+
},
|
|
24
|
+
disabled: true,
|
|
25
|
+
// #ifdef partner-mall
|
|
26
|
+
role: "ROLE_MARKET_EXPRESS_TEMP_INFO",
|
|
27
|
+
// #endif
|
|
28
|
+
// #ifdef supplier
|
|
29
|
+
role: '@@@.@@@.POSTAGE_CHANGE_GET',
|
|
30
|
+
// #endif
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
title: "运费模版设置 - 创建",
|
|
34
|
+
mapFn: "postageChangeCreate",
|
|
35
|
+
isPublic: true,
|
|
36
|
+
// #ifdef partner-mall
|
|
37
|
+
path: "/supplier-partner/v1/:xsiteid/:xnamespace/postage-change/add",
|
|
38
|
+
// #endif
|
|
39
|
+
// #ifdef supplier
|
|
40
|
+
path: '/supplier/v1/postage-change/add',
|
|
41
|
+
// #endif
|
|
42
|
+
isRule: false,
|
|
43
|
+
data: {
|
|
44
|
+
xsiteid: ['站点Id', 'String', '必填'],
|
|
45
|
+
xnamespace: ['命名空间', 'String', '必填'],
|
|
46
|
+
support_delivery: ['配送方式', 'String', '必填'],
|
|
47
|
+
change_json: ['form', 'Object', '必填'],
|
|
48
|
+
},
|
|
49
|
+
disabled: true,
|
|
50
|
+
// #ifdef partner-mall
|
|
51
|
+
role: "ROLE_MARKET_EXPRESS_TEMP_ADD",
|
|
52
|
+
// #endif
|
|
53
|
+
// #ifdef supplier
|
|
54
|
+
role: '@@@.@@@.POSTAGE_CHANGE_ADD',
|
|
55
|
+
// #endif
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
title: "运费模版设置 - 修改",
|
|
59
|
+
mapFn: "postageChangeUpdate",
|
|
60
|
+
isPublic: true,
|
|
61
|
+
// #ifdef partner-mall
|
|
62
|
+
path: "/supplier-partner/v1/:xsiteid/:xnamespace/postage-change/update",
|
|
63
|
+
// #endif
|
|
64
|
+
// #ifdef supplier
|
|
65
|
+
path: '/supplier/v1/postage-change/update',
|
|
66
|
+
// #endif
|
|
67
|
+
isRule: false,
|
|
68
|
+
data: {
|
|
69
|
+
xsiteid: ['站点Id', 'String', '必填'],
|
|
70
|
+
xnamespace: ['命名空间', 'String', '必填'],
|
|
71
|
+
support_delivery: ['配送方式', 'String', '必填'],
|
|
72
|
+
change_json: ['form', 'Object', '必填'],
|
|
73
|
+
change_id: ['运费模版设置id', 'Number', '必填'],
|
|
74
|
+
},
|
|
75
|
+
disabled: true,
|
|
76
|
+
// #ifdef partner-mall
|
|
77
|
+
role: "ROLE_MARKET_EXPRESS_TEMP_UPDATE",
|
|
78
|
+
// #endif
|
|
79
|
+
// #ifdef supplier
|
|
80
|
+
role: '@@@.@@@.POSTAGE_CHANGE_UPDATE',
|
|
81
|
+
// #endif
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
}
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="app-container">
|
|
3
|
+
<div class="app-container__title"></div>
|
|
4
|
+
<el-card class="app-container__search">
|
|
5
|
+
<xd-search
|
|
6
|
+
:list="searchForm"
|
|
7
|
+
labelWidth="100px"
|
|
8
|
+
:time-type="true"
|
|
9
|
+
v-model="searchParams"
|
|
10
|
+
@onSearch="handleSearch"
|
|
11
|
+
@onDone="getList"
|
|
12
|
+
:mainFilter="searchFilter"
|
|
13
|
+
mainFilterKey="support_delivery"
|
|
14
|
+
:mainFilterIndex="mainFilterIndex"
|
|
15
|
+
@onTabClick="handleSearchTabClick"
|
|
16
|
+
:key="searchFormKey"
|
|
17
|
+
>
|
|
18
|
+
</xd-search>
|
|
19
|
+
</el-card>
|
|
20
|
+
<el-card class="app-container__list">
|
|
21
|
+
<xd-base-dynamic-field
|
|
22
|
+
v-if="formList!==null"
|
|
23
|
+
ref="form"
|
|
24
|
+
v-model="formParams"
|
|
25
|
+
label-width="100px"
|
|
26
|
+
:list="formList"
|
|
27
|
+
:key="renderFormKey"
|
|
28
|
+
size="medium"
|
|
29
|
+
@success="handleSuccess"
|
|
30
|
+
@onApiSuccessUrl="handleApiSuccessUrl"
|
|
31
|
+
@onGetParamsAndHeader="handleGetParamsAndHeader"
|
|
32
|
+
>
|
|
33
|
+
</xd-base-dynamic-field>
|
|
34
|
+
<div style="padding-left: 150px">
|
|
35
|
+
<el-button @click="handleConfirm" type="primary" v-permission="[Role.postageChangeCreate,Role.postageChangeUpdate]">确定</el-button>
|
|
36
|
+
</div>
|
|
37
|
+
</el-card>
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
</template>
|
|
41
|
+
|
|
42
|
+
<script>
|
|
43
|
+
import XdSearch from "@/components/XdSearch";
|
|
44
|
+
import XdBaseDynamicField from "@/components/XdBaseDynamicField";
|
|
45
|
+
import {mapActions} from 'vuex';
|
|
46
|
+
import {Loading} from 'element-ui';
|
|
47
|
+
import {getOptions} from "@/utils/options";
|
|
48
|
+
import checkPermission from "@/utils/permission";
|
|
49
|
+
import Role from "@/constant/modules/freight_set";
|
|
50
|
+
|
|
51
|
+
export default {
|
|
52
|
+
name: "freight_set",
|
|
53
|
+
components: {
|
|
54
|
+
XdSearch,
|
|
55
|
+
XdBaseDynamicField
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
data() {
|
|
59
|
+
return {
|
|
60
|
+
Role,
|
|
61
|
+
pageSize: 1,//当前页面数量
|
|
62
|
+
hasNextPage: true,
|
|
63
|
+
limit: 20,
|
|
64
|
+
|
|
65
|
+
searchForm: [], //搜索区域模块表单
|
|
66
|
+
searchParams: null, // 搜索参数
|
|
67
|
+
|
|
68
|
+
searchFilter: [],
|
|
69
|
+
mainFilterIndex: 0,
|
|
70
|
+
formList: null,
|
|
71
|
+
formParams: {},
|
|
72
|
+
renderFormKey: 'renderFormKey',
|
|
73
|
+
searchFormKey: 'searchFormKey',
|
|
74
|
+
isEdit: false,
|
|
75
|
+
changeJsonData: [],
|
|
76
|
+
change_id:null,
|
|
77
|
+
formData:null,
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
watch: {
|
|
81
|
+
'formParams.formula_unit': {
|
|
82
|
+
handler(n, o) {
|
|
83
|
+
console.log(n,o,'aaaaa')
|
|
84
|
+
if (n &&o && n != o) {
|
|
85
|
+
this.initFormList(this.formParams,true);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
// 'formParams.formula_value': {
|
|
90
|
+
// handler(n, o) {
|
|
91
|
+
// console.log(n,o, this.formParams,'nnnnn')
|
|
92
|
+
// if (n && n != o) {
|
|
93
|
+
// this.initFormList(this.formParams);
|
|
94
|
+
// }
|
|
95
|
+
// }
|
|
96
|
+
// },
|
|
97
|
+
|
|
98
|
+
'searchParams.support_delivery': {
|
|
99
|
+
handler(n, o) {
|
|
100
|
+
if (n && n != o) {
|
|
101
|
+
console.log(n, 'nnnnn')
|
|
102
|
+
this.postageChangeGet({support_delivery: n})
|
|
103
|
+
.then(res => {
|
|
104
|
+
console.log(res, 'res')
|
|
105
|
+
if (JSON.stringify(res.data) !== '{}') {
|
|
106
|
+
this.change_id = res.data.change_id;
|
|
107
|
+
this.isEdit = true;
|
|
108
|
+
this.formData = {};
|
|
109
|
+
this.formData.formula_unit = res.data.change_json.method;
|
|
110
|
+
this.formData.formula_value = res.data.change_json.value;
|
|
111
|
+
this.initFormList(this.formData,false)
|
|
112
|
+
} else {
|
|
113
|
+
this.initFormList({},false)
|
|
114
|
+
}
|
|
115
|
+
})
|
|
116
|
+
.catch(err => {
|
|
117
|
+
console.log(err, 'err')
|
|
118
|
+
})
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
created() {
|
|
124
|
+
getOptions(
|
|
125
|
+
// #ifdef partner-mall
|
|
126
|
+
{
|
|
127
|
+
server: 'supplier-partner',
|
|
128
|
+
fn: 'postage-change',
|
|
129
|
+
path: 'p3',
|
|
130
|
+
},
|
|
131
|
+
// #endif
|
|
132
|
+
// #ifdef supplier
|
|
133
|
+
{
|
|
134
|
+
server: 'supplier',
|
|
135
|
+
fn: 'postage-change',
|
|
136
|
+
path: 'p1',
|
|
137
|
+
}
|
|
138
|
+
// #endif
|
|
139
|
+
)
|
|
140
|
+
.then(res => {
|
|
141
|
+
console.log(res, 'aaaaa')
|
|
142
|
+
this.searchFilter = res.data.support_delivery
|
|
143
|
+
this.changeJsonData = res.data.change_json_method
|
|
144
|
+
this.searchFormKey = Date.now();
|
|
145
|
+
console.log(this.searchFilter, 'searchFilter')
|
|
146
|
+
})
|
|
147
|
+
.catch(err => {
|
|
148
|
+
console.log(err, 'err')
|
|
149
|
+
})
|
|
150
|
+
},
|
|
151
|
+
|
|
152
|
+
methods: {
|
|
153
|
+
...mapActions('freight_set', [
|
|
154
|
+
'postageChangeGet',
|
|
155
|
+
'postageChangeCreate',
|
|
156
|
+
'postageChangeUpdate',
|
|
157
|
+
]),
|
|
158
|
+
|
|
159
|
+
handleSearchTabClick(n) {
|
|
160
|
+
console.log("handleSearchTabClick", n);
|
|
161
|
+
this.$router.replace({query: this.$route.query, hash: n});
|
|
162
|
+
},
|
|
163
|
+
|
|
164
|
+
getList() {
|
|
165
|
+
console.log(this.searchParams, 'support_delivery')
|
|
166
|
+
},
|
|
167
|
+
initFormList(params, isWitch=false) {
|
|
168
|
+
let formList = [
|
|
169
|
+
//input
|
|
170
|
+
{
|
|
171
|
+
label: "调整方式",
|
|
172
|
+
ele: "xd-radio",
|
|
173
|
+
valueKey: "formula_unit",
|
|
174
|
+
value: params.formula_unit || "money",
|
|
175
|
+
list: this.changeJsonData
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
label: '',
|
|
179
|
+
ele: 'xd-input-unit',
|
|
180
|
+
valueKey: 'formula_value',
|
|
181
|
+
value: params.formula_unit===this.formData.formula_unit?this.formData.formula_value:'',
|
|
182
|
+
setting: {
|
|
183
|
+
unit: params.formula_unit == 'money' ? '元' : '%',
|
|
184
|
+
tips: params.formula_unit == 'money' ? '可设置正负值' : '可设置正负值',
|
|
185
|
+
pos: 'append'
|
|
186
|
+
},
|
|
187
|
+
rules: [
|
|
188
|
+
{required: true, message: params.formula_unit == 'money' ? '请输入金额' : '请输入比例', trigger: 'blur'},
|
|
189
|
+
],
|
|
190
|
+
},
|
|
191
|
+
// #ifdef supplier
|
|
192
|
+
{
|
|
193
|
+
label: "生效时间:",
|
|
194
|
+
ele: "xd-date-range",
|
|
195
|
+
valueKey: ["start_time", "end_time"],
|
|
196
|
+
value:
|
|
197
|
+
params.start_time && params.end_time
|
|
198
|
+
? [params.start_time * 1000, params.end_time * 1000]
|
|
199
|
+
: [],
|
|
200
|
+
format: "yyyy/MM/dd HH:mm:ss",
|
|
201
|
+
formatValue: "timestamp",
|
|
202
|
+
placeholder: ["生效开始时间", "生效截止时间"],
|
|
203
|
+
disabled: false,
|
|
204
|
+
className: "input40",
|
|
205
|
+
rules: [
|
|
206
|
+
{required: true, message:'请选择生效时间', trigger: 'blur'},
|
|
207
|
+
],
|
|
208
|
+
},
|
|
209
|
+
// #endif
|
|
210
|
+
];
|
|
211
|
+
this.formList = formList.filter(i => i);
|
|
212
|
+
this.renderFormKey = Date.now();
|
|
213
|
+
},
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* @description 搜索事件
|
|
217
|
+
* @param action 动作
|
|
218
|
+
* @param form 搜索请求参数
|
|
219
|
+
*/
|
|
220
|
+
handleSearch({action, form}) {
|
|
221
|
+
console.log(action, 'action')
|
|
222
|
+
},
|
|
223
|
+
/**保存**/
|
|
224
|
+
handleConfirm() {
|
|
225
|
+
console.log(this.formParams, 'this.formParams')
|
|
226
|
+
let data = {
|
|
227
|
+
change_json:{
|
|
228
|
+
method:'',
|
|
229
|
+
value:'',
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
data.support_delivery = this.searchParams.support_delivery;
|
|
234
|
+
data.change_json.method = this.formParams.formula_unit;
|
|
235
|
+
data.change_json.value = this.formParams.formula_value;
|
|
236
|
+
data.change_json = JSON.stringify(data.change_json)
|
|
237
|
+
if(this.formParams.start_time){
|
|
238
|
+
data.start_time = this.formParams.start_time/1000
|
|
239
|
+
}
|
|
240
|
+
if(this.formParams.end_time){
|
|
241
|
+
data.end_time = this.formParams.end_time/1000
|
|
242
|
+
}
|
|
243
|
+
if (this.isEdit) {
|
|
244
|
+
this.postageChangeUpdate(data)
|
|
245
|
+
.then(res => {
|
|
246
|
+
console.log(res, 'sss')
|
|
247
|
+
this.$message({
|
|
248
|
+
type:'success',
|
|
249
|
+
message:'操作成功'
|
|
250
|
+
})
|
|
251
|
+
}).catch(err => {
|
|
252
|
+
|
|
253
|
+
})
|
|
254
|
+
} else {
|
|
255
|
+
this.postageChangeCreate(data)
|
|
256
|
+
.then(res => {
|
|
257
|
+
console.log(res, 'sss')
|
|
258
|
+
this.$message({
|
|
259
|
+
type: 'success',
|
|
260
|
+
message: '操作成功'
|
|
261
|
+
})
|
|
262
|
+
}).catch(err => {
|
|
263
|
+
|
|
264
|
+
})
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
</script>
|
|
270
|
+
|
|
271
|
+
<style scoped lang="scss">
|
|
272
|
+
.app-container__title {
|
|
273
|
+
font-size: 16px;
|
|
274
|
+
line-height: 24px;
|
|
275
|
+
padding: 0 0 20px;
|
|
276
|
+
font-weight: bold;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
@media screen and (max-width: 768px) {
|
|
280
|
+
.app-container__title {
|
|
281
|
+
padding: 0 0 10px;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
</style>
|