123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239 |
- <template>
- <!-- 待办单查询 -->
- <div class="modal-content">
- <u-popup v-model="isshow" class="search-popup" mode="right" @close="handleClose" length="85%">
- <view class="search-title">待办单查询</view>
- <u-form class="form-content" :model="form" ref="uForm" label-width="150">
- <u-form-item label="发起时间" prop="time">
- <u-input clearable v-model="form.time" disabled placeholder="请选择发起时间区间" @click="openPicker"/>
- </u-form-item>
- <u-form-item label="门店" prop="storeName">
- <u-input v-model="form.storeName" placeholder="请输入门店名称" />
- </u-form-item>
- <u-form-item label="巡店人" prop="userName">
- <u-input v-model="form.userName" placeholder="请输入巡店人名称" />
- </u-form-item>
- <u-form-item label="单据状态" prop="status" label-position="top">
- <view :class="['status-item', item.checked ? 'active' : '']" v-for="item in statusList" :key="item.id" @click="chooseStatus(item)">
- {{item.dispName}}
- </view>
- </u-form-item>
- <u-form-item label="检查方式" prop="sourceType" label-position="top">
- <view :class="['status-item', item.checked ? 'active' : '']" v-for="item in sourceTypeList" :key="item.id" @click="chooseSourceType(item)">
- {{item.dispName}}
- </view>
- </u-form-item>
- </u-form>
- <view class="uni-list-btns">
- <button type="primary" :style="{background: $config('buttonColors')}" @click="handleSearch">查询</button>
- <button type="info" @click="resetForm">重置</button>
- </view>
- </u-popup>
- <!-- 时间选择器 -->
- <w-picker
- class="date-picker"
- :visible.sync="showPicker"
- mode="range"
- :current="true"
- fields="day"
- @confirm="onSelected($event,'range')"
- @cancel="showPicker=false"
- ref="date"
- ></w-picker>
- </div>
- </template>
- <script>
- import wPicker from "@/components/w-picker/w-picker.vue"
- import { getLookUpDatas } from '@/api/data.js'
- export default {
- components: {
- wPicker
- },
- props: {
- visible: {
- type: Boolean,
- default: false
- }
- },
- watch: {
- visible (newValue, oldValue) {
- if (newValue) {
- this.isshow = newValue
- } else {
- }
- },
- isshow (newValue, oldValue) {
- if (newValue) {
- } else {
- this.$emit('close')
- }
- }
- },
- data() {
- return {
- isshow: this.visible, // 显示隐藏
- showPicker: false, // 是否显示时间弹窗
- statusList: [], // 状态列表
- sourceTypeList: [], // 检查方式列表
- form: {
- time: '', // 发起时间区间
- storeName: '', // 门店名称
- userName: '' // 巡店人
- },
- beginDate: null, // 开始时间
- endDate: null, // 结束时间
- }
- },
- computed: {
- // 已选单据状态
- status() {
- return this.filterData(this.statusList)
- },
- // 检查方式
- sourceType () {
- return this.filterData(this.sourceTypeList)
- }
- },
- mounted() {
- // 获取单据状态 和 检查方式列表
- this.getLookUpData('BACKLOG_STATUS')
- this.getLookUpData('BACKLOG_SOURCE_TYPE')
- },
- methods: {
- // 获取数据字典数据
- getLookUpData (code) {
- getLookUpDatas({type:code}).then(res=>{
- if (res.status == 200) {
- res.data.map(item => {
- item.checked = false
- })
- if (code == 'BACKLOG_STATUS') {
- this.statusList = res.data
- }
- if (code == 'BACKLOG_SOURCE_TYPE') {
- this.sourceTypeList = res.data
- }
- }
- })
- },
- // 关闭弹窗
- handleClose () {
- this.isshow = false
- },
- // 打开时间选择弹框
- openPicker () {
- this.showPicker = true
- },
- // 确认日期选择
- onSelected (v) {
- console.log(v,'vvvvvvvv')
- this.form.time = v.value[0] + ' ~ ' + v.value[1]
- this.beginDate = v.value[0]
- this.endDate = v.value[1]
- this.showPicker = false
- },
- // 过滤已选数据
- filterData (data) {
- let arr = []
- data.map(item => {
- if (item.checked) {
- arr.push(item.code)
- }
- })
- return arr
- },
- // 选择单据状态
- chooseStatus (item) {
- item.checked = !item.checked
- },
- // 选择检查方式
- chooseSourceType (item) {
- item.checked = !item.checked
- },
- // 查询
- handleSearch () {
- let params = {
- beginDate: this.beginDate,
- endDate: this.endDate,
- storeName: this.form.storeName,
- userName: this.form.userName,
- status: this.status,
- sourceType: this.sourceType
- }
- this.$emit('refresh',params)
- this.isshow = false
- },
- // 重置
- resetForm () {
- this.$refs.uForm.resetFields()
- this.statusList.map(item=>{
- item.checked = false
- })
- this.sourceTypeList.map(item=>{
- item.checked = false
- })
- this.$emit('refresh',{})
- this.isshow = false
- }
- },
- }
- </script>
- <style lang="scss" >
- .modal-content {
- position: relative;
- }
- .search-popup{
- .search-title{
- text-align: center;
- padding: 22upx;
- color: #333;
- border-bottom: 1px solid #eee;
- }
- .form-content {
- padding: 0 20upx;
- .status-item {
- width: 30%;
- text-align: center;
- line-height: 60upx;
- background-color: #F8F8F8;
- color: #333;
- border-radius: 6upx;
- font-size: 24upx;
- margin: 0 10upx;
- }
- .active {
- background-color: #ffaa00;
- color: #fff;
- }
- }
- .uni-list{
- margin: 20upx;
- .uni-list-cell{
- display: flex;
- align-items: center;
- border-bottom: 1px dashed #EEEEEE;
- .uni-list-cell-db{
- flex: 1;
- }
- .uni-input{
- height: 2.5em;
- line-height: 2.5em;
- }
- }
- }
- .uni-list-btns{
- display: flex;
- padding: 20upx;
- uni-button{
- font-size: 28upx;
- margin: 0 30upx;
- flex:1;
- }
- }
-
- }
- .date-picker{
- }
- </style>
|