Browse Source

销售单对接

lilei 4 years ago
parent
commit
1d6f59a423

+ 10 - 0
src/api/power-user.js

@@ -21,6 +21,16 @@ export const getPowerUserList = params => {
   })
 }
 
+// 获取所有用户
+export const getUserAllList = params => {
+  const url = `/mduser/findAll`
+  return axios({
+    url: url,
+    data: params,
+    method: 'POST'
+  })
+}
+
 // 改变权限状态接口
 export const updateEnableStatus = params => {
   return axios({

+ 3 - 3
src/api/sales.js

@@ -91,10 +91,10 @@ export const salesWriteSubmit = (params) => {
     method: 'post'
   })
 }
-//  销售 保存
-export const salesSave = (params) => {
+//  销售 新增
+export const salesInsert = (params) => {
   return axios({
-    url: '/sales/save',
+    url: '/sales/insert',
     data: params,
     method: 'post'
   })

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

@@ -94,7 +94,7 @@ export const asyncRouterMap = [
                 }
               },
               {
-                path: 'add',
+                path: 'add/:id',
                 name: 'salesAdd',
                 component: () => import(/* webpackChunkName: "salesManagement" */ '@/views/salesManagement/salesQuery/edit.vue'),
                 meta: {

+ 164 - 68
src/views/salesManagement/salesQuery/chooseCustomModal.vue

@@ -19,23 +19,25 @@
     >
       <a-row :gutter="15">
         <a-col :span="8">
-          <a-form-model-item label="客户名称" prop="customerName">
+          <a-form-model-item label="客户名称" prop="buyerSn">
             <a-auto-complete
-              id="chooseCustom-customerName"
+              id="chooseCustom-buyerSn"
               placeholder="请选择客户"
               allowClear
-              v-model="form.customerName"
+              v-model="form.buyerSn"
               :filter-option="filterOption"
               @select="custSelect"
               @change="custChange">
               <template slot="dataSource">
-                <a-select-option v-for="item in custAllList" :key="item.id" :title="item.id">{{ item.customerName }}</a-select-option>
+                <a-select-option v-for="item in custAllList" :key="item.customerSn" :title="item.id">{{ item.customerName }}</a-select-option>
               </template>
             </a-auto-complete>
-          </a-form-model-item>
+            </a-button></a-form-model-item>
         </a-col>
-        <a-col :span="8">
-          <a-form-model-item>(未搜索到客户时为新增客户)</a-form-model-item>
+        <a-col :span="16">
+          <a-form-model-item><a-button type="dashed" icon="plus">
+            新增
+          </a-button>(未搜索到客户时点击新增按钮)</a-form-model-item>
         </a-col>
       </a-row>
       <a-row :gutter="15">
@@ -68,11 +70,11 @@
           </a-form-model-item>
         </a-col>
         <a-col :span="8">
-          <a-form-model-item label="详细地址" prop="customerAddr">
+          <a-form-model-item label="" prop="shippingAddress">
             <a-input
-              id="chooseCustom-customerAddr"
+              id="chooseCustom-shippingAddress"
               :maxLength="60"
-              v-model="form.customerAddr"
+              v-model="form.shippingAddress"
               placeholder="请输入详细地址(最多60个字符)"
               allowClear />
           </a-form-model-item>
@@ -80,21 +82,21 @@
       </a-row>
       <a-row :gutter="15">
         <a-col :span="8">
-          <a-form-model-item label="联系人" prop="contactName">
+          <a-form-model-item label="联系人" prop="consigneeName">
             <a-input
-              id="chooseCustom-contactName"
+              id="chooseCustom-consigneeName"
               :maxLength="30"
-              v-model="form.contactName"
+              v-model="form.consigneeName"
               placeholder="请输入联系人(最多30个字符)"
               allowClear />
           </a-form-model-item>
         </a-col>
         <a-col :span="8">
-          <a-form-model-item label="联系电话" prop="contactTel">
+          <a-form-model-item label="联系电话" prop="consigneeTel">
             <a-input
-              id="chooseCustom-contactTel"
+              id="chooseCustom-consigneeTel"
               :maxLength="30"
-              v-model="form.contactTel"
+              v-model="form.consigneeTel"
               placeholder="请输入联系电话(最多30个字符)"
               allowClear />
           </a-form-model-item>
@@ -122,33 +124,33 @@
             </a-row>
           </a-form-model-item>
         </a-col>
-        <a-col :span="8">
+        <!-- <a-col :span="8">
           <a-form-model-item label="支付方式" prop="payType">
             <v-select code="PAY_TYPE" id="chooseCustom-payType" v-model="form.payType" allowClear placeholder="请选择支付方式" />
           </a-form-model-item>
-        </a-col>
+        </a-col> -->
         <a-col :span="8">
-          <a-form-model-item label="收款方式" prop="payment">
-            <v-select code="SETTLE_STYLE_NAME" id="chooseCustom-payment" v-model="form.settleStyleSn" allowClear placeholder="请选择收款方式"></v-select>
+          <a-form-model-item label="收款方式" prop="settleStyle">
+            <v-select code="SETTLE_STYLE_NAME" id="chooseCustom-settleStyle" v-model="form.settleStyle" allowClear placeholder="请选择收款方式"></v-select>
           </a-form-model-item>
         </a-col>
-      </a-row>
-      <a-row :gutter="15">
         <a-col :span="8">
           <a-form-model-item label="配送方式" prop="dispatchType">
             <v-select code="DISPATCH_TYPE" id="chooseCustom-dispatchType" v-model="form.dispatchType" allowClear placeholder="请选择配送方式"></v-select>
           </a-form-model-item>
         </a-col>
+      </a-row>
+      <a-row :gutter="15">
         <a-col :span="8">
-          <a-form-model-item label="业务员" prop="tenantId">
-            <a-select id="chooseCustom-tenantId" v-model="form.tenantId" placeholder="请选择业务员">
-              <a-select-option v-for="item in tenantList" :value="item.id" :key="item.id + 'c'">{{ item.name }}</a-select-option>
+          <a-form-model-item label="业务员" prop="salesManSn">
+            <a-select id="chooseCustom-salesManSn" @change="salesManChange" v-model="form.salesManSn" placeholder="请选择业务员">
+              <a-select-option v-for="item in userList" :value="item.id" :key="item.id + 'c'">{{ item.name }}</a-select-option>
             </a-select>
           </a-form-model-item>
         </a-col>
         <a-col :span="8">
-          <a-form-model-item label="铺货出库" prop="salesman">
-            <v-select code="FLAG" id="chooseCustom-salesman" v-model="form.salesman" allowClear placeholder="请选择"></v-select>
+          <a-form-model-item label="铺货出库" prop="distributionFalg">
+            <v-select code="FLAG" id="chooseCustom-distributionFalg" v-model="form.distributionFalg" allowClear placeholder="请选择"></v-select>
           </a-form-model-item>
         </a-col>
       </a-row>
@@ -178,7 +180,9 @@
 
 <script>
 import { getArea } from '@/api/data'
-import { custAllList, custFindById } from '@/api/customer'
+import { custAllList, custFindById, custSave } from '@/api/customer'
+import { salesInsert } from '@/api/sales'
+import { getUserAllList } from '@/api/power-user'
 import { VSelect } from '@/components'
 export default {
   name: 'ChooseCustomModal',
@@ -195,31 +199,36 @@ export default {
         wrapperCol: { span: 16 }
       },
       form: {
-        customerName: '', // 客户名称
-        contactTel: '', //  联系电话
-        contactName: '', //  联系人
+        buyerName: '', // 客户名称
+        buyerSn: '', // 客户sn
+        consigneeTel: '', //  联系电话
+        consigneeName: '', //  联系人
         provinceSn: undefined, //  省
-        provinceName: '',
+        shippingAddressProvinceName: '',
         citySn: undefined, // 市
-        cityName: '',
+        shippingAddressCityName: '',
         countySn: undefined, // 区
-        countyName: '',
-        customerAddr: '', //  详细地址
+        shippingAddressCountyName: '',
+        shippingAddress: '', //  详细地址
         fax: '', //  客户传真
         dispatchType: '', //  配送方式
         satelliteFlag: 0, //  是否卫星仓客户
         customerTypeSn: undefined, //  客户类型
         priceType: '', //  价格类型
-        payType: '', //  支付方式
-        settleStyleSn: '', //  收款方式
-        tenantId: undefined, //  业务员
+        // payType: '', //  支付方式
+        settleStyle: '', //  收款方式
+        salesManSn: undefined, //  业务员
+        salesManName: '',
+        distributionFalg: '0', // 铺货出库
+        salesTragetType: 'C',
         remarks: '' //  备注
       },
+      custInfo: {}, // 客户信息
       rules: {
-        customerName: [
+        buyerSn: [
           { required: true, message: '请输入客户名称', trigger: ['change', 'blur'] }
         ],
-        contactTel: [
+        consigneeTel: [
           { required: true, message: '请输入联系电话', trigger: 'blur' }
         ],
         provinceSn: [
@@ -231,70 +240,139 @@ export default {
         countySn: [
           { required: true, message: '请选择区/县', trigger: 'change' }
         ],
-        contactPhone: [
-          { required: true, message: '请输入联系电话', trigger: 'blur' }
+        shippingAddress: [
+          { required: true, message: '请输入详细地址', trigger: 'blur' }
         ],
         priceType: [
           { required: true, message: '请选择价格类型', trigger: 'change' }
         ],
-        payType: [
-          { required: true, message: '请选择支付方式', trigger: 'change' }
-        ],
-        settleStyleSn: [
+        // payType: [
+        //   { required: true, message: '请选择支付方式', trigger: 'change' }
+        // ],
+        settleStyle: [
           { required: true, message: '请选择收款方式', trigger: 'change' }
+        ],
+        distributionFalg: [
+          { required: true, message: '请选择是否铺货出库', trigger: 'change' }
         ]
+        // salesManSn: [
+        //   { required: true, message: '请选择业务员', trigger: 'change' }
+        // ]
       },
       custAllList: [], //  客户 下拉数据
       addrProvinceList: [], //  省下拉
       addrCityList: [], //  市下拉
       addrDistrictList: [], //  区下拉
-      tenantList: [], // 业务员 下拉
+      userList: [], // 业务员 下拉
       custId: undefined, // 客户id
       isEdit: true //  是否可编辑
     }
   },
   methods: {
+    // 业务员
+    salesManChange (id) {
+      this.form.salesManName = this.userList.find(item => item.id == id).name
+    },
     // 客户 select
-    custSelect (id) {
-      this.custId = id
+    custSelect (v) {
+      const cust = this.custAllList.find(item => item.customerSn == v)
+      this.custId = cust.id
+      this.form.buyerName = cust.customerName
       this.isEdit = false
       this.getDetail()
     },
     // 客户 change
     custChange (val) {
+      if (val == undefined || val == '') {
+        this.$refs.ruleForm.resetFields()
+      }
       this.custId = undefined
       this.isEdit = true
     },
+    // 编辑客户信息
+    editCust (data) {
+      console.log(data)
+      if (data.provinceSn) { this.getArea('city', data.provinceSn) }
+      if (data.citySn) { this.getArea('district', data.citySn) }
+      this.form = data
+    },
     //  获取详情
     getDetail () {
       custFindById({ id: this.custId }).then(res => {
-        if (res.status == 200) {
-          if (res.data.provinceSn) { this.getArea('city', res.data.provinceSn) }
-          if (res.data.citySn) { this.getArea('district', res.data.citySn) }
-          this.form = Object.assign(this.form, res.data)
+        const data = res.data
+        if (res.status == 200 && data) {
+          if (data.provinceSn) { this.getArea('city', data.provinceSn) }
+          if (data.citySn) { this.getArea('district', data.citySn) }
+          this.form = Object.assign(this.form, {
+            buyerName: data.customerName, // 客户名称
+            buyerSn: data.customerSn, // 客户sn
+            consigneeTel: data.contactTel, //  联系电话
+            consigneeName: data.contactName, //  联系人
+            provinceSn: data.provinceSn, //  省
+            shippingAddressProvinceName: data.provinceName,
+            citySn: data.citySn, // 市
+            shippingAddressCityName: data.cityName,
+            countySn: data.countySn, // 区
+            shippingAddressCountyName: data.countyName,
+            shippingAddress: data.customerAddr, //  详细地址
+            fax: data.fax, //  客户传真
+            dispatchType: data.dispatchType, //  配送方式
+            satelliteFlag: data.satelliteFlag, //  是否卫星仓客户
+            customerTypeSn: data.customerTypeSn, //  客户类型
+            priceType: data.priceType, //  价格类型
+            settleStyle: data.settleStyleSn //  收款方式
+          })
+          // 临时存储客户信息
+          this.custInfo = data
         } else {
+          this.$message.error('获取客户信息失败')
           this.$refs.ruleForm.resetFields()
         }
+        this.$refs.ruleForm.clearValidate()
+      })
+    },
+    // 保存客户信息
+    handleSaveCust () {
+      custSave({
+        id: this.custInfo.id,
+        customerName: this.form.buyerName,
+        contactTel: this.form.consigneeTel, //  联系电话
+        contactName: this.form.consigneeName, //  联系人
+        provinceSn: this.form.provinceSn, //  省
+        provinceName: this.form.shippingAddressProvinceName,
+        citySn: this.form.citySn, // 市
+        cityName: this.form.shippingAddressCityName,
+        countySn: this.form.countySn, // 区
+        countyName: this.form.shippingAddressCountyName,
+        customerAddr: this.form.shippingAddress, //  详细地址
+        dispatchType: this.form.dispatchType, //  配送方式
+        customerTypeSn: this.form.customerTypeSn, //  客户类型
+        priceType: this.form.priceType, //  价格类型
+        settleStyleSn: this.form.settleStyle //  收款方式
+      }).then(res => {
+        if (res.status != 200) {
+          this.$message.error(res.message)
+        }
       })
     },
     //  保存
     handleSubmit (e) {
       e.preventDefault()
       const _this = this
-      this.$emit('ok', { id: 1000, customName: '车领主常青二路店' })
-      this.cancel()
       this.$refs.ruleForm.validate(valid => {
         if (valid) {
-          console.log('-------------提交信息', _this.form)
-          //     const form = values.form
-          //     form.desc = _this.form.desc
-          //     form.id = this.isEdit ? this.$route.params.id : null
-          //     console.log(form,'-----提交信息')
-          //     // goodsSave(form).then(res => {
-          //     //   if (res.status == 200) {
-          //     //     _this.$message.success(res.message)
-          //     //   }
-          //     // })
+          // 保存客户信息
+          _this.handleSaveCust()
+          // 新建销售单
+          const form = this.form
+          console.log(form, 'save data')
+          salesInsert(form).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.$emit('ok', res.data)
+              _this.cancel()
+            }
+          })
         } else {
           console.log('error submit!!')
           return false
@@ -317,25 +395,42 @@ export default {
         }
       })
     },
+    // 获取业务员列表数据
+    getUserAllList () {
+      getUserAllList({}).then(res => {
+        if (res.status == 200) {
+          this.userList = res.data || []
+        } else {
+          this.userList = []
+        }
+      })
+    },
     // 获取城市列表
     getCityList (val) {
+      console.log(val, '-------------')
       this.addrCityList = []
       this.addrDistrictList = []
       this.form.citySn = undefined
+      this.form.shippingAddressCityName = ''
       this.form.countySn = undefined
-      this.form.customerAddr = ''
+      this.form.shippingAddressCountyName = ''
+      this.form.shippingAddress = ''
+      this.form.shippingAddressCountyName = this.addrProvinceList.find(item => item.id == val).name
       this.getArea('city', val)
     },
     // 获取区县列表
     getAreaList (val) {
       this.addrDistrictList = []
       this.form.countySn = undefined
-      this.form.customerAddr = ''
+      this.form.shippingAddressCountyName = ''
+      this.form.shippingAddress = ''
+      this.form.shippingAddressCityName = this.addrCityList.find(item => item.id == val).name
       this.getArea('district', val)
     },
     // 区县变更
     areaCharged (val) {
-      this.form.customerAddr = ''
+      this.form.shippingAddress = ''
+      this.form.shippingAddressCountyName = this.addrDistrictList.find(item => item.id == val).name
     },
     //  省/市/区
     getArea (type, sn) {
@@ -377,6 +472,7 @@ export default {
       if (newValue) {
         this.getArea('province')
         this.getCustAllList()
+        this.getUserAllList()
       }
     }
   }

+ 27 - 5
src/views/salesManagement/salesQuery/edit.vue

@@ -1,10 +1,11 @@
 <template>
   <div class="salesEdit-wrap">
-    <a-page-header :ghost="false" @back="handleBack" >
+    <a-page-header :ghost="false" :backIcon="false" @back="handleBack" >
       <!-- 自定义的二级文字标题 -->
       <template slot="subTitle">
-        <a id="salesEdit-back-btn" href="javascript:;" @click="handleBack">客户名称:车领主常青二路店</a>
-        <a-button id="salesEdit-edit-btn" size="small" @click="handleEdit" style="margin-left:50px" key="0">编辑</a-button>
+        <a id="salesEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
+        <span style="margin: 0 15px;color: #666;">客户名称:{{ detailData&&detailData.buyerName }}</span>
+        <a-button id="salesEdit-edit-btn" size="small" @click="handleEdit" style="margin-left:10px" key="0">编辑</a-button>
       </template>
       <!-- 操作区,位于 title 行的行尾 -->
       <template slot="extra">
@@ -77,7 +78,7 @@
       </s-table>
     </a-card>
     <!-- 选择客户弹框 -->
-    <choose-custom-modal :show="openModal" @ok="chooseCustomOk" @cancel="openModal=false" />
+    <choose-custom-modal ref="custModal" :show="openModal" @ok="chooseCustomOk" @cancel="openModal=false" />
   </div>
 </template>
 
@@ -85,13 +86,16 @@
 import { STable, VSelect } from '@/components'
 import queryPart from './queryPart.vue'
 import chooseCustomModal from './chooseCustomModal.vue'
+import { salesDetail } from '@/api/sales'
 export default {
   name: 'SalesDetail',
   components: { STable, VSelect, queryPart, chooseCustomModal },
   data () {
     return {
+      orderId: null, // 销售单id
       disabled: false, //  查询、重置按钮是否可操作
-      openModal: false,
+      openModal: false, // 客户弹框
+      detailData: null, // 订单基础数据
       dataSource: [],
       productForm: {
         productNo: '',
@@ -173,15 +177,33 @@ export default {
     chooseCustomOk (data) {
 
     },
+    // 编辑客户信息
     handleEdit () {
       this.openModal = true
+      this.$refs.custModal.editCust(this.detailData)
     },
     //  重置
     resetSearchForm () {},
     //  返回
     handleBack () {
       this.$router.push({ path: '/salesManagement/salesQuery/list' })
+    },
+    //  详情
+    getOrderDetail () {
+      salesDetail({ id: this.$route.params.id }).then(res => {
+        if (res.status == 200) {
+          this.detailData = res.data
+        } else {
+          this.detailData = null
+        }
+      })
     }
+  },
+  beforeRouteEnter (to, from, next) {
+    next(vm => {
+      // 获取销售单详情
+      vm.getOrderDetail()
+    })
   }
 }
 </script>

+ 34 - 33
src/views/salesManagement/salesQuery/list.vue

@@ -46,7 +46,7 @@
                   v-model="queryParam.payType"
                   ref="payType"
                   id="salesManagementList-payType"
-                  code="PAYMENT_TYPE"
+                  code="PAY_TYPE"
                   placeholder="请选择支付方式"
                   allowClear></v-select>
               </a-form-item>
@@ -57,7 +57,7 @@
                   v-model="queryParam.settleStyle"
                   ref="settleStyle"
                   id="salesManagementList-settleStyle"
-                  code="PAYMENT_TYPE"
+                  code="SETTLE_STYLE_NAME"
                   placeholder="请选择收款方式"
                   allowClear></v-select>
               </a-form-item>
@@ -65,10 +65,10 @@
             <a-col :md="6" :sm="24">
               <a-form-item label="业务状态">
                 <v-select
-                  v-model="queryParam.auditStatus"
-                  ref="auditStatus"
-                  id="salesManagementList-auditStatus"
-                  code="PAYMENT_TYPE"
+                  v-model="queryParam.billStatus"
+                  ref="billStatus"
+                  id="salesManagementList-billStatus"
+                  code="BILL_STATUS"
                   placeholder="请选择业务状态"
                   allowClear></v-select>
               </a-form-item>
@@ -79,7 +79,7 @@
                   v-model="queryParam.financialStatus"
                   ref="financialStatus"
                   id="salesManagementList-financialStatus"
-                  code="PAYMENT_TYPE"
+                  code="FINANCIAL_STATUS"
                   placeholder="请选择财务状态"
                   allowClear></v-select>
               </a-form-item>
@@ -114,10 +114,10 @@
       :rowKey="(record) => record.id"
       :columns="columns"
       :data="loadData"
-      :scroll="{ x: 2040 }"
+      :scroll="{ x: 2040, y:300 }"
       bordered>
       <!-- 业务/审核状态 -->
-      <template slot="auditStatus" slot-scope="text, record">
+      <template slot="billStatus" slot-scope="text, record">
         <a-tag :color="record.state=='FINISH'?'green':'red'" >{{ record.state=='FINISH'? '待备货审核': '待单据审核' }}</a-tag>
       </template>
       <!-- 财务状态 -->
@@ -147,7 +147,7 @@ import moment from 'moment'
 import { STable, VSelect } from '@/components'
 import chooseCustomModal from './chooseCustomModal.vue'
 import { custAllList } from '@/api/customer'
-import { salesList, salesDel } from '@/api/sales'
+import { salesList, salesDel, salesWriteAudit, salesWriteStockOut } from '@/api/sales'
 export default {
   name: 'TableList',
   components: { STable, VSelect, chooseCustomModal },
@@ -166,7 +166,7 @@ export default {
         purchaseBillNo: '', //  采购单号
         payType: undefined, //  支付方式
         settleStyle: undefined, //  收款方式
-        auditStatus: undefined, //  业务状态
+        billStatus: undefined, //  业务状态
         financialStatus: undefined //  财务状态
       },
       // 表头
@@ -221,25 +221,26 @@ export default {
     },
     // 选择客户成功
     chooseCustomOk (data) {
-      this.$router.push({ path: '/salesManagement/salesQuery/add' })
+      this.$router.push({ name: 'salesAdd', params: { id: data.id } })
     },
     //  审核
     handleEexamine (row) {
       const _this = this
       this.$confirm({
         title: '提示',
-        content: '确认要审核通过吗?',
+        content: '请点击下方按钮确认操作?',
         centered: true,
+        okText: '审核通过',
+        canselText: '审核不通过',
         onOk () {
-          // delectRolePower({
-          //   id: row.id
-          // }).then(res => {
-          //   console.log(res, 'res1111')
-          //   if (res.status == 200) {
-          //     _this.$message.success(res.message)
-          //     _this.$refs.table.refresh()
-          //   }
-          // })
+          salesWriteAudit({
+            id: row.id
+          }).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.$refs.table.refresh()
+            }
+          })
         }
       })
     },
@@ -251,25 +252,25 @@ 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()
-          //   }
-          // })
+          salesWriteStockOut({
+            id: row.id,
+            salesBillSn: row.salesBillSn
+          }).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.$refs.table.refresh()
+            }
+          })
         }
       })
     },
     // 详情
     handleDetail (row) {
-      this.$router.push({ path: `/salesManagement/salesQuery/detail/${row.id}/${row.salesBillSn}` })
+      this.$router.push({ name: 'salesDetail', params: { id: row.id, sn: row.salesBillSn } })
     },
     // 编辑
     handleEdit (row) {
-      this.$router.push({ path: `/salesManagement/salesQuery/edit/${row.id}` })
+      this.$router.push({ name: 'salesEdit', params: { id: row.id } })
     },
     // 删除
     handleDel (row) {

+ 83 - 55
src/views/salesManagement/salesQuery/queryPart.vue

@@ -6,42 +6,50 @@
         <a-row :gutter="15">
           <a-col :md="6" :sm="24">
             <a-form-item label="产品编码">
-              <a-input id="productInfoList-bundleName" v-model.trim="queryParam.bundleName" allowClear placeholder="请输入产品编码"/>
+              <a-input id="productInfoList-code" v-model.trim="queryParam.code" allowClear placeholder="请输入产品编码"/>
             </a-form-item>
           </a-col>
           <a-col :md="6" :sm="24">
             <a-form-item label="产品名称">
-              <a-input id="productInfoList-bundleName" v-model.trim="queryParam.bundleName" allowClear placeholder="请输入产品名称"/>
+              <a-input id="productInfoList-name" v-model.trim="queryParam.name" allowClear placeholder="请输入产品名称"/>
             </a-form-item>
           </a-col>
           <a-col :md="6" :sm="24">
             <a-form-item label="原厂编码">
-              <a-input id="productInfoList-bundleName" v-model.trim="queryParam.bundleName" allowClear placeholder="请输入原厂编码"/>
+              <a-input id="productInfoList-origCode" v-model.trim="queryParam.origCode" allowClear placeholder="请输入原厂编码"/>
             </a-form-item>
           </a-col>
           <template v-if="advanced">
             <a-col :md="6" :sm="24">
               <a-form-item label="车架号(VIN)">
-                <a-input id="productInfoList-bundleName" v-model.trim="queryParam.bundleName" allowClear placeholder="请输入车架号(VIN)"/>
+                <a-input id="productInfoList-vinNo" v-model.trim="queryParam.vinNo" allowClear placeholder="请输入车架号(VIN)"/>
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="产品品牌">
                 <a-select
                   placeholder="请选择产品品牌"
-                  id="productInfoList-state"
+                  id="productInfoList-productBrandSn"
                   allowClear
-                  v-model="queryParam.dataSourceNo"
+                  v-model="queryParam.productBrandSn"
                   :showSearch="true"
                   option-filter-prop="children"
                   :filter-option="filterOption">
-                  <a-select-option v-for="item in brandData" :key="item.salesChannelNo" :value="item.salesChannelNo">{{ item.salesChannelName }}</a-select-option>
+                  <a-select-option v-for="item in productBrandList" :key="item.brandSn" :value="item.brandSn">{{ item.brandName }}</a-select-option>
                 </a-select>
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="产品类别">
-                <a-cascader :options="typeData" id="productInfoList-state" placeholder="请选择产品类别" allowClear v-model="queryParam.brand" />
+                <a-cascader
+                  @change="changeProductType"
+                  change-on-select
+                  v-model="productType"
+                  :options="productTypeList"
+                  :fieldNames="{ label: 'productTypeName', value: 'productTypeSn', children: 'children' }"
+                  id="productInfoList-productType"
+                  placeholder="请选择产品分类"
+                  allowClear />
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
@@ -86,7 +94,7 @@
       <template slot="price" slot-scope="text, record">
         <a-input-number
           id="productInfoList-price"
-          :value="record.price"
+          :value="record.terminalPrice"
           :precision="0"
           :min="0"
           :max="999999"
@@ -115,7 +123,9 @@
 </template>
 
 <script>
-// import { customerBundleDelayList, customerBundleExportDelay } from '@/api/FinancialManagement'
+import { productBrandQuery } from '@/api/productBrand'
+import { productTypeQuery } from '@/api/productType'
+import { productList } from '@/api/product'
 import productSalesRecordModal from './productSalesRecordModal.vue'
 import { STable, VSelect } from '@/components'
 export default {
@@ -124,20 +134,29 @@ export default {
   data () {
     return {
       advanced: false, // 高级搜索 展开/关闭
+      productType: [],
       queryParam: { //  查询条件
-        bundleName: '', //  供应商名称
-        state: undefined //  状态
+        pageSize: 5,
+        code: '', //  产品编码
+        name: '', //  产品名称
+        origCode: '', //  原厂编码
+        sysFlag: '1',
+        productBrandSn: undefined, //  产品品牌
+        productTypeSn1: '', //  产品一级分类
+        productTypeSn2: '', //  产品二级分类
+        productTypeSn3: '', //  产品三级分类
+        onlineFalg: undefined //  状态
       },
       disabled: false, //  查询、重置按钮是否可操作
       exportLoading: false, // 导出loading
-      brandData: [], //  下拉数据
-      typeData: [], //  产品类别  下拉数据
+      productBrandList: [], //  下拉数据
+      productTypeList: [], //  产品类别  下拉数据
       columns: [
         { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
-        { title: '产品编码', dataIndex: 'productNo', width: 140, align: 'center', sorter: true },
-        { title: '产品名称', dataIndex: 'productName', align: 'center' },
-        { title: '原厂编码', dataIndex: 'ycNo', width: 140, align: 'center' },
-        { title: '品牌', dataIndex: 'productBrand', width: 100, align: 'center', sorter: true },
+        { title: '产品编码', dataIndex: 'code', width: 140, align: 'center', sorter: true },
+        { title: '产品名称', dataIndex: 'name', align: 'center' },
+        { title: '原厂编码', dataIndex: 'origCode', width: 140, align: 'center' },
+        { title: '品牌', dataIndex: 'productBrandName', width: 100, align: 'center', sorter: true },
         { title: '仓库', dataIndex: 'cangku', width: 100, align: 'center', sorter: true },
         { title: '仓位', dataIndex: 'cangwei', width: 100, align: 'center' },
         { title: '辅助单位', dataIndex: 'pzdw', width: 100, align: 'center' },
@@ -149,41 +168,21 @@ export default {
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
-        // return customerBundleDelayList( 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
-        //   }
-        //   this.disabled = false
-        //   return data
-        // })
-        const _this = this
-        return new Promise(function (resolve, reject) {
-          const data = {
-            pageNo: 1,
-            pageSize: 10,
-            list: [
-              {
-                id: '1',
-                productNo: 'jgqp1111111111',
-                productName: '产品1',
-                ycNo: 'jgqp111123545',
-                productBrand: '箭冠品牌',
-                productType: '产品分类1',
-                price: 5.6,
-                salesNums: 12,
-                dw: '个'
-              }
-            ],
-            count: 10
-          }
+        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].salesNums = 1
+          }
+          this.disabled = false
+          if (this.productBrandList.length == 0) {
+            this.getProductBrand()
           }
-          _this.disabled = false
-          resolve(data)
+          if (this.productTypeList.length == 0) {
+            this.getProductType()
+          }
+          return data
         })
       },
       openModal: false, //  查看客户详情  弹框
@@ -203,12 +202,15 @@ export default {
     },
     //  重置
     resetSearchForm () {
-      this.queryParam.orderBundleNo = ''
-      this.queryParam.orderBundle.custMobile = ''
-      this.queryParam.bundleName = ''
-      this.queryParam.itemName = ''
-      this.oldTime = undefined
-      this.newTime = undefined
+      this.queryParam.code = ''
+      this.queryParam.name = ''
+      this.queryParam.origCode = ''
+      this.queryParam.productBrandSn = undefined
+      this.queryParam.productTypeSn1 = ''
+      this.queryParam.productTypeSn2 = ''
+      this.queryParam.productTypeSn3 = ''
+      this.queryParam.onlineFalg = undefined
+      this.productType = []
       this.$refs.table.refresh(true)
     },
     filterOption (input, option) {
@@ -229,6 +231,32 @@ export default {
     closeModal () {
       this.itemId = ''
       this.openModal = false
+    },
+    //  产品品牌  列表
+    getProductBrand () {
+      productBrandQuery({}).then(res => {
+        if (res.status == 200) {
+          this.productBrandList = res.data
+        } else {
+          this.productBrandList = []
+        }
+      })
+    },
+    //  产品分类  列表
+    getProductType () {
+      productTypeQuery({}).then(res => {
+        if (res.status == 200) {
+          this.productTypeList = res.data
+        } else {
+          this.productTypeList = []
+        }
+      })
+    },
+    //  产品分类  change
+    changeProductType (val, opt) {
+      this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
+      this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
+      this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
     }
   }
 }