605 lines
14 KiB
Vue
605 lines
14 KiB
Vue
<template>
|
||
<view class="container">
|
||
<view class="card">
|
||
<view class="head">
|
||
<text class="title">
|
||
<text>{{listinfo.name}}</text>
|
||
</text>
|
||
<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="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 v-if="listinfo.tableName">
|
||
桌号:{{listinfo.tableName}}
|
||
</view>
|
||
<view class="number-wrap" style="margin-top: 20rpx;"
|
||
v-if="listinfo.status != 'unpaid' && listinfo.status != 'paying'&& listinfo.status != 'cancelled'">
|
||
<text class="t">取餐号</text>
|
||
<text class="number">{{listinfo.outNumber}}</text>
|
||
</view>
|
||
</view>
|
||
<view class="card">
|
||
<view class="head border" style="position: relative;">
|
||
<text class="title">
|
||
<text>点单详情</text>
|
||
</text>
|
||
|
||
<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="#ff0000" border-color="#00B26A" splitorColor="#000"
|
||
:font-size="14" :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">
|
||
<c-image width="120" height="120" radius="16" :src='item.productImg'></c-image>
|
||
</view>
|
||
<view class="info">
|
||
<text>{{item.productName}}</text>
|
||
<text class="n" v-if="item.productSkuName">{{item.productSkuName}}</text>
|
||
<text class="n">x{{item.num}}</text>
|
||
</view>
|
||
|
||
<view class="price">
|
||
<text class="i">¥</text>
|
||
<text class="num">{{item.priceAmount}}</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="total-wrap">
|
||
<view class="price">
|
||
<text>合计:</text>
|
||
<text class="i">¥</text>
|
||
<text class="num">{{listinfo.payAmount}}</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="card">
|
||
<view class="head border">
|
||
<text class="title">订单信息</text>
|
||
</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 class="card" style="padding-bottom: 20rpx;" v-if="listinfo.shopQrcode">
|
||
<image :src="listinfo.shopQrcode" show-menu-by-longpress="true" style="width: 100%;" mode="widthFix">
|
||
</image>
|
||
</view>
|
||
<view class="payType" v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'">
|
||
<view class="">
|
||
支付方式
|
||
</view>
|
||
<view class="">
|
||
<u-radio-group v-model="radiovalue" iconPlacement="right" @change="groupChange" :size="28"
|
||
placement="column">
|
||
<u-radio activeColor="#ffd158" name="1">
|
||
<view class="dfs">
|
||
<image style="width:44rpx;height:44rpx"
|
||
src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/balance.png" mode="">
|
||
</image>
|
||
<text style="font-size: 28rpx;margin-left: 16rpx;">
|
||
微信支付
|
||
</text>
|
||
</view>
|
||
</u-radio>
|
||
<view style="margin: 22rpx 0;width: 100%;height: 2rpx;background-color: #E5E5E5;">
|
||
</view>
|
||
<u-radio activeColor="#ffd158" name="2">
|
||
<view class="dfs">
|
||
<image style="width:44rpx;height:44rpx"
|
||
src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/wechat.png" mode="">
|
||
</image>
|
||
<text style="font-size: 28rpx;margin-left: 16rpx;">
|
||
会员卡支付</text>
|
||
</view>
|
||
</u-radio>
|
||
</u-radio-group>
|
||
<view style="font-weight: 400;font-size: 24rpx;color: #333333;margin-left: 60rpx;">
|
||
会员卡余额{{ amountVIP?amountVIP.amount:0}} <text
|
||
style="font-weight: 500;font-size: 28rpx;margin-left: 16rpx;color: #FF4C11;"
|
||
@click="goRecharge">去充值</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view :style="{height:height}">
|
||
|
||
</view>
|
||
<view class="fixedview">
|
||
<view class="flex-between" v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'">
|
||
<view class="fixedview_one flex-start">
|
||
<view class="fixedview_oneone">
|
||
实付金额:
|
||
</view>
|
||
<view class="fixedview_onetow">
|
||
<text>¥</text>{{listinfo.payAmount}}
|
||
</view>
|
||
</view>
|
||
<view class="fixedview_tow" @tap="$u.debounce(showpopupclickddes,500)">
|
||
立即付款
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<!-- 支付密码 -->
|
||
<payPassword ref="payPwd" @accountPayevent="accountPayevent" v-if="ispws"></payPassword>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
import payPassword from '@/components/payPassword.vue'
|
||
export default {
|
||
components: {
|
||
payPassword
|
||
},
|
||
data() {
|
||
return {
|
||
height: '',
|
||
pay_type: 1,
|
||
orderId: '',
|
||
listinfo: {},
|
||
radiovalue: '1', //选择支付方式
|
||
ispws: false,
|
||
srcimge: 'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/wx.jpg'
|
||
};
|
||
},
|
||
async onLoad(e) {
|
||
console.log(e)
|
||
this.orderId = e.orderId
|
||
},
|
||
onShow() {
|
||
this.orderorderInfo()
|
||
},
|
||
onUnload() {
|
||
uni.switchTab({
|
||
url: '/pages/order/order'
|
||
})
|
||
},
|
||
methods: {
|
||
groupChange(n) { //选择支付方式
|
||
this.radiovalue = n
|
||
},
|
||
mountedcreateSelectorQuery() {
|
||
//#ifdef MP-WEIXIN || H5
|
||
var query = uni.createSelectorQuery().in(this).select('.fixedview')
|
||
query.boundingClientRect(ele => {
|
||
var that = this;
|
||
console.log(ele, 111)
|
||
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
|
||
},
|
||
async paymodfiyOrderInfo() {
|
||
let res = await this.api.paymodfiyOrderInfo({
|
||
orderId: this.listinfo.orderId,
|
||
})
|
||
},
|
||
showpopupclickddes() {
|
||
// radiovalue为1是微信支付
|
||
if (this.radiovalue == 1) {
|
||
this.showpopupclick() //微信支付
|
||
} else {
|
||
// 先判断是否设置支付密码。0是没设置。没设置的情况下跳转到设置页面。有的话输入支付密码
|
||
// console.log(isPwd,'是否设置了支付密码')
|
||
if (uni.cache.get('userInfo').isPwd == 0) {
|
||
uni.pro.navigateTo('/pages/user/repairpassword', {
|
||
shopId_id: uni.cache.get('shopUser')
|
||
})
|
||
} else {
|
||
this.ispws = true
|
||
this.$nextTick(() => {
|
||
this.$refs.payPwd.onPayUp();
|
||
})
|
||
}
|
||
}
|
||
},
|
||
async showpopupclick() {
|
||
let res = await this.api.payorderPay({
|
||
orderId: this.orderId,
|
||
}) //判断是否支付成功
|
||
if (res.code == 0) {
|
||
uni.showLoading({
|
||
title: '加载中',
|
||
mask: true
|
||
})
|
||
// #ifdef MP-WEIXIN
|
||
uni.requestPayment({
|
||
provider: 'wxpay', //支付类型-固定值
|
||
partnerid: res.data.appId, // 微信支付商户号
|
||
timeStamp: res.data.timeStamp, // 时间戳(单位:秒)
|
||
nonceStr: res.data.nonceStr, // 随机字符串
|
||
package: res.data.package, // 固定值
|
||
signType: res.data.signType, //固定值
|
||
paySign: res.data.paySign, //签名
|
||
success: (res) => {
|
||
uni.showToast({
|
||
title: "支付成功"
|
||
})
|
||
setTimeout(res => {
|
||
uni.hideLoading()
|
||
uni.switchTab({
|
||
url: '/pages/order/order'
|
||
});
|
||
}, 500)
|
||
this.paymodfiyOrderInfo()
|
||
},
|
||
fail: (err) => {
|
||
uni.showToast({
|
||
icon: 'none',
|
||
title: '支付失败'
|
||
})
|
||
setTimeout(res => {
|
||
uni.hideLoading()
|
||
uni.switchTab({
|
||
url: '/pages/order/order'
|
||
});
|
||
}, 500)
|
||
|
||
}
|
||
});
|
||
// #endif
|
||
}
|
||
},
|
||
// 余额支付
|
||
async accountPayevent(pwd) {
|
||
this.ispws = false
|
||
let res = await this.api.accountPay({
|
||
orderId: this.listinfoid,
|
||
memberId: this.amountVIP.id,
|
||
// remark: this.remark,
|
||
pwd
|
||
})
|
||
if (res.code == 0) {
|
||
// data ->1 支付成功
|
||
// ->2 余额不足
|
||
// ->3 未设置支付密码,
|
||
// ->4 不是会员,
|
||
if (res.data == 1) {
|
||
this.showToastUppop('支付成功')
|
||
let _this = this
|
||
|
||
uni.requestSubscribeMessage({
|
||
tmplIds: ['z0fUG7-jhSfYCrw6poOvSRzh4_hgnPkm_5C7E5s5bCQ'],
|
||
complete() {
|
||
uni.redirectTo({
|
||
url: '/pages/order/order_detail?orderId=' + _this
|
||
.listinfoid
|
||
});
|
||
},
|
||
})
|
||
|
||
} else if (res.data == 2) {
|
||
this.showToastUppop('余额不足')
|
||
setTimeout(() => {
|
||
// 去充值
|
||
this.goRecharge()
|
||
}, 1500)
|
||
} else if (res.data == 3) {
|
||
this.showToastUppop('未设置支付密码')
|
||
setTimeout(() => {
|
||
uni.pro.navigateTo('/pages/user/repairpassword', {
|
||
shopId_id: uni.cache.get('shopUser')
|
||
})
|
||
}, 1500)
|
||
|
||
} else if (res.data == 4) {
|
||
this.showToastUppop('非会员请充值')
|
||
setTimeout(() => {
|
||
// 去充值
|
||
this.goRecharge()
|
||
}, 1500)
|
||
}
|
||
|
||
}
|
||
|
||
},
|
||
showToastUppop(title) {
|
||
uni.showToast({
|
||
icon: 'none',
|
||
title,
|
||
success: () => {
|
||
|
||
}
|
||
})
|
||
},
|
||
async orderorderInfo() {
|
||
let res = await this.api.orderorderInfo({
|
||
orderId: this.orderId
|
||
})
|
||
if (res.code == 0) {
|
||
this.listinfo = res.data
|
||
this.mountedcreateSelectorQuery()
|
||
}
|
||
},
|
||
copyHandle(e) {
|
||
uni.setClipboardData({
|
||
data: e,
|
||
success() {
|
||
uni.showToast({
|
||
title: '复制成功',
|
||
icon: 'none'
|
||
});
|
||
}
|
||
});
|
||
},
|
||
clickselect(b) {
|
||
this.pay_type = b
|
||
},
|
||
},
|
||
};
|
||
</script>
|
||
|
||
<style scoped lang="scss">
|
||
.container {
|
||
padding: 28upx;
|
||
}
|
||
|
||
.payType {
|
||
padding: 32rpx 34rpx;
|
||
margin-top: 48rpx;
|
||
background-color: #fff;
|
||
|
||
>view:first-child {
|
||
font-weight: 500;
|
||
font-size: 28rpx;
|
||
color: #333333;
|
||
}
|
||
|
||
>view:last-child {
|
||
margin-top: 32rpx;
|
||
}
|
||
|
||
.dfs {
|
||
display: flex;
|
||
align-items: center;
|
||
}
|
||
|
||
}
|
||
|
||
.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: 20upx 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> |