offlinepayment.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <template>
  2. <view class="tui-userinfo-box">
  3. <form @submit="bindSave" report-submit="true">
  4. <tui-list-cell padding="0" :arrow="true" @click="chooseImg">
  5. <view class="tui-list-cell">
  6. <view>上传支付凭证</view>
  7. <image :src="imageurl || '/static/images/default_img.png'" class="tui-avatar"></image>
  8. </view>
  9. </tui-list-cell>
  10. <textarea name="remark" class="tui-textarea" placeholder="备注" maxlength="200" auto-focus></textarea>
  11. <view class="tui-btn__box">
  12. <tui-button formType="submit" type="danger" height="88rpx" shape="circle">提交</tui-button>
  13. </view>
  14. </form>
  15. <view v-if="settings.payqrcode" class="qrcodebox">
  16. <image :show-menu-by-longpress="true" :src="settings.payqrcode" mode="widthFix" style="width: 360rpx;"></image>
  17. <view>请长按保存付款码到相册</view>
  18. <view>用微信扫码支付,并上传付款截图</view>
  19. </view>
  20. </view>
  21. </template>
  22. <script>
  23. export default {
  24. data() {
  25. return {
  26. orderid: '',
  27. imageurl: '',
  28. paymethodinfo:{},
  29. settings:{}
  30. }
  31. },
  32. onLoad: function(e) {
  33. this.orderid = e.id;
  34. let _this = this
  35. _this.$request.post('Paymethod.getInfo',{code:'offline_pay'}).then(res => {
  36. if (res.errno == 0) {
  37. _this.paymethodinfo = res.data;
  38. if(_this.paymethodinfo.settings){
  39. _this.settings = _this.paymethodinfo.settings;
  40. }
  41. }
  42. })
  43. },
  44. onShow: function() {
  45. },
  46. methods: {
  47. chooseImg: function() {
  48. var that = this;
  49. uni.chooseImage({
  50. count: 1,
  51. // 默认9
  52. sizeType: ['original', 'compressed'],
  53. // 可以指定是原图还是压缩图,默认二者都有
  54. sourceType: ['album', 'camera'],
  55. // 可以指定来源是相册还是相机,默认二者都有
  56. success: function(res) {
  57. // 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片
  58. var tempFilePaths = res.tempFilePaths;
  59. that.imageurl = tempFilePaths
  60. that.offlineupload(tempFilePaths[0]);
  61. }
  62. });
  63. },
  64. offlineupload: function(path) {
  65. var _this = this;
  66. _this.$request.uploadFile(path).then(res => {
  67. _this.imageurl = res.url;
  68. });
  69. },
  70. bindSave: function(e) {
  71. var _this = this;
  72. //上传线下付款信息,
  73. var imageurl = this.imageurl;
  74. var remark = e.detail.value.remark;
  75. _this.$request.post('Order.offlinepayment', {
  76. orderid: this.orderid,
  77. image: imageurl,
  78. remark: remark
  79. }).then(res => {
  80. if (res.errno != 0) {
  81. uni.showToast({
  82. title: res.message,
  83. icon: 'none'
  84. });
  85. return;
  86. } else {
  87. uni.showModal({
  88. title: '提示',
  89. content: res.message,
  90. showCancel: false,
  91. //是否显示取消按钮
  92. success: function(res) {
  93. if (res.cancel) { //点击取消,默认隐藏弹框
  94. } else {
  95. uni.navigateTo({
  96. url: "/pagesA/submitOrder/success"
  97. });
  98. }
  99. }
  100. });
  101. }
  102. });
  103. }
  104. },
  105. /**
  106. * 页面相关事件处理函数--监听用户下拉动作
  107. */
  108. onPullDownRefresh: function() {
  109. setTimeout(() => {
  110. uni.stopPullDownRefresh()
  111. }, 200);
  112. },
  113. }
  114. </script>
  115. <style>
  116. .container {
  117. padding: 20rpx 0;
  118. }
  119. .tui-userinfo-box {
  120. margin: 20rpx 0;
  121. color: #333;
  122. }
  123. .tui-list-cell {
  124. width: 100%;
  125. display: flex;
  126. align-items: center;
  127. justify-content: space-between;
  128. padding: 24rpx 60rpx 24rpx 30rpx;
  129. box-sizing: border-box;
  130. font-size: 30rpx;
  131. }
  132. .tui-pr30 {
  133. padding-right: 30rpx;
  134. }
  135. .tui-avatar {
  136. width: 200rpx;
  137. height: 200rpx;
  138. display: block;
  139. }
  140. .tui-content {
  141. font-size: 26rpx;
  142. color: #666;
  143. }
  144. .tui-textarea {
  145. width: 100%;
  146. height: 300rpx;
  147. font-size: 28rpx;
  148. padding: 20rpx 30rpx;
  149. box-sizing: border-box;
  150. background-color: #fff;
  151. }
  152. .tui-btn__box {
  153. width: 100%;
  154. padding: 60rpx;
  155. box-sizing: border-box;
  156. }
  157. .qrcodebox {
  158. padding: 20rpx;
  159. text-align: center;
  160. }
  161. </style>