|
@@ -1,8 +1,330 @@
|
|
|
<template>
|
|
|
+ <a-card size="small" :bordered="false" class="pushOrder-wrap">
|
|
|
+ <!-- 搜索条件 -->
|
|
|
+ <div class="table-page-search-wrapper">
|
|
|
+ <a-form layout="inline">
|
|
|
+ <a-row :gutter="15">
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-item label="创建时间">
|
|
|
+ <a-range-picker
|
|
|
+ style="width:100%"
|
|
|
+ id="pushOrder-creatDate"
|
|
|
+ :disabledDate="disabledDate"
|
|
|
+ v-model="time"
|
|
|
+ :format="dateFormat"
|
|
|
+ :placeholder="['开始时间', '结束时间']" />
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-item label="客户名称" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
|
|
|
+ <custList id="pushOrder-buyerName" v-model="queryParam.buyerName"></custList>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-item label="关联销售单号">
|
|
|
+ <a-input id="pushOrder-salesBillNo" v-model.trim="queryParam.salesBillNo" allowClear placeholder="请输入销售单号"/>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <template v-if="advanced">
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-item label="下推单号">
|
|
|
+ <a-input id="pushOrder-dispatchBillNo" v-model.trim="queryParam.dispatchBillNo" allowClear placeholder="请输入下推单号"/>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-item label="业务状态">
|
|
|
+ <v-select
|
|
|
+ v-model="queryParam.billStatus"
|
|
|
+ ref="billStatus"
|
|
|
+ id="pushOrder-billStatus"
|
|
|
+ code="SALES_BILL_STATUS"
|
|
|
+ placeholder="请选择业务状态"
|
|
|
+ allowClear></v-select>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ </template>
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <span class="table-page-search-submitButtons">
|
|
|
+ <a-button type="primary" :disabled="disabled" @click="$refs.table.refresh(true)">查询</a-button>
|
|
|
+ <a-button style="margin-left: 8px" :disabled="disabled" @click="resetSearchForm()">重置</a-button>
|
|
|
+ <a @click="advanced=!advanced" style="margin-left: 8px">
|
|
|
+ {{ advanced ? '收起' : '展开' }}
|
|
|
+ <a-icon :type="advanced ? 'up' : 'down'"/>
|
|
|
+ </a>
|
|
|
+ </span>
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
+ </a-form>
|
|
|
+ </div>
|
|
|
+ <!-- alert -->
|
|
|
+ <a-alert type="info" showIcon style="margin-bottom:15px">
|
|
|
+ <div slot="message">
|
|
|
+ 下推总单数::<strong>{{ totalData.totalRecord }}</strong>;
|
|
|
+ 下推总数量:<strong>{{ totalData.totalQty }}</strong>;
|
|
|
+ 下推总金额:<strong>{{ totalData.totalAmount }}</strong>元;
|
|
|
+ </div>
|
|
|
+ </a-alert>
|
|
|
+ <!-- 列表 -->
|
|
|
+ <s-table
|
|
|
+ class="sTable"
|
|
|
+ ref="table"
|
|
|
+ size="default"
|
|
|
+ :rowKey="(record) => record.id"
|
|
|
+ :columns="columns"
|
|
|
+ :data="loadData"
|
|
|
+ :scroll="{ x: 2050, y:tableHeight }"
|
|
|
+ bordered>
|
|
|
+ <!-- 销售单号 -->
|
|
|
+ <template slot="salesBillNo" slot-scope="text, record">
|
|
|
+ <span style="color: #ed1c24;cursor: pointer;" @click="handleDetail(record)">{{ record.salesBillNo }}</span>
|
|
|
+ </template>
|
|
|
+ <!-- 下推单号 -->
|
|
|
+ <template slot="dispatchBillNo" slot-scope="text, record">
|
|
|
+ <span style="color: #ed1c24;cursor: pointer;" @click="handleDetail(record)">{{ record.dispatchBillNo }}</span>
|
|
|
+ </template>
|
|
|
+ <!-- 财务状态 -->
|
|
|
+ <template slot="financialStatus" slot-scope="text, record">
|
|
|
+ <a-badge :color="text=='FINISH'?'#87d068':'gold'" :text="record.financialStatusDictValue" />
|
|
|
+ </template>
|
|
|
+ <!-- 操作 -->
|
|
|
+ <template slot="action" slot-scope="text, record">
|
|
|
+ <a-button
|
|
|
+ size="small"
|
|
|
+ type="link"
|
|
|
+ class="button-warning"
|
|
|
+ v-if="record.billStatus == 'WAIT_AUDIT'"
|
|
|
+ @click="handleEexamine(record)"
|
|
|
+ >审核</a-button>
|
|
|
+ <a-button
|
|
|
+ size="small"
|
|
|
+ type="link"
|
|
|
+ v-if="record.billStatus == 'WAIT_OUT_WAREHOUSE'"
|
|
|
+ class="button-primary"
|
|
|
+ @click="handleSend(record)"
|
|
|
+ >出库</a-button>
|
|
|
+ <a-button
|
|
|
+ size="small"
|
|
|
+ type="link"
|
|
|
+ class="button-info"
|
|
|
+ v-if="record.salesBillSource == 'SALES' && record.billStatus !== 'CANCEL' && record.billStatus !== 'FINISH' && record.billStatus != 'WAIT_OUT_WAREHOUSE'"
|
|
|
+ @click="handleEdit(record)"
|
|
|
+ >
|
|
|
+ 编辑
|
|
|
+ </a-button>
|
|
|
+ <a-button
|
|
|
+ size="small"
|
|
|
+ type="link"
|
|
|
+ class="button-error"
|
|
|
+ v-if="record.salesBillSource == 'SALES' && record.billStatus !== 'FINISH' && record.financialStatus !== 'FINISH'"
|
|
|
+ @click="handleDel(record)"
|
|
|
+ >
|
|
|
+ 删除
|
|
|
+ </a-button>
|
|
|
+ <a-button
|
|
|
+ size="small"
|
|
|
+ type="link"
|
|
|
+ class="button-info"
|
|
|
+ v-if="record.salesBillSource == 'PURCHASE' && record.billStatus !== 'CANCEL' && record.billStatus !== 'FINISH' && record.billStatus != 'WAIT_OUT_WAREHOUSE'&& record.billStatus != 'AUDIT_REJECT'"
|
|
|
+ @click="handleEdit(record)"
|
|
|
+ >
|
|
|
+ 改单
|
|
|
+ </a-button>
|
|
|
+ <a-button
|
|
|
+ size="small"
|
|
|
+ type="link"
|
|
|
+ class="button-error"
|
|
|
+ v-if="record.salesBillSource == 'PURCHASE' && record.billStatus !== 'FINISH' && record.financialStatus !== 'FINISH'&& record.billStatus != 'AUDIT_REJECT'&& record.billStatus != 'WAIT_OUT_WAREHOUSE'"
|
|
|
+ @click="handleDel(record)"
|
|
|
+ >
|
|
|
+ 取消
|
|
|
+ </a-button>
|
|
|
+ <span v-if="record.billStatus == 'FINISH'||(record.salesBillSource == 'PURCHASE'&&record.billStatus == 'AUDIT_REJECT')">--</span>
|
|
|
+ </template>
|
|
|
+ </s-table>
|
|
|
+ </a-card>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import moment from 'moment'
|
|
|
+import { STable, VSelect } from '@/components'
|
|
|
+import custList from '@/views/common/custList.js'
|
|
|
+import { salesList, salesDel, salesWriteAudit, salesWriteStockOut, salesCount } from '@/api/sales'
|
|
|
+export default {
|
|
|
+ name: 'TableList',
|
|
|
+ components: { STable, VSelect, custList },
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ tableHeight: 0,
|
|
|
+ advanced: false, // 高级搜索 展开/关闭
|
|
|
+ disabled: false, // 查询、重置按钮是否可操作
|
|
|
+ dateFormat: 'YYYY-MM-DD',
|
|
|
+ time: [], // 创建时间
|
|
|
+ // 查询参数
|
|
|
+ queryParam: {
|
|
|
+ buyerName: undefined, // 客户名称
|
|
|
+ salesBillNo: '', // 销售单号
|
|
|
+ dispatchBillNo: '', // 下推单号
|
|
|
+ billStatus: undefined // 业务状态
|
|
|
+ },
|
|
|
+ totalData: {
|
|
|
+ totalAmount: 0,
|
|
|
+ totalCategory: 0,
|
|
|
+ totalQty: 0,
|
|
|
+ totalRecord: 0
|
|
|
+ },
|
|
|
+ // 表头
|
|
|
+ columns: [
|
|
|
+ { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
|
|
|
+ { title: '区域', dataIndex: 'shippingAddrCountyName', width: 120, align: 'center' },
|
|
|
+ { title: '省份', dataIndex: 'shippingAddrProvinceName', width: 120, align: 'center' },
|
|
|
+ { title: '创建时间', dataIndex: 'createDate', width: 160, align: 'center' },
|
|
|
+ { title: '单据来源', dataIndex: 'salesBillSource', width: 120, align: 'center' },
|
|
|
+ { title: '下推单号', scopedSlots: { customRender: 'dispatchBillNo' }, width: 210, align: 'center' },
|
|
|
+ { title: '关联销售单号', scopedSlots: { customRender: 'salesBillNo' }, width: 210, align: 'center' },
|
|
|
+ { title: '客户名称', dataIndex: 'buyerName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
+ { title: '下推数量', dataIndex: 'totalQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
+ { title: '下推金额', dataIndex: 'totalAmount', width: 100, align: 'center', customRender: function (text) { return '¥' + (text || 0) } },
|
|
|
+ { title: '备货时间', dataIndex: 'stockUpDate', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '出库时间', dataIndex: 'settleDate', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '业务状态', dataIndex: 'billStatusDictValue', width: 110, align: 'center' },
|
|
|
+ { title: '操作', scopedSlots: { customRender: 'action' }, width: 220, align: 'center', fixed: 'right' }
|
|
|
+ ],
|
|
|
+ // 加载数据方法 必须为 Promise 对象
|
|
|
+ loadData: parameter => {
|
|
|
+ this.disabled = true
|
|
|
+ if (this.tableHeight == 0) {
|
|
|
+ this.tableHeight = window.innerHeight - 440
|
|
|
+ }
|
|
|
+ // 创建时间
|
|
|
+ if (this.time && this.time.length > 0) {
|
|
|
+ this.queryParam.beginDate = moment(this.time[0]).format(this.dateFormat)
|
|
|
+ this.queryParam.endDate = moment(this.time[1]).format(this.dateFormat)
|
|
|
+ } else {
|
|
|
+ this.queryParam.beginDate = undefined
|
|
|
+ this.queryParam.endDate = undefined
|
|
|
+ }
|
|
|
+ // 查询总计
|
|
|
+ salesCount(Object.assign(parameter, this.queryParam)).then(res => {
|
|
|
+ console.log(res)
|
|
|
+ this.totalData = Object.assign(this.totalData, res.data || {})
|
|
|
+ })
|
|
|
+ return salesList(Object.assign(parameter, this.queryParam)).then(res => {
|
|
|
+ const data = res.data
|
|
|
+ const no = (data.pageNo - 1) * data.pageSize
|
|
|
+ for (var i = 0; i < data.list.length; i++) {
|
|
|
+ data.list[i].no = no + i + 1
|
|
|
+ }
|
|
|
+ this.disabled = false
|
|
|
+ return data
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ // 不可选日期
|
|
|
+ disabledDate (date, dateStrings) {
|
|
|
+ return date && date.valueOf() > Date.now()
|
|
|
+ },
|
|
|
+ // 审核
|
|
|
+ handleEexamine (row) {
|
|
|
+ const _this = this
|
|
|
+ this.$confirm({
|
|
|
+ title: '提示',
|
|
|
+ content: '请点击下方按钮确认操作?',
|
|
|
+ centered: true,
|
|
|
+ closable: true,
|
|
|
+ okText: '审核通过',
|
|
|
+ cancelText: '审核不通过',
|
|
|
+ onOk () {
|
|
|
+ _this.auditOrder(row.id, 'WAIT_OUT_WAREHOUSE')
|
|
|
+ },
|
|
|
+ onCancel (e) {
|
|
|
+ if (!e.triggerCancel) {
|
|
|
+ _this.auditOrder(row.id, 'AUDIT_REJECT')
|
|
|
+ }
|
|
|
+ _this.$destroyAll()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ auditOrder (id, billStatus) {
|
|
|
+ salesWriteAudit({
|
|
|
+ id,
|
|
|
+ billStatus
|
|
|
+ }).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ this.$message.success(res.message)
|
|
|
+ this.$refs.table.refresh()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 出库
|
|
|
+ handleSend (row) {
|
|
|
+ const _this = this
|
|
|
+ this.$confirm({
|
|
|
+ title: '提示',
|
|
|
+ content: '确认要出库吗?',
|
|
|
+ centered: true,
|
|
|
+ closable: true,
|
|
|
+ onOk () {
|
|
|
+ salesWriteStockOut({
|
|
|
+ salesBillSn: row.salesBillSn
|
|
|
+ }).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ _this.$message.success(res.message)
|
|
|
+ _this.$refs.table.refresh()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 详情
|
|
|
+ handleDetail (row) {
|
|
|
+ this.$router.push({ name: 'salesDetail', params: { sn: row.salesBillSn } })
|
|
|
+ },
|
|
|
+ // 编辑
|
|
|
+ handleEdit (row) {
|
|
|
+ this.$router.push({ name: 'salesEdit', params: { id: row.id, sn: row.salesBillSn, priceType: row.priceType } })
|
|
|
+ },
|
|
|
+ // 删除
|
|
|
+ handleDel (row) {
|
|
|
+ const _this = this
|
|
|
+ this.$confirm({
|
|
|
+ title: '提示',
|
|
|
+ content: '确认要删除吗?',
|
|
|
+ centered: true,
|
|
|
+ closable: true,
|
|
|
+ onOk () {
|
|
|
+ salesDel({ id: row.id }).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ _this.$message.success(res.message)
|
|
|
+ _this.$refs.table.refresh()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 重置
|
|
|
+ resetSearchForm () {
|
|
|
+ this.queryParam.buyerName = undefined
|
|
|
+ this.queryParam.salesBillNo = ''
|
|
|
+ this.queryParam.purchaseBillNo = ''
|
|
|
+ this.queryParam.payType = undefined
|
|
|
+ this.queryParam.billStatus = undefined
|
|
|
+ this.queryParam.financialStatus = undefined
|
|
|
+ this.time = []
|
|
|
+ this.$refs.table.refresh(true)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ beforeRouteEnter (to, from, next) {
|
|
|
+ next(vm => {
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
</script>
|
|
|
-
|
|
|
-<style>
|
|
|
+<style lang="less">
|
|
|
+ .pushOrder-wrap{
|
|
|
+ .sTable{
|
|
|
+ margin-top: 15px;
|
|
|
+ }
|
|
|
+ }
|
|
|
</style>
|