index.js 6.59 KB
Newer Older
fukai committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217
import Api from '~/service/Api';
import { getTrnNameByInr } from "~/service/business/common";
import moment from 'moment';
import Utils from "~/utils"
import commonFunctions from '~/mixin/commonFunctions.js';

export default {
  mixins: [commonFunctions],
  methods: {
    async handleSearch() {
      const loading = this.loading();
      let param = {
        act: this.model.signinfo.act,
        channel: this.model.signinfo.channel,
        paytyp: this.model.signinfo.paytyp,
        extkey: this.model.signinfo.extkey,
        scenecode: this.model.signinfo.scenecode,
        inidatfro: this.model.signinfo.inidatfro ? moment(this.model.signinfo.inidatfro).format('YYYY-MM-DD') + ' 00:00:00' : "",
        inidattil: this.model.signinfo.inidattil ? moment(this.model.signinfo.inidattil).format('YYYY-MM-DD') + ' 23:59:59' : "", 
        pageNumber: this.pagination.pageIndex,
        pageSize: this.pagination.pageSize,
      };
      let rtnmsg = await Api.post('/Remittance/autosign/list',param);
      if (rtnmsg.respCode == SUCCESS) {
        this.stmData.data = [];
        this.stmData.data = rtnmsg.data.list;
        this.pagination.total = rtnmsg.data.total;
      } else {
        this.$notify.error({ title: '错误', message: '服务请求失败!' });
      }
      loading.close();
    },
    // pageSize改变
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
      this.pagination.pageIndex = 1;
      this.pagination.pageSize = val;
      this.handleSearch();
    },
    // 页码改变
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
      this.pagination.pageIndex = val;
      this.handleSearch();
    },

    clearDialogData() {
      Object.keys(this.model.signinfo).forEach(key => (this.model.signinfo[key] = ''));
      this.model.signinfo.pye = {
          ptytyp:'',
				  pts: new Pts().data,
      };
    },
    selectableFn(row) {
      return true;
    },
    sigAdd() {
			this.routerPush({
        path: "/business/auasig",
      });
    },
    handleEdit(row) {
			this.routerPush({
				path: "/business/auesig",
				query: { inr : row.inr}
      });
    },
    handleDeleteOne(row) {
      this.$confirm("确定删除选中的数据?", "提示", {
        confirmButtonText: "确认",
        cancelButtonText: "取消",
        type: "warning",
      }).then(async () => {
        const loading = this.loading();
        let params = {
          inrs:[]
        }
        params.inrs.push(row.inr);
        let rtnmsg = await Api.post('/Remittance/autosign/delete',params);
        if (rtnmsg.respCode == SUCCESS) {
          this.$notify({title: '成功',message: '删除成功',type: 'success',duration: 1000})
          this.handleSearch();
        } else {
          this.$notify.error({ title: '错误', message: '服务请求失败!' });
        }
        loading.close();
      });
    },
    handleDelete() {
      this.$confirm("确定删除选中的数据?", "提示", {
        confirmButtonText: "确认",
        cancelButtonText: "取消",
        type: "warning",
      }).then(async () => {
        const loading = this.loading();
        let params = {
          inrs:[]
        }
        params.inrs = this.multipleSelection;
        let rtnmsg = await Api.post('/Remittance/autosign/delete',params);
        if (rtnmsg.respCode == SUCCESS) {
          this.$notify({title: '成功',message: '删除成功',type: 'success',duration: 1000})
          this.handleSearch();
        } else {
          this.$notify.error({ title: '错误', message: '服务请求失败!' });
        }
        loading.close();
      });
    },
    // 表格多选
    handleSelectionChange(val) {
      this.multipleSelection = val.map((item) => {
        return item.inr
      })
      this.multipleSelectionObj = val.map((item) => {
        return item
      })
      this.multipleSelectionRow = val.map((item) => {
        return item
      })[0]
    },
    async handleReset() {
      this.model.signinfo.act = '';
      this.model.signinfo.paytyp = '';
      this.model.signinfo.extkey = '';
      this.model.signinfo.scenecode = '';
      this.model.signinfo.inidatfro = moment(new Date()).subtract(7, "days").format("YYYY-MM-DD");
      this.model.signinfo.inidattil = moment(new Date()).format("yyyy-MM-DD");
    },
    formatPaytyp(row, column) {
      var result = "";
        if (row.paytyp == "I") {
          result = "汇入汇款";
        }else if(row.paytyp == "O"){
          result = "汇出汇款";
        }
      return result;
    },
    formatChannel(row, column) {
      var result = "";
        if (row.channel == "YPT") {
          result = "云平台";
        }else if(row.channel == "EJS"){
          result = "E结算";
        }
      return result;
    },
    formatBustyp(row, column) {
      var result = "";
        if (row.scenecode == "CPTHYI") {
          result = "海运费汇入汇款";
        }else if(row.scenecode == "CPTECI"){
          result = "跨境电商汇入汇款";
        }else if(row.scenecode == "CPTECO"){
          result = "跨境电商汇出汇款";
        }else if(row.scenecode == "CPTHYF"){
          result = "海运费汇出汇款";
        }
      return result;
    },
    formatMantyp(row, column) {
      var result = "";
      Object.keys(this.mantypCodeMap).forEach(key => {
        if (row.mantyp == key) {
          result = this.mantypCodeMap[key];
        }
      });
      return result;
    },
    formatTrntyp(row, column) {
      var result = "";
      Object.keys(this.trntypCodeMap).forEach(key => {
        if (row.trntyp == key) {
          result = this.trntypCodeMap[key];
        }
      });
      return result;
    },
    formatHascountpty(row, column) {
      var result = "";
        if (row.hascountpty == "1") {
          result = "是";
        }else if(row.hascountpty == "0"){
          result = "否";
        }
      return result;
    },
    handleSta(){
      this.stadialog = true;
    },
    formatExtkey(row, column){
      var result = row.extkey;
      if(result.includes('-')){
        result = result.split("-")[0];
      }
      return result;
    },
    getCodelabel(value, codenam) {
      const codeobj = this.dbCodes[codenam].find(obj => obj.value === value)
      return codeobj ? codeobj.label : value;
    },
    async getdbCode(codeType, uil, codeNam) {
      let params = {
        codeType: codeType,
        uil: uil ? uil : 'EN'
      }
      let rtnmsg = await Api.post("/manager/dic/listDicInfo", params)
      if (rtnmsg.respCode === SUCCESS) {
        let curList = rtnmsg.data.map(item => ({
          value: item.codeValue,
          label: item.codeName
        }));
        this.dbCodes[codeNam] = curList
      }
    },
  },
};