123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410 |
- <template>
- <div class="mianBox">
- <van-row class="contentBox">
- <van-row>
- <van-col span="24" class="logo"><van-image width="75" height="75" :src="require('../img/logo.png')" /></van-col>
- <van-col span="24" class="introduce">中国东信智慧园区平台</van-col>
- <van-col span="24" class="money">{{data.money}}</van-col>
- <van-col span="24" class="order_money">订单金额(元)</van-col>
- </van-row>
- <!-- <van-row class="order_wrap">
- <van-row>
- <van-col span="8" class="left">用途</van-col>
- <van-col span="16" class="right">充值</van-col>
- </van-row>
- <van-row>
- <van-col span="8" class="left">收款单位</van-col>
- <van-col span="16"class="right">中国东信智慧园区平台</van-col>
- </van-row>
- <van-row>
- <van-col span="8" class="left">订单编号</van-col>
- <van-col span="16" class="right">12345678910123124565</van-col>
- </van-row>
- <van-row>
- <van-col span="8" class="left">订单时间</van-col>
- <van-col span="16" class="right">2021-09-27 15:00:00</van-col>
- </van-row>
- </van-row> -->
- <div class="pay_wrap">
- <van-button class="pay" color="#F22E3C" @tap="pay">支付</van-button>
- <button class="pay" open-type="launchApp" app-parameter="appData" @error="launchAppError" v-if="data.userId">返回APP</button>
- </div>
- <van-toast id="van-toast" />
- <!-- <van-overlay :show="show" @click="show = false" /> -->
- </van-row>
- </div>
- </template>
- <script>
- import Toast from '../../wxcomponents/vant/weapp/dist/toast/toast';
- import { requestPost, requestGet } from '@/utils/user.js';
- export default {
- data() {
- return {
- data:{
- money:undefined,
- openid:null,
- app:false,
- },
- appData:{
- errCOde:0,
- errStr:null,
- extMsg:"未支付",
- extraData:"未支付",
- openid:null,
- transaction:null,
- type:"WXLaunchMiniProgramReq.Resp"
- }
- }
- },
- onLoad(options) {
- //console.log(options)
- let _this = this
- const data = JSON.parse(options.params)
- _this.data = data
- uni.getStorage({
- key: 'openid',
- success: function (res) {
- _this.appData.openid = _this.data.openid
- if(data.scene){
- if(data.scene == "3"){
- //console.log("app进入 -->支付页")
- _this.data={
- money:data.money,
- channelId:data.channelId,
- userId:data.userId,
- scene:data.scene,
- openid:res.data,
- app:false,
- }
- }
- }else{
- //console.log("微信小程序历史记录进入 -->支付页")
- _this.data={
- money:data.money,
- scene:'2',
- channelId:'',
- userId:null,
- openid:data.openid,
- app:false,
- }
- }
-
- _this.data.app = false
- _this.pay()
-
- },
- fail: function (res) {
-
- },
- });
-
- },
- methods: {
- pay(){
- let _this = this
- if(_this.data.openid && _this.data.openid != 'null' ){
- // Toast(1,_this.data.money)
- // uni.redirectTo({
- // url: `../over/index?type=游客`
- // });
- if(_this.data.userId){//app用户充值
- //console.log("app用户充值")
- requestGet("dxtop/staff/one",
- {
- "id":_this.data.userId,
- },
- ).then(res =>{
-
- if(res[1].data.data){
- requestPost("dxtop/order/callUnifiedPay",
- {
- "money": _this.data.money,
- "topPayType": "W06",
- "payType": "2",
- "channelId":_this.data.channelId,
- "userId":res[1].data.data.sid,
- "scene":_this.data.scene,
- "openId":_this.data.openid,
- }
- ).then(res => {
- if(res[1].data?.status == "ERROR"){
- if(res[1].data?.code == 500){
- if(res[1].data.msg == "acct参数错误"){
- Toast("华为、Android10系统,需要开启微信的“浮窗”和“允许在其他上层应用上打开”这两个权限")
- }else{
- Toast(res[1].data.msg)
- }
- }else{
- Toast(res[1].data.msg)
- }
-
- }else{
- if(res[1].data){
- let data = JSON.parse(res[1].data.data)
- uni.requestPayment({
- timeStamp: data.timeStamp,
- nonceStr: data.nonceStr,
- package: data.package,
- signType: data.signType,
- paySign: data.paySign,
- success: function (res) {
- //console.log('success:' + JSON.stringify(res));
- uni.redirectTo({
- url: `../over/index`
- });
- },
- fail: function (err) {
- //console.log('fail:' + JSON.stringify(err));
-
- }
- });
- }
- }
-
- }).catch(err =>{
- })
- }else{
- Toast("该用户未暂未录入充值系统...")
- }
- })
- }else{
- Toast("请使用'中国东信'APP途径进行充值")
- // requestPost("dxtop/order/callUnifiedPay",
- // {
- // "money": _this.data.money,
- // "topPayType": "W06",
- // "payType": "2",
- // "channelName":"小程序游客充值",
- // "scene":2,
- // "openId":_this.data.openid,
- // }
- // ).then(res => {
-
- // if(res[1].data.code == 500){
- // Toast(res[1].data.msg)
- // }else{
- // if(res[1].data){
- // let data = JSON.parse(res[1].data.data)
- // uni.requestPayment({
- // timeStamp: data.timeStamp,
- // nonceStr: data.nonceStr,
- // package: data.package,
- // signType: data.signType,
- // paySign: data.paySign,
- // success: function (res) {
- // console.log('success:' + JSON.stringify(res));
- // uni.redirectTo({
- // url: `../over/index?type=游客`
- // });
- // },
- // fail: function (err) {
- // console.log('fail:' + JSON.stringify(err));
- // }
- // });
- // }
- // }
-
-
- // })
- }
-
-
-
-
-
-
-
-
-
-
- // else if(this.data.channelId){//"后台扫码充值"
- // console.log("后台扫码充值",this.data.channelId)
- // requestPost("dxtop/order/callUnifiedPay",
- // {
- // "money": this.data.money,
- // "topPayType": "W06",
- // "payType": "2",
- // "channelId":this.data.channelId,
- // "userId":'',
- // "scene":2,
- // "openId":this.data.openid,
- // }
- // ).then(res => {
- // console.log(res,121212)
- // if(res[1].data){
- // let data = JSON.parse(res[1].data.msg)
- // uni.requestPayment({
- // timeStamp: data.timeStamp,
- // nonceStr: data.nonceStr,
- // package: data.package,
- // signType: data.signType,
- // paySign: data.paySign,
- // success: function (res) {
- // console.log('success:' + JSON.stringify(res));
- // },
- // fail: function (err) {
- // // Toast({
- // // message:JSON.stringify(err),
- // // overlay:true,
- // // });
- // console.log('fail:' + JSON.stringify(err));
- // }
- // });
- // }
-
- // })
- // }else{//历史记录充值
- // // Toast("小程序历史记录进入充值暂未开放...")
- // // return false
- // console.log("历史记录充值")
- // requestPost("dxtop/order/callUnifiedPay",
- // {
- // "money": this.data.money,
- // "topPayType": "W06",
- // "payType": "2",
- // "channelId":56,
- // "userId":'',
- // "scene":2,
- // "openId":this.data.openid,
- // }
- // ).then(res => {
- // if(res[1].data){
- // let data = JSON.parse(res[1].data.msg)
- // uni.requestPayment({
- // timeStamp: data.timeStamp,
- // nonceStr: data.nonceStr,
- // package: data.package,
- // signType: data.signType,
- // paySign: data.paySign,
- // success: function (res) {
- // console.log('success:' + JSON.stringify(res));
- // },
- // fail: function (err) {
- // // Toast({
- // // message:JSON.stringify(err),
- // // overlay:true,
- // // });
- // console.log('fail:' + JSON.stringify(err));
- // }
- // });
- // }
-
- // })
- // }
-
-
-
- }else{
- //console.log("去授权页",JSON.stringify(_this.data))
- uni.redirectTo({
- url: `../login/index?params=${JSON.stringify(this.data)}`
- });
- }
-
- }
-
- },
- onShow(options){
- }
- }
- </script>
- <style lang="scss" scoped>
- .mianBox{
- height: 100%;
- width: 100%;
- color: #000;
- box-sizing: border-box;
- background-color: #F2F6FC;
- position: fixed;
- .contentBox{
- width: 100%;
- height: auto;
- padding: 15px 20px;
- box-sizing: border-box;
- overflow: hidden;
- .logo{
- /deep/ .van-image{
- margin:0 auto;
- display: block;
- }
- }
- .introduce{
- text-align: center;
- color: #000;
- display: block;
- /deep/ .van-col{
- font-size: 20;
- margin-top:20px;
- letter-spacing: 2px;
- }
- }
- .money{
- text-align: center;
- color: #000;
- /deep/ .van-col{
- font-size: 30px;
- margin-top: 10px;
- font-weight: 700;
- }
- }
- .order_money{
- text-align: center;
- color: #ccc;
- display: block;
- /deep/ .van-col{
- font-size: 20;
- margin-top:10px;
- letter-spacing: 2px;
- }
- }
- /deep/ .van-button{
- border-radius: 6px;
- width: 100% !important;
- margin-top:25px;
- letter-spacing: 2px;
- font-size: 18px;
- height: 50px;
- }
- .order_wrap{
- width:95%;
- padding:10px 20px 20px 20px;
- box-sizing: border-box;
- width:95%;
- margin:20px 2.5%;
- background-color: #fff;
- border-radius: 6px;
- box-shadow: 0 2px 12px 0 #ccc;
- display: block;
- /deep/ .van-col{
- font-size: 16px;
- color:#ccc;
- margin-top:10px;
- display: block;
- }
- /deep/ .left{
- text-align: left;
- }
- /deep/ .right{
- text-align: right;
- }
- }
- .pay_wrap{
- width:95%;
- margin:70px 2.5% 0;
- .pay{
- height: 50px;
- font-size: 18px;
- border-radius: 10px;
- margin-top:40px;
- }
- }
-
- }
- }
- .pay{
- background:#F22E3C;
- color:#fff;
- }
- </style>
|