12.31开源admin代码更新

This commit is contained in:
hejinfu1026
2021-12-31 15:58:40 +08:00
parent ad99c24532
commit f5a9772176
545 changed files with 9743 additions and 139371 deletions

View File

@@ -1,24 +1,139 @@
<template>
<div class="divBox">
<el-card class="box-card">
<div class="acea-row row-center-wrapper">
<el-button type="primary" @click="onClick">申请授权</el-button>
</div>
<div class="page_title">授权证书申请</div>
<div class="page_desc">您的支持是我们不断进步的动力商业授权更多是一个保障和附加的增值服务让您优先享受新版本的强大功能和安全保障</div>
<el-form ref="form" :model="form" label-width="80px" :rules="rules">
<el-form-item label="企业名称" prop="company_name">
<el-input v-model="form.company_name" placeholder="请填写您的企业名称"></el-input>
</el-form-item>
<el-form-item label="企业域名" prop="domain_name">
<el-input v-model="form.domain_name" placeholder="请输入域名格式baidu.com"></el-input>
</el-form-item>
<el-form-item label="订单号" prop="order_id">
<el-input v-model="form.order_id" placeholder="请输入您在淘宝或小程序购买的源码订单号"></el-input>
</el-form-item>
<el-form-item label="手机号" prop="phone">
<el-input v-model="form.phone" placeholder="负责人电话"></el-input>
</el-form-item>
<el-form-item label="授权产品">
<el-input value="java" disabled></el-input>
</el-form-item>
<el-form-item label="验证码" prop="captcha">
<div class="captcha">
<el-input
ref="username"
v-model="form.captcha"
style="width: 218px;"
prefix-icon="el-icon-message"
placeholder="验证码"
name="username"
type="text"
tabindex="3"
autocomplete="on"
/>
<div class="imgs" @click="getCaptcha()">
<img :src="captchs">
</div>
</div>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitForm('form')">提交</el-button>
<el-button @click="resetForm('form')">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</template>
<script>
export default {
name: "index",
methods:{
onClick() {
window.open('http://crmeb.com/web/auth/apply')
import {authCertSubmit} from '@/api/authInformation'
import {configSaveUniq} from '@/api/systemConfig'
import {Debounce} from '@/utils/validate'
export default {
name: "index",
data() {
return {
form: {
company_name: '',
domain_name:'',
order_id:'',
captcha:'',
phone:'',
label:22
},
captchs: 'http://authorize.crmeb.net/api/captchs/',
rules:{
company_name: [
{required: true, message: '请填写您的企业名称', trigger: 'blur'}
],
domain_name: [
{ required: true, message: '请输入域名格式baidu.com', trigger: 'blur' }
],
order_id: [
{ required: true, message: '请输入您购买的源码订单号', trigger: 'blur' }
],
phone: [
{ required: true, message: '请输入负责人电话', trigger: 'blur' }
],
captcha: [
{ required: true, message: '请输入验证码', trigger: 'blur' }
]
}
}
}
},
mounted(){
this.getCaptcha();
},
methods: {
getCaptcha(){
this.captchs = this.captchs + Date.parse(new Date());
},
submitForm:Debounce(function(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
authCertSubmit(this.form).then(res=>{
if(res.status === 200){
this.$modal.msgSuccess(res.msg);
configSaveUniq({key:'authHost',value:this.form.domain_name})
}else{
this.$modal.msgError(res.msg);
}
}).catch(res => {
this.getCaptcha();
return this.$modal.msgError(res.msg);
})
} else {
return false;
}
});
}),
resetForm(formName) {
this.$refs[formName].resetFields();
}
},
};
</script>
<style scoped>
<style scoped lang="scss">
.page_title{
text-align: center;
font-size: 30px;
padding:20px 0 20px;
}
.page_desc{
font-size: 18px;
text-align: center;
margin-bottom: 40px;
}
.captcha{
display: flex;
align-items: flex-start;
}
.imgs{
margin-left:20px;
img{
height: 36px;
}
}
</style>

View File

