|
@@ -18,56 +18,90 @@
|
|
|
element-loading-spinner="''"
|
|
|
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-tabs>
|
|
|
<el-form :model="form" ref="form" :rules="rules" label-width="120px">
|
|
|
- <div class="form-title"><span>基本信息</span></div>
|
|
|
- <div style="display: flex;">
|
|
|
- <el-form-item label="会员名称:">
|
|
|
- <span style="display: block; min-width: 250px;">{{ form.realName }}</span>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="性别:">
|
|
|
- <dict-tag :options="dict.type.tourism_memberInformation_sex" :value="form.sex"/>
|
|
|
- </el-form-item>
|
|
|
- </div>
|
|
|
- <div style="display: flex;">
|
|
|
- <el-form-item label="手机号:">
|
|
|
- <span style="display: block;min-width: 250px;">{{ form.mobile }}</span>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="身份证号:">
|
|
|
- <span style="display: block;min-width: 250px;">{{ form.cardId }}</span>
|
|
|
- </el-form-item>
|
|
|
- </div>
|
|
|
- <div style="display: flex;">
|
|
|
- <el-form-item label="注册时间:">
|
|
|
- <span style="display: block;min-width: 250px;">{{ form.createTime }}</span>
|
|
|
- </el-form-item>
|
|
|
- </div>
|
|
|
- <div class="form-title"><span>会员信息</span></div>
|
|
|
- <div style="display: flex;">
|
|
|
- <el-form-item label="会员类型:">
|
|
|
- <span style="display: block;min-width: 250px;">
|
|
|
- <dict-tag :options="dict.type.tourism_memberInformation_user_type" :value="form.type"/>
|
|
|
- </span>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="会员卡号:">
|
|
|
- <span style="display: block;min-width: 250px;">{{ form.memberCode }}</span>
|
|
|
- </el-form-item>
|
|
|
- </div>
|
|
|
- <div style="display: flex;">
|
|
|
- <el-form-item label="剩余积分:">
|
|
|
- <span style="display: block;min-width: 250px;">{{ form.credit }}</span>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="剩余储值:">
|
|
|
- <span style="display: block;min-width: 250px;">{{ form.balance }}</span>
|
|
|
- </el-form-item>
|
|
|
- </div>
|
|
|
- <div class="form-title"><span>消费数据</span></div>
|
|
|
- <div style="display: flex;">
|
|
|
- <el-form-item label="下单数(单):">
|
|
|
- <span style="display: block;min-width: 250px;">{{ form.orderCount }}</span>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="支付成功数(单):">
|
|
|
- <span style="display: block;min-width: 250px;">{{ form.buyCount }}</span>
|
|
|
- </el-form-item>
|
|
|
+ <div v-show="activeName == 'first'">
|
|
|
+ <el-form-item label="活动名称:" prop="activityName">
|
|
|
+ <span>{{ form.activityName }}</span>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="封面:" prop="image">
|
|
|
+ <div style="display: flex;">
|
|
|
+ <div
|
|
|
+ v-for="(item,index) in form.image"
|
|
|
+ :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.image">
|
|
|
+ </el-image>
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ style="width: 100px; height: 100px;"
|
|
|
+ v-if="!form.image||form.image.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>建议尺寸375px X 392px,支持jpg/png/gif,支持1MB大小以内的图片上传</span>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="活动起止时间:" prop="eventTime">
|
|
|
+ <span>{{ form.eventTime && form.eventTime.join('—') }}</span>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="选择模板:" prop="templateId">
|
|
|
+ <span>{{ form.tempInfo && form.tempInfo.templateName }}</span>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="优惠券:" prop="couponVoList">
|
|
|
+ <selectMoreBox
|
|
|
+ v-model="form.couponVoList"
|
|
|
+ title="新增优惠券"
|
|
|
+ listUrl="/merchant/merchantCouponInfo/pageList"
|
|
|
+ nameKey="couponName"
|
|
|
+ selectKey="couponName"
|
|
|
+ :params="{
|
|
|
+ status: 2
|
|
|
+ }"
|
|
|
+ :isAdd="false"
|
|
|
+ @submitForm="()=>$refs.form.validateField('couponVoList')">
|
|
|
+ </selectMoreBox>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="景区门票:" prop="performVoList">
|
|
|
+ <selectMoreBox
|
|
|
+ v-model="form.performVoList"
|
|
|
+ title="新增景区门票"
|
|
|
+ listUrl="/merchant/merchantPerformAuditorium/merchantPerformList"
|
|
|
+ nameKey="name"
|
|
|
+ selectKey="name"
|
|
|
+ idKey="performId"
|
|
|
+ :params="{
|
|
|
+ status: 1
|
|
|
+ }"
|
|
|
+ :isAdd="false"
|
|
|
+ @submitForm="()=>$refs.form.validateField('performVoList')">
|
|
|
+ </selectMoreBox>
|
|
|
+ </el-form-item>
|
|
|
</div>
|
|
|
</el-form>
|
|
|
</div>
|
|
@@ -82,11 +116,17 @@
|
|
|
<script>
|
|
|
import {
|
|
|
getTableDeatilsByIdApi,
|
|
|
+ updateTableApi,
|
|
|
+ addTableApi,
|
|
|
+ listTableApi,
|
|
|
} from '@/api/CURD'
|
|
|
-
|
|
|
+import selectCouponManagement from '../model/selectCouponManagement.vue'
|
|
|
+import selectTicketOrders from "../model/selectTicketOrders.vue"
|
|
|
+import selectMoreBox from '@/myComponents/selectMoreBox.vue';
|
|
|
export default {
|
|
|
name: "addAndEdit",
|
|
|
- dicts: ['tourism_memberInformation_sex','tourism_memberInformation_user_type'],
|
|
|
+ components: {selectCouponManagement,selectTicketOrders,selectMoreBox},
|
|
|
+ dicts: ['tourism_couponManagement_type','tourism_couponManagement_useUserType','tourism_couponManagement_receiveType','tourism_couponManagement_useConfig','goods_type'],
|
|
|
data() {
|
|
|
return {
|
|
|
title: "",
|
|
@@ -96,35 +136,58 @@ export default {
|
|
|
loadingText: "拼命加载数据中...",
|
|
|
formStatus: null, // 0/null : 加载中 1 : 获取详情成功 2 : 获取详情失败
|
|
|
configUrl: {
|
|
|
- add: '', // 新增地址
|
|
|
- details: '/member/memberInfo/detail', // 详情地址
|
|
|
- edit: '', // 编辑地址
|
|
|
+ list: '/merchant/merchantTemplate/pageList', // 列表地址
|
|
|
+ add: '/merchant/merchantActivityInfo/insertOrUpdate', // 新增地址
|
|
|
+ details: '/merchant/merchantActivityInfo/selectById', // 详情地址
|
|
|
+ edit: '/merchant/merchantActivityInfo/insertOrUpdate', // 编辑地址
|
|
|
},
|
|
|
form: {
|
|
|
id: undefined,
|
|
|
},
|
|
|
- rules: {},
|
|
|
- scenicAreaProducts: [],// 景点产品关联
|
|
|
+ rules: {
|
|
|
+ activityName: [{ required: true, message: "请输入活动名称", trigger: ["change","blur"] }],
|
|
|
+ image: [{ required: true, message: "请上传封面", trigger: ["change","blur"] }],
|
|
|
+ eventTime: [{ required: true, message: "请选择活动起止时间", trigger: ["change","blur"] }],
|
|
|
+ templateId: [{ required: true, message: "请选择模板", trigger: ["change","blur"] }],
|
|
|
+ couponVoList: [{ required: true, message: "请选择优惠券", trigger: ["change","blur"] }],
|
|
|
+ performVoList: [{ required: true, message: "请选择景区门票", trigger: ["change","blur"] }],
|
|
|
+ },
|
|
|
+
|
|
|
+ activeName: 'first',
|
|
|
+
|
|
|
+ actionUrl: process.env.VUE_APP_BASE_API + process.env.VUE_APP_UPLOAD_IMAGE,
|
|
|
+ actionUrlLoading: false,
|
|
|
+
|
|
|
+ templateIdList: []
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
async initData(title , model,row){
|
|
|
this.title = title
|
|
|
+ this.activeName = 'first'
|
|
|
this.open = true
|
|
|
this.loadingText = "拼命加载数据中..."
|
|
|
this.loading = true
|
|
|
- this.actionUrlLoading = false
|
|
|
this.model = model
|
|
|
this.formStatus = 0
|
|
|
+ this.getJsonObjList()
|
|
|
if(model=='ADD') { // 新增
|
|
|
- this.$set(this,'form',{...row,imgUrl:[]})
|
|
|
+ this.$set(this,'form',{
|
|
|
+ ...row,
|
|
|
+ eventTime: [], // 活动时间段
|
|
|
+ image: [],
|
|
|
+ couponVoList: [],
|
|
|
+ performVoList: [],
|
|
|
+ })
|
|
|
this.formStatus = 1
|
|
|
}else if(model=='EDIT') { // 新增
|
|
|
let obj = {
|
|
|
...row,
|
|
|
- imgUrl: row.imgUrl?row.imgUrl.split(','):[]
|
|
|
+ image: row.image?row.image.split(','):[],
|
|
|
}
|
|
|
- this.$set(this,'form',obj)
|
|
|
+ this.$set(this,'form',{
|
|
|
+ memberId: row.id
|
|
|
+ })
|
|
|
this.formStatus = 1
|
|
|
}else if(model=='EDITInit') { // 新增
|
|
|
await this.getTableDeatilsFun(row)
|
|
@@ -145,8 +208,9 @@ export default {
|
|
|
if(res.code == 200) {
|
|
|
let obj = {
|
|
|
...res.data,
|
|
|
- imgUrl: res.data.imgUrl?res.data.imgUrl.split(','):[],
|
|
|
- }
|
|
|
+ eventTime: [res.data.startDate,res.data.endDate], // 发放时间段
|
|
|
+ image: res.data.image?res.data.image.split(','):[],
|
|
|
+ }
|
|
|
this.$set(this,'form',JSON.parse(JSON.stringify(obj)))
|
|
|
this.formStatus = 1
|
|
|
}else {
|
|
@@ -163,6 +227,84 @@ export default {
|
|
|
this.open = false;
|
|
|
}
|
|
|
},
|
|
|
+ /** 查询模板列表 */
|
|
|
+ async getJsonObjList() {
|
|
|
+ try {
|
|
|
+ let res = await listTableApi(this.configUrl.list,{
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 999
|
|
|
+ })
|
|
|
+ if(res.code == 200) {
|
|
|
+ this.templateIdList = res.data.rows;
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ this.loading = false
|
|
|
+ this.open = false;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 保存
|
|
|
+ * @date 2023-11-22
|
|
|
+ * @returns {any}
|
|
|
+ */
|
|
|
+ submitForm() {
|
|
|
+ this.$refs["form"].validate((valid ,object)=> {
|
|
|
+ if (valid) {
|
|
|
+ this.loadingText = "提交数据中..."
|
|
|
+ this.loading = true
|
|
|
+ let param = JSON.parse(JSON.stringify(this.form))
|
|
|
+ param['startDate'] = param.eventTime[0]
|
|
|
+ param['endDate'] = param.eventTime[1]
|
|
|
+
|
|
|
+ param['couponIdList'] = this.form.couponVoList.map((item)=> item.id)
|
|
|
+ param['performIdList'] = this.form.performVoList.map((item)=> item.id)
|
|
|
+
|
|
|
+ delete param.eventTime
|
|
|
+ delete param.couponVoList
|
|
|
+ delete param.performVoList
|
|
|
+ if (this.model != 'ADD') {
|
|
|
+ addTableApi(
|
|
|
+ this.configUrl.edit,{
|
|
|
+ ...param,
|
|
|
+ image: param.image ? param.image.join(','):'',
|
|
|
+ }).then(response => {
|
|
|
+ this.$modal.msgSuccess("修改成功");
|
|
|
+ this.loading = false
|
|
|
+ this.open = false;
|
|
|
+ this.$emit('refresh')
|
|
|
+ }).catch(()=>{
|
|
|
+ this.$message.error("修改失败!!!");
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ addTableApi(this.configUrl.edit,{
|
|
|
+ ...param,
|
|
|
+ image: param.image ? param.image.join(','):'',
|
|
|
+ }).then(response => {
|
|
|
+ this.$modal.msgSuccess("新增成功");
|
|
|
+ this.loading = false
|
|
|
+ this.open = false;
|
|
|
+ this.$emit('refresh')
|
|
|
+ }).catch(()=>{
|
|
|
+ this.$message.error("新增失败!!!");
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
/**
|
|
|
* 重置
|
|
|
* @date 2023-11-22
|
|
@@ -182,6 +324,40 @@ export default {
|
|
|
this.reset();
|
|
|
this.open = false;
|
|
|
},
|
|
|
+ /** 点击tab */
|
|
|
+ handleClick() {
|
|
|
+
|
|
|
+ },
|
|
|
+ /** 上传图片 单张 */
|
|
|
+ handleAvatarSuccess(response, file, fileList) {
|
|
|
+ console.log("res, file",response, file, fileList)
|
|
|
+ this.actionUrlLoading = false
|
|
|
+ if(response.code == 200) {
|
|
|
+ this.form.image.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.image.splice(index,1)
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
@@ -295,6 +471,7 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
::v-deep .avatar-uploader .el-upload {
|
|
|
border: 1px dashed #d9d9d9;
|
|
|
border-radius: 6px;
|