paymentPage.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. <template>
  2. <view class="payment_bg">
  3. <view class="payment_info">
  4. <view class="people_num"><text>{{peopleNum}}人已测</text></view>
  5. <view class="price_num"><text>¥{{orderInfo.total}}</text></view>
  6. <view class="pay_btn_sm" @click="getH5Pay()">{{orderInfo.total}}元解锁专属测试报告</view>
  7. </view>
  8. <view class="payment_desc">
  9. <image src="https://test.jue-ming.com:8849/api/show?filePath=./webo/EQtest/paymentPage/pay_scale_desc.png"
  10. mode="widthFix"></image>
  11. </view>
  12. <view class="pay_btn_lg" @click="getH5Pay()">
  13. {{orderInfo.total}}元解锁专属测试报告
  14. </view>
  15. <uni-popup ref="popup" type="center">
  16. <view class="pay_dialog">
  17. <view class="btn_area">
  18. <image style="margin-right: 89rpx;" @click="completeHandle"
  19. src="https://test.jue-ming.com:8849/api/show?filePath=./webo/EQtest/paymentPage/complete_btn.png"
  20. mode="widthFix"></image>
  21. <image @click="uncompleteHandle"
  22. src="https://test.jue-ming.com:8849/api/show?filePath=./webo/EQtest/paymentPage/uncomplete_btn.png"
  23. mode="widthFix"></image>
  24. </view>
  25. </view>
  26. </uni-popup>
  27. </view>
  28. </template>
  29. <script>
  30. export default {
  31. data() {
  32. return {
  33. orderNo: '',
  34. orderInfo: {},
  35. peopleNum: 0
  36. }
  37. },
  38. onLoad(options) {
  39. if (options.orderNo) {
  40. this.orderNo = options.orderNo;
  41. setTimeout(() => {
  42. this.payEnsure();
  43. }, 200)
  44. }
  45. this.orderInfo = JSON.parse(sessionStorage.getItem('orderInfo'));
  46. this.getPeople();
  47. },
  48. methods: {
  49. // 检查订单支付状态
  50. checkOrder() {
  51. let _this = this;
  52. _this.$request
  53. .get({
  54. url: `api/wx-pay/queryOrder/${_this.orderNo}`,
  55. loadingTip: "加载中...",
  56. data: {},
  57. })
  58. .then((res) => {
  59. uni.hideLoading();
  60. let resultInfo = JSON.parse(res.data.body)
  61. if (resultInfo.trade_state === 'SUCCESS') {
  62. uni.navigateTo({
  63. url: `/newScale/EQtest/paySuccess?resultId=${this.orderInfo.resultId}&userId=${this.orderInfo.userId}`
  64. });
  65. } else {
  66. return;
  67. }
  68. });
  69. },
  70. // 拉起微信支付
  71. getH5Pay(params) {
  72. let _this = this;
  73. _this.$request
  74. .get({
  75. url: `api/orderInfo/queryOrderByResultIdAndUserId/${this.orderInfo.userId}/${this.orderInfo.resultId}`,
  76. loadingTip: "加载中...",
  77. data: {},
  78. })
  79. .then((res) => {
  80. uni.hideLoading();
  81. if (res.data && res.data.orderStatus === '支付成功') {
  82. uni.navigateTo({
  83. url: `/newScale/EQtest/paySuccess?resultId=${this.orderInfo.resultId}&userId=${this.orderInfo.userId}`
  84. });
  85. } else {
  86. // _this.orderInfo.total = _this.hasDiscount ? _this.promotionPrice : _this.price;
  87. _this.$request
  88. .post({
  89. url: "api/wx-pay/h5Pay",
  90. loadingTip: "加载中...",
  91. data: _this.orderInfo
  92. })
  93. .then((res) => {
  94. let redirect_url = encodeURI(
  95. `http://hnhong-duo.com/webo/newScale/EQtest/paymentPage?orderNo=${res.data.orderNo}`
  96. )
  97. window.location.href = `${res.data.codeUrl}&redirect_url=${redirect_url}`;
  98. });
  99. }
  100. });
  101. },
  102. // 查询测试人数
  103. getPeople() {
  104. let _this = this;
  105. _this.$request
  106. .get({
  107. url: "record/countByFlag?flag=20210820143117",
  108. loadingTip: "加载中..."
  109. })
  110. .then((res) => {
  111. _this.peopleNum = res.data + 57000
  112. });
  113. },
  114. payEnsure() {
  115. // console.log(11111)
  116. this.$refs.popup.open();
  117. },
  118. uncompleteHandle() {
  119. this.$refs.popup.close();
  120. },
  121. completeHandle() {
  122. uni.showLoading({
  123. title: ''
  124. });
  125. this.checkOrder();
  126. }
  127. }
  128. }
  129. </script>
  130. <style scoped>
  131. .payment_bg {
  132. width: 100%;
  133. background: url(https://test.jue-ming.com:8849/api/show?filePath=./webo/EQtest/paymentPage/payment_bg.png) no-repeat top;
  134. background-size: 100% auto;
  135. overflow: hidden;
  136. }
  137. .payment_info {
  138. width: 750rpx;
  139. height: 531rpx;
  140. background: url(https://test.jue-ming.com:8849/api/show?filePath=./webo/EQtest/paymentPage/pay_scale_info.png) no-repeat center;
  141. background-size: cover;
  142. position: relative;
  143. margin-top: 143rpx;
  144. overflow: hidden;
  145. }
  146. .payment_info image {
  147. width: 100%;
  148. height: auto;
  149. margin-top: 134rpx;
  150. }
  151. .payment_info .pay_btn_sm {
  152. width: 640rpx;
  153. height: 73rpx;
  154. line-height: 73rpx;
  155. position: absolute;
  156. left: 55rpx;
  157. bottom: 73rpx;
  158. background: url(https://test.jue-ming.com:8849/api/show?filePath=./webo/EQtest/paymentPage/pay_button.png) no-repeat center;
  159. background-size: 100% auto;
  160. font-family: 'Alibaba PuHuiTi 2.0';
  161. font-weight: bold;
  162. font-size: 36rpx;
  163. color: #FFFFFF;
  164. text-shadow: 0rpx 0rpx 5rpx rgba(168, 63, 90, 0.5);
  165. text-align: center;
  166. }
  167. .payment_desc image {
  168. width: 750rpx;
  169. }
  170. .pay_btn_lg {
  171. width: 640rpx;
  172. height: 73rpx;
  173. line-height: 73rpx;
  174. background: url(https://test.jue-ming.com:8849/api/show?filePath=./webo/EQtest/paymentPage/pay_button.png) no-repeat center;
  175. background-size: 100% auto;
  176. font-family: 'Alibaba PuHuiTi 2.0';
  177. font-weight: bold;
  178. font-size: 36rpx;
  179. color: #FFFFFF;
  180. text-shadow: 0rpx 0rpx 5rpx rgba(168, 63, 90, 0.5);
  181. text-align: center;
  182. margin: 20rpx auto 60rpx;
  183. }
  184. .pay_dialog {
  185. width: 594rpx;
  186. height: 360rpx;
  187. background: url(https://test.jue-ming.com:8849/api/show?filePath=./webo/EQtest/paymentPage/dialog_bg.png) no-repeat top;
  188. background-size: cover;
  189. position: fixed;
  190. top: 540rpx;
  191. left: 50%;
  192. transform: translate(-50%, -50%);
  193. }
  194. .btn_area {
  195. margin: 240rpx 0 0 96rpx;
  196. }
  197. .btn_area image {
  198. width: 160rpx;
  199. }
  200. .btn_area image:active {
  201. border: 1rpx solid #999999;
  202. opacity: 0.8;
  203. border-radius: 28rpx;
  204. }
  205. .people_num {
  206. margin-top: 177rpx;
  207. }
  208. .people_num text {
  209. min-width: 157rpx;
  210. height: 44rpx;
  211. padding: 0 10rpx;
  212. background: #FFEDF1;
  213. border-radius: 22rpx;
  214. font-family: 'Alibaba PuHuiTi 2.0';
  215. font-size: 28rpx;
  216. color: #FC716D;
  217. line-height: 44rpx;
  218. text-align: center;
  219. margin-left: 373rpx;
  220. }
  221. .price_num {
  222. margin-top: 72rpx;
  223. }
  224. .price_num text {
  225. min-width: 74rpx;
  226. font-family: 'Alibaba PuHuiTi 2.0';
  227. font-weight: normal;
  228. font-size: 32rpx;
  229. color: #FC716D;
  230. line-height: 24rpx;
  231. margin-left: 374rpx;
  232. }
  233. </style>