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,6 +9,20 @@ ...@@ -9,6 +9,20 @@
<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-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="" <el-upload action=""
class="elupload" class="elupload"
list-type="picture-card" list-type="picture-card"
...@@ -36,7 +50,7 @@ ...@@ -36,7 +50,7 @@
<i v-if="!imgUrl " <i v-if="!imgUrl "
class="el-icon-plus avatar-uploader-icon " class="el-icon-plus avatar-uploader-icon "
style="color: #8c939d;"> style="color: #8c939d;">
<span class="icon-text">上传图片</span> <span class="icon-text">上传加微二维码图片</span>
</i> </i>
<!-- <img v-if="!imgUrl " <!-- <img v-if="!imgUrl "
:src='examplePicUrl' :src='examplePicUrl'
...@@ -44,6 +58,10 @@ ...@@ -44,6 +58,10 @@
<!-- <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) const result = await serviceMerchantRelateQrcode(params)
console.log(result) console.log(result)
this.notice.okTips() this.notice.okTips()
// .then((result) => {
// console.log(result)
// }).catch((err) => {
// console.log(err)
// });
}
this.handleClose() 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!