123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257 |
- <!-- 拒收气瓶 -->
- <template>
- <view id="register">
- <view class="register_li">
- <view class="register_li_min">
- <view>*</view>
- <view>拒收原因:</view>
- <input v-model="form.rejectionApplyRemark" type="text" placeholder="请输入拒收原因">
- </view>
- <view class="up-img-box">
- <view class="title-view">问题照片:</view>
- <view class="img-max-box">
- <view class="img-box" v-for="(item,index) in imgList" :key="index">
- <img class="img-data" :src="baseUrl+item">
- <img class="position-img" src="@/images/basicsModules/icon_ssp_closure.png" @click="delImg(index)">
- </view>
- <img class="add-button" src="@/images/basicsModules/icon_07.png" @click="selectImage" v-if="imgList.length<5">
- </view>
- </view>
- </view>
- <view class="sub_btn" @click="submitForm()">提交</view>
- </view>
- </template>
- <script>
- import {gasApplyYjsAdd } from '@/api/apiDemo/index.js'
- import { config } from '@/api/request/config.js'
- export default {
- data() {
- return {
- baseUrl:config.base_url,
- form:{
- rejectionApplyRemark:'',
- rejectionApplyImg:'',
- },
- imgList:[],
- item:{},//从列表传过来的值
- item2:{},//从列表传过来的值
- }
- },
- onLoad(option) {
- this.item=JSON.parse(decodeURIComponent(option.item));
- this.item2=JSON.parse(decodeURIComponent(option.item2));
- },
- onShow(){
- },
- methods: {
- // 图片上传
- selectImage(index) {
- let self = this;
- if(self.imgList.length>4){
- uni.showToast({
- title: '最多上传5张图片',
- icon:"none",
- mask:true,
- duration: 2000
- });
- return
- }
- wx.chooseImage({
- count: 1,
- sizeType: ["original", "compressed"],
- sourceType: ["album", "camera"],
- success: function(res) {
- let tempFilePaths = res.tempFilePaths[0];
- self.uploadImg(tempFilePaths,index);
- }
- });
- },
- async uploadImg(tempFilePaths,index){
- var self = this;
- uni.showLoading({
- title: '上传中',
- mask: true
- });
- uni.uploadFile({
- url: config.base_url+'/base/file/upload', //仅为示例,非真实的接口地址
- header:{'Authorization':uni.getStorageSync('token')},
- filePath: tempFilePaths,
- name: 'file',
- formData: {
- 'user': 'test'
- },
- success: (uploadFileRes) => {
- let res = JSON.parse(uploadFileRes.data);
- if(res.code == 200){
- self.imgList.push(res.data.url);
- }else{
- uni.showToast({
- title: res.msg,
- icon:"none",
- mask:true,
- duration: 2000
- });
- }
- },
- fail: err => {},
- complete: () => {
- uni.hideLoading()
- }
- });
- },
- //删除图片
- delImg(index){
- this.imgList.splice(index,1);
- },
- //提交
- async submitForm(){
- let _this = this;
- if(!_this.form.rejectionApplyRemark){
- uni.showToast({
- title: '请输入拒收原因',
- icon:"none",
- mask:true,
- duration: 2000
- });
- return
- }
- _this.form.carCode=_this.item2.car.carCode
- _this.form.carCodeId =_this.item2.car.id
- _this.form.phone=_this.item2.user.phone
- _this.form.driverName=_this.item2.user.userName
- _this.form.driverId=_this.item2.user.id
- _this.form.airStatus=1;
- _this.form.taskId=_this.item.taskId;
- _this.form.taskDetailId=_this.item.id;
- _this.form.rejectionApplyImg=_this.imgList.join(',')
- const {data} = await gasApplyYjsAdd(_this.form);
- if(data.code == 200){
- uni.showToast({
- title: '提交成功',
- icon:"none",
- mask:true,
- duration: 2000
- });
- setTimeout(function(){
- uni.redirectTo({
- url: '/pages_manage/gasBottle/gasApply/gasApply'
- });
- },2000);
- }
- },
- }
- }
- </script>
- <style lang="stylus" scoped>
- #register{
- height:100%;
- width:100%;
- display flex
- flex-direction column;
- padding-bottom: 220rpx;
- .register_li{
- background #fff;
- border-radius:20rpx;
- margin:20rpx 20rpx 0;
- padding:20rpx 0;
- box-sizing: border-box;
- .register_li_min{
- margin:0 26rpx;
- display flex;
- align-items center;
- border-bottom: 1px solid #F5F5F5;
- view{
- line-height:100rpx;
- font-size:28rpx;
- }
- view:nth-child(1){
- color:red;
- line-height:28rpx;
- margin-right: 12rpx;
- }
- view:nth-child(2){
- width:140rpx;
- font-size: 28rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #333333;
- }
- >input{
- width 490rpx;
- text-align: right;
- font-size: 24rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #CCCCCC;
- }
- }
- .up-img-box{
- display flex
- margin:34rpx 26rpx;
- .title-view{
- width:160rpx;
- line-height:80rpx;
- font-size: 30rpx;
- color:#333;
- }
- .img-max-box{
- width:510rpx;
- .img-box{
- display inline-block
- height:146rpx;
- width:146rpx;
- position relative
- margin:0 20rpx 20rpx 0;
- .img-data{
- height:146rpx;
- width:146rpx;
- }
- .position-img{
- position absolute
- right:0;
- top:0;
- width:36rpx;
- height:36rpx;
- }
- }
- .add-button{
- display inline-block
- height:150rpx;
- width:150rpx;
- }
- }
- }
- }
- /* 按钮 */
- .sub_btn{
- width: 650rpx;
- height: 100rpx;
- background: #0183FA;
- border-radius: 20rpx;
- font-size: 28rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #FFFFFF;
- line-height: 100rpx;
- text-align: center;
- margin-left: 50rpx;
- position: fixed;
- bottom:30rpx;
- }
- }
- /deep/.input-value-border{
- display :none !important;
- }
- </style>
|