|
@@ -19,14 +19,13 @@
|
|
|
element-loading-background="rgba(0, 0, 0, 0.8)"
|
|
|
>
|
|
|
<el-tabs v-model="activeName" @tab-click="handleClick">
|
|
|
- <el-tab-pane label="用户管理" name="first"></el-tab-pane>
|
|
|
- <el-tab-pane label="配置管理" name="second"></el-tab-pane>
|
|
|
+ <el-tab-pane label="基本信息" name="first"></el-tab-pane>
|
|
|
+ <el-tab-pane label="使用规则" name="second"></el-tab-pane>
|
|
|
</el-tabs>
|
|
|
<el-form :model="form" ref="form" :rules="rules" label-width="120px">
|
|
|
- <transition name="el-zoom-in-top">
|
|
|
- <div v-show="activeName == 'first'">
|
|
|
- <el-form-item label="优惠券名称" prop="remark">
|
|
|
- <el-input style="width: 350px;" v-model="form.remark" placeholder="请输入优惠券名称" maxlength="50" show-word-limit />
|
|
|
+ <div v-show="activeName == 'first'">
|
|
|
+ <el-form-item label="优惠券名称" prop="couponName">
|
|
|
+ <el-input style="width: 350px;" v-model="form.couponName" placeholder="请输入优惠券名称" maxlength="50" show-word-limit />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="券种说明" prop="remark">
|
|
|
<el-input style="width: 350px;" type="textarea" v-model="form.remark" placeholder="请输入券种说明" maxlength="200" show-word-limit />
|
|
@@ -34,40 +33,203 @@
|
|
|
<el-form-item label="券种类型" prop="type">
|
|
|
<el-radio-group v-model="form.type">
|
|
|
<el-radio
|
|
|
- v-for="dict in dict.type.tourism_memberInformation_biangeng_type"
|
|
|
- :label="dict.value"
|
|
|
+ v-for="dict in dict.type.tourism_couponManagement_type"
|
|
|
+ :label="Number(dict.value)"
|
|
|
>{{ dict.label }}</el-radio>
|
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="变动量" prop="num">
|
|
|
- <el-input-number v-model="form.num" controls-position="right" :precision="0" :min="0" placeholder="请输入变动量"></el-input-number>
|
|
|
+ <el-form-item label="优惠金额" class="is-required">
|
|
|
+ <div style="display: flex;">
|
|
|
+ <span>订单满</span>
|
|
|
+ <el-form-item label="" prop="buyAmount">
|
|
|
+ <el-input-number v-model="form.buyAmount" controls-position="right" :min="0" placeholder="请输入"></el-input-number>
|
|
|
+ </el-form-item>
|
|
|
+ <span>减</span>
|
|
|
+ <el-form-item label="" prop="quota">
|
|
|
+ <el-input-number v-model="form.quota" controls-position="right" :min="0" placeholder="请输入"></el-input-number>
|
|
|
+ </el-form-item>
|
|
|
+ <span>{{ form.type == 1 ? '元':'折' }}</span>
|
|
|
+ </div>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="变动原因说明" prop="remark">
|
|
|
- <el-input style="width: 350px;" type="textarea" v-model="form.remark" placeholder="请输入变动原因说明" maxlength="200" show-word-limit />
|
|
|
+ <el-form-item label="发放数量" prop="issuseNum">
|
|
|
+ <el-input-number v-model="form.issuseNum" controls-position="right" step-strictly :step="1" :min="0" placeholder="请输入发放数量"></el-input-number>
|
|
|
+ <span>张</span>
|
|
|
</el-form-item>
|
|
|
- </div>
|
|
|
- </transition>
|
|
|
-
|
|
|
- <transition name="el-zoom-in-top">
|
|
|
- <div v-show="activeName == 'second'">
|
|
|
- <el-form-item label="积分变动111" prop="type">
|
|
|
- <el-radio-group v-model="form.type">
|
|
|
+ <el-form-item label="发放时间" prop="grantTime">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="form.grantTime"
|
|
|
+ type="datetimerange"
|
|
|
+ range-separator="至"
|
|
|
+ start-placeholder="开始日期"
|
|
|
+ value-format="yyyy-MM-dd HH:mm:ss"
|
|
|
+ end-placeholder="结束日期">
|
|
|
+ </el-date-picker>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="使用有效期:" prop="useType">
|
|
|
+ <el-radio-group v-model="form.useType" @input="radioInputs">
|
|
|
+ <div style="display: flex;flex-direction: column;">
|
|
|
+ <div style="display: flex;align-items: center;">
|
|
|
+ <el-radio style="display: flex;align-items: center;" :label="1">
|
|
|
+ <div style="display: flex;align-items: center;">
|
|
|
+ <el-form-item label="" label-width="0" :prop="'useDate'">
|
|
|
+ <span>指定时间</span>
|
|
|
+ <el-date-picker
|
|
|
+ :disabled="form.useType!=1"
|
|
|
+ v-model="form.useDate"
|
|
|
+ type="datetimerange"
|
|
|
+ range-separator="至"
|
|
|
+ start-placeholder="开始日期"
|
|
|
+ value-format="yyyy-MM-dd HH:mm:ss"
|
|
|
+ end-placeholder="结束日期">
|
|
|
+ </el-date-picker>
|
|
|
+ </el-form-item>
|
|
|
+ </div>
|
|
|
+ </el-radio>
|
|
|
+ </div>
|
|
|
+ <div style="display: flex;align-items: center;margin-top: 25px;">
|
|
|
+ <el-radio style="display: flex;align-items: center;" :label="2">
|
|
|
+ <div style="display: flex;align-items: center;">
|
|
|
+ <el-form-item label="" label-width="0" :prop="'useDay'">
|
|
|
+ <span>领取当日起</span>
|
|
|
+ <el-input-number
|
|
|
+ :disabled="form.useType!=2"
|
|
|
+ v-model="form.useDay"
|
|
|
+ step-strictly
|
|
|
+ :step="1"
|
|
|
+ placeholder="请输入天数"
|
|
|
+ controls-position="right">
|
|
|
+ </el-input-number>
|
|
|
+ <span>天内使用</span>
|
|
|
+ </el-form-item>
|
|
|
+ </div>
|
|
|
+ </el-radio>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ </div>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="优惠券背景图" prop="imag">
|
|
|
+ <div style="display: flex;">
|
|
|
+ <div
|
|
|
+ v-for="(item,index) in form.imag"
|
|
|
+ :key="index"
|
|
|
+ style="width: 100px; height: 100px;position: relative;border: 1px solid #999;border-radius: 5px;margin-right: 20px;">
|
|
|
+ <el-image
|
|
|
+ style="width: 100%; height: 100%"
|
|
|
+ :src="item"
|
|
|
+ :preview-src-list="form.imag">
|
|
|
+ </el-image>
|
|
|
+ <span @click="handleRemove(index)" style="position: absolute;top: -15px;right: -15px;color: red;font-size: 24px;z-index: 999;cursor: pointer;">
|
|
|
+ <i class="el-icon-error"></i>
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ style="width: 100px; height: 100px;"
|
|
|
+ v-if="!form.imag||form.imag.length<1"
|
|
|
+ v-loading="actionUrlLoading"
|
|
|
+ element-loading-text="上传中..."
|
|
|
+ element-loading-spinner="el-icon-loading"
|
|
|
+ element-loading-background="rgba(0, 0, 0, 0.8)"
|
|
|
+ >
|
|
|
+ <el-upload
|
|
|
+ class="avatar-uploader"
|
|
|
+ :action="actionUrl"
|
|
|
+ :data="{
|
|
|
+ bucket: 'tourism'
|
|
|
+ }"
|
|
|
+ :show-file-list="false"
|
|
|
+ :before-upload="beforeAvatarUpload"
|
|
|
+ :on-success="handleAvatarSuccess"
|
|
|
+ :on-progress="handleAvatarProgress"
|
|
|
+ :disabled="actionUrlLoading"
|
|
|
+ :on-error="handleAvatarError"
|
|
|
+ >
|
|
|
+ <i class="el-icon-plus avatar-uploader-icon"></i>
|
|
|
+ </el-upload>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ </div>
|
|
|
+ <span>建议尺寸322px X 77px,支持jpg/png/gif,支持1MB大小以内的图片上传</span>
|
|
|
+ </el-form-item>
|
|
|
+ </div>
|
|
|
+ <div v-show="activeName == 'second'">
|
|
|
+ <el-form-item label="使用对象:" prop="useUserType" label-width="200px">
|
|
|
+ <el-radio-group v-model="form.useUserType" @input="form.useUserRelid = []">
|
|
|
<el-radio
|
|
|
- v-for="dict in dict.type.tourism_memberInformation_biangeng_type"
|
|
|
- :label="dict.value"
|
|
|
+ v-for="dict in dict.type.tourism_couponManagement_useUserType"
|
|
|
+ :label="Number(dict.value)"
|
|
|
>{{ dict.label }}</el-radio>
|
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="变动量" prop="num">
|
|
|
- <el-input-number v-model="form.num" controls-position="right" :precision="0" :min="0" placeholder="请输入变动量"></el-input-number>
|
|
|
+ <el-form-item label="会员等级" v-if="form.useUserType == 2" prop="useUserRelid_2" label-width="200px">
|
|
|
+ <selectMembershipLevel
|
|
|
+ v-model="form.useUserRelid_2"
|
|
|
+ title="新增会员等级"
|
|
|
+ @submitForm="()=>$refs.form.validateField('useUserRelid_2')">
|
|
|
+ </selectMembershipLevel>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="变动原因说明" prop="remark">
|
|
|
- <el-input style="width: 350px;" type="textarea" v-model="form.remark" placeholder="请输入变动原因说明" maxlength="200" show-word-limit />
|
|
|
+ <el-form-item label="会员号" v-if="form.useUserType == 3" prop="useUserRelid_3" label-width="200px">
|
|
|
+ <selectMemberInformation
|
|
|
+ v-model="form.useUserRelid_3"
|
|
|
+ title="新增会员号"
|
|
|
+ @submitForm="()=>$refs.form.validateField('useUserRelid_3')">
|
|
|
+ </selectMemberInformation>
|
|
|
</el-form-item>
|
|
|
- </div>
|
|
|
- </transition>
|
|
|
-
|
|
|
-
|
|
|
+ <el-form-item label="领取限制:" prop="receiveType" label-width="200px">
|
|
|
+ <div style="display: flex;align-items: center;">
|
|
|
+ <el-radio-group v-model="form.receiveType" @input="radioInput">
|
|
|
+ <div style="display: flex;align-items: center;">
|
|
|
+ <el-radio :label="1">不限</el-radio>
|
|
|
+ <el-radio style="display: flex;align-items: center;" :label="2">
|
|
|
+ <el-form-item label="" label-width="0" :prop="'receiveNum'">
|
|
|
+ <span>每人限领</span>
|
|
|
+ <el-input-number
|
|
|
+ :disabled="form.receiveType!=2"
|
|
|
+ v-model="form.receiveNum"
|
|
|
+ controls-position="right"
|
|
|
+ step-strictly
|
|
|
+ :step="1"
|
|
|
+ :min="0"
|
|
|
+ placeholder="请输入金额"></el-input-number>
|
|
|
+ <span>张</span>
|
|
|
+ </el-form-item>
|
|
|
+ </el-radio>
|
|
|
+ </div>
|
|
|
+ </el-radio-group>
|
|
|
+ </div>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="会员积分抵扣同时使用:" prop="isAdd" label-width="200px">
|
|
|
+ <el-radio-group v-model="form.isAdd">
|
|
|
+ <el-radio
|
|
|
+ v-for="dict in dict.type.tourism_couponManagement_receiveType"
|
|
|
+ :label="Number(dict.value)"
|
|
|
+ >{{ dict.label }}</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="适用产品:" prop="useConfig" label-width="200px">
|
|
|
+ <el-radio-group v-model="form.useConfig">
|
|
|
+ <el-radio
|
|
|
+ v-for="dict in dict.type.tourism_couponManagement_useConfig"
|
|
|
+ :label="Number(dict.value)"
|
|
|
+ >{{ dict.label }}</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="产品类型:" v-if="form.useConfig == 2" prop="useGoodType" label-width="200px">
|
|
|
+ <el-radio-group v-model="form.useGoodType">
|
|
|
+ <el-radio
|
|
|
+ v-for="dict in dict.type.goods_type"
|
|
|
+ :label="dict.value"
|
|
|
+ >{{ dict.label }}</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="" v-if="form.useConfig == 2 && form.useGoodType==1" prop="usePerform_1" label-width="200px">
|
|
|
+ <selectTicketOrders
|
|
|
+ v-model="form.usePerform_1"
|
|
|
+ title="新增门票产品"
|
|
|
+ @submitForm="()=>$refs.form.validateField('usePerform_1')">
|
|
|
+ </selectTicketOrders>
|
|
|
+ </el-form-item>
|
|
|
+ </div>
|
|
|
</el-form>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -94,10 +256,13 @@ import {
|
|
|
updateTableApi,
|
|
|
addTableApi
|
|
|
} from '@/api/CURD'
|
|
|
-
|
|
|
+import selectMembershipLevel from '../model/selectMembershipLevel.vue'
|
|
|
+import selectMemberInformation from '../model/selectMemberInformation.vue'
|
|
|
+import selectTicketOrders from "../model/selectTicketOrders.vue"
|
|
|
export default {
|
|
|
name: "addAndEdit",
|
|
|
- dicts: ['tourism_memberInformation_biangeng_type'],
|
|
|
+ components: {selectMembershipLevel,selectMemberInformation,selectTicketOrders},
|
|
|
+ dicts: ['tourism_couponManagement_type','tourism_couponManagement_useUserType','tourism_couponManagement_receiveType','tourism_couponManagement_useConfig','goods_type'],
|
|
|
data() {
|
|
|
return {
|
|
|
title: "",
|
|
@@ -107,20 +272,43 @@ export default {
|
|
|
loadingText: "拼命加载数据中...",
|
|
|
formStatus: null, // 0/null : 加载中 1 : 获取详情成功 2 : 获取详情失败
|
|
|
configUrl: {
|
|
|
- add: '/member/memberInfo/updateCredit', // 新增地址
|
|
|
- details: '/member/memberInfo/detail', // 详情地址
|
|
|
- edit: '/member/memberInfo/updateCredit', // 编辑地址
|
|
|
+ add: '/merchant/merchantCouponInfo/insertOrUpdate', // 新增地址
|
|
|
+ details: '/merchant/merchantCouponInfo/selectById', // 详情地址
|
|
|
+ edit: '/merchant/merchantCouponInfo/insertOrUpdate', // 编辑地址
|
|
|
},
|
|
|
form: {
|
|
|
id: undefined,
|
|
|
},
|
|
|
rules: {
|
|
|
- type: [{ required: true, message: "请选择积分变动", trigger: ["change","blur"] }],
|
|
|
- num: [{ required: true, message: "请输入变动量", trigger: ["change","blur"] }],
|
|
|
- remark: [{ required: true, message: "请输入变动原因说明", trigger: ["change","blur"] }],
|
|
|
+ couponName: [{ required: true, message: "请输入优惠券名称", trigger: ["change","blur"] }],
|
|
|
+ remark: [{ required: true, message: "请输入券种说明", trigger: ["change","blur"] }],
|
|
|
+ type: [{ required: true, message: "请选择券种类型", trigger: ["change","blur"] }],
|
|
|
+ buyAmount: [{ required: true, message: "请输入订单门槛金额", trigger: ["change","blur"] }],
|
|
|
+ quota: [{ required: true, message: "请输入满减金额/折扣", trigger: ["change","blur"] }],
|
|
|
+ issuseNum: [{ required: true, message: "请输入发放数量", trigger: ["change","blur"] }],
|
|
|
+ grantTime: [{ required: true, message: "请选择发放时间", trigger: ["change","blur"] }],
|
|
|
+
|
|
|
+ useType: [{ required: true, message: "请选择使用有效期", trigger: ["change","blur"] }],
|
|
|
+ useDate: [{ required: false, message: "请选择指定时间", trigger: ["change","blur"] }],
|
|
|
+ useDay: [{ required: false, message: "请输入天数", trigger: ["change","blur"] }],
|
|
|
+ imag: [{ required: true, message: "请上传图片", trigger: ["change","blur"] }],
|
|
|
+
|
|
|
+ useUserType: [{ required: true, message: "请选择使用对象", trigger: ["change","blur"] }],
|
|
|
+ useUserRelid_2: [{ required: true, message: "请选择会员等级", trigger: ["change","blur"] }],
|
|
|
+ useUserRelid_3: [{ required: true, message: "请选择会员号", trigger: ["change","blur"] }],
|
|
|
+ receiveType: [{ required: true, message: "请选择是否领取限制", trigger: ["change","blur"] }],
|
|
|
+ receiveNum: [{ required: false, message: "请输入每人限领数量", trigger: ["change","blur"] }],
|
|
|
+ isAdd: [{ required: true, message: "请选择是否会员积分抵扣同时使用", trigger: ["change","blur"] }],
|
|
|
+
|
|
|
+ useConfig: [{ required: true, message: "请选择适用产品", trigger: ["change","blur"] }],
|
|
|
+ useGoodType: [{ required: true, message: "请选择产品类型", trigger: ["change","blur"] }],
|
|
|
+ usePerform_1: [{ required: true, message: "请选择门票产品", trigger: ["change","blur"] }],
|
|
|
},
|
|
|
|
|
|
activeName: 'first',
|
|
|
+
|
|
|
+ actionUrl: process.env.VUE_APP_BASE_API + process.env.VUE_APP_UPLOAD_IMAGE,
|
|
|
+ actionUrlLoading: false,
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
@@ -133,11 +321,27 @@ export default {
|
|
|
this.model = model
|
|
|
this.formStatus = 0
|
|
|
if(model=='ADD') { // 新增
|
|
|
- this.$set(this,'form',row)
|
|
|
+ this.$set(this,'form',{
|
|
|
+ ...row,
|
|
|
+ grantTime: [], // 发放时间段
|
|
|
+ useDate: [], // 使用指定时间
|
|
|
+ type: 1,
|
|
|
+ useType: 1,
|
|
|
+ useUserType: 1,
|
|
|
+ receiveType: 1,
|
|
|
+ isAdd: 1,
|
|
|
+ useConfig: 1,
|
|
|
+ useGoodType: null,
|
|
|
+ imag: [],
|
|
|
+ useUserRelid_2: [],
|
|
|
+ useUserRelid_3: [],
|
|
|
+ usePerform_1: []
|
|
|
+ })
|
|
|
this.formStatus = 1
|
|
|
}else if(model=='EDIT') { // 新增
|
|
|
let obj = {
|
|
|
- ...row
|
|
|
+ ...row,
|
|
|
+ imag: row.imag?row.imag.split(','):[],
|
|
|
}
|
|
|
this.$set(this,'form',{
|
|
|
memberId: row.id
|
|
@@ -147,6 +351,8 @@ export default {
|
|
|
await this.getTableDeatilsFun(row)
|
|
|
}
|
|
|
this.loading = false
|
|
|
+ this.radioInputs(this.form.useType)
|
|
|
+ this.radioInput(this.form.receiveType)
|
|
|
this.$nextTick(()=>{
|
|
|
if(this.$refs["form"]) {
|
|
|
this.$refs["form"].clearValidate();
|
|
@@ -161,8 +367,33 @@ export default {
|
|
|
let res = await getTableDeatilsByIdApi(this.configUrl.details,{id})
|
|
|
if(res.code == 200) {
|
|
|
let obj = {
|
|
|
- ...res.data
|
|
|
+ ...res.data,
|
|
|
+ grantTime: [res.data.issuseStartDate,res.data.issuseEndDate], // 发放时间段
|
|
|
+ imag: res.data.imag?res.data.imag.split(','):[],
|
|
|
+ quota: res.data.type == 1?res.data.quota:(res.data.quota)*10
|
|
|
+ }
|
|
|
+ if(obj.useType == 1) {
|
|
|
+ obj['useDate'] = [res.data.useStartDate,res.data.useEndDate] // 使用指定时间
|
|
|
+ }else if(obj.useType == 2){
|
|
|
+ obj['useDay'] = obj.useDay
|
|
|
+ }
|
|
|
+ if(obj.useUserType == 2) {
|
|
|
+ obj['useUserRelid_2'] = obj.useUserRelidList?obj.useUserRelidList:[]
|
|
|
+ }else if(obj.useUserType == 3){
|
|
|
+ obj['useUserRelid_3'] = obj.useUserRelidList?obj.useUserRelidList:[]
|
|
|
+ }else {
|
|
|
+ obj['useUserRelid_2'] = []
|
|
|
+ obj['useUserRelid_3'] = []
|
|
|
}
|
|
|
+ if(obj.useConfig == 2) {
|
|
|
+ if(obj.useGoodType == 1) {
|
|
|
+ obj['usePerform_1'] = obj.usePerformList?obj.usePerformList:[]
|
|
|
+ }else {
|
|
|
+ obj['usePerform_1'] = []
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
this.$set(this,'form',JSON.parse(JSON.stringify(obj)))
|
|
|
this.formStatus = 1
|
|
|
}else {
|
|
@@ -185,14 +416,51 @@ export default {
|
|
|
* @returns {any}
|
|
|
*/
|
|
|
submitForm() {
|
|
|
- this.$refs["form"].validate(valid => {
|
|
|
+ this.$refs["form"].validate((valid ,object)=> {
|
|
|
if (valid) {
|
|
|
this.loadingText = "提交数据中..."
|
|
|
this.loading = true
|
|
|
+ let param = JSON.parse(JSON.stringify(this.form))
|
|
|
+ param['issuseStartDate'] = param.grantTime[0]
|
|
|
+ param['issuseEndDate'] = param.grantTime[1]
|
|
|
+
|
|
|
+ param['useStartDate'] = param.useDate[0]
|
|
|
+ param['useEndDate'] = param.useDate[1]
|
|
|
+ if(param.useUserType == 2) {
|
|
|
+ let list = this.form.useUserRelid_2.map((item)=> item.id)
|
|
|
+ param['useUserRelid'] = list.join(',')
|
|
|
+ }else if(param.useUserType == 3){
|
|
|
+ let list = this.form.useUserRelid_3.map((item)=> item.id)
|
|
|
+ param['useUserRelid'] = list.join(',')
|
|
|
+ }else {
|
|
|
+ param['useUserRelid'] = ''
|
|
|
+ }
|
|
|
+
|
|
|
+ param['usePerform'] = ''
|
|
|
+ if(param.useConfig == 2) {
|
|
|
+ if(param.useGoodType == 1) {
|
|
|
+ let list = this.form.usePerform_1.map((item)=> item.id)
|
|
|
+ param['usePerform'] = list.join(',')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(this.form.type == 1){
|
|
|
+ param['quota'] = this.form.quota
|
|
|
+ }else {
|
|
|
+ param['quota'] = (this.form.quota)/10
|
|
|
+ }
|
|
|
+ delete param.grantTime
|
|
|
+ delete param.useDate
|
|
|
+ delete param.useUserRelid_2
|
|
|
+ delete param.useUserRelid_3
|
|
|
+ delete param.useUserRelidList
|
|
|
+
|
|
|
+ delete param.usePerformList
|
|
|
+ delete param.usePerform_1
|
|
|
if (this.model != 'ADD') {
|
|
|
addTableApi(
|
|
|
this.configUrl.edit,{
|
|
|
- ...this.form
|
|
|
+ ...param,
|
|
|
+ imag: param.imag ? param.imag.join(','):'',
|
|
|
}).then(response => {
|
|
|
this.$modal.msgSuccess("修改成功");
|
|
|
this.loading = false
|
|
@@ -204,7 +472,8 @@ export default {
|
|
|
})
|
|
|
} else {
|
|
|
addTableApi(this.configUrl.edit,{
|
|
|
- ...this.form
|
|
|
+ ...param,
|
|
|
+ imag: param.imag ? param.imag.join(','):'',
|
|
|
}).then(response => {
|
|
|
this.$modal.msgSuccess("新增成功");
|
|
|
this.loading = false
|
|
@@ -215,6 +484,18 @@ export default {
|
|
|
this.loading = false
|
|
|
})
|
|
|
}
|
|
|
+ }else {
|
|
|
+ console.log("fsdfsd===",valid,object)
|
|
|
+ if(object&&JSON.stringify(object)!='{}') {
|
|
|
+ let srt = ''
|
|
|
+ for(let key in object) {
|
|
|
+ if(object.hasOwnProperty(key)) {
|
|
|
+ srt = srt + `[${object[key][0].message}],`
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.$message.error(srt);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
});
|
|
|
},
|
|
@@ -240,7 +521,63 @@ export default {
|
|
|
/** 点击tab */
|
|
|
handleClick() {
|
|
|
|
|
|
- }
|
|
|
+ },
|
|
|
+
|
|
|
+ /** */
|
|
|
+ radioInput(value) {
|
|
|
+ if( value == 1 ){
|
|
|
+ this.rules.receiveNum[0].required = false
|
|
|
+ this.$refs.form.clearValidate('receiveNum');
|
|
|
+ }else if( value == 2 ) {
|
|
|
+ this.rules.receiveNum[0].required = true
|
|
|
+ this.$refs.form.clearValidate('receiveNum');
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /** 使用有效期 */
|
|
|
+ radioInputs(value) {
|
|
|
+ if( value == 1 ){
|
|
|
+ this.rules.useDate[0].required = true
|
|
|
+ this.rules.useDay[0].required = false
|
|
|
+ this.$refs.form.clearValidate('useDate');
|
|
|
+ this.$refs.form.clearValidate('useDay');
|
|
|
+ }else if( value == 2 ) {
|
|
|
+ this.rules.useDate[0].required = false
|
|
|
+ this.rules.useDay[0].required = true
|
|
|
+ this.$refs.form.clearValidate('useDate');
|
|
|
+ this.$refs.form.clearValidate('useDay');
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ /** 上传图片 单张 */
|
|
|
+ handleAvatarSuccess(response, file, fileList) {
|
|
|
+ console.log("res, file",response, file, fileList)
|
|
|
+ this.actionUrlLoading = false
|
|
|
+ if(response.code == 200) {
|
|
|
+ this.form.imag.push(response.data.url)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ beforeAvatarUpload(file) {
|
|
|
+ const isLt2M = file.size / 1024 / 1024 <= 1;
|
|
|
+ let testmsg = file.name.substring(file.name.lastIndexOf('.')+1)
|
|
|
+ let typeList = ['png','jepg','jpg']
|
|
|
+ const isJPG = typeList.includes(testmsg);
|
|
|
+ if (!isJPG) {
|
|
|
+ this.$message.error(`上传图片图片只能是 ${typeList} 格式!`);
|
|
|
+ }
|
|
|
+ if (!isLt2M) {
|
|
|
+ this.$message.error('上传图片图片大小不能超过 1MB!');
|
|
|
+ }
|
|
|
+ return isJPG && isLt2M;
|
|
|
+ },
|
|
|
+ handleAvatarProgress(){
|
|
|
+ this.actionUrlLoading = true
|
|
|
+ },
|
|
|
+ handleAvatarError() {
|
|
|
+ this.actionUrlLoading = false
|
|
|
+ },
|
|
|
+ handleRemove(index) {
|
|
|
+ this.form.imag.splice(index,1)
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
@@ -354,6 +691,30 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+::v-deep .avatar-uploader .el-upload {
|
|
|
+ border: 1px dashed #d9d9d9;
|
|
|
+ border-radius: 6px;
|
|
|
+ cursor: pointer;
|
|
|
+ position: relative;
|
|
|
+ overflow: hidden;
|
|
|
+ }
|
|
|
+ ::v-deep .avatar-uploader .el-upload:hover {
|
|
|
+ border-color: #409EFF;
|
|
|
+ }
|
|
|
+ ::v-deep .avatar-uploader-icon {
|
|
|
+ font-size: 28px;
|
|
|
+ color: #8c939d;
|
|
|
+ width: 100px;
|
|
|
+ height: 100px;
|
|
|
+ line-height: 100px;
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+ ::v-deep .avatar {
|
|
|
+ width: 100px;
|
|
|
+ height: 100px;
|
|
|
+ display: block;
|
|
|
+ }
|
|
|
</style>
|
|
|
<style>
|
|
|
.custom-class-box {
|