sunchengjie 9 kuukautta sitten
vanhempi
commit
9f187c79ce
1 muutettua tiedostoa jossa 43 lisäystä ja 37 poistoa
  1. 43 37
      src/pages/new/sureCombine.vue

+ 43 - 37
src/pages/new/sureCombine.vue

@@ -1,6 +1,6 @@
 <template>
     <div class="container">
-        <div v-show="isPhotoOrsize == '0'"> 
+        <div v-show="isPhotoOrsize == '图片'"> 
             <div style="padding: 20px 0;">合并签收以下快件:</div>
             <van-form @submit="onSubmit">
                 <van-field name="checkboxGroup">
@@ -15,15 +15,25 @@
                 </van-field>
 
                 <van-field readonly clickable name="shelfInformation" label="上传照片或签字板" lable-width="1000px" :value="currentSelect"
-                        placeholder="请选择货架" @click="isShelf = true" :rules="[{ required: true }]" />
+                        placeholder="请选择照片或签字板" @click="isShelf = true" :rules="[{ required: true }]" />
 
                 <van-popup v-model="isShelf" position="bottom">
                     <van-picker title="标题" show-toolbar :columns="shelfs" @confirm="onConfirm" @cancel="onCancel" />
                 </van-popup>
-                <div style="display: flex;justify-content: flex-start;">
-                    <span style="margin-left: 0.4rem; margin-right: 1rem;">图片显示:</span>
+
+                <div v-if="currentSelect == '签字板'" style="display: flex;justify-content: flex-start;">
+                    <span style="margin-left: 0.4rem; margin-right: 1rem;">签字版图片:</span>
                     <van-image  width="2rem" height="2rem" fit="contain" :src="canvasPhotoIMG"/>
                 </div>
+
+                <div v-if="currentSelect == '图片'">
+                    <van-field name="uploader" label="上传照片"  :rules="[{ required: true, message: '请上传图片' }]">
+                            <template #input>
+                                <van-uploader   multiple    :deletable="true"  
+                                @delete="onDelete" v-model="uploader" :after-read="afterRead" :before-read="beforeRead" :max-count="1" />
+                            </template>
+                    </van-field>
+                </div>
                
             
 
@@ -39,16 +49,7 @@
             </van-form>
         </div>
 
-        <div v-show="isPhotoOrsize == '图片'">
-            <van-field name="uploader" label="上传照片"  >
-                    <template #input>
-                        <van-uploader   multiple    :deletable="true"  
-                        @delete="onDelete" v-model="uploader" :after-read="afterRead" :before-read="beforeRead" :max-count="1" />
-                    </template>
-            </van-field>
-            <van-button type="default" native-type="button" @click="photoClose">取消</van-button>
-            <van-button type="default" native-type="button" @click="phoneSubmit">确定</van-button>
-        </div>
+      
 
         
         <div v-show="isPhotoOrsize == '签字板'">
@@ -81,7 +82,7 @@ export default {
             checkboxGroup: [],
             uploader: [],//图片
             isShelf:false,
-            isPhotoOrsize:'0',//控制展示
+            isPhotoOrsize:'图片',//控制展示
             currentSelect:'',
             shelfs:['图片', '签字板'],
             isDrawing: false,  
@@ -157,7 +158,7 @@ export default {
             this.context.stroke();  
         },  
         canvasClose() {
-            this.isPhotoOrsize = 0
+            this.isPhotoOrsize = '图片'
         },
         clearCanvas() {  
             this.context.clearRect(0, 0, this.width, this.height);  
@@ -179,7 +180,9 @@ export default {
                 console.log(this.getFileUrl,'=addresse')
             }); 
             this.currentSelect = "签字板"
-            this.isPhotoOrsize = 0
+            this.isPhotoOrsize = '图片'
+            this.context.clearRect(0, 0, this.width, this.height);  
+            this.hasContent = false;
         },  
 
 
@@ -187,7 +190,10 @@ export default {
             if(value == '签字板') {
                 this.show =true
             }
-            
+            if(value == '图片') {
+                this.uploader = []
+            }
+            this.currentSelect = value
             this.isPhotoOrsize = value
             this.isShelf = false
         },
@@ -235,27 +241,27 @@ export default {
         back() {
             this.$emit('isCombine', true)
         },
-        phoneSubmit() {
-            if (this.hasUploadedImage) {  
-                this.isPhotoOrsize = 0
-                this.currentSelect = '图片'
-                this.canvasPhotoIMG = this.photoIMG
-                console.log(this.photoIMG,'--123图片')
-            } else {  
-                this.$toast('请先上传图片');  
-            } 
+        // phoneSubmit() {
+        //     if (this.hasUploadedImage) {  
+        //         this.isPhotoOrsize = '图片'
+        //         this.currentSelect = '图片'
+        //         this.canvasPhotoIMG = this.photoIMG
+        //         console.log(this.photoIMG,'--123图片')
+        //     } else {  
+        //         this.$toast('请先上传图片');  
+        //     } 
            
-        },
-        photoClose() {
-            this.isPhotoOrsize = 0
-        },
+        // },
+        // photoClose() {
+        //     this.isPhotoOrsize = '图片'
+        // },
 
-        // 删除图片时的处理  
-        onDelete(file) {  
-            // 标记为未上传图片  
-            this.hasUploadedImage = false;  
-            console.log('已删除图片', file);  
-        }, 
+        // // 删除图片时的处理  
+        // onDelete(file) {  
+        //     // 标记为未上传图片  
+        //     this.hasUploadedImage = false;  
+        //     console.log('已删除图片', file);  
+        // }, 
     }
 
 };