代码更新
This commit is contained in:
@@ -29,14 +29,7 @@
|
||||
<!-- <view class="line-th">¥{{data.priceAmount||data.returnAmount}}</view> -->
|
||||
</view>
|
||||
</template>
|
||||
<!-- <view class="u-flex u-row-right u-m-t-24">
|
||||
<template v-if="orderInfo.status=='unpaid'&&data.status!='return'">
|
||||
<my-button plain shape="circle" :width="160" :height="56" @click="tuicai">退菜</my-button>
|
||||
</template>
|
||||
<template v-if="orderInfo.status=='closed'&&data.status!='return'">
|
||||
<my-button plain shape="circle" :width="160" :height="56" @click="tuikuan">退款</my-button>
|
||||
</template>
|
||||
</view> -->
|
||||
|
||||
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-24" v-if="packeFee>0">
|
||||
@@ -112,7 +105,7 @@
|
||||
}
|
||||
|
||||
function extraCanTuiKuan(orderInfo, data) {
|
||||
return orderInfo.status == 'closed' && data.status != 'refund' && data.priceAmount * 1 > 0
|
||||
return orderInfo.status == 'done' && data.status != 'refund' && data.priceAmount * 1 > 0
|
||||
}
|
||||
const packeNumbber = computed(() => {
|
||||
if (!props.orderInfo.detailList) {
|
||||
|
||||
@@ -189,20 +189,7 @@
|
||||
</template>
|
||||
|
||||
</view>
|
||||
<!-- <view class="u-flex u-row-between u-m-t-20" v-if="orderInfo.status=='closed'">
|
||||
<view></view>
|
||||
<view>
|
||||
<text>实付¥</text>
|
||||
<text class="font-bold u-font-32">{{to2(orderInfo.amount) }}</text>
|
||||
</view>
|
||||
</view> -->
|
||||
<!-- <view class="u-flex u-row-between u-m-t-20">
|
||||
<view></view>
|
||||
<view>
|
||||
<text>原价¥</text>
|
||||
<text class="font-bold u-font-32">{{to2(orderInfo.originAmount||0) }}</text>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
<view class="u-m-t-24">
|
||||
<my-button @tap="printOrder" type="cancel" :color="color.ColorMain">重新打印</my-button>
|
||||
</view>
|
||||
@@ -493,7 +480,7 @@
|
||||
})
|
||||
|
||||
const productCoupPrice = computed(() => {
|
||||
if (props.orderInfo.status == 'closed') {
|
||||
if (props.orderInfo.status == 'done') {
|
||||
return props.orderInfo.productCouponDiscountAmount
|
||||
}
|
||||
const goodsPrice = props.data.reduce((a, b) => {
|
||||
|
||||
@@ -19,36 +19,7 @@
|
||||
</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>
|
||||
<text class="u-p-l-10 u-p-r-10">至</text>
|
||||
<uni-dateformat format="yyyy-MM-dd hh:mm:ss" :date="time[1]"></uni-dateformat>
|
||||
</view>
|
||||
</view> -->
|
||||
<my-date-pickerview @confirm="datePickerConfirm" ref="datePicker" mode="all"></my-date-pickerview>
|
||||
<!-- 更多状态选择筛选 -->
|
||||
<up-popup :round="10" :show="statusData.moreShow" :closeable="true" @close="moreShowHide">
|
||||
@@ -80,12 +51,7 @@
|
||||
watch
|
||||
} from 'vue';
|
||||
|
||||
const emits = defineEmits(['update:time', 'update:status','clearUser','updateStatus'])
|
||||
|
||||
function userShowClose() {
|
||||
userShow.value = false
|
||||
emits('clearUser')
|
||||
}
|
||||
const emits = defineEmits(['update:time', 'update:status','updateStatus'])
|
||||
|
||||
const props = defineProps({
|
||||
time: {
|
||||
@@ -95,27 +61,6 @@
|
||||
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
|
||||
}
|
||||
})
|
||||
|
||||
@@ -163,7 +108,7 @@
|
||||
// },
|
||||
{
|
||||
label: '已完成',
|
||||
value: 'closed'
|
||||
value: 'done'
|
||||
},
|
||||
// {
|
||||
// label: '未支付',
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<view v-for="(item,index) in list" :key="index">
|
||||
<order-item @printOrder="print" :key="index" :data="item" :index="index"></order-item>
|
||||
</view>
|
||||
<view v-if="hasAjax&&!list.length">
|
||||
<view v-if="!list.length">
|
||||
<my-img-empty tips="亲,你还没有订单哦~"></my-img-empty>
|
||||
</view>
|
||||
</view>
|
||||
@@ -15,10 +15,6 @@
|
||||
list:{
|
||||
type:Array,
|
||||
default:()=>[]
|
||||
},
|
||||
hasAjax:{
|
||||
type:Boolean,
|
||||
default:false
|
||||
}
|
||||
})
|
||||
const emits=defineEmits(['printOrder'])
|
||||
|
||||
@@ -3,37 +3,32 @@
|
||||
<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="pageData.query.orderNo" @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 @updateStatus="updateQuery('status',$event)" v-model:time="pageData.createdAt" ></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>
|
||||
<order-list @printOrder="onPrintOrder" :list="pageData.list"></order-list>
|
||||
<template v-if="pageData.list.length>0">
|
||||
<my-pagination @change="pageChange" :totalElements="pageData.total"></my-pagination>
|
||||
</template>
|
||||
<view style="height: 100rpx;"></view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive, ref, watch } from 'vue';
|
||||
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, ref, watch
|
||||
} from 'vue';
|
||||
import {getTodayTimestamps} from '@/commons/utils/dayjs-time.js';
|
||||
import { getOrderList } from '@/api/order.js'
|
||||
|
||||
const search = reactive({
|
||||
val: '',
|
||||
placeholder: '搜索单号/商品名称',
|
||||
shape: 'square',
|
||||
inputStyle: {
|
||||
@@ -43,96 +38,53 @@
|
||||
textAlign: 'right'
|
||||
}
|
||||
})
|
||||
|
||||
const today = getTodayTimestamps();
|
||||
const order=new LIST({
|
||||
const pageData = reactive({
|
||||
createdAt: [today.start,today.end],
|
||||
list: [],
|
||||
total: 0,
|
||||
query: {
|
||||
createdAt: [today.start,today.end],
|
||||
id: "",
|
||||
platformType: "admin-app",
|
||||
orderNo: "",
|
||||
orderType: "0",
|
||||
page: 0,
|
||||
page: 1,
|
||||
pageSize: 10,
|
||||
payType: "",
|
||||
productName: "",
|
||||
status: "",
|
||||
userId:''
|
||||
startTime: today.start,
|
||||
endTime: today.end,
|
||||
status: ""
|
||||
}
|
||||
})
|
||||
console.log(order.data);
|
||||
function clearQueryUser(){
|
||||
order.setQuery('userId','')
|
||||
}
|
||||
function pageChange(e){
|
||||
const newPage=e-1
|
||||
order.setVal('page',newPage)
|
||||
order.setQuery('page',newPage)
|
||||
init()
|
||||
}
|
||||
function updateQuery(key,e){
|
||||
order.setQuery(key,e)
|
||||
}
|
||||
watch(()=>order.data.query.createdAt,(newval)=>{
|
||||
init()
|
||||
})
|
||||
watch(()=>order.data.query.status,(newval)=>{
|
||||
init()
|
||||
})
|
||||
watch(()=>order.data.query.userId,(newval)=>{
|
||||
init()
|
||||
})
|
||||
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})
|
||||
uni.stopPullDownRefresh()
|
||||
order.setVal('list',content)
|
||||
console.log(order.data.list);
|
||||
order.setVal('total',totalElements)
|
||||
order.setVal('hasAjax',true)
|
||||
}
|
||||
onPullDownRefresh(()=>{
|
||||
order.setQuery('page',0)
|
||||
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){
|
||||
try{
|
||||
console.log(item);
|
||||
const res= await $printOrder({
|
||||
tableId:item.tableId
|
||||
})
|
||||
infoBox.showToast('已发送打印请求')
|
||||
}catch(e){
|
||||
console.log(e);
|
||||
infoBox.showToast('发送打印请求失败')
|
||||
//TODO handle the exception
|
||||
}
|
||||
|
||||
})
|
||||
onShow(init)
|
||||
onPullDownRefresh(()=>{
|
||||
pageData.page = 1
|
||||
init()
|
||||
})
|
||||
watch(()=>pageData.createdAt,(newval)=>{
|
||||
pageData.query.startTime = newval[0]
|
||||
pageData.query.endTime = newval[1]
|
||||
init()
|
||||
})
|
||||
|
||||
/**
|
||||
* 获取订单列表
|
||||
*/
|
||||
async function init() {
|
||||
const res = await getOrderList({
|
||||
...pageData.query,
|
||||
})
|
||||
uni.stopPullDownRefresh()
|
||||
pageData.list = res.records
|
||||
pageData.total = res.totalRow
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否打印该订单
|
||||
* @param {Object} e
|
||||
*/
|
||||
function onPrintOrder(e){
|
||||
console.log(e);
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '是否打印该订单',
|
||||
@@ -143,6 +95,54 @@
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 打印该订单
|
||||
* @param {Object} item
|
||||
*/
|
||||
async function printOrder(item){
|
||||
try{
|
||||
const res= await $printOrder({
|
||||
tableId:item.tableId
|
||||
})
|
||||
infoBox.showToast('已发送打印请求')
|
||||
}catch(e){
|
||||
infoBox.showToast('发送打印请求失败')
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页加载
|
||||
* @param {Object} e
|
||||
*/
|
||||
function pageChange(e){
|
||||
pageData.page = e
|
||||
init()
|
||||
}
|
||||
|
||||
/**
|
||||
* 状态改变监听
|
||||
* @param {Object} key
|
||||
* @param {Object} e
|
||||
*/
|
||||
function updateQuery(key,e){
|
||||
pageData.query[key] = e
|
||||
pageData.page = 1
|
||||
init()
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索监听
|
||||
*/
|
||||
function searchConfirm(){
|
||||
pageData.page = 1
|
||||
init()
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
@@ -193,7 +193,7 @@
|
||||
<template v-if="order.status=='unpaid'">
|
||||
<up-loading-icon size="14" text="等待支付"></up-loading-icon>
|
||||
</template>
|
||||
<template v-if="order.status=='closed'">
|
||||
<template v-if="order.status=='done'">
|
||||
<view class="u-flex pay-success">
|
||||
<up-icon color="#5CBB6F" name="checkmark-circle-fill"></up-icon>
|
||||
<view class="u-m-l-6">支付成功</view>
|
||||
@@ -257,6 +257,10 @@
|
||||
returnProductCoupAllPrice,
|
||||
returnProductCanUseNum
|
||||
} from '../quan_util.js'
|
||||
|
||||
import { getHistoryOrder } from '@/api/order.js'
|
||||
import { getPayTypeList } from '@/api/payType.js'
|
||||
|
||||
|
||||
const modal = reactive({
|
||||
title: '提示',
|
||||
@@ -267,7 +271,80 @@
|
||||
show: false,
|
||||
data: ''
|
||||
})
|
||||
|
||||
let option = {
|
||||
isNowPay: false
|
||||
}
|
||||
|
||||
const order = reactive({
|
||||
amount: 0
|
||||
})
|
||||
onShow(() => {
|
||||
watchChooseuser()
|
||||
watchChooseQuan()
|
||||
})
|
||||
onLoad(async (opt) => {
|
||||
console.log(opt);
|
||||
option = opt
|
||||
Object.assign(order, opt)
|
||||
getPayType()
|
||||
init()
|
||||
})
|
||||
|
||||
watch(() => pays.selIndex, (newval) => {
|
||||
clearInterval(timer)
|
||||
if (newval) {
|
||||
timer = setInterval(() => {
|
||||
orderApi.tbOrderInfoDetail(order.orderId).then(res => {
|
||||
order.status = res.status
|
||||
if (res.status == 'done') {
|
||||
paySuccess()
|
||||
}
|
||||
})
|
||||
}, 2000)
|
||||
} else {
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
async function init() {
|
||||
const orderRes = await getHistoryOrder({orderId:order.orderId})
|
||||
console.log(orderRes)
|
||||
Object.assign(order, orderRes)
|
||||
$goodsPayPriceMap = returnGoodsPayPriceMap(order.detailList)
|
||||
const hasSelQuan = orderRes.couponInfoList ? JSON.parse(orderRes.couponInfoList) : {
|
||||
fullReductionCoupon: [],
|
||||
productCoupon: []
|
||||
};
|
||||
const fullReductionCoupon = hasSelQuan.fullReductionCoupon.filter(v => v.type == 1)
|
||||
const productCoupon = hasSelQuan.productCoupon.filter(v => v.type == 2)
|
||||
setQuan([...fullReductionCoupon, ...productCoupon])
|
||||
|
||||
if (orderRes.memberId) {
|
||||
calcUsablePoints()
|
||||
if (orderRes.pointsNum) {
|
||||
accountPoints.sel = true
|
||||
}
|
||||
queryAllShopUser({
|
||||
id: orderRes.memberId
|
||||
}).then(res => {
|
||||
if (res.content[0]) {
|
||||
user.value = res.content[0]
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 支付方式
|
||||
*/
|
||||
async function getPayType() {
|
||||
const payTypeList = await getPayTypeList()
|
||||
pays.payTypes.list = payTypeList.map(v => {
|
||||
return {
|
||||
...v,
|
||||
disabled: false
|
||||
}
|
||||
})
|
||||
}
|
||||
function confirmModelCancel() {
|
||||
if (modal.key == 'fullCoupon') {
|
||||
// 取消改价
|
||||
@@ -402,9 +479,7 @@
|
||||
showModel('editMoney', true)
|
||||
}
|
||||
}
|
||||
let option = {
|
||||
isNowPay: false
|
||||
}
|
||||
|
||||
let payFinish = ref(false)
|
||||
onBackPress(() => {
|
||||
uni.$emit('orderDetail:update')
|
||||
@@ -461,21 +536,7 @@
|
||||
return Api.$setUser(submitPar)
|
||||
}
|
||||
|
||||
function watchChooseuser() {
|
||||
uni.$off('choose-user')
|
||||
uni.$on('choose-user', (data) => {
|
||||
console.log(data);
|
||||
pays.quan = []
|
||||
setUser({
|
||||
vipUserId: data.id ? data.id : '',
|
||||
type: data.id ? 0 : 1 //0 设置 1 取消
|
||||
}).then(res => {
|
||||
user.value = data
|
||||
order.memberId = data.id
|
||||
init()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
function setQuan(arr) {
|
||||
console.log(arr);
|
||||
@@ -525,27 +586,22 @@
|
||||
setQuan(arr)
|
||||
})
|
||||
}
|
||||
function watchChooseuser() {
|
||||
uni.$off('choose-user')
|
||||
uni.$on('choose-user', (data) => {
|
||||
console.log(data);
|
||||
pays.quan = []
|
||||
setUser({
|
||||
vipUserId: data.id ? data.id : '',
|
||||
type: data.id ? 0 : 1 //0 设置 1 取消
|
||||
}).then(res => {
|
||||
user.value = data
|
||||
order.memberId = data.id
|
||||
init()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
onShow(() => {
|
||||
watchChooseuser()
|
||||
watchChooseQuan()
|
||||
})
|
||||
|
||||
watch(() => pays.selIndex, (newval) => {
|
||||
clearInterval(timer)
|
||||
if (newval) {
|
||||
timer = setInterval(() => {
|
||||
orderApi.tbOrderInfoDetail(order.orderId).then(res => {
|
||||
order.status = res.status
|
||||
if (res.status == 'closed') {
|
||||
paySuccess()
|
||||
}
|
||||
})
|
||||
}, 2000)
|
||||
} else {
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
const models = new Map();
|
||||
|
||||
@@ -584,16 +640,8 @@
|
||||
}
|
||||
getPayUrl()
|
||||
}
|
||||
|
||||
|
||||
async function getPayType() {
|
||||
const payTypeList = await Api.$getPayType()
|
||||
pays.payTypes.list = payTypeList.map(v => {
|
||||
return {
|
||||
...v,
|
||||
disabled: false
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function changePayType(i, item) {
|
||||
if (item.disabled) {
|
||||
@@ -675,9 +723,6 @@
|
||||
paySuccess()
|
||||
}
|
||||
|
||||
const order = reactive({
|
||||
amount: 0
|
||||
})
|
||||
|
||||
|
||||
|
||||
@@ -709,32 +754,7 @@
|
||||
// }
|
||||
})
|
||||
let payCodeUrl = ref('')
|
||||
async function init() {
|
||||
const orderRes = await orderApi.tbOrderInfoDetail(order.orderId)
|
||||
Object.assign(order, orderRes)
|
||||
$goodsPayPriceMap = returnGoodsPayPriceMap(order.detailList)
|
||||
const hasSelQuan = orderRes.couponInfoList ? JSON.parse(orderRes.couponInfoList) : {
|
||||
fullReductionCoupon: [],
|
||||
productCoupon: []
|
||||
};
|
||||
const fullReductionCoupon = hasSelQuan.fullReductionCoupon.filter(v => v.type == 1)
|
||||
const productCoupon = hasSelQuan.productCoupon.filter(v => v.type == 2)
|
||||
setQuan([...fullReductionCoupon, ...productCoupon])
|
||||
|
||||
if (orderRes.memberId) {
|
||||
calcUsablePoints()
|
||||
if (orderRes.pointsNum) {
|
||||
accountPoints.sel = true
|
||||
}
|
||||
queryAllShopUser({
|
||||
id: orderRes.memberId
|
||||
}).then(res => {
|
||||
if (res.content[0]) {
|
||||
user.value = res.content[0]
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function getPayUrl() {
|
||||
orderApi.$getOrderPayUrl({
|
||||
@@ -816,13 +836,7 @@
|
||||
calcUsablePoints()
|
||||
})
|
||||
|
||||
onLoad(async (opt) => {
|
||||
console.log(opt);
|
||||
option = opt
|
||||
Object.assign(order, opt)
|
||||
getPayType()
|
||||
init()
|
||||
})
|
||||
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
console.log('onBeforeUnmount');
|
||||
|
||||
Reference in New Issue
Block a user