Commit 6f62a239 by zhangquan

定向礼包开发

1 parent f4651a23
import { http,http_merchant } from '@/main'
const getListApi = params => {
params.method = 'scrm.api.coupon.group.directional.gift.page'
return http({
url: 'rop-scrm-coupon/router',
method: 'POST',
data: params,
sign: true
})
}
const giftExportApi = params => {
params.method = 'scrm.api.coupon.group.directional.gift.list.export'
return http({
url: 'rop-scrm-coupon/router',
method: 'GET',
data: params,
sign: true
})
}
//删除
const deleteGiftApi = params => {
params.method = 'scrm.api.coupon.group.directional.gift.delete'
return http({
url: 'rop-scrm-coupon/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
const getMerchantListApi = params => {
params.method = 'merchants.api.open.findMerchantBySupMerchantNo'
return http_merchant({
url: 'rop-merchants/router',
method: 'POST',
data: params,
sign: true
})
}
const insertGiftApi = params => {
params.method = 'scrm.api.coupon.group.directional.gift.create'
return http({
url: 'rop-scrm-coupon/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
// 获取详情
const getGiftInfoApi = params => {
params.method = 'scrm.api.coupon.group.directional.gift.detail'
return http({
url: 'rop-scrm-coupon/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
export default { getListApi, giftExportApi, deleteGiftApi, getMerchantListApi, insertGiftApi, getGiftInfoApi }
\ No newline at end of file
......@@ -239,6 +239,24 @@ const staticRoutes = Object.freeze([
meta: {}
},
{
name: 'groupGiftBag',
path: '/groupGiftBag/index',
component: resolve => require([`@/views/groupGiftBag/index.vue`], resolve),
meta: {}
},
{
name: 'groupGiftDetail',
path: '/groupGiftBag/giftDetail',
component: resolve => require([`@/views/groupGiftBag/giftDetail.vue`], resolve),
meta: {}
},
{
name: 'groupEditGift',
path: '/groupGiftBag/editGift',
component: resolve => require([`@/views/groupGiftBag/editGift.vue`], resolve),
meta: {}
},
{
name: 'sopIndex',
path: '/sop/index',
component: resolve => require([`@/views/sop/index.vue`], resolve),
......
<template>
<div>
<el-input @blur.stop="formatPhone" type="textarea" v-model="phones" :placeholder="placeholder"></el-input>
<span v-if="isTip" class="approval-tip" style="margin-left:0;">{{ tip }}</span>
<div style="width: 565px;">
<div :class="['tel-item', !item.valid ? 'valid-tel' : receiveType == 1 ? 'realTel' : 'realNum']" v-for="(item, index) in phoneLists" :key="index">
{{ item.tel }}
<i style="cursor:pointer" class="el-icon-close" @click="delPhone(item.tel)"></i>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'phone-area',
model: {
prop: 'newList',
event: 'changePhoneList'
},
props: {
receiveType: {
type: String,
require: true,
default: '1'
},
placeholder: {
type: String,
default: ''
},
isTip: {
type: String,
default: ''
},
phones: {
type: String,
default: ''
},
phoneLists: {
type: Array
}
},
// data() {
// return {
// phones: '',
// phoneLists: []
// }
// },
methods: {
delPhone(val) {
let phones = '\n' + this.phones + '\n'
phones = phones.replace(/[\n]/g, '\n\n')
phones = phones.replace(new RegExp('[\n]' + val + '[\n]', 'g'), '\n')
phones = phones.replace(/[\n]+/g, '\n')
phones = phones.replace(/^[\n]+/, '')
this.phones = phones
this.formatPhone()
},
formatPhone() {
let phoneLists = this.phones.split('\n')
phoneLists = [...new Set(phoneLists)]
// let phoneLists = this.phones.split(/[\n|\s|,|,]/)
let reg
if (this.receiveType == 1) {
reg = /^(13[0-9]|15[0-9]|16[0-9]|17[0-9]|18[0-9]|19[0-9]|14[0-9])[0-9]{8}$/
} else {
reg = /^[0-9a-zA-Z]{6}$/
}
let arr = []
phoneLists.forEach(item => {
arr.push({
tel: item,
valid: reg.test(item)
})
})
this.phoneLists = arr.filter(item => item.tel)
this.$emit('changePhoneList', this.phoneLists, this.phones)
},
}
}
</script>
<style scope lang="scss">
.tel-item {
height: 26px;
display: inline-block;
padding: 0 8px;
line-height: 26px;
background: #fafbfe;
border-radius: 4px;
border: 1px solid #e8e8ea;
color: #666666;
text-align: center;
margin-right: 4px;
box-sizing: border-box;
}
.valid-tel {
background: #fff1f0;
border: 1px solid #ffa39e;
color: #ff4d4f;
}
.realTel {
width: 130px;
}
.realNum {
width: 90px;
}
.el-textarea {
width: 632px;
}
</style>
<!-- 编辑礼包 -->
<template>
<div class="edit-gift marketing edit-box">
<!-- <div v-if="routeInfo.addOrEdit != 'add'" class="container approval-container">
<p class="edit-title">审批信息</p>
<div class="approval-info">
<div class="approval_label">审批人:{{ editForm.approveBy }}</div>
<div class="approval_label">
审批状态:
<span :style="{ color: approvalStatusColor[approvalStatus] }">{{ approvalStatusVal[approvalStatus] }}</span>
</div>
<div v-if="approvalStatus == 2" class="approval_label">
驳回说明:
<div class="approval_con">{{ editForm.approveExplain }}</div>
</div>
</div>
</div> -->
<div class="container edit-container">
<p class="edit-title">{{ title }}</p>
<el-radio-group @change="changeGiftType" v-model="giftType">
<el-radio :label="1">自选礼包</el-radio>
<el-radio :label="2">集团礼包</el-radio>
</el-radio-group>
<glsx-combi-form v-loading="loading" class="edit-form-container m-r-20" ref="editFormRef" :isEdit="isEdit" :labelWidth="defaultLabelWidth" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule">
<div slot="giftTypeSlot">
<div style="display:inline-block" v-for="item in giftTypeList" :key="item.value">
{{item.name}}
</div>
</div>
<div slot="remarkName" class="edit-tips m-t-8">可根据备注名称进行查找,仅作内部查看,不展示给客户</div>
<el-button slot="selectGiftBtn" :disabled="routeInfo.receivedStock" class="default-blue-btn" @click="handleGiftAdd">选择礼包内容</el-button>
<div slot="selectGroupGift">
<div v-for="(item,index) in groupList" :key="index" @click="selectGroupGift(item)">{{item.name}}</div>
</div>
<div slot="couponListBlock" class="gift-block" :style="{ 'margin-left': defaultLabelWidth }" v-show="editForm.couponList && editForm.couponList.length != 0">
<div class="gift-title">
预估成本:
......@@ -155,6 +153,7 @@ export default {
phone: '',
isLoaded: true,
loading: false,
giftType: 1,
tableSearchForm: { staffName: '' },
phoneList: [],
size: 'small',
......@@ -225,6 +224,16 @@ export default {
list: []
}
},
giftTypeList: [
{
name: '自选礼包',
value: 1
},
{
name: '集团礼包',
value: 2
}
],
editRule: {
name: [{ required: true, message: '请输入礼包名称', trigger: 'change' }],
remarkName: [{ required: true, message: '请输入备注名称', trigger: 'change' }],
......@@ -271,6 +280,11 @@ export default {
isEdit: true,
editFormData: [
{
label: '礼包类型',
name:'',
addHtml:'giftTypeSlot'
},
{
label: '礼包名称',
name: 'name',
isDisabled: false,
......@@ -292,6 +306,11 @@ export default {
addHtml: 'selectGiftBtn'
},
{
label:'选择礼包',
name: '',
addHtml: 'selectGroupGift'
},
{
label: '',
name: 'couponListBlock',
isHide: true,
......@@ -405,7 +424,8 @@ export default {
isChangeCoupons: true,
isChangePeople: true,
currentCoupons: [],
currentPeople: []
currentPeople: [],
groupList:[]
}
},
components: {
......@@ -419,6 +439,12 @@ export default {
},
deep: true
},
// giftType: {
// handler(val){
// },
// deep: true
// },
'editForm.couponList': {
handler(val) {
this.isChangeCoupons = this.judgeAddOrDel(val, this.currentCoupons, 'id')
......@@ -463,8 +489,18 @@ export default {
}
})
}
let a = '{"discount":{"label":"折扣券","discountType":2,"list":[]},"cash":{"label":"代金券","discountType":3,"list":[{"id":581,"discountType":3,"couponName":"验证关联商品-全部商品","couponAmount":1,"couponAnticipatedCost":100,"status":"2"},{"id":569,"discountType":3,"couponName":"礼包线上代金劵","couponAmount":1,"couponAnticipatedCost":750,"status":"2"}]},"exchange":{"label":"兑换券","discountType":4,"list":[]},"service":{"label":"会员服务","discountType":7,"list":[{"id":1074,"discountType":7,"couponName":"xxx123123123123","couponAmount":1,"couponAnticipatedCost":3200,"status":"2"}]}}'
let b = '{"discount":{"label":"折扣券","discountType":2,"list":[]},"cash":{"label":"代金券","discountType":3,"list":[]},"exchange":{"label":"兑换券","discountType":4,"list":[]},"service":{"label":"会员服务","discountType":7,"list":[{"id":1074,"discountType":7,"couponName":"xxx123123123123","couponAmount":1,"couponAnticipatedCost":3200,"status":"2"},{"id":1072,"discountType":7,"couponName":"xx123","couponAmount":1,"couponAnticipatedCost":100,"status":"2"},{"id":1071,"discountType":7,"couponName":"xx222","couponAmount":1,"couponAnticipatedCost":100,"status":"2"}]}}'
this.groupList = [
{name: '第一个礼包',gift: JSON.parse(a)},
{name: '大爱的礼包',gift: JSON.parse(b)}
]
},
methods: {
selectGroupGift(item){
console.log(item)
this.handleGiftConfirm(item.gift)
},
//员工查询
handleSearch() {
this.$refs?.staffDialog?.getList({}, true)
......@@ -601,6 +637,7 @@ export default {
this.handleGiftClose()
},
handleGiftConfirm(selectedData) {
console.log(selectedData,'selectedData')
this.handleGiftClose()
this.couponObj = selectedData
this.recoveryTotalPrice()
......
<!-- 礼包详情 -->
<template>
<div class="edit-gift detail-page marketing edit-box">
<div class="container edit-container">
<p class="edit-title">{{ title }}</p>
<glsx-combi-form v-loading="loading" class="edit-form-container m-r-20" ref="editFormRef" :isEdit="isEdit" :labelWidth="labelWidth" defaultWidth="415px" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule">
<div slot="couponListBlock" class="gift-block" v-show="editForm.couponList && editForm.couponList.length != 0">
<div class="gift-title">
预估成本:
<span class="price">{{ totalEstimatedCost }}</span>
元
</div>
<div v-for="(item, index) in orderShow" :key="index">
<div class="gift-box" v-show="couponObj[item].list.length">
<!-- <div class="gift-label">{{ couponObj[item].label }}:</div> -->
<img class="server-type" :src="require(`@/assets/coupon/icon-${item}.png`)" />
<div class="gift-content">
<div class="gift-item" v-for="(subItem, subIndex) in couponObj[item].list" :key="subIndex">
<span :class="['circle', subItem.status == '3' ? ' grey' : '']"></span>
<p :class="['gift-info', subItem.status == '3' ? ' txt-grey' : '']">{{ subItem.couponName }} × {{ subItem.couponAmount }}</p>
<p v-show="subItem.status == '3'" class="gift-tips">已失效</p>
</div>
</div>
</div>
</div>
</div>
</glsx-combi-form>
<div class="approval_note_container">
<div class="line"></div>
<div class="note_container">
<div class="left">
<span class="mar40">创建时间:{{ editForm.createdDate }}</span>
<span class="">创建人:{{ editForm.createdBy }}</span>
</div>
<div class="right">
<span class="mar40">最后修改时间:{{ editForm.updatedDate }}</span>
<span class="">修改人:{{ editForm.updatedBy }}</span>
</div>
</div>
</div>
</div>
<GLFooter>
<el-button @click="handleCancel" size="medium">取消</el-button>
</GLFooter>
</div>
</template>
<script>
import * as dayjs from 'dayjs'
export default {
name: 'giftDetail',
data() {
return {
size: 'small',
title: '礼包详情',
loading: false,
editChildRef: 'editChildRef',
receiveDetailList: [],
routeInfo: {
// add-新增;edit-编辑;detail-详情
addOrEdit: 'add',
id: ''
},
labelWidth: '144px',
editForm: {
name: '',
// 优惠券类型(discountType) 1:满减券,2:折扣券,3:代金券,4:兑换券,5:购车代金券,6:商品折扣券,7:会员服务
// 优惠券状态(status):1:未生效,2:生效中,3:已失效
couponList: []
},
totalEstimatedCost: '',
orderShow: ['service', 'cash', 'discount', 'exchange'],
numToCoupon: {
2: 'discount',
3: 'cash',
4: 'exchange',
7: 'service'
},
couponObj: {
// 折扣券
discount: {
label: '折扣券',
discountType: 2,
list: []
},
// 代金券
cash: {
label: '代金券',
discountType: 3,
list: []
},
// 兑换券
exchange: {
label: '兑换券',
discountType: 4,
list: []
},
// 会员服务
service: {
label: '会员服务',
discountType: 7,
list: []
}
},
editRule: {
name: [{ required: true, message: '请输入礼包名称', trigger: 'change' }],
couponList: [{ required: true, message: '请选择礼包', trigger: 'change' }],
},
isEdit: true,
editFormData: [
{
label: '礼包名称',
name: 'name',
type: 'showTxt'
},
{
label: '礼包设置',
name: 'couponList',
addHtml: 'couponListBlock'
},
],
}
},
mounted() {
this.routeInfo = this.$route.query
this.loading = true
this.getInfo()
},
methods: {
getInfo() {
this.$apis.giftBag
.getGiftInfoApi({ id: this.routeInfo.id })
.then(res => {
res.data.createdDate = dayjs(res.data.createdDate).format('YYYY-MM-DD HH:mm:ss')
res.data.updatedDate = dayjs(res.data.updatedDate).format('YYYY-MM-DD HH:mm:ss')
this.editForm = res.data
this.recoveryCoupon()
this.recoveryTotalPrice()
})
.finally(() => {
this.loading = false
})
},
recoveryCoupon() {
this.orderShow.forEach(item => {
this.couponObj[item].list = []
})
this.editForm.couponList.forEach(item => {
this.couponObj[this.numToCoupon[item.discountType]].list.push(item)
})
},
// 计算预估成本
recoveryTotalPrice() {
this.totalEstimatedCost = 0
this.orderShow.forEach(itme => {
this.couponObj[itme].list.forEach(subItem => {
// 失效券不加入预估成本
if (subItem.status != '3') {
this.totalEstimatedCost = this.totalEstimatedCost + subItem.couponAnticipatedCost * subItem.couponAmount
}
})
})
this.totalEstimatedCost = (this.totalEstimatedCost / 100).toFixed(2)
},
handleCancel() {
this.$router.push({
path: '/giftBag/index',
query: { type: this.routeInfo.type }
})
}
}
}
</script>
<style lang="scss">
.marketing.edit-gift .select-merchant {
/* width: calc(98% - 140px); */
width: 98%;
}
.marketing.edit-gift .staff-block {
width: 567px;
background: #ffffff;
border-radius: 4px;
border: 1px solid #e5e5e5;
}
.detail-page {
#receiveRule{
.el-radio-group{
.is-checked {
.el-radio__input.is-checked .el-radio__inner{
border-color:#5850ff;
&::after{
background-color: #5850ff;
}
}
}
.el-radio__label{
color: #333333!important;
}
}
}
}
.marketing.edit-gift {
// 礼包
.gift-block {
width: 878px;
border-radius: 4px;
border: 1px solid #e5e5e5;
.gift-title {
padding: 10px;
background-color: #f4f6fc;
border-bottom: 1px solid #e5e5e5;
.price {
font-size: 18px;
}
}
.gift-box {
display: flex;
padding: 10px 0 10px 10px;
.server-type {
margin: 4px 12px 0 0;
height: 23px;
width: 58px;
}
.gift-label {
width: 70px;
color: #999999;
text-align: right;
}
.gift-content {
width: calc(100% - 70px);
border-bottom: 1px solid #e5e5e5;
.gift-item {
display: inline-block;
width: 50%;
.gift-info {
display: inline-block;
margin: 0 5px 0 7px;
}
.gift-tips {
display: inline-block;
font-size: 12px;
height: 18px;
line-height: 18px;
color: #999999;
background-color: #eeeded;
margin-right: 7px;
}
}
}
.gift-content:last-child {
border-bottom: 0px;
}
}
}
.phone-wrap {
width: 878px;
background-color: #f9f9f9;
padding: 5px 10px;
line-height: 14px;
font-size: 14px;
box-sizing: border-box;
margin-top: 5px;
.phone {
display: inline-block;
margin: 5px 16px 5px 0;
}
.realTel {
width: 120px;
}
.realNum {
width: 80px;
}
}
// 发放员工
.sale-select {
display: flex;
align-items: center;
}
.input-tag-wrapper-detail {
max-height: 68px;
overflow: auto;
position: relative;
font-size: 14px;
background-color: #fff;
background-image: none;
border-radius: 4px;
// border: 1px solid #dcdfe6;
box-sizing: border-box;
color: #666;
display: inline-block;
outline: none;
padding: 5px 5px 0px 5px;
flex-wrap: wrap;
transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
width: 567px;
display: flex;
align-items: center;
// margin-top: 6px;
font-size: 14px;
i {
color: #75acff;
margin-right: 3px;
font-size: 14px;
}
}
.el-tag {
margin-right: 4px;
height: 26px;
line-height: 24px;
margin-bottom: 5px;
// background: #fff !important;
}
.el-tag.el-tag--info .el-tag__close {
color: #e8e8ea;
background-color: rgba(0, 0, 0, 0) !important;
}
.el-tag.el-tag--info .el-tag__close:hover {
background-color: #5f5efb !important;
}
.tag-input {
background: transparent;
border: none !important;
font-size: 14px;
height: 32px;
outline: none;
padding-left: 0;
width: 100px;
}
}
// v2.0.0
.approval-info {
display: flex;
box-sizing: border-box;
padding: 32px 0 12px 82px;
.approval_label {
font-size: 14px;
font-weight: 400;
color: #666666;
width: 30%;
// width: 80px;
display: flex;
line-height: 20px;
white-space: nowrap;
.approval_con {
width: 80%;
font-size: 14px;
font-weight: 400;
color: #333333;
line-height: 20px;
white-space: pre-wrap;
}
}
}
.approval_note_container {
.line {
margin: 0 20px;
border-top: 1px solid #d8d8d8;
}
.note_container {
box-sizing: border-box;
padding: 32px 68px 12px 68px;
display: flex;
justify-content: space-between;
.left,
.right {
display: flex;
align-items: center;
font-size: 14px;
font-weight: 400;
color: #666666;
.mar40 {
margin-right: 40px;
}
}
}
}
.user {
margin-left: 144px;
}
</style>
<!-- 定向礼包-->
<template>
<div class="marketing">
<div class="m-b-10">
<!-- <el-button :size="size" type="primary" fn="新增礼包" class="el-icon-plus" @click="handleEdit('add')">新增礼包</el-button> -->
<GLButton :size="size" type="primary" fn="新增礼包" class="el-icon-plus" @click="handleEdit('add')">新增礼包</GLButton>
</div>
<div class="list-tips m-b-10">
<img class="tips-img" src="@/assets/icon-info.png" />
<span>集团礼包:将多种券组合成礼包,由集团指定的门店进行发放,客户领取后可在指定的门店间进行使用。</span>
</div>
<div class="container">
<div>
<GLCombiForm @handleOk="handleSearch" :rowNumber="1" @handleRest="handleReset" ref="showSearch" :formObj="searchForm" :formData="searchFormData"></GLCombiForm>
<GLButton style="float:right;margin-bottom:10px;" :size="size" class="default-blue-btn" type="default" fn="导出" @click="handleExport">导出</GLButton>
</div>
<!-- 表格区域 开始 -->
<GLTable ref="giftListRef" :getListApi="getListApi" :hasNum="false" :noDataImg="url" :searchForm="searchForm" :tableParams="tableParams" :pageConf="pageConf" @setTableFinishFun="setTableFinishFun">
<div slot="giftInfo" slot-scope="scope">
<div class="p-b-12">礼包明细</div>
<div class="gift-detail flex-wrap">
<div class="gift-item" v-for="(item, index) in scope.scope.couponDTOList" :key="index">
<img :src="require(`@/assets/coupon/icon-${attrToIcon[item.discountType]}.png`)" />
<p :class="['gift-coupon-name', item.status == '3' ? ' txt-grey' : '']">{{ item.couponName }} × {{ item.couponAmount }}</p>
<p v-show="item.status == '3'" class="gift-tips">已失效</p>
</div>
</div>
</div>
<div slot="name" slot-scope="scope">
<p class="cursor-pointer" @click="handleDetail(scope.scope)">{{ scope.scope.name }}</p>
</div>
<div class="table-btns" slot="auth-button" slot-scope="scope">
<GLTableButton :buttonList="buttonList" :buttonItem="scope" :buttonNum="3"></GLTableButton>
</div>
</GLTable>
</div>
</div>
</template>
<script>
import url from '@/assets/empty.png'
import { aToExport } from '@/common/constant'
export default {
name: 'giftList',
data() {
return {
attrToIcon: {
2: 'discount',
3: 'cash',
4: 'exchange',
7: 'service'
},
buttonList: [
{
type: 'GLButton',
name: row => {
return '编辑'
},
attrs: {
type: 'text',
fn: '编辑'
},
listeners: {
click: row => this.handleEdit('edit', row.scope)
}
},
{
type: 'GLButton',
name: row => {
return '删除'
},
attrs: {
type: 'text',
fn: '删除'
},
listeners: {
click: row => this.handleDelete(row.scope)
}
}
],
size: 'small',
url: url,
searchForm: {
name: '',
merchantName: ''
},
// 搜索
searchFormData: [
{
label: '礼包名称',
name: 'name',
type: 'input',
maxlength: 30,
placeholder: '请输入礼包/备注名称',
isClear: true
},
{
label: '下发门店',
name: 'merchantName',
type: 'input',
maxlength: 30,
placeholder: '请输入门店名称',
isClear: true
},
],
// 表格
getListApi: this.$apis.groupGiftBag.getListApi,
tableParams: {
listName: 'list',
tableOption: {
width: 200,
align: 'center'
},
tableColumns: [
{
label: '',
prop: '',
columnattrs: {
type: 'expand'
},
addHtml: 'giftInfo'
},
{
label: '序号',
prop: 'idx',
width: 60
},
{
label: '礼包名称',
prop: 'name',
addHtml: 'name'
},
{
label: '礼包明细',
prop: 'name',
},
{
label: '预估成本/元',
prop: 'anticipatedCost',
formatter: cellValue => {
let total = cellValue.couponDTOList.reduce(function(prev, cur) {
return prev + +(cur.couponAnticipatedCost * cur.couponAmount).toFixed(0)
}, 0)
return total / 100
}
},
{
label: '下发门店',
prop: 'staffList',
line: 1,
formatter: cellValue => {
return cellValue.storeList.map(item => item.merchantName).join('、')
}
},
{
label: '已领取',
prop: 'stock',
formatter: cellValue => {
return cellValue.receivedStock || '0'
}
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
}
},
mounted() {
},
methods: {
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()
}
})
}
}
})
},
handleDelete(row) {
this.secondConfirm('删除', '是否确认删除该礼包?', 'groupGiftBag', 'deleteGiftApi', { id: row.id })
},
// 导出
handleExport() {
var params = {...this.searchForm}
this.$apis.groupGiftBag.giftExportApi(params).then(res => {
aToExport(res)
})
},
// 查看
handleDetail(row) {
this.$router.push({
path: '/groupGiftBag/giftDetail',
query: {
id: row.id
}
})
},
// add-新增;edit-编辑
handleEdit(addOrEdit, row) {
var params = {
addOrEdit: addOrEdit,
$title: encodeURI(addOrEdit == 'add' ? '新增礼包' : '编辑礼包')
}
addOrEdit != 'add' && (params.id = row.id)
this.$router.push({
path: '/groupGiftBag/editGift',
query: params
})
},
setTableFinishFun() {
var page = this.$refs.giftListRef.page
// 添加序号
this.$refs.giftListRef.data.forEach((item, index) => {
item.idx = index + (page[this.pageConf.pageNum] - 1) * page[this.pageConf.pageSize] + 1
})
//接收到的数据为空
this.$refs.giftListRef.data.length ? (this.$refs.giftListRef.tableHeightValues = '') : this.$refs.giftListRef.setTableHeightFun()
},
handleSearch() {
this.$refs.giftListRef.refreshTable()
},
handleReset() {
this.searchForm = {
name: '',
merchantName: ''
},
this.handleSearch()
}
}
}
</script>
<style lang="scss" scoped>
.p-b-12 {
margin-bottom: 14px;
font-weight: 500;
padding-left: 10px;
color: #333333;
}
.approve-status {
width: 6px;
height: 6px;
border-radius: 4px;
margin-right: 8px;
display: inline-block;
}
.qr-dialog {
/deep/.el-dialog__body {
// padding: 20px;
.el-scrollbar__wrap {
overflow: hidden;
}
.qrcode-body {
display: flex;
flex-direction: column;
align-items: center;
p {
line-height: 28px;
margin-bottom: 16px;
}
.el-select {
.el-input__inner {
width: 360px;
height: 36px;
}
.el-input__icon {
line-height: 36px;
}
}
.img {
margin-top: 16px;
background: #eee;
display: flex;
align-items: center;
justify-content: center;
&,
img {
width: 160px;
height: 160px;
}
}
}
}
}
.gift-detail {
padding:0 200px 0 10px;
.gift-item {
margin-right: 80px;
display: flex;
align-items: center;
color: #333333;
width: 400px;
img {
height: 23px;
width: 58px;
margin-right: 10px;
}
.gift-coupon-name {
display: inline-block;
}
.gift-tips {
display: inline-block;
font-size: 12px;
height: 18px;
line-height: 18px;
color: #999999;
background-color: #eeeded;
margin-right: 7px;
}
}
}
.gift-detail .gift-item:last-child {
margin-right: 0;
}
</style>
<!-- 定向礼包 -->
<template>
<div class="gift-bag">
<el-tabs v-model="activeName" @tab-click="handleTabClick">
<el-tab-pane label="集团礼包" name="giftList">
<gift-list v-if="activeName == 'giftList'"></gift-list>
</el-tab-pane>
<el-tab-pane label="已领取" name="receivedGiftList">
<receivedGiftList v-if="activeName == 'receivedGiftList'"></receivedGiftList>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script>
import giftList from './giftList.vue'
import receivedGiftList from './receivedGiftList.vue'
export default {
name: 'gitfBag',
data() {
return {
activeName: 'giftList'
}
},
components: {
giftList,
receivedGiftList
},
created() {
// this.activeName = sessionStorage.getItem('GIFTNAME') ? sessionStorage.getItem('GIFTNAME') : 'giftList'
if (this.$route.query.type == 'received') {
this.activeName = 'receivedGiftList'
}
},
mounted() {},
methods: {
handleTabClick() {
this.$router.push({ path: this.$route.path, query: { type: this.activeName == 'receivedGiftList' ? 'received' : 'gift' } })
}
}
}
</script>
<style>
.gift-bag .el-tabs__nav-wrap:after {
opacity: 0;
}
.gift-bag .el-tabs__item {
height: 20px !important;
line-height: 10px !important;
font-weight: 400;
font-size: 16px;
color: #717171;
height: 36px;
line-height: 36px;
}
.gift-bag .el-tabs__item:hover,
.gift-bag .el-tabs__item.is-active {
color: #5f5efb;
}
</style>
<!-- 选择员工弹窗 -->
<template>
<GLDialog class="muti-pro" :close-on-click-modal="false" bigTitle="选择员工" mode="big" :before-close="handleMutiSelectClose" :visible.sync="isMutiSelectVisible" @onOk="handleMutiSelectConfirm" @onCancel="handleMutiSelectClose" v-loading="loading">
<!-- <div class="noproDiv" v-show="!staffList.length && fnCallBack">
<img src="@/assets/noPro.png" />
<p class="noproP">系统暂无已创建的员工</p>
</div> -->
<div>
<slot name="search"></slot>
<GLTable v-loading="loading" ref="mutiProRef" :tableData="staffList" :pageConf="pageConf" :noDataImg="url" :tableParams="tableParams" @refreshTable="getList"></GLTable>
</div>
</GLDialog>
</template>
<script>
import url from '@/assets/empty.png'
export default {
name: 'selectStaffDialog',
data() {
return {
// 表格组件
userInfo: {},
staffList: [],
selectList: [],
fnCallBack: false,
url: url,
loading: true,
tableSearchForm: {
staffName: ''
},
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
// 表格参数
tableParams: {
listName: 'list',
// 行数据的key
mutiSelectUniqueKey: 'userOneId',
// 多选ref的名称
mutiSelectName: 'list',
tableColumns: [
{
label: '姓名',
prop: 'staffName'
},
{
label: '部门',
prop: 'departmentName'
},
{
label: '跟进员工类型',
prop: 'followerTypeName'
}
]
}
}
},
props: {
isMutiSelectVisible: {
type: Boolean,
default: false
},
searchForm: {
type: Object,
default: () => {}
},
selectedStaffList: {
type: Array,
default: () => []
}
},
mounted() {
this.userInfo = this.$globalState.session
this.selectList = JSON.parse(JSON.stringify(this.selectedStaffList))
this.selectList.map(item => (item.userOneId = item.staffUUID))
this.getList({}, true)
},
methods: {
getList(page, isResetPage = false) {
var params = {
...this.searchForm,
pageNum: isResetPage ? 1 : this.$refs.mutiProRef.page.pageNum,
pageSize: isResetPage ? 10 : this.$refs.mutiProRef.page.pageSize
}
this.loading = true
this.$apis.giftBag.getFollowerStaffListApi(params).then(res => {
// 重置分页组件
if (this.$refs.mutiProRef && isResetPage) {
this.$refs.mutiProRef.page.pageNum = 1
this.$refs.mutiProRef.page.pageSize = 10
}
this.staffList = res.data
this.loading = false
this.fnCallBack = true
this.$refs.mutiProRef.tableTotal = res.count
this.$nextTick(() => {
this.recoverySelected()
})
this.$refs.mutiProRef.tableHeightValues = '50vh'
})
},
recoverySelected() {
if (this.selectedStaffList && this.selectedStaffList.length) {
this.selectedStaffList.forEach(row => {
row.userOneId = row.staffUUID
this.$nextTick(() => {
let idx = this.$refs.mutiProRef.$refs[this.tableParams.mutiSelectName + 'MutiTable'].data.findIndex(item => item.userOneId == row.staffUUID)
if (idx > -1) {
try {
this.$refs.mutiProRef.$refs[this.tableParams.mutiSelectName + 'MutiTable'].toggleRowSelection(this.$refs.mutiProRef.$refs[this.tableParams.mutiSelectName + 'MutiTable'].data[idx], true)
let id = this.selectList.findIndex(item => item.staffUUID == row.staffUUID)
if (id > -1) this.selectList.splice(id, 1)
} catch (err) {
console.log(err)
}
}
})
})
}
},
handleMutiSelectConfirm() {
var selectedData = [...this.$refs.mutiProRef.mutiSelectArr[this.tableParams.mutiSelectName], ...this.selectList]
this.$emit('handleMutiSelectConfirm', selectedData)
},
handleMutiSelectClose() {
this.$emit('handleMutiSelectClose')
}
}
}
</script>
<style>
.muti-pro .m-t-10 {
margin-top: 10px;
}
.muti-pro .noproP {
width: 100%;
height: 20px;
font-family: PingFangSC-Medium;
font-size: 16px;
color: #666666;
line-height: 20px;
font-weight: 500;
text-align: center;
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!