123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216 |
- <template>
- <div class="salesReturnList-wrap">
- <!-- 搜索条件 -->
- <div 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" v-if="grabFlag == 1">
- <a-form-item label="销售单号">
- <a-input id="salesReturnList-salesBillNo" v-model.trim="queryParam.salesBillNo" allowClear placeholder="请输入销售单号"/>
- </a-form-item>
- </a-col>
- <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>
- <!-- 列表 -->
- <s-table
- class="sTable"
- ref="table"
- size="small"
- :rowKey="(record) => record.id"
- :columns="columns"
- :data="loadData"
- :customRow="handleClickRow"
- :rowClassName="(record, index) => (grabFlag == '1'&&record.refundableQty==0) ? 'redBg-row':''"
- :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="0"
- :max="999999"
- style="width: 100%;"
- placeholder="请输入" />
- </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="primary"
- class="button-info"
- :loading="newLoading"
- :disabled="grabFlag == '1'&&record.refundableQty==0"
- @click="handleAdd(record)"
- >添加</a-button>
- </template>
- </s-table>
- </div>
- </template>
- <script>
- import { salesQueryByReturn } from '@/api/salesReturn'
- import { queryStockProductPage } from '@/api/stock'
- import { STable, VSelect } from '@/components'
- export default {
- name: 'QueryPart',
- components: { STable, VSelect },
- props: {
- newLoading: Boolean
- },
- data () {
- return {
- buyerSn: '',
- grabFlag: '',
- priceType: '',
- queryParam: { // 查询条件
- salesBillNo: '', // 销售单号
- productName: '', // 产品名称
- productCode: '' // 产品编码
- },
- disabled: false, // 查询、重置按钮是否可操作
- columns: [],
- // 加载数据方法 必须为 Promise 对象
- loadData: parameter => {
- this.disabled = true
- // 抓单时
- if (this.grabFlag == 1) {
- this.queryParam.buyerSn = this.buyerSn
- }
- // 不抓单
- if (this.grabFlag == 0) {
- this.queryParam.dealerSn = this.buyerSn
- }
- const fun = [queryStockProductPage, salesQueryByReturn]
- return fun[this.grabFlag](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 = 1
- }
- this.disabled = false
- }
- return data
- })
- }
- }
- },
- methods: {
- // 双击列表选择配件
- handleClickRow (record) {
- const _this = this
- return {
- on: {
- dblclick: (event) => {
- if (_this.grabFlag == '1' && record.refundableQty == 0) {
- _this.$message.info('该产品暂时不能添加')
- } else {
- event.stopPropagation()
- _this.$emit('add', record)
- }
- }
- }
- }
- },
- // 重置
- resetSearchForm () {
- this.queryParam.salesBillNo = ''
- this.queryParam.productName = ''
- this.queryParam.productCode = ''
- this.$refs.table.refresh(true)
- },
- pageInit (buyerSn, grabFlag) {
- this.buyerSn = buyerSn
- this.grabFlag = grabFlag
- // 抓单
- if (this.grabFlag == 1) {
- const arr = [
- { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
- { title: '销售单号', dataIndex: 'salesBillNo', width: '16%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '产品编码', dataIndex: 'productEntity.code', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '产品名称', dataIndex: 'productEntity.name', width: '20%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
- // { title: '售价', dataIndex: 'price', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '剩余可退数量', dataIndex: 'refundableQty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '本次退货数量', dataIndex: 'qty', width: '8%', align: 'center', scopedSlots: { customRender: 'qty' } },
- // { title: '采购价', dataIndex: 'showCost', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '单位', dataIndex: 'productEntity.unit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
- { slots: { title: 'customTitle' }, scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
- ]
- if (this.$hasPermissions('B_isShowPrice')) { // 售价权限
- arr.splice(4, 0, { title: '售价', dataIndex: 'price', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
- }
- if (this.$hasPermissions('B_isShowCost')) { // 成本价权限
- const ind = this.$hasPermissions('B_isShowPrice') ? 7 : 6
- arr.splice(ind, 0, { title: '采购价', dataIndex: 'showCost', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
- }
- this.columns = arr
- } else {
- const arr = [
- { title: '序号', dataIndex: 'no', width: '6%', align: 'center' },
- { title: '产品编码', dataIndex: 'productCode', width: '24%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '产品名称', dataIndex: 'productName', width: '27%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
- // { title: '当前售价', dataIndex: 'productPrice', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '退货数量', dataIndex: 'qty', width: '9%', align: 'center', scopedSlots: { customRender: 'qty' } },
- // { title: '采购价', dataIndex: 'lastStockCost', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '单位', dataIndex: 'productUnit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
- { slots: { title: 'customTitle' }, scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
- ]
- if (this.$hasPermissions('B_isShowPrice')) { // 售价权限
- arr.splice(3, 0, { title: '当前售价', dataIndex: 'productPrice', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
- }
- if (this.$hasPermissions('B_isShowCost')) { // 成本价权限
- const ind = this.$hasPermissions('B_isShowPrice') ? 5 : 4
- arr.splice(ind, 0, { title: '采购价', dataIndex: 'lastStockCost', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
- }
- 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>
|