250108
This commit is contained in:
+250
-114
@@ -4,12 +4,18 @@
|
||||
<!-- <uni-segmented-control :current="current" :values="items" :styleType="styleType" :activeColor="activeColor"-->
|
||||
<!-- inActiveColor="#808080" @clickItem="onClickItem"/>-->
|
||||
<!-- </view>-->
|
||||
<uv-sticky>
|
||||
<view class="flex justify-center items-center p-10">
|
||||
<uv-sticky title="订单" bg-color="white">
|
||||
<view class="w-100p" :style="{height: `${safeTop}px`}"></view>
|
||||
<view v-if="hasMerchantRole || hasMerchantClerkRole || hasSuperAdminRole"
|
||||
class="px-20 pb-20 flex justify-center items-center" style="width: calc(100vw - 250rpx)">
|
||||
<uv-input v-model="orderNo" shape="circle" clearable placeholder="订单号搜索"
|
||||
:customStyle="{backgroundColor: 'white'}" @change="reload"/>
|
||||
</view>
|
||||
<view class="flex justify-center items-center p-10" style="width: calc(100vw - 220rpx); height: 40px">
|
||||
<view class="flex-2 mx-15 flex justify-center" @click="openOrderTypePicker">
|
||||
<uv-icon name="arrow-down" :label="orderTypeStr" label-pos="left"/>
|
||||
</view>
|
||||
<view class="flex-2 mx-15 flex justify-center" @click="openOrderStatusPicker">
|
||||
<view class="flex-2 mx-15 flex justify-center" @click="openOrderStatusPicker" v-if="orderType !== 2">
|
||||
<uv-icon name="arrow-down" :label="orderStatusStr" label-pos="left"/>
|
||||
</view>
|
||||
<view class="flex-1 mx-15 flex justify-center" @click="reset">
|
||||
@@ -19,92 +25,131 @@
|
||||
</uv-sticky>
|
||||
<view class="order">
|
||||
<block v-if="orderList.length > 0">
|
||||
<block v-for="(item,index) in orderList" :key="index">
|
||||
<uni-card :border="false" :is-shadow="false" :padding="0">
|
||||
<template v-slot:title>
|
||||
<div class="order-title web-cell">
|
||||
<view class="web-cell web-cell-content" v-if="orderType === 0">
|
||||
<text class="merchant-name">{{ item.siteName }}</text>
|
||||
</view>
|
||||
<view class="web-cell web-cell-content flex justify-between items-center" v-if="orderType === 1">
|
||||
<text class="merchant-name">{{ item.siteNames }}</text>
|
||||
<text class="text-25 text-red" v-if="item.status === 2">待支付</text>
|
||||
<text class="text-25 text-green" v-else-if="item.status === 1">已支付</text>
|
||||
<text class="text-25 text-gray" v-else-if="item.status === 3">已退款</text>
|
||||
<text class="text-25 text-gray" v-else-if="item.status === 0">已取消</text>
|
||||
</view>
|
||||
<block v-if="item.orderStatus === 3">
|
||||
<text class="btn-status web-text-secondary">已取消</text>
|
||||
</block>
|
||||
<block v-else-if="item.orderStatus === 1">
|
||||
<text class="btn-status web-text-success">已完成</text>
|
||||
</block>
|
||||
<block v-else>
|
||||
<text v-if="item.payStatus === 1" class="btn-status web-text-success">已支付</text>
|
||||
<view v-if="item.payStatus === 0" class="btn-status web-text-danger">
|
||||
<uv-count-down :time="item.timestamp" format="mm:ss"></uv-count-down>
|
||||
<text class="no-pay" style="margin-left: 10rpx;">未支付</text>
|
||||
<template v-if="orderType === 2">
|
||||
<view v-for="(item, index) in orderList" class="card m-20" :key="index">
|
||||
<view class="pb-20 border-bottom flex justify-between items-center text-25">
|
||||
<text>{{ item.orderNum }}</text>
|
||||
<text v-if="item.status === 0">未支付</text>
|
||||
<text v-if="item.status === 1" class="text-red">已支付,未退款</text>
|
||||
<text v-if="item.status === 2" class="text-green">已退款</text>
|
||||
</view>
|
||||
<view class="py-20 border-bottom flex justify-between items-center text-25">
|
||||
<text>{{ item.siteName }}-{{ item.info }}</text>
|
||||
<text class="text-red font-bold">¥{{ item.money }}</text>
|
||||
</view>
|
||||
<view class="py-20 flex justify-start items-center text-25 text-gray">
|
||||
<text>{{ dayjs(item.createTime * 1000).format('YYYY-MM-DD HH:mm:ss') }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<block v-for="(item,index) in orderList" :key="index">
|
||||
<uni-card :border="false" :is-shadow="false" :padding="0">
|
||||
<template v-slot:title>
|
||||
<div class="order-title web-cell">
|
||||
<view class="web-cell web-cell-content">
|
||||
<text class="merchant-name">订单号: {{ item.orderNum }}</text>
|
||||
</view>
|
||||
</block>
|
||||
</div>
|
||||
</template>
|
||||
<view class="order-body web-cell web-cell-align-top">
|
||||
<view class="web-cell-content" @click="toDetail(item.id)">
|
||||
<uv-cell-group :customStyle="{backgroundColor: '#ffffff'}" :border="false" v-if="orderType === 0">
|
||||
<block v-for="(sub,subIndex) in item.thinkOrderInfos" :key="subIndex">
|
||||
<uv-cell :title="`${item.siteName} - ${sub.fieldName}`" :label="`${sub.dateTime}`"
|
||||
:cellStyle="{padding: '0', paddingBottom: '5px'}" :border="false"/>
|
||||
<view class="web-cell web-cell-content flex justify-between items-center" v-if="orderType === 1">
|
||||
<text class="merchant-name">{{ item.siteNames }}</text>
|
||||
<text class="text-25 text-red" v-if="item.status === 2">待支付</text>
|
||||
<text class="text-25 text-green" v-else-if="item.status === 1">已支付</text>
|
||||
<text class="text-25 text-gray" v-else-if="item.status === 3">已退款</text>
|
||||
<text class="text-25 text-gray" v-else-if="item.status === 0">已取消</text>
|
||||
</view>
|
||||
<block v-if="item.orderStatus === 3">
|
||||
<text class="btn-status web-text-secondary">已取消</text>
|
||||
</block>
|
||||
</uv-cell-group>
|
||||
<uv-cell-group :customStyle="{backgroundColor: '#ffffff'}" :border="false" v-else-if="orderType === 1">
|
||||
<uv-cell :title="item.name"
|
||||
:cellStyle="{padding: '0', paddingBottom: '5px'}" :border="false">
|
||||
</uv-cell>
|
||||
</uv-cell-group>
|
||||
<view class="total-price" v-if="orderType === 0">
|
||||
<view class="web-text-heading">合计:¥{{ item.totalPrice }}</view>
|
||||
</view>
|
||||
<view class="total-price" v-else-if="orderType === 1">
|
||||
<view class="web-text-heading">合计:¥{{ item.price }}</view>
|
||||
<block v-else-if="item.orderStatus === 1">
|
||||
<text class="btn-status web-text-success">已完成</text>
|
||||
</block>
|
||||
<block v-else>
|
||||
<text v-if="item.payStatus === 1" class="btn-status web-text-success">已支付</text>
|
||||
<view v-if="item.payStatus === 0" class="btn-status web-text-danger">
|
||||
<uv-count-down :time="item.timestamp" format="mm:ss"></uv-count-down>
|
||||
<text class="no-pay" style="margin-left: 10rpx;">未支付</text>
|
||||
</view>
|
||||
</block>
|
||||
</div>
|
||||
</template>
|
||||
<view class="order-body web-cell web-cell-align-top">
|
||||
<view class="web-cell-content" @click="toDetail(item.id)">
|
||||
<uv-cell-group :customStyle="{backgroundColor: '#ffffff'}" :border="false" v-if="orderType === 0">
|
||||
<block v-for="(sub,subIndex) in item.thinkOrderInfos" :key="subIndex">
|
||||
<uv-cell :title="`${item.siteName} - ${sub.fieldName}`" :label="`${sub.dateTime}`"
|
||||
:cellStyle="{padding: '0', paddingBottom: '5px'}" :border="false"/>
|
||||
</block>
|
||||
</uv-cell-group>
|
||||
<uv-cell-group :customStyle="{backgroundColor: '#ffffff'}" :border="false"
|
||||
v-else-if="orderType === 1">
|
||||
<uv-cell :title="item.name"
|
||||
:cellStyle="{padding: '0', paddingBottom: '5px'}" :border="false">
|
||||
</uv-cell>
|
||||
</uv-cell-group>
|
||||
<view class="total-price" v-if="orderType === 0">
|
||||
<view class="web-text-heading">合计:¥{{ item.totalPrice }}</view>
|
||||
</view>
|
||||
<view class="total-price" v-else-if="orderType === 1">
|
||||
<view class="web-text-heading">合计:¥{{ item.price }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view slot="actions" class="card-actions">
|
||||
<template v-if="orderType === 0">
|
||||
<view class="card-actions-item" v-if="item.payStatus === 2 && item.orderStatus === 2">
|
||||
<button class="mini-btn" size="mini" @click="closeOrder(item)"
|
||||
style="margin-right: 20rpx;">取消订单
|
||||
</button>
|
||||
<button class="mini-btn" type="primary" size="mini"
|
||||
@click="openPayOrder(item.id)">立即支付
|
||||
</button>
|
||||
</view>
|
||||
<view class="card-actions-item" v-if="item.payStatus == 1">
|
||||
<button class="mini-btn" size="mini" v-if="item.isOpen === 2" @click="onInvoice(item.orderId)">
|
||||
申请开票
|
||||
</button>
|
||||
<button class="mini-btn" size="mini" v-else @click="showInvoice(item.id)">查看发票</button>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else-if="orderType === 1">
|
||||
<view class="card-actions-item" v-if="item.status === 2">
|
||||
<button class="mini-btn" size="mini" @click="closeVipOrder(item)"
|
||||
style="margin-right: 20rpx;">取消订单
|
||||
</button>
|
||||
<button class="mini-btn" type="primary" size="mini"
|
||||
@click="openPay(item.id)">立即支付
|
||||
</button>
|
||||
</view>
|
||||
<view class="card-actions-item" v-if="item.status === 1">
|
||||
<button class="mini-btn" size="mini" v-if="item.isInvoice === 2" @click="onInvoice(item.id)">
|
||||
申请开票
|
||||
</button>
|
||||
<button class="mini-btn" size="mini" v-else @click="showInvoice(item.id)">查看发票</button>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
</uni-card>
|
||||
</block>
|
||||
<view slot="actions" class="card-actions">
|
||||
<template v-if="orderType === 0">
|
||||
<view class="card-actions-item" v-if="item.payStatus === 2 && item.orderStatus === 2">
|
||||
<button class="mini-btn" size="mini" @click="closeOrder(item)"
|
||||
style="margin-right: 20rpx;">取消订单
|
||||
</button>
|
||||
<button class="mini-btn" type="primary" size="mini"
|
||||
@click="openPayOrder(item.id)">立即支付
|
||||
</button>
|
||||
</view>
|
||||
<view class="card-actions-item" v-if="item.payStatus === 1">
|
||||
<button class="mini-btn mx-10" size="mini" v-if="item.orderStatus === 4">
|
||||
退款中
|
||||
</button>
|
||||
<button class="mini-btn mx-10" size="mini" v-if="item.orderStatus === 6">
|
||||
{{ item.payType === 1 ? '退款成功' : '已取消' }}
|
||||
</button>
|
||||
<button class="mini-btn mx-10" size="mini"
|
||||
v-if="item.orderStatus === 2 && item.canRefund"
|
||||
@click="refund(item, index)" :disabled="item.disabled">
|
||||
{{ item.payType === 1 ? '申请退款' : '取消订单' }}
|
||||
</button>
|
||||
<button class="mini-btn mx-10" size="mini" v-if="item.orderStatus === 2" @click="toDetail(item.id)">
|
||||
核销码
|
||||
</button>
|
||||
<button class="mini-btn mx-10" size="mini" v-if="item.canInvoice" @click="onInvoice(item)">
|
||||
申请开票
|
||||
</button>
|
||||
<button class="mini-btn mx-10" size="mini" v-else-if="item.isInvoice === 1"
|
||||
@click="showInvoice(item.id)">
|
||||
查看发票
|
||||
</button>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else-if="orderType === 1">
|
||||
<view class="card-actions-item" v-if="item.payStatus === 2">
|
||||
<button class="mini-btn" size="mini" @click="closeVipOrder(item)"
|
||||
style="margin-right: 20rpx;">取消订单
|
||||
</button>
|
||||
<button class="mini-btn" type="primary" size="mini"
|
||||
@click="openPay(item.id)">立即支付
|
||||
</button>
|
||||
</view>
|
||||
<view class="card-actions-item" v-if="item.status === 1">
|
||||
<button class="mini-btn" size="mini" v-if="item.isInvoice === 2" @click="onInvoice(item)">
|
||||
申请开票
|
||||
</button>
|
||||
<button class="mini-btn" size="mini" v-else-if="item.isInvoice === 1" @click="showInvoice(item.id)">
|
||||
查看发票
|
||||
</button>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
</uni-card>
|
||||
</block>
|
||||
</template>
|
||||
</block>
|
||||
<!-- <block v-if="orderList.length === 0 && loadMore != 'no-more'">-->
|
||||
<!-- <uni-card :border="false" :padding="'18px 6px'">-->
|
||||
@@ -141,24 +186,34 @@
|
||||
|
||||
<script>
|
||||
import * as OrderApi from '@/api/think/thinkOrder'
|
||||
import {
|
||||
pageThinkWechatDeposit
|
||||
} from '@/api/think/thinkWechatDeposit'
|
||||
import {
|
||||
getWeek,
|
||||
getKey
|
||||
} from '@/utils/common';
|
||||
import {pageThinkOrder, thinkOrderRepay} from "@/api/think/thinkOrder";
|
||||
import {pageThinkOrder, thinkOrderRepay, updateThinkOrder} from "@/api/think/thinkOrder";
|
||||
import {pageThinkUsersVip, thinkUsersVipRepay, updateThinkUsersVip} from "@/api/think/thinkUsersVip";
|
||||
import {pageThinkDeposit} from "@/api/think/thinkDeposit";
|
||||
import dayjs from "dayjs";
|
||||
import * as Api from "@/api/booking/userInvoice";
|
||||
import {addThinkOrderRefundLog} from "@/api/think/thinkOrderRefundLog";
|
||||
import {authUser} from "@/api/user";
|
||||
import {useUserStore} from "@/store/modules/user";
|
||||
|
||||
const userStore = useUserStore();
|
||||
|
||||
export default {
|
||||
computed: {
|
||||
dayjs() {
|
||||
return dayjs
|
||||
}
|
||||
},
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
isRefresh: false,
|
||||
isLogin: false,
|
||||
userId: 0,
|
||||
userInfo: null,
|
||||
where: {
|
||||
page: 1
|
||||
// sceneType: 'showOrderInfo' // 查询订单附加场地信息
|
||||
@@ -214,6 +269,11 @@ export default {
|
||||
],
|
||||
orderStatusStr: '全部状态',
|
||||
orderStatus: null,
|
||||
hasMerchantRole: false,
|
||||
hasMerchantClerkRole: false,
|
||||
hasSuperAdminRole: false,
|
||||
orderNo: '',
|
||||
safeTop: 44,
|
||||
}
|
||||
},
|
||||
// async onLoad(option) {
|
||||
@@ -225,7 +285,16 @@ export default {
|
||||
// // }
|
||||
// },
|
||||
async onShow(e) {
|
||||
const sysInfo = uni.getSystemInfoSync()
|
||||
this.safeTop = sysInfo.statusBarHeight
|
||||
this.userId = await uni.getStorageSync('user_id')
|
||||
const userInfo = await userStore.fetchUserInfo();
|
||||
if (Object.keys(userInfo).length > 0) {
|
||||
this.userInfo = userInfo;
|
||||
this.hasMerchantRole = userInfo.roles.find((d) => d.roleCode === 'merchant');
|
||||
this.hasMerchantClerkRole = userInfo.roles.find((d) => d.roleCode === 'merchantClerk');
|
||||
this.hasSuperAdminRole = userInfo.roles.find((d) => d.roleCode === 'superAdmin');
|
||||
}
|
||||
await this.reload()
|
||||
},
|
||||
// 触底函数
|
||||
@@ -273,18 +342,63 @@ export default {
|
||||
},
|
||||
async getOrderList() {
|
||||
let res
|
||||
if (this.orderType === 0) res = await pageThinkOrder(this.where)
|
||||
else if (this.orderType === 1) res = await pageThinkUsersVip(this.where)
|
||||
else if (this.orderType === 2) res = await pageThinkDeposit(this.where)
|
||||
if (this.orderType === 0) {
|
||||
if (this.orderNo) {
|
||||
this.where.orderNum = this.orderNo
|
||||
this.where.forAdmin = true
|
||||
} else {
|
||||
this.where.orderNum = null
|
||||
this.where.forAdmin = null
|
||||
}
|
||||
res = await pageThinkOrder(this.where).catch(err => {
|
||||
this.$refs.login.open('bottom')
|
||||
})
|
||||
} else if (this.orderType === 1) res = await pageThinkUsersVip(this.where).catch(err => {
|
||||
this.$refs.login.open('bottom')
|
||||
})
|
||||
else if (this.orderType === 2) res = await pageThinkDeposit(this.where).catch(err => {
|
||||
this.$refs.login.open('bottom')
|
||||
})
|
||||
|
||||
if (this.orderList.length < res.count) {
|
||||
this.orderList = this.orderList.concat(res.list)
|
||||
let list = res.list
|
||||
if (this.orderType === 1) list = list.map(item => {
|
||||
item.orderNum = item.wechatOrder
|
||||
item.payPrice = item.price
|
||||
return item
|
||||
})
|
||||
if (this.orderType === 0) list = list.map(item => {
|
||||
item.canRefund = false
|
||||
// 游泳馆没有用就可以退
|
||||
if (item.sid === 37) {
|
||||
if (item.orderStatus === 2) item.canRefund = true
|
||||
} else {
|
||||
// 可提前6小时退
|
||||
item.canRefund = item.startTime - dayjs().unix() > (3600 * 6)
|
||||
}
|
||||
item.disabled = false
|
||||
return item
|
||||
})
|
||||
this.orderList = this.orderList.concat(list)
|
||||
console.log(this.orderList)
|
||||
this.canReset = true
|
||||
this.loadMore = 'no-more'
|
||||
} else {
|
||||
this.canReset = false;
|
||||
this.loadMore = 'no-more'
|
||||
}
|
||||
if (this.orderType !== 2) {
|
||||
this.orderList = this.orderList.map(item => {
|
||||
item.canInvoice = false
|
||||
if (this.orderType === 0 && item.isInvoice === 2 && item.orderStatus === 1) {
|
||||
const date = item.dateTime.split("(")[0]
|
||||
const endTime = item.dateTime.split(" - ")[1]
|
||||
const time = `${date} ${endTime}:00`
|
||||
if (dayjs().isAfter(dayjs(time))) item.canInvoice = true
|
||||
}
|
||||
return item
|
||||
})
|
||||
}
|
||||
},
|
||||
async onClickItem(e) {
|
||||
const app = this
|
||||
@@ -353,26 +467,20 @@ export default {
|
||||
})
|
||||
},
|
||||
closeOrder(item) {
|
||||
const _this = this
|
||||
uni.showModal({
|
||||
title: '确定取消此订单?',
|
||||
success(o) {
|
||||
async success(o) {
|
||||
if (o.confirm) {
|
||||
OrderApi.updateOrder({
|
||||
orderStatus: 2,
|
||||
orderId: item.orderId
|
||||
}).then(msg => {
|
||||
uni.showToast({
|
||||
title: msg,
|
||||
icon: 'none'
|
||||
})
|
||||
item.orderStatus = 2;
|
||||
}).catch(() => {
|
||||
uni.showToast({
|
||||
title: '请检查您的网络.',
|
||||
icon: 'none'
|
||||
})
|
||||
uni.hideLoading()
|
||||
await updateThinkOrder({
|
||||
orderStatus: 3,
|
||||
id: item.id
|
||||
})
|
||||
uni.showToast({
|
||||
title: '取消成功',
|
||||
icon: 'none'
|
||||
})
|
||||
await _this.reload()
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -386,10 +494,10 @@ export default {
|
||||
}
|
||||
},
|
||||
// 申请开票
|
||||
onInvoice(id) {
|
||||
uni.navigateTo({
|
||||
url: '/package/user/invoice?id=' + id
|
||||
})
|
||||
onInvoice({id, orderNum, payPrice}) {
|
||||
let url = `/package/user/invoice?id=${id}&orderNum=${orderNum}&itype=${this.orderType + 1}`
|
||||
url += `&price=${payPrice}`
|
||||
uni.navigateTo({url})
|
||||
},
|
||||
showInvoice(id) {
|
||||
uni.navigateTo({
|
||||
@@ -461,7 +569,7 @@ export default {
|
||||
}
|
||||
})
|
||||
},
|
||||
reset(){
|
||||
reset() {
|
||||
this.where = {
|
||||
page: 1
|
||||
}
|
||||
@@ -471,6 +579,34 @@ export default {
|
||||
this.orderStatus = null
|
||||
this.orderStatusStr = '全部状态'
|
||||
this.reload()
|
||||
},
|
||||
refund(order, index) {
|
||||
uni.showModal({
|
||||
title: '确定要退款吗?',
|
||||
success: async ({confirm}) => {
|
||||
if (confirm) {
|
||||
this.orderList[index].disabled = true
|
||||
uni.showLoading({
|
||||
title: '退款请求中'
|
||||
})
|
||||
await addThinkOrderRefundLog({
|
||||
uid: order.uid,
|
||||
refundAmount: order.payPrice,
|
||||
sid: order.sid,
|
||||
oid: order.id,
|
||||
status: 1,
|
||||
type: 0
|
||||
})
|
||||
this.orderList[index].disabled = false
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: '申请退款成功',
|
||||
icon: 'none'
|
||||
})
|
||||
await this.reload()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user