searchModal.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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="bundleName" class="form-item"><u-input v-model="form.bundleName" :maxlength="30" placeholder="请输入网点名称" /></u-form-item>
  8. <u-form-item label="排序方式:" prop="custMobile" class="form-item">
  9. <view @tap="openSort=true" :style="{color: form.custMobile?null:'#c0c4cc'}">{{custMobileName}}</view>
  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. <u-picker mode="selector" v-model="openSort" :default-selector="selectDefault" :range="list" range-key="label" @confirm="confirm"></u-picker>
  18. </div>
  19. </template>
  20. <script>
  21. export default {
  22. props: {
  23. visible: {
  24. type: Boolean,
  25. default: false
  26. },
  27. defaultParams: { // 默认筛选条件
  28. type: Object,
  29. default: () => {
  30. return {}
  31. }
  32. }
  33. },
  34. watch: {
  35. visible(newValue, oldValue) {
  36. if (newValue) {
  37. this.isShow = newValue
  38. }
  39. },
  40. isShow(newValue, oldValue) {
  41. if (newValue) {
  42. } else {
  43. this.init()
  44. this.$emit('close')
  45. }
  46. }
  47. },
  48. data() {
  49. return {
  50. customBtnStyle: { // 自定义按钮样式
  51. borderColor: '#e84131',
  52. backgroundColor: '#e84131',
  53. color: '#fff'
  54. },
  55. isShow: this.visible, // 显示隐藏
  56. form: {
  57. bundleName: '', // 套餐名称
  58. custMobile: '', // 客户手机
  59. },
  60. list: [
  61. { label: '风', value: '11' },
  62. { label: '花', value: '22' },
  63. { label: '雪', value: '33' },
  64. { label: '月', value: '44' },
  65. ],
  66. openSort: false, // 选择
  67. custMobileName: '请选择',
  68. selectDefault: [0], // 下拉默认选中项
  69. };
  70. },
  71. mounted() {
  72. this.init()
  73. },
  74. methods: {
  75. // 初始化数据
  76. init(){
  77. this.form.bundleName = this.defaultParams.bundleName ? this.defaultParams.bundleName : ''
  78. this.form.custMobile = this.defaultParams.custMobile ? this.defaultParams.custMobile : ''
  79. },
  80. // 关闭弹窗
  81. handleClose() {
  82. this.isShow = false
  83. },
  84. // 查询
  85. handleSearch() {
  86. let params = {
  87. bundleName: this.form.bundleName,
  88. custMobile: this.form.custMobile,
  89. };
  90. this.$emit('refresh', params)
  91. this.isShow = false
  92. },
  93. // 重置
  94. resetForm() {
  95. this.$refs.uForm.resetFields()
  96. this.$emit('refresh', {})
  97. this.isShow = false
  98. },
  99. // 确定
  100. confirm(v){
  101. this.selectDefault = v
  102. this.form.custMobile = this.list[v[0]].value
  103. this.custMobileName = this.list[v[0]].label
  104. }
  105. }
  106. };
  107. </script>
  108. <style lang="scss" scoped>
  109. .modal-content {
  110. position: relative;
  111. }
  112. .search-popup {
  113. .search-title {
  114. text-align: center;
  115. padding: 18rpx 22rpx;
  116. color: #333;
  117. border-bottom: 1px solid #eee;
  118. }
  119. .form-content {
  120. display: block;
  121. padding: 0 20rpx;
  122. box-sizing: content-box;
  123. .status-item {
  124. width: 30%;
  125. text-align: center;
  126. line-height: 60rpx;
  127. background-color: #F8F8F8;
  128. color: #333;
  129. border-radius: 6rpx;
  130. font-size: 24rpx;
  131. margin: 0 10rpx;
  132. }
  133. .active {
  134. background-color: #ffaa00;
  135. color: #fff;
  136. }
  137. .form-item-inp{
  138. display: inline-block;
  139. width: 88%;
  140. vertical-align: top;
  141. }
  142. }
  143. .uni-list {
  144. margin: 20rpx;
  145. .uni-list-cell {
  146. display: flex;
  147. align-items: center;
  148. border-bottom: 1px dashed #eeeeee;
  149. .uni-list-cell-db {
  150. flex: 1;
  151. }
  152. .uni-input {
  153. height: 2.5em;
  154. line-height: 2.5em;
  155. }
  156. }
  157. }
  158. .uni-list-btns {
  159. display: flex;
  160. padding: 20rpx;
  161. margin-top: 200rpx;
  162. .handle-btn {
  163. font-size: 28rpx;
  164. margin: 0 30rpx;
  165. width: 100%;
  166. flex: 1;
  167. }
  168. }
  169. }
  170. .date-picker {
  171. }
  172. </style>