新增微信支付、Native支付

This commit is contained in:
gxwebsoft
2024-05-11 23:06:25 +08:00
parent 31d6517314
commit ec629c4540
18 changed files with 1121 additions and 63 deletions

View File

@@ -8,13 +8,29 @@
@search="search"
@pressEnter="search"
/>
<a-button @click="getCode">生成支付二维码</a-button>
</a-space>
<ele-modal
:width="500"
:visible="showQrcode"
:maskClosable="false"
title="使用微信扫一扫完成支付"
:body-style="{ paddingBottom: '28px' }"
@cancel="closeQrcode"
@ok="closeQrcode"
>
<div class="qrcode">
<ele-qr-code-svg v-if="text" :value="text" :size="200" />
<div class="ele-text-secondary">使用微信扫一扫完成支付</div>
</div>
</ele-modal>
</template>
<script lang="ts" setup>
import { watch } from 'vue';
import { ref, watch } from 'vue';
import useSearch from '@/utils/use-search';
import { OrderParam } from '@/api/shop/order/model';
import { getNativeCode } from '@/api/system/payment';
const props = withDefaults(
defineProps<{
@@ -41,8 +57,33 @@
emit('search', where);
};
// 二维码内容
const text = ref('');
const showQrcode = ref(false);
const closeQrcode = () => {
showQrcode.value = !showQrcode.value;
};
const getCode = () => {
getNativeCode({}).then((data) => {
text.value = String(data);
showQrcode.value = true;
});
};
watch(
() => props.selection,
() => {}
);
</script>
<style lang="less" scoped>
.qrcode {
display: flex;
justify-content: center;
flex-direction: column;
align-items: center;
padding: 40px 0;
}
</style>