Explorar o código

Merge branch '黄色' into allTestUrgent

xiaohaizhao hai 11 horas
pai
achega
50abc520f2
Modificáronse 2 ficheiros con 115 adicións e 51 borrados
  1. 15 18
      src/HDrpManagement/recvoucher/details/index.vue
  2. 100 33
      src/components/customBtn/index.vue

+ 15 - 18
src/HDrpManagement/recvoucher/details/index.vue

@@ -40,6 +40,8 @@
           :dialog="true"
           dialogTitle="请输入对冲金额"
           dialogKey="amount"
+          dialogNoteLabel="请输入备注"
+          dialogNoteKey="remarks"
           :id="$route.query.id"
           @onSuccess="duichong"
           class="inline-16"
@@ -111,25 +113,20 @@ export default {
       this.changeDataStructure()
     },
     duichong (data) {
-      this.$store.dispatch('changeDetailDrawer',false)
-      this.$router.push('/recvoucher')
-      this.$router.replace({
-        path:'/recvoucherDetails',
-        query:{
-          id:data.sa_cashbillid,
-        }
-      })
-      setTimeout(() => {
-       /* this.$router.replace({
-          path:'/recvoucherDetails',
-          query:{
-            id:data.sa_cashbillid,
-          }
-        })*/
-        this.$store.dispatch('changeDetailDrawer',true)
-        /*this.queryMainData(this.$route.query.id)*/
-      })
+      this.queryMainData(this.$route.query.id)
+      this.$refs.hedgeVoucher && this.$refs.hedgeVoucher.listData()
+      this.$refs.bill && this.$refs.bill.listData()
 
+      this.$confirm(this.$t('对冲成功,是否前往新单据?'), this.$t('提示'), {
+        confirmButtonText: this.$t('前往'),
+        cancelButtonText: this.$t('留在当前'),
+        type: 'success'
+      }).then(() => {
+        this.$router.replace({ path: '/recvoucherDetails', query: { id: data.sa_cashbillid } })
+        this.queryMainData(data.sa_cashbillid)
+        this.$refs.hedgeVoucher && this.$refs.hedgeVoucher.listData()
+        this.$refs.bill && this.$refs.bill.listData()
+      }).catch(() => {})
     },
     changeDataStructure(){
       let that = this

+ 100 - 33
src/components/customBtn/index.vue

@@ -6,6 +6,24 @@
       :size="size ? size : 'mini'"
       @click="submit"
     >{{ $t(btnName) }}</el-button>
+    <el-dialog
+      v-if="dialogNoteLabel"
+      :title="$t('提示')"
+      :visible.sync="noteDialogVisible"
+      width="400px"
+      :append-to-body="true"
+    >
+      <div>
+        <div style="margin-bottom: 5px; font-size: 14px; color: #606266;">{{ $t(dialogTitle) }}</div>
+        <el-input v-model="dialogAmount"></el-input>
+        <div style="margin: 10px 0 5px; font-size: 14px; color: #606266;">{{ $t(dialogNoteLabel) }}</div>
+        <el-input v-model="dialogNote"></el-input>
+      </div>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="noteDialogVisible = false">{{ $t('取消') }}</el-button>
+        <el-button type="primary" @click="confirmNoteDialog">{{ confirmButtonText ? $t(confirmButtonText) : $t('确定') }}</el-button>
+      </span>
+    </el-dialog>
   </div>
 </template>
 
@@ -35,54 +53,66 @@ export default {
     size: String,
     delType: String,
     errorMessage:String,
-    confirmButtonText:String
+    confirmButtonText:String,
+    dialogNoteLabel: String,
+    dialogNoteKey: { type: String, default: 'note' }
   },
   data() {
-    return {};
+    return {
+      dialogAmount: '',
+      dialogNote: '',
+      noteDialogVisible: false
+    };
   },
   computed: {},
   watch: {},
   methods: {
     submit() {
       if (this.dialog) {
-        this.$prompt(this.$t(this.dialogTitle), this.$t("提示"), {
-          confirmButtonText: this.confirmButtonText?this.$t(this.confirmButtonText):this.$t("确定"),
-          cancelButtonText: this.$t("取消"),
-          inputPattern: this.checkContent ? /^[\d.]+$/ : this.checkString ? /^\S.*$/ : "",
-          inputErrorMessage: this.$t(this.errorMessage)
-        }).then(async ({ value }) => {
-          let param = {
-            content: {},
-          };
-          param.id = this.idName;
-          param.content[this.keyName] = this.idIsArr ? [this.id] : this.id;
-          this.paramData.forEach((item) => {
-            param.content[item.key] = item.value;
-          });
-          param.content[this.dialogKey] = value;
-          let res = await this.$api.requested(param);
-          if (this.delType === "合作伙伴") {
-            if (res.code === 0) {
-              this.$message({
-                message: res.data[0].errmsg,
-                type: "error",
-              });
+        if (this.dialogNoteLabel) {
+          this.dialogAmount = '';
+          this.dialogNote = '';
+          this.noteDialogVisible = true;
+        } else {
+          this.$prompt(this.$t(this.dialogTitle), this.$t("提示"), {
+            confirmButtonText: this.confirmButtonText?this.$t(this.confirmButtonText):this.$t("确定"),
+            cancelButtonText: this.$t("取消"),
+            inputPattern: this.checkContent ? /^[\d.]+$/ : this.checkString ? /^\S.*$/ : "",
+            inputErrorMessage: this.$t(this.errorMessage)
+          }).then(async ({ value }) => {
+            let param = {
+              content: {},
+            };
+            param.id = this.idName;
+            param.content[this.keyName] = this.idIsArr ? [this.id] : this.id;
+            this.paramData.forEach((item) => {
+              param.content[item.key] = item.value;
+            });
+            param.content[this.dialogKey] = value;
+            let res = await this.$api.requested(param);
+            if (this.delType === "合作伙伴") {
+              if (res.code === 0) {
+                this.$message({
+                  message: res.data[0].errmsg,
+                  type: "error",
+                });
+              } else {
+                this.tool.showMessage(res, () => {
+                  this.$emit("onSuccess", res.data);
+                });
+              }
             } else {
               this.tool.showMessage(res, () => {
                 this.$emit("onSuccess", res.data);
               });
             }
-          } else {
-            this.tool.showMessage(res, () => {
-              this.$emit("onSuccess", res.data);
+          }).catch(() => {
+            this.$message({
+              type: 'info',
+              message: this.$t('已取消')
             });
-          }
-        }).catch(() => {
-          this.$message({
-            type: 'info',
-            message: this.$t('已取消')
           });
-        });
+        }
       } else {
         this.$confirm(this.$t(this.message), this.$t("提示"), {
           confirmButtonText: this.confirmButtonText?this.$t(this.confirmButtonText):this.$t("确定"),
@@ -109,6 +139,43 @@ export default {
         });
       }
     },
+    async confirmNoteDialog() {
+      if (!this.dialogAmount) {
+        this.$message({ message: this.$t('请输入金额'), type: 'warning' });
+        return;
+      }
+      if (this.checkContent && !/^[\d.]+$/.test(this.dialogAmount)) {
+        this.$message({ message: this.$t(this.errorMessage || '请输入正确的数字'), type: 'error' });
+        return;
+      }
+      let param = {
+        content: {},
+      };
+      param.id = this.idName;
+      param.content[this.keyName] = this.idIsArr ? [this.id] : this.id;
+      this.paramData.forEach((item) => {
+        param.content[item.key] = item.value;
+      });
+      param.content[this.dialogKey] = this.dialogAmount;
+      param.content[this.dialogNoteKey] = this.dialogNote;
+      let res = await this.$api.requested(param);
+      if (this.delType === '合作伙伴') {
+        if (res.code === 0) {
+          this.$message({ message: res.data[0].errmsg, type: 'error' });
+          return;
+        } else {
+          this.noteDialogVisible = false;
+          this.tool.showMessage(res, () => {
+            this.$emit('onSuccess', res.data);
+          });
+        }
+      } else {
+        this.noteDialogVisible = false;
+        this.tool.showMessage(res, () => {
+          this.$emit('onSuccess', res.data);
+        });
+      }
+    }
   },
 };
 </script>