更新订单管理模块,增加订单详情跳转用户订单

This commit is contained in:
2024-09-29 15:40:51 +08:00
parent efc8485082
commit 1ff0b14f93
7 changed files with 209 additions and 54 deletions

View File

@@ -8,6 +8,7 @@
<view class="u-rela time-item tranistion-2" @click="changeTimeDataSel(-1)"
:class="{active:timeData.sel==-1}">自定义</view>
</view>
<view class="u-m-t-2 bg-fff u-col-center u-flex u-p-l-28 u-p-r-28 u-p-t-30 u-row-between">
<view class="status-item " @click="changeStatusSel(index)" :class="{active:statusData.sel==index}"
v-for="(item,index) in statusData.list" :key="index">
@@ -18,6 +19,29 @@
</image>
</view>
</view>
<template v-if="type&&userShow">
<view class="u-p-l-28 u-flex u-p-r-28 u-p-t-10 bg-gray" v-if="userShow">
<view class="time-area u-font-24 color-main u-flex">
<up-avatar :size="22" :src="user.headImg"></up-avatar>
<view class="u-m-l-10 u-m-r-10">
<text v-if="user.id">{{user.telephone||user.nickName}}</text>
<text v-else>服务员下单</text>
</view>
<up-icon name="close-circle-fill" :color="color.ColorMain" @click="userShowClose"></up-icon>
</view>
</view>
<view class="u-p-l-28 u-flex u-p-r-28 u-p-t-10 bg-gray" v-else>
<view class="time-area u-font-24 color-main u-flex">
<up-avatar :size="22" ></up-avatar>
<view class="u-m-l-10 u-m-r-10">
服务员下单
</view>
<up-icon name="close-circle-fill" :color="color.ColorMain" @click="userShowClose"></up-icon>
</view>
</view>
</template>
<view class="u-p-l-28 u-flex u-p-r-28 u-p-t-10 bg-gray" v-if="time.length">
<view class="time-area u-font-24 color-main u-flex">
<uni-dateformat format="yyyy-MM-dd hh:mm:ss" :date="time[0]"></uni-dateformat>
@@ -31,7 +55,9 @@
<view class="u-text-center font-bold u-font-32 u-p-t-30">选择状态</view>
<view style="height: 20rpx;"></view>
<view class="u-p-30 all-list u-flex u-flex-wrap gap-20">
<view class="all-list-item" :class="{active:statusItemIndex==statusData.allListSel}" @click="changeAllListSel(statusItemIndex)" v-for="(statusItem,statusItemIndex) in statusData.allList" :key="statusItemIndex">
<view class="all-list-item" :class="{active:statusItemIndex==statusData.allListSel}"
@click="changeAllListSel(statusItemIndex)"
v-for="(statusItem,statusItemIndex) in statusData.allList" :key="statusItemIndex">
{{statusItem.label}}
</view>
</view>
@@ -47,11 +73,20 @@
<script setup>
import orderEnum from '@/commons/orderEnum.js'
import * as $time from '@/commons/utils/dayjs-time.js';
import color from '@/commons/color.js';
import {
reactive,
ref,
watch
} from 'vue';
const emits = defineEmits(['update:time', 'update:status','clearUser'])
function userShowClose() {
userShow.value = false
emits('clearUser')
}
const props = defineProps({
time: {
type: Array,
@@ -60,10 +95,31 @@
status: {
type: [String, Number],
default: ''
},
user: {
type: Object,
default: () => {
return {
userId: ''
}
},
},
type:{
type:String,
default:''//user 查看具体用户订单
}
})
let userShow = ref(props.type? true : false)
console.log(props.type);
watch(() => props.type, (newval) => {
console.log(newval);
if (newval) {
userShow.value = true
}
})
let datePicker = ref(null)
const emits = defineEmits(['update:time', 'update:status'])
// 示例使用
const today = $time.getTodayTimestamps();
const yesterday = $time.getYesterdayTimestamps();
@@ -90,7 +146,7 @@
const statusData = reactive({
allList: orderEnum.status,
moreShow:false,
moreShow: false,
allListSel: -1,
list: [{
label: '全部',
@@ -115,12 +171,15 @@
],
sel: 0
})
function moreShowHide(){
statusData.moreShow=false
function moreShowHide() {
statusData.moreShow = false
}
function moreShowOpen(){
statusData.moreShow=true
function moreShowOpen() {
statusData.moreShow = true
}
function changeStatusSel(i) {
statusData.sel = i
}
@@ -129,8 +188,9 @@
console.log(e);
emits('update:time', [e.start, e.end])
}
function changeAllListSel(i){
statusData.allListSel=i
function changeAllListSel(i) {
statusData.allListSel = i
}
</script>
@@ -144,7 +204,8 @@
color: $my-main-color;
}
}
.all-list-item{
.all-list-item {
text-align: center;
width: 156rpx;
white-space: nowrap;
@@ -153,11 +214,13 @@
border-radius: 8rpx;
transition: all .2s ease-in-out;
border: 1px solid #eee;
&.active {
color: $my-main-color;
border-color: $my-main-color;
}
}
.time-item {
color: #666;
padding-bottom: 20rpx;

View File

@@ -4,7 +4,7 @@
<view class="search bg-fff u-p-t-32 u-p-l-28 u-p-r-28 u-p-b-32">
<up-search v-bind="search" v-model="search.val"></up-search>
</view>
<filter-vue v-model:time="order.data.query.createdAt"></filter-vue>
<filter-vue @clearUser="clearQueryUser" v-model:time="order.data.query.createdAt" :user="user" :type="option.type"></filter-vue>
</view>
<order-list @printOrder="onPrintOrder" :hasAjax="order.data.hasAjax" :list="order.data.list"></order-list>
<my-pagination @change="pageChange" :totalElements="order.data.total"></my-pagination>
@@ -15,13 +15,16 @@
<script setup>
import {onLoad,onShow,onPullDownRefresh} from '@dcloudio/uni-app'
import * as Api from '@/http/yskApi/order.js'
import {queryAllShopUser} from '@/http/yskApi/shop-user.js'
import LIST from '@/commons/class/list.js'
import {$printOrder} from '@/http/yskApi/Instead.js'
import filterVue from './compoents/filter.vue';
import orderList from './compoents/order-list.vue';
import infoBox from '@/commons/utils/infoBox.js'
import {
reactive, watch
reactive, ref, watch
} from 'vue';
const search = reactive({
@@ -47,9 +50,13 @@
pageSize: 10,
payType: "",
productName: "",
status: ""
status: "",
userId:''
}
})
function clearQueryUser(){
order.setQuery('userId','')
}
function pageChange(e){
order.setVal('page',e)
console.log(e);
@@ -62,6 +69,9 @@
watch(()=>order.data.query.createdAt,(newval)=>{
init()
})
watch(()=>order.data.query.userId,(newval)=>{
init()
})
async function init() {
const {content,totalElements}=await Api.tbOrderInfoData({...order.data.query,page:order.data.page})
uni.stopPullDownRefresh()
@@ -75,6 +85,21 @@
init()
})
let user=ref({
userId:''
})
const option=reactive({type:''})
onLoad((opt)=>{
Object.assign(option,opt)
if(opt&&JSON.stringify(opt)!='{}'){
order.setQuery('userId',opt.userId?opt.userId:'')
if(opt.userId){
queryAllShopUser({id:opt.userId}).then(res=>{
user.value=res.content[0]||opt
})
}
}
})
onShow(init)
async function printOrder(item){