|
@@ -53,12 +53,12 @@
|
|
|
label="店铺图片:">
|
|
|
<el-upload
|
|
|
:on-remove="(file) => {handleRemove(file, 'shop_img_url')}"
|
|
|
- :on-success="handleAvatarSuccess"
|
|
|
+ :on-success="(file) => {handleAvatarSuccess(file, 'shop_img_url')}"
|
|
|
:before-upload="beforeAvatarUpload"
|
|
|
:on-exceed="hadnleExceed"
|
|
|
:accept="'image/*'"
|
|
|
:limit="1"
|
|
|
- :file-list="fileList0"
|
|
|
+ :file-list="shop_img_url"
|
|
|
list-type="picture-card"
|
|
|
action="/api/upload/img"
|
|
|
multiple>
|
|
@@ -90,12 +90,12 @@
|
|
|
label="个人二维码:">
|
|
|
<el-upload
|
|
|
:on-remove="(file) => {handleRemove(file, 'user_code_url')}"
|
|
|
- :on-success="handleAvatarSuccess"
|
|
|
+ :on-success="(file) => {handleAvatarSuccess(file, 'user_code_url')}"
|
|
|
:before-upload="beforeAvatarUpload"
|
|
|
:on-exceed="hadnleExceed"
|
|
|
:accept="'image/*'"
|
|
|
:limit="1"
|
|
|
- :file-list="fileList"
|
|
|
+ :file-list="user_code_url"
|
|
|
list-type="picture-card"
|
|
|
action="/api/upload/img"
|
|
|
multiple>
|
|
@@ -127,7 +127,11 @@
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer text-center">
|
|
|
<el-button @click="dialog = false">取 消</el-button>
|
|
|
- <el-button type="primary" :disabled="booLock" @click="handleSubmit">确 定</el-button>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ :disabled="booLock"
|
|
|
+ @click="handleSubmit">确 定
|
|
|
+ </el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
</div>
|
|
@@ -151,6 +155,7 @@ export default {
|
|
|
return {
|
|
|
dialog: !!this.value,
|
|
|
form: {
|
|
|
+ // 'shop_id': '', // 店铺ID
|
|
|
'user_name': '', // 用户名称
|
|
|
'user_card': '', // 身份证
|
|
|
'shop_phone': '', // 手机号码
|
|
@@ -162,25 +167,11 @@ export default {
|
|
|
'shop_address': '', // 地址
|
|
|
'shop_remark': '' // 备注
|
|
|
},
|
|
|
- fileList0: [],
|
|
|
- fileList: [],
|
|
|
+ shop_img_url: [],
|
|
|
+ user_code_url: [],
|
|
|
booLock: false
|
|
|
}
|
|
|
},
|
|
|
- computed: {
|
|
|
- arrRotationType() {
|
|
|
- return []
|
|
|
- },
|
|
|
- arrRotationStatus() {
|
|
|
- return []
|
|
|
- },
|
|
|
- rotationChannelList() {
|
|
|
- return []
|
|
|
- },
|
|
|
- arrRotationLinkType() {
|
|
|
- return []
|
|
|
- }
|
|
|
- },
|
|
|
methods: {
|
|
|
beforeAvatarUpload(file) {
|
|
|
const isLt2M = file.size / 1024 / 1024 < 5
|
|
@@ -195,33 +186,30 @@ export default {
|
|
|
type: 'warning'
|
|
|
})
|
|
|
},
|
|
|
- handleRemove(file, e) {
|
|
|
- console.log(e)
|
|
|
+ handleRemove(file, formKey) {
|
|
|
let path = file.url
|
|
|
if (file.response && file.response.data) {
|
|
|
path = file.response.data.path
|
|
|
}
|
|
|
- this.form.user_code_url = this.form.user_code_url.filter(item => item !== path)
|
|
|
+ this.form[formKey] = this.form[formKey].filter(item => item !== path)
|
|
|
},
|
|
|
- handleAvatarSuccess(res) {
|
|
|
+ handleAvatarSuccess(res, formKey) {
|
|
|
if (res.code === 200) {
|
|
|
const { path } = res.data
|
|
|
- this.form.user_code_url.push(path)
|
|
|
+ this.form[formKey].push(path)
|
|
|
} else {
|
|
|
this.$message.error('图片上传失败')
|
|
|
}
|
|
|
},
|
|
|
handleSubmit() {
|
|
|
- const url = this.exData.id ? '/v1/setting/rotation/modify' : '/v1/setting/rotation/add'
|
|
|
+ const url = this.exData.id ? '/api/admin/shop/modify' : ''
|
|
|
this.$refs.form.validate(async valid => {
|
|
|
if (valid) {
|
|
|
const formData = JSON.parse(JSON.stringify(this.form))
|
|
|
const postData = {
|
|
|
...formData,
|
|
|
- user_code_url: formData.user_code_url[0]
|
|
|
- }
|
|
|
- if (this.form.rotation_link_type === 1) {
|
|
|
- postData.rotation_url = ''
|
|
|
+ user_code_url: formData.user_code_url[0],
|
|
|
+ shop_img_url: formData.shop_img_url[0]
|
|
|
}
|
|
|
this.booLock = true
|
|
|
const data = await this.$fetch(url, postData)
|
|
@@ -237,8 +225,14 @@ export default {
|
|
|
},
|
|
|
mounted() {
|
|
|
if (this.exData.id) {
|
|
|
- this.$set(this.form, 'id', this.exData.id)
|
|
|
- this.fileList = [
|
|
|
+ this.$set(this.form, 'shop_id', this.exData.id)
|
|
|
+ this.shop_img_url = [
|
|
|
+ {
|
|
|
+ name: '',
|
|
|
+ url: this.exData.shop_img_url
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ this.user_code_url = [
|
|
|
{
|
|
|
name: '',
|
|
|
url: this.exData.user_code_url
|
|
@@ -248,12 +242,15 @@ export default {
|
|
|
if (this.form.hasOwnProperty(key)) {
|
|
|
let value = this.exData[key]
|
|
|
if ((Array.isArray(value) && value.length >= 1) || (Object.prototype.toString.call(value) === '[object Object]') || (typeof value === 'string' && value) || typeof value === 'number') {
|
|
|
- if (key === 'user_code_url') {
|
|
|
+ if (key === 'user_code_url' || key === 'shop_img_url') {
|
|
|
value = [value]
|
|
|
}
|
|
|
if (key === 'sort_id') {
|
|
|
value = value.toString()
|
|
|
}
|
|
|
+ if (key === 'shop_address' && Object.prototype.toString.call(value) === '[object Object]') {
|
|
|
+ value = value.address_name + value.name
|
|
|
+ }
|
|
|
this.$set(this.form, key, value)
|
|
|
}
|
|
|
}
|