123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290 |
- <template>
- <a-modal
- centered
- class="collection-detail-modal"
- :footer="null"
- :maskClosable="false"
- v-model="isShow"
- :title="modalTit"
- :bodyStyle="{padding: modalTit?'25px 32px 20px':'50px 32px 15px'}"
- @cancel="isShow=false"
- width="90%">
- <a-spin :spinning="spinning" tip="Loading...">
- <div class="common-main">
- <!-- 搜索条件 -->
- <div ref="tableSearch" class="table-page-search-wrapper">
- <a-form layout="inline">
- <a-row :gutter="15">
- <a-col :md="4" :sm="24">
- <a-form-item label="销售单号">
- <a-input id="pushOrder-salesBillNo" v-model.trim="queryParam.salesBillNo" allowClear placeholder="请输入销售单号"/>
- </a-form-item>
- </a-col>
- <a-col :md="4" :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="客户名称" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
- <dealerSubareaScopeList ref="dealerSubareaScopeList" id="pushOrder-buyerName" @change="custChange" />
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="收货客户名称" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
- <dealerSubareaScopeList ref="shbuyerName" id="pushOrder-shbuyerName" @change="shcustChange" />
- </a-form-item>
- </a-col>
- <a-col :md="4" :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>
- </span>
- </a-col>
- </a-row>
- </a-form>
- </div>
- <!-- 表格数据 -->
- <s-table
- class="sTable"
- ref="table"
- size="small"
- :rowKey="(record) => record.id"
- :columns="columns"
- :data="loadData"
- :defaultLoadData="false"
- :scroll="{ y: 400 }"
- :pageSize="10"
- bordered>
- <!-- 销售单号 -->
- <template slot="salesBillNo" slot-scope="text, record">
- <span class="link-bule" v-if="$hasPermissions('B_salesDetail')" @click="handleDetail(record,0)">{{ record.salesBillNo }}</span>
- <span v-else>{{ record.salesBillNo }}</span>
- </template>
- <!-- 备货单号 -->
- <template slot="dispatchBillNo" slot-scope="text, record">
- <span class="link-bule" v-if="$hasPermissions('B_dispatchDetail')" @click="handleDetail(record,1)">{{ record.dispatchBillNo }}</span>
- <span v-else>{{ record.dispatchBillNo }}</span>
- </template>
- <!-- 操作 -->
- <template slot="action" slot-scope="text, record">
- <div v-if="record.financialStatus!='FINISH'&&record.billStatus!='STOCK_UP_REJECT'">
- <a-button
- size="small"
- type="link"
- class="button-warning"
- v-if="!record.checked"
- @click="handleChoose(record)"
- >选择</a-button>
- <span style="color:#55aa00;" v-else>已选</span>
- </div>
- <span style="color:#55aa00;" v-else>
- {{ record.checked?'已选':'--' }}
- </span>
- </template>
- </s-table>
- </div>
- <!-- 查看销售单或备货单详情 -->
- <commonModal
- :modalTit="detailType?'备货单详情':'销售单详情'"
- bodyPadding="10px"
- width="70%"
- :showFooter="false"
- :openModal="showDetailModal"
- @cancel="cancelDetail">
- <salesDetail v-if="detailType==0" ref="salesDetail" :bizSn="bizSn"></salesDetail>
- <dispatchDetail v-if="detailType==1" ref="dispatchDetail" :bizSn="bizSn"></dispatchDetail>
- </commonModal>
- </a-spin>
- </a-modal>
- </template>
- <script>
- import { STable, VSelect } from '@/components'
- import { dispatchlList } from '@/api/dispatch'
- import commonModal from '@/views/common/commonModal.vue'
- import salesDetail from '@/views/salesManagement/salesQuery/detail.vue'
- import dispatchDetail from '@/views/salesManagement/pushOrderManagement/detail.vue'
- import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
- export default {
- name: 'SelectGlSalesModal',
- components: { STable, VSelect, dealerSubareaScopeList, commonModal, salesDetail, dispatchDetail },
- props: {
- openModal: { // 弹框显示状态
- type: Boolean,
- default: false
- },
- modalTit: { // 弹框标题
- type: String,
- default: null
- },
- chooseData: {
- type: Array,
- default: function () {
- return []
- }
- },
- loading: {
- type: Boolean,
- default: false
- },
- dealerSn: {
- type: String,
- default: null
- }
- },
- data () {
- return {
- isShow: this.openModal, // 是否打开弹框
- disabled: false,
- spinning: false,
- showDetailModal: false,
- detailType: 2,
- bizSn: null,
- queryParam: {
- buyerSn: undefined, // 客户名称
- receiverSn: undefined, // 收货客户
- salesBillNo: '', // 销售单号
- dispatchBillNo: '' // 备货单号
- },
- orginData: [],
- // 加载数据方法 必须为 Promise 对象
- loadData: parameter => {
- this.disabled = true
- this.spinning = true
- return dispatchlList(Object.assign(parameter, this.queryParam)).then(res => {
- let data
- if (res.status == 200) {
- 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
- const index = this.chooseData.findIndex(item => (data.list[i].dispatchBillSn == item.dispatchBillSn && data.list[i].salesBillSn == item.salesBillSn))
- data.list[i].checked = index >= 0
- }
- this.disabled = false
- }
- this.spinning = false
- this.orginData = data.list
- return data
- })
- },
- snList: []
- }
- },
- computed: {
- columns () {
- const arr = [
- { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
- { title: '创建时间', dataIndex: 'createDate', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '销售单号', scopedSlots: { customRender: 'salesBillNo' }, width: '8%', align: 'center' },
- { title: '备货单号', scopedSlots: { customRender: 'dispatchBillNo' }, width: '10%', align: 'center' },
- { title: '客户名称', dataIndex: 'buyerName', width: '8%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
- { title: '收货客户名称', dataIndex: 'receiverName', width: '8%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
- { title: '发货编号', dataIndex: 'sendNo', width: '5%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
- { title: '产品款数', dataIndex: 'totalCategory', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '产品数量', dataIndex: 'totalQty', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '业务状态', dataIndex: 'billStatusDictValue', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '财务状态', dataIndex: 'financialStatusDictValue', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '操作', scopedSlots: { customRender: 'action' }, width: '6%', align: 'center' }
- ]
- if (this.$hasPermissions('B_isShowPrice')) { // 售价权限
- arr.splice(10, 0, { title: '总售价', dataIndex: 'totalAmount', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
- }
- return arr
- }
- },
- methods: {
- custChange (val) {
- this.queryParam.buyerSn = val.key
- },
- shcustChange (val) {
- this.queryParam.receiverSn = val.key
- },
- handleDetail (row, type) {
- this.detailType = type
- this.bizSn = type == 0 ? row.salesBillSn : row.dispatchBillSn
- this.showDetailModal = true
- console.log(this.bizSn)
- },
- cancelDetail () {
- this.showDetailModal = false
- this.detailType = 2
- this.bizSn = null
- },
- // 删除
- handleDel (row) {
- const oi = this.orginData.findIndex(item => row.bizSn == item.dispatchBillSn)
- if (oi >= 0) {
- this.orginData[oi].checked = false
- }
- },
- // 选择
- handleChoose (row) {
- row.checked = true
- this.$emit('choose', {
- bizType: 'DISPATCH',
- bizSn: row.dispatchBillSn,
- bizNo: row.dispatchBillNo
- })
- },
- // 取消
- handleCommonCancel () {
- this.$emit('cancel')
- },
- // 重置
- resetSearchForm (flag) {
- this.queryParam = {
- buyerSn: undefined, // 客户名称
- receiverSn: undefined, // 收货客户
- salesBillNo: '', // 销售单号
- dispatchBillNo: '' // 备货单号
- }
- this.orginData = []
- this.$nextTick(() => {
- this.$refs.dealerSubareaScopeList.resetForm()
- this.$refs.shbuyerName.resetForm()
- })
- if (this.$refs.table && !flag) {
- this.$nextTick(() => {
- this.$refs.table.refresh(true)
- })
- }
- }
- },
- watch: {
- loading (newValue, oldValue) {
- this.spinning = newValue
- },
- // 父页面传过来的弹框状态
- openModal (newValue, oldValue) {
- this.isShow = newValue
- },
- // 重定义的弹框状态
- isShow (newValue, oldValue) {
- if (!newValue) {
- this.handleCommonCancel()
- } else {
- this.resetSearchForm(1)
- if (this.dealerSn) {
- // 回显客户
- this.queryParam.buyerSn = this.dealerSn
- this.$nextTick(() => {
- this.$refs.dealerSubareaScopeList.getDetail(this.dealerSn)
- this.$refs.table.refresh(true)
- })
- } else {
- this.$nextTick(() => {
- this.$refs.table.refresh(true)
- })
- }
- }
- }
- }
- }
- </script>
- <style lang="less">
- </style>
|