PayPackage.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. <script setup lang="ts">
  2. import { onMounted, ref, reactive } from "vue";
  3. import { userLoginApi, getUserPhoneApi } from "@/services/home";
  4. import { useMemberStore } from "@/stores/";
  5. import type { LoginParams, GetPhoneParams } from "@/types/home";
  6. import { login } from "@/hooks/useIsLogin";
  7. const useMember = useMemberStore();
  8. const packagePopup = ref<any>();
  9. const packageList = reactive<any[]>([
  10. { name: '单次卡(税务报告)', desc: '税务报告单次获取', price: '980' },
  11. { name: '4次卡(税务报告)', desc: '税务报告4次卡', price: '2680' },
  12. { name: '12次卡(税务报告)', desc: '税务报告12次卡', price: '5980' },
  13. ]);
  14. const userInfoMsg = reactive<LoginParams>({
  15. code: "",
  16. });
  17. onMounted(() => {
  18. console.log("登录");
  19. });
  20. //获取手机号
  21. const getPhoneNumber = (e: any) => {
  22. console.log(e);
  23. //获取到动态令牌后将动态令牌传输到后台方法
  24. //同时需要将获取到的openId传输给后台
  25. const params = {
  26. openId: useMember.userInfo.openId,
  27. code: e.detail.code,
  28. };
  29. getUserPhone(params);
  30. };
  31. const getUserPhone = async (val: GetPhoneParams) => {
  32. const phoneInfo = await getUserPhoneApi(val);
  33. useMember.userInfo.phone = phoneInfo.data;
  34. login().then((res: any) => {
  35. //这时可以查询是否授权
  36. if (res.code == "2001") {
  37. uni.showToast({
  38. title: '暂无权限',
  39. icon: "none",
  40. duration: 2000
  41. });
  42. } else {
  43. uni.showToast({
  44. title: "登录成功",
  45. icon: "none",
  46. success() {
  47. uni.navigateTo({ url: "/pages/index/inviteUser" });
  48. }
  49. });
  50. }
  51. });
  52. close();
  53. //获取到手机号后
  54. //将缓存里的手机号替换为最新的
  55. };
  56. //拿到code 向后台请求openId session_key
  57. const open = () => {
  58. login().then((res: any) => {
  59. userInfoMsg.code = res.code;
  60. });
  61. packagePopup.value.open("center");
  62. };
  63. const close = () => {
  64. packagePopup.value.close();
  65. };
  66. const agree = ref<boolean>(false);
  67. const radioChange = () => {
  68. agree.value = !agree.value;
  69. };
  70. const stipulate = ref<any>();
  71. const stipulateClose = () => {
  72. stipulate.value.close();
  73. };
  74. const viewDetail = () => {
  75. stipulateOpen();
  76. };
  77. const stipulateOpen = () => {
  78. stipulate.value.open("bottom");
  79. };
  80. defineExpose({
  81. open,
  82. });
  83. </script>
  84. <template>
  85. <view>
  86. <uni-popup ref="packagePopup">
  87. <view class="payPackage">
  88. <view class="pay_title">套餐购买</view>
  89. <view class="package_list">
  90. <view class="package_item" v-for="item in packageList">
  91. <view class="item_head">
  92. </view>
  93. <view class="item_body">
  94. <view class="item_name">
  95. {{ item.name }}
  96. </view>
  97. <view class="item_desc">
  98. {{ item.desc }}
  99. </view>
  100. </view>
  101. <view class="item_price">
  102. {{ item.price }}
  103. </view>
  104. </view>
  105. </view>
  106. <view class="pay_way">
  107. <view class="pay_way_title">
  108. 付款方式
  109. </view>
  110. <view class="way_item">
  111. <view class="way_icon">
  112. <image src="" mode="scaleToFill" />
  113. </view>
  114. <view class="way_title">微信支付</view>
  115. <view class="way_check"></view>
  116. </view>
  117. </view>
  118. <view class="pay_control">
  119. <view class="pay_info"><text>待支付</text><text class="unit">¥</text><text class="amout">980</text>>
  120. </view>
  121. </view>
  122. </view>
  123. </uni-popup>
  124. </view>
  125. </template>
  126. <style lang="scss" scoped>
  127. .payPackage {
  128. width: 593rpx;
  129. height: 617rpx;
  130. background: url(https://test.jue-ming.com:8849/api/show?filePath=./jinhong/index/dialog_bg.png) no-repeat top;
  131. background-size: cover;
  132. border-radius: 40rpx;
  133. }
  134. .pay_title {
  135. font-family: 'Alibaba PuHuiTi 2.0';
  136. font-weight: normal;
  137. font-size: 32rpx;
  138. color: #4A89FB;
  139. text-align: center;
  140. padding: 28rpx 0 30rpx;
  141. }
  142. .package_item {
  143. display: flex;
  144. justify-content: space-between;
  145. align-items: center;
  146. width: 517rpx;
  147. height: 100rpx;
  148. background: #FFFFFF;
  149. border-radius: 14rpx;
  150. border: 1px solid #D6D6D6;
  151. margin: 0 auto 14rpx;
  152. padding: 14rpx 70rpx;
  153. }
  154. .package_item.active {
  155. background: #0056FF;
  156. }
  157. .item_body {
  158. flex: 1;
  159. }
  160. .item_name {
  161. font-family: Alibaba PuHuiTi 2.0;
  162. font-weight: normal;
  163. font-size: 28rpx;
  164. color: #333333;
  165. line-height: 36rpx;
  166. }
  167. .item_desc {
  168. font-family: Alibaba PuHuiTi 2.0;
  169. font-weight: normal;
  170. font-size: 20rpx;
  171. color: #999999;
  172. line-height: 36rpx;
  173. }
  174. .item_price {
  175. font-family: Alibaba PuHuiTi 2.0;
  176. font-weight: normal;
  177. font-size: 28rpx;
  178. color: #333333;
  179. line-height: 125rpx;
  180. }
  181. .pay_way_title {
  182. font-family: 'Alibaba PuHuiTi 2.0';
  183. font-weight: normal;
  184. font-size: 32rpx;
  185. color: #333333;
  186. margin: 35rpx 42rpx 26rpx 0;
  187. }
  188. .way_item {
  189. display: flex;
  190. }
  191. .pay_info {
  192. font-family: 'Alibaba PuHuiTi 2.0';
  193. font-weight: normal;
  194. font-size: 28rpx;
  195. color: #333333;
  196. display: flex;
  197. align-items: center;
  198. }
  199. .amout {
  200. font-family: Alibaba PuHuiTi 2.0;
  201. font-weight: normal;
  202. font-size: 28rpx;
  203. color: #F20404;
  204. }
  205. .unit {
  206. font-family: Alibaba PuHuiTi 2.0;
  207. font-weight: normal;
  208. font-size: 20rpx;
  209. color: #F20404;
  210. }
  211. </style>