|
@@ -12,52 +12,84 @@
|
|
:rules="formRules"
|
|
:rules="formRules"
|
|
label-width="120px">
|
|
label-width="120px">
|
|
<el-form-item
|
|
<el-form-item
|
|
- prop="rotation_name"
|
|
|
|
|
|
+ prop="user_name"
|
|
:rules="formRules.required"
|
|
:rules="formRules.required"
|
|
label="农户姓名:">
|
|
label="农户姓名:">
|
|
- <el-input v-model="form.rotation_name"
|
|
|
|
- placeholder="请输入农户姓名"
|
|
|
|
- clearable></el-input>
|
|
|
|
|
|
+ <el-input
|
|
|
|
+ v-model="form.user_name"
|
|
|
|
+ placeholder="请输入农户姓名"
|
|
|
|
+ clearable></el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item
|
|
<el-form-item
|
|
- prop="rotation_name"
|
|
|
|
|
|
+ prop="user_card"
|
|
:rules="formRules.required"
|
|
:rules="formRules.required"
|
|
label="身份证号:">
|
|
label="身份证号:">
|
|
- <el-input v-model="form.rotation_name"
|
|
|
|
|
|
+ <el-input v-model="form.user_card"
|
|
placeholder="请输入身份证号"
|
|
placeholder="请输入身份证号"
|
|
clearable></el-input>
|
|
clearable></el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item
|
|
<el-form-item
|
|
- prop="sort_id"
|
|
|
|
|
|
+ prop="shop_phone"
|
|
:rules="formRules.required"
|
|
:rules="formRules.required"
|
|
label="手机号:">
|
|
label="手机号:">
|
|
- <el-input v-model="form.sort_id"
|
|
|
|
- placeholder="请输入手机号"
|
|
|
|
- clearable
|
|
|
|
- @input="form.sort_id = form.sort_id.replace(/[^\d]$/, '').replace(/^0\d/, '')"></el-input>
|
|
|
|
|
|
+ <el-input
|
|
|
|
+ v-model="form.shop_phone"
|
|
|
|
+ placeholder="请输入手机号"
|
|
|
|
+ clearable
|
|
|
|
+ @input="form.shop_phone = form.shop_phone.replace(/[^\d]$/, '').replace(/^0/, '').replace(/(\d{11})(.*)/, '$1')"></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item
|
|
|
|
+ prop="shop_name"
|
|
|
|
+ :rules="formRules.required"
|
|
|
|
+ label="店铺名称:">
|
|
|
|
+ <el-input
|
|
|
|
+ v-model="form.shop_name"
|
|
|
|
+ placeholder="请输入店铺名称"
|
|
|
|
+ clearable></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item
|
|
|
|
+ prop="shop_img_url"
|
|
|
|
+ :rules="formRules.uploadImgs"
|
|
|
|
+ label="店铺图片:">
|
|
|
|
+ <el-upload
|
|
|
|
+ :on-remove="(file) => {handleRemove(file, 'shop_img_url')}"
|
|
|
|
+ :on-success="handleAvatarSuccess"
|
|
|
|
+ :before-upload="beforeAvatarUpload"
|
|
|
|
+ :on-exceed="hadnleExceed"
|
|
|
|
+ :accept="'image/*'"
|
|
|
|
+ :limit="1"
|
|
|
|
+ :file-list="fileList0"
|
|
|
|
+ list-type="picture-card"
|
|
|
|
+ action="/api/upload/img"
|
|
|
|
+ multiple>
|
|
|
|
+ <i class="el-icon-plus"></i>
|
|
|
|
+ <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过5M</div>
|
|
|
|
+ </el-upload>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item
|
|
<el-form-item
|
|
- prop="rotation_name"
|
|
|
|
|
|
+ prop="country_msg"
|
|
:rules="formRules.required"
|
|
:rules="formRules.required"
|
|
label="村信息:">
|
|
label="村信息:">
|
|
- <el-input v-model="form.rotation_name"
|
|
|
|
- placeholder="请输入村信息"
|
|
|
|
- clearable></el-input>
|
|
|
|
|
|
+ <el-input
|
|
|
|
+ v-model="form.country_msg"
|
|
|
|
+ placeholder="请输入村信息"
|
|
|
|
+ clearable></el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item
|
|
<el-form-item
|
|
- prop="rotation_name"
|
|
|
|
|
|
+ prop="user_wechat_code"
|
|
:rules="formRules.required"
|
|
:rules="formRules.required"
|
|
label="微信号:">
|
|
label="微信号:">
|
|
- <el-input v-model="form.rotation_name"
|
|
|
|
- placeholder="请输入微信号"
|
|
|
|
- clearable></el-input>
|
|
|
|
|
|
+ <el-input
|
|
|
|
+ v-model="form.user_wechat_code"
|
|
|
|
+ placeholder="请输入微信号"
|
|
|
|
+ clearable></el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item
|
|
<el-form-item
|
|
- prop="rotation_img_url"
|
|
|
|
|
|
+ prop="user_code_url"
|
|
:rules="formRules.uploadImgs"
|
|
:rules="formRules.uploadImgs"
|
|
label="个人二维码:">
|
|
label="个人二维码:">
|
|
<el-upload
|
|
<el-upload
|
|
- :on-remove="handleRemove"
|
|
|
|
|
|
+ :on-remove="(file) => {handleRemove(file, 'user_code_url')}"
|
|
:on-success="handleAvatarSuccess"
|
|
:on-success="handleAvatarSuccess"
|
|
:before-upload="beforeAvatarUpload"
|
|
:before-upload="beforeAvatarUpload"
|
|
:on-exceed="hadnleExceed"
|
|
:on-exceed="hadnleExceed"
|
|
@@ -65,30 +97,31 @@
|
|
:limit="1"
|
|
:limit="1"
|
|
:file-list="fileList"
|
|
:file-list="fileList"
|
|
list-type="picture-card"
|
|
list-type="picture-card"
|
|
- action="/api/admin/v1/upload/file"
|
|
|
|
|
|
+ action="/api/upload/img"
|
|
multiple>
|
|
multiple>
|
|
<i class="el-icon-plus"></i>
|
|
<i class="el-icon-plus"></i>
|
|
<div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过5M</div>
|
|
<div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过5M</div>
|
|
</el-upload>
|
|
</el-upload>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item
|
|
<el-form-item
|
|
- prop="rotation_name"
|
|
|
|
|
|
+ prop="shop_address"
|
|
:rules="formRules.required"
|
|
:rules="formRules.required"
|
|
label="详细地址:">
|
|
label="详细地址:">
|
|
- <el-input v-model="form.rotation_name"
|
|
|
|
- placeholder="请输入详细地址"
|
|
|
|
- clearable></el-input>
|
|
|
|
|
|
+ <el-input
|
|
|
|
+ v-model="form.shop_address"
|
|
|
|
+ placeholder="请输入详细地址"
|
|
|
|
+ clearable></el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item
|
|
<el-form-item
|
|
label="备注:"
|
|
label="备注:"
|
|
- prop="rotation_url"
|
|
|
|
- v-show="form.rotation_link_type !== 1">
|
|
|
|
- <el-input type="textarea"
|
|
|
|
- :rows="4"
|
|
|
|
- placeholder="上限200字符"
|
|
|
|
- maxlength="200"
|
|
|
|
- show-word-limit
|
|
|
|
- v-model="form.rotation_url">
|
|
|
|
|
|
+ prop="shop_remark">
|
|
|
|
+ <el-input
|
|
|
|
+ type="textarea"
|
|
|
|
+ :rows="4"
|
|
|
|
+ placeholder="上限200字符"
|
|
|
|
+ maxlength="200"
|
|
|
|
+ show-word-limit
|
|
|
|
+ v-model="form.shop_remark">
|
|
</el-input>
|
|
</el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-form>
|
|
</el-form>
|
|
@@ -101,8 +134,6 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
-import { yuan2Fen, fen2Yuan } from '@/utils'
|
|
|
|
-
|
|
|
|
export default {
|
|
export default {
|
|
props: {
|
|
props: {
|
|
value: {
|
|
value: {
|
|
@@ -120,15 +151,18 @@ export default {
|
|
return {
|
|
return {
|
|
dialog: !!this.value,
|
|
dialog: !!this.value,
|
|
form: {
|
|
form: {
|
|
- 'rotation_img_url': [], // 轮播图片地址
|
|
|
|
- 'rotation_status': '', // 轮播图状态(0无效1有效)
|
|
|
|
- 'rotation_url': '', // 链接
|
|
|
|
- 'rotation_name': '', // 轮播图名称
|
|
|
|
- 'sort_id': '', // 排序ID
|
|
|
|
- 'rotation_type': '', // 轮播类型(1首页2直播间)
|
|
|
|
- 'rotation_channel': '', // 应用包
|
|
|
|
- 'rotation_link_type': ''
|
|
|
|
|
|
+ 'user_name': '', // 用户名称
|
|
|
|
+ 'user_card': '', // 身份证
|
|
|
|
+ 'shop_phone': '', // 手机号码
|
|
|
|
+ 'shop_name': '', // 店铺名称
|
|
|
|
+ 'shop_img_url': [], // 店铺图片
|
|
|
|
+ 'country_msg': '', // 村信息
|
|
|
|
+ 'user_wechat_code': '', // 微信号
|
|
|
|
+ 'user_code_url': [], // 微信二维码
|
|
|
|
+ 'shop_address': '', // 地址
|
|
|
|
+ 'shop_remark': '' // 备注
|
|
},
|
|
},
|
|
|
|
+ fileList0: [],
|
|
fileList: [],
|
|
fileList: [],
|
|
booLock: false
|
|
booLock: false
|
|
}
|
|
}
|
|
@@ -155,27 +189,28 @@ export default {
|
|
}
|
|
}
|
|
return isLt2M
|
|
return isLt2M
|
|
},
|
|
},
|
|
- handleRemove(file) {
|
|
|
|
|
|
+ hadnleExceed(files, fileList) {
|
|
|
|
+ this.$message({
|
|
|
|
+ message: '最多上传一张',
|
|
|
|
+ type: 'warning'
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ handleRemove(file, e) {
|
|
|
|
+ console.log(e)
|
|
let path = file.url
|
|
let path = file.url
|
|
if (file.response && file.response.data) {
|
|
if (file.response && file.response.data) {
|
|
path = file.response.data.path
|
|
path = file.response.data.path
|
|
}
|
|
}
|
|
- this.form.rotation_img_url = this.form.rotation_img_url.filter(item => item !== path)
|
|
|
|
|
|
+ this.form.user_code_url = this.form.user_code_url.filter(item => item !== path)
|
|
},
|
|
},
|
|
handleAvatarSuccess(res) {
|
|
handleAvatarSuccess(res) {
|
|
if (res.code === 200) {
|
|
if (res.code === 200) {
|
|
const { path } = res.data
|
|
const { path } = res.data
|
|
- this.form.rotation_img_url.push(path)
|
|
|
|
|
|
+ this.form.user_code_url.push(path)
|
|
} else {
|
|
} else {
|
|
this.$message.error('图片上传失败')
|
|
this.$message.error('图片上传失败')
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- hadnleExceed(files, fileList) {
|
|
|
|
- this.$message({
|
|
|
|
- message: '最多上传一张',
|
|
|
|
- type: 'warning'
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
handleSubmit() {
|
|
handleSubmit() {
|
|
const url = this.exData.id ? '/v1/setting/rotation/modify' : '/v1/setting/rotation/add'
|
|
const url = this.exData.id ? '/v1/setting/rotation/modify' : '/v1/setting/rotation/add'
|
|
this.$refs.form.validate(async valid => {
|
|
this.$refs.form.validate(async valid => {
|
|
@@ -183,7 +218,7 @@ export default {
|
|
const formData = JSON.parse(JSON.stringify(this.form))
|
|
const formData = JSON.parse(JSON.stringify(this.form))
|
|
const postData = {
|
|
const postData = {
|
|
...formData,
|
|
...formData,
|
|
- rotation_img_url: formData.rotation_img_url[0]
|
|
|
|
|
|
+ user_code_url: formData.user_code_url[0]
|
|
}
|
|
}
|
|
if (this.form.rotation_link_type === 1) {
|
|
if (this.form.rotation_link_type === 1) {
|
|
postData.rotation_url = ''
|
|
postData.rotation_url = ''
|
|
@@ -206,14 +241,14 @@ export default {
|
|
this.fileList = [
|
|
this.fileList = [
|
|
{
|
|
{
|
|
name: '',
|
|
name: '',
|
|
- url: this.exData.rotation_img_url
|
|
|
|
|
|
+ url: this.exData.user_code_url
|
|
}
|
|
}
|
|
]
|
|
]
|
|
for (const key in this.exData) {
|
|
for (const key in this.exData) {
|
|
if (this.form.hasOwnProperty(key)) {
|
|
if (this.form.hasOwnProperty(key)) {
|
|
let value = this.exData[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 ((Array.isArray(value) && value.length >= 1) || (Object.prototype.toString.call(value) === '[object Object]') || (typeof value === 'string' && value) || typeof value === 'number') {
|
|
- if (key === 'rotation_img_url') {
|
|
|
|
|
|
+ if (key === 'user_code_url') {
|
|
value = [value]
|
|
value = [value]
|
|
}
|
|
}
|
|
if (key === 'sort_id') {
|
|
if (key === 'sort_id') {
|