Showing
3 changed files
with
64 additions
and
60 deletions
| ... | @@ -2,7 +2,7 @@ | ... | @@ -2,7 +2,7 @@ |
| 2 | * @Author: hookehuyr hookehuyr@gmail.com | 2 | * @Author: hookehuyr hookehuyr@gmail.com |
| 3 | * @Date: 2022-06-01 16:00:48 | 3 | * @Date: 2022-06-01 16:00:48 |
| 4 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 4 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 5 | - * @LastEditTime: 2022-06-07 16:37:07 | 5 | + * @LastEditTime: 2022-06-09 21:55:06 |
| 6 | * @FilePath: /tswj/src/api/C/donate.js | 6 | * @FilePath: /tswj/src/api/C/donate.js |
| 7 | * @Description: 捐钱操作API | 7 | * @Description: 捐钱操作API |
| 8 | */ | 8 | */ |
| ... | @@ -11,6 +11,7 @@ import { fn, fetch } from '@/api/fn'; | ... | @@ -11,6 +11,7 @@ import { fn, fetch } from '@/api/fn'; |
| 11 | const Api = { | 11 | const Api = { |
| 12 | PREPARE_DONATE: '/srv/?a=prepare_donate', | 12 | PREPARE_DONATE: '/srv/?a=prepare_donate', |
| 13 | ADD_DONATE: '/srv/?a=add_donate', | 13 | ADD_DONATE: '/srv/?a=add_donate', |
| 14 | + ONE_CERT: '/srv/?a=one_cert', | ||
| 14 | } | 15 | } |
| 15 | 16 | ||
| 16 | /** | 17 | /** |
| ... | @@ -31,3 +32,10 @@ export const prepareDonateAPI = (params) => fn(fetch.post(Api.PREPARE_DONATE, pa | ... | @@ -31,3 +32,10 @@ export const prepareDonateAPI = (params) => fn(fetch.post(Api.PREPARE_DONATE, pa |
| 31 | * @returns | 32 | * @returns |
| 32 | */ | 33 | */ |
| 33 | export const addDonateAPI = (params) => fn(fetch.post(Api.ADD_DONATE, params)); | 34 | export const addDonateAPI = (params) => fn(fetch.post(Api.ADD_DONATE, params)); |
| 35 | + | ||
| 36 | +/** | ||
| 37 | + * @description: 捐赠证书 | ||
| 38 | + * @param {String} donate_id 捐赠ID | ||
| 39 | + * @returns | ||
| 40 | + */ | ||
| 41 | +export const oneCertAPI = (params) => fn(fetch.get(Api.ONE_CERT, params)); | ... | ... |
| ... | @@ -2,7 +2,7 @@ | ... | @@ -2,7 +2,7 @@ |
| 2 | * @Author: hookehuyr hookehuyr@gmail.com | 2 | * @Author: hookehuyr hookehuyr@gmail.com |
| 3 | * @Date: 2022-04-27 10:23:05 | 3 | * @Date: 2022-04-27 10:23:05 |
| 4 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 4 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 5 | - * @LastEditTime: 2022-06-09 01:38:37 | 5 | + * @LastEditTime: 2022-06-09 22:00:41 |
| 6 | * @FilePath: /tswj/src/views/client/donateCertificate.vue | 6 | * @FilePath: /tswj/src/views/client/donateCertificate.vue |
| 7 | * @Description: 捐赠成功后显示证书页面 | 7 | * @Description: 捐赠成功后显示证书页面 |
| 8 | --> | 8 | --> |
| ... | @@ -17,39 +17,23 @@ | ... | @@ -17,39 +17,23 @@ |
| 17 | import DonateCert from '@/components/DonateCert/index' | 17 | import DonateCert from '@/components/DonateCert/index' |
| 18 | import ShortcutFixed from '@/components/ShortcutFixed/index' | 18 | import ShortcutFixed from '@/components/ShortcutFixed/index' |
| 19 | import { USER_ROLE } from '@/constant' | 19 | import { USER_ROLE } from '@/constant' |
| 20 | -import { ref } from 'vue' | 20 | +import { onMounted, ref } from 'vue' |
| 21 | import { useRoute } from 'vue-router' | 21 | import { useRoute } from 'vue-router' |
| 22 | -import axios from '@/utils/axios'; | 22 | +import { oneCertAPI } from '@/api/C/donate' |
| 23 | -import { Toast } from 'vant'; | ||
| 24 | 23 | ||
| 25 | const $route = useRoute(); | 24 | const $route = useRoute(); |
| 26 | 25 | ||
| 27 | -const certItem = ref('') | ||
| 28 | // 捐款成功后,查询生成捐赠证书 | 26 | // 捐款成功后,查询生成捐赠证书 |
| 29 | -axios.get('/srv/?a=one_cert', { | 27 | +const certItem = ref('') |
| 30 | - params: { | 28 | +onMounted(async () => { |
| 31 | - donate_id: $route.query.donate_id | 29 | + const { data } = await oneCertAPI({ donate_id: $route.query.donate_id }) |
| 32 | - } | 30 | + certItem.value = data; |
| 33 | -}) | ||
| 34 | -.then(res => { | ||
| 35 | - if (res.data.code === 1) { | ||
| 36 | - certItem.value = res.data.data; | ||
| 37 | - } else { | ||
| 38 | - console.warn(res); | ||
| 39 | - if (!res.data.show) return false; | ||
| 40 | - Toast({ | ||
| 41 | - icon: 'close', | ||
| 42 | - message: res.data.msg | ||
| 43 | - }); | ||
| 44 | - } | ||
| 45 | -}) | ||
| 46 | -.catch(err => { | ||
| 47 | - console.error(err); | ||
| 48 | }) | 31 | }) |
| 49 | </script> | 32 | </script> |
| 50 | 33 | ||
| 51 | <style lang="less" scoped> | 34 | <style lang="less" scoped> |
| 52 | @import url('@css/content-bg.less'); | 35 | @import url('@css/content-bg.less'); |
| 36 | + | ||
| 53 | .donate-certificate-page { | 37 | .donate-certificate-page { |
| 54 | height: 96vh; | 38 | height: 96vh; |
| 55 | padding: 2vh; | 39 | padding: 2vh; | ... | ... |
| 1 | <template> | 1 | <template> |
| 2 | <div class="wechatpay-callback-page"> | 2 | <div class="wechatpay-callback-page"> |
| 3 | - <div style="text-align: center; padding: 20%;"> | 3 | + <div class="pay-success"> |
| 4 | <van-image width="50" height="50" :src="icon_wechatpay" /> | 4 | <van-image width="50" height="50" :src="icon_wechatpay" /> |
| 5 | - <div style="color: #52ab38;;">支付成功</div> | 5 | + <div class="text">支付成功</div> |
| 6 | </div> | 6 | </div> |
| 7 | - <div style="color: #222222; text-align: center;"> | 7 | + <div class="pay-main"> |
| 8 | - <p style="font-size: 1.15rem; margin-bottom: 1rem;">上海市儿童基金会</p> | 8 | + <p class="title">上海市儿童基金会</p> |
| 9 | - <div> | 9 | + <div class="amount"> |
| 10 | - <div style="font-size: 1.5rem; display: inline-block; vertical-align: middle;">¥</div> | 10 | + <p>¥</p> |
| 11 | - <div style="font-size: 2.5rem; display: inline-block; vertical-align: middle;">59.00</div> | 11 | + <p>{{ amount }}</p> |
| 12 | </div> | 12 | </div> |
| 13 | </div> | 13 | </div> |
| 14 | - <div style="padding: 30% 4rem;"> | 14 | + <div class="button-wrapper"> |
| 15 | - <my-button @on-click="getCert" type="primary">查看证书</my-button> | 15 | + <my-button type="primary" @on-click="getCert">查看证书</my-button> |
| 16 | </div> | 16 | </div> |
| 17 | </div> | 17 | </div> |
| 18 | </template> | 18 | </template> |
| 19 | 19 | ||
| 20 | <script setup> | 20 | <script setup> |
| 21 | import MyButton from '@/components/MyButton/index.vue' | 21 | import MyButton from '@/components/MyButton/index.vue' |
| 22 | - | ||
| 23 | import icon_wechatpay from '@images/zhifu@2x.png' | 22 | import icon_wechatpay from '@images/zhifu@2x.png' |
| 24 | - | ||
| 25 | import { ref, reactive, onMounted } from 'vue' | 23 | import { ref, reactive, onMounted } from 'vue' |
| 26 | import { useRoute, useRouter } from 'vue-router' | 24 | import { useRoute, useRouter } from 'vue-router' |
| 27 | import axios from '@/utils/axios'; | 25 | import axios from '@/utils/axios'; |
| ... | @@ -31,40 +29,54 @@ const $route = useRoute(); | ... | @@ -31,40 +29,54 @@ const $route = useRoute(); |
| 31 | const $router = useRouter(); | 29 | const $router = useRouter(); |
| 32 | 30 | ||
| 33 | // TODO: 微信支付成功后回调 | 31 | // TODO: 微信支付成功后回调 |
| 32 | +const amount = ref(50) | ||
| 33 | +onMounted(() => { | ||
| 34 | 34 | ||
| 35 | - onMounted(() => { | 35 | +}) |
| 36 | 36 | ||
| 37 | - }) | 37 | +// TODO: 需要获取 donate_id |
| 38 | +// 跳转到捐赠证书页面,替换掉当前页面,不能返回这个页面 | ||
| 39 | +const getCert = () => { | ||
| 40 | + $router.replace({ | ||
| 41 | + path: '/client/donateCertificate', | ||
| 42 | + query: { | ||
| 43 | + donate_id: $route.query.donate_id | ||
| 44 | + } | ||
| 45 | + }); | ||
| 46 | +} | ||
| 38 | </script> | 47 | </script> |
| 39 | 48 | ||
| 40 | -<script> | 49 | +<style lang="less" scoped> |
| 41 | -import mixin from 'common/mixin'; | 50 | +.wechatpay-callback-page { |
| 51 | + .pay-success { | ||
| 52 | + text-align: center; | ||
| 53 | + padding: 20%; | ||
| 42 | 54 | ||
| 43 | -export default { | 55 | + .text { |
| 44 | - mixins: [mixin.init], | 56 | + color: #52ab38; |
| 45 | - data () { | 57 | + } |
| 46 | - return { | 58 | + } |
| 47 | 59 | ||
| 60 | + .pay-main { | ||
| 61 | + color: #222222; | ||
| 62 | + text-align: center; | ||
| 63 | + | ||
| 64 | + .title { | ||
| 65 | + font-size: 1.15rem; | ||
| 66 | + margin-bottom: 1rem; | ||
| 48 | } | 67 | } |
| 49 | - }, | ||
| 50 | - mounted () { | ||
| 51 | 68 | ||
| 52 | - }, | 69 | + .amount { |
| 53 | - methods: { | 70 | + p { |
| 54 | - getCert () { | 71 | + font-size: 1.5rem; |
| 55 | - // TODO: 需要获取 donate_id | 72 | + display: inline-block; |
| 56 | - // 跳转到捐赠证书页面,替换掉当前页面,不能返回这个页面 | 73 | + vertical-align: middle; |
| 57 | - this.$router.replace({ | ||
| 58 | - path: '/client/donateCertificate', | ||
| 59 | - query: { | ||
| 60 | - donate_id: this.$route.query.donate_id | ||
| 61 | } | 74 | } |
| 62 | - }); | ||
| 63 | } | 75 | } |
| 64 | } | 76 | } |
| 65 | -} | ||
| 66 | -</script> | ||
| 67 | 77 | ||
| 68 | -<style lang="less" scoped> | 78 | + .button-wrapper { |
| 69 | -.wechatpay-callback-page {} | 79 | + padding: 30% 4rem; |
| 80 | + } | ||
| 81 | +} | ||
| 70 | </style> | 82 | </style> | ... | ... |
-
Please register or login to post a comment