searchModal.vue 4.6 KB

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