|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422 |
-
-
- <template>
- <div class="pay-result-container">
- <div class="check-container" v-show="pageShow">
- <van-nav-bar title="支付结果" :left-arrow="false" :border="true" ></van-nav-bar>
-
- <div class="header pos-center">
- <img src="../../assets/img/ssjl.jpg" alt />
- <p>随手精灵</p>
- </div>
-
- <div class="details">
- <div class="details-item">
- <p class="left-text">订单状态</p>
- <p v-if="payStatus">支付成功</p>
- <p v-else class="error">查询失败</p>
- </div>
- <div class="details-item">
- <p class="left-text">订单尾号</p>
- <p>{{outTradeNo}}</p>
- </div>
- <div class="details-item price">
- <p class="left-text">支付总额</p>
- <p>¥ {{price}}元</p>
- </div>
- </div>
-
- <div class="footer pos-center">
-
-
-
-
- <div class="back-btn" @click="onBackHome">
- <p>第{{isAliPay ? '三' : '二'}}步:去使用功能</p>
- </div>
- </div>
- </div>
-
-
- </div>
- </template>
-
- <script>
- import { isNotNull} from "@/utils/index";
- import { APIPay } from "@/api/pay";
- import APIWx from "@/api/wx";
- import axios from "axios";
- export default {
- name: "payResult",
- data() {
- return {
- pageShow: false,
- count: 0,
- timer: "",
- payStatus: null,
- price: this.$route.query.price,
- outTradeNo: this.$route.query.outTradeNo,
- isIos: null,
- };
- },
- created() {
- this.checkParams();
- this.closeTime();
- },
- computed: {
- isAliPay() {
- return this.$route.query.alipayForm
- }
- },
- mounted() {
-
-
- },
- methods: {
-
- checkIosOrAndroid() {
- let userAgent = navigator.userAgent;
- if (userAgent.indexOf("iPhone") > -1) {
- this.isIos = true;
- }
- },
- onNavBack() {
- this.$router.replace({
- name: "packageList",
- query: {
- serialNo: this.$route.query.serialNo,
- isAdmin: this.$route.query.isAdmin,
- iccid: this.$route.query.iccid,
- routerName: this.$route.query.routerName,
- }
- });
- },
-
- onNext() {
- console.log("激活", );
-
-
- this.$router.replace({
- name: 'activeStatus',
- query: {
- serialNo: this.$route.query.serialNo,
- iccid: this.$route.query.iccid,
- issue: Number(this.$route.query.issue) || 0
- }
- })
- },
-
- effective() {
- this.$toast.loading('激活中,请稍候...');
- let reqBody = {
- imei: this.$route.query.serialNo,
- iccid: this.$route.query.iccid || '',
- issue: Number(this.$route.query.issue) || 0
- };
- APIWx.Effective(reqBody)
- .then(res => {
- console.log("res", res);
- let data = res.data;
- console.log("data", data);
- this.$toast.clear();
- if(data.stateCode !== 1) {
- this.$dialog.confirm({
- title: '温馨提示',
- message: `${data.message}`,
- showCancelButton: false
- })
- } else if(data.stateCode === 0 && data.message !== null) {
- this.$dialog.confirm({
- title: '温馨提示',
- message: `电话卡激活失败!请进行实名认证与绑定SIM卡。如您已实名认证,请5分钟后,再进行设备绑定。`,
- showCancelButton: false
- })
- } else if (data.stateCode === 1 && data.message !== 'ok') {
- this.$dialog.confirm({
- title: "SIM卡激活成功",
- message: '卡激活成功,5分钟后则可正常使用。',
- showCancelButton: false,
- confirmButtonText: '返回首页'}).then(() => {
- document.location.replace(" https://xrpt.jiankangtongxue.cn/WCUParentWebUI.WX/Home/")
- });
- } else if (data.stateCode === 1 && data.message === 'ok') {
- this.$dialog.confirm({
- title: "SIM卡激活成功",
- message: '卡激活成功,5分钟后则可正常使用。',
- showCancelButton: false,
- confirmButtonText: '返回首页'
- }).then(() => {
- document.location.replace(" https://xrpt.jiankangtongxue.cn/WCUParentWebUI.WX/Home/")
- });
- }
- })
- .catch(error => {
- console.log("出错了:;", error);
- this.$dialog.confirm({
- title: '温馨提示',
- message: `${error.message}`,
- showCancelButton: false
- })
- }).finally(() => {
- this.$toast.clear();
- })
- },
-
- onFlush() {
- this.isIos = false;
- this.checkParams();
- },
-
- checkParams() {
- let params = this.$route.query;
- let isFromWx = this.$store.getters.isFromWx;
- if (params.rechargeUrl && isFromWx === true) {
-
- console.log("支付宝");
- this.$toast.loading({
- message: "跳转中",
- });
- setTimeout(() => {
- this.$store.commit("isFromWx", "");
- let alipayForm = encodeURIComponent(params.alipayForm);
- let url =
- process.env.NODE_ENV === "production"
- ? `https://ai.ssjlai.com/frontend/#/alipay?goodsNo=${params.productId}&userId=${params.alipayUserId}&isWx=true&alipayForm=${alipayForm}`
- : `https://id.ssjlai.com/frontend/#/alipay?goodsNo=${params.productId}&userId=${params.alipayUserId}&isWx=true&alipayForm=${alipayForm}`;
- window.location.href = url;
- }, 1500);
- } else if (params.rechargeUrl && isFromWx === null) {
-
- let that = this;
- console.log("支付宝结果");
- this.$toast.loading({
- message: "支付结果查询中"
- });
- let reqBody = {
- outTradeNo: params.outTradeNo
- };
- let url =
- process.env.NODE_ENV === "production"
- ? "https://ai.ssjlai.com/telpopay/alipay/order/detail/callback"
- : "https://id.ssjlai.com/telpopay/alipay/order/detail/callback";
- if (that.count >= 30) {
- if (that.timer) {
- clearInterval(that.timer);
- this.payStatus = false;
- this.pageShow = true;
- this.$toast.clear();
- console.log("关闭轮询1");
- }
- }
- that.timer = setInterval(() => {
- that.count++;
- APIPay.getWxPayResult(reqBody)
- .then(res => {
- if (res.data.code === 20000) {
- this.pageShow = true;
- this.payStatus = true;
- this.$toast.clear();
- console.log("关闭轮询2");
- if (that.timer) {
- clearInterval(that.timer);
- }
- }
- })
- .catch(e => {
- console.log(e);
- });
- }, 2000);
- } else {
-
- let that = this;
- console.log("微信");
- this.$toast.loading({message: "支付结果查询中"});
- let reqBody = {
- outTradeNo: params.outTradeNo
- };
- let url =
- process.env.NODE_ENV === "production"
- ? " https://ai.ssjlai.com/telpopay/api/wx/order/callback"
- : "https://id.ssjlai.com/telpopay/api/wx/order/callback";
- if (that.count >= 30) {
- if (that.timer) {
- clearInterval(that.timer);
- this.payStatus = false;
- this.pageShow = true;
- this.$toast.clear();
- console.log("关闭轮询3");
- }
- }
- that.timer = setInterval(() => {
- that.count++;
- APIPay.getWxPayResult(reqBody)
- .then(res => {
- if (res.data.code === 20000) {
- this.pageShow = true;
- this.payStatus = true;
- this.$toast.clear();
- console.log("关闭轮询4");
- if (that.timer) {
- clearInterval(that.timer);
- }
- }
- })
- .catch(e => {
- console.log(e);
- });
- }, 2000);
- }
- },
-
- getWxPayResult() {
- this.$toast.loading({
- message: "正在获取支付结果",
- duration: 3000
- });
- setTimeout(() => {
- this.pageShow = true;
- }, 3000);
- },
- closeTime() {
- let params = this.$route.query;
- let isFromWx = this.$store.getters.isFromWx;
- setTimeout(() => {
- clearInterval(this.timer);
- console.log("即将关闭轮询");
- this.$toast.clear();
- if (this.pageShow === false) {
- this.pageShow = true;
- }
- }, 31000);
- },
- onBackHome() {
-
- document.location.replace("https://xrpt.jiankangtongxue.cn/WCUParentWebUI.WX/Home/SmartDigitalSsjl");
-
- }
- }
- };
- </script>
-
- <style scoped lang="scss">
- .pay-result-container {
- height: 100vh;
- width: 100%;
- display: flex;
- justify-content: flex-start;
- align-items: center;
- flex-direction: column;
- background-color: white;
- overflow: scroll;
- .check-container {
- width: 100%;
- }
- .pos-center {
- display: flex;
- justify-content: flex-start;
- align-items: center;
- flex-direction: column;
- }
- .header {
- width: 100%;
- padding: 10px 0;
- img {
- height: 60px;
- width: 60px;
- margin: 10px 0;
- border-radius: 50%;
- }
- p {
- font-size: 18px;
- }
- }
- .details {
- padding: 20px 0;
- width: 100%;
- p {
- font-size: 16px;
- }
- .details-item {
- width: 80%;
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-left: 10%;
- padding: 10px 0;
- .left-text {
- color: gray;
- }
- .error {
- color: red;
- font-size: 24px;
- }
- }
- .price {
- padding: 20px 0;
- border-bottom: 5px solid $background;
- .left-text {
- color: gray;
- }
- }
- .details-item:nth-child(2) {
- border-bottom: 5px solid $background;
- }
- }
- .footer {
- height: 75px;
- .back-btn {
- height: 45px;
- width: 275px;
- display: flex;
- justify-content: center;
- align-items: center;
- background: $blue;
- border: 1px solid $blue;
- border-radius: 25px;
- p {
- font-size: 18px;
- padding: 0;
- color: white;
- }
- }
- }
- }
- .flush {
- height: calc(100vh - 2.3784rem);
- display: flex;
- justify-content: center;
- align-items: center;
- .back-btn {
- height: 45px;
- width: 275px;
- display: flex;
- justify-content: center;
- align-items: center;
- background: $blue;
- border: 1px solid $blue;
- border-radius: 25px;
- p {
- font-size: 18px;
- padding: 0;
- color: white;
- }
- }
- }
- </style>
|