Commit b249dd3e authored by zhengke's avatar zhengke

修改

parent 253daaa9
......@@ -14,7 +14,7 @@
<el-form-item label="课程卡名称" prop="Name" class="is-required">
<el-input v-model="msg.Name" />
</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>
......@@ -23,31 +23,27 @@
<img v-else :src="msg.CouponIco" alt="">
</div>
</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-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-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-form-item>
<el-form-item label="指定商品类别或商品" >
<el-form-item label="指定商品类别或商品">
<div style="display: flex;flex-direction: row;align-items: center">
<div @click="getUseType(1)" style="margin-right: 15px">
<el-radio :label="1" v-model="msg.UseType">指定商品类型</el-radio>
......@@ -55,25 +51,31 @@
<div @click='getUseType(2)' style="margin-right: 15px">
<el-radio :label="2" v-model="msg.UseType">指定商品</el-radio>
</div>
<el-radio :label="3" v-model="msg.UseType" @change="getUseType2" style="margin-right: 15px">全场通用</el-radio>
<el-radio :label="4" v-model="msg.UseType" @change="getUseType2" >当面付</el-radio>
<el-radio :label="3" v-model="msg.UseType" @change="getUseType2" style="margin-right: 15px">全场通用
</el-radio>
<el-radio :label="4" v-model="msg.UseType" @change="getUseType2">当面付</el-radio>
</div>
<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>
<i class="el-tag__close el-icon-close" @click="deleteProduct(item,index)"></i>
</div>
</div>
<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 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 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="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>
</el-input>
......@@ -86,40 +88,33 @@
</el-form-item>
<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 label="有效期范围" class="is-required" v-if="msg.IndateType==2" >
<el-date-picker
@input="daterangeChange"
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-form-item label="有效期范围" class="is-required" v-if="msg.IndateType==2">
<el-date-picker @input="daterangeChange" 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-form-item>
<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 label="可领取数量" prop="TotalNum" class="is-required">
<el-tooltip class="item" effect="dark" content="可领取数量为0则无法领取或发放,-1为不限制张数" placement="top"
style="position: absolute;left: -16px;top:10px">
<i class="el-tooltip el-icon-info"></i>
</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-form-item>
<el-form-item label="课程卡描述">
<el-input
type="textarea"
:rows="2"
v-model="msg.Describe">
<el-input type="textarea" :rows="2" v-model="msg.Describe">
</el-input>
</el-form-item>
</div>
......@@ -131,54 +126,38 @@
<!--已指定商品类别选择-->
<el-dialog title="已指定商品类别" :visible.sync="category" width="714px">
<el-tree
:data="ProductCategoryTreeList"
show-checkbox
default-expand-all
node-key="Id"
ref="tree"
:default-checked-keys="checkedkeys"
@check="TreeList"
:props="defaultProps">
<div style="height:400px;overflow:auto;">
<el-tree :data="ProductCategoryTreeList" show-checkbox 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">取 消</el-button>
<el-button type="primary" @click="getProductList">确 定</el-button>
<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">
<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">
<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 prop="Name" label="商品名称" width="604">
</el-table-column>
<el-table-column
prop="address"
label="操作"
>
<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>
<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>
......@@ -191,64 +170,43 @@
<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%;" >
<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
>
@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>
<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"
<el-table v-loading="loading_t" :data="tableData" @selection-change="handleSelectionChange"
style="width: 984px">
<el-table-column
type="selection"
width="55">
<el-table-column type="selection" width="55">
</el-table-column>
<el-table-column
prop="Id"
label="ID"
width="80">
<el-table-column prop="Id" label="ID" width="80">
</el-table-column>
<el-table-column
label="商品图"
width="80">
<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 prop="Name" label="商品名称" width="333">
</el-table-column>
<el-table-column
prop="address"
label="操作"
>
<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>
<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 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>
......@@ -268,111 +226,127 @@
components: {
ChooseImg,
},
data(){
return{
msg:{
ID:0,
Name:'',
CouponType:1,
UseType:3,
MaxDiscountsPrice:0,
IndateDay:1,
IndateType:1,
TotalNum:-1,
Describe:'',
OnlyMember:0,
PickupCenter:0,
MemberLevelList:[],
ProductList:[],//指定商品类型的数组
StartDate:'',
EndDate:'',
value:[],
SmallShopId:0,//微店id
IsZanYangUse:0,
HeXiao:1,
CouponIco:"",
},
checkedkeys:[],//默认选中的
huiyuan:false,
zhongxin:true,
checked:true,
loading:false,
activeName:'first',
commodity:false,
addcommodity:false,
changeState:false,
SmallShopData:[],
rules:{
Name:[
{required: true, message: "课程卡名称不能为空", trigger: "blur"}
],
IndateDay:[
{required: true, message: "课程卡有效天数不能为空", trigger: "blur"}
],
MaxDiscountsPrice:[
{required: true, message: "抵扣金额不能为空", trigger: "blur"}
],
TotalNum:[
{required: true, message: "发放总数不能为空", trigger: "blur"}
],
CouponIco:[
{required: true, message: "请选择课程卡图标", trigger: "blur"}
],
HeXiao:[
{required: true, message: "请输入可核销总次数", trigger: "blur"}
],
value:[
{ type: 'array', required: true, message: '课程卡有效期不能为空', trigger: 'change' }
data() {
return {
msg: {
ID: 0,
Name: '',
CouponType: 1,
UseType: 3,
MaxDiscountsPrice: 0,
IndateDay: 1,
IndateType: 1,
TotalNum: -1,
Describe: '',
OnlyMember: 0,
PickupCenter: 0,
MemberLevelList: [],
ProductList: [], //指定商品类型的数组
StartDate: '',
EndDate: '',
value: [],
SmallShopId: 0, //微店id
IsZanYangUse: 0,
HeXiao: 1,
CouponIco: "",
},
checkedkeys: [], //默认选中的
huiyuan: false,
zhongxin: true,
checked: true,
loading: false,
activeName: 'first',
commodity: false,
addcommodity: false,
changeState: false,
SmallShopData: [],
rules: {
Name: [{
required: true,
message: "课程卡名称不能为空",
trigger: "blur"
}],
IndateDay: [{
required: true,
message: "课程卡有效天数不能为空",
trigger: "blur"
}],
MaxDiscountsPrice: [{
required: true,
message: "抵扣金额不能为空",
trigger: "blur"
}],
TotalNum: [{
required: true,
message: "发放总数不能为空",
trigger: "blur"
}],
CouponIco: [{
required: true,
message: "请选择课程卡图标",
trigger: "blur"
}],
HeXiao: [{
required: true,
message: "请输入可核销总次数",
trigger: "blur"
}],
value: [{
type: 'array',
required: true,
message: '课程卡有效期不能为空',
trigger: 'change'
}
]
},
cityOptions:[],
cityOptions: [],
cities: [],
checkAll: false,
isIndeterminate: false,
category:false,
ProductCategoryTreeList:[],
commoditylist:[],//商品的list
AppointList:[],//指定商品分类
category: false,
ProductCategoryTreeList: [],
commoditylist: [], //商品的list
AppointList: [], //指定商品分类
defaultProps: {
children: 'ChildList',
label: 'Name'
},
eData:{},
msg2:{
pageIndex:1,
pageSize:15,
Name:'',
GoodsStatus:0,
IsSelectSellOut:0,
CategoryIds:'',
Id:0,
StartTime:'',
EndTime:'',
},
tableData:[],
loading_t:false,
count:0,
multipleSelection:[],
AppointList2:[],
SmallShopMsg:{
Name:'',
}
}
},
created(){
eData: {},
msg2: {
pageIndex: 1,
pageSize: 15,
Name: '',
GoodsStatus: 0,
IsSelectSellOut: 0,
CategoryIds: '',
Id: 0,
StartTime: '',
EndTime: '',
},
tableData: [],
loading_t: false,
count: 0,
multipleSelection: [],
AppointList2: [],
SmallShopMsg: {
Name: '',
}
}
},
created() {
this.getMemberGradeList()
this.getSmallShopsDropDownList()
},
methods:{
getMemberGradeList(){
this.cityOptions=[];
this.apipost("/api/User/GetMemberGradeList",{}, res => {
this.cities=res.data.data;
let data=res.data.data;
data.forEach(item=>{
methods: {
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)
})
......@@ -380,71 +354,71 @@
this.getProductCategoryTreeList()
},
getDiscountCouponDetail(ID){
this.apipost("/api/Education/GetDiscountCouponDetail",{'ID':ID} , res => {
getDiscountCouponDetail(ID) {
this.apipost("/api/Education/GetDiscountCouponDetail", {
'ID': ID
}, res => {
if (res.data.resultCode == 1) {
this.msg = res.data.data
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.EndDate.replace("T", " "))
}
if(res.data.data.TotalNum!=-1){
this.checked=false
if (res.data.data.TotalNum != -1) {
this.checked = false
}
if(res.data.data.OnlyMember==0){
this.huiyuan=false
}else {
this.huiyuan=true
if (res.data.data.OnlyMember == 0) {
this.huiyuan = false
} else {
this.huiyuan = true
}
if(res.data.data.PickupCenter==0){
this.zhongxin=false
}else {
this.zhongxin=true
if (res.data.data.PickupCenter == 0) {
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
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){
if (res.data.data.UseType == 1) {
let ProductList = res.data.data.ProductList;
let newData = []
for(let i= 0;i<ProductList.length;i++){
for (let i = 0; i < ProductList.length; i++) {
this.checkedkeys.push(ProductList[i].ProductId)
for(let j=0;j<this.ProductCategoryTreeList.length;j++){
if(ProductList[i].ProductId == this.ProductCategoryTreeList[j].Id){
for (let j = 0; j < this.ProductCategoryTreeList.length; j++) {
if (ProductList[i].ProductId == this.ProductCategoryTreeList[j].Id) {
newData.push(this.ProductCategoryTreeList[j])
}
if(this.ProductCategoryTreeList[j].ChildList.length>0){
this.getReturn(ProductList[i],this.ProductCategoryTreeList[j].ChildList)
if (this.ProductCategoryTreeList[j].ChildList.length > 0) {
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;
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;
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])
}
......@@ -458,19 +432,19 @@
}
})
},
getReturn(ProductList,data){
for(let i=0;i<data.length;i++){
if(ProductList.ProductId == data[i].Id){
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)
if (data[i].ChildList.length > 0) {
this.getReturn(ProductList, data[i].ChildList)
}
}
},
getProductCategoryTreeList(){
this.apipost("/api/AppletGoods/GetProductCategoryTreeList",{}, res => {
getProductCategoryTreeList() {
this.apipost("/api/AppletGoods/GetProductCategoryTreeList", {}, res => {
if (res.data.resultCode == 1) {
this.ProductCategoryTreeList = res.data.data
......@@ -481,35 +455,35 @@
})
},
getProductGoodsPageList(type=2){
this.loading_t =true
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.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
}
if(type==1){
setTimeout(()=>{
if(this.$route.query.ID){
if (type == 1) {
setTimeout(() => {
if (this.$route.query.ID) {
this.getDiscountCouponDetail(this.$route.query.ID)
}
},10)
}, 10)
}
})
},
cancel(){
cancel() {
this.$router.go(-1)
},
......@@ -523,32 +497,32 @@
this.isIndeterminate = checkedCount > 0 && checkedCount < this.cities.length;
},
addtableData(data){
this.tableData[data.$index].disabled=true;
addtableData(data) {
this.tableData[data.$index].disabled = true;
this.commoditylist.push(data.row)
this.Success('添加成功');
},
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){
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;
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 {
} 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;
for (let z = 0; z < this.tableData.length; z++) {
if (this.tableData[z].Id == this.multipleSelection[i].Id) {
this.tableData[z].disabled = true;
break
}
......@@ -557,7 +531,7 @@
}
if(newdata.length>0){
if (newdata.length > 0) {
this.Success('添加成功');
}
this.commoditylist = this.unique(this.commoditylist.concat(newdata))
......@@ -566,7 +540,7 @@
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 ) {
if (arr[i].Id === arr[j].Id) {
arr.splice(j, 1);
j--; // 每删除一个数j的值就减1
len--; // j值减小时len也要相应减1(减少循环次数,节省性能)
......@@ -575,46 +549,46 @@
}
return arr;
},
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
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)
deletecommod(data, type) {
if (type == 1) {
this.commoditylist.splice(data, 1)
}else {
this.commoditylist.splice(data.$index,1)
} else {
this.commoditylist.splice(data.$index, 1)
}
},
handleSelectionChange(val) {
this.multipleSelection=val
this.multipleSelection = val
},
getUseType(val){
if(val ==1){
this.category=true;
this.$nextTick(() => {//在弹出dialog之前执行$nextTick回调函数,确保el-tree已经渲染
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
} else if (val == 2) {
this.checkedkeys = []
this.commodity = true
}
},
daterangeChange(e){
let _this =this
if(e==null){
daterangeChange(e) {
let _this = this
if (e == null) {
_this.msg.value = []
}else {
} else {
_this.$nextTick(() => {
_this.$set(_this.msg, "value", [e[0], e[1]]);
......@@ -624,14 +598,14 @@
},
getUseType2(){
this.checkedkeys=[]
getUseType2() {
this.checkedkeys = []
},
deleteProduct(item,index){
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)
deleteProduct(item, index) {
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)
}
}
},
......@@ -639,42 +613,46 @@
this.msg2.pageIndex = val;
this.getProductGoodsPageList();
},
TreeList(val,e){
TreeList(val, e) {
this.eData = e
},
preserve(formName){
preserve(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
if(this.msg.IndateType==2){
if(this.msg.value.length>0){
this.msg.StartDate=this.msg.value[0];
this.msg.EndDate=this.msg.value[1];
this.msg.IndateDay=0
}else {
if (this.msg.IndateType == 2) {
if (this.msg.value.length > 0) {
this.msg.StartDate = this.msg.value[0];
this.msg.EndDate = this.msg.value[1];
this.msg.IndateDay = 0
} else {
this.Error('课程卡有效期不能为空')
return false
}
}
if(this.msg.UseType==2){
let ProductList= []
for(let i = 0;i<this.commoditylist.length;i++){
ProductList.push({'ProductId':this.commoditylist[i].Id,})
if (this.msg.UseType == 2) {
let ProductList = []
for (let i = 0; i < this.commoditylist.length; i++) {
ProductList.push({
'ProductId': this.commoditylist[i].Id,
})
}
this.msg.ProductList =ProductList
}else if(this.msg.UseType==1){
let ProductList= []
for(let i = 0;i<this.AppointList.length;i++){
ProductList.push({'ProductId':this.AppointList[i].ProductId,})
this.msg.ProductList = ProductList
} else if (this.msg.UseType == 1) {
let ProductList = []
for (let i = 0; i < this.AppointList.length; i++) {
ProductList.push({
'ProductId': this.AppointList[i].ProductId,
})
}
this.msg.ProductList =ProductList
this.msg.ProductList = ProductList
}
this.loading= true
this.apipost("/api/Education/AddOrUpdateDiscountCoupon",this.msg , res => {
this.loading= false
this.loading = true
this.apipost("/api/Education/AddOrUpdateDiscountCoupon", this.msg, res => {
this.loading = false
if (res.data.resultCode == 1) {
this.Success(res.data.message);
this.$router.go(-1);//返回上一层
this.$router.go(-1); //返回上一层
} else {
this.Info(res.data.message);
......@@ -685,30 +663,33 @@
}
});
},
getProductList(){
getProductList() {
this.category = false;
let e = this.eData;
let ProductList = this.msg.ProductList;
ProductList=[]
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})
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
})
}
}
}
this.AppointList= ProductList
this.AppointList = ProductList
},
ChangeListName(val) {
this.SmallShopMsg.Name = val;
this.getSmallShopsDropDownList()
},
getSmallShopsDropDownList(){
this.apipost("/api/SmallShops/GetAllSmallShopsList",this.SmallShopMsg , res => {
this.loading= false
getSmallShopsDropDownList() {
this.apipost("/api/SmallShops/GetAllSmallShopsList", this.SmallShopMsg, res => {
this.loading = false
if (res.data.resultCode == 1) {
this.SmallShopData = res.data.data
} else {
......@@ -716,72 +697,84 @@
}
})
},
openChangeDig(){
this.changeState=true;
setTimeout(()=>{
openChangeDig() {
this.changeState = true;
setTimeout(() => {
this.$refs.mychild.InitData();
},10)
}, 10)
},
SelectId(msg){
this.changeState=false;
this.msg.CouponIco= this.getIconLink(msg.url);
SelectId(msg) {
this.changeState = false;
this.msg.CouponIco = this.getIconLink(msg.url);
},
},
mounted(){
mounted() {
}
}
</script>
<style >
<style>
.addCourseCard .form-box {
background: #fff;
padding: 20px 50% 20px 0;
margin-top: 10px;
}
.addCourseCard .el-input--small .el-input__inner{
.addCourseCard .el-input--small .el-input__inner {
height: 32px;
line-height: 32px;
}
.addCourseCard .img_yuan{
.addCourseCard .img_yuan {
width: 80px;
height: 80px;
margin-top: 5px;
position: relative;
}
.addCourseCard .img_yuan img{
.addCourseCard .img_yuan img {
width: 100%;
height: 100%;
}
.addCourseCard .el-date-editor .el-range__icon {
line-height: 24px;
}
.addCourseCard .el-date-editor .el-range-separator{
.addCourseCard .el-date-editor .el-range-separator {
line-height: 24px;
}
.addCourseCard .el-date-editor .el-range__close-icon{
.addCourseCard .el-date-editor .el-range__close-icon {
line-height: 24px;
}
.addCourseCard .el-form-item__label{
.addCourseCard .el-form-item__label {
padding: 0 20px 0 0;
}
.addCourseCard .form-body{
.addCourseCard .form-body {
background-color: #fff;
padding: 10px 50% 10px 20px;
min-width: 1000px;
}
.addCourseCard .splist{
.addCourseCard .splist {
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
.addCourseCard .app-image{
.addCourseCard .app-image {
width: 50px;
height: 50px;
border-radius: 0%;
background-position: center center;
}
</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>
<div class="navigation">
<template v-if="NavIconIsShowAdd">
<div class="ServiceManage">
<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>
</div>
......@@ -59,7 +58,7 @@
</el-table-column>
<el-table-column label="操作" width="120">
<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=""> -->
</template>
</el-table-column>
......@@ -68,114 +67,12 @@
:page-size="msg.pageSize" layout="prev, pager, next" :total="total">
</el-pagination>
</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>
</template>
<script>
import chooseMenu from "../common/chooseMenu.vue";
import ChooseImg from "@/components/global/ChooseImg.vue";
export default {
data() {
let validataNavIconImg = (rule, value, callback) => {
if (this.addMsg.NavIconImg == '') {
return callback(new Error('请选择导航图标'));
} else {
callback();
}
}
return {
//选择图片
choicImg: false,
//是否线下链接弹窗
isShowLink: false,
loading: false,
dataList: [],
msg: {
......@@ -185,62 +82,18 @@
ID:0, //编号
Telephone:'' //电话
},
addMsg:{
LableNameList:[], // 标签
StoreId:'', // 店铺id
Gender:'', //性别
ServiceType:'', //对应的类型
ProductList:[], //商品信息
ID:0, //编号
Name:'', //服务人员名称
ServiceLogo:'', //头像、
Major:'', //职务
ServiceStatus:1, // 启用/禁用 状态1启用 2禁用
Telephone:'', //电话
FictitiousReserveNum:'' //虚拟预约数
},
GoodsIds: [], //列表选中的商品编号
total: 0,
NavIconIsShowAdd: true,
addMsg: {
pageIndex: 1,
pageSize: 10,
},
genderList:[], //性别枚举
inputValue:'', //新增标签输入框值
inputVisible: false, //切换新增标签输入框
rules:{
}
checkedkeys:[],//默认选中的
};
},
components: {
chooseMenu,
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 = '';
},
//表格选中
tableSelect(val) {
this.GoodsIds = val;
console.log(val,'val');
},
//操作上下架
operateShelves(type){
......@@ -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(){
},
getUseType2(){
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
}
},
getMenu() {
//调用子组件方法
var obj = this.$refs.chooseMenu.getChooseMenu();
this.addMsg.NavIconUrl = obj.PageUrl;
this.isShowLink = false;
goUrl(row){
this.$router.push({
name: 'ServiceManageEdit',
query: {
ID:row.ID,
blank: "y"
}
});
},
handleCurrentChange(val) {
this.msg.pageIndex = val;
......@@ -324,103 +169,19 @@
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() {
this.getList();
this.getMale();
}
};
</script>
<style>
.navNavIconImg {
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 {
.ServiceManage .content {
background: #fff;
margin-top: 10px;
padding: 20px;
box-sizing: border-box;
}
</style>
......@@ -392,6 +392,12 @@ export default new Router({
name: 'ServiceMannage',
component: resolve => require(['@/components/offlineService/ServiceMannage'], resolve)
},
//线下 服务人员新增修改
{
path: '/ServiceManageEdit',
name: 'ServiceManageEdit',
component: resolve => require(['@/components/offlineService/ServiceManageEdit'], resolve)
},
//店铺管理 内容管理 门店管理
{
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