yangfeng
2023-08-15 c1adf27fbabbff1d76b60993521c765ef1ed79ef
src/views/sales/refundForm/AddRefundFormDialog.vue
@@ -5,6 +5,8 @@
      :visible.sync="editConfig.visible"
      :width="dialogWidth"
      :before-close="handleClose"
      append-to-body
      custom-class="iframe-dialog"
    >
      <el-form
        ref="form"
@@ -22,11 +24,20 @@
          <div class="basic-info-view">
            <el-row>
              <el-col :span="12">
                <el-form-item label="客户名称" prop="clientId">
                <el-form-item label="客户名称" prop="client_name">
                  <div class="custom-name">
                    <el-input v-model="editConfig.infomation.clientId"></el-input>
                    <div class="common-select-btn"><i class="el-icon-circle-plus-outline" title="选择"></i></div>
                    <div class="common-select-btn"><i class="el-icon-edit" title="编辑"></i></div>
                    <el-autocomplete
                      v-model="editConfig.infomation.client_name"
                      :fetch-suggestions="querySearchAsync"
                      value-key="name"
                      @select="handleSelectClient"
                    ></el-autocomplete>
                    <div class="common-select-btn" @click="selClientClick">
                      <i class="el-icon-circle-plus-outline" title="选择"></i>
                    </div>
                    <div class="common-select-btn" @click="clearupClient">
                      <i class="el-icon-edit-outline" title="清除"></i>
                    </div>
                  </div>
                </el-form-item>
              </el-col>
@@ -35,7 +46,7 @@
                  <el-input v-model="editConfig.infomation.number"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
              <!-- <el-col :span="12">
                <el-form-item label="选择源单" prop="selSourceOrder">
                  <el-select v-model="editConfig.infomation.selSourceOrder" size="mini" style="width: 63%">
                    <el-option
@@ -47,7 +58,7 @@
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              </el-col> -->
              <el-col :span="12">
                <el-form-item label="销售负责人" prop="memberId">
                  <el-select
@@ -56,22 +67,27 @@
                    size="mini"
                    style="width: 63%"
                  >
                    <el-option v-for="item in memberOptions" :key="item.value" :label="item.label" :value="item.value">
                    <el-option v-for="item in memberOptions" :key="item.id" :label="item.username" :value="item.id">
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="退款日期" prop="refundDate">
                  <el-date-picker v-model="editConfig.infomation.refundDate" type="date" placeholder="选择日期">
                  <el-date-picker
                    v-model="editConfig.infomation.refundDate"
                    value-format="yyyy-MM-dd"
                    type="date"
                    placeholder="选择日期"
                  >
                  </el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="付款方式" prop="refundMethod">
                <el-form-item label="付款方式" prop="paymentTypeId">
                  <div class="common-select">
                    <el-select
                      v-model="editConfig.infomation.refundMethod"
                      v-model="editConfig.infomation.paymentTypeId"
                      placeholder="请选择"
                      class="common-select-sel"
                      size="mini"
@@ -79,7 +95,7 @@
                      <el-option v-for="item in refundMethodOptions" :key="item.id" :label="item.name" :value="item.id">
                      </el-option>
                    </el-select>
                    <div class="common-select-btn"><i class="el-icon-setting"></i></div>
                    <!-- <div class="common-select-btn"><i class="el-icon-setting"></i></div> -->
                  </div>
                </el-form-item>
              </el-col>
@@ -95,7 +111,7 @@
                      <el-option v-for="item in accountOptions" :key="item.id" :label="item.name" :value="item.id">
                      </el-option>
                    </el-select>
                    <div class="common-select-btn"><i class="el-icon-setting"></i></div>
                    <!-- <div class="common-select-btn"><i class="el-icon-setting"></i></div> -->
                  </div>
                </el-form-item>
              </el-col>
@@ -108,10 +124,9 @@
                      class="common-select-sel"
                      size="mini"
                    >
                      <el-option v-for="item in isInvoiceOptions" :key="item.id" :label="item.name" :value="item.id">
                      </el-option>
                      <el-option v-for="item in isInvoiceOptions" :key="item" :label="item" :value="item"> </el-option>
                    </el-select>
                    <div class="common-select-btn"><i class="el-icon-setting"></i></div>
                    <!-- <div class="common-select-btn"><i class="el-icon-setting"></i></div> -->
                  </div>
                </el-form-item>
              </el-col>
