Commit 2a3a18b3 by 李伟康

feat(OrderScreen): 新增订单筛选功能

- 添加转化人员、销售顾问、订单时间、支付时间、订单状态、支付方式等筛选条件
- 实现筛选条件的动态加载和展开收起功能
- 优化筛选界面样式,增加全选和自定义日期选项
- 重构部分组件,提高代码复用性和可维护性
1 parent a7d2adb2
......@@ -63,4 +63,23 @@ module.exports = {
...data
})
},
/**获取订单列表筛选转化人员&销售顾问 */
getOrderScreenEmployeeList (data) {
return http.post({
method: 'dj.api.smartcarlife.employee.getByMerchantId',
projectName: 'boutique',
...data
})
},
/**
* 获取园区店配置
*/
getYqStoreConfig(data){
return http.get({
method: 'dj.api.smarcarlife.yqMerchantConfig.detail',
projectName: 'boutique',
...data
})
}
}
\ No newline at end of file
......@@ -25,8 +25,7 @@ export default {
},
props: {
params: Object,
data: Object,
cacheData: Array
data: Object
},
mounted () {
},
......
......@@ -37,7 +37,6 @@ export default {
props: {
params: Object,
data: [Object, Array],
cacheData: Array,
dataKey: String
},
mounted () {
......
......@@ -54,7 +54,6 @@ export default {
props: {
params: Object,
data: [Object, Array],
cacheData: Array,
dataKey: String
},
mounted () {
......
......@@ -101,7 +101,6 @@ export default {
props: {
params: Object,
data: [Object, Array],
cacheData: Array,
dataKey: String
},
mounted () {
......
......@@ -55,7 +55,7 @@
</template>
<script type='text/ecmascript-6'>
import Popup from './Popup.vue'
import Popup from '@/components/Popup.vue'
export default {
components: {
Popup,
......
......@@ -73,7 +73,7 @@
</template>
<script type='text/ecmascript-6'>
import Popup from './components/Popup.vue'
import Popup from '@/components/Popup.vue'
import config from './config'
import EmployeeList from './components/EmployeeList.vue'
import DiversionMerchant from './components/DiversionMerchant.vue'
......@@ -193,7 +193,7 @@ export default {
confirm () {
try {
let { chooseContent, popupType, componentObject } = this
if (popupType === 13) {
if (popupType == 13) {
chooseContent = this.componentRef().getResult()
}
if (chooseContent) {
......
<template>
<view class="employee-list">
<view
@click="currentIds = []"
:class="['item flex',{active:!currentIds.length}]"
>
<view class="sprite-icon icon-tag-checked"></view>
全部
</view>
<template v-for="(i, index) in list">
<view
:key="index"
@click="choose(i)"
:class="['item flex',{active:checkActive(i)}]"
>
<view class="sprite-icon icon-tag-checked"></view>
{{i.staffName}}
</view>
</template>
</view>
</template>
<script type='text/ecmascript-6'>
export default {
name: 'EmployeeList',
inject: ['userInfo'],
data () {
return {
list: [],
currentIds: []
}
},
props: {
params: Object,
data: [Array, Object],
},
watch: {
currentIds: {
handler (val) {
let { params: { idKey } } = this
this.$emit('choose', {
key: idKey,
value: val.length ? val : null
})
},
deep: true
}
},
mounted () {
this.getList()
},
methods: {
async getList () {
const { userInfo, params } = this,
{ cacheData } = params
if (cacheData && cacheData.length) {
this.initList(cacheData)
return
}
const { shopMerchantId, sceneType, merchantId } = userInfo,
data = await uni.$api.popupApi.getOrderScreenEmployeeList({
merchantId: params.idKey == 'sellerUserIdList' ? merchantId : shopMerchantId,
sceneList: params.idKey == 'sellerUserIdList' ? '' : [sceneType]
})
if (data && data.length) {
this.initList(data)
params.cacheData = data
this.$emit('update:params', params)
}
},
initList (list) {
let { data, params: {idKey} } = this
this.list = list
let paramsData = idKey ? data[idKey] : data
if (paramsData && paramsData.length) paramsData.map(e => {
this.currentIds.push(e)
})
this.$emit('onComplete')
},
choose (i) {
if (i) {
let { uuid } = i,
{ currentIds } = this,
index = currentIds.indexOf(uuid)
if (index == -1) this.currentIds.push(uuid)
else this.currentIds.splice(index, 1)
}
},
checkActive (i) {
let { currentIds } = this,
active = false
if (currentIds.length) active = currentIds.includes(i.uuid)
return active
// return this.currentIds.includes(i.uuid)
},
}
}
</script>
<style scoped lang='scss'>
.employee-list {
display: grid;
grid-template-columns: repeat(6, 1fr);
gap: 32rpx;
margin: 0 48rpx;
.item {
justify-content: center;
height: 72rpx;
border-radius: 8rpx;
border: 2rpx solid #dce0e6;
box-sizing: border-box;
position: relative;
color: #333333;
font-size: 32rpx;
.sprite-icon {
display: none;
position: absolute;
top: 0;
right: 0;
}
}
.active {
border-color: #2c66f7;
background: #ecf1ff;
color: #2c66f7;
.sprite-icon {
display: block;
}
}
}
</style>
\ No newline at end of file
<template>
<view class="list">
<view
@click="currentId = ''"
:class="['item flex',{active:!currentId}]"
>
<view class="sprite-icon icon-tag-checked"></view>
全部
</view>
<template v-for="(i, index) in list">
<view
:key="index"
@click="currentId = i.id"
:class="['item flex',{active:currentId == i.id}]"
>
<view class="sprite-icon icon-tag-checked"></view>
{{i.name}}
</view>
</template>
</view>
</template>
<script type='text/ecmascript-6'>
export default {
name: 'OrderStatusList',
inject: ['userInfo'],
data () {
return {
list: Object.freeze([
{
name: '待跟进',
value: [1],
id: 1
},
{
name: '已支付',
value: [4],
id: 2
},
{
name: '待支付',
value: [3],
id: 3
},
{
name: '已撤销',
value: [9],
id: 4
},
{
name: '战败',
value: [2],
id: 5
},
{
name: '已评价',
value: [6],
id: 6
},
{
name: '已关闭',
value: [10],
id: 7
},
{
name: '已失效',
value: [11],
id: 8
},
{
name: '未施工',
value: ['N'],
id: 9
},
{
name: '已施工',
value: ['Y'],
id: 10
},
{
name: '已退款',
value: [5, 12],
id: 11
}
]),
currentId: '',
}
},
props: {
params: Object,
data: [Array, Object],
},
watch: {
currentId: {
handler (val) {
let { params: { idKey } } = this,
{ list } = this,
item = list.find(item => item.id == val)
this.$emit('choose', {
key: idKey,
value: item ? item.value : null
})
},
deep: true
}
},
mounted () {
this.initList()
},
methods: {
initList () {
let { data, params: { idKey } } = this
this.currentId = data[idKey]
this.$emit('onComplete')
}
}
}
</script>
<style scoped lang='scss'>
.list {
display: grid;
grid-template-columns: repeat(6, 1fr);
gap: 32rpx;
margin: 0 48rpx;
.item {
justify-content: center;
height: 72rpx;
border-radius: 8rpx;
border: 2rpx solid #dce0e6;
box-sizing: border-box;
position: relative;
color: #333333;
font-size: 32rpx;
.sprite-icon {
display: none;
position: absolute;
top: 0;
right: 0;
}
}
.splice {
color: #333333;
font-size: 32rpx;
margin: 0 8rpx;
}
.active {
border-color: #2c66f7;
background: #ecf1ff;
color: #2c66f7;
.sprite-icon {
display: block;
}
}
}
</style>
\ No newline at end of file
<template>
<view class="list">
<view
@click="currentId = ''"
:class="['item flex',{active:!currentId}]"
>
<view class="sprite-icon icon-tag-checked"></view>
全部
</view>
<template v-for="(i, index) in list">
<view
:key="index"
@click="currentId = i.value"
:class="['item flex',{active:currentId == i.value}]"
>
<view class="sprite-icon icon-tag-checked"></view>
{{i.name}}
</view>
</template>
</view>
</template>
<script type='text/ecmascript-6'>
const payTypeList = [{
name: '门店收款',
value: 2
},
{
name: '微信支付',
value: 1
},
{
name: 'POS机支付',
value: 3
},
{
name: '支付宝支付',
value: 4
},
{
name: '嘀加收款',
value: 5
}
]
export default {
name: 'PayList',
inject: ['userInfo'],
data () {
return {
list: [],
currentId: '',
}
},
props: {
params: Object,
data: [Object, Array],
},
watch: {
currentId: {
handler (value) {
let { params: { idKey } } = this
this.$emit('choose', {
key: idKey,
value
})
},
deep: true
}
},
mounted () {
this.getList()
},
methods: {
async getList () {
const { userInfo, params } = this,
{ cacheData } = params
if (cacheData && cacheData.length) {
this.initList(cacheData)
return
}
const { merchantId } = userInfo,
data = await uni.$api.popupApi.getYqStoreConfig({
yqMerchantId: merchantId
})
if (data) {
let obj = data || {}
let m = obj.supportPayTypes || []
let n = JSON.parse(JSON.stringify(payTypeList))
let payList = n.filter(k => {
let idx = m.find(j => j == k.value)
return idx >= 0
})
payList = [
...payList,
{
name: '对公转账',
value: '6'
},
{
name: '其它收款',
value: '7'
}
]
this.initList(payList)
params.cacheData = payList
this.$emit('update:params', params)
}
},
initList (list) {
this.list = list
let { data, params: { idKey } } = this
this.currentId = data[idKey]
this.$emit('onComplete')
},
}
}
</script>
<style scoped lang='scss'>
.list {
display: grid;
grid-template-columns: repeat(6, 1fr);
gap: 32rpx;
margin: 0 48rpx;
.item {
justify-content: center;
height: 72rpx;
border-radius: 8rpx;
border: 2rpx solid #dce0e6;
box-sizing: border-box;
position: relative;
color: #333333;
font-size: 32rpx;
.sprite-icon {
display: none;
position: absolute;
top: 0;
right: 0;
}
}
.splice {
color: #333333;
font-size: 32rpx;
margin: 0 8rpx;
}
.active {
border-color: #2c66f7;
background: #ecf1ff;
color: #2c66f7;
.sprite-icon {
display: block;
}
}
}
</style>
\ No newline at end of file
<template>
<view class="list">
<view
@click="currentId = ''"
:class="['item flex',{active:!currentId}]"
>
<view class="sprite-icon icon-tag-checked"></view>
全部
</view>
<template v-for="(i, index) in list">
<view
:key="index"
@click="choose(i.id)"
:class="['item flex',{active:currentId == i.id}]"
>
<view class="sprite-icon icon-tag-checked"></view>
{{i.name}}
</view>
</template>
<template v-if="currentId == 3 && customDate.startDate && customDate.endDate">
<view
class="calendar flex"
@click="$refs.calendar.open()"
>
<view class="item flex active">
{{customDate.startDate}}
</view>
<view class="splice">-</view>
<view class="item flex active">
{{customDate.endDate}}
</view>
</view>
</template>
<template v-else>
<view
@click="$refs.calendar.open()"
:class="['item flex']"
>
自定义
</view>
</template>
<uni-calendar
ref="calendar"
:insert="false"
range
:clearDate="false"
startDate="2020-10-01"
:endDate="endDate"
@confirm="confirmCalendar"
:rangeValue="rangeValue"
/>
</view>
</template>
<script type='text/ecmascript-6'>
import dayjs from 'dayjs'
export default {
name: 'TimeList',
inject: ['userInfo'],
data () {
return {
list: Object.freeze([
{
name: '今日',
startDate: dayjs().format('YYYY-MM-DD'),
endDate: dayjs().format('YYYY-MM-DD'),
id: 1
}, {
name: '本月',
startDate: dayjs().startOf('month').format('YYYY-MM-DD'),
endDate: dayjs().format('YYYY-MM-DD'),
id: 2
}
]),
currentId: '',
endDate: dayjs().format('YYYY-MM-DD'),
customDate: {
startDate: '',
endDate: ''
},
rangeValue: {}
}
},
props: {
params: Object,
data: [Array, Object],
},
watch: {
currentId: {
handler (val) {
let { params: { idKey, currentIdKey } } = this
let { list } = this,
value = {}
if (val) {
let [startDateName, endDateName] = idKey
if (val == 3) {
value = {
[startDateName]: this.customDate.startDate,
[endDateName]: this.customDate.endDate
}
} else {
let item = list.find(e => e.id == val)
value = {
[startDateName]: item.startDate,
[endDateName]: item.endDate
}
}
}
this.$emit('choose', {
currentIdKey,
currentId: val,
keys: idKey,
value
})
},
deep: true
}
},
mounted () {
this.initList()
},
methods: {
async initList () {
let { data, params: { idKey, currentIdKey } } = this
if (data[currentIdKey] == 3) {
this.customDate = {
startDate: data[idKey[0]],
endDate: data[idKey[1]]
}
this.rangeValue = {
before: data[idKey[0]],
after: data[idKey[1]]
}
}
this.currentId = data[currentIdKey]
this.$emit('onComplete')
},
choose (i) {
this.currentId = i
},
confirmCalendar ({range}) {
let { data } = range
this.customDate = {
startDate: data[0] || dayjs().format('YYYY-MM-DD'),
endDate: data[data.length - 1] || dayjs().format('YYYY-MM-DD')
}
this.rangeValue = range
if (this.currentId == 3) {
let { params: { idKey } } = this,
[startDateName, endDateName] = idKey
this.$emit('choose', {
currentId: 3,
keys: idKey,
value: {
[startDateName]: this.customDate.startDate,
[endDateName]: this.customDate.endDate
}
})
} else this.currentId = 3
}
}
}
</script>
<style scoped lang='scss'>
.list {
display: flex;
gap: 32rpx;
margin: 0 48rpx;
.item {
justify-content: center;
width: 348rpx;
height: 72rpx;
border-radius: 8rpx;
border: 2rpx solid #dce0e6;
box-sizing: border-box;
position: relative;
color: #333333;
font-size: 32rpx;
.sprite-icon {
display: none;
position: absolute;
top: 0;
right: 0;
}
}
.splice {
color: #333333;
font-size: 32rpx;
margin: 0 8rpx;
}
.active {
border-color: #2c66f7;
background: #ecf1ff;
color: #2c66f7;
.sprite-icon {
display: block;
}
}
}
</style>
\ No newline at end of file
const screenList = [
{
title: '转化人员',
suffix: 'merchantName',
componentName: 'EmployeeList',
params: {
cacheData: [],
idKey: 'sellerUserIdList'
},
hasToggle: true,
toggle: false
},
{
title: '销售顾问',
suffix: 'shopMerchantName',
componentName: 'EmployeeList',
params: {
cacheData: [],
idKey: 'userIdList'
},
hasToggle: true,
toggle: false
},
{
title: '订单时间',
componentName: 'TimeList',
params: {
idKey: ['orderStartDate', 'orderEndDate'],
currentIdKey: 'orderTimeId',
},
},
{
title: '支付时间',
componentName: 'TimeList',
params: {
idKey: ['payStartDate', 'payEndDate'],
currentIdKey: 'payTimeId',
},
},
{
title: '订单状态',
componentName: 'OrderStatusList',
params: {
idKey: 'statusList'
}
},
{
title: '支付方式',
componentName: 'PayList',
params: {
idKey: 'payType'
}
},
]
export default { screenList }
\ No newline at end of file
<template>
<popup
ref="popup"
@onConfirm="confirm"
@onCancel="clear"
cancelText="清除"
>
<view class="popup-title flex">
工单筛选
<view
class="popup-close flex"
@click="close"
>
<uni-icons
type="closeempty"
size="16"
></uni-icons>
</view>
</view>
<view class="popup-body">
<scroll-view
scroll-y
:class="['popup-scroll-view',{show:loadComplete}]"
>
<template v-for="(i, index) in screenList">
<view
class="item-box"
:key="index"
>
<view class="title flex">
{{i.title}}
<template v-if="i.suffix">
({{userInfo[i.suffix]}})
</template>
<template v-if="i.hasToggle">
<view class="toggle-btn" @click="i.toggle = !i.toggle">{{i.toggle ? '收起' : '展开'}}</view>
</template>
</view>
<view :class="['box',{'fold':i.hasToggle},{'show':i.toggle}]">
<component
:ref="`${i.componentName}_${index}`"
:is="i.componentName"
:params.sync="i.params"
@choose="choose"
:data="chooseContent"
/>
</view>
</view>
</template>
</scroll-view>
<image
v-if="!loadComplete"
class="loading"
src="../../assets/images/common/loadding.gif"
/>
</view>
</popup>
</template>
<script type='text/ecmascript-6'>
import Popup from '@/components/Popup.vue'
import config from './config'
import EmployeeList from './components/EmployeeList.vue'
import TimeList from './components/TimeList.vue'
import OrderStatusList from './components/OrderStatusList.vue'
import PayList from './components/PayList.vue'
export default {
components: {
Popup,
EmployeeList,
TimeList,
OrderStatusList,
PayList
},
name: 'OrderScreen',
props: {
},
data () {
return {
screenList: config.screenList,
loadComplete: true,
chooseContent: {},
}
},
provide () {
return {
userInfo: this.userInfo,
}
},
computed: {
userInfo () {
return uni.$storage.get("userInfo")
},
},
mounted () {
},
methods: {
open (data) {
this.$refs.popup.open()
},
clear () {
},
close () {
this.$refs.popup.close()
},
choose (i) {
let { key, value, keys, currentIdKey, currentId } = i,
{ chooseContent } = this
if (keys) {
if (currentIdKey) chooseContent[currentIdKey] = currentId || ''
keys.map(e => {
if (value[e]) chooseContent[e] = value[e]
else delete chooseContent[e]
})
} else {
if (value) chooseContent[key] = value
else delete chooseContent[key]
}
},
confirm () {
let chooseContent = JSON.parse(JSON.stringify(this.chooseContent))
delete chooseContent.payTimeId
delete chooseContent.orderTimeId
Object.keys(chooseContent).map(e => {
if (e == 'orderStartDate' || e == 'payStartDate') chooseContent[e] = `${chooseContent[e]} 00:00:00`
if (e == 'orderEndDate' || e == 'payEndDate') chooseContent[e] = `${chooseContent[e]} 23:59:59`
})
this.$emit('onConfirm', chooseContent)
this.close()
},
}
}
</script>
<style scoped lang='scss'>
.popup-box {
border-radius: 32rpx 32rpx 0 0;
background: #ffffff;
height: 70vh;
.popup-title {
height: 104rpx;
justify-content: center;
position: relative;
color: #333333;
font-size: 36rpx;
font-weight: 500;
.popup-close {
position: absolute;
height: 100%;
top: 0;
right: 0;
padding: 0 48rpx;
font-weight: 400;
color: #1a1a1a;
}
}
.popup-tips {
color: #999ea8;
font-size: 28rpx;
padding-left: 48rpx;
}
.popup-body {
height: calc(100% - 312rpx);
position: relative;
.popup-scroll-view {
height: 100%;
padding-top: 8rpx;
.item-box {
margin-bottom: 32rpx;
.title {
color: #888888;
font-size: 28rpx;
height: 40rpx;
background: #f5f7fa;
padding-left: 48rpx;
margin-bottom: 16rpx;
line-height: 40rpx;
.toggle-btn {
margin-left: auto;
padding: 0 48rpx;
color: #4673ff;
font-size: 24rpx;
}
}
.box{
overflow: hidden;
}
.fold{
height: 72rpx;
}
.show{
height: auto !important;
}
}
}
.loading {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: toRpx(64);
height: toRpx(64);
}
.show {
opacity: 1;
}
}
}
</style>
\ No newline at end of file
......@@ -11,11 +11,11 @@
<view
class="popup-btn popup-cancel"
@click="cancel"
>取消</view>
>{{cancelText}}</view>
<view
class="popup-btn popup-confirm"
@click="confirm"
>确定</view>
>{{confirmText}}</view>
</view>
</view>
......@@ -38,7 +38,16 @@ export default {
position:{
type: String,
default: 'bottom'
},
cancelText: {
type: String,
default: '取消'
},
confirmText:{
type: String,
default: '确定'
}
},
data () {
......@@ -54,7 +63,6 @@ export default {
this.$refs.popup.open()
},
cancel () {
this.$refs.popup.close()
this.$emit('onCancel')
},
close () {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!