123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234 |
- <script setup lang="ts">
- import { onMounted, ref, reactive } from "vue";
- import { userLoginApi, getUserPhoneApi } from "@/services/home";
- import { useMemberStore } from "@/stores/";
- import type { LoginParams, GetPhoneParams } from "@/types/home";
- import { login } from "@/hooks/useIsLogin";
- const useMember = useMemberStore();
- const packagePopup = ref<any>();
- const packageList = reactive<any[]>([
- { name: '单次卡(税务报告)', desc: '税务报告单次获取', price: '980' },
- { name: '4次卡(税务报告)', desc: '税务报告4次卡', price: '2680' },
- { name: '12次卡(税务报告)', desc: '税务报告12次卡', price: '5980' },
- ]);
- const userInfoMsg = reactive<LoginParams>({
- code: "",
- });
- onMounted(() => {
- console.log("登录");
- });
- //获取手机号
- const getPhoneNumber = (e: any) => {
- console.log(e);
- //获取到动态令牌后将动态令牌传输到后台方法
- //同时需要将获取到的openId传输给后台
- const params = {
- openId: useMember.userInfo.openId,
- code: e.detail.code,
- };
- getUserPhone(params);
- };
- const getUserPhone = async (val: GetPhoneParams) => {
- const phoneInfo = await getUserPhoneApi(val);
- useMember.userInfo.phone = phoneInfo.data;
- login().then((res: any) => {
- //这时可以查询是否授权
- if (res.code == "2001") {
- uni.showToast({
- title: '暂无权限',
- icon: "none",
- duration: 2000
- });
- } else {
- uni.showToast({
- title: "登录成功",
- icon: "none",
- success() {
- uni.navigateTo({ url: "/pages/index/inviteUser" });
- }
- });
- }
- });
- close();
- //获取到手机号后
- //将缓存里的手机号替换为最新的
- };
- //拿到code 向后台请求openId session_key
- const open = () => {
- login().then((res: any) => {
- userInfoMsg.code = res.code;
- });
- packagePopup.value.open("center");
- };
- const close = () => {
- packagePopup.value.close();
- };
- const agree = ref<boolean>(false);
- const radioChange = () => {
- agree.value = !agree.value;
- };
- const stipulate = ref<any>();
- const stipulateClose = () => {
- stipulate.value.close();
- };
- const viewDetail = () => {
- stipulateOpen();
- };
- const stipulateOpen = () => {
- stipulate.value.open("bottom");
- };
- defineExpose({
- open,
- });
- </script>
- <template>
- <view>
- <uni-popup ref="packagePopup">
- <view class="payPackage">
- <view class="pay_title">套餐购买</view>
- <view class="package_list">
- <view class="package_item" v-for="item in packageList">
- <view class="item_head">
- </view>
- <view class="item_body">
- <view class="item_name">
- {{ item.name }}
- </view>
- <view class="item_desc">
- {{ item.desc }}
- </view>
- </view>
- <view class="item_price">
- {{ item.price }}
- </view>
- </view>
- </view>
- <view class="pay_way">
- <view class="pay_way_title">
- 付款方式
- </view>
- <view class="way_item">
- <view class="way_icon">
- <image src="" mode="scaleToFill" />
- </view>
- <view class="way_title">微信支付</view>
- <view class="way_check"></view>
- </view>
- </view>
- <view class="pay_control">
- <view class="pay_info"><text>待支付</text><text class="unit">¥</text><text class="amout">980</text>>
- </view>
- </view>
- </view>
- </uni-popup>
- </view>
- </template>
- <style lang="scss" scoped>
- .payPackage {
- width: 593rpx;
- height: 617rpx;
- background: url(https://test.jue-ming.com:8849/api/show?filePath=./jinhong/index/dialog_bg.png) no-repeat top;
- background-size: cover;
- border-radius: 40rpx;
- }
- .pay_title {
- font-family: 'Alibaba PuHuiTi 2.0';
- font-weight: normal;
- font-size: 32rpx;
- color: #4A89FB;
- text-align: center;
- padding: 28rpx 0 30rpx;
- }
- .package_item {
- display: flex;
- justify-content: space-between;
- align-items: center;
- width: 517rpx;
- height: 100rpx;
- background: #FFFFFF;
- border-radius: 14rpx;
- border: 1px solid #D6D6D6;
- margin: 0 auto 14rpx;
- padding: 14rpx 70rpx;
- }
- .package_item.active {
- background: #0056FF;
- }
- .item_body {
- flex: 1;
- }
- .item_name {
- font-family: Alibaba PuHuiTi 2.0;
- font-weight: normal;
- font-size: 28rpx;
- color: #333333;
- line-height: 36rpx;
- }
- .item_desc {
- font-family: Alibaba PuHuiTi 2.0;
- font-weight: normal;
- font-size: 20rpx;
- color: #999999;
- line-height: 36rpx;
- }
- .item_price {
- font-family: Alibaba PuHuiTi 2.0;
- font-weight: normal;
- font-size: 28rpx;
- color: #333333;
- line-height: 125rpx;
- }
- .pay_way_title {
- font-family: 'Alibaba PuHuiTi 2.0';
- font-weight: normal;
- font-size: 32rpx;
- color: #333333;
- margin: 35rpx 42rpx 26rpx 0;
- }
- .way_item {
- display: flex;
- }
- .pay_info {
- font-family: 'Alibaba PuHuiTi 2.0';
- font-weight: normal;
- font-size: 28rpx;
- color: #333333;
- display: flex;
- align-items: center;
- }
- .amout {
- font-family: Alibaba PuHuiTi 2.0;
- font-weight: normal;
- font-size: 28rpx;
- color: #F20404;
- }
- .unit {
- font-family: Alibaba PuHuiTi 2.0;
- font-weight: normal;
- font-size: 20rpx;
- color: #F20404;
- }
- </style>
|