Commit ea36e006 by chenwq

发券宝导出,样式,列表

1 parent 2d61ecc5
......@@ -14,8 +14,8 @@
"dayjs": "^1.10.7",
"el-tree-transfer": "^2.2.6",
"element-ui": "^2.4.5",
"glsx-common": "^2.0.8",
"glsx-components": "^1.2.5",
"glsx-common": "^2.0.9",
"glsx-components": "^1.5.7",
"vue": "^2.6.10",
"vue-router": "^3.1.3",
"vuex": "^3.1.2"
......
......@@ -59,6 +59,18 @@ const updateCouponApi = params => {
})
}
const deleteCouponApi = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `dj.api.life.merchant.coupon.delete`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
// 分页查找园区店
const commodityAddSeviceMerchant = function(params) {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
......@@ -82,4 +94,16 @@ const getDistinctColum = function(params) {
sign: true
})
}
export default { getListApi, getDetailListApi, getTypeList, addCouponApi, updateCouponApi, commodityAddSeviceMerchant, getDistinctColum }
const exportCoupon = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = 'dj.api.life.merchant.coupon.exportExcel'
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
export default { getListApi, getDetailListApi, getTypeList, addCouponApi, updateCouponApi, deleteCouponApi, commodityAddSeviceMerchant, getDistinctColum, exportCoupon }
......@@ -11,13 +11,13 @@
let cfg = require('./conf.js')
import { Http, utils } from 'glsx-common'
let timeout = 30000 //超时时间
export const fetchConfig = function (isEnv = true) {
export const fetchConfig = function(isEnv = true) {
// if (isEnv) {
// let { request } = cfg
// Object.assign(request, { timeout })
// return Promise.resolve(cfg)
let params = { moduleName: 'inventory', mockUrl: 'https://oss-config.glsx.com.cn/mock/643e06c7ea3da3a974f54357/purchase/config',httpOptions: { Headers: { refererurl: location.href }, request: { timeout: 30000 } } }
let params = { moduleName: 'inventory', mockUrl: 'https://oss-config.glsx.com.cn/mock/643e06c7ea3da3a974f54357/purchase/config', env: 'test', httpOptions: { Headers: { refererurl: location.href }, request: { timeout: 30000 } } }
return utils.getConfig(params)
// return new Http().get('https://oss-config.test.glsx.com.cn/mock/616d28231072f92988f059fb/home/config')
// return new Http({ Headers: { refererurl: location.href }, request: { timeout: 30000 } }).get('http://config-center-backend.test.glsx.com/glsxAdmin/config?moduleUrl=home').then(res => res)
......@@ -26,4 +26,4 @@ export const config = {
install(vue, cfg) {
vue.prototype.$config = cfg
}
}
\ No newline at end of file
}
......@@ -62,3 +62,12 @@ export function getOptionsList(that, formName, hasAll = true, refreshSigle) {
})
}
}
export function aToExport(url) {
var a = document.createElement('a')
a.setAttribute('id', 'exportToExport')
a.setAttribute('href', url)
a.setAttribute('target', '_blank')
document.body.appendChild(a)
a.click()
}
<!-- 新增/编辑优惠券 -->
<template>
<div>
<GLDialog :bigTitle="!couponInfo ? '新增精品礼券' : '编辑精品礼券'" mode="big" :visible.sync="couponsVisible" @onCancel="handleAdd" @onOk="handleAddConfirm">
<GLDialog :bigTitle="!couponInfo ? '新增精品礼券' : '编辑精品礼券'" mode="big" :visible.sync="couponsVisible" :before-close="handleAdd" @onCancel="handleAdd" @onOk="handleAddConfirm">
<el-form ref="couponAddForm" :model="couponsForm" :rules="formRules" label-width="140px">
<el-form-item label="精品礼券名称:" prop="couponName">
<el-input style="width: 216px;" v-model="couponsForm.couponName" placeholder="给礼券起个名字" maxlength="20" />
......@@ -32,7 +32,7 @@
{ required: true, message: '请输入券码数量', trigger: 'blur' },
{ validator: validateAccount, trigger: 'blur' }
]">
<el-input-number v-model="couponsForm.amount" :min="1" :max="999" size="mini" />
<el-input-number v-model="couponsForm.amount" :min="1" :max="99999" size="mini" />
</el-form-item>
</template>
<el-form-item v-if="!couponInfo" label="批量发放门店:" prop="merchantCouponDTOList" :rules="[{ required: true, message: '请选择门店', trigger: 'change' }]">
......@@ -41,7 +41,7 @@
</el-button>
<selected-show-table :table-data="couponsForm.merchantCouponDTOList" @handleTableStoreDelete="handleTableStoreDelete">
<span slot="num" slot-scope="scope">
<el-input-number v-model="couponsNumList[scope.scope.index]" :min="1" :max="999" size="mini" @change="handleNumChange(scope.scope.index)" />
<el-input-number v-model="couponsNumList[scope.scope.index]" :min="1" :max="99999" size="mini" @change="handleNumChange(scope.scope.index)" />
<span class="car-error-txt" style="display: inline-block; padding-top: 2px;" v-show="!couponsNumList[scope.scope.index]">请输入数量</span>
</span>
</selected-show-table>
......@@ -169,6 +169,14 @@ export default {
},
handleAdd() {
// this.couponsVisible = !this.couponsVisible
this.couponsForm = {
couponName: '',
couponType: '',
couponTypeName: '',
chargeFlag: 'N',
remark: this.remarkTemp,
merchantCouponDTOList: []
}
this.$emit('couponClose', false)
this.$refs.couponAddForm && this.$refs.couponAddForm.resetFields()
},
......@@ -203,10 +211,10 @@ export default {
return true
}
this.couponsForm.merchantCouponDTOList = selectedData
this.couponsNumList = new Array(selectedData.length).fill(999)
this.couponsNumList = new Array(selectedData.length).fill(99999)
this.couponsForm.merchantCouponDTOList.forEach((item, idx) => {
if (!item.hasOwnProperty('amount')) {
item.amount = 999
item.amount = 99999
} else {
this.couponsNumList[idx] = item.amount
}
......@@ -255,6 +263,14 @@ export default {
type: 'success',
title: res.message || '操作成功'
})
this.couponsForm = {
couponName: '',
couponType: '',
couponTypeName: '',
chargeFlag: 'N',
remark: this.remarkTemp,
merchantCouponDTOList: []
}
this.$refs.couponAddForm && this.$refs.couponAddForm.resetFields()
this.$emit('couponClose', true)
})
......
<template>
<div class="purchase">
<div class="container">
<GLCombiForm ref="showSearch" :rowNumber="1" :formObj="searchForm" :formData="searchFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
<GLCombiForm :key="refresh" 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>
<el-tabs v-model="activeName" type="card" @tab-click="handleTabChange">
<el-tab-pane label="店面列表" name="storeList"></el-tab-pane>
<el-tab-pane label="领用明细" name="couponsDetail"></el-tab-pane>
</el-tabs>
<div class="btn">
<GLButton type="primary" size="small" @click="handleEdit('add', {})" fn="新增">新增</GLButton>
<el-button size="small" @click="handleExport">导出</el-button>
</div>
</div>
<el-tabs v-model="activeName" type="card" @tab-click="handleTabChange">
<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" @sortChange="sortChange">
<div class="table-btns" slot="auth-button" slot-scope="scope">
......@@ -36,7 +34,7 @@
import url from '@/assets/empty.png'
import constData from './constant/data'
import editCouponsDialog from './components/editCouponsDialog'
import { getOptionsList } from '@/utils/index'
import { getOptionsList, aToExport } from '@/utils/index'
import * as dayjs from 'dayjs'
// import baseList from './constant/baseList'
export default {
......@@ -47,6 +45,7 @@ export default {
},
data() {
return {
refresh: new Date(),
size: 'small',
url: url,
activeName: 'storeList',
......@@ -108,17 +107,11 @@ export default {
}
},
{
label: '区域',
prop: 'region',
formatter: cellValue => {
return cellValue.yqMerchantInfo?.region || ''
}
},
{
label: '门店名称',
prop: 'merchantName',
width: '200px',
formatter: cellValue => {
return cellValue.merchantName + ' - ' + cellValue.yqMerchantName
return cellValue.merchantName + (cellValue.yqMerchantName ? ' - ' + cellValue.yqMerchantName : '')
}
},
{
......@@ -205,9 +198,6 @@ export default {
type: 'text',
fn: '删除'
},
// condition: row => {
// return !row.goodsStatus
// },
listeners: {
click: row => this.handleDelete(row)
}
......@@ -222,7 +212,7 @@ export default {
label: '领用时间',
prop: 'createdDate',
sortable: 'custom',
width: '160px',
width: '180px',
formatter: cellValue => {
return dayjs(cellValue.createdDate).format('YYYY-MM-DD HH:mm:ss')
}
......@@ -234,17 +224,22 @@ export default {
{
label: '手机号',
prop: 'customerPhone',
width: '120px'
width: '140px'
},
{
label: '礼券名称',
prop: 'couponName'
},
{
label: '类型',
prop: 'couponTypeName'
},
{
label: '门店名称',
prop: 'merchantName',
width: '200px',
formatter: cellValue => {
return cellValue.merchantName + ' - ' + cellValue.yqMerchantName
return cellValue.merchantName + (cellValue.yqMerchantName ? ' - ' + cellValue.yqMerchantName : '')
}
},
{
......@@ -255,13 +250,12 @@ export default {
optionId: 'confId',
optionLabel: 'confValue'
}
// optionList: []
},
{
label: '核销状态',
prop: 'usedFlag',
width: '100px',
formatter: (cellValue) => {
formatter: cellValue => {
return {
N: '待核销',
Y: '已核销'
......@@ -272,27 +266,21 @@ export default {
optionId: 'confId',
optionLabel: 'confValue'
}
// optionList: [{ confValue: '待核销', confId: 'N' }, { confValue: '已核销', confId: 'Y' }]
},
{
label: '核销人',
prop: 'sellerName'
// optionConfig: {
// searchItemName: 'sellerNameList',
// optionId: 'confId',
// optionLabel: 'confValue'
// }
// optionList: []
},
{
label: '核销时间',
prop: 'usedTime',
sortable: 'custom',
width: '160px',
width: '180px',
formatter: cellValue => {
return cellValue.usedTime ? dayjs(cellValue.usedTime).format('YYYY-MM-DD HH:mm:ss') : ''
}
}]
}
]
},
// 新增
couponsVisible: false,
......@@ -329,7 +317,6 @@ export default {
getDistinctColum() {
// columType属性类型(1:发券人;2:转化人)
this.$apis.coupons.getDistinctColum({ columType: 2, currentPage: 1, pageSize: 100 }).then(res => {
console.log(res)
let _list = []
res.forEach(item => {
_list.push({
......@@ -365,7 +352,6 @@ export default {
},
changeFormAttr(formName, attrName, labelList, attrValue) {
console.log(this[formName])
labelList.forEach(item => {
let idx = this[formName].findIndex(k => k.label == item)
this[formName][idx][attrName] = attrValue
......@@ -374,6 +360,7 @@ export default {
// tab切换
handleTabChange() {
this.refresh = new Date()
let storeAttrList = ['状态']
let couponAttrList = ['发券人', '核销状态', '核销人']
this.changeFormAttr('searchFormData', 'isHide', storeAttrList, this.activeName != 'storeList')
......@@ -383,7 +370,6 @@ export default {
// 停用
handleStop(row) {
console.log(row)
let params = {
id: row.id,
enabledFlag: row.enabledFlag === 'Y' ? 'N' : 'Y'
......@@ -394,7 +380,22 @@ export default {
// 删除
handleDelete(row) {
this.secondConfirm(this, '删除提示', '是否确认删除该礼券?')
let params = {
id: row.id
}
this.secondConfirm(this, '删除提示', '是否确认删除该礼券?', 'coupons', 'deleteCouponApi', params)
},
// 导出
handleExport() {
let params = {
...this.searchForm,
currentPage: 1,
pageSize: 9999
}
this.$apis.coupons.exportCoupon(params).then(res => {
aToExport(res.data)
})
},
// 排序
......@@ -433,4 +434,12 @@ export default {
}
</script>
<style scoped>
.table-header {
position: relative;
}
.btn {
position: absolute;
right: 0;
top: 0;
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!