gasApplyReject.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. <!-- 拒收气瓶 -->
  2. <template>
  3. <view id="register">
  4. <view class="register_li">
  5. <view class="register_li_min">
  6. <view>*</view>
  7. <view>拒收原因:</view>
  8. <input v-model="form.rejectionApplyRemark" type="text" placeholder="请输入拒收原因">
  9. </view>
  10. <view class="up-img-box">
  11. <view class="title-view">问题照片:</view>
  12. <view class="img-max-box">
  13. <view class="img-box" v-for="(item,index) in imgList" :key="index">
  14. <img class="img-data" :src="baseUrl+item">
  15. <img class="position-img" src="@/images/basicsModules/icon_ssp_closure.png" @click="delImg(index)">
  16. </view>
  17. <img class="add-button" src="@/images/basicsModules/icon_07.png" @click="selectImage" v-if="imgList.length<5">
  18. </view>
  19. </view>
  20. </view>
  21. <view class="sub_btn" @click="submitForm()">提交</view>
  22. </view>
  23. </template>
  24. <script>
  25. import {gasApplyYjsAdd } from '@/api/apiDemo/index.js'
  26. import { config } from '@/api/request/config.js'
  27. export default {
  28. data() {
  29. return {
  30. baseUrl:config.base_url,
  31. form:{
  32. rejectionApplyRemark:'',
  33. rejectionApplyImg:'',
  34. },
  35. imgList:[],
  36. item:{},//从列表传过来的值
  37. item2:{},//从列表传过来的值
  38. }
  39. },
  40. onLoad(option) {
  41. this.item=JSON.parse(decodeURIComponent(option.item));
  42. this.item2=JSON.parse(decodeURIComponent(option.item2));
  43. },
  44. onShow(){
  45. },
  46. methods: {
  47. // 图片上传
  48. selectImage(index) {
  49. let self = this;
  50. if(self.imgList.length>4){
  51. uni.showToast({
  52. title: '最多上传5张图片',
  53. icon:"none",
  54. mask:true,
  55. duration: 2000
  56. });
  57. return
  58. }
  59. wx.chooseImage({
  60. count: 1,
  61. sizeType: ["original", "compressed"],
  62. sourceType: ["album", "camera"],
  63. success: function(res) {
  64. let tempFilePaths = res.tempFilePaths[0];
  65. self.uploadImg(tempFilePaths,index);
  66. }
  67. });
  68. },
  69. async uploadImg(tempFilePaths,index){
  70. var self = this;
  71. uni.showLoading({
  72. title: '上传中',
  73. mask: true
  74. });
  75. uni.uploadFile({
  76. url: config.base_url+'/base/file/upload', //仅为示例,非真实的接口地址
  77. header:{'Authorization':uni.getStorageSync('token')},
  78. filePath: tempFilePaths,
  79. name: 'file',
  80. formData: {
  81. 'user': 'test'
  82. },
  83. success: (uploadFileRes) => {
  84. let res = JSON.parse(uploadFileRes.data);
  85. if(res.code == 200){
  86. self.imgList.push(res.data.url);
  87. }else{
  88. uni.showToast({
  89. title: res.msg,
  90. icon:"none",
  91. mask:true,
  92. duration: 2000
  93. });
  94. }
  95. },
  96. fail: err => {},
  97. complete: () => {
  98. uni.hideLoading()
  99. }
  100. });
  101. },
  102. //删除图片
  103. delImg(index){
  104. this.imgList.splice(index,1);
  105. },
  106. //提交
  107. async submitForm(){
  108. let _this = this;
  109. if(!_this.form.rejectionApplyRemark){
  110. uni.showToast({
  111. title: '请输入拒收原因',
  112. icon:"none",
  113. mask:true,
  114. duration: 2000
  115. });
  116. return
  117. }
  118. _this.form.carCode=_this.item2.car.carCode
  119. _this.form.carCodeId =_this.item2.car.id
  120. _this.form.phone=_this.item2.user.phone
  121. _this.form.driverName=_this.item2.user.userName
  122. _this.form.driverId=_this.item2.user.id
  123. _this.form.airStatus=1;
  124. _this.form.taskId=_this.item.taskId;
  125. _this.form.taskDetailId=_this.item.id;
  126. _this.form.rejectionApplyImg=_this.imgList.join(',')
  127. const {data} = await gasApplyYjsAdd(_this.form);
  128. if(data.code == 200){
  129. uni.showToast({
  130. title: '提交成功',
  131. icon:"none",
  132. mask:true,
  133. duration: 2000
  134. });
  135. setTimeout(function(){
  136. uni.redirectTo({
  137. url: '/pages_manage/gasBottle/gasApply/gasApply'
  138. });
  139. },2000);
  140. }
  141. },
  142. }
  143. }
  144. </script>
  145. <style lang="stylus" scoped>
  146. #register{
  147. height:100%;
  148. width:100%;
  149. display flex
  150. flex-direction column;
  151. padding-bottom: 220rpx;
  152. .register_li{
  153. background #fff;
  154. border-radius:20rpx;
  155. margin:20rpx 20rpx 0;
  156. padding:20rpx 0;
  157. box-sizing: border-box;
  158. .register_li_min{
  159. margin:0 26rpx;
  160. display flex;
  161. align-items center;
  162. border-bottom: 1px solid #F5F5F5;
  163. view{
  164. line-height:100rpx;
  165. font-size:28rpx;
  166. }
  167. view:nth-child(1){
  168. color:red;
  169. line-height:28rpx;
  170. margin-right: 12rpx;
  171. }
  172. view:nth-child(2){
  173. width:140rpx;
  174. font-size: 28rpx;
  175. font-family: PingFang SC;
  176. font-weight: 500;
  177. color: #333333;
  178. }
  179. >input{
  180. width 490rpx;
  181. text-align: right;
  182. font-size: 24rpx;
  183. font-family: PingFang SC;
  184. font-weight: 500;
  185. color: #CCCCCC;
  186. }
  187. }
  188. .up-img-box{
  189. display flex
  190. margin:34rpx 26rpx;
  191. .title-view{
  192. width:160rpx;
  193. line-height:80rpx;
  194. font-size: 30rpx;
  195. color:#333;
  196. }
  197. .img-max-box{
  198. width:510rpx;
  199. .img-box{
  200. display inline-block
  201. height:146rpx;
  202. width:146rpx;
  203. position relative
  204. margin:0 20rpx 20rpx 0;
  205. .img-data{
  206. height:146rpx;
  207. width:146rpx;
  208. }
  209. .position-img{
  210. position absolute
  211. right:0;
  212. top:0;
  213. width:36rpx;
  214. height:36rpx;
  215. }
  216. }
  217. .add-button{
  218. display inline-block
  219. height:150rpx;
  220. width:150rpx;
  221. }
  222. }
  223. }
  224. }
  225. /* 按钮 */
  226. .sub_btn{
  227. width: 650rpx;
  228. height: 100rpx;
  229. background: #0183FA;
  230. border-radius: 20rpx;
  231. font-size: 28rpx;
  232. font-family: PingFang SC;
  233. font-weight: 500;
  234. color: #FFFFFF;
  235. line-height: 100rpx;
  236. text-align: center;
  237. margin-left: 50rpx;
  238. position: fixed;
  239. bottom:30rpx;
  240. }
  241. }
  242. /deep/.input-value-border{
  243. display :none !important;
  244. }
  245. </style>