123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208 |
- <template>
- <div class="salesReturnList-wrap">
-
- <div class="table-page-search-wrapper">
- <div style="width:80%">
- <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="salesReturnList-productCode" v-model.trim="queryParam.productCode" allowClear placeholder="请输入产品编码"/>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="产品名称">
- <a-input id="salesReturnList-productName" v-model.trim="queryParam.productName" allowClear placeholder="请输入产品名称"/>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
- <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="salesReturnList-refresh">查询</a-button>
- <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="salesReturnList-reset">重置</a-button>
- </a-col>
- </a-row>
- </a-form>
- </div>
- </div>
-
- <s-table
- class="sTable"
- ref="table"
- size="small"
- :rowKey="(record) => record.id"
- :columns="columns"
- :data="loadData"
- :customRow="handleClickRow"
- :defaultLoadData="false"
- :scroll="{ y: 300 }"
- bordered>
-
- <template slot="qty" slot-scope="text, record">
- <div @dblclick.stop>
- <a-input-number
- size="small"
- v-model="record.qty"
- :precision="0"
- :min="showReceiveQty?0:1"
- :max="999999"
- style="width: 100%;"
- placeholder="请输入" />
- </div>
- </template>
-
- <template slot="receiveQty" slot-scope="text, record">
- <div @dblclick.stop>
- <a-input-number
- size="small"
- v-model="record.receiveQty"
- :precision="0"
- :min="1"
- :max="999999"
- style="width: 100%;"
- placeholder="请输入" />
- </div>
- </template>
-
- <template slot="returnReason" slot-scope="text, record">
- <div @dblclick.stop>
- <returnReason v-model.trim="record.returnReason"></returnReason>
- </div>
- </template>
- <span slot="customTitle">
- 操作
- <a-popover>
- <template slot="content">
- 双击列表配件可快速选中添加
- </template>
- <a-icon type="question-circle" theme="twoTone" />
- </a-popover>
- </span>
-
- <template slot="action" slot-scope="text, record">
- <a-button
- size="small"
- type="link"
- class="button-info"
- :disabled="newLoading"
- v-if="record.productPrice"
- @click="handleAdd(record)"
- >添加</a-button>
- <span v-else>--</span>
- </template>
- </s-table>
- </div>
- </template>
- <script>
- import { commonMixin } from '@/utils/mixin'
- import { queryDealerProductPage } from '@/api/salesReturn'
- import returnReason from '@/views/common/returnReason'
- import { STable, VSelect } from '@/components'
- export default {
- name: 'QueryPart',
- mixins: [commonMixin],
- components: { STable, VSelect, returnReason },
- props: {
- newLoading: Boolean,
- isShowPrice: {
- type: Boolean,
- default: true
- },
-
- showReceiveQty: {
- type: Boolean,
- default: false
- }
- },
- data () {
- return {
- buyerSn: '',
- priceType: '',
- queryParam: {
- productName: '',
- productCode: ''
- },
- disabled: false,
- columns: [],
-
- loadData: parameter => {
- this.disabled = true
- this.queryParam.dealerSn = this.buyerSn
- return queryDealerProductPage(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
- data.list[i].qty = this.showReceiveQty ? 0 : 1
- data.list[i].receiveQty = 1
- }
- this.disabled = false
- }
- return data
- })
- }
- }
- },
- methods: {
-
- handleClickRow (record) {
- const _this = this
- return {
- on: {
- dblclick: (event) => {
- event.stopPropagation()
- if (record.productPrice) {
- _this.$emit('add', record)
- }
- }
- }
- }
- },
-
- resetSearchForm () {
- this.queryParam.productName = ''
- this.queryParam.productCode = ''
- this.$refs.table.refresh(true)
- },
- pageInit (buyerSn, warehouseSn) {
- this.buyerSn = buyerSn
-
- const arr = [
- { title: '序号', dataIndex: 'no', width: '6%', align: 'center' },
- { title: '产品编码', dataIndex: 'code', width: '24%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '产品名称', dataIndex: 'name', width: '27%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
- { title: '单位', dataIndex: 'unit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '申请退货数量', dataIndex: 'qty', width: '9%', align: 'center', scopedSlots: { customRender: 'qty' } },
- { title: '退货原因', dataIndex: 'returnReason', width: '10%', align: 'center', scopedSlots: { customRender: 'returnReason' } },
- { slots: { title: 'customTitle' }, scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
- ]
- let i = 5
- if (this.$hasPermissions('B_salesReturnEdit_salesPrice') && this.isShowPrice) {
- arr.splice(4, 0, { title: '当前售价', dataIndex: 'productPrice', width: '9%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
- i = 6
- }
-
- if (this.showReceiveQty) {
- arr.splice(i, 0, { title: '仓库实收数量', dataIndex: 'receiveQty', width: '9%', align: 'center', scopedSlots: { customRender: 'receiveQty' } })
- }
- this.columns = arr
- this.resetSearchForm()
- },
-
- handleAdd (row) {
- this.$emit('add', row)
- },
- refreshData () {
- this.$refs.table.refresh()
- }
- }
- }
- </script>
- <style lang="less">
- .salesReturnList-wrap{
- .redBg-row{
- background-color: #f5cdc8;
- }
- }
- </style>
|