queryPart.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. <template>
  2. <div class="salesReturnList-wrap">
  3. <!-- 搜索条件 -->
  4. <div class="table-page-search-wrapper">
  5. <div style="width:80%">
  6. <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
  7. <a-row :gutter="15">
  8. <a-col :md="6" :sm="24">
  9. <a-form-item label="产品编码">
  10. <a-input id="salesReturnList-productCode" v-model.trim="queryParam.code" allowClear placeholder="请输入产品编码"/>
  11. </a-form-item>
  12. </a-col>
  13. <a-col :md="6" :sm="24">
  14. <a-form-item label="产品名称">
  15. <a-input id="salesReturnList-productName" v-model.trim="queryParam.name" allowClear placeholder="请输入产品名称"/>
  16. </a-form-item>
  17. </a-col>
  18. <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
  19. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="salesReturnList-refresh">查询</a-button>
  20. <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="salesReturnList-reset">重置</a-button>
  21. </a-col>
  22. </a-row>
  23. </a-form>
  24. </div>
  25. </div>
  26. <!-- 列表 -->
  27. <s-table
  28. class="sTable"
  29. ref="table"
  30. size="small"
  31. :rowKey="(record) => record.id"
  32. :columns="columns"
  33. :data="loadData"
  34. :customRow="handleClickRow"
  35. :defaultLoadData="false"
  36. :scroll="{ y: 300 }"
  37. bordered>
  38. <!-- 申请退货数量 -->
  39. <template slot="qty" slot-scope="text, record">
  40. <div @dblclick.stop>
  41. <a-input-number
  42. size="small"
  43. v-model="record.qty"
  44. :precision="0"
  45. :min="showReceiveQty?0:1"
  46. :max="99999999"
  47. style="width: 100%;"
  48. placeholder="请输入" />
  49. </div>
  50. </template>
  51. <!-- 仓库实收数量 -->
  52. <template slot="receiveQty" slot-scope="text, record">
  53. <div @dblclick.stop>
  54. <a-input-number
  55. size="small"
  56. v-model="record.receiveQty"
  57. :precision="0"
  58. :min="1"
  59. :max="99999999"
  60. style="width: 100%;"
  61. placeholder="请输入" />
  62. </div>
  63. </template>
  64. <!-- 退货原因 -->
  65. <template slot="returnReason" slot-scope="text, record">
  66. <div @dblclick.stop>
  67. <returnReason :goodFlag="goodFlag" v-model.trim="record.returnReasonCode"></returnReason>
  68. </div>
  69. </template>
  70. <!-- 备注 -->
  71. <template slot="remarks" slot-scope="text, record">
  72. <div @dblclick.stop>
  73. <a-input :maxLength="50" size="small" v-model="record.returnReasonRemarks" placeholder="请输入备注(最多50字符)"/>
  74. </div>
  75. </template>
  76. <span slot="customTitle">
  77. 操作
  78. <a-popover>
  79. <template slot="content">
  80. 双击列表配件可快速选中添加
  81. </template>
  82. <a-icon type="question-circle" theme="twoTone" />
  83. </a-popover>
  84. </span>
  85. <!-- 操作 -->
  86. <template slot="action" slot-scope="text, record">
  87. <a-button
  88. size="small"
  89. type="link"
  90. class="button-info"
  91. :disabled="newLoading"
  92. v-if="record.productPrice"
  93. @click="handleAdd(record)"
  94. >添加</a-button>
  95. <span v-else>--</span>
  96. </template>
  97. </s-table>
  98. </div>
  99. </template>
  100. <script>
  101. import { commonMixin } from '@/utils/mixin'
  102. import { queryDealerProductPage } from '@/api/salesReturn'
  103. import returnReason from '@/views/common/returnReason'
  104. import { STable, VSelect } from '@/components'
  105. export default {
  106. name: 'QueryPart',
  107. mixins: [commonMixin],
  108. components: { STable, VSelect, returnReason },
  109. props: {
  110. newLoading: Boolean,
  111. isShowPrice: {
  112. type: Boolean,
  113. default: true
  114. },
  115. // 是否显示仓库实收数量
  116. showReceiveQty: {
  117. type: Boolean,
  118. default: false
  119. },
  120. showRemark: {
  121. type: Boolean,
  122. default: false
  123. }
  124. },
  125. data () {
  126. return {
  127. buyerSn: '',
  128. priceType: '',
  129. queryParam: { // 查询条件
  130. name: '', // 产品名称
  131. code: '' // 产品编码
  132. },
  133. disabled: false, // 查询、重置按钮是否可操作
  134. columns: [],
  135. goodFlag: '',
  136. // 加载数据方法 必须为 Promise 对象
  137. loadData: parameter => {
  138. this.disabled = true
  139. this.queryParam.dealerSn = this.buyerSn
  140. return queryDealerProductPage(Object.assign(parameter, this.queryParam)).then(res => {
  141. let data
  142. if (res.status == 200) {
  143. data = res.data
  144. const no = (data.pageNo - 1) * data.pageSize
  145. for (var i = 0; i < data.list.length; i++) {
  146. data.list[i].no = no + i + 1
  147. data.list[i].qty = this.showReceiveQty ? 0 : 1
  148. data.list[i].receiveQty = 1
  149. data.list[i].returnReasonRemarks = ''
  150. }
  151. this.disabled = false
  152. }
  153. return data
  154. })
  155. }
  156. }
  157. },
  158. methods: {
  159. // 双击列表选择配件
  160. handleClickRow (record) {
  161. const _this = this
  162. return {
  163. on: {
  164. dblclick: (event) => {
  165. event.stopPropagation()
  166. if (record.productPrice) {
  167. _this.$emit('add', record)
  168. }
  169. }
  170. }
  171. }
  172. },
  173. // 重置
  174. resetSearchForm () {
  175. this.queryParam.name = ''
  176. this.queryParam.code = ''
  177. this.$refs.table.refresh(true)
  178. },
  179. pageInit (buyerSn, warehouseSn, goodFlag) {
  180. this.buyerSn = buyerSn
  181. this.goodFlag = goodFlag
  182. this.queryParam.warehouseSn = warehouseSn
  183. const arr = [
  184. { title: '序号', dataIndex: 'no', width: '6%', align: 'center' },
  185. { title: '产品编码', dataIndex: 'code', width: '16%', align: 'center', customRender: function (text) { return text || '--' } },
  186. { title: '产品名称', dataIndex: 'name', width: '23%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  187. { title: '单位', dataIndex: 'unit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  188. { title: '申请退货数量', dataIndex: 'qty', width: '8%', align: 'center', scopedSlots: { customRender: 'qty' } },
  189. { title: '退货原因', dataIndex: 'returnReason', width: '12%', align: 'center', scopedSlots: { customRender: 'returnReason' } },
  190. { slots: { title: 'customTitle' }, scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
  191. ]
  192. let i = 5
  193. if (this.$hasPermissions('B_salesReturnEdit_salesPrice') && this.isShowPrice) { // 售价权限
  194. arr.splice(4, 0, { title: '当前售价', dataIndex: 'productPrice', width: '8%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
  195. arr.splice(5, 0, { title: '价格级别', dataIndex: 'priceLevelDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } })
  196. i = 6
  197. }
  198. // 实收数量是否显示
  199. if (this.showReceiveQty) {
  200. arr.splice(i, 0, { title: '仓库实收数量', dataIndex: 'receiveQty', width: '8%', align: 'center', scopedSlots: { customRender: 'receiveQty' } })
  201. }
  202. if (this.showRemark) {
  203. arr.splice(i + 2, 0, { title: '备注', dataIndex: 'remarks', width: '12%', align: 'center', scopedSlots: { customRender: 'remarks' } })
  204. }
  205. this.columns = arr
  206. this.resetSearchForm()
  207. },
  208. // 选择配件
  209. handleAdd (row) {
  210. this.$emit('add', row)
  211. },
  212. refreshData () {
  213. this.$refs.table.refresh()
  214. }
  215. }
  216. }
  217. </script>
  218. <style lang="less">
  219. .salesReturnList-wrap{
  220. .redBg-row{
  221. background-color: #f5cdc8;
  222. }
  223. }
  224. </style>