user_pay.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. <template>
  2. <view class="page">
  3. <view class="page-user-info">
  4. <view class="info-left">
  5. <text class="info-left-title">付款给个人</text>
  6. <text class="info-left-info">{{user_info.username}}</text>
  7. </view>
  8. <view class="info-right">
  9. <image :src="staticPhoto + user_info.face"></image>
  10. </view>
  11. </view>
  12. <view class="content">
  13. <view class="content-main">
  14. <view class="content-main-other-info" v-if="pageParams.info">
  15. {{pageParams.info}}
  16. </view>
  17. <view class="content-main-icon">
  18. <text class="icon-msg">¥</text>
  19. <input class="uni-input" :disabled="disabled" v-model="value" @input="setAmount" type="number" placeholder=""/>
  20. </view>
  21. <view class="footer-msg">
  22. <view class="footer-msg-main" v-if="my_input.info">
  23. <text class="info">{{my_input.info}}</text>
  24. <text class="footer-msg-do" @tap="editShuoming">修改</text>
  25. </view>
  26. <view class="footer-msg-main" v-else>
  27. <text class="footer-msg-do" @tap="editShuoming">添加说明</text>
  28. </view>
  29. </view>
  30. <view class="footer-button">
  31. <button class="withdraw" type="submit" @tap="payAmount">确定</button>
  32. </view>
  33. </view>
  34. </view>
  35. <uni-popup ref="popup" type="dialog">
  36. <uni-popup-confirm
  37. mode="input"
  38. type="input"
  39. :value="my_input.info"
  40. placeholder="最多输入10个字"
  41. title="添加收钱说明"
  42. :duration="2000"
  43. :before-close="true"
  44. @close="close"
  45. @confirm="confirm">
  46. </uni-popup-confirm>
  47. </uni-popup>
  48. <pay-keyboard :showCose="showCose" :set_info = "set_info" :show_key="show_key" ref="payKeyboard" :set_msg="set_msg" @hideFun="hideFun" @getPassword="getPassword" :password="password"></pay-keyboard>
  49. </view>
  50. </template>
  51. <script>
  52. import _hook from '../../../common/_hook';
  53. import _data from '../../../common/_data';
  54. import _get from '../../../common/_get';
  55. import uniPopup from '../../../components/uni-popup/uni-popup'
  56. import uniPopupConfirm from '../../../components/uni-popup/uni-popup-confirm'
  57. import payKeyboard from '../../../components/uni-keyword/uni-keyword';
  58. export default {
  59. data() {
  60. return {
  61. my_data:{},
  62. pageParams:{
  63. info:'',
  64. user_id:0,
  65. amount:0
  66. },
  67. disabled:false,
  68. user_info:{},
  69. my_input:{
  70. info:''
  71. },
  72. set_msg:'请输入交易密码',
  73. set_info:'请输入交易密码,以确认身份',
  74. password:'',
  75. show_key:false,
  76. showCose:true
  77. }
  78. },
  79. components:{
  80. uniPopup,
  81. uniPopupConfirm,
  82. payKeyboard
  83. },
  84. onLoad(options){
  85. this.pageParams = options;
  86. if(options.amount) this.disabled = true;
  87. },
  88. onShow(){
  89. _hook.routeTabBarHook();
  90. let _this = this;
  91. /** 监听新的个人数据 */
  92. _get.getUserInfo(_this.pageParams,function(ret){
  93. console.log(ret);
  94. _this.user_info = ret;
  95. });
  96. },
  97. computed:{
  98. staticPhoto(){
  99. return _data.staticPhoto();
  100. },
  101. value(){
  102. return this.pageParams.amount;
  103. }
  104. },
  105. methods: {
  106. hideFun(){
  107. this.show_key = false;
  108. },
  109. getPassword(n){
  110. //付款
  111. let _this = this;
  112. uni.showLoading({
  113. title:'付款中...'
  114. });
  115. _get.payAmount({to_user_id:this.pageParams.user_id,amount:this.pageParams.amount,info:this.my_input.info},function (ret) {
  116. uni.$emit('data_user_info',ret);
  117. _data.data('user_info',ret);
  118. _this.$refs.payKeyboard.cleanNum();
  119. uni.hideLoading();
  120. uni.showToast({
  121. title:'支付成功',
  122. icon:'none'
  123. })
  124. setTimeout(function(){
  125. uni.redirectTo({
  126. url:'/pages/my/wallet/capital'
  127. })
  128. },1000)
  129. },function(ret){
  130. uni.hideLoading();
  131. uni.showToast({
  132. title:ret.msg,
  133. icon:'none'
  134. })
  135. _this.$refs.payKeyboard.cleanNum();
  136. });
  137. },
  138. setAmount(e){
  139. this.pageParams.amount= e.detail.value;
  140. },
  141. close(){
  142. this.$refs.popup.close()
  143. },
  144. confirm(val,value){
  145. val();
  146. this.my_input.info = value;
  147. },
  148. editShuoming(){
  149. this.$refs.popup.open();
  150. },
  151. payAmount(){
  152. let _this = this;
  153. if(!this.pageParams.amount){
  154. _this.$refs.payKeyboard.cleanNum();
  155. return uni.showToast({
  156. title:'金额错误',
  157. icon:'none'
  158. });
  159. }
  160. if(_data.data('user_info').id == _this.user_info.user_id) {
  161. _this.$refs.payKeyboard.cleanNum();
  162. return uni.showToast({
  163. title:'不能付款给自己',
  164. icon:'none'
  165. });
  166. }
  167. this.show_key = true;
  168. }
  169. }
  170. }
  171. </script>
  172. <style>
  173. .content-main-other-info{
  174. margin-left: 12px;
  175. margin-top: 20px;
  176. font-size: 14px;
  177. font-weight: 500;
  178. }
  179. .info-left-title{
  180. font-size: 14px;
  181. font-weight: 500;
  182. }
  183. .info-left-info{
  184. color: #b1b0b5;
  185. }
  186. .info-left{
  187. display: flex;
  188. flex-direction: column;
  189. justify-content: center;
  190. }
  191. .page-user-info{
  192. display: flex;
  193. flex-direction: row;
  194. justify-content: space-between;
  195. align-items: center;
  196. width: 90%;
  197. padding: 20upx 0;
  198. }
  199. .info-right image{
  200. width: 80upx !important;
  201. height: 80upx !important;
  202. border-radius: 10px;
  203. }
  204. .info-right{
  205. display: flex;
  206. align-items: center;
  207. }
  208. .footer-msg-do{
  209. color: #a1a3b0;
  210. margin-left: 20upx;
  211. }
  212. .content .withdraw{
  213. width: 90%;
  214. background-color: #51a938;
  215. color: white;
  216. height: 90upx;
  217. line-height: 90upx !important;
  218. border-radius: 15upx;
  219. font-size: 36upx;
  220. cursor: pointer;
  221. }
  222. .footer-button{
  223. margin-bottom: 50upx;
  224. }
  225. .page{
  226. display: flex;
  227. flex-direction:column;
  228. justify-content: center;
  229. align-items: center;
  230. }
  231. .footer-msg .footer-msg-main{
  232. margin: 30upx 0 30upx 12px;
  233. font-size: 14px;
  234. }
  235. .content{
  236. margin-top: 10upx;
  237. width: 95%;
  238. background-color: white;
  239. border-radius: 10upx;
  240. }
  241. .icon-msg{
  242. margin-bottom: 17px;
  243. font-weight: 600;
  244. font-size: 22px;
  245. }
  246. .content-main-icon{
  247. display: flex;
  248. justify-content: center;
  249. flex-direction: row;
  250. align-items: center;
  251. margin-top: 12px;
  252. margin-left: 30upx;
  253. border-bottom: 1px solid #f3f3f3;
  254. }
  255. .content-main-icon input{
  256. font-size: 30px;
  257. padding: 10upx;
  258. margin-left: 8px;
  259. font-weight: 600;
  260. }
  261. </style>