haoxuan
2023-08-28 6365989d130a8f5e222687b7441aa19a8b5eb9d6
src/views/purchaseManage/purchase/index.vue
@@ -40,19 +40,21 @@
    <!-- 新建/编辑销售线索 -->
    <!-- <AddSalesLeadDialog v-if="editSalesLeadConfig.visible" :edit-rightContent-config="editSalesLeadConfig" /> -->
    <!-- 详情 -->
    <DetailSupplier v-if="commonDetail.visible" :common-detail="commonDetail" @submitClick="submitClick" />
    <DetailSupplier v-if="commonDetail.visible" :common-detail="commonDetail"  />
    <!-- 新建/编辑 -->
    <AddPurchase v-if="editConfig.visible" :edit-common-config="editConfig" />
  </div>
</template>
<script>
import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
import {
  getSalesLeadsList, getDeleteSalesLeads
  getPurchaseList,getPurchaseInfo,submitPurchase,
} from "@/api/purchaseManage/purchase";
import DetailSupplier from "@/views/purchaseManage/purchase/DetailSupplier"
import AddPurchase from "@/views/purchaseManage/purchase/components/AddPurchase"
import { getDataByType } from "@/api/data";
export default {
  name: "SupplierManage",
  props: {},
@@ -74,6 +76,7 @@
        title: "创建",
        infomation: {}
      },
      purchaseStatusList:getDataByType('purchaseStatus'),
    }
  },
  created() {
@@ -87,9 +90,9 @@
        selectIndex: true,
        tableColumn: [
          { label: "采购单号", prop: "number", min: 150, isCommonClick: true },
          { label: "采购单名称", prop: "name", min: 130,},
          { label: "采购单名称", prop: "name", min: 130, isCommonClick: true},
          { label: "单据类型", prop: "contact_name", min: 130 },
          { label: "供应商名称", prop: "contact_phone", min: 130 },
          { label: "供应商名称", prop: "contact", min: 130 },
          { label: "采购数量", prop: "sales_resources", min: 130 },
          { label: "收货仓库", prop: "province", min: 130 },
          { label: "经办人", prop: "city", min: 130 },
@@ -100,23 +103,17 @@
    },
    // 请求数据
    async getData() {
      await getSalesLeadsList({
        search_map: this.search_map,
      await getPurchaseList({
        keyword: this.search_map,
        page: this.pagerOptions.currPage,
        pageSize: this.pagerOptions.pageSize
      })
        .then((res) => {
          const list = res.data.list.map((item) => {
            return {
              ...item,
              province: item.Province.name,
              city: item.City.name,
              sales_resources: item.sales_sources.name,
              member_name: item.member.username
            }
          })
          this.tableList.tableInfomation = list || []
          this.pagerOptions.totalCount = res.data.count
          if (res.data.code === 200) {
            const list = res.data.data.list
            this.tableList.tableInfomation = list || []
            this.pagerOptions.totalCount = res.data.data.total
          }
        })
        .catch((err) => {
          console.log(err)
@@ -140,19 +137,39 @@
      // this.$refs.add.islook = true;
      this.editConfig.visible = true
      this.editConfig.title = "创建"
      this.editConfig.infomation = { }
      this.editConfig.infomation = {
        productList:[],
        supplierId:'',
          signingDate:'',
          remark:'',
          purchaseTypeId:'',
          phone:'',
          name:'',
          deliveryDate:'',
          contact:''
       }
    },
    
    // 编辑
    editClick(row){
      getPurchaseInfo({id:row.ID}).then((res) => {
        if (res.code == 200) {
          this.editConfig.visible = true
          this.editConfig.title = "编辑"
          this.editConfig.infomation = {
            productList:res.data.productList,
            ...res.data.purchase
           }
        }else{
          this.$message.error(res.msg?res.msg+',':''+'获取信息失败!')
        }
      })
      // this.editRow = row;
      // this.$refs.add.islook = true;
      this.editConfig.visible = true
      this.editConfig.title = "编辑"
      this.editConfig.infomation = { ...row }
    },
    // 确认发货
    submitClick() {
    submitClick(row) {
        this.$confirm("是否提交?", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
@@ -160,7 +177,7 @@
        })
          .then(() => {
            console.log("dddd")
            getDeleteSalesLeads({ ids: this.selValueList }).then((response) => {
            submitPurchase({ id: row.ID }).then((response) => {
              if (response.code === 200) {
                this.$message.success("提交成功")
                this.getData()
@@ -175,8 +192,17 @@
    // 详情
    selCommonClick(row) {
      console.log(row)
      this.commonDetail.visible = true
      this.commonDetail.infomation = { ...row }
      getPurchaseInfo({id:row.ID}).then((res) => {
        if (res.code == 200) {
          this.commonDetail.visible = true
          this.commonDetail.infomation = {
            productList:res.data.productList,
            ...res.data.purchase
           }
        }else{
          this.$message.error(res.msg?res.msg+',':''+'获取信息失败!')
        }
      })
    }
  }
}