searchFilter.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <template>
  2. <u-popup mode="bottom" :round="10" :show="show" @close="close" @open="open" closeable>
  3. <u--form labelPosition="left" :model="formData" ref="uForm">
  4. <u-form-item label="品牌" @click="showBrandList" labelWidth="70">
  5. <Cell :val="formData.dictLabel" :isDelete="true" :border="true" @handleClear="clear('dictLabel')"></Cell>
  6. <BrandList ref="brandListRef" @selectedBrand="handleSelectedBrand"></BrandList>
  7. </u-form-item>
  8. <u-form-item label="实价范围" labelWidth="70">
  9. <u-input v-model="formData.minPrice" placeholder="最小价格" fontSize="14" border="bottom" clearable></u-input>
  10. &nbsp;&nbsp;——&nbsp;&nbsp;
  11. <u-input v-model="formData.maxPrice" placeholder="最大价格" fontSize="14" border="bottom" clearable></u-input>
  12. </u-form-item>
  13. <u-form-item label="位置" labelWidth="70">
  14. <u-input v-model="formData.location" fontSize="14" clearable border="bottom"></u-input>
  15. </u-form-item>
  16. <u-form-item label="回收时间" labelWidth="70" @click="recycleTimeShow = true">
  17. <Cell :val="formData.recycleTime" :isDelete="true" :border="true" @handleClear="clear('recycleTime')"> </Cell>
  18. <u-datetime-picker :show="recycleTimeShow" v-model="recycleTimeDefault" mode="date" @confirm="confirmRecycleTime" @close="recycleTimeShow = false"
  19. @cancel="recycleTimeShow = false"></u-datetime-picker>
  20. </u-form-item>
  21. <u-form-item label="回收人员" labelWidth="70" @click="recyclePersonClick">
  22. <Cell :val="formData.recyclePerson" :isDelete="true" :border="true" @handleClear="clear('recyclePerson')"></Cell>
  23. <PersonPicker ref="recyclePersonPickerRef" title="请选择回收人员" @selectPerson="handleSelectRecyclePerson"></PersonPicker>
  24. </u-form-item>
  25. <u-form-item label="鉴定人员" labelWidth="70" @click="identifyingPersonClick">
  26. <Cell :val="formData.identifyingPerson" :isDelete="true" :border="true" @handleClear="clear('identifyingPerson')"></Cell>
  27. <PersonPicker ref="identifyingPersonPickerRef" title="请选择鉴定人员" @selectPerson="handleSelectIdentifyingPerson"></PersonPicker>
  28. </u-form-item>
  29. <u-form-item label="商品属性" labelWidth="70">
  30. <TabSelect :tabList="productAttributeList" :colNum="3" :echoInfo="formData.productAttribute" mode="multiple" @tabChange="handleTabChangeProductAttribute"></TabSelect>
  31. </u-form-item>
  32. <u-form-item label="是否入库" labelWidth="70">
  33. <TabSelect :tabList="stockStatusListAll" :colNum="4" :echoInfo="formData.stockStatus" mode="single" @tabChange="handleTabChangeStockStatus"></TabSelect>
  34. </u-form-item>
  35. </u--form>
  36. <view class="btns">
  37. <u-button text="重置" @click="resetForm"></u-button>
  38. <u-button type="primary" text="确定" @click="handleSearch"></u-button>
  39. </view>
  40. </u-popup>
  41. </template>
  42. <script>
  43. import Cell from '@/components/custom-cell/index.vue'
  44. import BrandList from '@/components/brand-list/index.vue'
  45. import PersonPicker from '@/components/person-picker/index.vue'
  46. import TabSelect from '@/components/custom-tab-select/index.vue'
  47. import { productAttributeList, stockStatusListAll } from '../js/public.js'
  48. export default {
  49. components: {
  50. Cell,
  51. BrandList,
  52. PersonPicker,
  53. TabSelect,
  54. },
  55. name: 'searchFilter',
  56. emits: ['confirm'],
  57. data() {
  58. return {
  59. show: false,
  60. formData: {
  61. dictLabel: '',
  62. dictValue: '',
  63. minPrice: '',
  64. maxPrice: '',
  65. location: '',
  66. recycleTime: '',
  67. recyclePerson:'',
  68. recyclePersonId: '',
  69. identifyingPerson:'',
  70. identifyingPersonId: '',
  71. productAttribute: [],
  72. stockStatus: '',
  73. },
  74. recycleTimeDefault: new Date().getTime(),
  75. recycleTimeShow: false,
  76. recyclePersonList: [],
  77. // 将导入的变量在data中重新定义,确保模板能够访问
  78. productAttributeList: productAttributeList,
  79. stockStatusListAll: stockStatusListAll,
  80. }
  81. },
  82. props: {
  83. },
  84. emits: [],
  85. methods: {
  86. handleSearch() {
  87. this.$emit('confirm', this.formData);
  88. this.close();
  89. },
  90. resetForm() {
  91. this.formData = {
  92. dictLabel: '',
  93. dictValue: '',
  94. minPrice: '',
  95. maxPrice: '',
  96. location: '',
  97. recycleTime: '',
  98. recyclePerson:'',
  99. recyclePersonId: '',
  100. identifyingPerson:'',
  101. identifyingPersonId: '',
  102. productAttribute: [],
  103. stockStatus: '',
  104. };
  105. this.recycleTimeDefault = new Date().getTime();
  106. },
  107. open() {
  108. this.show = true
  109. },
  110. close() {
  111. this.show = false
  112. },
  113. showBrandList() {
  114. this.$refs.brandListRef.showBrandList();
  115. },
  116. handleSelectedBrand(info) {
  117. this.formData.dictLabel = info.dictLabel;
  118. this.formData.dictValue = info.dictValue;
  119. },
  120. // 处理清空事件
  121. clear(field) {
  122. // 品牌
  123. if(field == 'dictLabel'){
  124. this.formData.dictLabel = '';
  125. this.formData.dictValue = '';
  126. return;
  127. }
  128. // 回收人
  129. if(field == 'recyclePerson'){
  130. this.formData.recyclePerson = '';
  131. this.formData.recyclePersonId = '';
  132. return;
  133. }
  134. // 鉴定人
  135. if(field == 'identifyingPerson'){
  136. this.formData.identifyingPerson = '';
  137. this.formData.identifyingPersonId = '';
  138. return;
  139. }
  140. this.formData[field] = '';
  141. },
  142. confirmRecycleTime(val) {
  143. this.$nextTick(()=>{
  144. this.formData.recycleTime = this.$dayjs(val.value).format('YYYY-MM-DD');
  145. })
  146. this.recycleTimeShow = false;
  147. },
  148. recyclePersonClick() {
  149. this.$refs.recyclePersonPickerRef.open();
  150. },
  151. handleSelectRecyclePerson(info) {
  152. this.formData.recyclePerson = info.label;
  153. this.formData.recyclePersonId = info.id;
  154. },
  155. identifyingPersonClick() {
  156. this.$refs.identifyingPersonPickerRef.open();
  157. },
  158. handleSelectIdentifyingPerson(info) {
  159. this.formData.identifyingPerson = info.label;
  160. this.formData.identifyingPersonId = info.id;
  161. },
  162. handleTabChangeProductAttribute(e) {
  163. this.formData.productAttribute = e;
  164. },
  165. handleTabChangeStockStatus(e) {
  166. this.formData.stockStatus = e;
  167. },
  168. }
  169. }
  170. </script>
  171. <style lang="scss" scoped>
  172. @import "../styles/searchFilter.scss";
  173. </style>