searchFilter.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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>
  33. <view class="btns">
  34. <u-button text="重置" @click="resetForm"></u-button>
  35. <u-button type="primary" text="确定" @click="handleSearch"></u-button>
  36. </view>
  37. </u-popup>
  38. </template>
  39. <script>
  40. import Cell from '@/components/custom-cell/index.vue'
  41. import BrandList from '@/components/brand-list/index.vue'
  42. import PersonPicker from '@/components/person-picker/index.vue'
  43. import TabSelect from '@/components/custom-tab-select/index.vue'
  44. export default {
  45. components: {
  46. Cell,
  47. BrandList,
  48. PersonPicker,
  49. TabSelect,
  50. },
  51. name: 'searchFilter',
  52. emits: ['confirm'],
  53. data() {
  54. return {
  55. show: false,
  56. formData: {
  57. dictLabel: '',
  58. dictValue: '',
  59. minPrice: '',
  60. maxPrice: '',
  61. location: '',
  62. recycleTime: '',
  63. recyclePerson:'',
  64. recyclePersonId: '',
  65. identifyingPerson:'',
  66. identifyingPersonId: '',
  67. productAttribute: '',
  68. },
  69. recycleTimeDefault: new Date().getTime(),
  70. recycleTimeShow: false,
  71. recyclePersonList: [],
  72. productAttributeList: [
  73. {
  74. name: '自有商品',
  75. value: '1',
  76. },
  77. {
  78. name: '寄卖商品',
  79. value: '2',
  80. },
  81. {
  82. name: '质押商品',
  83. value: '3',
  84. },
  85. {
  86. name: '其它',
  87. value: '4',
  88. },
  89. ],
  90. }
  91. },
  92. props: {
  93. },
  94. emits: [],
  95. methods: {
  96. handleSearch() {
  97. this.$emit('confirm', this.formData);
  98. this.close();
  99. },
  100. resetForm() {
  101. this.formData = {
  102. dictLabel: '',
  103. dictValue: '',
  104. minPrice: '',
  105. maxPrice: '',
  106. location: '',
  107. recycleTime: '',
  108. recyclePerson:'',
  109. recyclePersonId: '',
  110. identifyingPerson:'',
  111. identifyingPersonId: '',
  112. productAttribute: '',
  113. };
  114. this.recycleTimeDefault = new Date().getTime();
  115. },
  116. open() {
  117. this.show = true
  118. },
  119. close() {
  120. this.show = false
  121. },
  122. showBrandList() {
  123. this.$refs.brandListRef.showBrandList();
  124. },
  125. handleSelectedBrand(info) {
  126. this.formData.dictLabel = info.dictLabel;
  127. this.formData.dictValue = info.dictValue;
  128. },
  129. // 处理清空事件
  130. clear(field) {
  131. // 品牌
  132. if(field == 'dictLabel'){
  133. this.formData.dictLabel = '';
  134. this.formData.dictValue = '';
  135. return;
  136. }
  137. // 回收人
  138. if(field == 'recyclePerson'){
  139. this.formData.recyclePerson = '';
  140. this.formData.recyclePersonId = '';
  141. return;
  142. }
  143. // 鉴定人
  144. if(field == 'identifyingPerson'){
  145. this.formData.identifyingPerson = '';
  146. this.formData.identifyingPersonId = '';
  147. return;
  148. }
  149. this.formData[field] = '';
  150. },
  151. confirmRecycleTime(val) {
  152. this.$nextTick(()=>{
  153. this.formData.recycleTime = this.$dayjs(val.value).format('YYYY-MM-DD');
  154. })
  155. this.recycleTimeShow = false;
  156. },
  157. recyclePersonClick() {
  158. this.$refs.recyclePersonPickerRef.open();
  159. },
  160. handleSelectRecyclePerson(info) {
  161. this.formData.recyclePerson = info.label;
  162. this.formData.recyclePersonId = info.id;
  163. },
  164. identifyingPersonClick() {
  165. this.$refs.identifyingPersonPickerRef.open();
  166. },
  167. handleSelectIdentifyingPerson(info) {
  168. this.formData.identifyingPerson = info.label;
  169. this.formData.identifyingPersonId = info.id;
  170. },
  171. handleTabChangeProductAttribute(e) {
  172. this.formData.productAttribute = e;
  173. },
  174. }
  175. }
  176. </script>
  177. <style lang="scss" scoped>
  178. @import "../styles/searchFilter.scss";
  179. </style>