@@ -20,7 +20,8 @@
<!-- </el-form-item>-->
</el-form>
</div>
<el-button type="primary" size="mini" @click="handlerOpenEditData({},0)" v-if="((formData.id==55 || formData.name==='签到天数配置') && dataList.list.length<7) || (formData.id!=55|| formData.name!=='签到天数配置')">添加数据</el-button>
<el-button type="primary" size="mini" @click="handlerOpenEditData({},0)" v-hasPermi="['admin:system:group:data:save']">添加数据</el-button>
<!-- v-if="((formData.id==55 || formData.name==='签到天数配置') && dataList.list.length<7) || (formData.id!=55|| formData.name!=='签到天数配置')" -->
<el-dialog
:title="editDataConfig.isCreate === 0?'添加数据':'编辑数据'"
:visible.sync="editDataConfig.visible"
@@ -39,6 +40,7 @@
<el-table
:data="dataList.list"
style="width: 100%;margin-bottom: 20px;"
:header-cell-style=" {fontWeight:'bold'}"
>
<el-table-column label="编号" prop="id" />
<el-table-column
@@ -65,8 +67,8 @@
</el-table-column>
<el-table-column label="操作" width="200">
<template slot-scope="scope">
<el-button type="text" size="small" @click="handlerOpenEditData(scope.row,1)">编辑</el-button>
<el-button type="text" size="small" @click="handlerDelete(scope.row)">删除</el-button>
<el-button type="text" size="small" @click="handlerOpenEditData(scope.row,1)" v-hasPermi="['admin:system:group:data:update','admin:system:group:data:info']">编辑</el-button>
<el-button type="text" size="small" @click="handlerDelete(scope.row)" v-if="formMark !== 99" v-hasPermi="['admin:system:group:data:delete']">删除</el-button>
</template>
</el-table-column>
</el-table>
@@ -110,7 +112,8 @@ export default {
editData: {}
},
formConf: { fields: [] },
dataList: { list: [], total: 0 }
dataList: { list: [], total: 0 },
formMark:0
}
},
mounted() {
@@ -145,6 +148,7 @@ export default {
handlerGetFormConfig() { // 获取表单配置后生成table列
const _pram = { id: this.formData.formId }
systemFormConfigApi.getFormConfigInfo(_pram).then(data => {
this.formMark = parseInt(data.id);
this.formConf = JSON.parse(data.content)
})
},

View File

@@ -7,12 +7,8 @@
<el-form-item
label="状态"
prop="status"
:rules="[{ required: true, message:'正确操作状态', trigger:['change'] }]"
>
<el-switch
v-model="selfForm.status"
/>
:rules="[{ required: true, message:'正确操作状态', trigger:['change'] }]">
<el-switch v-model="selfForm.status"/>
</el-form-item>
</el-form>
<parser
@@ -30,6 +26,7 @@
import parser from '@/components/FormGenerator/components/parser/Parser'
import * as systemGroupDataApi from '@/api/systemGroupData.js'
import * as systemFormConfigApi from '@/api/systemFormConfig.js'
import {Debounce} from '@/utils/validate'
export default {
// name: "combineEdit"
components: { parser },
@@ -71,9 +68,9 @@ export default {
this.formConf = JSON.parse(data.content)
})
},
handlerSubmit(formValue) {
handlerSubmit:Debounce(function(formValue) {
this.isCreate === 0 ? this.handlerSave(formValue) : this.handlerEdit(formValue)
},
}),
handlerSave(formValue) {
const _pram = this.buildFormPram(formValue)
systemGroupDataApi.groupDataSave(_pram).then(data => {

View File

@@ -11,21 +11,22 @@
</el-form-item>
</el-form>
</div>
<el-button size="mini" type="primary" @click="handlerOpenEdit({},0)">添加数据组</el-button>
<el-button size="mini" type="primary" @click="handlerOpenEdit({},0)" v-hasPermi="['admin:system:group:save']">添加数据组</el-button>
</div>
<el-table
:data="dataList.list"
style="width: 100%;margin-bottom: 20px;"
size="mini"
highlight-current-row
:header-cell-style=" {fontWeight:'bold'}"
>
<el-table-column label="数据组名称" prop="name" min-width="150"/>
<el-table-column label="简介" prop="info" min-width="150"/>
<el-table-column label="操作" fixed="right" min-width="180">
<template slot-scope="scope">
<el-button size="small" type="text" @click="handleDataList(scope.row)">数据列表</el-button>
<el-button size="small" type="text" @click="handlerOpenEdit(scope.row, 1)">编辑</el-button>
<el-button size="small" type="text" @click="handleDelete(scope.row)">删除</el-button>
<el-button size="small" type="text" @click="handleDataList(scope.row)" v-hasPermi="['admin:system:group:data:list']">数据列表</el-button>
<el-button size="small" type="text" @click="handlerOpenEdit(scope.row, 1)" v-hasPermi="['admin:system:group:info','admin:system:group:update']">编辑</el-button>
<el-button size="small" type="text" @click="handleDelete(scope.row)" v-hasPermi="['admin:system:group:delete']">删除</el-button>
</template>
</el-table-column>
</el-table>

View File

@@ -37,6 +37,7 @@
<script>
import formConfigList from '@/views/maintain/formConfig'
import * as systemGroupApi from '@/api/systemGroup'
import {Debounce} from '@/utils/validate'
export default {
// name: "combinedDataEdit"
components: { formConfigList },
@@ -81,12 +82,12 @@ export default {
this.editPram.formId = this.selectedFormConfigData.id
this.selectFormDialogConfig.visible = false
},
handlerSubmit(form) {
handlerSubmit:Debounce(function(form) {
this.$refs[form].validate(result => {
if (!result) return
this.isCreate === 0 ? this.handlerSave(this.editPram) : this.handlerEdit(this.editPram)
})
},
}),
handlerSave(pram) {
systemGroupApi.groupSave(pram).then(data => {
this.$message.success('添加组合数据成功')

View File

@@ -53,6 +53,7 @@
<script>
import * as categoryApi from '@/api/categoryApi.js'
import * as selfUtil from '@/utils/ZBKJIutil.js'
import {Debounce} from '@/utils/validate'
export default {
// name: "configCategotyEdit"
props: {
@@ -120,12 +121,12 @@ export default {
this.editPram.extra = extra
}
},
handlerSubmit(formName) {
handlerSubmit:Debounce(function(formName) {
this.$refs[formName].validate((valid) => {
if (!valid) return
this.handlerSaveOrUpdate(this.isCreate === 0)
})
},
}),
handlerSaveOrUpdate(isSave) {
if (isSave) {
this.editPram.pid = this.prent.id

View File

@@ -14,7 +14,7 @@
</el-form-item>
</el-form>
</div>
<el-button size="mini" type="primary" @click="handlerEditData({},0)" v-if="!selectModel">创建表单</el-button>
<el-button size="mini" type="primary" @click="handlerEditData({},0)" v-if="!selectModel" v-hasPermi="['admin:system:form:save']">创建表单</el-button>
</div>
<el-table
:data="dataList.list"
@@ -22,6 +22,7 @@
size="mini"
class="table"
@current-change="handleCurrentRowChange"
:header-cell-style=" {fontWeight:'bold'}"
>
<el-table-column label="ID" prop="id" width="80"/>
<el-table-column label="名称" prop="name" min-width="180"/>
@@ -29,7 +30,7 @@
<el-table-column label="更新时间" prop="updateTime" min-width="200" />
<el-table-column v-if="!selectModel" label="操作" min-width="80" fixed="right">
<template slot-scope="scope">
<el-button type="text" size="small" @click="handlerEditData(scope.row,1)">编辑</el-button>
<el-button type="text" size="small" @click="handlerEditData(scope.row,1)" v-hasPermi="['admin:system:form:info']">编辑</el-button>
</template>
</el-table-column>
</el-table>

View File

@@ -0,0 +1,228 @@
<template>
<div class="divBox">
<el-card class="box-card">
<el-table
v-loading="listLoading"
:data="tableData"
size="mini"
class="table"
row-key="cityId"
highlight-current-row
border
lazy
:load="load"
:header-cell-style=" {fontWeight:'bold'}"
        :tree-props="{children: 'child', hasChildren: 'hasChildren'}"
>
<el-table-column
prop="cityId"
label="编号"
min-width="100"
/>
<el-table-column
prop="parentName"
label="上级名称"
min-width="100"
>
<!-- <div>{{ parentName }}</div> -->
</el-table-column>
<el-table-column
prop="name"
min-width="250"
label="地区名称"
>
</el-table-column>
<el-table-column
fixed="right"
min-width="80"
label="操作"
>
<template slot-scope="scope">
<el-button type="text" size="small" @click="editCity(scope.row)" v-hasPermi="['admin:system:city:update']">编辑</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
<el-dialog
title="提示"
:visible.sync="dialogVisible"
width="30%"
:before-close="handleClose"
>
<parser v-if="formShow" :form-conf="formConf" :form-edit-data="formData" :is-edit="isCreate === 1" @submit="submit" />
</el-dialog>
</div>
</template>
<script>
import parser from '@/components/FormGenerator/components/parser/Parser'
import * as systemFormConfigApi from '@/api/systemFormConfig.js'
import * as logistics from '@/api/logistics.js'
import {Debounce} from '@/utils/validate'
export default {
name: 'CityList',
components: { parser },
data() {
return {
// 表单
formConf: { fields: [] },
// 生成表单id
formId: 70,
tableData: [],
// 上级名称
parentName: '中国',
// 父级城市id
parentId: 0,
loading: false,
listLoading: true,
dialogVisible: false,
// 选中id
editId: 0,
formShow: false,
formData: {},
isCreate: 0,
}
},
created() {
this.getCityList()
},
methods: {
// 获取城市数据
getCityList() {
this.listLoading = true
logistics.cityList({
parentId: this.parentId
}).then(data => {
this.listLoading = false
let arr = [];
data.forEach((item) => {
let str = {};
str = item;
str.hasChildren = true;
str.parentName = '中国';
arr.push(str);
});
this.tableData = arr;
})
},
// 状态
cityStatus(e) {
logistics.updateStatus({
id: e.id,
cityId: e.cityId,
status: e.isShow
}).then(res => {
this.$message.success('操作成功')
}).catch(() => {
e.isShow = !e.isShow
})
},
// 编辑
editCity(item) {
this.$confirm('请勿频繁修改此配置项', '提示', {
confirmButtonText: '确定修改',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.editId = item.id
this.parentId = item.parentId;
const _pram = { id: this.formId }
systemFormConfigApi.getFormConfigInfo(_pram).then(data => {
this.formShow = false
this.isCreate = 0
this.getCityInfo()
this.dialogVisible = true
this.formConf = JSON.parse(data.content)
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消'
});
});
},
// 详情
getCityInfo() {
logistics.cityInfo({
id: this.editId
}).then(res => {
this.isCreate = 1
this.formData = res
this.formData.parentName = this.parentName
setTimeout(() => { // 让表单重复渲染待编辑数据
this.formShow = true
}, 80)
})
},
submit:Debounce(function(data) {
const param = {
id: this.editId,
parentId: this.parentId,
name: data.name
}
logistics.cityUpdate(param).then(res => {
this.$message.success('修改成功')
this.dialogVisible = false
// this.getCityList()
})
}),
// 关闭模态框
handleClose(done) {
this.formConf.fields = []
this.dialogVisible = false
},
load(tree, treeNode, resolve){
logistics.cityList({
parentId: tree.cityId,
}).then(data => {
let arr = [];
data.forEach((item) => {
let str = {};
str = item;
str.hasChildren = true; //给每个省市节点赋一个可展开的值
str.parentName = tree.name
this.parentName = tree.name
if(item.level == 2){
str.hasChildren = false;//当节点为三级时,不可展开
}
arr.push(str);
});
resolve(arr)
})
}
}
}
</script>
<style lang="scss" scoped>
.el-icon-plus {
margin-right: 5px;
}
.demo .el-switch__label {
position: absolute;
display: none;
color: #fff;
}
/*打开时文字位置设置*/
.demo .el-switch__label--right {
z-index: 1;
}
/*关闭时文字位置设置*/
.demo .el-switch__label--left {
z-index: 1;
left: 19px;
}
/*显示文字*/
.demo .el-switch__label.is-active {
display: block;
}
.demo.el-switch .el-switch__core,
.el-switch .el-switch__label {
width: 60px !important;
}
</style>

View File

@@ -0,0 +1,299 @@
<template>
<div class="divBox">
<el-card class="box-card">
<div slot="header" class="clearfix">
<div class="container">
<el-form ref="form" inline :model="form">
<el-form-item label="关键字:">
<el-input v-model="form.keywords" placeholder="请输入关键字" class="selWidth" size="small" clearable>
<el-button slot="append" size="small" icon="el-icon-search" @click="handlerSearch" v-hasPermi="['admin:express:list']"/>
</el-input>
</el-form-item>
</el-form>
</div>
<el-button type="primary" size="small" @click="addExpress" v-hasPermi="['admin:express:sync']">同步物流公司</el-button>
</div>
<el-table
v-loading="loading"
:data="tableData.list"
:header-cell-style=" {fontWeight:'bold'}"
>
<el-table-column
prop="id"
label="ID"
min-width="180"
/>
<el-table-column
label="物流公司名称"
min-width="150"
prop="name"
/>
<el-table-column
min-width="200"
label="编码"
prop="code"
/>
<el-table-column
min-width="100"
label="排序"
prop="sort"
sortable
/>
<el-table-column
label="是否显示"
min-width="100"
>
<template slot-scope="scope">
<el-switch
v-model="scope.row.isShow"
class="demo"
:active-value="true" :inactive-value="false"
active-text="开启"
inactive-text="关闭"
@change="bindStatus(scope.row)"
v-if="checkPermi(['admin:express:update:show'])"
/>
</template>
</el-table-column>
<el-table-column
prop="address"
fixed="right"
min-width="120"
label="操作"
>
<template slot-scope="scope">
<el-button v-if="scope.row.net" type="text" size="small" @click="bindEdit(scope.row)" v-hasPermi="['admin:express:info']">收件网点名称编辑</el-button>
<el-button v-else-if="scope.row.partnerId" type="text" size="small" @click="bindEdit(scope.row)" v-hasPermi="['admin:express:info']">月结账号编辑</el-button>
<el-button v-else type="text" size="small" @click="bindEdit(scope.row)" v-hasPermi="['admin:express:info']">编辑</el-button>
</template>
</el-table-column>
</el-table>`
<div class="block-pagination">
<el-pagination
:page-sizes="[20, 40, 60, 80]"
:page-size="tableData.limit"
:current-page="tableData.page"
layout="total, sizes, prev, pager, next, jumper"
:total="tableData.total"
@current-change="pageChange"
@size-change="handleSizeChange"
/>
</div>
</el-card>
<el-dialog
title="编辑物流公司"
:visible.sync="dialogVisible"
width="700px"
:before-close="handleClose"
>
<el-form :model="formData" :rules="rules" ref="formData" label-width="100px" class="demo-ruleForm">
<el-form-item label="月结账号" prop="account" v-if="formData.partnerId">
<el-input v-model="formData.account" placeholder="请输入月结账号"></el-input>
</el-form-item>
<el-form-item label="月结密码" prop="password" v-if="formData.partnerKey">
<el-input v-model="formData.password" placeholder="请输入月结密码"></el-input>
</el-form-item>
<el-form-item label="网点名称" prop="netName" v-if="formData.net">
<el-input v-model="formData.netName" placeholder="请输入网点名称"></el-input>
</el-form-item>
<el-form-item label="排序" prop="sort">
<el-input-number v-model="formData.sort" :min="0" :max="9999" label="排序"></el-input-number>
</el-form-item>
<el-form-item label="是否启用" prop="status">
<el-radio-group v-model="formData.status">
<el-radio :label="false">关闭</el-radio>
<el-radio :label="true">开启</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="submit('formData')" v-hasPermi="['admin:express:update']">确 定</el-button>
</span>
<!--<parser v-if="formShow" ref="formBox" class="formBox" :form-conf="formConf" :form-edit-data="formData" :is-edit="isCreate === 1" @submit="submit" />-->
</el-dialog>
</div>
</template>
<script>
import parser from '@/components/FormGenerator/components/parser/Parser'
import * as systemFormConfigApi from '@/api/systemFormConfig.js'
import * as logistics from '@/api/logistics.js'
import { checkPermi } from "@/utils/permission"; // 权限判断函数
import {Debounce} from '@/utils/validate'
export default {
name: 'CompanyList',
components: { parser },
data() {
return {
constants:this.$constants,
// 表单
formConf: { fields: [] },
form: {
keywords: ''
},
tableData: {},
page: 1,
limit: 20,
loading: false,
dialogVisible: false,
fromType: 'add',
formData: {
status: false
},
isCreate: 0,
formShow: false,
editId: 0,
rules: {
sort: [
{ required: true, message: '请输入排序', trigger: 'blur' },
],
account: [
{ required: true, message: '请输入月结账号', trigger: 'blur' },
],
password: [
{ required: true, message: '请输入月结密码', trigger: 'blur' },
],
netName: [
{ required: true, message: '请输入网点名称', trigger: 'blur' },
]
}
}
},
created() {
this.getExpressList()
},
methods: {
checkPermi,
handlerSearch() {
this.page = 1
this.getExpressList()
},
// 获取物流公司列表
getExpressList() {
this.loading = true
logistics.expressList({
page: this.page,
limit: this.limit,
keywords: this.form.keywords
}).then(res => {
this.loading = false
this.tableData = res
}).catch(()=>{
this.loading = false
})
},
// 物流开关
bindStatus(item) {
logistics.expressUpdateShow({
account: item.account,
code: item.code,
id: item.id,
isShow: item.isShow,
name: item.name,
sort: item.sort
}).then(res => {
this.$message.success('操作成功')
// this.getExpressList()
}).catch(() => {
item.isShow = !item.isShow
})
},
// 分页
pageChange(e) {
this.page = e
this.getExpressList()
},
handleSizeChange(e) {
this.limit = e
this.getExpressList()
},
// 添加物流公司
addExpress() {
logistics.expressSyncApi().then(data => {
this.page = 1
this.getExpressList()
})
},
// 删除物流公司
bindDelete(item) {
this.$modalSure().then(() => {
logistics.expressDelete({ id: item.id }).then(res => {
this.$message.success('删除成功')
this.getExpressList()
})
})
},
// 表单提交
submit:Debounce(function(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
logistics.expressUpdate(this.formData).then(res => {
this.$message.success('操作成功')
this.handleClose()
this.getExpressList()
})
} else {
return false;
}
});
}),
// 关闭模态框
handleClose(done) {
this.formShow = false
// this.formData = {}
this.formConf.fields = []
this.dialogVisible = false
this.isCreate = 0
},
// 编辑
bindEdit(item) {
this.dialogVisible = true
this.editId = item.id
logistics.expressInfo({ id: item.id }).then(res => {
this.formData = res
})
}
}
}
</script>
<style lang="scss" scoped>
.selWidth{
width: 350px;
}
.el-icon-plus {
margin-right: 5px;
}
.demo .el-switch__label {
position: absolute;
display: none;
color: #fff;
}
/*打开时文字位置设置*/
.demo .el-switch__label--right {
z-index: 1;
}
/*关闭时文字位置设置*/
.demo .el-switch__label--left {
z-index: 1;
left: 19px;
}
/*显示文字*/
.demo .el-switch__label.is-active {
display: block;
}
.demo.el-switch .el-switch__core,
.el-switch .el-switch__label {
width: 60px !important;
}
.formBox{
.el-input-number--medium{
width: 100px;
}
}
</style>

View File

@@ -0,0 +1,13 @@
<template>
<div>
<router-view />
</div>
</template>
<script>
export default {}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,508 @@
<template>
<el-dialog
v-if="dialogVisible"
title="运费模板"
:visible.sync="dialogVisible"
width="1000px"
:before-close="handleClose"
>
<el-form ref="ruleForm" :model="ruleForm" label-width="120px" size="mini" v-if="dialogVisible" :rules="rules">
<el-form-item label="模板名称" prop="name">
<el-input v-model="ruleForm.name" class="withs" placeholder="请输入模板名称" />
</el-form-item>
<el-form-item label="计费方式" prop="type">
<el-radio-group v-model="ruleForm.type" @change="changeRadio(ruleForm.type)">
<el-radio :label="1">按件数</el-radio>
<el-radio :label="2">按重量</el-radio>
<el-radio :label="3">按体积</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="配送区域及运费" prop="region">
<el-table v-loading="listLoading" :data="ruleForm.region" border fit highlight-current-row style="width: 100%" size="mini" class="tempBox">
<el-table-column align="center" label="可配送区域" min-width="260">
<template slot-scope="scope">
<span v-if="scope.$index === 0">默认全国</span>
<el-cascader
v-else
v-model="scope.row.city_ids"
style="width: 98%"
:options="cityList"
:props="props"
collapse-tags
clearable
filterable
@change="changeRegion"
/>
</template>
</el-table-column>
<el-table-column min-width="130px" align="center" :label="columns.title" prop="first">
<template slot-scope="scope">
<el-form-item :rules="rules.first" :prop="'region.'+scope.$index+'.first'">
<el-input-number v-model="scope.row.first" controls-position="right" :step-strictly="ruleForm.type===1?true:false" :min="ruleForm.type===1?1:0.1"/>
</el-form-item>
</template>
</el-table-column>
<el-table-column min-width="120px" align="center" label="运费(元)" prop="firstPrice">
<template slot-scope="scope">
<el-form-item :rules="rules.firstPrice" :prop="'region.'+scope.$index+'.firstPrice'">
<el-input-number v-model="scope.row.firstPrice" controls-position="right" />
</el-form-item>
</template>
</el-table-column>
<el-table-column min-width="120px" align="center" :label="columns.title2" prop="renewal">
<template slot-scope="scope">
<el-form-item :rules="rules.renewal" :prop="'region.'+scope.$index+'.renewal'">
<el-input-number v-model="scope.row.renewal" controls-position="right" :step-strictly="ruleForm.type===1?true:false" :min="ruleForm.type===1?1:0.1"/>
</el-form-item>
</template>
</el-table-column>
<el-table-column class-name="status-col" align="center" label="续费(元)" min-width="120" prop="renewalPrice">
<template slot-scope="scope">
<el-form-item :rules="rules.renewalPrice" :prop="'region.'+scope.$index+'.renewalPrice'">
<el-input-number v-model="scope.row.renewalPrice" controls-position="right" />
</el-form-item>
</template>
</el-table-column>
<el-table-column align="center" label="操作" min-width="80">
<template slot-scope="scope">
<el-button
v-if="scope.$index > 0"
type="text"
size="small"
@click="confirmEdit(ruleForm.region,scope.$index)"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
</el-form-item>
<el-form-item>
<el-button type="primary" size="mini" icon="el-icon-edit" @click="addRegion(ruleForm.region)">
添加配送区域
</el-button>
</el-form-item>
<el-form-item label="指定包邮" prop="appoint">
<el-radio-group v-model="ruleForm.appoint">
<el-radio :label="true">开启</el-radio>
<el-radio :label="false">关闭</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item v-if="ruleForm.appoint === true" prop="free">
<el-table v-loading="listLoading" :data="ruleForm.free" border fit highlight-current-row style="width: 100%" size="mini">
<el-table-column align="center" label="选择地区" min-width="220">
<template slot-scope="{row}">
<el-cascader
v-model="row.city_ids"
style="width: 95%"
:options="cityList"
:props="props"
collapse-tags
clearable
/>
</template>
</el-table-column>
<el-table-column min-width="180px" align="center" :label="columns.title3">
<template slot-scope="{row}">
<el-input-number v-model="row.number" controls-position="right" :step-strictly="ruleForm.type===1?true:false" :min="ruleForm.type===1?1:0.1"/>
</template>
</el-table-column>
<el-table-column min-width="120px" align="center" label="包邮金额(元)">
<template slot-scope="{row}">
<el-input-number v-model="row.price" controls-position="right" />
</template>
</el-table-column>
<el-table-column align="center" label="操作" min-width="120">
<template slot-scope="scope">
<el-button
type="text"
size="small"
@click="confirmEdit(ruleForm.free,scope.$index)"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
</el-form-item>
<el-form-item v-if="ruleForm.appoint === true">
<el-button type="primary" size="mini" icon="el-icon-edit" @click="addFree(ruleForm.free)">
添加指定包邮区域
</el-button>
</el-form-item>
<!--<el-row :gutter="20">-->
<!--<el-col :span="7">-->
<!--<el-form-item label="指定区域不配送" prop="undelivery">-->
<!--<el-radio-group v-model="ruleForm.undelivery">-->
<!--<el-radio :label="1">开启</el-radio>-->
<!--<el-radio :label="0">关闭</el-radio>-->
<!--</el-radio-group>-->
<!--</el-form-item>-->
<!--</el-col>-->
<!--<el-col :span="14">-->
<!--<el-form-item v-if="ruleForm.undelivery === 1" class="noBox" prop="city_id3">-->
<!--<el-cascader-->
<!--v-model="ruleForm.city_id3"-->
<!--placeholder="请选择不配送区域"-->
<!--:options="cityList"-->
<!--:props="props"-->
<!--collapse-tags-->
<!--clearable-->
<!--style="width: 46%"-->
<!--/>-->
<!--</el-form-item>-->
<!--</el-col>-->
<!--</el-row>-->
<el-form-item label="排序">
<el-input v-model="ruleForm.sort" class="withs" placeholder="请输入排序" />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="onClose('ruleForm')"> </el-button>
<el-button type="primary" :loading="loading" @click="onsubmit('ruleForm')"> </el-button>
</span>
</el-dialog>
</template>
<script>
import * as logistics from '@/api/logistics'
import { Loading } from 'element-ui'
const defaultRole = {
name: '',
type: 1,
appoint: false,
sort: 0,
region: [{
first: 0,
firstPrice: 0,
renewal: 0,
renewalPrice: 0,
city_ids: []
}],
undelivery: 0,
free: [],
undelives: {},
city_id3: []
}
const kg = '重量kg'
const m = '体积'
const statusMap = [
{
title: '首件',
title2: '续件',
title3: '包邮件数'
},
{
title: `首件${kg}`,
title2: `续件${kg}`,
title3: `包邮${kg}`
},
{
title: `首件${m}`,
title2: `续件${m}`,
title3: `包邮${m}`
}
]
export default {
name: 'CreatTemplates',
components: {
},
data() {
return {
loading : false,
rules: {
name: [
{ required: true, message: '请输入模板名称', trigger: 'blur' }
],
free: [
{ type: 'array', required: true, message: '请至少添加一个地区', trigger: 'change' }
],
appoint: [
{ required: true, message: '请选择是否指定包邮', trigger: 'change' }
],
undelivery: [
{ required: true, message: '请选择是否指定区域不配送', trigger: 'change' }
],
type: [
{ required: true, message: '请选择计费方式', trigger: 'change' }
],
region: [
{ required: true, message: '请选择活动区域', trigger: 'change' }
],
city_id3: [
{ type: 'array', required: true, message: '请至少选择一个地区', trigger: 'change' }
],
first: [
{ required: true, message: '请输入', trigger: 'blur' }
],
renewal: [
{ required: true, message: '请输入', trigger: 'blur' }
],
firstPrice: [
{ required: true, message: '请输入运费', trigger: 'blur' }
],
renewalPrice: [
{ required: true, message: '请输入续费', trigger: 'blur' }
]
},
nodeKey: 'city_id',
props: {
children: 'child',
label: 'name',
value: 'cityId',
multiple: true
},
dialogVisible: false,
ruleForm: Object.assign({}, defaultRole),
listLoading: false,
cityList: [],
columns: {
title: '首件',
title2: '续件',
title3: '包邮件数'
},
tempId: 0,
type: 0 // 0添加 1编辑
}
},
mounted() {
setTimeout(()=>{
let cityList = JSON.parse(sessionStorage.getItem('cityList'));
this.cityList = cityList;
},1000);
},
methods: {
changType(type) {
this.type = type
},
onClose(formName) {
this.dialogVisible = false
this.$refs[formName].resetFields()
},
confirmEdit(row, index) {
row.splice(index, 1)
},
popoverHide() {},
handleClose() {
// this.$refs['ruleForm'].resetFields()
this.dialogVisible = false
this.ruleForm={
name: '',
type: 1,
appoint: false,
sort: 0,
region: [{
first: 0,
firstPrice: 0,
renewal: 0,
renewalPrice: 0,
city_ids: []
}],
undelivery: 0,
free: [],
undelives: {},
city_id3: []
}
},
changeRegion(value) {
console.log(value)
},
changeRadio(num) {
this.columns = Object.assign({}, statusMap[num - 1])
},
// 添加配送区域
addRegion(region) {
region.push(Object.assign({}, {
first: 0,
firstPrice: 0,
renewal: 0,
renewalPrice: 0,
city_ids: []
}))
},
addFree(Free) {
Free.push(Object.assign({}, {
city_id: [],
number: 1,
price: 1,
city_ids: []
}))
},
/**
* 详情
* id 模板id
* appoint true包邮 false不包邮
**/
getInfo(id, appoint) {
this.tempId = id
const loadingInstance = Loading.service({ fullscreen: true })
logistics.templateDetailApi({ id }).then(res => {
this.dialogVisible = true
const info = res
this.ruleForm = Object.assign(this.ruleForm, {
name: info.name,
type: info.type,
appoint: info.appoint,
sort: info.sort
})
this.columns = Object.assign({}, statusMap[this.ruleForm.type - 1])
this.$nextTick(() => {
loadingInstance.close()
})
// 不包邮地区
this.shippingRegion()
// 包邮地区
if (info.appoint) {
this.shippingFree()
}
}).catch(res => {
// console.integralLog(res)
this.$message.error(res.message)
this.$nextTick(() => {
loadingInstance.close()
})
})
},
// 不包邮
shippingRegion() {
logistics.shippingRegion({ tempId: this.tempId }).then(res => {
res.forEach((item, index) => {
item.title = JSON.parse(item.title)
item.city_ids = item.title
})
this.ruleForm.region = res
})
},
// 包邮
shippingFree() {
logistics.shippingFree({ tempId: this.tempId }).then(res => {
res.forEach((item, index) => {
item.title = JSON.parse(item.title)
item.city_ids = item.title
})
this.ruleForm.free = res
})
},
// 列表
getCityList() {
logistics.cityListTree().then(res => {
sessionStorage.setItem('cityList',JSON.stringify(res));
let cityList = JSON.parse(sessionStorage.getItem('cityList'));
this.cityList = cityList;
}).catch(res => {
this.$message.error(res.message)
})
},
change(idBox) {
idBox.map(item => {
const ids = []
item.city_ids.map(j => {
j.splice(0, 1)
ids.push(j[0])
})
item.city_id = ids
})
return idBox
},
changeOne(idBox) {
const city_ids = []
idBox.map(item => {
item.splice(0, 1)
city_ids.push(item[0])
})
return city_ids
},
onsubmit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.loading = true;
const param = {
appoint: this.ruleForm.appoint,
name: this.ruleForm.name,
sort: this.ruleForm.sort,
type: this.ruleForm.type,
// 配送区域及运费
// shippingTemplatesRegionRequestList: [],
// // 指定包邮设置
// shippingTemplatesFreeRequestList: []
}
this.ruleForm.region.forEach((el, index) => {
el.title = el.city_ids.length > 0 ? JSON.stringify(el.city_ids) : JSON.stringify([[0, 0]])
for (var i = 0; i < el.city_ids.length; i++) {
el.city_ids[i].shift()
}
el.cityId = el.city_ids.length > 0 ? el.city_ids.join(',') : 'all'
})
param.shippingTemplatesRegionRequestList = this.ruleForm.region
param.shippingTemplatesRegionRequestList.forEach((el, index) => {
// delete el.city_ids
// delete el.city_id
})
if (this.ruleForm.appoint) {
this.ruleForm.free.forEach((el, index) => {
el.title = el.city_ids.length > 0 ? JSON.stringify(el.city_ids) : JSON.stringify([[0, 0]])
for (var i = 0; i < el.city_ids.length; i++) {
el.city_ids[i].shift()
}
el.cityId = el.city_ids.length > 0 ? el.city_ids.join(',') : 'all'
})
param.shippingTemplatesFreeRequestList = this.ruleForm.free
param.shippingTemplatesFreeRequestList.forEach((el, index) => {
// delete el.city_ids
// delete el.city_id
})
}
if (this.type === 0) {
logistics.shippingSave(param).then(res => {
this.$message.success('操作成功')
this.handleClose()
this.$nextTick(() => {
this.dialogVisible = false
})
setTimeout(() => {
this.$emit('getList')
}, 600)
this.loading = false;
})
} else {
logistics.shippingUpdate(param, { id: this.tempId }).then(res => {
this.$message.success('操作成功')
setTimeout(() => {
this.$emit('getList')
this.handleClose()
}, 600)
this.$nextTick(() => {
this.dialogVisible = false
})
this.loading = false;
})
}
} else {
return false
}
})
},
clear() {
this.ruleForm.name = ''
this.ruleForm.sort = 0
}
}
}
</script>
<style scoped lang="scss">
.withs{
width: 50%;
}
.noBox{
/deep/.el-form-item__content{
margin-left: 0 !important;
}
}
.tempBox{
/deep/.el-input-number--mini{
width: 100px !important;
}
}
</style>

View File

@@ -0,0 +1,187 @@
<template>
<div class="divBox">
<el-card class="box-card">
<div slot="header" class="clearfix">
<div class="container">
<el-form ref="form" inline :model="form">
<el-form-item label="模板名称:">
<el-input v-model="form.keywords" placeholder="请输入模板名称" class="selWidth" size="small" clearable>
<el-button slot="append" icon="el-icon-search" @click="handleSearch" v-hasPermi="['admin:shipping:templates:list']" />
</el-input>
</el-form-item>
</el-form>
</div>
<el-button type="primary" size="mini" @click="handleSubmit()" v-hasPermi="['admin:shipping:templates:save']">添加运费模板</el-button>
</div>
<el-table
v-loading="loading"
:data="tableData.list"
style="width: 100%"
size="small"
:header-cell-style=" {fontWeight:'bold'}"
>
<el-table-column
prop="id"
label="ID"
min-width="60"
/>
<el-table-column
label="模板名称"
min-width="180"
prop="name"
/>
<el-table-column
min-width="100"
label="计费方式"
prop="type"
>
<template slot-scope="{row}">
<p>{{ row.type | typeFilter }}</p>
</template>
</el-table-column>
<el-table-column
min-width="100"
label="指定包邮"
prop="appoint"
>
<template slot-scope="{row}">
<p>{{ row.appoint | statusFilter }}</p>
</template>
</el-table-column>
<el-table-column
label="排序"
min-width="100"
prop="sort"
/>
<el-table-column
label="添加时间"
min-width="150"
prop="createTime"
/>
<el-table-column
prop="address"
fixed="right"
width="120"
label="操作"
>
<template slot-scope="scope">
<el-button type="text" size="small" @click="bindEdit(scope.row)" v-hasPermi="['admin:shipping:templates:info']">修改</el-button>
<el-button type="text" size="small" @click="bindDelete(scope.row)" v-hasPermi="['admin:shipping:templates:delete']">删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="block-pagination">
<el-pagination
:page-sizes="[20, 40, 60, 80]"
:page-size="tableData.limit"
:current-page="tableData.page"
layout="total, sizes, prev, pager, next, jumper"
:total="tableData.total"
@current-change="pageChange"
@size-change="handleSizeChange"
/>
</div>
</el-card>
<CreatTemplates ref="addTemplates" @getList="getList"/>
</div>
</template>
<script>
import CreatTemplates from './creatTemplates'
import * as logistics from '@/api/logistics.js'
export default {
name: 'ShippingTemplates',
filters: {
statusFilter(status) {
const statusMap = {
true: '开启',
false: '关闭'
}
return statusMap[status]
},
typeFilter(status) {
const statusMap = {
1: '按件数',
2: '按重量',
3: '按体积'
}
return statusMap[status]
}
},
components: { CreatTemplates },
data() {
return {
isShow: false,
dialogVisible: false,
form: {
keywords: ''
},
tableData: '',
page: 1,
limit: 20,
loading: false
}
},
created() {
this.getDataList()
},
methods: {
// 添加
handleSubmit() {
this.$refs.addTemplates.dialogVisible = true
this.$refs.addTemplates.getCityList()
this.$refs.addTemplates.changType(0)
},
handleSearch() {
this.page = 1
this.getDataList()
},
// 分页
pageChange(e) {
this.page = e
this.getDataList()
},
handleSizeChange(e) {
this.limit = e
this.getDataList()
},
// 数据列表
getDataList() {
this.loading = true
logistics.shippingTemplatesList({
keywords: this.form.keywords,
page: this.page,
limit: this.limit
}).then(res => {
this.loading = false
this.tableData = res
})
},
// 编辑
bindEdit(item) {
this.$refs.addTemplates.getCityList()
this.$refs.addTemplates.getInfo(item.id, item.appoint)
this.$refs.addTemplates.changType(1)
},
// 删除
bindDelete(item) {
this.$modalSure().then(() => {
logistics.shippingDetete({ id: item.id }).then(res => {
this.$message.success('删除成功')
this.getDataList()
})
})
// logistics.shippingDetete()
},
getList() {
this.getDataList()
}
}
}
</script>
<style scoped lang="scss">
.selWidth{
width: 350px;
}
</style>

View File

@@ -14,7 +14,7 @@
<el-form-item label="新密码" prop="pwd">
<el-input
v-model="pram.pwd"
placeholder="管理员密码,不更改可以不填写"
placeholder="管理员密码"
clearable
@input="handlerPwdInput"
@clear="handlerPwdInput"
@@ -35,6 +35,7 @@
<script>
import * as systemAdminApi from '@/api/systemadmin.js'
import Cookies from 'js-cookie'
import {Debounce} from '@/utils/validate'
export default {
name: "index",
data() {
@@ -47,15 +48,16 @@
callback()
}
}
const JavaInfo = JSON.parse(Cookies.get('JavaInfo'));
return {
password: '',
JavaInfo: JSON.parse(Cookies.get('JavaInfo')),
pram: {
account: JSON.parse(Cookies.get('JavaInfo')).account,
account:JavaInfo.account,
pwd: null,
repwd: null,
realName: null,
id: JSON.parse(Cookies.get('JavaInfo')).id
realName: JavaInfo.realName,
id: JavaInfo.id
},
roleList: [],
rules: {
@@ -63,7 +65,6 @@
pwd: [{ required: true, message: '请填管理员密码', trigger: ['blur', 'change'] }],
repwd: [{ required: true, message: '确认密码密码', validator: validatePass, trigger: ['blur', 'change'] }],
realName: [{ required: true, message: '管理员姓名', trigger: ['blur', 'change'] }],
roles: [{ required: true, message: '管理员身份', trigger: ['blur', 'change'] }]
}
}
},
@@ -71,17 +72,18 @@
close(formName) {
this.$refs[formName].resetFields();
},
handlerSubmit(formName) {
handlerSubmit:Debounce(function(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
systemAdminApi.adminUpdate(this.pram).then(data => {
this.$message.success('提交成功')
this.$router.go(-1)
})
} else {
return false;
}
});
},
}),
handlerPwdInput(val) {
if (!val) {
this.rules.pwd = []