searchModal.vue 4.9 KB

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