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
+54 -95
View File
@@ -33,16 +33,16 @@
<template v-for="(item,index) in periodList" :key="index">
<view class="period-item">
<view class="period">{{ item.timePeriod }}</view>
<!-- <view class="field-list">-->
<!-- <template v-for="(field,index2) in item.fieldList" :key="index2">-->
<!-- <view class="field"-->
<!-- :class="isActive(field)"-->
<!-- @click="onField(field,item)">-->
<!-- <text class="field-name">{{ field.fieldName }}</text>-->
<!-- <text class="price">{{ item.price }}元</text>-->
<!-- </view>-->
<!-- </template>-->
<!-- </view>-->
<view class="field-list">
<template v-for="(field,index2) in fieldList" :key="index2">
<view class="field"
:class="isActive(field, item)"
@click="onField(field, item)">
<text class="field-name">{{ field.name }}</text>
<text class="price">{{ item.price }}元</text>
</view>
</template>
</view>
</view>
</template>
<!-- 排版样式备份 -->
@@ -78,7 +78,7 @@
:endVal="totalPrice"></uv-count-to>
</view>
<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'}"
text="下一步" @click="save"></uv-button>
</view>
@@ -291,11 +291,11 @@ export default {
onType(e) {
const index = e.currentIndex
if (index === 0) {
this.type = 0;
this.type = 1;
this.isHalf = 0;
}
if (index === 1) {
this.type = 1;
this.type = 2;
this.isHalf = 1;
}
this.reload()
@@ -303,9 +303,9 @@ export default {
async getMerchant() {
this.merchant = await getThinkSite(this.merchantId)
},
async getFieldList(){
async getFieldList() {
if (!this.periodList.length) {
uni.showToast({
return uni.showToast({
title: '暂无可预订场地',
icon: 'none'
})
@@ -315,14 +315,14 @@ export default {
const timestamp = dayjs(this.dateTime + ' ' + item.timePeriod.split(' - ')[0]).unix()
periodVoList.push({
timestamp,
period: item.timePeriod
period: item.timePeriod,
id: item.id
})
})
const res = await listThinkFieldWithTimeList({
this.fieldList = await listThinkFieldWithTimeList({
sid: this.merchantId,
periodVoList
})
console.log(res)
},
getBookingPeriod() {
const {
@@ -379,9 +379,9 @@ export default {
closeCarInfo() {
this.$refs.popup.close()
},
onField(item, period) {
onField(field, item) {
// 已被预定
if (item.sold) {
if (field.sold) {
return
}
const app = this
@@ -390,7 +390,7 @@ export default {
// const p = this.periodList[i]
// 场地
// 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)
if (index >= 0) {
app.selection.splice(index, 1)
@@ -402,80 +402,52 @@ export default {
})
return false
}
// 计算订单总金额
// let totalPrice = 0
// app.selection.map(d => {
// console.log(d);
// totalPrice = totalPrice + d.totalPrice
// })
const split = item.timePeriod.split('-')
// console.log('aaaaaaaaa',{
// key,
// merchantId: this.merchantId,
// merchantCode: this.merchantCode,
// fieldId: item.fieldId,
// fieldName: item.fieldName,
// price: item.price,
// merchantName: this.merchantName,
// isChildren: item.isChildren,
// isHalf: this.type,
// timePeriod: item.timePeriod,
// periodId: item.periodId,
// startTime: `${split[0].trim()}:00`,
// endTime: `${split[1].trim()}:00`,
// orderCode: key,
// dateTime: `${this.dateTime}`,
// comments: `${this.dateTime} (${getWeek(this.week)}) ${item.timePeriod}`,
// });
const split = item.timePeriod.split(' - ')
const siteTime = field.periodVoList.find(d => d.period === item.timePeriod)
// 添加到购物车
const week = parseInt(this.week) === 7 ? 0 : this.week
app.selection.push({
key,
merchantId: this.merchantId,
merchantCode: merchant.merchantCode,
fieldId: item.fieldId,
fieldName: item.fieldName,
sid: this.merchantId,
fieldId: field.id,
fieldName: field.name,
price: item.price,
childrenPrice: period.childrenPrice,
childrenPrice: item.childrenPrice,
adultNum: 1,
childrenNum: 0,
merchantName: merchant.merchantName,
siteName: merchant.name,
isChildren: item.isChildren,
isHalf: this.type,
isHalf: this.isHalf,
type: this.type,
timePeriod: item.timePeriod,
periodId: item.periodId,
startTime: `${split[0].trim()}:00`,
startTime: dayjs(`${this.dateTime} ${split[0].trim()}`).unix(),
endTime: `${split[1].trim()}:00`,
orderCode: key,
siteTimeId: siteTime.id,
dateTime: `${this.dateTime}`,
comments: `${this.dateTime} (${getWeek(this.week)}) ${item.timePeriod}`,
comments: `${this.dateTime}(${getWeek(week)})${item.timePeriod}`,
})
console.log(app.selection);
console.log('period: ', period);
// console.log('period: ', period);
// 是否支持儿童票
console.log('item.isChildren: ', item.isChildren);
if (item.isChildren === 1) {
console.log('item.isChildren2: ', item.isChildren);
carStore.childrenPrice = period.childrenPrice
} else {
carStore.childrenPrice = 0
}
carStore.orderInfo = app.selection
carStore.carNum = app.selection.length
carStore.totalPrice = totalPrice
carStore.payPrice = totalPrice
carStore.setPeriod(period)
// console.log('item.isChildren: ', item.isChildren);
// if (item.isChildren === 1) {
// console.log('item.isChildren2: ', item.isChildren);
// carStore.childrenPrice = period.childrenPrice
// } else {
// carStore.childrenPrice = 0
// }
// carStore.orderInfo = app.selection
// carStore.carNum = app.selection.length
// carStore.totalPrice = totalPrice
// carStore.payPrice = totalPrice
// carStore.setPeriod(period)
}
},
getStratTime(value) {
const split = value.split('-')
const timeText = split[0].replace(' ', '')
const startTime = new Date(`${this.dateTime} ${timeText}:00`).getTime()
return startTime / 1000 || 0;
},
isActive(item) {
const index = this.selection.find(d => d.key === getKey(`${this.dateTime}${item.timePeriod}${this.merchantId}${item.fieldId}`))
isActive(field, item) {
const index = this.selection.find(d => d.key === getKey(`${this.dateTime}${item.timePeriod}${this.merchantId}${field.id}`))
if (item.sold) {
if (item.isHalf === 1) {
return 'web-bg-warning'
@@ -486,30 +458,17 @@ export default {
return 'active web-bg-success'
}
},
// isActive(text,item) {
// const index = this.selection.find(d => d.key == getKey(text))
// if(item.sold){
// if(item.isHalf == 1){
// return 'web-bg-warning'
// }
// return 'web-bg-info'
// }
// if (index) {
// return 'active web-bg-success'
// }
// },
remove(item) {
const index = this.selection.findIndex(d => d.key === item.key)
this.selection.splice(index, 1)
carStore.orderInfo = this.selection
},
save() {
const {
selection
} = this
uni.$uv.route({
url: '/package/booking/confirm'
uni.navigateTo({
url: '/package/booking/confirm',
success: (res) => {
res.eventChannel.emit('data', this.selection)
}
})
}
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -152,7 +152,7 @@ export default {
})
},
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 x2js = new X2js();
const {result} = x2js.xml2js(res.data)
File diff suppressed because it is too large Load Diff
+331 -361
View File
@@ -1,415 +1,385 @@
<template>
<view>
<view class="segmented">
<uni-segmented-control :current="current" :values="items" :styleType="styleType" :activeColor="activeColor" inActiveColor="#808080" @clickItem="onClickItem" />
</view>
<view class="card-list">
<block v-for="(item, index) in cardList" :key="index">
<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="content web-cell">
<view class="merchant-avatar">
<uv-avatar :src="item.merchantAvatar" size="36" style="border: 3rpx solid #ffffff"></uv-avatar>
</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 class="price">
<text class="web-text-price">{{ `¥${item.price}` }}</text>
</view>
</view>
</view>
</view>
</block>
<block v-if="cardList.length == 0">
<uni-card :border="false" :padding="'18px 6px'">
<uv-skeleton rows="2" avatar :loading="hideTools" :title="false"></uv-skeleton>
</uni-card>
<uni-card :border="false" :padding="'18px 6px'">
<uv-skeleton rows="2" avatar :loading="hideTools" :title="false"></uv-skeleton>
</uni-card>
<uni-card :border="false" :padding="'18px 6px'">
<uv-skeleton rows="2" avatar :loading="hideTools" :title="false"></uv-skeleton>
</uni-card>
<uni-card :border="false" :padding="'18px 6px'">
<uv-skeleton rows="2" avatar :loading="hideTools" :title="false"></uv-skeleton>
</uni-card>
<uni-card :border="false" :padding="'18px 6px'">
<uv-skeleton rows="2" avatar :loading="hideTools" :title="false"></uv-skeleton>
</uni-card>
<uni-card :border="false" :padding="'18px 6px'">
<uv-skeleton rows="2" avatar :loading="hideTools" :title="false"></uv-skeleton>
</uni-card>
</block>
<!-- 登录组件 -->
<ws-login ref="login" :logo="logo" @done="reload" />
</view>
</view>
<view>
<view class="segmented">
<uni-segmented-control :current="current" :values="items" :styleType="styleType" :activeColor="activeColor"
inActiveColor="#808080" @clickItem="onClickItem"/>
</view>
<view class="card-list">
<block v-for="(group, groupIndex) in cardList" :key="groupIndex">
<view class="flex flex-col justify-start items-start">
<view class="group-title">{{ group.siteNames }}</view>
<view @click="openUrl(`/package/card/checkout?cardId=${item.id}`)" class="container"
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="price">
<text class="web-text-price">{{ `¥${item.price}` }}</text>
</view>
</view>
<view class="text-25 text-gray p-20">
{{ item.info }}
</view>
</view>
</view>
</block>
<block v-if="cardList.length == 0">
<uni-card :border="false" :padding="'18px 6px'">
<uv-skeleton rows="2" avatar :loading="hideTools" :title="false"></uv-skeleton>
</uni-card>
<uni-card :border="false" :padding="'18px 6px'">
<uv-skeleton rows="2" avatar :loading="hideTools" :title="false"></uv-skeleton>
</uni-card>
<uni-card :border="false" :padding="'18px 6px'">
<uv-skeleton rows="2" avatar :loading="hideTools" :title="false"></uv-skeleton>
</uni-card>
<uni-card :border="false" :padding="'18px 6px'">
<uv-skeleton rows="2" avatar :loading="hideTools" :title="false"></uv-skeleton>
</uni-card>
<uni-card :border="false" :padding="'18px 6px'">
<uv-skeleton rows="2" avatar :loading="hideTools" :title="false"></uv-skeleton>
</uni-card>
<uni-card :border="false" :padding="'18px 6px'">
<uv-skeleton rows="2" avatar :loading="hideTools" :title="false"></uv-skeleton>
</uni-card>
</block>
<!-- 登录组件 -->
<ws-login ref="login" :logo="logo" @done="reload"/>
</view>
</view>
</template>
<script>
import * as Api from '@/api/booking/card';
import { pageWechatDeposit } from '@/api/shop/wechatDeposit';
import { getWeek, getKey } from '@/utils/common';
import {pageWechatDeposit} from '@/api/shop/wechatDeposit';
import {getWeek, getKey} from '@/utils/common';
import {listThinkVip, listThinkVipByGroup} from "@/api/think/thinkVip";
export default {
components: {},
data() {
return {
isRefresh: false,
isLogin: false,
userId: 0,
where: {
page: 1,
cardCode: '月/年卡',
sceneType: 'showCanBuyVipCard'
},
canReset: false,
loadMore: 'more',
logo: '',
items: ['月/年卡', '次卡', '充值卡'],
cardList: [],
styles: [
{
value: 'button',
text: '按钮',
checked: true
},
{
value: 'text',
text: '文字'
}
],
colors: ['#333333', '#4cd964', '#dd524d'],
current: 0,
colorIndex: 0,
activeColor: '#108001',
styleType: 'text',
getWeek,
// 骨架屏
hideTools: true
};
},
onLoad(option) {
// 判断是否登录
this.openLogin();
// 加载数据
this.reload();
console.log('判断是否刷新: ', option);
if (option.isRefresh) {
this.isRefresh = true;
}
},
onShow(e) {
console.log('判断是否刷新: ', e);
// 判断是否登录
this.openLogin();
if (this.isRefresh) {
this.reload();
}
},
// 触底函数
onReachBottom() {
const app = this;
const { where } = this;
if (app.canReset) {
app.where.page = ++where.page;
app.reload();
}
},
methods: {
reload() {
const app = this;
const { where, userId } = this;
if (userId == 0) {
app.openLogin();
return;
}
// where.userId = userId;
// uni.showLoading({
// title: '数据读取中.'
// });
app.loadMore = 'loading';
Api.pageCard(where)
.then((res) => {
const list = res.list.map((d) => {
return d;
});
if (app.cardList.length < res.count) {
app.cardList = app.cardList.concat(list);
app.canReset = true;
app.loadMore = 'no-more';
} else {
app.canReset = false;
app.loadMore = 'no-more';
}
// uni.hideLoading();
app.isRefresh = false;
app.hideTools = false;
})
.catch(() => {
uni.showToast({
title: '请检查您的网络.',
icon: 'none'
});
app.isRefresh = false;
app.hideTools = false;
});
},
onClickItem(e, text) {
const app = this;
const { where, userId } = this;
const index = e.currentIndex;
if (this.current !== e.currentIndex) {
this.current = e.currentIndex;
}
// 全部
if (index == 0) {
where.cardCode = '月/年卡';
}
// 未支付
if (index == 1) {
where.cardCode = '次卡';
}
// 已支付
if (index == 2) {
where.cardCode = '充值卡';
}
components: {},
data() {
return {
isRefresh: false,
isLogin: false,
userId: 0,
where: {
page: 1,
cardCode: '月/年卡',
sceneType: 'showCanBuyVipCard',
type: 0
},
canReset: false,
loadMore: 'more',
logo: '',
items: ['月/年卡', '次卡', '充值卡'],
cardList: [],
styles: [
{
value: 'button',
text: '按钮',
checked: true
},
{
value: 'text',
text: '文字'
}
],
colors: ['#333333', '#4cd964', '#dd524d'],
current: 0,
colorIndex: 0,
activeColor: '#108001',
styleType: 'text',
getWeek,
// 骨架屏
hideTools: true
};
},
onLoad(option) {
// 判断是否登录
this.openLogin();
// 加载数据
// this.reload();
this.getCardList()
console.log('判断是否刷新: ', option);
if (option.isRefresh) {
this.isRefresh = true;
}
},
onShow(e) {
console.log('判断是否刷新: ', e);
// 判断是否登录
this.openLogin();
if (this.isRefresh) {
// this.reload();
this.getCardList()
}
},
// 触底函数
onReachBottom() {
const app = this;
const {where} = this;
if (app.canReset) {
app.where.page = ++where.page;
app.reload();
}
},
methods: {
async getCardList() {
this.cardList = await listThinkVipByGroup({
type: this.where.type
})
},
reload() {
return;
const app = this;
const {where, userId} = this;
if (userId == 0) {
app.openLogin();
return;
}
// where.userId = userId;
// uni.showLoading({
// title: '数据读取中.'
// });
app.loadMore = 'loading';
Api.pageCard(where)
.then((res) => {
const list = res.list.map((d) => {
return d;
});
if (app.cardList.length < res.count) {
app.cardList = app.cardList.concat(list);
app.canReset = true;
app.loadMore = 'no-more';
} else {
app.canReset = false;
app.loadMore = 'no-more';
}
// uni.hideLoading();
app.isRefresh = false;
app.hideTools = false;
})
.catch(() => {
uni.showToast({
title: '请检查您的网络.',
icon: 'none'
});
app.isRefresh = false;
app.hideTools = false;
});
},
onClickItem({currentIndex}) {
this.where.page = 1;
this.cardList = [];
this.hideTools = true
this.reload();
},
openUrl(url) {
uni.navigateTo({
url
});
},
toPay(orderId) {
uni.navigateTo({
url: '/package/booking/confirm?id=' + orderId
});
},
closeOrder(item) {
uni.showModal({
title: '确定取消此订单?',
success(o) {
if (o.confirm) {
// Api.updateOrder({
// orderStatus: 2,
// orderId: item.orderId
// })
// .then((msg) => {
// uni.showToast({
// title: msg,
// icon: 'none'
// });
// item.orderStatus = 2;
// })
// .catch(() => {
// uni.showToast({
// title: '请检查您的网络.',
// icon: 'none'
// });
// uni.hideLoading();
// });
}
}
});
},
// 弹出登录提示框
async openLogin() {
this.userId = uni.getStorageSync('user_id');
if (!this.userId) {
this.$refs.login.open('bottom');
return false;
}
}
}
// 全部
if (currentIndex === 0) {
this.where.type = 0;
}
// 未支付
if (currentIndex === 1) {
this.where.type = 2;
}
// 已支付
if (currentIndex === 2) {
this.where.type = 4;
}
this.cardList = [];
this.hideTools = true
this.getCardList();
},
openUrl(url) {
uni.navigateTo({
url
});
},
toPay(orderId) {
uni.navigateTo({
url: '/package/booking/confirm?id=' + orderId
});
},
closeOrder(item) {
uni.showModal({
title: '确定取消此订单?',
success(o) {
if (o.confirm) {
// Api.updateOrder({
// orderStatus: 2,
// orderId: item.orderId
// })
// .then((msg) => {
// uni.showToast({
// title: msg,
// icon: 'none'
// });
// item.orderStatus = 2;
// })
// .catch(() => {
// uni.showToast({
// title: '请检查您的网络.',
// icon: 'none'
// });
// uni.hideLoading();
// });
}
}
});
},
// 弹出登录提示框
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;
.group-title {
margin: 20rpx;
padding-left: 20rpx;
border-left: 10px solid #19be6b;
font-size: 25rpx;
}
.segmented {
padding: 0 12rpx;
padding: 0 12rpx;
}
.content-text {
font-size: 14px;
color: #666;
font-size: 14px;
color: #666;
}
.color-tag {
width: 25px;
height: 25px;
width: 25px;
height: 25px;
}
.uni-list {
flex: 1;
flex: 1;
}
.card-list {
.container {
width: 700rpx;
height: 200rpx;
position: relative;
margin: 25rpx auto;
display: flex;
justify-content: space-between;
align-items: center;
border-radius: 20rpx;
position: relative;
box-shadow: 0 0px 6px 0 rgba(0, 0, 0, 0.2);
// background: linear-gradient(to right, #70b915, #008e04);
color: #ffffff;
}
.container {
margin: 20rpx;
position: relative;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: flex-start;
border-radius: 20rpx;
box-shadow: 0 0 6px 0 rgba(0, 0, 0, 0.2);
background-color: white;
width: calc(100% - 40rpx);
}
.container::before {
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; /* 设置透明度 */
}
.container::before {
content: '';
display: block;
position: absolute;
border-radius: 20rpx;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
.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 {
padding-right: 30rpx;
font-size: 36rpx;
color: #fecc66;
}
}
.card-bg {
}
}
.card-item {
width: 700rpx;
margin: 20rpx auto;
border-radius: 20rpx;
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 {
padding: 20rpx 0;
.web-text-price {
padding-right: 30rpx;
font-size: 36rpx;
color: #fecc66;
}
.merchant-avatar {
margin-right: 12rpx;
}
.card-item {
width: 700rpx;
margin: 20rpx auto;
border-radius: 20rpx;
position: relative;
}
.card-name {
font-weight: 600;
}
.order-title {
padding: 20rpx 0;
.btn-status {
font-size: 30rpx;
display: flex;
}
}
.merchant-avatar {
margin-right: 12rpx;
}
.order-body {
padding: 16px 0;
}
.card-name {
font-weight: 600;
}
.btn-status {
font-size: 30rpx;
display: flex;
}
}
.order-body {
padding: 16px 0;
}
}
.ele-flex {
display: flex;
justify-content: space-between;
display: flex;
justify-content: space-between;
}
.card-actions {
display: flex;
flex-direction: row;
justify-content: flex-end;
align-items: center;
height: 45px;
border-top: 1px #eee solid;
display: flex;
flex-direction: row;
justify-content: flex-end;
align-items: center;
height: 45px;
border-top: 1px #eee solid;
}
.card-actions-item {
display: flex;
flex-direction: row;
align-items: center;
display: flex;
flex-direction: row;
align-items: center;
}
.card-actions-item-text {
font-size: 12px;
color: #666;
margin-left: 5px;
font-size: 12px;
color: #666;
margin-left: 5px;
}
.close {
top: 60rpx !important;
top: 60rpx !important;
}
.total-price {
display: flex;
flex-direction: column;
justify-content: flex-start;
font-size: 30rpx;
align-items: flex-start;
padding-left: 6rpx;
margin-left: 450rpx;
display: flex;
flex-direction: column;
justify-content: flex-start;
font-size: 30rpx;
align-items: flex-start;
padding-left: 6rpx;
margin-left: 450rpx;
.web-text-heading {
font-size: 30rpx !important;
}
.web-text-heading {
font-size: 30rpx !important;
}
}
</style>
+309 -333
View File
@@ -1,400 +1,376 @@
<template>
<view class="order" v-if="form.id">
<view class="qrcode" v-if="form.payStatus === 1 && form.orderStatus === 2">
<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>
</view>
<uni-card title="预定信息" :border="false" :is-shadow="false" :padding="0">
<view class="order-body web-cell web-cell-align-top">
<view class="web-cell-content">
<uv-cell-group :customStyle="{ backgroundColor: '#ffffff' }" :border="false">
<uv-cell :title="`${form.siteName}`" :label="` `" :cellStyle="{ padding: '0', paddingBottom: '5px' }" :border="false" />
<block v-for="(item, index) in form.thinkOrderInfos" :key="index">
<uv-cell
:title="`${item.fieldName}`"
:label="`${item.dateTime}`"
:cellStyle="{ padding: '0', paddingBottom: '5px' }"
:value="`¥${item.price}`"
: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="`儿童票 ¥35`" :value="`x ${item.childrenNum}`" v-if="item.isChildren === 1" :cellStyle="{ padding: '0', paddingBottom: '5px' }" :border="false" />
</block>
</uv-cell-group>
</view>
</view>
<view slot="actions" class="card-actions">
<view class="web-text-heading">合计:¥{{ form.totalPrice }}</view>
<view class="web-text-danger">实付:¥{{ form.payPrice }}</view>
</view>
</uni-card>
<block v-if="form.orderNum">
<uni-card :border="false" :is-shadow="false" :padding="0">
<view class="web-cell web-cell-align-top">
<uv-cell-group :customStyle="{ backgroundColor: '#ffffff', padding: '8px 0' }" :border="false">
<uv-cell :title="`姓名`" :value="`${form.name}`" :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.orderNum}`" :cellStyle="{ padding: '8px' }"" />
<uv-cell :title="`订单状态`" :cellStyle="{ padding: '8px' }">
<template v-slot:value>
<view v-if="form.payStatus === 0">
<!-- <uv-count-down :time="form.timestamp" format="mm:ss"></uv-count-down> -->
<span style="color: #ff0000">未支付</span>
</view>
<view v-else>{{ orderStatus[form.orderStatus] }}</view>
</template>
</uv-cell>
<uv-cell :title="`下单时间`" :value="`${timeFormat(form.createTime,'yyyy-mm-dd hh:MM:ss')}`" :cellStyle="{ padding: '8px' }" />
<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>
</view>
</uni-card>
</block>
<uv-gap height="20"></uv-gap>
<view class="checkout-car" v-if="form.payStatus == 0">
<view class="car-total">
<text style="color: #ebcf00">¥</text>
<uv-count-to decimals="2" duration="30" color="#ebcf00" bold :endVal="form.payPrice"></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="navTo(`/package/booking/confirm?id=${form.orderId}`)"
></uv-button>
</view>
<!-- 登录组件 -->
<ws-login ref="login" :logo="logo" @done="reload" />
</view>
<view class="order" v-if="form.id">
<view class="qrcode" v-if="form.payStatus === 1 && form.orderStatus === 2">
<uv-image :src="`${IMG_URL}${form.qrcode}`" width="200" height="200"/>
<text class="web-text-secondary">核销码</text>
</view>
<uni-card title="预定信息" :border="false" :is-shadow="false" :padding="0">
<view class="order-body web-cell web-cell-align-top">
<view class="web-cell-content">
<uv-cell-group :customStyle="{ backgroundColor: '#ffffff' }" :border="false">
<uv-cell :title="`${form.siteName}`" :label="` `" :cellStyle="{ padding: '0', paddingBottom: '5px' }"
:border="false"/>
<block v-for="(item, index) in form.thinkOrderInfos" :key="index">
<uv-cell
:title="`${item.fieldName}`"
:label="`${item.dateTime}`"
:cellStyle="{ padding: '0', paddingBottom: '5px' }"
:value="`¥${item.price}`"
: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="`儿童票 ¥35`" :value="`x ${item.childrenNum}`" v-if="item.isChildren === 1"
:cellStyle="{ padding: '0', paddingBottom: '5px' }" :border="false"/>
</block>
</uv-cell-group>
</view>
</view>
<view slot="actions" class="card-actions">
<view class="web-text-heading">合计:¥{{ form.totalPrice }}</view>
<view class="web-text-danger">实付:¥{{ form.payPrice }}</view>
</view>
</uni-card>
<block v-if="form.orderNum">
<uni-card :border="false" :is-shadow="false" :padding="0">
<view class="web-cell web-cell-align-top">
<uv-cell-group :customStyle="{ backgroundColor: '#ffffff', padding: '8px 0' }" :border="false">
<uv-cell :title="`姓名`" :value="`${form.name}`" :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.orderNum}`" :cellStyle="{ padding: '8px' }"
" />
<uv-cell :title="`订单状态`" :cellStyle="{ padding: '8px' }">
<template v-slot:value>
<view v-if="form.payStatus === 2">
<!-- <uv-count-down :time="form.timestamp" format="mm:ss"></uv-count-down> -->
<span style="color: #ff0000">未支付</span>
</view>
<view v-else>{{ orderStatus[form.orderStatus] }}</view>
</template>
</uv-cell>
<uv-cell :title="`下单时间`" :value="`${timeFormat(form.createTime,'yyyy-mm-dd hh:MM:ss')}`"
:cellStyle="{ padding: '8px' }"/>
<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>
</view>
</uni-card>
</block>
<uv-gap height="20"></uv-gap>
<view class="checkout-car" v-if="form.payStatus === 2">
<view class="car-total">
<text style="color: #ebcf00">¥</text>
<uv-count-to decimals="2" duration="30" color="#ebcf00" bold :endVal="form.totalPrice"></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 * as OrderApi from '@/api/think/thinkOrder';
import { IMG_URL } from '@/config/setting';
import { pageThinkWechatDeposit } from '@/api/think/thinkWechatDeposit';
import {IMG_URL} from '@/config/setting';
import {pageThinkWechatDeposit} from '@/api/think/thinkWechatDeposit';
import UvImage from "@/uni_modules/uv-image/components/uv-image/uv-image.vue";
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 {
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季卡'
],
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季卡'
],
IMG_URL,
orderList: [],
styles: [
{
value: 'button',
text: '按钮',
checked: true
},
{
value: 'text',
text: '文字'
}
],
h5_url: '',
colors: ['#333333', '#4cd964', '#dd524d'],
current: 0,
colorIndex: 0,
activeColor: '#108001',
styleType: 'text'
};
},
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: {
orderList: [],
styles: [
{
value: 'button',
text: '按钮',
checked: true
},
{
value: 'text',
text: '文字'
}
],
h5_url: '',
colors: ['#333333', '#4cd964', '#dd524d'],
current: 0,
colorIndex: 0,
activeColor: '#108001',
styleType: 'text'
};
},
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,
reload() {
const app = this;
const { where, userId, orderId } = this;
if (!uni.getStorageSync('user_id')) {
app.openLogin();
return;
}
where.uid = uni.getStorageSync('uid');
uni.showLoading({
title: '数据读取中.'
});
OrderApi.getThinkOrder(orderId).then((data) => {
console.log('data909090: ', data);
app.form = data;
reload() {
const app = this;
const {where, userId, orderId} = this;
if (!uni.getStorageSync('user_id')) {
app.openLogin();
return;
}
where.uid = uni.getStorageSync('uid');
uni.showLoading({
title: '数据读取中.'
});
OrderApi.getThinkOrder(orderId).then((data) => {
app.form = data;
// 页面标题
if (data.orderStatus === 1) {
uni.setNavigationBarTitle({
title: '订单详情(已完成)'
});
}
// 页面标题
if (data.orderStatus === 1) {
uni.setNavigationBarTitle({
title: '订单详情(已完成)'
});
}
uni.hideLoading();
});
uni.hideLoading();
});
// H5版网址
const h5_url = uni.getStorageSync('h5_url');
const tid = uni.getStorageSync('TenantId');
if (h5_url) {
app.h5_url = h5_url;
} else {
app.h5_url = `http://${tid}.h5.wsdns.cn`;
}
},
navTo(url) {
uni.navigateTo({
url
});
},
onCopyText(text){
copyText(text);
// H5版网址
const h5_url = uni.getStorageSync('h5_url');
const tid = uni.getStorageSync('TenantId');
if (h5_url) {
app.h5_url = h5_url;
} else {
app.h5_url = `http://${tid}.h5.wsdns.cn`;
}
},
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() {
this.userId = uni.getStorageSync('user_id');
if (!this.userId) {
this.$refs.login.open('bottom');
return false;
}
}
}
navTo(url) {
uni.navigateTo({
url
});
},
// 弹出登录提示框
async openLogin() {
this.userId = uni.getStorageSync('user_id');
if (!this.userId) {
this.$refs.login.open('bottom');
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>
<style lang="scss">
.content {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
justify-content: center;
align-items: center;
height: 150px;
text-align: center;
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
justify-content: center;
align-items: center;
height: 150px;
text-align: center;
}
.content-text {
font-size: 14px;
color: #666;
font-size: 14px;
color: #666;
}
.color-tag {
width: 25px;
height: 25px;
width: 25px;
height: 25px;
}
.uni-list {
flex: 1;
flex: 1;
}
.order {
.order-title {
padding: 20rpx 0;
border-bottom: 1px #eee solid;
.order-title {
padding: 20rpx 0;
border-bottom: 1px #eee solid;
.merchant-avatar {
margin-right: 12rpx;
}
.merchant-avatar {
margin-right: 12rpx;
}
.merchant-name {
// padding-left: 12rpx;
}
.merchant-name {
// padding-left: 12rpx;
}
.btn-status {
font-size: 30rpx;
display: flex;
}
}
.btn-status {
font-size: 30rpx;
display: flex;
}
}
.order-body {
padding: 16px 0;
}
.order-body {
padding: 16px 0;
}
}
.ele-flex {
display: flex;
justify-content: space-between;
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;
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-heading {
font-size: 30rpx;
font-weight: 500;
}
.web-text-danger {
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;
display: flex;
flex-direction: row;
align-items: center;
}
.card-actions-item-text {
font-size: 12px;
color: #666;
margin-left: 5px;
font-size: 12px;
color: #666;
margin-left: 5px;
}
.btn-status {
font-size: 30rpx;
display: flex;
font-size: 30rpx;
display: flex;
}
.close {
top: 60rpx !important;
top: 60rpx !important;
}
.qrcode {
margin-top: 30rpx;
text-align: center;
align-items: center;
display: flex;
flex-direction: column;
justify-content: center;
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;
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-selected {
color: #ccc;
display: flex;
align-items: center;
padding: 0 20rpx;
}
.car-total {
display: flex;
color: #ebcf00;
align-items: center;
padding-left: 40rpx;
.car-total {
display: flex;
color: #ebcf00;
align-items: center;
padding-left: 40rpx;
.save-btn {
}
}
.save-btn {
}
}
}
</style>
+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>
+381 -364
View File
@@ -1,423 +1,440 @@
<template>
<view>
<!-- <view class="segmented">
<uni-segmented-control :current="current" :values="items" :styleType="styleType" :activeColor="activeColor" inActiveColor="#808080" @clickItem="onClickItem" />
</view> -->
<view class="card-list">
<block v-if="!hideTools || cardList.length > 0">
<view
class="container"
v-for="(item, index) in cardList"
:key="index"
@click="openUrl('/package/user/card-detail?cardId=' + item.id)"
: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="merchant-avatar">-->
<!-- <uv-avatar :src="item.merchantAvatar" size="36" style="border: 3rpx solid #ffffff"></uv-avatar>-->
<!-- </view>-->
<view class="card-info web-cell-content">
<view class="title-bar">
<view class="web-text-heading" style="color: #ffffff; font-size: 20px; font-weight: 600">{{ item.name }}</view>
<view>
<!-- <view class="segmented">
<uni-segmented-control :current="current" :values="items" :styleType="styleType" :activeColor="activeColor" inActiveColor="#808080" @clickItem="onClickItem" />
</view> -->
<view class="card-list">
<block v-if="!hideTools || cardList.length > 0">
<view
class="container"
v-for="(item, index) in cardList"
:key="index"
@click="openUrl('/package/user/card-detail?cardId=' + item.id)"
: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="merchant-avatar">-->
<!-- <uv-avatar :src="item.merchantAvatar" size="36" style="border: 3rpx solid #ffffff"></uv-avatar>-->
<!-- </view>-->
<view class="card-info web-cell-content">
<view class="title-bar">
<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;">
{{ item.siteNames }}
</view>
<!-- <block v-if="item.type == 2">
<view class="desc web-text-heading" style="color: #ffffff; font-size: 14px">{{ item.month }}个月</view>
</block> -->
<block v-if="item.type == 2">
<view class="desc web-text-heading" style="color: #ffffff; font-size: 14px">剩余{{ item.number }}次</view>
</block>
<block v-if="item.type == 1 || item.type == 3 || item.type == 5">
<view class="desc web-text-heading" style="color: #ffffff; font-size: 14px">余额¥{{ item.remainingMoney }}</view>
</block>
</view>
<!-- <view class="price">
<text class="web-text-price">{{ `¥${item.price}` }}</text>
</view> -->
</view>
</view>
</view>
</block>
<block v-else>
<uni-card :border="false" :padding="'18px 6px'">
<uv-skeleton rows="2" avatar :loading="hideTools" :title="false"></uv-skeleton>
</uni-card>
<uni-card :border="false" :padding="'18px 6px'">
<uv-skeleton rows="2" avatar :loading="hideTools" :title="false"></uv-skeleton>
</uni-card>
<uni-card :border="false" :padding="'18px 6px'">
<uv-skeleton rows="2" avatar :loading="hideTools" :title="false"></uv-skeleton>
</uni-card>
<uni-card :border="false" :padding="'18px 6px'">
<uv-skeleton rows="2" avatar :loading="hideTools" :title="false"></uv-skeleton>
</uni-card>
<uni-card :border="false" :padding="'18px 6px'">
<uv-skeleton rows="2" avatar :loading="hideTools" :title="false"></uv-skeleton>
</uni-card>
<uni-card :border="false" :padding="'18px 6px'">
<uv-skeleton rows="2" avatar :loading="hideTools" :title="false"></uv-skeleton>
</uni-card>
</block>
<!-- 登录组件 -->
<ws-login ref="login" :logo="logo" @done="reload" />
</view>
<view v-if="!hideTools && cardList.length == 0">
<uv-empty mode="list" icon="https://cdn.uviewui.com/uview/empty/list.png"></uv-empty>
</view>
</view>
<!-- <block v-if="item.type == 2">
<view class="desc web-text-heading" style="color: #ffffff; font-size: 14px">{{ item.month }}个月</view>
</block> -->
<view v-if="item.type === 2" class="desc web-text-heading" style="color: #ffffff; font-size: 14px">剩余{{
item.number
}}次
</view>
<view v-if="item.type === 5" class="desc web-text-heading" style="color: #ffffff; font-size: 14px">余额¥{{
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 class="price">
<text class="web-text-price">{{ `¥${item.price}` }}</text>
</view> -->
</view>
</view>
</view>
</block>
<block v-else>
<uni-card :border="false" :padding="'18px 6px'">
<uv-skeleton rows="2" avatar :loading="hideTools" :title="false"></uv-skeleton>
</uni-card>
<uni-card :border="false" :padding="'18px 6px'">
<uv-skeleton rows="2" avatar :loading="hideTools" :title="false"></uv-skeleton>
</uni-card>
<uni-card :border="false" :padding="'18px 6px'">
<uv-skeleton rows="2" avatar :loading="hideTools" :title="false"></uv-skeleton>
</uni-card>
<uni-card :border="false" :padding="'18px 6px'">
<uv-skeleton rows="2" avatar :loading="hideTools" :title="false"></uv-skeleton>
</uni-card>
<uni-card :border="false" :padding="'18px 6px'">
<uv-skeleton rows="2" avatar :loading="hideTools" :title="false"></uv-skeleton>
</uni-card>
<uni-card :border="false" :padding="'18px 6px'">
<uv-skeleton rows="2" avatar :loading="hideTools" :title="false"></uv-skeleton>
</uni-card>
</block>
<!-- 登录组件 -->
<ws-login ref="login" :logo="logo" @done="reload"/>
</view>
<view v-if="!hideTools && cardList.length == 0">
<uv-empty mode="list" icon="https://cdn.uviewui.com/uview/empty/list.png"></uv-empty>
</view>
</view>
</template>
<script>
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 {
components: {},
data() {
return {
isRefresh: false,
isLogin: false,
userId: 0,
where: {
page: 1
},
canReset: false,
loadMore: 'more',
logo: '',
items: ['月/年卡', '次卡', '充值卡'],
cardList: [],
styles: [
{
value: 'button',
text: '按钮',
checked: true
},
{
value: 'text',
text: '文字'
}
],
colors: ['#333333', '#4cd964', '#dd524d'],
current: 0,
colorIndex: 0,
activeColor: '#108001',
styleType: 'text',
getWeek,
// 骨架屏
hideTools: true
};
},
onLoad(option) {
// 判断是否登录
this.openLogin();
// 加载数据
this.reload();
console.log('判断是否刷新: ', option);
if (option.isRefresh) {
this.isRefresh = true;
}
},
onShow(e) {
console.log('判断是否刷新: ', e);
// 判断是否登录
this.openLogin();
if (this.isRefresh) {
this.reload();
}
},
// 触底函数
onReachBottom() {
const app = this;
const { where } = this;
if (app.canReset) {
app.where.page = ++where.page;
app.reload();
}
},
methods: {
reload() {
const app = this;
const { where, userId } = this;
if (userId === 0) {
app.openLogin();
return;
}
where.uid = uni.getStorageSync('uid');
where.status = 1;
components: {},
data() {
return {
isRefresh: false,
isLogin: false,
userId: 0,
where: {
page: 1
},
canReset: false,
loadMore: 'more',
logo: '',
items: ['月/年卡', '次卡', '充值卡'],
cardList: [],
styles: [
{
value: 'button',
text: '按钮',
checked: true
},
{
value: 'text',
text: '文字'
}
],
colors: ['#333333', '#4cd964', '#dd524d'],
current: 0,
colorIndex: 0,
activeColor: '#108001',
styleType: 'text',
getWeek,
// 骨架屏
hideTools: true
};
},
onLoad(option) {
// 判断是否登录
this.openLogin();
// 加载数据
this.reload();
console.log('判断是否刷新: ', option);
if (option.isRefresh) {
this.isRefresh = true;
}
},
onShow(e) {
console.log('判断是否刷新: ', e);
// 判断是否登录
this.openLogin();
if (this.isRefresh) {
this.reload();
}
},
// 触底函数
onReachBottom() {
const app = this;
const {where} = this;
if (app.canReset) {
app.where.page = ++where.page;
app.reload();
}
},
methods: {
dayjs,
reload() {
const app = this;
const {where, userId} = this;
if (userId === 0) {
app.openLogin();
return;
}
where.uid = uni.getStorageSync('uid');
where.status = 1;
where.sceneType = 'myCardAll';
app.loadMore = 'loading';
Api.pageThinkUsersVip(where)
.then((res) => {
console.log('res: ', res);
const list = res.list.map((d) => {
return d;
});
if (app.cardList.length < res.count) {
app.cardList = app.cardList.concat(list);
app.canReset = true;
app.loadMore = 'no-more';
} else {
app.canReset = false;
app.hideTools = false;
app.loadMore = 'no-more';
}
// uni.hideLoading();
app.isRefresh = false;
})
.catch(() => {
uni.showToast({
title: '请检查您的网络.',
icon: 'none'
});
app.hideTools = false;
app.isRefresh = false;
});
},
onClickItem(e, text) {
const app = this;
const { where, userId } = this;
const index = e.currentIndex;
if (this.current !== e.currentIndex) {
this.current = e.currentIndex;
}
// 全部
if (index == 0) {
where.cardCode = '月/年卡';
}
// 未支付
if (index == 1) {
where.cardCode = '次卡';
}
// 已支付
if (index == 2) {
where.cardCode = '充值卡';
}
app.loadMore = 'loading';
Api.pageThinkUsersVip(where)
.then((res) => {
console.log('res: ', res);
const list = res.list.map((d) => {
return d;
});
if (app.cardList.length < res.count) {
app.cardList = app.cardList.concat(list);
app.canReset = true;
app.loadMore = 'no-more';
} else {
app.canReset = false;
app.hideTools = false;
app.loadMore = 'no-more';
}
// uni.hideLoading();
app.isRefresh = false;
})
.catch(() => {
uni.showToast({
title: '请检查您的网络.',
icon: 'none'
});
app.hideTools = false;
app.isRefresh = false;
});
},
onClickItem(e, text) {
const app = this;
const {where, userId} = this;
const index = e.currentIndex;
if (this.current !== e.currentIndex) {
this.current = e.currentIndex;
}
// 全部
if (index == 0) {
where.cardCode = '月/年卡';
}
// 未支付
if (index == 1) {
where.cardCode = '次卡';
}
// 已支付
if (index == 2) {
where.cardCode = '充值卡';
}
this.where.page = 1;
this.cardList = [];
this.hideTools = true;
this.reload();
},
openUrl(url) {
uni.navigateTo({
url
});
},
toPay(orderId) {
uni.navigateTo({
url: '/package/booking/confirm?id=' + orderId
});
},
closeOrder(item) {
uni.showModal({
title: '确定取消此订单?',
success(o) {
if (o.confirm) {
// Api.updateOrder({
// orderStatus: 2,
// orderId: item.orderId
// })
// .then((msg) => {
// uni.showToast({
// title: msg,
// icon: 'none'
// });
// item.orderStatus = 2;
// })
// .catch(() => {
// uni.showToast({
// title: '请检查您的网络.',
// icon: 'none'
// });
// uni.hideLoading();
// });
}
}
});
},
// 弹出登录提示框
async openLogin() {
this.userId = uni.getStorageSync('user_id');
if (!this.userId) {
this.$refs.login.open('bottom');
return false;
}
}
}
this.where.page = 1;
this.cardList = [];
this.hideTools = true;
this.reload();
},
openUrl(url) {
uni.navigateTo({
url
});
},
toPay(orderId) {
uni.navigateTo({
url: '/package/booking/confirm?id=' + orderId
});
},
closeOrder(item) {
uni.showModal({
title: '确定取消此订单?',
success(o) {
if (o.confirm) {
// Api.updateOrder({
// orderStatus: 2,
// orderId: item.orderId
// })
// .then((msg) => {
// uni.showToast({
// title: msg,
// icon: 'none'
// });
// item.orderStatus = 2;
// })
// .catch(() => {
// uni.showToast({
// title: '请检查您的网络.',
// icon: 'none'
// });
// uni.hideLoading();
// });
}
}
});
},
// 弹出登录提示框
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: 380rpx;
text-align: center;
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
justify-content: center;
align-items: center;
height: 380rpx;
text-align: center;
}
.segmented {
padding: 0 12rpx;
padding: 0 12rpx;
}
.content-text {
font-size: 14px;
color: #666;
font-size: 14px;
color: #666;
}
.color-tag {
width: 25px;
height: 25px;
width: 25px;
height: 25px;
}
.uni-list {
flex: 1;
flex: 1;
}
.card-list {
.container {
width: 700rpx;
height: 380rpx;
position: relative;
margin: 25rpx auto;
display: flex;
justify-content: space-between;
align-items: center;
border-radius: 20rpx;
box-shadow: 0 0px 6px 0 rgba(0, 0, 0, 0.2);
// background: linear-gradient(to right, #70b915, #008e04);
color: #ffffff;
}
.container {
width: 700rpx;
height: 380rpx;
position: relative;
margin: 25rpx auto;
display: flex;
justify-content: space-between;
align-items: center;
border-radius: 20rpx;
box-shadow: 0 0px 6px 0 rgba(0, 0, 0, 0.2);
// background: linear-gradient(to right, #70b915, #008e04);
color: #ffffff;
}
.container::before {
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; /* 设置透明度 */
}
.container::before {
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 {
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 {
padding-right: 30rpx;
font-size: 36rpx;
color: #fecc66;
}
}
.card-bg {
}
}
.card-item {
width: 700rpx;
margin: 20rpx auto;
border-radius: 20rpx;
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 {
padding: 20rpx 0;
.content {
position: relative;
z-index: 1;
width: 700rpx;
display: flex;
justify-content: space-between;
.merchant-avatar {
margin-right: 12rpx;
}
.merchant-avatar {
margin-left: 24rpx;
}
.card-name {
font-weight: 600;
}
.card-info {
margin-left: 10rpx;
display: flex;
justify-content: space-between;
align-items: center;
.btn-status {
font-size: 30rpx;
display: flex;
}
}
.title-bar {
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: flex-start;
}
.order-body {
padding: 16px 0;
}
.web-text-price {
padding-right: 30rpx;
font-size: 36rpx;
color: #fecc66;
}
}
.card-bg {
}
}
.card-item {
width: 700rpx;
margin: 20rpx auto;
border-radius: 20rpx;
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 {
padding: 20rpx 0;
.merchant-avatar {
margin-right: 12rpx;
}
.card-name {
font-weight: 600;
}
.btn-status {
font-size: 30rpx;
display: flex;
}
}
.order-body {
padding: 16px 0;
}
}
.ele-flex {
display: flex;
justify-content: space-between;
display: flex;
justify-content: space-between;
}
.card-actions {
display: flex;
flex-direction: row;
justify-content: flex-end;
align-items: center;
height: 45px;
border-top: 1px #eee solid;
display: flex;
flex-direction: row;
justify-content: flex-end;
align-items: center;
height: 45px;
border-top: 1px #eee solid;
}
.card-actions-item {
display: flex;
flex-direction: row;
align-items: center;
display: flex;
flex-direction: row;
align-items: center;
}
.card-actions-item-text {
font-size: 12px;
color: #666;
margin-left: 5px;
font-size: 12px;
color: #666;
margin-left: 5px;
}
.close {
top: 60rpx !important;
top: 60rpx !important;
}
.total-price {
display: flex;
flex-direction: column;
justify-content: flex-start;
font-size: 30rpx;
align-items: flex-start;
padding-left: 6rpx;
margin-left: 450rpx;
display: flex;
flex-direction: column;
justify-content: flex-start;
font-size: 30rpx;
align-items: flex-start;
padding-left: 6rpx;
margin-left: 450rpx;
.web-text-heading {
font-size: 30rpx !important;
}
.web-text-heading {
font-size: 30rpx !important;
}
}
</style>
+9 -3
View File
@@ -106,11 +106,12 @@
const app = this
// 当前登录用户信息
const userInfo = await userStore.fetchUserInfo();
this.userInfo = userInfo
if (Object.keys(userInfo).length > 0) {
app.isLogin = true
app.form = userInfo
// 获取用户副表信息
UserApi.getThinkUsers(uni.getStorageSync('uid')).then(data => {
UserApi.getThinkUsers(userInfo.uid).then(data => {
if (data) {
app.form = Object.assign({}, app.form, data);
}
@@ -159,8 +160,13 @@
})
return false
}
UserApi.updateThinkUsers(this.form).then(res => {
const formData = {
id: this.form.id,
idcard: this.form.idcard,
truename: this.form.truename,
userId: this.userInfo.userId
}
UserApi.updateThinkUsers(formData).then(res => {
uni.showToast({
title: '保存成功',
icon: 'success'