Commit 52214ba8 by 张立顺

质保卡配置功能开发

1 parent 570c4d52
......@@ -187,7 +187,7 @@ export const routerName = {
{
authId: "9060803",
parentId: "90608",
label: "加微二维码",
label: "订单质保二维码配置",
handle: "handleQrcode"
}
],
......
<template>
<d2-dialog title="加微二维码"
<d2-dialog title="订单质保二维码设置"
:is-visible="qRcodeVisible"
class="qRcodeDailog"
width="585px"
......@@ -9,41 +9,59 @@
<div class="dialogContainer">
<p class="merchantName">{{ merchantInfo.yqMerchantName }}</p>
<p class="merchantId">{{ merchantInfo.yqMerchantId }}</p>
<el-upload action=""
class="elupload"
list-type="picture-card"
accept=".jpg,.png"
:auto-upload="false"
:show-file-list="false"
:disabled="!!imgUrl"
:on-change="e => handleChange(e,)"
:on-preview="e => handlePreview(e, )"
:on-remove="e => handleRemove(e, )">
<span class="img-btn">
<img v-if="imgUrl"
:src="imgUrl"
class="rectImg">
<span class="img-btns"
v-if="imgUrl">
<span class="btn-item">
<i @click.stop="handleRemove()"
class="el-icon-delete" />
<!-- <i @click.stop="handleImgLook"
<el-form :model="formData"
:rules="rules"
ref="elForm">
<el-form-item prop="qrcodeType">
<el-radio-group v-model="formData.qrcodeType">
<el-radio class="radioItem"
:label="0">关闭质保卡二维码</el-radio>
<el-radio class="radioItem"
:label="1">选择质保卡二维码链接</el-radio>
<el-radio class="radioItem"
:label="2">加微二维码</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item prop="imgUrl">
<el-upload action=""
class="elupload"
list-type="picture-card"
accept=".jpg,.png"
:auto-upload="false"
:show-file-list="false"
:disabled="!!imgUrl"
:on-change="e => handleChange(e,)"
:on-preview="e => handlePreview(e, )"
:on-remove="e => handleRemove(e, )">
<span class="img-btn">
<img v-if="imgUrl"
:src="imgUrl"
class="rectImg">
<span class="img-btns"
v-if="imgUrl">
<span class="btn-item">
<i @click.stop="handleRemove()"
class="el-icon-delete" />
<!-- <i @click.stop="handleImgLook"
class="el-icon-zoom-in"></i> -->
</span>
</span>
</span>
</span>
</span>
<i v-if="!imgUrl "
class="el-icon-plus avatar-uploader-icon "
style="color: #8c939d;">
<span class="icon-text">上传图片</span>
</i>
<!-- <img v-if="!imgUrl "
<i v-if="!imgUrl "
class="el-icon-plus avatar-uploader-icon "
style="color: #8c939d;">
<span class="icon-text">上传加微二维码图片</span>
</i>
<!-- <img v-if="!imgUrl "
:src='examplePicUrl'
class="rectImg"> -->
<!-- <div slot="tip"
<!-- <div slot="tip"
class="el-upload__tip">只能上传jpg/png文件,且不超过1M</div> -->
</el-upload>
</el-upload>
</el-form-item>
</el-form>
<!-- <span v-if="txtDescript">{{txtDescript}}</span> -->
<!-- <p v-show="!imgUrl"
slot="errorTips"
......@@ -80,7 +98,24 @@ export default {
data() {
return {
imgUrl: '',
defaultImgUrl: ''
defaultImgUrl: '',
qrcodeType: '',
formData: {
qrcodeType: '',
imgUrl: ''
},
rules: {
qrcodeType: [{ required: true, message: '请选择配置方式', trigger: 'change' }],
imgUrl: [
{
required: true,
trigger: 'change',
validator: (rule, value, callback) => {
console.log(value, 'value')
this.formData.qrcodeType === 2 ? (value ? callback() : callback(new Error('请上传加微二维码'))) : callback()
}
}]
}
// oldImgUrl: ''
// dialogConfig: {
// setting: {
......@@ -98,6 +133,14 @@ export default {
// }
}
},
watch: {
imgUrl(val) {
if (val) {
// this.yqMerchantConfigDetail()
this.formData.imgUrl = val
}
}
},
mounted() {
this.yqMerchantConfigDetail()
},
......@@ -106,9 +149,10 @@ export default {
// let parmas = this.merchantInfo.merchantId
yqMerchantConfigDetail({ yqMerchantId: this.merchantInfo.yqMerchantId }).then((result) => {
console.log(result)
const { workWechatQrcode } = result
const { workWechatQrcode, qrcodeType } = result
this.imgUrl = workWechatQrcode
this.defaultImgUrl = workWechatQrcode
this.formData.qrcodeType = qrcodeType
}).catch((err) => {
console.log(err)
})
......@@ -117,23 +161,19 @@ export default {
this.$emit('update:qRcodeVisible', false)
},
async handleAddConfirm() {
// 跟原来不一样认为是修改
if (this.defaultImgUrl != this.imgUrl) {
const params = {
yqMerchantId: this.merchantInfo.yqMerchantId,
imgUrl: this.imgUrl
this.$refs.elForm.validate(async (valid) => {
console.log(valid)
if (valid) {
const params = {
yqMerchantId: this.merchantInfo.yqMerchantId,
...this.formData
}
const result = await serviceMerchantRelateQrcode(params)
console.log(result)
this.notice.okTips()
this.handleClose()
}
const result = await serviceMerchantRelateQrcode(params)
console.log(result)
this.notice.okTips()
// .then((result) => {
// console.log(result)
// }).catch((err) => {
// console.log(err)
// });
}
this.handleClose()
})
},
handleChange(file, attrName, targetItem) {
if (!(file.size / 1024 / 1024 < 1)) {
......@@ -198,7 +238,7 @@ export default {
position: absolute;
white-space: nowrap;
top: 28px;
left: -14px;
left: -48px;
margin-top: 8px;
font-size: 14px;
}
......@@ -206,7 +246,7 @@ export default {
.dialogContainer {
box-sizing: border-box;
width: 300px;
height: 290px;
// height: 290px;
margin: auto;
padding: 16px 24px;
display: flex;
......@@ -219,23 +259,24 @@ export default {
p {
margin: 0;
}
.radioItem {
margin-top: 10px;
}
.merchantName {
font-weight: 600;
margin-bottom: 10px;
}
.elupload {
margin: auto;
margin: 10px auto 0;
position: relative;
display: flex;
justify-content: center;
}
.disabled .el-upload--picture-card {
display: none;
}
.el-upload--picture-card {
width: 140px;
height: 92px;
line-height: 98px;
}
.rectImg {
width: 100%;
height: 100%;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!