zuozhengqing
2023-10-17 4e8e3e78c35ca2ff4a31f865561f0d5c4d89dad9
src/views/sales/refundForm/index.vue
@@ -7,16 +7,16 @@
    <div v-else class="filter">
      <div class="filter-card">
        <CommonSearch
            :show-add="false"
            :show-download="false"
            :amount-view="false"
            :show-action-btn="false"
            placeholder="请输入退款单编号"
            @searchClick="onFilterSearch"
          :show-add="false"
          :show-download="false"
          :amount-view="false"
          :show-action-btn="false"
          placeholder="请输入退款单编号"
          @searchClick="onFilterSearch"
        >
          <template slot="leftButton">
            <el-button size="small" type="primary"  @click="addBtnClick">新建</el-button>
            <el-button size="small"  @click="delClick">删除</el-button>
            <el-button size="small" type="primary" @click="addBtnClick">新建</el-button>
            <!-- <el-button size="small"  @click="delClick">删除</el-button> -->
          </template>
        </CommonSearch>
      </div>
@@ -26,19 +26,18 @@
      <div class="body-card">
        <div class="list-view">
          <TableCommonView
              ref="tableListRef"
              :table-list="tableList"
              :select-box="!isDetail"
              @selClientClick="selClientClick"
              @selCommonClick="selCommonClick"
              @getSelectArray="getSelectArray"
              @selTableCol="selTableCol"
            ref="tableListRef"
            :table-list="tableList"
            @selClientClick="selClientClick"
            @selCommonClick="selCommonClick"
            @getSelectArray="getSelectArray"
            @selTableCol="selTableCol"
          >
            <template slot="tableButton">
              <el-table-column label="操作" width="100">
                <template slot-scope="scope">
                  <el-button @click="handleClick(scope.row)" type="text" size="small">编辑</el-button>
                  <!-- <el-button @click="delClick(scope.row.id)" type="text" size="small">删除</el-button> -->
                  <el-button @click="delClick(scope.row.id)" type="text" size="small">删除</el-button>
                </template>
              </el-table-column>
            </template>
@@ -137,7 +136,7 @@
        // { label: "修改时间", prop: "modifyTime" },
        { label: "价税合计", prop: "amountTotal" }
      ],
      showCol:["退款单编号", "客户名称", "退款日期", "账户", "是否开票", "付款方式", "销售负责人", "价税合计"]
      showCol: ["退款单编号", "客户名称", "退款日期", "账户", "是否开票", "付款方式", "销售负责人", "价税合计"]
    }
  },
  created() {
@@ -154,12 +153,13 @@
  methods: {
    setTable() {
      this.tableList = {
        selectIndex: true,
        tableInfomation: [],
        allcol: [],
        showcol: this.showCol,
        tableColumn:this.setColumnVisible(this.showCol)
        tableColumn: this.setColumnVisible(this.showCol)
      }
      this.tableList.allcol = this.tableList.tableColumn.filter(ele=>!ele.default).map(ele=>ele.label);
      this.tableList.allcol = this.tableList.tableColumn.filter((ele) => !ele.default).map((ele) => ele.label)
      this.searchOptions = []
      for (let i = 0; i < this.tableList.tableColumn.length; i++) {
        const label = this.tableList.tableColumn[i].label
@@ -167,27 +167,37 @@
        this.searchOptions.push({ value: value, label: label })
      }
    },
    setColumnVisible(showCol){
      return  this.tableColumn.map(ele=>{
    setColumnVisible(showCol) {
      return this.tableColumn.map((ele) => {
        return {
          ...ele,
          isShowColumn:showCol.includes(ele.label)
          isShowColumn: showCol.includes(ele.label)
        }
      })
    },
    selTableCol(val) {
      this.showcol = val;
      this.tableList.tableColumn = this.setColumnVisible(val);
      this.showcol = val
      this.tableList.tableColumn = this.setColumnVisible(val)
    },
    // 请求数据
    async getData() {
      this.loading = true
      await getSalesRefundList({
        keyword: this.keyword,
        keywordType: this.keywordType,
        page: this.pagerOptions.currPage,
        pageSize: this.pagerOptions.pageSize
      })
      let params = {}
      if (this.addConfig.id) {
        params = {
          sourceId: this.addConfig.id,
          page: this.pagerOptions.currPage,
          pageSize: this.pagerOptions.pageSize
        }
      } else {
        params = {
          keyword: this.keyword,
          keywordType: this.keywordType,
          page: this.pagerOptions.currPage,
          pageSize: this.pagerOptions.pageSize
        }
      }
      await getSalesRefundList(params)
        .then((res) => {
          console.log(res)
          if (res.code === 200) {
@@ -218,16 +228,16 @@
        })
    },
    // 搜索
    onFilterSearch(searchText){
    onFilterSearch(searchText) {
      this.keyword = searchText ?? ""
      this.keywordType = '退款单编号'
      this.keywordType = "退款单编号"
      this.getData()
    },
    // 新建
    addBtnClick() {
      this.editConfig.visible = true
      this.editConfig.title = "新建"
      this.editConfig.infomation = { currency: "人民币" }
      this.editConfig.infomation = { currency: "人民币", ...this.addConfig }
    },
    // 编辑
    handleClick(row) {
@@ -237,27 +247,27 @@
      this.editConfig.infomation = { ...row, currency: "人民币", sale_return_nunber: row.Source.number }
    },
    // 删除
    delClick() {
      if (this.selValueList && this.selValueList.length > 0) {
        this.$confirm("是否确认删除?", "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        })
          .then(() => {
            getDelSalesRefund({ ids: this.selValueList }).then((response) => {
              if (response.code === 200) {
                this.$message.success("删除成功")
                this.getData()
              } else {
                this.$message.warning("删除失败")
              }
            })
    delClick(rowID) {
      // if (this.selValueList && this.selValueList.length > 0) {
      this.$confirm("是否确认删除?", "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          getDelSalesRefund({ ids: [rowID] }).then((response) => {
            if (response.code === 200) {
              this.$message.success("删除成功")
              this.getData()
            } else {
              this.$message.warning("删除失败")
            }
          })
          .catch(() => {})
      } else {
        this.$message.warning("请至少选择一条记录")
      }
        })
        .catch(() => {})
      // } else {
      //   this.$message.warning("请至少选择一条记录")
      // }
    },
    getSelectArray(val) {
      console.log(val)
@@ -293,12 +303,12 @@
.refund-form {
  height: 100%;
  overflow: hidden;
  .filter{
  .filter {
    height: 80px;
    display: flex;
    align-items: center;
    padding: 12px 20px 0 20px;
    &-card{
    &-card {
      height: 80px;
      display: flex;
      align-items: center;
@@ -309,7 +319,7 @@
      background-color: #fff;
    }
  }
  .body{
  .body {
    box-sizing: border-box;
    padding: 10px 20px;
    border-radius: 12px;