|
@@ -2,7 +2,7 @@
|
|
|
<el-dialog
|
|
|
:title="title"
|
|
|
:visible.sync="open"
|
|
|
- width="75%"
|
|
|
+ width="95%"
|
|
|
append-to-body
|
|
|
:close-on-click-modal="false"
|
|
|
@close="cancel"
|
|
@@ -72,20 +72,25 @@
|
|
|
<div class="form-title"><span>会员权益</span></div>
|
|
|
<el-form-item label="折扣权益:">
|
|
|
<div style="display: flex;align-items: center;">
|
|
|
- <el-form-item label="基本折扣:" prop="discount" label-width="100px">
|
|
|
+ <el-form-item label="基本折扣:" prop="discount" label-width="150px">
|
|
|
<el-input-number style="width: 150px;" v-model="form.discount" controls-position="right" placeholder="请输入基本折扣"></el-input-number>
|
|
|
<span style="padding-bottom: 15px;">%</span>
|
|
|
</el-form-item>
|
|
|
- <el-button style="margin-left: 15px;" v-if="!form.classifyList||form.classifyList.length==0" type="primary" @click="addClassifyList">添加单品</el-button>
|
|
|
</div>
|
|
|
|
|
|
+ <!-- 门票折扣 -->
|
|
|
+ <div v-if="!form.classifyList||form.classifyList.length==0" style="margin-top: 20px;">
|
|
|
+ <el-form-item label="门票折扣" label-width="150px">
|
|
|
+ <el-button style="margin-left: 15px;" type="primary" @click="addClassifyList('classifyList')">添加门票</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </div>
|
|
|
<div v-for="(item,index) in form.classifyList" :key="index" style="margin-top: 10px;display: flex;align-items: center;">
|
|
|
- <el-form-item label="单品折扣:" label-width="100px">
|
|
|
+ <el-form-item :label="index == 0 ? '门票折扣:':''" label-width="150px">
|
|
|
<el-select
|
|
|
v-model="form.classifyList[index].classifyId"
|
|
|
clearable
|
|
|
- placeholder="请选择单品"
|
|
|
- @visible-change="visibleChange"
|
|
|
+ placeholder="请选择门票"
|
|
|
+ @visible-change="(type)=> visibleChange(type,'scenicAreaProducts','classifyList','performId','classifyId')"
|
|
|
>
|
|
|
<el-option
|
|
|
v-for="item in scenicAreaProducts"
|
|
@@ -96,11 +101,121 @@
|
|
|
>
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
- <el-input-number style="width: 150px;margin-left: 20px;" v-model="form.classifyList[index].discount" placeholder="请输入单品折扣" controls-position="right"></el-input-number>
|
|
|
+ <el-input-number style="width: 150px;margin-left: 20px;" v-model="form.classifyList[index].discount" placeholder="请输入门票折扣" controls-position="right"></el-input-number>
|
|
|
<span style="padding-bottom: 15px;">%</span>
|
|
|
</el-form-item>
|
|
|
- <el-button style="margin-left: 15px;" v-if="form.classifyList.length==(index+1)" type="primary" @click="addClassifyList">添加单品</el-button>
|
|
|
- <el-button style="margin-left: 15px;" type="danger" @click="clearClassifyList(index)">移除</el-button>
|
|
|
+ <el-button style="margin-left: 15px;" v-if="form.classifyList.length==(index+1)" type="primary" @click="addClassifyList('classifyList')">添加门票</el-button>
|
|
|
+ <el-button style="margin-left: 15px;" type="danger" @click="clearClassifyList('classifyList',index)">移除</el-button>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 酒店品类折扣 -->
|
|
|
+ <div v-if="!form.hotelList||form.hotelList.length==0" style="margin-top: 20px;">
|
|
|
+ <el-form-item label="酒店品类折扣" label-width="150px">
|
|
|
+ <el-button style="margin-left: 15px;" type="primary" @click="addClassifyList('hotelList')">添加门票</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </div>
|
|
|
+ <div v-for="(item,index) in form.hotelList" :key="'hotel'+index" style="margin-top: 10px;display: flex;align-items: center;">
|
|
|
+ <el-form-item :label="index == 0 ? '酒店品类折扣:':''" label-width="150px">
|
|
|
+ <el-select
|
|
|
+ v-model="form.hotelList[index].classifyParentId"
|
|
|
+ clearable
|
|
|
+ placeholder="请选择酒店品类"
|
|
|
+ @change="(value) => visibleChange1('hotelList','hoteClassList',index)"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in hotelParentList"
|
|
|
+ :key="item.id + index + 'sdfsdfsfsd'"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.id"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ <selecteNew
|
|
|
+ style="margin-left: 20px;"
|
|
|
+ v-model="form.hotelList[index].classInfo"
|
|
|
+ :list="hoteClassList"
|
|
|
+ placeholder="请选择酒店品类房型"
|
|
|
+ :getDataFun="(page)=> getDataFun(page,configUrl.hotelListClass,5,index,'hoteClassList','hotelList','id','classifyId')"
|
|
|
+ />
|
|
|
+ <el-input-number style="width: 150px;margin-left: 20px;" v-model="form.hotelList[index].discount" placeholder="请输入酒店品类折扣" controls-position="right"></el-input-number>
|
|
|
+ <span style="padding-bottom: 15px;">%</span>
|
|
|
+ </el-form-item>
|
|
|
+ <el-button style="margin-left: 15px;" v-if="form.hotelList.length==(index+1)" type="primary" @click="addClassifyList('hotelList')">添加酒店品类</el-button>
|
|
|
+ <el-button style="margin-left: 15px;" type="danger" @click="clearClassifyList('hotelList',index)">移除</el-button>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 餐饮品类折扣 -->
|
|
|
+ <div v-if="!form.foodList||form.foodList.length==0" style="margin-top: 20px;">
|
|
|
+ <el-form-item label="餐饮品类折扣" label-width="150px">
|
|
|
+ <el-button style="margin-left: 15px;" type="primary" @click="addClassifyList('foodList')">添加门票</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </div>
|
|
|
+ <div v-for="(item,index) in form.foodList" :key="'food'+index" style="margin-top: 10px;display: flex;align-items: center;">
|
|
|
+ <el-form-item :label="index == 0 ? '餐饮品类折扣:':''" label-width="150px">
|
|
|
+ <el-select
|
|
|
+ v-model="form.foodList[index].classifyParentId"
|
|
|
+ clearable
|
|
|
+ placeholder="请选择餐饮品类"
|
|
|
+ @change="(value) => visibleChange1('foodList','foodClassList',index)"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in foodParentList"
|
|
|
+ :key="item.id + index + 'sdfsdfsfsd1'"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.id"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ <selecteNew
|
|
|
+ style="margin-left: 20px;"
|
|
|
+ v-model="form.foodList[index].classInfo"
|
|
|
+ :list="foodClassList"
|
|
|
+ idKey="goodsId"
|
|
|
+ placeholder="请选择菜品"
|
|
|
+ :getDataFun="(page)=> getDataFun(page,configUrl.foodListClass,4,index,'foodClassList','foodList','goodsId','classifyId')"
|
|
|
+ />
|
|
|
+ <el-input-number style="width: 150px;margin-left: 20px;" v-model="form.foodList[index].discount" placeholder="请输入餐饮品类折扣" controls-position="right"></el-input-number>
|
|
|
+ <span style="padding-bottom: 15px;">%</span>
|
|
|
+ </el-form-item>
|
|
|
+ <el-button style="margin-left: 15px;" v-if="form.foodList.length==(index+1)" type="primary" @click="addClassifyList('foodList')">添加餐饮品类</el-button>
|
|
|
+ <el-button style="margin-left: 15px;" type="danger" @click="clearClassifyList('foodList',index)">移除</el-button>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 餐饮品类折扣 -->
|
|
|
+ <div v-if="!form.productList||form.productList.length==0" style="margin-top: 20px;">
|
|
|
+ <el-form-item label="文创品类折扣" label-width="150px">
|
|
|
+ <el-button style="margin-left: 15px;" type="primary" @click="addClassifyList('productList')">添加门票</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </div>
|
|
|
+ <div v-for="(item,index) in form.productList" :key="'product'+index" style="margin-top: 10px;display: flex;align-items: center;">
|
|
|
+ <el-form-item :label="index == 0 ? '文创品类折扣:':''" label-width="150px">
|
|
|
+ <el-select
|
|
|
+ v-model="form.productList[index].classifyParentId"
|
|
|
+ clearable
|
|
|
+ placeholder="请选择文创品类"
|
|
|
+ @change="(value) => visibleChange1('productList','productParentList',index)"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in productParentList"
|
|
|
+ :key="item.id + index + 'sdfsdfsfsd1'"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.id"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ <selecteNew
|
|
|
+ style="margin-left: 20px;"
|
|
|
+ v-model="form.productList[index].classInfo"
|
|
|
+ :list="productClassList"
|
|
|
+ idKey="goodsId"
|
|
|
+ placeholder="请选择文创类品商品"
|
|
|
+ :getDataFun="(page)=> getDataFun(page,configUrl.productListClass,3,index,'productClassList','productList','goodsId','classifyId')"
|
|
|
+ />
|
|
|
+ <el-input-number style="width: 150px;margin-left: 20px;" v-model="form.productList[index].discount" placeholder="请输入文创品类折扣" controls-position="right"></el-input-number>
|
|
|
+ <span style="padding-bottom: 15px;">%</span>
|
|
|
+ </el-form-item>
|
|
|
+ <el-button style="margin-left: 15px;" v-if="form.productList.length==(index+1)" type="primary" @click="addClassifyList('productList')">添加文创品类</el-button>
|
|
|
+ <el-button style="margin-left: 15px;" type="danger" @click="clearClassifyList('productList',index)">移除</el-button>
|
|
|
</div>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="积分权益:">
|
|
@@ -165,10 +280,11 @@ import {
|
|
|
addTableApi
|
|
|
} from '@/api/CURD'
|
|
|
import selectMoreBox from '../model/selectMoreBox.vue';
|
|
|
+ import selecteNew from '@/myComponents/selecteNew.vue';
|
|
|
export default {
|
|
|
name: "addAndEdit",
|
|
|
dicts: [],
|
|
|
- components: {selectMoreBox},
|
|
|
+ components: {selectMoreBox,selecteNew},
|
|
|
data() {
|
|
|
return {
|
|
|
title: "",
|
|
@@ -181,7 +297,13 @@ export default {
|
|
|
add: '/member/memberLevelInfo/insertOrUpdate', // 新增地址
|
|
|
details: '/member/memberLevelInfo/selectById', // 详情地址
|
|
|
edit: '/member/memberLevelInfo/insertOrUpdate', // 编辑地址
|
|
|
- list: '/merchant/merchantPerformAuditorium/merchantPerformList'
|
|
|
+ list: '/merchant/merchantPerformAuditorium/merchantPerformList', // 门票类商品
|
|
|
+
|
|
|
+ pinglei: '/merchant/merchantShop/pageList', // 获取品类 和 酒店商品
|
|
|
+ hotelListClass: '/goods/goodsHotel/pageList', // 酒业商品
|
|
|
+ foodListClass: '/merchant/merchantPerformAuditorium/shopGoodsList', // 获取餐饮商品
|
|
|
+ productListClass: '/merchant/merchantPerformAuditorium/shopGoodsList', // 获取餐饮商品
|
|
|
+
|
|
|
},
|
|
|
form: {
|
|
|
id: undefined,
|
|
@@ -193,7 +315,16 @@ export default {
|
|
|
discount: [{ required: true, message: "请输入基本折扣", trigger: ["change","blur"] }],
|
|
|
integralRatio: [{ required: true, message: "请输入积分成长系数", trigger: ["change","blur"] }],
|
|
|
},
|
|
|
- scenicAreaProducts: [],// 景点产品关联
|
|
|
+ scenicAreaProducts: [],// 景点门票产品关联
|
|
|
+
|
|
|
+ hotelParentList: [], // 酒店列表
|
|
|
+ hoteClassList: [], // 酒店房型列表
|
|
|
+
|
|
|
+ foodParentList: [], // 餐饮列表
|
|
|
+ foodClassList: [], // 餐饮房型列表
|
|
|
+
|
|
|
+ productParentList: [], // 文创品类列表
|
|
|
+ productClassList: [], // 文创品类房型列表
|
|
|
|
|
|
// 上传文件
|
|
|
actionUrl: process.env.VUE_APP_BASE_API + process.env.VUE_APP_UPLOAD_IMAGE,
|
|
@@ -209,7 +340,10 @@ export default {
|
|
|
this.actionUrlLoading = false
|
|
|
this.model = model
|
|
|
this.formStatus = 0
|
|
|
- this.getList()
|
|
|
+ await this.getList()
|
|
|
+ await this.getPinglei(this.configUrl.pinglei,5,'hotelParentList') // 酒店
|
|
|
+ await this.getPinglei(this.configUrl.pinglei,4,'foodParentList') // 餐饮
|
|
|
+ await this.getPinglei(this.configUrl.pinglei,3,'productParentList') // 文创
|
|
|
if(model=='ADD') { // 新增
|
|
|
this.$set(this,'form',{
|
|
|
...row,
|
|
@@ -247,9 +381,10 @@ export default {
|
|
|
...res.data,
|
|
|
logo: res.data.logo?res.data.logo.split(','):[],
|
|
|
}
|
|
|
- if(!obj.classifyList) {
|
|
|
- obj.classifyList = []
|
|
|
- }
|
|
|
+ this.setDiscountParams(obj,'classifyList')
|
|
|
+ this.setDiscountParams(obj,'hotelList')
|
|
|
+ this.setDiscountParams(obj,'foodList')
|
|
|
+ this.setDiscountParams(obj,'productList')
|
|
|
if(obj.couponList && obj.couponList.length>0) {
|
|
|
let list = []
|
|
|
obj.couponList.forEach((item,index)=>{
|
|
@@ -290,6 +425,18 @@ export default {
|
|
|
this.open = false;
|
|
|
}
|
|
|
},
|
|
|
+ setDiscountParams(obj,key){
|
|
|
+ if(!obj[key]) {
|
|
|
+ obj[key] = []
|
|
|
+ }else {
|
|
|
+ obj[key].forEach((item,index) => {
|
|
|
+ obj[key][index]['classInfo'] = {
|
|
|
+ classifyName: item.classifyName,
|
|
|
+ classifyId: item.classifyId
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
/** 查询用户列表 */
|
|
|
async getList() {
|
|
|
try {
|
|
@@ -313,8 +460,17 @@ export default {
|
|
|
this.$refs["form"].validate(valid => {
|
|
|
if (valid) {
|
|
|
this.loadingText = "提交数据中..."
|
|
|
-
|
|
|
let params = JSON.parse(JSON.stringify(this.form))
|
|
|
+ let hotelList = this.checkClassList(this.form,'hotelList','酒店房型')
|
|
|
+ let foodList = this.checkClassList(this.form,'foodList','酒店房型')
|
|
|
+ let productList = this.checkClassList(this.form,'productList','酒店房型')
|
|
|
+ if(!hotelList || !foodList || !productList){
|
|
|
+ return
|
|
|
+ }else {
|
|
|
+ params['hotelList'] = hotelList
|
|
|
+ params['foodList'] = foodList
|
|
|
+ params['productList'] = productList
|
|
|
+ }
|
|
|
if(params.classifyList && params.classifyList.length>0) {
|
|
|
let list = []
|
|
|
let flog = false
|
|
@@ -330,7 +486,7 @@ export default {
|
|
|
})
|
|
|
})
|
|
|
if(flog) {
|
|
|
- this.$message.error("请选择单品或输入单品折扣!!!");
|
|
|
+ this.$message.error("请选择门票或输入门票折扣!!!");
|
|
|
return
|
|
|
}
|
|
|
params.classifyList = list
|
|
@@ -393,6 +549,32 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ checkClassList(obj,formKey,message){
|
|
|
+ let params = JSON.parse(JSON.stringify(obj))
|
|
|
+ if(params[formKey] && params[formKey].length>0) {
|
|
|
+ let list = []
|
|
|
+ let flog = false
|
|
|
+ params[formKey].forEach((item,index)=>{
|
|
|
+ if((!item.discount&&item.discount!=0) || !item.classInfo.classifyId) {
|
|
|
+ flog = true
|
|
|
+ }else {
|
|
|
+ list[index] = {
|
|
|
+ classifyParentId: item.classifyParentId,
|
|
|
+ ...item.classInfo,
|
|
|
+ discount: item.discount
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if(flog) {
|
|
|
+ this.$message.error(`请选择${message}或输入${message}折扣!!!`);
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ return list
|
|
|
+ }else {
|
|
|
+ return []
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
/**
|
|
|
* 重置
|
|
|
* @date 2023-11-22
|
|
@@ -444,31 +626,43 @@ export default {
|
|
|
this.form.logo.splice(index,1)
|
|
|
},
|
|
|
|
|
|
- /** 填加单品 */
|
|
|
- addClassifyList(){
|
|
|
+ /** 填加门票 */
|
|
|
+ addClassifyList(key){
|
|
|
let list = []
|
|
|
- if(this.form.classifyList) {
|
|
|
- list = JSON.parse(JSON.stringify(this.form.classifyList))
|
|
|
+ if(this.form[key]) {
|
|
|
+ list = JSON.parse(JSON.stringify(this.form[key]))
|
|
|
}
|
|
|
list.push({
|
|
|
classifyId: null,
|
|
|
discount: null,
|
|
|
- classifyName: null
|
|
|
+ classifyName: null,
|
|
|
+ classInfo: {
|
|
|
+ classifyId: null,
|
|
|
+ classifyName: null,
|
|
|
+ }
|
|
|
})
|
|
|
- this.$set(this.form,'classifyList',list)
|
|
|
+ this.$set(this.form,key,list)
|
|
|
},
|
|
|
- /** 移除单品 */
|
|
|
- clearClassifyList(index) {
|
|
|
- this.form.classifyList.splice(index,1)
|
|
|
+ /** 移除门票 */
|
|
|
+ clearClassifyList(key,index) {
|
|
|
+ this.form[key].splice(index,1)
|
|
|
},
|
|
|
/** 禁选 */
|
|
|
- visibleChange(type) {
|
|
|
- if(type) {
|
|
|
- let list = JSON.parse(JSON.stringify(this.scenicAreaProducts))
|
|
|
- this.scenicAreaProducts.forEach((item1,index1)=>{
|
|
|
+ async visibleChange(type,url,goodsType,index,key,keyForm,key1,key2) {
|
|
|
+ if(type && this.form[keyForm][index].classifyParentId) {
|
|
|
+ //this.$refs.selecteNew.setLoading()
|
|
|
+ let res = await listTableApi(url,{
|
|
|
+ shopId:this.form[keyForm][index].classifyParentId,
|
|
|
+ goodsType,
|
|
|
+ pageSize: 10000,
|
|
|
+ pageNum: 1
|
|
|
+ })
|
|
|
+ this[key] = res.data.rows;
|
|
|
+ let list = JSON.parse(JSON.stringify(this[key]))
|
|
|
+ this[key].forEach((item1,index1)=>{
|
|
|
let folg = false
|
|
|
- this.form.classifyList.forEach((item,index)=>{
|
|
|
- if(item1.performId == item.classifyId) {
|
|
|
+ this.form[keyForm].forEach((item,index)=>{
|
|
|
+ if(item.classInfo[key2] && item1[key1] == item.classInfo[key2]) {
|
|
|
folg = true
|
|
|
}
|
|
|
})
|
|
@@ -478,9 +672,73 @@ export default {
|
|
|
list[index1].disabled = false
|
|
|
}
|
|
|
})
|
|
|
- this.scenicAreaProducts = list
|
|
|
+ return {
|
|
|
+ rows: list,
|
|
|
+ total: res.data.total
|
|
|
+ }
|
|
|
+ // this[key] = list
|
|
|
+ }else {
|
|
|
+ // this[key] = []
|
|
|
+ return {
|
|
|
+ rows: [],
|
|
|
+ total: 0
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+ },
|
|
|
+ /** 获取品类的产品 */
|
|
|
+ async visibleChange1(keyForm,keyList,index) {
|
|
|
+ console.log("值发生了改变====")
|
|
|
+ this.form[keyForm][index].classInfo = {}
|
|
|
+ this[keyList] = []
|
|
|
+ },
|
|
|
+ /** 获取品类 */
|
|
|
+ async getPinglei(url,shopType,key) {
|
|
|
+ if(this[key] && this[key].length>0) return
|
|
|
+ try {
|
|
|
+ let res = await listTableApi(
|
|
|
+ url,{shopType, pageSize: 10000,pageNum: 1})
|
|
|
+ this[key] = res.data.rows;
|
|
|
+ } catch (error) {
|
|
|
+ console.error('获取列表失败!!!!',error)
|
|
|
+ this[key] = [];
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async getDataFun(page,url,goodsType,index,key,keyForm,key1,key2) {
|
|
|
+ if(this.form[keyForm][index].classifyParentId) {
|
|
|
+ //this.$refs.selecteNew.setLoading()
|
|
|
+ let res = await listTableApi(url,{
|
|
|
+ shopId:this.form[keyForm][index].classifyParentId,
|
|
|
+ goodsType,
|
|
|
+ ...page
|
|
|
+ })
|
|
|
+ this[key] = res.data.rows;
|
|
|
+ let list = JSON.parse(JSON.stringify(this[key]))
|
|
|
+ this[key].forEach((item1,index1)=>{
|
|
|
+ let folg = false
|
|
|
+ this.form[keyForm].forEach((item,index)=>{
|
|
|
+ if(item.classInfo[key2] && item1[key1] == item.classInfo[key2]) {
|
|
|
+ folg = true
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if(folg) {
|
|
|
+ list[index1].disabled = true
|
|
|
+ }else {
|
|
|
+ list[index1].disabled = false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ return {
|
|
|
+ rows: list,
|
|
|
+ total: res.data.total
|
|
|
+ }
|
|
|
+ // this[key] = list
|
|
|
+ }else {
|
|
|
+ // this[key] = []
|
|
|
+ return {
|
|
|
+ rows: [],
|
|
|
+ total: 0
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
};
|