update
This commit is contained in:
@@ -3,12 +3,14 @@
|
||||
<up-sticky offset-top="0">
|
||||
<view class="top">
|
||||
<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" @search="searchConfirm" @clear="searchConfirm" @custom="searchConfirm"></up-search>
|
||||
<up-search v-bind="search" v-model="search.val" @search="searchConfirm" @clear="searchConfirm"
|
||||
@custom="searchConfirm"></up-search>
|
||||
</view>
|
||||
<filter-vue @clearUser="clearQueryUser" @updateStatus="updateQuery('status',$event)" v-model:time="order.data.query.createdAt" :user="user" :type="option.type"></filter-vue>
|
||||
<filter-vue @clearUser="clearQueryUser" @updateStatus="updateQuery('status',$event)"
|
||||
v-model:time="order.data.query.createdAt" :user="user" :type="option.type"></filter-vue>
|
||||
</view>
|
||||
</up-sticky>
|
||||
|
||||
|
||||
<order-list @printOrder="onPrintOrder" :hasAjax="order.data.hasAjax" :list="order.data.list"></order-list>
|
||||
<template v-if="order.data.list.length>0">
|
||||
<my-pagination @change="pageChange" :totalElements="order.data.total"></my-pagination>
|
||||
@@ -18,20 +20,32 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {onLoad,onShow,onPullDownRefresh} from '@dcloudio/uni-app'
|
||||
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 {
|
||||
queryAllShopUser
|
||||
} from '@/http/yskApi/shop-user.js'
|
||||
|
||||
|
||||
import LIST from '@/commons/class/list.js'
|
||||
import {$printOrder} from '@/http/yskApi/Instead.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, ref, watch
|
||||
reactive,
|
||||
ref,
|
||||
watch
|
||||
} from 'vue';
|
||||
import {getTodayTimestamps} from '@/commons/utils/dayjs-time.js';
|
||||
import {
|
||||
getTodayTimestamps
|
||||
} from '@/commons/utils/dayjs-time.js';
|
||||
const search = reactive({
|
||||
val: '',
|
||||
placeholder: '搜索单号/商品名称',
|
||||
@@ -43,12 +57,12 @@
|
||||
textAlign: 'right'
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
const today = getTodayTimestamps();
|
||||
const order=new LIST({
|
||||
const order = new LIST({
|
||||
list: [],
|
||||
query: {
|
||||
createdAt: [today.start,today.end],
|
||||
createdAt: [today.start, today.end],
|
||||
id: "",
|
||||
orderNo: "",
|
||||
orderType: "0",
|
||||
@@ -57,81 +71,95 @@
|
||||
payType: "",
|
||||
productName: "",
|
||||
status: "",
|
||||
userId:''
|
||||
userId: ''
|
||||
}
|
||||
})
|
||||
console.log(order.data);
|
||||
function clearQueryUser(){
|
||||
order.setQuery('userId','')
|
||||
|
||||
function clearQueryUser() {
|
||||
order.setQuery('userId', '')
|
||||
}
|
||||
function pageChange(e){
|
||||
const newPage=e-1
|
||||
order.setVal('page',newPage)
|
||||
order.setQuery('page',newPage)
|
||||
|
||||
function pageChange(e) {
|
||||
const newPage = e - 1
|
||||
order.setVal('page', newPage)
|
||||
order.setQuery('page', newPage)
|
||||
init()
|
||||
}
|
||||
function updateQuery(key,e){
|
||||
order.setQuery(key,e)
|
||||
|
||||
function updateQuery(key, e) {
|
||||
order.setQuery(key, e)
|
||||
}
|
||||
watch(()=>order.data.query.createdAt,(newval)=>{
|
||||
watch(() => order.data.query.createdAt, (newval) => {
|
||||
init()
|
||||
})
|
||||
watch(()=>order.data.query.status,(newval)=>{
|
||||
watch(() => order.data.query.status, (newval) => {
|
||||
init()
|
||||
})
|
||||
watch(()=>order.data.query.userId,(newval)=>{
|
||||
watch(() => order.data.query.userId, (newval) => {
|
||||
init()
|
||||
})
|
||||
function searchConfirm(){
|
||||
order.setQuery('page',0)
|
||||
|
||||
function searchConfirm() {
|
||||
order.setQuery('page', 0)
|
||||
init()
|
||||
}
|
||||
async function init() {
|
||||
console.log(order.data.query);
|
||||
const {content,totalElements}=await Api.tbOrderInfoData({...order.data.query,page:order.data.query.page,keyword:search.val})
|
||||
const {
|
||||
data
|
||||
} = await Api.tbOrderInfoData({
|
||||
...order.data.query,
|
||||
page: order.data.query.page,
|
||||
keyword: search.val
|
||||
})
|
||||
uni.stopPullDownRefresh()
|
||||
order.setVal('list',content)
|
||||
console.log(order.data.list);
|
||||
order.setVal('total',totalElements)
|
||||
order.setVal('hasAjax',true)
|
||||
order.setVal('list', data.records)
|
||||
order.setVal('total', data.totalRow)
|
||||
order.setVal('hasAjax', true)
|
||||
}
|
||||
onPullDownRefresh(()=>{
|
||||
order.setQuery('page',0)
|
||||
onPullDownRefresh(() => {
|
||||
order.setQuery('page', 0)
|
||||
init()
|
||||
})
|
||||
|
||||
let user=ref({
|
||||
userId:''
|
||||
|
||||
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
|
||||
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){
|
||||
try{
|
||||
async function printOrder(item) {
|
||||
try {
|
||||
console.log(item);
|
||||
const res= await $printOrder({
|
||||
tableId:item.tableId
|
||||
const res = await $printOrder({
|
||||
tableId: item.tableId
|
||||
})
|
||||
infoBox.showToast('已发送打印请求')
|
||||
}catch(e){
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
infoBox.showToast('发送打印请求失败')
|
||||
//TODO handle the exception
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
function onPrintOrder(e){
|
||||
|
||||
function onPrintOrder(e) {
|
||||
console.log(e);
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
|
||||
Reference in New Issue
Block a user