123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- <template>
- <div class="checkBox">
- <div class="check-tip">
- <div class="check-content">
- <h3 class="b-text2" >支付订单</h3>
- <img :src="`${$cdn}images/weixin-pay.png`" alt />
- <div class="check-detail">
- <p>
- <span >1. 如果已完成支付,请点击</span>
- <strong >完成支付</strong>
- </p>
- <p>
- <span >2. 如果未打开微信客户端或未完成支付,请点击</span>
- <strong>稍后支付</strong>
- <span>返回我的订单页</span>
- </p>
- </div>
- </div>
- <div class="check-footer">
- <div class="btn" @click="backto">稍后支付</div>
- <div class="btn" @click="queryOrderStatus">完成支付</div>
- </div>
- </div>
- </div>
- </template>
- <script>
- import { mapState } from 'vuex'
- export default {
- computed: {
- ...mapState({
- token: state => state.user.token,
- orderinfo: state => {
- let type = Object.prototype.toString.call(state.user.orderinfo)
- if (type === '[object Object]') {
- return state.user.orderinfo
- }
- let condition = state.user.orderinfo && state.user.orderinfo !== 'null' && type !== '[object Array]'
- return condition ? JSON.parse(state.user.orderinfo) : {}
- }
- })
- },
- methods: {
- backto () {
- let to = this.orderinfo.orderType === 0 ? {
- path: '/order'
- } : {
- name: 'device',
- params: {
- id: 4
- }
- }
- this.$router.replace(to)
- },
- async queryOrderStatus () {
- let {orderSn, orderType} = this.orderinfo
- if (!orderSn) {
- return this.$toast.show('error', '获取订单信息失败')
- }
- let params = {
- orderSn,
- orderType,
- payType: 0
- }
- let res = await this.$http
- .post('/user/order/queryOrderStatus', params, {
- headers: {
- token: this.token
- }
- })
- let response = res.data
- if (response.code !== 0) {
- return this.$toast.show('warn', '查询交易失败,请稍后再试')
- }
- response.data ? this.$router.replace({
- name: 'payresult',
- params: {
- isSuccess: 'success'
- }
- }) : this.$router.replace({
- name: 'payresult',
- params: {
- isSuccess: 'fail'
- }
- })
- }
- },
- mounted () {
- }
- }
- </script>
- <style lang="scss" scoped>
- .checkBox{
- width: 100%;
- margin: 10% 0;
- .check-tip{
- text-align: center;
- .check-content{
- img{
- width: 15%;
- margin: 8% auto;
- }
- }
- .check-detail{
- border-top: 1px solid #ddd;
- padding-top: 8%;
- margin:0 5%;
- text-align: left;
- p{
- margin-bottom: 20px;
- line-height: 1.5;
- span{
- color: #999;
- }
- strong{
- font-weight: normal;
- }
- }
- }
- .check-footer{
- margin:0 5%;
- .btn {
- width: 100%;
- background: white;
- border-radius: 3px;
- height: 45px;
- line-height: 45px;
- border: 1px solid #ccc;
- margin-bottom: 5%;
- &:last-child{
- border: 1px solid #333;
- }
- }
- }
- }
- }
- </style>
|