初始化

This commit is contained in:
2024-07-10 13:50:01 +08:00
commit e30966c6c5
1073 changed files with 143076 additions and 0 deletions
+549
View File
@@ -0,0 +1,549 @@
<template>
<view class="container">
<!-- deBug信息 -->
<view class="web-debug web-text-success" style="display: none">
场馆ID:{{ merchantId }} 场馆编号:{{ merchantCode }} 场馆名称:{{ merchantName }} 日期:{{ dateTime }} 星期:{{ week }} 订单总金额:{{ totalPrice }} 类型:{{
type
}}
商品信息:{{ goodsList }}
</view>
<!-- {{ address }} -->
<uni-card :border="false" :is-shadow="false">
<uv-cell
v-if="address.name"
:title="`${address.name} &nbsp; ${address.phone}`"
:label="`${address.address}`"
icon="map"
:cellStyle="{ padding: '5px 0' }"
:border="false"
@click="openAddressList"
>
<template v-slot:right-icon>
<uv-icon name="arrow-right"></uv-icon>
</template>
</uv-cell>
</uni-card>
<uni-card title="订单信息" :border="false" :is-shadow="false">
<uv-cell-group :customStyle="{ backgroundColor: '#ffffff' }" :border="false">
<block v-if="goodsList.length == 0">
<span class="web-text-secondary">商品不存在</span>
</block>
<block v-if="goodsList">
<block v-for="(item, index) in goodsList" :key="index">
<uv-cell :title="`${item.goodsName}`" :label="`${item.comments}`" :cellStyle="{ padding: '10px 0' }" :border="false" :value="`¥${item.price}`">
<template v-slot:icon>
<uv-avatar :src="item.image" size="60" shape="square"></uv-avatar>
</template>
</uv-cell>
</block>
</block>
</uv-cell-group>
</uni-card>
<uni-card title="选择支付方式" :border="false" :is-shadow="false">
<uv-cell-group :customStyle="{ backgroundColor: '#ffffff' }" :border="false">
<block v-for="(item, index) in payment" :key="index">
<uv-cell
:title="`${item.name}`"
:icon="`${item.image}`"
:cellStyle="{ padding: '20rpx 10rpx', borderRadius: '8rpx', backgroundColor: item.type == payType ? '#f6fff1' : '' }"
:border="false"
@click="onPayType(item.type)"
>
<template v-slot:right-icon>
<uv-icon v-if="item.type == payType" size="30rpx" name="checkbox-mark"></uv-icon>
</template>
</uv-cell>
</block>
</uv-cell-group>
<view slot="actions" class="card-actions">
<view class="card-actions-item" @click="actionsClick('分享')">
<span class="web-text-danger">已优惠¥0.00</span>
<span class="web-text-heading">¥{{ totalPrice || 0.0 }}</span>
</view>
</view>
</uni-card>
<view class="xieyi web-cell web-text-secondary web-cell-align-top">
<view class="web-cell web-cell-content web-cell-align-top">
<uni-icons type="circle" size="20" color="#a4a5a7" v-if="!disabled" @click="onDisabled"></uni-icons>
<uni-icons type="checkbox" size="20" color="#11a954" v-else @click="onDisabled"></uni-icons>
<view class="text" @click="onDisabled">
<text>同意以下服务条款</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>
</view>
</view>
</view>
<!-- 支付按钮 -->
<uv-gap height="50"></uv-gap>
<view class="checkout-car">
<view class="car-total">
<text style="color: #ebcf00">合计¥</text>
<uv-count-to :startVal="0" decimals="2" duration="100" color="#ebcf00" bold :endVal="totalPrice"></uv-count-to>
</view>
<uv-button
class="save-btn"
:disabled="!disabled || goodsList.length == 0"
:customStyle="{ background: 'linear-gradient(to right, #70b915, #008e04)', borderRadius: '0 30px 30px 0', color: '#ffffff', border: 'none', padding: '22px 30px' }"
text="提交订单"
@click="save"
></uv-button>
</view>
</view>
<!-- 收货地址选择弹窗 -->
<uni-popup ref="addForm" type="center" border-radius="10px 10px 0 0">
<uni-card title="选择收货地址" :border="false" :is-shadow="false" :padding="0">
<view class="address-body web-cell web-cell-align-top">
<view class="web-cell-content">
<uv-cell-group :customStyle="{ backgroundColor: '#ffffff' }" :border="false">
<block v-for="(item, index) in addressList" :key="index">
<uv-cell :cellStyle="{ padding: '10px 0' }" :label="item.address" @click="onAddress(item)">
<template v-slot:icon>
<uv-avatar :text="item.type" fontSize="12" size="32" randomBgColor></uv-avatar>
</template>
<template v-slot:title>
<view class="title-bar">
<text class="web-text-heading" style="font-weight: 700">{{ item.name }}</text>
<text class="web-text-secondary">{{ item.phone }}</text>
<uni-tag v-if="item.isDefault" text="默认" size="mini" inverted type="success"></uni-tag>
</view>
</template>
<template v-slot:right-icon>
<uni-icons type="right" style="color: #999999"></uni-icons>
</template>
</uv-cell>
</block>
<uv-button class="add-address" :customStyle="{ borderRadius: '30px' }" text="收货地址管理" @click="navTo('/package/user/address')"></uv-button>
</uv-cell-group>
</view>
</view>
</uni-card>
</uni-popup>
<!-- 支付密码弹窗 -->
<uni-popup ref="payPasswordForm" type="center" border-radius="10px 10px 0 0">
<uni-card title="请输入支付密码" :border="false" :is-shadow="false" :padding="0">
<view class="pay-password-card">
<uni-forms ref="form" :label-width="80">
<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>
</uni-forms-item>
<!-- <uv-button
class="to-pay-btn"
:customStyle="{ background: 'linear-gradient(to right, #70b915, #008e04)', borderRadius: '30px', color: '#ffffff' }"
text="确定支付"
:disabled="disabledPayPayPassword"
@click="onPayPassword"
></uv-button> -->
</uni-forms>
<text @click="navTo(`/package/user/pay-password`)" class="web-text-primary">忘记支付密码?</text>
</view>
</uni-card>
</uni-popup>
<!-- 登录组件 -->
<ws-login ref="login" :logo="logo" @done="reload" />
</template>
<script>
import * as Api from '@/api/shop/order';
import * as UserAddressApi from '@/api/shop/userAddress';
import * as PaymentApi from '@/api/system/payment';
import { checkPayPassword } from '@/api/passport/login';
import { storeToRefs } from 'pinia';
import { getWeek, getKey } from '@/utils/common';
import { useCarStore } from '@/store/modules/car';
import { useUserStore } from '@/store/modules/user';
const userStore = useUserStore();
const carStore = useCarStore();
const { goodsList, totalPrice, carNum, merchantId, merchantName, merchantCode, type, dateTime } = storeToRefs(carStore);
export default {
data() {
return {
orderId: 0,
goodsId: 0,
userInfo: {},
address: {},
addressList: [],
week: 0,
goodsList,
// 订单总金额
totalPrice,
reducePrice: 0,
merchantId,
merchantName,
merchantCode,
getWeek,
payType: 1,
payment: [],
isLogin: false,
disabled: false,
// 支付密码是否正确
isPayPasswordCorrect: false,
disabledPayPayPassword: false,
payPassword: ''
};
},
onLoad(option) {
this.orderId = option.orderId;
this.reload();
},
onShow() {
// 登录状态
if (uni.getStorageSync('user_id') && uni.getStorageSync('access_token')) {
this.isLogin = true;
}
this.openLogin();
},
methods: {
async reload() {
const app = this;
const { orderId } = this;
// 当前登录用户信息
const userInfo = await userStore.fetchUserInfo();
app.userInfo = userInfo;
UserAddressApi.pageUserAddress({
userId: uni.getStorageSync('user_id')
}).then((res) => {
app.addressList = res.list;
const arr = res.list.filter((d) => d.isDefault === true);
app.address = arr[0];
});
// 读取支付方式列表
PaymentApi.select({ status: true }).then((list) => {
app.payment = list
.filter((d) => d.type < 2)
.map((d) => {
if (d.code == 'balancePay') {
d.name = `${d.name} (¥${userInfo.balance})`;
}
return d;
});
});
// if (orderId > 0) {
// Api.getOrder(orderId).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() {
this.disabled = !this.disabled;
},
navTo(url) {
uni.navigateTo({
url
});
},
openUrl(url) {
if (!this.isLogin) {
this.$refs.login.open('bottom');
return false;
} else {
uni.navigateTo({
url
});
}
},
onAddress(item) {
this.address = item;
this.$refs.addForm.close();
},
// 切换支付方式
onPayType(index) {
this.payType = index;
},
openAddressList() {
this.$refs.addForm.open('center');
},
// 弹出登录提示框
openLogin() {
if (!this.isLogin) {
this.$refs.login.open('bottom');
return false;
}
},
// 验证支付密码
onPayPassword() {
if (this.payPassword == '' || !this.payPassword) {
uni.showToast({
title: '请输入支付密码',
icon: 'none'
});
return false;
}
this.disabledPayPayPassword = true;
const { payPassword } = this;
checkPayPassword({ payPassword })
.then((res) => {
this.disabledPayPayPassword = false;
this.isPayPasswordCorrect = true;
this.save();
})
.catch((err) => {
uni.showToast({
title: err.message,
icon: 'none'
});
this.disabledPayPayPassword = false;
});
},
save() {
const app = this;
const { form, payType } = this;
if (!this.disabled) {
uni.showToast({
title: '请先阅读并同意服务协议',
icon: 'none'
});
return false;
}
if (carStore.goodsList.length == 0) {
uni.showToast({
title: '订单信息不存在',
icon: 'none'
});
return false;
}
if (app.payType == 0 && !this.isPayPasswordCorrect) {
this.$refs.payPasswordForm.open('center');
return false;
}
uni.showLoading({
title: '订单提交中.'
});
Api.addOrder({
type: 0, // 0商城订单
orderId: this.orderId,
merchantId: this.merchantId,
merchantCode: this.merchantCode,
merchantName: this.merchantName,
totalPrice: this.totalPrice,
payPrice: this.totalPrice - this.reducePrice,
goodsList: this.goodsList,
comments: this.goodsList[0].goodsName,
// 微信支付
payType: this.payType,
// 下单日期
dateTime: this.dateTime
})
.then((data) => {
const orderInfo = data;
// 调起微信支付
if (app.payType == 1) {
// #ifdef MP-WEIXIN
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 () {
app.disabled = false;
uni.navigateTo({
url: '/package/goods/order'
});
}, 500);
},
fail: function (err) {
console.log('支付失败', err);
app.disabled = false;
uni.navigateTo({
url: '/package/goods/order'
});
}
});
// #endif
}
// 使用余额支付
if (app.payType == 0) {
if (!orderInfo) {
return uni.showToast({
title: '支付失败',
icon: 'error'
});
}
if (orderInfo) {
uni.showToast({
title: '支付成功',
icon: 'success'
});
setTimeout(function () {
app.disabled = false;
app.$refs.payPasswordForm.close();
uni.reLaunch({
url: '/package/goods/order',
success: function (e) {
var page = getCurrentPages()[0];
if (page == undefined || page == null) return;
page.onLoad();
}
});
}, 1500);
}
}
uni.hideLoading();
})
.catch((res) => {
uni.showToast({
title: res.message || '请检查您的网络.',
icon: 'none'
});
uni.hideLoading();
});
}
}
};
</script>
<style>
page {
background-size: 100%;
background-repeat: no-repeat;
background-color: #f0f2f5;
width: 750rpx;
overflow-x: hidden;
}
</style>
<style lang="scss" scoped>
.container {
}
.checkout-car {
width: 700rpx;
left: 25rpx;
position: fixed;
bottom: 30rpx;
display: flex;
justify-content: space-between;
background-color: #000000;
border-radius: 100px;
align-items: center;
.car-selected {
color: #ccc;
display: flex;
align-items: center;
padding: 0 20rpx;
}
.car-total {
display: flex;
color: #ebcf00;
align-items: center;
padding-left: 40rpx;
.save-btn {
}
}
}
.card-actions {
display: flex;
flex-direction: row;
justify-content: flex-end;
height: 45px;
border-top: 1px #eee solid;
}
.card-actions-item {
display: flex;
flex-direction: row;
align-items: center;
.web-text-heading {
font-size: 38rpx;
margin-left: 28rpx;
}
}
.card-actions-item-text {
font-size: 12px;
color: #666;
margin-left: 5px;
}
.address-body {
width: 660rpx;
margin: auto;
}
.add-address {
width: 600rpx !important;
margin: 40rpx auto;
}
.btn-bar {
width: 700rpx;
left: 25rpx;
position: fixed;
bottom: 30rpx;
margin: auto;
clear: both;
}
.title-bar {
display: flex;
.web-text-heading {
margin-right: 20rpx;
}
.web-text-secondary {
margin-right: 20rpx;
}
}
.xieyi {
margin-bottom: 80rpx;
padding: 0 30rpx;
.text {
margin-left: 5rpx;
.link {
color: #0f80ff;
}
}
}
.pay-password-card {
width: 600rpx;
min-height: 300rpx;
margin: 30rpx auto;
background-color: #ffffff;
text-align: center;
display: flex;
justify-content: center;
flex-direction: column;
align-items: center;
.web-text-primary {
line-height: 2rem;
padding: 20rpx 0;
}
}
.to-pay-btn {
width: 400rpx !important;
margin: 40rpx auto;
}
</style>
+357
View File
@@ -0,0 +1,357 @@
<template>
<view class="">
<view class="goods-info">
<uv-swiper :list="photo" indicator indicatorMode="line" circular height="750rpx" radius="0"></uv-swiper>
</view>
<!-- <view class="merchant-name">{{ form.merchantName }}</view> -->
<uni-card :border="false" :is-shadow="false" :padding="0">
<uv-cell-group :customStyle="{backgroundColor: '#ffffff'}" :border="false">
<uv-cell :cellStyle="{padding: '10px 5px'}">
<template v-slot:title>
<view class="pirce-bar" style="display: flex;">
<view class="web-text-danger">¥</view>
<view class="web-text-danger" style="font-size: 40rpx;">{{ form.price }}</view>
</view>
</template>
<template v-slot:right-icon>
<text class="web-text-secondary" style="text-decoration: line-through">划线价¥{{ form.price*2 }}</text>
</template>
</uv-cell>
<uv-cell :title="form.goodsName" label="商品名称" :cellStyle="{padding: '10px 5px'}">
</uv-cell>
<uv-cell title="选择款式" :label="`100zz【藏青色】、100zz【古红色】`" isLink
:cellStyle="{padding: '10px 5px'}">
<template v-slot:right-icon>
<!-- <uv-icon size="50rpx" name="map-fill" color="#5ac725" style="color: #ff0000;"></uv-icon> -->
</template>
</uv-cell>
<uv-cell title="参数" :label="form.goodsName" :cellStyle="{padding: '10px 5px'}">
</uv-cell>
<uv-cell title="客服电话" label="0771-8888888" :border="false" :cellStyle="{padding: '10px 5px'}"
@click="callPhone('0771-8888888')">
</uv-cell>
</uv-cell-group>
</uni-card>
<uni-card title="商品详情" :is-shadow="false" :border="false" :padding="0">
<view class="web-text-heading booking-content">
<view v-html="form.content"></view>
</view>
</uni-card>
<view class="xieyi web-cell web-text-secondary web-cell-align-top">
<view class="web-cell web-cell-content web-cell-align-top">
<uni-icons type="circle" size="20" color="#a4a5a7" v-if="!disabled" @click="onDisabled"></uni-icons>
<uni-icons type="checkbox" size="20" color="#11a954" v-else @click="onDisabled"></uni-icons>
<view class="text" @click="onDisabled">
<text>我已阅读并同意</text>
<text class="link"
@click.stop="navTo('/package/article/detail?articleId=503')">《购买协议》</text>
</view>
</view>
</view>
<uv-gap height="50"></uv-gap>
<view class="save-btn">
<uv-button
:customStyle="{background: 'linear-gradient(to right, #ccff66, #008e04)',borderRadius: '30px',color: '#ffffff'}"
text="立即购买" @click="save"></uv-button>
</view>
<!-- <view class="goods-nav-btn">
<uni-goods-nav :fill="true" :options="options" :button-group="buttonGroup" @click="onClick"
@buttonClick="buttonClick" />
</view> -->
</view>
<!-- 活动订场弹窗 -->
<uni-popup ref="popup" type="center">
<view class="popup-booking-tel">
<text class="title">场馆热线</text>
<text class="desc">主体育场、足球训练场:0771-4953380</text>
<text class="desc">体育馆、综合训练馆、网球馆:0771-4953380</text>
<text class="desc">游泳跳水馆:0771-4736008</text>
<text class="title">参观接待</text>
<text class="desc">预约电话:0771-4736955</text>
<text class="desc">传真号码:0771-4736955</text>
<text class="title">大型活动订场</text>
<text class="desc">预约电话:0771-4736970、0771-4736994</text>
<text class="title">威拓普健身馆</text>
<text class="desc">联系电话:0771-5588699</text>
</view>
<view class="web-cell popup-close" @click="closeBookingTel">
<uv-icon name="close-circle" color="#ffffff" size="30"></uv-icon>
</view>
</uni-popup>
<!-- 登录组件 -->
<ws-login ref="login" :logo="logo" @done="reload" />
</template>
<script>
import {
storeToRefs
} from 'pinia';
import * as GoodsApi from '@/api/shop/goods';
import {
useCarStore
} from '@/store/modules/car';
const carStore = useCarStore();
const {
goodsList,
orderInfo,
totalPrice,
carNum,
merchantId,
merchantName,
merchantCode,
type,
dateTime
} = storeToRefs(carStore)
export default {
data() {
return {
id: 0,
form: {},
// 场馆相册
photo: [],
isLogin: false,
disabled: true,
orderInfo,
goodsList,
totalPrice,
carNum,
merchantId,
merchantName,
merchantCode,
type,
dateTime,
options: [{
icon: 'headphones',
text: '客服'
}, {
icon: 'cart',
text: '购物车',
info: 2
}],
buttonGroup: [
{
text: '立即购买',
backgroundColor: 'linear-gradient(90deg, #ccff66, #008e04)',
color: '#fff'
}
],
customButtonGroup1: [{
text: '立即购买',
backgroundColor: 'linear-gradient(90deg, #ccff66, #008e04)',
color: '#fff'
}]
}
},
onLoad(option) {
this.id = option.id
this.reload();
},
onShow() {
// 登录状态
if (uni.getStorageSync('user_id') && uni.getStorageSync('access_token')) {
this.isLogin = true;
}
},
methods: {
async reload() {
const app = this
// 请求数据
Promise.all([app.getGoods()]).then(data => {
console.log('data: ', data);
const form = data[0]
app.form = form;
carStore.merchantId = form.merchantId
carStore.merchantName = form.merchantName
carStore.merchantCode = form.merchantCode
// 修改标题
uni.setNavigationBarTitle({
title: form.goodsName
})
// 加载场馆相册
if (form.files) {
app.photo = JSON.parse(form.files)
}
})
},
getGoods() {
return new Promise((resolve, reject) => {
GoodsApi.getGoods(this.id).then(result => {
resolve(result)
}).catch(reject)
})
},
onDisabled() {
this.disabled = !this.disabled;
},
navTo(url) {
uni.navigateTo({
url
})
},
openBookingTel() {
// 通过组件定义的ref调用uni-popup方法 ,如果传入参数 ,type 属性将失效 ,仅支持 ['top','left','bottom','right','center']
this.$refs.popup.open('center')
},
closeBookingTel() {
this.$refs.popup.close()
},
callPhone(phone) {
uni.makePhoneCall({
phoneNumber: phone
});
},
onMap() {
uni.getLocation({
type: 'gcj02', //返回可以用于uni.openLocation的经纬度
success: function(res) {
console.log('返回可以用于uni.openLocation的经纬度: ', res);
const latitude = this.merchant.latitude;
const longitude = this.merchant.longitude;
uni.openLocation({
latitude: latitude,
longitude: longitude,
success: function() {
console.log('success');
}
});
}
});
},
save() {
if (!this.disabled) {
uni.showToast({
title: '请先阅读并同意订票协议',
icon: 'none'
})
return false
}
const app = this
const { form } = this
carStore.totalPrice = form.price
app.goodsList = []
form.image = JSON.parse(form.image)[0]
app.goodsList.push(form)
carStore.goodsList = app.goodsList
// 跳转页面
uni.navigateTo({
url: '/package/goods/checkout?goodsId=' + this.id
})
}
}
}
</script>
<style>
page {
background-size: 100%;
background-repeat: no-repeat;
background-color: #f0f2f5;
width: 750rpx;
overflow-x: hidden;
}
</style>
<style lang="scss" scoped>
.container {}
.goods-info {
width: 750rpx;
height: 750rpx;
background-color: #fff;
}
.merchant-name {
padding: 30rpx;
font-weight: 500;
font-size: 42rpx;
background-color: #ffffff;
}
.save-btn {
width: 700rpx;
left: 25rpx;
height: 80rpx;
position: fixed;
bottom: 30rpx;
}
.booking-tel {
position: fixed;
z-index: 1;
top: 270px;
right: 0;
width: 80px;
height: 38px;
border-radius: 50px 0 0 50px;
background: linear-gradient(to right, #ccff66, #008e04);
display: flex;
align-items: center;
justify-content: center;
color: #ffffff;
font-size: 13px;
}
.popup-booking-tel {
background-color: #ffffff;
width: 560rpx;
min-height: 400rpx;
border-radius: 20rpx;
margin: auto;
padding: 20px;
z-index: 9999;
display: flex;
flex-direction: column;
.title {
font-weight: bold;
font-size: 38rpx;
text-align: center;
padding: 10px 0;
}
.desc {
line-height: 2rem;
}
}
.popup-close {
display: flex;
margin-top: 24rpx;
justify-content: center;
}
.booking-content {
padding: 10px;
font-size: 30rpx;
line-height: 1.5rem;
}
.xieyi {
margin-bottom: 80rpx;
padding: 0 30rpx;
.text {
margin-left: 5rpx;
.link {
color: #0f80ff;
}
}
}
.goods-nav-btn {
width: 750rpx;
position: fixed;
bottom: 0;
background-color: #fff;
}
</style>
+410
View File
@@ -0,0 +1,410 @@
<template>
<view>
<view class="segmented">
<uni-segmented-control :current="current" :values="items" :styleType="styleType" :activeColor="activeColor" inActiveColor="#808080" @clickItem="onClickItem" />
</view>
<view class="order">
<block v-if="orderList.length > 0">
<block v-for="(item, index) in orderList" :key="index">
<uni-card :border="false" :is-shadow="false" :padding="0">
<template v-slot:title>
<div class="order-title web-cell">
<view class="web-cell web-cell-content">
<view class="merchant-avatar">
<uv-avatar :src="item.merchantAvatar" size="24"></uv-avatar>
</view>
<text class="merchant-name">{{ item.merchantName }}</text>
</view>
<block v-if="item.orderStatus == 2">
<text class="btn-status web-text-secondary">已取消</text>
</block>
<block v-else-if="item.orderStatus == 1">
<text class="btn-status web-text-success">已完成</text>
</block>
<block v-else>
<text v-if="item.payStatus == 1" class="btn-status web-text-success">已支付</text>
<view v-if="item.payStatus == 0" class="btn-status web-text-danger">
<uv-count-down :time="item.timestamp" format="mm:ss"></uv-count-down>
<text class="no-pay" style="margin-left: 10rpx">未支付</text>
</view>
</block>
</div>
</template>
<view class="order-body web-cell web-cell-align-top">
<view class="web-cell-content">
<uv-cell-group :customStyle="{ backgroundColor: '#ffffff' }" :border="false">
<block v-for="(sub, subIndex) in item.goodsList" :key="subIndex">
<uv-cell
:title="`${sub.goodsName}`"
:label="`${sub.comments}`"
:cellStyle="{ padding: '0', paddingBottom: '5px' }"
:border="false"
@click="openUrl(`/package/order/detail?id=${item.orderId}`)"
>
<template v-slot:icon>
<uv-avatar :src="sub.image" fontSize="12" size="50" shape="square"></uv-avatar>
</template>
<template v-slot:value>
<view class="goods-price-bar">
<view class="goods-price web-text-heading">¥{{sub.price}}</view>
<view class="total-num web-text-secondary" style="font-size: 13px;letter-spacing: 1px;">共{{ item.totalNum }}件</view>
</view>
</template>
</uv-cell>
</block>
</uv-cell-group>
<!-- <view class="total-price">
<view class="web-text-heading">合计:¥{{ item.totalPrice }}</view>
<view class="web-text-heading" style="font-weight: 500">实付:¥{{ item.totalPrice - item.reducePrice }}</view>
</view> -->
</view>
</view>
<view slot="actions" class="card-actions">
<view class="card-actions-item" v-if="item.payStatus == 0 && item.orderStatus == 0">
<button class="mini-btn" size="mini" @click="closeOrder(item)" style="margin-right: 20rpx">取消订单</button>
<button class="mini-btn" type="primary" size="mini" @click="toPay(item.orderId)">去支付</button>
</view>
<view class="card-actions-item" v-if="item.payStatus == 1 && item.isInvoice == 0" @click="onInvoice(item.orderId)">
<button class="mini-btn" size="mini">申请开票</button>
</view>
</view>
</uni-card>
</block>
</block>
<block v-if="orderList.length == 0 && loadMore != 'no-more'">
<uni-card :border="false" :padding="'18px 6px'">
<uv-skeleton rows="3" avatar :loading="hideTools" :title="false"></uv-skeleton>
<uv-gap height="16"></uv-gap>
</uni-card>
<uni-card :border="false" :padding="'18px 6px'">
<uv-skeleton rows="3" avatar :loading="hideTools" :title="false"></uv-skeleton>
<uv-gap height="16"></uv-gap>
</uni-card>
<uni-card :border="false" :padding="'18px 6px'">
<uv-skeleton rows="3" avatar :loading="hideTools" :title="false"></uv-skeleton>
<uv-gap height="16"></uv-gap>
</uni-card>
<uni-card :border="false" :padding="'18px 6px'">
<uv-skeleton rows="3" avatar :loading="hideTools" :title="false"></uv-skeleton>
<uv-gap height="16"></uv-gap>
</uni-card>
</block>
<uni-load-more v-if="orderList.length > 0" :status="loadMore"></uni-load-more>
<!-- 登录组件 -->
<ws-login ref="login" :logo="logo" @done="reload" />
</view>
</view>
</template>
<script>
import * as OrderApi from '@/api/shop/order';
import { pageWechatDeposit } from '@/api/shop/wechatDeposit';
import { getWeek, getKey } from '@/utils/common';
export default {
components: {},
data() {
return {
isRefresh: false,
isLogin: false,
userId: 0,
where: {
page: 1,
type: 0, // 0商城订单 1场地预定
sceneType: 'showOrderGoods' // 查询订单附加场地信息
},
canReset: false,
loadMore: 'more',
logo: '',
items: ['全部', '待付款', '待发货', '待收货', '已完成'],
orderList: [],
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()
// if(option.isRefresh){
// this.isRefresh = true
// }
},
onShow(e) {
// 判断是否登录
this.openLogin();
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';
OrderApi.pageOrder(where)
.then((res) => {
const list = res.list.map((d) => {
console.log(d);
return d;
});
if (app.orderList.length < res.count) {
console.log('11111: ', 11111);
app.orderList = app.orderList.concat(list);
app.canReset = true;
app.loadMore = 'no-more';
} else {
app.canReset = false;
app.loadMore = 'no-more';
console.log('22222: ', 22222);
}
uni.hideLoading();
app.isRefresh = false;
})
.catch(() => {
uni.showToast({
title: '请检查您的网络.',
icon: 'none'
});
uni.hideLoading();
app.isRefresh = false;
});
},
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 = 0;
where.orderStatus = undefined;
}
// 已支付
if (index == 2) {
where.payStatus = 1;
where.orderStatus = undefined;
}
// 已完成
if (index == 3) {
where.payStatus = 1;
where.orderStatus = 1;
}
// 押金
if (index == 4) {
pageWechatDeposit({
uid: uni.getStorageSync('user_id')
}).then((res) => {
app.orderList = res.list;
if (res.count == 0) {
app.loadMore = 'no-more';
}
uni.hideLoading();
});
return false;
}
this.where.page = 1;
this.orderList = [];
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) {
OrderApi.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;
}
},
// 申请开票
onInvoice(id) {
uni.navigateTo({
url: '/package/user/invoice?id=' + id
});
}
}
};
</script>
<style lang="scss">
.content {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
justify-content: center;
align-items: center;
height: 150px;
text-align: center;
}
.segmented {
padding: 0 12rpx;
}
.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: flex-end;
align-items: center;
height: 45px;
border-top: 1px #eee solid;
}
.card-actions-item {
display: flex;
flex-direction: row;
align-items: center;
}
.card-actions-item-text {
font-size: 12px;
color: #666;
margin-left: 5px;
}
.close {
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;
.web-text-heading {
font-size: 30rpx !important;
}
}
.goods-price-bar{
display: flex;
flex-direction: column;
align-items: flex-end;
}
</style>