searchFilter.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  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="openTimePicker">
  17. <Cell :val="time" :isDelete="true" :border="true" @handleClear="clear('time')"> </Cell>
  18. <JTimePicker :isShowShortTimeList="true" shortTimeTitle="快捷时间" :shortTimeList="shortTimeList"
  19. :isShowSeletTimeTitle="true" seletTimeTitle="时间选择" cancelText="取消" confirmText="确认"
  20. :endSelectMonth="-1" :endSelectDay="-1" beginTimePlaceHolder='开始时间' endTimePlaceHolder="结束时间"
  21. :isDateTypeRange="true" :isShowSelectedTimeEcho="true" @confirm="getSelectTime" :defaultSelect="0"
  22. ref="jtimePickerPopupRef">
  23. </JTimePicker>
  24. </u-form-item>
  25. <u-form-item label="回收人员" labelWidth="70" @click="recyclePersonClick">
  26. <Cell :val="formData.recyclePerson" :isDelete="true" :border="true" @handleClear="clear('recyclePerson')"></Cell>
  27. <PersonPicker ref="recyclePersonPickerRef" title="请选择回收人员" @selectPerson="handleSelectRecyclePerson"></PersonPicker>
  28. </u-form-item>
  29. <u-form-item label="鉴定人员" labelWidth="70" @click="identifyingPersonClick">
  30. <Cell :val="formData.identifyingPerson" :isDelete="true" :border="true" @handleClear="clear('identifyingPerson')"></Cell>
  31. <PersonPicker ref="identifyingPersonPickerRef" title="请选择鉴定人员" @selectPerson="handleSelectIdentifyingPerson"></PersonPicker>
  32. </u-form-item>
  33. <u-form-item label="商品属性" labelWidth="70">
  34. <TabSelect :tabList="productAttributeList" :colNum="3" :echoInfo="formData.productAttribute" mode="multiple" @tabChange="handleTabChangeProductAttribute"></TabSelect>
  35. </u-form-item>
  36. <u-form-item label="是否入库" labelWidth="70">
  37. <TabSelect :tabList="stockStatusListAll" :colNum="4" :echoInfo="formData.stockStatus" mode="single" @tabChange="handleTabChangeStockStatus"></TabSelect>
  38. </u-form-item>
  39. </u--form>
  40. <view class="btns">
  41. <u-button text="重置" @click="resetForm"></u-button>
  42. <u-button type="primary" text="确定" @click="handleSearch"></u-button>
  43. </view>
  44. </u-popup>
  45. </template>
  46. <script>
  47. import Cell from '@/components/custom-cell/index.vue'
  48. import BrandList from '@/components/brand-list/index.vue'
  49. import PersonPicker from '@/components/person-picker/index.vue'
  50. import TabSelect from '@/components/custom-tab-select/index.vue'
  51. import JTimePicker from '@/uni_modules/jtime-picker-popup/components/JTimePicker/JTimePicker.vue'
  52. import { productAttributeList, stockStatusListAll,shortTimeList } from '../js/public.js'
  53. export default {
  54. components: {
  55. Cell,
  56. BrandList,
  57. PersonPicker,
  58. TabSelect,
  59. JTimePicker,
  60. },
  61. name: 'searchFilter',
  62. emits: ['confirm'],
  63. data() {
  64. return {
  65. show: false,
  66. formData: {
  67. dictLabel: '',
  68. dictValue: '',
  69. minPrice: '',
  70. maxPrice: '',
  71. location: '',
  72. startTime: '',
  73. endTime: '',
  74. recyclePerson:'',
  75. recyclePersonId: '',
  76. identifyingPerson:'',
  77. identifyingPersonId: '',
  78. productAttribute: [],
  79. stockStatus: '',
  80. },
  81. time:'',
  82. shortTimeList: shortTimeList,
  83. recyclePersonList: [],
  84. // 将导入的变量在data中重新定义,确保模板能够访问
  85. productAttributeList: productAttributeList,
  86. stockStatusListAll: stockStatusListAll,
  87. }
  88. },
  89. props: {
  90. },
  91. emits: [],
  92. methods: {
  93. handleSearch() {
  94. this.$emit('confirm', this.formData);
  95. this.close();
  96. },
  97. resetForm() {
  98. this.formData = {
  99. dictLabel: '',
  100. dictValue: '',
  101. minPrice: '',
  102. maxPrice: '',
  103. location: '',
  104. startTime: '',
  105. endTime: '',
  106. recyclePerson:'',
  107. recyclePersonId: '',
  108. identifyingPerson:'',
  109. identifyingPersonId: '',
  110. productAttribute: [],
  111. stockStatus: '',
  112. };
  113. },
  114. open() {
  115. this.show = true
  116. setTimeout(() => {
  117. this.$refs.jtimePickerPopupRef.handleInit();
  118. }, 300)
  119. },
  120. openTimePicker() {
  121. this.$nextTick(()=>{
  122. this.$refs.jtimePickerPopupRef.pickerShow();
  123. })
  124. },
  125. close() {
  126. this.show = false
  127. },
  128. showBrandList() {
  129. this.$refs.brandListRef.showBrandList();
  130. },
  131. handleSelectedBrand(info) {
  132. this.formData.dictLabel = info.dictLabel;
  133. this.formData.dictValue = info.dictValue;
  134. },
  135. // 处理清空事件
  136. clear(field) {
  137. // 品牌
  138. if(field == 'dictLabel'){
  139. this.formData.dictLabel = '';
  140. this.formData.dictValue = '';
  141. return;
  142. }
  143. // 回收人
  144. if(field == 'recyclePerson'){
  145. this.formData.recyclePerson = '';
  146. this.formData.recyclePersonId = '';
  147. return;
  148. }
  149. // 鉴定人
  150. if(field == 'identifyingPerson'){
  151. this.formData.identifyingPerson = '';
  152. this.formData.identifyingPersonId = '';
  153. return;
  154. }
  155. // 回收时间
  156. if(field == 'time'){
  157. this.time = '';
  158. this.formData.startTime = '';
  159. this.formData.endTime = '';
  160. return;
  161. }
  162. this.formData[field] = '';
  163. },
  164. getSelectTime(val) {
  165. this.formData.startTime = this.$dayjs(val.beginTime).format('YYYY-MM-DD');
  166. this.formData.endTime = this.$dayjs(val.endTime).format('YYYY-MM-DD');
  167. this.time = this.$dayjs(val.beginTime).format('YYYY-MM-DD') + ' 至 ' + this.$dayjs(val.endTime).format('YYYY-MM-DD');
  168. },
  169. recyclePersonClick() {
  170. this.$refs.recyclePersonPickerRef.open();
  171. },
  172. handleSelectRecyclePerson(info) {
  173. this.formData.recyclePerson = info.label;
  174. this.formData.recyclePersonId = info.id;
  175. },
  176. identifyingPersonClick() {
  177. this.$refs.identifyingPersonPickerRef.open();
  178. },
  179. handleSelectIdentifyingPerson(info) {
  180. this.formData.identifyingPerson = info.label;
  181. this.formData.identifyingPersonId = info.id;
  182. },
  183. handleTabChangeProductAttribute(e) {
  184. this.formData.productAttribute = e;
  185. },
  186. handleTabChangeStockStatus(e) {
  187. this.formData.stockStatus = e;
  188. },
  189. }
  190. }
  191. </script>
  192. <style lang="scss" scoped>
  193. @import "../styles/searchFilter.scss";
  194. </style>