searchModal.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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="stationName" class="form-item"><u-input v-model="form.stationName" :maxlength="30" placeholder="请输入网点名称" /></u-form-item>
  8. <u-form-item label="排序方式:" prop="orderType" class="form-item">
  9. <view @tap="openSort=true" :style="{color: form.orderType?null:'#c0c4cc'}">{{orderTypeName}}</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: '#07c160',
  52. backgroundColor: '#07c160',
  53. color: '#fff'
  54. },
  55. isShow: this.visible, // 显示隐藏
  56. form: {
  57. stationName: '', // 套餐名称
  58. orderType: '', // 客户手机
  59. },
  60. list: [
  61. { label: '按内置单箱体最大投放量降序', value: 'max' },
  62. { label: '按网点可回收物投放总量降序', value: 'total' }
  63. ],
  64. openSort: false, // 选择
  65. orderTypeName: '请选择',
  66. selectDefault: [0], // 下拉默认选中项
  67. };
  68. },
  69. mounted() {
  70. this.init()
  71. },
  72. methods: {
  73. // 初始化数据
  74. init(){
  75. this.form.stationName = this.defaultParams.stationName ? this.defaultParams.stationName : ''
  76. this.form.orderType = this.defaultParams.orderType ? this.defaultParams.orderType : ''
  77. if(this.defaultParams.orderType){
  78. this.list.map((item, index) => {
  79. if(item.value == this.form.orderType){
  80. this.orderTypeName = this.list[index].label
  81. this.selectDefault[0] = index
  82. }
  83. })
  84. }
  85. },
  86. // 关闭弹窗
  87. handleClose() {
  88. this.isShow = false
  89. },
  90. // 查询
  91. handleSearch() {
  92. let params = {
  93. stationName: this.form.stationName,
  94. orderType: this.form.orderType,
  95. };
  96. this.$emit('refresh', params)
  97. this.isShow = false
  98. },
  99. // 重置
  100. resetForm() {
  101. this.$refs.uForm.resetFields()
  102. this.$emit('refresh', {})
  103. this.isShow = false
  104. },
  105. // 确定
  106. confirm(v){
  107. this.selectDefault = v
  108. this.form.orderType = this.list[v[0]].value
  109. this.orderTypeName = this.list[v[0]].label
  110. }
  111. }
  112. };
  113. </script>
  114. <style lang="scss" scoped>
  115. .modal-content {
  116. position: relative;
  117. }
  118. .search-popup {
  119. .search-title {
  120. text-align: center;
  121. padding: 18rpx 22rpx;
  122. color: #333;
  123. border-bottom: 1px solid #eee;
  124. }
  125. .form-content {
  126. display: block;
  127. padding: 0 20rpx;
  128. box-sizing: content-box;
  129. .status-item {
  130. width: 30%;
  131. text-align: center;
  132. line-height: 60rpx;
  133. background-color: #F8F8F8;
  134. color: #333;
  135. border-radius: 6rpx;
  136. font-size: 24rpx;
  137. margin: 0 10rpx;
  138. }
  139. .active {
  140. background-color: #ffaa00;
  141. color: #fff;
  142. }
  143. .form-item-inp{
  144. display: inline-block;
  145. width: 88%;
  146. vertical-align: top;
  147. }
  148. }
  149. .uni-list {
  150. margin: 20rpx;
  151. .uni-list-cell {
  152. display: flex;
  153. align-items: center;
  154. border-bottom: 1px dashed #eeeeee;
  155. .uni-list-cell-db {
  156. flex: 1;
  157. }
  158. .uni-input {
  159. height: 2.5em;
  160. line-height: 2.5em;
  161. }
  162. }
  163. }
  164. .uni-list-btns {
  165. display: flex;
  166. padding: 20rpx;
  167. margin-top: 200rpx;
  168. .handle-btn {
  169. font-size: 28rpx;
  170. margin: 0 30rpx;
  171. width: 100%;
  172. flex: 1;
  173. }
  174. }
  175. }
  176. .date-picker {
  177. }
  178. </style>