Commit 664c9429 by 李长胜

会员中心提交代码

1 parent 9e77a7ea
import { http } from '@/main'
// const defaultPath = 'scrm.api.live.'
const getCenterListApi = params => {
// params.method = `${defaultPath}goods.list`
params.method = `scrm.api.equity.card.merchant.record.get`
return http({
url: 'rop-scrm-equity/router',
method: 'POST',
data: params,
sign: true
})
}
const getMoreMerchant = params => {
// params.method = `${defaultPath}goods.list`
params.method = `scrm.api.equity.third.get`
return http({
url: 'rop-scrm-equity/router',
method: 'POST',
data: params,
sign: true
})
}
//获取上方卡片的相关信息
const getCardContent = params => {
params.method = `scrm.api.equity.card.get.by.merchant.id`
return http({
url: 'rop-scrm-equity/router',
method: 'POST',
data: params,
sign: true
})
}
const updateCardContent = params => {
params.method = `scrm.api.equity.card.class.update`
return http({
url: 'rop-scrm-equity/router',
method: 'POST',
data: params,
sign: true
})
}
export { getCenterListApi,getMoreMerchant ,updateCardContent,getCardContent}
\ No newline at end of file
import { http } from '@/main'
// const defaultPath = 'scrm.api.live.'
const getOrderListApi = params => {
// params.method = `${defaultPath}goods.list`
params.method = `scrm.api.equity.merchant.order.list.with.page`
return http({
url: 'rop-scrm-equity/router',
method: 'POST',
data: params,
sign: true
})
}
export { getOrderListApi }
\ No newline at end of file
import { http } from '@/main'
// const defaultPath = 'scrm.api.live.'
const getRecordListApi = params => {
// params.method = `${defaultPath}goods.list`
params.method = `scrm.api.coupon.verification.code.verification.list`
return http({
url: 'rop-scrm-coupon/router',
method: 'POST',
data: params,
sign: true
})
}
// const auditGoodApi = params => {
// params.method = `${defaultPath}audit.goods`
// return http({
// url: 'rop-scrm-live/router',
// method: 'POST',
// data: params,
// sign: true,
// returnAll: true
// })
// }
// const getGoodInfoApi = params => {
// params.method = `${defaultPath}get.good.by.id`
// return http({
// url: 'rop-scrm-live/router',
// method: 'POST',
// data: params,
// sign: true
// })
// }
// const getGoodGroupInfoApi = params => {
// params.method = `${defaultPath}get.good.group.by.id`
// return http({
// url: 'rop-scrm-live/router',
// method: 'POST',
// data: params,
// sign: true
// })
// }
// const insertGoodApi = params => {
// params.method = `${defaultPath}insert.good`
// return http({
// url: 'rop-scrm-live/router',
// method: 'POST',
// data: params,
// sign: true,
// returnAll: true
// })
// }
// const insertGoodGroupApi = params => {
// params.method = `${defaultPath}insert.good.group`
// return http({
// url: 'rop-scrm-live/router',
// method: 'POST',
// data: params,
// sign: true,
// returnAll: true
// })
// }
// const deleteGoodApi = params => {
// params.method = `${defaultPath}delete.goods`
// return http({
// url: 'rop-scrm-live/router',
// method: 'POST',
// data: params,
// sign: true,
// returnAll: true
// })
// }
export { getRecordListApi }
import { http } from '@/main'
// const defaultPath = 'scrm.api.live.'
const getServiceListApi = params => {
params.method = `scrm.api.coupon.list.merchant`
return http({
url: 'rop-scrm-coupon/router',
method: 'POST',
data: params,
sign: true
})
}
//生效、生效
const effectiveService = params => {
params.method = `scrm.api.coupon.effective`
return http({
url: 'rop-scrm-coupon/router',
method: 'POST',
data: params,
sign: true,
returnAll:true
})
}
//删除
const deleteService = params => {
params.method = `scrm.api.coupon.delete`
return http({
url: 'rop-scrm-coupon/router',
method: 'POST',
data: params,
sign: true,
returnAll:true
})
}
//删除
const createService = params => {
params.method = `scrm.api.coupon.create`
return http({
url: 'rop-scrm-coupon/router',
method: 'POST',
data: params,
sign: true,
returnAll:true
})
}
//编辑、查看
const detailService = params => {
params.method = `scrm.api.coupon.detail`
return http({
url: 'rop-scrm-coupon/router',
method: 'POST',
data: params,
sign: true,
})
}
//修改
const updateService = params => {
params.method = `scrm.api.coupon.update`
return http({
url: 'rop-scrm-coupon/router',
method: 'POST',
data: params,
sign: true,
returnAll:true
})
}
export { getServiceListApi,effectiveService, deleteService,createService,detailService,updateService}
\ No newline at end of file
import { http } from '@/main'
// const defaultPath = 'scrm.api.live.'
const getSetMealListApi = params => {
// params.method = `${defaultPath}goods.list`
params.method = `scrm.api.equity.package.info.list.with.page`
return http({
url: 'rop-scrm-equity/router',
method: 'POST',
data: params,
sign: true
})
}
const deleteSetMeal = params => {
params.method = `scrm.api.equity.package.info.delete`
return http({
url: 'rop-scrm-equity/router',
method: 'POST',
data: params,
sign: true,
returnAll:true
})
}
const getSetmealService = params=>{
params.method = `scrm.api.coupon.list.merchant`
return http({
url: 'rop-scrm-coupon/router',
method: 'POST',
data: params,
sign: true
})
}
//获取编辑详情的接口
const getServiceInfo = params=>{
params.method = `scrm.api.equity.package.info.select`
return http({
url: 'rop-scrm-equity/router',
method: 'POST',
data: params,
sign: true,
returnAll:true
})
}
//创建套餐的接口
const createSetMeal = params => {
params.method = `scrm.api.equity.package.info.insert`
return http({
url: 'rop-scrm-equity/router',
method: 'POST',
data: params,
sign: true,
returnAll:true
})
}
const updateSetMeal = params => {
params.method = `scrm.api.equity.package.info.update`
return http({
url: 'rop-scrm-equity/router',
method: 'POST',
data: params,
sign: true,
returnAll:true
})
}
//不知道啥作用,老接口有调
const configSetMeal = params => {
params.method = `scrm.api.equity.package.service.config`
return http({
url: 'rop-scrm-equity/router',
method: 'POST',
data: params,
sign: true,
returnAll:true
})
}
//上下架
const upDownPackage = params => {
params.method = `scrm.api.equity.package.info.shelves`
return http({
url: 'rop-scrm-equity/router',
method: 'POST',
data: params,
sign: true,
returnAll:true
})
}
export { getSetMealListApi,deleteSetMeal,getSetmealService,getServiceInfo,createSetMeal,upDownPackage,updateSetMeal,configSetMeal }
\ No newline at end of file
......@@ -75,4 +75,98 @@ const auditStatusList = [{
}
]
export { limitPrice, liveStatusList, auditStatusList }
\ No newline at end of file
//会员中心得状态list
const statusList=[
// {
// confId: '',
// confName: '全部'
// },
{
confId: 1,
confName: '生效中'
},
{
confId: 2,
confName: '已失效'
}
]
//会员订单类型字典
const orderTypesList=[
{
confId: 1,
confName: '套餐'
},
{
confId: 2,
confName: '会员卡'
}
]
const orderStatusList=[
// 2: '待收货',
// 3: '已完成',
// 4: '售后中',
// 5: '退款失败',
// 6: '已经退款',
{
confId: 2,
confName: '待收货'
},
{
confId: 3,
confName: '已完成'
},
{
confId: 4,
confName: '售后中'
},
{
confId: 5,
confName: '退款失败'
},
{
confId: 2,
confName: '已经退款'
},
]
const serviceStatusList=[
{
confId: 1,
confName: '未生效'
},
{
confId: 2,
confName: '生效中'
},
{
confId: 3,
confName: '已失效'
}
]
const memberTypeList=[
{
confId: 1,
confName: '正式会员'
},
{
confId: 2,
confName: '试用会员'
}
]
const stateList=[
{
confId: 0,
confName: '待上架'
},
{
confId: 1,
confName: '在售中'
},
{
confId: 2,
confName: '已下架'
},
]
export { limitPrice, liveStatusList, auditStatusList,statusList ,serviceStatusList,
memberTypeList,stateList,orderTypesList,orderStatusList}
\ No newline at end of file
......@@ -11,8 +11,8 @@
<slot></slot>
<div slot="footer">
<slot name="btn-start"></slot>
<el-button type="primary" :size="btnSize" @click="handleConfirm">{{ btnOkLabel }}</el-button>
<el-button v-if="!noCancel" :size="btnSize" @click="handleClose">取消</el-button>
<el-button type="primary" v-if="!noBtnOk" :size="btnSize" @click="handleConfirm">{{ btnOkLabel }}</el-button>
<el-button v-if="!noCancel" :size="btnSize" @click="handleClose">{{btnCanelLabel}}</el-button>
<slot name="btn-middle"></slot>
</div>
</el-dialog>
......@@ -42,6 +42,14 @@ export default {
type: String,
default: '确定'
},
btnCancelLabel: {
type: String,
default: '取消'
},
noBtnOk: {
type: Boolean,
default: false
},
noCancel: {
type: Boolean,
default: false
......
<template>
<div>
<div class="initPanel" :style="{ width: panelWidth, minHeight: panelMinHeight }">
{{ panelContent }}
<img src="@/assets/Shape.png" alt="" />
<i class="el-icon-close" @click="closeInitPanel"></i>
</div>
</div>
</template>
<script>
export default {
props: {
panelWidth: {
type: String,
default: ''
},
panelMinHeight: {
type: String,
default: '20px'
},
panelContent: {
type: String,
default: '请传入面板内容'
}
},
data() {
return {}
},
methods: {
closeInitPanel() {
this.$emit('closePanel')
}
}
}
</script>
<style lang="scss" scoped>
.initPanel {
margin-left: 40px;
position: relative;
margin-top: 20px;
box-sizing: border-box;
background: #e6e9ff;
border: 1px solid #5850ff;
border-radius: 4px;
padding: 10px 38px;
font-size: 14px;
font-weight: 400;
color: rgba(0, 0, 0, 0.65);
line-height: 20px;
img {
position: absolute;
left: 16px;
top: 13px;
}
i {
position: absolute;
top: 14px;
right: 18px;
width: 9px;
height: 9px;
cursor: pointer;
}
}
</style>
......@@ -135,6 +135,60 @@ const staticRoutes = Object.freeze([
path: '/customerTransform/detaiCustomeGroup',
component: resolve => require([`@/views/customerTransform/detaiCustomeGroup.vue`], resolve),
meta: {}
}
},
{
name: 'memberCenter',
path: '/memberCenter/index',
component: resolve => require([`@/views/memberCenter/index.vue`], resolve),
meta: {}
},
{
name: 'center',
path: '/memberCenter/center',
component: resolve => require([`@/views/memberCenter/center.vue`], resolve),
meta: {}
},
{
name: 'service',
path: '/memberCenter/service',
component: resolve => require([`@/views/memberCenter/service.vue`], resolve),
meta: {}
},
{
name: 'serviceAddUpdateLook',
path: '/memberCenter/serviceAddUpdateLook',
component: resolve => require([`@/views/memberCenter/serviceAddUpdateLook.vue`], resolve),
meta: {}
},
{
name: 'setmeal',
path: '/memberCenter/setmeal',
component: resolve => require([`@/views/memberCenter/setmeal.vue`], resolve),
meta: {}
},
{
name: 'setmealAddUpdate',
path: '/memberCenter/setmealAddUpdate',
component: resolve => require([`@/views/memberCenter/setmealAddUpdate.vue`], resolve),
meta: {}
},
{
name: 'order',
path: '/memberCenter/order',
component: resolve => require([`@/views/memberCenter/order.vue`], resolve),
meta: {}
},
{
name: 'orderDetail',
path: '/memberCenter/orderDetail',
component: resolve => require([`@/views/memberCenter/orderDetail.vue`], resolve),
meta: {}
},
{
name: 'record',
path: '/memberCenter/record',
component: resolve => require([`@/views/memberCenter/record.vue`], resolve),
meta: {}
},
])
export default staticRoutes
export function dateFormat (dateTime, format = 'YYYY-MM-DD HH:mm') {
const date = new Date(dateTime)
const config = {
YYYY: date.getFullYear(),
MM: date.getMonth() + 1, //getMonth() 方法根据本地时间返回指定日期的月份(从 0 到 11)
DD: date.getDate(),
HH: date.getHours(),
mm: date.getMinutes(),
ss: date.getSeconds()
}
for (const key in config) {
format = format.replace(key, config[key])
}
return format
}
\ No newline at end of file
<template>
<div class="live-room">
<div class="memberCardWrap">
<div class="cardBoxWrap">
<img src="@/assets/memberCard.png" alt="" />
<div class="masonry">
<img src="@/assets/masonry.png" alt="" />
</div>
<div class="memberCardName">{{ ruleForm.cardName }}</div>
</div>
<div class="cardDetail" v-if="!isShowEditWrap">
<p>{{ ruleForm.cardName }}</p>
<img src="@/assets/edit.png" class="editIcon" @click="isShowEditWrap = true" alt="" />
<div>
<span>售价:</span>
<span class="price" v-if="ruleForm.price">¥{{ ruleForm.price }}</span>
</div>
<div>
<span>市场价:</span>
<span class="price" v-if="ruleForm.marketPrice">¥{{ ruleForm.marketPrice }}</span>
</div>
<div>
<span>
会员权益使用地址:
</span>
<span class="address">{{ ruleForm.linkUrl }}</span>
</div>
<el-button class="seeEquity" size="small" type="primary" @click="openDialog">查看权益</el-button>
</div>
<div class="cardDetail editForm" v-else>
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="90px" class="demo-ruleForm" style="width:500px">
<el-form-item label="会员卡名" prop="cardName" size="small">
<el-input v-model="ruleForm.cardName" size="small" placeholder="请输入会员卡名" maxlength="10"></el-input>
</el-form-item>
<el-form-item label="售价" size="small" prop="price" style="width:300px">
<el-input v-model="ruleForm.price" size="small" placeholder="请输入合理价格" @keyup.native="ruleForm.price = oninput(ruleForm.price)">
<template slot="append">元</template>
</el-input>
</el-form-item>
<el-form-item label="市场价" prop="marketPrice" size="small" style="width:300px">
<!-- :onkeyup="(ruleForm.marketPrice = ruleForm.marketPrice.replace(/[^\-\d.]/g, ''))" -->
<el-input v-model="ruleForm.marketPrice" size="small" placeholder="请输入合理价格" @keyup.native="ruleForm.marketPrice = oninput(ruleForm.marketPrice)">
<template slot="append">元</template>
</el-input>
</el-form-item>
</el-form>
<el-button size="small" class="cancelBtn" @click="isShowEditWrap = false">取消</el-button>
<el-button size="small" class="saveBtn" type="primary" @click="submitRuleForm('ruleForm')">保存</el-button>
</div>
</div>
<p class="pageTitle">会员中心</p>
<div class="live-room container">
<el-form :inline="true" style="width:100%" :model="searchForm" label-width="100px" label-position="right">
<el-row>
<el-form-item size="small" label="会员用户">
<el-input :size="size" v-model="searchForm.userInfo" placeholder="请输入会员用户或手机号" clearable></el-input>
</el-form-item>
<el-form-item size="small" label="门店">
<el-input :size="size" v-model="searchForm.merchantName" placeholder="请输入门店" clearable></el-input>
</el-form-item>
<el-form-item size="small" label="状态">
<el-select size="small" v-model="searchForm.status" placeholder="请选择">
<el-option v-for="item in memberCenterStatus" :key="item.dictValue" :label="item.dictLabel" :value="item.dictValue"></el-option>
</el-select>
</el-form-item>
</el-row>
<el-row>
<el-form-item size="small" label="开通日期">
<el-date-picker :size="size" v-model="searchForm.daterange" type="daterange" value-format="yyyy-MM-dd" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="pickerOptions || {}"></el-date-picker>
</el-form-item>
<el-form-item size="small" style="float:right">
<el-button :size="size" type="primary" @click="handleSearch">查询</el-button>
<el-button :size="size" @click="handleReset">重置</el-button>
</el-form-item>
</el-row>
</el-form>
<GLTable ref="memberCenterRef" :searchForm="searchFormTable" :tableParams="tableParams" :getListApi="getListApi" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn"></GLTable>
</div>
<glsx-dialog title="权益详情" width="712px" :noBtnOk="true" btnCancelLabel="关闭" btnSize="small" :isVisible="isDialogVisible" :showClose="false" @closeDialog="handleClose" @confirmDialog="handleClose">
<el-scrollbar>
<div class="modal-body">
<div class="equity-name">汽车权益</div>
<div class="equity-panel">
<div class="equity-item" v-for="(item, index) in merchantData.carServiceList" :key="index">
<div class="equity-item-icon"><img :src="item.equityIcon" /></div>
<div class="equity-item-name">{{ item.equityName }}</div>
<div class="equity-item-desc">{{ item.equityDesc }}</div>
</div>
</div>
<div v-for="(item, index) in merchantData.goodsServiceList" :key="index">
<div class="equity-name">{{ item.goodsCategory }}</div>
<div class="equity-panel">
<div class="equity-item" v-for="(v, xindex) in item.equityGoodsGroupDescDtos" :key="xindex">
<div class="equity-item-icon"><img :src="v.equityIcon" /></div>
<div class="equity-item-name">{{ v.equityName }}</div>
<div class="equity-item-desc">{{ v.equityDesc }}</div>
</div>
</div>
</div>
</div>
</el-scrollbar>
</glsx-dialog>
</div>
</template>
<script>
import glsxDialog from '@/components/glsx-dialog'
import { getCenterListApi, getMoreMerchant, getCardContent, updateCardContent } from '@/api/modules/center'
import { statusList, memberTypeList } from '@/common/constant'
export default {
components: {
glsxDialog
},
data() {
var checkPrice = (rule, value, callback) => {
// if (!value) {
// return callback(new Error('价格不能为空'))
// }
// setTimeout(() => {
// if (!Number.isInteger(value)) {
// callback(new Error('请输入数字值'))
// } else {
// if (value < 0) {
// callback(new Error('不能是负数'))
// } else {
// callback()
// }
// }
// }, 1000)
}
return {
pickerOptions: {
disabledDate(time) {
return time.getTime() > Date.now() || time.getTime() < new Date('2017-12-31').getTime()
}
},
size: 'small',
getListApi: getCenterListApi,
searchForm: {
userInfo: '',
status: '',
merchantName: ''
},
searchFormTable: {},
memberCenterStatus: [
{
dictValue: '',
dictLabel: '全部'
},
{
dictValue: 1,
dictLabel: '生效中'
},
{
dictValue: 2,
dictLabel: '已失效'
}
],
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
// 表格参数
tableParams: {
listName: 'list',
tableOption: false,
tableColumns: [
{
label: '会员用户',
prop: 'accountName',
width: '180'
// formatter: cellValue => {
// return cellValue.startTime + '-' + cellValue.endTime
// }
},
{
label: '会员类型',
prop: 'memberType',
line: 1,
formatter: cellValue => {
return this.baseDataList.memberTypeList.find(item => item.confId == cellValue.memberType).confName
}
},
{
label: '开通门店',
prop: 'merchantName'
},
{
label: '开通方式',
prop: 'activeTypeDesc',
line: 1
},
{
label: '开通日期',
prop: 'activeTime',
line: 1
// addHtml: 'activeTime'
},
{
label: '状态',
prop: 'status',
width: '80',
formatter: cellValue => {
return this.baseDataList.statusList.find(item => item.confId == cellValue.status).confName
}
}
]
},
baseDataList: {
statusList: statusList,
memberTypeList: memberTypeList
},
isShowEditWrap: false,
ruleForm: {
equityId: '',
cardName: '',
price: '',
marketPrice: '',
linkUrl: ''
},
rules: {
cardName: [
{ required: true, message: '请输入会员卡名称', trigger: 'blur' },
{ min: 3, max: 20, message: '长度在 3 到 20 个字符', trigger: 'blur' }
],
price: [
{ required: true, message: '请输入价格', trigger: 'blur' }
// { validator: checkPrice, trigger: 'blur' }
]
// marketPrice: [{ validator: checkPrice, trigger: 'blur' }]
},
//权益 - 弹窗
isDialogVisible: false,
merchantData: {},
merchantId: 44184606 //记得改
}
},
created() {
if (window.__POWERED_BY_QIANKUN__) {
//运行在qiankun容器中
this.merchantId = this.$globalState.session.merchantId
}
this.getCardContentFun()
},
methods: {
oninput(value) {
let str = value
let len1 = str.substr(0, 1)
let len2 = str.substr(1, 1) //如果第一位是0,第二位不是点,就用数字把点替换掉
if (str.length > 1 && len1 == 0 && len2 != '.') {
str = str.substr(1, 1)
} //第一位不能是.
if (len1 == '.') {
str = ''
}
if (len1 == '+') {
str = ''
}
if (len1 == '-') {
str = ''
} //限制只能输入一个小数点
if (str.indexOf('.') != -1) {
let str_ = str.substr(str.indexOf('.') + 1)
if (str_.indexOf('.') != -1) {
str = str.substr(0, str.indexOf('.') + str_.indexOf('.') + 1)
}
}
//正则替换
// (/[^\-\d.]/g, ''))"
str = str.replace(/[^\d.^]+/g, '') // 保留数字和小数点
str = str.replace(/^\D*([0-9]\d*\.?\d{0,2})?.*$/, '$1') // 小数点后只能输 2 位
return str
},
getCardContentFun() {
getCardContent({ merchantId: this.merchantId }).then(res => {
this.ruleForm.cardName = res[0].cardClassName
this.ruleForm.price = res[0].price
this.ruleForm.marketPrice = res[0].marketPrice
this.ruleForm.linkUrl = res[0].url
this.ruleForm.equityId = res[0].id
})
},
submitRuleForm(formName) {
this.$refs[formName].validate(valid => {
if (!valid) {
return
}
this.isShowEditWrap = false
let params = {}
params.id = this.ruleForm.equityId
params.cardClassName = this.ruleForm.cardName
params.price = this.ruleForm.price
params.marketPrice = this.ruleForm.marketPrice
updateCardContent(params).then(res => {
if (!res) {
return
}
this.$message.success('修改成功')
this.getCardContentFun()
})
})
},
beforeSearchFn() {
return new Promise((resolve, reject) => {
this.searchFormTable = JSON.parse(JSON.stringify(this.searchForm))
if (this.searchFormTable.daterange) {
this.searchFormTable.startTime = this.searchForm.daterange[0] + ' 00:00:00'
this.searchFormTable.endTime = this.searchForm.daterange[1] + ' 23:59:59'
} else {
if (this.searchFormTable.beginTime) delete this.searchFormTable.beginTime && delete this.searchFormTable.endTime
}
delete this.searchFormTable.daterange
resolve()
})
},
handleReset() {
// this.searchForm = {
// name: '',
// status: '-1'
// }
this.searchForm = {}
this.handleSearch()
},
handleSearch() {
this.$refs.memberCenterRef.refreshTable()
},
handleClose() {
this.isDialogVisible = !this.isDialogVisible
},
openDialog() {
this.isDialogVisible = !this.isDialogVisible
getMoreMerchant({})
.then(res => {
this.merchantData = res
})
.catch(err => {
console.error('错误信息:', err)
})
}
}
}
</script>
<style lang="scss" scoped>
.memberCardWrap {
display: flex;
background-color: #fff;
height: 173px;
box-sizing: border-box;
margin: 20px 40px;
padding: 15px 20px;
box-shadow: 0 1px 5px 0 rgba(38, 38, 38, 0.1);
.cardBoxWrap {
position: relative;
.masonry {
position: absolute;
top: 40px;
left: 40px;
}
.memberCardName {
position: absolute;
font-size: 17px;
color: #8e5310;
font-weight: 700;
top: 50px;
left: 95px;
}
}
.cardDetail {
height: 129px;
width: calc(100% - 350px);
padding-top: 8px;
margin-left: 10px;
position: relative;
.seeEquity {
position: absolute;
right: 0;
bottom: 10px;
}
.cancelBtn {
position: absolute;
right: 100px;
bottom: 0;
padding: 8px 30px;
}
.saveBtn {
position: absolute;
right: 0;
bottom: 0;
padding: 8px 30px;
}
.editIcon {
margin-left: 10px;
vertical-align: middle;
cursor: pointer;
}
> p {
display: inline-block;
font-weight: 600;
color: #333333;
font-size: 16px;
margin: 0;
}
> div {
margin-top: 15px;
font-weight: 400;
font-size: 14px;
span:first-child {
color: #333;
}
.price {
color: #eb4e4e;
}
.address {
color: #989898;
}
}
}
.editForm {
padding-top: 0px;
}
}
.pageTitle {
position: relative;
padding: 0 40px;
height: 20px;
font-size: 20px;
font-weight: 700;
color: #333333;
line-height: 20px;
letter-spacing: 1px;
}
.el-form-item {
margin-bottom: 15px;
}
.el-range-editor.is-active,
.el-range-editor.is-active:hover {
border-color: #5850ff;
width: 215px;
}
.el-range-editor--small.el-input__inner {
width: 215px;
}
/deep/ .el-dialog__header .el-dialog__title {
font-size: 16px;
color: #000;
font-weight: 700;
height: 24px;
line-height: 24px;
}
// ::v-deep .el-dialog__body {
// border-top: 1px solid #e6e6e6;
// border-bottom: 1px solid #e6e6e6;
// padding: 20px 25px;
// }
/deep/.el-dialog__body {
border-top: 1px solid #e6e6e6;
border-bottom: 1px solid #e6e6e6;
padding: 20px 45px;
.modal-body {
// overflow: auto;
max-height: 400px;
}
.equity-panel {
display: grid;
grid-template-columns: repeat(5, 1fr);
}
.equity-item {
display: flex;
flex-direction: column;
align-items: center;
color: #999;
margin-bottom: 15px;
}
.equity-name {
font-size: 15px;
font-weight: 700;
margin: 12px 0px;
color: #000;
height: 24px;
line-height: 24px;
}
.equity-item-icon {
width: 46px;
height: 46px;
margin-bottom: 10px;
}
.equity-item-icon img {
width: 46px;
height: 46px;
border-radius: 50%;
}
.equity-item-name {
font-size: 14px;
width: 80px;
text-align: center;
color: #282829;
font-weight: 400;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
margin-bottom: 10px;
}
.equity-item-desc {
font-size: 12px;
width: 80px;
text-align: center;
color: #fc5b32;
font-weight: 400;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
}
/deep/ .el-dialog__footer {
text-align: center;
}
</style>
<!-- 会员中心主页 -->
<template>
<div class="live-room">
<div class="container live-room">
<!-- <div class="titles">
<div v-for="(item, index) in titles" :key="index" class="tabItem" :class="{ activeTab: currentIndex === index }" @click="tabClick(index)">{{ item }}</div>
</div>
<template v-if="currentIndex == 0">
<Center></Center>
</template>
<template v-if="currentIndex == 1">
<Service></Service>
</template>
<template v-if="currentIndex == 2">
<SetMeal></SetMeal>
</template>
<template v-if="currentIndex == 3">
<Order></Order>
</template>
<template v-if="currentIndex == 4">
<Record></Record>
</template> -->
</div>
</div>
</template>
<script>
// import glsxDialog from '@/components/glsx-dialog'
// import Center from '@/views/memberCenter/childs/center'
// import Service from '@/views/memberCenter/childs/service'
// import SetMeal from '@/views/memberCenter/childs/setMeal'
// import Order from '@/views/memberCenter/childs/order'
// import Record from '@/views/memberCenter/childs/record'
export default {
name: 'memberCenter',
// components: {
// Record,
// Center,
// Service,
// SetMeal,
// Order
// },
data() {
return {
currentIndex: 0,
titles: ['会员中心', '会员服务', '会员套餐', '订单', '核销记录']
}
},
// components: {
// glsxDialog,
// glsxTable
// },
created() {
this.$router.push('/memberCenter/center')
},
mounted() {},
methods: {
tabClick(index) {
this.currentIndex = index
}
}
}
</script>
<style>
.live-room .titles {
display: flex;
justify-content: space-around;
/* align-items: center; */
width: 500px;
}
.live-room .tabItem {
font-size: 14px;
padding-bottom: 6px;
color: #717171;
cursor: pointer;
}
.live-room .activeTab {
color: #5850ff;
border-bottom: 2px solid #5850ff;
/* background-color: #fff; */
}
</style>
<template>
<div class="live-room">
<div class="live-room container">
<div class="flex">
<el-form :inline="true" style="width:100%" :model="searchForm" label-width="100px" label-position="right">
<el-row>
<el-form-item size="small" label="订单编号">
<el-input :size="size" v-model="searchForm.orderCode" placeholder="请输入订单编号" clearable></el-input>
</el-form-item>
<el-form-item size="small" label="名称">
<el-input :size="size" v-model="searchForm.packageName" placeholder="请输入名称" clearable></el-input>
</el-form-item>
<el-form-item size="small" label="类型">
<el-select size="small" v-model="searchForm.orderType" placeholder="请选择">
<el-option v-for="item in orderTypeList" :key="item.dictValue" :label="item.dictLabel" :value="item.dictValue"></el-option>
</el-select>
</el-form-item>
</el-row>
<el-row>
<el-form-item size="small" label="用户信息">
<el-input :size="size" v-model="searchForm.userInfo" placeholder="请输入用户名或手机号" clearable></el-input>
</el-form-item>
<el-form-item size="small" label="下单时间">
<el-date-picker :size="size" v-model="searchForm.daterange" type="daterange" value-format="yyyy-MM-dd" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="pickerOptions || {}"></el-date-picker>
</el-form-item>
<el-form-item size="small" style="float:right">
<el-button :size="size" type="primary" @click="handleSearch">查询</el-button>
<el-button :size="size" @click="handleReset">重置</el-button>
</el-form-item>
</el-row>
</el-form>
</div>
<GLTable ref="memberOrderRef" :searchForm="searchFormTable" :tableParams="tableParams" :getListApi="getListApi" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn">
<!-- <span slot="shareImgUrl" slot-scope="scope">
<img class="img-60" :src="scope.scope.shareImgUrl" />
</span> -->
<span class="table-btns" slot="auth-button" slot-scope="scope" :data="scope.scope">
<el-button type="text" @click="handleDetail(scope.scope)">详情</el-button>
</span>
</GLTable>
</div>
</div>
</template>
<script>
import { orderTypesList, orderStatusList } from '@/common/constant'
import { getOrderListApi } from '@/api/modules/order'
export default {
data() {
return {
pickerOptions: {
disabledDate(time) {
return time.getTime() > Date.now() || time.getTime() < new Date('2017-12-31').getTime()
}
},
size: 'small',
searchForm: {
// name: '',
// daterange:''
// orderType: ''
},
searchFormTable: {},
orderTypeList: [
{
dictValue: '',
dictLabel: '全部'
},
{
dictValue: 1,
dictLabel: '套餐'
},
{
dictValue: 2,
dictLabel: '会员卡'
}
],
// 表格组件
getListApi: getOrderListApi,
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
// 表格参数
tableParams: {
listName: 'list',
tableOption: true,
tableColumns: [
{
label: '名称',
prop: 'packageName',
width: '180'
// formatter: cellValue => {
// return cellValue.startTime + '-' + cellValue.endTime
// }
},
{
label: '类型',
prop: 'orderType',
formatter: cellValue => {
return this.baseDataList.orderTypesList.find(item => item.confId == cellValue.orderType).confName
}
},
{
label: '价格',
prop: 'originalPrice'
},
{
label: '实收金额',
prop: 'realPayPrice',
line: 1
},
{
label: '订单状态',
prop: 'orderStatus',
width: '80',
formatter: cellValue => {
return this.baseDataList.orderStatusList.find(item => item.confId == cellValue.orderStatus).confName
}
},
{
label: '下单时间',
prop: 'createDate',
line: 1
},
{
label: '用户信息',
prop: 'accountName',
line: 1
},
{
label: '订单号',
prop: 'orderCode',
line: 1
}
]
},
baseDataList: {
orderTypesList: orderTypesList,
orderStatusList: orderStatusList
}
}
},
methods: {
beforeSearchFn() {
return new Promise((resolve, reject) => {
this.searchFormTable = JSON.parse(JSON.stringify(this.searchForm))
if (this.searchFormTable.daterange) {
this.searchFormTable.startTime = this.searchForm.daterange[0] + ' 00:00:00'
this.searchFormTable.endTime = this.searchForm.daterange[1] + ' 23:59:59'
} else {
if (this.searchFormTable.beginTime) delete this.searchFormTable.beginTime && delete this.searchFormTable.endTime
}
delete this.searchFormTable.daterange
resolve()
})
},
handleDetail(row) {
this.$router.push({
path: '/memberCenter/orderDetail',
query: {
id: row.id,
detail: row
}
})
},
handleSearch() {
this.$refs.memberOrderRef.refreshTable()
},
handleReset() {
this.searchForm = {}
this.handleSearch()
}
}
}
</script>
<style lang="scss" scoped>
.el-range-editor.is-active,
.el-range-editor.is-active:hover {
border-color: #5850ff;
width: 215px;
}
.el-range-editor--small.el-input__inner {
width: 215px;
}
</style>
<template>
<div class="live-room">
<div class="live-room container">
<div class="topMsg">
<div class="orderNo">订单编号:{{ detail.orderCode }}</div>
<div class="orderTime">下单时间:{{ detail.createDate }}</div>
<el-button type="primary" size="small" class="backBtn" @click="goBack">
返回
</el-button>
</div>
<div class="midMsgWrap">
<div class="midMsgTitle">
<span>支付信息</span>
<span>用户信息</span>
<span>服务名称</span>
<span>已核/总次数</span>
</div>
<div class="midMsgContent">
<div class="item">
<div>付款状态:已付款</div>
<div>付款金额:{{ detail.realPayPrice }}元</div>
<div>付款方式:微信支付</div>
<div>付款时间:{{ detail.createDate }}</div>
</div>
<div class="item">
<div class="userName">用户名称:{{ detail.accountName }}</div>
<div class="phoneNumber">用户手机号:{{ detail.mobile }}</div>
</div>
<div class="item">
<div v-for="(item, index) in detail.list" :key="index">{{ item.serviceName }}</div>
</div>
<div class="item">
<!-- <div>8/12次</div>
<div>0/1次</div>
<div>0/3次</div> -->
<div v-for="(item, index) in detail.list" :key="index">{{ item.serviceAmount }}/{{ item.serviceCount }}次</div>
</div>
</div>
</div>
<div id="tableWrap">
<el-table :data="tableData" style="width: 100%" :header-cell-style="{ height: '54px', background: '#F4F6FC', color: '#333333', fontSize: '14px' }">
<el-table-column label="商品名称" align="center">
<template slot-scope="scope">
<div v-for="(item, index) in scope.row.couponList" :key="index">{{ item.couponName }}</div>
</template>
</el-table-column>
<el-table-column label="类型" align="center">
<template slot-scope="scope">
<span>{{ scope.row.orderType == 1 ? '套餐' : '权益卡' }}</span>
</template>
</el-table-column>
<el-table-column label="有效期" align="center" v-if="detail.orderType == 2">
<template slot-scope="scope">
<span>{{ scope.row.effectiveNum == '-1' ? '无限制' : scope.row.effectiveNum + '天' }}</span>
</template>
</el-table-column>
<el-table-column prop="originalPrice" label="单价/元" align="center"></el-table-column>
<el-table-column prop="amount" label="数量" align="center"></el-table-column>
<el-table-column prop="totalPrice" label="小计/元" align="center"></el-table-column>
<el-table-column prop="realPayPrice" label="实收金额" align="center">
<template slot-scope="scope">
<span style="color:#EB4E4E">{{ scope.row.realPayPrice }}</span>
</template>
</el-table-column>
<el-table-column prop="orderStatus" label="状态" align="center">
<template slot-scope="scope">
<span>{{ scope.row.orderStatus == 2 ? '待收货' : scope.row.orderStatus == 3 ? '已完成' : scope.row.orderStatus == 4 ? '售后中' : scope.row.orderStatus == 2 ? '退款失败' : scope.row.orderStatus == 2 ? '已退款' : '' }}</span>
</template>
</el-table-column>
</el-table>
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
tableData: [{}],
detail: this.$route.query.detail
}
},
created() {
this.setTableData()
},
mounted() {
this.$nextTick(() => {
let clientHeight = document.documentElement.clientHeight
let offsettop = document.getElementById('tableWrap').offsetTop
document.getElementById('tableWrap').style.minHeight = clientHeight - offsettop - 120 + 'px'
})
},
methods: {
setTableData() {
this.$set(this.tableData[0], 'couponList', this.detail.couponList)
this.$set(this.tableData[0], 'orderType', this.detail.orderType)
this.$set(this.tableData[0], 'effectiveNum', this.detail.effectiveNum)
this.$set(this.tableData[0], 'originalPrice', this.detail.originalPrice)
this.$set(this.tableData[0], 'amount', 1)
this.$set(this.tableData[0], 'totalPrice', this.detail.originalPrice)
this.$set(this.tableData[0], 'realPayPrice', this.detail.realPayPrice)
this.$set(this.tableData[0], 'orderStatus', this.detail.orderStatus)
console.log(this.tableData[0], '表格数据')
},
goBack() {
console.log(this.detail, 'gggg')
this.$router.go(-1)
}
}
}
</script>
<style lang="scss" scoped>
.container {
padding-top: 0px;
.topMsg {
display: flex;
height: 56px;
align-items: center;
position: relative;
.orderNo,
.orderTime {
font-size: 14px;
font-weight: 400;
color: #333333;
}
.orderNo {
position: absolute;
left: 50px;
}
.orderTime {
position: absolute;
left: 350px;
}
.backBtn {
position: absolute;
right: 0;
}
}
.midMsgWrap {
border-bottom: 1px solid#DCDFE6;
margin-bottom: 30px;
.midMsgTitle {
display: flex;
height: 56px;
align-items: center;
background-color: #f4f6fc;
padding-left: 50px;
span {
font-size: 14px;
font-weight: 700;
color: #333333;
flex: 1;
}
}
.midMsgContent {
padding-left: 50px;
display: flex;
height: 150px;
.item {
padding-top: 20px;
font-size: 14px;
font-weight: 400;
color: #666666;
flex: 1;
div {
margin-bottom: 10px;
}
.userName {
text-indent: 1em;
}
}
}
}
}
</style>
<template>
<div class="live-room">
<div class="live-room container">
<div class="flex">
<!-- <el-form>
<el-form-item>
<el-button :size="size" type="primary" class="el-icon-plus" @click="handleEdit(1)">新增直播</el-button>
</el-form-item>
</el-form> -->
<el-form :inline="true" style="width:100%" :model="searchForm" label-width="100px" label-position="right">
<el-row>
<!-- <el-col :span="6"></el-col> -->
<el-form-item size="small" label="服务名称">
<el-input :size="size" v-model="searchForm.couponName" placeholder="请输入服务名称" clearable></el-input>
</el-form-item>
<el-form-item size="small" label="核销用户">
<el-input :size="size" v-model="searchForm.userReq" placeholder="请输入核销用户" clearable></el-input>
</el-form-item>
<el-form-item size="small" label="核销员">
<el-input :size="size" v-model="searchForm.verificationOperator" placeholder="请输入核销员" clearable></el-input>
</el-form-item>
</el-row>
<el-row>
<el-form-item size="small" label="关联订单号">
<el-input :size="size" v-model="searchForm.orderCode" placeholder="请输入关联订单号" clearable></el-input>
</el-form-item>
<el-form-item size="small" label="核销日期">
<!-- verificationTimeStart verificationTimeEnd -->
<!-- <el-input :size="size" v-model="searchForm.name" placeholder="请输入核销员" clearable></el-input> -->
<el-date-picker :size="size" v-model="searchForm.daterange" type="daterange" value-format="yyyy-MM-dd" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="pickerOptions || {}"></el-date-picker>
</el-form-item>
<el-form-item size="small" style="float:right">
<el-button :size="size" type="primary" @click="handleSearch">查询</el-button>
<el-button :size="size" @click="handleReset">重置</el-button>
</el-form-item>
</el-row>
</el-form>
</div>
<GLTable ref="memberRecordRef" @setTableFinishFun="setTableFinishFun" :searchForm="searchFormTable" :tableParams="tableParams" :getListApi="getListApi" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn">
<span slot="verificationTime" slot-scope="scope">
<span>{{ dateFormatFun(scope.scope.verificationTime) }}</span>
</span>
</GLTable>
</div>
</div>
</template>
<script>
import { getRecordListApi } from '@/api/modules/record'
import { dateFormat } from '@/utils/index.js'
export default {
name: 'record',
data() {
return {
pickerOptions: {
disabledDate(time) {
return time.getTime() > Date.now() || time.getTime() < new Date('2017-12-31').getTime()
}
},
size: 'small',
searchForm: {
// couponId:222 //卷id
//userCouponId //用户卷id
// name: '',
// daterange:''
couponName: '',
userReq: '',
verificationOperator: '',
orderCode: '',
merchantId: 44184606
},
// 44187877
searchFormTable: {},
// 表格组件
getListApi: getRecordListApi,
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
// 表格参数
tableParams: {
listName: 'list',
tableOption: false,
tableColumns: [
{
label: '服务名称',
prop: 'couponName',
width: '180'
// formatter: cellValue => {
// return cellValue.startTime + '-' + cellValue.endTime
// }
},
{
label: '剩余待核销次数',
prop: 'residueAmount',
line: 1
},
{
label: '核销员',
prop: 'verificationOperator'
},
{
label: '关联订单号',
prop: 'orderCode',
line: 1
},
{
label: '核销日期',
prop: 'verificationTime',
line: 1,
addHtml: 'verificationTime'
}
// {
// label: '直播状态',
// prop: 'liveStatus',
// width: '80'
// // formatter: cellValue => {
// // return this.baseDataList.liveStatusList.find(item => item.confId == cellValue.liveStatus).confName
// // }
// }
]
}
// baseDataList: {
// liveStatusList: liveStatusList
// }
}
},
methods: {
dateFormatFun(date) {
return dateFormat(date)
},
beforeSearchFn() {
return new Promise((resolve, reject) => {
this.searchFormTable = JSON.parse(JSON.stringify(this.searchForm))
if (this.searchFormTable.daterange) {
this.searchFormTable.verificationTimeStart = this.searchForm.daterange[0]
this.searchFormTable.verificationTimeEnd = this.searchForm.daterange[1]
} else {
if (this.searchFormTable.beginTime) delete this.searchFormTable.beginTime && delete this.searchFormTable.endTime
}
delete this.searchFormTable.daterange
resolve()
})
},
setTableFinishFun() {
//接收到的数据为空
if (!this.$refs.memberRecordRef.data.length) {
this.$refs.memberRecordRef.setTableHeightFun()
}
},
// handleShare(row) {
// getLiveShareApi({ id: row.id }).then(res => {
// console.log(res)
// this.isShareVisible = !this.isShareVisible
// this.shareForm = res
// })
// },
handleShareClose() {
// this.handleShare()
this.isShareVisible = !this.isShareVisible
},
handleDetail(row) {
this.$router.push({
name: 'ServicesLiveRoomLiveControl',
params: {
id: row.id
}
})
},
// 1-新增;2-编辑
handleEdit(addOrEdit, row) {
// console.log(row)
// this.$history.push('services/liveRoom/editLiveRoom', { addOrEdit: addOrEdit, row: row || {} })
// this.eventBus.$emit('editRoom', {
// addOrEdit: addOrEdit,
// id: row ? row.id : ''
// })
this.$router.push({
name: 'ServicesLiveRoomEditLiveRoom',
params: {
addOrEdit: addOrEdit,
id: row ? row.id : '-1'
}
// name: 'editLiveRoom',
// path: '/liveRoom/editLiveRoom'
})
},
handleSearch() {
this.$refs.memberRecordRef.refreshTable()
},
handleReset() {
this.searchForm = { merchantId: 44184606 }
this.handleSearch()
}
}
}
</script>
<style lang="scss" scoped>
.el-range-editor.is-active,
.el-range-editor.is-active:hover {
border-color: #5850ff;
width: 215px;
}
.el-range-editor--small.el-input__inner {
width: 215px;
}
</style>
<template>
<div class="live-room">
<!-- //提示面板组件 -->
<tip-panel panelWidth="616px" panelMinHeight="60px" :panelContent="panelContent" v-if="isFirstShow" @closePanel="closePanel"></tip-panel>
<div class="live-room container">
<el-form :inline="true" style="width:100%" :model="searchForm" label-width="100px" label-position="right">
<el-row>
<el-form-item size="small">
<el-button :size="size" type="primary" icon="el-icon-plus" @click="handleCreate">创建服务</el-button>
</el-form-item>
<el-form-item size="small" label="服务名称">
<el-input :size="size" v-model="searchForm.couponName" placeholder="请输入服务名称" clearable></el-input>
</el-form-item>
<el-form-item size="small" style="float:right">
<el-button :size="size" type="primary" @click="handleSearch">查询</el-button>
<el-button :size="size" @click="handleReset">重置</el-button>
</el-form-item>
</el-row>
</el-form>
<GLTable ref="memberServiceRef" @setTableFinishFun="setTableFinishFun" :searchForm="searchForm" :tableParams="tableParams" :getListApi="getListApi" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn">
<span slot="effectiveType" slot-scope="scope">
<span>{{ toLabelText(scope.scope) }}</span>
</span>
<span slot="useType" slot-scope="scope">
<span>{{ toRestrictLabelText(scope.scope) }}</span>
</span>
<span class="table-btns" slot="auth-button" slot-scope="scope" :data="scope.scope">
<template v-if="scope.scope.status == 2">
<el-button type="text" @click="handleLossOption(scope.scope)">失效</el-button>
<el-button type="text" @click="handleLook(scope.scope)">查看</el-button>
<el-button type="text" @click="handleDelete(scope.scope)">删除</el-button>
</template>
<template v-else-if="scope.scope.status == 3">
<el-button type="text" @click="handleLook(scope.scope)">查看</el-button>
<el-button type="text" @click="handleDelete(scope.scope)">删除</el-button>
</template>
<template v-else>
<el-button type="text" @click="handleTakeOption(scope.scope)">生效</el-button>
<el-button type="text" @click="handleEdit(scope.scope)">编辑</el-button>
<el-button type="text" @click="handleDelete(scope.scope)">删除</el-button>
</template>
</span>
</GLTable>
</div>
</div>
</template>
<script>
import { getServiceListApi, effectiveService, deleteService } from '@/api/modules/service'
import { serviceStatusList } from '@/common/constant'
import tipPanel from '@/components/tipPanel/index.vue'
export default {
components: {
tipPanel
},
data() {
return {
isFirstShow: true,
panelContent: '会员服务:是由门店根据自店服务项目创建的线上服务券,如“一年十二次洗车券”、“陶瓷镀膜”等,客户购买后可到店出示服务券享受服务,门店扫码进行次数核销。',
size: 'small',
getListApi: getServiceListApi,
searchForm: {
couponName: '',
merchantId: 44184606
},
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
// 表格参数
tableParams: {
listName: 'list',
// 行数据的key
mutiSelectUniqueKey: 'id',
// 多选ref的名称
mutiSelectName: 'list',
tableOption: true,
tableColumns: [
{
label: '服务名称',
prop: 'couponName',
width: '180'
},
{
label: '会员价(元)',
prop: 'vipPrice',
line: 1
},
{
label: '有效期',
prop: 'effectiveType',
addHtml: 'effectiveType'
},
{
label: '使用限制',
prop: 'useType',
addHtml: 'useType'
},
{
label: '剩余库存',
prop: 'residueAmount',
line: 1
// addHtml: 'activeTime'
},
{
label: '状态',
prop: 'status',
width: '80',
formatter: cellValue => {
return this.baseDataList.serviceStatusList.find(item => item.confId == cellValue.status).confName
}
},
{
label: '创建时间',
prop: 'createdDate',
line: 1
}
]
},
baseDataList: {
serviceStatusList: serviceStatusList
},
merchantId: 44184606
}
},
created() {
if (window.__POWERED_BY_QIANKUN__) {
//运行在qiankun容器中
this.merchantId = this.$globalState.session.merchantId
}
},
methods: {
closePanel() {
this.isFirstShow = false
},
toLabelText(row) {
switch (row.effectiveType) {
case 3:
return '无有效期'
case 2:
return row.effectiveStartTime ? row.effectiveStartTime.split(' ')[0] + '-' + row.effectiveEndTime.split(' ')[0] : ''
case 1:
return row.effectiveDays + '天'
}
},
toRestrictLabelText(row) {
switch (row.useType) {
case 0:
return '无限制'
case 1:
return row.useAmount
case 2:
return '每' + row.useLimitDays + '天可以使用' + row.useAmount + '次'
}
},
handleReset() {
this.searchForm = { couponName: '', merchantId: 44184606 }
this.handleSearch()
},
handleSearch() {
this.$refs.memberServiceRef.refreshTable()
},
setTableFinishFun(content) {
console.log(content, this.$refs.memberServiceRef.data.length, '获取数据')
//接收到的数据为空
if (!this.$refs.memberServiceRef.data.length) {
this.$refs.memberServiceRef.setTableHeightFun()
}
},
//创建服务
handleCreate() {
this.$router.push({
path: '/memberCenter/serviceAddUpdateLook'
})
},
//失效
handleLossOption(row) {
this.$messageBox.confirm('是否失效该服务?', '失效', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'error',
callback: action => {
if (action == 'confirm') {
effectiveService({ couponId: row.id, status: 3 }).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
this.handleSearch()
}
})
}
}
})
},
//生效
handleTakeOption(row) {
effectiveService({ couponId: row.id, status: 2 }).then(res => {
this.$message({
message: res.code == '0' ? '生效成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
this.handleSearch()
}
})
},
handleEdit(row) {
this.$router.push({
path: '/memberCenter/serviceAddUpdateLook',
query: {
couponId: row.id,
title: '编辑'
}
})
},
handleLook(row) {
this.$router.push({
path: '/memberCenter/serviceAddUpdateLook',
query: {
couponId: row.id,
title: '查看'
}
})
},
handleDelete(row) {
this.$messageBox.confirm('是否删除该服务?', '删除', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'error',
callback: action => {
if (action == 'confirm') {
deleteService({ couponId: row.id, merchantId: this.merchantId }).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
this.handleSearch()
}
})
}
}
})
}
}
}
</script>
<style lang="scss" scoped></style>
<template>
<div class="live-room">
<div class="topMsg">
<p class="pageTitle">基本信息</p>
<el-button type="primary" size="small" @click="goBack">返回</el-button>
</div>
<div class="live-room container">
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="120px" class="demo-ruleForm">
<el-form-item size="small" label="服务名称" prop="couponName" style="width: 420px">
<el-input size="small" :disabled="disabledContent" v-model="ruleForm.couponName" placeholder="请输入服务名称,如“精洗轿车”"></el-input>
</el-form-item>
<el-form-item size="small" label="有效期" prop="effectiveType">
<div class="radioGroupWrap">
<el-radio-group v-model="ruleForm.effectiveType" :disabled="disabledContent">
<el-radio :label="3" class="itemBlock">无有效期</el-radio>
<!-- effectiveType:1, effectiveDays:5 -->
<el-radio :label="1">
领取后
<el-input
v-model="effectiveDays"
@input="
val => {
effectiveDays = val.replace(/[^\d]/g, '')
}
"
:disabled="disabledContent"
placeholder="请输入"
size="small"
style="width: 100px"
></el-input>
天内有效
</el-radio>
<!-- effectiveStartTime effectiveEndTime +具体时间 -->
<el-radio :label="2">
<el-date-picker :size="small" :disabled="disabledContent" style="width: 215px" v-model="ruleForm.daterange" type="daterange" value-format="yyyy-MM-dd" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
</el-radio>
</el-radio-group>
</div>
</el-form-item>
<el-form-item size="small" label="使用限制" prop="customUseLimit">
<div class="radioGroupWrap">
<el-radio-group v-model="ruleForm.customUseLimit" :disabled="disabledContent">
<el-radio :label="0" class="itemBlock">不限制使用次数</el-radio>
<!-- useType:1 useAmount:6 -->
<el-radio :label="1">
有效期内可使用
<el-button @click="sub1" class="addsubBtn" :disabled="disabledContent">-</el-button>
<span class="numWrap">{{ limitTime1 }}</span>
<el-button @click="add1" class="addsubBtn" :disabled="disabledContent">+</el-button>
次
</el-radio>
<el-radio :label="2">
有效期内每
<el-input
v-model="limitDays"
@input="
val => {
limitDays = val.replace(/[^\d]/g, '')
}
"
:disabled="disabledContent"
placeholder="请输入"
size="small"
style="width: 100px"
></el-input>
天内可使用
<el-button @click.stop="sub2" class="addsubBtn" :disabled="disabledContent">-</el-button>
<span class="numWrap">{{ limitTime2 }}</span>
<el-button @click.stop="add2" class="addsubBtn" :disabled="disabledContent">+</el-button>
次
</el-radio>
</el-radio-group>
</div>
</el-form-item>
<el-form-item size="small" label="会员价" prop="vipPrice" style="width: 315px">
<el-input size="small" :disabled="disabledContent" v-model="ruleForm.vipPrice" placeholder="请输入" @keyup.native="ruleForm.vipPrice = oninput(ruleForm.vipPrice)">
<template slot="append">元</template>
</el-input>
</el-form-item>
<el-form-item size="small" label="门店价" prop="shopPrice" style="width: 315px">
<el-input size="small" :disabled="disabledContent" v-model="ruleForm.shopPrice" placeholder="请输入" @keyup.native="ruleForm.shopPrice = oninput(ruleForm.shopPrice)">
<template slot="append">元</template>
</el-input>
</el-form-item>
<el-form-item size="small" label="库存" prop="stock" style="width: 315px">
<el-input size="small" :disabled="title == '查看'" v-model.number="ruleForm.stock" placeholder="请输入"></el-input>
</el-form-item>
<el-form-item size="small" label="使用说明" prop="useDescription" style="width: 670px">
<el-input size="small" :disabled="title == '查看'" type="textarea" v-model="ruleForm.useDescription" placeholder="请输入" maxlength="200" show-word-limit></el-input>
</el-form-item>
<!-- <el-form-item size="small">
<el-button type="primary" @click="submitForm('ruleForm')" size="small">创建</el-button>
<el-button type="primary" @click="resetForm('ruleForm')" size="small">重置</el-button>
</el-form-item> -->
</el-form>
<div class="serviceCard">
<div class="cardtop">
<img src="@/assets/serviceMemberCard.png" alt="" />
<span class="serviceName">{{ ruleForm.couponName || '-' }}</span>
<span class="effectiveRange">{{ limitText }}</span>
<span class="timeRange">{{ effectiveRangeText }}</span>
<div class="grayLine"></div>
</div>
<div class="cardbottom">
<div class="desc">使用说明:</div>
<span class="detailDesc">{{ ruleForm.useDescription }}</span>
</div>
</div>
</div>
<div
class="footer-panel"
v-if="title !== '查看'"
:style="{
left: footerLeft + 'px',
width: footerWidth + 'px'
}"
>
<el-button type="primary" @click="submitForm('ruleForm')" size="small">创建</el-button>
<el-button type="primary" @click="resetForm('ruleForm')" size="small">取消</el-button>
</div>
</div>
</template>
<script>
import { createService, detailService, updateService } from '@/api/modules/service'
export default {
data() {
var checkStock = (rule, value, callback) => {
if (value <= 0) {
return callback(new Error('库存不能为空或负数'))
}
setTimeout(() => {
if (!Number.isInteger(value)) {
callback(new Error('请输入数字值'))
} else {
if (value < 0) {
callback(new Error('必须大于或等于0'))
} else {
callback()
}
}
}, 1000)
}
return {
// pickerOptions: {
// disabledDate(time) {
// return time.getTime() > Date.now() || time.getTime() < new Date('2017-12-31').getTime()
// }
// },
ruleForm: {
couponName: '',
// region: '',
// date1: '',
// date2: '',
// delivery: false,
// type: [],
// resource: '',
effectiveType: 3, //有效期(默认无有效期)
customUseLimit: 0, //使用限制(默认不限制使用次数)
vipPrice: '',
shopPrice: '',
stock: '',
useDescription: '',
daterange: []
},
effectiveDays: '',
limitTime1: 1,
limitDays: '30',
limitTime2: 5,
rules: {
couponName: [{ required: true, message: '请输入活动名称', trigger: 'blur' }],
// region: [{ required: true, message: '请选择活动区域', trigger: 'change' }],
// date1: [{ type: 'date', required: true, message: '请选择日期', trigger: 'change' }],
// date2: [{ type: 'date', required: true, message: '请选择时间', trigger: 'change' }],
// type: [{ type: 'array', required: true, message: '请至少选择一个活动性质', trigger: 'change' }],
effectiveType: [{ required: true, message: '请选择有效期', trigger: 'change' }],
customUseLimit: [{ required: true, message: '请选择使用限制', trigger: 'change' }],
vipPrice: [{ required: true, message: '请输入会员价', trigger: 'blur' }],
shopPrice: [{ required: true, message: '请输入门店价', trigger: 'blur' }],
stock: [
{ required: true, message: '请输入库存', trigger: 'blur' },
{ validator: checkStock, trigger: 'blur' }
]
// useDescription: [{ required: true, message: '请填写活动形式', trigger: 'blur' }]
},
merchantId: '',
merchantName: '',
title: this.$route.query.title || ''
}
},
computed: {
disabledContent() {
if (this.title == '查看' || this.title == '编辑') {
return true
}
return false
},
limitText() {
if (this.ruleForm.customUseLimit == 0) {
return `不限制使用次数`
} else if (this.ruleForm.customUseLimit == 1) {
return `有效期内可使用${this.limitTime1}次`
} else if (this.ruleForm.customUseLimit == 2) {
return `有效期内每${this.limitDays}天内可使用${this.limitTime2}次`
}
return '不限制使用次数'
},
effectiveRangeText() {
if (this.ruleForm.effectiveType == 1) {
return `领取后${this.effectiveDays}天内有效`
} else if (this.ruleForm.effectiveType == 2) {
return `${this.ruleForm.daterange[0]}-${this.ruleForm.daterange[1]}`
}
return '无有效期'
}
// 有效期内可使用3次
},
created() {
if (window.__POWERED_BY_QIANKUN__) {
//运行在qiankun容器中
this.merchantId = this.$globalState.session.merchantId
this.merchantName = this.$globalState.session.merchantName
}
if (this.title == '编辑' || this.title == '查看') {
var breadcrumbTitle = this.title
// document.getElementsByClassName('el-breadcrumb__item')[3].innerText = `${breadcrumbTitle}服务`
// document.getElementById('tab-/membercenter/memberCenter/serviceAddUpdateLook').innerHTML = 'AAAAAAAA'
this.getPageDetail()
}
},
mounted() {
this.footerLeft = document.querySelector('.base-container-right').offsetLeft
this.footerWidth = document.documentElement.clientWidth - this.footerLeft
},
methods: {
getPageDetail() {
let params = {}
params.couponId = this.$route.query.couponId
detailService(params).then(res => {
this.ruleForm = res
this.ruleForm.customUseLimit = res.useType
if (res.effectiveType == 1) {
this.effectiveDays = res.effectiveDays
}
if (res.effectiveType == 2) {
this.ruleForm.daterange = [res.effectiveStartTime, res.effectiveEndTime]
}
// this.limitTime1 = ''
// this.limitTime2 = ''
// this.limitDays = ''
if (res.useType == 1) {
this.limitTime1 = res.useAmount
}
if (res.useType == 2) {
this.limitTime2 = res.useAmount
this.limitDays = res.useLimitDays
}
})
},
submitForm(formName) {
this.$refs[formName].validate(valid => {
if (valid) {
if (this.title == '编辑') {
this.updateService()
} else {
this.createService()
}
} else {
return false
}
})
},
//创建服务
createService() {
let params = {
effectiveDays: '',
useAmount: '',
useLimitDays: ''
}
params.couponName = this.ruleForm.couponName
//有效期
params.effectiveType = this.ruleForm.effectiveType
//使用限制
params.useType = this.ruleForm.customUseLimit
//有效期 effectiveType: 3 1 2
if (this.ruleForm.effectiveType == 1 && !parseInt(this.effectiveDays)) {
this.$message.error('请输入有效期')
return false
}
params.effectiveDays = this.effectiveDays
if (this.ruleForm.effectiveType == 2) {
if (!this.ruleForm.daterange) {
this.$message.error('请输入有效期')
return false
} else {
params.effectiveStartTime = this.ruleForm.daterange[0] + ' 00:00:00'
params.effectiveEndTime = this.ruleForm.daterange[1] + ' 23:59:59'
}
}
//使用限制
if (this.ruleForm.customUseLimit == 1) {
if (!parseInt(this.limitTime1)) {
this.$message.error('请输入有效期使用次数')
return false
} else {
params.useAmount = this.limitTime1
}
}
if (this.ruleForm.customUseLimit == 2) {
if (!parseInt(this.limitTime2) || !parseInt(this.limitDays)) {
this.$message.error('请输入有效期使用次数')
return false
} else {
params.useLimitDays = this.limitDays
params.useAmount = this.limitTime2
}
}
params.vipPrice = this.ruleForm.vipPrice
params.shopPrice = this.ruleForm.shopPrice
params.stock = this.ruleForm.stock
params.useDescription = this.ruleForm.useDescription
params.discountType = 7
params.merchantId = this.merchantId
params.merchantName = this.merchantName
createService(params).then(res => {
if (res.code == 0) {
// console.log(res, '提交内容')
this.$message.success('创建服务成功')
this.$router.push('/memberCenter/service')
} else {
this.$message({
type: 'error',
message: res.message
})
}
})
},
//更新服务
updateService() {
let param = {}
param.discountType = 7
param.merchantId = this.merchantId
param.merchantName = this.merchantName
param.couponId = this.$route.query.couponId
param.stock = this.ruleForm.stock
param.useDescription = this.ruleForm.useDescription
updateService(param).then(res => {
if (res.code == 0) {
this.$message.success('编辑服务成功')
this.$router.push('/memberCenter/service')
} else {
this.$message({
type: 'error',
message: res.message
})
}
})
},
resetForm(formName) {
this.$router.push('/memberCenter/service')
// this.$refs[formName].resetFields()
},
goBack() {
this.$router.push('/memberCenter/service')
},
oninput(value) {
let str = value
let len1 = str.substr(0, 1)
let len2 = str.substr(1, 1) //如果第一位是0,第二位不是点,就用数字把点替换掉
if (str.length > 1 && len1 == 0 && len2 != '.') {
str = str.substr(1, 1)
} //第一位不能是.
if (len1 == '.') {
str = ''
}
if (len1 == '+') {
str = ''
}
if (len1 == '-') {
str = ''
} //限制只能输入一个小数点
if (str.indexOf('.') != -1) {
let str_ = str.substr(str.indexOf('.') + 1)
if (str_.indexOf('.') != -1) {
str = str.substr(0, str.indexOf('.') + str_.indexOf('.') + 1)
}
}
//正则替换
// (/[^\-\d.]/g, ''))"
str = str.replace(/[^\d.^]+/g, '') // 保留数字和小数点
str = str.replace(/^\D*([0-9]\d*\.?\d{0,2})?.*$/, '$1') // 小数点后只能输 2 位
return str
},
sub1() {
if (this.limitTime1 <= 0) {
return
}
this.limitTime1--
},
add1() {
this.limitTime1++
},
sub2() {
if (this.limitTime2 <= 0) {
return
}
this.limitTime2--
},
add2() {
this.limitTime2++
}
}
}
</script>
<style lang="scss" scoped>
.live-room {
.topMsg {
margin: 20px 40px 0;
padding: 0 20px;
background-color: #fff;
height: 56px;
border-bottom: 1px solid#DCDFE6;
display: flex;
justify-content: space-between;
align-items: center;
.pageTitle {
position: relative;
// margin-bottom: 20px;
// height: 20px;
font-size: 20px;
font-weight: 700;
color: #333333;
line-height: 20px;
letter-spacing: 1px;
}
}
.container {
margin: 0 40px 100px;
position: relative;
/deep/ .el-form-item__content {
.radioGroupWrap {
width: 550px;
height: 164px;
background-color: #f4f6fc;
padding-top: 10px;
padding-left: 20px;
}
}
.numWrap {
display: inline-block;
background-color: #fff;
min-width: 34px;
height: 22px;
text-align: center;
line-height: 22px;
margin: 0 2px;
}
.addsubBtn {
background-color: #fff;
color: #5850ff;
padding: 5px 9px;
}
.el-radio {
display: block;
&:not(:first-child) {
margin-top: 18px;
}
}
.itemBlock {
margin-top: 10px;
}
.serviceCard {
position: absolute;
padding: 10px;
box-sizing: border-box;
top: 136px;
right: 78px;
width: 343px;
min-height: 184px;
background: #ffffff;
box-shadow: 0px 2px 12px 0px rgba(0, 0, 0, 0.06);
border-radius: 4px;
border: 1px solid #e4e7ed;
span {
font-size: 12px;
font-weight: 400;
color: #999999;
}
.cardtop {
padding-bottom: 10px;
// border-bottom: 1px solid #979797;
position: relative;
.serviceName {
position: absolute;
left: 88px;
top: 5px;
font-size: 14px;
font-weight: 600;
color: #333333;
}
.effectiveRange {
position: absolute;
left: 88px;
top: 30px;
}
.timeRange {
position: absolute;
left: 88px;
top: 60px;
}
.grayLine {
position: absolute;
width: 100%;
left: 0;
top: 90px;
height: 1px;
opacity: 0.14;
background-color: #979797;
}
}
.cardbottom {
position: relative;
.desc {
position: absolute;
top: 10px;
left: 88px;
color: #333;
}
.detailDesc {
position: absolute;
left: 88px;
top: 35px;
}
}
}
}
.footer-panel {
display: flex;
align-items: center;
justify-content: center;
position: fixed;
width: 100%;
bottom: 0px;
height: 64px;
background: #ffffff;
z-index: 999;
box-shadow: 0px -1px 1px 0px rgba(88, 80, 255, 0.1);
}
}
</style>
<template>
<div class="live-room">
<tip-panel panelWidth="616px" panelMinHeight="40px" :panelContent="panelContent" v-if="isFirstShow" @closePanel="closePanel"></tip-panel>
<div class="live-room container">
<div class="btnWrap">
<el-button :size="size" type="primary" @click="handleCreate" icon="el-icon-plus">创建套餐</el-button>
<el-button :size="size" @click="isDialogVisible = true">查看示例效果</el-button>
</div>
<GLTable ref="memberSetMealRef" :searchForm="searchForm" :tableParams="tableParams" :getListApi="getListApi" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn">
<span slot="list" slot-scope="scope">
<div v-for="(item, index) in scope.scope.list" :key="index">{{ item.couponName }}×{{ item.serviceQuantity }}</div>
</span>
<span class="table-btns" slot="auth-button" slot-scope="scope" :data="scope.scope">
<template v-if="scope.scope.state === 0">
<el-button type="text" @click="handleUpOption(scope.scope)">上架</el-button>
<el-button type="text" @click="handleDelete(scope.scope)">删除</el-button>
</template>
<template v-else-if="scope.scope.state === 1">
<el-button type="text" @click="handleDownOption(scope.scope)">下架</el-button>
<el-button type="text" @click="handleEdit(scope.scope)">编辑</el-button>
</template>
<template v-else>
<el-button type="text" @click="handleUpOption(scope.scope)">上架</el-button>
<el-button type="text" @click="handleDelete(scope.scope)">删除</el-button>
</template>
</span>
</GLTable>
</div>
<glsx-dialog title="示例效果" width="1142px" :noBtnOk="true" btnCancelLabel="关闭" btnSize="small" :isVisible="isDialogVisible" :showClose="false" @closeDialog="handleClose" @confirmDialog="handleClose">
<div class="content-body">
<div class="content-item col1">
<div class="subTitle">
1、管理后台先创建套餐
</div>
<div class="imageWrap">
<img src="@/assets/table.png" alt="" />
</div>
</div>
<div class="content-item col2">
<div class="subTitle">
2、小程序端进行展示
</div>
<div class="twoImageWrap">
<img src="@/assets/card1.png" alt="" />
<img src="@/assets/card2.png" alt="" />
</div>
</div>
</div>
</glsx-dialog>
</div>
</template>
<script>
import glsxDialog from '@/components/glsx-dialog'
import { getSetMealListApi, deleteSetMeal, upDownPackage } from '@/api/modules/setmeal'
import { stateList } from '@/common/constant'
import tipPanel from '@/components/tipPanel/index.vue'
export default {
components: {
tipPanel,
glsxDialog
},
data() {
return {
isFirstShow: true,
panelContent: '会员套餐:将已经创建好的会员服务打包成一个套餐售卖给客户。',
size: 'small',
getListApi: getSetMealListApi,
searchForm: {
merchantId: 44184606
// merchantName
},
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
// 表格参数
tableParams: {
listName: 'list',
tableOption: true,
tableColumns: [
{
label: '套餐名称',
prop: 'packageName',
width: '180'
},
{
label: '套餐售价',
prop: 'packagePrice',
line: 1
},
{
label: '套餐总价',
prop: 'referencePrice'
},
{
label: '套餐内容',
prop: 'list',
addHtml: 'list'
},
{
label: '说明',
prop: 'notes'
// line: 1
},
{
label: '状态',
prop: 'state',
width: '80',
formatter: cellValue => {
return this.baseDataList.stateList.find(item => item.confId == cellValue.state).confName
}
}
]
},
baseDataList: {
stateList: stateList
},
//查看示例 --弹窗
isDialogVisible: false
}
},
methods: {
closePanel() {
this.isFirstShow = false
},
handleReset() {
this.searchForm = {
merchantId: 44184606
}
this.handleSearch()
},
handleSearch() {
this.$refs.memberSetMealRef.refreshTable()
},
//创建套餐
handleCreate() {
this.$router.push('/memberCenter/setmealAddUpdate')
},
handleClose() {
this.isDialogVisible = !this.isDialogVisible
},
//上架
handleUpOption(row) {
var params = {}
params.id = row.id
params.state = 1
upDownPackage(params).then(res => {
this.$message({
message: res.code == '0' ? '上架成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
this.handleSearch()
}
})
},
handleDownOption(row) {
var params = {}
params.id = row.id
params.state = 2
this.$messageBox.confirm('下架后将隐藏且客户不能购买该套餐,已经购买的客户仍继续享有该套餐的服务?', '下架', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'error',
callback: action => {
if (action == 'confirm') {
upDownPackage(params).then(res => {
this.$message({
message: res.code == '0' ? '下架成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
this.handleSearch()
}
})
}
}
})
},
handleEdit(row) {
this.$router.push({ path: '/memberCenter/setmealAddUpdate', query: { id: row.id } })
},
// 查看示例效果
handleLook(row) {},
handleDelete(row) {
this.$messageBox.confirm('是否删除该套餐?', '删除', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'error',
callback: action => {
if (action == 'confirm') {
deleteSetMeal({ id: row.id }).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
this.handleSearch()
}
})
}
}
})
}
}
}
</script>
<style lang="scss" scoped>
.btnWrap {
margin-bottom: 20px;
}
/deep/ .el-dialog__header .el-dialog__title {
font-size: 16px;
font-weight: 700;
color: #000000;
}
/deep/ .el-dialog__body {
border-top: 1px solid #e6e6e6;
border-bottom: 1px solid #e6e6e6;
padding: 20px 25px;
.content-body {
display: flex;
.col2 {
margin-left: 40px;
}
.content-item {
.subTitle {
margin-bottom: 20px;
font-size: 18px;
font-weight: 700;
color: #000000;
}
}
}
}
/deep/ .el-dialog__footer {
text-align: center;
}
</style>
<template>
<div class="live-room">
<div class="topMsg">
<p class="pageTitle">创建套餐</p>
<el-button type="primary" size="small" @click="goBack">返回</el-button>
</div>
<div class="live-room container">
<el-form ref="ruleForm" :rules="rules" :model="ruleForm" label-width="120px" class="demo-ruleForm">
<el-form-item size="small" label="套餐名称" prop="packageName" style="width: 420px">
<el-input size="small" v-model="ruleForm.packageName" placeholder="请输入套餐名称"></el-input>
</el-form-item>
<el-form-item size="small" label="套餐内容" class="is-required">
<el-button @click="openDialog" size="small" icon="el-icon-plus">选择服务</el-button>
<div class="allChoseWrap" v-if="this.choseItemList.length > 0">
<!-- choseItemList -->
<div class="choseItem" v-for="(item, index) in choseItemList" :key="index">
<span>{{ item.couponName }}</span>
<img src="@/assets/closeIcon.png" @click="closeChoseItemFun(item, index)" alt="" />
</div>
</div>
<div class="el-form-item__error" v-if="setmealContentRules">
请选择套餐
</div>
<div class="totalWrap" v-if="this.choseItemList.length > 0">
<span>合计:</span>
<span>{{ totalPrice }}元</span>
</div>
</el-form-item>
<el-form-item size="small" label="售价" prop="packagePrice" style="width: 315px">
<el-input size="small" v-model="ruleForm.packagePrice" placeholder="请输入" @keyup.native="ruleForm.packagePrice = oninput(ruleForm.packagePrice)">
<template slot="append">元</template>
</el-input>
</el-form-item>
<el-form-item size="small" label="说明" prop="notes" style="width: 670px">
<el-input size="small" type="textarea" v-model="ruleForm.notes" placeholder="请输入" maxlength="200" show-word-limit></el-input>
</el-form-item>
</el-form>
</div>
<div
class="footer-panel"
:style="{
left: footerLeft + 'px',
width: footerWidth + 'px'
}"
>
<el-button type="primary" @click="submitForm('ruleForm')" size="small">创建</el-button>
<el-button type="primary" @click="resetForm('ruleForm')" size="small">取消</el-button>
</div>
<glsx-dialog title="套餐服务" width="1142px" btnCancelLabel="关闭" btnSize="small" :isVisible="setmealDialogVisible" @closeDialog="handleClose" @confirmDialog="handleConfirm">
<div class="content-body">
<div class="subTitle">
<span>请选择套餐服务:</span>
<span @click="$router.push('/memberCenter/serviceAddUpdateLook')">没有服务?去新建</span>
</div>
<div class="itemWrap">
<div class="item" v-for="(item, index) in allItemList" :key="index">
<div class="itemBox" :class="{ 's-checkd': item.serviceQuantity > 0 }" @click="handlePackage(item, index)">
<div class="name">{{ item.couponName }}</div>
<div class="price">
<span>¥</span>
{{ item.vipPrice }}
</div>
<div class="effectiveRange" v-if="item.effectiveType == 3">有效期:无有效期</div>
<div class="effectiveRange" v-if="item.effectiveType == 1">有效期:{{ item.effectiveDays }}天</div>
<div class="effectiveRange" v-if="item.effectiveType == 2">有效期:{{ item.effectiveStartTime.split(' ')[0] }} - {{ item.effectiveEndTime.split(' ')[0] }}</div>
<div class="useTime" v-if="item.useType == 0">有效期内无限制</div>
<div class="useTime" v-if="item.useType == 1">有效期内可使用{{ item.useAmount }}次</div>
<div class="useTime" v-if="item.useType == 2">每{{ item.useLimitDays }}天可以使用{{ item.useAmount }}次</div>
<!-- <div class="select-package-time" ng-show="item.effectiveType == 3">有效期:无有效期</div>
<div class="select-package-time" ng-show="item.effectiveType == 1">有效期:{{item.effectiveDays}}天</div>
<div class="select-package-time" ng-show="item.effectiveType == 2">有效期:{{item.effectiveStartTime.split(' ')[0]}} - {{item.effectiveEndTime.split(' ')[0]}}</div>
<div class="select-package-time" ng-show="item.useType == 0">有效期内无限制</div>
<div class="select-package-time" ng-show="item.useType == 1">有效期内可使用{{item.useAmount}}次</div>
<div class="select-package-time" ng-show="item.useType == 2">每{{item.useLimitDays}}天可以使用{{item.useAmount}}次</div> -->
</div>
<div class="optionBtns" v-if="item.serviceQuantity > 0">
<el-button @click="cutPackage(item, index)" class="addsubBtn">-</el-button>
<span class="numWrap">{{ item.serviceQuantity }}</span>
<el-button @click="addPackage(item, index)" class="addsubBtn">+</el-button>
</div>
</div>
</div>
<div class="amountTo" v-if="selectNum">
<span class="bottomText">
已选
<span class="redText">{{ selectNum }}</span>
项
</span>
<span class="bottomText" style="margin-left:20px">合计:</span>
<span class="smallRedText">¥</span>
<span class="redText">{{ totalPrice }}</span>
</div>
</div>
</glsx-dialog>
</div>
</template>
<script>
import glsxDialog from '@/components/glsx-dialog'
import { getSetmealService, createSetMeal, getServiceInfo, updateSetMeal, configSetMeal } from '@/api/modules/setmeal'
export default {
components: {
glsxDialog
},
data() {
return {
ruleForm: {
packageName: '',
packagePrice: '',
notes: ''
},
rules: {
packageName: [{ required: true, message: '请输入套餐名称', trigger: 'blur' }],
packagePrice: [{ required: true, message: '请输入售价', trigger: 'blur' }]
},
allItemList: [],
choseItemList: [], //['一年12次洗车劵×1', '车身打蜡×2', '全车镀膜×1'],
merchantId: 44184606,
merchantName: '',
setmealContentRules: false,
//弹窗
setmealDialogVisible: false,
selectNum: 0,
totalPrice: 0,
id: this.$route.query.id || 0
}
},
created() {
if (window.__POWERED_BY_QIANKUN__) {
//运行在qiankun容器中
this.merchantId = this.$globalState.session.merchantId
this.merchantName = this.$globalState.session.merchantName
}
this.getSetmealServiceFun()
if (this.id) {
this.getServiceInfo() //获取编辑详情
}
},
watch: {
// allItemList: {
// deep: true,
// handler(val) {
// this.choseItemList = this.allItemList.filter(item => item.serviceQuantity > 0)
// this.choseItemList = this.choseItemList.map(ele => {
// return {
// ...ele,
// serviceId: ele.id
// }
// })
// }
// }
},
mounted() {
this.footerLeft = document.querySelector('.base-container-right').offsetLeft
this.footerWidth = document.documentElement.clientWidth - this.footerLeft
},
methods: {
openDialog() {
this.allItemList.forEach(item => {
item.serviceQuantity = 0
})
this.allItemList.forEach(item => {
for (let i = 0; i < this.choseItemList.length; i++) {
if (this.choseItemList[i].serviceId == item.id) {
item.serviceQuantity = this.choseItemList[i].serviceQuantity
}
}
})
this.selectNumFun()
this.setmealDialogVisible = true
this.setmealContentRules = false
},
//编辑详情
getServiceInfo() {
getServiceInfo({ id: this.id }).then(res => {
if (res.code == '0') {
this.ruleForm = res.data
this.choseItemList = res.data.list || []
this.totalPrice = res.data.referencePrice
}
})
},
//获取套餐服务总的数量
getSetmealServiceFun() {
let params = {}
params.merchantId = this.merchantId
params.status = 2
params.discountType = 7
params.pageSize = 1000
params.currentPage = 1
getSetmealService(params).then(res => {
this.allItemList = res.list.map(item => {
return {
...item,
serviceQuantity: 0
}
})
})
},
//选中该条服务套餐
handlePackage(item, index) {
if (item.serviceQuantity == 0) {
item.serviceQuantity++
this.selectNumFun()
}
},
//删除该条服务套餐(让item.serviceQuantity==0)
closeChoseItemFun(item, index) {
this.totalPrice = this.totalPrice - item.vipPrice * item.serviceQuantity
// item.serviceQuantity = 0
this.allItemList.forEach(ele => {
if (ele.id == item.serviceId) {
ele.serviceQuantity = 0
}
})
this.selectNumFun()
this.choseItemList.splice(index, 1)
},
selectNumFun() {
this.selectNum = 0
this.totalPrice = 0
this.allItemList.forEach(item => {
if (item.serviceQuantity) {
this.selectNum++
this.totalPrice += item.vipPrice * item.serviceQuantity
}
})
},
cutPackage(item, index) {
item.serviceQuantity--
this.selectNumFun()
},
addPackage(item, index) {
item.serviceQuantity++
this.selectNumFun()
},
submitForm(formName) {
this.$refs[formName].validate(valid => {
if (!valid) {
if (this.choseItemList.length <= 0) {
this.setmealContentRules = true
}
return
}
if (this.choseItemList.length <= 0) {
this.setmealContentRules = true
return
}
if (this.id) {
//需要调config的接口????
// scrm.api.equity.package.service.config
this.configFun()
//调修改的接口
let param = {}
param.id = this.id
param.merchantId = this.merchantId
param.merchantName = this.merchantName
param.packageName = this.ruleForm.packageName
param.packagePrice = this.ruleForm.packagePrice
param.notes = this.ruleForm.notes
let lists = this.choseItemList
for (var k in lists) {
param[`lists[${k}].serviceQuantity`] = lists[k].serviceQuantity
param[`lists[${k}].serviceId`] = lists[k].serviceId
}
updateSetMeal(param).then(res => {
this.$message({
message: res.code == '0' ? '修改成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
this.$router.go(-1)
}
})
} else {
//调创建的接口
let params = {}
params.referencePrice = this.totalPrice
params.merchantId = this.merchantId
params.merchantName = this.merchantName
params.packageName = this.ruleForm.packageName
params.packagePrice = this.ruleForm.packagePrice
params.notes = this.ruleForm.notes
let list = this.choseItemList
for (var i in list) {
params[`list[${i}].serviceQuantity`] = list[i].serviceQuantity
params[`list[${i}].serviceId`] = list[i].serviceId
}
createSetMeal(params).then(res => {
this.$message({
message: res.code == '0' ? '创建成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
this.$router.go(-1)
}
})
}
})
},
configFun() {
let params = {}
params.id = this.id
let list = this.choseItemList
for (var i in list) {
params[`list[${i}].serviceQuantity`] = list[i].serviceQuantity
params[`list[${i}].serviceId`] = list[i].serviceId
}
configSetMeal(params).then(res => {
console.log('配置接口', res.data)
})
},
resetForm(formName) {
// this.$refs[formName].resetFields()
this.$router.go(-1)
},
goBack() {
this.$router.go(-1)
},
oninput(value) {
let str = value
let len1 = str.substr(0, 1)
let len2 = str.substr(1, 1) //如果第一位是0,第二位不是点,就用数字把点替换掉
if (str.length > 1 && len1 == 0 && len2 != '.') {
str = str.substr(1, 1)
} //第一位不能是.
if (len1 == '.') {
str = ''
}
if (len1 == '+') {
str = ''
}
if (len1 == '-') {
str = ''
} //限制只能输入一个小数点
if (str.indexOf('.') != -1) {
let str_ = str.substr(str.indexOf('.') + 1)
if (str_.indexOf('.') != -1) {
str = str.substr(0, str.indexOf('.') + str_.indexOf('.') + 1)
}
}
//正则替换
// (/[^\-\d.]/g, ''))"
str = str.replace(/[^\d.^]+/g, '') // 保留数字和小数点
str = str.replace(/^\D*([0-9]\d*\.?\d{0,2})?.*$/, '$1') // 小数点后只能输 2 位
return str
},
handleConfirm() {
var idx = this.allItemList.some(item => item.serviceQuantity > 0)
if (!idx) {
this.$message.error('请选择服务套餐')
return
}
// this.$emit('selectItem', this.allItemList,this.totalPrice);
this.choseItemList = this.allItemList.filter(item => item.serviceQuantity > 0)
this.choseItemList = this.choseItemList.map(ele => {
return {
...ele,
serviceId: ele.id
}
})
this.setmealDialogVisible = false
},
handleClose() {
this.setmealDialogVisible = false
this.totalPrice = 0
this.choseItemList.forEach(item => {
this.totalPrice += item.vipPrice * item.serviceQuantity
})
// this.totalPrice = this.choseItemList.reduce(function(preValue, choseItem) {
// //第二个参数这里是对象,不是number(n)
// return preValue + choseItem.vipPrice * choseItem.serviceQuantity
// }, 0)
this.getSetmealServiceFun()
}
}
}
</script>
<style lang="scss" scoped>
.live-room {
.topMsg {
margin: 20px 40px 0;
padding: 0 20px;
background-color: #fff;
height: 56px;
border-bottom: 1px solid#DCDFE6;
display: flex;
justify-content: space-between;
align-items: center;
.pageTitle {
position: relative;
// margin-bottom: 20px;
// height: 20px;
font-size: 20px;
font-weight: 700;
color: #333333;
line-height: 20px;
letter-spacing: 1px;
}
}
.container {
margin: 0 40px 20px;
position: relative;
min-height: calc(100vh - 300px);
.allChoseWrap {
width: 363px;
min-height: 32px;
margin-top: 10px;
background: #f7f7f7;
border-radius: 4px;
border: 1px solid #dcdfe6;
display: flex;
flex-wrap: wrap;
align-content: flex-start;
padding-top: 5px;
padding-left: 10px;
box-sizing: border-box;
.choseItem {
position: relative;
min-width: 90px;
padding: 0 22px 0 6px;
box-sizing: border-box;
height: 22px;
line-height: 18px;
background: #e6e9ff;
border-radius: 2px;
border: 1px solid #5850ff;
margin-right: 10px;
margin-bottom: 10px;
span {
font-size: 12px;
font-weight: 400;
color: #666666;
}
img {
position: absolute;
top: 5px;
right: 5px;
cursor: pointer;
}
}
}
.totalWrap {
span {
font-size: 14px;
font-weight: 400;
color: #666666;
}
span:last-child {
color: #ff5151;
}
}
}
.footer-panel {
display: flex;
align-items: center;
justify-content: center;
position: fixed;
width: 100%;
bottom: 0px;
height: 64px;
background: #ffffff;
z-index: 999;
box-shadow: 0px -1px 1px 0px rgba(88, 80, 255, 0.1);
}
/deep/.el-dialog__headerbtn {
background-color: #d9e0f5;
width: 25px;
height: 25px;
border-radius: 50%;
.el-dialog__close {
color: #5850ff;
}
}
/deep/ .el-dialog__header .el-dialog__title {
font-size: 16px;
font-weight: 700;
color: #000000;
}
/deep/ .el-dialog__body {
border-top: 1px solid #e6e6e6;
border-bottom: 1px solid #e6e6e6;
padding: 20px 25px;
.content-body {
max-height: 400px;
.subTitle {
margin-bottom: 20px;
span:first-child {
font-size: 16px;
font-weight: 400;
color: #000000;
}
span:last-child {
font-size: 14px;
font-weight: 500;
color: #5850ff;
cursor: pointer;
}
}
.itemWrap {
display: grid;
grid-template-columns: repeat(4, 1fr);
.item {
.itemBox {
margin-bottom: 10px;
width: 240px;
height: 132px;
border-radius: 4px;
border: 2px solid #e6e6e6;
&:hover {
border: 2px solid #5850ff;
cursor: pointer;
}
div {
text-align: center;
margin-bottom: 5px;
}
.name {
margin-top: 15px;
font-size: 18px;
font-weight: 700;
color: #333333;
}
.price {
font-size: 24px;
font-weight: 700;
color: #ff5151;
> span {
font-size: 16px;
}
}
.effectiveRange,
.useTime {
font-size: 12px;
font-weight: 400;
color: #666666;
}
}
.s-checkd {
border: 2px solid #5850ff;
}
.optionBtns {
text-align: center;
margin: 0 0 25px;
width: 240px;
.numWrap {
display: inline-block;
background-color: #fff;
border-radius: 3px;
border: 1px solid #e8e8ea;
min-width: 34px;
height: 22px;
text-align: center;
line-height: 22px;
margin: 0 2px;
padding: 1px 0;
}
.addsubBtn {
background-color: #fff;
color: #5850ff;
padding: 5px 9px;
}
}
}
}
.amountTo {
text-align: center;
.bottomText {
font-size: 16px;
font-weight: 400;
color: #000000;
}
.smallRedText {
font-size: 16px;
color: #ff5151;
}
.redText {
font-size: 24px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #ff5151;
}
}
}
}
/deep/ .el-dialog__footer {
text-align: center;
.el-button + .el-button {
margin-left: 40px;
}
}
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!