pay_out.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. <template>
  2. <view class="page">
  3. <view class="content">
  4. <view class="content-info">
  5. <image src="/static/theme/default/my/shoukuan2.png"></image>
  6. <text>二维码收款</text>
  7. </view>
  8. <view class="content-main">
  9. <text class="content-main-info">无需向我加好友,扫码向我付钱</text>
  10. <view v-if="pageParams.amount" class="amount-set-info">
  11. <text class="info-amount">¥{{pageParams.amount}}</text>
  12. <text class="info-text">{{pageParams.info}}</text>
  13. </view>
  14. <view class="content-main-qrCode">
  15. <tki-qrcode
  16. ref="qrcode"
  17. :val="qrData"
  18. :onval="true"
  19. :size="300"
  20. :iconSize="65"
  21. unit="upx"
  22. background="#ffffff"
  23. foreground="#000000"
  24. pdground="#000000"
  25. :loadMake="true"
  26. :showLoading="true"
  27. loadingText="加载中..."
  28. @result="qrR" />
  29. </view>
  30. <view class="content-main-footer">
  31. <view @tap="goPath('set_money')">{{set?'设置金额':'清除金额'}}</view>
  32. <!-- #ifndef MP-WEIXIN -->
  33. <view @click="saveImgToLocal">
  34. 保存收款码
  35. </view>
  36. <!-- #endif -->
  37. <!-- #ifdef MP-WEIXIN -->
  38. <view v-if="openSettingBtnHidden" class="purple_btn btn_box" @click="saveImg">
  39. 保存收款码
  40. </view>
  41. <button v-else hover-class="none" open-type="openSetting" @opensetting='handleSetting'>保存收款码</button>
  42. <!-- #endif -->
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. </template>
  48. <script>
  49. import _hook from '../../../common/_hook';
  50. import _data from '../../../common/_data';
  51. import _page from '../../../common/common';
  52. import tkiQrcode from "../../../components/tki-qrcode/tki-qrcode.vue";
  53. export default {
  54. data() {
  55. return {
  56. img_path:'',
  57. my_data:{},
  58. pageParams:{
  59. amount:'',
  60. info:'',
  61. },
  62. set:true,
  63. openSettingBtnHidden:true,
  64. qrParams:{
  65. }
  66. }
  67. },
  68. components:{
  69. tkiQrcode
  70. },
  71. onShow(){
  72. _hook.routeSonHook();
  73. console.log(this.pageParams)
  74. let _this = this;
  75. /** 监听新的个人数据 */
  76. uni.$on('data_user_info',function(data){
  77. _this.my_data = data;
  78. });
  79. uni.$on('update_money_info',function (data) {
  80. _this.pageParams = data;
  81. console.log(data)
  82. if(_this.pageParams.amount)_this.set = false;
  83. })
  84. _this.my_data = _data.data('user_info');
  85. },
  86. onLoad(options){
  87. console.log(options)
  88. },
  89. computed:{
  90. qrData(){
  91. this.pageParams.user_id = this.my_data.id;
  92. return _page.qrAction.toPage("/pages/my/pay/user_pay",this.pageParams);
  93. },
  94. qrPhoto(){
  95. return _data.data('cache').local_photo;
  96. },
  97. myPhoto(){
  98. return _data.staticPhoto() + this.my_data.photo;
  99. },
  100. },
  101. methods: {
  102. handleSetting(e){
  103. if (!e.detail.authSetting['scope.writePhotosAlbum']) {
  104. this.openSettingBtnHidden = false;
  105. } else {
  106. this.openSettingBtnHidden = true;
  107. }
  108. },
  109. saveImgToLocal(){
  110. //#ifndef H5
  111. _page.capture();
  112. //#endif
  113. //#ifdef H5
  114. _page.imgPreview([this.img_path],0);
  115. //#endif
  116. },
  117. saveImg(){
  118. let _this =this;
  119. params['local'] = this.img_path
  120. _page.saveMpImg(params,function () {
  121. _this.openSettingBtnHidden = false;
  122. },function () {
  123. uni.showToast({
  124. title:'保存成功',
  125. icon:'none'
  126. })
  127. })
  128. },
  129. qrR(ref){
  130. this.img_path = ref;
  131. },
  132. goPath(path){
  133. if(!this.set){
  134. this.pageParams.amount = '';
  135. this.pageParams.info = '';
  136. this.set = true;
  137. return false;
  138. }
  139. if(path){
  140. let _this = this;
  141. uni.navigateTo({
  142. url:path,
  143. success:function () {
  144. }
  145. })
  146. }
  147. },
  148. }
  149. }
  150. </script>
  151. <style>
  152. .info-amount,.info-text{
  153. display: flex;
  154. width: 100%;
  155. flex: 1;
  156. align-items: center;
  157. justify-content: center;
  158. }
  159. .info-text{
  160. color: black;
  161. font-weight: 400;
  162. font-size: 16px;
  163. }
  164. .content-main-qrCode{
  165. margin-top: 30upx;
  166. }
  167. .amount-set-info .info-amount{
  168. font-size: 20px;
  169. font-weight: 600;
  170. color: black;
  171. display: flex;
  172. justify-content: center;
  173. align-items: center;
  174. flex-direction: column;
  175. }
  176. .content-main-footer{
  177. display: flex;
  178. width: 100%;
  179. }
  180. .content-main-info{
  181. margin: 50upx 0 10upx 0;
  182. }
  183. .content-main-footer view{
  184. display: flex;
  185. justify-content: center;
  186. align-items: center;
  187. flex: 1;
  188. margin: 30upx 0;
  189. color: #443d80;
  190. }
  191. .page{
  192. display: flex;
  193. justify-content: center;
  194. align-items: center;
  195. width: 100%;
  196. }
  197. .content-main{
  198. color: #c6c6c6;
  199. display: flex;
  200. flex-direction: column;
  201. justify-content: center;
  202. align-items: center;
  203. }
  204. .content-info{
  205. border-bottom: 1px solid #d6d6d6;
  206. display: flex;
  207. justify-content: start;
  208. align-items: center;
  209. }
  210. .content-info image{
  211. width: 50upx;
  212. height: 55upx;
  213. padding: 20upx;
  214. }
  215. .content-info text{
  216. color: #5691cb;
  217. }
  218. .content{
  219. width: 90%;
  220. border-radius: 10upx;
  221. background-color: white;
  222. }
  223. page{
  224. /*7197bc*/
  225. background-color: #5691cb;
  226. }
  227. </style>