Commit 1c063f3f by wangql

111

2 parents ff97316b 8ec9b397
Showing 54 changed files with 5489 additions and 385 deletions
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 \ No newline at end of file
import { http } from '@/main'
const path = 'org.ore.api.one.mass.'
const URL = 'rop-scrm-entmicro/router'
const customerList = params => {
params.type = 1
params.method = `${path}page`
return http({
url: URL,
method: 'GET',
data: params,
sign: true
})
}
const customerGroupList = params => {
params.type = 2
params.method = `${path}page`
return http({
url: URL,
method: 'GET',
data: params,
sign: true
})
}
const insert = params => {
params.method = `${path}insert`
return http({
url: URL,
method: 'POST',
data: params,
sign: true
})
}
const detail = params => {
params.type = 2
params.method = `${path}detail`
return http({
url: URL,
method: 'GET',
data: params,
sign: true
})
}
const remindUserGroup = params => {
params.type = 2
params.method = `${path}remindUserGroup`
return http({
url: URL,
method: 'GET',
data: params,
sign: true
})
}
const listRemindOperate = params => {
params.type = 2
params.method = `${path}listRemindOperate`
return http({
url: URL,
method: 'GET',
data: params,
sign: true
})
}
const listDepartmentTree = params => {
params.method = 'cn.com.glsx.entmicro.department.listDepartmentTree'
return http({
url: URL,
method: 'GET',
data: params,
sign: true
})
}
const querylabeltree = params => {
params.method = 'datahub.api.label.querylabeltree'
return http({
url: '/rop-scrm-datahub/router',
method: 'POST',
data: params,
sign: true
})
}
export default {
customerList,
customerGroupList,
insert,
detail,
remindUserGroup,
listRemindOperate,
listDepartmentTree,
querylabeltree
}
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 \ No newline at end of file
...@@ -76,4 +76,15 @@ const insertOrUpdateProApi = params => { ...@@ -76,4 +76,15 @@ const insertOrUpdateProApi = params => {
}) })
} }
export default { getListApi, getProShareApi, topProApi, updateStatusProApi, deleteTakeProApi, getProInfoApi, insertOrUpdateProApi } const updateTakeProApi = params => {
params.method = `${defaultPath}updateTake`
return http({
url: 'rop-scrm-shopmall/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
export default { getListApi, getProShareApi, topProApi, updateStatusProApi, deleteTakeProApi, getProInfoApi, insertOrUpdateProApi, updateTakeProApi }
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 \ 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 \ No newline at end of file
...@@ -12,4 +12,15 @@ const getListApi = params => { ...@@ -12,4 +12,15 @@ const getListApi = params => {
}) })
} }
export default { getListApi } const takeGookApi = params => {
params.method = `${defaultPath}batchTake`
return http({
url: 'rop-scrm-shopmall/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
export default { getListApi, takeGookApi }
...@@ -75,4 +75,98 @@ const auditStatusList = [{ ...@@ -75,4 +75,98 @@ const auditStatusList = [{
} }
] ]
export { limitPrice, liveStatusList, auditStatusList }
\ No newline at end of file \ 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 \ No newline at end of file
...@@ -170,6 +170,9 @@ export default { ...@@ -170,6 +170,9 @@ export default {
item.keyFn() item.keyFn()
} }
}, },
handleInputBlur(e, item) {
item.inputBlur && item.inputBlur(e, item)
},
// 图片 // 图片
handleUploadChange(e, targetItem) { handleUploadChange(e, targetItem) {
var reader = new FileReader() var reader = new FileReader()
......
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
<slot></slot> <slot></slot>
<div slot="footer"> <div slot="footer">
<slot name="btn-start"></slot> <slot name="btn-start"></slot>
<el-button type="primary" :size="btnSize" @click="handleConfirm">{{ btnOkLabel }}</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">取消</el-button> <el-button v-if="!noCancel" :size="btnSize" @click="handleClose">{{btnCanelLabel}}</el-button>
<slot name="btn-middle"></slot> <slot name="btn-middle"></slot>
</div> </div>
</el-dialog> </el-dialog>
...@@ -42,6 +42,14 @@ export default { ...@@ -42,6 +42,14 @@ export default {
type: String, type: String,
default: '确定' default: '确定'
}, },
btnCancelLabel: {
type: String,
default: '取消'
},
noBtnOk: {
type: Boolean,
default: false
},
noCancel: { noCancel: {
type: Boolean, type: Boolean,
default: false 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>
...@@ -65,6 +65,12 @@ const staticRoutes = Object.freeze([ ...@@ -65,6 +65,12 @@ const staticRoutes = Object.freeze([
meta: {} meta: {}
}, },
{ {
name: 'editProductDh',
path: '/productStore/editProductDh',
component: resolve => require([`@/views/productStore/editProductDh.vue`], resolve),
meta: {}
},
{
name: 'couponManage', name: 'couponManage',
path: '/couponManage/index', path: '/couponManage/index',
component: resolve => require([`@/views/couponManage/index.vue`], resolve), component: resolve => require([`@/views/couponManage/index.vue`], resolve),
...@@ -129,6 +135,60 @@ const staticRoutes = Object.freeze([ ...@@ -129,6 +135,60 @@ const staticRoutes = Object.freeze([
path: '/customerTransform/detaiCustomeGroup', path: '/customerTransform/detaiCustomeGroup',
component: resolve => require([`@/views/customerTransform/detaiCustomeGroup.vue`], resolve), component: resolve => require([`@/views/customerTransform/detaiCustomeGroup.vue`], resolve),
meta: {} 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 default staticRoutes
...@@ -24,7 +24,7 @@ export async function start() { ...@@ -24,7 +24,7 @@ export async function start() {
// .forEach(item => { // .forEach(item => {
// urlParams[item.split('=')[0]] = item.split('=')[1] // urlParams[item.split('=')[0]] = item.split('=')[1]
// }) // })
var token = Object.keys(urlParams).includes('sessionId') ? urlParams.sessionId : '1112223333444' var token = Object.keys(urlParams).includes('sessionId') ? urlParams.sessionId : 'mini-3ab7a37c-3bfa-4a83-bbf8-9e59c6e10330-rop'
Vue.prototype.$http = new Http({ response, request, sign, secret, alert: message.error, headers: { token: token } }) Vue.prototype.$http = new Http({ response, request, sign, secret, alert: message.error, headers: { token: token } })
Vue.use(GLButton, { permissions: ['1-1-1-1', '2-1-1-1', '3-1-1-1'] }) Vue.use(GLButton, { permissions: ['1-1-1-1', '2-1-1-1', '3-1-1-1'] })
render('/', routes) render('/', routes)
......
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 \ No newline at end of file
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
</template> </template>
<script> <script>
import * as dayjs from 'dayjs'
export default { export default {
name: 'classifyList', name: 'classifyList',
data() { data() {
...@@ -67,8 +68,9 @@ export default { ...@@ -67,8 +68,9 @@ export default {
{ {
label: '创建日期', label: '创建日期',
prop: 'createdDate', prop: 'createdDate',
width: '180',
formatter: cellValue => { formatter: cellValue => {
return new Date(cellValue.createdDate).toLocaleDateString().replace(/\//g, '-') return dayjs(cellValue.createdDate).format('YYYY-MM-DD HH:mm:ss')
} }
} }
] ]
......
...@@ -7,37 +7,70 @@ ...@@ -7,37 +7,70 @@
<div class="info-box"> <div class="info-box">
<div class="info-content"> <div class="info-content">
<el-form :model="basicForm" :rules="basicRules" ref="basicForm" label-width="120px"> <el-form :model="basicForm" :rules="basicRules" ref="basicForm" label-width="120px">
<el-form-item label="选择群发账号" prop="groupName"> <el-form-item label="选择群发账号" prop="userList">
<el-button size="small" @click="openMembers"> <el-button size="small" @click="openMembers">
<i class="el-icon-plus"></i> <i class="el-icon-plus"></i>
全部成员 选择成员
</el-button> </el-button>
<span class="label-text">
已选择
<span>{{ basicForm.userList ? basicForm.userList.length : 0 }}</span>
人
</span>
<div class="sale-select" v-show="basicForm.userList">
<div :key="key" class="el-input-tag input-tag-wrapper">
<el-tag v-for="(tag, idx) in basicForm.userList" :key="idx" :size="size" closable :disable-transitions="false" @close="remove(tag)">
{{ tag.staffName }}
</el-tag>
<el-input size="small" style="outline: none; border: none"></el-input>
</div>
</div>
</el-form-item> </el-form-item>
<el-form-item label="选择客户" prop="select"> <el-form-item label="选择客户" prop="selectType">
<el-radio-group v-model="basicForm.radio"> <el-radio-group v-model="basicForm.selectType">
<el-radio :label="1">全部成员</el-radio> <el-radio :label="1">全部成员</el-radio>
<el-radio :label="2">筛选成员</el-radio> <el-radio :label="2">筛选成员</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<div class="filter-box" v-show="basicForm.radio == 2"> <div class="filter-box" v-show="basicForm.selectType == 2">
<div class="filter-memeber"> <div class="filter-memeber">
<el-form-item label="性别"> <el-form :model="basicForm.condition" label-width="120px">
<el-radio-group v-model="basicForm.sex"> <el-form-item label="性别">
<el-radio :label="1">全部</el-radio> <el-radio-group v-model="basicForm.condition.sex">
<el-radio :label="2">男性</el-radio> <el-radio :label="1">全部</el-radio>
<el-radio :label="3">女性</el-radio> <el-radio :label="2">男性</el-radio>
<el-radio :label="4">未知性别</el-radio> <el-radio :label="3">女性</el-radio>
</el-radio-group> <el-radio :label="4">未知性别</el-radio>
</el-form-item> </el-radio-group>
<el-form-item label="所在群聊"> </el-form-item>
<el-select v-model="basicForm.value" multiple collapse-tags placeholder="请选择"> <el-form-item label="所在群聊">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"></el-option> <el-select v-model="basicForm.condition.value" multiple collapse-tags placeholder="请选择">
</el-select> <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-form-item> </el-select>
<el-form-item label="添加客户时间"> </el-form-item>
<el-date-picker v-model="basicForm.date" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" size="small"></el-date-picker> <el-form-item label="添加客户时间">
</el-form-item> <el-date-picker v-model="basicForm.condition.date" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" size="small"></el-date-picker>
<el-form-item label="标签筛选"></el-form-item> </el-form-item>
<el-form-item label="标签筛选">
<el-button size="small" @click="openLabel">
<i class="el-icon-plus"></i>
标签筛选
</el-button>
<!-- <span class="label-text">
已选择
<span>{{ basicForm.userList ? basicForm.userList.length : 0 }}</span>
人
</span> -->
<div class="sale-select" v-show="basicForm.condition.labelList">
<div :key="key" class="el-input-tag input-tag-wrapper">
<el-tag v-for="(tag, idx) in basicForm.condition.labelList" :key="idx" :size="size" closable :disable-transitions="false" @close="remove(tag)">
{{ tag.staffName }}
</el-tag>
<el-input size="small" style="outline: none; border: none"></el-input>
</div>
</div>
</el-form-item>
</el-form>
</div> </div>
<div class="filter-footer"> <div class="filter-footer">
<span>将消息发送给客户符合条件的客户</span> <span>将消息发送给客户符合条件的客户</span>
...@@ -51,7 +84,23 @@ ...@@ -51,7 +84,23 @@
<!-- 编辑入群欢迎语 --> <!-- 编辑入群欢迎语 -->
<div class="title">编辑群发内容</div> <div class="title">编辑群发内容</div>
<div> <div>
<WelcomeWords :eventBus="eventBus"></WelcomeWords> <el-form :model="basicForm" :rules="basicRules" ref="groupForm" label-width="120px">
<el-form-item prop="attachmentList">
<label slot="label" class="required">入群欢迎语</label>
<WelcomeWords ref="welcome" :eventBus="eventBus"></WelcomeWords>
</el-form-item>
<el-form-item label="发送时间" prop="sendType">
<el-radio-group v-model="basicForm.sendType">
<el-radio :label="1">立即发送</el-radio>
<el-radio :label="2">定时发送</el-radio>
</el-radio-group>
<div v-show="basicForm.sendType == 2" class="date-picker">
<el-date-picker v-model="sendTime" size="small" type="date" placeholder="选择日期"></el-date-picker>
-
<el-time-picker v-model="sendDate" size="small" placeholder="选择时间"></el-time-picker>
</div>
</el-form-item>
</el-form>
</div> </div>
</div> </div>
<div class="preview"> <div class="preview">
...@@ -60,7 +109,7 @@ ...@@ -60,7 +109,7 @@
</div> </div>
</div> </div>
<glsx-dialog :title="'选择成员'" :width="'712px'" :isVisible="membersVisible" @confirmDialog="handleConfirm" @closeDialog="membersVisible = !membersVisible"> <glsx-dialog :title="'选择成员'" :width="'712px'" :isVisible="membersVisible" @confirmDialog="handleConfirm" @closeDialog="membersVisible = !membersVisible">
<SelectMembers ref="drawerForm" @closeDrawer="closeDrawer" @handSelectdEmp="handSelectdEmp"></SelectMembers> <SelectMembers ref="membersForm"></SelectMembers>
</glsx-dialog> </glsx-dialog>
</div> </div>
<div <div
...@@ -70,9 +119,10 @@ ...@@ -70,9 +119,10 @@
width: footerWidth + 'px' width: footerWidth + 'px'
}" }"
> >
<el-button type="primary" @click="handleNext">确定</el-button> <el-button type="primary" @click="handleSubmit">确定</el-button>
<el-button type="primary" @click="handleCancel">取消</el-button> <el-button type="primary" @click="handleCancel">取消</el-button>
</div> </div>
<SelectLabel ref="selectLabel" :dialogVisible="dialogVisible"></SelectLabel>
</div> </div>
</template> </template>
...@@ -81,19 +131,72 @@ import Vue from 'vue' ...@@ -81,19 +131,72 @@ import Vue from 'vue'
import WelcomeWords from './components/welcomeWords.vue' import WelcomeWords from './components/welcomeWords.vue'
import SelectMembers from './components/selectMembers.vue' import SelectMembers from './components/selectMembers.vue'
import Preview from './components/preview.vue' import Preview from './components/preview.vue'
import SelectLabel from './components/selectLabel.vue'
export default { export default {
components: { components: {
WelcomeWords, WelcomeWords,
SelectMembers, SelectMembers,
Preview Preview,
SelectLabel
}, },
data() { data() {
const validatorUser = (rule, value, callback) => {
console.log(value)
if (this.$route.params.id == -1) {
if (this.$refs.membersForm.innerTags) this.basicForm.userList = this.$refs.membersForm.innerTags
if (this.basicForm.userList) {
if (this.basicForm.userList.length < 2) {
callback(new Error('至少配置2个及以上成员'))
} else {
callback()
}
} else {
callback(new Error('请选择默认成员'))
}
} else {
if (value) {
if (value.length < 2) {
callback(new Error('至少配置2个及以上成员'))
} else {
callback()
}
} else {
callback(new Error('请选择默认成员'))
}
}
}
const validatorAttachment = (rule, value, callback) => {
const previewList = this.$refs.welcome.previewList
if (previewList.length != 0) {
this.basicForm.attachmentList = previewList
}
console.log(this.basicForm.attachmentList, '---')
if (this.basicForm.attachmentList) {
if (this.basicForm.attachmentList.length > 9) {
callback(new Error('附件不可超过9个'))
} else {
callback()
}
} else {
callback(new Error('请输入入群欢迎语'))
}
}
return { return {
eventBus: new Vue(), eventBus: new Vue(),
basicForm: {}, basicForm: {
condition: {}
},
basicRules: { basicRules: {
name: [{ required: true, message: '请输入组名', trigger: 'blur' }], userList: [
groupName: [{ required: true, message: '请输入群聊名称', trigger: 'blur' }] // { required: true, message: '请选择群发账号', trigger: 'blur' },
{ validator: validatorUser, trigger: 'change' }
],
selectType: [{ required: true, message: '请选择客户类型', trigger: 'change' }],
attachmentList: [
// { required: true, message: '请输入入群欢迎语' },
{ validator: validatorAttachment, trigger: 'change' }
],
sendType: [{ required: true, message: '请选择发送时间', trigger: 'change' }]
}, },
membersVisible: false, membersVisible: false,
options: [ options: [
...@@ -117,7 +220,10 @@ export default { ...@@ -117,7 +220,10 @@ export default {
value: '选项5', value: '选项5',
label: '北京烤鸭' label: '北京烤鸭'
} }
] ],
key: new Date(),
dialogVisible: false,
previewFlag: false
} }
}, },
// mounted() { // mounted() {
...@@ -132,6 +238,50 @@ export default { ...@@ -132,6 +238,50 @@ export default {
}, },
handleCancel() { handleCancel() {
this.$router.go(-1) this.$router.go(-1)
},
// 成员弹窗
handleConfirm() {
console.log(this.$refs.membersForm.innerTags)
this.basicForm.userList = this.$refs.membersForm.innerTags
this.openMembers()
},
remove(val) {
console.log(val, '00000')
this.$refs.membersForm.remove(val)
this.$set(this.basicForm, 'userList', this.$refs.membersForm.innerTags)
this.key = new Date()
},
openLabel() {
console.log(11)
this.dialogVisible = !this.dialogVisible
this.$refs.selectLabel.init()
},
handleSubmit() {
const previewList = this.$refs.welcome.previewList
console.log(111, previewList.length)
this.$refs.groupForm.validate(valid => {
if (valid) {
if (previewList.length == 0) {
this.$set(this, 'previewFlag', true)
return
}
this.previewFlag = false
const params = {
attachmentList: previewList,
selectType: this.basicForm.selectType
}
params.userList = this.basicForm.userList.map(item => {
return {
staffId: item.staffId,
staffName: item.staffName,
departmentName: item.departmentName,
avatar: item.avatar,
delFlag: item.delFlag
}
})
console.log(params)
}
})
} }
} }
} }
...@@ -163,6 +313,9 @@ export default { ...@@ -163,6 +313,9 @@ export default {
.filter-memeber { .filter-memeber {
padding: 20px 0; padding: 20px 0;
border-bottom: 1px solid #dcdfe6; border-bottom: 1px solid #dcdfe6;
.el-form {
padding: 0;
}
} }
.filter-footer { .filter-footer {
display: flex; display: flex;
...@@ -209,4 +362,80 @@ export default { ...@@ -209,4 +362,80 @@ export default {
background: #ffffff; background: #ffffff;
box-shadow: 0px -1px 1px 0px rgba(88, 80, 255, 0.1); box-shadow: 0px -1px 1px 0px rgba(88, 80, 255, 0.1);
} }
.label-text {
margin-left: 10px;
font-size: 14px;
span {
color: #5850ff;
}
}
.sale-select {
display: flex;
align-items: center;
}
.input-tag-wrapper {
max-width: 300px;
position: relative;
font-size: 14px;
background-color: #fff;
background-image: none;
border-radius: 4px;
border: 1px solid #dcdfe6;
box-sizing: border-box;
color: #606266;
display: inline-block;
outline: none;
padding: 0 10px 0 5px;
flex-wrap: wrap;
line-height: 32px;
transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
width: 100%;
display: flex;
align-items: center;
/deep/ input {
/* input { */
/* background-color: red!important; 调试用的样式 */
outline: none !important;
border: none !important;
}
/deep/ .el-input {
min-width: 150px;
width: auto;
flex: 1;
}
}
.el-tag {
margin-right: 4px;
height: 26px;
line-height: 24px;
}
.tag-input {
background: transparent;
border: none !important;
font-size: 14px;
height: 32px;
outline: none;
padding-left: 0;
width: 100px;
}
.form-error {
color: #f56c6c;
font-size: 12px;
margin-left: 186px;
margin-top: 10px;
}
/deep/ {
.el-form-item .el-form-item {
margin-bottom: 22px;
}
.required {
display: inline-block;
line-height: 40px;
}
.required::before {
content: '*';
color: #f56c6c;
margin-right: 4 px;
}
}
</style> </style>
...@@ -10,11 +10,19 @@ ...@@ -10,11 +10,19 @@
<el-form-item label="群聊名称" prop="groupName"> <el-form-item label="群聊名称" prop="groupName">
<el-input v-model="basicForm.groupName" placeholder="群发名称仅内部可见" maxlength="10"></el-input> <el-input v-model="basicForm.groupName" placeholder="群发名称仅内部可见" maxlength="10"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="选择群主" prop="groupName"> <el-form-item label="选择群主" prop="userList">
<el-button size="small" @click="openMembers"> <el-button size="small" @click="openMembers">
<i class="el-icon-plus"></i> <i class="el-icon-plus"></i>
全部账号 全部账号
</el-button> </el-button>
<span>已选择{{ basicForm.userList.length }}人</span>
<div class="sale-select" v-show="basicForm.userList">
<div :key="key" class="el-input-tag input-tag-wrapper">
<el-tag v-for="(tag, idx) in basicForm.userList" :key="idx" closable :disable-transitions="false" @close="remove(tag)">
{{ tag.staffName }}
</el-tag>
</div>
</div>
<div class="form-tips">群主收到通知后,可选择他管理的客户群并群发该内容。</div> <div class="form-tips">群主收到通知后,可选择他管理的客户群并群发该内容。</div>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -41,7 +49,7 @@ ...@@ -41,7 +49,7 @@
<el-button type="primary" @click="handleCancel">取消</el-button> <el-button type="primary" @click="handleCancel">取消</el-button>
</div> </div>
<glsx-dialog :title="'选择成员'" :width="'712px'" :isVisible="membersVisible" @confirmDialog="handleConfirm" @closeDialog="membersVisible = !membersVisible"> <glsx-dialog :title="'选择成员'" :width="'712px'" :isVisible="membersVisible" @confirmDialog="handleConfirm" @closeDialog="membersVisible = !membersVisible">
<SelectMembers ref="drawerForm" @closeDrawer="closeDrawer" @handSelectdEmp="handSelectdEmp"></SelectMembers> <SelectMembers ref="membersForm"></SelectMembers>
</glsx-dialog> </glsx-dialog>
</div> </div>
</template> </template>
...@@ -65,7 +73,8 @@ export default { ...@@ -65,7 +73,8 @@ export default {
name: [{ required: true, message: '请输入组名', trigger: 'blur' }], name: [{ required: true, message: '请输入组名', trigger: 'blur' }],
groupName: [{ required: true, message: '请输入群聊名称', trigger: 'blur' }] groupName: [{ required: true, message: '请输入群聊名称', trigger: 'blur' }]
}, },
membersVisible: false membersVisible: false,
key: new Date()
} }
}, },
// mounted() { // mounted() {
...@@ -80,6 +89,18 @@ export default { ...@@ -80,6 +89,18 @@ export default {
}, },
handleCancel() { handleCancel() {
this.$router.go(-1) this.$router.go(-1)
},
// 成员弹窗
handleConfirm() {
console.log(this.$refs.membersForm.innerTags)
this.basicForm.userList = this.$refs.membersForm.innerTags
this.openMembers()
},
remove(val) {
console.log(val, '00000')
this.$refs.membersForm.remove(val)
this.$set(this.basicForm, 'userList', this.$refs.membersForm.innerTags)
this.key = new Date()
} }
} }
} }
......
...@@ -3,26 +3,30 @@ ...@@ -3,26 +3,30 @@
<div class="preview-content"> <div class="preview-content">
<div class="preview-time">{{ currentTime }}</div> <div class="preview-time">{{ currentTime }}</div>
<div class="preview-info" v-for="item in previewList" :key="item.id"> <div class="preview-info" v-for="item in previewList" :key="item.id">
<img class="avatar" src="../../../assets/logo.png" alt="" /> <img class="avatar" src="@/assets/logo.png" alt="" />
<template v-if="item.type == 'text'"> <template v-if="item.attType == 1">
<div class="preview-text text">{{ item.content }}</div> <div class="preview-text text">{{ item.attContent }}</div>
</template> </template>
<template v-else-if="item.type == 'link'"> <template v-else-if="item.attType == 4">
<div class="preview-text preview-link"> <div class="preview-text preview-link">
{{ item.url }} {{ item.attContent.url }}
<img src="../../../assets/guestCustom/preview-link.png" alt="" /> <img src="@/assets/guestCustom/preview-link.png" alt="" />
</div> </div>
</template> </template>
<template v-else-if="item.type == 'img'"> <template v-else-if="item.attType == 2">
<el-image style="width: 100px" :src="item.url" fit="contain"></el-image> <el-image style="width: 100px" :src="item.attContent" fit="contain"></el-image>
</template> </template>
<template v-else-if="item.type == 'applet'"> <template v-else-if="item.attType == 3">
<!-- <el-image style="width: 100px" :src="item.attContent" fit="contain"></el-image> -->
<video style="width: 100px" :src="item.attContent"></video>
</template>
<template v-else-if="item.attType == 5">
<div class="preview-text text preview-applet"> <div class="preview-text text preview-applet">
<div class="preview-applet-title"> <div class="preview-applet-title">
<img :src="item.appleIcon" alt="" /> <img :src="item.attContent.picUrl" alt="" />
<span>{{ item.title }}</span> <span>{{ item.attContent.title }}</span>
</div> </div>
{{ item.content }} {{ item.attContent.page }}
</div> </div>
</template> </template>
</div> </div>
...@@ -37,7 +41,6 @@ export default { ...@@ -37,7 +41,6 @@ export default {
data() { data() {
return { return {
previewList: [], previewList: [],
currentTime: '' currentTime: ''
} }
}, },
...@@ -48,7 +51,6 @@ export default { ...@@ -48,7 +51,6 @@ export default {
}) })
}, },
mounted() { mounted() {
console.log(1111, this.eventBus)
const date = new Date() const date = new Date()
let hours = date.getHours() let hours = date.getHours()
hours = hours < 10 ? `0${hours}` : hours hours = hours < 10 ? `0${hours}` : hours
...@@ -90,10 +92,11 @@ export default { ...@@ -90,10 +92,11 @@ export default {
} }
.preview-text { .preview-text {
position: relative; position: relative;
max-width: 190px; max-width: 169px;
color: #333; color: #333;
background-color: #fff; background-color: #fff;
border-radius: 4px; border-radius: 4px;
word-wrap: break-word;
} }
.text { .text {
font-size: 16px; font-size: 16px;
......
...@@ -55,7 +55,8 @@ export default { ...@@ -55,7 +55,8 @@ export default {
} }
] ]
}, },
tableEmpData: [] tableEmpData: [],
group: {}
} }
}, },
methods: { methods: {
...@@ -63,7 +64,7 @@ export default { ...@@ -63,7 +64,7 @@ export default {
this.$emit('selectTable', val) this.$emit('selectTable', val)
}, },
listDepartmentTree() { listDepartmentTree() {
this.$apis.emp.listDepartmentTree({ id: 1 }).then(res => { this.$apis.customerTransform.listDepartmentTree({ merchantId: 10001001, addChildrensFlag: true }).then(res => {
this.listTree = res this.listTree = res
this.$nextTick(() => { this.$nextTick(() => {
document.getElementsByClassName('el-tree-node__expand-icon')[0].click() document.getElementsByClassName('el-tree-node__expand-icon')[0].click()
...@@ -72,6 +73,7 @@ export default { ...@@ -72,6 +73,7 @@ export default {
}) })
}, },
clearSelect(row) { clearSelect(row) {
console.log(row, '2222')
this.$refs.saleTable.$refs.salelistMutiTable.toggleRowSelection(row) this.$refs.saleTable.$refs.salelistMutiTable.toggleRowSelection(row)
}, },
clearSelection() { clearSelection() {
...@@ -79,18 +81,19 @@ export default { ...@@ -79,18 +81,19 @@ export default {
}, },
handleNodeClick(data) { handleNodeClick(data) {
this.departmentId = data.id this.departmentId = data.id
this.listEntmicroStaff() this.tableEmpData = data.entmicroStaffResponses
}, // this.listEntmicroStaff()
listEntmicroStaff(staffName) {
let params = {
departmentId: this.departmentId,
staffName: staffName ? staffName : this.staffName,
merchantid: this.$globalState.session.merchantId
}
this.$apis.emp.listEntmicroStaff(params).then(res => {
this.tableEmpData = res
})
} }
// listEntmicroStaff(staffName) {
// let params = {
// departmentId: this.departmentId,
// staffName: staffName ? staffName : this.staffName,
// merchantid: this.$globalState.session.merchantId
// }
// this.$apis.emp.listEntmicroStaff(params).then(res => {
// this.tableEmpData = res
// })
// }
}, },
mounted() { mounted() {
let clientHeight = document.documentElement.clientHeight let clientHeight = document.documentElement.clientHeight
......
<template>
<div class="tag-main">
<el-dialog title="选择标签" :visible.sync="dialogVisible" width="70%" :before-close="handleClose">
<div class="tag-panel">
<div class="tag-panel-select">
<div class="tag-title">预选标签</div>
<div class="tag-select-box">
<div class="tag-box-header">
<el-input size="small" v-model="labelGroupName" placeholder="请输入搜索内容"></el-input>
<el-button size="small" type="primary" @click="handleSearch">查询</el-button>
</div>
<div class="checkbox-group-box" :style="{ 'max-height': heightBox + 'px' }">
<div v-for="(item, index) in labelTreeRets" :key="index">
<span class="el-tree-node__expand-icon el-icon-caret-right" :class="{ expanded: item.checked }" @click="item.checked = !item.checked"></span>
<el-checkbox :indeterminate="item.isIndeterminate" v-model="item.checkAll" @change="handleCheckAllChange(item.checkAll, index)">{{ item.labelGroup.name }}({{ item.tagChecked.length }}/{{ item.labelList.length }} 项)</el-checkbox>
<div style="margin: 15px 0"></div>
<el-checkbox-group class="tag-group" v-model="item.tagChecked" @change="handleCheckedChange(item.tagChecked, index)" v-show="item.checked">
<el-checkbox v-for="(itm, idx) in item.labelList" :label="itm" :key="idx">{{ itm.name }}</el-checkbox>
</el-checkbox-group>
</div>
</div>
</div>
</div>
<div class="tag-panel-selected">
<div class="tag-title">已选标签</div>
<div class="tag-select-box">
<div class="tag-box-header">标签名称({{ selectNum }}项)</div>
<div class="tag-selected-box">
<template v-for="item in labelTreeRets">
<el-tag class="tag-selected-item" v-for="(tag, idx) in item.tagChecked" :key="idx" closable :disable-transitions="false" @close="remove(item, idx)">
{{ tag.name }}
</el-tag>
</template>
</div>
</div>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="dialogVisible = false">取 消</el-button>
<el-button size="small" type="primary" @click="dialogVisible = false">确 定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
export default {
name: 'SelectLabel',
data() {
return {
heightBox: 200,
dialogVisible: false,
labelGroupName: '',
selectNum: 0,
labelTreeRets: [
{
labelGroup: { id: '109', name: '湖口123' },
labelList: [
{ id: '372', name: '12345678' },
{ id: '371', name: '7654321' },
{ id: '370', name: '1234567' }
],
checked: false,
tagChecked: [],
isIndeterminate: false,
checkAll: false
},
{
labelGroup: { id: '65', name: '自店标签111' },
labelList: [
{ id: '179', name: '标签44' },
{ id: '178', name: '标签33' },
{ id: '176', name: '标签1112' }
],
checked: false,
tagChecked: [],
isIndeterminate: false,
checkAll: false
}
]
}
},
watch: {
labelTreeRets: {
handler() {
this.selectNum = 0
this.labelTreeRets.forEach(item => {
this.selectNum += item.tagChecked.length
})
},
deep: true
}
},
methods: {
init() {
this.dialogVisible = true
this.querylabeltree()
},
handleSearch() {
this.querylabeltree()
},
querylabeltree() {
this.$apis.customerTransform
.querylabeltree({
labelTreeReq: {
pageNum: 1,
pageSize: 1000,
shopId: this.$globalState.session.merchantId,
labelGroupName: this.labelGroupName
}
})
.then(res => {
console.log(res)
this.labelTreeRets = res.labelTreeRets.map(item => {
return {
labelGroup: item.labelGroup,
labelList: item.labelList,
checked: false,
tagChecked: [],
isIndeterminate: false,
checkAll: false
}
})
})
},
remove(item, idx) {
item.tagChecked.splice(idx, 1)
if (item.tagChecked.length == 0) item.checkAll = false
},
//全选
handleCheckAllChange(val, index) {
if (val) {
this.labelTreeRets[index].tagChecked = []
for (let i in this.labelTreeRets[index].labelList) {
this.labelTreeRets[index].tagChecked.push(this.labelTreeRets[index].labelList[i])
}
} else {
this.labelTreeRets[index].tagChecked = []
}
this.labelTreeRets[index].isIndeterminate = false
},
//选中
handleCheckedChange(value, index) {
let checkedCount = value.length
this.labelTreeRets[index].checkAll = checkedCount === this.labelTreeRets[index].labelList.length
this.labelTreeRets[index].isIndeterminate = checkedCount > 0 && checkedCount < this.labelTreeRets[index].labelList.length
}
},
mounted() {
let clientHeight = document.documentElement.clientHeight
this.heightBox = clientHeight - 0.15 * clientHeight - 300
}
}
</script>
<style lang="scss" scoped>
.tag-panel {
display: flex;
.tag-panel-select {
width: 60%;
/deep/ {
.el-checkbox__label {
width: 100%;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
word-wrap: break-word;
}
}
}
.tag-panel-selected {
width: 40%;
margin-left: 10px;
.tag-box-header {
font-size: 14px;
font-weight: 400;
color: #333333;
line-height: 20px;
padding-left: 20px !important;
}
}
.tag-title {
font-size: 16px;
font-weight: 400;
color: #333333;
line-height: 22px;
}
.tag-select-box {
margin-top: 10px;
border-radius: 2px;
border: 1px solid #eeeeee;
padding: 6px;
.tag-box-header {
box-sizing: border-box;
display: flex;
height: 56px;
align-items: center;
border-bottom: 1px solid #eeeeee;
margin: -6px;
margin-bottom: 10px;
padding: 0px 6px;
/deep/ {
.el-input {
width: 60%;
margin-right: 10px;
}
}
}
.tag-selected-item {
margin: 0px 6px 6px 0px;
height: 26px;
line-height: 22px;
}
.el-tree-node__expand-icon {
color: #5850ff;
font-size: 16px;
}
.tag-group {
margin-left: 40px;
.el-checkbox {
width: 40%;
margin-bottom: 6px;
display: flex;
align-items: center;
}
}
}
}
.checkbox-group-box {
overflow: auto;
}
.tag-selected-box {
min-height: 200px;
}
</style>
\ No newline at end of file \ No newline at end of file
...@@ -13,28 +13,11 @@ ...@@ -13,28 +13,11 @@
</div> </div>
<div> <div>
<div class="select-sale-panel"> <div class="select-sale-panel">
<select-emp @selectTable="selectTable" ref="selectEmpTabel"></select-emp> <select-emp @group="handlGroup" @selectTable="selectTable" ref="selectEmpTabel"></select-emp>
<div class="popper__arrow"></div> <div class="popper__arrow"></div>
</div> </div>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="请选择跟进员工类型">
<div class="emp-type">
<div @click="handleType(index)" :class="{ checked: typeIndex == index }" class="emp-type-btn" v-for="(item, index) in empType" :key="index">
{{ item.followName }}
<i class="el-icon-error" @click="delEmpType(item, index)" v-if="!item.commonFlag"></i>
</div>
</div>
<div class="sale-select">
<el-input size="small" v-model="empTypeValue" placeholder="添加类型名称" maxlength="8" show-word-limit></el-input>
<div><el-button size="small" class="sale-select-btn" type="primary" @click="addEmpType">新增</el-button></div>
</div>
<div class="sale-type-desc">跟进员工类型最多新增30个,已新增{{ empType.length - 3 }}个</div>
</el-form-item>
<!-- <el-form-item style="text-align: center">
<el-button @click="onCancel" size="small">取消</el-button>
<el-button type="primary" @click="onSubmit" size="small">确定</el-button>
</el-form-item> -->
</el-form> </el-form>
</div> </div>
</template> </template>
...@@ -50,7 +33,7 @@ export default { ...@@ -50,7 +33,7 @@ export default {
addForm: {}, addForm: {},
typeIndex: 0, typeIndex: 0,
empType: [], empType: [],
empTypeValue: '', // empTypeValue: '',
newTag: '', newTag: '',
innerTags: [], innerTags: [],
dialog_temp: {} dialog_temp: {}
...@@ -69,14 +52,6 @@ export default { ...@@ -69,14 +52,6 @@ export default {
selectTable(val) { selectTable(val) {
this.innerTags = val this.innerTags = val
}, },
listEntFollowerType() {
this.$apis.emp.listEntFollowerType({ merchantId: this.$globalState.session.merchantId }).then(res => {
this.empType = res
})
},
handleType(index) {
this.typeIndex = index
},
foucusTagInput() { foucusTagInput() {
if (this.readOnly || !this.$el.querySelector('.tag-input')) { if (this.readOnly || !this.$el.querySelector('.tag-input')) {
return return
...@@ -85,58 +60,34 @@ export default { ...@@ -85,58 +60,34 @@ export default {
} }
}, },
remove(row) { remove(row) {
console.log(row, '111')
this.$refs.selectEmpTabel.clearSelect(row) this.$refs.selectEmpTabel.clearSelect(row)
}, },
//查询 //查询
searchEmp() { searchEmp() {
this.$refs.selectEmpTabel.listEntmicroStaff(this.newTag) this.$refs.selectEmpTabel.listDepartmentTree(this.newTag)
}, },
addEmpType() { onSubmit() {
if (!this.empTypeValue) { if (this.innerTags.length == 0) {
this.$message.error('请输入类型名称') this.$message({
return message: '请选择成员',
} type: 'error'
if (this.empType.length == 33) { })
this.$message.error('跟进员工类型最多新增30个')
return return
} }
let params = { let userIds = []
followName: this.empTypeValue, this.innerTags.forEach(item => {
merchantid: this.$globalState.session.merchantId userIds.push(item.userId)
}
this.$apis.emp.saveFollowerType(params).then(res => {
this.listEntFollowerType()
})
this.empTypeValue = ''
},
delEmpType(item, index) {
this.$apis.emp.deleteFollowerType({ id: item.id }).then(res => {
if (res) {
this.listEntFollowerType()
this.typeIndex = 0
}
}) })
// this.$emit('handSelectdEmp', this.empType[this.typeIndex].id, userIds)
} }
// onSubmit() {
// if (this.innerTags.length == 0) {
// this.$message({
// message: '请选择员工',
// type: 'error'
// })
// return
// }
// let userIds = []
// this.innerTags.forEach(item => {
// userIds.push(item.userId)
// })
// this.$emit('handSelectdEmp', this.empType[this.typeIndex].id, userIds)
// },
// onCancel() { // onCancel() {
// this.$emit('closeDrawer') // this.$emit('closeDrawer')
// } // }
}, },
mounted() { mounted() {
this.listEntFollowerType() console.log(111)
// this.listEntFollowerType()
} }
} }
</script> </script>
......
<template> <template>
<div class="welcome-box"> <div class="welcome-box">
<div class="required">入群欢迎语</div> <!-- <div class="required">入群欢迎语</div> -->
<div class="content content-bg"> <div class="content">
<el-input type="textarea" :rows="9" maxlength="600" show-word-limit v-model="guestForm.name" placeholder="请输入内容"></el-input> <div class="content-bg">
<div> <el-input type="textarea" :rows="9" maxlength="600" show-word-limit v-model="guestForm.name" @input="textInput" placeholder="请输入内容"></el-input>
<div class="welcome-file" v-for="(itm, index) in previewList" :key="itm.id"> <div v-for="itm in previewList" :key="itm.id">
<template v-if="itm.type == 'img'"> <div class="welcome-file" v-if="itm.attType != 1">
<img src="../../../assets/guestCustom/icon-img.png" alt="" /> <template v-if="itm.attType == 2">
<span>{{ itm.name }}</span> <img src="@/assets/guestCustom/icon-img.png" alt="" />
</template> <span>{{ itm.attContent }}</span>
<template v-else-if="itm.type == 'link'"> </template>
<img src="../../../assets/guestCustom/icon-link.png" alt="" /> <template v-else-if="itm.attType == 3">
<span>{{ itm.url }}</span> <img src="@/assets/guestCustom/icon-img.png" alt="" />
</template> <span>{{ itm.attContent }}</span>
<template v-else-if="itm.type == 'applet'"> </template>
<img src="../../../assets/guestCustom/icon-applet.png" alt="" /> <template v-else-if="itm.attType == 4">
<span>{{ itm.title }}</span> <img src="@/assets/guestCustom/icon-link.png" alt="" />
</template> <span>{{ itm.attContent.url }}</span>
<i class="el-icon-circle-close" @click="close(index)"></i> </template>
<template v-else-if="itm.attType == 5">
<img src="@/assets/guestCustom/icon-applet.png" alt="" />
<span>{{ itm.attContent.title }}</span>
</template>
<i class="el-icon-circle-close" @click="close(index)"></i>
</div>
</div> </div>
</div> <div class="btn-group">
<div class="btn-group"> <div class="add-btn" v-for="item in btnList" :key="item.id">
<div class="add-btn" v-for="item in btnList" :key="item.id"> <i class="el-icon-circle-plus-outline"></i>
<i class="el-icon-circle-plus-outline"></i> <span>{{ item.name }}</span>
<span>{{ item.name }}</span> <!-- <div id="video"></div> -->
<input v-if="item.type == 'img'" type="file" style="opacity: 0" :id="item.name + 'file'" ref="file" class="welcome-input" :accept="item.accept || 'image/png, image/jpeg, image/jpg'" @change="e => handleImgChange(e, item)" /> <input v-if="item.type == 'img'" type="file" style="opacity: 0" :id="item.name + 'file'" ref="file" class="welcome-input" :accept="item.accept || 'image/png, image/jpeg, image/jpg'" @change="e => handleImgChange(e, item)" />
<el-link v-if="item.type == 'popup'" style="opacity: 0" @click="switchDailog(item.funName)">{{ item.name }}</el-link> <input v-if="item.type == 'video'" type="file" style="opacity: 0" :id="item.name + 'file'" ref="file" class="welcome-input" :accept="item.accept || 'video/*'" @change="e => handleVideoChange(e, item)" />
<el-link v-if="item.type == 'popup'" style="opacity: 0" @click="switchDailog(item.funName)">{{ item.name }}</el-link>
</div>
</div> </div>
</div> </div>
<div class="tips-text"> <div class="tips-text">
...@@ -33,46 +41,50 @@ ...@@ -33,46 +41,50 @@
<span>客户每个月最多接收来自同一企业的管理员的 4 条群发消息,4条消息可在同一天发送,达到上限后,无法再接收管理员的群发消息。</span> <span>客户每个月最多接收来自同一企业的管理员的 4 条群发消息,4条消息可在同一天发送,达到上限后,无法再接收管理员的群发消息。</span>
</div> </div>
</div> </div>
<div class="required">发送时间</div> <!-- <div class="required">发送时间</div>
<div class="content"> <div class="content">
<el-radio-group v-model="radio"> <el-radio-group v-model="sendType">
<el-radio :label="1">立即发送</el-radio> <el-radio :label="1">立即发送</el-radio>
<el-radio :label="2">定时发送</el-radio> <el-radio :label="2">定时发送</el-radio>
</el-radio-group> </el-radio-group>
<div v-show="radio == 2" class="date-picker"> <div v-show="sendType == 2" class="date-picker">
<el-date-picker v-model="value1" size="small" type="date" placeholder="选择日期"></el-date-picker> <el-date-picker v-model="sendTime" size="small" type="date" placeholder="选择日期"></el-date-picker>
- -
<el-time-picker v-model="value2" size="small" placeholder="选择时间"></el-time-picker> <el-time-picker v-model="sendDate" size="small" placeholder="选择时间"></el-time-picker>
</div> </div>
</div> </div> -->
<glsx-dialog :title="dialogTitle" :width="'712px'" :isVisible="dialogVisible" @confirmDialog="handleConfirm" @closeDialog="dialogVisible = !dialogVisible"> <glsx-dialog :title="dialogTitle" :width="'712px'" :isVisible="dialogVisible" @confirmDialog="handleConfirm" @closeDialog="dialogVisible = !dialogVisible">
<slot> <slot>
<el-form v-if="dialogTitle == '添加网页消息'" :model="linkForm" :rules="linkRules" ref="linkForm" label-width="120px"> <el-form v-if="dialogTitle == '添加网页消息'" :model="linkForm" :rules="linkRules" ref="linkForm" label-width="120px">
<el-form-item label="网页标题" prop="name"> <el-form-item label="网页标题" prop="title">
<el-input v-model="linkForm.name" placeholder="请输入网页标题"></el-input> <el-input v-model="linkForm.title" placeholder="请输入网页标题"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="添加网页链接" prop="link"> <el-form-item label="添加网页链接" prop="url">
<el-input v-model="linkForm.link" placeholder="以http或https开头"></el-input> <el-input v-model="linkForm.url" placeholder="以http或https开头"></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-form v-else-if="dialogTitle == '添加小程序'" :model="appletForm" :rules="appletRules" ref="appletForm" label-width="120px"> <el-form v-else-if="dialogTitle == '添加小程序'" :model="appletForm" :rules="appletRules" ref="appletForm" label-width="120px">
<el-form-item label="小程序标题" prop="name"> <el-form-item label="小程序标题" prop="title">
<el-input v-model="appletForm.name" placeholder="请输入小程序标题"></el-input> <el-input v-model="appletForm.title" placeholder="请输入小程序标题"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="小程序appID" prop="link"> <el-form-item label="小程序appID" prop="appid">
<el-input v-model="appletForm.link" placeholder="请输入小程序appID"></el-input> <el-input v-model="appletForm.appid" placeholder="请输入小程序appID"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="小程序路径" prop="link"> <el-form-item label="小程序路径" prop="page">
<el-input v-model="appletForm.url" placeholder="请输入小程序路径"></el-input> <el-input v-model="appletForm.page" placeholder="请输入小程序路径"></el-input>
<div class="form-tips">注意:小程序路径以html作为后缀</div> <div class="form-tips">注意:小程序路径以html作为后缀</div>
</el-form-item> </el-form-item>
<el-form-item label="小程序路径" prop="link"> <el-form-item label="小程序封面" prop="page">
<div class="upload-bg"> <div class="upload">
<i class="el-icon-circle-plus"></i> <div v-show="!appletForm.picUrl" class="upload-bg">
<div>上传封面</div> <i class="el-icon-circle-plus"></i>
<div class="upload-text">上传封面</div>
</div>
<input type="file" style="opacity: 0" ref="file" class="form-upload img-w-h" accept="image/png, image/jpeg, image/gif, image/jpg" @change="handleImg" /> <input type="file" style="opacity: 0" ref="file" class="form-upload img-w-h" accept="image/png, image/jpeg, image/gif, image/jpg" @change="handleImg" />
<el-image v-show="appletForm.picUrl" style="width: 140px" :src="appletForm.picUrl" fit="contain"></el-image>
</div> </div>
<div class="form-tips">建议图片大小在2M以内,建议尺寸:352*282px</div> <div class="form-tips">建议图片大小在2M以内,建议尺寸:352*282px</div>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -80,8 +92,15 @@ ...@@ -80,8 +92,15 @@
</glsx-dialog> </glsx-dialog>
</div> </div>
</template> </template>
<script> <script>
const ATT_TYPE = {
TEXT: 1,
IMAGE: 2,
VEDIO: 3,
URL: 4,
MINIPROGRAM: 5,
FILE: 6
}
export default { export default {
name: 'WelcomeWords', name: 'WelcomeWords',
props: { eventBus: Object }, props: { eventBus: Object },
...@@ -99,8 +118,7 @@ export default { ...@@ -99,8 +118,7 @@ export default {
id: 2, id: 2,
name: '视频', name: '视频',
funcName: '', funcName: '',
type: 'img', type: 'video',
accept: 'video/*',
limitSize: 10 limitSize: 10
}, },
{ {
...@@ -121,73 +139,24 @@ export default { ...@@ -121,73 +139,24 @@ export default {
dialogVisible: false, dialogVisible: false,
linkForm: {}, linkForm: {},
linkRules: { linkRules: {
name: [{ required: true, message: '请输入网页标题', trigger: 'blur' }], title: [{ required: true, message: '请输入网页标题', trigger: 'blur' }],
link: [{ required: true, message: '请输入网页链接', trigger: 'blur' }] url: [{ required: true, message: '请输入网页链接', trigger: 'blur' }]
}, },
appletForm: {}, appletForm: {},
appletRules: { appletRules: {
name: [{ required: true, message: '请输入网页标题', trigger: 'blur' }], title: [{ required: true, message: '请输入网页标题', trigger: 'blur' }],
link: [{ required: true, message: '请输入网页链接', trigger: 'blur' }], appid: [{ required: true, message: '请输入网页链接', trigger: 'blur' }],
url: [{ required: true, message: '请输入小程序路径', trigger: 'blur' }] page: [{ required: true, message: '请输入小程序路径', trigger: 'blur' }]
}, },
previewList: [ previewList: [],
{ sendType: '',
id: 1, sendTime: '',
type: 'text', sendDate: ''
content: 'fasf'
},
{
id: 2,
type: 'link',
url: 'https://baidu.comdfasdfasdfa'
},
{
id: 3,
type: 'img',
name: 'hdjkashfajk',
url: 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fhbimg.b0.upaiyun.com%2F945cad7c7105d352aa3c513c94846bb0c2f1a61342067-OWFZcE_fw658&refer=http%3A%2F%2Fhbimg.b0.upaiyun.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1639018450&t=a60f5defc48c980674edcf9a8d5981df'
},
{
id: 4,
type: 'applet',
appleIcon: '../../../assets/logo.png',
title: '我的智慧门店',
content: '我的智慧门店'
},
{
id: 5,
type: 'text',
content: 'fasf'
},
{
id: 6,
type: 'text',
content: 'fasf'
},
{
id: 7,
type: 'text',
content: 'fasf'
},
{
id: 8,
type: 'text',
content: 'fasf'
},
{
id: 9,
type: 'text',
content: 'fasf'
}
],
radio: '',
value1: '',
value2: ''
} }
}, },
mounted() { mounted() {
console.log(this.previewList)
this.eventBus.$emit('update', this.previewList) this.eventBus.$emit('update', this.previewList)
// obj.init('video')
}, },
methods: { methods: {
handleImgChange(e, targetItem) { handleImgChange(e, targetItem) {
...@@ -195,7 +164,7 @@ export default { ...@@ -195,7 +164,7 @@ export default {
var reader = new FileReader() var reader = new FileReader()
var file = e.srcElement.files[0] var file = e.srcElement.files[0]
console.log(file) console.log(file)
// // 默认1MB // 默认1MB
const limitSize = targetItem.limitSize || 1 const limitSize = targetItem.limitSize || 1
const isLt = file.size / 1024 / 1024 < limitSize const isLt = file.size / 1024 / 1024 < limitSize
if (!isLt) { if (!isLt) {
...@@ -213,13 +182,68 @@ export default { ...@@ -213,13 +182,68 @@ export default {
this.$apis.common.pictureUpload({ file: base64 }).then(res => { this.$apis.common.pictureUpload({ file: base64 }).then(res => {
if (res) { if (res) {
console.log(res) console.log(res)
this.previewList.push({
attType: ATT_TYPE.IMAGE,
attContent: res
})
}
})
}
}
},
handleVideoChange(e, targetItem) {
var file = e.srcElement.files[0]
var reader = new FileReader()
// 默认1MB
const limitSize = targetItem.limitSize || 1
const isLt = file.size / 1024 / 1024 < limitSize
if (!isLt) {
this.$message.error('上传视频大小不能超过' + limitSize + 'MB!')
return true
}
reader.readAsDataURL(file)
reader.onload = e => {
const imgFile = e.target.result
const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1]
this.$apis.common.pictureUpload({ file: base64 }).then(res => {
if (res) {
console.log(res)
this.previewList.push({
attType: ATT_TYPE.VEDIO,
attContent: res
})
}
})
}
},
handleImg(e) {
var reader = new FileReader()
var file = e.srcElement.files[0]
console.log(file)
// 默认1MB
const limitSize = 10
const isLt = file.size / 1024 / 1024 < limitSize
if (!isLt) {
this.$message.error('上传图片大小不能超过' + limitSize + 'MB!')
return true
}
reader.readAsDataURL(file)
reader.onload = e => {
var image = new Image()
image.src = e.target.result
image.onload = () => {
const imgFile = e.target.result
const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1]
this.$apis.common.pictureUpload({ file: base64 }).then(res => {
if (res) {
console.log(res)
this.$set(this.appletForm, 'picUrl', res)
// this.appletForm.picUrl = res
} }
}) })
} }
} }
this.guestForm.imgUrl = 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fhbimg.b0.upaiyun.com%2F945cad7c7105d352aa3c513c94846bb0c2f1a61342067-OWFZcE_fw658&refer=http%3A%2F%2Fhbimg.b0.upaiyun.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1639018450&t=a60f5defc48c980674edcf9a8d5981df'
}, },
handleImg(e) {},
switchDailog(funName) { switchDailog(funName) {
console.log(funName) console.log(funName)
if (funName == 'link') { if (funName == 'link') {
...@@ -235,7 +259,12 @@ export default { ...@@ -235,7 +259,12 @@ export default {
case '添加网页消息': case '添加网页消息':
this.$refs.linkForm.validate(valid => { this.$refs.linkForm.validate(valid => {
if (valid) { if (valid) {
alert('submit!') console.log(this.linkForm)
this.previewList.push({
attType: ATT_TYPE.URL,
attContent: this.linkForm
})
this.dialogVisible = !this.dialogVisible
} else { } else {
console.log('error submit!!') console.log('error submit!!')
return false return false
...@@ -245,7 +274,12 @@ export default { ...@@ -245,7 +274,12 @@ export default {
case '添加小程序': case '添加小程序':
this.$refs.appletForm.validate(valid => { this.$refs.appletForm.validate(valid => {
if (valid) { if (valid) {
alert('submit!') console.log(this.appletForm)
this.previewList.push({
attType: ATT_TYPE.MINIPROGRAM,
attContent: this.appletForm
})
this.dialogVisible = !this.dialogVisible
} else { } else {
console.log('error submit!!') console.log('error submit!!')
return false return false
...@@ -259,6 +293,23 @@ export default { ...@@ -259,6 +293,23 @@ export default {
close(index) { close(index) {
this.previewList.splice(index, 1) this.previewList.splice(index, 1)
this.eventBus.$emit('update', this.previewList) this.eventBus.$emit('update', this.previewList)
},
textInput(val) {
console.log(val)
const hasText = this.previewList.some(item => item.attType == 1)
console.log(hasText)
if (hasText) {
this.$set(this.previewList, 0, {
attContent: val,
attType: ATT_TYPE.TEXT
})
} else {
this.previewList.unshift({
attContent: val,
attType: ATT_TYPE.TEXT
})
}
console.log(this.previewList)
} }
} }
} }
...@@ -266,8 +317,6 @@ export default { ...@@ -266,8 +317,6 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.welcome-box { .welcome-box {
padding-top: 20px;
margin-left: 87px;
} }
.content-bg { .content-bg {
background-color: #f7f7f7; background-color: #f7f7f7;
...@@ -357,9 +406,12 @@ export default { ...@@ -357,9 +406,12 @@ export default {
} }
.form-upload { .form-upload {
position: absolute; position: absolute;
width: 100%; top: 0;
width: 140px;
// width: 100%;
height: 100%; height: 100%;
cursor: pointer; cursor: pointer;
z-index: 1;
} }
/deep/ { /deep/ {
.el-textarea__inner { .el-textarea__inner {
...@@ -373,6 +425,9 @@ export default { ...@@ -373,6 +425,9 @@ export default {
background-color: #f7f7f7; background-color: #f7f7f7;
} }
} }
.upload {
position: relative;
}
.upload-bg { .upload-bg {
position: relative; position: relative;
width: 140px; width: 140px;
...@@ -387,7 +442,7 @@ export default { ...@@ -387,7 +442,7 @@ export default {
transform: translateX(-50%); transform: translateX(-50%);
font-size: 30px; font-size: 30px;
} }
div { .upload-text {
position: absolute; position: absolute;
bottom: 40px; bottom: 40px;
left: 50%; left: 50%;
...@@ -397,7 +452,7 @@ export default { ...@@ -397,7 +452,7 @@ export default {
} }
.tips-text { .tips-text {
display: flex; display: flex;
align-self: center; align-items: center;
justify-self: center; justify-self: center;
color: #000; color: #000;
font-size: 14px; font-size: 14px;
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<el-button type="primary" icon="el-icon-plus" @click="btnClick('create', 1)">新建群发</el-button> <el-button type="primary" icon="el-icon-plus" @click="btnClick('create', 1)">新建群发</el-button>
</div> </div>
<!-- 表格区域 开始 --> <!-- 表格区域 开始 -->
<GLTable ref="gueast" :tableData="gueastTableData" :tableParams="gueastTableParams" :pageConf="gueastPageConf"> <GLTable ref="gueast" :getListApi="customerList" :tableParams="gueastTableParams" :pageConf="gueastPageConf">
<!-- <div slot="entmicro-name" class="entmicro" slot-scope="scope"> <!-- <div slot="entmicro-name" class="entmicro" slot-scope="scope">
<span v-for="(i, index) in scope.scope.userList" :key="index">{{ i.name }}({{ i.tips }});</span> <span v-for="(i, index) in scope.scope.userList" :key="index">{{ i.name }}({{ i.tips }});</span>
</div> --> </div> -->
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
<el-button type="primary" icon="el-icon-plus" @click="btnClick('create', 2)">新建群发</el-button> <el-button type="primary" icon="el-icon-plus" @click="btnClick('create', 2)">新建群发</el-button>
</div> </div>
<!-- 表格区域 开始 --> <!-- 表格区域 开始 -->
<GLTable ref="gueast" :tableData="gueastTableData" :tableParams="gueastGroupTableParams" :pageConf="gueastPageConf"> <GLTable ref="gueast" :getListApi="customerGroupList" :tableParams="gueastGroupTableParams" :pageConf="gueastPageConf">
<!-- <div slot="entmicro-name" class="entmicro" slot-scope="scope"> <!-- <div slot="entmicro-name" class="entmicro" slot-scope="scope">
<span v-for="(i, index) in scope.scope.userList" :key="index">{{ i.name }}({{ i.tips }});</span> <span v-for="(i, index) in scope.scope.userList" :key="index">{{ i.name }}({{ i.tips }});</span>
</div> --> </div> -->
...@@ -102,32 +102,8 @@ export default { ...@@ -102,32 +102,8 @@ export default {
] ]
}, },
gueastPageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' }, gueastPageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' },
gueastTableData: [ customerList: this.$apis.customerTransform.customerList,
{ customerGroupList: this.$apis.customerTransform.customerGroupList,
id: 1,
massName: '守候专用服务一组dfajkfhakjdfhak[土盘]',
sendTime: '2021-11-05',
name: '群发任务命名',
sendType: 1,
sendUserNum: 1,
sendCustomerNum: 1,
unsendUserNum: 2,
unsendCustomerNum: 3,
isRemind: 1 // 1已提醒2 未提醒
},
{
id: 2,
massName: '守候专用服务一组dfajkfhakjdfhak[土盘]',
sendTime: '2021-11-05',
name: '群发任务命名',
sendType: 1,
sendUserNum: 1,
sendCustomerNum: 1,
unsendUserNum: 2,
unsendCustomerNum: 3,
isRemind: 2 // 1已提醒2 未提醒
}
],
gueastGroupTableParams: { gueastGroupTableParams: {
listName: 'data', listName: 'data',
tableOption: false, tableOption: false,
......
...@@ -150,29 +150,29 @@ export default { ...@@ -150,29 +150,29 @@ export default {
maxlength: '50' maxlength: '50'
} }
] ]
},
{
title: '新车优惠政策',
editFormData: [
{
label: '优惠政策',
name: 'police',
type: 'input',
inputType: 'textarea',
width: '320px',
maxlength: '300'
}
]
},
{
title: '在线客服',
editFormData: [
{
label: '',
addHtml: 'onlineService'
}
]
} }
// {
// title: '新车优惠政策',
// editFormData: [
// {
// label: '优惠政策',
// name: 'police',
// type: 'input',
// inputType: 'textarea',
// width: '320px',
// maxlength: '300'
// }
// ]
// },
// {
// title: '在线客服',
// editFormData: [
// {
// label: '',
// addHtml: 'onlineService'
// }
// ]
// }
] ]
} }
}, },
......
<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>
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
</template> </template>
<script> <script>
import * as dayjs from 'dayjs'
export default { export default {
name: 'orderManage', name: 'orderManage',
data() { data() {
...@@ -68,7 +69,7 @@ export default { ...@@ -68,7 +69,7 @@ export default {
label: '创建日期', label: '创建日期',
prop: 'createdDate', prop: 'createdDate',
formatter: cellValue => { formatter: cellValue => {
return new Date(cellValue.createdDate).toLocaleDateString().replace(/\//g, '-') return dayjs(cellValue.createdDate).format('YYYY-MM-DD HH:mm:ss')
} }
} }
] ]
......
...@@ -53,6 +53,7 @@ export default { ...@@ -53,6 +53,7 @@ export default {
editRule: { editRule: {
shareContent: [{ required: true, message: '请输入专区名称', trigger: 'change' }], shareContent: [{ required: true, message: '请输入专区名称', trigger: 'change' }],
zoneId: [{ required: true, message: '请选择发现频道', trigger: 'change' }], zoneId: [{ required: true, message: '请选择发现频道', trigger: 'change' }],
videoUrl: [{ required: true, message: '请上传视频', trigger: 'change' }],
imgUrls: [{ required: true, message: '请上传照片', trigger: 'change' }], imgUrls: [{ required: true, message: '请上传照片', trigger: 'change' }],
relatePro: [{ required: true, message: '请选择关联商品', trigger: 'change' }], relatePro: [{ required: true, message: '请选择关联商品', trigger: 'change' }],
goodsId: [{ required: false, message: '请选择关联的商品', trigger: 'change' }] goodsId: [{ required: false, message: '请选择关联的商品', trigger: 'change' }]
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
</template> </template>
<script> <script>
import * as dayjs from 'dayjs'
export default { export default {
name: 'orderShare', name: 'orderShare',
data() { data() {
...@@ -78,8 +79,9 @@ export default { ...@@ -78,8 +79,9 @@ export default {
{ {
label: '创建日期', label: '创建日期',
prop: 'createdDate', prop: 'createdDate',
width: '180',
formatter: cellValue => { formatter: cellValue => {
return new Date(cellValue.createdDate).toLocaleDateString().replace(/\//g, '-') return dayjs(cellValue.createdDate).format('YYYY-MM-DD HH:mm:ss')
} }
}, },
{ {
...@@ -125,7 +127,7 @@ export default { ...@@ -125,7 +127,7 @@ export default {
}, },
mounted() { mounted() {
this.getOptionsList('searchFormData',) this.getOptionsList('searchFormData')
}, },
methods: { methods: {
......
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
<p class="edit-sub-title">{{ item.title }}</p> <p class="edit-sub-title">{{ item.title }}</p>
<glsx-combi-form class="edit-form-container" ref="editFormRef" :labelWidth="labelWidth" :isBlock="true" :formRef="item.editChildRef" :formObj="editForm" :formData="item.editFormData" :formRules="item.editRule"> <glsx-combi-form class="edit-form-container" ref="editFormRef" :labelWidth="labelWidth" :isBlock="true" :formRef="item.editChildRef" :formObj="editForm" :formData="item.editFormData" :formRules="item.editRule">
<template slot="describeBtn"> <template slot="describeBtn">
<el-button :disabled="routeInfo.addOrEdit == 3" type="primary" @click="handleDescribeImgAdd">添加图片</el-button> <el-button :disabled="isDisabled" type="primary" @click="handleDescribeImgAdd">添加图片</el-button>
</template> </template>
<div :style="{ 'margin-left': labelWidth }" slot="descImgs" slot-scope="scope"> <div :style="{ 'margin-left': labelWidth }" slot="descImgs" slot-scope="scope">
<div v-for="(subItem, subIndex) in editForm[scope.scope.name]" :key="subIndex" class="flex"> <div v-for="(subItem, subIndex) in editForm[scope.scope.name]" :key="subIndex" class="flex">
...@@ -97,15 +97,15 @@ ...@@ -97,15 +97,15 @@
</div> </div>
</div> </div>
<template slot="proSpecsBtn"> <template slot="proSpecsBtn">
<el-button :disabled="routeInfo.addOrEdit == 3" type="primary" @click="handleSpecsEdit(1)">添加规格</el-button> <el-button :disabled="isDisabled" type="primary" @click="handleSpecsEdit(1)">添加规格</el-button>
</template> </template>
<div slot="proSpecs" style="margin-left: 110px;"> <div slot="proSpecs" style="margin-left: 110px;">
<div v-for="(subItem, subIndex) in specificationDetailList" :key="subIndex"> <div v-for="(subItem, subIndex) in specificationDetailList" :key="subIndex">
<div> <div>
<span>规格名:</span> <span>规格名:</span>
<span>{{ subItem.specificationName }}</span> <span>{{ subItem.specificationName }}</span>
<el-button v-show="!disabled" type="text" @click="handleSpecsEdit(2, subItem, subIndex)">编辑</el-button> <el-button v-show="!isDisabled" type="text" @click="handleSpecsEdit(2, subItem, subIndex)">编辑</el-button>
<el-button v-show="!disabled" type="text" @click="handleSpecsDelete(subIndex)">删除</el-button> <el-button v-show="!isDisabled" type="text" @click="handleSpecsDelete(subIndex)">删除</el-button>
</div> </div>
<div class="flex"> <div class="flex">
<span style="width: 56px;">规格值:</span> <span style="width: 56px;">规格值:</span>
...@@ -135,16 +135,16 @@ ...@@ -135,16 +135,16 @@
<td :style="{ width: specsWidth }" v-for="(n, idx) in subItem.specsValueList" :key="idx">{{ n }}</td> <td :style="{ width: specsWidth }" v-for="(n, idx) in subItem.specsValueList" :key="idx">{{ n }}</td>
<td :style="{ width: specsWidth }"> <td :style="{ width: specsWidth }">
<div v-if="routeInfo.groupOrStore == 1"> <div v-if="routeInfo.groupOrStore == 1">
<el-input :class="{ 'border-red': (!(subItem.retailPrice + '') || (+editForm.supplyPrice > +subItem.retailPrice)) && submitted }" placeholder="零售价" v-model="subItem.retailPrice" ng-blur="handleBlur()"> <el-input :disabled="isDisabled" :class="{ 'border-red': (!(subItem.retailPrice + '') || +editForm.supplyPrice > +subItem.retailPrice) && submitted }" placeholder="零售价" v-model="subItem.retailPrice" @input.native="e => handleRetailPriceInput(e, subIndex)">
<el-popover v-show="(!(subItem.retailPrice + '') || (+editForm.supplyPrice > +subItem.retailPrice)) && submitted" slot="suffix" placement="top" title="" width="90" trigger="hover" :content="!(subItem.retailPrice + '') ? '零售价是必填项' :'零售价要大于供货价'"> <el-popover v-show="(!(subItem.retailPrice + '') || +editForm.supplyPrice > +subItem.retailPrice) && submitted" slot="suffix" placement="top" title="" width="90" trigger="hover" :content="!(subItem.retailPrice + '') ? '零售价是必填项' : '零售价要大于供货价'">
<i class="el-icon-warning color-red" slot="reference"></i> <i class="el-icon-warning color-red" slot="reference"></i>
</el-popover> </el-popover>
</el-input> </el-input>
</div> </div>
<el-input v-else placeholder="零售价" v-model="subItem.retailPrice" ng-blur="handleBlur()"></el-input> <el-input :disabled="isDisabled" v-else placeholder="零售价" v-model="subItem.retailPrice" @input.native="e => handleRetailPriceInput(e, subIndex)"></el-input>
</td> </td>
<td :style="{ width: specsWidth }"> <td :style="{ width: specsWidth }">
<el-input placeholder="库存" v-model="subItem.stock" :class="{ 'border-red': !(subItem.stock + '') && submitted }"> <el-input :disabled="isDisabled" placeholder="库存" v-model="subItem.stock" :class="{ 'border-red': !(subItem.stock + '') && submitted }" @input.native="e => handleStockInput(e, subIndex)">
<el-popover v-show="!(subItem.stock + '') && submitted" slot="suffix" placement="top" title="" width="90" trigger="hover" content="库存是必填项"> <el-popover v-show="!(subItem.stock + '') && submitted" slot="suffix" placement="top" title="" width="90" trigger="hover" content="库存是必填项">
<i class="el-icon-warning color-red" slot="reference"></i> <i class="el-icon-warning color-red" slot="reference"></i>
</el-popover> </el-popover>
...@@ -165,12 +165,12 @@ ...@@ -165,12 +165,12 @@
<p>作为货源供给门店的价格</p> <p>作为货源供给门店的价格</p>
</template> </template>
<div slot="selectMerchant" slot-scope="scope" class="select-merchant"> <div slot="selectMerchant" slot-scope="scope" class="select-merchant">
<el-button :disabled="routeInfo.addOrEdit == 3" type="primary" @click="handleRelateStoreClose(scope)">{{ editForm.supplyMerchantList.length ? '更换' : '请选择' }}</el-button> <el-button :disabled="isDisabled" type="primary" @click="handleRelateStoreClose(scope)">{{ editForm.supplyMerchantList.length ? '更换' : '请选择' }}</el-button>
</div> </div>
<div slot="merchantTable" class="select-merchant"> <div slot="merchantTable" class="select-merchant">
<GLTable v-show="editForm.supplyMerchantList.length" :hasPage="false" :tableParams="tableParams" :tableData="editForm.supplyMerchantList"> <GLTable v-show="editForm.supplyMerchantList.length" :hasPage="false" :tableParams="tableParams" :tableData="editForm.supplyMerchantList">
<span slot="auth-button" slot-scope="scope"> <span slot="auth-button" slot-scope="scope">
<el-button type="text" @click="handleMerchantDelete(scope)">删除</el-button> <el-button :disabled="isDisabled" type="text" @click="handleMerchantDelete(scope)">删除</el-button>
</span> </span>
</GLTable> </GLTable>
</div> </div>
...@@ -217,6 +217,7 @@ ...@@ -217,6 +217,7 @@
</template> </template>
<script> <script>
import { limitPrice } from '@/common/constant'
export default { export default {
name: 'editProduct', name: 'editProduct',
data() { data() {
...@@ -231,6 +232,7 @@ export default { ...@@ -231,6 +232,7 @@ export default {
footerWidth: '0', footerWidth: '0',
editChildRef: 'editChildRef', editChildRef: 'editChildRef',
submitted: false, submitted: false,
isDisabled: false,
routeInfo: { routeInfo: {
// 1-新增;2-编辑;3-查看 // 1-新增;2-编辑;3-查看
addOrEdit: 1, addOrEdit: 1,
...@@ -261,14 +263,22 @@ export default { ...@@ -261,14 +263,22 @@ export default {
specificationDetailList: [], specificationDetailList: [],
nameToValSpecsList: [], nameToValSpecsList: [],
minRetailPrice: '', minRetailPrice: '',
/* eslint-disable */
reg: {
priceReg: /^\d[\d\.]*$/,
numReg: /^[1-9]\d*$/
},
/* eslint-enable */
// 添加规格弹窗 // 添加规格弹窗
isSpescVisible: false, isSpescVisible: false,
spescRules: { spescRules: {
specificationName: [ specificationName: [
{ required: true, message: '请输入规格名', trigger: 'blur' }, { required: true, message: '请输入规格名', trigger: 'blur' },
{ validator: (rule, value, callback) => { {
return this.spescData.curSpeceNameList.some(item => item == value) ? callback(new Error('规格名重复')) : callback() validator: (rule, value, callback) => {
}, trigger: 'blur' return this.spescData.curSpeceNameList.some(item => item == value) ? callback(new Error('规格名重复')) : callback()
},
trigger: 'blur'
} }
], ],
specificationValueList: [{ required: true, message: '请输入规格值', trigger: 'change' }] specificationValueList: [{ required: true, message: '请输入规格值', trigger: 'change' }]
...@@ -316,7 +326,8 @@ export default { ...@@ -316,7 +326,8 @@ export default {
name: 'goodsName', name: 'goodsName',
type: 'input', type: 'input',
maxlength: 20, maxlength: 20,
width: '320px' width: '320px',
isDisabled: false
}, },
{ {
label: '商品缩略图', label: '商品缩略图',
...@@ -325,6 +336,7 @@ export default { ...@@ -325,6 +336,7 @@ export default {
width: '320px', width: '320px',
limitSize: 10, limitSize: 10,
maxPhotoNum: 1, maxPhotoNum: 1,
isDisabled: false,
handleUpload: (e, file, targetItem) => { handleUpload: (e, file, targetItem) => {
const imgFile = e.target.result const imgFile = e.target.result
const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1] const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1]
...@@ -341,6 +353,7 @@ export default { ...@@ -341,6 +353,7 @@ export default {
width: '100%', width: '100%',
limitSize: 20, limitSize: 20,
maxPhotoNum: 10, maxPhotoNum: 10,
isDisabled: false,
handleUpload: (e, file, targetItem) => { handleUpload: (e, file, targetItem) => {
const imgFile = e.target.result const imgFile = e.target.result
const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1] const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1]
...@@ -361,6 +374,7 @@ export default { ...@@ -361,6 +374,7 @@ export default {
uploadType: 'video', uploadType: 'video',
limitSize: 50, limitSize: 50,
maxPhotoNum: 1, maxPhotoNum: 1,
isDisabled: false,
handleUpload: (e, file, targetItem) => { handleUpload: (e, file, targetItem) => {
const imgFile = e.target.result const imgFile = e.target.result
const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1] const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1]
...@@ -378,7 +392,8 @@ export default { ...@@ -378,7 +392,8 @@ export default {
optionList: [], optionList: [],
optionId: 'id', optionId: 'id',
optionLabel: 'classifyName', optionLabel: 'classifyName',
optionsName: 'classifyList' optionsName: 'classifyList',
isDisabled: false
}, },
{ {
label: '关联专区', label: '关联专区',
...@@ -388,7 +403,8 @@ export default { ...@@ -388,7 +403,8 @@ export default {
optionList: [], optionList: [],
optionId: 'id', optionId: 'id',
optionLabel: 'zoneName', optionLabel: 'zoneName',
optionsName: 'zoneList' optionsName: 'zoneList',
isDisabled: false
}, },
{ {
label: '商品描述', label: '商品描述',
...@@ -447,7 +463,8 @@ export default { ...@@ -447,7 +463,8 @@ export default {
append: '元', append: '元',
width: '320px', width: '320px',
suffixSlot: 'retailPrice', suffixSlot: 'retailPrice',
isHide: false isHide: false,
isDisabled: false
}, },
{ {
label: '划线价', label: '划线价',
...@@ -455,7 +472,8 @@ export default { ...@@ -455,7 +472,8 @@ export default {
type: 'input', type: 'input',
append: '元', append: '元',
width: '320px', width: '320px',
suffixSlot: 'originalPrice' suffixSlot: 'originalPrice',
isDisabled: false
}, },
{ {
label: '供货价', label: '供货价',
...@@ -463,7 +481,8 @@ export default { ...@@ -463,7 +481,8 @@ export default {
type: 'input', type: 'input',
append: '元', append: '元',
width: '320px', width: '320px',
suffixSlot: 'supplyPrice' suffixSlot: 'supplyPrice',
isDisabled: false
}, },
{ {
label: '库存', label: '库存',
...@@ -472,7 +491,8 @@ export default { ...@@ -472,7 +491,8 @@ export default {
append: '件', append: '件',
width: '320px', width: '320px',
suffixSlot: 'goodsStock', suffixSlot: 'goodsStock',
isHide: false isHide: false,
isDisabled: false
} }
] ]
}, },
...@@ -490,6 +510,7 @@ export default { ...@@ -490,6 +510,7 @@ export default {
type: 'radio', type: 'radio',
optionId: 'confId', optionId: 'confId',
optionLabel: 'confName', optionLabel: 'confName',
isDisabled: false,
optionList: [ optionList: [
{ {
confId: 1, confId: 1,
...@@ -510,7 +531,8 @@ export default { ...@@ -510,7 +531,8 @@ export default {
type: 'input', type: 'input',
append: '元', append: '元',
width: '320px', width: '320px',
isHide: false isHide: false,
isDisabled: false
} }
] ]
}, },
...@@ -548,6 +570,29 @@ export default { ...@@ -548,6 +570,29 @@ export default {
} }
}, },
watch: {
// 零售价
'editForm.retailPrice'(newValue, oldValue) {
this.editForm.retailPrice = limitPrice(newValue, oldValue, 5, 2)
},
// 划线价
'editForm.originalPrice'(newValue, oldValue) {
this.editForm.originalPrice = limitPrice(newValue, oldValue, 5, 2)
},
// 供货价
'editForm.supplyPrice'(newValue, oldValue) {
this.editForm.supplyPrice = limitPrice(newValue, oldValue, 5, 2)
},
// 库存
'editForm.goodsStock'(newValue, oldValue) {
this.editForm.goodsStock = limitPrice(newValue, oldValue, 10, 0, 0, 10000000000, 'numReg')
},
// 运费
'editForm.expressFee'(newValue, oldValue) {
this.editForm.expressFee = limitPrice(newValue, oldValue, 5, 2, 0, 100000)
}
},
mounted() { mounted() {
this.userInfo = this.$globalState.session this.userInfo = this.$globalState.session
this.footerLeft = document.querySelector('.base-container-right').offsetLeft this.footerLeft = document.querySelector('.base-container-right').offsetLeft
...@@ -558,7 +603,10 @@ export default { ...@@ -558,7 +603,10 @@ export default {
this.getBaseDate().then(() => { this.getBaseDate().then(() => {
this.getOptionsList(0, 'editFormData', false) this.getOptionsList(0, 'editFormData', false)
}) })
this.isDisabled = this.routeInfo.addOrEdit == 3
this.routeInfo.groupOrStore == 2 && this.storeNoExitAttr()
this.routeInfo.addOrEdit != 1 ? this.getInfo() : '' this.routeInfo.addOrEdit != 1 ? this.getInfo() : ''
this.routeInfo.addOrEdit == 3 && this.setAllDisabled()
}, },
methods: { methods: {
...@@ -572,19 +620,69 @@ export default { ...@@ -572,19 +620,69 @@ export default {
}) })
}, },
handleTypeChange(val) { handleTypeChange(val) {
this.externalFormList[2].editRule.expressFee[0].required = val == 2 // this.externalFormList[2].editRule.expressFee[0].required = val == 2
var idx = this.externalFormList[2].editFormData.findIndex(item => item.name == 'expressFee') var idx = this.externalFormList[2].editFormData.findIndex(item => item.name == 'expressFee')
this.externalFormList[2].editFormData[idx].isHide = val != 2 this.externalFormList[2].editFormData[idx].isHide = val != 2
}, },
setAllDisabled() {
this.externalFormList.forEach(item => {
item.editFormData.forEach(subItem => {
subItem.isDisabled = true
})
})
},
hideOrShowAttr(obj, isHide=true) {
var idx = ''
obj.forEach(item => {
idx = this.externalFormList[item.pIdx].editFormData.findIndex(subItem => subItem.name == item.name)
this.externalFormList[item.pIdx].editFormData[idx].isHide = isHide
})
},
storeNoExitAttr() {
var attrObj = [
{
name: 'zoneId',
pIdx: 0
},
{
name: 'supplyPrice',
pIdx: 1
}
]
this.hideOrShowAttr(attrObj)
this.externalFormList.splice(3, 1)
},
retailStockRule() { retailStockRule() {
var list = ['retailPrice', 'goodsStock'] var list = ['retailPrice', 'goodsStock']
var idx = '' var idx = ''
list.forEach(item => { list.forEach(item => {
this.externalFormList[1].editRule[item][0].required = !this.editForm.specificationList.length // this.externalFormList[1].editRule[item][0].required = !this.specificationDetailList.length
idx = this.externalFormList[1].editFormData.findIndex(subItem => subItem.name == item) idx = this.externalFormList[1].editFormData.findIndex(subItem => subItem.name == item)
this.externalFormList[1].editFormData[idx].isHide = !!this.editForm.specificationList.length this.externalFormList[1].editFormData[idx].isHide = !!this.specificationDetailList.length
}) })
}, },
handleRetailPriceInput(e, idx) {
var newValue = e.target.value
if (!this.reg.priceReg.test(newValue)) {
newValue = ''
}
var oldValue = newValue
if (e.key != 'Backspace' && newValue.length > 1) {
oldValue = newValue.slice(0, newValue.length - 1)
}
this.nameToValSpecsList[idx].retailPrice = limitPrice(newValue, oldValue, 5, 2)
},
handleStockInput(e, idx) {
var newValue = e.target.value
if (!this.reg.priceReg.test(newValue)) {
newValue = ''
}
var oldValue = newValue
if (e.key != 'Backspace' && newValue.length > 1) {
oldValue = newValue.slice(0, newValue.length - 1)
}
this.nameToValSpecsList[idx].stock = limitPrice(newValue, oldValue, 10, 0, 0, 10000000000, 'numReg')
},
// 二次确认 // 二次确认
secondSimpleConfirm(title, txt, fn) { secondSimpleConfirm(title, txt, fn) {
this.$confirm(txt, title, { this.$confirm(txt, title, {
...@@ -628,7 +726,8 @@ export default { ...@@ -628,7 +726,8 @@ export default {
}, },
// 规格值解构 // 规格值解构
changeSpecs(isRecovery) { changeSpecs(isRecovery) {
this.specsWidth = (100 / ( this.specificationDetailList.length + 2 )) + '%' this.retailStockRule()
this.specsWidth = 100 / (this.specificationDetailList.length + 2) + '%'
this.nameToValSpecsList = [] this.nameToValSpecsList = []
var markIdx = 0 var markIdx = 0
for (var i = 0; i < this.specificationDetailList.length; i++) { for (var i = 0; i < this.specificationDetailList.length; i++) {
...@@ -700,14 +799,14 @@ export default { ...@@ -700,14 +799,14 @@ export default {
// 规格弹窗 // 规格弹窗
handleSpescDelete(tag) { handleSpescDelete(tag) {
this.spescEditForm.specificationValueList.splice(this.spescEditForm.specificationValueList.indexOf(tag), 1); this.spescEditForm.specificationValueList.splice(this.spescEditForm.specificationValueList.indexOf(tag), 1)
}, },
showInput() { showInput() {
this.specsInputVisible = true this.specsInputVisible = true
this.$nextTick(_ => { this.$nextTick(_ => {
this.$refs.saveSpescInput.$refs.input.focus() this.$refs.saveSpescInput.$refs.input.focus()
}); })
}, },
handleInputConfirm() { handleInputConfirm() {
...@@ -939,7 +1038,7 @@ export default { ...@@ -939,7 +1038,7 @@ export default {
isJump = true isJump = true
break break
} }
if ((this.routeInfo.groupOrStore == 1) && (+item.retailPrice < +this.editForm.supplyPrice)) { if (this.routeInfo.groupOrStore == 1 && +item.retailPrice < +this.editForm.supplyPrice) {
this.whereToGo('specificationDetailList') this.whereToGo('specificationDetailList')
isJump = true isJump = true
break break
...@@ -1077,10 +1176,10 @@ export default { ...@@ -1077,10 +1176,10 @@ export default {
vertical-align: bottom; vertical-align: bottom;
} }
.edit-pro .table-spesc .el-input--small.border-red .el-input__inner { .edit-pro .table-spesc .el-input--small.border-red .el-input__inner {
border: 1px solid #EB4E4E; border: 1px solid #eb4e4e;
} }
.color-red { .color-red {
color: #EB4E4E; color: #eb4e4e;
cursor: pointer; cursor: pointer;
} }
</style> </style>
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<!-- 表格区域 开始 --> <!-- 表格区域 开始 -->
<GLTable ref="proGroupRef" class="table-img" :getListApi="getListApi" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn"> <GLTable ref="proGroupRef" class="table-img" :getListApi="getListApi" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn">
<div slot="goodsImage" class="table-image" slot-scope="scope"> <div slot="goodsImage" class="table-image" slot-scope="scope">
<img class="img-60" :src="scope.scope.goodsImage"/> <img class="img-60" :src="scope.scope.goodsImage" />
</div> </div>
<div class="table-btns" slot="auth-button" slot-scope="scope"> <div class="table-btns" slot="auth-button" slot-scope="scope">
<el-button type="text" @click="handleUpOrDown(scope.scope)">{{ scope.scope.goodsStatus ? '下架' : '上架' }}</el-button> <el-button type="text" @click="handleUpOrDown(scope.scope)">{{ scope.scope.goodsStatus ? '下架' : '上架' }}</el-button>
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
</template> </template>
<script> <script>
import * as dayjs from 'dayjs'
import shareDialog from './components/shareDialog' import shareDialog from './components/shareDialog'
export default { export default {
name: 'productGroup', name: 'productGroup',
...@@ -115,14 +116,14 @@ export default { ...@@ -115,14 +116,14 @@ export default {
label: '浏览量(次)', label: '浏览量(次)',
name: 'goodsStatistics', name: 'goodsStatistics',
formatter: cellValue => { formatter: cellValue => {
return cellValue.goodsStatistics ? (cellValue.goodsStatistics.viewAmount || '0') : '0' return cellValue.goodsStatistics ? cellValue.goodsStatistics.viewAmount || '0' : '0'
} }
}, },
{ {
label: '销量', label: '销量',
name: 'goodsStatistics', name: 'goodsStatistics',
formatter: cellValue => { formatter: cellValue => {
return cellValue.goodsStatistics ? (cellValue.goodsStatistics.saleAmount || '0') : '0' return cellValue.goodsStatistics ? cellValue.goodsStatistics.saleAmount || '0' : '0'
} }
}, },
{ {
...@@ -142,8 +143,9 @@ export default { ...@@ -142,8 +143,9 @@ export default {
{ {
label: '创建日期', label: '创建日期',
prop: 'createdDate', prop: 'createdDate',
width: '180',
formatter: cellValue => { formatter: cellValue => {
return new Date(cellValue.createdDate).toLocaleDateString().replace(/\//g, '-') return dayjs(cellValue.createdDate).format('YYYY-MM-DD HH:mm:ss')
} }
}, },
{ {
...@@ -157,13 +159,16 @@ export default { ...@@ -157,13 +159,16 @@ export default {
}, },
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' }, pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
baseData: { baseData: {
goodsStatusList: [{ goodsStatusList: [
confId: '0', {
confName: '已下架' confId: '0',
}, { confName: '已下架'
confId: '1', },
confName: '已上架' {
}] confId: '1',
confName: '已上架'
}
]
} }
} }
}, },
......
<!-- 商品编辑 - 带货 -->
<template>
<div class="edit-product-dh marketing">
<div class="container edit-container">
<p class="edit-title">{{ title }}</p>
<div class="flex" style="margin-top: 20px;">
<div style="width: 440px; text-align: center;">
<img class="main-img" :src="mainImgUrl" />
<div>
<div class="flex">
<p class="arrow left-arrow" @click="handleMoveImg('left')"></p>
<div class="small-block">
<div class="flex small-box">
<img class="small-img" v-for="(item, index) in editForm.goodsDetailImageList" :key="index" :src="item.content" @click="handleChangeImg(index)" />
</div>
</div>
<p class="arrow right-arrow" @click="handleMoveImg('right')"></p>
</div>
</div>
</div>
<div style="width: calc(100% - 440px);">
<p class="pro-name txt-ellipsis">{{ editForm.goodsName }}</p>
<p v-show="!specificationDetailList.length" class="supply-price txt-ellipsis">{{ editForm.retailPrice }}元</p>
</div>
</div>
<div v-if="specificationDetailList.length" class="flex" style="margin-top: 20px;" id="specificationDetailList">
<span class="spesc-label" :style="{ width: labelWidth }">规格明细:</span>
<div style="width: calc(100% - 100px);">
<table class="table-spesc">
<tbody>
<tr>
<td :style="{ width: specsWidth }" v-for="(subItem, subIndex) in specificationDetailList" :key="subIndex">{{ subItem.specificationName }}</td>
<td :style="{ width: specsWidth }">零售价(元)</td>
<td :style="{ width: specsWidth }">供货价</td>
<td :style="{ width: specsWidth }">利润</td>
<td :style="{ width: specsWidth }">库存</td>
</tr>
</tbody>
</table>
<table class="table-spesc" style="max-height: 400px;">
<tbody>
<tr style="border-bottom: 1px solid rgb(235, 235, 235);" v-for="(item, index) in nameToValSpecsList" :key="index">
<td :style="{ width: specsWidth }" v-for="(n, idx) in item.specsValueList" :key="idx">{{ n }}</td>
<td :style="{ width: specsWidth }">
<el-input :disabled="isDisabled" :class="{ 'border-red': (!(item.retailPrice + '') || +item.supplyPrice > +item.retailPrice) && submitted }" placeholder="零售价" v-model="item.retailPrice" @input.native="e => handleInput(e, index)">
<el-popover v-show="(!(item.retailPrice + '') || +item.supplyPrice > +item.retailPrice) && submitted" slot="suffix" placement="top" title="" width="90" trigger="hover" :content="!(item.retailPrice + '') ? '零售价是必填项' : '零售价要大于供货价'">
<i class="el-icon-warning color-red" slot="reference"></i>
</el-popover>
</el-input>
</td>
<td :style="{ width: specsWidth }">{{ item.supplyPrice }}元</td>
<td :style="{ width: specsWidth }">{{ (item.retailPrice - item.supplyPrice).toFixed(2) }}元</td>
<td :style="{ width: specsWidth }">{{ item.stock }}件</td>
</tr>
</tbody>
</table>
</div>
</div>
<glsx-combi-form v-if="!specificationDetailList.length" class="edit-form-container" ref="editFormRef" labelWidth="140px" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule"></glsx-combi-form>
</div>
<div class="footer" :style="{ left: footerLeft + 'px', width: footerWidth + 'px' }">
<el-button type="primary" @click="handleConfirm">确定</el-button>
<el-button type="default" @click="handleCancel">取消</el-button>
</div>
</div>
</template>
<script>
import { limitPrice } from '@/common/constant'
export default {
name: 'editProductDh',
data() {
return {
size: 'small',
title: '创建商品',
titleObj: {
1: '创建商品',
2: '编辑商品',
3: '查看商品'
},
footerLeft: '0',
footerWidth: '0',
editChildRef: 'editChildRef',
submitted: false,
isDisabled: false,
mainImgUrl: '',
moveNum: 0,
curMoveNum: 0,
/* eslint-disable */
reg: {
priceReg: /^\d[\d\.]*$/,
numReg: /^[1-9]\d*$/
},
/* eslint-enable */
routeInfo: {
// 1-新增;2-编辑;3-查看
addOrEdit: 1,
id: ''
},
specificationDetailList: [],
nameToValSpecsList: [],
editForm: {
retailPrice: ''
},
editRule: {
retailPrice: [
{ required: true, message: '请输入零售价', trigger: 'change' },
{
validator: (rule, value, callback) => {
return +this.editForm.supplyPrice > +value ? callback(new Error('零售价不能小于供货价')) : callback()
},
trigger: 'change'
}
]
},
editFormData: [
{
label: '零售价',
name: 'retailPrice',
width: '280px',
type: 'input',
isDisabled: false
},
{
label: '供货价',
name: 'supplyPrice',
width: '280px',
type: 'input',
isDisabled: true
},
{
label: '库存',
name: 'goodsStock',
width: '280px',
type: 'input',
isDisabled: true
}
]
}
},
watch: {
'editForm.retailPrice'(newValue, oldValue) {
this.editForm.retailPrice = limitPrice(newValue, oldValue, 5, 2)
}
},
mounted() {
this.footerLeft = document.querySelector('.base-container-right').offsetLeft
this.footerWidth = document.documentElement.clientWidth - this.footerLeft
this.routeInfo = this.$route.params
this.title = this.titleObj[this.routeInfo.addOrEdit]
this.isDisabled = this.routeInfo.addOrEdit == 3
this.editFormData[0].isDisabled = true
this.routeInfo.addOrEdit != 1 ? this.getInfo() : ''
},
methods: {
getInfo() {
this.$apis.proManage.getProInfoApi({ id: this.routeInfo.id }).then(res => {
this.editForm = {
...res,
retailPrice: '',
supplyPrice: res.supplyPrice ? (res.supplyPrice / 100).toFixed(2) : ''
}
// 规格
if (this.editForm.specificationList.length) {
this.specificationDetailList = this.$common.utils.deepClone(this.editForm.specificationList)
this.recoverySpec()
// this.findSpeceMin()
} else {
// 零售价
this.editForm.retailPrice = (res.retailPrice / 100).toFixed(2)
}
this.mainImgUrl = this.editForm.goodsDetailImageList[0].content
this.moveNum = this.editForm.goodsDetailImageList.length > 4 ? this.editForm.goodsDetailImageList.length - 4 : 0
})
},
// 规格值解构
changeSpecs(isRecovery) {
this.specsWidth = 100 / (this.specificationDetailList.length + 4) + '%'
this.nameToValSpecsList = []
var markIdx = 0
for (var i = 0; i < this.specificationDetailList.length; i++) {
markIdx = 0
for (var j = 0; j < this.specificationDetailList[i].specificationValueList.length; j++) {
if (i == 0) {
this.nameToValSpecsList.push({
specsValueList: [this.specificationDetailList[i].specificationValueList[j].specificationValue],
retailPrice: '',
stock: ''
})
} else {
var targetValLen = this.specificationDetailList[i].specificationValueList.length
var loopNum = 0
var tempMarkIdx = 0
if (j == 0 && targetValLen > 1) {
var obj = JSON.parse(JSON.stringify(this.nameToValSpecsList))
this.nameToValSpecsList = []
obj.forEach((item, index) => {
for (var k = 0; k < targetValLen; k++) {
this.nameToValSpecsList.push(JSON.parse(JSON.stringify(item)))
}
})
}
loopNum = this.nameToValSpecsList.length / targetValLen
tempMarkIdx = markIdx
for (var k = 0; k < loopNum; k++) {
this.nameToValSpecsList[tempMarkIdx].specsValueList.push(this.specificationDetailList[i].specificationValueList[j].specificationValue)
tempMarkIdx = tempMarkIdx + targetValLen
}
markIdx = markIdx + 1
}
}
}
if (isRecovery) {
this.nameToValSpecsList.forEach((item, index) => {
var specificationObj = {}
item.specsValueList.forEach((subItem, subIndex) => {
specificationObj[this.specificationDetailList[subIndex].specificationName] = subItem
})
item.specificationData = this.setLocaleCompare(specificationObj)
for (var i = 0; i < this.editForm.specificationDetailList.length; i++) {
var temp = this.editForm.specificationDetailList[i]
if (temp.specificationData == item.specificationData) {
item.retailPrice = (temp.retailPrice / 100).toFixed(2)
item.specificationKey = temp.specificationKey
item.stock = temp.stock
item.supplyPrice = this.editForm.supplyPrice
break
}
}
})
}
},
setLocaleCompare(params) {
let keys = []
let obj = []
Object.keys(params).forEach(item => {
keys.push(item)
})
keys.sort()
keys.forEach(item => {
obj.push([item, params[item]])
})
return obj.join('&').replace(/,/g, '-')
},
// 恢复规格值
recoverySpec() {
this.changeSpecs(true)
},
// 换图
handleChangeImg(idx) {
this.mainImgUrl = this.editForm.goodsDetailImageList[idx].content
},
// 移动图片
handleMoveImg(dirction) {
var el = document.getElementsByClassName('small-box')[0]
if (dirction == 'left') {
if (this.curMoveNum == 0) {
return true
}
this.curMoveNum = this.curMoveNum - 1
el.style.left = '-' + this.curMoveNum * 90 + 'px'
} else {
if (this.curMoveNum == this.moveNum) {
return true
}
this.curMoveNum = this.curMoveNum + 1
el.style.left = '-' + this.curMoveNum * 90 + 'px'
}
},
handleInput(e, idx) {
var newValue = e.target.value
if (!this.reg.priceReg.test(newValue)) {
newValue = ''
}
var oldValue = newValue
if (e.key != 'Backspace' && newValue.length > 1) {
oldValue = newValue.slice(0, newValue.length - 1)
}
this.nameToValSpecsList[idx].retailPrice = limitPrice(newValue, oldValue, 5, 2)
},
// 跳转
whereToGo(id) {
document.getElementById(id).scrollIntoView()
},
checkSpeceData() {
var flag = true
for (var i = 0; i < this.nameToValSpecsList.length; i++) {
var item = this.nameToValSpecsList[i]
if (!item.retailPrice) {
this.whereToGo('specificationDetailList')
return false
}
if (+item.retailPrice < +item.supplyPrice) {
this.whereToGo('specificationDetailList')
return false
}
}
return flag
},
handleConfirm() {
this.submitted = true
var flag = false
var params = {}
if (this.nameToValSpecsList.length) {
if (!this.checkSpeceData()) {
return
}
params.specificationDetailList = []
this.nameToValSpecsList.forEach((item, index) => {
params.specificationDetailList.push({
specificationData: item.specificationData,
specificationKey: item.specificationKey,
retailPrice: (item.retailPrice * 100).toFixed(0)
})
})
} else {
this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => {
if (!valid) {
flag = true
} else {
params = {
retailPrice: (this.editForm.retailPrice * 100).toFixed(0)
}
}
})
}
if (flag) {
return true
}
params.id = this.routeInfo.id
this.$apis.proManage.updateTakeProApi(params).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : '操作失败',
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
this.handleCancel()
}
})
},
handleCancel() {
this.$router.push({
path: '/productStore/index'
})
}
}
}
</script>
<style scoped>
.title {
padding: 13px 20px;
border-bottom: 1px solid #E5E5E5;
}
.view {
width: 375px;
height: 667px;
margin: 30px 45px 0 60px;
background: #F6F6F6;
position: relative;
}
/* .control {
width: calc(100% - 480px);
} */
.view img {
width: 100%;
vertical-align: top;
}
.edit-product-dh .main-img {
width: 375px;
height: 375px;
}
/* .edit-product-dh .flex {
display: flex;
} */
.edit-product-dh .arrow {
width: 0;
height: 0;
border-width: 20px;
border-style: solid;
margin-top: 20px;
cursor: pointer;
}
.edit-product-dh .left-arrow {
border-color: transparent #999999 transparent transparent;
}
.edit-product-dh .right-arrow {
border-color: transparent transparent transparent #999999;
}
.edit-product-dh .small-block {
position: relative;
overflow: hidden;
width: 344px;
height: 80px;
margin: 0 10px;
}
.edit-product-dh .small-box {
position: absolute;
left: 0;
}
.edit-product-dh .small-img {
width: 80px;
height: 80px;
margin-right: 8px;
cursor: pointer;
}
.edit-product-dh .pro-name {
width: 100%;
font-size: 20px;
color: #3A3A3A;
}
.edit-product-dh .supply-price {
font-size: 26px;
color: #FF6D00;
}
.edit-product-dh .border-red {
border: 1px solid red;
}
.txt-ellipsis {
display: -webkit-box;
overflow: hidden;
text-overflow: ellipsis;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
}
/* 规格 */
.edit-product-dh .spesc-label {
padding: 1px 10px;
box-sizing: border-box;
width: 110px;
color: #666;
text-align: right;
padding-right: 12px;
}
.edit-product-dh .table-spesc {
width: 100%;
text-align: center;
margin-bottom: 0;
}
.edit-product-dh .table-spesc tbody tr {
border: 1px solid #e7e7e7;
}
.edit-product-dh .table-spesc tbody td {
display: inline-block;
box-sizing: border-box;
width: 20%;
border: none;
padding: 2px 6px;
vertical-align: center;
text-align: center;
}
.edit-product-dh .table-spesc .el-input--small .el-input__inner {
text-align: center !important;
}
.edit-product-dh .w-320 {
width: 320px;
}
.color-red {
color: #eb4e4e;
cursor: pointer;
}
/* 规格 */
</style>
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<!-- 表格区域 开始 --> <!-- 表格区域 开始 -->
<GLTable ref="proGroupRef" class="table-img" :getListApi="getListApi" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn"> <GLTable ref="proGroupRef" class="table-img" :getListApi="getListApi" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn">
<template slot="goodsImage" slot-scope="scope"> <template slot="goodsImage" slot-scope="scope">
<img class="img-60" :src="scope.scope.goodsImage"/> <img class="img-60" :src="scope.scope.goodsImage" />
</template> </template>
<div class="table-btns" slot="auth-button" slot-scope="scope"> <div class="table-btns" slot="auth-button" slot-scope="scope">
<el-button v-if="!scope.scope.goodsStatus" type="text" @click="handleEdit(2, scope.scope)">编辑</el-button> <el-button v-if="!scope.scope.goodsStatus" type="text" @click="handleEdit(2, scope.scope)">编辑</el-button>
...@@ -46,7 +46,9 @@ ...@@ -46,7 +46,9 @@
</template> </template>
<script> <script>
import * as dayjs from 'dayjs'
import shareDialog from '../productGroup/components/shareDialog' import shareDialog from '../productGroup/components/shareDialog'
import { truncate } from 'fs';
export default { export default {
name: 'productGroup', name: 'productGroup',
data() { data() {
...@@ -118,14 +120,14 @@ export default { ...@@ -118,14 +120,14 @@ export default {
label: '浏览量(次)', label: '浏览量(次)',
name: 'goodsStatistics', name: 'goodsStatistics',
formatter: cellValue => { formatter: cellValue => {
return cellValue.goodsStatistics ? (cellValue.goodsStatistics.viewAmount || '0') : '0' return cellValue.goodsStatistics ? cellValue.goodsStatistics.viewAmount || '0' : '0'
} }
}, },
{ {
label: '销量', label: '销量',
name: 'goodsStatistics', name: 'goodsStatistics',
formatter: cellValue => { formatter: cellValue => {
return cellValue.goodsStatistics ? (cellValue.goodsStatistics.saleAmount || '0') : '0' return cellValue.goodsStatistics ? cellValue.goodsStatistics.saleAmount || '0' : '0'
} }
}, },
{ {
...@@ -145,8 +147,9 @@ export default { ...@@ -145,8 +147,9 @@ export default {
{ {
label: '创建日期', label: '创建日期',
prop: 'createdDate', prop: 'createdDate',
width: '180',
formatter: cellValue => { formatter: cellValue => {
return new Date(cellValue.createdDate).toLocaleDateString().replace(/\//g, '-') return dayjs(cellValue.createdDate).format('YYYY-MM-DD HH:mm:ss')
} }
}, },
{ {
...@@ -167,20 +170,26 @@ export default { ...@@ -167,20 +170,26 @@ export default {
}, },
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' }, pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
baseData: { baseData: {
goodsStatusList: [{ goodsStatusList: [
confId: '0', {
confName: '已下架' confId: '0',
}, { confName: '已下架'
confId: '1', },
confName: '已上架' {
}], confId: '1',
goodsSourceList: [{ confName: '已上架'
confId: '1', }
confName: '门店' ],
}, { goodsSourceList: [
confId: '2', {
confName: '带货' confId: '1',
}] confName: '门店'
},
{
confId: '2',
confName: '带货'
}
]
} }
} }
}, },
...@@ -235,13 +244,18 @@ export default { ...@@ -235,13 +244,18 @@ export default {
// addOrEdit:1-新增;2-编辑;3-查看 // addOrEdit:1-新增;2-编辑;3-查看
// groupOrStore:1-集团;2-门店 // groupOrStore:1-集团;2-门店
handleEdit(addOrEdit, row) { handleEdit(addOrEdit, row) {
// 1-门店;2-带货
if (row.goodsSource == 2) {
this.$router.push('/productStore/editProductDh/' + addOrEdit + '/' + row.id)
return true
}
addOrEdit == 1 ? this.$router.push('/productGroup/editProduct/' + addOrEdit + '/' + 2) : this.$router.push('/productGroup/editProduct/' + addOrEdit + '/' + 2 + '/' + row.id) addOrEdit == 1 ? this.$router.push('/productGroup/editProduct/' + addOrEdit + '/' + 2) : this.$router.push('/productGroup/editProduct/' + addOrEdit + '/' + 2 + '/' + row.id)
}, },
// 下架通知 // 下架通知
handleDwonNotice(row) { handleDwonNotice(row) {
this.$alert( '你带货的' + row.goodsName + '商品现已下架,下架原因:' + row.offReason, '商品下架通知', { this.$alert('你带货的' + row.goodsName + '商品现已下架,下架原因:' + row.offReason, '商品下架通知', {
confirmButtonText: '确定', confirmButtonText: '确定',
callback: action => { } callback: action => {}
}) })
}, },
handleUpOrDown(row) { handleUpOrDown(row) {
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
</template> </template>
<script> <script>
import * as dayjs from 'dayjs'
export default { export default {
name: 'takeGood', name: 'takeGood',
data() { data() {
...@@ -69,6 +70,7 @@ export default { ...@@ -69,6 +70,7 @@ export default {
{ {
label: '商品名称', label: '商品名称',
prop: 'goodsName', prop: 'goodsName',
line: 2,
formatter: cellValue => { formatter: cellValue => {
return cellValue.goods.goodsName return cellValue.goods.goodsName
} }
...@@ -82,14 +84,15 @@ export default { ...@@ -82,14 +84,15 @@ export default {
label: '供货价', label: '供货价',
prop: 'supplyPrice', prop: 'supplyPrice',
formatter: cellValue => { formatter: cellValue => {
return (cellValue.supplyPrice / 100).toFixed(2) return (cellValue.goods.supplyPrice / 100).toFixed(2)
} }
}, },
{ {
label: '创建日期', label: '创建日期',
prop: 'createdDate', prop: 'createdDate',
width: '180',
formatter: cellValue => { formatter: cellValue => {
return new Date(cellValue.goods.createdDate).toLocaleDateString().replace(/\//g, '-') return dayjs(cellValue.goods.createdDate).format('YYYY-MM-DD HH:mm:ss')
} }
} }
] ]
...@@ -120,20 +123,54 @@ export default { ...@@ -120,20 +123,54 @@ export default {
setTableFinishFun(table) { setTableFinishFun(table) {
this.tableParams.checkSelectVal = [] this.tableParams.checkSelectVal = []
table.forEach(item => { table &&
if (item.taked) { table.forEach(item => {
this.tableParams.checkSelectVal.push(item.goodsId) if (item.taked) {
this.tableParams.checkSelectVal.push(item.goodsId)
}
})
},
secondConfirm(title, txt, apiModule, apiName, apiParams, fn) {
this.$confirm(txt, title, {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: action => {
if (action == 'confirm') {
this.$apis[apiModule][apiName](apiParams).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
fn && fn()
this.handleSearch()
}
})
}
} }
}) })
}, },
handleSingleTakeGood(row) {
this.secondConfirm('带货', '是否确认带货?', 'takeGood', 'takeGookApi', { takeGoodsIdList: [row.goodsId] })
},
handleTakeGood() { handleTakeGood() {
var selectedList = this.$refs.takeGoodRef.mutiSelectArr[this.tableParams.mutiSelectName] var selectedList = this.$refs.takeGoodRef.mutiSelectArr[this.tableParams.mutiSelectName]
console.log(selectedList) if (!selectedList.length) {
this.$message({
message: '请勾选要带货的商品',
type: 'error'
})
return true
}
this.secondConfirm('带货', '是否确认带货?', 'takeGood', 'takeGookApi', { takeGoodsIdList: selectedList.map(item => item.goodsId) })
}, },
handleDetail(row) { handleDetail(row) {
this.$router.push('/takeGood/takeGoodDetail/' + row.id) this.$router.push('/takeGood/takeGoodDetail/' + row.goodsId)
}, },
handleSearch() { handleSearch() {
......
<!-- 带货详情 --> <!-- 带货详情 -->
<!-- 商品编辑 - 带货 -->
<template> <template>
<div>带货详情</div> <div class="edit-product-dh marketing">
<div class="container edit-container">
<p class="edit-title">{{ title }}</p>
<div class="flex" style="margin-top: 20px;">
<div style="width: 440px; text-align: center;">
<img class="main-img" :src="mainImgUrl" />
<div>
<div class="flex">
<p class="arrow left-arrow" @click="handleMoveImg('left')"></p>
<div class="small-block">
<div class="flex small-box">
<img class="small-img" v-for="(item, index) in editForm.goodsDetailImageList" :key="index" :src="item.content" @click="handleChangeImg(index)" />
</div>
</div>
<p class="arrow right-arrow" @click="handleMoveImg('right')"></p>
</div>
</div>
</div>
<div style="width: calc(100% - 440px);">
<p class="pro-name txt-ellipsis">{{ editForm.goodsName }}</p>
<!-- <p v-show="!specificationDetailList.length" class="supply-price txt-ellipsis">{{ editForm.retailPrice }}元</p> -->
</div>
</div>
<div v-if="specificationDetailList.length" class="flex" style="margin-top: 20px;" id="specificationDetailList">
<span class="spesc-label" :style="{ width: labelWidth }">规格明细:</span>
<div style="width: calc(100% - 100px);">
<table class="table-spesc">
<tbody>
<tr>
<td :style="{ width: specsWidth }" v-for="(subItem, subIndex) in specificationDetailList" :key="subIndex">{{ subItem.specificationName }}</td>
<!-- <td :style="{ width: specsWidth }">零售价(元)</td> -->
<td :style="{ width: specsWidth }">供货价</td>
<!-- <td :style="{ width: specsWidth }">利润</td> -->
<td :style="{ width: specsWidth }">库存</td>
</tr>
</tbody>
</table>
<table class="table-spesc" style="max-height: 400px;">
<tbody>
<tr style="border-bottom: 1px solid rgb(235, 235, 235);" v-for="(item, index) in nameToValSpecsList" :key="index">
<td :style="{ width: specsWidth }" v-for="(n, idx) in item.specsValueList" :key="idx">{{ n }}</td>
<!-- <td :style="{ width: specsWidth }">
<el-input :disabled="isDisabled" :class="{ 'border-red': (!(item.retailPrice + '') || +item.supplyPrice > +item.retailPrice) && submitted }" placeholder="零售价" v-model="item.retailPrice" @input.native="e => handleInput(e, index)">
<el-popover v-show="(!(item.retailPrice + '') || +item.supplyPrice > +item.retailPrice) && submitted" slot="suffix" placement="top" title="" width="90" trigger="hover" :content="!(item.retailPrice + '') ? '零售价是必填项' : '零售价要大于供货价'">
<i class="el-icon-warning color-red" slot="reference"></i>
</el-popover>
</el-input>
</td> -->
<td :style="{ width: specsWidth }">{{ item.supplyPrice }}元</td>
<!-- <td :style="{ width: specsWidth }">{{ (item.retailPrice - item.supplyPrice).toFixed(2) }}元</td> -->
<td :style="{ width: specsWidth }">{{ item.stock }}件</td>
</tr>
</tbody>
</table>
</div>
</div>
<glsx-combi-form v-if="!specificationDetailList.length" class="edit-form-container" ref="editFormRef" labelWidth="140px" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule"></glsx-combi-form>
</div>
<div class="footer" :style="{ left: footerLeft + 'px', width: footerWidth + 'px' }">
<!-- <el-button type="primary" @click="handleConfirm">确定</el-button> -->
<el-button type="default" @click="handleCancel">取消</el-button>
</div>
</div>
</template> </template>
<script> <script>
import { limitPrice } from '@/common/constant'
export default { export default {
name: 'takeGoodDetail', name: 'takeGoodDetail',
data() { data() {
return { } return {
size: 'small',
title: '查看商品',
// titleObj: {
// 1: '创建商品',
// 2: '编辑商品',
// 3: '查看商品'
// },
footerLeft: '0',
footerWidth: '0',
editChildRef: 'editChildRef',
// submitted: false,
isDisabled: false,
mainImgUrl: '',
moveNum: 0,
curMoveNum: 0,
/* eslint-disable */
reg: {
priceReg: /^\d[\d\.]*$/,
numReg: /^[1-9]\d*$/
},
/* eslint-enable */
routeInfo: {
// 1-新增;2-编辑;3-查看
addOrEdit: 1,
id: ''
},
specificationDetailList: [],
nameToValSpecsList: [],
editForm: {
retailPrice: ''
},
editRule: {
// retailPrice: [
// { required: true, message: '请输入零售价', trigger: 'change' },
// {
// validator: (rule, value, callback) => {
// return +this.editForm.supplyPrice > +value ? callback(new Error('零售价不能小于供货价')) : callback()
// },
// trigger: 'change'
// }
// ]
},
editFormData: [
// {
// label: '零售价',
// name: 'retailPrice',
// width: '280px',
// type: 'input',
// isDisabled: false
// },
{
label: '供货价',
name: 'supplyPrice',
width: '280px',
type: 'input',
isDisabled: true
},
{
label: '库存',
name: 'goodsStock',
width: '280px',
type: 'input',
isDisabled: true
}
]
}
}, },
components: {}, mounted() {
this.footerLeft = document.querySelector('.base-container-right').offsetLeft
this.footerWidth = document.documentElement.clientWidth - this.footerLeft
this.routeInfo = this.$route.params
// this.title = this.titleObj[this.routeInfo.addOrEdit]
this.isDisabled = true
this.editFormData[0].isDisabled = true
this.getInfo()
},
methods: {
getInfo() {
this.$apis.proManage.getProInfoApi({ id: this.routeInfo.id }).then(res => {
this.editForm = {
...res,
retailPrice: '',
supplyPrice: res.supplyPrice ? (res.supplyPrice / 100).toFixed(2) : ''
}
// 规格
if (this.editForm.specificationList.length) {
this.specificationDetailList = this.$common.utils.deepClone(this.editForm.specificationList)
this.recoverySpec()
// this.findSpeceMin()
} else {
// 零售价
this.editForm.retailPrice = (res.retailPrice / 100).toFixed(2)
}
this.mainImgUrl = this.editForm.goodsDetailImageList[0].content
this.moveNum = this.editForm.goodsDetailImageList.length > 4 ? this.editForm.goodsDetailImageList.length - 4 : 0
})
},
// 规格值解构
changeSpecs(isRecovery) {
this.specsWidth = 100 / (this.specificationDetailList.length + 2) + '%'
this.nameToValSpecsList = []
var markIdx = 0
for (var i = 0; i < this.specificationDetailList.length; i++) {
markIdx = 0
for (var j = 0; j < this.specificationDetailList[i].specificationValueList.length; j++) {
if (i == 0) {
this.nameToValSpecsList.push({
specsValueList: [this.specificationDetailList[i].specificationValueList[j].specificationValue],
retailPrice: '',
stock: ''
})
} else {
var targetValLen = this.specificationDetailList[i].specificationValueList.length
var loopNum = 0
var tempMarkIdx = 0
if (j == 0 && targetValLen > 1) {
var obj = JSON.parse(JSON.stringify(this.nameToValSpecsList))
this.nameToValSpecsList = []
obj.forEach((item, index) => {
for (var k = 0; k < targetValLen; k++) {
this.nameToValSpecsList.push(JSON.parse(JSON.stringify(item)))
}
})
}
loopNum = this.nameToValSpecsList.length / targetValLen
tempMarkIdx = markIdx
for (var k = 0; k < loopNum; k++) {
this.nameToValSpecsList[tempMarkIdx].specsValueList.push(this.specificationDetailList[i].specificationValueList[j].specificationValue)
tempMarkIdx = tempMarkIdx + targetValLen
}
markIdx = markIdx + 1
}
}
}
if (isRecovery) {
this.nameToValSpecsList.forEach((item, index) => {
var specificationObj = {}
item.specsValueList.forEach((subItem, subIndex) => {
specificationObj[this.specificationDetailList[subIndex].specificationName] = subItem
})
item.specificationData = this.setLocaleCompare(specificationObj)
for (var i = 0; i < this.editForm.specificationDetailList.length; i++) {
var temp = this.editForm.specificationDetailList[i]
if (temp.specificationData == item.specificationData) {
item.retailPrice = (temp.retailPrice / 100).toFixed(2)
item.specificationKey = temp.specificationKey
item.stock = temp.stock
item.supplyPrice = this.editForm.supplyPrice
break
}
}
})
}
},
setLocaleCompare(params) {
let keys = []
let obj = []
Object.keys(params).forEach(item => {
keys.push(item)
})
keys.sort()
keys.forEach(item => {
obj.push([item, params[item]])
})
return obj.join('&').replace(/,/g, '-')
},
// 恢复规格值
recoverySpec() {
this.changeSpecs(true)
},
// 换图
handleChangeImg(idx) {
this.mainImgUrl = this.editForm.goodsDetailImageList[idx].content
},
// 移动图片
handleMoveImg(dirction) {
var el = document.getElementsByClassName('small-box')[0]
if (dirction == 'left') {
if (this.curMoveNum == 0) {
return true
}
this.curMoveNum = this.curMoveNum - 1
el.style.left = '-' + this.curMoveNum * 90 + 'px'
} else {
if (this.curMoveNum == this.moveNum) {
return true
}
this.curMoveNum = this.curMoveNum + 1
el.style.left = '-' + this.curMoveNum * 90 + 'px'
}
},
// handleInput(e, idx) {
// var newValue = e.target.value
// if (!this.reg.priceReg.test(newValue)) {
// newValue = ''
// }
// var oldValue = newValue
// if (e.key != 'Backspace' && newValue.length > 1) {
// oldValue = newValue.slice(0, newValue.length - 1)
// }
// this.nameToValSpecsList[idx].retailPrice = limitPrice(newValue, oldValue, 5, 2)
// },
// 跳转
// whereToGo(id) {
// document.getElementById(id).scrollIntoView()
// },
// checkSpeceData() {
// var flag = true
// for (var i = 0; i < this.nameToValSpecsList.length; i++) {
// var item = this.nameToValSpecsList[i]
// if (!item.retailPrice) {
// this.whereToGo('specificationDetailList')
// return false
// }
// if (+item.retailPrice < +item.supplyPrice) {
// this.whereToGo('specificationDetailList')
// return false
// }
// }
// return flag
// },
// handleConfirm() {
// this.submitted = true
// var flag = false
// var params = {}
// if (this.nameToValSpecsList.length) {
// if (!this.checkSpeceData()) {
// return
// }
// params.specificationDetailList = []
// this.nameToValSpecsList.forEach((item, index) => {
// params.specificationDetailList.push({
// specificationData: item.specificationData,
// specificationKey: item.specificationKey,
// retailPrice: (item.retailPrice * 100).toFixed(0)
// })
// })
// } else {
// this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => {
// if (!valid) {
// flag = true
// } else {
// params = {
// retailPrice: (this.editForm.retailPrice * 100).toFixed(0)
// }
// }
// })
// }
// if (flag) {
// return true
// }
// params.id = this.routeInfo.id
// this.$apis.proManage.updateTakeProApi(params).then(res => {
// this.$message({
// message: res.code == '0' ? '操作成功' : '操作失败',
// type: res.code == '0' ? 'success' : 'error'
// })
// if (res.code == '0') {
// this.handleCancel()
// }
// })
// },
handleCancel() {
this.$router.push({
path: '/takeGood/index'
})
}
}
}
</script>
<style scoped>
.title {
padding: 13px 20px;
border-bottom: 1px solid #E5E5E5;
}
computed: {}, .view {
width: 375px;
height: 667px;
margin: 30px 45px 0 60px;
background: #F6F6F6;
position: relative;
}
mounted() {}, /* .control {
width: calc(100% - 480px);
} */
methods: {} .view img {
width: 100%;
vertical-align: top;
} }
</script> .edit-product-dh .main-img {
<style scoped> width: 375px;
height: 375px;
}
/* .edit-product-dh .flex {
display: flex;
} */
.edit-product-dh .arrow {
width: 0;
height: 0;
border-width: 20px;
border-style: solid;
margin-top: 20px;
cursor: pointer;
}
.edit-product-dh .left-arrow {
border-color: transparent #999999 transparent transparent;
}
.edit-product-dh .right-arrow {
border-color: transparent transparent transparent #999999;
}
.edit-product-dh .small-block {
position: relative;
overflow: hidden;
width: 344px;
height: 80px;
margin: 0 10px;
}
.edit-product-dh .small-box {
position: absolute;
left: 0;
}
.edit-product-dh .small-img {
width: 80px;
height: 80px;
margin-right: 8px;
cursor: pointer;
}
.edit-product-dh .pro-name {
width: 100%;
font-size: 20px;
color: #3A3A3A;
}
.edit-product-dh .supply-price {
font-size: 26px;
color: #FF6D00;
}
.edit-product-dh .border-red {
border: 1px solid red;
}
.txt-ellipsis {
display: -webkit-box;
overflow: hidden;
text-overflow: ellipsis;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
}
/* 规格 */
.edit-product-dh .spesc-label {
padding: 1px 10px;
box-sizing: border-box;
width: 110px;
color: #666;
text-align: right;
padding-right: 12px;
}
.edit-product-dh .table-spesc {
width: 100%;
text-align: center;
margin-bottom: 0;
}
.edit-product-dh .table-spesc tbody tr {
border: 1px solid #e7e7e7;
}
.edit-product-dh .table-spesc tbody td {
display: inline-block;
box-sizing: border-box;
width: 20%;
border: none;
padding: 2px 6px;
vertical-align: center;
text-align: center;
}
.edit-product-dh .table-spesc .el-input--small .el-input__inner {
text-align: center !important;
}
.edit-product-dh .w-320 {
width: 320px;
}
.color-red {
color: #eb4e4e;
cursor: pointer;
}
/* 规格 */
</style> </style>
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
</template> </template>
<script> <script>
import * as dayjs from 'dayjs'
export default { export default {
name: 'zoneList', name: 'zoneList',
data() { data() {
...@@ -69,14 +70,15 @@ export default { ...@@ -69,14 +70,15 @@ export default {
{ {
label: '创建日期', label: '创建日期',
prop: 'createdDate', prop: 'createdDate',
width: '180',
formatter: cellValue => { formatter: cellValue => {
return new Date(cellValue.createdDate).toLocaleDateString().replace(/\//g, '-') return dayjs(cellValue.createdDate).format('YYYY-MM-DD HH:mm:ss')
} }
},
{
label: '专区来源',
prop: ''
} }
// {
// label: '专区来源',
// prop: ''
// }
] ]
}, },
pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' } pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!