This commit is contained in:
2024-11-01 14:15:56 +08:00
parent 0fc032aa8e
commit 06f6e29972
20 changed files with 3104 additions and 2715 deletions
+30 -30
View File
@@ -34,36 +34,36 @@
</block>
</block>
<view class="card-title web-text-heading">热门项目</view>
<block v-if="itemList.length > 0">
<view class="item-list">
<uni-grid :column="5" :highlight="true" :showBorder="false" @change="onItem">
<uni-grid-item v-for="(item, index) in itemList" :index="index" :key="index">
<view
class="grid-item-box"
style="
background-color: #ffffff;
margin: 10rpx;
border-radius: 10rpx;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 5rem;
"
>
<uv-avatar :src="item.image" :size="27" shape="square" fontSize="16" randomBgColor></uv-avatar>
<text class="text">{{ item.name }}</text>
</view>
</uni-grid-item>
</uni-grid>
</view>
</block>
<block v-else>
<uni-card :border="false" :padding="'12px 4px'">
<uv-skeleton rows="2" avatar :loading="hideTools" :title="false"></uv-skeleton>
</uni-card>
</block>
<!-- <view class="card-title web-text-heading">热门项目</view>-->
<!-- <block v-if="itemList.length > 0">-->
<!-- <view class="item-list">-->
<!-- <uni-grid :column="5" :highlight="true" :showBorder="false" @change="onItem">-->
<!-- <uni-grid-item v-for="(item, index) in itemList" :index="index" :key="index">-->
<!-- <view-->
<!-- class="grid-item-box"-->
<!-- style="-->
<!-- background-color: #ffffff;-->
<!-- margin: 10rpx;-->
<!-- border-radius: 10rpx;-->
<!-- display: flex;-->
<!-- flex-direction: column;-->
<!-- justify-content: center;-->
<!-- align-items: center;-->
<!-- height: 5rem;-->
<!-- "-->
<!-- >-->
<!-- <uv-avatar :src="item.image" :size="27" shape="square" fontSize="16" randomBgColor></uv-avatar>-->
<!-- <text class="text">{{ item.name }}</text>-->
<!-- </view>-->
<!-- </uni-grid-item>-->
<!-- </uni-grid>-->
<!-- </view>-->
<!-- </block>-->
<!-- <block v-else>-->
<!-- <uni-card :border="false" :padding="'12px 4px'">-->
<!-- <uv-skeleton rows="2" avatar :loading="hideTools" :title="false"></uv-skeleton>-->
<!-- </uni-card>-->
<!-- </block>-->
<!-- 商户列表 -->
<view class="card-title web-text-heading">场地预定</view>
+275 -116
View File
@@ -1,21 +1,38 @@
<template>
<view>
<view class="segmented">
<uni-segmented-control :current="current" :values="items" :styleType="styleType" :activeColor="activeColor"
inActiveColor="#808080" @clickItem="onClickItem"/>
</view>
<!-- <view class="segmented">-->
<!-- <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">
<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">
<uv-icon name="arrow-down" :label="orderStatusStr" label-pos="left"/>
</view>
<view class="flex-1 mx-15 flex justify-center" @click="reset">
<text class="text-24 text-blue">重置</text>
</view>
</view>
</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">
<view class="merchant-avatar">
<uv-avatar :src="item.merchantAvatar" size="24"></uv-avatar>
</view>
<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>
@@ -32,70 +49,93 @@
</div>
</template>
<view class="order-body web-cell web-cell-align-top">
<view class="web-cell-content">
<uv-cell-group :customStyle="{backgroundColor: '#ffffff'}" :border="false">
<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"
@click="openUrl(`/package/order/detail?id=${item.id}`)"/>
:cellStyle="{padding: '0', paddingBottom: '5px'}" :border="false"/>
</block>
</uv-cell-group>
<view class="total-price">
<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 class="web-text-heading" style="font-weight: 500;">
实付:¥{{ item.payPrice }}
</view>
</view>
<view class="total-price" v-else-if="orderType === 1">
<view class="web-text-heading">合计:¥{{ item.price }}</view>
</view>
</view>
</view>
<view slot="actions" class="card-actions">
<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;">{{ item.payStatus }}取消订单{{item.orderStatus}}
</button>
<button class="mini-btn" type="primary" size="mini"
@click="toPay(item.orderId)">去支付
</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 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>
</block>
<!-- <block v-if="orderList.length === 0 && loadMore != 'no-more'">-->
<!-- <uni-card :border="false" :padding="'18px 6px'">-->
<!-- <uv-skeleton rows="3" avatar :loading="hideTools" :title="false">-->
<!-- </uv-skeleton>-->
<!-- <uv-gap height="16"></uv-gap>-->
<!-- </uni-card>-->
<!-- <uni-card :border="false" :padding="'18px 6px'">-->
<!-- <uv-skeleton rows="3" avatar :loading="hideTools" :title="false">-->
<!-- </uv-skeleton>-->
<!-- <uv-gap height="16"></uv-gap>-->
<!-- </uni-card>-->
<!-- <uni-card :border="false" :padding="'18px 6px'">-->
<!-- <uv-skeleton rows="3" avatar :loading="hideTools" :title="false">-->
<!-- </uv-skeleton>-->
<!-- <uv-gap height="16"></uv-gap>-->
<!-- </uni-card>-->
<!-- <uni-card :border="false" :padding="'18px 6px'">-->
<!-- <uv-skeleton rows="3" avatar :loading="hideTools" :title="false">-->
<!-- </uv-skeleton>-->
<!-- <uv-gap height="16"></uv-gap>-->
<!-- </uni-card>-->
<!-- </block>-->
<!-- <block v-if="orderList.length === 0 && loadMore != 'no-more'">-->
<!-- <uni-card :border="false" :padding="'18px 6px'">-->
<!-- <uv-skeleton rows="3" avatar :loading="hideTools" :title="false">-->
<!-- </uv-skeleton>-->
<!-- <uv-gap height="16"></uv-gap>-->
<!-- </uni-card>-->
<!-- <uni-card :border="false" :padding="'18px 6px'">-->
<!-- <uv-skeleton rows="3" avatar :loading="hideTools" :title="false">-->
<!-- </uv-skeleton>-->
<!-- <uv-gap height="16"></uv-gap>-->
<!-- </uni-card>-->
<!-- <uni-card :border="false" :padding="'18px 6px'">-->
<!-- <uv-skeleton rows="3" avatar :loading="hideTools" :title="false">-->
<!-- </uv-skeleton>-->
<!-- <uv-gap height="16"></uv-gap>-->
<!-- </uni-card>-->
<!-- <uni-card :border="false" :padding="'18px 6px'">-->
<!-- <uv-skeleton rows="3" avatar :loading="hideTools" :title="false">-->
<!-- </uv-skeleton>-->
<!-- <uv-gap height="16"></uv-gap>-->
<!-- </uni-card>-->
<!-- </block>-->
<uv-empty :show="orderList.length === 0" mode="order" class="none"
icon="https://cdn.uviewui.com/uview/empty/car.png"></uv-empty>
<uni-load-more v-if="orderList.length > 0" :status="loadMore"></uni-load-more>
<!-- 登录组件 -->
<ws-login ref="login" :logo="logo" @done="reload"/>
</view>
<uv-picker ref="orderTypePicker" :columns="[orderTypeList]" keyName="label" @confirm="confirmOrderType"/>
<uv-picker ref="orderStatusPicker" :columns="[orderStatusList]" keyName="label" @confirm="confirmOrderStatus"/>
</view>
</template>
@@ -108,6 +148,9 @@ import {
getWeek,
getKey
} from '@/utils/common';
import {pageThinkOrder, thinkOrderRepay} from "@/api/think/thinkOrder";
import {pageThinkUsersVip, thinkUsersVipRepay, updateThinkUsersVip} from "@/api/think/thinkUsersVip";
import {pageThinkDeposit} from "@/api/think/thinkDeposit";
export default {
components: {},
@@ -142,17 +185,45 @@ export default {
styleType: 'text',
getWeek,
// 骨架屏
hideTools: true
hideTools: true,
orderTypeStr: '订场订单',
orderType: 0,
orderTypeList: [
{
label: '订场订单',
value: 0
},
{
label: '会员卡订单',
value: 1
},
{
label: '押金',
value: 2
},
],
orderStatusList: [
{
label: '未支付',
value: 2
},
{
label: '已支付',
value: 1
}
],
orderStatusStr: '全部状态',
orderStatus: null,
}
},
async onLoad(option) {
this.userId = await uni.getStorageSync('user_id')
// 加载数据
await this.reload()
// if(option.isRefresh){
// this.isRefresh = true
// }
},
// async onLoad(option) {
// this.userId = await uni.getStorageSync('user_id')
// // 加载数据
// await this.reload()
// // if(option.isRefresh){
// // this.isRefresh = true
// // }
// },
async onShow(e) {
this.userId = await uni.getStorageSync('user_id')
await this.reload()
@@ -163,60 +234,72 @@ export default {
const {
where
} = this
console.log(app.canReset)
if (app.canReset) {
app.where.page = ++where.page;
app.reload()
app.where.page += 1;
app.getOrderList()
}
},
methods: {
async reload() {
const app = this
const { where } = this
const uid = uni.getStorageSync('uid')
if (!uid) {
app.orderList = [];
app.loadMore = 'no-more'
return;
openOrderTypePicker() {
this.$refs.orderTypePicker.open()
},
openOrderStatusPicker() {
this.$refs.orderStatusPicker.open()
},
confirmOrderType({value}) {
this.orderType = value[0].value
this.orderTypeStr = value[0].label
this.reload()
},
confirmOrderStatus({value}) {
if (this.orderType === 0) {
this.where.payStatus = value[0].value
} else if (this.orderType === 1) {
this.where.status = value[0].value
} else if (this.orderType === 2) {
this.where.status = value[0].value
}
this.orderStatus = value[0].value
this.orderStatusStr = value[0].label
this.reload()
},
async reload() {
this.loadMore = 'loading'
this.where.page = 1
this.orderList = []
this.$refs.orderTypePicker.close()
await this.getOrderList()
},
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.orderList.length < res.count) {
this.orderList = this.orderList.concat(res.list)
this.canReset = true
this.loadMore = 'no-more'
} else {
this.canReset = false;
this.loadMore = 'no-more'
}
where.uid = uid;
app.loadMore = 'loading'
OrderApi.pageThinkOrder(where).then(res => {
const list = res.list.map(d => {
return d;
});
if (app.orderList.length < res.count) {
app.orderList = app.orderList.concat(list)
app.canReset = true
app.loadMore = 'no-more'
} else {
app.canReset = false;
app.loadMore = 'no-more'
}
uni.hideLoading()
app.isRefresh = false
}).catch(() => {
uni.showToast({
title: '请检查您的网络.',
icon: 'none'
})
uni.hideLoading()
app.isRefresh = false
})
},
async onClickItem(e) {
const app = this
this.uid = await uni.getStorageSync('uid')
// this.uid = await uni.getStorageSync('uid')
const {
where,
uid
// uid
} = this
if (app.uid === 0 || !app.uid) {
console.log(app.uid,'>>>>>>>2',app.uid)
app.orderList = [];
app.loadMore = 'no-more'
return;
}
// if (app.uid === 0 || !app.uid) {
// console.log(app.uid, '>>>>>>>2', app.uid)
// app.orderList = [];
// app.loadMore = 'no-more'
// return;
// }
const index = e.currentIndex
if (this.current !== e.currentIndex) {
@@ -243,18 +326,18 @@ export default {
where.orderStatus = 1;
}
// 押金
if (index === 4) {
pageThinkWechatDeposit({
uid: uni.getStorageSync('user_id')
}).then(res => {
app.orderList = res.list;
if (res.count === 0) {
app.loadMore = 'no-more'
}
uni.hideLoading()
})
return false
}
// if (index === 4) {
// pageThinkWechatDeposit({
// uid: uni.getStorageSync('user_id')
// }).then(res => {
// app.orderList = res.list;
// if (res.count === 0) {
// app.loadMore = 'no-more'
// }
// uni.hideLoading()
// })
// return false
// }
this.where.page = 1;
this.orderList = [];
this.reload()
@@ -312,6 +395,82 @@ export default {
uni.navigateTo({
url: `/package/user/invoice-show?id=${id}`
})
},
async closeVipOrder({id}) {
await updateThinkUsersVip({id, status: 0})
await uni.showToast({
title: '取消成功',
icon: 'none'
})
await this.reload()
},
toDetail(id) {
let url
if (this.orderType === 0) url = `/package/order/detail?id=${id}`
else if (this.orderType === 1) url = `/package/order/vipDetail?id=${id}`
else if (this.orderType === 2) url = `/package/order/detail?id=${id}`
uni.navigateTo({url})
},
async openPay(id) {
const orderInfo = await thinkUsersVipRepay({id})
const _this = this
uni.requestPayment({
provider: orderInfo.provider, // 服务提供商
timeStamp: orderInfo.timeStamp, // 时间戳
nonceStr: orderInfo.nonceStr, // 随机字符串
package: orderInfo.package,
signType: orderInfo.signType, // 签名算法
paySign: orderInfo.paySign, // 签名
success: function (res) {
// 业务逻辑。。。
uni.showToast({
title: '支付成功',
icon: 'success'
});
setTimeout(function () {
_this.reload()
}, 1500);
},
fail: function (err) {
console.log('支付失败', err);
}
})
},
async openPayOrder(id) {
const orderInfo = await thinkOrderRepay({id})
const _this = this
uni.requestPayment({
provider: orderInfo.provider, // 服务提供商
timeStamp: orderInfo.timeStamp, // 时间戳
nonceStr: orderInfo.nonceStr, // 随机字符串
package: orderInfo.package,
signType: orderInfo.signType, // 签名算法
paySign: orderInfo.paySign, // 签名
success: function (res) {
// 业务逻辑。。。
uni.showToast({
title: '支付成功',
icon: 'success'
});
setTimeout(function () {
_this.reload()
}, 1500);
},
fail: function (err) {
console.log('支付失败', err);
}
})
},
reset(){
this.where = {
page: 1
}
this.orderList = []
this.orderType = 0
this.orderTypeStr = '订场订单'
this.orderStatus = null
this.orderStatusStr = '全部状态'
this.reload()
}
}
}