重构框架

This commit is contained in:
2024-08-14 06:39:28 +08:00
parent 24e63cf551
commit 10533eb67d
166 changed files with 11388 additions and 856 deletions
+36 -33
View File
@@ -14,17 +14,17 @@
<view class="merchant-avatar">
<uv-avatar :src="item.merchantAvatar" size="24"></uv-avatar>
</view>
<text class="merchant-name">{{ item.merchantName }}</text>
<text class="merchant-name">{{ item.siteName }}</text>
</view>
<block v-if="item.orderStatus == 2">
<block v-if="item.orderStatus === 3">
<text class="btn-status web-text-secondary">已取消</text>
</block>
<block v-else-if="item.orderStatus == 1">
<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">
<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>
@@ -34,10 +34,10 @@
<view class="order-body web-cell web-cell-align-top">
<view class="web-cell-content">
<uv-cell-group :customStyle="{backgroundColor: '#ffffff'}" :border="false">
<block v-for="(sub,subIndex) in item.orderInfo" :key="subIndex">
<uv-cell :title="`${sub.fieldName}`" :label="`${sub.comments}`"
<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.orderId}`)"/>
@click="openUrl(`/package/order/detail?id=${item.id}`)"/>
</block>
</uv-cell-group>
<view class="total-price">
@@ -49,9 +49,9 @@
</view>
</view>
<view slot="actions" class="card-actions">
<view class="card-actions-item" v-if="item.payStatus == 0 && item.orderStatus == 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;">取消订单
style="margin-right: 20rpx;">{{ item.payStatus }}取消订单{{item.orderStatus}}
</button>
<button class="mini-btn" type="primary" size="mini"
@click="toPay(item.orderId)">去支付
@@ -89,7 +89,7 @@
<!-- <uv-gap height="16"></uv-gap>-->
<!-- </uni-card>-->
<!-- </block>-->
<uv-empty :show="orderList.length === 0 && loadMore !== 'no-more'" mode="order" class="none"
<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>
<!-- 登录组件 -->
@@ -100,10 +100,10 @@
</template>
<script>
import * as OrderApi from '@/api/shop/order'
import * as OrderApi from '@/api/think/thinkOrder'
import {
pageWechatDeposit
} from '@/api/shop/wechatDeposit'
pageThinkWechatDeposit
} from '@/api/think/thinkWechatDeposit'
import {
getWeek,
getKey
@@ -117,9 +117,8 @@ export default {
isLogin: false,
userId: 0,
where: {
page: 1,
type: 1, // 0商城订单 1场地预定
sceneType: 'showOrderInfo' // 查询订单附加场地信息
page: 1
// sceneType: 'showOrderInfo' // 查询订单附加场地信息
},
canReset: false,
loadMore: 'more',
@@ -146,15 +145,17 @@ export default {
hideTools: true
}
},
onLoad(option) {
async onLoad(option) {
this.userId = await uni.getStorageSync('user_id')
// 加载数据
this.reload()
await this.reload()
// if(option.isRefresh){
// this.isRefresh = true
// }
},
onShow(e) {
this.reload()
async onShow(e) {
this.userId = await uni.getStorageSync('user_id')
await this.reload()
},
// 触底函数
onReachBottom() {
@@ -171,16 +172,15 @@ export default {
async reload() {
const app = this
const { where } = this
app.userId = await uni.getStorageSync('user_id')
if (app.userId === 0 || app.userId === undefined) {
const uid = uni.getStorageSync('uid')
if (!uid) {
app.orderList = [];
app.loadMore = 'no-more'
return;
}
where.userId = app.userId;
where.uid = uid;
app.loadMore = 'loading'
OrderApi.pageOrder(where).then(res => {
OrderApi.pageThinkOrder(where).then(res => {
const list = res.list.map(d => {
return d;
});
@@ -203,14 +203,16 @@ export default {
app.isRefresh = false
})
},
onClickItem(e) {
async onClickItem(e) {
const app = this
this.uid = await uni.getStorageSync('uid')
const {
where,
userId
uid
} = this
if (userId === 0) {
if (app.uid === 0 || !app.uid) {
console.log(app.uid,'>>>>>>>2',app.uid)
app.orderList = [];
app.loadMore = 'no-more'
return;
@@ -227,12 +229,13 @@ export default {
}
// 未支付
if (index === 1) {
where.payStatus = 0;
where.payStatus = 2;
where.orderStatus = undefined;
}
// 已支付
if (index === 2) {
where.payStatus = 1;
where.orderStatus = undefined;
}
// 已完成
if (index === 3) {
@@ -241,11 +244,11 @@ export default {
}
// 押金
if (index === 4) {
pageWechatDeposit({
pageThinkWechatDeposit({
uid: uni.getStorageSync('user_id')
}).then(res => {
app.orderList = res.list;
if (res.count == 0) {
if (res.count === 0) {
app.loadMore = 'no-more'
}
uni.hideLoading()
@@ -293,7 +296,7 @@ export default {
},
// 弹出登录提示框
async openLogin() {
this.userId = uni.getStorageSync('user_id');
const userId = uni.getStorageSync('user_id');
if (!this.userId) {
this.$refs.login.open('bottom')
return false;