Commit c2c8930e by 王志慧

commit

1 parent 1cab5ade
File mode changed
<template>
<div class="purchase">
<div class="container">
<GLCombiForm ref="showSearch" :rowNumber="1" :formObj="searchForm" :formData="showFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
<div class="table-header">
<span>总数量:9,待激活数量:2,已激活数量:7</span>
<el-button type="primary" size="small" @click="exportExcel">导出</el-button>
</div>
<!-- 表格区域 开始 -->
<GLTable ref="outboundRef" :getListApi="getListApi" :noDataImg="url" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn" @setTableFinishFun="setTableFinishFun"></GLTable>
<!-- 表格区域 end -->
</div>
</div>
</template>
<script>
import * as dayjs from 'dayjs'
import url from '@/assets/empty.png'
import { membraneTypeList } from '@/utils/constants.js'
export default {
name: 'warehousing',
data() {
return {
membraneTypeList: membraneTypeList,
size: 'small',
url: url,
searchForm: {
reduceDate: '',
eventType: '',
upgradeGoodsName: '',
yqMerchantId: '',
goodsType: '',
businessCode: '',
goodsSeries: '',
productCode: ''
},
tableSearchForm: {},
paramsObj: {},
// 查看门店
detailVisible: false,
showFormData: [
{
label: '卡号',
name: 'merchantName',
type: 'input',
maxlength: '20',
isClear: true
},
{
label: '关联业务单号',
name: 'merchantName',
type: 'input',
maxlength: '20',
isClear: true
},
{
label: '关联发货单号',
name: 'merchantName',
type: 'input',
maxlength: '20',
isClear: true
},
{
label: '所属商户',
name: 'merchantName',
type: 'input',
maxlength: '20',
isClear: true
},
{
label: '激活业务单号',
name: 'merchantName',
type: 'input',
maxlength: '20',
isClear: true
},
{
label: '状态',
name: 'eventType',
type: 'select',
optionList: [],
optionId: 'confId',
optionLabel: 'confLabel',
optionsName: 'eventTypeList'
},
{
label: '激活门店',
name: 'merchantName',
type: 'input',
maxlength: '20',
isClear: true
},
{
label: '激活客户',
name: 'productCode',
type: 'input',
isClear: true
},
{
label: '客户手机号',
name: 'productCode',
type: 'input',
isClear: true
}
],
// 表格
getListApi: this.$apis.stockManage.getMerchantGoodsStockReduceRecord,
tableParams: {
listName: 'list',
tableOption: false,
tableColumns: [
{
label: '卡号',
prop: 'upgradeGoodsName',
width: 180,
line: 1
},
{
label: '入库时间',
prop: 'reduceDate',
formatter: cellValue => {
return dayjs(cellValue.reduceDate).format('YYYY-MM-DD HH:mm:ss')
},
width: 180
},
{
label: '关联业务单号',
prop: 'upgradeGoodsName',
width: 180,
line: 1
},
{
label: '关发货单号',
prop: 'productCode',
width: 180,
line: 1
},
{
label: '所属商户',
prop: 'goodsSeries'
},
{
label: '所属分类',
prop: 'goodsTypeName',
minWidth: 120
},
{
label: '状态',
prop: 'eventType',
width: 100,
formatter: cellValue => {
return this.baseData.eventTypeList.find(item => item.confId === cellValue.eventType?.toString())?.confLabel
}
},
{
label: '激活业务单号',
prop: 'reduceStockMoney',
formatter: cellValue => {
return cellValue.reduceStockMoney ? '¥' + cellValue.reduceStockMoney.toFixed(2) : '-'
}
},
{
label: '激活时间',
prop: 'reduceDate',
formatter: cellValue => {
return dayjs(cellValue.reduceDate).format('YYYY-MM-DD HH:mm:ss')
},
width: 180
},
{
label: '激活门店',
prop: 'businessCode'
},
{
label: '激活客户',
prop: 'yqMerchantName',
width: 200
},
{
// label: '适用门店',
label: '客户手机号',
prop: 'storeUsage',
width: 200,
formatter: cellValue => {
return cellValue.storeUsage || '-'
}
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' },
// 基本数据
baseData: {
eventTypeList: [
{
confId: '1',
confLabel: '订单出库'
},
{
confId: '2',
confLabel: '盘点出库'
},
{
confId: '3',
confLabel: '调拨出库'
}
],
productTypeList: [],
yqMerchantList: []
}
}
},
mounted() {
this.$apis.product.getProductTypeBySceneId({ sceneType: '' }).then(res => {
this.baseData.productTypeList = res
this.getOptionsList('showFormData')
})
// 获取当前登录账号可见的园区店列表
this.$apis.stockManage.getyqMerchantList({}).then(res => {
this.baseData.yqMerchantList = res
this.getOptionsList('showFormData')
})
},
methods: {
getParams() {
var params = JSON.parse(JSON.stringify(this.searchForm))
if (this.searchForm.reduceDate) {
params.reduceStartDateStr = dayjs(this.searchForm.reduceDate[0]).format('YYYY-MM-DD HH:mm:ss')
params.reduceEndDateStr = dayjs(this.searchForm.reduceDate[0]).format('YYYY-MM-DD') + ' 23:59:59'
}
delete params.reduceDate
return params
},
beforeSearchFn() {
return new Promise(resolve => {
this.tableSearchForm = this.getParams()
resolve()
})
},
getOptionsList(formName, hasAll = true, refreshSigle) {
if (refreshSigle) {
var item = this[formName].find(k => k.name == refreshSigle)
var index = this[formName].findIndex(k => k.name == refreshSigle)
this.$set(this[formName][index], 'optionList', this.$common.utils.deepClone(this.baseData[item.optionsName]))
if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this[formName][index].optionLabel] !== '全部') {
const temp = {}
temp[this[formName][index].optionId] = ''
temp[this[formName][index].optionLabel] = '全部'
this[formName][index].optionList.unshift(temp)
}
} else {
this[formName].forEach((item, index) => {
if (item.type === 'select' && this.baseData[item.optionsName].length) {
this.$set(this[formName][index], 'optionList', this.$common.utils.deepClone(this.baseData[item.optionsName]))
if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this[formName][index].optionLabel] !== '全部') {
const temp = {}
temp[this[formName][index].optionId] = ''
temp[this[formName][index].optionLabel] = '全部'
this[formName][index].optionList.unshift(temp)
}
}
})
}
},
setTableFinishFun() {
//接收到的数据为空
this.$refs.outboundRef.data.length ? (this.$refs.outboundRef.tableHeightValues = '') : this.$refs.outboundRef.setTableHeightFun()
},
exportExcel() {
var params = this.getParams()
this.$apis.stockManage.exportReduceExcel(params).then(res => {
window.location.href = res
})
},
handleSearch() {
this.$refs.outboundRef.refreshTable()
},
handleReset() {
this.searchForm = {
reduceDate: '',
eventType: '',
upgradeGoodsName: '',
yqMerchantId: '',
goodsType: '',
businessCode: '',
goodsSeries: '',
productCode: ''
}
this.handleSearch()
}
}
}
</script>
<style scoped lang="scss">
@import '@/assets/css/mixin.scss';
.purchase {
.table-header {
@include space-between_center;
margin-bottom: 10px;
h2 {
font-weight: 600;
font-size: 16px;
color: #333;
}
}
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!