This commit is contained in:
duan
2025-09-29 10:42:48 +08:00
parent 89db955ec1
commit 096f591123
80 changed files with 8735 additions and 3286 deletions

View File

@@ -1,23 +1,23 @@
<template>
<view class="bg-fff item" @click="toDetail">
<view class="u-flex u-p-b-22 border-bottom u-row-between u-col-center">
<view class="u-flex u-col-bottom">
<view class="u-flex u-col-bottom" style="align-items: center;">
<template v-if="data.tableName">
<view class="u-flex u-col-center">
<view class="u-font-40 color-333">{{data.tableName}}</view>
<view class="line" style="height: 16px;"></view>
</view>
</template>
<view class="">{{data.masterId}}</view>
<!-- <view class="">{{ $dict.getDiceName(data.platformType,'platformType') }}</view> -->
</view>
<view class="u-flex">
<view>
<text :class="[data.status]">{{returnStatus(data.status)}}</text>
<text :class="[data.status]">{{$dict.getDiceName(data.status,'orderStatus')}}</text>
</view>
<view class="line"></view>
<view class=" color-main">
<text>
{{sendTypeFilter(data.sendType)}}
{{$dict.getDiceName(data.dineMode,'dineMode')}}
</text>
</view>
</view>
@@ -25,42 +25,24 @@
<view class="u-m-t-26">
<view class="u-flex u-col-bottom u-font-24 color-999">
<up-avatar :size="33"></up-avatar>
<view class="u-m-l-16">{{formatTime(data.createdAt)}}</view>
<view class="u-m-l-16">{{formatTime(data.createTime)}}</view>
</view>
<view class="u-m-t-32">
<view class="u-font-32">{{goosZhonglei}}种商品{{goodsNumber}}</view>
<view class="u-font-32">{{data.goods.length}}商品</view>
<view class="border-bottom u-p-b-32">
<view class="" v-for="(item,index) in data.detailList" :key="index">
<view class="" v-for="(item,index) in data.goods" :key="index">
<view class="u-flex u-row-between u-col-top u-m-t-32" v-if="item.productId!=-999">
<view>
<view class=""> {{item.productName}}</view>
<view class="color-999 u-font-24 u-m-t-8">
{{item.productSkuName}}
{{item.skuName}}
</view>
</view>
<view class="u-flex u-flex-1 u-row-right">
<view>×{{item.num}}</view>
<template v-if="item.gift||item.userCouponId">
<view class="u-text-right u-relative" :style="computedPriceStyle()">
<text class="line-th">{{goodsPriceAmount(item)}}</text>
<view class="u-absolute" style="bottom: 100%;right: 0;">
0
</view>
</view>
</template>
<template v-else-if="item.isMember&&data.memberId&&item.memberPrice&&item.memberPrice!=item.price">
<view class="u-text-right u-relative" :style="computedPriceStyle()">
<text class="line-th">{{goodsPriceAmount(item)}}</text>
<view class="u-absolute" style="bottom: 100%;right: 0;">
{{goodsVipPriceAmount(item)}}
</view>
</view>
</template>
<template v-else>
<view class="u-text-right u-relative" :style="computedPriceStyle()">
<text>{{goodsPriceAmount(item)}}</text>
</view>
</template>
<view class="u-flex u-flex-1 u-row-right" style="align-items: center;">
<view style="margin-right: 10rpx;">×{{item.num}}</view>
<view class="u-text-right u-relative" :style="computedPriceStyle()">
<text>{{item.unitPrice}}</text>
</view>
</view>
</view>
@@ -74,8 +56,8 @@
<view class="no-wrap u-m-r-32">打包费</view>
<view>{{data.packFee||0}}</view>
</view>
<view style="height: 32rpx;" v-if="data.packFee>0&&data.seatInfo&&data.seatInfo.priceAmount>0"></view>
<view class="u-flex u-row-between u-col-top" v-if="data.seatInfo&&data.seatInfo.priceAmount>0">
<view style="height: 32rpx;" ></view>
<view class="u-flex u-row-between u-col-top" v-if="data.seatInfo&&data.seatInfo.priceAmount>0">
<view class="no-wrap u-m-r-32">{{data.seatInfo.productName}}</view>
<view>{{data.seatInfo.priceAmount}}</view>
</view>
@@ -105,9 +87,9 @@
<view class="u-m-t-32">
<view class="u-flex u-row-right">
<text>总计</text>
<text class="font-bold u-font-32">{{data.orderAmount}}</text>
<text class="font-bold u-font-32">{{originAmount.toFixed(2)}}</text>
</view>
<view class="u-flex u-row-right u-m-t-24">
<view class="u-flex u-row-right u-m-t-24" v-if="data.status == 'unpaid'||data.status == 'done'">
<view class="print" @click.stop="print(item)">重新打印</view>
</view>
</view>
@@ -116,20 +98,11 @@
</template>
<script setup>
import { computed, reactive, ref, watch } from 'vue';
import dayjs from 'dayjs';
import orderEnum from '@/commons/orderEnum.js'
import go from '@/commons/utils/go.js'
import {
isTui,
canTuiKuan,
canTuicai
} from '@/commons/utils/goodsUtil.js'
import {
computed,
reactive,
ref,
watch
} from 'vue';
const emits = defineEmits(['printOrder'])
const props = defineProps({
data: {
@@ -141,7 +114,7 @@
productName: '客座费',
priceAmount: 0
},
detailList: []
goods: []
}
}
},
@@ -153,73 +126,40 @@
let $goodsMap = {}
let goosZhonglei = ref(0)
let goodsNumber = ref(0)
let originAmount = ref(0)
const priceSize = 9
let minWidth=ref(36)
function goodsPriceAmount(item) {
const total=(item.price * item.num).toFixed(2)
const minW=total.length * priceSize + 15
minWidth.value=minW<minWidth.value?minWidth.value:minW
return total
}
function goodsVipPriceAmount(item) {
const price = item.memberPrice ? item.memberPrice : item.price
return (price * item.num).toFixed(2)
}
// const packeFee=computed(()=>{
// return props.data.detailList.reduce((prve,cur)=>{
// return prve+cur.packAmount
// },0).toFixed(2)
// })
function computedPriceStyle() {
return {
'min-width':minWidth.value + 'px'
}
}
// const computedPriceStyle = computed(() => {
// })
function goodsMapInit() {
for (let i in props.data.detailList) {
const goods = props.data.detailList[i]
for (let i in props.data.goods) {
const goods = props.data.goods[i]
if ($goodsMap.hasOwnProperty(goods.productId)) {
$goodsMap[goods.productId] += goods.num * 1
goodsNumber.value += goods.num * 1
} else {
$goodsMap[goods.productId] = goods.num * 1
goosZhonglei.value += 1
goodsNumber.value += goods.num * 1
}
originAmount.value += goods.unitPrice
}
}
goodsMapInit()
watch(() => props.data.detailList.length, (newval) => {
watch(() => props.data.goods.length, (newval) => {
goodsNumber.value = 0
goodsMapInit()
})
function formatTime(time) {
return dayjs(time).format('YYYY-MM-DD HH:mm:ss');
}
function returnStatus(status) {
const item = orderEnum.status.find(v => v.key == status)
return item ? item.label : ''
}
function sendTypeFilter(t) {
console.log(t);
if (t) {
const item = orderEnum.sendType.find(item => item.key == t)
return item ? item.label : '';
} else {
return t;
}
}
function toDetail() {
go.to('PAGES_ORDER_DETAIL', {
id: props.data.id
@@ -286,4 +226,4 @@
}
}
}
</style>
</style>

View File

@@ -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: '提示',