拆分admin分包,修复会员卡支付bug

This commit is contained in:
2024-07-16 00:14:30 +08:00
parent f3c18408d3
commit 8d682fbe81
13 changed files with 475 additions and 434 deletions
-17
View File
@@ -1,17 +0,0 @@
<script setup lang="ts">
</script>
<template>
<uni-card title="游泳馆" :border="false" :is-shadow="false">
<view class="flex justify-between">
<text>今日销量 0</text>
<text>今日出售 0</text>
<text>今日退票 0</text>
</view>
</uni-card>
</template>
<style scoped lang="scss">
</style>
-748
View File
@@ -1,748 +0,0 @@
<template>
<view class="container">
<!-- <ws-select-merchant :merchantList="merchantList" :merchantId="merchantId" @done="reload" />-->
<uv-tabs
:list="next7day"
:itemStyle="{ height: '58px' }"
:activeStyle="{ color: '#2ba91c' }"
lineColor="#2ba91c"
:inactiveStyle="{ color: '#808080' }"
@change="onDateTime"
></uv-tabs>
<view class="uni-padding-wrap uni-common-mt relative">
<uni-segmented-control :current="current" :values="items" activeColor="#2ba91c" inActiveColor="#ff0000" @clickItem="onType" />
</view>
<uni-data-select :clear="false" style="background-color: #fff; width: 330rpx; position: absolute; right: 16rpx; top: 120rpx;" v-model="value" :localdata="merchantList" @change="change"></uni-data-select>
<!-- 状态说明 -->
<view class="uni-badge-wrap">
<view class="badge-item">
<uv-badge :isDot="true" type="blank"></uv-badge>
<text class="web-text-secondary">可预约</text>
</view>
<view class="badge-item">
<uv-badge :isDot="true" type="info"></uv-badge>
<text class="web-text-secondary">已出售</text>
</view>
<view class="badge-item">
<uv-badge :isDot="true" type="success"></uv-badge>
<text class="web-text-secondary">我的选择</text>
</view>
<view class="badge-item">
<uv-badge :isDot="true" type="warning"></uv-badge>
<text class="web-text-secondary">已预定半场</text>
</view>
</view>
<!-- 场地列表 -->
<!-- <uv-empty mode="data" v-if="periodList.length == 0"
icon="https://cdn.uviewui.com/uview/empty/data.png"></uv-empty> -->
<view class="checkout-body web-text-primary" v-if="periodList.length > 0">
<template v-for="(item, index) in periodList" :key="index">
<view class="period-item">
<view class="period">{{ item.timePeriod }}</view>
<view class="field-list">
<template v-for="(field, index2) in item.fieldList" :key="index2">
<view class="field" :class="isActive(field)" @click="onField(field, item)">
<text class="field-name">{{ field.fieldName }}</text>
<text class="price">{{ item.price }}元</text>
</view>
</template>
</view>
</view>
</template>
<!-- 排版样式备份 -->
<view class="period-item" style="display: none">
<view class="period">18:00 - 20:00</view>
<view class="field-list">
<view class="field web-bg-info">
<text class="field-name">1号场地</text>
<text class="price">580元</text>
</view>
<view class="field web-bg-success active">
<text class="field-name">2号场地</text>
<text class="price">580元</text>
</view>
<view class="field web-bg-warning">
<text class="field-name">3号场地</text>
<text class="price">580元</text>
</view>
</view>
</view>
</view>
</view>
<!-- 支付按钮 -->
<uv-gap height="50"></uv-gap>
<view class="checkout-car" style="display: none">
<view class="car-selected" @click="openCarInfo">
<uv-icon name="shopping-cart" size="36" color="#ffffff"></uv-icon>
<uv-badge type="error" max="99" :value="carNum"></uv-badge>
</view>
<view class="car-total">
<text style="color: #ebcf00">¥</text>
<uv-count-to :startVal="0" decimals="2" duration="100" color="#ebcf00" bold :endVal="totalPrice"></uv-count-to>
</view>
<uv-button
class="save-btn"
:disabled="orderInfo.length == 0"
:customStyle="{ background: 'linear-gradient(to right, #70b915, #008e04)', borderRadius: '0 30px 30px 0', color: '#ffffff', border: 'none', padding: '22px 30px' }"
text="下一步"
@click="save"
></uv-button>
</view>
<!-- 展示购物车 -->
<uni-popup ref="popup" style="margin-bottom: 200px">
<uni-card :title="`购物车`" extra="关闭" :border="false" :is-shadow="false" :padding="0" @click="closeCarInfo">
<uv-cell-group :customStyle="{ backgroundColor: '#ffffff' }" :border="false">
<block v-for="(item, index) in orderInfo" :key="index">
<uv-cell :title="`${item.fieldName} ¥${item.price}`" :label="`${item.dateTime}`" :cellStyle="{ padding: '10px 5px' }">
<template v-slot:right-icon>
<uni-icons type="trash" size="20" color="#f76b4e" @click="remove(item)"></uni-icons>
<text class="web-text-secondary" style="font-size: 24rpx" @click="remove(item)">移除</text>
</template>
</uv-cell>
</block>
</uv-cell-group>
</uni-card>
<uv-gap height="70"></uv-gap>
</uni-popup>
<!-- 登录组件 -->
<ws-login ref="login" :logo="logo" @done="reload" />
</template>
<script>
import * as Api from '@/api/layout';
import * as MerchantApi from '@/api/shop/merchant';
import * as FieldApi from '@/api/booking/field';
import * as PeriodApi from '@/api/booking/period';
import { storeToRefs } from 'pinia';
import { useCarStore } from '@/store/modules/car';
import { getWeek, getKey } from '@/utils/common';
const carStore = useCarStore();
const { orderInfo, totalPrice, carNum, merchant, type, dateTime, childrenPrice } = storeToRefs(carStore);
const value = uni.getStorageSync('currentId')
export default {
data() {
return {
// 场馆ID
merchantId: 0,
// 场馆信息
merchant,
// 未来7天
next7day: [],
// 预定信息
orderInfo,
// 订单总金额
totalPrice,
// 儿童票价
childrenPrice,
// 预定日期
dateTime: null,
merchantList: [],
currentId: 0,
// 0全场 1半场
type: 0,
// 星期几
week: 0,
// 是否可以预定半场
isHalf: 0,
// 服务器时间
serverTime: {},
items: ['全场', '半场'],
// 搜索条件
where: {},
// 时段
periodList: [],
// 场地
fieldList: [],
// 选中的场地
selection: [],
// 是否已登录
isLogin: false,
// 是否同意协议
disabled: false,
// 购物车信息
showCarInfo: false,
value
};
},
onLoad() {
this.reload();
},
onShow() {
// 登录状态
if (uni.getStorageSync('user_id') && uni.getStorageSync('access_token')) {
this.isLogin = true;
}
},
computed: {
totalPrice() {
const app = this;
let totalPrice = 0;
app.selection.map((d) => {
totalPrice = totalPrice + d.price;
});
carStore.totalPrice = totalPrice;
console.log('totalPrice: ', totalPrice);
return totalPrice;
},
carNum() {
return this.selection.length;
}
},
methods: {
async reload() {
const app = this;
await app.getMerchantList()
// 请求数据
uni.showLoading({
title: '数据读取中.'
});
Promise.all([app.getServerTime(), app.getNext7day(), app.getMerchant()])
.then((res) => {
const serverTime = res[0];
const next7day = res[1];
const merchant = res[2];
app.serverTime = serverTime;
app.next7day = next7day;
app.merchant = merchant;
// 修改标题
uni.setNavigationBarTitle({
title: merchant.merchantName
});
// 保存场馆信息
carStore.setMerchant(merchant);
// 加载预定日期
app.next7day = next7day.map((d, i) => {
if (!app.dateTime && i == 0) {
app.dateTime = d.dateTime;
app.week = d.week;
carStore.dateTime = d.dateTime;
}
d.name = getWeek(d.week);
d.value = d.date;
return d;
});
// 加载时段列表
app.getBookingPeriod();
// 加载场地列表
// app.getBookingField();
// 关闭加载状态
})
.catch(() => {
uni.showToast({
title: '请检查您的网络.',
icon: 'none'
});
uni.hideLoading();
});
},
back() {
uni.navigateBack();
},
goBack() {
return uni.navigateTo({
url: '/package/admin/index'
});
},
getMerchantList() {
// 可管理的场馆
this.merchantList = uni.getStorageSync('merchantList')
if(this.merchantList.length > 0){
this.merchantId = this.merchantList[0].value
}
if(uni.getStorageSync('currentId')){
this.merchantId = uni.getStorageSync('currentId')
}
},
onDisabled() {
this.disabled = !this.disabled;
},
onDateTime(e) {
console.log('e: ', e);
const { serverTime } = this;
this.week = e.week;
this.dateTime = e.dateTime;
carStore.dateTime = e.dateTime;
carStore.orderInfo = [];
this.selection = [];
this.reload();
},
onType(e) {
const index = e.currentIndex;
if (index == 0) {
this.type = 0;
this.isHalf = 0;
}
if (index == 1) {
this.type = 1;
this.isHalf = 1;
}
this.reload();
},
getMerchant() {
return new Promise((resolve, reject) => {
MerchantApi.getMerchant(this.merchantId)
.then((result) => {
resolve(result);
})
.catch(reject);
});
},
getServerTime() {
return new Promise((resolve, reject) => {
Api.getServerTime()
.then((result) => {
resolve(result);
})
.catch(reject);
});
},
getNext7day() {
return new Promise((resolve, reject) => {
Api.getNext7day()
.then((result) => {
resolve(result);
})
.catch(reject);
});
},
// getBookingField() {
// FieldApi.listField({
// merchantId: this.merchantId,
// isStatus: 1,
// isHalf: this.isHalf,
// dateTime: `${this.dateTime}`
// }).then(list => {
// this.fieldList = list;
// })
// },
getBookingPeriod() {
const { serverTime } = this;
const now = new Date();
const hours = now.getHours();
const minutes = now.getMinutes();
// const startTime = serverTime.today == this.dateTime ? String(hours) + String(minutes) : undefined;
const week = this.week === 0 ? 7 : this.week;
PeriodApi.listPeriod({
merchantId: this.merchantId,
isStatus: 0,
week,
dateTime: `${this.dateTime}`,
half: this.isHalf,
admin: true
})
.then((list) => {
this.periodList = list;
uni.hideLoading();
})
.catch((err) => {
this.periodList = [];
uni.showToast({
title: err.message,
icon: 'none'
});
uni.hideLoading();
// if (err.message === '您还有未支付订单,请先支付') {
// setTimeout(() => {
// return uni.switchTab({
// url: '/pages/order/order'
// });
// }, 1000);
// }
});
},
callPhone(phone) {
uni.makePhoneCall({
phoneNumber: phone
});
},
change(index) {
console.log('index>>: ',index);
uni.setStorageSync('currentId', index);
this.reload()
},
openCarInfo() {
// this.showCarInfo = !this.showCarInfo;
// 通过组件定义的ref调用uni-popup方法 ,如果传入参数 ,type 属性将失效 ,仅支持 ['top','left','bottom','right','center']
this.$refs.popup.open('bottom');
},
closeCarInfo() {
this.$refs.popup.close();
},
onMap() {
uni.getLocation({
type: 'gcj02', //返回可以用于uni.openLocation的经纬度
success: function (res) {
console.log('返回可以用于uni.openLocation的经纬度: ', res);
const latitude = this.merchant.latitude;
const longitude = this.merchant.longitude;
uni.openLocation({
latitude: latitude,
longitude: longitude,
success: function () {
console.log('success');
}
});
}
});
},
onField(item, period) {
// 已被预定
if (item.sold) {
uni.navigateTo({url: `/package/admin/order-detail?id=${item.orderInfoList[0].orderId}`})
return;
}
const app = this;
const { merchant } = this;
// 时段
// const p = this.periodList[i]
// 场地
// const f = this.fieldList[i2]
const key = getKey(`${this.dateTime}${item.timePeriod}${this.merchantId}${item.fieldId}`);
const index = app.selection.findIndex((d) => d.key === key);
if (index >= 0) {
app.selection.splice(index, 1);
} else {
if (app.selection.length > 1) {
uni.showToast({
title: '最多预定两个场地!',
icon: 'none'
});
return false;
}
// 计算订单总金额
// let totalPrice = 0
// app.selection.map(d => {
// console.log(d);
// totalPrice = totalPrice + d.totalPrice
// })
const split = item.timePeriod.split('-');
// console.log('aaaaaaaaa',{
// key,
// merchantId: this.merchantId,
// merchantCode: this.merchantCode,
// fieldId: item.fieldId,
// fieldName: item.fieldName,
// price: item.price,
// merchantName: this.merchantName,
// isChildren: item.isChildren,
// isHalf: this.type,
// timePeriod: item.timePeriod,
// periodId: item.periodId,
// startTime: `${split[0].trim()}:00`,
// endTime: `${split[1].trim()}:00`,
// orderCode: key,
// dateTime: `${this.dateTime}`,
// comments: `${this.dateTime} (${getWeek(this.week)}) ${item.timePeriod}`,
// });
// 添加到购物车
app.selection.push({
key,
merchantId: this.merchantId,
merchantCode: merchant.merchantCode,
fieldId: item.fieldId,
fieldName: item.fieldName,
price: item.price,
childrenPrice: period.childrenPrice,
adultNum: 1,
childrenNum: 0,
merchantName: merchant.merchantName,
isChildren: item.isChildren,
isHalf: this.type,
timePeriod: item.timePeriod,
periodId: item.periodId,
startTime: `${split[0].trim()}:00`,
endTime: `${split[1].trim()}:00`,
orderCode: key,
dateTime: `${this.dateTime}`,
comments: `${this.dateTime} (${getWeek(this.week)}) ${item.timePeriod}`
});
console.log(app.selection);
console.log('period: ', period);
// 是否支持儿童票
console.log('item.isChildren: ', item.isChildren);
if (item.isChildren === 1) {
console.log('item.isChildren2: ', item.isChildren);
carStore.childrenPrice = period.childrenPrice;
} else {
carStore.childrenPrice = 0;
}
carStore.orderInfo = app.selection;
carStore.carNum = app.selection.length;
carStore.totalPrice = totalPrice;
carStore.payPrice = totalPrice;
carStore.setPeriod(period);
}
},
getStratTime(value) {
const split = value.split('-');
const timeText = split[0].replace(' ', '');
const startTime = new Date(`${this.dateTime} ${timeText}:00`).getTime();
return startTime / 1000 || 0;
},
isActive(item) {
const index = this.selection.find((d) => d.key === getKey(`${this.dateTime}${item.timePeriod}${this.merchantId}${item.fieldId}`));
if (item.sold) {
if (item.isHalf === 1) {
return 'web-bg-warning';
}
return 'web-bg-info';
}
if (index) {
return 'active web-bg-success';
}
},
// isActive(text,item) {
// const index = this.selection.find(d => d.key == getKey(text))
// if(item.sold){
// if(item.isHalf == 1){
// return 'web-bg-warning'
// }
// return 'web-bg-info'
// }
// if (index) {
// return 'active web-bg-success'
// }
// },
remove(item) {
const index = this.selection.findIndex((d) => d.key === item.key);
this.selection.splice(index, 1);
carStore.orderInfo = this.selection;
},
save() {
const { selection } = this;
uni.$uv.route({
url: '/package/booking/confirm'
});
}
}
};
</script>
<style>
page {
background-size: 100%;
background-repeat: no-repeat;
background-color: #f0f2f5;
width: 750rpx;
overflow-x: hidden;
}
</style>
<style lang="scss" scoped>
.container {
}
.checkout-car {
width: 700rpx;
left: 25rpx;
position: fixed;
bottom: 30rpx;
display: flex;
justify-content: space-between;
background-color: #000000;
border-radius: 100px;
align-items: center;
.car-selected {
color: #ccc;
display: flex;
align-items: center;
padding: 0 20rpx;
position: relative;
}
.car-total {
display: flex;
color: #ebcf00;
align-items: center;
.save-btn {
}
}
}
.popup-car-info {
margin-bottom: 100px;
padding: 20rpx;
background-color: #ffffff;
width: 660rpx;
margin: 150rpx auto;
}
.uni-padding-wrap {
width: 180rpx;
margin: 20rpx;
}
.uni-badge-wrap {
display: flex;
justify-content: space-around;
.badge-item {
display: flex;
justify-content: center;
align-items: center;
font-size: 28rpx;
text {
padding: 2rpx;
}
.web-text-secondary {
padding-left: 8rpx;
}
}
}
.checkout-body {
padding: 24rpx;
.period-item {
margin: 12rpx 0;
.period {
line-height: 2rem;
padding-left: 12rpx;
font-size: 28rpx;
}
.field-list {
display: flex;
flex-wrap: wrap;
.web-bg-info {
background-color: #909399 !important;
color: #ffffff !important;
}
.web-bg-success {
color: #2ba91c !important;
border: 1px solid #2ba91c !important;
}
.web-bg-warning {
// background-color: #c9e294 !important;
}
.active {
&:before {
border-radius: 0 0 12rpx 0;
content: '';
position: absolute;
right: 0;
bottom: 0;
border: 24rpx solid #2ba91c;
border-top-color: transparent;
border-left-color: transparent;
}
&:after {
content: '';
width: 5px;
height: 10px;
position: absolute;
right: 3px;
bottom: 4px;
border: 1px solid #fff;
border-top-color: transparent;
border-left-color: transparent;
transform: rotate(45deg);
border-radius: 4rpx;
}
}
.field {
width: 118rpx;
height: 118rpx;
margin: 9rpx;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
border-radius: 16rpx;
line-height: 1rem;
position: relative;
color: #333333;
background-color: #ffffff;
border: 1px solid #808080;
.field-name {
font-size: 23rpx;
}
.price {
font-size: 25rpx;
}
}
}
}
}
.xieyi {
margin: 30rpx auto;
padding: 20rpx 30rpx;
.text {
margin-left: 5rpx;
.link {
color: #0f80ff;
}
}
}
$nav-height: 30px;
.box-bg {
background-color: #f5f5f5;
padding: 5px 0;
}
.city {
/* #ifndef APP-PLUS-NVUE */
display: flex;
/* #endif */
flex-direction: row;
align-items: center;
justify-content: flex-start;
// width: 160rpx;
margin-left: 4px;
}
.input-view {
/* #ifndef APP-PLUS-NVUE */
display: flex;
/* #endif */
flex-direction: row;
// width: 500rpx;
flex: 1;
background-color: #f8f8f8;
height: $nav-height;
border-radius: 15px;
padding: 0 15px;
flex-wrap: nowrap;
margin: 7px 0;
line-height: $nav-height;
}
.input-uni-icon {
line-height: $nav-height;
}
.nav-bar-input {
height: $nav-height;
line-height: $nav-height;
/* #ifdef APP-PLUS-NVUE */
width: 370rpx;
/* #endif */
padding: 0 5px;
font-size: 12px;
background-color: #f8f8f8;
}
</style>
-280
View File
@@ -1,280 +0,0 @@
<template>
<view class="page">
<uv-gap height="20"></uv-gap>
<!-- <uni-nav-bar dark :fixed="true" shadow background-color="#2ba91c" status-bar left-icon="left" left-text="返回" title="场地管理" @clickLeft="goBack" /> -->
<!-- 顶部距离 -->
<!-- <view class="header" :style="'margin-top: ' + statusBarHeight + 'px'"></view> -->
<!-- 用户信息 -->
<ws-admin-card :merchantList="merchantList" :merchantId="merchantId" :data="userInfo" :is-login="isLogin" @openLogin="openLogin" />
<block v-if="hideTools">
<uni-card :border="false" :padding="'18px 8px'">
<uv-skeleton rows="2" :loading="hideTools" :title="false"></uv-skeleton>
</uni-card>
<uni-card :border="false" :padding="'18px 8px'">
<uv-skeleton rows="9" :loading="hideTools" :title="false"></uv-skeleton>
</uni-card>
</block>
<block v-else>
<!-- 收藏|关注|足迹|作品 -->
<!-- <ws-user-collect></ws-user-collect> -->
<!-- 我的订单 -->
<!-- <ws-user-order :order="order" :is-login="isLogin" @done="openLogin"></ws-user-order> -->
<!-- 其他功能 -->
<uni-card :border="false" :padding="0">
<!-- 场馆管理可见-->
<block v-if="hasMerchantRole || hasMerchantClerkRole">
<view class="server" style="min-height: 200px">
<uni-list :border="false">
<block v-for="(item, index) in server" :key="index">
<uni-list-item :thumb="item.icon" link @click="navTo(item)">
<template v-slot:body>
<view class="slot-box">
<text class="slot-text" :style="{ color: item.color ? item.color : '#333333' }">{{ item.title }}</text>
</view>
</template>
</uni-list-item>
</block>
</uni-list>
</view>
</block>
</uni-card>
<!-- <view class="debug">
<view>条码类型: {{ scanType }}</view>
<view>条码内容: {{ scanResult }}</view>
</view> -->
<!-- 登录组件 -->
<ws-login ref="login" :logo="logo" @done="reload" />
<!-- 返回 -->
<view class="logout" @click="goBack">
<view size="20" class="btn">返回</view>
</view>
</block>
</view>
</template>
<script>
import { useUserStore } from '@/store/modules/user';
import * as UserApi from '@/api/booking/users';
import * as MpMenuApi from '@/api/cms/mp-menu/index';
import * as MerchantApi from '@/api/shop/merchant';
import { updateUsers } from '@/api/shop/users';
import { openUrl } from '@/utils/common';
import { getWxOpenId } from '@/api/passport/login';
import { useTenantStore } from '@/store/modules/tenant';
const tenantStore = useTenantStore();
const userStore = useUserStore();
export default {
data() {
return {
orderNo: undefined,
statusBarHeight: 104,
isLogin: false,
userInfo: {},
currMerchant: {},
merchantId: null,
fields: {},
logo: '',
bookingUser: {},
server: [],
order: [],
hideUser: true,
hideTools: true,
// 是否拥有场馆管理员权限
hasMerchantRole: false,
// 是否拥有场馆职员权限
hasMerchantClerkRole: false,
// 是否拥有超级管理员权限
hasSuperAdminRole: false,
scanType: '',
scanResult: ''
};
},
onLoad(option) {
if (option.orderNo) {
this.orderNo = option.orderNo;
}
this.reload();
},
methods: {
async reload(e) {
const app = this;
// 获取系统信息
uni.getSystemInfo({
success(data) {
if (data) {
app.statusBarHeight = data.statusBarHeight;
}
}
});
// 当前租户信息
const tenantInfo = await tenantStore.fetchTenantInfo();
app.logo = tenantInfo.websiteLogo;
if (tenantInfo.fields) {
tenantInfo.fields.map((d) => {
const key = d.name;
app.fields[key] = d.value;
});
}
// 当前登录用户信息
const userInfo = await userStore.fetchUserInfo();
if (Object.keys(userInfo).length > 0) {
app.isLogin = true;
if (app.orderNo) {
return uni.redirectTo({
url: '/package/admin/order-scan?orderNo=' + app.orderNo
});
}
app.userInfo = userInfo;
uni.setStorageSync('user_id', app.userInfo.userId);
// 判断用户角色
app.hasMerchantRole = userInfo.roles.find((d) => d.roleCode === 'merchant');
app.hasMerchantClerkRole = userInfo.roles.find((d) => d.roleCode === 'merchantClerk');
app.hasSuperAdminRole = userInfo.roles.find((d) => d.roleCode === 'superAdmin');
// 可管理的场馆
MerchantApi.pageMerchant({ merchantIds: userInfo.merchants, limit: 50 }).then((res) => {
app.merchantList = res.list.map((d, i) => {
if (i === 0) {
app.currMerchant = d;
app.merchantId = d.merchantId;
}
return {
text: d.merchantName,
value: d.merchantId
};
});
uni.setStorageSync('merchantList',app.merchantList)
});
// 获取用户副表信息
UserApi.getByPhone({
phone: userInfo.phone
}).then((data) => {
if (data) {
app.hideUser = false;
app.userInfo.ouid = data.userId;
app.userInfo = Object.assign({}, app.userInfo, data);
}
});
} else {
app.isLogin = false;
app.userInfo = {};
}
// 菜单数据
MpMenuApi.pageMpMenu({ type: 4, limit: 100 })
.then((res) => {
app.order = res.list.filter((d) => d.rows === 0);
app.server = res.list.filter((d) => d.rows === 0);
app.hideTools = false;
})
.catch(() => {
uni.showToast({
title: '请检查您的网络.',
icon: 'none'
});
app.hideTools = false;
});
// #ifdef MP-WEIXIN
uni.login({
success: (res) => {
getWxOpenId({
code: res.code
}).then((response) => {
// console.log("response401: ", response);
// console.log('app.userInfo.openid: ', app.userInfo.openid);
if (!app.userInfo.openid) {
updateUsers({
userId: app.userInfo.ouid,
openid: response.openid,
sessionKey: response.session_key,
unionid: response.unionid
});
}
});
}
});
// #endif
},
navTo(item) {
const app = this;
if (!this.isLogin) {
this.$refs.login.open('bottom');
return false;
} else {
if (item.path === '/package/admin/order-scan') {
// uni.showModal({
// title: '直接使用微信扫一扫功能完成核销'
// });
// return false;
// 允许从相机和相册扫码
uni.scanCode({
success: function (res) {
app.scanType = res.scanType
app.scanResult = res.result
if(res.scanType){
// console.log('/package/admin/order-scan?orderNo=' + app.orderNo);
uni.redirectTo({
url: '/package/admin/order-scan?orderNo=' + app.orderNo
})
}
}
});
// return false;
} else {
openUrl(item);
}
}
},
// 弹出登录提示框
openLogin() {
if (!this.isLogin) {
this.$refs.login.open('bottom');
return false;
}
},
back() {
uni.navigateBack();
},
goBack() {
return uni.switchTab({
url: '/pages/user/user'
});
}
}
};
</script>
<style>
page {
/* background: url('https://oss.wsdns.cn/20240502/75fc744657544a38a32f83a825688286.png') no-repeat; */
background-size: 100%;
background-repeat: no-repeat;
background-color: #f0f2f5;
width: 750rpx;
overflow-x: hidden;
}
</style>
<style lang="scss">
.uni-section .uni-section-header{
padding: 5px 5px !important;
}
.logout {
width: 300rpx;
margin: 0 auto;
padding: 10rpx 0 20rpx 0;
.btn {
display: flex;
justify-content: center;
background-color: #fff;
border-radius: 30rpx;
padding: 12rpx 0;
color: $uni-text-color-placeholder;
}
}
</style>
-454
View File
@@ -1,454 +0,0 @@
<template>
<view class="order" v-if="form.orderId">
<uni-card title="预定信息" :border="false" :is-shadow="false" :padding="0">
<view class="order-body web-cell web-cell-align-top">
<view class="web-cell-content">
<uv-cell-group :customStyle="{ backgroundColor: '#ffffff' }" :border="false">
<uv-cell :title="`${form.merchantName}`" :label="` `" :cellStyle="{ padding: '0', paddingBottom: '5px' }"
:border="false"/>
<block v-for="(item, index) in form.orderInfo" :key="index">
<uv-cell
:title="`${item.fieldName}`"
:label="`${item.comments}`"
:cellStyle="{ padding: '0', paddingBottom: '5px' }"
:value="`¥${item.price}`"
:border="item.isChildren"
/>
<uv-cell :label="`成人票 ¥50`" :value="`x ${item.adultNum}`" v-if="item.isChildren"
:cellStyle="{ padding: '0', paddingBottom: '5px' }" :border="false"/>
<uv-cell :label="`儿童票 ¥35`" :value="`x ${item.childrenNum}`" v-if="item.isChildren"
:cellStyle="{ padding: '0', paddingBottom: '5px' }" :border="false"/>
</block>
</uv-cell-group>
</view>
</view>
<view slot="actions" class="card-actions">
<view class="web-text-heading">合计:¥{{ form.totalPrice }}</view>
<view class="web-text-danger">实付:¥{{ form.payPrice }}</view>
</view>
</uni-card>
<block v-if="form.orderNo">
<uni-card :border="false" :is-shadow="false" :padding="0">
<view class="web-cell web-cell-align-top">
<uv-cell-group :customStyle="{ backgroundColor: '#ffffff', padding: '8px 0' }" :border="false">
<uv-cell :title="`姓名`" :value="`${form.realName}`" :cellStyle="{ padding: '8px' }"/>
<uv-cell :title="`手机号码`" :value="`${form.phone}`" :cellStyle="{ padding: '8px' }"/>
<uv-cell :title="`订单号`" :value="`${form.orderId}`" :cellStyle="{ padding: '8px' }"/>
<uv-cell :title="`订单编号`" :cellStyle="{ padding: '8px' }">
<template v-slot:value>
<uv-parse :content="form.orderNo" :selectable="true"></uv-parse>
</template>
</uv-cell>
<uv-cell :title="`订单状态`" :cellStyle="{ padding: '8px' }">
<template v-slot:value>
<view v-if="form.payStatus == 0">
<!-- <uv-count-down :time="form.timestamp" format="mm:ss"></uv-count-down> -->
<span style="color: #ff0000">未支付</span>
</view>
<view v-else>{{ orderStatus[form.orderStatus] }}</view>
</template>
</uv-cell>
<uv-cell :title="`下单时间`" :value="`${form.createTime}`" :cellStyle="{ padding: '8px' }"/>
<uv-cell :title="`支付方式`" :value="`${payType[form.payType]}`" :cellStyle="{ padding: '8px' }"/>
<uv-cell :title="`优惠说明`" :value="`${form.couponDesc ? form.couponDesc : '无'}`"
:cellStyle="{ padding: '8px' }" :border="false"/>
</uv-cell-group>
</view>
</uni-card>
</block>
<uv-gap height="50"></uv-gap>
<view class="checkout-car">
<!-- <uv-button-->
<!-- text="取消订单"-->
<!-- ></uv-button>-->
<uv-button
text="更换场地"
@click="openPicker"
></uv-button>
<!-- <uv-button-->
<!-- text="同意退款"-->
<!-- ></uv-button>-->
<!-- <uv-button-->
<!-- text="不同意退款"-->
<!-- ></uv-button>-->
</view>
<uv-picker ref="picker" :columns="fieldList" keyName="label" @confirm="confirm"></uv-picker>
<!-- 登录组件 -->
<ws-login ref="login" :logo="logo" @done="reload"/>
</view>
</template>
<script>
import * as OrderApi from '@/api/shop/order';
import {pageWechatDeposit} from '@/api/shop/wechatDeposit';
import * as PeriodApi from "@/api/booking/period";
import * as FieldApi from "@/api/booking/field";
import * as Api from "@/api/layout";
export default {
components: {},
data() {
return {
isLogin: false,
orderId: 0,
userId: 0,
form: {},
where: {
page: 1
},
canReset: false,
loadMore: 'more',
logo: '',
items: ['全部订单', '未支付', '已支付', '已完成', '押金'],
orderStatus: ['未使用', '已完成', '已取消', '取消中', '退款申请中', '退款被拒绝', '退款成功', '客户端申请退款'],
payType: [
'余额支付',
'微信支付',
'会员卡支付',
'支付宝',
'现金',
'POS机',
'VIP月卡',
'VIP年卡',
'VIP次卡',
'IC月卡',
'IC年卡',
'IC次卡',
'免费',
'VIP充值卡',
'IC充值卡',
'积分支付',
'VIP季卡',
'IC季卡'
],
orderList: [],
styles: [
{
value: 'button',
text: '按钮',
checked: true
},
{
value: 'text',
text: '文字'
}
],
h5_url: '',
colors: ['#333333', '#4cd964', '#dd524d'],
current: 0,
colorIndex: 0,
activeColor: '#108001',
styleType: 'text',
fieldList: [],
// 服务器时间
serverTime: {},
dateTime: ''
};
},
async onLoad(option) {
this.orderId = option.id;
// 判断是否登录
await this.openLogin();
// 加载数据
await this.reload();
},
onShow() {
// 判断是否登录
this.openLogin();
},
// 触底函数
onReachBottom() {
const app = this;
const {where} = this;
if (app.canReset) {
app.where.page = ++where.page;
app.reload();
}
},
methods: {
async reload() {
const app = this;
const {where, userId, orderId} = this;
if (userId === 0) {
app.openLogin();
return;
}
where.userId = userId;
uni.showLoading({
title: '数据读取中.'
});
await OrderApi.getOrder(orderId).then((data) => {
console.log('data: ', data);
app.form = data;
if(data){
this.getServerTime()
}
// 页面标题
if (data.orderStatus == 1) {
uni.setNavigationBarTitle({
title: '订单详情(已完成)'
});
}
uni.hideLoading();
});
// H5版网址
const h5_url = uni.getStorageSync('h5_url');
const tid = uni.getStorageSync('TenantId');
if (h5_url) {
app.h5_url = h5_url;
} else {
app.h5_url = `http://${tid}.h5.wsdns.cn`;
}
},
async openPicker() {
this.getBookingEmptyField()
this.$refs.picker.open();
},
confirm(e) {
console.log('confirm', e.value[0]);
console.log(this.form.orderId);
},
getBookingEmptyField(dateTime) {
const app = this
const { serverTime,merchantId,isHalf } = this;
const now = new Date();
const hours = now.getHours();
const minutes = now.getMinutes();
const startTime = serverTime.today === dateTime ? String(hours) + String(minutes) : undefined;
const week = this.week === 0 ? 7 : this.week;
app.fieldList = []
FieldApi.listField({
merchantId,
isStatus: 0,
week,
dateTime,
startTime,
half: isHalf
})
.then((list) => {
const arr = list.map(d => {
return {
label: d.fieldName,
// 其他属性值
id: d.fieldId
}
});
app.fieldList.push(arr);
uni.hideLoading();
})
.catch((err) => {
app.fieldList = [];
uni.showToast({
title: err.message,
icon: 'none'
});
uni.hideLoading();
});
},
getServerTime() {
const app = this
Api.getServerTime()
.then((result) => {
app.serverTime = result
app.form.orderInfo.map((d,i) => {
if(i === 0){
app.dateTime = d.dateTime
app.merchantId = d.merchantId
}
})
console.log(app.merchantId)
console.log(app.dateTime)
})
.catch();
},
navTo(url) {
uni.navigateTo({
url
});
},
onClickItem(e) {
const app = this;
const {where, userId} = this;
const index = e.currentIndex;
if (this.current !== e.currentIndex) {
this.current = e.currentIndex;
}
if (userId == 0) {
app.openLogin();
return;
}
// 全部
if (index == 0) {
where.payStatus = undefined;
where.orderStatus = undefined;
}
// 未支付
if (index == 1) {
where.payStatus = 2;
}
// 已支付
if (index == 2) {
where.payStatus = 1;
}
// 已完成
if (index == 3) {
where.orderStatus = 1;
}
// 押金
if (index == 4) {
pageWechatDeposit({
uid: uni.getStorageSync('user_id')
}).then((res) => {
console.log('res: ', res);
app.orderList = res.list;
});
return false;
}
this.reload();
},
// 弹出登录提示框
async openLogin() {
this.userId = uni.getStorageSync('user_id');
if (!this.userId) {
this.$refs.login.open('bottom');
return false;
}
}
}
};
</script>
<style lang="scss">
.content {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
justify-content: center;
align-items: center;
height: 150px;
text-align: center;
}
.content-text {
font-size: 14px;
color: #666;
}
.color-tag {
width: 25px;
height: 25px;
}
.uni-list {
flex: 1;
}
.order {
.order-title {
padding: 20rpx 0;
border-bottom: 1px #eee solid;
.merchant-avatar {
margin-right: 12rpx;
}
.merchant-name {
// padding-left: 12rpx;
}
.btn-status {
font-size: 30rpx;
display: flex;
}
}
.order-body {
padding: 16px 0;
}
}
.ele-flex {
display: flex;
justify-content: space-between;
}
.card-actions {
display: flex;
flex-direction: row;
justify-content: space-between;
padding: 0 10px;
align-items: center;
height: 45px;
border-top: 1px #eee solid;
.web-text-heading {
font-size: 30rpx;
font-weight: 500;
}
.web-text-danger {
font-size: 30rpx;
font-weight: 500;
}
}
.card-actions-item {
display: flex;
flex-direction: row;
align-items: center;
}
.card-actions-item-text {
font-size: 12px;
color: #666;
margin-left: 5px;
}
.btn-status {
font-size: 30rpx;
display: flex;
}
.close {
top: 60rpx !important;
}
.qrcode {
margin-top: 30rpx;
text-align: center;
align-items: center;
display: flex;
flex-direction: column;
justify-content: center;
}
.checkout-car {
width: 700rpx;
left: 25rpx;
position: fixed;
bottom: 30rpx;
display: flex;
justify-content: space-around;
border-radius: 100px;
align-items: center;
.car-selected {
color: #ccc;
display: flex;
align-items: center;
padding: 0 20rpx;
}
.car-total {
display: flex;
color: #ebcf00;
align-items: center;
padding-left: 40rpx;
.save-btn {
}
}
}
</style>
-398
View File
@@ -1,398 +0,0 @@
<template>
<view class="order" v-if="isLogin">
orderNo: {{ orderNo }}
<uni-card title="预定信息" :border="false" :is-shadow="false" :padding="0">
<view class="order-body web-cell web-cell-align-top">
<view class="web-cell-content">
<uv-cell-group :customStyle="{ backgroundColor: '#ffffff' }" :border="false">
<uv-cell :title="`${form.merchantName}`" :label="` `" :cellStyle="{ padding: '0', paddingBottom: '5px' }" :border="false" />
<block v-for="(item, index) in form.orderInfo" :key="index">
<uv-cell
:title="`${item.fieldName}`"
:label="`${item.comments}`"
:cellStyle="{ padding: '0', paddingBottom: '5px' }"
:value="`¥${item.price}`"
:border="false"
/>
</block>
</uv-cell-group>
</view>
</view>
<view slot="actions" class="card-actions">
<view class="web-text-heading">合计:¥{{ form.totalPrice }}</view>
<view class="web-text-danger">实付:¥{{ form.payPrice }}</view>
</view>
</uni-card>
<block v-if="form.orderNo">
<uni-card :border="false" :is-shadow="false" :padding="0">
<view class="web-cell web-cell-align-top">
<uv-cell-group :customStyle="{ backgroundColor: '#ffffff', padding: '8px 0' }" :border="false">
<uv-cell :title="`姓名`" :value="`${form.realName}`" :cellStyle="{ padding: '8px' }" />
<uv-cell :title="`手机号码`" :value="`${form.phone}`" :cellStyle="{ padding: '8px' }" />
<uv-cell :title="`订单号`" :value="`${form.orderId}`" :cellStyle="{ padding: '8px' }" />
<uv-cell :title="`订单编号`" :cellStyle="{ padding: '8px' }">
<template v-slot:value>
<uv-parse :content="form.orderNo" :selectable="true"></uv-parse>
</template>
</uv-cell>
<uv-cell :title="`订单状态`" :cellStyle="{ padding: '8px' }">
<template v-slot:value>
<text class="web-text-primary" v-if="form.orderStatus == 0">{{ `${orderStatus[form.orderStatus]}` }}</text>
<text class="web-text-success" v-if="form.orderStatus == 1">{{ `${orderStatus[form.orderStatus]}` }}</text>
</template>
</uv-cell>
<uv-cell :title="`下单时间`" :value="`${form.createTime}`" :cellStyle="{ padding: '8px' }" />
<uv-cell :title="`支付方式`" :value="`${payType[form.payType]}`" :cellStyle="{ padding: '8px' }" />
<uv-cell :title="`优惠说明`" :value="`${form.couponDesc ? form.couponDesc : '无'}`" :cellStyle="{ padding: '8px' }" :border="false" />
</uv-cell-group>
</view>
</uni-card>
</block>
<uv-gap height="20"></uv-gap>
<view class="save-btn" v-if="form.orderStatus == 0">
<uv-button
:customStyle="{ background: 'linear-gradient(to right, #ccff66, #008e04)', borderRadius: '30px', color: '#ffffff' }"
text="确认核销"
@click="save"
></uv-button>
</view>
</view>
<view v-else>
<view class="login-bar">
<view class="login-btn">
<uv-button
:customStyle="{ background: 'linear-gradient(to right, #ccff66, #008e04)', borderRadius: '30px', color: '#ffffff' }"
text="请先登录"
@click="openLogin"
></uv-button>
</view>
</view>
<!-- 登录组件 -->
<ws-login ref="login" :logo="logo" @done="reload" />
</view>
</template>
<script>
import * as OrderApi from '@/api/shop/order';
import * as FieldApi from '@/api/booking/field';
import { pageWechatDeposit } from '@/api/shop/wechatDeposit';
import { useUserStore } from '@/store/modules/user';
const userStore = useUserStore();
export default {
components: {},
data() {
return {
isLogin: false,
orderNo: '',
userId: 0,
form: {},
where: {
page: 1
},
canReset: false,
loadMore: 'more',
logo: '',
items: ['全部订单', '未支付', '已支付', '已完成', '押金'],
orderStatus: ['未使用', '已完成', '已取消', '取消中', '退款申请中', '退款被拒绝', '退款成功', '客户端申请退款'],
payType: [
'余额支付',
'微信支付',
'会员卡支付',
'支付宝',
'现金',
'POS机',
'VIP月卡',
'VIP年卡',
'VIP次卡',
'IC月卡',
'IC年卡',
'IC次卡',
'免费',
'VIP充值卡',
'IC充值卡',
'积分支付',
'VIP季卡',
'IC季卡'
],
orderList: [],
styles: [
{
value: 'button',
text: '按钮',
checked: true
},
{
value: 'text',
text: '文字'
}
],
colors: ['#333333', '#4cd964', '#dd524d'],
current: 0,
colorIndex: 0,
activeColor: '#108001',
styleType: 'text'
};
},
onLoad(option) {
this.orderNo = option.orderNo;
this.logo = uni.getStorageSync('app_logo') ? uni.getStorageSync('app_logo') : 'https://oss.wsdns.cn/20240423/7f6878104a6d4427884721f412ab5441.png?x-oss-process=image/resize,m_fixed,w_100,h_100/quality,Q_90'
// 判断是否登录
// this.openLogin();
// 加载数据
this.reload();
},
onShow() {
// 判断是否登录
// this.openLogin();
},
// 触底函数
onReachBottom() {
const app = this;
const { where } = this;
if (app.canReset) {
app.where.page = ++where.page;
app.reload();
}
},
methods: {
async reload() {
const app = this;
// 当前登录用户信息
const userInfo = await userStore.fetchUserInfo();
if (Object.keys(userInfo).length > 0) {
app.isLogin = true
}
const { where, userId, orderNo } = this;
console.log('userId: ',userId);
where.userId = userId;
OrderApi.getByOrderNo(orderNo)
.then((data) => {
app.form = data;
// 页面标题
if (data.orderStatus == 1) {
uni.setNavigationBarTitle({
title: '订单核销'
});
}
uni.hideLoading();
})
.catch((err) => {
console.log('err: ', err);
app.form = {};
uni.hideLoading();
});
},
onClickItem(e) {
const app = this;
const { where, userId } = this;
const index = e.currentIndex;
if (this.current !== e.currentIndex) {
this.current = e.currentIndex;
}
if (userId == 0) {
app.openLogin();
return;
}
// 全部
if (index == 0) {
where.payStatus = undefined;
where.orderStatus = undefined;
}
// 未支付
if (index == 1) {
where.payStatus = 2;
}
// 已支付
if (index == 2) {
where.payStatus = 1;
}
// 已完成
if (index == 3) {
where.orderStatus = 1;
}
// 押金
if (index == 4) {
pageWechatDeposit({
uid: uni.getStorageSync('user_id')
}).then((res) => {
console.log('res: ', res);
app.orderList = res.list;
});
return false;
}
this.reload();
},
// 弹出登录提示框
// openLogin() {
// if (!this.isLogin) {
// this.$refs.login.open('bottom');
// return false;
// }
// },
// 弹出登录提示框
async openLogin() {
if (!this.isLogin) {
this.$refs.login.open('bottom');
// uni.showToast({
// title: '请先登录',
// icon: 'error'
// });
// setTimeout(() => {
// return uni.redirectTo({
// url: '/package/admin/index?orderNo=' + this.orderNo
// })
// },2000)
}
},
save() {
const app = this;
const { orderNo } = this;
uni.showLoading({
title: '请求中.'
});
FieldApi.verification(orderNo)
.then((res) => {
uni.showToast({
title: '核销成功',
icon: 'success'
});
uni.hideLoading();
app.reload()
})
.catch((res) => {
uni.showToast({
title: res.message || '请检查您的网络.',
icon: 'none'
});
uni.hideLoading();
app.reload()
});
}
}
};
</script>
<style lang="scss">
.content {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
justify-content: center;
align-items: center;
height: 150px;
text-align: center;
}
.content-text {
font-size: 14px;
color: #666;
}
.color-tag {
width: 25px;
height: 25px;
}
.uni-list {
flex: 1;
}
.order {
.order-title {
padding: 20rpx 0;
border-bottom: 1px #eee solid;
.merchant-avatar {
margin-right: 12rpx;
}
.merchant-name {
// padding-left: 12rpx;
}
.btn-status {
font-size: 30rpx;
display: flex;
}
}
.order-body {
padding: 16px 0;
}
}
.ele-flex {
display: flex;
justify-content: space-between;
}
.card-actions {
display: flex;
flex-direction: row;
justify-content: space-between;
padding: 0 10px;
align-items: center;
height: 45px;
border-top: 1px #eee solid;
.web-text-heading {
font-size: 30rpx;
font-weight: 500;
}
.web-text-danger {
font-size: 30rpx;
font-weight: 500;
}
}
.card-actions-item {
display: flex;
flex-direction: row;
align-items: center;
}
.card-actions-item-text {
font-size: 12px;
color: #666;
margin-left: 5px;
}
.btn-status {
font-size: 30rpx;
display: flex;
}
.close {
top: 60rpx !important;
}
.save-btn {
width: 700rpx;
left: 25rpx;
height: 80rpx;
position: fixed;
bottom: 30rpx;
}
.qrcode {
margin-top: 30rpx;
text-align: center;
align-items: center;
display: flex;
flex-direction: column;
justify-content: center;
}
.login-bar{
width: 600rpx;
height: 40vh;
margin: auto;
display: flex;
.login-btn{
width: 500rpx;
margin: auto;
}
}
</style>
-465
View File
@@ -1,465 +0,0 @@
<template>
<view class="admin-order-detail">
<view>
<uni-search-bar placeholder="订单号" @confirm="reload" :focus="true" v-model="orderId" />
</view>
<view class="order" v-if="form.orderId">
<uni-card title="预定信息" :border="false" :is-shadow="false" :padding="0">
<view class="order-body web-cell web-cell-align-top">
<view class="web-cell-content">
<uv-cell-group :customStyle="{ backgroundColor: '#ffffff' }" :border="false">
<uv-cell :title="`${form.merchantName}`" :label="` `" :cellStyle="{ padding: '0', paddingBottom: '5px' }"
:border="false"/>
<block v-for="(item, index) in form.orderInfo" :key="index">
<uv-cell
:title="`${item.fieldName}`"
:label="`${item.comments}`"
:cellStyle="{ padding: '0', paddingBottom: '5px' }"
:value="`¥${item.price}`"
:border="item.isChildren"
/>
<uv-cell :label="`成人票 ¥50`" :value="`x ${item.adultNum}`" v-if="item.isChildren"
:cellStyle="{ padding: '0', paddingBottom: '5px' }" :border="false"/>
<uv-cell :label="`儿童票 ¥35`" :value="`x ${item.childrenNum}`" v-if="item.isChildren"
:cellStyle="{ padding: '0', paddingBottom: '5px' }" :border="false"/>
</block>
</uv-cell-group>
</view>
</view>
<view slot="actions" class="card-actions">
<view class="web-text-heading">合计:¥{{ form.totalPrice }}</view>
<view class="web-text-danger">实付:¥{{ form.payPrice }}</view>
</view>
</uni-card>
<block v-if="form.orderNo">
<uni-card :border="false" :is-shadow="false" :padding="0">
<view class="web-cell web-cell-align-top">
<uv-cell-group :customStyle="{ backgroundColor: '#ffffff', padding: '8px 0' }" :border="false">
<uv-cell :title="`姓名`" :value="`${form.realName}`" :cellStyle="{ padding: '8px' }"/>
<uv-cell :title="`手机号码`" :value="`${form.phone}`" :cellStyle="{ padding: '8px' }"/>
<uv-cell :title="`订单号`" :value="`${form.orderId}`" :cellStyle="{ padding: '8px' }"/>
<uv-cell :title="`订单编号`" :cellStyle="{ padding: '8px' }">
<template v-slot:value>
<uv-parse :content="form.orderNo" :selectable="true"></uv-parse>
</template>
</uv-cell>
<uv-cell :title="`订单状态`" :cellStyle="{ padding: '8px' }">
<template v-slot:value>
<view v-if="form.payStatus == 0">
<!-- <uv-count-down :time="form.timestamp" format="mm:ss"></uv-count-down> -->
<span style="color: #ff0000">未支付</span>
</view>
<view v-else>{{ orderStatus[form.orderStatus] }}</view>
</template>
</uv-cell>
<uv-cell :title="`下单时间`" :value="`${form.createTime}`" :cellStyle="{ padding: '8px' }"/>
<uv-cell :title="`支付方式`" :value="`${payType[form.payType]}`" :cellStyle="{ padding: '8px' }"/>
<uv-cell :title="`优惠说明`" :value="`${form.couponDesc ? form.couponDesc : '无'}`"
:cellStyle="{ padding: '8px' }" :border="false"/>
</uv-cell-group>
</view>
</uni-card>
</block>
<uv-gap height="50"></uv-gap>
<view class="checkout-car">
<!-- <uv-button-->
<!-- text="取消订单"-->
<!-- ></uv-button>-->
<uv-button
text="更换场地"
@click="openPicker"
></uv-button>
<!-- <uv-button-->
<!-- text="同意退款"-->
<!-- ></uv-button>-->
<!-- <uv-button-->
<!-- text="不同意退款"-->
<!-- ></uv-button>-->
</view>
<uv-picker ref="picker" :columns="fieldList" keyName="label" @confirm="confirm"></uv-picker>
<!-- 登录组件 -->
<ws-login ref="login" :logo="logo" @done="reload"/>
</view>
</view>
</template>
<script>
import * as OrderApi from '@/api/shop/order';
import {pageWechatDeposit} from '@/api/shop/wechatDeposit';
import * as PeriodApi from "@/api/booking/period";
import * as FieldApi from "@/api/booking/field";
import * as Api from "@/api/layout";
export default {
components: {},
data() {
return {
isLogin: false,
orderId: 0,
userId: 0,
form: {},
where: {
page: 1
},
canReset: false,
loadMore: 'more',
logo: '',
items: ['全部订单', '未支付', '已支付', '已完成', '押金'],
orderStatus: ['未使用', '已完成', '已取消', '取消中', '退款申请中', '退款被拒绝', '退款成功', '客户端申请退款'],
payType: [
'余额支付',
'微信支付',
'会员卡支付',
'支付宝',
'现金',
'POS机',
'VIP月卡',
'VIP年卡',
'VIP次卡',
'IC月卡',
'IC年卡',
'IC次卡',
'免费',
'VIP充值卡',
'IC充值卡',
'积分支付',
'VIP季卡',
'IC季卡'
],
orderList: [],
styles: [
{
value: 'button',
text: '按钮',
checked: true
},
{
value: 'text',
text: '文字'
}
],
h5_url: '',
colors: ['#333333', '#4cd964', '#dd524d'],
current: 0,
colorIndex: 0,
activeColor: '#108001',
styleType: 'text',
fieldList: [],
// 服务器时间
serverTime: {},
dateTime: ''
};
},
async onLoad(option) {
this.orderId = option.id;
// 判断是否登录
await this.openLogin();
// 加载数据
// await this.reload();
},
onShow() {
// 判断是否登录
this.openLogin();
},
// 触底函数
onReachBottom() {
const app = this;
const {where} = this;
if (app.canReset) {
app.where.page = ++where.page;
app.reload();
}
},
methods: {
async reload() {
const app = this;
const {where, userId, orderId} = this;
if (userId === 0) {
app.openLogin();
return;
}
where.userId = userId;
uni.showLoading({
title: '数据读取中.'
});
await OrderApi.getOrder(orderId).then((data) => {
app.form = data;
if(data){
this.getServerTime()
}
// 页面标题
if (data.orderStatus == 1) {
uni.setNavigationBarTitle({
title: '订单详情'
});
}
uni.hideLoading();
}).catch(err => {
console.log(err)
uni.showToast({
title: '订单不存在',
icon: 'none'
})
uni.hideLoading();
});
// H5版网址
const h5_url = uni.getStorageSync('h5_url');
const tid = uni.getStorageSync('TenantId');
if (h5_url) {
app.h5_url = h5_url;
} else {
app.h5_url = `http://${tid}.h5.wsdns.cn`;
}
},
async openPicker() {
this.getBookingEmptyField()
this.$refs.picker.open();
},
confirm(e) {
console.log('confirm', e.value[0]);
console.log(this.form.orderId);
},
getBookingEmptyField(dateTime) {
const app = this
const { serverTime,merchantId,isHalf } = this;
const now = new Date();
const hours = now.getHours();
const minutes = now.getMinutes();
const startTime = serverTime.today === dateTime ? String(hours) + String(minutes) : undefined;
const week = this.week === 0 ? 7 : this.week;
app.fieldList = []
FieldApi.listField({
merchantId,
isStatus: 0,
week,
dateTime,
startTime,
half: isHalf
})
.then((list) => {
const arr = list.map(d => {
return {
label: d.fieldName,
// 其他属性值
id: d.fieldId
}
});
app.fieldList.push(arr);
uni.hideLoading();
})
.catch((err) => {
app.fieldList = [];
uni.showToast({
title: err.message,
icon: 'none'
});
uni.hideLoading();
});
},
getServerTime() {
const app = this
Api.getServerTime()
.then((result) => {
app.serverTime = result
app.form.orderInfo.map((d,i) => {
if(i === 0){
app.dateTime = d.dateTime
app.merchantId = d.merchantId
}
})
console.log(app.merchantId)
console.log(app.dateTime)
})
.catch();
},
navTo(url) {
uni.navigateTo({
url
});
},
onClickItem(e) {
const app = this;
const {where, userId} = this;
const index = e.currentIndex;
if (this.current !== e.currentIndex) {
this.current = e.currentIndex;
}
if (userId == 0) {
app.openLogin();
return;
}
// 全部
if (index == 0) {
where.payStatus = undefined;
where.orderStatus = undefined;
}
// 未支付
if (index == 1) {
where.payStatus = 2;
}
// 已支付
if (index == 2) {
where.payStatus = 1;
}
// 已完成
if (index == 3) {
where.orderStatus = 1;
}
// 押金
if (index == 4) {
pageWechatDeposit({
uid: uni.getStorageSync('user_id')
}).then((res) => {
console.log('res: ', res);
app.orderList = res.list;
});
return false;
}
this.reload();
},
// 弹出登录提示框
async openLogin() {
this.userId = uni.getStorageSync('user_id');
if (!this.userId) {
this.$refs.login.open('bottom');
return false;
}
}
}
};
</script>
<style lang="scss">
.content {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
justify-content: center;
align-items: center;
height: 150px;
text-align: center;
}
.content-text {
font-size: 14px;
color: #666;
}
.color-tag {
width: 25px;
height: 25px;
}
.uni-list {
flex: 1;
}
.order {
.order-title {
padding: 20rpx 0;
border-bottom: 1px #eee solid;
.merchant-avatar {
margin-right: 12rpx;
}
.merchant-name {
// padding-left: 12rpx;
}
.btn-status {
font-size: 30rpx;
display: flex;
}
}
.order-body {
padding: 16px 0;
}
}
.ele-flex {
display: flex;
justify-content: space-between;
}
.card-actions {
display: flex;
flex-direction: row;
justify-content: space-between;
padding: 0 10px;
align-items: center;
height: 45px;
border-top: 1px #eee solid;
.web-text-heading {
font-size: 30rpx;
font-weight: 500;
}
.web-text-danger {
font-size: 30rpx;
font-weight: 500;
}
}
.card-actions-item {
display: flex;
flex-direction: row;
align-items: center;
}
.card-actions-item-text {
font-size: 12px;
color: #666;
margin-left: 5px;
}
.btn-status {
font-size: 30rpx;
display: flex;
}
.close {
top: 60rpx !important;
}
.qrcode {
margin-top: 30rpx;
text-align: center;
align-items: center;
display: flex;
flex-direction: column;
justify-content: center;
}
.checkout-car {
width: 700rpx;
left: 25rpx;
position: fixed;
bottom: 30rpx;
display: flex;
justify-content: space-around;
border-radius: 100px;
align-items: center;
.car-selected {
color: #ccc;
display: flex;
align-items: center;
padding: 0 20rpx;
}
.car-total {
display: flex;
color: #ebcf00;
align-items: center;
padding-left: 40rpx;
.save-btn {
}
}
}
</style>
+4 -3
View File
@@ -180,7 +180,7 @@ import { useCarStore } from '@/store/modules/car';
import { useUserStore } from '@/store/modules/user';
const userStore = useUserStore();
const carStore = useCarStore();
const { merchantId, orderInfo, period, totalPrice, reducePrice, payPrice, childrenPrice, carNum, carNum2, merchant, type, dateTime } = storeToRefs(carStore);
const { merchantId, merchantCode, orderInfo, period, totalPrice, reducePrice, payPrice, childrenPrice, carNum, carNum2, merchant, type, dateTime } = storeToRefs(carStore);
export default {
data() {
@@ -197,6 +197,7 @@ export default {
// 场馆信息
merchant,
merchantId,
merchantCode,
orderInfo,
carNum,
carNum2: 0,
@@ -386,9 +387,9 @@ export default {
const app = this;
const { payPrice } = this
return new Promise((resolve, reject) => {
const { merchantId } = this;
const { merchantId,merchantCode } = this;
UserCardApi.findUseCard({
sid: merchantId,
sid: merchantCode,
payPrice
})
.then((result) => {
+5 -2
View File
@@ -3,7 +3,7 @@
<!-- 其他功能 -->
<block v-for="(item, index) in list" :key="index">
<uni-card :border="false" :is-shadow="false" :padding="0">
<uv-cell :title="item.comments" :label="item.createTime" :value="`${item.price}`" :cellStyle="{ padding: '10px 0' }" :border="false"></uv-cell>
<uv-cell :title="item.comments" :label="item.createTime" :value="`¥${item.price}`" :cellStyle="{ padding: '10px 0' }" :border="false"></uv-cell>
</uni-card>
</block>
<!-- 登录组件 -->
@@ -48,7 +48,10 @@ export default {
// 获取会员卡使用记录
Api.pageUserCardLog({cardId}).then((res) => {
app.list = res.list;
app.list = res.list.map(d => {
d.createTime = uni.$uv.date(d.createTime,'yyyy-mm-dd hh:MM:ss')
return d;
});
});
},
navTo(item) {
+19 -19
View File
@@ -31,25 +31,25 @@
</template>
</uv-cell>
</uv-form-item>
<uv-form-item prop="form.idCard" borderBottom>
<uv-cell title="上传证件">
<template v-slot:right-icon>
<uv-icon size="40rpx" name="camera" @click="onIdCard(item)"></uv-icon>
</template>
</uv-cell>
</uv-form-item>
<uv-form-item prop="form.idCard" borderBottom>
<uv-cell>
<template v-slot:label>
<image src="https://oss.wsdns.cn/20240502/ec8c13037e7d4d40931b49fd45b23c61.png?x-oss-process=image/resize,m_fixed,w_100,h_100/quality,Q_90" style="width: 80rpx" mode="widthFix" />
</template>
</uv-cell>
<uv-cell>
<template v-slot:label>
<image src="https://oss.wsdns.cn/20240502/ec8c13037e7d4d40931b49fd45b23c61.png?x-oss-process=image/resize,m_fixed,w_100,h_100/quality,Q_90" style="width: 80rpx" mode="widthFix" />
</template>
</uv-cell>
</uv-form-item>
<!-- <uv-form-item prop="form.idCard" borderBottom>-->
<!-- <uv-cell title="上传证件">-->
<!-- <template v-slot:right-icon>-->
<!-- <uv-icon size="40rpx" name="camera" @click="onIdCard(item)"></uv-icon>-->
<!-- </template>-->
<!-- </uv-cell>-->
<!-- </uv-form-item>-->
<!-- <uv-form-item prop="form.idCard" borderBottom>-->
<!-- <uv-cell>-->
<!-- <template v-slot:label>-->
<!-- <image src="https://oss.wsdns.cn/20240502/ec8c13037e7d4d40931b49fd45b23c61.png?x-oss-process=image/resize,m_fixed,w_100,h_100/quality,Q_90" style="width: 80rpx" mode="widthFix" />-->
<!-- </template>-->
<!-- </uv-cell>-->
<!-- <uv-cell>-->
<!-- <template v-slot:label>-->
<!-- <image src="https://oss.wsdns.cn/20240502/ec8c13037e7d4d40931b49fd45b23c61.png?x-oss-process=image/resize,m_fixed,w_100,h_100/quality,Q_90" style="width: 80rpx" mode="widthFix" />-->
<!-- </template>-->
<!-- </uv-cell>-->
<!-- </uv-form-item>-->
</uv-form>
</view>
</uni-card>