rechargeByPhone.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. <template>
  2. <view>
  3. <ujp-navbar title="帮人充值" :isBack="isBack">
  4. <view class="slot-wrap">
  5. <span class="navBtn " @click="toRefundList"> <u-icon name="clock"></u-icon>充值记录</span>
  6. </view>
  7. </ujp-navbar>
  8. <view class="recharge">
  9. <view class="recharge-text">
  10. <p>充值账户</p>
  11. <u-input v-model="phone"
  12. :custom-style="{
  13. 'font-size': '48rpx',
  14. 'line-height': '48rpx',
  15. }"
  16. :placeholder-style="{
  17. 'font-size': '48rpx',
  18. 'line-height': '48rpx',
  19. 'color':' rgba(204, 204, 204, 1)',
  20. }"
  21. height="82" placeholder="请输入充值手机号" ></u-input>
  22. </view>
  23. </view>
  24. <view class="charge">
  25. <view class="chargeTit">
  26. 选择充值金额
  27. </view>
  28. <view class="chargeMain">
  29. <template v-for="(item,i) in list">
  30. <view :key="i" :class="{
  31. 'active':amount==item
  32. }" @click="amount=item"
  33. class="chargeMain-item "><p>{{item}}元</p></view>
  34. </template>
  35. </view>
  36. </view>
  37. <view style=" padding-bottom: 120px; ">
  38. <view class="charge">
  39. <view class="chargeRadio">
  40. <view class="u-flex">
  41. <u-icon name="weixinzhifu" custom-prefix="custom-icon" color="#22ac38" size="80"></u-icon>
  42. <view class="chargeRadio-text">
  43. <h4>微信支付</h4>
  44. <p>推荐微信支付</p>
  45. </view>
  46. </view>
  47. <u-radio-group>
  48. <u-radio></u-radio>
  49. </u-radio-group>
  50. </view>
  51. </view>
  52. </view>
  53. <view class="foot-btn">
  54. <view class="foot-pirce">
  55. <u-icon name="tikuan" custom-prefix="custom-icon" color="#FF9502" size="48"></u-icon>
  56. <span>支付 {{amount}} 元</span>
  57. </view>
  58. <u-button type="primary" @click="submit" :custom-style="customStyle" shape="square">确定充值</u-button>
  59. </view>
  60. </view>
  61. </template>
  62. <script>
  63. import * as Pay from '@/apis/weixin.js'
  64. import {
  65. checkPhone
  66. } from '@/utils'
  67. import {
  68. wxPayJs
  69. } from '@/utils/wxpay'
  70. import * as API from '@/apis/index.js'
  71. export default {
  72. data() {
  73. return {
  74. isReady:false,
  75. customStyle: {
  76. background: '#1677ff'
  77. },
  78. detail:{},
  79. isBack:false,
  80. chargingMarketingId:'',
  81. selectItem:{},
  82. list:[5,10,20,50,100,200],
  83. amount:5,
  84. phone:"",
  85. }
  86. },
  87. onLoad(op){
  88. if(op.site){
  89. this.isBack=true;
  90. }
  91. },
  92. onReady() {
  93. },
  94. methods: {
  95. toRefundList() {
  96. uni.navigateTo({
  97. url: '/pages/user/rechargeListByPhone'
  98. })
  99. },
  100. submit(){
  101. var checkPhoneResult = checkPhone(this.phone);
  102. if ( checkPhoneResult !== true) {
  103. uni.showToast({
  104. title: checkPhoneResult,
  105. })
  106. return;
  107. }
  108. uni.showLoading({
  109. title: "加载中",
  110. mask: true,
  111. })
  112. Pay.wxJsapiPayByPhone({
  113. openId:this.carhelp.getOpenId(),
  114. phone:this.phone,
  115. amount:this.amount
  116. }).then((response) => {
  117. if(!response.result){
  118. uni.showToast({
  119. title: response.message
  120. })
  121. return
  122. }
  123. var data = response.data
  124. uni.hideLoading()
  125. console.log("Pay+"+new Date().getTime())
  126. wxPayJs(data);
  127. }).catch(error => {
  128. uni.showToast({
  129. title: error
  130. })
  131. })
  132. },
  133. },onShow(){
  134. if(this.isReady){
  135. }
  136. }
  137. }
  138. </script>
  139. <style>
  140. page{
  141. background-color: #f7f7f7;
  142. }
  143. </style>
  144. <style lang="scss" scoped>
  145. .slot-wrap{
  146. flex: 1;
  147. }
  148. .navBtn{
  149. float: right;
  150. margin-right: 15px;
  151. color:#1677FF ;
  152. }
  153. .recharge{
  154. padding: 15px;
  155. //background-color: #1677FF;
  156. background-color: #fff;
  157. margin-bottom: 10px;
  158. display: flex;
  159. justify-content: space-between;
  160. align-items: center;
  161. .recharge-text{
  162. //color:#fff;
  163. width: 100%;
  164. }
  165. .recharge-btn{
  166. width: 60px;
  167. height: 30px;
  168. text-align: center;
  169. line-height: 30px;
  170. background-color: #589EFF;
  171. color:#fff;
  172. border-radius: 15px;
  173. }
  174. }
  175. .charge{
  176. padding: 15px;
  177. background-color: #fff;
  178. margin-bottom: 10px;
  179. }
  180. .chargeRadio{
  181. display: flex;
  182. justify-content: space-between;
  183. align-items: center;
  184. width: 100%;
  185. .chargeRadio-text{
  186. margin-left: 5px;
  187. h4{
  188. font-weight: normal;
  189. font-size: 15px;
  190. }
  191. p{
  192. font-size: 12px;
  193. color:#999;
  194. margin-top: 5px;
  195. }
  196. }
  197. }
  198. .chargeTit{
  199. border-bottom: 1px solid #f7f7f7;
  200. padding-bottom: 10px;
  201. font-size: 15px;
  202. }
  203. .chargeMain{
  204. display: flex;
  205. flex-wrap: wrap;
  206. justify-content: space-between;
  207. margin-top: 20px;
  208. .chargeMain-item{
  209. width: 32%;
  210. text-align: center;
  211. padding: 10px 10px;
  212. border: 1px solid rgba(22, 119, 255, 1);
  213. margin-bottom: 10px;
  214. border-radius: 5px;
  215. color:#333;
  216. color: rgba(22, 119, 255, 1);
  217. position: relative;
  218. p{
  219. font-size: 20px;
  220. }
  221. span{
  222. background-color: #ff8d00;
  223. color:#fff;
  224. padding: 2px 10px;
  225. border-radius:0 10px 0 10px;
  226. position: absolute;
  227. font-size: 12px;
  228. right: -2px;
  229. top: -2px;
  230. }
  231. }
  232. .active{
  233. border-color:rgba(22, 119, 255, 1);
  234. background-color: rgba(22, 119, 255, 1);
  235. color: rgba(255, 255, 255, 1);
  236. }
  237. .fault{
  238. background-color:#e1e1e1;
  239. color:#666;
  240. border: 1px solid #ccc;
  241. }
  242. .occupy{
  243. color:#FF4F3F;
  244. border: 1px solid #FF4F3F;
  245. }
  246. }
  247. .foot-btn{
  248. padding: 10px;
  249. position: fixed;
  250. left: 0;
  251. right: 0;
  252. bottom: 0;
  253. background-color: #fff;
  254. .foot-pirce{
  255. display: flex;
  256. align-items: center;
  257. span{
  258. margin-left: 5px;
  259. font-size: 16px;
  260. }
  261. padding-bottom: 10px;
  262. border-bottom: 1px solid #f7f7f7;
  263. margin-bottom: 10px;
  264. }
  265. }
  266. </style>