payZL.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. <script>
  2. import api from '@/api'
  3. export default {
  4. name: 'payZL',
  5. props: {
  6. bankList: {
  7. type: Array,
  8. default: () => []
  9. },
  10. channel: {
  11. type: [String, Number],
  12. default: ''
  13. },
  14. order_id: {
  15. type: String,
  16. default: ''
  17. },
  18. order_type: {
  19. type: String,
  20. default: ''
  21. }
  22. },
  23. data() {
  24. return {
  25. show: false,
  26. selectBank: {},
  27. code: '', // 短信验证码
  28. yl_order_id: '' // 银行卡支付 时返回的 order_id
  29. }
  30. },
  31. methods: {
  32. close() {
  33. this.show = false
  34. uni.$emit('payZLClose')
  35. },
  36. selectedBank(item) {
  37. this.selectBank = item
  38. this.createPayOrder()
  39. },
  40. async createPayOrder() {
  41. let res = await api.paymentInfo(
  42. {
  43. order_id: this.order_id,
  44. sign_id: this.selectBank.id,
  45. channel: this.channel,
  46. order_type: this.order_type,
  47. trade_type: 'app'
  48. },
  49. true
  50. )
  51. this.yl_order_id = res.thirdpaySYL.orderid
  52. this.$refs.modal.show = true
  53. },
  54. // 银行卡支付
  55. async sylSurePay() {
  56. try {
  57. await api.sylSurePay({ order_id: this.yl_order_id, sms_code: this.code }, true)
  58. if (this.order_type === '4') {
  59. this.$common.toast('支付订单提交成功,请稍后关注订单列表~')
  60. setTimeout(() => {
  61. this.$jump({ url: '/pagesGoods/order/orderList' }, { status: -1 }, 'redirectTo')
  62. }, 1000)
  63. } else if (this.order_type === '6') {
  64. // 先把这个支付弹窗给关闭了
  65. this.$refs.modal.show = false
  66. this.$nextTick(() => {
  67. // 开通服务商弹窗提示
  68. this.$refs.modal3.show = true
  69. // 刷新用户信息
  70. this.$store.dispatch('refreshUser')
  71. })
  72. }
  73. } catch (e) {
  74. this.$common.toast('支付失败')
  75. this.$refs.modal.show = false
  76. }
  77. },
  78. // 解绑
  79. async unBind() {
  80. await api.userToUnSignBank(this.selectBank.id)
  81. this.$refs.modal2.show = false
  82. this.$common.toast('解绑成功')
  83. await this.getBankList()
  84. }
  85. }
  86. }
  87. </script>
  88. <template>
  89. <view>
  90. <!-- 银行卡弹窗 -->
  91. <u-popup
  92. :show="show"
  93. @close="close"
  94. customStyle="box-sizing:border-box; padding:60rpx 28rpx 65rpx"
  95. >
  96. <u-text size="34rpx" text="选择银行卡" align="center" bold></u-text>
  97. <view class="popup-list">
  98. <view
  99. class="popup-item flex align-center"
  100. v-for="item in bankList"
  101. :key="item.id"
  102. @click="selectedBank(item)"
  103. >
  104. <view class="flex1">
  105. <view class="info">
  106. <text class="name">持卡人:{{ item.name }}</text>
  107. <text class="tel">Tel:{{ item.phone }}</text>
  108. </view>
  109. <view class="card flex">
  110. <image src="/static/images/pay/yhk_chose.png" class="img"></image>
  111. <view class="ml-10">银行卡:{{ item.bank_card }}</view>
  112. </view>
  113. </view>
  114. <image
  115. @click.stop="
  116. selectBank = item
  117. $refs.modal2.show = true
  118. "
  119. src="/static/images/pay/jiebang.png"
  120. class="jiebang"
  121. ></image>
  122. </view>
  123. <u-text
  124. v-if="bankList.length === 0"
  125. text="暂无绑定银行卡哦~"
  126. type="info"
  127. align="center"
  128. size="30rpx"
  129. ></u-text>
  130. </view>
  131. <view class="flex mt-30" @click="$jump({ url: './payBankBind' })">
  132. <image src="/static/images/pay/tj_yhk_blue.png" class="plus"></image>
  133. <view class="f32 bold">添加银行卡</view>
  134. </view>
  135. </u-popup>
  136. <!-- 银行卡支付弹窗 -->
  137. <custom-modal ref="modal" zIndex="10077" overlayZIndex="10076" :showBtn="false">
  138. <u-text
  139. :text="`请输入手机号:${selectBank.phone}`"
  140. size="28rpx"
  141. align="center"
  142. margin="20rpx 0 0"
  143. bold
  144. ></u-text>
  145. <u-text text="接收的短信验证码" align="center" size="28rpx" margin="0 0 40rpx" bold></u-text>
  146. <input
  147. v-model="code"
  148. type="number"
  149. class="modal-input"
  150. placeholder="请输入短信验证码"
  151. placeholder-style="font-size: 28rpx;font-weight: 500;color: #BDBDC0;line-height: 32rpx;"
  152. />
  153. <u-text
  154. text="请注意短信包含汇付宝字样短信,请确定手机号不在欠费停机状态,以及信号良好情况。如果一直没收到,请联系客服"
  155. color="#F76363"
  156. size="24rpx"
  157. margin="30rpx 0 40rpx"
  158. ></u-text>
  159. <u-button
  160. text="提交"
  161. shape="circle"
  162. color="#F7C363"
  163. customStyle="width: 320rpx;height: 88rpx;"
  164. @click="sylSurePay"
  165. ></u-button>
  166. </custom-modal>
  167. <!-- 解绑弹窗 -->
  168. <custom-modal
  169. ref="modal2"
  170. content="是否确认解绑银行卡"
  171. @confirm="unBind"
  172. zIndex="10079"
  173. overlayZIndex="10078"
  174. ></custom-modal>
  175. <!-- 服务商弹窗提示 -->
  176. <custom-modal
  177. ref="modal3"
  178. content="服务商开通支付已提交,订单处理稍有延迟,请勿重复开通,如十五分钟之后还未开通,请联系在线客服"
  179. :show-cancel="false"
  180. :close-on-click-overlay="false"
  181. @confirm="$common.back"
  182. >
  183. </custom-modal>
  184. </view>
  185. </template>
  186. <style lang="scss" scoped>
  187. .popup-list {
  188. margin-top: 50rpx;
  189. height: 400rpx;
  190. overflow-y: auto;
  191. .popup-item {
  192. height: 156rpx;
  193. background: #f4f4f4;
  194. border-radius: 10px;
  195. padding: 37rpx 25rpx 28rpx;
  196. box-sizing: border-box;
  197. & + .popup-item {
  198. margin-top: 20rpx;
  199. }
  200. .info {
  201. color: #959595;
  202. font-size: 26rpx;
  203. .name {
  204. margin-right: 38rpx;
  205. }
  206. }
  207. .card {
  208. margin-top: 27rpx;
  209. .img {
  210. width: 48rpx;
  211. height: 39rpx;
  212. }
  213. }
  214. .jiebang {
  215. width: 120rpx;
  216. height: 57rpx;
  217. }
  218. }
  219. }
  220. .plus {
  221. width: 40rpx;
  222. height: 40rpx;
  223. margin: 0 30rpx;
  224. }
  225. .modal-input {
  226. height: 88rpx;
  227. background: #f4f4f4;
  228. border-radius: 10px;
  229. padding: 0 30rpx;
  230. }
  231. </style>