Browse Source

采购单调试

lilei 4 years ago
parent
commit
f781e31501

+ 21 - 5
src/api/purchase.js

@@ -19,6 +19,23 @@ export const purchaseDetail = (params) => {
     method: 'get'
   })
 }
+
+//  采购 详情
+export const purchaseDetailBySn = (params) => {
+  return axios({
+    url: `/purchase/findBySn/${params.sn}`,
+    data: params,
+    method: 'get'
+  })
+}
+//  采购明细 统计
+export const purchaseCount = (params) => {
+  return axios({
+    url: `/purchase/count`,
+    data: params,
+    method: 'post'
+  })
+}
 //  采购 打印
 export const purchasePrint = (params) => {
   return axios({
@@ -54,9 +71,8 @@ export const purchaseWriteStockIn = (params) => {
 //  采购 提交
 export const purchaseWriteSubmit = (params) => {
   return axios({
-    url: '/purchase/submit',
-    data: params,
-    method: 'post'
+    url: `/purchase/submit/${params.id}`,
+    method: 'get'
   })
 }
 //  采购 保存
@@ -67,12 +83,12 @@ export const purchaseSave = (params) => {
     method: 'post'
   })
 }
+
 //  采购 删除
 export const purchaseDel = (params) => {
   return axios({
     url: `/purchase/delete/${params.id}`,
-    data: params,
-    method: 'post'
+    method: 'get'
   })
 }
 //  采购 导出

+ 1 - 2
src/api/purchaseDetail.js

@@ -23,8 +23,7 @@ export const purchaseDetailSave = (params) => {
 export const purchaseDetailDel = (params) => {
   return axios({
     url: `/purchaseDetail/delete/${params.id}`,
-    data: params,
-    method: 'post'
+    method: 'get'
   })
 }
 //  采购详情 整单删除

+ 4 - 4
src/config/router.config.js

@@ -361,7 +361,7 @@ export const asyncRouterMap = [
                 }
               },
               {
-                path: 'add/:id',
+                path: 'add/:sn',
                 name: 'purchaseOrderAdd',
                 component: () => import(/* webpackChunkName: "shop" */ '@/views/purchasingManagement/purchaseOrder/edit.vue'),
                 meta: {
@@ -372,7 +372,7 @@ export const asyncRouterMap = [
                 }
               },
               {
-                path: 'edit/:id',
+                path: 'edit/:sn',
                 name: 'purchaseOrderEdit',
                 component: () => import(/* webpackChunkName: "shop" */ '@/views/purchasingManagement/purchaseOrder/edit.vue'),
                 meta: {
@@ -383,7 +383,7 @@ export const asyncRouterMap = [
                 }
               },
               {
-                path: 'detail/:id',
+                path: 'detail/:sn',
                 name: 'purchaseOrderDetail',
                 component: () => import(/* webpackChunkName: "shop" */ '@/views/purchasingManagement/purchaseOrder/detail.vue'),
                 meta: {
@@ -656,7 +656,7 @@ export const asyncRouterMap = [
             meta: {
               title: '店内调出',
               icon: 'interaction',
-              permission: 'M_storeTransferOutList'
+              // permission: 'M_storeTransferOutList'
             },
             hideChildrenInMenu: true,
             children: [

+ 13 - 9
src/views/common/productBrand.js

@@ -5,7 +5,7 @@ const ProductBrand = {
         placeholder="请选择产品品牌"
         :id="id"
         allowClear
-        :value="value"
+        :value="defaultVal"
         :showSearch="true"
         @change="handleChange"
         option-filter-prop="children"
@@ -14,11 +14,9 @@ const ProductBrand = {
       </a-select>
     `,
   props: {
-    defaultVal: {
-      type: Array,
-      defatut: function(){
-        return []
-      }
+    value: {
+      type: String,
+      defatut: ''
     },
     id: {
       type: String,
@@ -31,13 +29,18 @@ const ProductBrand = {
   },
   data() {
     return {
-      value: this.defaultVal,
+      defaultVal: this.value,
       productBrandList: []
     };
   },
   mounted() {
     this.getProductBrand()
   },
+  watch: {
+    value(newValue, oldValue) {
+      this.defaultVal = newValue
+    }
+  },
   methods: {
     filterOption (input, option) {
       return (
@@ -45,8 +48,9 @@ const ProductBrand = {
       )
     },
     handleChange(value) {
-      this.value = value;
-      this.$emit('change', this.value);
+      this.defaultVal = value;
+      this.$emit('change', value);
+      this.$emit('input', value);
     },
     //  产品品牌列表, sysFlag: 1 箭冠 0 自建
     getProductBrand () {

+ 15 - 13
src/views/purchasingManagement/purchaseOrder/basicInfoModal.vue

@@ -93,6 +93,17 @@ export default {
     }
   },
   methods: {
+    resetForm () {
+      this.$refs.ruleForm.resetFields()
+      this.chooseAddr = ''
+      this.addressVal = '选择地址'
+      this.form.shippingAddressProvinceName = ''// 省
+      this.form.shippingAddressCityName = '' // 市
+      this.form.shippingAddressCountyName = '' // 区
+      this.form.shippingAddress = ''// 详细地址
+      this.form.consigneeTel = '' // 联系电话
+      this.form.consigneeName = ''
+    },
     //  保存
     handleSubmit (e) {
       e.preventDefault()
@@ -118,16 +129,7 @@ export default {
     },
     // 取消
     cancel () {
-      console.log(11)
-      this.isShow = false
-      this.chooseAddr = ''
-      this.addressVal = '选择地址'
-      this.form.shippingAddressProvinceName = ''// 省
-      this.form.shippingAddressCityName = '' // 市
-      this.form.shippingAddressCountyName = '' // 区
-      this.form.shippingAddress = ''// 详细地址
-      this.form.consigneeTel = '' // 联系电话
-      this.form.consigneeName = ''
+      this.$emit('cancel')
     },
     //  选择地址
     handleChoose () {
@@ -148,8 +150,8 @@ export default {
     },
     // 编辑信息
     setData (data) {
-      this.form = data
-      this.chooseAddr = data.consigneeName + '(' + data.consigneeTel + ')' + ' ' + data.address
+      this.form = JSON.parse(JSON.stringify(data))
+      this.chooseAddr = data.consigneeName + '(' + data.consigneeTel + ')' + ' ' + data.shippingAddressProvinceName + '-' + data.shippingAddressCityName + '-' + data.shippingAddressCountyName + ' ' + data.shippingAddress
       this.addressVal = '更换地址'
     },
     // 获取收款方式
@@ -170,7 +172,7 @@ export default {
     isShow (newValue, oldValue) {
       if (!newValue) {
         this.$emit('close')
-        this.$refs.ruleForm.resetFields()
+        this.resetForm()
       } else {
         this.getSettleStyle()
       }

+ 43 - 27
src/views/purchasingManagement/purchaseOrder/detail.vue

@@ -1,33 +1,41 @@
 <template>
   <div class="purchaseOrderDetail-wrap">
-    <a-page-header :ghost="false" @back="handleBack" >
+    <a-page-header :ghost="false" :backIcon="false" @back="handleBack" >
       <!-- 自定义的二级文字标题 -->
       <template slot="subTitle">
-        <a id="purchaseOrderDetail-back-btn" href="javascript:;" @click="handleBack">返回列表</a>
-      </template>
-      <!-- 操作区,位于 title 行的行尾 -->
-      <template slot="extra">
-        <a-button key="2" id="purchaseOrderDetail-preview-btn">打印预览</a-button>
-        <a-button key="1" type="primary" id="purchaseOrderDetail-print-btn">快速打印</a-button>
+        <a id="purchaseOrderDetail-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
+        <b style="font-size: 18px;margin-left: 15px;">采购单详情</b>
       </template>
     </a-page-header>
     <!-- 内容 -->
-    <a-page-header title="单号:CG2021010100001" >
+    <a-page-header>
+      <template slot="subTitle">
+        <p class="billno">单号:{{ detail&&detail.purchaseBillNo }}</p>
+      </template>
       <template slot="tags">
         <a-tag color="blue">审核通过</a-tag>
         <a-tag color="orange">未结算</a-tag>
       </template>
+      <!-- 操作区,位于 title 行的行尾 -->
+      <template slot="extra">
+        <a-button key="2" id="purchaseOrderDetail-preview-btn">打印预览</a-button>
+        <a-button key="1" type="primary" id="purchaseOrderDetail-print-btn">快速打印</a-button>
+      </template>
     </a-page-header>
     <!-- 基础信息 -->
     <a-card size="small" :bordered="false" class="purchaseOrderDetail-cont">
       <a-collapse :activeKey="['1']">
         <a-collapse-panel key="1" header="基础信息">
           <a-descriptions :column="3">
-            <a-descriptions-item label="供应商">箭冠营销中心</a-descriptions-item>
-            <a-descriptions-item label="支付方式">箭冠营销中心</a-descriptions-item>
-            <a-descriptions-item label="采购员工">箭冠营销中心</a-descriptions-item>
-            <a-descriptions-item label="收货人">箭冠营销中心</a-descriptions-item>
-            <a-descriptions-item label="收货地址">箭冠营销中心</a-descriptions-item>
+            <a-descriptions-item label="供应商">{{ detail&&detail.dealerName }}</a-descriptions-item>
+            <a-descriptions-item label="支付方式">{{ detail&&detail.settleStyleEntity.name }}</a-descriptions-item>
+            <a-descriptions-item label="收货人">{{ detail&&detail.consigneeName }}({{ detail&&detail.consigneeTel }})</a-descriptions-item>
+            <a-descriptions-item label="收货地址">
+              {{ detail&&detail.shippingAddressProvinceName }} -
+              {{ detail&&detail.shippingAddressCityName }} -
+              {{ detail&&detail.shippingAddressCountyName }} -
+              {{ detail&&detail.shippingAddress }}
+            </a-descriptions-item>
           </a-descriptions>
         </a-collapse-panel>
       </a-collapse>
@@ -38,7 +46,9 @@
         <a-collapse-panel key="1" header="产品详情">
           <!-- 总计 -->
           <a-alert type="info" showIcon style="margin-bottom:15px">
-            <div slot="message">产品款数 <strong>6</strong> ,采购数量合计 <strong>6</strong> ,采购金额合计¥<strong>6.33</strong></div>
+            <div slot="message">产品款数 <strong>{{ detail&&detail.totalCategory }}</strong> ,
+              采购数量合计 <strong>{{ detail&&detail.totalQty }}</strong> ,
+              采购金额合计¥<strong>{{ detail&&detail.totalAmount }}</strong></div>
           </a-alert>
           <!-- 列表 -->
           <s-table
@@ -84,7 +94,7 @@
 
 <script>
 import { STable, VSelect } from '@/components'
-import { purchaseDetail } from '@/api/purchase'
+import { purchaseDetailBySn } from '@/api/purchase'
 import { purchaseDetailList } from '@/api/purchaseDetail'
 export default {
   components: { STable, VSelect },
@@ -93,14 +103,14 @@ export default {
       // 表头
       columns: [
         { title: '序号', dataIndex: 'no', width: 80, align: 'center', fixed: 'left' },
-        { title: '产品编码', dataIndex: 'creatDate', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'custName', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '原厂编码', dataIndex: 'totalP', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '采购单价', dataIndex: 'totalNums', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '采购数量', scopedSlots: { customRender: 'purchaseNum' }, width: 100, align: 'center' },
-        { title: '缺货数量', scopedSlots: { customRender: 'outOfStockNum' }, width: 100, align: 'center' },
-        { title: '单位', dataIndex: 'mementPay', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '采购金额', dataIndex: 'shDate', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
+        { title: '产品编码', dataIndex: 'dealerProductEntity.code', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'dealerProductEntity.name', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '原厂编码', dataIndex: 'dealerProductEntity.origCode', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '采购单价', dataIndex: 'price', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '采购数量', dataIndex: 'qty', width: 100, align: 'center', customRender: function (text) { return text || 0 } },
+        { title: '缺货数量', dataIndex: 'oosQty', width: 100, align: 'center', customRender: function (text) { return text || 0 } },
+        { title: '单位', dataIndex: 'unit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '采购金额', dataIndex: 'totalAmount', width: 100, align: 'center', customRender: function (text) { return '¥' + (text || 0) } }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
@@ -115,7 +125,7 @@ export default {
           return data
         })
       },
-      detailData: null //  详情数据
+      detail: null //  详情数据
     }
   },
   methods: {
@@ -125,11 +135,11 @@ export default {
     },
     //  详情
     getDetail () {
-      purchaseDetail({ id: this.$route.params.id }).then(res => {
+      purchaseDetailBySn({ sn: this.$route.params.sn }).then(res => {
         if (res.status == 200) {
-          this.detailData = res.data
+          this.detail = res.data
         } else {
-          this.detailData = null
+          this.detail = null
         }
       })
     }
@@ -150,4 +160,10 @@ export default {
       }
     }
   }
+  .purchaseOrderDetail-wrap{
+    .billno{
+      font-size: 18px;
+      font-weight: bold;
+    }
+  }
 </style>

+ 53 - 38
src/views/purchasingManagement/purchaseOrder/edit.vue

@@ -29,7 +29,7 @@
           </template>
           <a-descriptions :column="3">
             <a-descriptions-item label="供应商">{{ detail&&detail.dealerName }}</a-descriptions-item>
-            <a-descriptions-item label="支付方式">{{ detail&&detail.settleStyle }}</a-descriptions-item>
+            <a-descriptions-item label="支付方式">{{ detail&&detail.settleStyleEntity.name }}</a-descriptions-item>
             <a-descriptions-item label="收货人">{{ detail&&detail.consigneeName }}({{ detail&&detail.consigneeTel }})</a-descriptions-item>
             <a-descriptions-item label="收货地址">
               {{ detail&&detail.shippingAddressProvinceName }} -
@@ -101,16 +101,15 @@
               <!-- 采购数量 -->
               <template slot="storageQuantity" slot-scope="text, record">
                 <a-input-number
-                  id="purchaseOrderEdit-storageQuantity"
-                  :value="record.storageQuantity"
+                  v-model="record.qty"
                   :precision="0"
                   :min="0"
                   :max="999999"
-                  placeholder="请输入" />
+                  placeholder="请输入数量" />
               </template>
               <!-- 操作 -->
               <template slot="action" slot-scope="text, record">
-                <a-button size="small" type="link" @click="handleAdd(record)" id="purchaseOrderEdit-add-btn">添加</a-button>
+                <a-button size="small" type="link" :loading="addLoading" @click="handleAdd(record,0)" id="purchaseOrderEdit-add-btn">添加</a-button>
               </template>
             </s-table>
           </div>
@@ -129,7 +128,9 @@
           <div>
             <!-- 总计 -->
             <a-alert type="info" showIcon style="margin-bottom:15px">
-              <div slot="message">产品款数 <strong>6</strong> ,采购数量合计 <strong>6</strong> ,采购金额合计¥<strong>6.33</strong></div>
+              <div slot="message">产品款数 <strong>{{ detail&&detail.totalCategory }}</strong> ,
+                采购数量合计 <strong>{{ detail&&detail.totalQty }}</strong> ,
+                采购金额合计¥<strong>{{ detail&&detail.totalAmount }}</strong></div>
             </a-alert>
             <!-- 列表 -->
             <s-table
@@ -167,7 +168,7 @@
         </a-collapse-panel>
       </a-collapse>
     </a-card>
-    <a-affix :offset-bottom="0">
+    <a-affix :offset-bottom="0" v-if="detail">
       <div style="text-align: center;width: 100%;background-color: #fff;padding: 12px 0;box-shadow: 0 0 20px #dcdee2;">
         <a-button
           type="primary"
@@ -179,7 +180,7 @@
       </div>
     </a-affix>
     <!-- 选择基本信息弹框 -->
-    <basic-info-modal ref="baseInfo" :openModal="openModal" @ok="handleOk" @close="openModal=false" />
+    <basic-info-modal ref="baseInfo" :openModal="openModal" @ok="handleOk" @cancel="openModal=false" />
   </div>
 </template>
 
@@ -188,8 +189,9 @@ import { STable, VSelect } from '@/components'
 import basicInfoModal from './basicInfoModal.vue'
 import ProductType from '../../common/productType.js'
 import ProductBrand from '../../common/productBrand.js'
-import { purchaseDetail, purchaseWriteSubmit } from '@/api/purchase'
+import { purchaseDetailBySn, purchaseWriteSubmit } from '@/api/purchase'
 import { purchaseDetailList, purchaseDetailSave, purchaseDetailDel } from '@/api/purchaseDetail'
+import { productList } from '@/api/product'
 export default {
   components: { STable, VSelect, basicInfoModal, ProductType, ProductBrand },
   data () {
@@ -197,6 +199,7 @@ export default {
       openModal: false, // 选择基本信息弹框是否显示
       detail: null, // 详细信息
       // 选择产品
+      addLoading: false,
       productType: [],
       queryParam: {
         productBrandSn: undefined,
@@ -213,25 +216,23 @@ export default {
       // 表头
       columns: [
         { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
-        { title: '产品编码', dataIndex: 'creatDate', width: 140, align: 'center', sorter: true },
-        { title: '产品名称', dataIndex: 'custName', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品级别', dataIndex: 'custsName', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '原厂编码', dataIndex: 'totalP', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '终端会员价', dataIndex: 'totalNums', width: 110, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '车主零售价', scopedSlots: { customRender: 'purchaseNum' }, width: 110, align: 'center' },
-        { title: '箱/单位', scopedSlots: { customRender: 'outOfStockNum' }, width: 100, align: 'center' },
-        { title: '采购单价', dataIndex: 'mementPay', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '采购数量', scopedSlots: { customRender: 'storageQuantity' }, width: 150, align: 'center' },
+        { title: '产品编码', dataIndex: 'code', width: 200, align: 'center', sorter: true },
+        { title: '产品名称', dataIndex: 'name', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '原厂编码', dataIndex: 'origCode', width: 200, align: 'center', customRender: function (text) { return text == ' ' ? '--' : text } },
+        { title: '箱/单位', dataIndex: 'unit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '采购单价', dataIndex: 'terminalPrice', width: 100, align: 'center', customRender: function (text) { return '¥' + (text || 0) }, fixed: 'right' },
+        { title: '采购数量', dataIndex: 'qty', scopedSlots: { customRender: 'storageQuantity' }, width: 150, align: 'center', fixed: 'right' },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center', fixed: 'right' }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
-        return customerBundleDelayList(Object.assign(parameter, this.queryParam)).then(res => {
+        return productList(Object.assign(parameter, this.queryParam)).then(res => {
           const data = res.data
           const no = (data.pageNo - 1) * data.pageSize
           for (var i = 0; i < data.list.length; i++) {
             data.list[i].no = no + i + 1
+            data.list[i].qty = 1
           }
           this.disabled = false
           return data
@@ -242,11 +243,11 @@ export default {
       // 表头
       chooseColumns: [
         { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
-        { title: '产品编码', dataIndex: 'productCode', width: 140, align: 'center', sorter: true },
-        { title: '产品名称', dataIndex: 'productName', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品编码', dataIndex: 'dealerProductEntity.code', width: 140, align: 'center', sorter: true },
+        { title: '产品名称', dataIndex: 'dealerProductEntity.name', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '采购单价', dataIndex: 'price', width: 100, align: 'center', customRender: function (text) { return '¥' + (text || 0) } },
         { title: '采购数量', scopedSlots: { customRender: 'storageQuantity' }, width: 150, align: 'center' },
-        { title: '单位', dataIndex: 'unit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '单位', dataIndex: 'dealerProductEntity.unit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '采购金额', dataIndex: 'totalAmount', width: 100, align: 'center', customRender: function (text) { return '¥' + (text || 0) } },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center', fixed: 'right' }
       ],
@@ -268,7 +269,7 @@ export default {
   methods: {
     // 获取采购单基本信息
     getOrderDetail () {
-      purchaseDetail({ id: this.$route.params.id }).then(res => {
+      purchaseDetailBySn({ sn: this.$route.params.sn }).then(res => {
         if (res.status == 200) {
           this.detail = res.data
         }
@@ -277,7 +278,7 @@ export default {
     },
     //  基本信息编辑成功
     handleOk (data) {
-      this.getOrderDetail()
+      // this.getOrderDetail()
     },
     //  编辑基本信息
     handleEditInfo () {
@@ -310,16 +311,9 @@ export default {
       this.$refs.purchaseTable.refresh(!!flag)
     },
     // 修改数量后
-    qtyBlur (v) {
-      //  光标移出,值发生改变再调用编辑接口
-      if (val != record.qty) {
-        purchaseDetailSave(record).then(res => {
-          if (res.status == 200) {
-            this.resetPurchaseDetail(true)
-          }
-          this.$message.info(res.message)
-        })
-      }
+    qtyBlur (val, record) {
+      console.log(val, record)
+      this.handleAdd(record, 1)
     },
     //  导入明细
     handleImport () {
@@ -350,13 +344,33 @@ export default {
       this.productType = []
       this.$refs.table.refresh(true)
     },
-    //  添加
-    handleAdd (row) {},
+    //  添加或修改
+    handleAdd (row, type) {
+      let params = {}
+      // 添加
+      if (type == 0) {
+        params.productSn = row.productSn
+        params.purchaseBillSn = this.detail.purchaseBillSn
+        params.purchaseBillNo = this.detail.purchaseBillNo
+        params.price = row.terminalPrice
+        params.qty = row.qty
+      } else {
+        params = row
+      }
+      this.addLoading = true
+      purchaseDetailSave(params).then(res => {
+        if (res.status == 200) {
+          this.resetPurchaseDetail()
+          this.$message.info(res.message)
+        }
+        this.addLoading = false
+      })
+    },
     // ------------产品库 end --------
     //  提交
     handleSubmit () {
       const _this = this
-      purchaseWriteSubmit({ id: this.$route.params.id }).then(res => {
+      purchaseWriteSubmit({ id: this.detail.id }).then(res => {
         if (res.status == 200) {
           this.$message.success(res.message)
           setTimeout(() => {
@@ -367,12 +381,13 @@ export default {
     },
     //  返回列表
     handleBack () {
-      this.$router.push({ naem: 'purchaseOrderList' })
+      this.$router.push({ name: 'purchaseOrderList' })
     }
   },
   beforeRouteEnter (to, from, next) {
     next(vm => {
       vm.openModal = false
+      vm.getOrderDetail()
     })
   }
 }

+ 45 - 17
src/views/purchasingManagement/purchaseOrder/list.vue

@@ -77,7 +77,7 @@
     </div>
     <!-- alert -->
     <a-alert type="info" showIcon style="margin-bottom:15px">
-      <div slot="message">共 <strong>6</strong> 条记录,采购数量合计 <strong>14</strong> ,采购金额合计¥<strong>14.00</strong> </div>
+      <div slot="message">共 <strong>{{ totalData.totalRecord }}</strong> 条记录,采购数量合计 <strong>{{ totalData.totalQty }}</strong> ,采购金额合计¥<strong>{{ totalData.totalAmount }}</strong> </div>
     </a-alert>
     <!-- 列表 -->
     <s-table
@@ -126,15 +126,16 @@
       </template>
     </s-table>
     <!-- 选择基本信息弹框 -->
-    <basic-info-modal :openModal="openModal" @ok="handleOk" @close="openModal=false" />
+    <basic-info-modal :openModal="openModal" @ok="handleOk" @cancel="openModal=false" />
   </a-card>
 </template>
 
 <script>
 import { STable, VSelect } from '@/components'
 import basicInfoModal from './basicInfoModal.vue'
-import { purchaseList } from '@/api/purchase'
+import { purchaseList, purchaseDel, purchaseWriteStockIn, purchaseCount } from '@/api/purchase'
 import { supplierAllList } from '@/api/supplier'
+import moment from 'moment'
 export default {
   components: { STable, VSelect, basicInfoModal },
   data () {
@@ -146,11 +147,24 @@ export default {
       dateFormat: 'YYYY-MM-DD',
       time: [], //  创建时间
       // 查询参数
-      queryParam: {},
+      queryParam: {
+        // purchaseBillNo: '',
+        // supplierSn: '',
+        // billStatus: '',
+        // financialStatus: '',
+        // beginDate: '',
+        // endDate: ''
+      },
+      totalData: {
+        totalRecord: 0,
+        totalCategory: 0,
+        totalQty: 0,
+        totalAmount: 0
+      },
       // 表头
       columns: [
         { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
-        { title: '采购单号', scopedSlots: { customRender: 'purchaseBillNo' }, width: 140, align: 'center' },
+        { title: '采购单号', scopedSlots: { customRender: 'purchaseBillNo' }, width: 200, align: 'center' },
         { title: '创建时间', dataIndex: 'createDate', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '供应商', dataIndex: 'dealerName', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '产品款数', dataIndex: 'totalCategory', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
@@ -163,6 +177,16 @@ export default {
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
+        // 创建时间
+        if (this.time && this.time.length > 0) {
+          this.queryParam.beginDate = moment(this.time[0]).format(this.dateFormat)
+          this.queryParam.endDate = moment(this.time[1]).format(this.dateFormat)
+        } else {
+          this.queryParam.beginDate = undefined
+          this.queryParam.endDate = undefined
+        }
+        // 获取统计数据
+        this.getTotalData(Object.assign(parameter, this.queryParam))
         return purchaseList(Object.assign(parameter, this.queryParam)).then(res => {
           const data = res.data
           const no = (data.pageNo - 1) * data.pageSize
@@ -176,6 +200,11 @@ export default {
     }
   },
   methods: {
+    getTotalData (params) {
+      purchaseCount(params).then(res => {
+        this.totalData = res.data || null
+      })
+    },
     // 不可选日期
     disabledDate (date, dateStrings) {
       return date && date.valueOf() > Date.now()
@@ -186,15 +215,15 @@ export default {
     },
     //  基本信息  保存
     handleOk (row) {
-      this.$router.push({ name: `purchaseOrderAdd`, params: { id: row.id } })
+      this.$router.push({ name: `purchaseOrderAdd`, params: { sn: row.purchaseBillSn } })
     },
     //  编辑
     handleEdit (row) {
-      this.$router.push({ name: `purchaseOrderEdit`, params: { id: row.id } })
+      this.$router.push({ name: `purchaseOrderEdit`, params: { sn: row.purchaseBillSn } })
     },
     //  详情
     handleDetail (row) {
-      this.$router.push({ name: `purchaseOrderDetail`, params: { id: row.id } })
+      this.$router.push({ name: `purchaseOrderDetail`, params: { sn: row.purchaseBillSn } })
     },
     //  签收入库
     handleWarehouse (row) {
@@ -208,15 +237,14 @@ export default {
         content: '删除后不可恢复,确定要进行删除吗?',
         centered: true,
         onOk () {
-          // delectRolePower({
-          //   id: row.id
-          // }).then(res => {
-          //   console.log(res, 'res1111')
-          //   if (res.status == 200) {
-          //     _this.$message.success(res.message)
-          //     _this.$refs.table.refresh()
-          //   }
-          // })
+          purchaseDel({
+            id: row.id
+          }).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.$refs.table.refresh()
+            }
+          })
         }
       })
     },