@@ -133,7 +148,7 @@
            </el-row>
          </div>
          <!-- 附件信息 -->
          <div class="basic-info-title">附件信息</div>
          <!-- <div class="basic-info-title">附件信息</div>
          <div class="basic-info-view">
            <el-row>
              <el-col :span="12">
@@ -158,7 +173,7 @@
                </el-form-item>
              </el-col>
            </el-row>
          </div>
          </div> -->
          <!-- 产品管理 -->
          <div class="basic-info-title" style="display: flex">
            产品管理
@@ -222,9 +237,15 @@
      </el-form>
      <div slot="footer" class="dialog-footer">
        <!-- <el-button type="primary" size="small" @click="editConfig.visible = false">保并提交审批</el-button> -->
        <el-button type="primary" size="small" @click="editConfig.visible = false">保存</el-button>
        <el-button type="primary" size="small" @click="saveClick('form')">保存</el-button>
        <el-button size="small" @click="editConfig.visible = false">取消</el-button>
      </div>
      <!-- 选择客户 -->
      <SelectClientDialog
        v-if="editSelectClientConfig.editVisible"
        :edit-common-config="editSelectClientConfig"
        @selClient="selClient"
      />
    </el-dialog>
  </div>
</template>
@@ -233,6 +254,7 @@
import CommonFormTableView from "@/components/makepager/CommonFormTableView"
import { getAllData } from "@/api/client/client"
import { getAddSalesRefund, getUpdateSalesRefund } from "@/api/sales/refundForm"
import SelectClientDialog from "@/views/other/commonDialog/SelectClientDialog"
export default {
  name: "AddRefundFormDialog",
  props: {
@@ -247,8 +269,12 @@
      }
    }
  },
  components: { CommonFormTableView },
  computed: {},
  components: { CommonFormTableView, SelectClientDialog },
  computed: {
    clientList() {
      return this.$store.state.getClientName.clientList
    }
  },
  data() {
    return {
      dialogWidth: "80%",
@@ -261,25 +287,11 @@
        account: [{ required: true, message: "请选择", trigger: "change" }]
      },
      memberOptions: [],
      selSourceOrderOptions: [{ value: "1", label: "销售退货单" }], // 选择源单
      refundMethodOptions: [
        { value: "1", label: "现金" },
        { value: "2", label: "支票" },
        { value: "3", label: "电汇" },
        { value: "4", label: "邮政汇款" },
        { value: "5", label: "网上银行" },
        { value: "6", label: "其他" }
      ], // 付款方式
      accountOptions: [{ value: "1", label: "人民币账户" }], // 账户
      isInvoiceOptions: [
        { value: "1", label: "未开" },
        { value: "2", label: "已开" }
      ], // 是否开票
      currencyOptions: [
        { value: "1", label: "人民币(¥)" },
        { value: "2", label: "英镑(£)" },
        { value: "3", label: "欧元(€)" }
      ], // 币种
      // selSourceOrderOptions: [{ value: "1", label: "销售退货单" }], // 选择源单
      refundMethodOptions: [], // 付款方式
      accountOptions: [], // 账户
      isInvoiceOptions: ["是", "否"], // 是否开票
      currencyOptions: [], // 币种
      approvalWorkflowOptions: [], // 审批流程
      productTableList: {},
      showSummary: {
@@ -287,10 +299,17 @@
        total: true,
        sumProp: ["other1", "other2", "other3", "other4"],
        mergeNumber: 5
      }
      },
      editSelectClientConfig: {
        editVisible: false,
        title: "",
        infomation: {}
      },
      clientId: this.editCommonConfig.infomation.client_id
    }
  },
  created() {
    this.$store.dispatch("geClient")
    this.setTableForm()
    this.getCommonData()
  },
