searchModal.vue 5.7 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" @click="handleSearch">查询</button>
  29. <button type="info" @click="resetForm">重置</button>
  30. </view>
  31. <!-- <mx-date-picker class="date-picker" :show="showPicker" type="range" format="yyyy-mm-dd" :value="form.time" :show-tips="true" @confirm="onSelected" @cancel="showPicker=false" /> -->
  32. </u-popup>
  33. <!-- 时间选择器 -->
  34. <w-picker
  35. class="date-picker"
  36. :visible.sync="showPicker"
  37. mode="range"
  38. :current="true"
  39. fields="day"
  40. @confirm="onSelected($event,'range')"
  41. @cancel="showPicker=false"
  42. ref="date"
  43. ></w-picker>
  44. </div>
  45. </template>
  46. <script>
  47. import wPicker from "@/components/w-picker/w-picker.vue"
  48. import { getLookUpDatas } from '@/api/data.js'
  49. export default {
  50. components: {
  51. wPicker
  52. },
  53. props: {
  54. visible: {
  55. type: Boolean,
  56. default: false
  57. }
  58. },
  59. watch: {
  60. visible (newValue, oldValue) {
  61. if (newValue) {
  62. this.isshow = newValue
  63. } else {
  64. }
  65. },
  66. isshow (newValue, oldValue) {
  67. if (newValue) {
  68. } else {
  69. this.$emit('close')
  70. }
  71. }
  72. },
  73. data() {
  74. return {
  75. isshow: this.visible, // 显示隐藏
  76. showPicker: false, // 是否显示时间弹窗
  77. statusList: [], // 状态列表
  78. sourceTypeList: [], // 检查方式列表
  79. form: {
  80. time: '', // 发起时间区间
  81. storeName: '', // 门店名称
  82. userName: '' // 巡店人
  83. },
  84. beginDate: null, // 开始时间
  85. endDate: null, // 结束时间
  86. }
  87. },
  88. computed: {
  89. // 已选单据状态
  90. status() {
  91. return this.filterData(this.statusList)
  92. },
  93. // 检查方式
  94. sourceType () {
  95. return this.filterData(this.sourceTypeList)
  96. }
  97. },
  98. mounted() {
  99. // 获取单据状态 和 检查方式列表
  100. this.getLookUpData('BACKLOG_STATUS')
  101. this.getLookUpData('BACKLOG_SOURCE_TYPE')
  102. },
  103. methods: {
  104. // 获取数据字典数据
  105. getLookUpData (code) {
  106. getLookUpDatas({type:code}).then(res=>{
  107. if (res.status == 200) {
  108. res.data.map(item => {
  109. item.checked = false
  110. })
  111. if (code == 'BACKLOG_STATUS') {
  112. this.statusList = res.data
  113. }
  114. if (code == 'BACKLOG_SOURCE_TYPE') {
  115. this.sourceTypeList = res.data
  116. }
  117. }
  118. })
  119. },
  120. // 关闭弹窗
  121. handleClose () {
  122. this.isshow = false
  123. },
  124. // 打开时间选择弹框
  125. openPicker () {
  126. this.showPicker = true
  127. },
  128. // 确认日期选择
  129. onSelected (v) {
  130. console.log(v,'vvvvvvvv')
  131. this.form.time = v.value[0] + ' ~ ' + v.value[1]
  132. this.beginDate = v.value[0]
  133. this.endDate = v.value[1]
  134. this.showPicker = false
  135. },
  136. // 过滤已选数据
  137. filterData (data) {
  138. let arr = []
  139. data.map(item => {
  140. if (item.checked) {
  141. arr.push(item.code)
  142. }
  143. })
  144. return arr
  145. },
  146. // 选择单据状态
  147. chooseStatus (item) {
  148. item.checked = !item.checked
  149. },
  150. // 选择检查方式
  151. chooseSourceType (item) {
  152. item.checked = !item.checked
  153. },
  154. // 查询
  155. handleSearch () {
  156. let params = {
  157. beginDate: this.beginDate,
  158. endDate: this.endDate,
  159. storeName: this.form.storeName,
  160. userName: this.form.userName,
  161. status: this.status,
  162. sourceType: this.sourceType
  163. }
  164. this.$emit('refresh',params)
  165. this.isshow = false
  166. },
  167. // 重置
  168. resetForm () {
  169. this.$refs.uForm.resetFields()
  170. this.statusList.map(item=>{
  171. item.checked = false
  172. })
  173. this.sourceTypeList.map(item=>{
  174. item.checked = false
  175. })
  176. this.$emit('refresh',{})
  177. this.isshow = false
  178. }
  179. },
  180. }
  181. </script>
  182. <style lang="scss" scoped>
  183. .modal-content {
  184. position: relative;
  185. }
  186. .search-popup{
  187. .search-title{
  188. text-align: center;
  189. padding: 22upx;
  190. color: #333;
  191. border-bottom: 1px solid #eee;
  192. }
  193. .form-content {
  194. padding: 0 20upx;
  195. .status-item {
  196. width: 30%;
  197. text-align: center;
  198. line-height: 60upx;
  199. background-color: #e2e2e2;
  200. color: #333;
  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>