Commit 7ea0c03f by chenwq

发券宝

1 parent e58d467f
import { http } from '@/main'
const path = 'dj.api.'
const path2 = 'dj.smartcarlife.api.'
const getListApi = params => {
params.method = `scrm.api.shopmall.goods.page.curMerchant`
return http({
url: 'rop-scrm-shopmall/router',
method: 'GET',
data: params,
sign: true
})
}
// 分页查找园区店
const commodityAddSeviceMerchant = function(params) {
params.method = `dj.api.servicemerchantref.page`
return http({
url: 'rop-scrm-shopmall/router',
method: 'GET',
data: params,
sign: true
})
}
const getSimpleMerchantList = params => {
params.method = 'scrm.api.carlife.merchant.listWithPageSimpleByCurMerchant'
return http({
url: 'rop-scrm-carlife/router',
method: 'POST',
data: params,
sign: true
})
}
export default { getListApi, commodityAddSeviceMerchant, getSimpleMerchantList }
......@@ -8,10 +8,10 @@
* @FilePath: \scrm\scrm-sub-blog\src\components\index.js
*/
import Vue from 'vue'
import glsxDialog from '@/components/glsx-dialog/index.vue'
// import glsxDialog from '@/components/glsx-dialog/index.vue'
import GlsxCombiForm from '@/components/glsx-combi-form/index.vue'
import GlsxForm from '@/components/glsx-form/index.vue'
Vue.component('glsx-dialog', glsxDialog)
// Vue.component('glsx-dialog', glsxDialog)
Vue.component('GlsxCombiForm', GlsxCombiForm)
Vue.component('GlsxForm', GlsxForm)
\ No newline at end of file
<!-- 关联门店弹窗 -->
<template>
<GLDialog bigTitle="关联门店" :visible.sync="relateStoreVisible" mode="big" okText="关联" @onOk="handleRelateStoreConfirm" @onCancel="handleRelateStoreClose" class="relateStore">
<slot />
<el-row class="tableCon">
<!-- <el-col :span="12"> -->
<div class="tableBox">
<el-table ref="seletingTable" :data="selectingData" height="464px" class="table" border @select="handleChange" @select-all="handleAll">
<el-table-column type="selection" width="55" align="center" :selectable="selectable" />
<el-table-column v-if="sourcePage != 'serviceStore'" prop="yqMerchantName" label="园区店名称" align="center">
<template slot-scope="scope">
<span :class="{'red': !scope.row.isSetUpgradeSettleRule && needTip.includes(sourcePage)}">{{ scope.row.yqMerchantName }}</span>
</template>
</el-table-column>
<el-table-column prop="merchantName" label="4S店名称" align="center">
<template slot-scope="scope">
<span :class="{'red': !scope.row.isSetUpgradeSettleRule && needTip.includes(sourcePage)}">{{ scope.row.merchantName }}</span>
<el-tooltip v-if="!scope.row.isSetUpgradeSettleRule" popper-class="tooltip-class" effect="dark" content="该门店无配置财务分润规则,无法关联!" placement="top">
<span v-if="!scope.row.isSetUpgradeSettleRule && needTip.includes(sourcePage)" class="tip-icon">?</span>
</el-tooltip>
</template>
</el-table-column>
</el-table>
<el-pagination small background @current-change="handleCurrentChange" :current-page.sync="currentPage" :page-size="pageSize" layout="total, prev, pager, next" :total="total" />
</div>
<!-- </el-col> -->
<!-- <el-col :span="12"> -->
<el-table :data="selectedData" class="table tableBox" border height="464px">
<el-table-column v-if="sourcePage != 'serviceStore'" prop="yqMerchantName" label="园区店名称" align="center" />
<el-table-column prop="merchantName" label="4S店名称" align="center" />
<el-table-column label="删除" align="center" width="50px">
<template slot-scope="scope">
<el-button class="el-icon-delete" @click="handleDelete(scope.row)" type="text" />
</template>
</el-table-column>
</el-table>
<!-- </el-col> -->
</el-row>
</GLDialog>
</template>
<script>
export default {
name: 'RelateStoreDialog',
data() {
return {
selectedData: [],
selectingData: [],
needTip: ['editProduct'],
// 分页
total: 0,
currentPage: 1,
pageSize: 20
}
},
props: {
relateStoreVisible: {
type: Boolean,
default: false
},
// 页面来源
sourcePage: {
type: String,
default: ''
},
storeApi: {
type: Function,
default: () => { }
},
storeSelected: {
type: Array,
default: () => []
},
storeSearchForm: {
type: Object,
default: () => { }
}
// 去掉表格中某些字段
// noTableField: {
// type: Array,
// default: () => []
// }
},
mounted() {
console.log('???/')
this.selectedData = this.storeSelected
this.getSelectingList()
},
methods: {
selectable(row, index) {
var isSelect = row.hasOwnProperty('beServed') ? !row.beServed : true
if (this.sourcePage === 'editProduct') {
// 不能选的判断
// console.log('??')
isSelect = row.isSetUpgradeSettleRule
}
return isSelect
},
recoverySelection() {
var exitIds = this.selectedData.map(item => item.merchantId)
this.selectingData.forEach(item => {
exitIds.includes(item.merchantId) && this.$refs.seletingTable.toggleRowSelection(item, true)
})
},
getSelectingList() {
this.storeApi({
...this.storeSearchForm,
currentPage: this.currentPage,
pageSize: this.pageSize
}).then(res => {
this.selectingData = res.list
this.total = res.total
this.$nextTick(() => {
this.recoverySelection()
})
})
},
handleChange(selection, row) {
var addOrDelete = !!selection.find(item => item.merchantId === row.merchantId)
addOrDelete ? this.selectedData.push(row) : (this.selectedData = this.selectedData.filter(item => item.merchantId !== row.merchantId))
},
handleAll(selection) {
this.selectingData.forEach(item => {
var isExit = this.selectedData.findIndex(subItem => subItem.merchantId === item.merchantId)
var isServed = item.hasOwnProperty('beServed') ? item.beServed : false
if (selection.length && (isExit === -1) && !isServed) {
this.selectedData.push(item)
} else if (!selection.length && (isExit !== -1)) {
this.selectedData.splice(isExit, 1)
}
})
},
handleDelete(row) {
this.selectedData = this.selectedData.filter(item => item.merchantId !== row.merchantId)
this.$refs.seletingTable.toggleRowSelection(row)
},
handleCurrentChange(val) {
this.currentPage = val
this.getSelectingList()
},
handleRelateStoreConfirm() {
this.$emit('handleRelateStoreConfirm', this.selectedData)
},
handleRelateStoreClose() {
this.$emit('handleRelateStoreClose')
}
}
}
</script>
<style lang="scss">
.relateStore .table {
margin: 0 auto 20px !important;
width: 98%;
}
.relateStore .tableCon {
display: flex;
.tableBox {
flex: 1;
}
}
.service-store .relateStore .el-table .cell,
.d2-form .relateStore .el-table .cell {
line-height: 26px !important;
}
.service-store .relateStore .el-table--medium td,
.d2-form .relateStore .el-table--medium td {
padding: 6px 8px !important;
}
.relateStore .red {
color: red;
}
.relateStore .tip-icon {
position: absolute;
display: inline-block;
height: 10px;
width: 10px;
line-height: 10px;
color: #ffffff;
background-color: red;
border: 1px solid red;
border-radius: 50%;
cursor: pointer;
font-size: 6px;
margin-left: 2px;
}
</style>
<!-- 被选中门店展示 -->
<template>
<div>
<el-table :data="tableData" style="width: 690px" border class="store-table">
<el-table-column label="序号" align="center" type="index" width="64px" />
<el-table-column prop="yqMerchantName" label="园区店名称" align="center" />
<el-table-column prop="merchantName" label="4S店名称" align="center" />
<el-table-column prop="merchantId" label="商户编号" align="center" />
<el-table-column prop="userType" label="商户类型" align="center">
<template slot-scope="scope">
<span>{{ baseData[scope.row.channelType === 2 ? 'ghUserTypeList' : 'userTypeList'][scope.row.userType] }}</span>
</template>
</el-table-column>
<el-table-column label="删除" align="center">
<template slot-scope="scope">
<el-button class="el-icon-delete" @click="handleDelete(scope.row)" type="text" />
</template>
</el-table-column>
<el-table-column label="券码数量(张)" align="center" width="160px">
<template slot-scope="scope">
<slot name="num" :scope="{row: scope.row, index: scope.$index}" />
</template>
</el-table-column>
</el-table>
</div>
</template>
<script>
// import { userType, ghUserType } from '@/common/constants.js'
export default {
name: 'SelectedShowTable',
data() {
return {
// 基本数据
baseData: {
userTypeList: [],
ghUserTypeList: []
}
}
},
props: {
tableData: {
type: Array,
default: () => []
}
},
components: {},
computed: {},
mounted() { },
methods: {
handleDelete(row) {
this.$confirm('是否确认删除该门店?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$emit('handleTableStoreDelete', row)
})
}
}
}
</script>
<style scoped>
</style>
const couponsObj = {
searchFormData: [
{
label: '礼券名称',
name: 'couponName',
type: 'input',
isClear: true
},
{
label: '门店名称',
name: 'merchantName',
type: 'input',
isClear: true
}
],
tableParams: {
needUnique: true,
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'list',
tableOption: true,
tableColumns: [
{
label: '批次号',
prop: 'merchantCouponCode'
},
{
label: '礼券名称',
parentProp: 'couponInfo',
prop: 'couponName'
},
{
label: '类型',
parentProp: 'couponInfo',
prop: 'couponTypeName',
optionConfig: {
searchItemName: 'couponTypeList',
optionId: 'goodsType',
optionLabel: 'goodsTypeName'
}
// optionList: []
},
{
label: '区域',
parentProp: 'yqMerchantInfo',
prop: 'region',
optionConfig: {
searchItemName: 'regionList',
optionId: 'confKey',
optionLabel: 'confValue'
}
// optionList: []
},
{
label: '门店名称',
prop: 'merchantName',
formatter: cellValue => {
return cellValue.merchantName + ' - ' + cellValue.yqMerchantName
}
},
{
label: '总数',
prop: 'amount',
sortable: 'custom'
},
{
label: '余量',
prop: 'allowance',
sortable: 'custom',
formatter: cellValue => {
return cellValue.amount - cellValue.getAmount
}
},
{
label: '发放量',
prop: 'getAmount',
sortable: 'custom'
},
{
label: '核销量',
prop: 'usedAmount',
sortable: 'custom'
},
{
label: '状态',
prop: 'enabledFlag',
optionConfig: {
searchItemName: 'enabledFlagList',
optionId: 'confId',
optionLabel: 'confLabel'
},
// optionList: [{ confLabel: '启用', confId: 'Y' }, { confLabel: '停用', confId: 'N' }],
formatter: cellValue => {
return {
Y: '启用',
N: '停用'
}[cellValue.enabledFlag]
}
}
]
}
}
export default {
couponsObj
}
<template>
<div class="purchase">
<div class="container">
<GLCombiForm ref="showSearch" :rowNumber="1" :formObj="searchForm" :formData="searchFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
<div class="table-header">
<GLButton type="primary" size="small" @click="handleEdit('add', {})" fn="新增">新增</GLButton>
</div>
<el-tabs v-model="activeName" type="card" @tab-click="handleSearch">
<el-tab-pane label="店面列表" name="storeList">
<store-list ref="storeList" :parent-search-form="parentSearchForm" />
</el-tab-pane>
<el-tab-pane label="领用明细" name="couponsDetail">
<coupons-detail ref="couponsDetail" :parent-search-form="parentSearchForm" />
</el-tab-pane>
</el-tabs>
<!-- 店面列表 - 表格区域 开始 -->
<GLTable v-show="activeName == 'storeList'" ref="storeRef" :getListApi="getListApi" :noDataImg="url" :searchForm="searchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn" @setTableFinishFun="setTableFinishFun">
<div class="table-btns" slot="auth-button" slot-scope="scope">
<GLTableButton :buttonList="tableButtonList" :buttonItem="scope.scope" :buttonNum="3"></GLTableButton>
</div>
</GLTable>
<!-- 表格区域 end -->
<!-- 领用明细 - 表格区域 开始 -->
<GLTable v-show="activeName == 'couponsDetail'" ref="storeRef" :getListApi="getListApi" :noDataImg="url" :searchForm="searchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn" @setTableFinishFun="setTableFinishFun"></GLTable>
<!-- 表格区域 end -->
</div>
<edit-coupons-dialog :coupons-visible="couponsVisible" :coupon-info="couponInfo" @couponClose="couponClose" />
</div>
</template>
<script>
import url from '@/assets/empty.png'
import constData from './constant/data'
import editCouponsDialog from './components/editCouponsDialog'
// import baseList from './constant/baseList'
export default {
name: 'coupons',
components: {
editCouponsDialog
},
data() {
return {
size: 'small',
url: url,
activeName: 'storeList',
searchForm: {
couponName: '',
merchantName: ''
},
couponInfo: null,
searchFormData: constData.couponsObj.searchFormData,
// 表格
getListApi: this.$apis.coupons.getListApi,
tableParams: constData.couponsObj.tableParams,
// pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' },
// 表格按钮
tableButtonList: [
{
type: 'GLButton',
name: '编辑',
attrs: {
type: 'text',
fn: '编辑'
},
// condition: row => {
// return row.goodsStatus
// },
listeners: {
click: row => this.handleEdit('detail', row)
}
},
{
type: 'GLButton',
name: '停用',
attrs: {
type: 'text',
fn: '停用'
},
// condition: row => {
// return !row.goodsStatus
// },
listeners: {
click: row => this.handleStop(row)
}
},
{
type: 'GLButton',
name: '删除',
attrs: {
type: 'text',
fn: '删除'
},
// condition: row => {
// return !row.goodsStatus
// },
listeners: {
click: row => this.handleDelete(row)
}
}
],
// 新增
couponsVisible: false,
// 基本数据
baseData: {
productTypeList: [],
brandList: []
// statusList: baseList.statusList
},
imgVisible: false,
previewImgUrl: ''
}
},
mounted() {
this.$utils.getOptionsList(this, 'searchFormData')
},
methods: {
/** 二次确认封装 */
secondConfirm(that, title, txt, apiModule, apiName, apiParams, type = 'warning', fn) {
that.$confirm(txt, title, {
confirmButtonText: '确定',
cancelButtonText: '取消',
type,
callback: action => {
if (action == 'confirm') {
// that.$apis[apiModule][apiName](apiParams).then(res => {
// that.$message({
// message: res.code == '0' ? '操作成功' : res.message,
// type: res.code == '0' ? 'success' : 'error'
// })
// if (res.code == '0') {
// fn && fn()
// that.handleSearch()
// }
// })
}
}
})
},
// 停用
handleStop(row) {
this.secondConfirm(this, '停用提示', '是否停用该礼券?')
},
// 删除
handleDelete(info) {
this.secondConfirm(this, '删除提示', '是否确认删除该礼券?')
console.log(info)
},
handleSearch() {
this.$refs.storeRef.refreshTable()
},
handleReset() {
this.searchForm = {
couponName: '',
merchantName: ''
}
this.handleSearch()
},
handleEdit(editType, info) {
this.couponsVisible = !this.couponsVisible
this.couponInfo = editType == 'edit' ? info : null
},
couponClose(isRefresh) {
this.couponsVisible = !this.couponsVisible
isRefresh && this.handleSearch()
}
}
}
</script>
<style scoped>
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!