@@ -299,6 +318,10 @@
      getAllData()
        .then((res) => {
          this.memberOptions = res.data.member
          this.refundMethodOptions = res.data.refundMethod
          this.accountOptions = res.data.accountId
          // this.isInvoiceOptions = res.data.isInvoice
          this.currencyOptions = res.data.currency
        })
        .catch((err) => {
          console.log(err)
@@ -312,37 +335,23 @@
          const params = this.saveParams()
          console.log(params)
          if (this.editConfig.title === "新建") {
            getAddSalesRefund(params)
              .then((res) => {
                console.log(res)
                this.editConfig.visible = false
                if (res.code === 200) {
                  this.$message({
                    message: "添加成功",
                    type: "success"
                  })
                  this.$parent.getData()
                }
              })
              .catch((err) => {
                console.log(err)
              })
            getAddSalesRefund(params).then((res) => {
              console.log(res)
              this.editConfig.visible = false
              if (res.code === 200) {
                this.$message.success("添加成功")
                this.$parent.getData()
              }
            })
          } else {
            getUpdateSalesRefund(params)
              .then((res) => {
                console.log(res)
                this.editConfig.visible = false
                if (res.code === 200) {
                  this.$message({
                    message: "编辑成功",
                    type: "success"
                  })
                  this.$parent.getData()
                }
              })
              .catch((err) => {
                console.log(err)
              })
            getUpdateSalesRefund(params).then((res) => {
              console.log(res)
              this.editConfig.visible = false
              if (res.code === 200) {
                this.$message.success("编辑成功")
                this.$parent.getData()
              }
            })
          }
        } else {
          console.log("error submit")
@@ -356,21 +365,11 @@
        id: this.editConfig.title === "新建" ? 0 : data.id,
        salesRefund: {
          accountId: data.accountId || 0,
          clientId: data.clientId || 0,
          isInvoice: data.isInvoice || 0,
          clientId: this.clientId || 0,
          isInvoice: data.isInvoice || "",
          memberId: data.memberId || 0,
          number: data.number || "",
          products: [
            {
              amount: 0,
              desc: "",
              id: 0,
              name: "",
              number: "",
              price: 0,
              total: 0
            }
          ],
          products: data.products || [],
          reason: data.reason || "",
          refundDate: data.refundDate || "",
          refundMethod: data.refundMethod || ""
@@ -380,6 +379,33 @@
    },
    handleClose() {
      this.editConfig.visible = false
    },
    // 选择客户相关方法
    querySearchAsync(queryString, cb) {
      var restaurants = this.clientList
      var results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants
      cb(results)
    },
    createStateFilter(queryString) {
      return (state) => {
        return state.name.toLowerCase().indexOf(queryString.toLowerCase()) === 0
      }
    },
    handleSelectClient(item) {
      this.clientId = item.id
    },
    selClientClick() {
      this.editSelectClientConfig.editVisible = true
    },
    selClient(row) {
      console.log(row)
      this.editConfig.infomation.client_name = row.name
      this.clientId = row.id
    },
    // 清除已选择用户
    clearupClient() {
      this.editConfig.infomation.client_name = ""
      this.clientId = 0
    },
    // 添加附件
    addAnnexClick() {},
@@ -423,58 +449,54 @@
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" scoped>
.add-refund-form {
  .basic-info {
    .basic-info-title {
      background-color: #f4f8fe;
      padding-left: 10px;
      font-size: 15px;
      font-weight: bold;
      color: #666;
      height: 42px;
      line-height: 42px;
    }
    .basic-info-view {
      margin-top: 10px;
      padding-right: 40px;
      .custom-name {
        display: flex;
        .common-select-btn {
          margin-left: 5px;
          font-size: 18px;
::v-deep {
  .iframe-dialog .el-dialog__body {
    .basic-info {
      .basic-info-title {
        background-color: #f4f8fe;
        padding-left: 10px;
        font-size: 15px;
        font-weight: bold;
        color: #666;
        height: 42px;
        line-height: 42px;
      }
      .basic-info-view {
        margin-top: 10px;
        padding-right: 40px;
        .custom-name,
        .common-select {
          display: flex;
          .common-select-sel {
            width: 270px;
          }
          .common-select-btn {
            margin-left: 5px;
            font-size: 16px;
            cursor: pointer;
          }
        }
      }
      .common-select {
      .annex-view {
        display: flex;
        .common-select-sel {
          width: 270px;
        }
        .common-select-btn {
          margin-left: 5px;
          font-size: 16px;
          cursor: pointer;
        color: #6166d3;
        .setFormat {
          margin-left: 10px;
        }
      }
    }
    .annex-view {
    .unflod-collapse {
      display: flex;
      height: 30px;
      justify-content: center;
      align-items: center;
      color: #6166d3;
      .setFormat {
        margin-left: 10px;
      }
    }
  }
  .unflod-collapse {
    display: flex;
    height: 30px;
    justify-content: center;
    align-items: center;
    color: #6166d3;
  }
  .dialog-footer {
    background-color: #f5f5f5;
    height: 55px;
    line-height: 55px;
    .dialog-footer {
      background-color: #f5f5f5;
      height: 55px;
      line-height: 55px;
    }
  }
}
</style>