order-addpay.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. <template>
  2. <view class="container qualifications">
  3. <view class="qualifications-content">
  4. <view class="list-view-title"><text class="none">*</text>支付凭证图片:</view>
  5. <view class="list-view-upload clearfix">
  6. <view class="photo-item" v-for="(item, imageIndex) in imageList" :key="imageIndex">
  7. <image :src="item" mode="aspectFill" @click.stop="previewImg(item)"></image>
  8. <text class="iconfont icon-iconfontguanbi" @click.stop="deletePhotoFn(imageIndex)"></text>
  9. </view>
  10. <view class="photo-item add" @click.stop="uploadPhotoFn" v-if="imageList.length<5 || imageList.length == 0">
  11. <text class="iconfont icon-jiahao"></text>
  12. </view>
  13. </view>
  14. <view class="list-view-title">备注:</view>
  15. <view class="list-view-text">
  16. <textarea class="textarea" v-model="params.remarks" placeholder="请输入备注信息" />
  17. </view>
  18. </view>
  19. <view class="card-mains-btn">
  20. <button
  21. class="add-btn"
  22. :disabled="disabled"
  23. :class="[disabled ? 'disabled' : '']"
  24. @click="orderInsertVoucher"
  25. >
  26. 提交
  27. </button>
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. import { mapState,mapMutations } from 'vuex'
  33. import { uploadFileImage } from '@/services/public.js'
  34. export default{
  35. data() {
  36. return{
  37. isIphoneX:this.$store.state.isIphoneX,
  38. isPreviewImg:false,
  39. imageList:[],
  40. params:{
  41. id:0,
  42. orderId:0,
  43. remarks:'',
  44. voucherImgs:''
  45. },
  46. }
  47. },
  48. onLoad(option) {
  49. console.log(option)
  50. this.params.orderId = option.orderId
  51. },
  52. computed: {
  53. disabled() {
  54. return !(this.imageList.length > 0)
  55. }
  56. },
  57. methods:{
  58. async orderInsertVoucher(){
  59. try{
  60. this.params.voucherImgs = this.imageList.join('##')
  61. console.log('params',this.params)
  62. const res = await this.OrderService.orderInsertVoucher(this.params)
  63. this.$util.msg('保存成功', 2000, true, 'success')
  64. setTimeout(()=>{
  65. this.$api.navigateBack(1)
  66. },2000)
  67. }catch(error){
  68. console.log('error',error)
  69. }
  70. },
  71. async uploadPhotoFn(){//添加图片
  72. try{
  73. const res = await uploadFileImage()
  74. const data = JSON.parse(res.data).data
  75. this.imageList.push(data)
  76. console.log('imageList',this.imageList)
  77. }catch(e){
  78. console.log('1111111111')
  79. }
  80. },
  81. deletePhotoFn(index){//删除图片
  82. this.imageList.splice(index, 1)
  83. },
  84. previewImg (image) {//顶部商品图片预览
  85. this.isPreviewImage = true
  86. let urls = []
  87. urls.push(image)
  88. uni.previewImage({
  89. urls: urls,
  90. current: 0
  91. })
  92. },
  93. },
  94. onShow() {
  95. }
  96. }
  97. </script>
  98. <style lang="scss">
  99. page {
  100. height: auto;
  101. background:#FFFFFF;
  102. }
  103. .qualifications-content{
  104. width: 100%;
  105. height: auto;
  106. box-sizing: border-box;
  107. padding: 0 24rpx;
  108. .list-view-title{
  109. width: 100%;
  110. height: 92rpx;
  111. line-height: 92rpx;
  112. font-size: $font-size-30;
  113. color: #333333;
  114. text-align: left;
  115. .none{
  116. color: #F85050;
  117. }
  118. }
  119. .list-view-text{
  120. width: 100%;
  121. height: 216rpx;
  122. box-sizing: border-box;
  123. border: 1px solid #e1e1e1;
  124. padding: 20rpx;
  125. border-radius: 6rpx;
  126. .textarea{
  127. width: 100%;
  128. height: 100%;
  129. }
  130. }
  131. .list-view-upload{
  132. width: 100%;
  133. height: auto;
  134. padding: 10rpx 0;
  135. .photo-item{
  136. display: inline-block;
  137. width: 150rpx;
  138. height: 150rpx;
  139. margin: 10rpx 0;
  140. margin-right: 25rpx;
  141. border-radius: 10rpx;
  142. border:1px dashed #B8BFCA;
  143. position: relative;
  144. float: left;
  145. &.add{
  146. width: 150rpx;
  147. height: 150rpx;
  148. border-color: #b2b2b2;
  149. text-align: center;
  150. line-height: 150rpx;
  151. margin-right: 0rpx;
  152. .icon-jiahao{
  153. font-size: $font-size-44;
  154. color:#b2b2b2 ;
  155. font-weight: bold;
  156. }
  157. }
  158. .icon-iconfontguanbi{
  159. width: 30rpx;
  160. height: 30rpx;
  161. border-radius:50%;
  162. display: block;
  163. position: absolute;
  164. right: -10rpx;
  165. top: -10rpx;
  166. background: #f94b4b;
  167. text-align: center;
  168. line-height: 30rpx;
  169. color: #FFFFFF;
  170. font-size: $font-size-22;
  171. }
  172. image{
  173. width: 100%;
  174. height: 100%;
  175. border-radius: 10rpx;
  176. display: block;
  177. }
  178. }
  179. .photo-list{
  180. width: 100%;
  181. height: 116rpx;
  182. overflow: hidden;
  183. white-space: nowrap;
  184. display: flex;
  185. align-items: flex-start;
  186. }
  187. .scoll-wrapper{
  188. display:flex;
  189. align-items: flex-start;
  190. }
  191. }
  192. }
  193. .card-mains-btn {
  194. width: 100%;
  195. height: auto;
  196. box-sizing: border-box;
  197. padding: 0 75rpx;
  198. margin-top: 180rpx;
  199. .add-btn {
  200. width: 100%;
  201. height: 90rpx;
  202. font-size: $font-size-30;
  203. line-height: 90rpx;
  204. color: #ffffff;
  205. text-align: center;
  206. background: $btn-confirm;
  207. border-radius: 45rpx;
  208. border-radius: 44rpx;
  209. margin-top: 80rpx;
  210. &.disabled {
  211. background: #e1e1e1;
  212. border-radius: 44rpx;
  213. }
  214. }
  215. }
  216. </style>