Commit b249dd3e authored by zhengke's avatar zhengke

修改

parent 253daaa9
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<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 +23,27 @@ ...@@ -23,31 +23,27 @@
<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-form-item label="微店铺">-->
<!-- <el-select size="small" v-model="msg.SmallShopId" :filter-method="ChangeListName" filterable--> <!-- <el-select size="small" v-model="msg.SmallShopId" :filter-method="ChangeListName" filterable-->
<!-- placeholder="请选择">--> <!-- placeholder="请选择">-->
<!-- <el-option label="不限" :value="0"></el-option>--> <!-- <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 v-for="item in SmallShopData" :key="item.Id" :label="item.Name" :value="item.Id">-->
<!-- </el-option>--> <!-- </el-option>-->
<!-- </el-select>--> <!-- </el-select>-->
<!-- </el-form-item>--> <!-- </el-form-item>-->
<!-- <el-form-item label="赞羊用户专用">--> <!-- <el-form-item label="赞羊用户专用">-->
<!-- <el-radio-group v-model="msg.IsZanYangUse">--> <!-- <el-radio-group v-model="msg.IsZanYangUse">-->
<!-- <el-radio :label="0"></el-radio>--> <!-- <el-radio :label="0"></el-radio>-->
<!-- <el-radio :label="1"></el-radio>--> <!-- <el-radio :label="1"></el-radio>-->
<!-- </el-radio-group>--> <!-- </el-radio-group>-->
<!-- </el-form-item>--> <!-- </el-form-item>-->
<el-form-item label="加入领券中心"> <el-form-item label="加入领券中心">
<el-switch <el-switch :active-value="1" :inactive-value="0" v-model="msg.PickupCenter">
: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="指定商品类别或商品">
<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,25 +51,31 @@ ...@@ -55,25 +51,31 @@
<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(index,1)"></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>
...@@ -86,40 +88,33 @@ ...@@ -86,40 +88,33 @@
</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 <el-date-picker @input="daterangeChange" style="padding: 3px 10px;width: 450px;height: 32px"
@input="daterangeChange" v-model.trim="msg.value" type="datetimerange" range-separator="至" start-placeholder="开始日期"
style="padding: 3px 10px;width: 450px;height: 32px" end-placeholder="结束日期" value-format="yyyy-MM-dd HH:mm:ss" align="right">
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>
...@@ -131,54 +126,38 @@ ...@@ -131,54 +126,38 @@
<!--已指定商品类别选择--> <!--已指定商品类别选择-->
<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 default-expand-all node-key="Id" ref="tree"
show-checkbox :default-checked-keys="checkedkeys" @check="TreeList" :props="defaultProps">
default-expand-all
node-key="Id"
ref="tree"
:default-checked-keys="checkedkeys"
@check="TreeList"
:props="defaultProps">
</el-tree> </el-tree>
</div>
<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"> <el-dialog title="已指定商品" :visible.sync="commodity" width="1024px">
<template> <template>
<button class="el-button el-button--primary el-button--small" style="float: right;" @click="addcommoditybtn">新增</button> <button class="el-button el-button--primary el-button--small" style="float: right;"
<el-table @click="addcommoditybtn">新增</button>
:data="commoditylist" <el-table :data="commoditylist" style="width: 984px">
style="width: 984px"> <el-table-column prop="Id" label="ID" width="80">
<el-table-column
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="604">
prop="Name"
label="商品名称"
width="604">
</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">
<div class="cell"> <div class="cell">
<button type="button" class="el-button el-button--danger el-button--mini is-plain" @click="deletecommod(scope,2)"><span>删除</span></button> <button type="button" class="el-button el-button--danger el-button--mini is-plain"
@click="deletecommod(scope,2)"><span>删除</span></button>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
...@@ -191,64 +170,43 @@ ...@@ -191,64 +170,43 @@
<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 <el-table v-loading="loading_t" :data="tableData" @selection-change="handleSelectionChange"
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>
...@@ -268,111 +226,127 @@ ...@@ -268,111 +226,127 @@
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: "",
}, },
checkedkeys:[],//默认选中的 checkedkeys: [], //默认选中的
huiyuan:false, huiyuan: false,
zhongxin:true, zhongxin: true,
checked:true, checked: true,
loading:false, loading: false,
activeName:'first', activeName: 'first',
commodity:false, commodity: false,
addcommodity:false, addcommodity: false,
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 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: '',
} }
} }
}, },
created(){ created() {
this.getMemberGradeList() this.getMemberGradeList()
this.getSmallShopsDropDownList() this.getSmallShopsDropDownList()
}, },
methods:{ methods: {
getMemberGradeList(){ getMemberGradeList() {
this.cityOptions=[]; this.cityOptions = [];
this.apipost("/api/User/GetMemberGradeList",{}, res => { this.apipost("/api/User/GetMemberGradeList", {}, res => {
this.cities=res.data.data; this.cities = res.data.data;
let data=res.data.data; let data = res.data.data;
data.forEach(item=>{ data.forEach(item => {
this.cityOptions.push(item.Id) this.cityOptions.push(item.Id)
}) })
...@@ -380,71 +354,71 @@ ...@@ -380,71 +354,71 @@
this.getProductCategoryTreeList() this.getProductCategoryTreeList()
}, },
getDiscountCouponDetail(ID){ getDiscountCouponDetail(ID) {
this.apipost("/api/Education/GetDiscountCouponDetail",{'ID':ID} , res => { this.apipost("/api/Education/GetDiscountCouponDetail", {
'ID': ID
}, res => {
if (res.data.resultCode == 1) { if (res.data.resultCode == 1) {
this.msg = res.data.data this.msg = res.data.data
this.msg.value = [] this.msg.value = []
if(res.data.data.IndateType==2){ 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){ if (res.data.data.OnlyMember == 0) {
this.huiyuan=false this.huiyuan = false
}else { } else {
this.huiyuan=true this.huiyuan = true
} }
if(res.data.data.PickupCenter==0){ if (res.data.data.PickupCenter == 0) {
this.zhongxin=false this.zhongxin = false
}else { } else {
this.zhongxin=true this.zhongxin = true
} }
this.msg.MemberLevelList=res.data.data.MemberLevelList?res.data.data.MemberLevelList:[]; this.msg.MemberLevelList = res.data.data.MemberLevelList ? res.data.data.MemberLevelList : [];
if(this.msg.MemberLevelList){ //设置全选状态 if (this.msg.MemberLevelList) { //设置全选状态
if(this.msg.MemberLevelList.length == this.cities.length){ if (this.msg.MemberLevelList.length == this.cities.length) {
this.checkAll=true this.checkAll = true
} }
} }
if(res.data.data.UseType==1){ if (res.data.data.UseType == 1) {
let ProductList = res.data.data.ProductList; let ProductList = res.data.data.ProductList;
let newData = [] let newData = []
for(let i= 0;i<ProductList.length;i++){ 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++){ for (let j = 0; j < this.ProductCategoryTreeList.length; j++) {
if(ProductList[i].ProductId == this.ProductCategoryTreeList[j].Id){ if (ProductList[i].ProductId == this.ProductCategoryTreeList[j].Id) {
newData.push(this.ProductCategoryTreeList[j]) newData.push(this.ProductCategoryTreeList[j])
} }
if(this.ProductCategoryTreeList[j].ChildList.length>0){ if (this.ProductCategoryTreeList[j].ChildList.length > 0) {
this.getReturn(ProductList[i],this.ProductCategoryTreeList[j].ChildList) this.getReturn(ProductList[i], this.ProductCategoryTreeList[j].ChildList)
} }
} }
} }
this.AppointList = this.AppointList2.concat(newData) this.AppointList = this.AppointList2.concat(newData)
} }
if(res.data.data.UseType==2){ if (res.data.data.UseType == 2) {
let ProductList = res.data.data.ProductList; let ProductList = res.data.data.ProductList;
let newData = [] let newData = []
for(let i= 0;i<ProductList.length;i++){ for (let i = 0; i < ProductList.length; i++) {
this.apipost("/api/product/GetProductGoodsPageList", this.apipost("/api/product/GetProductGoodsPageList", {
{ pageIndex: 1,
pageIndex:1, pageSize: 15,
pageSize:15, Name: '',
Name:'', GoodsStatus: 0,
GoodsStatus:0, IsSelectSellOut: 0,
IsSelectSellOut:0, CategoryIds: '',
CategoryIds:'', Id: ProductList[i].ProductId,
Id:ProductList[i].ProductId, StartTime: '',
StartTime:'', EndTime: '',
EndTime:'', }, res => {
} if (res.data.resultCode == 1) {
, res => { let pageData = res.data.data.pageData;
if(res.data.resultCode==1){
let pageData= res.data.data.pageData;
newData.push(pageData[0]) newData.push(pageData[0])
} }
...@@ -458,19 +432,19 @@ ...@@ -458,19 +432,19 @@
} }
}) })
}, },
getReturn(ProductList,data){ getReturn(ProductList, data) {
for(let i=0;i<data.length;i++){ for (let i = 0; i < data.length; i++) {
if(ProductList.ProductId == data[i].Id){ if (ProductList.ProductId == data[i].Id) {
this.AppointList2.push(data[i]) this.AppointList2.push(data[i])
} }
if(data[i].ChildList.length>0){ if (data[i].ChildList.length > 0) {
this.getReturn(ProductList,data[i].ChildList) this.getReturn(ProductList, data[i].ChildList)
} }
} }
}, },
getProductCategoryTreeList(){ getProductCategoryTreeList() {
this.apipost("/api/AppletGoods/GetProductCategoryTreeList",{}, res => { 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
...@@ -481,35 +455,35 @@ ...@@ -481,35 +455,35 @@
}) })
}, },
getProductGoodsPageList(type=2){ getProductGoodsPageList(type = 2) {
this.loading_t =true this.loading_t = true
this.apipost("/api/product/GetProductGoodsPageList", this.msg2, res => { this.apipost("/api/product/GetProductGoodsPageList", 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; let pageData = res.data.data.pageData;
for(let i= 0;i<pageData.length;i++){ for (let i = 0; i < pageData.length; i++) {
pageData[i].disabled=false; pageData[i].disabled = false;
this.commoditylist.forEach(x=>{ this.commoditylist.forEach(x => {
if(pageData[i].Id == x.Id){ if (pageData[i].Id == x.Id) {
pageData[i].disabled=true; pageData[i].disabled = true;
} }
}) })
} }
this.tableData = pageData this.tableData = pageData
this.count = res.data.data.count this.count = res.data.data.count
} }
if(type==1){ if (type == 1) {
setTimeout(()=>{ setTimeout(() => {
if(this.$route.query.ID){ if (this.$route.query.ID) {
this.getDiscountCouponDetail(this.$route.query.ID) this.getDiscountCouponDetail(this.$route.query.ID)
} }
},10) }, 10)
} }
}) })
}, },
cancel(){ cancel() {
this.$router.go(-1) this.$router.go(-1)
}, },
...@@ -523,32 +497,32 @@ ...@@ -523,32 +497,32 @@
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; this.tableData[data.$index].disabled = true;
this.commoditylist.push(data.row) this.commoditylist.push(data.row)
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
} }
...@@ -557,7 +531,7 @@ ...@@ -557,7 +531,7 @@
} }
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))
...@@ -566,7 +540,7 @@ ...@@ -566,7 +540,7 @@
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(减少循环次数,节省性能)
...@@ -575,46 +549,46 @@ ...@@ -575,46 +549,46 @@
} }
return arr; return arr;
}, },
addcommoditybtn(){ addcommoditybtn() {
this.addcommodity=true; this.addcommodity = true;
for(let i=0;i<this.tableData.length;i++){ for (let i = 0; i < this.tableData.length; i++) {
this.tableData[i].disabled= false; this.tableData[i].disabled = false;
for(let j=0;j<this.commoditylist.length;j++){ for (let j = 0; j < this.commoditylist.length; j++) {
if(this.commoditylist[j].Id== this.tableData[i].Id){ if (this.commoditylist[j].Id == this.tableData[i].Id) {
this.tableData[i].disabled=true this.tableData[i].disabled = true
} }
} }
} }
}, },
deletecommod(data,type){ deletecommod(data, type) {
if(type==1){ if (type == 1) {
this.commoditylist.splice(data,1) this.commoditylist.splice(data, 1)
}else { } else {
this.commoditylist.splice(data.$index,1) 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.commodity = 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 +598,14 @@ ...@@ -624,14 +598,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 +613,46 @@ ...@@ -639,42 +613,46 @@
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/Education/AddOrUpdateDiscountCoupon",this.msg , res => { this.apipost("/api/Education/AddOrUpdateDiscountCoupon", this.msg, res => {
this.loading= false 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 +663,33 @@ ...@@ -685,30 +663,33 @@
} }
}); });
}, },
getProductList(){ getProductList() {
this.category = false; this.category = false;
let e = this.eData; let e = this.eData;
let ProductList = this.msg.ProductList; let ProductList = this.msg.ProductList;
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++){ for (let i = 0; i < e.checkedNodes.length; i++) {
if(e.checkedNodes[i].ChildList.length==0){ if (e.checkedNodes[i].ChildList.length == 0) {
ProductList.push({'ProductId':e.checkedNodes[i].Id,'Name':e.checkedNodes[i].Name}) ProductList.push({
'ProductId': e.checkedNodes[i].Id,
'Name': e.checkedNodes[i].Name
})
} }
} }
} }
this.AppointList= ProductList 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 +697,84 @@ ...@@ -716,72 +697,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>
.addCourseCard .form-box { .addCourseCard .form-box {
background: #fff; background: #fff;
padding: 20px 50% 20px 0; padding: 20px 50% 20px 0;
margin-top: 10px; margin-top: 10px;
} }
.addCourseCard .el-input--small .el-input__inner{
.addCourseCard .el-input--small .el-input__inner {
height: 32px; height: 32px;
line-height: 32px; line-height: 32px;
} }
.addCourseCard .img_yuan{
.addCourseCard .img_yuan {
width: 80px; width: 80px;
height: 80px; height: 80px;
margin-top: 5px; margin-top: 5px;
position: relative; position: relative;
} }
.addCourseCard .img_yuan img{
.addCourseCard .img_yuan img {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.addCourseCard .el-date-editor .el-range__icon { .addCourseCard .el-date-editor .el-range__icon {
line-height: 24px; line-height: 24px;
} }
.addCourseCard .el-date-editor .el-range-separator{
.addCourseCard .el-date-editor .el-range-separator {
line-height: 24px; line-height: 24px;
} }
.addCourseCard .el-date-editor .el-range__close-icon{
.addCourseCard .el-date-editor .el-range__close-icon {
line-height: 24px; line-height: 24px;
} }
.addCourseCard .el-form-item__label{
.addCourseCard .el-form-item__label {
padding: 0 20px 0 0; padding: 0 20px 0 0;
} }
.addCourseCard .form-body{
.addCourseCard .form-body {
background-color: #fff; background-color: #fff;
padding: 10px 50% 10px 20px; padding: 10px 50% 10px 20px;
min-width: 1000px; min-width: 1000px;
} }
.addCourseCard .splist{
.addCourseCard .splist {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
flex-wrap: wrap; flex-wrap: wrap;
} }
.addCourseCard .app-image{
.addCourseCard .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>
<template>
<div class="ServiceManageEdit">
<div class="head-title">
<span @click="CommonJump('ServiceMannage')" style="color:rgb(64, 158, 255);cursor:pointer;">服务人员管理</span><span
style="margin:0 9px;color:#C0C4CC">/</span><span>服务人员编辑</span>
</div>
<div class="content">
<el-form :model="addMsg" :rules="rules" ref="addMsg" label-width="100px" style="padding:0 20px;">
<el-form-item label="头像">
<div>
<el-tooltip class="item" effect="dark" content="建议尺寸:88*88" placement="top-start">
<el-button size="small" @click="choicImg=true">选择文件</el-button>
</el-tooltip>
</div>
<div class="headerImg">
<img v-if="addMsg.ServiceLogo" :src="addMsg.ServiceLogo" alt="" />
<img v-else src="../../assets/img/default.png" alt="" />
</div>
</el-form-item>
<el-form-item label="门店">
<el-select class="w200" style="margin-right: 10px;" v-model="addMsg.StoreId" size="small" 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="对应的类型" prop="ServiceType">
<div style="display: flex;flex-direction: row;align-items: center">
<div @click="getUseType(1)" style="margin-right: 15px">
<el-radio :label="1" v-model="addMsg.ServiceType">指定商品类型</el-radio>
</div>
<div @click='getUseType(2)' style="margin-right: 15px">
<el-radio :label="2" v-model="addMsg.ServiceType">指定商品</el-radio>
</div>
<el-radio :label="3" v-model="addMsg.ServiceType" @change="getUseType2" style="margin-right: 15px">全部商品
</el-radio>
</div>
<div class="splist" v-if="addMsg.ServiceType==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">
<span>{{item.Name}}</span>
<i class="el-tag__close el-icon-close" @click="deleteProduct(item,index)"></i>
</div>
</div>
<div class="splist" v-if="addMsg.ServiceType==2">
<div v-for="(item,index) in commoditylist" :label="item.ProductId" :key="index"
style="margin-right: 20px; position: relative; cursor: pointer;">
<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(index,1)"></i>
</div>
</div>
</el-form-item>
<el-form-item label="名称" prop="Name">
<el-input v-model="addMsg.Name" class="w400" size="small" placeholder="请输入服务人员名称" maxlength="20" />
</el-form-item>
<el-form-item label="性别" prop="Gender">
<el-radio-group v-model="addMsg.Gender">
<el-radio :label="item.Id" v-for="(item,index) in genderList" :key="index">{{item.Name}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="标签">
<el-tag :key="tag" size="small" v-for="(tag,index) in addMsg.LableNameList" closable
:disable-transitions="false" @close="handleClose(index)">
{{tag}}
</el-tag>
<el-input class="input-new-tag" v-if="inputVisible" v-model="inputValue" ref="saveTagInput" size="small"
@keyup.enter.native="handleInputConfirm" @blur="handleInputConfirm">
</el-input>
<el-button class="button-new-tag" size="mini" @click="showInput">+ 标签</el-button>
</el-form-item>
<el-form-item label="虚拟预约数">
<el-input v-model="addMsg.FictitiousReserveNum" @keyup.native="checkInteger(addMsg,'FictitiousReserveNum')"
class="w400" size="small" placeholder="请输入预约次数" maxlength="20" />
</el-form-item>
<el-form-item label="电话">
<el-input type="number" v-model="addMsg.Telephone" class="w400" size="small" placeholder="请输入电话"
maxlength="20" />
</el-form-item>
<el-form-item label="状态">
<el-switch v-model="addMsg.ServiceStatus" active-color="#409EFF" :active-value="1" :inactive-value="2">
</el-switch>
</el-form-item>
<el-form-item label="职务">
<el-input v-model="addMsg.Major" class="w400" size="small" placeholder="职务" maxlength="20" />
</el-form-item>
</el-form>
</div>
<el-button size="small" style="margin-top:20px;padding:9px 25px;" type="primary" @click="submitform('addMsg')">保存
</el-button>
<!-- 选择图片文件 -->
<el-dialog title="选择文件" :visible.sync="choicImg" width="1240px">
<ChooseImg @SelectId="SelectId"></ChooseImg>
</el-dialog>
<!--已指定商品类别选择-->
<el-dialog title="已指定商品类别" :visible.sync="category" width="714px">
<div style="height:400px;overflow:auto;">
<el-tree :data="ProductCategoryTreeList" show-checkbox :check-on-click-node="true" default-expand-all
node-key="Id" ref="tree" :default-checked-keys="checkedkeys" @check="TreeList" :props="defaultProps">
</el-tree>
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="category = false" size="small">取 消</el-button>
<el-button type="primary" @click="getProductList" size="small">确 定</el-button>
</div>
</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">
<template>
<div class="el-form-item">
<div class="el-form-item__content">
<div class="el-input el-input--small" style="width: 40%;">
<input type="text" autocomplete="off" placeholder="商品名称" class="el-input__inner" v-model="msg2.Name"
@clear="msg2.pageIndex=1,getProductGoodsPageList()" clearable>
</div>
<button type="button" class="el-button el-button--default el-button--small" style="margin-left: 15px"
@click="msg2.pageIndex=1,getProductGoodsPageList()">查找商品</button>
<button class="el-button el-button--default el-button--small" style="float: right;"
@click="batchAdd">批量添加</button>
</div>
</div>
<el-table v-loading="loading_t" :data="tableData" @selection-change="handleSelectionChange"
style="width: 984px">
<el-table-column type="selection" width="55">
</el-table-column>
<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="333">
</el-table-column>
<el-table-column prop="address" label="操作">
<template slot-scope="scope">
<el-button type="primary" plain size="mini" @click="addtableData(scope)" :disabled="scope.row.disabled">
{{scope.row.disabled==true? '已添加':'添加'}}</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination style="text-align:right" background @current-change="handleCurrentChange"
:page-size="msg2.pageSize" layout="prev, pager, next" :current-page.sync="msg2.pageIndex" :total="count">
</el-pagination>
</template>
</el-dialog>
</div>
</template>
<script>
import ChooseImg from "@/components/global/ChooseImg.vue";
export default {
data() {
let validataType = (rule, value, callback) => {
if (this.addMsg.ServiceType == '') {
return callback(new Error('请选择对应类型'));
} else {
callback();
}
}
let validataSex = (rule, value, callback) => {
if (this.addMsg.Gender == '') {
return callback(new Error('请选择性别'));
} else {
callback();
}
}
return {
//选择图片
choicImg: false,
//是否线下链接弹窗
isShowLink: false,
dataList: [],
addMsg: {
LableNameList: [], // 标签
StoreId: '', // 店铺id
Gender: '', //性别
ServiceType: '', //对应的类型
ProductList: [], //商品信息
ID: 0, //编号
Name: '', //服务人员名称
ServiceLogo: '', //头像、
Major: '', //职务
ServiceStatus: 1, // 启用/禁用 状态1启用 2禁用
Telephone: '', //电话
FictitiousReserveNum: '' //虚拟预约数
},
msg2: {
pageIndex: 1,
pageSize: 15,
Name: '',
GoodsStatus: 0,
IsSelectSellOut: 0,
CategoryIds: '',
Id: 0,
StartTime: '',
EndTime: '',
},
genderList: [], //性别枚举
inputValue: '', //新增标签输入框值
inputVisible: false, //切换新增标签输入框
category: false,
defaultProps: {
children: 'ChildList',
label: 'Name'
},
ProductCategoryTreeList: [],
checkedkeys: [], //默认选中的
commodity: false,
AppointList: [], //指定商品分类
addcommodity: false,
commoditylist: [], //商品的list
loading_t: false,
tableData: [],
multipleSelection: [],
count: 0,
cityOptions: [],
cities: [],
SmallShopData: [],
SmallShopMsg: {
Name: ''
},
StoreList: [], //门店下拉数据
AppointList2: [],
rules: {
Name: [{
required: true,
message: "请输入服务人员名称",
trigger: "blur"
}],
ServiceType: [{
validator: validataType,
trigger: "blur",
required: true
}],
Gender: [{
validator: validataSex,
trigger: "blur",
required: true
}]
}
};
},
components: {
ChooseImg
},
created() {
},
methods: {
//新增标签
showInput() {
this.inputVisible = true;
this.$nextTick(_ => {
this.$refs.saveTagInput.$refs.input.focus();
});
},
handleInputConfirm() {
if (this.inputValue) {
this.addMsg.LableNameList.push(this.inputValue);
}
this.inputVisible = false;
this.inputValue = '';
},
//获取性别
getMale() {
this.apipost("/api/Reserve/GetGenderEnumList", {}, res => {
if (res.data.resultCode == 1) {
this.genderList = res.data.data;
} else {
this.Error(res.data.message);
}
})
},
//删除标签
handleClose(index) {
this.addMsg.LableNameList.splice(index, 1);
},
//操作对应商品类型
getUseType(val) {
if (val == 1) {
this.category = true;
this.$nextTick(() => { //在弹出dialog之前执行$nextTick回调函数,确保el-tree已经渲染
this.$refs.tree.setCheckedKeys(this.checkedkeys);
});
} else if (val == 2) {
this.checkedkeys = []
this.commodity = true
}
},
TreeList(val, e) {
this.eData = e
},
getUseType2() {
this.checkedkeys = []
},
//新增对应商品类型
getProductList() {
this.category = false;
let e = this.eData;
let ProductList = []
this.checkedkeys = e.checkedKeys;
if (e.checkedNodes.length > 0) {
for (let i = 0; i < e.checkedNodes.length; i++) {
if (e.checkedNodes[i].ChildList.length == 0) {
ProductList.push({
'ProductId': e.checkedNodes[i].Id,
'Name': e.checkedNodes[i].Name
})
}
}
}
console.log(ProductList, 'ProductList');
this.AppointList = ProductList
},
//删除对应商品类型
deleteProduct(item, index) {
console.log(item, 'item');
this.AppointList.splice(index, 1)
for (let i = 0; i < this.checkedkeys.length; i++) {
if (this.checkedkeys[i] == item.ProductId) {
this.checkedkeys.splice(i, 1)
}
}
console.log(this.AppointList, 'this.AppointList');
},
addcommoditybtn() {
this.addcommodity = true;
for (let i = 0; i < this.tableData.length; i++) {
this.tableData[i].disabled = false;
for (let j = 0; j < this.commoditylist.length; j++) {
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)
}
},
getProductGoodsPageList(type = 2) {
this.loading_t = true
this.apipost("/api/product/GetProductGoodsPageList", this.msg2, res => {
this.loading_t = false;
if (res.data.resultCode == 1) {
let pageData = 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
}
})
},
handleSelectionChange(val) {
this.multipleSelection = val
},
addtableData(data) {
this.tableData[data.$index].disabled = true;
this.commoditylist.push(data.row)
this.Success('添加成功');
},
handleCurrentChange(val) {
this.msg2.pageIndex = val;
this.getProductGoodsPageList();
},
batchAdd() { //批量添加
let newdata = []
for (let i = 0; i < this.multipleSelection.length; i++) {
if (this.commoditylist.length > 0) {
for (let j = 0; j < this.commoditylist.length; j++) {
if (this.multipleSelection[i].Id != this.commoditylist[j].Id) {
newdata.push(this.multipleSelection[i])
for (let z = 0; z < this.tableData.length; z++) {
if (this.tableData[z].Id == this.multipleSelection[i].Id) {
this.tableData[z].disabled = true;
break
}
}
}
}
} else {
newdata.push(this.multipleSelection[i])
for (let z = 0; z < this.tableData.length; z++) {
if (this.tableData[z].Id == this.multipleSelection[i].Id) {
this.tableData[z].disabled = true;
break
}
}
}
}
if (newdata.length > 0) {
this.Success('添加成功');
}
this.commoditylist = this.unique(this.commoditylist.concat(newdata))
},
// 数组去重
unique(arr) {
for (var i = 0, len = arr.length; i < len; i++) {
for (var j = i + 1, len = arr.length; j < len; j++) {
if (arr[i].Id === arr[j].Id) {
arr.splice(j, 1);
j--; // 每删除一个数j的值就减1
len--; // j值减小时len也要相应减1(减少循环次数,节省性能)
}
}
}
return arr;
},
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.getProductCategoryTreeList()
},
getProductCategoryTreeList() {
this.apipost("/api/AppletGoods/GetProductCategoryTreeList", {}, res => {
if (res.data.resultCode == 1) {
this.ProductCategoryTreeList = res.data.data
} else {
this.Error(res.data.message);
}
})
},
getSmallShopsDropDownList() {
this.apipost("/api/SmallShops/GetAllSmallShopsList", this.SmallShopMsg, res => {
this.loading = false
if (res.data.resultCode == 1) {
this.SmallShopData = res.data.data
} else {
this.Error(res.data.message);
}
})
},
//选择图片
SelectId(msg) {
this.addMsg.ServiceLogo = this.getIconLink(msg.url);
this.choicImg = false;
},
submitform(addMsg) {
//提交创建、修改表单
this.$refs[addMsg].validate(valid => {
if (valid) {
this.saveMsg();
} else {
return false;
}
});
},
getStoreList() {
this.apipost("/api/MContent/GetStoresList", {}, res => {
if (res.data.resultCode == 1) {
this.StoreList = res.data.data;
console.log(res, '下拉数据');
} else {
this.Error(res.data.message);
}
})
},
//保存
saveMsg() {
if (this.addMsg.ServiceType == 2) {
let ProductList = []
for (let i = 0; i < this.commoditylist.length; i++) {
ProductList.push({
'ProductId': this.commoditylist[i].Id,
})
}
this.addMsg.ProductList = ProductList
} else if (this.addMsg.ServiceType == 1) {
let ProductList = []
for (let i = 0; i < this.AppointList.length; i++) {
ProductList.push({
'ProductId': this.AppointList[i].ProductId,
})
}
this.addMsg.ProductList = ProductList
}
console.log(this.addMsg);
this.apipost("/api/Reserve/AddOrUpdateServicePersonal", this.addMsg, res => {
if (res.data.resultCode == 1) {
this.Success(res.data.message);
this.$router.go(-1); //返回上一层
} else {
this.Error(res.data.message);
}
})
},
//获取数据
getData() {
this.apipost("/api/Reserve/GetServicePersonalModel", {
ID: this.addMsg.ID
}, res => {
if (res.data.resultCode == 1) {
console.log(res, '获取数据');
this.addMsg = res.data.data;
if (res.data.data.ServiceType == 1) {
let ProductList = res.data.data.ProductList;
let newData = []
this.getProductCategoryTreeList();
console.log(this.ProductCategoryTreeList, 'ProductCategoryTreeList');
for (let i = 0; i < ProductList.length; i++) {
this.checkedkeys.push(ProductList[i].ProductId)
console.log(this.getObjById(this.ProductCategoryTreeList,ProductList[i].ProductId),'阿萨德');
}
// console.log(newData, 'newData');
// this.AppointList = this.AppointList2.concat(newData)
}
if (res.data.data.ServiceType == 2) {
let ProductList = res.data.data.ProductList;
let newData = []
for (let i = 0; i < ProductList.length; i++) {
this.apipost("/api/product/GetProductGoodsPageList", {
pageIndex: 1,
pageSize: 15,
Name: '',
GoodsStatus: 0,
IsSelectSellOut: 0,
CategoryIds: '',
Id: ProductList[i].ProductId,
StartTime: '',
EndTime: '',
}, res => {
if (res.data.resultCode == 1) {
let pageData = res.data.data.pageData;
newData.push(pageData[0])
}
})
}
this.commoditylist = newData
}
} else {
this.Error(res.data.message);
}
})
},
getObjById(list,id) {
console.log(list,'list');
console.log(id,'idddd');
if (!list instanceof Array) {
return null
}
//遍历数组
for (let i in list) {
let item = list[i]
console.log(item,'itemmmmmm');
if (item.Id === id) {
console.log(item,'item');
return item
} else {
//查不到继续遍历
if (item.ChildList) {
let value = getObjById(item.ChildList, id)
//查询到直接返回
if (value) {
return value
}
}
}
}
},
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() {
this.getMale();
this.getMemberGradeList();
this.getSmallShopsDropDownList();
this.getStoreList();
if (this.$route.query.ID) {
this.addMsg.ID = this.$route.query.ID;
this.getData()
}
}
};
</script>
<style>
.ServiceManageEdit .headerImg {
width: 80px;
height: 80px;
}
.ServiceManageEdit .headerImg img {
width: 100%;
height: 100%;
}
.ServiceManageEdit .content {
background: #fff;
margin-top: 10px;
padding: 20px;
box-sizing: border-box;
}
.ServiceManageEdit .app-image {
width: 50px;
height: 50px;
border-radius: 0%;
background-position: center center;
}
.ServiceManageEdit .splist {
display: flex;
flex-wrap: wrap;
}
.ServiceManageEdit .input-new-tag {
width: 90px;
margin-left: 10px;
vertical-align: bottom;
}
</style>
<template> <template>
<div class="navigation"> <div class="ServiceManage">
<template v-if="NavIconIsShowAdd">
<div class="head-title"> <div class="head-title">
服务人员列表 服务人员列表
<el-button @click="NavIconIsShowAdd=false" style="float:right;margin-top: -5px;" size="small" type="primary"> <el-button @click="CommonJump('ServiceManageEdit')" style="float:right;margin-top: -5px;" size="small" type="primary">
添加服务人员 添加服务人员
</el-button> </el-button>
</div> </div>
...@@ -59,7 +58,7 @@ ...@@ -59,7 +58,7 @@
</el-table-column> </el-table-column>
<el-table-column label="操作" width="120"> <el-table-column label="操作" width="120">
<template slot-scope="scope"> <template slot-scope="scope">
<img @click="EditNavIcon(scope.row)" src="../../assets/img/userman/edit.png" alt=""> <img @click="goUrl(scope.row)" src="../../assets/img/userman/edit.png" alt="">
<!-- <img style="margin-left:10px;" src="../../assets/img/userman/del.png" alt=""> --> <!-- <img style="margin-left:10px;" src="../../assets/img/userman/del.png" alt=""> -->
</template> </template>
</el-table-column> </el-table-column>
...@@ -68,114 +67,12 @@ ...@@ -68,114 +67,12 @@
:page-size="msg.pageSize" layout="prev, pager, next" :total="total"> :page-size="msg.pageSize" layout="prev, pager, next" :total="total">
</el-pagination> </el-pagination>
</div> </div>
</template>
<template v-else>
<div class="head-title">
<span @click="NavIconIsShowAdd=true" style="color:rgb(64, 158, 255);cursor:pointer;">导航图标列表</span><span
style="margin:0 9px;color:#C0C4CC">/</span><span>导航图标编辑</span>
</div>
<div class="content">
<el-form :model="addMsg" :rules="rules" ref="addMsg" label-width="100px" style="padding:0 20px;">
<el-form-item label="头像">
<div>
<el-tooltip class="item" effect="dark" content="建议尺寸:88*88" placement="top-start">
<el-button size="small" @click="choicImg=true">选择文件</el-button>
</el-tooltip>
</div>
<div class="navNavIconImg">
<img v-if="addMsg.ServiceLogo" :src="addMsg.ServiceLogo" alt="" />
<img v-else src="../../assets/img/default.png" alt="" />
</div>
</el-form-item>
<el-form-item label="对应的类型">
<div @click="getUseType(1)" style="margin-right: 15px">
<el-radio :label="1" v-model="addMsg.ServiceType">分类</el-radio>
</div>
<div @click='getUseType(2)' style="margin-right: 15px">
<el-radio :label="2" v-model="msg.ServiceType">部分商品</el-radio>
</div>
<el-radio :label="3" v-model="msg.ServiceType" @change="getUseType2" style="margin-right: 15px">全部商品</el-radio>
</el-form-item>
<el-form-item label="名称" prop="Name">
<el-input v-model="addMsg.Name" class="w400" size="small" placeholder="请输入服务人员名称" maxlength="20" />
</el-form-item>
<el-form-item label="性别">
<el-radio-group v-model="addMsg.Gender">
<el-radio :label="item.Name" v-for="(item,index) in genderList" :key="index">{{item.Name}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="标签">
<el-tag :key="tag" size="small" v-for="(tag,index) in addMsg.LableNameList" closable :disable-transitions="false"
@close="handleClose(index)">
{{tag}}
</el-tag>
<el-input
class="input-new-tag"
v-if="inputVisible"
v-model="inputValue"
ref="saveTagInput"
size="small"
@keyup.enter.native="handleInputConfirm"
@blur="handleInputConfirm"
>
</el-input>
<el-button class="button-new-tag" size="small" @click="showInput">+ 标签</el-button>
</el-form-item>
<el-form-item label="虚拟预约数">
<el-input v-model="addMsg.FictitiousReserveNum" class="w400" size="small" placeholder="请输入预约次数" maxlength="20" />
</el-form-item>
<el-form-item label="电话">
<el-input v-model="addMsg.Telephone" class="w400" size="small" placeholder="请输入电话" maxlength="20" />
</el-form-item>
<el-form-item label="状态">
<el-switch
v-model="addMsg.ServiceStatus"
active-color="#409EFF"
:active-value="1"
:inactive-value="2"
active-text="启用"
inactive-text="禁用">
</el-switch>
</el-form-item>
<el-form-item label="职务">
<el-input v-model="addMsg.Major" class="w400" size="small" placeholder="职务" maxlength="20" />
</el-form-item>
</el-form>
</div>
<el-button size="small" style="margin-top:20px;padding:9px 25px;" type="primary" @click="submitform('addMsg')">保存
</el-button>
</template>
<el-dialog title="选择链接" :visible.sync="isShowLink" width="800px">
<chooseMenu ref="chooseMenu">
</chooseMenu>
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="isShowLink=false">取 消</el-button>
<el-button size="small" type="danger" @click="getMenu()">确 定</el-button>
</span>
</el-dialog>
<!-- 选择图片文件 -->
<el-dialog title="选择文件" :visible.sync="choicImg" width="1240px">
<ChooseImg @SelectId="SelectId"></ChooseImg>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import chooseMenu from "../common/chooseMenu.vue";
import ChooseImg from "@/components/global/ChooseImg.vue";
export default { export default {
data() { data() {
let validataNavIconImg = (rule, value, callback) => {
if (this.addMsg.NavIconImg == '') {
return callback(new Error('请选择导航图标'));
} else {
callback();
}
}
return { return {
//选择图片
choicImg: false,
//是否线下链接弹窗
isShowLink: false,
loading: false, loading: false,
dataList: [], dataList: [],
msg: { msg: {
...@@ -185,62 +82,18 @@ ...@@ -185,62 +82,18 @@
ID:0, //编号 ID:0, //编号
Telephone:'' //电话 Telephone:'' //电话
}, },
addMsg:{
LableNameList:[], // 标签
StoreId:'', // 店铺id
Gender:'', //性别
ServiceType:'', //对应的类型
ProductList:[], //商品信息
ID:0, //编号
Name:'', //服务人员名称
ServiceLogo:'', //头像、
Major:'', //职务
ServiceStatus:1, // 启用/禁用 状态1启用 2禁用
Telephone:'', //电话
FictitiousReserveNum:'' //虚拟预约数
},
GoodsIds: [], //列表选中的商品编号 GoodsIds: [], //列表选中的商品编号
total: 0, total: 0,
NavIconIsShowAdd: true, checkedkeys:[],//默认选中的
addMsg: {
pageIndex: 1,
pageSize: 10,
},
genderList:[], //性别枚举
inputValue:'', //新增标签输入框值
inputVisible: false, //切换新增标签输入框
rules:{
}
}; };
}, },
components: {
chooseMenu,
ChooseImg
},
created() { created() {
}, },
methods: { methods: {
//新增标签
showInput() {
this.inputVisible = true;
this.$nextTick(_ => {
this.$refs.saveTagInput.$refs.input.focus();
});
},
handleInputConfirm() {
if (this.inputValue) {
this.addMsg.LableNameList.push(this.inputValue);
}
this.inputVisible = false;
this.inputValue = '';
},
//表格选中 //表格选中
tableSelect(val) { tableSelect(val) {
this.GoodsIds = val; this.GoodsIds = val;
console.log(val,'val');
}, },
//操作上下架 //操作上下架
operateShelves(type){ operateShelves(type){
...@@ -279,34 +132,26 @@ ...@@ -279,34 +132,26 @@
); );
}); });
}, },
//获取性别
getMale(){
this.apipost("/api/Reserve/GetGenderEnumList", {}, res => {
if (res.data.resultCode == 1) {
console.log(res,'数据');
this.genderList = res.data.data;
} else {
this.Error(res.data.message);
}
})
},
//删除标签
handleClose(tag) {
this.addMsg.LableNameList.splice(index, 1);
},
//操作对应商品类型 //操作对应商品类型
getUseType(){ getUseType(val){
if(val ==1){
}, this.category=true;
getUseType2(){ this.$nextTick(() => {//在弹出dialog之前执行$nextTick回调函数,确保el-tree已经渲染
this.$refs.tree.setCheckedKeys(this.checkedkeys);
});
}else if(val==2){
this.checkedkeys=[]
this.commodity =true
}
}, },
goUrl(row){
getMenu() { this.$router.push({
//调用子组件方法 name: 'ServiceManageEdit',
var obj = this.$refs.chooseMenu.getChooseMenu(); query: {
this.addMsg.NavIconUrl = obj.PageUrl; ID:row.ID,
this.isShowLink = false; blank: "y"
}
});
}, },
handleCurrentChange(val) { handleCurrentChange(val) {
this.msg.pageIndex = val; this.msg.pageIndex = val;
...@@ -324,103 +169,19 @@ ...@@ -324,103 +169,19 @@
this.Error(res.data.message); this.Error(res.data.message);
} }
}) })
},
//选择图片
SelectId(msg) {
this.addMsg.ServiceLogo = this.getIconLink(msg.url);
this.choicImg = false;
},
submitform(addMsg) {
//提交创建、修改表单
this.$refs[addMsg].validate(valid => {
if (valid) {
this.saveMsg();
} else {
return false;
} }
});
},
//保存
saveMsg() {
this.apipost("/api/Tenant/SetMiniProgrameNavicon", this.addMsg, res => {
if (res.data.resultCode == 1) {
this.getList();
this.NavIconIsShowAdd = true;
this.addMsg.NavIconId = 0;
this.addMsg.NavIconName = "";
this.addMsg.NavIconSort = 100;
this.addMsg.NavIconImg = "";
this.addMsg.NavIconUrl = "";
this.addMsg.NavIconIsShow = 0;
} else {
this.Info(res.data.message);
}
})
},
//修改
EditNavIcon(item) {
this.apipost("/api/Tenant/GetMiniProgrameNavicon", {
NavIconId: item.NavIconId
}, res => {
if (res.data.resultCode == 1) {
this.addMsg = res.data.data;
this.NavIconIsShowAdd = false;
} else {
this.Info(res.data.message);
}
})
},
}, },
mounted() { mounted() {
this.getList(); this.getList();
this.getMale();
} }
}; };
</script> </script>
<style> <style>
.navNavIconImg { .ServiceManage .content {
width: 80px;
height: 80px;
}
.navNavIconImg img {
width: 100%;
height: 100%;
}
.navigation .blue {
color: #409EFF;
}
.navigation .content .searchInput {
border: 1px solid #DCDFE6;
border-radius: 4px;
}
.navigation .content .searchInput .el-input__inner {
border: none;
outline: none;
height: 30px;
line-height: 30px;
}
.navigation .content .searchInput {
line-height: normal;
display: inline-table;
width: 100%;
border-collapse: separate;
border-spacing: 0;
width: 250px;
margin-right: 20px;
}
.navigation .content {
background: #fff; background: #fff;
margin-top: 10px; margin-top: 10px;
padding: 20px; padding: 20px;
box-sizing: border-box; box-sizing: border-box;
} }
</style> </style>
...@@ -392,6 +392,12 @@ export default new Router({ ...@@ -392,6 +392,12 @@ export default new Router({
name: 'ServiceMannage', name: 'ServiceMannage',
component: resolve => require(['@/components/offlineService/ServiceMannage'], resolve) component: resolve => require(['@/components/offlineService/ServiceMannage'], resolve)
}, },
//线下 服务人员新增修改
{
path: '/ServiceManageEdit',
name: 'ServiceManageEdit',
component: resolve => require(['@/components/offlineService/ServiceManageEdit'], resolve)
},
//店铺管理 内容管理 门店管理 //店铺管理 内容管理 门店管理
{ {
path: '/storesManage', path: '/storesManage',
......
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