|
@@ -0,0 +1,357 @@
|
|
|
+<template>
|
|
|
+ <a-card size="small" :bordered="false">
|
|
|
+ <a-spin :spinning="spinning" tip="Loading...">
|
|
|
+ <div ref="tableSearch" class="table-page-search-wrapper">
|
|
|
+ <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
|
|
|
+ <a-row :gutter="15">
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-item label="活动名称">
|
|
|
+ <a-input id="redPacket-shelfName" allowClear v-model.trim="queryParam.rewardRuleName" placeholder="请输入活动名称"/>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-item label="货架名称">
|
|
|
+ <a-input id="redPacket-shelfName" allowClear v-model.trim="queryParam.shelfName" placeholder="请输入货架名称"/>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-item label="配件经销商">
|
|
|
+ <dealerList ref="dealerList" @change="dealerChange" id="redPacket-dealerChange"></dealerList>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <template v-if="advanced">
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-item label="汽车修理厂">
|
|
|
+ <storeList ref="storeList" @change="storeChange" id="redPacket-storeChange"></storeList>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-item label="员工姓名">
|
|
|
+ <a-input id="redPacket-shelfName" allowClear v-model.trim="queryParam.userName" placeholder="请输入员工姓名"/>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-item label="员工手机号码">
|
|
|
+ <a-input id="redPacket-shelfName" allowClear v-model.trim="queryParam.userMobile" placeholder="请输入员工手机号码"/>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-item label="订单编号">
|
|
|
+ <a-input id="redPacket-orderNo" allowClear v-model.trim="queryParam.orderNo" placeholder="请输入订单编号"/>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-item label="订单类型">
|
|
|
+ <v-select id="redPacket-orderType" code="REWARD_BIZ_TYPE" v-model="queryParam.orderType" allowClear placeholder="请选择订单类型"></v-select>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <!-- <a-col :md="6" :sm="24">
|
|
|
+ <a-form-item label="iSCM销售单号">
|
|
|
+ <a-input id="redPacket-shelfName" allowClear v-model.trim="queryParam.bizNo" placeholder="请输入iSCM销售单号"/>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col> -->
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-item label="红包奖励时间">
|
|
|
+ <rangeDate ref="rangeDate" @change="dateChange" />
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-item label="红包发放状态">
|
|
|
+ <v-select id="redPacket-rewardStatus" code="REWARD_SEND_STATUS" v-model="queryParam.rewardStatus" allowClear placeholder="请选择红包发放状态"></v-select>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ </template>
|
|
|
+ <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
|
|
|
+ <a-button type="primary" @click="$refs.table.refresh(true)" id="redPacket-search">查询</a-button>
|
|
|
+ <a-button type="" @click="reset" id="gredPacket-reset" style="margin-left: 10px;">重置</a-button>
|
|
|
+ <a-button type="primary" @click="exportFile" class="button-warning" id="gredPacket-export" style="margin-left: 10px;">导出</a-button>
|
|
|
+ <a @click="advanced=!advanced" style="margin-left: 8px">
|
|
|
+ {{ advanced ? '收起' : '展开' }}
|
|
|
+ <a-icon :type="advanced ? 'up' : 'down'"/>
|
|
|
+ </a>
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
+ </a-form>
|
|
|
+ <div class="table-operator">
|
|
|
+ <a-button type="primary" class="button-error" @click="plPublish">批量标记已发</a-button>
|
|
|
+ <span v-if="totalChoose">已选{{ totalChoose }}项</span>
|
|
|
+ </div>
|
|
|
+ <a-alert type="info" style="margin-bottom:10px">
|
|
|
+ <div slot="message">
|
|
|
+ 售价总计:<strong>{{ totalData&&(totalData.totalTerminalPrice || totalData.totalTerminalPrice==0) ? totalData.totalTerminalPrice : '--' }}</strong>;
|
|
|
+ 成本总计:<strong>{{ totalData&&(totalData.totalCityPrice || totalData.totalCityPrice==0) ? totalData.totalCityPrice : '--' }}</strong>;
|
|
|
+ 毛利总计:<strong>{{ totalData&&(totalData.totalGrossAmount || totalData.totalGrossAmount==0) ? totalData.totalGrossAmount : '--' }}</strong>;
|
|
|
+ 红包金额总计:<strong>{{ totalData&&(totalData.totalRewardAmount || totalData.totalRewardAmount==0) ? totalData.totalRewardAmount : '--' }}</strong>;
|
|
|
+ </div>
|
|
|
+ </a-alert>
|
|
|
+ </div>
|
|
|
+ <s-table
|
|
|
+ class="sTable fixPagination"
|
|
|
+ ref="table"
|
|
|
+ :style="{ height: tableHeight+84.5+'px', wordBreak: 'break-all' }"
|
|
|
+ size="small"
|
|
|
+ rowKey="id"
|
|
|
+ :columns="columns"
|
|
|
+ :row-selection="{ columnWidth: 40, getCheckboxProps: record => ({ props: { disabled: record.rewardStatus!='un_paid' } })}"
|
|
|
+ @rowSelection="rowSelectionFun"
|
|
|
+ :data="loadData"
|
|
|
+ :scroll="{ y: tableHeight, x: 2240 }"
|
|
|
+ :defaultLoadData="false"
|
|
|
+ bordered>
|
|
|
+ <template slot="orderNo" slot-scope="text, record">
|
|
|
+ <a @click="viewDetail(record)">{{ record.orderNo }}</a>
|
|
|
+ </template>
|
|
|
+ <template slot="rewardStatus" slot-scope="text, record">
|
|
|
+ <span v-if="record.rewardStatus=='un_paid'" style="color: #ffaa00;">{{ text }}</span>
|
|
|
+ <span v-else-if="record.rewardStatus=='paid'" style="color: #55aa00;">{{ text }}</span>
|
|
|
+ <span v-else style="color: #ff0000;">{{ text }}</span>
|
|
|
+ </template>
|
|
|
+ <template slot="action" slot-scope="text, record">
|
|
|
+ <a-button v-if="record.rewardStatus=='un_paid'" size="small" type="link" class="button-info" @click="handlePublish(record)">标记已发</a-button>
|
|
|
+ <a-button v-if="record.rewardStatus=='un_paid'" size="small" type="link" class="button-error" @click="handleDelete(record)">删除</a-button>
|
|
|
+ <span v-if="record.rewardStatus!='un_paid'">--</span>
|
|
|
+ </template>
|
|
|
+ </s-table>
|
|
|
+ </a-spin>
|
|
|
+ <!-- 详情弹框 -->
|
|
|
+ <statisticsDetail :visible="openModal" :itemData="itemData" @close="openModal=false"></statisticsDetail>
|
|
|
+ </a-card>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { STable, VSelect } from '@/components'
|
|
|
+import { rewardOrderQueryPage, rewardOrderCancel, cancelRewardBatch, exportRewardOrder, rewardOrderGiveReward, rewardOrderGiveRewardBatch, rewardOrderQueryCount } from '@/api/rewardOrder.js'
|
|
|
+import { hdExportExcel } from '@/libs/exportExcel'
|
|
|
+import dealerList from '@/views/common/dealerList.vue'
|
|
|
+import storeList from '@/views/common/storeList.vue'
|
|
|
+import rangeDate from '@/views/common/rangeDate.vue'
|
|
|
+import statisticsDetail from './statisticsDetail.vue'
|
|
|
+export default {
|
|
|
+ name: 'UserList',
|
|
|
+ components: { STable, VSelect, storeList, dealerList, rangeDate, statisticsDetail },
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ spinning: false,
|
|
|
+ advanced: false,
|
|
|
+ openModal: false,
|
|
|
+ tableHeight: 0,
|
|
|
+ // 查询参数
|
|
|
+ queryParam: {
|
|
|
+ rewardRuleName: '',
|
|
|
+ shelfName: '',
|
|
|
+ userName: '',
|
|
|
+ userMobile: '',
|
|
|
+ orderNo: '',
|
|
|
+ orderType: undefined,
|
|
|
+ bizNo: '',
|
|
|
+ rewardStatus: undefined,
|
|
|
+ beginDate: '',
|
|
|
+ endDate: ''
|
|
|
+ },
|
|
|
+ itemData: null, // 编辑行数据
|
|
|
+ totalData: null,
|
|
|
+ // 表头
|
|
|
+ columns: [
|
|
|
+ { title: '序号', dataIndex: 'no', width: '60px', align: 'center' },
|
|
|
+ { title: '活动名称', dataIndex: 'rewardRuleName', width: '150px', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
+ { title: '货架名称', dataIndex: 'shelfName', width: '180px', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
+ { title: '配件经销商', dataIndex: 'dealerName', width: '160px', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
+ { title: '汽车修理厂', dataIndex: 'storeName', width: '160px', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
+ { title: '员工姓名', dataIndex: 'userName', width: '80px', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '员工手机号码', dataIndex: 'userMobile', width: '100px', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '订单编号', dataIndex: 'orderNo', scopedSlots: { customRender: 'orderNo' }, width: '130px', align: 'center' },
|
|
|
+ { title: '订单类型', dataIndex: 'orderTypeDictValue', width: '80px', align: 'center', customRender: function (text) { return (text || text == 0) ? text : '--' } },
|
|
|
+ { title: '订单状态', dataIndex: 'orderStatusDictValue', width: '80px', align: 'center', customRender: function (text) { return (text || text == 0) ? text : '--' } },
|
|
|
+ { title: '下单方式', dataIndex: 'orderSourceDictValue', width: '90px', align: 'center', customRender: function (text) { return (text || text == 0) ? text : '--' } },
|
|
|
+ { title: '下单时间', dataIndex: 'orderDate', width: '150px', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: 'VIN', dataIndex: 'vin', width: '140px', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '车型', dataIndex: 'vehicleModel', width: '180px', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
+ { title: '红包奖励时间', dataIndex: 'rewardCreateDate', width: '150px', align: 'center', customRender: function (text) { return (text || text == 0) ? text : '--' } },
|
|
|
+ { title: '本单红包金额小计', dataIndex: 'totalRewardAmount', width: '80px', align: 'center', customRender: function (text) { return (text || text == 0) ? text : '--' } },
|
|
|
+ { title: '红包发放状态', dataIndex: 'rewardStatusDictValue', width: '100px', align: 'center', scopedSlots: { customRender: 'rewardStatus' } },
|
|
|
+ { title: '红包发放时间', dataIndex: 'giveDate', width: '150px', align: 'center', customRender: function (text) { return (text || text == 0) ? text : '--' } },
|
|
|
+ { title: '操作', width: '120px', align: 'center', scopedSlots: { customRender: 'action' }, fixed: 'right' }
|
|
|
+ ],
|
|
|
+ // 加载数据方法 必须为 Promise 对象
|
|
|
+ loadData: parameter => {
|
|
|
+ this.spinning = true
|
|
|
+ const params = Object.assign(parameter, this.queryParam)
|
|
|
+ return rewardOrderQueryPage(params).then(res => {
|
|
|
+ let data
|
|
|
+ if (res.status == 200) {
|
|
|
+ data = res.data
|
|
|
+ const no = (data.pageNo - 1) * data.pageSize
|
|
|
+ for (let i = 0; i < data.list.length; i++) {
|
|
|
+ const _item = data.list[i]
|
|
|
+ _item.no = no + i + 1
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.getCount(params)
|
|
|
+ this.spinning = false
|
|
|
+ return data
|
|
|
+ })
|
|
|
+ },
|
|
|
+ rowSelectionInfo: null
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ totalChoose () {
|
|
|
+ return this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys && this.rowSelectionInfo.selectedRowKeys.length
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ getCount (params) {
|
|
|
+ rewardOrderQueryCount(params).then(res => {
|
|
|
+ this.totalData = res.data
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 表格选中项
|
|
|
+ rowSelectionFun (obj) {
|
|
|
+ this.rowSelectionInfo = obj || null
|
|
|
+ },
|
|
|
+ // 创建时间 change
|
|
|
+ dateChange (date) {
|
|
|
+ this.queryParam.beginDate = date[0] ? date[0] + ' 00:00:00' : ''
|
|
|
+ this.queryParam.endDate = date[1] ? date[1] + ' 23:59:59' : ''
|
|
|
+ },
|
|
|
+ // 经销商 change
|
|
|
+ dealerChange (obj) {
|
|
|
+ this.queryParam.dealerSn = obj.key || undefined
|
|
|
+ },
|
|
|
+ // 汽车修理厂 change
|
|
|
+ storeChange (obj) {
|
|
|
+ this.queryParam.storeSn = obj.key || undefined
|
|
|
+ },
|
|
|
+ // 重置
|
|
|
+ reset () {
|
|
|
+ this.queryParam = {
|
|
|
+ rewardRuleName: '',
|
|
|
+ shelfName: '',
|
|
|
+ userName: '',
|
|
|
+ userMobile: '',
|
|
|
+ orderNo: '',
|
|
|
+ orderType: undefined,
|
|
|
+ bizNo: '',
|
|
|
+ rewardStatus: undefined,
|
|
|
+ beginDate: '',
|
|
|
+ endDate: ''
|
|
|
+ }
|
|
|
+ this.$refs.dealerList.resetForm()
|
|
|
+ if (this.advanced) {
|
|
|
+ this.$refs.rangeDate.resetDate()
|
|
|
+ this.$refs.storeList.resetForm()
|
|
|
+ }
|
|
|
+ this.$refs.table.refresh(true)
|
|
|
+ },
|
|
|
+ // 标记发布
|
|
|
+ handlePublish (row) {
|
|
|
+ const _this = this
|
|
|
+ this.$confirm({
|
|
|
+ title: '提示',
|
|
|
+ content: '确认要标记为已发吗?',
|
|
|
+ centered: true,
|
|
|
+ onOk () {
|
|
|
+ _this.spinning = true
|
|
|
+ rewardOrderGiveReward({ id: row.id }).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ _this.$message.success(res.message)
|
|
|
+ _this.$refs.table.refresh()
|
|
|
+ _this.$refs.table.clearSelected()
|
|
|
+ }
|
|
|
+ _this.spinning = false
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 批量发布
|
|
|
+ plPublish () {
|
|
|
+ const _this = this
|
|
|
+ if (this.totalChoose) {
|
|
|
+ this.$confirm({
|
|
|
+ title: '提示',
|
|
|
+ content: '确认要批量标记为已发吗?',
|
|
|
+ centered: true,
|
|
|
+ onOk () {
|
|
|
+ _this.spinning = true
|
|
|
+ rewardOrderGiveRewardBatch({
|
|
|
+ idList: _this.rowSelectionInfo.selectedRowKeys
|
|
|
+ }).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ _this.$message.success(res.message)
|
|
|
+ _this.$refs.table.refresh()
|
|
|
+ _this.$refs.table.clearSelected()
|
|
|
+ }
|
|
|
+ _this.spinning = false
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$message.warning('请先选择红包奖励记录!')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 详情
|
|
|
+ viewDetail (row) {
|
|
|
+ this.itemData = row
|
|
|
+ this.openModal = true
|
|
|
+ },
|
|
|
+ // 删除
|
|
|
+ handleDelete (row) {
|
|
|
+ const _this = this
|
|
|
+ this.$confirm({
|
|
|
+ title: '提示',
|
|
|
+ content: '确认要删除吗?',
|
|
|
+ centered: true,
|
|
|
+ onOk () {
|
|
|
+ _this.spinning = true
|
|
|
+ rewardOrderCancel({ id: row.id }).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ _this.$message.success(res.message)
|
|
|
+ _this.$refs.table.refresh()
|
|
|
+ _this.spinning = false
|
|
|
+ } else {
|
|
|
+ _this.spinning = false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 导出
|
|
|
+ exportFile () {
|
|
|
+ const _this = this
|
|
|
+ _this.spinning = true
|
|
|
+ hdExportExcel(exportRewardOrder, this.queryParam, '红包活动统计', function () {
|
|
|
+ _this.spinning = false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ pageInit () {
|
|
|
+ const _this = this
|
|
|
+ _this.$refs.table.refresh()
|
|
|
+ this.$nextTick(() => { // 页面渲染完成后的回调
|
|
|
+ _this.setTableH()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ setTableH () {
|
|
|
+ const tableSearchH = this.$refs.tableSearch.offsetHeight
|
|
|
+ this.tableHeight = window.innerHeight - tableSearchH - 275
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
|
|
|
+ this.setTableH()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted () {
|
|
|
+ this.pageInit()
|
|
|
+ this.reset()
|
|
|
+ },
|
|
|
+ beforeRouteEnter (to, from, next) {
|
|
|
+ next(vm => {
|
|
|
+ if (from.name == 'redPacketEdit' || from.name == 'redPacketAdd') {
|
|
|
+ vm.pageInit()
|
|
|
+ } else {
|
|
|
+ vm.reset()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|