|
@@ -0,0 +1,357 @@
|
|
|
+<template>
|
|
|
+ <div class="salesDetail-wrap" :style="{paddingBottom:hideFooter?'0px':'45px'}">
|
|
|
+ <a-spin :spinning="spinning" tip="Loading...">
|
|
|
+ <a-page-header :ghost="false" :backIcon="false" class="salesDetail-cont">
|
|
|
+ <template slot="subTitle">
|
|
|
+ <a href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
|
|
|
+ </template>
|
|
|
+ </a-page-header>
|
|
|
+ <a-card size="small" :bordered="false" class="pages-wrap">
|
|
|
+ <!-- 查询 -->
|
|
|
+ <div class="table-page-search-wrapper">
|
|
|
+ <div style="display: flex;justify-content: space-between;align-items: center;">
|
|
|
+ <div style="flex-grow: 1;width: 60%;">
|
|
|
+ <a-form layout="inline" @keyup.enter.native="searchTable">
|
|
|
+ <a-row :gutter="15" type="flex">
|
|
|
+ <a-col flex="300px">
|
|
|
+ <a-form-item label="促销名称/简称">
|
|
|
+ <a-input v-model.trim="queryParam.queryWord" allowClear placeholder="请输入促销名称/简称"/>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col flex="300px">
|
|
|
+ <a-form-item label="费用类型">
|
|
|
+ <a-select v-model="queryParam.expenseOption" placeholder="请选择费用类型" allowClear>
|
|
|
+ <a-select-option v-for="item in expenstype" :key="item.id" :value="item.id">{{item.name}}</a-select-option>
|
|
|
+ </a-select>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col flex="300px">
|
|
|
+ <a-form-item label="客户名称">
|
|
|
+ <dealerSubareaScopeList ref="dealerSubareaScopeList" @change="custChange" />
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col flex="300px">
|
|
|
+ <a-form-item label="销售单号">
|
|
|
+ <a-input v-model.trim="queryParam.salesBillNo" allowClear placeholder="请输入销售单号"/>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col flex="300px">
|
|
|
+ <a-form-item label="规则简称">
|
|
|
+ <a-input v-model.trim="queryParam.description" allowClear placeholder="请输入规则简称"/>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col flex="150px">
|
|
|
+ <a-button type="primary" :disabled="disabled" @click="$refs.table.refresh(true)">查询</a-button>
|
|
|
+ <a-button style="margin-left: 10px" :disabled="disabled" @click="resetSearchForm()">重置</a-button>
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
+ </a-form>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!-- 产品列表 -->
|
|
|
+ <div>
|
|
|
+ <s-table
|
|
|
+ class="sTable fixPagination"
|
|
|
+ ref="table"
|
|
|
+ :style="{ height: pageHeight+67+'px' }"
|
|
|
+ size="small"
|
|
|
+ :rowKey="(record) => record.id"
|
|
|
+ :columns="columns"
|
|
|
+ :row-selection="{ columnWidth: 40, getCheckboxProps: record => ({ props: { disabled: record.state == 'CANCEL' } }) }"
|
|
|
+ @rowSelection="rowSelectionFun"
|
|
|
+ :data="loadData"
|
|
|
+ :scroll="{ y: pageHeight }"
|
|
|
+ :defaultLoadData="false"
|
|
|
+ bordered>
|
|
|
+ <!-- 操作 -->
|
|
|
+ <template slot="action" slot-scope="text, record">
|
|
|
+ <div>
|
|
|
+ <a-button
|
|
|
+ size="small"
|
|
|
+ type="link"
|
|
|
+ class="button-warning"
|
|
|
+ @click="handleExpense(record)"
|
|
|
+ >转费用报销单</a-button>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </s-table>
|
|
|
+ </div>
|
|
|
+ </a-card>
|
|
|
+ </a-spin>
|
|
|
+ <div class="affix-cont" :style="{padding:hideFooter?0:'7px 0 4px'}">
|
|
|
+ <a-button
|
|
|
+ style="width: 100px;"
|
|
|
+ :disabled="spinning"
|
|
|
+ type="primary"
|
|
|
+ class="button-info"
|
|
|
+ @click="handleView()"
|
|
|
+ >
|
|
|
+ 查看
|
|
|
+ </a-button>
|
|
|
+ <a-button
|
|
|
+ type="primary"
|
|
|
+ :disabled="spinning"
|
|
|
+ style="width: 100px;margin: 0 20px;"
|
|
|
+ @click="handleSave()"
|
|
|
+ >
|
|
|
+ 提交
|
|
|
+ </a-button>
|
|
|
+ </div>
|
|
|
+ <!-- 新增费用单 -->
|
|
|
+ <baseDataModal ref="expenseModal" @expenseSaveOk="expenseSaveOk" :show="openBaseModal" @close="openBaseModal=false"></baseDataModal>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { commonMixin } from '@/utils/mixin'
|
|
|
+import moment from 'moment'
|
|
|
+import { STable, VSelect } from '@/components'
|
|
|
+import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
|
|
|
+import baseDataModal from '@/views/expenseManagement/expenseReimbursement/baseDataModal.vue'
|
|
|
+import { salesList, expenseAccountSave, queryCreateBySalesBillSn } from '@/api/salesNew'
|
|
|
+export default {
|
|
|
+ name: 'WaitCostOrder',
|
|
|
+ mixins: [commonMixin],
|
|
|
+ components: { STable, VSelect, dealerSubareaScopeList, baseDataModal },
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ spinning: false,
|
|
|
+ disabled: false,
|
|
|
+ hideFooter: false,
|
|
|
+ openBaseModal: false, // 费用弹框
|
|
|
+ fromRouter:'',
|
|
|
+ authCode:'',
|
|
|
+ expenstype: [
|
|
|
+ {
|
|
|
+ id: 'balance',
|
|
|
+ name: '结余'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 'exceed',
|
|
|
+ name: '超出'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 'giftConvertAmount',
|
|
|
+ name: '转采'
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ queryParam: {
|
|
|
+ queryWord: '',
|
|
|
+ expenseOption: '',
|
|
|
+ salesBillNo: '',
|
|
|
+ description: '',
|
|
|
+ buyerSn: ''
|
|
|
+ },
|
|
|
+ // 加载数据方法 必须为 Promise 对象
|
|
|
+ loadData: parameter => {
|
|
|
+ this.disabled = true
|
|
|
+ this.spinning = true
|
|
|
+ delete parameter.tableId
|
|
|
+ delete parameter.index
|
|
|
+ if (parameter.sortOrder) {
|
|
|
+ parameter['sortAlias'] = 'sales_bill'
|
|
|
+ } else {
|
|
|
+ delete parameter.sortField
|
|
|
+ }
|
|
|
+ this.queryParam.expenseClainFlag = "N"
|
|
|
+ return salesList(Object.assign(parameter, this.queryParam)).then(res => {
|
|
|
+ let data
|
|
|
+ if (res.status == 200) {
|
|
|
+ data = res.data
|
|
|
+ const no = (data.pageNo - 1) * data.pageSize
|
|
|
+ data.list.forEach((con, i) => {
|
|
|
+ con.no = no + i + 1
|
|
|
+ })
|
|
|
+ this.disabled = false
|
|
|
+ }
|
|
|
+ this.spinning = false
|
|
|
+ return data
|
|
|
+ })
|
|
|
+ },
|
|
|
+ rowSelectionInfo: null,
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ pageHeight () {
|
|
|
+ return window.innerHeight - 315 + (this.hideFooter ? 45 : 0)
|
|
|
+ },
|
|
|
+ columns () {
|
|
|
+ const _this = this
|
|
|
+ const arr = [
|
|
|
+ { title: '编号', dataIndex: 'no', width: '5%', align: 'center', customRender: function (text) { return text || '--' }},
|
|
|
+ { title: '销售单号', dataIndex: 'salesBillNo', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '客户名称', dataIndex: 'buyerName', width: '15%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
+ { title: '费用类型', scopedSlots: { customRender: 'warehouseBox' }, width: '8%', align: 'left', ellipsis: true },
|
|
|
+ { title: '待转金额', dataIndex: 'totalAmount', width: '8%', align: 'right',customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
+ { title: '促销名称', dataIndex: 'settleStyleSnDictValue', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '促销简称', dataIndex: 'auditDate', width: '15%', align: 'center', customRender: function (text) { return text || '--' }, sorter: true },
|
|
|
+ { title: '规则简称', dataIndex: 'lastStockUpDate', width: '10%', align: 'center', customRender: function (text) { return text || '--' }, sorter: true },
|
|
|
+ { title: '规则类型', dataIndex: 'billStatusDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
|
|
|
+ ]
|
|
|
+ return arr
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ // 返回
|
|
|
+ handleBack () {
|
|
|
+ this.$router.push({ name: 'salesQueryNewList' })
|
|
|
+ },
|
|
|
+ // 表格选中项
|
|
|
+ rowSelectionFun (obj) {
|
|
|
+ this.rowSelectionInfo = obj || null
|
|
|
+ },
|
|
|
+ custChange (val) {
|
|
|
+ this.queryParam.buyerSn = val.key
|
|
|
+ },
|
|
|
+ // 转费用单
|
|
|
+ async handleExpense (row) {
|
|
|
+ const _this = this
|
|
|
+ const hasExpense = await queryCreateBySalesBillSn({ salesBillSn: row.salesBillSn }).then(res => res.data || [])
|
|
|
+ const showModalFlag = []
|
|
|
+ const optionsKey = [
|
|
|
+ {
|
|
|
+ id: 'balance',
|
|
|
+ name: '采购额结余'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 'exceed',
|
|
|
+ name: '采购额超出'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 'giftConvertAmount',
|
|
|
+ name: '促销产品转采购额'
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ optionsKey.map(key => {
|
|
|
+ if (hasExpense[key.id]) {
|
|
|
+ showModalFlag.push(key)
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ if (showModalFlag.length) {
|
|
|
+ // 直接转费用单
|
|
|
+ if (showModalFlag.length == 1) {
|
|
|
+ _this.expenseSave(hasExpense[showModalFlag[0].id])
|
|
|
+ }
|
|
|
+ // 有2个以上采购额时
|
|
|
+ if (showModalFlag.length > 1) {
|
|
|
+ _this.$confirm({
|
|
|
+ title: '转费用报销单?',
|
|
|
+ centered: true,
|
|
|
+ class: 'confirm-center',
|
|
|
+ content: <div>
|
|
|
+ <div style="padding:10px 0;text-align:center;">请选择费用报销单类型</div>
|
|
|
+ <div style="padding:0 0 10px 0;text-align:center;">
|
|
|
+ <aRadioGroup onChange={_this.changeDaOpt}>
|
|
|
+ {showModalFlag.map(item => <aRadio key={item.id} style="height: '30px';lineHeight: '30px';padding:5px 0;" value={item.id}>{item.name}</aRadio>)}
|
|
|
+ </aRadioGroup>
|
|
|
+ </div>
|
|
|
+ </div>,
|
|
|
+ onOk () {
|
|
|
+ if (_this.expenseOption) {
|
|
|
+ _this.expenseSave(hasExpense[_this.expenseOption])
|
|
|
+ } else {
|
|
|
+ _this.$message.info('请选择费用报销单类型!')
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onCancel () {
|
|
|
+ _this.expenseOption = null
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 转费用单
|
|
|
+ expenseSave (data) {
|
|
|
+ console.log(data)
|
|
|
+ if (data) {
|
|
|
+ this.openBaseModal = true
|
|
|
+ this.$refs.expenseModal.setDetail(data, 'sales')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ expenseSaveOk (params) {
|
|
|
+ expenseAccountSave(params).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ this.$message.info(res.message)
|
|
|
+ this.$refs.table.refresh()
|
|
|
+ this.openBaseModal = false
|
|
|
+ this.expenseOption = null
|
|
|
+ this.$router.push({ name: 'expenseReimbursementEdit', params: { sn: res.data.expenseAccountSn } })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 查看
|
|
|
+ handleView () {
|
|
|
+ },
|
|
|
+ // 提交
|
|
|
+ handleSave(){
|
|
|
+
|
|
|
+ },
|
|
|
+ // 重置
|
|
|
+ resetSearchForm () {
|
|
|
+ this.queryParam.buyerSn = undefined
|
|
|
+ this.queryParam.expenseOption = undefined
|
|
|
+ this.queryParam.salesBillNo = ''
|
|
|
+ this.queryParam.queryWord = ''
|
|
|
+ this.queryParam.description = ''
|
|
|
+ this.$refs.table.refresh(true)
|
|
|
+ },
|
|
|
+ },
|
|
|
+ mounted () {
|
|
|
+ if (!this.$store.state.app.isNewTab || this.bizSn) { // 页签刷新时调用
|
|
|
+ this.resetSearchForm()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ activated () {
|
|
|
+ // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
|
|
|
+ if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
|
|
|
+ this.resetSearchForm()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ beforeRouteEnter (to, from, next) {
|
|
|
+ next(vm => {
|
|
|
+ vm.fromRouter = from
|
|
|
+ vm.authCode = to.meta.permission
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="less">
|
|
|
+ .salesDetail-wrap{
|
|
|
+ position: relative;
|
|
|
+ height: 100%;
|
|
|
+ padding-bottom: 45px;
|
|
|
+ box-sizing: border-box;
|
|
|
+ >.ant-spin-nested-loading{
|
|
|
+ overflow-y: auto;
|
|
|
+ height: 100%;
|
|
|
+ }
|
|
|
+ .salesDetail-cont{
|
|
|
+ margin-bottom: 6px;
|
|
|
+ }
|
|
|
+ .active-title{
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+ padding: 10px;
|
|
|
+ background: #f3f8fa;
|
|
|
+ }
|
|
|
+ .flexBox{
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ align-items: center;
|
|
|
+ }
|
|
|
+ .footer-cont{
|
|
|
+ margin-top: 5px;
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+ .redStyle{
|
|
|
+ font-weight: bold;
|
|
|
+ color: red;
|
|
|
+ }
|
|
|
+ }
|
|
|
+</style>
|