确认订单页面及收银台页面调整

This commit is contained in:
2022-06-08 14:13:33 +08:00
parent ad9d27ccc1
commit 803d3af3cb
15 changed files with 6506 additions and 6473 deletions

View File

@@ -1,106 +1,123 @@
<template>
<view>
<oct-pay
:price="price"
:payNo="payNo"
color="#34CE98"
price-color="#e6576b"
:payPlatform="platform"
@onPay="pay"
/>
</view>
</template>
<script>
import { wxPAY, alPAY } from '@/apis/interfaces/pay'
export default {
data() {
return {
payNo : "",
price : "",
platform: ['wxpay', 'alipay']
}
},
mounted() {
this.payNo = this.$Route.query.orderNo
this.price = Number(this.$Route.query.price).toFixed(2)
},
methods: {
pay(e){
uni.getProvider({
service: 'payment',
success: res => {
if(res.provider.findIndex(val => val === e.platform) < 0){
switch (e.platform){
case 'wxpay':
uni.showToast({
title: '支付失败,您暂未安装微信',
icon : 'none'
})
break;
case 'alipay':
uni.showToast({
title: '支付失败,您暂未安装支付宝',
icon : 'none'
})
break;
}
return
}
if(e.platform === 'wxpay') this.getWXPAY(e.platform)
if(e.platform === 'alipay') this.getALPAY(e.platform)
}
})
},
getALPAY(payType){
alPAY(this.payNo).then(res => {
this.callPay(res, payType)
})
},
getWXPAY(payType){
wxPAY(this.payNo).then(res => {
let config = JSON.parse(res)
this.callPay(config, payType)
})
},
callPay(orderInfo, payType){
uni.requestPayment({
provider: payType,
orderInfo,
success: payRes => {
uni.showModal({
title: '支付成功',
content: '订单已支付,我们将尽快为您安排发货,可在订单管理查询订单动态',
showCancel:false,
success:onRes => {
if(onRes.confirm){
if(this.$Route.query.oepnType === 'order'){
this.$store.commit('setRefresh', 1)
}
this.$Router.back()
}
}
})
},
fail: payErr => {
if(payErr.errCode == '-100'){
uni.showToast({
title: '支付被取消',
icon : 'none'
})
}else{
uni.showToast({
title: payErr.errMsg,
icon : 'none'
})
}
}
})
}
}
}
</script>
<style>
<template>
<view>
<oct-pay :price="price" :payNo="payNo" color="#34CE98" price-color="#e6576b" :payPlatform="platform"
@onPay="pay" />
</view>
</template>
<script>
import {
wxPAY,
alPAY
} from '@/apis/interfaces/pay'
export default {
data() {
return {
payNo: "",
price: "",
platform: ['dtpay']
}
},
mounted() {
this.payNo = this.$Route.query.orderNo
this.price = Number(this.$Route.query.price).toFixed(2)
},
methods: {
pay(e) {
if (e.platform === 'dtpay') return this.getDTPAY(e.platform);
uni.getProvider({
service: 'payment',
success: res => {
if (res.provider.findIndex(val => val === e.platform) < 0) {
switch (e.platform) {
case 'wxpay':
uni.showToast({
title: '支付失败,您暂未安装微信',
icon: 'none'
})
break;
case 'alipay':
uni.showToast({
title: '支付失败,您暂未安装支付宝',
icon: 'none'
})
break;
}
return
}
if (e.platform === 'wxpay') this.getWXPAY(e.platform)
if (e.platform === 'alipay') this.getALPAY(e.platform)
}
})
},
getDTPAY(){
console.log('dt 支付。。。')
uni.showModal({
title:'当前DT积分不足',
content:'不能支付该订单,是否放弃当前支付',
confirmText:'立即充值',
confirmColor:"#34CE98",
cancelText:'放弃支付',
cancelColor:"#666666",
success: (res) => {
if(res.confirm){
}else{
uni.navigateBack();
}
}
})
},
getALPAY(payType) {
alPAY(this.payNo).then(res => {
this.callPay(res, payType)
})
},
getWXPAY(payType) {
wxPAY(this.payNo).then(res => {
let config = JSON.parse(res)
this.callPay(config, payType)
})
},
callPay(orderInfo, payType) {
uni.requestPayment({
provider: payType,
orderInfo,
success: payRes => {
uni.showModal({
title: '支付成功',
content: '订单已支付,我们将尽快为您安排发货,可在订单管理查询订单动态',
showCancel: false,
success: onRes => {
if (onRes.confirm) {
if (this.$Route.query.oepnType === 'order') {
this.$store.commit('setRefresh', 1)
}
this.$Router.back()
}
}
})
},
fail: payErr => {
if (payErr.errCode == '-100') {
uni.showToast({
title: '支付被取消',
icon: 'none'
})
} else {
uni.showToast({
title: payErr.errMsg,
icon: 'none'
})
}
}
})
}
}
}
</script>
<style>
</style>

View File

@@ -21,7 +21,7 @@
<image class="order-cover" :src="item.items[0].cover" mode="aspectFill"></image>
<view class="order-title">{{item.items[0].title}}</view>
<view class="order-count">
<view class="order-price"><text></text>{{item.items[0].price}}</view>
<view class="order-price">{{item.items[0].price}}<text class="type">DT积分</text></view>
</view>
</view>
</block>
@@ -44,12 +44,12 @@
<view class="block info-box">
<view class="info-item">
<view class="label">订单备注</view>
<textarea class="info-textarea" v-model="remark" placeholder="订单备注"></textarea>
<textarea class="info-textarea" v-model="remark" placeholder="请输入备注"></textarea>
</view>
</view>
<!-- footer -->
<view class="order-footer">
<view class="total">总计<text>{{total}}</text></view>
<view class="total">总计<text>{{total}} <text class="type">DT积分</text></text></view>
<button class="btn" @click="subOrder">确认订单</button>
</view>
</view>
@@ -217,13 +217,17 @@
padding-left: $margin;
line-height: 40rpx;
.order-price{
font-size: 30rpx;
font-size: 32rpx;
font-weight: bold;
color: $text-price;
&>text{
font-size: 24rpx;
}
}
.type{
font-size: 22rpx;
padding-left: 6rpx;
}
.order-sum{
font-size: $title-size-sm;
color: $text-gray;
@@ -289,6 +293,10 @@
font-size: $title-size-lg;
font-weight: bold;
}
.type{
font-size: 22rpx;
padding-left: 6rpx;
}
}
.btn{
margin-left: $margin;

View File

@@ -61,7 +61,7 @@
</view>
<!-- 订单 -->
<view class="order-box">
<view class="order-box-item" @click="onBtn('Order', { index: 4 })">
<view class="order-box-item" @click="onBtn('Order', { index: 0 })">
<image class="icon" src="@/static/user/order_icon_04.png" mode="widthFix" />
<view class="title">我的订单</view>
</view>