123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701 |
- <template>
- <view class="content">
- <view class="cont">
- <view class="other-info">
- <view class="title">付款详情</view>
- <view class="item">
- <view class="left">
- <text class="label">订单号:</text>
- </view>
- <view class="right">
- <text class="text" v-if="order!=null">{{order.orderSn}}</text>
- </view>
- </view>
- <view class="item">
- <view class="left">
- <text class="label">订单类型:</text>
-
- </view>
- <view class="right">
- <text class="text" >
- <text >{{$getDictLabelName(inquiryTypeOptions,order.inquiryType)}}</text>
- <text >-{{$getDictLabelName(orderTypeOptions,order.orderType)}}</text>
- </text>
- </view>
- </view>
- <view class="item">
- <view class="left">
- <text class="label">订单金额:</text>
- </view>
- <view class="right">
- <text class="text">{{order.money.toFixed(2)}}</text>
- </view>
- </view>
- <view class="item" v-if="order!=null&&(order.userCouponId==null||order.userCouponId==0)" @click.stop="openCoupon()">
- <view class="left">
- <text class="label">优惠券:</text>
- </view>
- <view class="right">
- <text class="text">{{couponText}}</text>
- <image v-if="userCouponId!=0" @click.stop="delCoupon()" class="ic-close" src="/static/images/close.png"></image>
- <image class="ic-back" src="/static/images/arrow_gray.png"></image>
- </view>
- </view>
- <view class="item" v-if="order.userCouponId==null||order.userCouponId==0">
- <view class="left">
- <text class="label">优惠金额:</text>
- </view>
- <view class="right">
- <text class="text">{{discountMoney.toFixed(2)}}</text>
- </view>
- </view>
- <view class="item">
- <view class="left">
- <text class="label">支付金额:</text>
- </view>
- <view class="right">
- <text class="text">{{payMoney.toFixed(2)}}</text>
- </view>
- </view>
- <uni-popup ref="popCoupon" type="bottom" borderRadius="10rpx 10rpx 0px 0px">
- <view class="coupon">
- <view class="coupon-box" v-if="coupons.length>0" >
- <view @click="couponSelect(item)" class="coupon-item" v-for="(item) in coupons">
- <view class="left" >
- <image v-if="item.status==0" src="https://fs-1319721001.cos.ap-chongqing.myqcloud.com/fs/20240229/004bcf24fc7641dea9f3247fa8d59ea2.png" mode="widthFix"></image>
- <image v-if="item.status!=0" src="https://fs-1319721001.cos.ap-chongqing.myqcloud.com/fs/20240229/3ce37842579c48e2b8e50e547adbfeb6.png" mode="widthFix"></image>
- <view style="z-index: 999;">
- ¥<span class="num">{{item.price.toFixed(2)}}</span>
- </view>
- <view class="pic-num" >满{{item.minPrice.toFixed(2)}}元可用</view>
- </view>
- <view class="right">
- <view class="title">
- {{item.title}}
- </view>
- <view class="btns">
- <view v-if="item.status==0||item.status==2" >{{item.limitTime}} 到期</view>
- <view v-if="item.status==1">使用时间 {{item.useTime}}</view>
- <view class="bnt gray" v-if="item.status==1" >已使用</view>
- <view class="bnt gray" v-if="item.status==2" >已过期</view>
- <view class="btn" v-if="item.status==0" >使用</view>
- </view>
- </view>
- </view>
- </view>
- <view class="empty" v-if="coupons.length==0">
- <image src="https://cos.his.cdwjyyh.com/fs/20240423/cf4a86b913a04341bb44e34bb4d37aa2.png"></image>
- </view>
- </view>
- </uni-popup>
- </view>
-
- </view>
- <view class="btn-box">
- <view class="btn" @click="payOrder()">支付{{payMoney.toFixed(2)}}元</view>
- </view>
- <uni-popup ref="popTip" type="dialog">
- <uni-popup-dialog cancelText="支付失败" confirmText="支付成功" mode="base" content="是否已支付成功?" title="提示" :duration="2000" :before-close="true" @close="confirmTip" @confirm="confirmTip"></uni-popup-dialog>
- </uni-popup>
- <uni-popup ref="popPayType" type="bottom" borderRadius="10rpx 10rpx 0px 0px">
- <view class="pay-box">
- <view class="title">请选择支付方式</view>
- <view class="pay-list">
- <view class="pay-item alipay" @click="doAlipay()">
- <image src="/static/images/alipay.png"></image>
- <view class="name">支付宝支付</view>
- </view>
- <view class="pay-item wx" @click="doWxPay()">
- <image src="/static/images/wx.png"></image>
- <view class="name" >微信支付</view>
- </view>
- </view>
-
- </view>
-
- </uni-popup>
- </view>
- </template>
- <script>
- import {getMyEnableCouponList} from '@/api/user.js'
- import {getDictByKey} from '@/api/common.js'
- import {pay,getInquiryOrderById,compute,zfbPayment} from '@/api/inquiryOrder.js'
- const tzCashier=uni.requireNativePlugin("TZBank-Cashier");
- export default {
- data() {
- return {
- order:null,
- orderId:null,
- orderTypeOptions:[],
- inquiryTypeOptions:[],
- couponText:"请选择优惠券",
- userCouponId:0,
- coupons:[],
- couponShow:false,
- payMoney:0,
- discountMoney:0
- }
- },
- onLoad(options) {
- this.orderId=options.orderId;
- this.getDictByKey("sys_inquiry_order_type");
- this.getDictByKey("sys_inquiry_type");
- this.getInquiryOrderById();
- this.getMyEnableCouponList();
-
- },
- onShow() {
-
- },
- //发送给朋友
- onShareAppMessage(res) {
- var that=this;
- if(this.$isLogin()){
- return {
- title: "订单支付",
- path: '/pages_order/inquiryPay?orderId='+that.orderId,
- imageUrl: 'https://hos-1309931967.cos.ap-chongqing.myqcloud.com/fs/20230106/6b459adfb1004c1a96219bcdf07e337c.png' //分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径.支持PNG及JPG。显示图片长宽比是 5:4
- }
- }
-
- },
- methods: {
- closeTip(){
- this.$refs.popTip.close()
- },
- confirmTip() {
- uni.showLoading({title:"请稍侯...",mask:true});
- setTimeout(()=>{
- uni.hideLoading();
- this.getInquiryOrder();
- },2000);
-
- },
- getInquiryOrder(){
- var data = {orderId:this.orderId};
- var that=this;
- uni.showLoading();
- getInquiryOrderById(data).then(res => {
- this.$refs.popTip.close();
- if(res.code==200){
- this.order=res.data;
- if(res.data.status==1){ //1:代付款 2:已支付
- uni.showToast({title: '未支付成功',icon: 'none'});
- }
- else if(res.data.status==2){ //1:代付款 2:已支付
- this.$refs.popTip.close();
- //获取渠道标识
- // #ifdef APP-PLUS
- if(plus.runtime.channel=="baidu"){
- let bdCmdType=uni.getStorageSync("bdCmdType");
- if(bdCmdType!=null && parseInt(bdCmdType)<=2){
- //this.$registerIdCode("orders",2,res.data.payMoney.toString()); //已下单
- }
- }
- // #endif
- uni.redirectTo({
- url:"./inquiryOrderPaySuccess?orderId="+this.order.orderId
- })
- }
- }else{
- uni.showToast({
- icon:'none',
- title: res.msg,
- });
- }
- },
- rej => {}
- );
- },
- couponSelect(item){
- this.$refs.popCoupon.close()
- //计算金额
- this.userCouponId=item.id;
- console.log(item)
- this.couponText=item.price+"元优惠券"
- this.compute()
- },
- openCoupon(){
- this.$refs.popCoupon.open("bottom")
- },
- delCoupon(){
- this.userCouponId=0;
- this.couponText="请选择优惠券"
- this.compute()
- },
- compute(){
- var data={
- orderId:this.orderId,
- userCouponId:this.userCouponId
- }
- console.log(data)
- compute(data).then(
- res => {
- if(res.code==200){
- this.payMoney=res.data.payMoney;
- this.discountMoney=res.data.discountMoney;
- }
- else{
- this.userCouponId=0;
- this.couponText="请选择优惠券"
- uni.showToast({
- icon:'none',
- title: res.msg,
- });
- }
- },
- err => {
- }
- );
- },
- getMyEnableCouponList(){
- var data={couponType:3}
- getMyEnableCouponList(data).then(
- res => {
- if(res.code==200){
- this.coupons=res.data;
- }
- },
- err => {
- }
- );
- },
- getDictByKey(key){
- var data={key:key}
- getDictByKey(data).then(
- res => {
- if(res.code==200){
- if(key=="sys_inquiry_order_type"){
- this.orderTypeOptions=res.data;
- }
- if(key=="sys_inquiry_type"){
- this.inquiryTypeOptions=res.data;
- }
- }
- },
- err => {
- }
- );
-
- },
- getInquiryOrderById(){
- var data = {orderId:this.orderId};
- var that=this;
- uni.showLoading();
- getInquiryOrderById(data).then(
- res => {
- if(res.code==200){
- uni.hideLoading();
- that.order=res.data;
- this.compute();
- }else{
- uni.showToast({
- icon:'none',
- title: res.msg,
- });
- }
- },
- rej => {}
- );
- },
- doAlipay(){
- var data = {
- orderId:this.order.orderId,
- };
- var that=this;
- // #ifdef APP-PLUS
- uni.showLoading();
- zfbPayment(data).then(res => {
- uni.hideLoading()
- this.$refs.popPayType.close()
- this.$refs.popTip.open()
- if(res.code==200){
- if(res.type=="tz"){
- const match = res.data.body.url.match(/[\?&]businessCstNo=([^&]+)/);
- const businessCstNo = match ? match[1] : null;
- console.log("qxj tzCashier:"+tzCashier+" businessCstNo:"+businessCstNo);
- tzCashier.pay({
- env:0,
- wxMiniProgramType:0,
- wxAppId:'wx703c4bd07bbd1695',
- wxUniversalLink:"https://yjf.runtzh.com/",
- orderFlowNo:res.data.body.orderFlowNo,
- businessCstNo:businessCstNo,
- platMerCstNo:res.data.body.platMerCstNo
- },(res)=>{
- console.log("qxj 支付成功:"+JSON.stringify(res));
- });
- }
- else if(res.type=='hf'){
- if (uni.getSystemInfoSync().platform == 'android') {
- var alipayScheme ='alipays://platformapi/startApp?&saId=10000007&qrcode=' + res.data.qr_code;
-
- }else{
- var alipayScheme ='alipay://platformapi/startApp?&saId=10000007&qrcode=' + res.data.qr_code;
- }
- console.log(alipayScheme)
- // 在uni-app中使用plus.runtime.openURL打开URL
- plus.runtime.openURL(alipayScheme, function(error) {
- // console.error('打开支付宝失败: ' + error.message);
- // 处理打开支付宝失败的情况,比如提示用户或者跳转到其他支付方式
- });
-
- }
- }
- else{
- uni.showToast({
- title:res.msg,
- icon:'none'
- })
- }
- },
- rej => {}
- );
- // #endif
-
- },
-
- doWxPay(){
- var that=this;
- plus.share.getServices(function(res){
- var sweixin = null;
- for(var i=0;i<res.length;i++){
- var t = res[i];
- if(t.id == 'weixin'){
- sweixin = t;
- }
- }
- if(sweixin){
- that.$refs.popPayType.close()
- that.$refs.popTip.open()
- //唤起微信跳转小程序
- sweixin.launchMiniProgram({
- id:"gh_7a6a32e5ef61",
- path:'pages_order/inquiryPayment?orderId='+that.orderId+"&payMethod=app",
- type:0
- },function(){
- console.log("微信唤起成功");
- return true;
- },function(e){
- console.log("微信唤起失败",e);
- uni.showToast({
- title:'微信唤起失败,请检查是否有微信应用',
- icon:'none'
- })
- return false;
- })
-
- }else{
- uni.showToast({
- title:'微信唤起失败,请检查是否有微信应用',
- icon:'none',
- duration:3000
- })
- return false;
- }
-
- },function(res){
- console.log(JSON.stringify(res));
- });
- },
- payOrder(){
- var data = {
- orderId:this.order.orderId,
- userCouponId:this.userCouponId
- };
- var that=this;
- uni.showLoading();
- pay(data).then(
- res => {
- if(res.code==200){
- console.log(res)
- this.$refs.popPayType.open("bottom")
-
- }else{
- uni.showToast({
- icon:'none',
- title: res.msg,
- });
- }
- },
- rej => {}
- );
-
- }
-
- }
- }
- </script>
- <style lang="scss">
- page{
- background: #f6f6f6;
- }
- </style>
- <style scoped lang="scss">
- .content{
- position: relative;
- height: 100%;
- .cont{
- position: relative;
- padding: 0rpx 20rpx 160rpx;
- width: 100%;
- display: flex;
- flex-direction: column;
- }
- .other-info{
- margin-top: 20upx;
- background-color: #fff;
- border-radius: 20upx;
- overflow: hidden;
- padding: 0 30upx;
- .title{
- height: 80upx;
- line-height: 80upx;
- font-size: 30upx;
- color: #000;
- font-weight: bold;
- border-bottom: 2upx solid #eeeeee;
- }
- .item{
- height: 80upx;
- display: flex;
- align-items: center;
- justify-content: space-between;
- &:last-child{
- border-bottom: none;
- }
- .left{
- flex: 1;
- display: flex;
- align-items: center;
- .label{
- min-width: 140rpx;
- font-size: 28upx;
- color: #000;
- }
- .text{
- font-size: 28upx;
- color: #1b1b1b;
- }
- }
- .right{
- display: flex;
- align-items: center;
- justify-content: flex-end;
- .text{
- font-size: 28upx;
- color: #1b1b1b;
- }
- .ic-close{
- margin-left: 10rpx;
- width: 30rpx;
- height:30rpx;
- }
- .ic-back{
- margin-left: 10rpx;
- width: 15rpx;
- height:30rpx;
- }
- }
- .item-btn{
- max-width: 200rpx;
- padding: 0rpx 15rpx;
- height: 48upx;
- border-radius: 24upx;
- line-height: 48upx;
- font-size: 24upx;
- color: #000;
- border: 1upx solid #d8d8d8;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- }
- }
- .btn-box{
- height: 140upx;
- width: 100%;
- padding: 0rpx 30upx;
- position: absolute;
- bottom: 0;
- left: 0;
- box-sizing: border-box;
- background-color: #ffffff;
- display: flex;
- align-items: center;
- justify-content: center;
- .btn{
- width: 100%;
- height: 88upx;
- line-height: 88upx;
- text-align: center;
- font-size: 34upx;
- font-family: PingFang SC;
- font-weight: 400;
- color: #FFFFFF;
- background: #FF5C03;
- border-radius: 10upx;
- }
- }
- }
- .coupon{
- border-radius: 30rpx 30rpx 0rpx 0rpx;
- background-color: #FFFFFF;
- height: 100%;
- .empty{
- display: flex;
- align-items: center;
- justify-content: center;
- height: 650rpx;
- width: 100%;
- image{
- width: 280rpx;
- height: 200rpx;
- }
- }
- }
- .coupon-box{
-
- overflow-y: auto;
- padding: 80rpx 20rpx 80rpx;
- height: 650rpx;
- width: 100%;
- display: flex;
- flex-direction: column;
- align-items: flex-start;
- justify-content: flex-start;
- box-sizing: border-box;
- .coupon-item{
- width: 100%;
- display: flex;
- align-items: center;
- justify-content: flex-start;
- margin-bottom: 16rpx;
- height:170rpx;
- &:last-child{
- margin-bottom: 0rpx;
- }
- .left{
- color: #fff;
- font-size: 36rpx;
- font-weight: bold;
- text-align: center;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- position: relative;
- width: 230rpx;
- image{
- position: absolute;
- width: 230rpx;
- height:170rpx;
- color: #fff;
- }
- .num{
- font-size: 40rpx;
- }
- .pic-num{
- font-size: 20rpx;
- z-index: 99;
- }
- }
- .right{
-
- display: flex;
- flex-direction: column;
- align-items: flex-start;
- justify-content: flex-start;
- height:170rpx;
- width: calc(100% - 230rpx);
- padding: 0 17rpx 0 24rpx;
- background-color: #fff;
- box-sizing: border-box;
- .title{
- width: 100%;
- font-size: 0.3 * 100rpx;
- color: #282828;
- height: 0.93 * 100rpx;
- line-height: 0.93 * 100rpx;
- border-bottom: 1px solid #f0f0f0;
- }
- .btns{
- display: flex;
- align-items: center;
- justify-content: space-between;
- width: 100%;
- font-size: 0.2 * 100rpx;
- color: #999;
- height: 0.76 * 100rpx;
- .btn{
- width: 1.36 * 100rpx;
- height: 0.44 * 100rpx;
- border-radius: 0.22 * 100rpx;
- font-size: 0.22 * 100rpx;
- color: #fff;
- text-align: center;
- line-height: 0.44 * 100rpx;
- background-color: #FF5C03;
- .gray{
- background-color: #ccc;
- }
- }
-
- }
- }
- }
-
- }
- .pay-box{
- border-radius: 30rpx 30rpx 0rpx 0rpx;
- padding: 30rpx;
- height: 350rpx;
- background-color: #fff;
- width: 100%;
- display:flex;
- flex-direction: column;
- text-align: center;
- justify-content: flex-start;
- .title{
- font-size: 32rpx;
- font-weight: bold;
- color: #111;
- }
- .pay-list{
- margin-top: 50rpx;
- display:flex;
- text-align: center;
- justify-content: center;
- .pay-item{
- margin: 10rpx;
- padding: 30rpx 0rpx;
- border-radius: 60rpx;
- background-color: green;
- flex: 1;
- display:flex;
- text-align: center;
- justify-content: center;
- image{
- width:40rpx;
- height:40rpx;
- }
- .name{
- margin-left: 15rpx;
- font-size: 32rpx;
- font-weight: bold;
- color: #fff;
- }
-
-
- }
- .wx{
- background-color: #09ba08;
- }
- .alipay{
- background-color: #04a9ed;
- }
- }
-
- }
- </style>
|