已支付订单列表:where.payStatus = 1;

This commit is contained in:
2024-07-10 22:44:18 +08:00
parent 9dd834adb5
commit 1311eb03b8
611 changed files with 92828 additions and 400 deletions
+1 -1
View File
@@ -53,4 +53,4 @@ export const FILE_SERVER = 'https://file.wsdns.cn';
export const API_BASE_URL: string = 'https://server.gxwebsoft.com/api';
// export const API_BASE_URL: string = 'http://127.0.0.1:9091/api';
// 主节点
export const SERVER_API_URL = 'https://server.gxwebsoft.com/api';
export const SERVER_API_URL = 'https://server.gxwebsoft.com/api';
+739
View File
@@ -0,0 +1,739 @@
<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">
<uni-segmented-control :current="current" :values="items" activeColor="#2ba91c" inActiveColor="#ff0000" @clickItem="onType" />
</view>
<!-- 状态说明 -->
<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);
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
};
},
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
})
.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
});
},
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) {
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 auto;
}
.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: 1.3rem;
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>
+218 -232
View File
@@ -1,17 +1,17 @@
<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>
<!-- <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>
<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>
<uv-skeleton rows="9" :loading="hideTools" :title="false"></uv-skeleton>
</uni-card>
</block>
<block v-else>
@@ -23,14 +23,13 @@
<uni-card :border="false" :padding="0">
<!-- 场馆管理可见-->
<block v-if="hasMerchantRole || hasMerchantClerkRole">
<view class="server" style="min-height: 200px;">
<view class="server" style="min-height: 200px">
<uni-list :border="false">
<block v-for="(item,index) in server" :key="index">
<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>
<text class="slot-text" :style="{ color: item.color ? item.color : '#333333' }">{{ item.title }}</text>
</view>
</template>
</uni-list-item>
@@ -50,245 +49,232 @@
<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 { 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';
import { useTenantStore } from '@/store/modules/tenant';
const tenantStore = useTenantStore();
const tenantStore = useTenantStore();
const userStore = useUserStore();
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 && app.orderNo != undefined){
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
}
})
});
// 获取用户副表信息
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
console.log('item.path: ',item.path);
console.log('app.orderNo: ',app.orderNo);
// 允许从相机和相册扫码
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);
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;
}
}
},
// 弹出登录提示框
openLogin() {
if (!this.isLogin) {
this.$refs.login.open('bottom')
return false;
}
},
goBack(){
return uni.switchTab({
url: '/pages/user/user'
});
// 当前租户信息
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;
}
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">
.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;
}
.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>
}
</style>
+7
View File
@@ -282,6 +282,13 @@
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
}, {
"path": "admin/field",
"style": {
"navigationBarTitleText": "场地管理",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
},
{
"path": "teacher/detail",
+7 -8
View File
@@ -216,32 +216,31 @@
if (this.current !== e.currentIndex) {
this.current = e.currentIndex
}
if (userId == 0) {
if (userId === 0) {
app.openLogin()
return;
}
// 全部
if (index == 0) {
if (index === 0) {
where.payStatus = undefined;
where.orderStatus = undefined;
}
// 未支付
if (index == 1) {
if (index === 1) {
where.payStatus = 0;
where.orderStatus = undefined;
}
// 已支付
if (index == 2) {
if (index === 2) {
where.payStatus = 1;
where.orderStatus = 0;
}
// 已完成
if (index == 3) {
if (index === 3) {
where.payStatus = 1;
where.orderStatus = 1;
}
// 押金
if (index == 4) {
if (index === 4) {
pageWechatDeposit({
uid: uni.getStorageSync('user_id')
}).then(res => {
@@ -412,4 +411,4 @@
font-size: 30rpx !important;
}
}
</style>
</style>
@@ -18,9 +18,9 @@
<view class="nickname">点击登录</view>
</view>
</view>
<view class="tool-btn" v-if="merchantList">
<!-- <view class="tool-btn" v-if="merchantList">
<uni-data-select :clear="false" style="background-color: #fff; width: 300rpx;" v-model="value" :localdata="merchantList" @change="change"></uni-data-select>
</view>
</view> -->
</view>
</template>
@@ -69,7 +69,7 @@ export default {
});
},
change(index) {
console.log(index);
uni.setStorageSync('currentId',index);
},
reload() {
this.$emit('done');
+4 -2
View File
@@ -373,7 +373,9 @@ page {
padding-left: 0.5rem; /* 8px */
padding-right: 0.5rem; /* 8px */
}
.p-5{
padding: 0.25rem; /* 8px */
}
.text-blue-500{
color: rgb(59 130 246);
}
@@ -386,4 +388,4 @@ page {
}
.mx-10{
margin: 0 40rpx;
}
}
@@ -1,86 +1,88 @@
import request from '@/uni_modules/ws-common/utils/request';
import type { ApiResult } from '@/uni_modules/ws-common/api';
import type { User } from '@/uni_modules/ws-common/api/system/user/model';
import type { UpdatePasswordParam, NoticeResult, LoginParam } from './model';
import { SERVER_API_URL } from '@/config/setting';
import type {ApiResult} from '@/uni_modules/ws-common/api';
import type {User} from '@/uni_modules/ws-common/api/system/user/model';
import type {UpdatePasswordParam, NoticeResult, LoginParam} from './model';
import {SERVER_API_URL} from '@/config/setting';
/**
* 解析token
*/
export async function parseToken(token : string) : Promise<any> {
const res = await request.get<ApiResult<any>>(
'https://server.gxwebsoft.com/api/parseToken/' + token
);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
export async function parseToken(token: string): Promise<any> {
const res = await request.get<ApiResult<any>>(
'https://server.gxwebsoft.com/api/parseToken/' + token
);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 获取当前登录的用户信息、菜单、权限、角色
*/
export async function getUserInfo() : Promise<User> {
const res = await request.get<ApiResult<User>>(SERVER_API_URL + '/auth/user');
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
export async function getUserInfo(): Promise<User> {
const res = await request.get<ApiResult<User>>(SERVER_API_URL + '/auth/user');
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
export async function loginMpWxMobile(data : User) : Promise<User> {
const res = await request.post<ApiResult<unknown>>(SERVER_API_URL + '/wx-login/loginByMpWxPhone', data);
if (res.data.code === 0) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
export async function loginMpWxMobile(data: User): Promise<any> {
const res = await request.post<ApiResult<unknown>>(SERVER_API_URL + '/wx-login/loginByMpWxPhone', data);
if (res.data.code === 0) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 发送短信验证码
*/
export async function sendSmsCaptcha(data : LoginParam) : Promise<User> {
const res = await request.post<ApiResult<unknown>>(
SERVER_API_URL + '/sendSmsCaptcha',
data
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
export async function sendSmsCaptcha(data: LoginParam): Promise<string | undefined> {
const res = await request.post<ApiResult<unknown>>(
SERVER_API_URL + '/sendSmsCaptcha',
data
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 短信验证码登录
*/
export async function loginBySms(data: LoginParam) : Promise<User> {
const res = await request.post<ApiResult<unknown>>(
SERVER_API_URL + '/loginBySms',
data
);
if (res.data.code === 0) {
uni.setStorageSync('access_token', res.data.data?.access_token)
// setToken(res.data.data?.access_token, data.remember);
if (res.data.data?.user) {
const user = res.data.data?.user;
console.log('user: ',user.userId);
uni.setStorageSync('user_id', user.userId)
console.log('TenantId: ',user.tenantId);
console.log('Phone: ',user.phone);
console.log('UserId: ',user.userId);
console.log('MerchantId: ',user.merchantId);
uni.setStorageSync('TenantId', user.tenantId)
uni.setStorageSync('Phone', user.phone)
uni.setStorageSync('UserId', user.userId)
if(user.merchantId){
uni.setStorageSync('MerchantId',user.merchantId)
}
}
export async function loginBySms(data: LoginParam): Promise<string | undefined> {
const res = await request.post<ApiResult<unknown>>(
SERVER_API_URL + '/loginBySms',
data
);
if (res.data.code === 0) {
// @ts-ignore
uni.setStorageSync('access_token', res.data.data?.access_token)
// setToken(res.data.data?.access_token, data.remember);
// @ts-ignore
const user = res.data.data?.user;
if (user) {
console.log('user: ', user.userId);
uni.setStorageSync('user_id', user.userId)
console.log('TenantId: ', user.tenantId);
console.log('Phone: ', user.phone);
console.log('UserId: ', user.userId);
console.log('MerchantId: ', user.merchantId);
uni.setStorageSync('TenantId', user.tenantId)
uni.setStorageSync('Phone', user.phone)
uni.setStorageSync('UserId', user.userId)
if (user.merchantId) {
uni.setStorageSync('MerchantId', user.merchantId)
}
}
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
@@ -88,103 +90,103 @@ export async function loginBySms(data: LoginParam) : Promise<User> {
* 修改当前登录的用户密码
*/
export async function updatePassword(
data : UpdatePasswordParam
) : Promise<string> {
const res = await request.put<ApiResult<unknown>>('/auth/password', data);
if (res.data.code === 0) {
return res.data.message ?? '修改成功';
}
return Promise.reject(new Error(res.data.message));
data: UpdatePasswordParam
): Promise<string> {
const res = await request.put<ApiResult<unknown>>('/auth/password', data);
if (res.data.code === 0) {
return res.data.message ?? '修改成功';
}
return Promise.reject(new Error(res.data.message));
}
/**
* 查询未读通知
*/
export async function getUnreadNotice() : Promise<NoticeResult> {
return {
notice: [
{
color: '#60B2FC',
icon: 'NotificationFilled',
title: '你收到了一封14份新周报',
time: '2020-07-27 18:30:18'
},
{
color: '#F5686F',
icon: 'PushpinFilled',
title: '许经理同意了你的请假申请',
time: '2020-07-27 09:08:36'
},
{
color: '#7CD734',
icon: 'VideoCameraFilled',
title: '陈总邀请你参加视频会议',
time: '2020-07-26 18:30:01'
},
{
color: '#FAAD14',
icon: 'CarryOutFilled',
title: '你推荐的刘诗雨已通过第三轮面试',
time: '2020-07-25 16:38:46'
},
{
color: '#2BCACD',
icon: 'BellFilled',
title: '你的6月加班奖金已发放',
time: '2020-07-25 11:03:31'
}
],
letter: [
{
avatar:
'https://cdn.eleadmin.com/20200609/c184eef391ae48dba87e3057e70238fb.jpg',
title: 'SunSmile 评论了你的日志',
content: '写的不错, 以后多多向你学习~',
time: '2020-07-27 18:30:18'
},
{
avatar:
'https://cdn.eleadmin.com/20200609/948344a2a77c47a7a7b332fe12ff749a.jpg',
title: '刘诗雨 点赞了你的日志',
content: '写的不错, 以后多多向你学习~',
time: '2020-07-27 09:08:36'
},
{
avatar:
'https://cdn.eleadmin.com/20200609/2d98970a51b34b6b859339c96b240dcd.jpg',
title: '酷酷的大叔 评论了你的周报',
content: '写的不错, 以后多多向你学习~',
time: '2020-07-26 18:30:01'
},
{
avatar:
'https://cdn.eleadmin.com/20200609/f6bc05af944a4f738b54128717952107.jpg',
title: 'Jasmine 点赞了你的周报',
content: '写的不错, 以后多多向你学习~',
time: '2020-07-25 11:03:31'
}
],
todo: [
{
status: 0,
title: '刘诗雨的请假审批',
description: '刘诗雨在 07-27 18:30 提交的请假申请'
},
{
status: 1,
title: '第三方代码紧急变更',
description: '需要在 2020-07-27 之前完成'
},
{
status: 2,
title: '信息安全考试',
description: '需要在 2020-07-26 18:30 前完成'
},
{
status: 2,
title: 'EleAdmin发布新版本',
description: '需要在 2020-07-25 11:03 前完成'
}
]
};
}
export async function getUnreadNotice(): Promise<NoticeResult> {
return {
notice: [
{
color: '#60B2FC',
icon: 'NotificationFilled',
title: '你收到了一封14份新周报',
time: '2020-07-27 18:30:18'
},
{
color: '#F5686F',
icon: 'PushpinFilled',
title: '许经理同意了你的请假申请',
time: '2020-07-27 09:08:36'
},
{
color: '#7CD734',
icon: 'VideoCameraFilled',
title: '陈总邀请你参加视频会议',
time: '2020-07-26 18:30:01'
},
{
color: '#FAAD14',
icon: 'CarryOutFilled',
title: '你推荐的刘诗雨已通过第三轮面试',
time: '2020-07-25 16:38:46'
},
{
color: '#2BCACD',
icon: 'BellFilled',
title: '你的6月加班奖金已发放',
time: '2020-07-25 11:03:31'
}
],
letter: [
{
avatar:
'https://cdn.eleadmin.com/20200609/c184eef391ae48dba87e3057e70238fb.jpg',
title: 'SunSmile 评论了你的日志',
content: '写的不错, 以后多多向你学习~',
time: '2020-07-27 18:30:18'
},
{
avatar:
'https://cdn.eleadmin.com/20200609/948344a2a77c47a7a7b332fe12ff749a.jpg',
title: '刘诗雨 点赞了你的日志',
content: '写的不错, 以后多多向你学习~',
time: '2020-07-27 09:08:36'
},
{
avatar:
'https://cdn.eleadmin.com/20200609/2d98970a51b34b6b859339c96b240dcd.jpg',
title: '酷酷的大叔 评论了你的周报',
content: '写的不错, 以后多多向你学习~',
time: '2020-07-26 18:30:01'
},
{
avatar:
'https://cdn.eleadmin.com/20200609/f6bc05af944a4f738b54128717952107.jpg',
title: 'Jasmine 点赞了你的周报',
content: '写的不错, 以后多多向你学习~',
time: '2020-07-25 11:03:31'
}
],
todo: [
{
status: 0,
title: '刘诗雨的请假审批',
description: '刘诗雨在 07-27 18:30 提交的请假申请'
},
{
status: 1,
title: '第三方代码紧急变更',
description: '需要在 2020-07-27 之前完成'
},
{
status: 2,
title: '信息安全考试',
description: '需要在 2020-07-26 18:30 前完成'
},
{
status: 2,
title: 'EleAdmin发布新版本',
description: '需要在 2020-07-25 11:03 前完成'
}
]
};
}
@@ -0,0 +1,74 @@
<template>
<view class="container">
<view class="flex justify-between items-center w-full fixed bg-white" style="z-index: 100;">
<view class="left p-5">
<uni-icons type="left" size="24" @click="goBack"></uni-icons>
</view>
<view class="right p-5">
<uni-data-select :clear="false" style="background-color: #fff; width: 300rpx" v-model="value" :localdata="merchantList" @change="change"></uni-data-select>
</view>
</view>
<uv-gap height="50"></uv-gap>
</view>
</template>
<script>
const value = uni.getStorageSync('currentId')
export default {
name: 'ws-select-merchant',
emits: ['done'],
props: {
isLogin: {
type: Boolean,
default: false
},
data: {
type: Object,
default: {}
},
merchantList: {
type: Array,
default: []
},
merchantId: {
type: Number,
default: 0
}
},
data() {
return {
value
};
},
methods: {
back() {
uni.navigateBack({delta:2});
},
goBack() {
return uni.redirectTo({
url: '/package/admin/index'
});
},
navTo(url) {
console.log('url99: ', url);
if (!this.isLogin) {
return false;
}
return uni.navigateTo({
url
});
},
change(index) {
console.log('index>>: ',index);
uni.setStorageSync('currentId', index);
this.reload()
},
reload() {
this.$emit('done');
}
}
};
</script>
<style lang="scss" scoped>
</style>
@@ -0,0 +1,83 @@
{
"id": "ws-select-merchant",
"displayName": "ws-select-merchant",
"version": "1.0.0",
"description": "ws-select-merchant",
"keywords": [
"ws-select-merchant"
],
"repository": "",
"engines": {
"HBuilderX": "^3.1.0"
},
"dcloudext": {
"type": "component-vue",
"sale": {
"regular": {
"price": "0.00"
},
"sourcecode": {
"price": "0.00"
}
},
"contact": {
"qq": ""
},
"declaration": {
"ads": "",
"data": "",
"permissions": ""
},
"npmurl": ""
},
"uni_modules": {
"dependencies": [],
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "u",
"aliyun": "u",
"alipay": "u"
},
"client": {
"Vue": {
"vue2": "u",
"vue3": "u"
},
"App": {
"app-vue": "u",
"app-nvue": "u",
"app-uvue": "u"
},
"H5-mobile": {
"Safari": "u",
"Android Browser": "u",
"微信浏览器(Android)": "u",
"QQ浏览器(Android)": "u"
},
"H5-pc": {
"Chrome": "u",
"IE": "u",
"Edge": "u",
"Firefox": "u",
"Safari": "u"
},
"小程序": {
"微信": "u",
"阿里": "u",
"百度": "u",
"字节跳动": "u",
"QQ": "u",
"钉钉": "u",
"快手": "u",
"飞书": "u",
"京东": "u"
},
"快应用": {
"华为": "u",
"联盟": "u"
}
}
}
}
}
@@ -0,0 +1 @@
# ws-select-merchant