订单逻辑修改

This commit is contained in:
GaoHao
2024-09-26 14:28:16 +08:00
parent 1de598f1b1
commit 82cea7c341
8 changed files with 1185 additions and 193 deletions

View File

@@ -60,12 +60,8 @@
if (tableCode) {
let data = await this.api.productqueryShop({
code: uni.cache.get('tableCode'),
lng: uni.cache.get('getLocationstorage').lng ? uni.cache.get('getLocationstorage').lng :
'',
lat: uni.cache.get('getLocationstorage').lat ? uni.cache.get('getLocationstorage').lat :
'',
})
if ( !data.data.shopTableInfo.orderId && data.data.storeInfo.isTableFee == 1) {
if ( !data.data.shopTableInfo.choseCount ) {
uni.pro.navigateTo('/pagesOrder/orderAMeal/index', {
tableCode: tableCode,
})

View File

@@ -70,13 +70,9 @@
if (tableCode) {
let data = await this.api.productqueryShop({
code: uni.cache.get('tableCode'),
lng: uni.cache.get('getLocationstorage').lng ? uni.cache.get('getLocationstorage').lng :
'',
lat: uni.cache.get('getLocationstorage').lat ? uni.cache.get('getLocationstorage').lat :
'',
})
console.log()
if ( !data.data.shopTableInfo.orderId && data.data.storeInfo.isTableFee == 1) {
if ( !data.data.shopTableInfo.choseCount ) {
uni.pro.navigateTo('/pagesOrder/orderAMeal/index', {
tableCode: tableCode,
})

View File

@@ -126,6 +126,8 @@
// this.shopId = e.shopId;
// this.init();
// }
console.log(e)
uni.cache.set('forceUpdate',1)
if (e.q) {
this.shopId = this.getQueryString(decodeURIComponent(e.q), 'shopId')

View File

@@ -0,0 +1,406 @@
<template>
<viwe>
<view class="card_box">
<view class="card_head_box">
<view class="card_head_item" v-for="(item,index) in 8" :key="index"></view>
</view>
<view class="card">
<!-- 订单头部 -->
<view class="card_item" v-for="(item,index) in listinfo.detailList" :key="index">
<view class="head">
<view class="head_left">
<text class="placeNum">{{item.placeNum}}次下单</text>
<text class="placeTime">{{item.placeTime}}</text>
</view>
</view>
<!-- 订单详情 -->
<view class="shop-info">
<view class="item" v-for="(items,indexs) in item.info" :key="indexs">
<view class="cover">
<u-image width="152" height="152" radius="16" :src='items.productImg'></u-image>
</view>
<view class="info">
<text class="productName">{{items.productName}}</text>
<text class="productSkuName" v-if="items.productSkuName">{{items.productSkuName}}</text>
</view>
<view class="price">
<view class="priceAmount">{{items.priceAmount}}</view>
<view class="num">x{{items.num}}</view>
</view>
</view>
</view>
<view class="status">未付款</view>
<view class="totalAmount">
<view class="label">小计</view>
<view class="price"> {{item.totalAmount}} </view>
</view>
<view class="semicircle_icon" v-if="index > 0">
<view class="semicircle_left_icon"></view>
<view class="semicircle_right_icon"></view>
</view>
</view>
<view class="total-wrap">
<view>总计</view>
<view class="price"> {{listinfo.payAmount}} </view>
</view>
</view>
</view>
<view class="orderInfo">
<view class="row" @click="copyHandle(listinfo.orderNo)">
<text class="t">订单编号</text>
<text class="info">{{listinfo.orderNo}}点击复制</text>
</view>
<view class="row">
<text class="t">下单时间</text>
<text class="info">{{$u.timeFormat(listinfo.time, 'yyyy-mm-dd hh:MM:ss')}}</text>
</view>
<view class="row">
<text class="t">下单门店</text>
<text class="info">{{listinfo.name}}</text>
</view>
<view class="row">
<text class="t">订单类型</text>
<text class="info">{{$u.timeFormat(listinfo.time, 'yyyy-mm-dd hh:MM:ss')}}</text>
</view>
<view class="row">
<text class="t">备注</text>
<text class="info"></text>
</view>
<view class="row">
<text class="t">就餐人数</text>
<text class="info">{{$u.timeFormat(listinfo.time, 'yyyy-mm-dd hh:MM:ss')}}</text>
</view>
</view>
</viwe>
</template>
<script>
export default {
data() {
return {
}
},
props:{
listinfo:{
type: Object
}
},
mounted() {
},
methods: {
/**
* 复制订单号
* @param {Object} e
*/
copyHandle(e) {
uni.setClipboardData({
data: e,
success() {
uni.showToast({
title: '复制成功',
icon: 'none'
});
}
});
},
}
}
</script>
<style lang="scss">
.card_box{
background-color: #fff;
// box-shadow: 0rpx 8rpx 12rpx 2rpx rgba(87,86,86,0.35);
position: relative;
width: 100%;
height: 100%;
box-shadow: 0rpx 4rpx 12rpx 2rpx rgba(87,86,86,0.35);
border-radius: 18rpx;
padding-bottom: 32rpx;
.card_head_box{
width: 100%;
display: flex;
justify-content: space-between;
position: absolute;
top: -22.5rpx;
padding: 0 44rpx;
.card_head_item{
width: 45rpx;
height: 45rpx;
background-color: #f9f9f9;
border-radius: 50%;
box-shadow: inset 0rpx -13rpx 18rpx -16rpx rgba(87, 86, 86, 0.35);
}
}
.card {
// background-color: #fff;
border-radius: 20upx;
margin-bottom: 28upx;
position: relative;
.card_item{
display: flex;
flex-direction: column;
position: relative;
.head {
display: flex;
justify-content: space-between;
padding: 50rpx 34rpx 32rpx 34rpx;
.head_left{
display: flex;
align-items: center;
.placeNum{
font-weight: bold;
font-size: 32rpx;
color: #333333;
margin-right: 32rpx;
flex-shrink: 0;
}
.placeTime{
font-weight: 400;
font-size: 32rpx;
color: #666666;
flex-shrink: 0;
}
}
}
.shop-info {
padding: 0 34rpx;
border-bottom: 2rpx dashed #e5e5e5;
.item:nth-child(1) {
margin-top: 0;
}
.item {
margin-bottom: 32rpx;
display: flex;
.cover{
}
.info {
flex: 1;
display: flex;
flex-direction: column;
padding-left: 16upx;
.productName{
font-weight: bold;
font-size: 28rpx;
color: #333333;
margin-top: 20rpx;
}
.productSkuName{
font-weight: 400;
font-size: 24rpx;
color: #999999;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
overflow: hidden;
text-overflow: ellipsis;
}
.n {
font-size: 24upx;
color: #999;
}
}
.price{
display: flex;
flex-direction: column;
align-items: flex-end;
padding-left: 68rpx;
.priceAmount{
font-weight: 500;
font-size: 28rpx;
color: #333333;
margin-top: 26rpx;
}
.num{
font-weight: 400;
font-size: 24rpx;
color: #999999;
margin-top: 22rpx;
}
}
}
}
.status{
align-self: flex-end;
width: 92rpx;
height: 40rpx;
line-height: 40rpx;
text-align: center;
background: #999999;
border-radius: 10rpx 10rpx 10rpx 10rpx;
font-weight: 400;
font-size: 22rpx;
color: #FFFFFF;
margin-top: 32rpx;
margin-right: 32rpx;
}
.totalAmount {
width: 100%;
display: flex;
justify-content: flex-end;
align-items: flex-end;
padding: 0 34rpx;
margin-top: 32rpx;
.label{
font-weight: bold;
font-size: 28rpx;
color: #333333;
}
.price{
font-weight: bold;
font-size: 36rpx;
color: #333333;
}
}
.semicircle_icon{
width: 100%;
position: absolute;
top: -22.5rpx;
left: 0;
display: flex;
justify-content: space-between;
.semicircle_left_icon{
width: 45rpx;
height: 45rpx;
margin-left: -22.5rpx;
background-color: #f9f9f9;
border-radius: 50%;
box-shadow: inset -20rpx 0rpx 22rpx -20rpx rgba(87, 86, 86, 0.35);
}
.semicircle_right_icon{
width: 45rpx;
height: 45rpx;
margin-right: -22.5rpx;
background-color: #f9f9f9;
border-radius: 50%;
box-shadow: inset 13rpx 0rpx 16rpx -9rpx rgba(87, 86, 86, 0.35);
}
}
}
.total-wrap {
width: 100%;
display: flex;
justify-content: flex-end;
align-items: flex-end;
padding: 0 34rpx;
font-weight: bold;
font-size: 28rpx;
color: #333333;
margin-top: 64rpx;
.price{
font-weight: bold;
font-size: 36rpx;
}
}
.order_footer{
display: flex;
flex-direction: column;
padding: 34rpx;
position: relative;
}
}
}
.orderInfo{
background: #FFFFFF;
border-radius: 18rpx 18rpx 18rpx 18rpx;
margin-top: 32rpx;
padding: 32rpx 34rpx;
box-shadow: 0rpx 4rpx 12rpx 2rpx rgba(87,86,86,0.35);
.row {
display: flex;
justify-content: space-between;
margin-bottom: 32rpx;
.t {
font-weight: bold;
font-size: 28rpx;
color: #333333;
}
.info {
font-weight: 400;
font-size: 28rpx;
color: #666666;
}
}
.row:last-child{
margin-bottom: none;
}
}
.fixedview {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
.flex-between {
width: 100%;
padding: 36rpx 54rpx 102rpx 54rpx;
background: #FFFFFF;
.fixedview_one {
display: flex;
align-items: flex-end;
.fixedview_oneone {
font-weight: 400;
font-size: 28rpx;
color: #666666;
}
.fixedview_onetow {
font-weight: bold;
font-size: 32rpx;
color: #333333;
text {
font-size: 24rpx;
}
}
}
.fixedview_tow {
width: 140rpx;
height: 56rpx;
line-height: 56rpx;
text-align: center;
background: #E3AD7F;
border-radius: 12rpx 12rpx 12rpx 12rpx;
font-weight: 400;
font-size: 28rpx;
color: #FFFFFF;
}
}
}
</style>

View File

@@ -0,0 +1,408 @@
<template>
<view class="card_box">
<view class="card_head_box">
<view class="card_head_item" v-for="(item,index) in 8" :key="index"></view>
</view>
<view class="card">
<!-- 订单头部 -->
<view class="head">
<view class="head_left">
<text class="shopName">{{listinfo.name}}</text>
<text class="tableName" v-if="listinfo.tableName">桌号{{listinfo.tableName}}</text>
</view>
<text class="status" v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'">
<text> 待支付 </text>
</text>
<text class="status" v-if="listinfo.status == 'unsend'">
<text>待发货</text>
</text>
<text class="status" v-if="listinfo.status == 'closed'">
<text>订单完成</text>
</text>
<text class="status" v-if="listinfo.status == 'send'">
<text> 已发</text>
</text>
<text class="status" v-if="listinfo.status == 'refunding'">
<text>申请退单</text>
</text>
<text class="status" v-if="listinfo.status == 'refund'">
<text>退单</text>
</text>
<text class="status" v-if="listinfo.status == 'cancelled'">
<text>已取消</text>
</text>
<text class="status" v-if="listinfo.status == 'merge'">
<text>合台</text>
</text>
</view>
<!-- 取餐号 -->
<view class="number-wrap"
v-if="listinfo.status != 'unpaid' && listinfo.status != 'paying'&& listinfo.status != 'cancelled'">
<text class="t">取餐号</text>
<text class="number">{{listinfo.outNumber}}</text>
</view>
<block>
</block>
<!-- 订单详情 -->
<view class="shop-box">
<view class="shop-head">
<view class="shop-head-left">
<view class="tag-wrap">
<text class="tag" v-if="listinfo.sendType == 'post'">快递</text>
<text class="tag" v-if="listinfo.sendType == 'takeaway'">外卖</text>
<text class="tag" v-if="listinfo.sendType == 'takeself'">自提</text>
<text class="tag" v-if="listinfo.sendType == 'table'">堂食</text>
</view>
<text class="title">订单详情</text>
</view>
<view style="display: flex;align-items: center;"
v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'"
>
<!-- <text style="font-size:24rpx;">支付时间:</text> -->
<uni-countdown :show-day="false" color="#E3AD7F" border-color="#E3AD7F" splitorColor="#E3AD7F"
:font-size="16" :hour="0" :minute="listinfo.expiredMinutes" :second="listinfo.expiredSeconds" />
</view>
</view>
<view class="shop-info">
<view class="item" v-for="(item,index) in listinfo.details" :key="index">
<view class="cover">
<u-image width="152" height="152" radius="16" :src='item.productImg'></u-image>
</view>
<view class="info">
<text class="productName">{{item.productName}}</text>
<text class="productSkuName" v-if="item.productSkuName">{{item.productSkuName}}</text>
</view>
<view class="price">
<view class="priceAmount">{{item.priceAmount}}</view>
<view class="num">x{{item.num}}</view>
</view>
</view>
</view>
<view class="total-wrap">
<view>合计</view>
<view class="price"> {{listinfo.payAmount}} </view>
</view>
</view>
<!-- 订单信息 -->
<view class="order_footer">
<view class="order_footer_icon">
<view class="order_footer_left_icon"></view>
<view class="order_footer_right_icon"></view>
</view>
<view class="order-info">
<view class="row" @click="copyHandle(listinfo.orderNo)">
<text class="t">订单编号</text>
<text class="info">{{listinfo.orderNo}}点击复制</text>
</view>
<view class="row">
<text class="t">下单时间</text>
<text class="info">{{$u.timeFormat(listinfo.time, 'yyyy-mm-dd hh:MM:ss')}}</text>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
}
},
props:{
listinfo:{
type: Object
}
},
mounted() {
},
methods: {
/**
* 复制订单号
* @param {Object} e
*/
copyHandle(e) {
uni.setClipboardData({
data: e,
success() {
uni.showToast({
title: '复制成功',
icon: 'none'
});
}
});
},
}
}
</script>
<style lang="scss">
.card_box{
background-color: #fff;
// box-shadow: 0rpx 8rpx 12rpx 2rpx rgba(87,86,86,0.35);
position: relative;
width: 100%;
height: 100%;
box-shadow: 0rpx 4rpx 12rpx 2rpx rgba(87,86,86,0.35);
border-radius: 18rpx;
.card_head_box{
width: 100%;
display: flex;
justify-content: space-between;
position: absolute;
top: -22.5rpx;
padding: 0 44rpx;
.card_head_item{
width: 45rpx;
height: 45rpx;
background-color: #f9f9f9;
border-radius: 50%;
box-shadow: inset 0rpx -13rpx 18rpx -16rpx rgba(87, 86, 86, 0.35);
}
}
.card {
// background-color: #fff;
border-radius: 20upx;
margin-bottom: 28upx;
position: relative;
.head {
display: flex;
justify-content: space-between;
padding: 50rpx 34rpx 32rpx 34rpx;
border-bottom: 2rpx dashed #E3E3E3;
.head_left{
.shopName{
font-weight: bold;
font-size: 32rpx;
color: #333333;
}
.tableName{
font-weight: 400;
font-size: 28rpx;
color: #333333;
}
}
.status {
text{
font-weight: 500;
font-size: 28rpx;
color: #333333;
}
}
}
.number-wrap {
display: flex;
flex-direction: column;
align-items: center;
margin-top: 32rpx;
.t{
font-weight: 400;
font-size: 28rpx;
color: #333333;
}
.number {
font-weight: bold;
font-size: 56rpx;
color: #333333;
}
}
.price {
.i {
font-size: 20upx;
}
.num {
font-size: 38upx;
}
}
.shop-box{
padding: 36rpx 34rpx 30rpx 34rpx;
border-bottom: 2rpx dashed #E3E3E3;
.shop-head{
display: flex;
justify-content: space-between;
align-items: center;
.shop-head-left{
display: flex;
align-items: center;
.tag-wrap{
width: 80rpx;
height: 48rpx;
background: #FFFFFF;
border-radius: 10rpx 10rpx 10rpx 10rpx;
border: 2rpx solid #E3AD7F;
margin-right: 18rpx;
display: flex;
align-items: center;
justify-content: center;
.tag{
font-weight: 400;
font-size: 24rpx;
color: #E3AD7F;
}
}
.title{
font-weight: bold;
font-size: 28rpx;
color: #333333;
}
}
}
.shop-info {
margin-top: 32rpx;
.item:nth-child(1) {
margin-top: 0;
}
.item {
margin-bottom: 32rpx;
display: flex;
.cover{
}
.info {
flex: 1;
display: flex;
flex-direction: column;
padding-left: 16upx;
.productName{
font-weight: bold;
font-size: 28rpx;
color: #333333;
margin-top: 20rpx;
}
.productSkuName{
font-weight: 400;
font-size: 24rpx;
color: #999999;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
overflow: hidden;
text-overflow: ellipsis;
}
.n {
font-size: 24upx;
color: #999;
}
}
.price{
display: flex;
flex-direction: column;
align-items: flex-end;
padding-left: 68rpx;
.priceAmount{
font-weight: 500;
font-size: 28rpx;
color: #333333;
margin-top: 26rpx;
}
.num{
font-weight: 400;
font-size: 24rpx;
color: #999999;
margin-top: 22rpx;
}
}
}
}
.total-wrap {
width: 100%;
display: flex;
justify-content: space-between;
font-weight: 500;
font-size: 28rpx;
.price{
font-weight: bold;
font-size: 32rpx;
}
}
}
.order_footer{
display: flex;
flex-direction: column;
padding: 34rpx;
position: relative;
.order_footer_icon{
width: 100%;
position: absolute;
top: -22.5rpx;
left: 0;
display: flex;
justify-content: space-between;
.order_footer_left_icon{
width: 45rpx;
height: 45rpx;
margin-left: -22.5rpx;
background-color: #f9f9f9;
border-radius: 50%;
box-shadow: inset -20rpx 0rpx 22rpx -20rpx rgba(87, 86, 86, 0.35);
}
.order_footer_right_icon{
width: 45rpx;
height: 45rpx;
margin-right: -22.5rpx;
background-color: #f9f9f9;
border-radius: 50%;
box-shadow: inset 13rpx 0rpx 16rpx -9rpx rgba(87, 86, 86, 0.35);
}
}
.title{
font-weight: bold;
font-size: 28rpx;
color: #333333;
}
.order-info {
.row {
display: flex;
justify-content: space-between;
padding-top: 32upx;
.t {
font-weight: bold;
font-size: 28rpx;
color: #333333;
}
.info {
font-weight: 400;
font-size: 24rpx;
color: #666666;
}
}
}
}
}
}
</style>

View File

@@ -0,0 +1,146 @@
<template>
<!-- 支付方式 -->
<view class="paymentMethod">
<view class="paymentMethod_content">
<view class="paymentMethod_title">支付方式</view>
<u-radio-group v-model="radiovalue" iconPlacement="right" @change="groupChange" :size="28"
placement="column">
<block v-for="(item,index) in paymentMethodList" :key="index">
<view class="method_list" @click="groupChange(index+1)">
<view class="method_list_top">
<view class="method_list_top_left">
<image class="icon" :src="item.url" mode="aspectFill"/>
<view class="method_list_top_cen">
<view class="name"> {{ item.name }} </view>
<view class="method_list_bom" v-if="item.type == 1">
<text class="balance">会员卡余额 {{amountVIP?amountVIP.amount:0}}</text>
<text class="topUpNow" @click="goRecharge">去充值</text>
</view>
</view>
</view>
<u-radio activeColor="#E8AD7B" icon-size="36" size="36" :name="index+1">
</u-radio>
</view>
</view>
</block>
</u-radio-group>
</view>
</view>
</template>
<script>
export default {
data() {
return {
paymentMethodList:[
{ name: "余额支付", type: "1", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/wechat.png"},
// #ifdef MP-WEIXIN
{ name: "微信支付", type: "2", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/weChat.png"},
// #endif
// #ifdef MP-ALIPAY
{ name: "支付宝支付", type: "3", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/alipay.png"},
// #endif
],
radiovalue: 1, // 支付方式
ispws: false, // 输入支付密码
storeInfo: {},
}
},
props:{
amountVIP:{
type: Object
}
},
mounted() {
console.log(this.amountVIP)
// this.getAount();
},
methods: {
/**
* 监听支付方式切换
* @param {Object} n
*/
groupChange(n) {
this.radiovalue = n;
this.$emit("groupChange",n)
},
/**
* 去充值
*/
goRecharge() {
uni.pro.navigateTo('/pages/member/index', {
shopId: this.shopId
})
},
}
}
</script>
<style lang="scss">
.paymentMethod{
box-sizing: border-box;
margin-top: 30rpx;
border-radius: 18rpx;
box-shadow: 0rpx 4rpx 12rpx 2rpx rgba(87,86,86,0.35);
.paymentMethod_content{
background-color: #fff;
border-radius: 22rpx;
padding:30rpx 30rpx 0 30rpx;
box-sizing: border-box;
.paymentMethod_title{
font-weight: 500;
font-size: 32rpx;
color: #333333;
box-sizing: border-box;
}
.method_list{
padding: 40rpx 0;
box-sizing: border-box;
.method_list_top{
display: flex;
justify-content: space-between;
.method_list_top_left{
display: flex;
align-items: center;
.icon{
width: 54.67rpx!important;
height: 48rpx!important;
margin-right: 22rpx;
}
.name{
font-size: 32rpx;
font-weight: 500;
color: #333;
}
.method_list_top_cen{
display: flex;
flex-direction: column;
}
}
}
.method_list_bom{
display: flex;
align-items: center;
.balance{
margin-right: 20rpx;
font-size: 24rpx;
}
.topUpNow{
color: #FF803D;
font-size: 28rpx;
}
}
}
.method_list:nth-child(odd){
border-bottom: 2rpx solid #e5e5e5;
}
}
}
</style>

View File

@@ -97,7 +97,7 @@
</view>
<!-- 支付方式 -->
<view class="paymentMethod" v-if="storeInfo.registerType == 'munchies'">
<!-- <view class="paymentMethod" v-if="storeInfo.registerType == 'munchies'">
<view class="paymentMethod_content">
<view class="paymentMethod_title">支付方式</view>
<u-radio-group v-model="radiovalue" iconPlacement="right" @change="groupChange" :size="28"
@@ -123,7 +123,10 @@
</block>
</u-radio-group>
</view>
</view>
</view> -->
<paymentMethod ref="paymentMethod" :amountVIP="amountVIP" v-if="storeInfo.registerType == 'munchies'"></paymentMethod>
<view class="bottom">
<view class="bottom_left">
@@ -164,12 +167,14 @@
import navseat from '@/components/navseat.vue'
import webSocketUtils from '@/common/js/websocket.js'
import payPasswordtwo from '@/components/payPasswordtwo.vue'
import paymentMethod from '../components/paymentMethod.vue'
// import cwxKeyboard from '@/components/cwx-keyboard/cwx-keyboard.vue'
export default {
components: {
payPasswordtwo,
paymentMethod,
navseat
},
data() {
@@ -566,8 +571,6 @@
*/
async showpopupclickdds() {
console.log(this.listinfoid)
let res = await this.api.payorderPay({
orderId: this.listinfoid
}) //判断是否支付成功

View File

@@ -1,137 +1,11 @@
<template>
<view class="container">
<view class="card_box">
<view class="card_head_box">
<view class="card_head_item"></view>
<view class="card_head_item"></view>
<view class="card_head_item"></view>
<view class="card_head_item"></view>
<view class="card_head_item"></view>
<view class="card_head_item"></view>
<view class="card_head_item"></view>
<view class="card_head_item"></view>
</view>
<view class="card">
<!-- 订单头部 -->
<view class="head">
<view class="head_left">
<text class="shopName">{{listinfo.name}}</text>
<text class="tableName" v-if="listinfo.tableName">桌号{{listinfo.tableName}}</text>
</view>
<text class="status" v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'">
<text> 待支付 </text>
</text>
<text class="status" v-if="listinfo.status == 'unsend'">
<text>待发货</text>
</text>
<text class="status" v-if="listinfo.status == 'closed'">
<text>订单完成</text>
</text>
<text class="status" v-if="listinfo.status == 'send'">
<text> 已发</text>
</text>
<text class="status" v-if="listinfo.status == 'refunding'">
<text>申请退单</text>
</text>
<text class="status" v-if="listinfo.status == 'refund'">
<text>退单</text>
</text>
<text class="status" v-if="listinfo.status == 'cancelled'">
<text>已取消</text>
</text>
<text class="status" v-if="listinfo.status == 'merge'">
<text>合台</text>
</text>
</view>
<!-- 取餐号 -->
<view class="number-wrap"
v-if="listinfo.status != 'unpaid' && listinfo.status != 'paying'&& listinfo.status != 'cancelled'">
<text class="t">取餐号</text>
<text class="number">{{listinfo.outNumber}}</text>
</view>
<!-- 订单详情 -->
<view class="shop-box">
<view class="shop-head">
<view class="shop-head-left">
<view class="tag-wrap">
<text class="tag" v-if="listinfo.sendType == 'post'">快递</text>
<text class="tag" v-if="listinfo.sendType == 'takeaway'">外卖</text>
<text class="tag" v-if="listinfo.sendType == 'takeself'">自提</text>
<text class="tag" v-if="listinfo.sendType == 'table'">堂食</text>
</view>
<text class="title">订单详情</text>
</view>
<view style="display: flex;align-items: center;"
v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'"
>
<!-- <text style="font-size:24rpx;">支付时间:</text> -->
<uni-countdown :show-day="false" color="#E3AD7F" border-color="#E3AD7F" splitorColor="#E3AD7F"
:font-size="16" :hour="0" :minute="listinfo.expiredMinutes" :second="listinfo.expiredSeconds" />
</view>
</view>
<view class="shop-info">
<view class="item" v-for="(item,index) in listinfo.details" :key="index">
<view class="cover">
<u-image width="152" height="152" radius="16" :src='item.productImg'></u-image>
</view>
<view class="info">
<text class="productName">{{item.productName}}</text>
<text class="productSkuName" v-if="item.productSkuName">{{item.productSkuName}}</text>
</view>
<view class="price">
<view class="priceAmount">{{item.priceAmount}}</view>
<view class="num">x{{item.num}}</view>
</view>
</view>
</view>
<view class="total-wrap">
<view>合计</view>
<view class="price"> {{listinfo.payAmount}} </view>
</view>
</view>
<!-- 订单信息 -->
<view class="order_footer">
<view class="order_footer_icon">
<view class="order_footer_left_icon"></view>
<view class="order_footer_right_icon"></view>
</view>
<view class="title">订单信息</view>
</view>
</view>
</view>
<view class="orderInfo">
<view class="row" @click="copyHandle(listinfo.orderNo)">
<text class="t">订单编号</text>
<text class="info">{{listinfo.orderNo}}点击复制</text>
</view>
<view class="row">
<text class="t">下单时间</text>
<text class="info">{{$u.timeFormat(listinfo.time, 'yyyy-mm-dd hh:MM:ss')}}</text>
</view>
<view class="row">
<text class="t">下单门店</text>
<text class="info">{{listinfo.name}}</text>
</view>
<view class="row">
<text class="t">订单类型</text>
<text class="info">{{$u.timeFormat(listinfo.time, 'yyyy-mm-dd hh:MM:ss')}}</text>
</view>
<view class="row">
<text class="t">备注</text>
<text class="info">{{listinfo.orderNo}}点击复制</text>
</view>
<view class="row">
<text class="t">就餐人数</text>
<text class="info">{{$u.timeFormat(listinfo.time, 'yyyy-mm-dd hh:MM:ss')}}</text>
</view>
</view>
<orderInfoAfter ref="orderInfoAfter" :listinfo="listinfo" v-if="listinfo.useType == 'dine-in-after'"></orderInfoAfter>
<orderInfoBefore ref="orderInfoBefore" :listinfo="listinfo" v-else></orderInfoBefore>
<paymentMethod ref="paymentMethod" :amountVIP="amountVIP" @groupChange="groupChange"></paymentMethod>
<view class="fixedview">
<view class="flex-between" v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'">
<view class="fixedview_one flex-start">
@@ -140,23 +14,50 @@
<text>¥</text>{{listinfo.payAmount}}
</view>
</view>
<view class="fixedview_tow" @tap="$u.debounce(showpopupclick,1000)">
立即付款
<view class="fixedview_tow" @tap="$u.debounce(goToPay,1000)">
{{paymentBtnText}}
</view>
</view>
</view>
<u-popup :show="ispws" :round="20" mode="bottom" @close="ispws = false" height="500" :safeAreaInsetBottom="false">
<view class="pay-info-wrap">
<view class="info-wrap flex-between">
<view class="close" @click="ispws = false">
<u-icon name="close" color="#999999" size="40"></u-icon>
</view>
<text class="title">请输入支付密码</text>
<view></view>
</view>
<view class="info-content">
<payPasswordtwo ref="payPwd" :payAmount="listinfo.payAmount" @accountPayevent="accountPayevent" v-if="ispws"></payPasswordtwo>
</view>
</view>
</u-popup>
</view>
</template>
<script>
import orderInfoAfter from '../components/orderInfoAfter.vue'
import orderInfoBefore from '../components/orderInfoBefore.vue'
import paymentMethod from '../components/paymentMethod.vue'
export default {
components: {
orderInfoAfter,
orderInfoBefore,
paymentMethod,
},
data() {
return {
ispws: false, // 输入支付密码
pay_type: 1,
radiovalue: 1,
paymentBtnText: "余额支付",
orderId: '',
listinfo: {},
status: [],
amountVIP: {},
srcimge: 'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/wx.jpg'
};
},
@@ -168,11 +69,32 @@
this.orderorderInfo()
},
onUnload() {
this.ispws = false
uni.switchTab({
url: '/pages/order/order'
})
},
methods: {
/**
* 获取会员信息
*/
async getAount() {
let res = await this.api.shopUserInfo({
"shopId": uni.cache.get('shopId'),
"userId": uni.cache.get('userInfo').id,
})
if (res.code == 0) {
console.log("会员信息===",res)
this.amountVIP = res.data;
}
},
groupChange (n) {
console.log(n)
this.radiovalue = n;
this.paymentBtnText = n==1?'余额支付':'微信支付'
},
/**
* 获取订单信息
*/
@@ -182,25 +104,122 @@
})
if (res.code == 0) {
this.listinfo = res.data;
if (this.listinfo.useType == "dine-in-before") {
uni.cache.set('shopId',res.data.shopId)
if (this.listinfo.useType == " ") {
//堂食先付费
}
}
},
/**
* 支付完成后请求
* 去充值
*/
async paymodfiyOrderInfo() {
let res = await this.api.paymodfiyOrderInfo({
orderId: this.listinfo.orderId,
goRecharge() {
uni.pro.navigateTo('/pages/member/index', {
shopId: this.shopId
})
},
/**
* 立即付款
* 去支付
*/
async showpopupclick() {
goToPay(){
if ( this.radiovalue == 2 && this.listinfo.payAmount <= 0 ) {
uni.showToast({
title: "支付金额必须大于0",
icon: 'none'
})
return;
}
if (this.radiovalue == 2) {
this.wechatPay() //微信支付
} else {
// 先判断是否设置支付密码。0是没设置。没设置的情况下跳转到设置页面。有的话输入支付密码
// console.log(isPwd,'是否设置了支付密码')
if ( this.amountVIP.isVip == 0 ) {//非会员情况
this.goRecharge();
} else {
if (uni.cache.get('userInfo').isPwd == 0) {
uni.navigateTo({
url: '/pages/member/setPassword?shopUserInfo=' + JSON.stringify(this.amountVIP)
})
} else {
uni.hideLoading()
// this.payPasswordShow = false;
this.ispws = true
}
}
}
},
/**
* 余额支付
* @param {Object} pwd
*/
async accountPayevent(pwd) {
this.ispws = false;
console.log(pwd)
let res = await this.api.accountPay({
orderId: this.listinfoid,
memberId: this.amountVIP.id,
pwd: pwd
})
if (res.code == 0) {
// data ->1 支付成功
// ->2 余额不足
// ->3 未设置支付密码,
// ->4 不是会员,
if (res.data == 1) {
uni.showToast({ title: "支付成功",icon:'none'})
let _this = this
uni.requestSubscribeMessage({
tmplIds:["z0fUG7-jhSfYCrw6poOvSRzh4_hgnPkm_5C7E5s5bCQ","AV-KybUHaK3KtFVLqpy6PHccHBS7XeX__mOM4RbufnQ"],
complete() {
uni.redirectTo({
url: '/pagesOrder/order_detail/index?orderId=' + _this
.listinfoid
});
},
})
} else if (res.data == 2) {
uni.showToast({ title: "余额不足",icon:'none'})
setTimeout(() => {
// 去充值
this.goRecharge()
}, 1500)
} else if (res.data == 3) {
uni.showToast({ title: "未设置支付密码",icon:'none'})
setTimeout(() => {
uni.navigateTo({
url: '/pages/member/setPassword?shopUserInfo=' + JSON.stringify(this.amountVIP)
})
}, 1500)
} else if (res.data == 4) {
uni.showToast({ title: "非会员请充值",icon:'none'})
setTimeout(() => {
// 去充值
this.goRecharge()
}, 1500)
}
}
},
/**
* 微信支付
*/
async wechatPay() {
let res = await this.api.payorderPay({
orderId: this.orderId,
}) //判断是否支付成功
@@ -219,16 +238,22 @@
signType: res.data.signType, //固定值
paySign: res.data.paySign, //签名
success: (res) => {
uni.showToast({
title: "支付成功"
let _this = this
uni.requestSubscribeMessage({
tmplIds: ['z0fUG7-jhSfYCrw6poOvSRzh4_hgnPkm_5C7E5s5bCQ'],
complete() {
uni.showToast({
title: "支付成功"
})
this.paymodfiyOrderInfo()
setTimeout(res => {
uni.hideLoading()
uni.switchTab({
url: '/pages/order/order'
});
}, 500)
},
})
setTimeout(res => {
uni.hideLoading()
uni.switchTab({
url: '/pages/order/order'
});
}, 500)
this.paymodfiyOrderInfo()
},
fail: (err) => {
uni.showToast({
@@ -245,9 +270,45 @@
}
});
// #endif
// #ifdef MP-ALIPAY
uni.requestPayment({
provider: 'alipay', //支付类型-固定值
orderInfo: res.data.appId, // 微信支付商户号
success: (res) => {
let _this = this
uni.requestSubscribeMessage({
tmplIds: ['z0fUG7-jhSfYCrw6poOvSRzh4_hgnPkm_5C7E5s5bCQ'],
complete() {
uni.showToast({
title: "支付成功"
})
// uni.cache.set('shopUser', '') //删除shopUser
_this.paymodfiyOrderInfo()
uni.redirectTo({
url: '/pagesOrder/order_detail/index?orderId=' + _this.listinfoid
});
},
})
},
fail: () => {
uni.hideLoading()
}
});
// #endif
}
},
/**
* 支付完成后请求
*/
async paymodfiyOrderInfo() {
let res = await this.api.paymodfiyOrderInfo({
orderId: this.listinfo.orderId,
})
},
/**
* 复制订单号
* @param {Object} e
@@ -274,7 +335,7 @@
}
.container {
padding: 32rpx 28rpx 194rpx 28rpx;
padding: 32rpx 28rpx 224rpx 28rpx;
}
.card_box{
@@ -529,33 +590,7 @@
}
.orderInfo{
background: #FFFFFF;
border-radius: 18rpx 18rpx 18rpx 18rpx;
margin-top: 32rpx;
padding: 32rpx 34rpx;
.row {
display: flex;
justify-content: space-between;
margin-bottom: 32rpx;
.t {
font-weight: bold;
font-size: 28rpx;
color: #333333;
}
.info {
font-weight: 400;
font-size: 24rpx;
color: #666666;
}
}
.row:last-child{
margin-bottom: none;
}
}
.fixedview {