|
@@ -0,0 +1,392 @@
|
|
|
+<template>
|
|
|
+ <!-- 支付 -->
|
|
|
+ <div v-if="data" v-loading="loading" class="Nopyment">
|
|
|
+ <div class="message">
|
|
|
+ <div :class="['coverUrl', data.goods_type !== 401 ? 'coverUrl-border' : '']">
|
|
|
+ <template v-if="data.goods_type !== 401">
|
|
|
+ <img :src="data.goods_picture_url" />
|
|
|
+ </template>
|
|
|
+ </div>
|
|
|
+ <div class="text">
|
|
|
+ <p class="p1">
|
|
|
+ {{ data.goods_name }}
|
|
|
+ </p>
|
|
|
+ <p class="p2">
|
|
|
+ <span>{{ $t('Key44') }}</span>
|
|
|
+ </p>
|
|
|
+ <p class="p3">{{ data.goods_person_name_desc }}</p>
|
|
|
+ </div>
|
|
|
+ <div class="price">
|
|
|
+ <p v-if="data.hasOwnProperty('price')">¥<span v-html="changePrice(data.price, 16)"></span></p>
|
|
|
+ <p v-if="data.hasOwnProperty('goods_price')">¥<span v-html="changePrice(data.goods_price, 16)"></span></p>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="pay-platform">
|
|
|
+ <!-- 选择支付平台 -->
|
|
|
+ <p class="pay-platform-title">{{ $t('Key473') }}</p>
|
|
|
+ <ul class="pay-platform-list">
|
|
|
+ <li v-for="(item, index) in platList" :key="'plat' + index" :class="item.isSelected ? 'active' : ''">
|
|
|
+ <img :src="item.img" class="plat-logo" />
|
|
|
+ <img src="../../assets/pay/active.png" class="active-icon" />
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+ </div>
|
|
|
+ <div class="total">
|
|
|
+ <p class="p1">
|
|
|
+ <!-- 一件商品,总金额 -->
|
|
|
+ <span> {{ $t('Key53') }}: </span>
|
|
|
+ <span v-if="data.hasOwnProperty('price')" class="co-value">
|
|
|
+ ¥<span v-html="changePrice(data.price, 16)"></span>
|
|
|
+ </span>
|
|
|
+ <span v-if="data.hasOwnProperty('goods_price')" class="co-value">
|
|
|
+ ¥<span v-html="changePrice(data.goods_price, 16)"></span>
|
|
|
+ </span>
|
|
|
+ </p>
|
|
|
+ <p class="p2">
|
|
|
+ <!-- 优惠折扣 -->
|
|
|
+ <span> {{ $t('Key54') }}: </span>
|
|
|
+ <span class="co-value">-¥<span v-html="changePrice(data.discount_money, 16)"></span></span>
|
|
|
+ </p>
|
|
|
+ <p class="p4">
|
|
|
+ <span></span>
|
|
|
+ <!-- 优惠码 未使用优惠码-->
|
|
|
+ <span class="no-code">{{ data.discount_code ? $t('Key232') + ':' + data.discount_code : $t('Key108') }}</span>
|
|
|
+ </p>
|
|
|
+ <p class="p3">
|
|
|
+ <!-- 应付: -->
|
|
|
+ <span> {{ $t('Key55') }}: </span>
|
|
|
+ <span class="co-value">¥<span v-html="changePrice(data.receivables_money, 24)"></span></span>
|
|
|
+ </p>
|
|
|
+ </div>
|
|
|
+ <div class="submitBtn">
|
|
|
+ <!-- 去支付 -->
|
|
|
+ <button @click="buy">{{ $t('Key474') }}</button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { PayMyOrder, GetMyOrder } from '@/api/course';
|
|
|
+
|
|
|
+export default {
|
|
|
+ props: {
|
|
|
+ orderId: {
|
|
|
+ type: String,
|
|
|
+ default: ''
|
|
|
+ }
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ // 这里存放数据
|
|
|
+ return {
|
|
|
+ data: {},
|
|
|
+ loading: false,
|
|
|
+ platList: [
|
|
|
+ {
|
|
|
+ img: require('../../assets/pay/shouxinyi.png'),
|
|
|
+ isSelected: true
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ };
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ orderId(newVal) {
|
|
|
+ if (!newVal) return;
|
|
|
+ GetMyOrder({ id: newVal }).then(res => {
|
|
|
+ this.data = res;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ GetMyOrder({ id: this.orderId }).then(res => {
|
|
|
+ this.data = res;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ // 购买
|
|
|
+ buy() {
|
|
|
+ this.loading = true;
|
|
|
+ // 首先添加订单
|
|
|
+ PayMyOrder({
|
|
|
+ id: this.orderId,
|
|
|
+ pay_money: this.data.receivables_money, // 实际入账金额,由易支付成功返回
|
|
|
+ bank_transaction_sn: '' // 银行交易流水号,由易支付成功返回
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ this.loading = false;
|
|
|
+ this.$emit('judgePayResult', true);
|
|
|
+ // 调取支付接口
|
|
|
+ if (res.pay_page_url) {
|
|
|
+ window.location.href = res.pay_page_url;
|
|
|
+ } else {
|
|
|
+ this.$router.push('/OrderPaySuccess');
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ changePrice(price, fontSize1, fontSize2) {
|
|
|
+ let prices = price || 0;
|
|
|
+ prices = prices.toFixed(2);
|
|
|
+ prices = prices.toString();
|
|
|
+ const arr = prices.split('.');
|
|
|
+ const str = `<span style="font-size: ${fontSize1 || 16}px;">${arr[0]}</span>.<span style="font-size: ${
|
|
|
+ fontSize2 || 16
|
|
|
+ }px;">${arr[1]}</span>`;
|
|
|
+
|
|
|
+ return str;
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.Nopyment {
|
|
|
+ .pay-platform {
|
|
|
+ box-sizing: border-box;
|
|
|
+ width: 656px;
|
|
|
+ padding: 16px 0;
|
|
|
+ border-top: 1px rgba(44, 44, 44, 15%) solid;
|
|
|
+ border-bottom: 1px rgba(44, 44, 44, 15%) solid;
|
|
|
+
|
|
|
+ &-title {
|
|
|
+ padding: 0;
|
|
|
+ margin: 0;
|
|
|
+ margin-bottom: 16px;
|
|
|
+ font-size: 16px;
|
|
|
+ font-style: normal;
|
|
|
+ font-weight: normal;
|
|
|
+ line-height: 150%;
|
|
|
+ color: #000;
|
|
|
+ }
|
|
|
+
|
|
|
+ &-list {
|
|
|
+ display: flex;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ padding: 0;
|
|
|
+ margin: 0;
|
|
|
+
|
|
|
+ > li {
|
|
|
+ position: relative;
|
|
|
+ box-sizing: border-box;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ width: 152px;
|
|
|
+ height: 60px;
|
|
|
+ margin: 0 8px 8px 0;
|
|
|
+ cursor: pointer;
|
|
|
+ background: #fff;
|
|
|
+ border: 1px solid rgba(44, 44, 44, 15%);
|
|
|
+ border-radius: 4px;
|
|
|
+
|
|
|
+ > .plat-logo {
|
|
|
+ width: 99px;
|
|
|
+ height: 26px;
|
|
|
+ }
|
|
|
+
|
|
|
+ > .active-icon {
|
|
|
+ position: absolute;
|
|
|
+ right: -1px;
|
|
|
+ bottom: -1px;
|
|
|
+ display: block;
|
|
|
+ width: 20px;
|
|
|
+ height: 20px;
|
|
|
+ }
|
|
|
+
|
|
|
+ &.active {
|
|
|
+ border-color: #f90;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .message {
|
|
|
+ display: flex;
|
|
|
+ width: 656px;
|
|
|
+ height: 152px;
|
|
|
+ margin-bottom: 24px;
|
|
|
+ background: rgba(70, 70, 70, 3%);
|
|
|
+ border-radius: 8px;
|
|
|
+
|
|
|
+ .coverUrl {
|
|
|
+ box-sizing: border-box;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ width: 120px;
|
|
|
+ height: 120px;
|
|
|
+ margin-top: 16px;
|
|
|
+ margin-left: 16px;
|
|
|
+
|
|
|
+ &-border {
|
|
|
+ border: 1px rgba(0, 0, 0, 15%) solid;
|
|
|
+ }
|
|
|
+
|
|
|
+ > img {
|
|
|
+ max-width: 100%;
|
|
|
+ max-height: 100%;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .text {
|
|
|
+ margin-left: 24px;
|
|
|
+
|
|
|
+ .p1 {
|
|
|
+ display: -webkit-box;
|
|
|
+ width: 360px;
|
|
|
+ margin-top: 22px;
|
|
|
+ overflow: hidden;
|
|
|
+
|
|
|
+ // height: 45px;
|
|
|
+ font-size: 16px;
|
|
|
+ line-height: 20px;
|
|
|
+ color: #2c2c2c;
|
|
|
+ text-overflow: ellipsis;
|
|
|
+ word-break: break-all;
|
|
|
+ -webkit-box-orient: vertical;
|
|
|
+ -webkit-line-clamp: 2;
|
|
|
+ }
|
|
|
+
|
|
|
+ .p2 {
|
|
|
+ margin-top: 10px;
|
|
|
+
|
|
|
+ span {
|
|
|
+ width: 64px;
|
|
|
+ height: 24px;
|
|
|
+ padding: 2px 8px;
|
|
|
+ font-size: 12px;
|
|
|
+ font-weight: bold;
|
|
|
+ line-height: 24px;
|
|
|
+ color: #f90;
|
|
|
+ text-align: center;
|
|
|
+ background: #ffefd8;
|
|
|
+ border-radius: 4px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .p3 {
|
|
|
+ margin-top: 10px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .price {
|
|
|
+ box-sizing: border-box;
|
|
|
+ width: 110px;
|
|
|
+ padding-right: 16px;
|
|
|
+
|
|
|
+ p {
|
|
|
+ width: 100%;
|
|
|
+ margin-top: 22px;
|
|
|
+ font-size: 16px;
|
|
|
+ font-weight: bold;
|
|
|
+ color: #ff4c00;
|
|
|
+ text-align: right;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .promotionCode {
|
|
|
+ display: flex;
|
|
|
+ align-self: center;
|
|
|
+ justify-content: flex-start;
|
|
|
+ width: 100%;
|
|
|
+ height: 58px;
|
|
|
+ margin-top: 24px;
|
|
|
+ line-height: 56px;
|
|
|
+ border-top: 1px solid rgba(44, 44, 44, 15%);
|
|
|
+ border-bottom: 1px solid rgba(44, 44, 44, 15%);
|
|
|
+
|
|
|
+ .sp1 {
|
|
|
+ font-size: 16px;
|
|
|
+ color: #000;
|
|
|
+ }
|
|
|
+
|
|
|
+ input {
|
|
|
+ box-sizing: border-box;
|
|
|
+ flex: 1;
|
|
|
+ height: 55px;
|
|
|
+ padding: 0;
|
|
|
+ padding: 0 24px;
|
|
|
+ border: none;
|
|
|
+ outline: none;
|
|
|
+ }
|
|
|
+
|
|
|
+ .sp2 {
|
|
|
+ font-size: 16px;
|
|
|
+ color: #f90;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .total {
|
|
|
+ width: 656px;
|
|
|
+ padding-top: 24px;
|
|
|
+ font-size: 16px;
|
|
|
+ color: #000;
|
|
|
+ text-align: right;
|
|
|
+
|
|
|
+ > p {
|
|
|
+ > span {
|
|
|
+ display: inline-block;
|
|
|
+ }
|
|
|
+
|
|
|
+ .co-value {
|
|
|
+ width: 160px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .p1 {
|
|
|
+ > span {
|
|
|
+ display: inline-block;
|
|
|
+ line-height: 24px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .p2 {
|
|
|
+ margin: 16px 0 8px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .p3 {
|
|
|
+ > span {
|
|
|
+ line-height: 36px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .co-value {
|
|
|
+ font-size: 24px;
|
|
|
+ color: #ff4c00;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .p4 {
|
|
|
+ margin-bottom: 16px;
|
|
|
+
|
|
|
+ .no-code {
|
|
|
+ font-size: 12px;
|
|
|
+ font-weight: normal;
|
|
|
+ line-height: 150%;
|
|
|
+ color: rgba(0, 0, 0, 50%);
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .submitBtn {
|
|
|
+ margin-top: 16px;
|
|
|
+ text-align: right;
|
|
|
+
|
|
|
+ button {
|
|
|
+ width: 120px;
|
|
|
+ height: 40px;
|
|
|
+ line-height: 40px;
|
|
|
+ color: white;
|
|
|
+ text-align: center;
|
|
|
+ cursor: pointer;
|
|
|
+ background: #ff4d00;
|
|
|
+ border: none;
|
|
|
+ border-radius: 4px;
|
|
|
+ outline: none;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|