Commit 52214ba8 by 张立顺

质保卡配置功能开发

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