add-auth.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <template>
  2. <view class="add-auth">
  3. <custom-nav :title="title"></custom-nav>
  4. <view class="content">
  5. <view class="total">
  6. <view class="area">
  7. <text>
  8. 付款金额:<text class="basecolor">{{ total }}</text>
  9. </text>
  10. <text>元</text>
  11. </view>
  12. </view>
  13. <view class="add">
  14. <view class="imgs">
  15. <view class="choose" v-for="(item,index) in imgList" :key="index" @tap="ViewImage" :data-url="imgList[index]">
  16. <image :src="imgList[index]" mode="aspectFill"></image>
  17. <view class="del" @tap.stop="DelImg" :data-index="index">
  18. <text></text>
  19. </view>
  20. </view>
  21. <view class="choose" @tap="ChooseImage" v-if="imgList.length < 3">
  22. <text class="cuIcon-add"></text>
  23. </view>
  24. </view>
  25. <view class="remark">
  26. <textarea placeholder="添加备注"></textarea>
  27. </view>
  28. </view>
  29. <view class="big-btn bg">提交凭证</view>
  30. </view>
  31. </view>
  32. </template>
  33. <script>
  34. export default {
  35. data() {
  36. return {
  37. title: '添加凭证',
  38. total: '',
  39. imgList: ['https://p1.music.126.net/pzJpSxdcALY8_bsvMDkFeA==/18784056651018911.jpg?param=200y200']
  40. }
  41. },
  42. onLoad(opt) {
  43. this.total = opt.total
  44. },
  45. methods: {
  46. ChooseImage() {
  47. uni.chooseImage({
  48. count: 3 - this.imgList.length,
  49. sizeType: ['original '], //可以指定是原图还是压缩图,默认二者都有
  50. sourceType: ['album'], //从相册选择
  51. success: (res) => {
  52. this.imgList = this.imgList.concat(res.tempFilePaths)
  53. }
  54. });
  55. },
  56. ViewImage(e) {
  57. uni.previewImage({
  58. urls: this.imgList,
  59. current: e.currentTarget.dataset.url
  60. });
  61. },
  62. DelImg(e) {
  63. uni.showModal({
  64. title: '删除',
  65. content: '确定删除这张截图嘛?',
  66. cancelText: '取消',
  67. confirmText: '确定',
  68. success: res => {
  69. if (res.confirm) {
  70. this.imgList.splice(e.currentTarget.dataset.index, 1)
  71. }
  72. }
  73. })
  74. }
  75. }
  76. }
  77. </script>
  78. <style lang="scss">
  79. .add-auth {
  80. @include page();
  81. .content {
  82. .total {
  83. @include flex();
  84. height: 160rpx;
  85. background: #FFFFFF;
  86. margin-bottom: 10rpx;
  87. .area {
  88. @include flex();
  89. width: 690rpx;
  90. height: 90rpx;
  91. padding: 0 20rpx;
  92. border-radius: 10rpx;
  93. box-sizing: border-box;
  94. border: 2rpx solid #F5F5F5;
  95. justify-content: space-between;
  96. }
  97. }
  98. .add {
  99. .imgs {
  100. @include flex();
  101. height: 240rpx;
  102. background: #FFFFFF;
  103. margin-bottom: 2rpx;
  104. padding: 35rpx 30rpx;
  105. box-sizing: border-box;
  106. justify-content: flex-start;
  107. .choose {
  108. @include flex();
  109. width: 170rpx;
  110. height: 170rpx;
  111. position: relative;
  112. margin-right: 20rpx;
  113. border: 1rpx solid #999999;
  114. .del {
  115. @include flex();
  116. top: -15rpx;
  117. width: 30rpx;
  118. height: 30rpx;
  119. right: -15rpx;
  120. border-radius: 50%;
  121. position: absolute;
  122. background: $app-base-color;
  123. text {
  124. width: 19rpx;
  125. height: 3rpx;
  126. background: #FFFFFF;
  127. }
  128. }
  129. text {
  130. font-size: 60rpx;
  131. }
  132. image {
  133. width: 100%;
  134. height: 100%;
  135. }
  136. }
  137. }
  138. .remark {
  139. @include flex();
  140. height: 160rpx;
  141. background: #FFFFFF;
  142. textarea {
  143. width: 690rpx;
  144. height: 120rpx;
  145. padding: 20rpx;
  146. box-sizing: border-box;
  147. border: 2rpx solid #F5F5F5;
  148. }
  149. }
  150. }
  151. .big-btn {
  152. width: 480rpx;
  153. }
  154. }
  155. }
  156. </style>