Commit f5125444 by 前端

Merge branch 'SAAS+V4.44-0902' of http://192.168.3.233:8090/saas_plus/dj-car-lif…

…e-system into SAAS+V4.44-0902
2 parents 84d1ad2b ed9c09ef
......@@ -111,6 +111,6 @@ export function orderFieldSettingUpdate(data) {
}
//员工注册码
export function employeeRegister(data) {
data.method = `${path}serviceMerchant.shopSetting`
data.method = `${path}staff.register`
return request(data, RequestMethods.POST)
}
......@@ -379,8 +379,9 @@
<el-input class="w-320"
size="small"
maxlength="20"
@input="handleBatchServiceTimeInput($event)"
v-model="batchForm.serviceYears"
placeholder="请输入服务时间"></el-input>
placeholder="请输入服务时间/年"></el-input>
</el-form-item>
</el-form>
</d2-dialog>
......@@ -425,7 +426,8 @@ export default {
extendedPosiTypeList: [], // 延保类商品部位
serviceYearsVisible: false, // 批量服务时间弹窗
batchForm: {
serviceYears: ''
serviceYears: '',
oldServiceYears: ''
},
batchRules: {
serviceYears: [
......@@ -780,6 +782,13 @@ export default {
this.$set(this.goodsInfoData.goodsSpecificationSingleList[index], 'serviceYears', limitPrice(newValue, oldValue, 2, 0, 1))
this.$set(this.goodsInfoData.goodsSpecificationSingleList[index], 'oldserviceYears', this.goodsInfoData.goodsSpecificationSingleList[index]['serviceYears'])
},
// 批量服务时间
handleBatchServiceTimeInput(newValue) {
newValue = newValue.replace(/[^\d.]/g, '')
let oldValue = this.batchForm.oldServiceYears ? this.batchForm.oldServiceYears : ''
this.$set(this.batchForm, 'serviceYears', limitPrice(newValue, oldValue, 2, 0, 1))
this.$set(this.batchForm, 'oldServiceYears', this.batchForm['serviceYears'])
},
handleServiceTimeBlur(e, index) {
const newValue = e.target.value
if (!newValue) this.$set(this.goodsInfoData.goodsSpecificationSingleList[index], 'serviceYearsEmpty', true)
......
<!-- 标记退款 -->
<template>
<baseDialog :dialog-config="dialogConfig" :is-show.sync="visible" :btn-loding="btnLoding" class="accountDailog" @handleClick="handleAddConfirm">
<div class="refund-dialog">
<div class="refund-dialog" v-loading="loading">
<p class="title">业务信息</p>
<el-form class="edit-sub-block" label-width="150px" :inline="true">
<template v-for="item in orderInfoList">
......@@ -25,15 +25,15 @@
</el-input>
</div>
<template slot="attachmentListHtml" slot-scope="scope">
<el-upload action="" accept=".xlsx,.xls,.doc,.pdf" class="upload-file" drag :show-file-list="false" :file-list="uploadFileList" :limit="5" :auto-upload="false" :on-remove="importFileChange" :on-change="
<el-upload action="" accept=".xlsx,.xls,.doc,.pdf,.docx,.jpg,.png" class="upload-file" :show-file-list="false" :file-list="uploadFileList" :limit="5" :auto-upload="false" :on-remove="importFileChange" :on-change="
(file, fileList) => handleFileChange(file, fileList, scope.scope)
" :on-exceed="hanldeOnExceed" multiple>
<i class="el-icon-upload"></i>
<!-- <i class="el-icon-upload"></i>
<div class="el-upload__text">点击或将文件拖拽到此区域上传</div>
<div class="item-tips text-tips">
支持格式:.xlsx .xls .doc .pdf
</div>
<div class="item-tips">单个文件不能超过10M,最多上传5个文件</div>
</div> -->
<div class="upload-txt">+ 上传文件</div>
</el-upload>
<!-- 文件列表区域 -->
<div class="file-box">
......@@ -48,6 +48,7 @@
</div>
</div>
</div>
<div class="upload-tips">支持文件格式:.doc .docx .pdf .xlsx .xls .png .jpg ,单个文件不能超过10M,最多上传5个文件。</div>
</template>
</glsx-combi-form>
</div>
......@@ -57,7 +58,7 @@
<script>
import { getPlatformMerchant, addRefundApplyRecord, getOrderDefaultInfo } from "@api/refundExamine"
import { getYqMerchantConfig } from "@api/serviceManage"
import { getList as merchantApi } from '@api/merchant'
import { listShop4sByRef as merchantApi } from '@api/merchant'
import { getList as serviceManageApi } from '@api/serviceManage'
import { deepClone } from "@/common/util"
import { mapActions, mapState } from "vuex"
......@@ -68,6 +69,9 @@ export default {
data() {
return {
userInfo: this.$store.state.d2admin.user.info,
loading: false,
// 标记apiList是否都正确返回数据
baseApiIdx: 0,
okParams: {},
formDefaultObj: {
labelWidth: '150px',
......@@ -75,7 +79,7 @@ export default {
isEdit: true
},
infoForm: {
refundType: '',
refundType: "1",
yqMerchantId: '',
shopMerchantId: '',
shopRefundAmount: '',
......@@ -317,10 +321,15 @@ export default {
isClear: true,
maxlength: 30,
inputFn: (event) => {
if (!(/^\d|\s+$/.test(event.slice(event.length - 1)))) {
this.infoForm.bankAccountNo = event.slice(0, event.length - 1)
if (!(/^\d|\s+$/.test(event.slice(event.length)))) {
this.infoForm.bankAccountNo = event.replace(/\D/g, '')
}
this.infoForm.bankAccountNo = this.infoForm.bankAccountNo.replace(/\s/g, '').replace(/(.{4})/g, "$1 ")
let arr = this.infoForm.bankAccountNo.split('')
if(arr[arr.length - 1] == ' ') {
arr.splice(arr.length - 1, 1)
this.infoForm.bankAccountNo = arr.join('')
}
}
},
{
......@@ -342,10 +351,10 @@ export default {
],
baseData: {
refundList: [{
confId: 1,
confId: '1',
confLabel: '全额退款'
}, {
confId: 2,
confId: '2',
confLabel: '部分退款'
}],
yqMerchantList: [],
......@@ -358,7 +367,8 @@ export default {
list: ['yqMerchantList']
}, {
api: merchantApi,
list: ['shopMerchantList']
list: ['shopMerchantList'],
noList: true
}, {
api: serviceManageApi,
list: ['partnerList']
......@@ -438,6 +448,11 @@ export default {
created() {
this.dealAttrRule()
this.getPlatformMerchant()
this.loading = true
this.apiList.forEach(item => {
this.setBaseData(item)
})
},
mounted() {
......@@ -453,18 +468,24 @@ export default {
// 加判断---------------
this.getOrderDefaultInfo()
} else if (this.orderList && this.orderList.length > 0) {
let yqIdTemp = this.orderList[0].yqMerchantId
let shopIdTemp = this.orderList[0].shopMerchantId
this.orderList.forEach((item) => {
if(yqIdTemp) {
yqIdTemp = yqIdTemp == item.yqMerchantId ? yqIdTemp : ''
}
if(shopIdTemp) {
shopIdTemp = shopIdTemp == item.shopMerchantId ? shopIdTemp : ''
}
this.orderInfoList.push({
orderCode: item.orderCode,
price: item.price
})
this.infoForm.bizOrderCodeList.push(item.orderCode)
})
this.infoForm.yqMerchantId = yqIdTemp
this.infoForm.shopMerchantId = shopIdTemp
}
this.getPlatformMerchant()
this.apiList.forEach(item => {
this.setBaseData(item)
})
},
methods: {
......@@ -525,9 +546,14 @@ export default {
setBaseData(name) {
name.api(this.pageParams).then(res => {
name.list.forEach(k => {
this.baseData[k] = res.list
this.baseData[k] = name.noList ? res : res.list
})
this.baseApiIdx = this.baseApiIdx + 1
this.getOptionsList('infoEditFormData')
}).finally(() => {
if(this.baseApiIdx == this.apiList.length) {
this.loading = false
}
})
},
......@@ -560,7 +586,10 @@ export default {
!fileInfo.name.includes(".xlsx") &&
!fileInfo.name.includes(".xls") &&
!fileInfo.name.includes(".doc") &&
!fileInfo.name.includes(".pdf")
!fileInfo.name.includes(".pdf") &&
!fileInfo.name.includes(".docx") &&
!fileInfo.name.includes(".png") &&
!fileInfo.name.includes(".jpg")
) {
this.$message({
message: "文件格式不支持上传",
......@@ -607,7 +636,9 @@ export default {
"application/vnd.ms-excel": "excel",
"application/msword": "doc",
"application/vnd.openxmlformats-officedocument.wordprocessingml.document":
"docx"
"doc",
"image/png": "image",
"image/jpeg": "image"
}
// this.btnLoding = true
uploadFile({
......@@ -799,10 +830,11 @@ export default {
}
.el-textarea .el-input__count {
right: 90px;
bottom: -10px;
right: 10px;
bottom: -7px;
font-size: 12px;
color: #999999;
background-color: transparent;
}
.tips {
......@@ -823,35 +855,55 @@ export default {
}
.upload-file {
::v-deep .el-upload-dragger {
display: flex;
flex-flow: column;
justify-content: center;
align-items: center;
width: 300px;
height: 160px;
background: #f7f7f7;
.el-icon-upload {
margin: 0;
}
.el-upload__text {
font-size: 14px;
color: #000000;
}
.item-tips {
font-size: 12px;
color: #999999;
height: 22px;
line-height: 22px;
}
.text-tips {
font-size: 14px;
}
width: 110px;
height: 32px;
border-radius: 4px;
opacity: 1;
border: 1px solid #00000026;
background: #ffffff;
text-align: center;
.upload-txt {
height: 22px;
color: #666666;
font-size: 14px;
text-align: left;
line-height: 22px;
}
// ::v-deep .el-upload-dragger {
// display: flex;
// flex-flow: column;
// justify-content: center;
// align-items: center;
// width: 300px;
// height: 160px;
// background: #f7f7f7;
// .el-icon-upload {
// margin: 0;
// }
// .el-upload__text {
// font-size: 14px;
// color: #000000;
// }
// .item-tips {
// font-size: 12px;
// color: #999999;
// height: 22px;
// line-height: 22px;
// }
// .text-tips {
// font-size: 14px;
// }
// }
}
.upload-tips {
height: 20px;
color: #999999;
font-size: 14px;
text-align: left;
}
.file-box {
......@@ -868,8 +920,8 @@ export default {
::v-deep .el-progress-bar {
width: 320px;
background: #ffffff;
border: 1px solid #f4f6fc;
// background: #ffffff;
// border: 1px solid #f4f6fc;
border-radius: 4px;
.el-progress-bar__outer {
......@@ -889,16 +941,19 @@ export default {
}
.file-name {
position: absolute;
left: 12px;
top: 6px;
transform: translateY(-50%);
box-sizing: border-box;
width: 318px;
height: 26px;
line-height: 26px;
background: #f5f7fa;
color: #333333;
font-size: 14px;
max-width: 300px;
transform: translateY(-50%);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
border-radius: 4px;
padding: 0 8px;
}
.image-file {
......@@ -907,11 +962,11 @@ export default {
}
.file-item:first-child {
margin-top: 15px;
margin-top: 11px;
.file-name {
position: absolute;
left: 12px;
left: 0px;
top: 15px;
transform: translateY(-50%);
color: #333333;
......
......@@ -4,15 +4,15 @@
<div class="refund-update-dialog">
<glsx-combi-form class="edit-form-container" ref="editFormRef" label-width="150px" default-width="370px" :form-ref="editChildRef" :form-obj="infoForm" :form-data="editFormData" :form-rules="formRules">
<template slot="attachmentListHtml" slot-scope="scope">
<el-upload action="" accept=".png,.jpg" class="upload-file" drag :show-file-list="false" :file-list="uploadFileList" :limit="5" :auto-upload="false" :on-remove="importFileChange" :on-change="
<el-upload action="" accept=".png,.jpg" class="upload-file" :show-file-list="false" :file-list="uploadFileList" :limit="5" :auto-upload="false" :on-remove="importFileChange" :on-change="
(file, fileList) => handleFileChange(file, fileList, scope.scope)
" :on-exceed="hanldeOnExceed" multiple>
<i class="el-icon-upload"></i>
<!-- <i class="el-icon-upload"></i>
<div class="el-upload__text">点击或将文件拖拽到此区域上传</div>
<div class="item-tips text-tips">
支持格式:.png .jpg
</div>
<div class="item-tips">单个文件不能超过10M,最多上传5个文件</div>
</div> -->
<div class="upload-txt">+ 上传文件</div>
</el-upload>
<!-- 文件列表区域 -->
<div class="file-box">
......@@ -27,6 +27,7 @@
</div>
</div>
</div>
<div class="upload-tips">支持文件格式: .png .jpg ,单个文件不能超过10M,最多上传5个文件。</div>
</template>
</glsx-combi-form>
</div>
......@@ -81,6 +82,13 @@ export default {
trigger: "blur"
}
],
attachmentList: [
{
required: false,
message: "请上传结算凭证",
trigger: "blur"
}
],
remark: [
{
required: true,
......@@ -119,15 +127,20 @@ export default {
isClear: true,
maxlength: 30,
inputFn: (event) => {
if (!(/^\d|\s+$/.test(event.slice(event.length - 1)))) {
this.infoForm.bankAccountNo = event.slice(0, event.length - 1)
if (!(/^\d|\s+$/.test(event.slice(event.length)))) {
this.infoForm.bankAccountNo = event.replace(/\D/g, '')
}
this.infoForm.bankAccountNo = this.infoForm.bankAccountNo.replace(/\s/g, '').replace(/(.{4})/g, "$1 ")
let arr = this.infoForm.bankAccountNo.split('')
if(arr[arr.length - 1] == ' ') {
arr.splice(arr.length - 1, 1)
this.infoForm.bankAccountNo = arr.join('')
}
}
}, {
label: "附件",
label: "结算凭证",
name: "attachmentList",
// isHide: false,
isHide: true,
addHtml: "attachmentListHtml"
}, {
label: "备注",
......@@ -175,6 +188,11 @@ export default {
// this.dialogConfig.title = this.examineType
this.infoForm = deepClone(this.detailInfo)
this.getPlatformMerchant()
this.dealAttachment()
if(this.infoForm.bankAccountNo) {
this.infoForm.bankAccountNo = this.infoForm.bankAccountNo.replace(/\s/g, '').replace(/(.{4})/g, "$1 ")
}
console.log(this.infoForm, 'infoForm--------')
},
methods: {
......@@ -190,6 +208,25 @@ export default {
})
},
dealAttachment() {
// fileType 文件类型(1.申请附件,2.结算凭证)';只保留结算凭证
/* status状态(已完成才有结算凭证)
{ confId: 0, confValue: "运营审核" },
{ confId: 1, confValue: "商务审核" },
{ confId: 2, confValue: "财务复核" },
{ confId: 3, confValue: "财务结算" },
{ confId: 4, confValue: "已完成" },
{ confId: 5, confValue: "驳回" }
*/
console.log(this.infoForm.status)
this.infoForm.attachmentList = this.infoForm.status == 4 ? [] : (this.infoForm.attachmentList.filter(item => item.fileType == 2) || [])
if (this.infoForm.status == 4) {
let idx = this.editFormData.findIndex(item => item.label == '结算凭证')
this.editFormData[idx].isHide = false
this.formRules.attachmentList[0].required = true
}
},
getPlatformMerchant() {
this.baseData.platformMerchantIdList = []
var params = {}
......@@ -203,7 +240,6 @@ export default {
importFileChange(file, fileList) {
this.uploadFileList = fileList
this.infoForm.attachmentList = deepClone(fileList)
console.log(fileList, "fileList")
},
hanldeOnExceed(files, fileList) {
......@@ -292,7 +328,7 @@ export default {
// this.btnLoding = true
uploadFile({
file: base64,
fileType: fileTypeKey[fileInfo.type],
fileType: 'image',
onProcess: (e) => {
// 上传进度
const { loaded, total } = e
......@@ -333,7 +369,14 @@ export default {
i-- // 需要将i减1,因为数组长度已经减少了1
}
}
console.log(params, 'params-----------')
params.attachmentList.forEach((k, idx) => {
params.attachmentList[idx] = {
fileUrl: k.fileUrl,
fileName: k.fileName
}
})
params.bankAccountNo = params.bankAccountNo.replace(/\s*/g, '')
// console.log(params, 'params-----------')
update(params).then((res) => {
this.notice.okTips("操作成功")
this.$emit('refundConfirm')
......@@ -365,6 +408,28 @@ export default {
.tips {
color: #999999;
}
.upload-file {
width: 110px;
height: 32px;
border-radius: 4px;
opacity: 1;
border: 1px solid #00000026;
background: #ffffff;
text-align: center;
.upload-txt {
height: 22px;
color: #666666;
font-size: 14px;
text-align: left;
line-height: 22px;
}
}
.upload-tips {
height: 20px;
color: #999999;
font-size: 14px;
text-align: left;
}
.file-box {
width: 350px;
......@@ -401,16 +466,19 @@ export default {
}
.file-name {
position: absolute;
left: 12px;
top: 6px;
transform: translateY(-50%);
box-sizing: border-box;
width: 318px;
height: 26px;
line-height: 26px;
background: #f5f7fa;
color: #333333;
font-size: 14px;
max-width: 300px;
transform: translateY(-50%);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
border-radius: 4px;
padding: 0 8px;
}
.image-file {
......@@ -419,11 +487,11 @@ export default {
}
.file-item:first-child {
margin-top: 15px;
margin-top: 8px;
.file-name {
position: absolute;
left: 12px;
left: 0px;
top: 15px;
transform: translateY(-50%);
color: #333333;
......
......@@ -64,6 +64,7 @@
<span style="margin-right: 10px;">
<auth-button :data="scope.scope"
:show-btn-ids="['9040808']" />
<span v-if="scope.scope.downCount != 0" style="color: #2A58AD;">({{scope.scope.downCount}})</span>
</span>
</div>
</d2-table>
......@@ -207,7 +208,10 @@ export default {
}, {
label: '银行账号',
prop: 'bankAccountNo',
width: '160px'
width: '160px',
formatter: (cellValue) => {
return cellValue.bankAccountNo ? cellValue.bankAccountNo.replace(/\s/g, '').replace(/(.{4})/g, "$1 ") : '--'
}
}, {
label: '关联业务单号',
prop: 'bizOrderCode',
......
......@@ -127,9 +127,12 @@
</el-row>
</el-form>
</div>
<div class="examine-record" v-if="detailInfo.operationList.length > 0">
<div class="examine-record">
<div class="title">审核记录</div>
<div class="record-div">
<div
class="record-div"
v-if="detailInfo.operationList && detailInfo.operationList.length > 0"
>
<div
class="record-div-d"
v-for="(item, index) in detailInfo.operationList"
......@@ -146,6 +149,7 @@
<div class="record-div-time">审核时间:{{ item.operateTime }}</div>
</div>
</div>
<div v-else class="empty">暂无记录</div>
</div>
</div>
<el-dialog
......@@ -418,6 +422,12 @@ export default {
.carousel-img {
width: 100%;
}
.empty {
display: flex;
align-items: center;
justify-content: center;
margin-top:20px;
}
</style>
<style >
......
......@@ -55,7 +55,7 @@
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="积分变化时间:">
{{ detailInfo.rewardTime ? detailInfo.rewardTime : "-" }}
{{ detailInfo.updatedTime ? detailInfo.updatedTime : "-" }}
</el-form-item></el-col
>
......@@ -173,9 +173,8 @@ export default {
getDetail() {
getScoreDetail({ id: this.id }).then((res) => {
if (res) {
console.log(res)
res.rewardTime = res.rewardTime
? Util.dateFormate(res.rewardTime, "YYYY-MM-DD HH:mm:ss")
res.updatedTime = res.updatedTime
? Util.dateFormate(res.updatedTime, "YYYY-MM-DD HH:mm:ss")
: "--"
res.withdrawalTime = res.withdrawalTime
? Util.dateFormate(res.withdrawalTime, "YYYY-MM-DD HH:mm:ss")
......
......@@ -187,19 +187,19 @@ export default {
exportDetailScore(params).then((res) => {
console.log(res)
this.$open(res.data)
this.$open(res)
})
},
beforeSearchFn() {
return new Promise((resolve) => {
this.searchFormSearch = deepClone(this.searchForm)
if (this.searchFormSearch.rewardTime&&this.searchFormSearch.rewardTime.length) {
this.searchFormSearch.rewardTimeBegin =
this.searchFormSearch.rewardBeginTime =
Util.dateFormate(
this.searchFormSearch.rewardTime[0],
"YYYY-MM-DD"
) + " 00:00:00"
this.searchFormSearch.rewardTimeEnd =
this.searchFormSearch.rewardEndTime =
Util.dateFormate(
this.searchFormSearch.rewardTime[1],
"YYYY-MM-DD"
......@@ -260,6 +260,9 @@ export default {
}
}
}
.header{
background: #ffffff;
}
.detail-wrap {
margin: 16px 24px;
.detail-tabs {
......
......@@ -452,16 +452,17 @@ export default {
message: "审核成功"
})
this.handleSearch()
done()
})
} else {
done()
}
}
}).then((action) => {
this.$message({
type: "info",
message: "action: " + action
})
// this.$message({
// type: "info",
// message: "action: " + action
// })
})
},
......@@ -492,8 +493,7 @@ export default {
}
exportFile(params).then((res) => {
console.log(res)
this.$open(res.data)
this.$open(res)
})
},
aToExport(url) {
......
......@@ -126,8 +126,7 @@ export default {
}
exportScore(params).then((res) => {
console.log(res)
this.$open(res.data)
this.$open(res)
})
},
handleDetail(data) {
......
......@@ -3,10 +3,10 @@
<div class="header" slot="header" style="padding: 10px 20px">
<d2-search label-width="110px" :search-form="searchForm" :form-data="showFormData">
<div slot="beginDate">
<el-date-picker v-model="searchForm.beginDate" value-format="yyyy-MM-dd" type="date" placeholder="选择日期" :picker-options="beginDateOptions"></el-date-picker>
<el-date-picker style="width: 100%;" v-model="searchForm.beginDate" value-format="yyyy-MM-dd" type="date" placeholder="选择日期" :picker-options="beginDateOptions"></el-date-picker>
</div>
<div slot="endDate">
<el-date-picker v-model="searchForm.endDate" value-format="yyyy-MM-dd" type="date" placeholder="选择日期" :picker-options="endDateOptions"></el-date-picker>
<el-date-picker style="width: 100%;" v-model="searchForm.endDate" value-format="yyyy-MM-dd" type="date" placeholder="选择日期" :picker-options="endDateOptions"></el-date-picker>
</div>
<div class="up-btns">
<el-button size="small" type="primary" @click="handleSearch">
......@@ -41,7 +41,7 @@
<el-input v-model="dialogForm.badgeCode" maxlength="50"></el-input>
</el-form-item>
<el-form-item label="APP编号:" prop="appCode">
<el-input v-model="dialogForm.appCode" maxlength="20"></el-input>
<el-input v-model="dialogForm.appCode" maxlength="50"></el-input>
</el-form-item>
<el-form-item label="保管人:" prop="custodian">
<el-input v-model="dialogForm.custodian" maxlength="20"></el-input>
......@@ -205,7 +205,7 @@ export default {
maxlength: 20
},
{
label: "使用开始日期",
label: "开始使用日期",
name: "beginDate",
// type: "datePicker",
// dateType: 'date',
......@@ -214,7 +214,7 @@ export default {
// pickerOptions: "beginDateOptions"
},
{
label: "使用结束日期",
label: "结束使用日期",
name: "endDate",
// type: "datePicker",
// dateType: 'date',
......@@ -259,12 +259,12 @@ export default {
{
label: '设备编号',
prop: 'badgeCode',
width: '180px'
width: '200px'
},
{
label: 'APP编号',
prop: 'appCode',
width: '160px'
width: '200px'
},
{
label: '保管人',
......@@ -285,7 +285,7 @@ export default {
label: '直营',
prop: 'directSalesFlag',
formatter: (cellValue) => {
return cellValue.directSalesFlag == 1 ? '是' : '否'
return cellValue.directSalesFlag == 1 ? '是' : cellValue.directSalesFlag == 0 ? '否' : '-'
}
},
{
......@@ -382,8 +382,8 @@ export default {
custodian,
custodianPhone,
supervision,
brandId: Number(brandId),
directSalesFlag: directSalesFlag.toString()
brandId: brandId ? Number(brandId) : null,
directSalesFlag: directSalesFlag === null ? null : directSalesFlag.toString()
}
}
console.log(scope)
......
<!--
* @Author: 王志慧 wangzh@didihu.com.cn
* @Date: 2024-08-20 10:57:01
* @LastEditors: 王志慧 wangzh@didihu.com.cn
* @LastEditTime: 2024-08-20 11:14:12
* @FilePath: \dj-car-life-system\src\views\systemConfig\ShopConfig\components\employeeDialog.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<d2-dialog
title="员工注册码"
......@@ -16,9 +9,11 @@
@closeDialog="handleClose"
@confirmDialog="handleAddConfirm"
>
<div class="employee-wrap">
<div class="employee-wrap" v-if="qrCodeURL">
<div class="title">员工注册码</div>
<div class="code"></div>
<div class="code">
<img :src="qrCodeURL" alt="" />
</div>
</div>
</d2-dialog>
</template>
......@@ -34,6 +29,7 @@ export default {
baseData: {
merchantList: []
},
loading: true,
qrCodeURL: ""
}
},
......@@ -55,24 +51,44 @@ export default {
components: {},
mounted() {
console.log(this.info)
this.getEmployeeRegister()
},
methods: {
// 下载图片 filename是图片名称
downImg(url, name) {
// 创建a标签 并设置其相关属性,最后触发其点击事件
const a = document.createElement("a")
const clickEvent = document.createEvent("MouseEvents")
a.setAttribute("href", url)
a.setAttribute("download", name)
a.setAttribute("target", "_blank")
clickEvent.initEvent("click", true, true)
a.dispatchEvent(clickEvent)
getEmployeeRegister() {
employeeRegister({
merchantId: this.info.merchantId
}).then((res) => {
if (res) {
this.qrCodeURL = res.qrCode
this.loading = false
}
})
},
downloadIamge(imgsrc, name = new Date().getTime()) {
//下载图片地址和图片名
var image = new Image()
// 解决跨域 Canvas 污染问题
image.setAttribute("crossOrigin", "anonymous")
image.onload = function () {
var canvas = document.createElement("canvas")
canvas.width = image.width
canvas.height = image.height
var context = canvas.getContext("2d")
context.drawImage(image, 0, 0, image.width, image.height)
var url = canvas.toDataURL("image/png") //得到图片的base64编码数据
var a = document.createElement("a") // 生成一个a元素
var event = new MouseEvent("click") // 创建一个单击事件
a.download = name || "photo" // 设置图片名称
a.href = url // 将生成的URL设置为a.href属性
a.dispatchEvent(event) // 触发a的单击事件
}
image.src = imgsrc
},
handleAddConfirm() {
this.downImg()
// this.downImg(this.qrCodeURL, "员工注册码.png")
this.downloadIamge(this.qrCodeURL, "员工注册码.png")
},
handleClose() {
this.$emit("dialogClose", true)
......@@ -85,17 +101,19 @@ export default {
display: flex;
align-items: center;
flex-direction: column;
justify-content: center;
justify-content: center;
.title {
font-weight: 500;
font-size: 14px;
color: #333333;
margin-bottom:8px;
margin-bottom: 8px;
}
.code {
width: 120px;
height: 120px;
background: #333333;
img {
width: 100%;
}
}
}
</style>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!