|
@@ -1,580 +1,328 @@
|
|
<template>
|
|
<template>
|
|
- <div class="app-container">
|
|
|
|
- <div class="filter-container">
|
|
|
|
- <span>机构名称:</span>
|
|
|
|
- <el-input v-model="listQuery.authParty" placeholder="机构名称" style="width: 280px;" class="filter-item" @keyup.enter.native="handleFilter" />
|
|
|
|
- <span>审核状态:</span>
|
|
|
|
- <el-select
|
|
|
|
- v-model="listQuery.auditStatus"
|
|
|
|
- placeholder="审核状态"
|
|
|
|
- clearable
|
|
|
|
- style="width: 200px"
|
|
|
|
- class="filter-item"
|
|
|
|
- @change="getList"
|
|
|
|
- >
|
|
|
|
- <el-option label="全部" value="" />
|
|
|
|
- <el-option label="待审核" :value="2" />
|
|
|
|
- <el-option label="审核通过" :value="1" />
|
|
|
|
- <el-option label="审核未通过" :value="0" />
|
|
|
|
- </el-select>
|
|
|
|
- <span>上线状态:</span>
|
|
|
|
- <el-select
|
|
|
|
- v-model="listQuery.status"
|
|
|
|
- placeholder="上线状态"
|
|
|
|
- clearable
|
|
|
|
- style="width: 200px"
|
|
|
|
- class="filter-item"
|
|
|
|
- @change="getList"
|
|
|
|
- >
|
|
|
|
- <el-option label="全部" value="" />
|
|
|
|
- <el-option label="已上线" :value="1" />
|
|
|
|
- <el-option label="待上线" :value="2" />
|
|
|
|
- <el-option label="未上线" :value="0" />
|
|
|
|
- </el-select>
|
|
|
|
-
|
|
|
|
- <el-button icon="el-icon-search" type="primary" @click="getList">查询</el-button>
|
|
|
|
- <!-- <el-button v-if="isProxy" icon="el-icon-edit" type="primary" @click="handleShowEditDialog('添加品牌授权')">添加品牌授权</el-button> -->
|
|
|
|
- <el-button v-if="isProxy" icon="el-icon-edit" type="primary" @click="$_navigationTo('/auth/auth-add')">添加</el-button>
|
|
|
|
- <el-button icon="el-icon-upload" type="primary" @click="improtDialogVisible = true">导入</el-button>
|
|
|
|
- <el-button icon="el-icon-document" type="primary" @click="handleExportExcel">导出</el-button>
|
|
|
|
- <el-button icon="el-icon-document-copy" type="primary" @click="downLoadExportExcel">获取导入模板</el-button>
|
|
|
|
- <el-button type="primary" icon="el-icon-download" @click="handleExport(1)">一键下载授权牌</el-button>
|
|
|
|
- <el-button type="primary" icon="el-icon-download" @click="handleExport(2)">一键下载二维码</el-button>
|
|
|
|
|
|
+ <div class="club-edit">
|
|
|
|
+ <el-form ref="submitForm" class="club-edit-form" label-width="120px" :model="formData" :rules="rules">
|
|
|
|
+ <el-form-item label="机构名称:" prop="name">
|
|
|
|
+ <el-input v-model="formData.name" placeholder="请输入机构名称" />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="所在地区:" prop="address">
|
|
|
|
+ <el-cascader
|
|
|
|
+ ref="cascader"
|
|
|
|
+ v-model="formData.address"
|
|
|
|
+ :class="{ display: cascaderDisplay }"
|
|
|
|
+ clearable
|
|
|
|
+ :props="cascaderProps"
|
|
|
|
+ style="width: 100%"
|
|
|
|
+ :placeholder="cascaderPlaceholder"
|
|
|
|
+ @change="handleChange"
|
|
|
|
+ />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="详细地址:" prop="fullAddress">
|
|
|
|
+ <el-input v-model="formData.fullAddress" placeholder="请输入详细地址" />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="经纬度:" prop="point">
|
|
|
|
+ <el-input v-model="formData.point" placeholder="请输入经纬度 (格式:纬度,经度,可通过右侧地图小按钮获取)">
|
|
|
|
+ <el-button slot="append" icon="el-icon-map-location" @click="dialogMapVisible = true" />
|
|
|
|
+ </el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="联系方式:" prop="mobile">
|
|
|
|
+ <el-input v-model="formData.mobile" placeholder="请输入联系方式" />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="机构logo:" prop="logoImage">
|
|
|
|
+ <el-input v-show="false" v-model="formData.logoImage" />
|
|
|
|
+ <upload-image
|
|
|
|
+ tip="建议尺寸:242px * 242px"
|
|
|
|
+ :image-list="logoList"
|
|
|
|
+ :before-upload="beforeLogoUpload"
|
|
|
|
+ @success="uploadLogoSuccess"
|
|
|
|
+ @remove="handleLogoRemove"
|
|
|
|
+ />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="轮播图:" prop="banner">
|
|
|
|
+ <el-input v-show="false" v-model="formData.banner" />
|
|
|
|
+ <upload-image
|
|
|
|
+ tip="至少上传一张,最多6张;建议尺寸:542px * 542px"
|
|
|
|
+ :image-list="bannerList"
|
|
|
|
+ :before-upload="beforeBannerUpload"
|
|
|
|
+ :limit="6"
|
|
|
|
+ @success="uploadBannerSuccess"
|
|
|
|
+ @remove="handleBannerRemove"
|
|
|
|
+ />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-form>
|
|
|
|
+ <div class="submit-btn">
|
|
|
|
+ <el-button type="primary" @click="submit">保存</el-button>
|
|
|
|
+ <el-button type="warning" @click="$_back()">返回</el-button>
|
|
</div>
|
|
</div>
|
|
- <!-- 表格区域 -->
|
|
|
|
- <el-table
|
|
|
|
- :key="tableKey"
|
|
|
|
- v-loading="listLoading"
|
|
|
|
- :data="list"
|
|
|
|
- border
|
|
|
|
- fit
|
|
|
|
- highlight-current-row
|
|
|
|
- style="width: 100%;"
|
|
|
|
- header-row-class-name="tableHeader"
|
|
|
|
- >
|
|
|
|
- <el-table-column label="序号" :index="indexMethod" align="center" width="80" type="index" />
|
|
|
|
-
|
|
|
|
- <el-table-column label="机构名称" align="center" prop="authParty" />
|
|
|
|
-
|
|
|
|
- <el-table-column label="审核状态" width="160px" align="center">
|
|
|
|
- <template slot-scope="{ row }">
|
|
|
|
- <el-tag v-if="row.auditStatus === 2" size="small" type="warning">待审核</el-tag>
|
|
|
|
- <el-tag v-if="row.auditStatus === 1" size="small" type="success">审核通过</el-tag>
|
|
|
|
- <!-- 未通过原因展示 -->
|
|
|
|
- <template v-if="row.auditStatus === 0">
|
|
|
|
- <!-- <span class="status danger">审核未通过 </span> -->
|
|
|
|
- <el-popover
|
|
|
|
- placement="top-start"
|
|
|
|
- title="审核说明"
|
|
|
|
- width="400"
|
|
|
|
- trigger="hover"
|
|
|
|
- :content="row.invalidReason"
|
|
|
|
- >
|
|
|
|
- <el-tag slot="reference" size="small" type="danger" class="reason">
|
|
|
|
- <span>审核未通过</span>
|
|
|
|
- <span class="el-icon-question status danger " />
|
|
|
|
- </el-tag>
|
|
|
|
- </el-popover>
|
|
|
|
- <!-- 未通过原因展示END -->
|
|
|
|
- </template>
|
|
|
|
- </template>
|
|
|
|
- </el-table-column>
|
|
|
|
-
|
|
|
|
- <el-table-column label="上线状态" width="260px" align="center">
|
|
|
|
- <template slot-scope="{row}">
|
|
|
|
- <!-- 只有审核通过了才能操作上下线 auditStatus :审核状态 -->
|
|
|
|
- <template v-if="row.auditStatus === 1">
|
|
|
|
- <template v-if="row.status === 0">
|
|
|
|
- <span style="margin-right:10px;" class="status danger">已下线</span>
|
|
|
|
- <el-button v-if="isProxy" type="primary" size="mini" @click="handleChangeStatus(row)">上线</el-button>
|
|
|
|
- </template>
|
|
|
|
- <template v-else>
|
|
|
|
- <span style="margin-right:10px;" class="status success ">已上线</span>
|
|
|
|
- <el-button v-if="isProxy" type="info" size="mini" @click="handleChangeStatus(row)">下线</el-button>
|
|
|
|
- </template>
|
|
|
|
- </template>
|
|
|
|
- <template v-else>
|
|
|
|
- <!-- <el-tag type="warning">待上线</el-tag> -->
|
|
|
|
- <span style="margin-right:10px;" class="status warning">待上线</span>
|
|
|
|
- </template>
|
|
|
|
- </template>
|
|
|
|
- </el-table-column>
|
|
|
|
|
|
|
|
- <el-table-column label="创建时间" class-name="status-col" width="200px">
|
|
|
|
- <template slot-scope="{row}">
|
|
|
|
- <span>{{ row.createTime | formatTime }}</span>
|
|
|
|
- </template>
|
|
|
|
- </el-table-column>
|
|
|
|
-
|
|
|
|
- <!-- <el-table-column label="创建人" class-name="status-col" width="160px" prop="createBy" /> -->
|
|
|
|
- <el-table-column label="操作" align="center" width="400px" class-name="small-padding fixed-width">
|
|
|
|
- <template slot-scope="{row}">
|
|
|
|
- <template v-if="isProxy">
|
|
|
|
- <el-button type="primary" size="mini" @click="$_navigationTo(`/auth/auth-edit?id=${row.authId}&authParty=${row.authParty}`)">
|
|
|
|
- 编辑
|
|
|
|
- </el-button>
|
|
|
|
- <el-button type="primary" size="mini" @click="$_navigationTo(`/auth/user-list?id=${row.authId}&authParty=${row.authParty}`)">
|
|
|
|
- 登录用户
|
|
|
|
- </el-button>
|
|
|
|
- </template>
|
|
|
|
- <template v-if="!isProxy">
|
|
|
|
- <el-button type="primary" size="mini" @click="$_navigationTo(`/product?id=${row.authId}&authParty=${row.authParty}`)">
|
|
|
|
- 查看
|
|
|
|
- </el-button>
|
|
|
|
- </template>
|
|
|
|
- <el-button type="primary" size="mini" @click="$_navigationTo(`/product?id=${row.authId}&authParty=${row.authParty}`)">
|
|
|
|
- 查看设备认证
|
|
|
|
- </el-button>
|
|
|
|
- <el-button v-if="isProxy" type="danger" size="mini" @click="handleRemoveAuth(row)">
|
|
|
|
- 删除
|
|
|
|
- </el-button>
|
|
|
|
-
|
|
|
|
- </template>
|
|
|
|
- </el-table-column>
|
|
|
|
- </el-table>
|
|
|
|
-
|
|
|
|
- <!-- 页码 -->
|
|
|
|
- <pagination v-show="total>0" :total="total" :page.sync="listQuery.pageNum" :limit.sync="listQuery.pageSize" @pagination="getList" />
|
|
|
|
-
|
|
|
|
- <!-- 对话框区域 -->
|
|
|
|
<el-dialog
|
|
<el-dialog
|
|
- :title="dialogTitle"
|
|
|
|
- :visible.sync="showAddAuthDialog"
|
|
|
|
- width="30%"
|
|
|
|
- @close="dialogClosed"
|
|
|
|
|
|
+ class="map-dialog"
|
|
|
|
+ title="坐标拾取(请拖动标记点选取准确位置)"
|
|
|
|
+ :visible.sync="dialogMapVisible"
|
|
|
|
+ width="80%"
|
|
>
|
|
>
|
|
- <el-form ref="addAuthForm" :rules="addAuthFormRules" :model="addAuthFormData" label-width="100px">
|
|
|
|
- <el-form-item label="授权机构:" prop="authParty">
|
|
|
|
- <el-input v-model="addAuthFormData.authParty" placeholder="请输入授权机构名称" />
|
|
|
|
- </el-form-item>
|
|
|
|
- <!-- <el-form-item label="上线状态:">
|
|
|
|
- <el-select v-model="addAuthFormData.status">
|
|
|
|
- <el-option label="上线" :value="1" />
|
|
|
|
- <el-option label="下线" :value="0" />
|
|
|
|
- </el-select>
|
|
|
|
- </el-form-item> -->
|
|
|
|
- </el-form>
|
|
|
|
- <span slot="footer" class="dialog-footer">
|
|
|
|
- <el-button @click="showAddAuthDialog = false">取 消</el-button>
|
|
|
|
- <el-button type="primary" :disabled="disabled" @click="handleUpdateBrandAuth">确 定</el-button>
|
|
|
|
- </span>
|
|
|
|
|
|
+ <!-- <location v-if="dialogMapVisible" :init-point="formData.point" @point="handlePointChange" /> -->
|
|
|
|
+ <map-ui v-if="dialogMapVisible" :init-point="formData.point" :address="locationAddress" @change="markerChange" />
|
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
|
+ <el-button type="primary" size="mini" @click="dialogMapVisible = false">确 定</el-button>
|
|
|
|
+ </div>
|
|
</el-dialog>
|
|
</el-dialog>
|
|
- <!-- 导入对话框 -->
|
|
|
|
- <!-- dialog Start -->
|
|
|
|
- <el-dialog
|
|
|
|
- title="导入"
|
|
|
|
- :visible.sync="improtDialogVisible"
|
|
|
|
- width="30%"
|
|
|
|
- @close="improtDialogClose"
|
|
|
|
- >
|
|
|
|
- <el-form ref="dialogForm" :model="improtDialogFormData" label-width="86px" :rules="improtDialogFormRules">
|
|
|
|
- <el-form-item label="文件路径:" prop="fileUrl">
|
|
|
|
- <file-upload ref="fileUpload" :file-list="uploadFileList" @change="fileUploadChange" />
|
|
|
|
- <el-input v-show="false" v-model="improtDialogFormData.fileUrl" />
|
|
|
|
- </el-form-item>
|
|
|
|
- </el-form>
|
|
|
|
- <span slot="footer" class="dialog-footer">
|
|
|
|
- <el-button @click="improtDialogVisible = false">取 消</el-button>
|
|
|
|
- <el-button type="primary" :disabled="!saveBtnClickable" :loading="requestLoading" @click="submitUpload">确 定</el-button>
|
|
|
|
- </span>
|
|
|
|
- </el-dialog>
|
|
|
|
- <!-- dialog END -->
|
|
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
-import FileUpload from '@/components/FileUpload'
|
|
|
|
-import { fecthAuthList, saveBrandAuth, changeAuthStatus, removeAuth, authImportExcel } from '@/api/auth'
|
|
|
|
-import Pagination from '@/components/Pagination' // secondary package based on el-pagination
|
|
|
|
|
|
+// import Location from '@/components/location'
|
|
|
|
+import AMapUI from '@/components/AMapUI'
|
|
|
|
+import UploadImage from '@/components/UploadImage'
|
|
import { mapGetters } from 'vuex'
|
|
import { mapGetters } from 'vuex'
|
|
-import { formatDate } from '@/utils'
|
|
|
|
-import { debounce, downLoadWithATag } from '@/utils/tools'
|
|
|
|
|
|
+import { saveBrandAuth, getAuthFormData } from '@/api/auth'
|
|
|
|
+import { getAddress } from '@/api/common'
|
|
|
|
+import { isPoint, isNumber } from '@/utils/validate'
|
|
|
|
+
|
|
export default {
|
|
export default {
|
|
- name: 'ComplexTable',
|
|
|
|
- components: { Pagination, FileUpload },
|
|
|
|
- filters: {
|
|
|
|
- formatTime(time) {
|
|
|
|
- if (!time) {
|
|
|
|
- return ''
|
|
|
|
- }
|
|
|
|
- return formatDate(time, 'yyyy-MM-DD HH:mm:ss')
|
|
|
|
- }
|
|
|
|
|
|
+ components: {
|
|
|
|
+ // Location
|
|
|
|
+ [AMapUI.name]: AMapUI,
|
|
|
|
+ UploadImage
|
|
},
|
|
},
|
|
data() {
|
|
data() {
|
|
|
|
+ var validatePoint = (rule, value, callback) => {
|
|
|
|
+ if (value === '') {
|
|
|
|
+ callback(new Error('经纬度坐标不能为空'))
|
|
|
|
+ } else {
|
|
|
|
+ if (isPoint(value)) {
|
|
|
|
+ this.$refs.ruleForm.validateField('point')
|
|
|
|
+ } else {
|
|
|
|
+ callback('经纬度坐标格式不正确,(例如:114.095294,22.536004)')
|
|
|
|
+ }
|
|
|
|
+ callback()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ var validateMobile = (rule, value, callback) => {
|
|
|
|
+ if (value === '') {
|
|
|
|
+ callback(new Error('联系方式不能为空'))
|
|
|
|
+ } else {
|
|
|
|
+ if (isNumber(value)) {
|
|
|
|
+ this.$refs.ruleForm.validateField('point')
|
|
|
|
+ } else {
|
|
|
|
+ callback('联系方式格式不正确')
|
|
|
|
+ }
|
|
|
|
+ callback()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
return {
|
|
return {
|
|
- noticeTitle: '添加',
|
|
|
|
- dialogFlag: true, // 对话框状态
|
|
|
|
- tableKey: 0,
|
|
|
|
- list: null,
|
|
|
|
- total: 0,
|
|
|
|
- listLoading: true,
|
|
|
|
- // 查询参数
|
|
|
|
- listQuery: {
|
|
|
|
- authParty: '', // 授权机构
|
|
|
|
- authUserId: '', // 供应商用户id
|
|
|
|
- pageNum: 1, // 页码
|
|
|
|
- pageSize: 10, // 分页
|
|
|
|
- status: ''
|
|
|
|
- },
|
|
|
|
- // 添加品牌授权
|
|
|
|
- showAddAuthDialog: false, // 显示添加供应商对话框
|
|
|
|
- dialogTitle: '',
|
|
|
|
- addAuthFormData: {
|
|
|
|
- authId: '', // 授权id
|
|
|
|
- authUserId: '', // 供应商用户id
|
|
|
|
- authParty: '', // 授权机构
|
|
|
|
- createBy: '', // 创建人id
|
|
|
|
- status: 2 // 授权状态 0下线,1上线 2待审核
|
|
|
|
- },
|
|
|
|
- addAuthFormRules: {
|
|
|
|
- authParty: [
|
|
|
|
- { required: true, message: '请输入授权机构名称', trigger: 'blur' }
|
|
|
|
- ]
|
|
|
|
- },
|
|
|
|
|
|
+ dialogMapVisible: false,
|
|
|
|
+ point: {},
|
|
|
|
+ value: [],
|
|
|
|
+ options: [],
|
|
|
|
+
|
|
|
|
+ authId: '',
|
|
disabled: false,
|
|
disabled: false,
|
|
- // 审核未通过
|
|
|
|
- auditFailedList: [],
|
|
|
|
- auditNoticeFlag: true,
|
|
|
|
- // ------------------
|
|
|
|
- improtDialogVisible: false,
|
|
|
|
- requestLoading: false,
|
|
|
|
- uploadFileList: [],
|
|
|
|
- improtDialogFormData: {
|
|
|
|
- fileUrl: ''
|
|
|
|
|
|
+
|
|
|
|
+ area: '',
|
|
|
|
+ formData: {
|
|
|
|
+ name: '',
|
|
|
|
+ address: [],
|
|
|
|
+ fullAddress: '',
|
|
|
|
+ point: '',
|
|
|
|
+ mobile: '',
|
|
|
|
+ logoImage: '',
|
|
|
|
+ banner: ''
|
|
},
|
|
},
|
|
- improtDialogFormRules: {
|
|
|
|
- fileUrl: [
|
|
|
|
- {
|
|
|
|
- required: true,
|
|
|
|
- message: '请选择文件', trigger: 'change'
|
|
|
|
- }
|
|
|
|
- ]
|
|
|
|
|
|
+ rules: {
|
|
|
|
+ name: [{ required: true, message: '机构名称不能为空', trigger: ['blur', 'change'] }],
|
|
|
|
+ address: [{ required: true, message: '地址不能为空', trigger: 'change', type: 'array' }],
|
|
|
|
+ fullAddress: [{ required: true, message: '详细不能为空', trigger: ['blur', 'change'] }],
|
|
|
|
+ point: [{ validator: validatePoint, trigger: ['blur', 'change'] }],
|
|
|
|
+ mobile: [{ validator: validateMobile, trigger: ['blur', 'change'] }],
|
|
|
|
+ logoImage: [{ required: true, message: '请上传机构logo', trigger: 'change' }],
|
|
|
|
+ banner: [{ required: true, message: '请至少上传一张banner图片', trigger: 'change' }]
|
|
},
|
|
},
|
|
- chooseFile: ''
|
|
|
|
|
|
+ // logo图片列表
|
|
|
|
+ logoList: [],
|
|
|
|
+ // banner图片列表
|
|
|
|
+ bannerList: [],
|
|
|
|
+ // 级联选择的地址
|
|
|
|
+ address: ''
|
|
}
|
|
}
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
- ...mapGetters(['authUserId', 'userIdentity', 'proxyInfo', 'copyUserInfo']),
|
|
|
|
- saveBtnClickable() {
|
|
|
|
- return this.uploadFileList.length > 0
|
|
|
|
|
|
+ ...mapGetters(['authUserId', 'proxyInfo']),
|
|
|
|
+ // 级联选择器
|
|
|
|
+ cascaderProps() {
|
|
|
|
+ return {
|
|
|
|
+ lazy: true,
|
|
|
|
+ lazyLoad: async(node, resolve) => {
|
|
|
|
+ const { level, value = 0 } = node
|
|
|
|
+ const result = await getAddress({ parentId: value, type: level })
|
|
|
|
+ const nodes = result.data.map(item => ({ value: item.id, label: item.name, leaf: level >= 2 }))
|
|
|
|
+ resolve(nodes)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ cascaderDisplay() {
|
|
|
|
+ return this.formData.address.length > 0
|
|
},
|
|
},
|
|
- isProxy() {
|
|
|
|
- return this.proxyInfo || this.userIdentity !== 1
|
|
|
|
|
|
+ cascaderPlaceholder() {
|
|
|
|
+ return this.cascaderDisplay ? this.area : '请选择所在区域'
|
|
|
|
+ },
|
|
|
|
+ // 定位使用的地址
|
|
|
|
+ locationAddress() {
|
|
|
|
+ return this.address + this.formData.fullAddress
|
|
}
|
|
}
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
- this.listQuery.authUserId = this.$route.query.id || this.proxyInfo?.authUserId || this.authUserId
|
|
|
|
- const type = this.$route.query.type
|
|
|
|
- // 如果是通过路由参数传递的type,则需要同步到store
|
|
|
|
- if (type) {
|
|
|
|
- this.$store.commit('user/SET_SHOP_TYPE', parseInt(type))
|
|
|
|
- }
|
|
|
|
- this.getList()
|
|
|
|
|
|
+ this.authId = this.$route.query.id
|
|
|
|
+ this.initFormData()
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
- // 上传文件
|
|
|
|
- submitUpload() {
|
|
|
|
- this.$refs.dialogForm.validate(valid => {
|
|
|
|
- console.log(valid)
|
|
|
|
- if (!valid) return
|
|
|
|
- this.requestLoading = true // 上传文件
|
|
|
|
- // this.$refs.fileUpload.submit()
|
|
|
|
- this.handleSave()
|
|
|
|
|
|
+ // 获取地址
|
|
|
|
+ initAddress() {
|
|
|
|
+ return getAddress({
|
|
|
|
+ parentId: 19,
|
|
|
|
+ type: 1
|
|
})
|
|
})
|
|
},
|
|
},
|
|
- // 监听上传文件的状态变化
|
|
|
|
- async fileUploadChange(fileList) {
|
|
|
|
- this.uploadFileList = fileList
|
|
|
|
- try {
|
|
|
|
- await this.handleFileUploadStatus(fileList)
|
|
|
|
- this.handleSave.apply(this)
|
|
|
|
- } catch (error) {
|
|
|
|
- console.log(error)
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
+ // 地图标记变化
|
|
|
|
+ markerChange(point) {
|
|
|
|
+ this.formData.point = `${point.lng},${point.lat}`
|
|
},
|
|
},
|
|
|
|
|
|
- // 导出下载授权牌 || 二维码
|
|
|
|
- async handleExport(type) {
|
|
|
|
- const confirmText = type === 1 ? '授权牌' : '二维码'
|
|
|
|
|
|
+ // 数据回显
|
|
|
|
+ initFormData() {
|
|
|
|
+ getAuthFormData({ authId: this.authId }).then(res => {
|
|
|
|
+ console.log(res)
|
|
|
|
+ this.formData.name = res.data.authParty
|
|
|
|
|
|
- const text = await this.$confirm(`确认下载所有${confirmText}?`, '提示', {
|
|
|
|
- confirmButtonText: '确定',
|
|
|
|
- cancelButtonText: '取消',
|
|
|
|
- type: 'warning'
|
|
|
|
- }).catch(() => {
|
|
|
|
- this.$message.info('已取消操作')
|
|
|
|
- })
|
|
|
|
- if (text !== 'confirm') return
|
|
|
|
- // 使用a链接下载
|
|
|
|
- downLoadWithATag(`${process.env.VUE_APP_BASE_API}/download/shop/image?authUserId=${this.authUserId}&type=${type}`)
|
|
|
|
- },
|
|
|
|
|
|
+ this.formData.fullAddress = res.data.address
|
|
|
|
+ this.formData.point = res.data.lngAndLat
|
|
|
|
+ this.formData.mobile = res.data.mobile
|
|
|
|
+ this.formData.logoImage = res.data.logo
|
|
|
|
+ this.formData.banner = res.data.bannerList.length || ''
|
|
|
|
|
|
- // 下载模板
|
|
|
|
- downLoadExportExcel() {
|
|
|
|
- downLoadWithATag(`${process.env.VUE_APP_BASE_API}/download/file?ossName=%E6%AD%A3%E5%93%81%E8%81%94%E7%9B%9F%E6%9C%BA%E6%9E%84%E3%80%81%E5%95%86%E5%93%81%E5%AF%BC%E5%85%A5%E6%A8%A1%E6%9D%BF.xlsx&fileName=%E6%AD%A3%E5%93%81%E8%81%94%E7%9B%9F%E6%9C%BA%E6%9E%84%E3%80%81%E5%95%86%E5%93%81%E5%AF%BC%E5%85%A5%E6%A8%A1%E6%9D%BF.xlsx`)
|
|
|
|
- },
|
|
|
|
|
|
+ this.logoList = [{ name: '', url: res.data.logo }]
|
|
|
|
+ this.bannerList = res.data.bannerList.map(item => ({ name: '', url: item }))
|
|
|
|
|
|
- // 导出为Excel
|
|
|
|
- async handleExportExcel() {
|
|
|
|
- const text = await this.$confirm('确认导出所有授权机构的数据吗?', '提示', {
|
|
|
|
- confirmButtonText: '确定',
|
|
|
|
- cancelButtonText: '取消',
|
|
|
|
- type: 'warning'
|
|
|
|
- }).catch(() => {
|
|
|
|
- this.$message.info('已取消操作')
|
|
|
|
|
|
+ this.formData.address = [res.data.provinceId, res.data.cityId, res.data.townId]
|
|
|
|
+ // this.formData.address = '广东省/深圳市/福田区'
|
|
|
|
+ this.area = res.data.area
|
|
})
|
|
})
|
|
- if (text !== 'confirm') return
|
|
|
|
- // 使用a链接下载
|
|
|
|
- downLoadWithATag(`${process.env.VUE_APP_BASE_API}/auth/export/excel?authUserId=${this.authUserId}`)
|
|
|
|
},
|
|
},
|
|
|
|
|
|
- // 导入Excel 并提交
|
|
|
|
- handleSave: debounce(function() {
|
|
|
|
- console.log('保存')
|
|
|
|
- console.log(this.improtDialogFormData)
|
|
|
|
- console.log(this.proxyInfo, this.authUserId)
|
|
|
|
- // 上传文件使用 multipart/form-data
|
|
|
|
- const formData = new FormData()
|
|
|
|
|
|
+ // 表单提交保存
|
|
|
|
+ submit() {
|
|
|
|
+ this.$refs.submitForm.validate(valide => {
|
|
|
|
+ if (!valide) return
|
|
|
|
|
|
- formData.append('authUserId', this.authUserId)
|
|
|
|
- formData.append('createBy', this.copyUserInfo.authUserId)
|
|
|
|
- formData.append('file', this.chooseFile)
|
|
|
|
|
|
+ console.log(this.formData)
|
|
|
|
+ const {
|
|
|
|
+ name: authParty,
|
|
|
|
+ address: [provinceId, cityId, townId],
|
|
|
|
+ mobile,
|
|
|
|
+ logoImage: logo,
|
|
|
|
+ point: lngAndLat
|
|
|
|
+ } = this.formData
|
|
|
|
|
|
- authImportExcel(formData)
|
|
|
|
- .then(res => {
|
|
|
|
- this.$message.success(res.data)
|
|
|
|
- this.improtDialogVisible = false
|
|
|
|
- this.getList()
|
|
|
|
- })
|
|
|
|
- .catch(err => { console.log(err) })
|
|
|
|
- .finally(() => {
|
|
|
|
- this.requestLoading = false
|
|
|
|
- })
|
|
|
|
- }, 200),
|
|
|
|
|
|
+ const authUserId = this.proxyInfo?.authUserId || this.authUserId
|
|
|
|
|
|
- // 处理文件上传状态
|
|
|
|
- handleFileUploadStatus(fileList) {
|
|
|
|
- console.log(fileList)
|
|
|
|
- this.chooseFile = fileList[0].raw
|
|
|
|
- // 文件列表为空
|
|
|
|
- if (fileList.length <= 0) {
|
|
|
|
- this.improtDialogFormData.fileUrl = ''
|
|
|
|
- return Promise.reject('faild')
|
|
|
|
- }
|
|
|
|
- // 取第一个文件
|
|
|
|
- const { response, status } = fileList[0]
|
|
|
|
- // 文件已选择但未上传
|
|
|
|
- if (status === 'ready') {
|
|
|
|
- this.improtDialogFormData.fileUrl = status
|
|
|
|
- return Promise.reject('faild')
|
|
|
|
- }
|
|
|
|
- // 文件已上传
|
|
|
|
- if (status === 'success') {
|
|
|
|
- this.improtDialogFormData.fileUrl = response.previewUrl
|
|
|
|
- return Promise.resolve('success')
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- improtDialogClose() {
|
|
|
|
- console.log(123)
|
|
|
|
- // this.uploadFileList = []
|
|
|
|
- this.$refs.fileUpload.clearAllFiles()
|
|
|
|
- this.$refs.dialogForm.resetFields()
|
|
|
|
- },
|
|
|
|
- // 获取授权列表
|
|
|
|
- getList() {
|
|
|
|
- this.listLoading = true
|
|
|
|
- fecthAuthList(this.listQuery).then(response => {
|
|
|
|
- if (response.code !== 0) {
|
|
|
|
- return this.$message.error('授权列表信息获取失败')
|
|
|
|
|
|
+ const data = {
|
|
|
|
+ authId: parseInt(this.authId),
|
|
|
|
+ authParty,
|
|
|
|
+ authUserId,
|
|
|
|
+ createBy: authUserId,
|
|
|
|
+ provinceId,
|
|
|
|
+ cityId,
|
|
|
|
+ townId,
|
|
|
|
+ address: this.formData.fullAddress,
|
|
|
|
+ mobile,
|
|
|
|
+ logo,
|
|
|
|
+ lngAndLat
|
|
}
|
|
}
|
|
- const { list, total } = response.data
|
|
|
|
- // this.formatList(list)
|
|
|
|
- this.list = list
|
|
|
|
- this.total = total
|
|
|
|
- // 获取审核未通过的列表
|
|
|
|
- // this.checkAuditFailedList(list)
|
|
|
|
- }).catch(err => {
|
|
|
|
- console.log(err)
|
|
|
|
- return this.$message.error('授权列表信息获取失败')
|
|
|
|
- }).finally(() => {
|
|
|
|
- this.listLoading = false
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
- // 获取审核未通过条数
|
|
|
|
- // Audit failed 审核未通过
|
|
|
|
- checkAuditFailedList(data) {
|
|
|
|
- this.auditFailedList = data.filter(item => item.auditStatus === 0)
|
|
|
|
- if (this.auditFailedList.length > 0 && this.auditNoticeFlag && (this.userIdentity !== 1 || this.proxyInfo !== null)) {
|
|
|
|
- this.$notify.info({
|
|
|
|
- title: '消息通知',
|
|
|
|
- dangerouslyUseHTMLString: true,
|
|
|
|
- message: `共有<b style="color:red">${this.auditFailedList.length}</b>个授权机构未能通过审核,请查看原因并及时修改!`,
|
|
|
|
- duration: 3000
|
|
|
|
- })
|
|
|
|
- this.auditNoticeFlag = false
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- // 检查机构名是否存在 true:存在 false:不存在
|
|
|
|
- handleCheckAuthName(name) {
|
|
|
|
- const flag = this.list.some(item => item.authParty === name)
|
|
|
|
- console.log(flag)
|
|
|
|
- return flag
|
|
|
|
- },
|
|
|
|
- // 添加授权
|
|
|
|
- handleUpdateBrandAuth() {
|
|
|
|
- if (this.handleCheckAuthName(this.addAuthFormData.authParty) && this.dialogFlag) {
|
|
|
|
- this.$message({
|
|
|
|
- message: '该授权机构已存在',
|
|
|
|
- duration: 1000,
|
|
|
|
- type: 'warning'
|
|
|
|
- })
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- this.$refs.addAuthForm.validate(valide => {
|
|
|
|
- if (valide) {
|
|
|
|
- this.disabled = true
|
|
|
|
- this.listLoading = true
|
|
|
|
- // authUserId先判断是否为代理操作,是就从代理数据中获取,否则直接获取当前登录用户的信息
|
|
|
|
- this.addAuthFormData.authUserId = this.$route.query.id || this.proxyInfo?.authUserId || this.authUserId
|
|
|
|
- this.addAuthFormData.createBy = this.addAuthFormData.authUserId
|
|
|
|
- saveBrandAuth(this.addAuthFormData).then(res => {
|
|
|
|
- if (res.code !== 0) {
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- this.getList()
|
|
|
|
|
|
+
|
|
|
|
+ data.bannerList = this.bannerList.map(item => item.response ? item.response.data : item.url)
|
|
|
|
+
|
|
|
|
+ console.log(data)
|
|
|
|
+ saveBrandAuth(data)
|
|
|
|
+ .then(res => {
|
|
const h = this.$createElement
|
|
const h = this.$createElement
|
|
this.$notify.success({
|
|
this.$notify.success({
|
|
- title: `${this.noticeTitle}授权机构`,
|
|
|
|
- message: h('i', { style: 'color: #333' }, `已${this.noticeTitle}授权机构:"${this.addAuthFormData.authParty}"`),
|
|
|
|
|
|
+ title: `修改授权机构`,
|
|
|
|
+ message: h('i', { style: 'color: #333' }, `已修改授权机构:"${this.formData.name}"`),
|
|
duration: 3000
|
|
duration: 3000
|
|
})
|
|
})
|
|
- this.$refs.addAuthForm.resetFields()
|
|
|
|
- }).catch(err => {
|
|
|
|
- console.log(err)
|
|
|
|
- this.$message.danger('操作失败')
|
|
|
|
- }).finally(() => {
|
|
|
|
- this.showAddAuthDialog = false
|
|
|
|
- this.listLoading = false
|
|
|
|
- this.disabled = false
|
|
|
|
|
|
+ this.$refs.submitForm.resetFields()
|
|
|
|
+ this.$store.dispatch('tagsView/delView', this.$route)
|
|
|
|
+ this.$router.push('/auth/list')
|
|
|
|
+ })
|
|
|
|
+ .catch(err => {
|
|
|
|
+ this.$message.danger(err.msg)
|
|
})
|
|
})
|
|
- }
|
|
|
|
})
|
|
})
|
|
},
|
|
},
|
|
- // 删除品牌授权
|
|
|
|
- async handleRemoveAuth(item) {
|
|
|
|
- const text = await this.$confirm('确认删除该数据吗?删除后,对应的商品数据也将全部删除', '提示', {
|
|
|
|
- confirmButtonText: '确定',
|
|
|
|
- cancelButtonText: '取消',
|
|
|
|
- type: 'warning'
|
|
|
|
- }).catch(() => {
|
|
|
|
- this.$message.info('已取消操作')
|
|
|
|
- })
|
|
|
|
- if (text !== 'confirm') return
|
|
|
|
- // 要执行的操作
|
|
|
|
- this.listLoading = true
|
|
|
|
- removeAuth({ authId: item.authId }).then(res => {
|
|
|
|
- if (res.code !== 0) return
|
|
|
|
- const h = this.$createElement
|
|
|
|
- this.$notify.success({
|
|
|
|
- title: '移除授权机构',
|
|
|
|
- message: h('i', { style: 'color: #333' }, `移除授权机构:"${item.authParty}"`),
|
|
|
|
- duration: 3000
|
|
|
|
- })
|
|
|
|
- }).catch(err => {
|
|
|
|
- console.log(err)
|
|
|
|
- }).finally(() => {
|
|
|
|
- this.listLoading = false
|
|
|
|
- this.getList()
|
|
|
|
- })
|
|
|
|
|
|
+ handleChange(e) {
|
|
|
|
+ const node = this.$refs.cascader.getCheckedNodes()
|
|
|
|
+ if (node.length <= 0) return
|
|
|
|
+ this.address = node[0].pathLabels.join()
|
|
},
|
|
},
|
|
- // 格式化列表数据
|
|
|
|
- formatList(list = []) {
|
|
|
|
- list.forEach(i => {
|
|
|
|
- i.status = i.status === 1
|
|
|
|
- })
|
|
|
|
|
|
+ // logo上传
|
|
|
|
+ uploadLogoSuccess({ response, file, fileList }) {
|
|
|
|
+ this.logoList = fileList
|
|
|
|
+ this.formData.logoImage = fileList[0].response.data
|
|
},
|
|
},
|
|
- // 供应商状态改变
|
|
|
|
- handleChangeStatus(item) {
|
|
|
|
- if (this.userIdentity !== 2 && this.proxyInfo === null) return
|
|
|
|
- this.listLoading = true
|
|
|
|
- // const params = {
|
|
|
|
- // authId: item.authId,
|
|
|
|
- // status: item.status ? 1 : 0
|
|
|
|
- // }
|
|
|
|
- const params = {
|
|
|
|
- authId: item.authId,
|
|
|
|
- status: item.status === 1 ? 0 : 1
|
|
|
|
- }
|
|
|
|
- changeAuthStatus(params).then(res => {
|
|
|
|
- // this.$message.success(res.data)
|
|
|
|
- this.$message({
|
|
|
|
- message: res.data,
|
|
|
|
- duration: 500,
|
|
|
|
- type: 'success'
|
|
|
|
- })
|
|
|
|
- this.getList()
|
|
|
|
- }).catch(err => {
|
|
|
|
- console.log(err)
|
|
|
|
- }).finally(() => {
|
|
|
|
- this.listLoading = false
|
|
|
|
- })
|
|
|
|
|
|
+ handleLogoRemove({ file, fileList }) {
|
|
|
|
+ this.logoList = fileList
|
|
|
|
+ this.formData.logoImage = ''
|
|
},
|
|
},
|
|
- // 过滤列表
|
|
|
|
- handleFilter() {
|
|
|
|
- this.listQuery.page = 1
|
|
|
|
- this.getList()
|
|
|
|
|
|
+ beforeLogoUpload(file) {
|
|
|
|
+ const flag = file.size / 1024 < 500
|
|
|
|
+ if (!flag) {
|
|
|
|
+ this.$message.error('上传logo图片大小不能超过 500kb!')
|
|
|
|
+ }
|
|
|
|
+ return flag
|
|
},
|
|
},
|
|
- // 添加供应商
|
|
|
|
- handleAddAuth() {
|
|
|
|
- console.log('添加供应商')
|
|
|
|
|
|
+
|
|
|
|
+ // banner上传
|
|
|
|
+ uploadBannerSuccess({ response, file, fileList }) {
|
|
|
|
+ this.bannerList = fileList
|
|
|
|
+ console.log(this.bannerList)
|
|
|
|
+ this.formData.banner = fileList.length > 0 ? fileList.length : ''
|
|
},
|
|
},
|
|
- // 对话框关闭事件
|
|
|
|
- dialogClosed() {
|
|
|
|
- console.log('dialog is closed')
|
|
|
|
- this.addAuthFormData.authParty = ''
|
|
|
|
- this.addAuthFormData.authId = ''
|
|
|
|
- this.addAuthFormData.status = 1
|
|
|
|
- this.noticeTitle = '添加'
|
|
|
|
- this.$refs.addAuthForm.resetFields()
|
|
|
|
|
|
+ handleBannerRemove({ file, fileList }) {
|
|
|
|
+ this.bannerList = fileList
|
|
|
|
+ this.formData.banner = fileList.length > 0 ? fileList.length : ''
|
|
},
|
|
},
|
|
- handleShowEditDialog(title, data) {
|
|
|
|
- this.dialogTitle = title
|
|
|
|
- if (data) {
|
|
|
|
- this.addAuthFormData.authId = data.authId
|
|
|
|
- this.addAuthFormData.authUserId = data.authUserId
|
|
|
|
- this.addAuthFormData.authParty = data.authParty
|
|
|
|
- this.addAuthFormData.createBy = data.createBy
|
|
|
|
- this.status = data.status
|
|
|
|
- this.noticeTitle = '修改'
|
|
|
|
- this.dialogFlag = false
|
|
|
|
- } else {
|
|
|
|
- this.dialogFlag = true
|
|
|
|
|
|
+ beforeBannerUpload(file) {
|
|
|
|
+ const flag = file.size / 1024 / 1024 < 1
|
|
|
|
+ if (!flag) {
|
|
|
|
+ this.$message.error('上传banner图片大小不能超过 1MB!')
|
|
}
|
|
}
|
|
- this.showAddAuthDialog = true
|
|
|
|
- },
|
|
|
|
- indexMethod(index) {
|
|
|
|
- return index + this.listQuery.pageSize * (this.listQuery.pageNum - 1) + 1
|
|
|
|
|
|
+ return flag
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
-.filter-container{
|
|
|
|
- span{
|
|
|
|
- display: inline-block;
|
|
|
|
- margin-bottom: 10px;
|
|
|
|
- vertical-align: middle;
|
|
|
|
- font-size: 14px;
|
|
|
|
- }
|
|
|
|
- .el-button{
|
|
|
|
- display: inline-block;
|
|
|
|
- margin-bottom: 10px;
|
|
|
|
- vertical-align: middle;
|
|
|
|
- }
|
|
|
|
- .el-input,.el-select{
|
|
|
|
- margin-right: 10px;
|
|
|
|
- margin-left: 10px;
|
|
|
|
|
|
+#allmap {
|
|
|
|
+ width: 100%;
|
|
|
|
+ height: 600px;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.club-edit {
|
|
|
|
+ margin-bottom: 80px;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.club-edit-form {
|
|
|
|
+ width: 600px;
|
|
|
|
+ margin: 0 auto;
|
|
|
|
+ margin-top: 80px;
|
|
|
|
+}
|
|
|
|
+.submit-btn {
|
|
|
|
+ text-align: center;
|
|
|
|
+ .el-button {
|
|
|
|
+ width: 140px;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</style>
|
|
</style>
|