This commit is contained in:
2024-11-01 14:15:56 +08:00
parent 0fc032aa8e
commit 06f6e29972
20 changed files with 3104 additions and 2715 deletions
+2 -2
View File
@@ -1,9 +1,9 @@
VITE_APP_NAME=后台管理系统 VITE_APP_NAME=后台管理系统
VITE_SOCKET_URL=wss://server.gxwebsoft.com VITE_SOCKET_URL=wss://server.gxwebsoft.com
VITE_SERVER_URL=https://server.gxwebsoft.com/api VITE_SERVER_URL=https://server.gxwebsoft.com/api
#VITE_THINK_URL=https://gxtyzx-api.websoft.top/api
VITE_API_URL=https://modules.gxwebsoft.com/api VITE_API_URL=https://modules.gxwebsoft.com/api
VITE_THINK_URL=https://gxtyzx-api.websoft.top/api
#VITE_SERVER_URL=http://127.0.0.1:9090/api #VITE_SERVER_URL=http://127.0.0.1:9090/api
#VITE_API_URL=http://127.0.0.1:9099/api #VITE_API_URL=http://127.0.0.1:9099/api
VITE_THINK_URL=http://127.0.0.1:9099/api #VITE_THINK_URL=http://127.0.0.1:9099/api
+10
View File
@@ -35,6 +35,16 @@ export async function listThinkCard(params?: ThinkCardParam) {
return Promise.reject(new Error(res.data.message)); return Promise.reject(new Error(res.data.message));
} }
export async function listUserThinkCard() {
const res = await request.post<ApiResult<ThinkCard[]>>(
THINK_API_URL + '/think/think-card/user-card'
);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
/** /**
* 添加 * 添加
*/ */
+11 -1
View File
@@ -44,7 +44,7 @@ export async function addThinkOrder(data: ThinkOrder) {
data data
); );
if (res.data.code === 0) { if (res.data.code === 0) {
return res.data.message; return res.data.data;
} }
return Promise.reject(new Error(res.data.message)); return Promise.reject(new Error(res.data.message));
} }
@@ -104,3 +104,13 @@ export async function getThinkOrder(id: number) {
} }
return Promise.reject(new Error(res.data.message)); return Promise.reject(new Error(res.data.message));
} }
export async function thinkOrderRepay(data: ThinkOrder) {
const res = await request.post<ApiResult<ThinkOrder>>(
THINK_API_URL + '/think/think-order/repay', data
);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
+11 -3
View File
@@ -1,7 +1,7 @@
import request from '@/utils/request'; import request from '@/utils/request';
import type { ApiResult, PageResult } from '@/api'; import type {ApiResult, PageResult} from '@/api';
import type { ThinkUsers, ThinkUsersParam } from './model'; import type {ThinkUsers, ThinkUsersParam} from './model';
import { THINK_API_URL } from '@/config/setting'; import {THINK_API_URL} from '@/config/setting';
// 微信小程序登录 // 微信小程序登录
export async function loginByOpenId(data: any) { export async function loginByOpenId(data: any) {
@@ -12,6 +12,14 @@ export async function loginByOpenId(data: any) {
return Promise.reject(new Error(res.data.message)); return Promise.reject(new Error(res.data.message));
} }
export async function thinkUserInfo() {
const res = await request.post<ApiResult<ThinkUsers>>(THINK_API_URL + '/think/think-users/info');
if (res.data.code === 0) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
/** /**
* 分页查询 * 分页查询
*/ */
+10 -1
View File
@@ -44,7 +44,7 @@ export async function addThinkUsersVip(data: ThinkUsersVip) {
data data
); );
if (res.data.code === 0) { if (res.data.code === 0) {
return res.data.message; return res.data.data;
} }
return Promise.reject(new Error(res.data.message)); return Promise.reject(new Error(res.data.message));
} }
@@ -104,3 +104,12 @@ export async function getThinkUsersVip(id: number) {
} }
return Promise.reject(new Error(res.data.message)); return Promise.reject(new Error(res.data.message));
} }
export async function thinkUsersVipRepay(data: any) {
const res = await request.post<ApiResult<ThinkUsersVip>>(
THINK_API_URL + '/think/think-users-vip/repay', data
);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
+10
View File
@@ -104,3 +104,13 @@ export async function getThinkVip(id: number) {
} }
return Promise.reject(new Error(res.data.message)); return Promise.reject(new Error(res.data.message));
} }
export async function listThinkVipByGroup(data: ThinkVip) {
const res = await request.post<ApiResult<ThinkVip[]>>(
THINK_API_URL + '/think/think-vip/list-by-group', data
);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
+54 -95
View File
@@ -33,16 +33,16 @@
<template v-for="(item,index) in periodList" :key="index"> <template v-for="(item,index) in periodList" :key="index">
<view class="period-item"> <view class="period-item">
<view class="period">{{ item.timePeriod }}</view> <view class="period">{{ item.timePeriod }}</view>
<!-- <view class="field-list">--> <view class="field-list">
<!-- <template v-for="(field,index2) in item.fieldList" :key="index2">--> <template v-for="(field,index2) in fieldList" :key="index2">
<!-- <view class="field"--> <view class="field"
<!-- :class="isActive(field)"--> :class="isActive(field, item)"
<!-- @click="onField(field,item)">--> @click="onField(field, item)">
<!-- <text class="field-name">{{ field.fieldName }}</text>--> <text class="field-name">{{ field.name }}</text>
<!-- <text class="price">{{ item.price }}元</text>--> <text class="price">{{ item.price }}元</text>
<!-- </view>--> </view>
<!-- </template>--> </template>
<!-- </view>--> </view>
</view> </view>
</template> </template>
<!-- 排版样式备份 --> <!-- 排版样式备份 -->
@@ -78,7 +78,7 @@
:endVal="totalPrice"></uv-count-to> :endVal="totalPrice"></uv-count-to>
</view> </view>
<uv-button class="save-btn" <uv-button class="save-btn"
:disabled="orderInfo.length == 0" :disabled="!selection.length"
:customStyle="{background: 'linear-gradient(to right, #70b915, #008e04)',borderRadius: '0 30px 30px 0',color: '#ffffff', border: 'none', padding: '22px 30px'}" :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> text="下一步" @click="save"></uv-button>
</view> </view>
@@ -291,11 +291,11 @@ export default {
onType(e) { onType(e) {
const index = e.currentIndex const index = e.currentIndex
if (index === 0) { if (index === 0) {
this.type = 0; this.type = 1;
this.isHalf = 0; this.isHalf = 0;
} }
if (index === 1) { if (index === 1) {
this.type = 1; this.type = 2;
this.isHalf = 1; this.isHalf = 1;
} }
this.reload() this.reload()
@@ -303,9 +303,9 @@ export default {
async getMerchant() { async getMerchant() {
this.merchant = await getThinkSite(this.merchantId) this.merchant = await getThinkSite(this.merchantId)
}, },
async getFieldList(){ async getFieldList() {
if (!this.periodList.length) { if (!this.periodList.length) {
uni.showToast({ return uni.showToast({
title: '暂无可预订场地', title: '暂无可预订场地',
icon: 'none' icon: 'none'
}) })
@@ -315,14 +315,14 @@ export default {
const timestamp = dayjs(this.dateTime + ' ' + item.timePeriod.split(' - ')[0]).unix() const timestamp = dayjs(this.dateTime + ' ' + item.timePeriod.split(' - ')[0]).unix()
periodVoList.push({ periodVoList.push({
timestamp, timestamp,
period: item.timePeriod period: item.timePeriod,
id: item.id
}) })
}) })
const res = await listThinkFieldWithTimeList({ this.fieldList = await listThinkFieldWithTimeList({
sid: this.merchantId, sid: this.merchantId,
periodVoList periodVoList
}) })
console.log(res)
}, },
getBookingPeriod() { getBookingPeriod() {
const { const {
@@ -379,9 +379,9 @@ export default {
closeCarInfo() { closeCarInfo() {
this.$refs.popup.close() this.$refs.popup.close()
}, },
onField(item, period) { onField(field, item) {
// 已被预定 // 已被预定
if (item.sold) { if (field.sold) {
return return
} }
const app = this const app = this
@@ -390,7 +390,7 @@ export default {
// const p = this.periodList[i] // const p = this.periodList[i]
// 场地 // 场地
// const f = this.fieldList[i2] // const f = this.fieldList[i2]
const key = getKey(`${this.dateTime}${item.timePeriod}${this.merchantId}${item.fieldId}`) const key = getKey(`${this.dateTime}${item.timePeriod}${this.merchantId}${field.id}`)
const index = app.selection.findIndex(d => d.key === key) const index = app.selection.findIndex(d => d.key === key)
if (index >= 0) { if (index >= 0) {
app.selection.splice(index, 1) app.selection.splice(index, 1)
@@ -402,80 +402,52 @@ export default {
}) })
return false return false
} }
// 计算订单总金额 const split = item.timePeriod.split(' - ')
// let totalPrice = 0 const siteTime = field.periodVoList.find(d => d.period === item.timePeriod)
// 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}`,
// });
// 添加到购物车 // 添加到购物车
const week = parseInt(this.week) === 7 ? 0 : this.week
app.selection.push({ app.selection.push({
key, key,
merchantId: this.merchantId, sid: this.merchantId,
merchantCode: merchant.merchantCode, fieldId: field.id,
fieldId: item.fieldId, fieldName: field.name,
fieldName: item.fieldName,
price: item.price, price: item.price,
childrenPrice: period.childrenPrice, childrenPrice: item.childrenPrice,
adultNum: 1, adultNum: 1,
childrenNum: 0, childrenNum: 0,
merchantName: merchant.merchantName, siteName: merchant.name,
isChildren: item.isChildren, isChildren: item.isChildren,
isHalf: this.type, isHalf: this.isHalf,
type: this.type,
timePeriod: item.timePeriod, timePeriod: item.timePeriod,
periodId: item.periodId, periodId: item.periodId,
startTime: `${split[0].trim()}:00`, startTime: dayjs(`${this.dateTime} ${split[0].trim()}`).unix(),
endTime: `${split[1].trim()}:00`, endTime: `${split[1].trim()}:00`,
orderCode: key, orderCode: key,
siteTimeId: siteTime.id,
dateTime: `${this.dateTime}`, dateTime: `${this.dateTime}`,
comments: `${this.dateTime} (${getWeek(this.week)}) ${item.timePeriod}`, comments: `${this.dateTime}(${getWeek(week)})${item.timePeriod}`,
}) })
console.log(app.selection); console.log(app.selection);
console.log('period: ', period); // console.log('period: ', period);
// 是否支持儿童票 // 是否支持儿童票
console.log('item.isChildren: ', item.isChildren); // console.log('item.isChildren: ', item.isChildren);
if (item.isChildren === 1) { // if (item.isChildren === 1) {
console.log('item.isChildren2: ', item.isChildren); // console.log('item.isChildren2: ', item.isChildren);
carStore.childrenPrice = period.childrenPrice // carStore.childrenPrice = period.childrenPrice
} else { // } else {
carStore.childrenPrice = 0 // carStore.childrenPrice = 0
} // }
carStore.orderInfo = app.selection // carStore.orderInfo = app.selection
carStore.carNum = app.selection.length // carStore.carNum = app.selection.length
carStore.totalPrice = totalPrice // carStore.totalPrice = totalPrice
carStore.payPrice = totalPrice // carStore.payPrice = totalPrice
carStore.setPeriod(period) // carStore.setPeriod(period)
} }
}, },
getStratTime(value) { isActive(field, item) {
const split = value.split('-') const index = this.selection.find(d => d.key === getKey(`${this.dateTime}${item.timePeriod}${this.merchantId}${field.id}`))
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.sold) {
if (item.isHalf === 1) { if (item.isHalf === 1) {
return 'web-bg-warning' return 'web-bg-warning'
@@ -486,30 +458,17 @@ export default {
return 'active web-bg-success' 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) { remove(item) {
const index = this.selection.findIndex(d => d.key === item.key) const index = this.selection.findIndex(d => d.key === item.key)
this.selection.splice(index, 1) this.selection.splice(index, 1)
carStore.orderInfo = this.selection carStore.orderInfo = this.selection
}, },
save() { save() {
const { uni.navigateTo({
selection url: '/package/booking/confirm',
} = this success: (res) => {
uni.$uv.route({ res.eventChannel.emit('data', this.selection)
url: '/package/booking/confirm' }
}) })
} }
+190 -205
View File
@@ -6,36 +6,22 @@
{{ totalPrice }} {{ totalPrice }}
{{ orderInfo }} {{ orderInfo }}
</view> --> </view> -->
<view style="display: none;">
{{ radiolist }}
{{ carNum }} {{ childrenPrice }} {{ orderInfo }}
</view>
<view v-if="merchant" class="web-debug web-text-success" style="display: none">
场馆ID:{{ merchant.merchantId }} 场馆编号:{{ merchant.merchantCode }} 场馆名称:{{ merchant.merchantName }} 日期:{{ dateTime }} 星期:{{ week }} 订单总金额:{{
totalPrice
}}
类型:{{ type }} 实付金额:{{ payPrice }} 时段: {{ period }} 场地信息:{{ orderInfo }}
</view>
<uni-card title="预约人信息" :border="false" :is-shadow="false"> <uni-card title="预约人信息" :border="false" :is-shadow="false">
<uv-cell-group :customStyle="{ backgroundColor: '#ffffff' }" :border="false"> <uv-cell-group :customStyle="{ backgroundColor: '#ffffff' }" :border="false">
<uv-cell title="真实姓名" :cellStyle="{ padding: '10px 5px' }" :border="false"> <uv-cell title="真实姓名" :cellStyle="{ padding: '10px 5px' }" :border="false">
<template v-slot:value> <template v-slot:value>
<text v-if="userInfo.realName">{{ userInfo.realName }}</text> <text v-if="form.name">{{ form.name }}</text>
<text v-else class="text-blue-500" @click="navTo(`/package/user/personal`)">点击完善</text> <text v-else class="text-blue-500" @click="navTo(`/package/user/personal`)">点击完善</text>
</template> </template>
</uv-cell> </uv-cell>
<uv-cell title="手机号码" :cellStyle="{ padding: '10px 5px' }" :value="userInfo.phone" :border="false" /> <uv-cell title="手机号码" :cellStyle="{ padding: '10px 5px' }" :value="form.phone" :border="false"/>
</uv-cell-group> </uv-cell-group>
</uni-card> </uni-card>
<uni-card title="订单信息" :border="false" :is-shadow="false" v-if="list.length">
<uni-card title="订单信息" :border="false" :is-shadow="false">
<uv-cell-group :customStyle="{ backgroundColor: '#ffffff' }" :border="false"> <uv-cell-group :customStyle="{ backgroundColor: '#ffffff' }" :border="false">
<block v-if="orderInfo.length == 0"> <block>
<span class="web-text-secondary">订单不存在</span> <uv-cell :title="`场馆`" :label="list[0].siteName" :cellStyle="{ padding: '10px 5px' }"/>
</block> <block v-for="(item, index) in list" :key="index">
<block v-if="orderInfo">
<uv-cell :title="`场馆`" :label="form.merchantName" :cellStyle="{ padding: '10px 5px' }" />
<block v-for="(item, index) in orderInfo" :key="index">
<uv-cell <uv-cell
:title="`${item.fieldName}`" :title="`${item.fieldName}`"
:label="`${item.dateTime} ${getWeek(this.week)} ${item.timePeriod}`" :label="`${item.dateTime} ${getWeek(this.week)} ${item.timePeriod}`"
@@ -63,15 +49,16 @@
</template> </template>
</uv-cell> --> </uv-cell> -->
<block v-for="(item,index) in radiolist" :key="index"> <block v-for="(item,index) in radiolist" :key="index">
<uv-cell iconStyle="checkbox-mark" :cellStyle="{ padding: '10px 5px' }" :border="false" v-if="childrenPrice > 0"> <uv-cell iconStyle="checkbox-mark" :cellStyle="{ padding: '10px 5px' }" :border="false"
v-if="childrenPrice > 0">
<template v-slot:title> <template v-slot:title>
<view class="flex"> <view class="flex">
<span style="margin-right: 40rpx;">{{ item.name }}</span> <span style="margin-right: 40rpx;">{{ item.name }}</span>
<block v-if="item.name == '成人票'"> <block v-if="item.name === '成人票'">
<span>¥{{ item.price }}</span> <span>¥{{ item.price }}</span>
<!-- <span style="padding-left:16rpx;"> x {{ carNum }}张</span> --> <!-- <span style="padding-left:16rpx;"> x {{ carNum }}张</span> -->
</block> </block>
<block v-if="item.name == '儿童票'"> <block v-if="item.name === '儿童票'">
<span>¥{{ item.price }}</span> <span>¥{{ item.price }}</span>
<!-- <span style="padding-left:16rpx;"> x {{ carNum2 }}张</span> --> <!-- <span style="padding-left:16rpx;"> x {{ carNum2 }}张</span> -->
</block> </block>
@@ -79,10 +66,12 @@
</template> </template>
<template v-slot:value> <template v-slot:value>
<view v-if="item.name === '成人票'"> <view v-if="item.name === '成人票'">
<uv-number-box :min="0" :max="1000" v-model="carNum" :disabled="orderId > 0" @change="onAdultNum"></uv-number-box> <uv-number-box :min="0" :max="1000" v-model="carNum" :disabled="orderId > 0"
@change="onAdultNum"></uv-number-box>
</view> </view>
<view v-if="item.name === '儿童票'"> <view v-if="item.name === '儿童票'">
<uv-number-box :min="0" :max="1000" v-model="carNum2" :disabled="orderId > 0" @change="onAdultNum2"></uv-number-box> <uv-number-box :min="0" :max="1000" v-model="carNum2" :disabled="orderId > 0"
@change="onAdultNum2"></uv-number-box>
</view> </view>
</template> </template>
</uv-cell> </uv-cell>
@@ -97,12 +86,12 @@
<uv-cell <uv-cell
:title="`${item.name}`" :title="`${item.name}`"
:icon="`${item.image}`" :icon="`${item.image}`"
:cellStyle="{ padding: '20rpx 10rpx', borderRadius: '8rpx', backgroundColor: item.type == payType ? '#f6fff1' : '' }" :cellStyle="{ padding: '20rpx 10rpx', borderRadius: '8rpx', backgroundColor: item.type === form.payType ? '#f6fff1' : '' }"
:border="false" :border="false"
@click="onPayType(item.type)" @click="onPayType(item.type)"
> >
<template v-slot:right-icon> <template v-slot:right-icon>
<uv-icon v-if="item.type == payType" size="30rpx" name="checkbox-mark"></uv-icon> <uv-icon v-if="item.type === form.payType" size="30rpx" name="checkbox-mark"></uv-icon>
</template> </template>
</uv-cell> </uv-cell>
</block> </block>
@@ -122,7 +111,8 @@
<view class="text" @click="onDisabled"> <view class="text" @click="onDisabled">
<text>同意以下服务条款</text> <text>同意以下服务条款</text>
<text class="link" @click.stop="navTo('/package/article/detail?articleId=501')">《广西体育中心预定条款》</text> <text class="link" @click.stop="navTo('/package/article/detail?articleId=501')">《广西体育中心预定条款》</text>
<text class="link" @click.stop="navTo('/package/article/detail?articleId=502')">《用户服务协议和隐私政策》</text> <text class="link" @click.stop="navTo('/package/article/detail?articleId=502')">《用户服务协议和隐私政策》
</text>
</view> </view>
</view> </view>
</view> </view>
@@ -144,14 +134,15 @@
</view> </view>
</view> </view>
<!-- 登录组件 --> <!-- 登录组件 -->
<ws-login ref="login" :logo="logo" @done="reload" /> <!-- <ws-login ref="login" :logo="logo" @done="reload" />-->
<!-- 支付密码弹窗 --> <!-- 支付密码弹窗 -->
<uni-popup ref="payPasswordForm" type="center" border-radius="10px 10px 0 0"> <uni-popup ref="payPasswordForm" type="center" border-radius="10px 10px 0 0">
<uni-card title="请输入支付密码" :border="false" :is-shadow="false" :padding="0"> <uni-card title="请输入支付密码" :border="false" :is-shadow="false" :padding="0">
<view class="pay-password-card"> <view class="pay-password-card">
<uni-forms ref="form" :label-width="80"> <uni-forms ref="form" :label-width="80">
<uni-forms-item label="支付密码" name="payPassword" required> <uni-forms-item label="支付密码" name="payPassword" required>
<uv-code-input mode="box" dot :space="0" :maxlength="6" hairline v-model="payPassword" @finish="onPayPassword"></uv-code-input> <uv-code-input mode="box" dot :space="0" :maxlength="6" hairline v-model="payPassword"
@finish="onPayPassword"></uv-code-input>
</uni-forms-item> </uni-forms-item>
<!-- <uv-button <!-- <uv-button
class="to-pay-btn" class="to-pay-btn"
@@ -172,15 +163,19 @@ import * as Api from '@/api/shop/order';
import * as UserApi from '@/api/booking/users'; import * as UserApi from '@/api/booking/users';
import * as UserCardApi from '@/api/booking/userCard'; import * as UserCardApi from '@/api/booking/userCard';
import * as PaymentApi from '@/api/system/payment'; import * as PaymentApi from '@/api/system/payment';
import { checkPayPassword } from '@/api/passport/login'; import {checkPayPassword} from '@/api/passport/login';
import { storeToRefs } from 'pinia'; import {storeToRefs} from 'pinia';
import { cal } from '@/utils/decimal'; import {cal} from '@/utils/decimal';
import { getWeek, getKey } from '@/utils/common'; import {getWeek, getKey} from '@/utils/common';
import { useCarStore } from '@/store/modules/car'; import {useCarStore} from '@/store/modules/car';
import { useUserStore } from '@/store/modules/user'; import {useUserStore} from '@/store/modules/user';
import dayjs from "dayjs";
import {addThinkOrder} from "@/api/think/thinkOrder";
import {listUserThinkCard} from "@/api/think/thinkCard";
const userStore = useUserStore(); const userStore = useUserStore();
const carStore = useCarStore(); // const carStore = useCarStore();
const { merchantId, merchantCode, 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 { export default {
data() { data() {
@@ -189,27 +184,33 @@ export default {
userInfo: {}, userInfo: {},
// 表单信息 // 表单信息
form: { form: {
cardId: 0, name: '',
payType: 1 phone: '',
sid: null,
cid: null,
vid: null,
code: null,
payType: null,
thinkOrderInfos: []
}, },
list: [],
// 支付方式 // 支付方式
payment: [], payment: [],
// 场馆信息 // 场馆信息
merchant, // merchant,
merchantId, // merchantId,
merchantCode, // merchantCode,
orderInfo, // orderInfo,
carNum, // carNum,
carNum2: 0, carNum2: 0,
week: 0, week: 0,
totalPrice, // totalPrice,
reducePrice: 0, reducePrice: 0,
payPrice, // payPrice,
childrenPrice, // childrenPrice,
period, // period,
cardId: 0, cardId: 0,
getWeek, getWeek,
payType: 1,
isLogin: false, isLogin: false,
disabled: false, disabled: false,
cardList: [], cardList: [],
@@ -236,18 +237,61 @@ export default {
disabled: false disabled: false
} }
], ],
radiovalue: '成人票' radiovalue: '成人票',
userCardList: []
}; };
}, },
onLoad(option) { async onLoad() {
if (option.id) { // if (option.id) {
this.orderId = option.id; // this.orderId = option.id;
this.form.orderId = option.id; // this.form.orderId = option.id;
// }
// this.reload();
// this.getUserCa"rd();
const eventChannel = this.getOpenerEventChannel();
const _this = this
this.userInfo = await userStore.fetchUserInfo();
eventChannel.on('data', function (data) {
_this.list = data
_this.payPrice = data.reduce((a, b) => a + b.price, 0)
const thinkOrderInfos = []
data.forEach(item => {
const [startTime, endTime] = item.timePeriod.split(' - ')
const mergeData = dayjs(item.dateTime).format('YYYY-MM-DD') + `${startTime}${endTime}${item.sid}${item.fieldId}`
thinkOrderInfos.push({
sid: item.sid,
fid: item.fieldId,
siteName: item.siteName,
fieldName: item.fieldName,
dateTime: item.comments,
adultNum: item.adultNum,
childrenNum: item.childrenNum,
type: item.type,
mergeData,
startTime: item.startTime,
timePeriod: item.dateTime,
siteTimeId: item.siteTimeId,
})
_this.form = {
name: _this.userInfo.realName,
phone: _this.userInfo.phone,
sid: data[0].sid,
cid: null,
vid: null,
code: null,
payType: 1,
thinkOrderInfos,
startTime: thinkOrderInfos.map(item => item.startTime).join()
} }
this.reload(); })
// this.getUserCard(); })
await this.getPayment()
await this.getUserCard()
}, },
onShow() { async onShow() {
this.userInfo = await userStore.fetchUserInfo();
this.form.name = this.userInfo.realName;
this.form.phone = this.userInfo.phone;
// 登录状态 // 登录状态
if (uni.getStorageSync('user_id') && uni.getStorageSync('access_token')) { if (uni.getStorageSync('user_id') && uni.getStorageSync('access_token')) {
this.isLogin = true; this.isLogin = true;
@@ -267,7 +311,7 @@ export default {
methods: { methods: {
async reload() { async reload() {
const app = this; const app = this;
const { form, orderId, merchant, totalPrice, orderInfo } = this; const {form, orderId, merchant, totalPrice, orderInfo} = this;
// 当前登录用户信息 // 当前登录用户信息
app.userInfo = await userStore.fetchUserInfo(); app.userInfo = await userStore.fetchUserInfo();
@@ -279,7 +323,7 @@ export default {
if (data) { if (data) {
app.hideUser = false; app.hideUser = false;
app.userInfo.money = data.money; app.userInfo.money = data.money;
console.log('money',app.userInfo.money) console.log('money', app.userInfo.money)
app.userInfo.ouid = data.userId; app.userInfo.ouid = data.userId;
app.userInfo = Object.assign({}, app.userInfo, data); app.userInfo = Object.assign({}, app.userInfo, data);
} }
@@ -308,11 +352,11 @@ export default {
app.payPrice = data.payPrice; app.payPrice = data.payPrice;
app.merchantId = data.merchantId; app.merchantId = data.merchantId;
app.childrenPrice = data.orderInfo[0].childrenPrice; app.childrenPrice = data.orderInfo[0].childrenPrice;
if(data.orderInfo[0].adultNum > 0){ if (data.orderInfo[0].adultNum > 0) {
app.radiovalue = '成人票' app.radiovalue = '成人票'
app.carNum = data.orderInfo[0].adultNum app.carNum = data.orderInfo[0].adultNum
} }
if(data.orderInfo[0].childrenNum > 0){ if (data.orderInfo[0].childrenNum > 0) {
app.radiovalue = '儿童票' app.radiovalue = '儿童票'
app.carNum = data.orderInfo[0].childrenNum app.carNum = data.orderInfo[0].childrenNum
} }
@@ -338,76 +382,61 @@ export default {
return d; return d;
}); });
if (userCard) {
// 整理表单字段
form.cardId = userCard.id;
form.payType = 2;
app.payType = 2;
// 1年卡
if (userCard.type == 1) {
}
// 2次卡
if (userCard.type == 2) {
}
// 3月卡
if (userCard.type == 3) {
}
// 4会员IC卡
if (userCard.type == 2) {
}
// 5充值卡
if (userCard.type == 5) {
// 折扣率
app.discount = cal.cheng(userCard.discount, 0.1);
// 订单金额
const orderPrice = totalPrice || form.totalPrice;
if (orderPrice) {
console.log('orderPrice: ', orderPrice);
// 折后金额
const lastTotalPrice = cal.cheng(orderPrice, app.discount);
console.log('折后金额: ', lastTotalPrice);
// 减少的金额
app.reducePrice = cal.jian(orderPrice, lastTotalPrice);
console.log('减少的金额: ', app.reducePrice);
// 实付额
app.payPrice = orderPrice * app.discount;
console.log('实付额: ', app.payPrice);
}
}
}
}); });
}, },
// 读取可用的会员卡 // 读取可用的会员卡
async getUserCard() { async getUserCard() {
const app = this; const res = await listUserThinkCard()
const { payPrice } = this if (res.length) {
return new Promise((resolve, reject) => { this.userCard = res
const { merchantId,merchantCode } = this; // if (this.userCard) {
UserCardApi.findUseCard({ // // 整理表单字段
sid: merchantCode, // form.cardId = userCard.id;
payPrice // form.payType = 2;
}) // app.payType = 2;
.then((result) => { //
resolve(result); // // 1年卡
}) // if (userCard.type == 1) {
.catch(reject); // }
}); //
// // 2次卡
// if (userCard.type == 2) {
// }
//
// // 3月卡
// if (userCard.type == 3) {
// }
//
// // 4会员IC卡
// if (userCard.type == 2) {
// }
// // 5充值卡
// if (userCard.type == 5) {
// // 折扣率
// app.discount = cal.cheng(userCard.discount, 0.1);
//
// // 订单金额
// const orderPrice = totalPrice || form.totalPrice;
// if (orderPrice) {
// console.log('orderPrice: ', orderPrice);
// // 折后金额
// const lastTotalPrice = cal.cheng(orderPrice, app.discount);
// console.log('折后金额: ', lastTotalPrice);
// // 减少的金额
// app.reducePrice = cal.jian(orderPrice, lastTotalPrice);
// console.log('减少的金额: ', app.reducePrice);
// // 实付额
// app.payPrice = orderPrice * app.discount;
// console.log('实付额: ', app.payPrice);
// }
// }
// }
}
}, },
// 读取支付方式列表 // 读取支付方式列表
getPayment() { async getPayment() {
const app = this; this.payment = await PaymentApi.select({status: true})
return new Promise((resolve, reject) => {
PaymentApi.select({ status: true })
.then((result) => {
resolve(result);
})
.catch(reject);
});
}, },
onDisabled() { onDisabled() {
this.disabled = !this.disabled; this.disabled = !this.disabled;
@@ -420,8 +449,8 @@ export default {
// 切换支付方式 // 切换支付方式
async onPayType(index) { async onPayType(index) {
const app = this; const app = this;
const { form, totalPrice, carNum, childrenPrice, radiovalue } = this; const {form, totalPrice, carNum, childrenPrice, radiovalue} = this;
app.payType = index; // app.payType = index;
app.form.payType = index; app.form.payType = index;
app.form.cardId = 0; app.form.cardId = 0;
@@ -462,8 +491,8 @@ export default {
return false; return false;
} }
this.disabledPayPayPassword = true; this.disabledPayPayPassword = true;
const { payPassword } = this; const {payPassword} = this;
checkPayPassword({ payPassword }) checkPayPassword({payPassword})
.then((res) => { .then((res) => {
this.disabledPayPayPassword = false; this.disabledPayPayPassword = false;
this.isPayPasswordCorrect = true; this.isPayPasswordCorrect = true;
@@ -495,25 +524,23 @@ export default {
app.countTotalPrice() app.countTotalPrice()
}, },
// 重新计算金额 // 重新计算金额
countTotalPrice(){ countTotalPrice() {
const app = this // const app = this
// 计算总金额 // // 计算总金额
let total; // let total;
const prices = []; // const prices = [];
app.orderInfo.map(d => { // app.orderInfo.map(d => {
prices.push(d.price * d.adultNum + d.childrenPrice * d.childrenNum); // prices.push(d.price * d.adultNum + d.childrenPrice * d.childrenNum);
}) // })
// 使用reduce方法进行累加 // // 使用reduce方法进行累加
const sum = prices.reduce((accumulator, currentValue) => accumulator + currentValue, 0); // const sum = prices.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
console.log(sum); // console.log(sum);
app.totalPrice = sum // app.totalPrice = sum
app.payPrice = sum // app.payPrice = sum
}, },
save() { save() {
const app = this; const app = this;
console.log('payPrice000: ',app.payPrice); const {form} = this;
console.log(carStore.payPrice)
const { form, merchant, orderInfo, totalPrice, payPrice } = this;
if (!this.disabled) { if (!this.disabled) {
uni.showToast({ uni.showToast({
title: '请先阅读并同意服务协议', title: '请先阅读并同意服务协议',
@@ -521,14 +548,14 @@ export default {
}); });
return false; return false;
} }
if (orderInfo.length == 0) { if (!form.name) {
uni.showToast({ uni.showToast({
title: '订单信息不存在', title: '请输入姓名',
icon: 'none' icon: 'none'
}); });
return false; return false;
} }
if (form.payType == 2 && !app.userCard) { if (form.payType === 2 && !app.userCard) {
uni.showToast({ uni.showToast({
title: '没有找到可用的会员卡', title: '没有找到可用的会员卡',
icon: 'none' icon: 'none'
@@ -536,7 +563,7 @@ export default {
return false; return false;
} }
if (form.payType == 0 && !this.isPayPasswordCorrect) { if (form.payType === 0 && !this.isPayPasswordCorrect) {
app.$refs.payPasswordForm.open('center'); app.$refs.payPasswordForm.open('center');
return false; return false;
} }
@@ -544,57 +571,11 @@ export default {
title: '订单提交中.' title: '订单提交中.'
}); });
// console.log('payPrice22: ',carStore.payPrice);
form.payPrice = app.payPrice;
form.totalPrice = app.payPrice;
form.reducePrice = app.reducePrice;
// console.log('form: ',form);
// console.log({
// type: 1,
// orderId: form.orderId,
// merchantId: form.merchantId,
// merchantName: form.merchantName,
// merchantCode: form.merchantCode,
// // 订单金额
// totalPrice,
// // 实付金额
// payPrice,
// // 预定场地信息
// orderInfo: form.orderInfo,
// comments: form.comments,
// // 微信支付
// payType: form.payType,
// // 下单日期
// dateTime: form.dateTime,
// // 会员卡ID
// cardId: form.cardId
// });
// return false
addThinkOrder(form)
Api.addOrder({
type: 1,
orderId: form.orderId,
merchantId: form.merchantId,
merchantName: form.merchantName,
merchantCode: form.merchantCode,
// 订单金额
totalPrice: app.payPrice,
// 实付金额
payPrice: app.payPrice,
// 预定场地信息
orderInfo: form.orderInfo,
comments: form.comments,
// 微信支付
payType: form.payType,
// 下单日期
dateTime: form.dateTime,
// 会员卡ID
cardId: form.cardId
})
.then((data) => { .then((data) => {
const orderInfo = data; const orderInfo = data;
console.log(data)
// 调起微信支付 // 调起微信支付
if (form.payType === 1) { if (form.payType === 1) {
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
@@ -613,14 +594,15 @@ export default {
}); });
setTimeout(function () { setTimeout(function () {
app.disabled = false; app.disabled = false;
uni.reLaunch({ // uni.reLaunch({
url: '/pages/order/order', // url: '/pages/order/order',
success: function (e) { // success: function (e) {
var page = getCurrentPages()[0]; // var page = getCurrentPages()[0];
if (page == undefined || page == null) return; // if (page == undefined || page == null) return;
page.onLoad(); // page.onLoad();
} // }
}); // });
uni.switchTab({url: '/pages/order'})
}, 1500); }, 1500);
}, },
fail: function (err) { fail: function (err) {
@@ -788,6 +770,7 @@ page {
} }
} }
} }
.pay-password-card { .pay-password-card {
width: 600rpx; width: 600rpx;
min-height: 300rpx; min-height: 300rpx;
@@ -798,11 +781,13 @@ page {
justify-content: center; justify-content: center;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
.web-text-primary { .web-text-primary {
line-height: 2rem; line-height: 2rem;
padding: 20rpx 0; padding: 20rpx 0;
} }
} }
.to-pay-btn { .to-pay-btn {
width: 400rpx !important; width: 400rpx !important;
margin: 40rpx auto; margin: 40rpx auto;
+1 -1
View File
@@ -152,7 +152,7 @@ export default {
}) })
}, },
async getDuration() { async getDuration() {
let url = `http://api.tianditu.gov.cn/drive?postStr={"orig":"${this.lng},${this.lat}","dest":"${this.merchant.lng},${this.merchant.lat}","style":"0"}&type=search&tk=71f234f251d4cb1feeb3c293a0f21709` let url = `https://api.tianditu.gov.cn/drive?postStr={"orig":"${this.lng},${this.lat}","dest":"${this.merchant.lng},${this.merchant.lat}","style":"0"}&type=search&tk=71f234f251d4cb1feeb3c293a0f21709`
const res = await request.get(url) const res = await request.get(url)
const x2js = new X2js(); const x2js = new X2js();
const {result} = x2js.xml2js(res.data) const {result} = x2js.xml2js(res.data)
+91 -170
View File
@@ -1,51 +1,38 @@
<template> <template>
<view class="container"> <view>
<!-- deBug信息 --> <!-- deBug信息 -->
<view class="web-debug web-text-success" style="display: none"> <uni-card title="" :border="false" :is-shadow="false" v-if="info">
场馆ID:{{ merchantId }} 场馆编号:{{ merchantCode }} 场馆名称:{{ merchantName }} 日期:{{ dateTime }} 星期:{{ week }} 订单总金额:{{ totalPrice }} 类型:{{ <view class="flex justify-between items-center w-100p p-20">
type <view class="flex justify-start items-center text-28 font-bold w-100p">
}} <view class="web-text-heading">
商品信息:{{ goodsList }} 表单信息:{{ form }} {{ info.name }}
</view> </view>
<view class="card-list"> <view class="ml-10" v-if="info.type === 1">{{
<view class="container" :style="{ background: `url(${form.image}) no-repeat center center`, backgroundSize: '100%', opacity: '0.85' }"> info.term
<view class="content web-cell web-cell-align-top"> }}年
<view class="merchant-avatar">
<uv-avatar :src="form.merchantAvatar" size="42" style="border: 3rpx solid #ffffff"></uv-avatar>
</view> </view>
<view class="card-info web-cell-content"> <view class="ml-10" v-if="info.type === 3">{{
<view class="title-bar"> info.month
<view class="web-text-heading" style="color: #ffffff; font-size: 17px; font-weight: 600">{{ form.cardName }}</view> }}个月
<block v-if="form.cardCode == '月/年卡'">
<view class="desc web-text-heading" style="color: #ffffff; font-size: 14px">{{ form.month }}个月</view>
</block>
<block v-if="form.cardCode == '次卡'">
<view class="desc web-text-heading" style="color: #ffffff; font-size: 14px">{{ form.number }}次</view>
</block>
<block v-if="form.cardCode == '充值卡'">
<view class="desc web-text-heading" style="color: #ffffff; font-size: 14px">{{ form.discount }}折</view>
</block>
</view> </view>
<view class="price"> <view v-if="info.type === 2" class="ml-10">
<view class="web-text-price"> {{ info.count }}次
<uv-avatar src="../../static/qrcode.png" size="30" shape="square"></uv-avatar> </view>
<view v-if="info.type === 4" class="ml-10">{{
info.discount
}}折
</view> </view>
</view> </view>
<text class="text-orange">{{ `¥${info.price}` }}</text>
</view> </view>
</view> </uni-card>
<view class="card-num">0000 0000 0000</view>
</view>
<!-- 登录组件 -->
<ws-login ref="login" :logo="logo" @done="reload" />
</view>
<uni-card title="会员卡说明" :border="false" :is-shadow="false"> <uni-card title="会员卡说明" :border="false" :is-shadow="false">
<view v-html="form.comments"></view> <view v-html="info.info"></view>
</uni-card> </uni-card>
<uni-card title="选择支付方式" :border="false" :is-shadow="false"> <uni-card title="选择支付方式" :border="false" :is-shadow="false">
<uv-cell-group :customStyle="{ backgroundColor: '#ffffff' }" :border="false"> <uv-cell-group :customStyle="{ backgroundColor: '#ffffff' }" :border="false">
<block v-for="(item, index) in payment" :key="index"></block>
<uv-cell <uv-cell
title="微信支付" title="微信支付"
icon="https://oss.wsdns.cn/20240511/8d7af0f0374040cb9b9255eff5fb812d.png?x-oss-process=image/resize,m_fixed,w_100,h_100/quality,Q_90" icon="https://oss.wsdns.cn/20240511/8d7af0f0374040cb9b9255eff5fb812d.png?x-oss-process=image/resize,m_fixed,w_100,h_100/quality,Q_90"
@@ -54,24 +41,23 @@
@click="onPayType(1)" @click="onPayType(1)"
> >
<template v-slot:right-icon> <template v-slot:right-icon>
<uv-icon v-if="payType == 1" size="30rpx" name="checkbox-mark"></uv-icon> <uv-icon v-if="payType === 1" size="30rpx" name="checkbox-mark"></uv-icon>
</template>
</uv-cell>
<uv-cell
:title="`余额支付(${userInfo.balance})`"
icon="https://oss.wsdns.cn/20240511/fae57a94fa0042b9bceb721421304db1.png?x-oss-process=image/resize,m_fixed,w_100,h_100/quality,Q_90"
:cellStyle="{ padding: '10px 5px', borderRadius: '8rpx', backgroundColor: payType == 0 ? '#f6fff1' : '' }"
:border="false"
@click="onPayType(0)"
>
<template v-slot:right-icon>
<uv-icon v-if="payType == 0" size="30rpx" name="checkbox-mark"></uv-icon>
</template> </template>
</uv-cell> </uv-cell>
<!-- <uv-cell v-if="userInfo"-->
<!-- :title="`余额支付(¥${userInfo.money})`"-->
<!-- icon="https://oss.wsdns.cn/20240511/fae57a94fa0042b9bceb721421304db1.png?x-oss-process=image/resize,m_fixed,w_100,h_100/quality,Q_90"-->
<!-- :cellStyle="{ padding: '10px 5px', borderRadius: '8rpx', backgroundColor: payType == 0 ? '#f6fff1' : '' }"-->
<!-- :border="false"-->
<!-- @click="onPayType(0)"-->
<!-- >-->
<!-- <template v-slot:right-icon>-->
<!-- <uv-icon v-if="payType == 0" size="30rpx" name="checkbox-mark"></uv-icon>-->
<!-- </template>-->
<!-- </uv-cell>-->
</uv-cell-group> </uv-cell-group>
<view slot="actions" class="card-actions"> <view slot="actions" class="card-actions">
<view class="card-actions-item" @click="actionsClick('分享')"> <view class="card-actions-item" @click="actionsClick('分享')">
<!-- <span class="web-text-danger">已优惠¥0.00</span> -->
<span class="web-text-heading">¥{{ form.price || 0.0 }}</span> <span class="web-text-heading">¥{{ form.price || 0.0 }}</span>
</view> </view>
</view> </view>
@@ -84,7 +70,8 @@
<view class="text" @click="onDisabled"> <view class="text" @click="onDisabled">
<text>同意以下服务条款</text> <text>同意以下服务条款</text>
<text class="link" @click.stop="navTo('/package/article/detail?articleId=501')">《广西体育中心预定条款》</text> <text class="link" @click.stop="navTo('/package/article/detail?articleId=501')">《广西体育中心预定条款》</text>
<text class="link" @click.stop="navTo('/package/article/detail?articleId=502')">《用户服务协议和隐私政策》</text> <text class="link" @click.stop="navTo('/package/article/detail?articleId=502')">《用户服务协议和隐私政策》
</text>
</view> </view>
</view> </view>
</view> </view>
@@ -128,7 +115,8 @@
</template> </template>
</uv-cell> </uv-cell>
</block> </block>
<uv-button class="add-address" :customStyle="{ borderRadius: '30px' }" text="收货地址管理" @click="navTo('/package/user/address')"></uv-button> <uv-button class="add-address" :customStyle="{ borderRadius: '30px' }" text="收货地址管理"
@click="navTo('/package/user/address')"></uv-button>
</uv-cell-group> </uv-cell-group>
</view> </view>
</view> </view>
@@ -155,20 +143,24 @@
</uni-card> </uni-card>
</uni-popup> </uni-popup>
<!-- 登录组件 --> <!-- 登录组件 -->
<ws-login ref="login" :logo="logo" @done="reload" /> <ws-login ref="login" :logo="logo" @done="getUserInfo"/>
</template> </template>
<script> <script>
import * as Api from '@/api/booking/card'; import * as Api from '@/api/booking/card';
import * as OrderApi from '@/api/shop/order'; import * as OrderApi from '@/api/shop/order';
import { checkPayPassword } from '@/api/passport/login'; import {checkPayPassword} from '@/api/passport/login';
import { storeToRefs } from 'pinia'; import {storeToRefs} from 'pinia';
import { getWeek, getKey } from '@/utils/common'; import {getWeek, getKey} from '@/utils/common';
import { useCarStore } from '@/store/modules/car'; import {useCarStore} from '@/store/modules/car';
import { useUserStore } from '@/store/modules/user'; import {useUserStore} from '@/store/modules/user';
import {getThinkVip} from "@/api/think/thinkVip";
import {thinkUserInfo} from "@/api/think/thinkUsers";
import {addThinkUsersVip} from "@/api/think/thinkUsersVip";
const userStore = useUserStore(); const userStore = useUserStore();
const carStore = useCarStore(); const carStore = useCarStore();
const { goodsList, totalPrice, carNum, merchantId, merchantName, merchantCode, type, dateTime } = storeToRefs(carStore); const {goodsList, totalPrice, carNum, merchantId, merchantName, merchantCode, type, dateTime} = storeToRefs(carStore);
export default { export default {
data() { data() {
@@ -177,6 +169,7 @@ export default {
goodsId: 0, goodsId: 0,
userInfo: {}, userInfo: {},
form: {}, form: {},
info: {},
address: {}, address: {},
addressList: [], addressList: [],
week: 0, week: 0,
@@ -199,7 +192,8 @@ export default {
}, },
onLoad(option) { onLoad(option) {
this.cardId = option.cardId; this.cardId = option.cardId;
this.reload(); // this.getUserInfo();
this.getCardInfo()
}, },
onShow() { onShow() {
// 登录状态 // 登录状态
@@ -209,33 +203,12 @@ export default {
this.openLogin(); this.openLogin();
}, },
methods: { methods: {
async reload() { async getCardInfo() {
const app = this; this.info = await getThinkVip(this.cardId)
const { cardId } = this; this.form.price = this.info.price
},
// 当前登录用户信息 async getUserInfo() {
const userInfo = await userStore.fetchUserInfo(); this.userInfo = await thinkUserInfo();
app.userInfo = userInfo;
Api.getCard(cardId).then((data) => {
app.form = data;
// console.log('res: ',res);
// app.addressList = res.list;
// const arr = res.list.filter((d) => d.isDefault === true);
// app.address = arr[0];
});
// if (cardId > 0) {
// Api.getOrder(cardId).then(data => {
// app.merchantId = data.merchantId
// app.merchantName = data.merchantName
// app.merchantCode = data.merchantCode
// app.payType = data.payType
// app.orderInfo = data.orderInfoList
// app.totalPrice = data.totalPrice
// app.dateTime = data.orderInfoList[0].dateTime
// })
// }
}, },
onDisabled() { onDisabled() {
this.disabled = !this.disabled; this.disabled = !this.disabled;
@@ -261,12 +234,12 @@ export default {
}, },
// 切换支付方式 // 切换支付方式
onPayType(index) { onPayType(index) {
console.log('e: ', index); if (index === 0 && this.userInfo.money <= 0) return uni.showToast({
title: '余额不足',
icon: 'none'
});
this.payType = index; this.payType = index;
}, },
openAddressList() {
this.$refs.addForm.open('center');
},
// 弹出登录提示框 // 弹出登录提示框
openLogin() { openLogin() {
if (!this.isLogin) { if (!this.isLogin) {
@@ -284,8 +257,8 @@ export default {
return false; return false;
} }
this.disabledPayPayPassword = true; this.disabledPayPayPassword = true;
const { payPassword } = this; const {payPassword} = this;
checkPayPassword({ payPassword }) checkPayPassword({payPassword})
.then((res) => { .then((res) => {
this.disabledPayPayPassword = false; this.disabledPayPayPassword = false;
this.isPayPasswordCorrect = true; this.isPayPasswordCorrect = true;
@@ -300,9 +273,6 @@ export default {
}); });
}, },
save() { save() {
const app = this;
const { form, payType } = this;
if (!this.disabled) { if (!this.disabled) {
uni.showToast({ uni.showToast({
title: '请先阅读并同意服务协议', title: '请先阅读并同意服务协议',
@@ -311,30 +281,16 @@ export default {
return false; return false;
} }
if (payType == 0 && !this.isPayPasswordCorrect) {
this.$refs.payPasswordForm.open('center');
return false;
}
uni.showLoading({ uni.showLoading({
title: '订单提交中.' title: '订单提交中.'
}); });
const app = this
OrderApi.addOrder({ addThinkUsersVip({
type: 2, // 0商城订单 1预定订单 2会员卡订单 vid: this.cardId,
cardId: form.cardId,
merchantId: form.merchantId,
merchantName: form.merchantName,
totalPrice: form.price,
payPrice: form.price,
comments: form.cardName,
payType
}) })
.then((data) => { .then((data) => {
console.log(data)
const orderInfo = data; const orderInfo = data;
// 调起微信支付
if (payType == 1) {
// #ifdef MP-WEIXIN
uni.requestPayment({ uni.requestPayment({
provider: orderInfo.provider, // 服务提供商 provider: orderInfo.provider, // 服务提供商
timeStamp: orderInfo.timeStamp, // 时间戳 timeStamp: orderInfo.timeStamp, // 时间戳
@@ -343,14 +299,13 @@ export default {
signType: orderInfo.signType, // 签名算法 signType: orderInfo.signType, // 签名算法
paySign: orderInfo.paySign, // 签名 paySign: orderInfo.paySign, // 签名
success: function (res) { success: function (res) {
// 业务逻辑。。。
uni.showToast({ uni.showToast({
title: '支付成功', title: '支付成功',
icon: 'success' icon: 'success'
}); });
setTimeout(function () { setTimeout(function () {
app.disabled = false; app.disabled = false;
uni.navigateTo({ uni.redirectTo({
url: '/package/user/card' url: '/package/user/card'
}); });
}, 500); }, 500);
@@ -360,32 +315,6 @@ export default {
app.disabled = false; app.disabled = false;
} }
}); });
// #endif
}
// 使用余额支付
if (payType == 0) {
if (orderInfo) {
uni.showToast({
title: '支付成功',
icon: 'success'
});
setTimeout(function () {
app.disabled = false;
uni.navigateTo({
url: '/package/user/card'
});
}, 500);
return;
}
if (!orderInfo) {
return uni.showToast({
title: '支付失败',
icon: 'error'
});
}
}
uni.hideLoading(); uni.hideLoading();
}) })
.catch((res) => { .catch((res) => {
@@ -438,41 +367,20 @@ page {
} }
} }
.card-list { .container {
.container { margin: 20rpx;
width: 700rpx;
position: relative; position: relative;
margin: 25rpx auto;
display: flex; display: flex;
justify-content: space-between; flex-direction: column;
align-items: center; justify-content: flex-start;
align-items: flex-start;
border-radius: 20rpx; border-radius: 20rpx;
position: relative; box-shadow: 0 0 6px 0 rgba(0, 0, 0, 0.2);
box-shadow: 0 0px 6px 0 rgba(0, 0, 0, 0.2); background-color: white;
// background: linear-gradient(to right, #70b915, #008e04); width: calc(100% - 40rpx);
color: #ffffff; }
.card-num {
position: absolute;
z-index: 1;
bottom: 30rpx;
left: 30rpx;
}
}
.container::before { .card-list {
content: '';
display: block;
position: absolute;
border-radius: 20rpx;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: #000000;
// background: url('https://oss.wsdns.cn/20240528/cf37a247603f489ba23d7d2a53b8da39.jpeg') no-repeat center bottom;
background-size: 100%;
opacity: 0.25; /* 设置透明度 */
}
.content { .content {
position: relative; position: relative;
@@ -481,10 +389,12 @@ page {
height: 380rpx; height: 380rpx;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
.merchant-avatar { .merchant-avatar {
margin-top: 30rpx; margin-top: 30rpx;
margin-left: 30rpx; margin-left: 30rpx;
} }
.card-info { .card-info {
height: 120rpx; height: 120rpx;
margin-top: 10rpx; margin-top: 10rpx;
@@ -492,21 +402,25 @@ page {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
.title-bar { .title-bar {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: space-between; justify-content: space-between;
align-items: flex-start; align-items: flex-start;
} }
.web-text-price { .web-text-price {
padding-right: 40rpx; padding-right: 40rpx;
font-size: 36rpx; font-size: 36rpx;
color: #fecc66; color: #fecc66;
} }
} }
.card-bg { .card-bg {
} }
} }
.card-item { .card-item {
width: 700rpx; width: 700rpx;
margin: 20rpx auto; margin: 20rpx auto;
@@ -514,6 +428,7 @@ page {
position: relative; position: relative;
// box-shadow: 0 0px 6px 1px rgba($color: #a5a5a5, $alpha: 0.2); // box-shadow: 0 0px 6px 1px rgba($color: #a5a5a5, $alpha: 0.2);
} }
// .card-item::before { // .card-item::before {
// content: ''; /* 伪元素需要内容,即使它是空的 */ // content: ''; /* 伪元素需要内容,即使它是空的 */
// position: absolute; // position: absolute;
@@ -547,6 +462,7 @@ page {
padding: 16px 0; padding: 16px 0;
} }
} }
.card-actions { .card-actions {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
@@ -571,10 +487,12 @@ page {
color: #666; color: #666;
margin-left: 5px; margin-left: 5px;
} }
.address-body { .address-body {
width: 660rpx; width: 660rpx;
margin: auto; margin: auto;
} }
.add-address { .add-address {
width: 600rpx !important; width: 600rpx !important;
margin: 40rpx auto; margin: 40rpx auto;
@@ -600,6 +518,7 @@ page {
margin-right: 20rpx; margin-right: 20rpx;
} }
} }
.xieyi { .xieyi {
margin-bottom: 80rpx; margin-bottom: 80rpx;
padding: 0 30rpx; padding: 0 30rpx;
@@ -623,11 +542,13 @@ page {
justify-content: center; justify-content: center;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
.web-text-primary { .web-text-primary {
line-height: 2rem; line-height: 2rem;
padding: 20rpx 0; padding: 20rpx 0;
} }
} }
.to-pay-btn { .to-pay-btn {
width: 400rpx !important; width: 400rpx !important;
margin: 40rpx auto; margin: 40rpx auto;
+70 -100
View File
@@ -1,32 +1,43 @@
<template> <template>
<view> <view>
<view class="segmented"> <view class="segmented">
<uni-segmented-control :current="current" :values="items" :styleType="styleType" :activeColor="activeColor" inActiveColor="#808080" @clickItem="onClickItem" /> <uni-segmented-control :current="current" :values="items" :styleType="styleType" :activeColor="activeColor"
inActiveColor="#808080" @clickItem="onClickItem"/>
</view> </view>
<view class="card-list"> <view class="card-list">
<block v-for="(item, index) in cardList" :key="index"> <block v-for="(group, groupIndex) in cardList" :key="groupIndex">
<view @click="openUrl('/package/card/checkout?cardId=' + item.cardId)" class="container" :style="{ background: `url(${item.image}) no-repeat center center`, backgroundSize: '100%', opacity: '0.85' }"> <view class="flex flex-col justify-start items-start">
<view class="content web-cell"> <view class="group-title">{{ group.siteNames }}</view>
<view class="merchant-avatar"> <view @click="openUrl(`/package/card/checkout?cardId=${item.id}`)" class="container"
<uv-avatar :src="item.merchantAvatar" size="36" style="border: 3rpx solid #ffffff"></uv-avatar> v-for="(item, index) in group.cardList" :key="index">
<view class="flex justify-between items-center w-100p p-20">
<view class="flex justify-start items-center text-28 font-bold w-100p">
<view class="web-text-heading">
{{ item.name }}
</view>
<view class="ml-10" v-if="item.type === 1">{{
item.term
}}年
</view>
<view class="ml-10" v-if="item.type === 3">{{
item.month
}}个月
</view>
<view v-if="item.type === 2" class="ml-10">
{{ item.count }}次
</view>
<view v-if="item.type === 4" class="ml-10">{{
item.discount
}}折
</view> </view>
<view class="card-info web-cell-content">
<view class="title-bar">
<view class="web-text-heading" style="color: #ffffff; font-size: 17px; font-weight: 600;">{{ item.cardName }}</view>
<block v-if="item.cardCode == '月/年卡'">
<view class="desc web-text-heading" style="color: #ffffff;font-size: 14px;">{{ item.month }}个月</view>
</block>
<block v-if="item.cardCode == '次卡'">
<view class="desc web-text-heading" style="color: #ffffff;font-size: 14px;">{{ item.number }}次</view>
</block>
<block v-if="item.cardCode == '充值卡'">
<view class="desc web-text-heading" style="color: #ffffff;font-size: 14px;">{{ item.discount }}折</view>
</block>
</view> </view>
<view class="price"> <view class="price">
<text class="web-text-price">{{ `¥${item.price}` }}</text> <text class="web-text-price">{{ `¥${item.price}` }}</text>
</view> </view>
</view> </view>
<view class="text-25 text-gray p-20">
{{ item.info }}
</view>
</view> </view>
</view> </view>
</block> </block>
@@ -51,15 +62,16 @@
</uni-card> </uni-card>
</block> </block>
<!-- 登录组件 --> <!-- 登录组件 -->
<ws-login ref="login" :logo="logo" @done="reload" /> <ws-login ref="login" :logo="logo" @done="reload"/>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import * as Api from '@/api/booking/card'; import * as Api from '@/api/booking/card';
import { pageWechatDeposit } from '@/api/shop/wechatDeposit'; import {pageWechatDeposit} from '@/api/shop/wechatDeposit';
import { getWeek, getKey } from '@/utils/common'; import {getWeek, getKey} from '@/utils/common';
import {listThinkVip, listThinkVipByGroup} from "@/api/think/thinkVip";
export default { export default {
components: {}, components: {},
@@ -71,7 +83,8 @@ export default {
where: { where: {
page: 1, page: 1,
cardCode: '月/年卡', cardCode: '月/年卡',
sceneType: 'showCanBuyVipCard' sceneType: 'showCanBuyVipCard',
type: 0
}, },
canReset: false, canReset: false,
loadMore: 'more', loadMore: 'more',
@@ -103,7 +116,8 @@ export default {
// 判断是否登录 // 判断是否登录
this.openLogin(); this.openLogin();
// 加载数据 // 加载数据
this.reload(); // this.reload();
this.getCardList()
console.log('判断是否刷新: ', option); console.log('判断是否刷新: ', option);
if (option.isRefresh) { if (option.isRefresh) {
this.isRefresh = true; this.isRefresh = true;
@@ -114,22 +128,29 @@ export default {
// 判断是否登录 // 判断是否登录
this.openLogin(); this.openLogin();
if (this.isRefresh) { if (this.isRefresh) {
this.reload(); // this.reload();
this.getCardList()
} }
}, },
// 触底函数 // 触底函数
onReachBottom() { onReachBottom() {
const app = this; const app = this;
const { where } = this; const {where} = this;
if (app.canReset) { if (app.canReset) {
app.where.page = ++where.page; app.where.page = ++where.page;
app.reload(); app.reload();
} }
}, },
methods: { methods: {
async getCardList() {
this.cardList = await listThinkVipByGroup({
type: this.where.type
})
},
reload() { reload() {
return;
const app = this; const app = this;
const { where, userId } = this; const {where, userId} = this;
if (userId == 0) { if (userId == 0) {
app.openLogin(); app.openLogin();
return; return;
@@ -165,30 +186,23 @@ export default {
app.hideTools = false; app.hideTools = false;
}); });
}, },
onClickItem(e, text) { onClickItem({currentIndex}) {
const app = this;
const { where, userId } = this;
const index = e.currentIndex;
if (this.current !== e.currentIndex) {
this.current = e.currentIndex;
}
// 全部 // 全部
if (index == 0) { if (currentIndex === 0) {
where.cardCode = '月/年卡'; this.where.type = 0;
} }
// 未支付 // 未支付
if (index == 1) { if (currentIndex === 1) {
where.cardCode = '次卡'; this.where.type = 2;
} }
// 已支付 // 已支付
if (index == 2) { if (currentIndex === 2) {
where.cardCode = '充值卡'; this.where.type = 4;
} }
this.where.page = 1;
this.cardList = []; this.cardList = [];
this.hideTools = true this.hideTools = true
this.reload(); this.getCardList();
}, },
openUrl(url) { openUrl(url) {
uni.navigateTo({ uni.navigateTo({
@@ -240,14 +254,11 @@ export default {
</script> </script>
<style lang="scss"> <style lang="scss">
.content { .group-title {
/* #ifndef APP-NVUE */ margin: 20rpx;
display: flex; padding-left: 20rpx;
/* #endif */ border-left: 10px solid #19be6b;
justify-content: center; font-size: 25rpx;
align-items: center;
height: 150px;
text-align: center;
} }
.segmented { .segmented {
@@ -270,18 +281,16 @@ export default {
.card-list { .card-list {
.container { .container {
width: 700rpx; margin: 20rpx;
height: 200rpx;
position: relative; position: relative;
margin: 25rpx auto;
display: flex; display: flex;
justify-content: space-between; flex-direction: column;
align-items: center; justify-content: flex-start;
align-items: flex-start;
border-radius: 20rpx; border-radius: 20rpx;
position: relative; box-shadow: 0 0 6px 0 rgba(0, 0, 0, 0.2);
box-shadow: 0 0px 6px 0 rgba(0, 0, 0, 0.2); background-color: white;
// background: linear-gradient(to right, #70b915, #008e04); width: calc(100% - 40rpx);
color: #ffffff;
} }
.container::before { .container::before {
@@ -293,60 +302,21 @@ export default {
left: 0; left: 0;
right: 0; right: 0;
bottom: 0; bottom: 0;
background: #000000;
// background: url('https://oss.wsdns.cn/20240528/cf37a247603f489ba23d7d2a53b8da39.jpeg') no-repeat center bottom;
background-size: 100%;
opacity: 0.25; /* 设置透明度 */
} }
.content {
position: relative;
z-index: 1;
width: 700rpx;
display: flex;
justify-content: space-between;
.merchant-avatar {
margin-left: 24rpx;
}
.card-info {
margin-left: 10rpx;
display: flex;
justify-content: space-between;
align-items: center;
.title-bar {
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: flex-start;
}
.web-text-price { .web-text-price {
padding-right: 30rpx; padding-right: 30rpx;
font-size: 36rpx; font-size: 36rpx;
color: #fecc66; color: #fecc66;
} }
}
.card-bg {
}
}
.card-item { .card-item {
width: 700rpx; width: 700rpx;
margin: 20rpx auto; margin: 20rpx auto;
border-radius: 20rpx; border-radius: 20rpx;
position: relative; position: relative;
// box-shadow: 0 0px 6px 1px rgba($color: #a5a5a5, $alpha: 0.2);
} }
// .card-item::before {
// content: ''; /* 伪元素需要内容,即使它是空的 */
// position: absolute;
// top: 0;
// right: 0;
// bottom: 0;
// left: 0;
// background: url('https://oss.wsdns.cn/20240528/d5680e18210544a49dfa79f250f1997d.jpeg');
// background-size: cover; /* 或其他你需要的背景大小 */
// opacity: 0.5; /* 设置透明度 */
// z-index: -1; /* 确保伪元素在内容之下 */
// }
.order-title { .order-title {
padding: 20rpx 0; padding: 20rpx 0;
+56 -80
View File
@@ -1,28 +1,15 @@
<template> <template>
<view class="order" v-if="form.id"> <view class="order" v-if="form.id">
<view class="qrcode" v-if="form.payStatus === 1 && form.orderStatus === 2"> <view class="qrcode" v-if="form.payStatus === 1 && form.orderStatus === 2">
<uv-image :src="`${IMG_URL}${form.qrcode}`" width="200" height="200" /> <uv-image :src="`${IMG_URL}${form.qrcode}`" width="200" height="200"/>
<!-- <uv-qrcode-->
<!-- ref="qrcode"-->
<!-- size="280rpx"-->
<!-- :options="{-->
<!-- data: form.orderNum,-->
<!-- foregroundImageSrc: form.merchantAvatar,-->
<!-- margin: 10,-->
<!-- foregroundImagePadding: 4,-->
<!-- foregroundImageHeight: 30,-->
<!-- foregroundImageWidth: 30,-->
<!-- foregroundImageBorderRadius: 4-->
<!-- }"-->
<!-- :value="`${h5_url}#/package/admin/order-scan?orderNo=${form.orderNum}`"-->
<!-- ></uv-qrcode>-->
<text class="web-text-secondary">核销码</text> <text class="web-text-secondary">核销码</text>
</view> </view>
<uni-card title="预定信息" :border="false" :is-shadow="false" :padding="0"> <uni-card title="预定信息" :border="false" :is-shadow="false" :padding="0">
<view class="order-body web-cell web-cell-align-top"> <view class="order-body web-cell web-cell-align-top">
<view class="web-cell-content"> <view class="web-cell-content">
<uv-cell-group :customStyle="{ backgroundColor: '#ffffff' }" :border="false"> <uv-cell-group :customStyle="{ backgroundColor: '#ffffff' }" :border="false">
<uv-cell :title="`${form.siteName}`" :label="` `" :cellStyle="{ padding: '0', paddingBottom: '5px' }" :border="false" /> <uv-cell :title="`${form.siteName}`" :label="` `" :cellStyle="{ padding: '0', paddingBottom: '5px' }"
:border="false"/>
<block v-for="(item, index) in form.thinkOrderInfos" :key="index"> <block v-for="(item, index) in form.thinkOrderInfos" :key="index">
<uv-cell <uv-cell
:title="`${item.fieldName}`" :title="`${item.fieldName}`"
@@ -31,8 +18,10 @@
:value="`¥${item.price}`" :value="`¥${item.price}`"
:border="item.isChildren === 1" :border="item.isChildren === 1"
/> />
<uv-cell :label="`成人票 ¥50`" :value="`x ${item.adultNum}`" v-if="item.isChildren === 1" :cellStyle="{ padding: '0', paddingBottom: '5px' }" :border="false" /> <uv-cell :label="`成人票 ¥50`" :value="`x ${item.adultNum}`" v-if="item.isChildren === 1"
<uv-cell :label="`儿童票 ¥35`" :value="`x ${item.childrenNum}`" v-if="item.isChildren === 1" :cellStyle="{ padding: '0', paddingBottom: '5px' }" :border="false" /> :cellStyle="{ padding: '0', paddingBottom: '5px' }" :border="false"/>
<uv-cell :label="`儿童票 ¥35`" :value="`x ${item.childrenNum}`" v-if="item.isChildren === 1"
:cellStyle="{ padding: '0', paddingBottom: '5px' }" :border="false"/>
</block> </block>
</uv-cell-group> </uv-cell-group>
</view> </view>
@@ -46,51 +35,56 @@
<uni-card :border="false" :is-shadow="false" :padding="0"> <uni-card :border="false" :is-shadow="false" :padding="0">
<view class="web-cell web-cell-align-top"> <view class="web-cell web-cell-align-top">
<uv-cell-group :customStyle="{ backgroundColor: '#ffffff', padding: '8px 0' }" :border="false"> <uv-cell-group :customStyle="{ backgroundColor: '#ffffff', padding: '8px 0' }" :border="false">
<uv-cell :title="`姓名`" :value="`${form.name}`" :cellStyle="{ padding: '8px' }" /> <uv-cell :title="`姓名`" :value="`${form.name}`" :cellStyle="{ padding: '8px' }"/>
<uv-cell :title="`手机号码`" :value="`${form.phone}`" :cellStyle="{ padding: '8px' }" /> <uv-cell :title="`手机号码`" :value="`${form.phone}`" :cellStyle="{ padding: '8px' }"/>
<uv-cell :title="`订单号`" :value="`${form.id}`" :cellStyle="{ padding: '8px' }" /> <uv-cell :title="`订单号`" :value="`${form.id}`" :cellStyle="{ padding: '8px' }"/>
<uv-cell :title="`订单编号`" :value="`${form.orderNum}`" :cellStyle="{ padding: '8px' }"" /> <uv-cell :title="`订单编号`" :value="`${form.orderNum}`" :cellStyle="{ padding: '8px' }"
" />
<uv-cell :title="`订单状态`" :cellStyle="{ padding: '8px' }"> <uv-cell :title="`订单状态`" :cellStyle="{ padding: '8px' }">
<template v-slot:value> <template v-slot:value>
<view v-if="form.payStatus === 0"> <view v-if="form.payStatus === 2">
<!-- <uv-count-down :time="form.timestamp" format="mm:ss"></uv-count-down> --> <!-- <uv-count-down :time="form.timestamp" format="mm:ss"></uv-count-down> -->
<span style="color: #ff0000">未支付</span> <span style="color: #ff0000">未支付</span>
</view> </view>
<view v-else>{{ orderStatus[form.orderStatus] }}</view> <view v-else>{{ orderStatus[form.orderStatus] }}</view>
</template> </template>
</uv-cell> </uv-cell>
<uv-cell :title="`下单时间`" :value="`${timeFormat(form.createTime,'yyyy-mm-dd hh:MM:ss')}`" :cellStyle="{ padding: '8px' }" /> <uv-cell :title="`下单时间`" :value="`${timeFormat(form.createTime,'yyyy-mm-dd hh:MM:ss')}`"
<uv-cell :title="`支付方式`" :value="`${payType[form.payType]}`" :cellStyle="{ padding: '8px' }" /> :cellStyle="{ padding: '8px' }"/>
<uv-cell :title="`优惠说明`" :value="`${form.desc ? form.desc : '无'}`" :cellStyle="{ padding: '8px' }" :border="false" /> <uv-cell :title="`支付方式`" :value="`${payType[form.payType]}`" :cellStyle="{ padding: '8px' }"/>
<uv-cell :title="`优惠说明`" :value="`${form.desc ? form.desc : '无'}`" :cellStyle="{ padding: '8px' }"
:border="false"/>
</uv-cell-group> </uv-cell-group>
</view> </view>
</uni-card> </uni-card>
</block> </block>
<uv-gap height="20"></uv-gap> <uv-gap height="20"></uv-gap>
<view class="checkout-car" v-if="form.payStatus == 0"> <view class="checkout-car" v-if="form.payStatus === 2">
<view class="car-total"> <view class="car-total">
<text style="color: #ebcf00">¥</text> <text style="color: #ebcf00">¥</text>
<uv-count-to decimals="2" duration="30" color="#ebcf00" bold :endVal="form.payPrice"></uv-count-to> <uv-count-to decimals="2" duration="30" color="#ebcf00" bold :endVal="form.totalPrice"></uv-count-to>
</view> </view>
<uv-button <uv-button
class="save-btn" class="save-btn"
:customStyle="{ background: 'linear-gradient(to right, #70b915, #008e04)', borderRadius: '0 30px 30px 0', color: '#ffffff', border: 'none', padding: '22px 30px' }" :customStyle="{ background: 'linear-gradient(to right, #70b915, #008e04)', borderRadius: '0 30px 30px 0', color: '#ffffff', border: 'none', padding: '22px 30px' }"
text="去支付" text="立即支付"
@click="navTo(`/package/booking/confirm?id=${form.orderId}`)" @click="openPay"
></uv-button> ></uv-button>
</view> </view>
<!-- 登录组件 --> <!-- 登录组件 -->
<ws-login ref="login" :logo="logo" @done="reload" /> <ws-login ref="login" :logo="logo" @done="reload"/>
</view> </view>
</template> </template>
<script> <script>
import * as OrderApi from '@/api/think/thinkOrder'; import * as OrderApi from '@/api/think/thinkOrder';
import { IMG_URL } from '@/config/setting'; import {IMG_URL} from '@/config/setting';
import { pageThinkWechatDeposit } from '@/api/think/thinkWechatDeposit'; import {pageThinkWechatDeposit} from '@/api/think/thinkWechatDeposit';
import UvImage from "@/uni_modules/uv-image/components/uv-image/uv-image.vue"; import UvImage from "@/uni_modules/uv-image/components/uv-image/uv-image.vue";
import {timeFormat} from "@/uni_modules/uv-ui-tools/libs/function"; import {timeFormat} from "@/uni_modules/uv-ui-tools/libs/function";
import { copyText, openUrl } from '@/utils/common'; import {copyText, openUrl} from '@/utils/common';
import {thinkUsersVipRepay} from "@/api/think/thinkUsersVip";
import {thinkOrderRepay} from "@/api/think/thinkOrder";
export default { export default {
components: {UvImage}, components: {UvImage},
@@ -163,7 +157,7 @@ export default {
// 触底函数 // 触底函数
onReachBottom() { onReachBottom() {
const app = this; const app = this;
const { where } = this; const {where} = this;
if (app.canReset) { if (app.canReset) {
app.where.page = ++where.page; app.where.page = ++where.page;
app.reload(); app.reload();
@@ -173,7 +167,7 @@ export default {
timeFormat, timeFormat,
reload() { reload() {
const app = this; const app = this;
const { where, userId, orderId } = this; const {where, userId, orderId} = this;
if (!uni.getStorageSync('user_id')) { if (!uni.getStorageSync('user_id')) {
app.openLogin(); app.openLogin();
return; return;
@@ -183,7 +177,6 @@ export default {
title: '数据读取中.' title: '数据读取中.'
}); });
OrderApi.getThinkOrder(orderId).then((data) => { OrderApi.getThinkOrder(orderId).then((data) => {
console.log('data909090: ', data);
app.form = data; app.form = data;
// 页面标题 // 页面标题
@@ -210,49 +203,6 @@ export default {
url url
}); });
}, },
onCopyText(text){
copyText(text);
},
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) {
pageThinkWechatDeposit({
uid: uni.getStorageSync('uid')
}).then((res) => {
console.log('res: ', res);
app.orderList = res.list;
});
return false;
}
this.reload();
},
// 弹出登录提示框 // 弹出登录提示框
async openLogin() { async openLogin() {
this.userId = uni.getStorageSync('user_id'); this.userId = uni.getStorageSync('user_id');
@@ -260,7 +210,33 @@ export default {
this.$refs.login.open('bottom'); this.$refs.login.open('bottom');
return false; return false;
} }
},
async openPay() {
const orderInfo = await thinkOrderRepay({id: this.orderId})
const _this = this
uni.requestPayment({
provider: orderInfo.provider, // 服务提供商
timeStamp: orderInfo.timeStamp, // 时间戳
nonceStr: orderInfo.nonceStr, // 随机字符串
package: orderInfo.package,
signType: orderInfo.signType, // 签名算法
paySign: orderInfo.paySign, // 签名
success: function (res) {
// 业务逻辑。。。
uni.showToast({
title: '支付成功',
icon: 'success'
});
setTimeout(function () {
_this.reload()
}, 1500);
},
fail: function (err) {
console.log('支付失败', err);
} }
})
}
} }
}; };
</script> </script>
+335
View File
@@ -0,0 +1,335 @@
<template>
<view v-if="orderInfo">
<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="`${orderInfo.siteNames}`" :label="orderInfo.name" :cellStyle="{ padding: '0', paddingBottom: '5px' }"
:border="false"/>
</uv-cell-group>
</view>
</view>
<view slot="actions" class="card-actions">
<view class="web-text-heading text-orange">合计:¥{{ orderInfo.price }}</view>
</view>
</uni-card>
<uni-card title="会员卡详情" :border="false" :is-shadow="false" :padding="0">
<view class="order-body web-cell web-cell-align-top">
<view>{{ orderInfo.info }}</view>
</view>
</uni-card>
<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="`${orderInfo.wechatOrder}`" :cellStyle="{ padding: '8px' }"/>
<uv-cell :title="`支付状态`" :cellStyle="{ padding: '8px' }">
<template v-slot:value>
<view v-if="orderInfo.status === 0" class="text-25 text-red">已取消</view>
<view v-else-if="orderInfo.status === 1" class="text-25 text-green">已支付</view>
<view v-else-if="orderInfo.status === 2" class="text-25 text-gray">未支付</view>
<view v-else-if="orderInfo.status === 3" class="text-25 text-gray">已退款</view>
</template>
</uv-cell>
<uv-cell :title="`下单时间`" :value="`${timeFormat(orderInfo.createTime,'yyyy-mm-dd hh:MM:ss')}`"
:cellStyle="{ padding: '8px' }"/>
<uv-cell :title="`到期时间`" :value="`${timeFormat(orderInfo.expireTime,'yyyy-mm-dd hh:MM:ss')}`"
:cellStyle="{ padding: '8px' }"/>
</uv-cell-group>
</view>
</uni-card>
<uv-gap height="20"></uv-gap>
<view class="checkout-car" v-if="orderInfo.status === 2">
<view class="car-total">
<text style="color: #ebcf00">¥</text>
<uv-count-to decimals="2" duration="30" color="#ebcf00" bold :endVal="orderInfo.price"></uv-count-to>
</view>
<uv-button
class="save-btn"
:customStyle="{ background: 'linear-gradient(to right, #70b915, #008e04)', borderRadius: '0 30px 30px 0', color: '#ffffff',
border: 'none', padding: '22px 30px' }"
text="立即支付"
@click="openPay"
></uv-button>
</view>
<!-- 登录组件 -->
<ws-login ref="login" :logo="logo" @done="reload"/>
</view>
</template>
<script>
import UvImage from "@/uni_modules/uv-image/components/uv-image/uv-image.vue";
import {timeFormat} from "@/uni_modules/uv-ui-tools/libs/function";
import {getThinkUsersVip, thinkUsersVipRepay} from "@/api/think/thinkUsersVip";
export default {
components: {UvImage},
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',
orderInfo: null
};
},
onLoad(option) {
this.orderId = option.id;
// 判断是否登录
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: {
timeFormat,
async reload() {
const app = this;
const {where, userId, orderId} = this;
if (!uni.getStorageSync('user_id')) {
app.openLogin();
return;
}
uni.showLoading({
title: '数据读取中.'
});
this.orderInfo = await getThinkUsersVip(this.orderId).catch(({message}) => {
uni.hideLoading()
uni.showToast({
title: message,
icon: 'none'
});
setTimeout(() => {
uni.navigateBack()
}, 1500)
})
uni.hideLoading()
},
async openPay() {
const orderInfo = await thinkUsersVipRepay({id: this.orderId})
const _this = this
uni.requestPayment({
provider: orderInfo.provider, // 服务提供商
timeStamp: orderInfo.timeStamp, // 时间戳
nonceStr: orderInfo.nonceStr, // 随机字符串
package: orderInfo.package,
signType: orderInfo.signType, // 签名算法
paySign: orderInfo.paySign, // 签名
success: function (res) {
// 业务逻辑。。。
uni.showToast({
title: '支付成功',
icon: 'success'
});
setTimeout(function () {
_this.reload()
}, 1500);
},
fail: function (err) {
console.log('支付失败', err);
}
})
}
,
// 弹出登录提示框
async 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-between;
background-color: #000000;
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>
+32 -15
View File
@@ -13,24 +13,32 @@
:style="{ background: `url(https://oss.wsdns.cn/20240920/5e3327e1ad97472e942c824ab1776f52.jpg?x-oss-process=image/resize,m_fixed,w_750/quality,Q_90) no-repeat center center`, backgroundSize: '100%', opacity: '0.85' }" :style="{ background: `url(https://oss.wsdns.cn/20240920/5e3327e1ad97472e942c824ab1776f52.jpg?x-oss-process=image/resize,m_fixed,w_750/quality,Q_90) no-repeat center center`, backgroundSize: '100%', opacity: '0.85' }"
> >
<view class="content web-cell"> <view class="content web-cell">
<!-- <view class="merchant-avatar">--> <!-- <view class="merchant-avatar">-->
<!-- <uv-avatar :src="item.merchantAvatar" size="36" style="border: 3rpx solid #ffffff"></uv-avatar>--> <!-- <uv-avatar :src="item.merchantAvatar" size="36" style="border: 3rpx solid #ffffff"></uv-avatar>-->
<!-- </view>--> <!-- </view>-->
<view class="card-info web-cell-content"> <view class="card-info web-cell-content">
<view class="title-bar"> <view class="title-bar">
<view class="web-text-heading" style="color: #ffffff; font-size: 20px; font-weight: 600">{{ item.name }}</view> <view class="web-text-heading" style="color: #ffffff; font-size: 20px; font-weight: 600">{{
item.name
}}
</view>
<view class="desc py-3" style="text-align: left;"> <view class="desc py-3" style="text-align: left;">
{{ item.siteNames }} {{ item.siteNames }}
</view> </view>
<!-- <block v-if="item.type == 2"> <!-- <block v-if="item.type == 2">
<view class="desc web-text-heading" style="color: #ffffff; font-size: 14px">{{ item.month }}个月</view> <view class="desc web-text-heading" style="color: #ffffff; font-size: 14px">{{ item.month }}个月</view>
</block> --> </block> -->
<block v-if="item.type == 2"> <view v-if="item.type === 2" class="desc web-text-heading" style="color: #ffffff; font-size: 14px">剩余{{
<view class="desc web-text-heading" style="color: #ffffff; font-size: 14px">剩余{{ item.number }}次</view> item.number
</block> }}次
<block v-if="item.type == 1 || item.type == 3 || item.type == 5"> </view>
<view class="desc web-text-heading" style="color: #ffffff; font-size: 14px">余额¥{{ item.remainingMoney }}</view> <view v-if="item.type === 5" class="desc web-text-heading" style="color: #ffffff; font-size: 14px">余额¥{{
</block> item.remainingMoney
}}
</view>
<view class="desc web-text-heading" v-if="item.type === 1 || item.type === 3" style="color: #ffffff; font-size: 14px">
{{ dayjs(item.expireTime * 1000).format('YYYY-MM-DD HH:mm') }}过期
</view>
</view> </view>
<!-- <view class="price"> <!-- <view class="price">
<text class="web-text-price">{{ `¥${item.price}` }}</text> <text class="web-text-price">{{ `¥${item.price}` }}</text>
@@ -60,7 +68,7 @@
</uni-card> </uni-card>
</block> </block>
<!-- 登录组件 --> <!-- 登录组件 -->
<ws-login ref="login" :logo="logo" @done="reload" /> <ws-login ref="login" :logo="logo" @done="reload"/>
</view> </view>
<view v-if="!hideTools && cardList.length == 0"> <view v-if="!hideTools && cardList.length == 0">
<uv-empty mode="list" icon="https://cdn.uviewui.com/uview/empty/list.png"></uv-empty> <uv-empty mode="list" icon="https://cdn.uviewui.com/uview/empty/list.png"></uv-empty>
@@ -70,7 +78,8 @@
<script> <script>
import * as Api from '@/api/think/thinkUsersVip'; import * as Api from '@/api/think/thinkUsersVip';
import { getWeek, getKey } from '@/utils/common'; import {getWeek, getKey} from '@/utils/common';
import dayjs from "dayjs";
export default { export default {
components: {}, components: {},
@@ -129,16 +138,17 @@ export default {
// 触底函数 // 触底函数
onReachBottom() { onReachBottom() {
const app = this; const app = this;
const { where } = this; const {where} = this;
if (app.canReset) { if (app.canReset) {
app.where.page = ++where.page; app.where.page = ++where.page;
app.reload(); app.reload();
} }
}, },
methods: { methods: {
dayjs,
reload() { reload() {
const app = this; const app = this;
const { where, userId } = this; const {where, userId} = this;
if (userId === 0) { if (userId === 0) {
app.openLogin(); app.openLogin();
return; return;
@@ -176,7 +186,7 @@ export default {
}, },
onClickItem(e, text) { onClickItem(e, text) {
const app = this; const app = this;
const { where, userId } = this; const {where, userId} = this;
const index = e.currentIndex; const index = e.currentIndex;
if (this.current !== e.currentIndex) { if (this.current !== e.currentIndex) {
this.current = e.currentIndex; this.current = e.currentIndex;
@@ -313,29 +323,35 @@ export default {
width: 700rpx; width: 700rpx;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
.merchant-avatar { .merchant-avatar {
margin-left: 24rpx; margin-left: 24rpx;
} }
.card-info { .card-info {
margin-left: 10rpx; margin-left: 10rpx;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
.title-bar { .title-bar {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: space-between; justify-content: space-between;
align-items: flex-start; align-items: flex-start;
} }
.web-text-price { .web-text-price {
padding-right: 30rpx; padding-right: 30rpx;
font-size: 36rpx; font-size: 36rpx;
color: #fecc66; color: #fecc66;
} }
} }
.card-bg { .card-bg {
} }
} }
.card-item { .card-item {
width: 700rpx; width: 700rpx;
margin: 20rpx auto; margin: 20rpx auto;
@@ -343,6 +359,7 @@ export default {
position: relative; position: relative;
// box-shadow: 0 0px 6px 1px rgba($color: #a5a5a5, $alpha: 0.2); // box-shadow: 0 0px 6px 1px rgba($color: #a5a5a5, $alpha: 0.2);
} }
// .card-item::before { // .card-item::before {
// content: ''; /* 伪元素需要内容,即使它是空的 */ // content: ''; /* 伪元素需要内容,即使它是空的 */
// position: absolute; // position: absolute;
+9 -3
View File
@@ -106,11 +106,12 @@
const app = this const app = this
// 当前登录用户信息 // 当前登录用户信息
const userInfo = await userStore.fetchUserInfo(); const userInfo = await userStore.fetchUserInfo();
this.userInfo = userInfo
if (Object.keys(userInfo).length > 0) { if (Object.keys(userInfo).length > 0) {
app.isLogin = true app.isLogin = true
app.form = userInfo app.form = userInfo
// 获取用户副表信息 // 获取用户副表信息
UserApi.getThinkUsers(uni.getStorageSync('uid')).then(data => { UserApi.getThinkUsers(userInfo.uid).then(data => {
if (data) { if (data) {
app.form = Object.assign({}, app.form, data); app.form = Object.assign({}, app.form, data);
} }
@@ -159,8 +160,13 @@
}) })
return false return false
} }
const formData = {
UserApi.updateThinkUsers(this.form).then(res => { id: this.form.id,
idcard: this.form.idcard,
truename: this.form.truename,
userId: this.userInfo.userId
}
UserApi.updateThinkUsers(formData).then(res => {
uni.showToast({ uni.showToast({
title: '保存成功', title: '保存成功',
icon: 'success' icon: 'success'
+6
View File
@@ -284,6 +284,12 @@
"navigationBarTitleText": "订单详情" "navigationBarTitleText": "订单详情"
} }
}, },
{
"path": "order/vipDetail",
"style": {
"navigationBarTitleText": "订单详情"
}
},
{ {
"path": "course/index", "path": "course/index",
"style": { "style": {
+30 -30
View File
@@ -34,36 +34,36 @@
</block> </block>
</block> </block>
<view class="card-title web-text-heading">热门项目</view> <!-- <view class="card-title web-text-heading">热门项目</view>-->
<block v-if="itemList.length > 0"> <!-- <block v-if="itemList.length > 0">-->
<view class="item-list"> <!-- <view class="item-list">-->
<uni-grid :column="5" :highlight="true" :showBorder="false" @change="onItem"> <!-- <uni-grid :column="5" :highlight="true" :showBorder="false" @change="onItem">-->
<uni-grid-item v-for="(item, index) in itemList" :index="index" :key="index"> <!-- <uni-grid-item v-for="(item, index) in itemList" :index="index" :key="index">-->
<view <!-- <view-->
class="grid-item-box" <!-- class="grid-item-box"-->
style=" <!-- style="-->
background-color: #ffffff; <!-- background-color: #ffffff;-->
margin: 10rpx; <!-- margin: 10rpx;-->
border-radius: 10rpx; <!-- border-radius: 10rpx;-->
display: flex; <!-- display: flex;-->
flex-direction: column; <!-- flex-direction: column;-->
justify-content: center; <!-- justify-content: center;-->
align-items: center; <!-- align-items: center;-->
height: 5rem; <!-- height: 5rem;-->
" <!-- "-->
> <!-- >-->
<uv-avatar :src="item.image" :size="27" shape="square" fontSize="16" randomBgColor></uv-avatar> <!-- <uv-avatar :src="item.image" :size="27" shape="square" fontSize="16" randomBgColor></uv-avatar>-->
<text class="text">{{ item.name }}</text> <!-- <text class="text">{{ item.name }}</text>-->
</view> <!-- </view>-->
</uni-grid-item> <!-- </uni-grid-item>-->
</uni-grid> <!-- </uni-grid>-->
</view> <!-- </view>-->
</block> <!-- </block>-->
<block v-else> <!-- <block v-else>-->
<uni-card :border="false" :padding="'12px 4px'"> <!-- <uni-card :border="false" :padding="'12px 4px'">-->
<uv-skeleton rows="2" avatar :loading="hideTools" :title="false"></uv-skeleton> <!-- <uv-skeleton rows="2" avatar :loading="hideTools" :title="false"></uv-skeleton>-->
</uni-card> <!-- </uni-card>-->
</block> <!-- </block>-->
<!-- 商户列表 --> <!-- 商户列表 -->
<view class="card-title web-text-heading">场地预定</view> <view class="card-title web-text-heading">场地预定</view>
+259 -100
View File
@@ -1,21 +1,38 @@
<template> <template>
<view> <view>
<view class="segmented"> <!-- <view class="segmented">-->
<uni-segmented-control :current="current" :values="items" :styleType="styleType" :activeColor="activeColor" <!-- <uni-segmented-control :current="current" :values="items" :styleType="styleType" :activeColor="activeColor"-->
inActiveColor="#808080" @clickItem="onClickItem"/> <!-- inActiveColor="#808080" @clickItem="onClickItem"/>-->
<!-- </view>-->
<uv-sticky>
<view class="flex justify-center items-center p-10">
<view class="flex-2 mx-15 flex justify-center" @click="openOrderTypePicker">
<uv-icon name="arrow-down" :label="orderTypeStr" label-pos="left"/>
</view> </view>
<view class="flex-2 mx-15 flex justify-center" @click="openOrderStatusPicker">
<uv-icon name="arrow-down" :label="orderStatusStr" label-pos="left"/>
</view>
<view class="flex-1 mx-15 flex justify-center" @click="reset">
<text class="text-24 text-blue">重置</text>
</view>
</view>
</uv-sticky>
<view class="order"> <view class="order">
<block v-if="orderList.length > 0"> <block v-if="orderList.length > 0">
<block v-for="(item,index) in orderList" :key="index"> <block v-for="(item,index) in orderList" :key="index">
<uni-card :border="false" :is-shadow="false" :padding="0"> <uni-card :border="false" :is-shadow="false" :padding="0">
<template v-slot:title> <template v-slot:title>
<div class="order-title web-cell"> <div class="order-title web-cell">
<view class="web-cell web-cell-content"> <view class="web-cell web-cell-content" v-if="orderType === 0">
<view class="merchant-avatar">
<uv-avatar :src="item.merchantAvatar" size="24"></uv-avatar>
</view>
<text class="merchant-name">{{ item.siteName }}</text> <text class="merchant-name">{{ item.siteName }}</text>
</view> </view>
<view class="web-cell web-cell-content flex justify-between items-center" v-if="orderType === 1">
<text class="merchant-name">{{ item.siteNames }}</text>
<text class="text-25 text-red" v-if="item.status === 2">待支付</text>
<text class="text-25 text-green" v-else-if="item.status === 1">已支付</text>
<text class="text-25 text-gray" v-else-if="item.status === 3">已退款</text>
<text class="text-25 text-gray" v-else-if="item.status === 0">已取消</text>
</view>
<block v-if="item.orderStatus === 3"> <block v-if="item.orderStatus === 3">
<text class="btn-status web-text-secondary">已取消</text> <text class="btn-status web-text-secondary">已取消</text>
</block> </block>
@@ -32,29 +49,34 @@
</div> </div>
</template> </template>
<view class="order-body web-cell web-cell-align-top"> <view class="order-body web-cell web-cell-align-top">
<view class="web-cell-content"> <view class="web-cell-content" @click="toDetail(item.id)">
<uv-cell-group :customStyle="{backgroundColor: '#ffffff'}" :border="false"> <uv-cell-group :customStyle="{backgroundColor: '#ffffff'}" :border="false" v-if="orderType === 0">
<block v-for="(sub,subIndex) in item.thinkOrderInfos" :key="subIndex"> <block v-for="(sub,subIndex) in item.thinkOrderInfos" :key="subIndex">
<uv-cell :title="`${item.siteName} - ${sub.fieldName}`" :label="`${sub.dateTime}`" <uv-cell :title="`${item.siteName} - ${sub.fieldName}`" :label="`${sub.dateTime}`"
:cellStyle="{padding: '0', paddingBottom: '5px'}" :border="false" :cellStyle="{padding: '0', paddingBottom: '5px'}" :border="false"/>
@click="openUrl(`/package/order/detail?id=${item.id}`)"/>
</block> </block>
</uv-cell-group> </uv-cell-group>
<view class="total-price"> <uv-cell-group :customStyle="{backgroundColor: '#ffffff'}" :border="false" v-else-if="orderType === 1">
<uv-cell :title="item.name"
:cellStyle="{padding: '0', paddingBottom: '5px'}" :border="false">
</uv-cell>
</uv-cell-group>
<view class="total-price" v-if="orderType === 0">
<view class="web-text-heading">合计:¥{{ item.totalPrice }}</view> <view class="web-text-heading">合计:¥{{ item.totalPrice }}</view>
<view class="web-text-heading" style="font-weight: 500;">
实付:¥{{ item.payPrice }}
</view> </view>
<view class="total-price" v-else-if="orderType === 1">
<view class="web-text-heading">合计:¥{{ item.price }}</view>
</view> </view>
</view> </view>
</view> </view>
<view slot="actions" class="card-actions"> <view slot="actions" class="card-actions">
<template v-if="orderType === 0">
<view class="card-actions-item" v-if="item.payStatus === 2 && item.orderStatus === 2"> <view class="card-actions-item" v-if="item.payStatus === 2 && item.orderStatus === 2">
<button class="mini-btn" size="mini" @click="closeOrder(item)" <button class="mini-btn" size="mini" @click="closeOrder(item)"
style="margin-right: 20rpx;">{{ item.payStatus }}取消订单{{item.orderStatus}} style="margin-right: 20rpx;">取消订单
</button> </button>
<button class="mini-btn" type="primary" size="mini" <button class="mini-btn" type="primary" size="mini"
@click="toPay(item.orderId)">去支付 @click="openPayOrder(item.id)">立即支付
</button> </button>
</view> </view>
<view class="card-actions-item" v-if="item.payStatus == 1"> <view class="card-actions-item" v-if="item.payStatus == 1">
@@ -63,39 +85,57 @@
</button> </button>
<button class="mini-btn" size="mini" v-else @click="showInvoice(item.id)">查看发票</button> <button class="mini-btn" size="mini" v-else @click="showInvoice(item.id)">查看发票</button>
</view> </view>
</template>
<template v-else-if="orderType === 1">
<view class="card-actions-item" v-if="item.status === 2">
<button class="mini-btn" size="mini" @click="closeVipOrder(item)"
style="margin-right: 20rpx;">取消订单
</button>
<button class="mini-btn" type="primary" size="mini"
@click="openPay(item.id)">立即支付
</button>
</view>
<view class="card-actions-item" v-if="item.status === 1">
<button class="mini-btn" size="mini" v-if="item.isInvoice === 2" @click="onInvoice(item.id)">
申请开票
</button>
<button class="mini-btn" size="mini" v-else @click="showInvoice(item.id)">查看发票</button>
</view>
</template>
</view> </view>
</uni-card> </uni-card>
</block> </block>
</block> </block>
<!-- <block v-if="orderList.length === 0 && loadMore != 'no-more'">--> <!-- <block v-if="orderList.length === 0 && loadMore != 'no-more'">-->
<!-- <uni-card :border="false" :padding="'18px 6px'">--> <!-- <uni-card :border="false" :padding="'18px 6px'">-->
<!-- <uv-skeleton rows="3" avatar :loading="hideTools" :title="false">--> <!-- <uv-skeleton rows="3" avatar :loading="hideTools" :title="false">-->
<!-- </uv-skeleton>--> <!-- </uv-skeleton>-->
<!-- <uv-gap height="16"></uv-gap>--> <!-- <uv-gap height="16"></uv-gap>-->
<!-- </uni-card>--> <!-- </uni-card>-->
<!-- <uni-card :border="false" :padding="'18px 6px'">--> <!-- <uni-card :border="false" :padding="'18px 6px'">-->
<!-- <uv-skeleton rows="3" avatar :loading="hideTools" :title="false">--> <!-- <uv-skeleton rows="3" avatar :loading="hideTools" :title="false">-->
<!-- </uv-skeleton>--> <!-- </uv-skeleton>-->
<!-- <uv-gap height="16"></uv-gap>--> <!-- <uv-gap height="16"></uv-gap>-->
<!-- </uni-card>--> <!-- </uni-card>-->
<!-- <uni-card :border="false" :padding="'18px 6px'">--> <!-- <uni-card :border="false" :padding="'18px 6px'">-->
<!-- <uv-skeleton rows="3" avatar :loading="hideTools" :title="false">--> <!-- <uv-skeleton rows="3" avatar :loading="hideTools" :title="false">-->
<!-- </uv-skeleton>--> <!-- </uv-skeleton>-->
<!-- <uv-gap height="16"></uv-gap>--> <!-- <uv-gap height="16"></uv-gap>-->
<!-- </uni-card>--> <!-- </uni-card>-->
<!-- <uni-card :border="false" :padding="'18px 6px'">--> <!-- <uni-card :border="false" :padding="'18px 6px'">-->
<!-- <uv-skeleton rows="3" avatar :loading="hideTools" :title="false">--> <!-- <uv-skeleton rows="3" avatar :loading="hideTools" :title="false">-->
<!-- </uv-skeleton>--> <!-- </uv-skeleton>-->
<!-- <uv-gap height="16"></uv-gap>--> <!-- <uv-gap height="16"></uv-gap>-->
<!-- </uni-card>--> <!-- </uni-card>-->
<!-- </block>--> <!-- </block>-->
<uv-empty :show="orderList.length === 0" 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> icon="https://cdn.uviewui.com/uview/empty/car.png"></uv-empty>
<uni-load-more v-if="orderList.length > 0" :status="loadMore"></uni-load-more> <uni-load-more v-if="orderList.length > 0" :status="loadMore"></uni-load-more>
<!-- 登录组件 --> <!-- 登录组件 -->
<ws-login ref="login" :logo="logo" @done="reload"/> <ws-login ref="login" :logo="logo" @done="reload"/>
</view> </view>
<uv-picker ref="orderTypePicker" :columns="[orderTypeList]" keyName="label" @confirm="confirmOrderType"/>
<uv-picker ref="orderStatusPicker" :columns="[orderStatusList]" keyName="label" @confirm="confirmOrderStatus"/>
</view> </view>
</template> </template>
@@ -108,6 +148,9 @@ import {
getWeek, getWeek,
getKey getKey
} from '@/utils/common'; } from '@/utils/common';
import {pageThinkOrder, thinkOrderRepay} from "@/api/think/thinkOrder";
import {pageThinkUsersVip, thinkUsersVipRepay, updateThinkUsersVip} from "@/api/think/thinkUsersVip";
import {pageThinkDeposit} from "@/api/think/thinkDeposit";
export default { export default {
components: {}, components: {},
@@ -142,17 +185,45 @@ export default {
styleType: 'text', styleType: 'text',
getWeek, getWeek,
// 骨架屏 // 骨架屏
hideTools: true hideTools: true,
orderTypeStr: '订场订单',
orderType: 0,
orderTypeList: [
{
label: '订场订单',
value: 0
},
{
label: '会员卡订单',
value: 1
},
{
label: '押金',
value: 2
},
],
orderStatusList: [
{
label: '未支付',
value: 2
},
{
label: '已支付',
value: 1
}
],
orderStatusStr: '全部状态',
orderStatus: null,
} }
}, },
async onLoad(option) { // async onLoad(option) {
this.userId = await uni.getStorageSync('user_id') // this.userId = await uni.getStorageSync('user_id')
// 加载数据 // // 加载数据
await this.reload() // await this.reload()
// if(option.isRefresh){ // // if(option.isRefresh){
// this.isRefresh = true // // this.isRefresh = true
// } // // }
}, // },
async onShow(e) { async onShow(e) {
this.userId = await uni.getStorageSync('user_id') this.userId = await uni.getStorageSync('user_id')
await this.reload() await this.reload()
@@ -163,60 +234,72 @@ export default {
const { const {
where where
} = this } = this
console.log(app.canReset)
if (app.canReset) { if (app.canReset) {
app.where.page = ++where.page; app.where.page += 1;
app.reload() app.getOrderList()
} }
}, },
methods: { methods: {
openOrderTypePicker() {
this.$refs.orderTypePicker.open()
},
openOrderStatusPicker() {
this.$refs.orderStatusPicker.open()
},
confirmOrderType({value}) {
this.orderType = value[0].value
this.orderTypeStr = value[0].label
this.reload()
},
confirmOrderStatus({value}) {
if (this.orderType === 0) {
this.where.payStatus = value[0].value
} else if (this.orderType === 1) {
this.where.status = value[0].value
} else if (this.orderType === 2) {
this.where.status = value[0].value
}
this.orderStatus = value[0].value
this.orderStatusStr = value[0].label
this.reload()
},
async reload() { async reload() {
const app = this this.loadMore = 'loading'
const { where } = this this.where.page = 1
const uid = uni.getStorageSync('uid') this.orderList = []
if (!uid) { this.$refs.orderTypePicker.close()
app.orderList = []; await this.getOrderList()
app.loadMore = 'no-more' },
return; async getOrderList() {
} let res
where.uid = uid; if (this.orderType === 0) res = await pageThinkOrder(this.where)
app.loadMore = 'loading' else if (this.orderType === 1) res = await pageThinkUsersVip(this.where)
OrderApi.pageThinkOrder(where).then(res => { else if (this.orderType === 2) res = await pageThinkDeposit(this.where)
const list = res.list.map(d => {
return d; if (this.orderList.length < res.count) {
}); this.orderList = this.orderList.concat(res.list)
if (app.orderList.length < res.count) { this.canReset = true
app.orderList = app.orderList.concat(list) this.loadMore = 'no-more'
app.canReset = true
app.loadMore = 'no-more'
} else { } else {
app.canReset = false; this.canReset = false;
app.loadMore = 'no-more' this.loadMore = 'no-more'
} }
uni.hideLoading()
app.isRefresh = false
}).catch(() => {
uni.showToast({
title: '请检查您的网络.',
icon: 'none'
})
uni.hideLoading()
app.isRefresh = false
})
}, },
async onClickItem(e) { async onClickItem(e) {
const app = this const app = this
this.uid = await uni.getStorageSync('uid') // this.uid = await uni.getStorageSync('uid')
const { const {
where, where,
uid // uid
} = this } = this
if (app.uid === 0 || !app.uid) { // if (app.uid === 0 || !app.uid) {
console.log(app.uid,'>>>>>>>2',app.uid) // console.log(app.uid, '>>>>>>>2', app.uid)
app.orderList = []; // app.orderList = [];
app.loadMore = 'no-more' // app.loadMore = 'no-more'
return; // return;
} // }
const index = e.currentIndex const index = e.currentIndex
if (this.current !== e.currentIndex) { if (this.current !== e.currentIndex) {
@@ -243,18 +326,18 @@ export default {
where.orderStatus = 1; where.orderStatus = 1;
} }
// 押金 // 押金
if (index === 4) { // if (index === 4) {
pageThinkWechatDeposit({ // pageThinkWechatDeposit({
uid: uni.getStorageSync('user_id') // uid: uni.getStorageSync('user_id')
}).then(res => { // }).then(res => {
app.orderList = res.list; // app.orderList = res.list;
if (res.count === 0) { // if (res.count === 0) {
app.loadMore = 'no-more' // app.loadMore = 'no-more'
} // }
uni.hideLoading() // uni.hideLoading()
}) // })
return false // return false
} // }
this.where.page = 1; this.where.page = 1;
this.orderList = []; this.orderList = [];
this.reload() this.reload()
@@ -312,6 +395,82 @@ export default {
uni.navigateTo({ uni.navigateTo({
url: `/package/user/invoice-show?id=${id}` url: `/package/user/invoice-show?id=${id}`
}) })
},
async closeVipOrder({id}) {
await updateThinkUsersVip({id, status: 0})
await uni.showToast({
title: '取消成功',
icon: 'none'
})
await this.reload()
},
toDetail(id) {
let url
if (this.orderType === 0) url = `/package/order/detail?id=${id}`
else if (this.orderType === 1) url = `/package/order/vipDetail?id=${id}`
else if (this.orderType === 2) url = `/package/order/detail?id=${id}`
uni.navigateTo({url})
},
async openPay(id) {
const orderInfo = await thinkUsersVipRepay({id})
const _this = this
uni.requestPayment({
provider: orderInfo.provider, // 服务提供商
timeStamp: orderInfo.timeStamp, // 时间戳
nonceStr: orderInfo.nonceStr, // 随机字符串
package: orderInfo.package,
signType: orderInfo.signType, // 签名算法
paySign: orderInfo.paySign, // 签名
success: function (res) {
// 业务逻辑。。。
uni.showToast({
title: '支付成功',
icon: 'success'
});
setTimeout(function () {
_this.reload()
}, 1500);
},
fail: function (err) {
console.log('支付失败', err);
}
})
},
async openPayOrder(id) {
const orderInfo = await thinkOrderRepay({id})
const _this = this
uni.requestPayment({
provider: orderInfo.provider, // 服务提供商
timeStamp: orderInfo.timeStamp, // 时间戳
nonceStr: orderInfo.nonceStr, // 随机字符串
package: orderInfo.package,
signType: orderInfo.signType, // 签名算法
paySign: orderInfo.paySign, // 签名
success: function (res) {
// 业务逻辑。。。
uni.showToast({
title: '支付成功',
icon: 'success'
});
setTimeout(function () {
_this.reload()
}, 1500);
},
fail: function (err) {
console.log('支付失败', err);
}
})
},
reset(){
this.where = {
page: 1
}
this.orderList = []
this.orderType = 0
this.orderTypeStr = '订场订单'
this.orderStatus = null
this.orderStatusStr = '全部状态'
this.reload()
} }
} }
} }
@@ -24,7 +24,7 @@
</template> </template>
<template v-else> <template v-else>
<button class="btn-normal" type="primary" open-type="getPhoneNumber" <button class="btn-normal" type="primary" open-type="getPhoneNumber"
@getphonenumber="handelMpWeixinMobileLogin($event)" @click="clickPhoneNumber"> @getphonenumber="handelMpWeixinMobileLogin($event)">
<view class="wechat-auth-container"> <view class="wechat-auth-container">
<text class="title">手机号快捷登录</text> <text class="title">手机号快捷登录</text>
</view> </view>
@@ -75,9 +75,10 @@
</view> </view>
</view> </view>
</view> </view>
<view class="close text-gray-800" @click="closeLogin">
<uv-icon name="close-circle" size="30"></uv-icon>
</view> </view>
<view class="close-wrap text-gray-800" @click="closeLogin">
<uv-icon name="close-circle" size="30"></uv-icon>
</view> </view>
</view> </view>
</uni-popup> </uni-popup>
@@ -92,6 +93,7 @@ import {
storeToRefs storeToRefs
} from 'pinia'; } from 'pinia';
import {updateUsers} from "@/api/shop/users"; import {updateUsers} from "@/api/shop/users";
import {addThinkUsers} from "@/api/think/thinkUsers";
const mpStore = useMpStore(); const mpStore = useMpStore();
const cartStore = useCartStore(); const cartStore = useCartStore();
@@ -239,12 +241,17 @@ export default {
detail detail
} = e; } = e;
const app = this const app = this
uni.showLoading({
title: '登录中'
})
if (detail.errMsg != 'getPhoneNumber:ok') { if (detail.errMsg != 'getPhoneNumber:ok') {
console.log('微信授权获取手机号失败', detail.errMsg) console.log('微信授权获取手机号失败', detail.errMsg)
uni.hideLoading()
return false return false
} }
if (detail.errMsg == 'getPhoneNumber:ok') { if (detail.errMsg == 'getPhoneNumber:ok') {
app.isLoading = true app.isLoading = true
const authCode = await this.getCode()
Api.loginMpWxMobile({ Api.loginMpWxMobile({
code: detail.code, code: detail.code,
encryptedData: detail.encryptedData, encryptedData: detail.encryptedData,
@@ -252,8 +259,11 @@ export default {
isParty: app.isParty, isParty: app.isParty,
partyData: app.partyData, partyData: app.partyData,
refereeId: Number(uni.getStorageSync('refereeId')), refereeId: Number(uni.getStorageSync('refereeId')),
comments: uni.getStorageSync('DelistingQrcode') ? '脱单邮局' : null comments: uni.getStorageSync('DelistingQrcode') ? '脱单邮局' : null,
authCode
}).then(res => { }).then(res => {
uni.hideLoading()
console.log('res', res)
if (res.access_token) { if (res.access_token) {
uni.showToast({ uni.showToast({
title: '登录成功', title: '登录成功',
@@ -262,18 +272,17 @@ export default {
cartStore.isLogin = true cartStore.isLogin = true
uni.setStorageSync('access_token', res.access_token) uni.setStorageSync('access_token', res.access_token)
uni.setStorageSync('user_id', res.user.userId) uni.setStorageSync('user_id', res.user.userId)
uni.setStorageSync('phone',res.user.phone) uni.setStorageSync('phone', res.user.phone)
if(!uni.getStorageSync('phone')){
const phone = res.user.phone; const phone = res.user.phone;
console.log('授权手机号码一键登录>>>',phone) console.log('授权手机号码一键登录>>>', phone)
updateUsers({ addThinkUsers({
id: uni.getStorageSync('uid'), phone: phone,
phone: phone openId: res.user.openid,
userId: res.user.userId,
}).then(res => { }).then(res => {
uni.setStorageSync('phone',phone) uni.setStorageSync('phone', phone)
}).finally(() => { }).finally(() => {
}) })
}
setTimeout(() => { setTimeout(() => {
this.$refs.login.close() this.$refs.login.close()
this.$emit('done', res) this.$emit('done', res)
@@ -281,6 +290,7 @@ export default {
} }
}) })
.catch(err => { .catch(err => {
uni.hideLoading()
uni.showToast({ uni.showToast({
title: '登录失败', title: '登录失败',
icon: 'none' icon: 'none'
@@ -365,6 +375,7 @@ export default {
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
position: relative;
.center { .center {
@@ -420,10 +431,10 @@ export default {
} }
} }
.close { .close-wrap {
width: 750rpx; position: absolute;
position:fixed; left: 30rpx;
bottom: 100rpx; top: 30rpx;
text-align: center; text-align: center;
display: flex; display: flex;
justify-content: center; justify-content: center;
@@ -14,9 +14,6 @@
<view class="userid"> <view class="userid">
<view class="text">{{ data.mobile }}</view> <view class="text">{{ data.mobile }}</view>
</view> </view>
<view class="flex flex-col justify-center items-center" @click="scan">
<uv-icon name="scan" size="58rpx" label="提货扫码" label-pos="bottom" label-size="24rpx" space="0"/>
</view>
</view> </view>
<view class="nickname-box" v-else> <view class="nickname-box" v-else>
<view class="nickname">点击登录</view> <view class="nickname">点击登录</view>