searchModal.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  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="dispName" @confirm="confirm"></u-picker>
  18. </div>
  19. </template>
  20. <script>
  21. import { getLookUpDatas } from '@/api/data.js'
  22. export default {
  23. props: {
  24. visible: {
  25. type: Boolean,
  26. default: false
  27. },
  28. defaultParams: { // 默认筛选条件
  29. type: Object,
  30. default: () => {
  31. return {}
  32. }
  33. }
  34. },
  35. watch: {
  36. visible(newValue, oldValue) {
  37. if (newValue) {
  38. this.isShow = newValue
  39. }
  40. },
  41. isShow(newValue, oldValue) {
  42. if (newValue) {
  43. } else {
  44. this.init()
  45. this.$emit('close')
  46. }
  47. }
  48. },
  49. data() {
  50. return {
  51. customBtnStyle: { // 自定义按钮样式
  52. borderColor: '#07c160',
  53. backgroundColor: '#07c160',
  54. color: '#fff'
  55. },
  56. isShow: this.visible, // 显示隐藏
  57. form: {
  58. stationName: '', // 套餐名称
  59. orderType: '', // 客户手机
  60. },
  61. list: [],
  62. openSort: false, // 选择
  63. orderTypeName: '请选择',
  64. selectDefault: [0], // 下拉默认选中项
  65. };
  66. },
  67. mounted() {
  68. this.init()
  69. },
  70. created() {
  71. this.getLookUpDatas()
  72. },
  73. methods: {
  74. // 获取数据字典
  75. getLookUpDatas(){
  76. getLookUpDatas({ type: 'WAIT_CLEAN_SORT_RULE' }).then(res => {
  77. if(res.status == 200){
  78. this.list = res.data || []
  79. this.form.orderType = this.defaultParams.orderType ? this.defaultParams.orderType : ''
  80. if(this.defaultParams.orderType){
  81. this.list.map((item, index) => {
  82. if(item.code == this.form.orderType){
  83. this.orderTypeName = this.list[index].dispName
  84. this.selectDefault[0] = index
  85. }
  86. })
  87. }
  88. }else{
  89. this.list = []
  90. this.form.orderType = ''
  91. this.orderTypeName = '请选择'
  92. this.selectDefault = [0]
  93. }
  94. })
  95. },
  96. // 初始化数据
  97. init(){
  98. this.form.stationName = this.defaultParams.stationName ? this.defaultParams.stationName : ''
  99. },
  100. // 关闭弹窗
  101. handleClose() {
  102. this.isShow = false
  103. },
  104. // 查询
  105. handleSearch() {
  106. let params = {
  107. stationName: this.form.stationName,
  108. orderType: this.form.orderType,
  109. };
  110. this.$emit('refresh', params)
  111. this.isShow = false
  112. },
  113. // 重置
  114. resetForm() {
  115. this.$refs.uForm.resetFields()
  116. this.$emit('refresh', {orderType: 'max'})
  117. this.isShow = false
  118. },
  119. // 确定
  120. confirm(v){
  121. this.selectDefault = v
  122. this.form.orderType = this.list[v[0]].code
  123. this.orderTypeName = this.list[v[0]].dispName
  124. }
  125. }
  126. };
  127. </script>
  128. <style lang="scss" scoped>
  129. .modal-content {
  130. position: relative;
  131. }
  132. .search-popup {
  133. .search-title {
  134. text-align: center;
  135. padding: 18rpx 22rpx;
  136. color: #333;
  137. border-bottom: 1px solid #eee;
  138. }
  139. .form-content {
  140. display: block;
  141. padding: 0 20rpx;
  142. box-sizing: content-box;
  143. .status-item {
  144. width: 30%;
  145. text-align: center;
  146. line-height: 60rpx;
  147. background-color: #F8F8F8;
  148. color: #333;
  149. border-radius: 6rpx;
  150. font-size: 24rpx;
  151. margin: 0 10rpx;
  152. }
  153. .active {
  154. background-color: #ffaa00;
  155. color: #fff;
  156. }
  157. .form-item-inp{
  158. display: inline-block;
  159. width: 88%;
  160. vertical-align: top;
  161. }
  162. }
  163. .uni-list {
  164. margin: 20rpx;
  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: 20rpx;
  181. margin-top: 200rpx;
  182. .handle-btn {
  183. font-size: 28rpx;
  184. margin: 0 30rpx;
  185. width: 100%;
  186. flex: 1;
  187. }
  188. }
  189. }
  190. .date-picker {
  191. }
  192. </style>