searchModal.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  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">
  8. <u-input clearable v-model="form.time" disabled placeholder="请选择发起时间区间" @click="openPicker"/>
  9. </u-form-item>
  10. <u-form-item label="门店" prop="storeName">
  11. <u-input v-model="form.storeName" placeholder="请输入门店名称" />
  12. </u-form-item>
  13. <u-form-item label="巡店人" prop="userName">
  14. <u-input v-model="form.userName" placeholder="请输入巡店人名称" />
  15. </u-form-item>
  16. <u-form-item label="单据状态" prop="status" label-position="top">
  17. <view :class="['status-item', item.checked ? 'active' : '']" v-for="item in statusList" :key="item.id" @click="chooseStatus(item)">
  18. {{item.dispName}}
  19. </view>
  20. </u-form-item>
  21. <u-form-item label="检查方式" prop="sourceType" label-position="top">
  22. <view :class="['status-item', item.checked ? 'active' : '']" v-for="item in sourceTypeList" :key="item.id" @click="chooseSourceType(item)">
  23. {{item.dispName}}
  24. </view>
  25. </u-form-item>
  26. </u-form>
  27. <view class="uni-list-btns">
  28. <button type="primary" :style="{background: $config('buttonColors')}" @click="handleSearch">查询</button>
  29. <button type="info" @click="resetForm">重置</button>
  30. </view>
  31. </u-popup>
  32. <!-- 时间选择器 -->
  33. <w-picker
  34. class="date-picker"
  35. :visible.sync="showPicker"
  36. mode="range"
  37. :current="true"
  38. fields="day"
  39. @confirm="onSelected($event,'range')"
  40. @cancel="showPicker=false"
  41. ref="date"
  42. ></w-picker>
  43. </div>
  44. </template>
  45. <script>
  46. import wPicker from "@/components/w-picker/w-picker.vue"
  47. import { getLookUpDatas } from '@/api/data.js'
  48. export default {
  49. components: {
  50. wPicker
  51. },
  52. props: {
  53. visible: {
  54. type: Boolean,
  55. default: false
  56. }
  57. },
  58. watch: {
  59. visible (newValue, oldValue) {
  60. if (newValue) {
  61. this.isshow = newValue
  62. } else {
  63. }
  64. },
  65. isshow (newValue, oldValue) {
  66. if (newValue) {
  67. } else {
  68. this.$emit('close')
  69. }
  70. }
  71. },
  72. data() {
  73. return {
  74. isshow: this.visible, // 显示隐藏
  75. showPicker: false, // 是否显示时间弹窗
  76. statusList: [], // 状态列表
  77. sourceTypeList: [], // 检查方式列表
  78. form: {
  79. time: '', // 发起时间区间
  80. storeName: '', // 门店名称
  81. userName: '' // 巡店人
  82. },
  83. beginDate: null, // 开始时间
  84. endDate: null, // 结束时间
  85. }
  86. },
  87. computed: {
  88. // 已选单据状态
  89. status() {
  90. return this.filterData(this.statusList)
  91. },
  92. // 检查方式
  93. sourceType () {
  94. return this.filterData(this.sourceTypeList)
  95. }
  96. },
  97. mounted() {
  98. // 获取单据状态 和 检查方式列表
  99. this.getLookUpData('BACKLOG_STATUS')
  100. this.getLookUpData('BACKLOG_SOURCE_TYPE')
  101. },
  102. methods: {
  103. // 获取数据字典数据
  104. getLookUpData (code) {
  105. getLookUpDatas({type:code}).then(res=>{
  106. if (res.status == 200) {
  107. res.data.map(item => {
  108. item.checked = false
  109. })
  110. if (code == 'BACKLOG_STATUS') {
  111. this.statusList = res.data
  112. }
  113. if (code == 'BACKLOG_SOURCE_TYPE') {
  114. this.sourceTypeList = res.data
  115. }
  116. }
  117. })
  118. },
  119. // 关闭弹窗
  120. handleClose () {
  121. this.isshow = false
  122. },
  123. // 打开时间选择弹框
  124. openPicker () {
  125. this.showPicker = true
  126. },
  127. // 确认日期选择
  128. onSelected (v) {
  129. console.log(v,'vvvvvvvv')
  130. this.form.time = v.value[0] + ' ~ ' + v.value[1]
  131. this.beginDate = v.value[0]
  132. this.endDate = v.value[1]
  133. this.showPicker = false
  134. },
  135. // 过滤已选数据
  136. filterData (data) {
  137. let arr = []
  138. data.map(item => {
  139. if (item.checked) {
  140. arr.push(item.code)
  141. }
  142. })
  143. return arr
  144. },
  145. // 选择单据状态
  146. chooseStatus (item) {
  147. item.checked = !item.checked
  148. },
  149. // 选择检查方式
  150. chooseSourceType (item) {
  151. item.checked = !item.checked
  152. },
  153. // 查询
  154. handleSearch () {
  155. let params = {
  156. beginDate: this.beginDate,
  157. endDate: this.endDate,
  158. storeName: this.form.storeName,
  159. userName: this.form.userName,
  160. status: this.status,
  161. sourceType: this.sourceType
  162. }
  163. this.$emit('refresh',params)
  164. this.isshow = false
  165. },
  166. // 重置
  167. resetForm () {
  168. this.$refs.uForm.resetFields()
  169. this.statusList.map(item=>{
  170. item.checked = false
  171. })
  172. this.sourceTypeList.map(item=>{
  173. item.checked = false
  174. })
  175. this.$emit('refresh',{})
  176. this.isshow = false
  177. }
  178. },
  179. }
  180. </script>
  181. <style lang="scss" >
  182. .modal-content {
  183. position: relative;
  184. }
  185. .search-popup{
  186. .search-title{
  187. text-align: center;
  188. padding: 22upx;
  189. color: #333;
  190. border-bottom: 1px solid #eee;
  191. }
  192. .form-content {
  193. padding: 0 20upx;
  194. .status-item {
  195. width: 30%;
  196. text-align: center;
  197. line-height: 60upx;
  198. background-color: #F8F8F8;
  199. color: #333;
  200. border-radius: 6upx;
  201. font-size: 24upx;
  202. margin: 0 10upx;
  203. }
  204. .active {
  205. background-color: #ffaa00;
  206. color: #fff;
  207. }
  208. }
  209. .uni-list{
  210. margin: 20upx;
  211. .uni-list-cell{
  212. display: flex;
  213. align-items: center;
  214. border-bottom: 1px dashed #EEEEEE;
  215. .uni-list-cell-db{
  216. flex: 1;
  217. }
  218. .uni-input{
  219. height: 2.5em;
  220. line-height: 2.5em;
  221. }
  222. }
  223. }
  224. .uni-list-btns{
  225. display: flex;
  226. padding: 20upx;
  227. uni-button{
  228. font-size: 28upx;
  229. margin: 0 30upx;
  230. flex:1;
  231. }
  232. }
  233. }
  234. .date-picker{
  235. }
  236. </style>