searchModal.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  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="storeName" class="form-item"><u-input v-model="form.storeName" :maxlength="30" placeholder="请输入支付账号" /></u-form-item>
  12. </u-form>
  13. <view class="uni-list-btns">
  14. <button type="primary" class="handle-btn search-btn" @click="handleSearch">查询</button>
  15. <button type="info" class="handle-btn" @click="resetForm">重置</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. isShow: this.visible, // 显示隐藏
  64. showPicker: false, // 是否显示时间弹窗
  65. form: {
  66. time: '', // 发起时间区间
  67. storeName: '', // 门店名称
  68. },
  69. beginDate: null, // 开始时间
  70. endDate: null // 结束时间
  71. };
  72. },
  73. mounted() {
  74. this.init()
  75. },
  76. methods: {
  77. // 初始化数据
  78. init(){
  79. if(this.defaultParams.beginDate && this.defaultParams.endDate){
  80. this.form.time = this.defaultParams.beginDate + ' ~ ' + this.defaultParams.endDate
  81. }
  82. this.beginDate = this.defaultParams.beginDate ? this.defaultParams.beginDate : ''
  83. this.endDate = this.defaultParams.endDate ? this.defaultParams.endDate : ''
  84. this.form.storeName = this.defaultParams.storeName ? this.defaultParams.storeName : ''
  85. },
  86. // 清空创建时间
  87. clearTime(){
  88. this.form.time = ''
  89. this.beginDate = ''
  90. this.endDate = ''
  91. },
  92. // 关闭弹窗
  93. handleClose() {
  94. this.isShow = false
  95. },
  96. // 打开时间选择弹框
  97. openPicker() {
  98. this.showPicker = true
  99. },
  100. // 确认日期选择
  101. onSelected(v) {
  102. this.form.time = v.value[0] + ' ~ ' + v.value[1]
  103. this.beginDate = v.value[0]
  104. this.endDate = v.value[1]
  105. this.showPicker = false
  106. },
  107. // 查询
  108. handleSearch() {
  109. let params = {
  110. beginDate: this.beginDate,
  111. endDate: this.endDate,
  112. storeName: this.form.storeName,
  113. };
  114. this.$emit('refresh', params)
  115. this.isShow = false
  116. },
  117. // 重置
  118. resetForm() {
  119. this.$refs.uForm.resetFields()
  120. this.$emit('refresh', {})
  121. this.isShow = false
  122. }
  123. }
  124. };
  125. </script>
  126. <style lang="scss" scoped>
  127. .modal-content {
  128. position: relative;
  129. }
  130. .search-popup {
  131. .search-title {
  132. text-align: center;
  133. padding: 22upx;
  134. color: #333;
  135. border-bottom: 1px solid #eee;
  136. }
  137. .form-content {
  138. display: block;
  139. padding: 0 20upx;
  140. box-sizing: content-box;
  141. .status-item {
  142. width: 30%;
  143. text-align: center;
  144. line-height: 60upx;
  145. background-color: #F8F8F8;
  146. color: #333;
  147. border-radius: 6upx;
  148. font-size: 24upx;
  149. margin: 0 10upx;
  150. }
  151. .active {
  152. background-color: #ffaa00;
  153. color: #fff;
  154. }
  155. .form-item-inp{
  156. display: inline-block;
  157. width: 88%;
  158. vertical-align: top;
  159. }
  160. .close-circle{
  161. }
  162. }
  163. .uni-list {
  164. margin: 20upx;
  165. .uni-list-cell {
  166. display: flex;
  167. align-items: center;
  168. border-bottom: 1px dashed #eeeeee;
  169. .uni-list-cell-db {
  170. flex: 1;
  171. }
  172. .uni-input {
  173. height: 2.5em;
  174. line-height: 2.5em;
  175. }
  176. }
  177. }
  178. .uni-list-btns {
  179. display: flex;
  180. padding: 20upx;
  181. margin-top: 200rpx;
  182. .handle-btn {
  183. font-size: 28upx;
  184. margin: 0 30upx;
  185. width: 100%;
  186. flex: 1;
  187. }
  188. .search-btn{
  189. background-color: #007aff;
  190. }
  191. }
  192. }
  193. .date-picker {
  194. }
  195. </style>