|
@@ -2,13 +2,37 @@
|
|
|
<div>
|
|
|
<el-dialog :visible.sync="visible" v-bind="modalOptions">
|
|
|
<div>
|
|
|
- <el-form ref="formData" :model="formData" :rules="formRules" size="mini" label-suffix=":" label-width="150px">
|
|
|
+ <el-form ref="formData" :model="formData" :rules="formRules" size="mini" label-suffix=":" label-width="160px">
|
|
|
<div>
|
|
|
<el-tabs v-model="activeName">
|
|
|
<el-tab-pane label="授权信息" name="first">
|
|
|
<el-form-item label="店铺名称" prop="shopName">
|
|
|
<el-input v-model="formData.shopName" maxlength="20" />
|
|
|
</el-form-item>
|
|
|
+ <el-form-item label="是否支持代金券" prop="isVoucher">
|
|
|
+ <el-radio-group v-model="formData.isVoucher">
|
|
|
+ <el-radio :label="1">
|
|
|
+ 允许
|
|
|
+ </el-radio>
|
|
|
+ <el-radio :label="2">
|
|
|
+ 拒绝
|
|
|
+ </el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item
|
|
|
+ v-if="formData.isVoucher === 1" :rules="[
|
|
|
+ { required: true, message: '请输入代金券返还比例', trigger: 'blur' },
|
|
|
+ { type: 'number', max: 100, min: 0, message: '请输入正确的代金券返还比例,0 ~ 100', trigger: ['blur', 'change'] }
|
|
|
+ ]" label="代金券返还比例" prop="voucherReturn"
|
|
|
+ >
|
|
|
+ <el-input v-model.number="formData.voucherReturn" style="width: 200px;" placeholder="请填写代金券返还比例,范围0 ~ 100">
|
|
|
+ <template #append>%</template>
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="代金券提现比例" prop="voucherCoinRatio">
|
|
|
+ <el-input-number v-model="formData.voucherCoinRatio" :precision="2" :step="0.01" :max="1"></el-input-number>
|
|
|
+ <span style="margin-left: 10px;">比例*100</span>
|
|
|
+ </el-form-item>
|
|
|
<el-form-item label="是否支持消费金" prop="isBeeCoin">
|
|
|
<el-radio-group v-model="formData.isBeeCoin">
|
|
|
<el-radio :label="1">支持</el-radio>
|
|
@@ -108,26 +132,6 @@
|
|
|
>
|
|
|
</el-time-select>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="是否支持代金券" prop="isVoucher">
|
|
|
- <el-radio-group v-model="formData.isVoucher">
|
|
|
- <el-radio :label="1">
|
|
|
- 允许
|
|
|
- </el-radio>
|
|
|
- <el-radio :label="2">
|
|
|
- 拒绝
|
|
|
- </el-radio>
|
|
|
- </el-radio-group>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item
|
|
|
- v-if="formData.isVoucher === 1" :rules="[
|
|
|
- { required: true, message: '请输入代金券返还比例', trigger: 'blur' },
|
|
|
- { type: 'number', max: 100, min: 0, message: '请输入正确的代金券返还比例,0 ~ 100', trigger: ['blur', 'change'] }
|
|
|
- ]" label="代金券返还比例" prop="voucherReturn"
|
|
|
- >
|
|
|
- <el-input v-model.number="formData.voucherReturn" placeholder="请填写代金券返还比例,范围0 ~ 100">
|
|
|
- <template #append>%</template>
|
|
|
- </el-input>
|
|
|
- </el-form-item>
|
|
|
<el-form-item label="惠市宝商家编号">
|
|
|
<el-input v-model="formData.hsbMrchId" maxlength="60" />
|
|
|
</el-form-item>
|
|
@@ -174,10 +178,10 @@
|
|
|
:action="uploadUrl"
|
|
|
:on-success="(r) => formData.advertisement.push({ url: r.url, uid: r.url + Math.random() + Date.now() })"
|
|
|
:on-remove="(e) => formData.advertisement.filter((item) => item.uid !== e.uid)"
|
|
|
- >
|
|
|
+ >
|
|
|
<i class="el-icon-plus avatar-uploader-icon" />
|
|
|
- </el-upload> -->
|
|
|
-
|
|
|
+ </el-upload> -->
|
|
|
+
|
|
|
<el-upload
|
|
|
class="avatar-uploader" list-type="picture-card" :file-list="uploadList"
|
|
|
:action="uploadUrl"
|
|
@@ -242,6 +246,7 @@ export default {
|
|
|
formData: {
|
|
|
shopId: '',
|
|
|
shopName: '', // 店铺名称
|
|
|
+ voucherCoinRatio: '', // 代金券提现比例
|
|
|
isBeeCoin: '', // 是否支持消费金
|
|
|
beeCoinRatio: '', // 商家消费金提现比例
|
|
|
chargePersonName: '', // 店铺负责人
|
|
@@ -329,7 +334,7 @@ export default {
|
|
|
},
|
|
|
uploadUrl,
|
|
|
categoryList: [],
|
|
|
- uploadList:[]
|
|
|
+ uploadList: []
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
@@ -390,20 +395,18 @@ export default {
|
|
|
const res = await businessListGetById({ shopId: id })
|
|
|
this.formData = Object.assign(this.$options.data().formData, res.data, {
|
|
|
shopId: res.data.shopId || '',
|
|
|
- voucherReturn:Number(res.data.voucherReturn)
|
|
|
+ voucherReturn: Number(res.data.voucherReturn)
|
|
|
// advertisement: res.data.advertisement ? res.data.advertisement.split(',').map((item) => ({ url: item, uid: item + Math.random() + new Date() })) : []
|
|
|
// advertisement
|
|
|
})
|
|
|
- let arr = this.formData.advertisement.split(",");
|
|
|
- if(arr[0] == ""){
|
|
|
+ const arr = this.formData.advertisement.split(',')
|
|
|
+ if (arr[0] == '') {
|
|
|
this.uploadList = []
|
|
|
- }else{
|
|
|
- this.uploadList = arr.map(item=>{
|
|
|
- return {
|
|
|
+ } else {
|
|
|
+ this.uploadList = arr.map((item) => ({
|
|
|
url: item,
|
|
|
uid: item + Math.random() + new Date()
|
|
|
- }
|
|
|
- })
|
|
|
+ }))
|
|
|
}
|
|
|
const categoryItem = XeUtils.findTree(this.categoryList, (item) => item.id === String(res.data.classificationId))
|
|
|
if (categoryItem && Array.isArray(categoryItem.nodes)) {
|
|
@@ -428,12 +431,12 @@ export default {
|
|
|
// advertisement: Array.isArray(advertisement) ? advertisement.map((v) => v.url || v).join(',') : '',
|
|
|
classificationId: Array.isArray(classificationArr) && classificationArr.length ? classificationArr[classificationArr.length - 1] : ''
|
|
|
}
|
|
|
- params.advertisement = this.uploadList.reduce((prev,item,index)=>{
|
|
|
- prev += item.url + ","
|
|
|
+ params.advertisement = this.uploadList.reduce((prev, item, index) => {
|
|
|
+ prev += item.url + ','
|
|
|
return prev
|
|
|
- },"")
|
|
|
+ }, '')
|
|
|
// 删除最后一个字符
|
|
|
- params.advertisement = params.advertisement.substring(0,params.advertisement.length - 1)
|
|
|
+ params.advertisement = params.advertisement.substring(0, params.advertisement.length - 1)
|
|
|
this.formData.shopId ? await businessListUpdate(params) : await businessListSave(params)
|
|
|
loading.close()
|
|
|
this.$message({ message: `${this.formData.shopId ? '编辑' : '添加'}成功!`, type: 'success' })
|
|
@@ -450,12 +453,12 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- uploadSuccess(r){
|
|
|
- console.log(r);
|
|
|
- this.uploadList.push({url:r.data.url,uid: r.url + Math.random() + Date.now()})
|
|
|
+ uploadSuccess(r) {
|
|
|
+ console.log(r)
|
|
|
+ this.uploadList.push({ url: r.data.url, uid: r.url + Math.random() + Date.now() })
|
|
|
},
|
|
|
- removeSuccess(r){
|
|
|
- this.uploadList = this.uploadList.filter(item => item.uid !== r.uid)
|
|
|
+ removeSuccess(r) {
|
|
|
+ this.uploadList = this.uploadList.filter((item) => item.uid !== r.uid)
|
|
|
}
|
|
|
}
|
|
|
}
|