会员权益

This commit is contained in:
2026-04-29 15:33:58 +08:00
commit 54965243da
2787 changed files with 242809 additions and 0 deletions

565
pagesMall/order/details.vue Normal file
View File

@@ -0,0 +1,565 @@
<!-- +----------------------------------------------------------------------
| 麦沃德科技赋能开发者助力商协会发展
+----------------------------------------------------------------------
| Copyright (c) 20172024 www.wdsxh.cn All rights reserved.
+----------------------------------------------------------------------
| 沃德商协会系统并不是自由软件不加密并不代表开源未经许可不可自由转售和商用
+----------------------------------------------------------------------
| Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
+----------------------------------------------------------------------
| 订单详情 开发者: 麦沃德科技-半夏
+---------------------------------------------------------------------- -->
<template>
<view class="container" :style="{ '--theme-color': themeColor }">
<!-- 标题栏 -->
<title-bar :showBack="true" title="订单详情"></title-bar>
<!-- 内容区 -->
<view class="container-main" :style="{paddingBottom: (orderInfo.state == 1 || orderInfo.state == 2 || orderInfo.state == 3) ? '144rpx' : '32rpx'}" v-if="loadEnd">
<!-- 订单状态 -->
<view class="main-status">
<block v-if="orderInfo.state == 1">
<view class="status-text">待付款</view>
<view class="status-tips flex align-items-center">
<view class="icon" :style="{'background-image': 'url('+ iconClock +')'}" v-if="iconClock"></view>
<view class="text">商品未付款,请及时付款</view>
</view>
</block>
<block v-else-if="orderInfo.state == 2">
<view class="status-text">
<text v-if="orderInfo.delivery_method == 2">待自提</text>
<text v-else>待发货</text>
</view>
<view class="status-tips flex align-items-center">
<view class="icon" :style="{'background-image': 'url('+ iconClock +')'}" v-if="iconClock"></view>
<view class="text">
<text v-if="orderInfo.delivery_method == 2">商品待自提</text>
<text v-else>商品待发货</text>
</view>
</view>
</block>
<block v-else-if="orderInfo.state == 3">
<view class="status-text">待收货</view>
<view class="status-tips flex align-items-center">
<view class="icon" :style="{'background-image': 'url('+ iconClock +')'}" v-if="iconClock"></view>
<view class="text">商品已发货,请及时收货</view>
</view>
</block>
<block v-else-if="orderInfo.state == 4">
<view class="status-text">已完成</view>
<view class="status-tips flex align-items-center">
<view class="icon" :style="{'background-image': 'url('+ iconClock +')'}" v-if="iconClock"></view>
<view class="text">商品已完成收货</view>
</view>
</block>
</view>
<!-- 到店自提 -->
<view class="main-address" v-if="orderInfo.delivery_method == 2">
<view class="address-title">自提地址</view>
<view class="address-box flex align-items-center" @click="toNavigation()">
<view class="box-text flex-item">{{mallConfig.address}}</view>
<view class="box-icon" :style="{'background-image': 'url('+ iconMore +')'}" v-if="iconMore"></view>
</view>
<view class="address-info flex flex-wrap" v-if="mallConfig.mobile" @click="onContact()">{{mallConfig.mobile}}</view>
</view>
<!-- 地址选择 -->
<view class="main-address" v-else>
<view class="address-name">{{orderInfo.user_address || ""}}</view>
<view class="address-info flex flex-wrap" v-if="orderInfo.real_name || orderInfo.user_phone">
<text v-if="orderInfo.real_name">{{orderInfo.real_name}}</text>
<text v-if="orderInfo.user_phone">{{orderInfo.user_phone}}</text>
</view>
</view>
<!-- 自提提货码 -->
<view class="main-code" v-if="orderInfo.delivery_method == 2 && orderInfo.pick_up_code">
<view class="code">{{orderInfo.pick_up_code}}</view>
<view class="label">提货码</view>
</view>
<!-- 商品信息 -->
<view class="main-goods">
<block v-for="(item, index) in orderInfo.goods" :key="index">
<mall-store :show-data="item"></mall-store>
</block>
</view>
<!-- 订单信息 -->
<view class="main-order">
<view class="order-info">
<view class="title">商品总额</view>
<view class="value">{{orderInfo.goods_price || ''}}</view>
</view>
<view class="order-info" v-if="orderInfo.delivery_method == 1">
<view class="title">运费总额</view>
<view class="value">{{orderInfo.pay_postage || '0.00'}}</view>
</view>
<view class="order-info">
<view class="title">总计金额</view>
<view class="value">{{orderInfo.total_price || '0.00'}}</view>
</view>
<view class="order-info" v-if="orderInfo.delivery_method == 2">
<view class="title">发货方式</view>
<view class="value" style="color: #5A5B6E;">到店自提</view>
</view>
</view>
<!-- 底部按钮 -->
<view class="main-footer" v-if="orderInfo.state == 1 || orderInfo.state == 2 || orderInfo.state == 3">
<view class="flex align-items-center" v-if="orderInfo.state == 1">
<view class="footer-money"><text></text>{{orderInfo.total_price}}</view>
<view class="footer-btn flex-item" :style="{background: themeColor}" @click="handlePayment()">立即支付</view>
<view class="footer-btn flex-item" style="background: #FF626E;" @click="handleCancel()">取消订单</view>
</view>
<view class="flex align-items-center" v-if="orderInfo.state == 2">
<view class="footer-btn flex-item" style="background: #FF626E;" @click="handleRefund()">申请退款</view>
</view>
<view class="flex align-items-center" v-if="orderInfo.state == 3">
<view class="footer-btn flex-item" style="background: #FF626E;" @click="handleRefund()">申请退款</view>
<view class="footer-btn flex-item" :style="{background: themeColor}" @click="handleDelivery()">确认收货</view>
</view>
<view class="safe-padding"></view>
</view>
</view>
</view>
</template>
<script>
import { mapState } from "vuex"
import mallStore from "@/pagesMall/component/mall/store.vue"
import svgData from "@/common/svg.js"
export default {
components: {
mallStore
},
data() {
return {
// 是否加载完成
loadEnd: false,
// 订单id
orderId: null,
// 订单号
orderNo: null,
// 订单详情
orderInfo: {},
// 商城配置
mallConfig: {},
// 延时器
delayer: null,
};
},
computed: {
...mapState({
themeColor: state => state.app.themeColor,
iconClock: state => {
return svgData.svgToUrl("clock", state.app.themeColor)
},
iconMore: state => {
return svgData.svgToUrl("more", state.app.themeColor)
},
deliveryManagement: state => state.app.deliveryManagement,
})
},
onLoad(option) {
if (uni.getStorageSync("token")) {
uni.showLoading({
title: "加载中"
})
if (option.order_id) this.orderId = option.order_id;
else if (option.id) this.orderNo = option.id;
this.getMallConfig()
this.getOrderDetails(() => {
uni.hideLoading()
this.loadEnd = true
})
} else {
this.$util.verifyLogin(2)
}
},
onShow() {
if (this.loadEnd) this.getOrderDetails()
},
onUnload() {
if (this.delayer) clearTimeout(this.delayer)
},
methods: {
// 获取订单详情
getOrderDetails(fn) {
var data = {}
if (this.orderId) data.id = this.orderId
else if (this.orderNo) data.order_no = this.orderNo
this.$util.request("mall.orderDetails", data).then(res => {
if (fn) fn()
if (res.code == 1) {
this.orderInfo = res.data
this.orderInfo.goods_price = parseFloat(parseFloat(this.orderInfo.total_price) - parseFloat(this.orderInfo.pay_postage || 0)).toFixed(2)
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
}).catch(error => {
if (fn) fn()
console.error('获取订单详情', error)
})
},
// 获取商城配置
getMallConfig() {
this.$util.request("mall.config").then(res => {
if (res.code == 1) {
this.mallConfig = res.data
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
}).catch(error => {
console.error('获取商城配置', error)
})
},
// 取消订单
handleCancel() {
uni.showModal({
title: '提示',
content: '确认取消该订单吗?',
confirmText: '确认取消',
confirmColor: this.themeColor,
cancelText: '我再想想',
cancelColor: '#999999',
success: (res) => {
if (res.confirm) {
uni.showLoading({
title: "加载中",
mask: true
})
this.$util.request("mall.delOrder", {
order_id: this.orderInfo.id,
}).then(res => {
uni.hideLoading()
if (res.code == 1) {
uni.showToast({
title: "取消成功",
icon: "success",
mask: true,
duration: 1500
})
this.delayer = setTimeout(() => {
uni.navigateBack()
}, 1500)
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
}).catch(error => {
uni.hideLoading()
console.error('取消订单', error)
})
}
}
})
},
// 立即支付
handlePayment() {
this.$util.toPage({
mode: 1,
path: `/pagesMall/order/payment?money=${this.orderInfo.total_price}&id=${this.orderInfo.id}`
})
},
// 申请退款
handleRefund() {
this.$util.toPage({
mode: 1,
path: "/pagesMall/refund/apply?id=" + this.orderInfo.id
})
},
// 确认收货
handleDelivery() {
if (this.deliveryManagement == 1) {
if (wx.openBusinessView) {
wx.openBusinessView({
businessType: 'weappOrderConfirm',
extraData: { transaction_id: this.orderInfo.trade_no },
success: e => {
if (e.extraData.status === 'success') {
uni.showLoading({
title: "加载中",
mask: true
})
this.$util.request("mall.orderCollect", {
id: this.orderInfo.id,
}).then(res => {
uni.hideLoading()
if (res.code == 1) {
uni.showToast({
title: "签收成功",
icon: "success",
mask: true,
duration: 1500
})
this.delayer = setTimeout(() => {
uni.navigateBack()
}, 1500)
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
}).catch(error => {
uni.hideLoading()
console.error('确认收货', error)
})
} else {
console.error("调用微信收货", e)
}
},
fail: (err) => {
console.error("调用微信收货", err)
},
});
} else {
uni.showToast({
title: "您的微信版本过低,请升级微信版本后重试",
duration: 2000,
icon: "none",
});
}
} else {
uni.showModal({
title: '提示',
content: '确认此商品已收货,\n点击确认收货后订单完成?',
confirmText: '确认收货',
confirmColor: this.themeColor,
cancelText: '我再想想',
cancelColor: '#999999',
success: (res) => {
if (res.confirm) {
uni.showLoading({
title: "加载中",
mask: true
})
this.$util.request("mall.orderCollect", {
id: this.orderInfo.id,
}).then(res => {
uni.hideLoading()
if (res.code == 1) {
uni.showToast({
title: "签收成功",
icon: "success",
mask: true,
duration: 1500
})
this.delayer = setTimeout(() => {
uni.navigateBack()
}, 1500)
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
}).catch(error => {
uni.hideLoading()
console.error('确认收货', error)
})
}
}
})
}
},
// 跳转地图导航
toNavigation() {
this.$util.toPage({
mode: 7,
address: {
latitude: this.mallConfig.latitude,
longitude: this.mallConfig.longitude,
address: this.mallConfig.address,
},
})
},
// 联系
onContact() {
this.$util.toPage({
mode: 6,
phone: this.mallConfig.mobile,
})
},
}
}
</script>
<style lang="scss">
.container {
.container-main {
padding: 32rpx 32rpx 144rpx;
.main-status {
padding: 16rpx 16rpx 48rpx;
.status-text {
color: #5A5B6E;
font-size: 48rpx;
line-height: 68rpx;
}
.status-tips {
margin-top: 16rpx;
.icon {
width: 32rpx;
height: 32rpx;
background-size: 32rpx;
}
.text {
margin-left: 16rpx;
color: var(--theme-color);
font-size: 28rpx;
line-height: 40rpx;
}
}
}
.main-address {
border-radius: 20rpx;
padding: 32rpx;
background: #FFF;
.address-title {
color: #5A5B6E;
font-size: 28rpx;
font-weight: 600;
line-height: 40rpx;
margin-bottom: 24rpx;
}
.address-name {
color: #5A5B6E;
font-size: 32rpx;
line-height: 44rpx;
}
.address-box {
.box-text {
color: #5A5B6E;
font-size: 32rpx;
line-height: 44rpx;
margin-right: 64rpx;
}
.box-icon {
width: 32rpx;
height: 32rpx;
background-size: 32rpx;
}
}
.address-info {
margin-top: 24rpx;
color: #979797;
font-size: 28rpx;
line-height: 40rpx;
gap: 16rpx;
}
}
.main-code {
margin-top: 32rpx;
padding: 40rpx 32rpx;
border-radius: 16rpx;
background: #FFFFFF;
.code {
text-align: center;
color: #5A5B6E;
font-size: 40rpx;
font-weight: 600;
line-height: 56rpx;
}
.label {
margin-top: 12rpx;
color: #979797;
font-size: 24rpx;
line-height: 34rpx;
text-align: center;
}
}
.main-goods {
margin-top: 32rpx;
display: flex;
flex-direction: column;
row-gap: 32rpx;
}
.main-order {
margin-top: 32rpx;
padding: 32rpx;
border-radius: 16rpx;
background: #FFFFFF;
.order-info {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 32rpx;
&:first-child {
margin-top: 0;
}
.title {
color: #979797;
font-size: 28rpx;
line-height: 40rpx;
}
.value {
color: var(--theme-color);
font-size: 28rpx;
line-height: 40rpx;
margin-left: 24rpx;
}
}
}
.main-footer {
position: fixed;
left: 0;
right: 0;
bottom: 0;
z-index: 96;
background: #FFF;
border-top: 1rpx solid #F6F7FB;
padding: 16rpx 24rpx;
.footer-money {
color: var(--theme-color);
font-size: 40rpx;
line-height: 56rpx;
text {
font-size: 28rpx;
}
}
.footer-btn {
margin-left: 24rpx;
padding: 20rpx 44rpx;
background: var(--theme-color);
border-radius: 16rpx;
color: #FFF;
text-align: center;
font-size: 28rpx;
line-height: 40rpx;
&:first-child {
margin-left: 0;
}
}
}
}
}
</style>

196
pagesMall/order/index.vue Normal file
View File

@@ -0,0 +1,196 @@
<!-- +----------------------------------------------------------------------
| 麦沃德科技赋能开发者助力商协会发展
+----------------------------------------------------------------------
| Copyright (c) 20172024 www.wdsxh.cn All rights reserved.
+----------------------------------------------------------------------
| 沃德商协会系统并不是自由软件不加密并不代表开源未经许可不可自由转售和商用
+----------------------------------------------------------------------
| Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
+----------------------------------------------------------------------
| 我的订单 开发者: 麦沃德科技-半夏
+---------------------------------------------------------------------- -->
<template>
<view class="container" :style="{'--theme-color': themeColor}">
<!-- 标题栏 -->
<title-bar title="我的订单"></title-bar>
<!-- 内容区 -->
<view class="container-main" v-if="loadEnd">
<!-- 顶部导航 -->
<scroll-view scroll-x class="main-screen" :style="{top: titleBarHeight + 'px'}">
<view class="screen-item" :class="{active: selectScreen == index}" @click="changeScreen(index)" v-for="(item, index) in screenList" :key="index">{{item.text}}</view>
</scroll-view>
<!-- 订单列表 -->
<view class="main-list">
<mall-order :show-data="orderList" @getOrderList="resetOrderList"></mall-order>
<empty top="36%" title="暂无相关订单~" v-if="orderList.length == 0"></empty>
</view>
</view>
<!-- 底部导航 -->
<tab-bar></tab-bar>
</view>
</template>
<script>
import { mapState } from "vuex"
import mallOrder from "@/pagesMall/component/mall/order.vue"
export default {
components: {
mallOrder,
},
data() {
return {
// 是否加载完成
loadEnd: false,
// 标题栏高度
titleBarHeight: 0,
// 分类列表
screenList: [{
text: "全部",
},
{
text: "待付款",
state: 1
},
{
text: "待发货",
state: 2
},
{
text: "待收货",
state: 3
},
{
text: "已完成",
state: 4
}
],
// 已选分类
selectScreen: 0,
// 订单列表
orderList: [],
// 分类查询参数
page: 1,
limit: 20,
hasMore: false,
}
},
computed: {
...mapState({
themeColor: state => state.app.themeColor,
})
},
mounted() {
// #ifdef MP-WEIXIN
let statusBarHeight = uni.getSystemInfoSync().statusBarHeight
let menuButtonInfo = uni.getMenuButtonBoundingClientRect()
this.titleBarHeight = statusBarHeight + (menuButtonInfo.top - statusBarHeight) * 2 + menuButtonInfo.height
// #endif
},
onLoad(option) {
if (option.id) {
this.selectScreen = this.screenList.findIndex(item => {
if (item.state == option.id) return true
})
}
uni.showLoading({
title: "加载中"
})
this.getOrderList(() => {
uni.hideLoading()
this.loadEnd = true
})
},
onShow() {
if (this.loadEnd) {
uni.pageScrollTo({
scrollTop: 0,
duration: 0
});
this.page = 1
this.getOrderList()
}
},
onPullDownRefresh() {
this.page = 1
this.getOrderList(() => {
uni.stopPullDownRefresh()
})
},
onReachBottom() {
if (this.hasMore) {
this.page++
this.getOrderList()
}
},
methods: {
// 更改分类
changeScreen(index) {
this.selectScreen = index
this.page = 1
this.getOrderList()
},
// 获取订单列表
getOrderList(fn) {
let data = {
page: this.page,
limit: this.limit,
}
if (this.screenList[this.selectScreen].state) data.state = this.screenList[this.selectScreen].state
this.$util.request("mall.orderList", data).then(res => {
if (fn) fn()
if (res.code == 1) {
let list = res.data.data
this.hasMore = this.page < res.data.total / this.limit ? true : false
this.orderList = this.page == 1 ? list : [...this.orderList, ...list];
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
}).catch(error => {
if (fn) fn()
console.error('获取订单列表', error)
})
},
// 重新获取订单列表
resetOrderList() {
this.page = 1
this.getOrderList()
},
}
}
</script>
<style lang="scss">
.container {
.container-main {
.main-screen {
position: sticky;
top: 0;
z-index: 99;
background: #FFF;
white-space: nowrap;
.screen-item {
display: inline-block;
min-width: 20%;
padding: 40rpx 12rpx;
color: #8D929C;
font-size: 28rpx;
line-height: 40rpx;
text-align: center;
&.active {
color: var(--theme-color);
}
}
}
.main-list {
padding: 32rpx;
}
}
}
</style>

220
pagesMall/order/payment.vue Normal file
View File

@@ -0,0 +1,220 @@
<!-- +----------------------------------------------------------------------
| 麦沃德科技赋能开发者助力商协会发展
+----------------------------------------------------------------------
| Copyright (c) 20172024 www.wdsxh.cn All rights reserved.
+----------------------------------------------------------------------
| 沃德商协会系统并不是自由软件不加密并不代表开源未经许可不可自由转售和商用
+----------------------------------------------------------------------
| Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
+----------------------------------------------------------------------
| 订单支付 开发者: 麦沃德科技-半夏
+---------------------------------------------------------------------- -->
<template>
<view class="container">
<!-- 标题栏 -->
<title-bar :showBack="true" title="订单支付"></title-bar>
<!-- 内容区 -->
<view class="container-main" v-if="loadEnd">
<view class="main-info">
<view class="info-label">订单需要支付</view>
<view class="info-value"><text></text>{{orderAmount}}</view>
</view>
<view class="main-footer">
<button class="footer-btn" :style="{ background: themeColor }" @click="handlePayment()">立即支付</button>
<view class="safe-padding"></view>
</view>
</view>
</view>
</template>
<script>
import { mapState } from "vuex"
// #ifdef H5
import wx from 'weixin-js-sdk';
// #endif
export default {
data() {
return {
// 加载完成
loadEnd: false,
// 支付金额
orderAmount: "",
// 订单id
orderId: "",
}
},
onLoad(option) {
this.orderAmount = option.money
this.orderId = option.id
this.$nextTick(() => {
this.loadEnd = true
})
// #ifdef H5
this.initConfig()
// #endif
},
computed: {
...mapState({
themeColor: state => state.app.themeColor,
})
},
methods: {
// #ifdef H5
// 微信公众号初始化方法
initConfig() {
this.$util.request("main.WeChatConfig", {
url: location.href.split('#')[0]
}).then(res => {
if (res.code == 1) {
wx.config({
debug: false,
appId: res.data.appId,
timestamp: Number(res.data.timestamp),
nonceStr: res.data.nonceStr,
signature: res.data.signature,
jsApiList: ['chooseWXPay']
})
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
}).catch(error => {
console.error('通过config接口注入权限验证配置 ', error)
})
},
// #endif
// 支付
handlePayment() {
uni.showLoading({
title: "加载中",
mask: true
})
this.$util.request("mall.preparePay", {
order_id: this.orderId
}).then(res => {
if (res.code == 1) {
const data = res.data
// #ifdef MP-WEIXIN
uni.requestPayment({
provider: "wxpay",
...data,
success: (res) => {
uni.hideLoading();
if (res.errMsg == "requestPayment:ok") {
uni.redirectTo({
url: "/pagesMall/order/success?id=" + this.orderId
})
}
},
fail: () => {
uni.hideLoading();
uni.showToast({
title: "支付已取消",
icon: "none",
duration: 1000
})
},
})
// #endif
// #ifdef H5
wx.ready(() => {
uni.hideLoading()
wx.chooseWXPay({
timestamp: data.timeStamp,
package: data.package,
nonceStr: data.nonceStr,
signType: data.signType,
paySign: data.paySign,
success: (res) => {
uni.hideLoading();
if (res.errMsg == "chooseWXPay:ok") {
uni.redirectTo({
url: "/pagesMall/order/success?id=" + this.orderId
})
} else {
uni.showToast({
title: '支付失败',
icon: 'error'
})
}
},
fail: () => {
uni.hideLoading();
uni.showToast({
title: '支付已取消',
icon: 'none'
})
},
});
});
// #endif
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
}).catch(error => {
console.error('获取支付参数', error)
})
}
}
}
</script>
<style lang="scss">
.container {
.container-main {
padding: 32rpx 32rpx 144rpx;
.main-info {
background: #FFF;
padding: 48rpx 32rpx;
border-radius: 20rpx;
.info-label {
color: #5A5B6E;
text-align: center;
font-size: 32rpx;
line-height: 44rpx;
}
.info-value {
margin-top: 32rpx;
color: #E10602;
font-size: 72rpx;
font-weight: 600;
line-height: 100rpx;
text-align: center;
text {
font-size: 32rpx;
}
}
}
.main-footer {
position: fixed;
left: 0;
right: 0;
bottom: 0;
z-index: 99;
padding: 16rpx 24rpx;
background: #FFF;
border-top: 1rpx solid #F6F7FB;
.footer-btn {
color: #FFF;
font-size: 28rpx;
line-height: 40rpx;
padding: 20rpx 32rpx;
border-radius: 40rpx;
text-align: center;
}
}
}
}
</style>

131
pagesMall/order/success.vue Normal file
View File

@@ -0,0 +1,131 @@
<!-- +----------------------------------------------------------------------
| 麦沃德科技赋能开发者助力商协会发展
+----------------------------------------------------------------------
| Copyright (c) 20172024 www.wdsxh.cn All rights reserved.
+----------------------------------------------------------------------
| 沃德商协会系统并不是自由软件不加密并不代表开源未经许可不可自由转售和商用
+----------------------------------------------------------------------
| Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
+----------------------------------------------------------------------
| 支付成功 开发者: 麦沃德科技-半夏
+---------------------------------------------------------------------- -->
<template>
<view class="container" :style="{'--theme-color': themeColor}">
<!-- 标题栏 -->
<title-bar :showBack="true" title="支付成功"></title-bar>
<!-- 内容区 -->
<view class="container-main" v-if="loadEnd">
<view class="main-image">
<image class="icon" src="/static/check.png" mode="aspectFit"></image>
</view>
<view class="main-title">支付成功</view>
<view class="main-subtitle">请前往我的订单查看订单详情</view>
<view class="main-btn" @click="toOrder()">前往查看</view>
<view class="main-back" @click="toIndex()">返回首页</view>
</view>
</view>
</template>
<script>
import { mapState } from "vuex"
export default {
data() {
return {
// 加载完成
loadEnd: false,
// 订单id
orderId: null,
}
},
onLoad(option) {
this.orderId = option.id
this.$nextTick(() => {
this.loadEnd = true
})
},
computed: {
...mapState({
themeColor: state => state.app.themeColor
})
},
methods: {
// 前往我的订单
toOrder() {
let prevPage = getCurrentPages()[getCurrentPages().length - 2];
if (prevPage && (prevPage.route.indexOf('pagesMall/order/index') > -1 || prevPage.route.indexOf('pagesMall/order/details') > -1)) {
uni.navigateBack()
} else {
this.$util.toPage({
mode: 2,
path: "/pagesMall/order/details?order_id=" + this.orderId
})
}
},
// 返回首页
toIndex() {
uni.switchTab({
url: "/pages/index/index"
})
},
}
}
</script>
<style lang="scss">
page {
background: #FFF;
}
.container {
.container-main {
padding: 144rpx 32rpx 32rpx;
.main-image {
width: 200rpx;
height: 200rpx;
margin: 0 auto;
padding: 48rpx;
background: var(--theme-color);
border-radius: 50%;
}
.main-title {
color: #333;
font-size: 36rpx;
font-weight: 600;
line-height: 50rpx;
margin-top: 48rpx;
text-align: center;
}
.main-subtitle {
color: #979797;
font-size: 28rpx;
line-height: 40rpx;
margin-top: 16rpx;
text-align: center;
}
.main-btn {
margin-top: 64rpx;
color: #FFF;
font-size: 32rpx;
line-height: 44rpx;
padding: 22rpx 32rpx;
border-radius: 16rpx;
text-align: center;
background: var(--theme-color);
}
.main-back {
margin-top: 16rpx;
color: #979797;
font-size: 32rpx;
line-height: 44rpx;
padding: 32rpx;
text-align: center;
}
}
}
</style>