upPj.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. <template>
  2. <view class="center">
  3. <view class="upload" >
  4. <view class="upload-title">上传支付截图</view>
  5. <view class="upload-main" v-for="(item,index) in pjList">
  6. <image v-if="!item" class="upload-image" src="../../static/img/add.png" mode="" @click="upimg(index)"></image>
  7. <image v-else :src="item" mode="" class="upload-image" @click="upimg(index)"></image>
  8. </view>
  9. </view>
  10. <view class="bottom flex">
  11. <view class="btn" @click="goUp()">立即上传</view>
  12. </view>
  13. </view>
  14. </template>
  15. <script>
  16. import { upload,upPj,wuyouUpPj } from '@/api/order.js';
  17. import {
  18. getCardInfo,
  19. upEvaluation
  20. } from '@/api/zero.js'
  21. export default {
  22. data() {
  23. return {
  24. tabCurrentIndex: 1,
  25. info: {},
  26. pz: '',
  27. pzing: false,
  28. pjList: [''],
  29. type: 0
  30. };
  31. },
  32. onLoad(opt) {
  33. if (opt.id) {
  34. this.id = opt.id
  35. }
  36. if(opt.type) {
  37. this.type = opt.type
  38. }
  39. },
  40. methods: {
  41. lookImg(img) {
  42. let arr = img.split(',')
  43. uni.previewImage({
  44. current: 0,
  45. loop: false,
  46. urls: arr,
  47. indicator: 'default'
  48. });
  49. },
  50. //上传凭证
  51. goUp() {
  52. if(this.pzing) {
  53. return
  54. }
  55. // if(!this.pz) {
  56. // return this.$api.msg('请上传支付截图')
  57. // }
  58. this.pzing = true
  59. let upup;
  60. if(this.type == 1) {
  61. upup = wuyouUpPj
  62. }else {
  63. upup = upPj
  64. }
  65. upup({
  66. order_id: this.id,
  67. auth_up_file: this.pjList.filter(item => item !== '').join(',')
  68. }).then(res => {
  69. uni.showToast({
  70. title:'上传成功',
  71. duration:2000
  72. });
  73. this.pzing = false
  74. setTimeout(()=> {
  75. uni.navigateBack()
  76. },1500)
  77. }).catch(err => {
  78. this.pzing = false
  79. })
  80. },
  81. openAuth() {
  82. this.$refs['WRITE_EXTERNAL_STORAGE'].open()
  83. },
  84. changeAuth() {
  85. this.upimg()
  86. },
  87. upimg(index) {
  88. upload({
  89. file: '',
  90. stype: 3
  91. })
  92. .then(e => {
  93. console.log(e,'e')
  94. this.pjList.splice(index,1,e[0].url)
  95. if(this.pjList.length < 5) {
  96. this.pjList.push('')
  97. }
  98. console.log(this.pjList)
  99. })
  100. .catch(e => {});
  101. },
  102. getInfo() {
  103. getCardInfo({
  104. id: this.id
  105. }).then(res => {
  106. // console.log(info)
  107. this.info = res.data.result
  108. })
  109. },
  110. open() {
  111. this.$refs.popup.open();
  112. },
  113. close() {
  114. this.$refs.popup.close();
  115. },
  116. nav(url) {
  117. uni.navigateTo({
  118. url
  119. });
  120. },
  121. //swiper 切换
  122. changeTab(e) {
  123. this.tabCurrentIndex = e.target.current;
  124. },
  125. toBack() {
  126. uni.navigateBack({});
  127. },
  128. change(num) {
  129. this.tabCurrentIndex = num * 1;
  130. }
  131. }
  132. };
  133. </script>
  134. <style lang="scss">
  135. .center {
  136. background: #f8f6f6;
  137. min-height: 100%;
  138. height: auto;
  139. }
  140. .bottom {
  141. position: fixed;
  142. bottom: 0;
  143. background: #ffffff;
  144. width: 750rpx;
  145. height: 146rpx;
  146. justify-content: center;
  147. .bottom-item {
  148. margin-left: 30rpx;
  149. display: flex;
  150. flex-direction: column;
  151. align-items: center;
  152. .bi-image {
  153. width: 38rpx;
  154. height: 34rpx;
  155. }
  156. .bottom-font {
  157. margin-top: 14rpx;
  158. font-size: 24rpx;
  159. font-weight: bold;
  160. color: #333333;
  161. }
  162. .bottom-num {
  163. line-height: 1;
  164. font-size: 24rpx;
  165. font-weight: bold;
  166. color: #333333;
  167. }
  168. }
  169. .shu {
  170. margin-left: 20rpx;
  171. width: 2px;
  172. height: 74rpx;
  173. background: #c0bfc0;
  174. }
  175. .btn {
  176. margin-left: 40rpx;
  177. width: 430rpx;
  178. height: 80rpx;
  179. background: $base-color;
  180. border-radius: 20rpx;
  181. text-align: center;
  182. font-size: 34rpx;
  183. font-weight: bold;
  184. color: #ffffff;
  185. line-height: 80rpx;
  186. }
  187. }
  188. .upload {
  189. margin-top: 20rpx;
  190. padding: 34rpx 30rpx 40rpx 30rpx;
  191. background: #ffffff;
  192. .upload-title {
  193. font-size: 30rpx;
  194. font-weight: bold;
  195. color: #333333;
  196. }
  197. .upload-main {
  198. padding-top: 32rpx;
  199. display: flex;
  200. justify-content: center;
  201. align-items: center;
  202. flex-direction: column;
  203. .upload-image {
  204. width: 160rpx;
  205. height: 160rpx;
  206. border-radius: 10rpx;
  207. }
  208. .upload-font {
  209. margin-top: 24rpx;
  210. font-size: 30rpx;
  211. font-weight: bold;
  212. color: #333333;
  213. }
  214. }
  215. }
  216. </style>