472 lines
11 KiB
Vue
472 lines
11 KiB
Vue
<template>
|
||
<view class="container">
|
||
<view class="card">
|
||
<view class="head">
|
||
<text class="title">
|
||
<text>{{listinfo.tableName || '空'}}</text>
|
||
</text>
|
||
<text class="status" v-if="listinfo.status == 'unpaid'">
|
||
<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="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>
|
||
<view class="number-wrap" v-if="listinfo.status != 'unpaid'">
|
||
<text class="t">取餐号</text>
|
||
<text class="number">{{listinfo.tableName || '空'}}</text>
|
||
</view>
|
||
</view>
|
||
<view class="card">
|
||
<view class="head border">
|
||
<text class="title">
|
||
<text>点单详情</text>
|
||
</text>
|
||
</view>
|
||
<view class="shop-info">
|
||
<view class="item" v-for="(item,index) in listinfo.detailList" :key="index">
|
||
<view class="cover">
|
||
<c-image width="120" height="120" radius="16" :src='item.productImg'></c-image>
|
||
</view>
|
||
<view class="info">
|
||
<text>{{item.productName}}</text>
|
||
<text class="n">x{{item.num}}</text>
|
||
</view>
|
||
<view class="price">
|
||
<text class="i">¥</text>
|
||
<text class="num">{{item.price}}</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="total-wrap">
|
||
<view class="price">
|
||
<text>合计:</text>
|
||
<text class="i">¥</text>
|
||
<text class="num">{{listinfo.amount}}</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="sixcontent" v-if="listinfo.status == 'unpaid'">
|
||
<view class="sixcontentone flex-between">
|
||
<view class="sixcontent_one">
|
||
支付方式
|
||
</view>
|
||
</view>
|
||
<view class="sixcontenttow">
|
||
<view class="sixcontenttowitem flex-between" @click="clickselect(1)">
|
||
<view class="sixcontenttowitemone flex-start">
|
||
<u-icon name="weixin-fill" color="#999999" size="32"></u-icon>
|
||
<text class="sixcontenttowitemonetext">微信支付</text>
|
||
</view>
|
||
<view class="flex-start">
|
||
<u-icon v-if="pay_type == 1" name="checkmark-circle-fill" color="#333333" size="26"></u-icon>
|
||
<u-icon v-else name="checkmark-circle-fill" color="#999999" size="26"></u-icon>
|
||
|
||
</view>
|
||
</view>
|
||
<!-- <view class="sixcontenttowitem flex-between" @click="clickselect(2)">
|
||
<view class="sixcontenttowitemone flex-start">
|
||
<u-icon name="zhifubao" color="#999999" size="26"></u-icon>
|
||
<text class="sixcontenttowitemonetext">余额支付</text>
|
||
</view>
|
||
<view class="flex-start">
|
||
<u-icon v-if="pay_type == 2" name="checkmark-circle-fill" color="#333333" size="26"></u-icon>
|
||
<u-icon v-else name="checkmark-circle-fill" color="#999999" size="26"></u-icon>
|
||
</view>
|
||
</view> -->
|
||
</view>
|
||
</view>
|
||
<view :style="{height:height}">
|
||
|
||
</view>
|
||
<view class="fixedview">
|
||
<view class="flex-between">
|
||
<view class="fixedview_one flex-start">
|
||
<view class="fixedview_oneone">
|
||
实付金额:
|
||
</view>
|
||
<view class="fixedview_onetow">
|
||
<text>¥</text>{{listinfo.amount}}
|
||
</view>
|
||
</view>
|
||
<view class="fixedview_tow" @tap="$u.debounce(showpopupclick,1000)">
|
||
立即付款
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
import webSocketUtils from '@/common/js/websocket.js'
|
||
export default {
|
||
data() {
|
||
return {
|
||
height: '',
|
||
pay_type: 1,
|
||
info: {},
|
||
listinfo: {}
|
||
};
|
||
},
|
||
|
||
// onUnload() {
|
||
// uni.$off('createOrdermessage')
|
||
// },
|
||
onLoad(e) {
|
||
console.log(e,140)
|
||
let res = JSON.parse(e.tableId)
|
||
console.log(res)
|
||
this.listinfo = res
|
||
// uni.$on('createOrdermessage', res => {
|
||
// console.log(1111111)
|
||
// console.log(res)
|
||
// this.listinfo = res
|
||
// })
|
||
// uni.$on('createOrdermessage', this.getMessagess)
|
||
},
|
||
onShow() {
|
||
// uni.$on('createOrdermessage', res => {
|
||
// console.log(1111111)
|
||
// console.log(res)
|
||
// this.listinfo = res
|
||
// })
|
||
},
|
||
methods: {
|
||
|
||
async ordercreatOrder() {
|
||
let res = await this.api.ordercreatOrder({
|
||
tableId: this.info.tableId,
|
||
shopId: this.info.shopId,
|
||
userId: this.info.userId
|
||
})
|
||
this.listinfo = res.data
|
||
},
|
||
copyHandle(e) {
|
||
uni.setClipboardData({
|
||
data: e,
|
||
success() {
|
||
uni.showToast({
|
||
title: '复制成功',
|
||
icon: 'none'
|
||
});
|
||
}
|
||
});
|
||
},
|
||
async paymodfiyOrderInfo() {
|
||
let res = await this.api.paymodfiyOrderInfo({
|
||
orderId: this.listinfo.id
|
||
})
|
||
},
|
||
async showpopupclick() {
|
||
// const data = { //定义socket数据传参
|
||
// "skuId": res.data.id,
|
||
// "num": a == '-' ? Number(b) - 1 : Number(b) + 1, //数量
|
||
// "type": "addcart", //“addcart:添加购物车,create0rder:生成订单,clearCart:庆康购物车”,
|
||
// "productId": item.id, //商品id
|
||
// "shopId": uni.cache.get('shopUser').shopId,
|
||
// "userId": uni.cache.get('userInfo').id
|
||
// };
|
||
let res = await this.api.payorderPay({
|
||
orderId: this.listinfo.id,
|
||
}) //判断是否支付成功
|
||
if (res.code == 0) {
|
||
uni.showLoading({
|
||
title: '加载中',
|
||
mask: true
|
||
})
|
||
// #ifdef MP-WEIXIN
|
||
uni.requestPayment({
|
||
provider: 'wxpay', //支付类型-固定值
|
||
partnerid: res.data.payAppId, // 微信支付商户号
|
||
timeStamp: res.data.payTimeStamp, // 时间戳(单位:秒)
|
||
nonceStr: res.data.paynonceStr, // 随机字符串
|
||
package: res.data.payPackage, // 固定值
|
||
signType: res.data.paySignType, //固定值
|
||
paySign: res.data.paySign, //签名
|
||
success: (res) => {
|
||
uni.showToast({
|
||
title: "支付成功"
|
||
})
|
||
setTimeout(res => {
|
||
uni.redirectTo({
|
||
url: '/pages/order/order_detail?orderId=' + this
|
||
.listinfo.id
|
||
});
|
||
}, 1000)
|
||
this.paymodfiyOrderInfo()
|
||
// uni.redirectTo({
|
||
// url: "/pages/mall/order/ordersuccess?id=" + datareslane.data
|
||
// .order_id,
|
||
// });
|
||
},
|
||
fail: (err) => {
|
||
setTimeout(res => {
|
||
uni.showToast({
|
||
icon: 'none',
|
||
title: '支付失败'
|
||
})
|
||
uni.hideLoading()
|
||
}, 2000)
|
||
uni.redirectTo({
|
||
url: '/pages/order/order_detail?orderId=' + this.listinfo.id
|
||
});
|
||
}
|
||
});
|
||
// #endif
|
||
}
|
||
},
|
||
clickselect(b) {
|
||
this.pay_type = b
|
||
},
|
||
},
|
||
mounted() {
|
||
//#ifdef MP-WEIXIN || H5
|
||
var query = uni.createSelectorQuery().in(this).select('.fixedview')
|
||
query.boundingClientRect(ele => {
|
||
var that = this;
|
||
that.height = (ele.height) + "px";
|
||
that = null;
|
||
// uni.getSystemInfo({
|
||
// success(res) {
|
||
|
||
// }
|
||
// })
|
||
}).exec();
|
||
//#endif
|
||
//#ifdef MP-ALIPAY
|
||
my.createSelectorQuery().selectAll('.fixedview').boundingClientRect().exec(ele => {
|
||
var nodeData = ele[0]
|
||
var that = this;
|
||
that.height = (nodeData.height) + "px";
|
||
that = null;
|
||
})
|
||
//#endif
|
||
},
|
||
};
|
||
</script>
|
||
|
||
<style scoped lang="scss">
|
||
.container {
|
||
padding: 28upx;
|
||
}
|
||
|
||
.card {
|
||
background-color: #fff;
|
||
border-radius: 20upx;
|
||
padding: 28upx;
|
||
margin-bottom: 28upx;
|
||
|
||
.head {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
|
||
&.border {
|
||
padding-bottom: 28upx;
|
||
border-bottom: 1upx solid #fafafa;
|
||
}
|
||
|
||
.status {
|
||
color: #ff0000;
|
||
}
|
||
}
|
||
|
||
.tag-wrap {
|
||
padding: 28upx 0;
|
||
display: flex;
|
||
|
||
.tag {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
padding: 0 10upx;
|
||
color: $color-priamry;
|
||
border: 1px solid $color-priamry;
|
||
font-size: 24upx;
|
||
}
|
||
}
|
||
|
||
.number-wrap {
|
||
background-color: #fafafa;
|
||
border-radius: 16upx;
|
||
padding: 28upx 0;
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
|
||
.number {
|
||
font-size: 42upx;
|
||
font-weight: bold;
|
||
}
|
||
}
|
||
|
||
.price {
|
||
.i {
|
||
font-size: 20upx;
|
||
}
|
||
|
||
.num {
|
||
font-size: 38upx;
|
||
}
|
||
}
|
||
|
||
.shop-info {
|
||
padding: 28upx 0;
|
||
|
||
.item:nth-child(1) {
|
||
margin-top: 0;
|
||
}
|
||
|
||
.item {
|
||
margin-top: 16rpx;
|
||
display: flex;
|
||
|
||
.info {
|
||
flex: 1;
|
||
display: flex;
|
||
flex-direction: column;
|
||
justify-content: space-between;
|
||
padding-left: 28upx;
|
||
|
||
.n {
|
||
font-size: 24upx;
|
||
color: #999;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
.total-wrap {
|
||
display: flex;
|
||
justify-content: flex-end;
|
||
padding-top: 28upx;
|
||
border-top: 1upx solid #fafafa;
|
||
}
|
||
|
||
.order-info {
|
||
.row {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
padding-top: 28upx;
|
||
|
||
.t {
|
||
font-size: 24upx;
|
||
color: #999;
|
||
}
|
||
|
||
.info {
|
||
font-size: 24upx;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
.sixcontent {
|
||
width: 100%;
|
||
background: #FFFFFF;
|
||
padding: 32rpx;
|
||
margin-top: 32rpx;
|
||
border-radius: 12rpx;
|
||
|
||
.sixcontentone {
|
||
padding-bottom: 28rpx;
|
||
border-bottom: 1px solid #F7F7F7;
|
||
|
||
.sixcontent_one {
|
||
font-size: 28rpx;
|
||
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
|
||
font-weight: 500;
|
||
color: #333333;
|
||
}
|
||
}
|
||
|
||
.sixcontenttow {
|
||
.sixcontenttowitem {
|
||
margin-top: 16rpx;
|
||
|
||
.sixcontenttowitemone {
|
||
image {
|
||
margin-left: 24rpx;
|
||
width: 31.37rpx;
|
||
height: 27.34rpx;
|
||
}
|
||
|
||
.sixcontenttowitemonetext {
|
||
margin-left: 14rpx;
|
||
font-size: 28rpx;
|
||
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
|
||
font-weight: 500;
|
||
color: #333333;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
.fixedview {
|
||
position: fixed;
|
||
bottom: 0;
|
||
left: 0;
|
||
width: 100%;
|
||
|
||
.flex-between {
|
||
width: 100%;
|
||
padding: 24rpx 28rpx;
|
||
background: #FFFFFF;
|
||
|
||
.fixedview_one {
|
||
.fixedview_oneone {
|
||
font-size: 28rpx;
|
||
font-family: SourceHanSansCN-Bold-, SourceHanSansCN-Bold;
|
||
font-weight: normal;
|
||
color: #333333;
|
||
}
|
||
|
||
.fixedview_onetow {
|
||
font-size: 44rpx;
|
||
font-family: SourceHanSansCN-Bold-, SourceHanSansCN-Bold;
|
||
font-weight: normal;
|
||
color: #F45C4C;
|
||
font-weight: bold;
|
||
|
||
text {
|
||
font-size: 28rpx;
|
||
}
|
||
}
|
||
}
|
||
|
||
.fixedview_tow {
|
||
background: red;
|
||
border-radius: 34rpx;
|
||
padding: 10rpx 44rpx;
|
||
font-size: 32rpx;
|
||
font-family: PingFang SC-Bold, PingFang SC;
|
||
font-weight: bold;
|
||
color: #FFFFFF;
|
||
}
|
||
}
|
||
}
|
||
</style> |