pay-popup.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <template>
  2. <view>
  3. <u-popup :show="payShow" mode="bottom" @close="close" :closeable="true">
  4. <view class="choiceShow-wrap">
  5. <view class="flex goods">
  6. <view class="flex image-wrap">
  7. <image :src="payInfo.picUrl" mode="aspectFill"></image>
  8. </view>
  9. <view class="info">
  10. <view class="info-title">{{ payInfo.title }}</view>
  11. <view class="info-stock">¥{{ $numberFormat( payInfo.salePrice ) }}</view>
  12. </view>
  13. </view>
  14. <view class="flex coupon" @click="toCoupon">
  15. <view class="flex coupon-left">
  16. <u-icon name="coupon" size="26" color="#333"></u-icon>
  17. <view class="txt">代金券</view>
  18. </view>
  19. <view class="flex coupon-right">
  20. <view class="txt">暂无可用代金券</view>
  21. <u-icon name="arrow-right" size="16" color="#333"></u-icon>
  22. </view>
  23. </view>
  24. <view class="flex agreement">
  25. <view class="txt">同意<text>《盲票购买须知》</text></view>
  26. <view class="checked">
  27. <u-checkbox-group>
  28. <u-checkbox :value="checked" :checked="checked" shape="circle" activeColor="#E96737"
  29. @change="changeChecked"></u-checkbox>
  30. </u-checkbox-group>
  31. </view>
  32. </view>
  33. <view class="flex btn">
  34. <view class="flex btn-left">
  35. <view class="title">应付:</view>
  36. <view class="flex coin">¥{{ $numberFormat(payInfo.payAmt) }}</view>
  37. </view>
  38. <view class="btn-right">
  39. <view class="confirm" @click="pay">立即支付</view>
  40. </view>
  41. </view>
  42. </view>
  43. </u-popup>
  44. </view>
  45. </template>
  46. <script>
  47. import $http from '@/utils/request.js'
  48. export default {
  49. name: "pay-popup",
  50. props: {
  51. payShow: {
  52. type: [Boolean],
  53. default: false
  54. },
  55. payInfo: {
  56. type: [Object],
  57. default: {}
  58. }
  59. },
  60. data() {
  61. return {
  62. checked: false,
  63. couponIds: [],
  64. autoCoupon: 1,
  65. };
  66. },
  67. methods: {
  68. changeChecked(e) {
  69. console.log(e);
  70. this.checked = e
  71. },
  72. toCoupon() {
  73. uni.navigateTo({
  74. url: '/pages/coupon/index'
  75. })
  76. },
  77. close() {
  78. this.checked = false
  79. this.$emit('close')
  80. },
  81. pay(){
  82. if(!this.checked){
  83. uni.$u.toast('请同意《盲票购买须知》!');
  84. return
  85. }
  86. $http.post('/api/v1/mp/user/ticket/order/submit', {}).then(res=>{
  87. console.log(res);
  88. if(res.code == 0){
  89. if(res.data.needPay == 1){
  90. $http.post('/api/v1/mp/user/ticket/order/pay', {
  91. orderId: res.data.orderId,
  92. payType: 2
  93. }).then(res=>{
  94. if(res.code == 0){
  95. uni.$u.toast('支付成功');
  96. }else{
  97. uni.$u.toast('支付失败!');
  98. }
  99. }).catch(()=>{
  100. uni.$u.toast('支付失败!');
  101. })
  102. } else{
  103. uni.$u.toast('支付成功');
  104. }
  105. }
  106. })
  107. },
  108. },
  109. }
  110. </script>
  111. <style lang="scss" scoped>
  112. .choiceShow-wrap {
  113. min-height: 400rpx;
  114. padding: 80rpx 0 60rpx;
  115. .goods {
  116. padding: 0 20rpx;
  117. justify-content: space-between;
  118. margin-bottom: 20rpx;
  119. .image-wrap {
  120. width: 220rpx;
  121. height: 220rpx;
  122. border: 1px solid rgba(236, 236, 236, 100);
  123. border-radius: 10rpx;
  124. image {
  125. width: 174rpx;
  126. height: 174rpx;
  127. }
  128. }
  129. .info {
  130. flex: 1;
  131. display: flex;
  132. height: 220rpx;
  133. flex-direction: column;
  134. justify-content: space-between;
  135. padding-left: 26rpx;
  136. &-title {
  137. font-size: 32rpx;
  138. line-height: 44rpx;
  139. font-weight: bold;
  140. }
  141. &-coin {
  142. display: flex;
  143. align-items: center;
  144. font-size: 32rpx;
  145. line-height: 44rpx;
  146. color: rgba(235, 112, 9, 100);
  147. font-weight: bold;
  148. image {
  149. width: 42rpx;
  150. height: 42rpx;
  151. margin-right: 20rpx;
  152. }
  153. }
  154. &-stock {
  155. line-height: 44rpx;
  156. }
  157. }
  158. }
  159. .coupon {
  160. justify-content: space-between;
  161. padding: 30rpx 40rpx;
  162. border-top: 1px solid rgba(187, 187, 187, 100);
  163. border-bottom: 1px solid rgba(187, 187, 187, 100);
  164. .txt {
  165. margin: 0 24rpx;
  166. }
  167. }
  168. .agreement {
  169. justify-content: space-between;
  170. padding: 50rpx 40rpx;
  171. border-bottom: 1px solid rgba(187, 187, 187, 100);
  172. .txt text {
  173. color: #007aff;
  174. }
  175. }
  176. .btn {
  177. justify-content: space-between;
  178. padding: 20rpx 20rpx;
  179. &-left {
  180. .coin {
  181. display: flex;
  182. align-items: center;
  183. font-size: 32rpx;
  184. line-height: 44rpx;
  185. color: rgba(235, 112, 9, 100);
  186. margin-left: 20rpx;
  187. }
  188. }
  189. &-right {
  190. .confirm {
  191. width: 250rpx;
  192. height: 60rpx;
  193. line-height: 60rpx;
  194. border-radius: 8px;
  195. background-color: rgba(235, 112, 9, 100);
  196. color: rgba(255, 255, 255, 100);
  197. font-size: 28rpx;
  198. text-align: center;
  199. }
  200. }
  201. }
  202. }
  203. </style>