|
|
@@ -14,31 +14,25 @@
|
|
|
<span class="app-size-36 app-bold">¥{{ parseFloat(actPrice)}}</span>
|
|
|
</view>
|
|
|
</block>
|
|
|
- <view v-if="isCashier">
|
|
|
- <view class="balance">请出示付款码</view>
|
|
|
- <view class="call-one-btn">
|
|
|
- <button class="button-com default" @click="checkResult()">查询支付结果</button>
|
|
|
- </view>
|
|
|
- <view style="margin-top:35upx;">
|
|
|
- <button style="width:25vh;" @click="changePayWay(2)" class="admin-button-com big default">赊账</button>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- <view v-else>
|
|
|
+ <view>
|
|
|
<view style="text-align:center;margin:10upx auto 10upx auto;">
|
|
|
- <view class="balance" style="margin-bottom:25upx;">扫二维码付款</view>
|
|
|
- <view style="margin-bottom:20upx;">
|
|
|
- <button @click="changePayWay(0)" class="admin-button-com big" :class="payWay == 0 ? 'blue' : 'default'">微信</button>
|
|
|
- <button @click="changePayWay(1)" style="margin-left:40upx;" class="admin-button-com big" :class="payWay == 1 ? 'blue' : 'default'">支付宝</button>
|
|
|
- <button @click="changePayWay(2)" style="margin-left:40upx;" class="admin-button-com big" :class="payWay == 2 ? 'blue' : 'default'">赊账</button>
|
|
|
- </view>
|
|
|
-
|
|
|
- <image mode="widthFix" v-if="expire == 0" style="width:350upx;margin:0 auto;" :src="payQrCodeUrl"></image>
|
|
|
- <view style="font-size:32upx;color:red;font-weight:bold;padding-top:50upx;padding-bottom:50upx;" v-if="expire == 1">订单已过期,请重新创建</view>
|
|
|
-
|
|
|
+ <view class="balance" style="margin-bottom:25upx;">扫客户二维码收款</view>
|
|
|
+ <view style="margin-bottom:20upx;">
|
|
|
+ <button style="width:25vh;" @click="beginScan()" class="admin-button-com big blue">点击扫码</button>
|
|
|
+ </view>
|
|
|
+ <view style="margin-top:20upx;">
|
|
|
+ <button style="width:25vh;" class="admin-button-com big default" @click="checkResult()">查询支付结果</button>
|
|
|
+ </view>
|
|
|
+ <view style="margin-top:20upx;">
|
|
|
+ <button style="width:25vh;" @click="changePayWay(2)" class="admin-button-com big default">记赊账</button>
|
|
|
+ </view>
|
|
|
+ <view style="margin-top:20upx;">
|
|
|
+ <button style="width:25vh;" @click="toCancel()" class="admin-button-com big default">取消</button>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view style="margin-top:35upx;">
|
|
|
- <button style="width:28vh;" @click="goBack()" class="admin-button-com big default">返回首页</button>
|
|
|
+ <view style="margin-top:20upx;">
|
|
|
+ <button style="width:25vh;" @click="goBack()" class="admin-button-com big default">返回首页</button>
|
|
|
</view>
|
|
|
<view style="color:#CCCCCC;margin-top:20upx;">10分钟后未付款自动取消</view>
|
|
|
</view>
|
|
|
@@ -46,7 +40,7 @@
|
|
|
</view>
|
|
|
</template>
|
|
|
<script>
|
|
|
-import { codePayCheck,scanPay,scanPayCheck,cancel,debtPay,getDetail} from "@/api/order/index";
|
|
|
+import { cancel,debtPay,getDetail,codePay,codePayCheck} from "@/api/order";
|
|
|
export default {
|
|
|
name: "toPay",
|
|
|
components: {
|
|
|
@@ -64,14 +58,16 @@ export default {
|
|
|
isCashier:false,
|
|
|
INT:null,
|
|
|
orderInfo:{orderType:0},
|
|
|
- expire:0
|
|
|
+ expire:0,
|
|
|
+ T:null
|
|
|
};
|
|
|
},
|
|
|
mounted() {
|
|
|
},
|
|
|
onLoad(option) {
|
|
|
this.orderId = option.orderId
|
|
|
-
|
|
|
+ this.actPrice = option.actPrice
|
|
|
+ this.orderSn = option.orderSn
|
|
|
if(!this.$util.isEmpty(option.orderId)){
|
|
|
getDetail({ id: option.orderId }).then(res=>{
|
|
|
if(res.code == 1){
|
|
|
@@ -79,48 +75,60 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
-
|
|
|
- uni.setStorageSync('globalCodePayId',option.orderId)
|
|
|
- this.actPrice = option.actPrice
|
|
|
- this.orderSn = option.orderSn
|
|
|
-
|
|
|
- // #ifdef MP-WEIXIN
|
|
|
- this.isCashier = false
|
|
|
- // #endif
|
|
|
- if(this.isCashier == false){
|
|
|
- this.toScanPay()
|
|
|
- this.checkPayInfo()
|
|
|
- }
|
|
|
-
|
|
|
- },
|
|
|
- onShow() {
|
|
|
- },
|
|
|
- onUnload() {
|
|
|
- uni.removeStorageSync('globalCodePayId')
|
|
|
- if(!this.$util.isEmpty(this.INT)){
|
|
|
- clearInterval(this.INT)
|
|
|
- }
|
|
|
},
|
|
|
methods: {
|
|
|
- init(){
|
|
|
-
|
|
|
- },
|
|
|
- checkPayInfo(){
|
|
|
+ beginScan(){
|
|
|
let that = this
|
|
|
- this.INT = setInterval(function(){
|
|
|
- scanPayCheck({id:that.orderId}).then(res=>{
|
|
|
+ uni.scanCode({
|
|
|
+ onlyFromCamera: true,
|
|
|
+ success: function (res) {
|
|
|
+ that.requestCodePay(res.result)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //付款
|
|
|
+ requestCodePay(authCode){
|
|
|
+ let that = this
|
|
|
+ codePay({id:this.orderId,authCode:authCode}).then(res=>{
|
|
|
if(res.code == 1){
|
|
|
+ if(res.data.returnStatus == 'SUCCESS'){
|
|
|
+ that.showSuccess = true
|
|
|
+ setTimeout(function(){
|
|
|
+ that.payFinish()
|
|
|
+ },1200)
|
|
|
+ }else{
|
|
|
+ that.T = setInterval(function(){
|
|
|
+ that.checkPay()
|
|
|
+ }, 1000);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ that.T = setInterval(function(){
|
|
|
+ that.checkPay()
|
|
|
+ }, 1000);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //查询付款结果
|
|
|
+ checkPay(){
|
|
|
+ let that = this
|
|
|
+ codePayCheck({id:this.orderId}).then(res=>{
|
|
|
+ if(res.code == 1){
|
|
|
if(res.data.returnStatus == 'SUCCESS'){
|
|
|
- that.$util.pageTo({ url: '/admin/billing/result',type:2,query: {orderId:that.orderId,orderSn:that.orderSn,title:'支付成功'}})
|
|
|
+ uni.hideLoading()
|
|
|
+ clearInterval(that.T)
|
|
|
+ setTimeout(function(){
|
|
|
+ that.payFinish()
|
|
|
+ },1500)
|
|
|
+ return
|
|
|
}
|
|
|
- //订单过期
|
|
|
- if(res.data.returnStatus == 'EXPIRE'){
|
|
|
- clearInterval(that.INT)
|
|
|
- that.expire = 1
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- }, 4000);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ init(){
|
|
|
+
|
|
|
+ },
|
|
|
+ payFinish(){
|
|
|
+ this.$util.pageTo({ url: '/admin/billing/result',type:2,query: {orderId:this.orderId,orderSn:this.orderSn,title:'支付成功'}})
|
|
|
},
|
|
|
changePayWay(payWay){
|
|
|
this.payWay = payWay
|
|
|
@@ -137,52 +145,49 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
})
|
|
|
- }else{
|
|
|
- this.toScanPay()
|
|
|
}
|
|
|
},
|
|
|
- toScanPay(){
|
|
|
- let that = this
|
|
|
- scanPay({id:this.orderId,payWay:this.payWay}).then(res=>{
|
|
|
- if(res.code == 1){
|
|
|
- if(res.data.returnStatus == 'SUCCESS'){
|
|
|
- let url = res.data.url || ''
|
|
|
- that.payQrCodeUrl = url
|
|
|
- that.showQrCode = true
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
checkResult(){
|
|
|
let that = this
|
|
|
- uni.showLoading({title: '查询中',mask:true})
|
|
|
codePayCheck({id:this.orderId}).then(res=>{
|
|
|
- uni.hideLoading()
|
|
|
if(res.code == 1){
|
|
|
- if(res.data.returnStatus == 'SUCCESS'){
|
|
|
- this.$util.pageTo({ url: '/admin/billing/result',type:2,query: {orderId:this.orderId,orderSn:this.orderSn,title:'支付成功'}})
|
|
|
- return
|
|
|
- }
|
|
|
+ if(res.data.returnStatus == 'SUCCESS'){
|
|
|
+ uni.hideLoading()
|
|
|
+ clearInterval(that.T)
|
|
|
+ setTimeout(function(){
|
|
|
+ that.payFinish()
|
|
|
+ },1500)
|
|
|
+ return
|
|
|
+ }
|
|
|
}
|
|
|
- that.$msg(res.msg)
|
|
|
- })
|
|
|
- },
|
|
|
- mobileScan(){
|
|
|
- let that = this
|
|
|
- uni.scanCode({
|
|
|
- success:function(res){
|
|
|
- let code = res.result
|
|
|
- that.requestCodePay(code)
|
|
|
- }
|
|
|
+ that.$msg('没有付款,请跟客户确认')
|
|
|
})
|
|
|
},
|
|
|
- handPay(){
|
|
|
- this.requestCodePay('123')
|
|
|
+ confirmToCancel(){
|
|
|
+ let that = this
|
|
|
+ codePayCheck({id:this.orderId}).then(res=>{
|
|
|
+ if(res.code == 1){
|
|
|
+ if(res.data.returnStatus == 'SUCCESS'){
|
|
|
+ uni.hideLoading()
|
|
|
+ clearInterval(that.T)
|
|
|
+ setTimeout(function(){
|
|
|
+ that.payFinish()
|
|
|
+ },1500)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ clearInterval(that.T)
|
|
|
+ cancel({id:this.orderId}).then(res=>{
|
|
|
+ if(res.code == 1){
|
|
|
+ that.$msg('已取消')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
},
|
|
|
goBack(){
|
|
|
uni.navigateBack()
|
|
|
},
|
|
|
- cancelOrder(){
|
|
|
+ toCancel(){
|
|
|
let that = this
|
|
|
that.$util.confirmModal({content:'确认取消?'},() => {
|
|
|
clearInterval(this.INT)
|