yangfeng
2023-07-25 05d33b5bb924e52b9e6185a1006b31a53370d350
src/views/sales/salesDetails/index.vue
@@ -7,9 +7,10 @@
    </div>
    <TableCommonView ref="tableListRef" :show-summary="showSummary" :table-list="tableList">
      <template slot="tableButton">
        <el-table-column label="操作" width="60">
        <el-table-column label="操作" width="90">
          <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>
          </template>
        </el-table-column>
      </template>
@@ -20,20 +21,13 @@
</template>
<script>
import SearchCommonView from "@/components/makepager/SearchCommonView"
import PublicFunctionBtnView from "@/components/makepager/PublicFunctionBtnView"
import PagerView from "@/components/makepager/PagerView"
import TableCommonView from "@/components/makepager/TableCommonView"
import AddSalesDetailsDialog from "@/views/sales/salesDetails/AddSalesDetailsDialog"
import { getSalesDetailsList, getDelSalesDetails } from "@/api/sales/salesDetails"
export default {
  name: "SalesDetails",
  props: {},
  components: {
    SearchCommonView,
    PublicFunctionBtnView,
    PagerView,
    TableCommonView,
    AddSalesDetailsDialog
  },
  computed: {
@@ -85,34 +79,17 @@
  },
  created() {
    this.setTable()
    this.getData()
  },
  methods: {
    setTable() {
      this.tableList = {
        tableInfomation: [
          {
            orderNumber: "XSHT265",
            customName: "55555",
            signDate: "2023-06-25",
            salesHead: "系统管理员",
            outboundStatus: "未出库",
            receiveTotalAmount: "8000.00",
            total: "8000.00",
            amountReceivable: "8000.00",
            invoicedAmount: "8000.00",
            uninvoicedAmount: "8000.00",
            productName: "自动打印机",
            number: "1.00",
            taxUnitPrice: "8000.00",
            unOutoundNo: "1.00",
            priceTax: "8000.00"
          }
        ],
        tableInfomation: [],
        tableColumn: [
          { label: "订单编号", prop: "orderNumber" },
          { label: "客户名称", prop: "customName" },
          { label: "签约日期", prop: "signDate" },
          { label: "销售负责人", prop: "salesHead" },
          { label: "订单编号", prop: "number" },
          { label: "客户名称", prop: "client_name" },
          { label: "签约日期", prop: "signTime", isTime: true, width: 150 },
          { label: "销售负责人", prop: "memberId" },
          { label: "出库状态", prop: "outboundStatus" },
          { label: "已收总额", prop: "receiveTotalAmount", price: true },
          { label: "合计", prop: "total", price: true },
@@ -120,7 +97,7 @@
          { label: "已开票金额", prop: "invoicedAmount", price: true },
          { label: "未开票金额", prop: "uninvoicedAmount", price: true },
          { label: "产品名称", prop: "productName" },
          { label: "数量", prop: "number" },
          { label: "数量", prop: "number1" },
          { label: "含税单价", prop: "taxUnitPrice", price: true },
          { label: "未出库数量", prop: "unOutoundNo" },
          { label: "价税合计", prop: "priceTax", price: true }
@@ -132,54 +109,70 @@
        this.searchOptions.push({ value: (i + 1).toString(), label: label })
      }
    },
    // 请求数据
    async getData() {
      this.loading = true
      await getSalesDetailsList()
        .then((res) => {
          console.log(res)
          if (res.code === 200) {
            if (res.data.list && res.data.list.length > 0) {
              const list = res.data.list.map((item) => {
                return {
                  ...item,
                  client_name: item.client.name
                }
              })
              this.tableList.tableInfomation = list || []
            } else {
              this.tableList.tableInfomation = []
            }
          } else {
            this.tableList.tableInfomation = []
          }
          this.loading = false
        })
        .catch((err) => {
          console.log(err)
          this.tableList.tableInfomation = []
          this.loading = false
        })
    },
    // 新建
    addBtnClick() {
      this.editConfig.visible = true
      this.editConfig.title = "新建"
      this.editConfig.infomation = {
        customName: "",
        orderNumber: "XSHT521",
        salesOpportunity: "",
        selSourceOrder: "",
        signDate: "",
        salesHead: "",
        deliveryDate: "",
        wechatOrderStatus: "",
        consignee: "",
        consigneeContactInfo: "",
        shippingAddress: "",
        termsTreaty: "",
        notes: "",
        approvalWorkflow: "",
        approvalSteps: "",
        approvalPerson: "",
        approvalOpinion: ""
      }
      this.editConfig.infomation = {}
    },
    // 编辑
    handleClick(row) {
      console.log(row)
      this.editConfig.visible = true
      this.editConfig.title = "编辑"
      this.editConfig.infomation = {
        customName: "",
        orderNumber: "XSHT521",
        salesOpportunity: "",
        selSourceOrder: "",
        signDate: "",
        salesHead: "",
        deliveryDate: "",
        wechatOrderStatus: "",
        consignee: "",
        consigneeContactInfo: "",
        shippingAddress: "",
        termsTreaty: "",
        notes: "",
        approvalWorkflow: "",
        approvalSteps: "",
        approvalPerson: "",
        approvalOpinion: ""
      }
      this.editConfig.infomation = { ...row }
    },
    // 删除
    delClick(id) {
      this.$confirm("是否确认删除?", "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(function () {
          return getDelSalesDetails({ id: id })
        })
        .then((response) => {
          if (response.code === 200) {
            this.$message.success("删除成功")
            this.getData()
          } else {
            this.$message.warning("删除失败")
          }
        })
        .catch(function () {})
    },
    getSelectArray(val) {
      console.log(val)
    }
  }
}