Commit 5d161829 authored by zhengke's avatar zhengke

修改

parent d310167c
...@@ -349,8 +349,10 @@ ...@@ -349,8 +349,10 @@
this.multipleSelection = val this.multipleSelection = val
}, },
addtableData(data) { addtableData(data) {
this.tableData[data.$index].disabled = true; var myTable = JSON.parse(JSON.stringify(this.tableData));
myTable[data.$index].disabled = true;
this.commoditylist.push(data.row) this.commoditylist.push(data.row)
this.tableData=myTable;
this.Success('添加成功'); this.Success('添加成功');
}, },
handleCurrentChange(val) { handleCurrentChange(val) {
...@@ -549,18 +551,7 @@ ...@@ -549,18 +551,7 @@
} }
} }
} }
}, }
getReturn(ProductList, data) {
for (let i = 0; i < data.length; i++) {
if (ProductList.ProductId == data[i].Id) {
this.AppointList2.push(data[i])
}
if (data[i].ChildList.length > 0) {
this.getReturn(ProductList, data[i].ChildList)
}
}
},
}, },
mounted() { mounted() {
this.getMale(); this.getMale();
......
...@@ -7,14 +7,13 @@ ...@@ -7,14 +7,13 @@
<span>套餐卡编辑</span> <span>套餐卡编辑</span>
</div> </div>
</div> </div>
<div class="el-card__body" style="background-color: white; padding: 0px;margin-top: 20px"> <div class="el-card__body" style="background-color: white; padding: 0px;margin-top: 20px">
<el-form :model="msg" style="padding:0 20px;" :rules="rules" ref="msg" label-width="160px" size="small"> <el-form :model="msg" style="padding:0 20px;" :rules="rules" ref="msg" label-width="160px" size="small">
<div class="form-body"> <div class="form-body">
<el-form-item label="套餐卡名称" prop="Name" class="is-required"> <el-form-item label="套餐卡名称" prop="Name" class="is-required">
<el-input v-model="msg.Name" /> <el-input v-model="msg.Name" />
</el-form-item> </el-form-item>
<el-form-item label="套餐卡图标" prop="CouponIco" class="is-required" > <el-form-item label="套餐卡图标" prop="CouponIco" class="is-required">
<button class="el-button el-button--default el-button--small" @click="openChangeDig()"> <button class="el-button el-button--default el-button--small" @click="openChangeDig()">
选择图标 选择图标
</button> </button>
...@@ -23,31 +22,22 @@ ...@@ -23,31 +22,22 @@
<img v-else :src="msg.CouponIco" alt=""> <img v-else :src="msg.CouponIco" alt="">
</div> </div>
</el-form-item> </el-form-item>
<!-- <el-form-item label="微店铺">-->
<!-- <el-select size="small" v-model="msg.SmallShopId" :filter-method="ChangeListName" filterable-->
<!-- placeholder="请选择">-->
<!-- <el-option label="不限" :value="0"></el-option>-->
<!-- <el-option v-for="item in SmallShopData" :key="item.Id" :label="item.Name" :value="item.Id">-->
<!-- </el-option>-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<!-- <el-form-item label="赞羊用户专用">-->
<!-- <el-radio-group v-model="msg.IsZanYangUse">-->
<!-- <el-radio :label="0"></el-radio>-->
<!-- <el-radio :label="1"></el-radio>-->
<!-- </el-radio-group>-->
<!-- </el-form-item>-->
<el-form-item label="加入领券中心"> <el-form-item label="加入领券中心">
<el-switch :active-value="1" :inactive-value="0" v-model="msg.PickupCenter">
<el-switch
:active-value="1"
:inactive-value="0"
v-model="msg.PickupCenter"
>
</el-switch> </el-switch>
</el-form-item> </el-form-item>
<el-form-item label="指定商品类别或商品" > <el-form-item label="门店">
<el-select style="width:636px;" v-model="storeCheck" multiple placeholder="请选择">
<el-option v-for="item in StoreList" :key="item.Id" :label="item.Name" :value="item.Id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="从业年限">
<el-input type="text" @keyup.native="checkPrice(msg,'WorkYears')" v-model="msg.WorkYears">
<template slot="append"></template>
</el-input>
</el-form-item>
<el-form-item label="指定商品类别或商品">
<div style="display: flex;flex-direction: row;align-items: center"> <div style="display: flex;flex-direction: row;align-items: center">
<div @click="getUseType(1)" style="margin-right: 15px"> <div @click="getUseType(1)" style="margin-right: 15px">
<el-radio :label="1" v-model="msg.UseType">指定商品类型</el-radio> <el-radio :label="1" v-model="msg.UseType">指定商品类型</el-radio>
...@@ -55,27 +45,32 @@ ...@@ -55,27 +45,32 @@
<div @click='getUseType(2)' style="margin-right: 15px"> <div @click='getUseType(2)' style="margin-right: 15px">
<el-radio :label="2" v-model="msg.UseType">指定商品</el-radio> <el-radio :label="2" v-model="msg.UseType">指定商品</el-radio>
</div> </div>
<el-radio :label="3" v-model="msg.UseType" @change="getUseType2" style="margin-right: 15px">全场通用</el-radio> <el-radio :label="3" v-model="msg.UseType" @change="getUseType2" style="margin-right: 15px">全场通用
<el-radio :label="4" v-model="msg.UseType" @change="getUseType2" >当面付</el-radio> </el-radio>
<el-radio :label="4" v-model="msg.UseType" @change="getUseType2">当面付</el-radio>
</div> </div>
<div class="splist" v-if="msg.UseType==1"> <div class="splist" v-if="msg.UseType==1">
<div v-for="(item,index) in AppointList" :label="item.ProductId" :key="index" style="margin-right: 20px;" class="el-tag el-tag--warning el-tag--plain"> <div v-for="(item,index) in AppointList" :label="item.ProductId" :key="index" style="margin-right: 20px;"
class="el-tag el-tag--warning el-tag--plain">
<span>{{item.Name}}</span> <span>{{item.Name}}</span>
<i class="el-tag__close el-icon-close" @click="deleteProduct(item,index)"></i> <i class="el-tag__close el-icon-close" @click="deleteProduct(item,index)"></i>
</div> </div>
</div> </div>
<div class="splist" v-if="msg.UseType==2"> <div class="splist" v-if="msg.UseType==2">
<div v-for="(item,index) in commoditylist" :label="item.ProductId" :key="index" style="margin-right: 20px; position: relative; cursor: pointer;" > <div v-for="(item,index) in commoditylist" :label="item.ProductId" :key="index"
<div class="app-image" :style="{backgroundImage:'url(' + item.CoverImage + ')',backgroundSize:'cover'}" ></div> style="margin-right: 20px; position: relative; cursor: pointer;">
<i class="el-icon-error" style="position: absolute;right: -5px;top:-5px;color: #F56C6C;font-size: 20px" @click="deletecommod(index,1)"></i> <div class="app-image" :style="{backgroundImage:'url(' + item.CoverImage + ')',backgroundSize:'cover'}">
</div>
<i class="el-icon-error" style="position: absolute;right: -5px;top:-5px;color: #F56C6C;font-size: 20px"
@click="deletecommod(item,index)"></i>
</div> </div>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="抵扣金额" prop="MaxDiscountsPrice" class="is-required"> <el-form-item label="抵扣金额" prop="MaxDiscountsPrice" class="is-required">
<el-input v-model="msg.MaxDiscountsPrice" step="1" min="0" onkeyup="this.value= this.value.match(/\d+(\.\d{0,2})?/) ? this.value.match(/\d+(\.\d{0,2})?/)[0] : ''"> <el-input v-model="msg.MaxDiscountsPrice" step="1" min="0"
onkeyup="this.value= this.value.match(/\d+(\.\d{0,2})?/) ? this.value.match(/\d+(\.\d{0,2})?/)[0] : ''">
<template slot="append"></template> <template slot="append"></template>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item label="卡券有效期" class="is-required"> <el-form-item label="卡券有效期" class="is-required">
...@@ -84,174 +79,89 @@ ...@@ -84,174 +79,89 @@
<el-radio :label="2">时间段</el-radio> <el-radio :label="2">时间段</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="有效天数" prop="IndateDay" class="is-required" v-if="msg.IndateType==1"> <el-form-item label="有效天数" prop="IndateDay" class="is-required" v-if="msg.IndateType==1">
<el-input v-model="msg.IndateDay" class="el-input--small" step="1" min="0" onkeyup="this.value= this.value.match(/\d+(\d{0,2})?/) ? this.value.match(/\d+(\d{0,2})?/)[0] : ''"/> <el-input v-model="msg.IndateDay" class="el-input--small" step="1" min="0"
onkeyup="this.value= this.value.match(/\d+(\d{0,2})?/) ? this.value.match(/\d+(\d{0,2})?/)[0] : ''" />
</el-form-item> </el-form-item>
<el-form-item label="有效期范围" class="is-required" v-if="msg.IndateType==2">
<el-form-item label="有效期范围" class="is-required" v-if="msg.IndateType==2" > <el-date-picker @input="daterangeChange" style="padding: 3px 10px;width: 450px;height: 32px"
<el-date-picker v-model.trim="msg.value" type="datetimerange" range-separator="至" start-placeholder="开始日期"
@input="daterangeChange" end-placeholder="结束日期" value-format="yyyy-MM-dd HH:mm:ss" align="right">
style="padding: 3px 10px;width: 450px;height: 32px"
v-model.trim="msg.value"
type="datetimerange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-dd HH:mm:ss"
align="right">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="核销总次数" prop="HeXiao" class="is-required"> <el-form-item label="核销总次数" prop="HeXiao" class="is-required">
<el-input v-model="msg.HeXiao" class="el-input--small" placeholder="请输入整数" step="1" min="1" onkeyup="this.value= this.value.match(/\d+(\d{0,2})?/) ? this.value.match(/\d+(\d{0,2})?/)[0] : ''"/> <el-input v-model="msg.HeXiao" class="el-input--small" placeholder="请输入整数" step="1" min="1"
onkeyup="this.value= this.value.match(/\d+(\d{0,2})?/) ? this.value.match(/\d+(\d{0,2})?/)[0] : ''" />
</el-form-item> </el-form-item>
<el-form-item label="可领取数量" prop="TotalNum" class="is-required"> <el-form-item label="可领取数量" prop="TotalNum" class="is-required">
<el-tooltip class="item" effect="dark" content="可领取数量为0则无法领取或发放,-1为不限制张数" placement="top" <el-tooltip class="item" effect="dark" content="可领取数量为0则无法领取或发放,-1为不限制张数" placement="top"
style="position: absolute;left: -16px;top:10px"> style="position: absolute;left: -16px;top:10px">
<i class="el-tooltip el-icon-info"></i> <i class="el-tooltip el-icon-info"></i>
</el-tooltip> </el-tooltip>
<el-input v-model="msg.TotalNum" class="el-input--small" :disabled="checked" step="1" min="0" onkeyup="this.value= this.value.match(/\d+(\d{0,2})?/) ? this.value.match(/\d+(\d{0,2})?/)[0] : ''"/> <el-input v-model="msg.TotalNum" class="el-input--small" :disabled="checked" step="1" min="0"
onkeyup="this.value= this.value.match(/\d+(\d{0,2})?/) ? this.value.match(/\d+(\d{0,2})?/)[0] : ''" />
<el-checkbox v-model="checked" @change="checked==true? msg.TotalNum=-1:msg.TotalNum=0">无限制</el-checkbox> <el-checkbox v-model="checked" @change="checked==true? msg.TotalNum=-1:msg.TotalNum=0">无限制</el-checkbox>
</el-form-item> </el-form-item>
<el-form-item label="套餐卡描述"> <el-form-item label="套餐卡描述">
<el-input <el-input type="textarea" :rows="2" v-model="msg.Describe">
type="textarea"
:rows="2"
v-model="msg.Describe">
</el-input> </el-input>
</el-form-item> </el-form-item>
</div> </div>
</el-form> </el-form>
</div> </div>
<el-button type="primary" style="margin: 12px 0 " @click="preserve('msg')" :loading="loading">保存</el-button> <el-button type="primary" style="margin: 12px 0" size="small" @click="preserve('msg')" :loading="loading">保存
</el-button>
<!--已指定商品类别选择--> <!--已指定商品类别选择-->
<el-dialog title="已指定商品类别" :visible.sync="category" width="714px"> <el-dialog title="已指定商品类别" :visible.sync="category" width="714px">
<el-tree <div style="height:400px;overflow:auto;">
:data="ProductCategoryTreeList" <el-tree :data="ProductCategoryTreeList" show-checkbox :check-strictly="true" default-expand-all node-key="Id" ref="tree"
show-checkbox :default-checked-keys="checkedkeys" @check="TreeList" :props="defaultProps">
default-expand-all </el-tree>
node-key="Id" </div>
ref="tree"
:default-checked-keys="checkedkeys"
@check="TreeList"
:props="defaultProps">
</el-tree>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button @click="category = false">取 消</el-button> <el-button @click="category = false" size="small">取 消</el-button>
<el-button type="primary" @click="getProductList">确 定</el-button> <el-button type="primary" @click="getProductList" size="small">确 定</el-button>
</div> </div>
</el-dialog> </el-dialog>
<!--已指定商品选择-->
<el-dialog title="已指定商品" :visible.sync="commodity" width="1024px">
<template>
<button class="el-button el-button--primary el-button--small" style="float: right;" @click="addcommoditybtn">新增</button>
<el-table
:data="commoditylist"
style="width: 984px">
<el-table-column
prop="Id"
label="ID"
width="80">
</el-table-column>
<el-table-column
label="商品图"
width="80">
<template slot-scope="scope">
<img style="width:50px;height:50px;margin-right:1px" :src="scope.row.CoverImage" alt="">
</template>
</el-table-column>
<el-table-column
prop="Name"
label="商品名称"
width="604">
</el-table-column>
<el-table-column
prop="address"
label="操作"
>
<template slot-scope="scope">
<div class="cell">
<button type="button" class="el-button el-button--danger el-button--mini is-plain" @click="deletecommod(scope,2)"><span>删除</span></button>
</div>
</template>
</el-table-column>
</el-table>
</template>
</el-dialog>
<!--选择的商品列表--> <!--选择的商品列表-->
<el-dialog title="添加商品" :visible.sync="addcommodity" width="1024px"> <el-dialog title="添加商品" :visible.sync="addcommodity" width="1024px">
<template> <template>
<div class="el-form-item"> <div class="el-form-item">
<div class="el-form-item__content" > <div class="el-form-item__content">
<div class="el-input el-input--small" style="width: 40%;" > <div class="el-input el-input--small" style="width: 40%;">
<input type="text" autocomplete="off" placeholder="商品名称" class="el-input__inner" v-model="msg2.Name" <input type="text" autocomplete="off" placeholder="商品名称" class="el-input__inner" v-model="msg2.Name"
@clear="msg2.pageIndex=1,getProductGoodsPageList()" @clear="msg2.pageIndex=1,getProductGoodsPageList()" clearable>
clearable
>
</div> </div>
<button type="button" class="el-button el-button--default el-button--small" style="margin-left: 15px" @click="msg2.pageIndex=1,getProductGoodsPageList()">查找商品</button> <button type="button" class="el-button el-button--default el-button--small" style="margin-left: 15px"
<button class="el-button el-button--default el-button--small" style="float: right;" @click="batchAdd">批量添加</button> @click="msg2.pageIndex=1,getProductGoodsPageList()">查找商品</button>
<button class="el-button el-button--default el-button--small" style="float: right;"
@click="batchAdd">批量添加</button>
</div> </div>
</div> </div>
<el-table v-loading="loading_t" :data="tableData" ref="dataTable" @selection-change="handleSelectionChange"
<el-table
v-loading="loading_t"
:data="tableData"
@selection-change="handleSelectionChange"
style="width: 984px"> style="width: 984px">
<el-table-column <el-table-column type="selection" width="55">
type="selection"
width="55">
</el-table-column> </el-table-column>
<el-table-column <el-table-column prop="Id" label="ID" width="80">
prop="Id"
label="ID"
width="80">
</el-table-column> </el-table-column>
<el-table-column <el-table-column label="商品图" width="80">
label="商品图"
width="80">
<template slot-scope="scope"> <template slot-scope="scope">
<img style="width:50px;height:50px;margin-right:1px" :src="scope.row.CoverImage" alt=""> <img style="width:50px;height:50px;margin-right:1px" :src="scope.row.CoverImage" alt="">
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column prop="Name" label="商品名称" width="333">
prop="Name"
label="商品名称"
width="333">
</el-table-column> </el-table-column>
<el-table-column <el-table-column prop="address" label="操作">
prop="address"
label="操作"
>
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="primary" plain size="mini" @click="addtableData(scope)" :disabled="scope.row.disabled">{{scope.row.disabled==true? '已添加':'添加'}}</el-button> <el-button type="primary" plain size="mini" @click="addtableData(scope)" :disabled="scope.row.disabled">
{{scope.row.disabled==true? '已添加':'添加'}}</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-pagination style="text-align:right" <el-pagination style="text-align:right" background @current-change="handleCurrentChange"
background :page-size="msg2.pageSize" layout="prev, pager, next" :current-page.sync="msg2.pageIndex" :total="count">
@current-change="handleCurrentChange"
:page-size="msg2.pageSize"
layout="prev, pager, next"
:current-page.sync="msg2.pageIndex"
:total="count">
</el-pagination> </el-pagination>
</template> </template>
</el-dialog> </el-dialog>
<!-- 选择文件 --> <!-- 选择文件 -->
<el-dialog title="选择文件" :visible.sync="changeState" width="1240px"> <el-dialog title="选择文件" :visible.sync="changeState" width="1240px">
...@@ -268,251 +178,233 @@ ...@@ -268,251 +178,233 @@
components: { components: {
ChooseImg, ChooseImg,
}, },
data(){ data() {
return{ return {
msg:{ msg: {
ID:0, ID: 0,
Name:'', Name: '',
CouponType:1, CouponType: 1,
UseType:3, UseType: 3,
MaxDiscountsPrice:0, MaxDiscountsPrice: 0,
IndateDay:1, IndateDay: 1,
IndateType:1, IndateType: 1,
TotalNum:-1, TotalNum: -1,
Describe:'', Describe: '',
OnlyMember:0, OnlyMember: 0,
PickupCenter:0, PickupCenter: 0,
MemberLevelList:[], MemberLevelList: [],
ProductList:[],//指定商品类型的数组 ProductList: [], //指定商品类型的数组
StartDate:'', StartDate: '',
EndDate:'', EndDate: '',
value:[], value: [],
SmallShopId:0,//微店id SmallShopId: 0, //微店id
IsZanYangUse:0, IsZanYangUse: 0,
HeXiao:1, HeXiao: 1,
CouponIco:"", CouponIco: "",
WorkYears: '', //从业年限
StoreIds: '' // 店铺id
}, },
checkedkeys:[],//默认选中的 checkedkeys: [], //默认选中的
huiyuan:false, huiyuan: false,
zhongxin:true, zhongxin: true,
checked:true, checked: true,
loading:false, loading: false,
activeName:'first', activeName: 'first',
commodity:false, addcommodity: false,
addcommodity:false, commoditylist: [], //商品的list
changeState:false, changeState: false,
SmallShopData:[], SmallShopData: [],
rules:{ rules: {
Name:[ Name: [{
{required: true, message: "套餐卡名称不能为空", trigger: "blur"} required: true,
], message: "套餐卡名称不能为空",
IndateDay:[ trigger: "blur"
{required: true, message: "套餐卡有效天数不能为空", trigger: "blur"} }],
], IndateDay: [{
MaxDiscountsPrice:[ required: true,
{required: true, message: "抵扣金额不能为空", trigger: "blur"} message: "套餐卡有效天数不能为空",
], trigger: "blur"
TotalNum:[ }],
{required: true, message: "发放总数不能为空", trigger: "blur"} MaxDiscountsPrice: [{
], required: true,
CouponIco:[ message: "抵扣金额不能为空",
{required: true, message: "请选择套餐卡图标", trigger: "blur"} trigger: "blur"
], }],
HeXiao:[ TotalNum: [{
{required: true, message: "请输入可核销总次数", trigger: "blur"} required: true,
], message: "发放总数不能为空",
value:[ trigger: "blur"
{ type: 'array', required: true, message: '套餐卡有效期不能为空', trigger: 'change' } }],
CouponIco: [{
required: true,
message: "请选择套餐卡图标",
trigger: "blur"
}],
HeXiao: [{
required: true,
message: "请输入可核销总次数",
trigger: "blur"
}],
value: [{
type: 'array',
required: true,
message: '套餐卡有效期不能为空',
trigger: 'change'
}
] ]
}, },
cityOptions:[], cityOptions: [],
cities: [], cities: [],
checkAll: false, checkAll: false,
isIndeterminate: false, isIndeterminate: false,
category:false, category: false,
ProductCategoryTreeList:[], ProductCategoryTreeList: [],
commoditylist:[],//商品的list AppointList: [], //指定商品分类
AppointList:[],//指定商品分类
defaultProps: { defaultProps: {
children: 'ChildList', children: 'ChildList',
label: 'Name' label: 'Name'
}, },
eData:{}, eData: {},
msg2:{ msg2: {
pageIndex:1, pageIndex: 1,
pageSize:15, pageSize: 15,
Name:'', Name: '',
GoodsStatus:0, GoodsStatus: 0,
IsSelectSellOut:0, IsSelectSellOut: 0,
CategoryIds:'', CategoryIds: '',
Id:0, Id: 0,
StartTime:'', StartTime: '',
EndTime:'', EndTime: '',
}, },
tableData:[], tableData: [],
loading_t:false, loading_t: false,
count:0, count: 0,
multipleSelection:[], multipleSelection: [],
AppointList2:[], AppointList2: [],
SmallShopMsg:{ SmallShopMsg: {
Name:'', Name: '',
} },
storeCheck: [], //门店多选
StoreList: [], //门店下拉
} }
}, },
created(){ created() {
this.getMemberGradeList() this.getMemberGradeList()
this.getSmallShopsDropDownList() this.getSmallShopsDropDownList()
this.getStoreList();
this.getProductGoodsPageList();
if (this.$route.query.ID) {
this.msg.ID = this.$route.query.ID;
this.getData()
}
}, },
methods:{ methods: {
getMemberGradeList(){ //获取门店下拉
this.cityOptions=[]; getStoreList() {
this.apipost("/api/User/GetMemberGradeList",{}, res => { this.apipost("/api/MContent/GetStoresList", {}, res => {
this.cities=res.data.data; if (res.data.resultCode == 1) {
let data=res.data.data; this.StoreList = res.data.data;
data.forEach(item=>{ } else {
this.Error(res.data.message);
}
})
},
getMemberGradeList() {
this.cityOptions = [];
this.apipost("/api/User/GetMemberGradeList", {}, res => {
this.cities = res.data.data;
let data = res.data.data;
data.forEach(item => {
this.cityOptions.push(item.Id) this.cityOptions.push(item.Id)
}) })
}) })
this.getProductCategoryTreeList() this.getProductCategoryTreeList()
}, },
getDiscountCouponDetail(ID){
this.apipost("/api/Reserve/GetDiscountCouponDetail",{'ID':ID} , res => { getData(){
this.apipost("/api/Reserve/GetDiscountCouponDetail", {
ID: this.msg.ID
}, res => {
if (res.data.resultCode == 1) { if (res.data.resultCode == 1) {
this.msg = res.data.data console.log(res,'数据');
this.msg.value = [] this.msg = res.data.data;
if(res.data.data.IndateType==2){ this.msg.value = [];
if (res.data.data.IndateType == 2) {
this.msg.value.push(res.data.data.StartDate.replace("T", " ")) this.msg.value.push(res.data.data.StartDate.replace("T", " "))
this.msg.value.push(res.data.data.EndDate.replace("T", " ")) this.msg.value.push(res.data.data.EndDate.replace("T", " "))
} }
if(res.data.data.TotalNum!=-1){ if (res.data.data.TotalNum != -1) {
this.checked=false this.checked = false
} }
if(res.data.data.OnlyMember==0){ this.storeCheck=[];
this.huiyuan=false var cked = this.msg.StoreIds.split(',');
}else { cked.forEach(x=>{
this.huiyuan=true this.storeCheck.push(parseInt(x));
} })
if(res.data.data.PickupCenter==0){ if (res.data.data.UseType == 1) {
this.zhongxin=false
}else {
this.zhongxin=true
}
this.msg.MemberLevelList=res.data.data.MemberLevelList?res.data.data.MemberLevelList:[];
if(this.msg.MemberLevelList){ //设置全选状态
if(this.msg.MemberLevelList.length == this.cities.length){
this.checkAll=true
}
}
if(res.data.data.UseType==1){
let ProductList = res.data.data.ProductList; let ProductList = res.data.data.ProductList;
let newData = [] this.AppointList = []
for(let i= 0;i<ProductList.length;i++){ this.getProductCategoryTreeList();
for (let i = 0; i < ProductList.length; i++) {
this.checkedkeys.push(ProductList[i].ProductId) this.checkedkeys.push(ProductList[i].ProductId)
for(let j=0;j<this.ProductCategoryTreeList.length;j++){ var objList = this.getObjById(this.ProductCategoryTreeList, ProductList[i].ProductId);
if(ProductList[i].ProductId == this.ProductCategoryTreeList[j].Id){ if (objList) {
newData.push(this.ProductCategoryTreeList[j]) this.AppointList.push({
} ProductId: objList.Id,
if(this.ProductCategoryTreeList[j].ChildList.length>0){ Name: objList.Name
this.getReturn(ProductList[i],this.ProductCategoryTreeList[j].ChildList) })
}
} }
} }
this.AppointList = this.AppointList2.concat(newData)
} }
if(res.data.data.UseType==2){ if (res.data.data.UseType == 2) {
let ProductList = res.data.data.ProductList; this.commoditylist = [];
let newData = [] var myTable = [];
for(let i= 0;i<ProductList.length;i++){ this.apipost("/api/OSGoods/GetOfflineGoodsPageList", this.msg2, res => {
this.apipost("/api/product/GetProductGoodsPageList", if (res.data.resultCode == 1) {
{ myTable = res.data.data.pageData;
pageIndex:1, }
pageSize:15, myTable.forEach(x => {
Name:'', this.msg.ProductList.forEach(y => {
GoodsStatus:0, if (y.ProductId == x.Id) {
IsSelectSellOut:0, this.commoditylist.push(x);
CategoryIds:'', x.disabled=true;
Id:ProductList[i].ProductId,
StartTime:'',
EndTime:'',
}
, res => {
if(res.data.resultCode==1){
let pageData= res.data.data.pageData;
newData.push(pageData[0])
} }
}) })
})
} this.tableData = myTable;
this.commoditylist = newData })
} }
} else { } else {
this.Info(res.data.message); this.Error(res.data.message);
} }
}) })
}, },
getReturn(ProductList,data){ getProductCategoryTreeList() {
for(let i=0;i<data.length;i++){ this.apipost("/api/AppletGoods/GetProductCategoryTreeList", {}, res => {
if(ProductList.ProductId == data[i].Id){
this.AppointList2.push(data[i])
}
if(data[i].ChildList.length>0){
this.getReturn(ProductList,data[i].ChildList)
}
}
},
getProductCategoryTreeList(){
this.apipost("/api/AppletGoods/GetProductCategoryTreeList",{}, res => {
if (res.data.resultCode == 1) { if (res.data.resultCode == 1) {
this.ProductCategoryTreeList = res.data.data this.ProductCategoryTreeList = res.data.data
this.getProductGoodsPageList(1)
} else { } else {
// this.Info(res.data.message); this.Error(res.data.message);
} }
}) })
}, },
getProductGoodsPageList(type=2){ getProductGoodsPageList() {
this.loading_t =true this.loading_t = true
this.apipost("/api/product/GetProductGoodsPageList", this.msg2, res => { this.apipost("/api/OSGoods/GetOfflineGoodsPageList", this.msg2, res => {
this.loading_t=false; this.loading_t = false;
if(res.data.resultCode==1){ if (res.data.resultCode == 1) {
let pageData= res.data.data.pageData; this.tableData = res.data.data.pageData
for(let i= 0;i<pageData.length;i++){
pageData[i].disabled=false;
this.commoditylist.forEach(x=>{
if(pageData[i].Id == x.Id){
pageData[i].disabled=true;
}
})
}
this.tableData = pageData
this.count = res.data.data.count this.count = res.data.data.count
} }
if(type==1){
setTimeout(()=>{
if(this.$route.query.ID){
this.getDiscountCouponDetail(this.$route.query.ID)
}
},10)
}
}) })
}, },
cancel(){ cancel() {
this.$router.go(-1) this.$router.go(-1)
}, },
handleCheckAllChange(val) { handleCheckAllChange(val) {
this.msg.MemberLevelList = val ? this.cityOptions : []; this.msg.MemberLevelList = val ? this.cityOptions : [];
this.isIndeterminate = false; this.isIndeterminate = false;
...@@ -523,98 +415,85 @@ ...@@ -523,98 +415,85 @@
this.isIndeterminate = checkedCount > 0 && checkedCount < this.cities.length; this.isIndeterminate = checkedCount > 0 && checkedCount < this.cities.length;
}, },
addtableData(data){ addtableData(data) {
this.tableData[data.$index].disabled=true; var myTable = JSON.parse(JSON.stringify(this.tableData));
this.commoditylist.push(data.row) myTable[data.$index].disabled = true;
this.commoditylist.push(data.row);
this.tableData=myTable;
this.Success('添加成功'); this.Success('添加成功');
}, },
batchAdd(){ //批量添加 batchAdd() { //批量添加
let newdata=[] let newdata = []
for(let i=0;i<this.multipleSelection.length;i++){ for (let i = 0; i < this.multipleSelection.length; i++) {
if(this.commoditylist.length>0){ if (this.commoditylist.length > 0) {
for(let j=0;j<this.commoditylist.length;j++){ for (let j = 0; j < this.commoditylist.length; j++) {
if(this.multipleSelection[i].Id!=this.commoditylist[j].Id){ if (this.multipleSelection[i].Id != this.commoditylist[j].Id) {
newdata.push(this.multipleSelection[i]) newdata.push(this.multipleSelection[i])
for(let z =0;z<this.tableData.length;z++){ for (let z = 0; z < this.tableData.length; z++) {
if(this.tableData[z].Id==this.multipleSelection[i].Id){ if (this.tableData[z].Id == this.multipleSelection[i].Id) {
this.tableData[z].disabled=true; this.tableData[z].disabled = true;
break break
} }
} }
} }
} }
}else { } else {
newdata.push(this.multipleSelection[i]) newdata.push(this.multipleSelection[i])
for(let z =0;z<this.tableData.length;z++){ for (let z = 0; z < this.tableData.length; z++) {
if(this.tableData[z].Id==this.multipleSelection[i].Id){ if (this.tableData[z].Id == this.multipleSelection[i].Id) {
this.tableData[z].disabled=true; this.tableData[z].disabled = true;
break break
} }
} }
} }
} }
if (newdata.length > 0) {
if(newdata.length>0){
this.Success('添加成功'); this.Success('添加成功');
} }
this.commoditylist = this.unique(this.commoditylist.concat(newdata)) this.commoditylist = this.unique(this.commoditylist.concat(newdata));
this.$refs.dataTable.clearSelection()
}, },
// 数组去重 // 数组去重
unique(arr) { unique(arr) {
for (var i = 0, len = arr.length; i < len; i++) { for (var i = 0, len = arr.length; i < len; i++) {
for (var j = i + 1, len = arr.length; j < len; j++) { for (var j = i + 1, len = arr.length; j < len; j++) {
if (arr[i].Id === arr[j].Id ) { if (arr[i].Id === arr[j].Id) {
arr.splice(j, 1); arr.splice(j, 1);
j--; // 每删除一个数j的值就减1 j--; // 每删除一个数j的值就减1
len--; // j值减小时len也要相应减1(减少循环次数,节省性能) len--; // j值减小时len也要相应减1(减少循环次数,节省性能)
} }
} }
} }
return arr; return arr;
}, },
addcommoditybtn(){ deletecommod(data, index) {
this.addcommodity=true; this.tableData.forEach(x => {
for(let i=0;i<this.tableData.length;i++){ if (data.Id == x.Id) {
this.tableData[i].disabled= false; x.disabled = false
for(let j=0;j<this.commoditylist.length;j++){ this.commoditylist.splice(index, 1)
if(this.commoditylist[j].Id== this.tableData[i].Id){
this.tableData[i].disabled=true
}
} }
} })
},
deletecommod(data,type){
if(type==1){
this.commoditylist.splice(data,1)
}else {
this.commoditylist.splice(data.$index,1)
}
}, },
handleSelectionChange(val) { handleSelectionChange(val) {
this.multipleSelection=val this.multipleSelection = val
}, },
getUseType(val){ getUseType(val) {
if(val ==1){ if (val == 1) {
this.category=true; this.category = true;
this.$nextTick(() => {//在弹出dialog之前执行$nextTick回调函数,确保el-tree已经渲染 this.$nextTick(() => { //在弹出dialog之前执行$nextTick回调函数,确保el-tree已经渲染
this.$refs.tree.setCheckedKeys(this.checkedkeys); this.$refs.tree.setCheckedKeys(this.checkedkeys);
}); });
}else if(val==2){ } else if (val == 2) {
this.checkedkeys=[] this.checkedkeys = []
this.commodity =true this.addcommodity = true
} }
}, },
daterangeChange(e){ daterangeChange(e) {
let _this =this let _this = this
if(e==null){ if (e == null) {
_this.msg.value = [] _this.msg.value = []
}else { } else {
_this.$nextTick(() => { _this.$nextTick(() => {
_this.$set(_this.msg, "value", [e[0], e[1]]); _this.$set(_this.msg, "value", [e[0], e[1]]);
...@@ -624,14 +503,14 @@ ...@@ -624,14 +503,14 @@
}, },
getUseType2(){ getUseType2() {
this.checkedkeys=[] this.checkedkeys = []
}, },
deleteProduct(item,index){ deleteProduct(item, index) {
this.AppointList.splice(index,1) this.AppointList.splice(index, 1)
for(let i = 0;i<this.checkedkeys.length;i++){ for (let i = 0; i < this.checkedkeys.length; i++) {
if(this.checkedkeys[i]==item.ProductId){ if (this.checkedkeys[i] == item.ProductId) {
this.checkedkeys.splice(i,1) this.checkedkeys.splice(i, 1)
} }
} }
}, },
...@@ -639,42 +518,50 @@ ...@@ -639,42 +518,50 @@
this.msg2.pageIndex = val; this.msg2.pageIndex = val;
this.getProductGoodsPageList(); this.getProductGoodsPageList();
}, },
TreeList(val,e){ TreeList(val, e) {
this.eData = e this.eData = e
}, },
preserve(formName){ preserve(formName) {
this.$refs[formName].validate((valid) => { this.$refs[formName].validate((valid) => {
if (valid) { if (valid) {
if(this.msg.IndateType==2){ if (this.msg.IndateType == 2) {
if(this.msg.value.length>0){ if (this.msg.value.length > 0) {
this.msg.StartDate=this.msg.value[0]; this.msg.StartDate = this.msg.value[0];
this.msg.EndDate=this.msg.value[1]; this.msg.EndDate = this.msg.value[1];
this.msg.IndateDay=0 this.msg.IndateDay = 0
}else { } else {
this.Error('套餐卡有效期不能为空') this.Error('套餐卡有效期不能为空')
return false return false
} }
} }
if(this.msg.UseType==2){ if (this.msg.UseType == 2) {
let ProductList= [] let ProductList = []
for(let i = 0;i<this.commoditylist.length;i++){ for (let i = 0; i < this.commoditylist.length; i++) {
ProductList.push({'ProductId':this.commoditylist[i].Id,}) ProductList.push({
'ProductId': this.commoditylist[i].Id,
})
} }
this.msg.ProductList =ProductList this.msg.ProductList = ProductList
}else if(this.msg.UseType==1){ } else if (this.msg.UseType == 1) {
let ProductList= [] let ProductList = []
for(let i = 0;i<this.AppointList.length;i++){ for (let i = 0; i < this.AppointList.length; i++) {
ProductList.push({'ProductId':this.AppointList[i].ProductId,}) ProductList.push({
'ProductId': this.AppointList[i].ProductId,
})
} }
this.msg.ProductList =ProductList this.msg.ProductList = ProductList
} }
this.loading= true this.loading = true
this.apipost("/api/Reserve/AddOrUpdateDiscountCoupon",this.msg , res => { if (this.storeCheck.length == 0) {
this.loading= false this.msg.StoreIds = 0;
} else {
this.msg.StoreIds = this.storeCheck.join(',');
}
this.apipost("/api/Reserve/AddOrUpdateDiscountCoupon", this.msg, res => {
this.loading = false
if (res.data.resultCode == 1) { if (res.data.resultCode == 1) {
this.Success(res.data.message); this.Success(res.data.message);
this.$router.go(-1);//返回上一层 this.$router.go(-1); //返回上一层
} else { } else {
this.Info(res.data.message); this.Info(res.data.message);
...@@ -685,30 +572,58 @@ ...@@ -685,30 +572,58 @@
} }
}); });
}, },
getProductList(){ getProductList() {
this.category = false; this.category = false;
let e = this.eData; let e = this.eData;
let ProductList = this.msg.ProductList; let ProductList = []
ProductList=[]
this.checkedkeys = e.checkedKeys; this.checkedkeys = e.checkedKeys;
if(e.checkedNodes.length>0){ if (e.checkedNodes.length > 0) {
for(let i= 0;i<e.checkedNodes.length;i++){ this.checkedkeys.forEach(x => {
if(e.checkedNodes[i].ChildList.length==0){ var objList = this.getObjById(this.ProductCategoryTreeList, x);
ProductList.push({'ProductId':e.checkedNodes[i].Id,'Name':e.checkedNodes[i].Name}) if (objList) {
for (var i = 0; i < this.AppointList.length; i++) {
if (this.AppointList[i].ProductId == objList.Id) {
return;
}
}
this.AppointList.push({
ProductId: objList.Id,
Name: objList.Name
})
}
})
}
},
getObjById(list, id) {
if (!list instanceof Array) {
return null
}
//遍历数组
for (let i in list) {
let item = list[i]
if (item.Id === id) {
return item
} else {
//查不到继续遍历
if (item.ChildList) {
let value = this.getObjById(item.ChildList, id)
//查询到直接返回
if (value) {
return value
}
} }
} }
} }
this.AppointList= ProductList
}, },
ChangeListName(val) { ChangeListName(val) {
this.SmallShopMsg.Name = val; this.SmallShopMsg.Name = val;
this.getSmallShopsDropDownList() this.getSmallShopsDropDownList()
}, },
getSmallShopsDropDownList(){ getSmallShopsDropDownList() {
this.apipost("/api/SmallShops/GetAllSmallShopsList",this.SmallShopMsg , res => { this.apipost("/api/SmallShops/GetAllSmallShopsList", this.SmallShopMsg, res => {
this.loading= false this.loading = false
if (res.data.resultCode == 1) { if (res.data.resultCode == 1) {
this.SmallShopData = res.data.data this.SmallShopData = res.data.data
} else { } else {
...@@ -716,72 +631,84 @@ ...@@ -716,72 +631,84 @@
} }
}) })
}, },
openChangeDig(){ openChangeDig() {
this.changeState=true; this.changeState = true;
setTimeout(()=>{ setTimeout(() => {
this.$refs.mychild.InitData(); this.$refs.mychild.InitData();
},10) }, 10)
}, },
SelectId(msg){ SelectId(msg) {
this.changeState=false; this.changeState = false;
this.msg.CouponIco= this.getIconLink(msg.url); this.msg.CouponIco = this.getIconLink(msg.url);
}, },
}, },
mounted(){ mounted() {
} }
} }
</script> </script>
<style > <style>
.osAddmealcard .form-box { .osAddmealcard .form-box {
background: #fff; background: #fff;
padding: 20px 50% 20px 0; padding: 20px 50% 20px 0;
margin-top: 10px; margin-top: 10px;
} }
.osAddmealcard .el-input--small .el-input__inner{
.osAddmealcard .el-input--small .el-input__inner {
height: 32px; height: 32px;
line-height: 32px; line-height: 32px;
} }
.osAddmealcard .img_yuan{
.osAddmealcard .img_yuan {
width: 80px; width: 80px;
height: 80px; height: 80px;
margin-top: 5px; margin-top: 5px;
position: relative; position: relative;
} }
.osAddmealcard .img_yuan img{
.osAddmealcard .img_yuan img {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.osAddmealcard .el-date-editor .el-range__icon { .osAddmealcard .el-date-editor .el-range__icon {
line-height: 24px; line-height: 24px;
} }
.osAddmealcard .el-date-editor .el-range-separator{
.osAddmealcard .el-date-editor .el-range-separator {
line-height: 24px; line-height: 24px;
} }
.osAddmealcard .el-date-editor .el-range__close-icon{
.osAddmealcard .el-date-editor .el-range__close-icon {
line-height: 24px; line-height: 24px;
} }
.osAddmealcard .el-form-item__label{
.osAddmealcard .el-form-item__label {
padding: 0 20px 0 0; padding: 0 20px 0 0;
} }
.osAddmealcard .form-body{
.osAddmealcard .form-body {
background-color: #fff; background-color: #fff;
padding: 10px 50% 10px 20px; padding: 10px 50% 10px 20px;
min-width: 1000px; min-width: 1000px;
} }
.osAddmealcard .splist{
.osAddmealcard .splist {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
flex-wrap: wrap; flex-wrap: wrap;
} }
.osAddmealcard .app-image{
.osAddmealcard .app-image {
width: 50px; width: 50px;
height: 50px; height: 50px;
border-radius: 0%; border-radius: 0%;
background-position: center center; background-position: center center;
} }
</style> </style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment