searchModal.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. <template>
  2. <!-- 待办单查询 -->
  3. <div class="modal-content">
  4. <u-popup v-model="isShow" class="search-popup" mode="right" @close="handleClose" length="85%">
  5. <view class="search-title">筛选</view>
  6. <u-form class="form-content" :model="form" ref="uForm" label-width="150">
  7. <u-form-item label="录入时间" prop="time" class="form-item">
  8. <u-input clearable v-model="form.time" disabled placeholder="请选择投递时间区间" class="form-item-inp" @click="openPicker" />
  9. <u-icon v-show="form.time.length != 0" name="close-circle-fill" color="#c8c0cc" size="32" class="close-circle" @click="clearTime"></u-icon>
  10. </u-form-item>
  11. </u-form>
  12. <view class="uni-list-btns">
  13. <u-button class="handle-btn search-btn" size="medium" hover-class="none" :custom-style="customBtnStyle" @click="handleSearch">查询</u-button>
  14. <u-button class="handle-btn" size="medium" hover-class="none" @click="resetForm">重置</u-button>
  15. </view>
  16. </u-popup>
  17. <!-- 时间选择器 -->
  18. <w-picker
  19. class="date-picker"
  20. :visible.sync="showPicker"
  21. mode="range"
  22. :current="true"
  23. fields="day"
  24. @confirm="onSelected($event, 'range')"
  25. @cancel="showPicker = false"
  26. ref="date"
  27. ></w-picker>
  28. </div>
  29. </template>
  30. <script>
  31. import wPicker from '@/components/w-picker/w-picker.vue'
  32. export default {
  33. components: { wPicker },
  34. props: {
  35. visible: {
  36. type: Boolean,
  37. default: false
  38. },
  39. defaultParams: { // 默认筛选条件
  40. type: Object,
  41. default: () => {
  42. return {};
  43. }
  44. }
  45. },
  46. watch: {
  47. visible(newValue, oldValue) {
  48. if (newValue) {
  49. this.isShow = newValue
  50. }
  51. },
  52. isShow(newValue, oldValue) {
  53. if (newValue) {
  54. } else {
  55. this.init()
  56. this.$emit('close')
  57. }
  58. }
  59. },
  60. data() {
  61. return {
  62. customBtnStyle: { // 自定义按钮样式
  63. borderColor: '#2ab4e5',
  64. backgroundColor: '#2ab4e5',
  65. color: '#fff'
  66. },
  67. isShow: this.visible, // 显示隐藏
  68. showPicker: false, // 是否显示时间弹窗
  69. form: {
  70. time: '', // 发起时间区间
  71. customerMobile: '', // 门店名称
  72. },
  73. beginDate: null, // 开始时间
  74. endDate: null // 结束时间
  75. };
  76. },
  77. mounted() {
  78. this.init()
  79. },
  80. methods: {
  81. // 初始化数据
  82. init(){
  83. if(this.defaultParams.beginDate && this.defaultParams.endDate){
  84. this.form.time = this.defaultParams.beginDate + ' ~ ' + this.defaultParams.endDate
  85. }
  86. this.beginDate = this.defaultParams.beginDate ? this.defaultParams.beginDate : ''
  87. this.endDate = this.defaultParams.endDate ? this.defaultParams.endDate : ''
  88. this.form.customerMobile = this.defaultParams.customerMobile ? this.defaultParams.customerMobile : ''
  89. },
  90. // 清空创建时间
  91. clearTime(){
  92. this.form.time = ''
  93. this.beginDate = ''
  94. this.endDate = ''
  95. },
  96. // 关闭弹窗
  97. handleClose() {
  98. this.isShow = false
  99. },
  100. // 打开时间选择弹框
  101. openPicker() {
  102. this.showPicker = true
  103. },
  104. // 确认日期选择
  105. onSelected(v) {
  106. this.form.time = v.value[0] + ' ~ ' + v.value[1]
  107. this.beginDate = v.value[0]
  108. this.endDate = v.value[1]
  109. this.showPicker = false
  110. },
  111. // 查询
  112. handleSearch() {
  113. let params = {
  114. beginDate: this.beginDate,
  115. endDate: this.endDate,
  116. customerMobile: this.form.customerMobile,
  117. };
  118. this.$emit('refresh', params)
  119. this.isShow = false
  120. },
  121. // 重置
  122. resetForm() {
  123. this.$refs.uForm.resetFields()
  124. this.$emit('refresh', {})
  125. this.isShow = false
  126. }
  127. }
  128. };
  129. </script>
  130. <style lang="scss" scoped>
  131. .modal-content {
  132. position: relative;
  133. }
  134. .search-popup {
  135. .search-title {
  136. text-align: center;
  137. padding: 18upx 22upx;
  138. color: #333;
  139. border-bottom: 1px solid #eee;
  140. }
  141. .form-content {
  142. display: block;
  143. padding: 0 20upx;
  144. box-sizing: content-box;
  145. .status-item {
  146. width: 30%;
  147. text-align: center;
  148. line-height: 60upx;
  149. background-color: #F8F8F8;
  150. color: #333;
  151. border-radius: 6upx;
  152. font-size: 24upx;
  153. margin: 0 10upx;
  154. }
  155. .active {
  156. background-color: #ffaa00;
  157. color: #fff;
  158. }
  159. .form-item-inp{
  160. display: inline-block;
  161. width: 88%;
  162. vertical-align: top;
  163. }
  164. }
  165. .uni-list {
  166. margin: 20upx;
  167. .uni-list-cell {
  168. display: flex;
  169. align-items: center;
  170. border-bottom: 1px dashed #eeeeee;
  171. .uni-list-cell-db {
  172. flex: 1;
  173. }
  174. .uni-input {
  175. height: 2.5em;
  176. line-height: 2.5em;
  177. }
  178. }
  179. }
  180. .uni-list-btns {
  181. display: flex;
  182. padding: 20upx;
  183. margin-top: 200rpx;
  184. .handle-btn {
  185. font-size: 28upx;
  186. margin: 0 30upx;
  187. width: 100%;
  188. flex: 1;
  189. }
  190. }
  191. }
  192. .date-picker {
  193. }
  194. </style>