searchFilter.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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="stockStatusList" :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. export default {
  48. components: {
  49. Cell,
  50. BrandList,
  51. PersonPicker,
  52. TabSelect,
  53. },
  54. name: 'searchFilter',
  55. emits: ['confirm'],
  56. data() {
  57. return {
  58. show: false,
  59. formData: {
  60. dictLabel: '',
  61. dictValue: '',
  62. minPrice: '',
  63. maxPrice: '',
  64. location: '',
  65. recycleTime: '',
  66. recyclePerson:'',
  67. recyclePersonId: '',
  68. identifyingPerson:'',
  69. identifyingPersonId: '',
  70. productAttribute: [],
  71. stockStatus: '',
  72. },
  73. recycleTimeDefault: new Date().getTime(),
  74. recycleTimeShow: false,
  75. recyclePersonList: [],
  76. productAttributeList: [
  77. {
  78. name: '自有商品',
  79. value: '1',
  80. },
  81. {
  82. name: '寄卖商品',
  83. value: '2',
  84. },
  85. {
  86. name: '质押商品',
  87. value: '3',
  88. },
  89. {
  90. name: '其它',
  91. value: '4',
  92. },
  93. ],
  94. stockStatusList: [
  95. {
  96. name: '全部',
  97. value: '',
  98. },
  99. {
  100. name: '待入库',
  101. value: '0',
  102. },
  103. {
  104. name: '已入库',
  105. value: '1',
  106. },
  107. ],
  108. }
  109. },
  110. props: {
  111. },
  112. emits: [],
  113. methods: {
  114. handleSearch() {
  115. this.$emit('confirm', this.formData);
  116. this.close();
  117. },
  118. resetForm() {
  119. this.formData = {
  120. dictLabel: '',
  121. dictValue: '',
  122. minPrice: '',
  123. maxPrice: '',
  124. location: '',
  125. recycleTime: '',
  126. recyclePerson:'',
  127. recyclePersonId: '',
  128. identifyingPerson:'',
  129. identifyingPersonId: '',
  130. productAttribute: [],
  131. stockStatus: '',
  132. };
  133. this.recycleTimeDefault = new Date().getTime();
  134. },
  135. open() {
  136. this.show = true
  137. },
  138. close() {
  139. this.show = false
  140. },
  141. showBrandList() {
  142. this.$refs.brandListRef.showBrandList();
  143. },
  144. handleSelectedBrand(info) {
  145. this.formData.dictLabel = info.dictLabel;
  146. this.formData.dictValue = info.dictValue;
  147. },
  148. // 处理清空事件
  149. clear(field) {
  150. // 品牌
  151. if(field == 'dictLabel'){
  152. this.formData.dictLabel = '';
  153. this.formData.dictValue = '';
  154. return;
  155. }
  156. // 回收人
  157. if(field == 'recyclePerson'){
  158. this.formData.recyclePerson = '';
  159. this.formData.recyclePersonId = '';
  160. return;
  161. }
  162. // 鉴定人
  163. if(field == 'identifyingPerson'){
  164. this.formData.identifyingPerson = '';
  165. this.formData.identifyingPersonId = '';
  166. return;
  167. }
  168. this.formData[field] = '';
  169. },
  170. confirmRecycleTime(val) {
  171. this.$nextTick(()=>{
  172. this.formData.recycleTime = this.$dayjs(val.value).format('YYYY-MM-DD');
  173. })
  174. this.recycleTimeShow = false;
  175. },
  176. recyclePersonClick() {
  177. this.$refs.recyclePersonPickerRef.open();
  178. },
  179. handleSelectRecyclePerson(info) {
  180. this.formData.recyclePerson = info.label;
  181. this.formData.recyclePersonId = info.id;
  182. },
  183. identifyingPersonClick() {
  184. this.$refs.identifyingPersonPickerRef.open();
  185. },
  186. handleSelectIdentifyingPerson(info) {
  187. this.formData.identifyingPerson = info.label;
  188. this.formData.identifyingPersonId = info.id;
  189. },
  190. handleTabChangeProductAttribute(e) {
  191. this.formData.productAttribute = e;
  192. },
  193. handleTabChangeStockStatus(e) {
  194. this.formData.stockStatus = e;
  195. },
  196. }
  197. }
  198. </script>
  199. <style lang="scss" scoped>
  200. @import "../styles/searchFilter.scss";
  201. </style>