Qukatie hace 3 años
padre
commit
fdadf3b0eb

+ 13 - 0
src/api/basicData/Inventory.js

@@ -0,0 +1,13 @@
+import request from '@/router/axios';
+
+export const getList = (current, size, params) => {
+    return request({
+        url: '/api/blade-stock/stockgoods/app-stockPartsPage',
+        method: 'get',
+        params: {
+            ...params,
+            current,
+            size,
+        }
+    })
+}

+ 29 - 1
src/api/basicData/client.js

@@ -32,4 +32,32 @@ export const getDetails = (data) => {
     method: 'get',
     params:data
   })
-}
+}
+export const addCorpType = (data) => {
+  return request({
+    url: '/api/blade-client/corpstype/submit',
+    method: 'POST',
+    data:data
+  })
+}
+export const getCorpType = (data) => {
+  return request({
+    url: '/api/blade-client/corpstype/tree',
+    method: 'get',
+    params:data
+  })
+}
+export const submit = (data) => {
+  return request({
+    url: '/api/blade-client/corpsdesc/submit',
+    method: 'POST',
+    data:data
+  })
+}
+export const remove = (data) => {
+  return request({
+    url: '/api/blade-client/corpsdesc/update',
+    method: 'POST',
+    data:data
+  })
+}

+ 65 - 0
src/api/basicData/product.js

@@ -0,0 +1,65 @@
+import request from '@/router/axios';
+
+export const getList = (current, size, params) => {
+    return request({
+        url: '/api/blade-client/goodsdesc/descList',
+        method: 'get',
+        params: {
+            ...params,
+            current,
+            size,
+        }
+    })
+}
+
+export const getGoodstype = () => {
+    return request({
+        url: '/api/blade-client/goodstype/tree',
+        method: 'get',
+    })
+}
+
+export const getDetails = (data) => {
+    return request({
+        url: '/api/blade-client/goodsDescParts/partsDetails',
+        method: 'get',
+        params: data
+    })
+}
+
+export const submit = (data) => {
+    return request({
+        url: '/api/blade-client/goodsDescParts/modify',
+        method: 'post',
+        data: data
+    })
+}
+export const goodsTypesubmit = (data) => {
+    return request({
+        url: '/api/blade-client/goodstype/submit',
+        method: 'post',
+        data: data
+    })
+}
+
+export const getStoragetype = (data) => {
+    return request({
+        url: '/api/blade-client/storagetype/tree',
+        method: 'get',
+        params: data
+    })
+}
+export const remove = (data) => {
+    return request({
+        url: '/api/blade-client/goodsDescParts/delete',
+        method: 'post',
+        params: data
+    })
+}
+export const itemRemove = (data) => {
+    return request({
+        url: '/api/blade-stock/stockgoods/remove',
+        method: 'post',
+        data: data
+    })
+}

+ 67 - 0
src/api/basicData/salesOrder.js

@@ -0,0 +1,67 @@
+import request from '@/router/axios';
+
+export const getList = (current, size, params) => {
+  return request({
+    url: 'api/blade-purchase-sales/appParts/page',
+    method: 'get',
+    params: {
+      ...params,
+      current,
+      size,
+    }
+  })
+}
+export const getCorpsAll = () => {
+  return request({
+    url: '/api/blade-client/partsCorps/getCorpsAll',
+    method: 'get',
+  })
+}
+export const getCorpDetails = (data) => {
+  return request({
+    url: '/api/blade-client/partsCorps/getDetails',
+    method: 'get',
+    params:data
+  })
+}
+export function gainUser(query) {
+  return request({
+    url: '/api/blade-user/client/gainUser',
+    method: 'get',
+    params: query
+  })
+}
+export function submit(data) {
+  return request({
+    url: '/api/blade-purchase-sales/dealerOrder/submitApp',
+    method: 'post',
+    data:data
+  })
+}
+export const getDetails = (data) => {
+  return request({
+    url: '/api/blade-purchase-sales/appParts/detail',
+    method: 'get',
+    params:data
+  })
+}
+export function remove(data) {
+  return request({
+    url: '/api/blade-purchase-sales/orderitems/update',
+    method: 'post',
+    data: {
+      id: data
+    }
+  })
+}
+export const getGoodsList = (current, size, params) => {
+  return request({
+      url: '/api/blade-client/goodsdesc/descList',
+      method: 'get',
+      params: {
+          ...params,
+          current,
+          size,
+      }
+  })
+}

+ 61 - 0
src/components/ypj-corp/main.vue

@@ -0,0 +1,61 @@
+<template>
+    <div>
+        <el-select size="small" v-model="value" placeholder="请选择" @input="$emit('event', value)" :disabled="disabled"
+            filterable clearable style="width:100%" @change="corpChange">
+            <el-option v-for="item in corpList" :key="item.value" :label="item.label" :value="item.value">
+            </el-option>
+        </el-select>
+    </div>
+</template>
+  
+<script>
+import { getCorpsAll, getCorpDetails } from "@/api/basicData/salesOrder";
+export default {
+    data() {
+        return {
+            corpList: []
+        };
+    },
+    props: {
+        value: String,
+        disabled: {
+            type: Boolean,
+            default: false
+        },
+        dataInfo: {
+            type: Boolean,
+            default: false
+        },
+    },
+    model: {
+        prop: "value",
+        event: "event"
+    },
+    created() {
+        getCorpsAll().then(res => {
+            this.corpList = res.data.data
+        })
+    },
+    methods: {
+        corpChange(row) {
+            if (this.dataInfo) {
+                getCorpDetails({ id: row }).then(res => {
+                    this.$emit('getCorpData', res.data.data)
+                })
+            } else {
+                this.corpList.forEarch(e => {
+                    if (row == e.value) {
+                        return e.label
+                    }
+                })
+            }
+
+        }
+    }
+};
+</script>
+  
+<style scoped lang="scss">
+
+</style>
+  

+ 3 - 0
src/main.js

@@ -55,6 +55,8 @@ import changeApprove from "@/components/change-approve/main"
 import warehousKH from '@/components/warehousKH/main';
 //仓库客户组件
 import eCropSelect from '@/components/e-crop-select/main';
+//配件客户组件
+import ypjCorp from '@/components/ypj-corp/main';
 // 标题跳转组件
 import eCropJump from '@/components/e-crop-jump/index';
 //枚举列设置名称管理
@@ -92,6 +94,7 @@ Vue.component('messagePost', messagePost);
 Vue.component('changeApprove', changeApprove)
 Vue.component('warehousKh', warehousKH)
 Vue.component('eCropSelect', eCropSelect)
+Vue.component('ypjCorp', ypjCorp)
 Vue.component('eCropJump', eCropJump)
 import portInfo from "@/components/port-info/index";
 Vue.component('portInfo', portInfo);

+ 9 - 1
src/util/calculate.js

@@ -44,7 +44,15 @@ export function multiply(num, num2,num3) {
   const multiply = _.multiply(val, val2)
   return Number(multiply).toFixed(val3)
 }
-
+//两数相减
+export function subtract(num, num2,num3) {
+  //最新价格
+  const val = Number(num ? num : 0)
+  const val2 = Number(num2 ? num2 : 0)
+  const val3 = Number(num3 ? num3 : 2)
+  const subtract = _.subtract(val, val2)
+  return Number(subtract).toFixed(val3)
+}
 //原始成本=最新价格/(1+税率/100)
 export function costCal(num, num2) {
   //最新价格

+ 5 - 8
src/views/Inventory/index.vue

@@ -48,7 +48,7 @@
 <script>
 import detailsPage from "./detailsPage";
 import { option } from "./js/optionList";
-import { getList, getCorpsAll, pageStatistics } from "@/api/basicData/client";
+import { getList} from "@/api/basicData/Inventory";
 export default {
   name: "index",
   data() {
@@ -79,10 +79,10 @@ export default {
   },
   methods: {
     getAllWorkDicts() {
-      getCorpsAll().then(res => {
-        this.findObject(this.option.column, "id").dicData = res.data.data;
-        this.findObject(this.option.column, "ids").dicData = res.data.data;
-      })
+      // getCorpsAll().then(res => {
+      //   this.findObject(this.option.column, "id").dicData = res.data.data;
+      //   this.findObject(this.option.column, "ids").dicData = res.data.data;
+      // })
       this.$refs.crud.init();
     },
     searchCriteriaSwitch(type) {
@@ -121,9 +121,6 @@ export default {
           this.page.total = res.data.data.total;
         })
         .finally(() => {
-          pageStatistics(data).then(res => {
-            this.form = res.data.data
-          })
           this.loading = false;
         });
     },

+ 3 - 15
src/views/Inventory/js/optionList.js

@@ -17,12 +17,6 @@ export const option = {
   searchIndex: 2,
   column: [
     {
-      label: "图片",
-      prop: "img",
-      overHidden: true,
-      index: 1
-    },
-    {
       label: "产品分类",
       prop: "type",
       overHidden: true,
@@ -36,13 +30,6 @@ export const option = {
       index: 3
     },
     {
-      label: "规格型号",
-      prop: "debitAmount",
-      search: true,
-      overHidden: true,
-      index: 4
-    },
-    {
       label: "库存",
       prop: "deliveringAmount",
       overHidden: true,
@@ -65,17 +52,18 @@ export const option = {
       label: "库存预警值",
       prop: "deliveringAmount",
       overHidden: true,
+      width:120,
       index: 8
     },
     {
       label: "采购价",
-      prop: "deliveringAmount",
+      prop: "purchasePrice",
       overHidden: true,
       index: 9
     },
     {
       label: "成本均价",
-      prop: "deliveringAmount",
+      prop: "stockPrice",
       overHidden: true,
       cell:true,
       index: 10

+ 45 - 23
src/views/client/detailsInfo.vue

@@ -83,13 +83,19 @@
                         @saveColumn="saveColumn" @resetColumn="resetColumn" :cell-style="cellStyle"
                         @search-criteria-switch="searchCriteriaSwitch">
                         <template slot="menuLeft">
-                            <el-button type="primary" size="mini">新建销售单
-                            </el-button>
+                            <!-- <el-button type="primary" size="mini">新建销售单
+                            </el-button> -->
                             <el-button size="mini">收款
                             </el-button>
                             <el-button size="mini">送货
                             </el-button>
                         </template>
+                        <template slot="businesDateSearch">
+                            <el-date-picker v-model="search.businesDate" type="daterange" start-placeholder="开始日期"
+                                end-placeholder="结束日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss"
+                                :default-time="['00:00:00', '23:59:59']">
+                            </el-date-picker>
+                        </template>
                     </avue-crud>
                 </el-tab-pane>
                 <el-tab-pane label="资金往来" name="second">
@@ -121,7 +127,7 @@
                         <el-col :span="4">备用电话</el-col>
                         <el-col :span="4">{{ form.telephone | nameFileter }}</el-col>
                         <el-col :span="4">传真</el-col>
-                        <el-col :span="4">{{ form.Fax | nameFileter }}</el-col>
+                        <el-col :span="4">{{ form.fax | nameFileter }}</el-col>
                         <el-col :span="4">邮箱</el-col>
                         <el-col :span="4">{{ form.mailbox | nameFileter }}</el-col>
                     </el-row>
@@ -129,10 +135,10 @@
                         <el-col :span="4">备注</el-col>
                         <el-col :span="20">{{ form.remarks | nameFileter }}</el-col>
                     </el-row>
-                    <el-row class="client_info">
+                    <el-row class="client_info" v-for="(item, index) in corpsAddrList" :key="index">
                         <el-col :span="2"><i class="el-icon-location"></i></el-col>
-                        <el-col :span="4">客户地址</el-col>
-                        <el-col :span="18">(公司地址)天津市和平区222</el-col>
+                        <el-col :span="4">{{ item.type == 0 ? '客户地址' : '物流地址' }}</el-col>
+                        <el-col :span="18">{{ item.detailedAddress }}</el-col>
                     </el-row>
                 </el-tab-pane>
             </el-tabs>
@@ -142,6 +148,7 @@
   
 <script>
 import { optionList, sellOption, capitalOption } from "./js/optionList";
+import { getList, getCorpsAll, gainUser } from "@/api/basicData/salesOrder";
 import { getDetails } from "@/api/basicData/client";
 import { validatenull } from "@/util/validate";
 export default {
@@ -158,13 +165,13 @@ export default {
                 settlmentAmount: 0
             },
             page: {
-                pageSize: 20,
+                pageSize: 10,
                 currentPage: 1,
                 total: 0,
                 pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
             },
             page2: {
-                pageSize: 20,
+                pageSize: 10,
                 currentPage: 1,
                 total: 0,
                 pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
@@ -176,6 +183,7 @@ export default {
             capitalOption: {},
             sellList: [],
             capitalList: [],
+            corpsAddrList: []
         };
     },
     props: {
@@ -206,6 +214,12 @@ export default {
     methods: {
         getAllWorkDicts() {
             // this.findObject(this.optionList.column, "departureId").dicData = JSON.parse(localStorage.getItem('areaTypeTree'));
+            getCorpsAll().then(res => {
+                this.findObject(this.sellOption.column, "corpId").dicData = res.data.data;
+            })
+            gainUser().then(res => {
+                this.findObject(this.sellOption.column, "createUser").dicData = res.data.data;
+            })
         },
         cellStyle() {
             return "padding:0;height:40px;";
@@ -236,19 +250,27 @@ export default {
         },
         onLoad(page, params = {}) {
             let data = this.deepClone(Object.assign(params, this.search));
-            // this.loading = true;
-            //   getList(
-            //     page.currentPage,
-            //     page.pageSize,
-            //     data
-            //   )
-            //     .then(res => {
-            //       this.dataList = res.data.data.records ? res.data.data.records : [];
-            //       this.page.total = res.data.data.total;
-            //     })
-            //     .finally(() => {
-            //       this.loading = false;
-            //     });
+            data.billType = 'XS';
+            data.tradeType = 'YPJ';
+            if (data.businesDate) {
+                data.orderStartDate = data.businesDate[0];
+                data.orderEndDate = data.businesDate[1];
+            }
+            delete data.businesDate
+            data.corpId = this.detailData.id;
+            this.loading = true;
+            getList(
+                page.currentPage,
+                page.pageSize,
+                data
+            )
+                .then(res => {
+                    this.sellList = res.data.data.records ? res.data.data.records : [];
+                    this.page.total = res.data.data.total;
+                })
+                .finally(() => {
+                    this.loading = false;
+                });
         },
         searchCriteriaSwitch2(type) {
             if (type) {
@@ -283,7 +305,7 @@ export default {
             //     data
             //   )
             //     .then(res => {
-            //       this.dataList = res.data.data.records ? res.data.data.records : [];
+            //       this.sellList = res.data.data.records ? res.data.data.records : [];
             //       this.page.total = res.data.data.total;
             //     })
             //     .finally(() => {
@@ -295,7 +317,7 @@ export default {
             getDetails({ id: id })
                 .then(res => {
                     this.form = res.data.data;
-                    this.dataList = res.data.data.orderCostItemList;
+                    this.corpsAddrList = res.data.data.corpsAddrList;
                 })
                 .finally(() => {
                     this.loading = false;

+ 200 - 64
src/views/client/detailsPage.vue

@@ -13,43 +13,67 @@
           </el-button>
         </div>
       </div>
-      <trade-card title="基础资料" style="margin-top: 60px">
+      <trade-card title="基础资料" style="margin-top: 60px" v-loading="loadingBtn">
         <avue-form ref="form" class="trading-form" v-model="form" :option="option">
+          <template slot="corpsTypeId">
+            <div style="display:flex;">
+              <avue-select v-model="form.corpsTypeId" placeholder="请选择客户分类" :dic="corpTypeList" :props="props">
+              </avue-select>
+              <!-- <el-button icon="el-icon-plus" size="mini" @click="corpTypeVisible = true"></el-button> -->
+              <i class="el-icon-circle-plus-outline" style="font-size:18px;line-height: 32px;margin-left:4px"
+                @click="corpTypeVisible = true"></i>
+            </div>
+          </template>
         </avue-form>
       </trade-card>
-      <trade-card title="地址管理">
+      <trade-card title="地址管理" v-loading="loadingBtn">
         <avue-crud ref="crud" :option="optionList" :data="data" :table-loading="loading" @saveColumn="saveColumn"
           @resetColumn="resetColumn" :cell-style="cellStyle" @row-save="rowSave" @row-update="addUpdate">
-          <template slot="menuLeft">
-            <el-button type="primary" @click="addRow" size="mini" :disabled="detailData.status == 1">新建地址
-            </el-button>
+          <template slot="headerSerial">
+            <el-button type="primary" icon="el-icon-plus" size="mini" @click.stop="addRow"
+              :disabled="detailData.status == 1" circle></el-button>
           </template>
           <template slot="menu" slot-scope="{ row, index }">
             <el-button size="small" type="text" @click="rowCell(row, index)">{{
-            row.$cellEdit ? "保存" : "修改" }}</el-button>
+                row.$cellEdit ? "保存" : "修改"
+            }}</el-button>
             <el-button size="small" type="text" @click="rowDel(row, index)">删除
             </el-button>
           </template>
         </avue-crud>
       </trade-card>
       <containerTitle title="上传附件"></containerTitle>
-      <c-upload typeUpload="CD" deleteUrl="/api/trade-purchase/woodHarvestingCloud/removeByFileId"
-        :data="orderFilesList" display :enumerationValue="35.1" :disabled="detailData.status == 1"></c-upload>
+      <c-upload v-loading="loadingBtn" typeUpload="CD"
+        deleteUrl="/api/trade-purchase/woodHarvestingCloud/removeByFileId" :data="orderFilesList" display
+        :enumerationValue="35.1" :disabled="detailData.status == 1"></c-upload>
       <el-dialog :title="addressTitle" v-dialogDrag :visible.sync="addressVisible" class="avue-dialog avue-dialog--top"
-        width="50%" append-to-body>
+        width="50%" append-to-body @closed="addressClosed">
         <span>
           <el-tabs v-model="activeName">
             <el-tab-pane label="客户地址" name="first">
-              <avue-form class="trading-form" v-model="form2" :option="option2"></avue-form>
+              <avue-form :key="reload1" ref="address1" class="trading-form" v-model="form2" :option="option2">
+              </avue-form>
             </el-tab-pane>
             <el-tab-pane label="物流地址" name="second">
-              <avue-form class="trading-form" v-model="form3" :option="option3"></avue-form>
+              <avue-form :key="reload2" ref="address2" class="trading-form" v-model="form3" :option="option3">
+              </avue-form>
             </el-tab-pane>
           </el-tabs>
         </span>
         <div class="avue-dialog__footer">
-          <el-button @click="addressVisible=false">取 消</el-button>
-          <el-button @click="addressVisible=false" type="primary">确 定</el-button>
+          <el-button @click="addressVisible = false">取 消</el-button>
+          <el-button @click="importAddRess(activeName)" type="primary">确 定</el-button>
+        </div>
+      </el-dialog>
+      <el-dialog title="添加客户分类" v-dialogDrag :visible.sync="corpTypeVisible" class="avue-dialog avue-dialog--top"
+        width="30%" append-to-body @closed="corpTypeClosed">
+        <span>
+          <avue-form :key="reload3" ref="corpType" v-model="form4" :option="option4" style="margin-top:20px">
+          </avue-form>
+        </span>
+        <div class="avue-dialog__footer">
+          <el-button @click="corpTypeVisible = false" size="mini">取 消</el-button>
+          <el-button @click="addCorpType" type="primary" size="mini">确 定</el-button>
         </div>
       </el-dialog>
     </div>
@@ -58,23 +82,25 @@
 
 <script>
 import { optionList } from "./js/optionList";
-import { getDetails } from "@/api/basicData/client";
-import { areaTypeTree } from "@/api/basicData/customerInformation";
-import { getCode } from "@/api/basicData/customerInquiry";
+import { getDetails, addCorpType, getCorpType, submit } from "@/api/basicData/client";
 export default {
   name: "index",
   data() {
     return {
+      props: {
+        label: 'title',
+        value: 'value'
+      },
+      corpTypeList: [],
+      corpTypeVisible: false,
       activeName: 'first',
       loadingBtn: false,
       addressTitle: null,
       addressVisible: false,
       form: {},
-      form2: {
-      },
-      form3: {
-
-      },
+      form2: {},
+      form3: {},
+      form4: {},
       data: [],
       option: {
         menuBtn: false,
@@ -82,8 +108,7 @@ export default {
         column: [
           {
             label: "客户名称",
-            prop: "id",
-            type: "select",
+            prop: "cname",
             rules: [
               {
                 required: true,
@@ -96,7 +121,6 @@ export default {
           {
             label: "客户分类",
             prop: "corpsTypeId",
-            type: "select",
             span: 8,
           },
           {
@@ -116,7 +140,7 @@ export default {
           },
           {
             label: "传真",
-            prop: "Fax",
+            prop: "fax",
             span: 8,
           },
           {
@@ -139,29 +163,49 @@ export default {
         column: [
           {
             label: "简称",
-            prop: "a",
+            allowCreate: true,
+            filterable: true,
+            prop: "abbreviation",
             type: "select",
+            props: {
+              label: "dictValue",
+              value: "dictKey"
+            },
+            dicUrl: "/api/blade-system/dict-biz/dictionary?code=abbreviation",
             span: 24,
           },
           {
             label: "地址",
-            prop: "b",
-            type: "select",
+            prop: "addr",
+            dicData: JSON.parse(localStorage.getItem('areaTypeTree')),
+            dataType: "string",
+            type: "cascader",
+            props: {
+              label: 'name',
+              value: 'name'
+            },
             span: 24,
           },
           {
             label: "详细地址",
-            prop: "c",
+            prop: "detailedAddress",
+            rules: [
+              {
+                required: true,
+                message: "",
+                trigger: "blur"
+              }
+            ],
             span: 24,
           },
           {
             label: "邮编",
-            prop: "d",
+            prop: "postalCode",
             span: 24,
           },
           {
             label: "备注",
-            prop: "e",
+            prop: "remarks",
             type: 'textarea',
             minRows: 3,
             span: 24,
@@ -169,7 +213,7 @@ export default {
           {
             label: "地址智能识别",
             prop: "ad",
-            placeholder:"例:上海市徐汇区枫林街道斜土路100号",
+            placeholder: "例:上海市徐汇区枫林街道斜土路100号",
             type: "textarea",
             minRows: 3,
             span: 24,
@@ -178,44 +222,50 @@ export default {
       },
       option3: {
         menuBtn: false,
-        labelWidth: 80,
+        labelWidth: 90,
         column: [
           {
             label: "目的地",
-            prop: "a",
-            type: "select",
-            rules: [
-              {
-                required: true,
-                message: "",
-                trigger: "blur"
-              }
-            ],
+            prop: "destination",
             span: 24,
           },
           {
             label: "物流公司",
-            prop: "b",
+            prop: "logisticsCompany",
             span: 24,
           },
           {
             label: "电话",
-            prop: "c",
+            prop: "tel",
             span: 24,
           },
           {
             label: "地址",
-            prop: "d",
+            prop: "addr",
+            dicData: JSON.parse(localStorage.getItem('areaTypeTree')),
+            dataType: "string",
+            type: "cascader",
+            props: {
+              label: 'name',
+              value: 'name'
+            },
             span: 24,
           },
           {
             label: "详细地址",
-            prop: "e",
+            prop: "detailedAddress",
+            rules: [
+              {
+                required: true,
+                message: "",
+                trigger: "blur"
+              }
+            ],
             span: 24,
           },
           {
             label: "邮编",
-            prop: "f",
+            prop: "postalCode",
             span: 24,
           },
           {
@@ -234,6 +284,24 @@ export default {
           }
         ]
       },
+      option4: {
+        menuBtn: false,
+        labelWidth: 80,
+        column: [
+          {
+            label: "分类名称",
+            prop: "cname",
+            rules: [
+              {
+                required: true,
+                message: "",
+                trigger: "blur"
+              }
+            ],
+            span: 24,
+          }
+        ]
+      },
       optionList: {},
     };
   },
@@ -253,11 +321,12 @@ export default {
     if (this.detailData.status == 1) {
       this.option.disabled = true;
     }
-    this.getAllWorkDicts()
+    this.getCorpType()
   },
   methods: {
     getAllWorkDicts() {
-      this.findObject(this.optionList.column, "departureId").dicData = JSON.parse(localStorage.getItem('areaTypeTree'));
+      this.findObject(this.option2.column, "addr").dicData = JSON.parse(localStorage.getItem('areaTypeTree'));
+      this.findObject(this.option3.column, "addr").dicData = JSON.parse(localStorage.getItem('areaTypeTree'));
     },
     cellStyle() {
       return "padding:0;height:40px;";
@@ -272,10 +341,10 @@ export default {
     },
     getDetail(id) {
       this.loadingBtn = true
-      getDetails({id:id})
+      getDetails({ id: id })
         .then(res => {
           this.form = res.data.data;
-          this.data = res.data.data.orderCostItemList;
+          this.data = res.data.data.corpsAddrList;
         })
         .finally(() => {
           this.loadingBtn = false;
@@ -289,7 +358,16 @@ export default {
       this.addressVisible = true
     },
     rowCell(row, index) {
-      this.$refs.crud.rowCell(row, index)
+      // this.$refs.crud.rowCell(row, index)
+      this.addressTitle = '修改地址'
+      this.addressVisible = true
+      if (row.type == 0) {
+        this.activeName = "first"
+        this.form2=row
+      }else{
+        this.activeName = "second"
+        this.form3=row
+      }
     },
     rowSave(form, done) {
       done()
@@ -320,24 +398,82 @@ export default {
         }
       });
     },
+    addressClosed() {
+      this.reload1 = Math.random();
+      this.reload2 = Math.random();
+      this.form2 = this.$options.data().form2
+      this.form3 = this.$options.data().form3
+    },
+    corpTypeClosed() {
+      this.reload3 = Math.random();
+      this.form4 = this.$options.data().form4
+    },
+    importAddRess(status) {
+      if (status == 'first') {
+        this.$refs["address1"].validate((valid, done) => {
+          done();
+          if (valid) {
+            if(this.addressTitle=='新增地址'){
+              this.data.push({ ...this.form2, type: 0 })
+            }else{
+              this.$set(this.data,this.form2.$index,{ ...this.form2, type: 0 })
+            }
+            this.addressVisible = false
+          } else {
+            return false;
+          }
+        });
+      } else {
+        this.$refs["address2"].validate((valid, done) => {
+          done();
+          if (valid) {
+            if(this.addressTitle=='新增地址'){
+              this.data.push({ ...this.form3, type: 1 })
+            }else{
+              this.$set(this.data,this.form3.$index,{ ...this.form3, type: 1 })
+            }
+            this.addressVisible = false
+          } else {
+            return false;
+          }
+        });
+      }
+    },
+    getCorpType() {
+      getCorpType({ corpType: 'KH' }).then(res => {
+        this.corpTypeList = res.data.data
+      })
+    },
+    addCorpType() {
+      this.$refs["corpType"].validate((valid, done) => {
+        done();
+        if (valid) {
+          addCorpType({ ...this.form4, corpType: 'KH', status: 0 })
+            .then(res => {
+              this.$message.success("保存成功");
+              this.getCorpType()
+              this.corpTypeVisible = false
+            })
+        } else {
+          return false;
+        }
+      });
+    },
     //修改提交触发
     editCustomer() {
       this.$refs["form"].validate((valid, done) => {
         done();
         if (valid) {
-          this.data.forEach(e => {
-            e.departure = e.departureId ? e.departureId.replace(/,/g, "/") : ''
-          })
           this.loadingBtn = true;
-          // submit({ ...this.form, feesType: 1, orderCostItemList: this.data })
-          //   .then(res => {
-          //     this.$message.success("保存成功");
-          //     this.form = res.data.data;
-          //     this.data = res.data.data.orderCostItemList;
-          //   })
-          //   .finally(() => {
-          //     this.loadingBtn = false;
-          //   });
+          submit({ ...this.form, code: this.form.cname, corpType: "KH", corpsAddrList: this.data })
+            .then(res => {
+              this.$message.success("保存成功");
+              this.form = res.data.data;
+              this.data = res.data.data.corpsAddrList;
+            })
+            .finally(() => {
+              this.loadingBtn = false;
+            });
         } else {
           return false;
         }

+ 23 - 15
src/views/client/index.vue

@@ -69,15 +69,17 @@
           <span style="color: #409EFF;cursor: pointer" @click.stop="viewInfo(row)">{{ row.cname }}
           </span>
         </template>
+        <template slot="dateSearch">
+          <el-date-picker v-model="search.date" type="daterange" start-placeholder="开始日期" end-placeholder="结束日期"
+            format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss" :default-time="['00:00:00', '23:59:59']">
+          </el-date-picker>
+        </template>
         <template slot-scope="{ row, index }" slot="menu">
-          <el-tooltip class="item" effect="dark" content="新建销售订单" placement="top">
-            <i class="tradingIcon icon-add" />
-          </el-tooltip>
           <el-tooltip class="item" effect="dark" content="删除" placement="top">
-            <i class="tradingIcon icon-del" />
+            <i class="tradingIcon icon-del" @click.stop="rowDel(row)"/>
           </el-tooltip>
           <el-tooltip class="item" effect="dark" content="编辑" placement="top">
-            <i class="tradingIcon icon-edit" />
+            <i class="tradingIcon icon-edit" @click.stop="editOpen(row, 2)" />
           </el-tooltip>
           <el-tooltip class="item" effect="dark" content="收款" placement="top">
             <i class="tradingIcon icon-proceeds" />
@@ -106,7 +108,7 @@
 import detailsInfo from "./detailsInfo";
 import detailsPage from "./detailsPage";
 import { option } from "./js/optionList";
-import { getList, getCorpsAll, pageStatistics } from "@/api/basicData/client";
+import { getList, getCorpsAll, pageStatistics,remove } from "@/api/basicData/client";
 export default {
   name: "index",
   data() {
@@ -177,6 +179,12 @@ export default {
     },
     onLoad(page, params = {}) {
       let data = this.deepClone(Object.assign(params, this.search));
+      if (data.date && data.date.length > 0) {
+        data.startTime = data.date[0]
+        data.endTime = data.date[1]
+      }
+      delete data.date
+      data.corpType = "KH"
       this.loading = true;
       getList(
         page.currentPage,
@@ -221,15 +229,15 @@ export default {
         cancelButtonText: "取消",
         type: "warning"
       }).then(() => {
-        // remove(row.id).then(res => {
-        //   if (res.data.code == 200) {
-        //     this.$message({
-        //       type: "success",
-        //       message: "删除成功!"
-        //     });
-        //     this.onLoad(this.page, this.search);
-        //   }
-        // });
+        remove({id:row.id,corpType:"KH"}).then(res => {
+          if (res.data.code == 200) {
+            this.$message({
+              type: "success",
+              message: "删除成功!"
+            });
+            this.onLoad(this.page, this.search);
+          }
+        });
       });
     },
     async saveColumn() {

+ 71 - 23
src/views/client/js/optionList.js

@@ -94,7 +94,7 @@ export const option = {
     },
     {
       label: "日期",
-      prop: "data",
+      prop: "date",
       hide: true,
       search: true,
       showColumn: false,
@@ -112,15 +112,33 @@ export const optionList = {
   border: true,
   menuWidth: 120,
   stripe: true,
+  index:true,
+  indexSlot: true,
   column: [
     {
       label: "地址类型",
-      prop: "departureId",
+      prop: "type",
+      dicData: [
+        {
+          type: 0,
+          name: '客户地址'
+        },
+        {
+          type: 1,
+          name: '物流地址'
+        }
+      ],
+      dataType: "string",
+      type: "cascader",
+      props: {
+        label: 'name',
+        value: 'type'
+      },
       overHidden: true
     },
     {
       label: "详细地址",
-      prop: "address",
+      prop: "detailedAddress",
       overHidden: true
     }
   ]
@@ -191,7 +209,7 @@ export const sellOptionList = {
 }
 export const sellOption = {
   searchShow: true,
-  searchMenuSpan: 8,
+  searchMenuSpan: 16,
   align: "center",
   searchSpan: 8,
   tip: false,
@@ -202,53 +220,83 @@ export const sellOption = {
   editBtn: false,
   delBtn: false,
   menu: false,
+  menuWidth: 150,
   searchIcon: true,
   searchIndex: 2,
   column: [
     {
       label: "单号",
-      prop: "a",
+      prop: "orderNo",
+      overHidden: true,
       search: true,
-      overHidden: true
+      index: 1
+    },
+    {
+      label: "客户名称",
+      prop: "corpId",
+      type: 'select',
+      dicData: [],
+      overHidden: true,
+      index: 2
     },
     {
       label: "日期",
-      prop: "b",
+      prop: "businesDate",
       search: true,
-      overHidden: true
+      overHidden: true,
+      index: 4
     },
     {
       label: "合同金额",
-      prop: "c",
-      search: true,
-      overHidden: true
+      prop: "debitAmount",
+      overHidden: true,
+      index: 5
     },
     {
-      label: "已发送",
-      prop: "d",
-      overHidden: true
+      label: "已送货",
+      prop: "deliveringAmount",
+      overHidden: true,
+      search: true,
+      index: 6
     },
     {
       label: "未收款",
-      prop: "e",
-      overHidden: true
+      prop: "balanceAmount",
+      overHidden: true,
+      search: true,
+      index: 7
     },
     {
       label: "已收款",
-      prop: "f",
-      overHidden: true
+      prop: "settlmentAmount",
+      overHidden: true,
+      search: true,
+      index: 8
     },
     {
       label: "收款状态",
-      prop: "g",
-      search: true,
-      overHidden: true
+      prop: "status",
+      type: 'select',
+      index: 9
     },
     {
       label: "送货状态",
-      prop: "h",
+      prop: "status",
+      type: 'select',
       search: true,
-      overHidden: true
+      index: 10
+    },
+    {
+      label: "制单人",
+      prop: "createUser",
+      type: "select",
+      props: {
+        label: "name",
+        value: "id"
+      },
+      dicData: [],
+      search: true,
+      index: 11
     }
   ]
 }

+ 172 - 70
src/views/product/detailsPage.vue

@@ -15,121 +15,142 @@
       </div>
       <trade-card title="基础资料" style="margin-top: 60px">
         <avue-form ref="form" class="trading-form" v-model="form" :option="option">
+          <template slot="goodsTypeId">
+            <div style="display:flex;">
+              <avue-select v-model="form.goodsTypeId" placeholder="请选择产品分类" :dic="goodsTypeList" :props="props">
+              </avue-select>
+              <!-- <el-button icon="el-icon-plus" size="mini" @click="corpTypeVisible = true"></el-button> -->
+              <i class="el-icon-circle-plus-outline" style="font-size:18px;line-height: 32px;margin-left:4px"
+                @click="addGoodstype"></i>
+            </div>
+          </template>
+          <template slot="whether">
+            <el-switch v-model="form.whether" active-text="是" inactive-text="否" active-value="1" inactive-value="0" />
+          </template>
         </avue-form>
       </trade-card>
+      <trade-card title="库存管理" v-loading="loadingBtn">
+        <avue-crud ref="crud" :option="optionList" :data="data" :table-loading="loading" @saveColumn="saveColumn"
+          @resetColumn="resetColumn" :cell-style="cellStyle">
+          <template slot="headerSerial">
+            <el-button type="primary" icon="el-icon-plus" size="mini" @click.stop="addRow"
+              :disabled="detailData.status == 1" circle></el-button>
+          </template>
+          <template slot="menu" slot-scope="{ row, index }">
+            <el-button size="small" type="text" @click="rowCell(row, index)">{{
+                row.$cellEdit ? "保存" : "修改"
+            }}</el-button>
+            <el-button size="small" type="text" @click="rowDel(row, index)">删除
+            </el-button>
+          </template>
+        </avue-crud>
+      </trade-card>
       <containerTitle title="主图附件"></containerTitle>
-      <c-upload :data="bankOfDepositData" display deleteUrl="/api/blade-client/goodsfiles/delete"
-        :enumerationValue="160" />
+      <c-upload :data="filesList" display deleteUrl="/api/blade-client/goodsfiles/delete" :enumerationValue="160" />
     </div>
   </div>
 </template>
 
 <script>
+import { getGoodstype, getDetails, goodsTypesubmit, getStoragetype, submit,itemRemove } from "@/api/basicData/product";
 import { optionList } from "./js/optionList";
-import { getDetails } from "@/api/basicData/client";
-import { areaTypeTree } from "@/api/basicData/customerInformation";
-import { getCode } from "@/api/basicData/customerInquiry";
 export default {
   name: "index",
   data() {
     return {
+      loadingBtn: false,
       form: {},
       data: [],
       option: {
         menuBtn: false,
-        labelWidth: 90,
+        labelWidth: 100,
         column: [
           {
             label: "名称",
-            prop: "name",
+            prop: "cname",
             span: 16,
           },
           {
             label: "产品分类",
-            prop: "type",
-            span: 8,
-          },
-          {
-            label: "条码",
-            prop: "mailbox",
+            prop: "goodsTypeId",
+            type: 'select',
+            dicData: [],
+            props: {
+              label: 'detailedAddress',
+              value: 'detailedAddress'
+            },
+            filterable: true,
             span: 8,
           },
           {
             label: "单位",
-            prop: "mailbox",
+            prop: "unit",
+            type: "select",
+            props: {
+              label: "dictValue",
+              value: "dictKey"
+            },
+            dicUrl: "/api/blade-system/dict-biz/dictionary?code=unit",
             span: 8,
           },
           {
-            label: "规格型号",
-            prop: "mailbox",
+            label: "标准售价",
+            prop: "standardPrice",
             span: 8,
           },
           {
-            label: "期初库存",
-            prop: "mailbox",
+            label: "批发售价",
+            prop: "wholesalePrice",
             span: 8,
           },
           {
-            label: "库存下限",
-            prop: "mailbox",
+            label: "汽修厂售价",
+            prop: "repairDepotPrice",
             span: 8,
           },
           {
-            label: "价",
-            prop: "mailbox",
+            label: "门店售价",
+            prop: "storePrice",
             span: 8,
           },
           {
-            label: "售价1",
-            prop: "mailbox",
+            label: "采购价",
+            prop: "purchasePrice",
             span: 8,
           },
           {
-            label: "售价2",
-            prop: "mailbox",
-            span: 8,
-          },
-          {
-            label: "售价3",
-            prop: "mailbox",
-            span: 8,
-          },
-          {
-            label: "售价4",
-            prop: "mailbox",
-            span: 8,
-          },
-          {
-            label: "售价5",
-            prop: "mailbox",
+            label: "标签",
+            prop: "label",
+            type: 'checkbox',
+            dataType: "string",
+            props: {
+              label: "dictValue",
+              value: "dictValue"
+            },
+            dicUrl: "/api/blade-system/dict-biz/dictionary?code=label",
             span: 8,
           },
           {
-            label: "标签",
-            prop: "mailbox",
-            type: 'checkbox',
-            dicData: [{
-              label: '爆款',
-              value: 0
-            }, {
-              label: '新品',
-              value: 1
-            }, {
-              label: '促销',
-              value: ''
-            }],
+            label: "是否管理批次号",
+            prop: "whether",
             span: 8,
           },
           {
             label: "备注",
-            prop: "g",
+            prop: "remarks",
             type: "textarea",
             minRows: 3,
             span: 24,
           }
         ]
       },
-      bankOfDepositData: []
+      filesList: [],
+      props: {
+        label: 'title',
+        value: 'value'
+      },
+      goodsTypeList: [],
+      optionList: {}
     };
   },
   props: {
@@ -138,23 +159,77 @@ export default {
     }
   },
   async created() {
+    this.optionList = await this.getColumnData(
+      this.getColumnName(218),
+      optionList
+    );
     if (this.detailData.id) {
       this.getDetail(this.detailData.id);
     }
     if (this.detailData.status == 1) {
       this.option.disabled = true;
     }
+    this.getAllWorkDicts()
   },
   methods: {
+    getAllWorkDicts() {
+      getGoodstype().then(res => {
+        this.goodsTypeList = res.data.data;
+      });
+      getStoragetype().then(res => {
+        this.findObject(this.optionList.column, "storageId").dicData = res.data.data;
+      });
+      this.$refs.crud.init();
+    },
     cellStyle() {
       return "padding:0;height:40px;";
     },
+    addRow() {
+      this.data.push({ $cellEdit: true })
+    },
+    rowCell(row, index) {
+      this.$refs.crud.rowCell(row, index)
+    },
+    rowDel(row, index) {
+      this.$confirm("确定删除数据?", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        if (row.id) {
+          itemRemove({ids:row.id}).then(res => {
+            this.$message({
+              type: "success",
+              message: "删除成功!"
+            });
+            this.data.splice(index, 1);
+          });
+        } else {
+          this.$message({
+            type: "success",
+            message: "删除成功!"
+          });
+          this.data.splice(index, 1);
+        }
+      });
+    },
+    addGoodstype() {
+      this.$prompt('产品分类名称', '产品分类', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+      }).then(({ value }) => {
+        goodsTypesubmit({ cname: value, status: 0 }).then(res => {
+          this.getAllWorkDicts()
+        })
+      })
+    },
     getDetail(id) {
       this.loadingBtn = true
-      getDetails({ id: id })
+      getDetails({ goodsId: id })
         .then(res => {
           this.form = res.data.data;
-          this.data = res.data.data.orderCostItemList;
+          this.data = res.data.data.stockGoodsList;
+          this.filesList = res.data.data.filesList
         })
         .finally(() => {
           this.loadingBtn = false;
@@ -165,24 +240,51 @@ export default {
       this.$refs["form"].validate((valid, done) => {
         done();
         if (valid) {
-          this.data.forEach(e => {
-            e.departure = e.departureId ? e.departureId.replace(/,/g, "/") : ''
-          })
           this.loadingBtn = true;
-          // submit({ ...this.form, feesType: 1, orderCostItemList: this.data })
-          //   .then(res => {
-          //     this.$message.success("保存成功");
-          //     this.form = res.data.data;
-          //     this.data = res.data.data.orderCostItemList;
-          //   })
-          //   .finally(() => {
-          //     this.loadingBtn = false;
-          //   });
+          submit({ ...this.form, code: this.form.cname, type: 0, stockGoodsList: this.data, filesList: this.filesList })
+            .then(res => {
+              this.$message.success("保存成功");
+              this.form = res.data.data;
+              this.data = res.data.data.stockGoodsList;
+              this.filesList = res.data.data.filesList
+            })
+            .finally(() => {
+              this.loadingBtn = false;
+            });
         } else {
           return false;
         }
       });
     },
+    async saveColumn() {
+      const inSave = await this.saveColumnData(
+        this.getColumnName(218),
+        this.optionList
+      );
+      if (inSave) {
+        this.$nextTick(() => {
+          this.$refs.crud.doLayout();
+        });
+        this.$message.success("保存成功");
+        //关闭窗口
+        this.$refs.crud.$refs.dialogColumn.columnBox = false;
+      }
+    },
+    async resetColumn() {
+      this.optionList = optionList;
+      const inSave = await this.delColumnData(
+        this.getColumnName(218),
+        optionList
+      );
+      if (inSave) {
+        this.$nextTick(() => {
+          this.$refs.crud.doLayout();
+        });
+        this.getAllWorkDicts()
+        this.$message.success("重置成功");
+        this.$refs.crud.$refs.dialogColumn.columnBox = false;
+      }
+    },
     //返回列表
     backToList() {
       this.$emit("goBack");

+ 18 - 21
src/views/product/index.vue

@@ -9,17 +9,17 @@
           <el-button type="primary" size="mini" @click.stop="newAdd()">新建产品
           </el-button>
         </template>
-        <template slot-scope="{ row, index }" slot="id">
+        <template slot-scope="{ row, index }" slot="cname">
           <span style="color: #409EFF;cursor: pointer" @click.stop="editOpen(row, 2)">{{ row.cname }}
           </span>
         </template>
         <template slot-scope="{ row, index }" slot="menu">
+          <el-tooltip class="item" effect="dark" content="删除" placement="top">
+            <i class="tradingIcon icon-del" @click.stop="rowDel(row, index)"/>
+          </el-tooltip>
           <!-- <el-tooltip class="item" effect="dark" content="新建销售订单" placement="top">
             <i class="tradingIcon icon-add" />
           </el-tooltip>
-          <el-tooltip class="item" effect="dark" content="删除" placement="top">
-            <i class="tradingIcon icon-del" />
-          </el-tooltip>
           <el-tooltip class="item" effect="dark" content="编辑" placement="top">
             <i class="tradingIcon icon-edit" />
           </el-tooltip>
@@ -48,7 +48,7 @@
 <script>
 import detailsPage from "./detailsPage";
 import { option } from "./js/optionList";
-import { getList, getCorpsAll, pageStatistics } from "@/api/basicData/client";
+import { getList,remove} from "@/api/basicData/product";
 export default {
   name: "index",
   data() {
@@ -79,10 +79,10 @@ export default {
   },
   methods: {
     getAllWorkDicts() {
-      getCorpsAll().then(res => {
-        this.findObject(this.option.column, "id").dicData = res.data.data;
-        this.findObject(this.option.column, "ids").dicData = res.data.data;
-      })
+      // getCorpsAll().then(res => {
+      //   this.findObject(this.option.column, "cname").dicData = res.data.data;
+      //   this.findObject(this.option.column, "ids").dicData = res.data.data;
+      // })
       this.$refs.crud.init();
     },
     searchCriteriaSwitch(type) {
@@ -121,9 +121,6 @@ export default {
           this.page.total = res.data.data.total;
         })
         .finally(() => {
-          pageStatistics(data).then(res => {
-            this.form = res.data.data
-          })
           this.loading = false;
         });
     },
@@ -147,15 +144,15 @@ export default {
         cancelButtonText: "取消",
         type: "warning"
       }).then(() => {
-        // remove(row.id).then(res => {
-        //   if (res.data.code == 200) {
-        //     this.$message({
-        //       type: "success",
-        //       message: "删除成功!"
-        //     });
-        //     this.onLoad(this.page, this.search);
-        //   }
-        // });
+        remove({id:row.id}).then(res => {
+          if (res.data.code == 200) {
+            this.$message({
+              type: "success",
+              message: "删除成功!"
+            });
+            this.onLoad(this.page, this.search);
+          }
+        });
       });
     },
     async saveColumn() {

+ 34 - 112
src/views/product/js/optionList.js

@@ -2,7 +2,7 @@ import { number } from "echarts"
 
 export const option = {
   searchShow: true,
-  searchMenuSpan: 8,
+  searchMenuSpan: 16,
   align: "center",
   searchSpan: 8,
   tip: false,
@@ -12,42 +12,39 @@ export const option = {
   viewBtn: false,
   editBtn: false,
   delBtn: false,
-  menuWidth: 150,
+  menuWidth: 70,
   searchIcon: true,
   searchIndex: 2,
   column: [
     {
-      label: "图品",
-      prop: "no",
+      label: "商品名称",
+      prop: "cname",
+      search: true,
       overHidden: true,
       index: 1
     },
     {
       label: "产品分类",
-      prop: "id",
-      type: 'select',
-      dicData: [],
+      prop: "goodsTypeName",
       overHidden: true,
       index: 2
     },
     {
       label: "单位",
-      prop: "data",
-      search: true,
+      prop: "unit",
       overHidden: true,
       index: 4
     },
     {
       label: "参考售价",
-      prop: "debitAmount",
+      prop: "standardPrice",
       overHidden: true,
       index: 5
     },
     {
       label: "备注",
-      prop: "deliveringAmount",
+      prop: "remarks",
       overHidden: true,
-      search: true,
       index: 6
     }
   ]
@@ -61,124 +58,49 @@ export const optionList = {
   border: true,
   menuWidth: 120,
   stripe: true,
-  index:true,
+  index: true,
+  indexSlot: true,
   column: [
     {
-      label: "产品",
-      prop: "departureId",
-      cell:true,
-      overHidden: true
-    },
-    {
-      label: "图片",
-      prop: "address",
+      label: "仓库",
+      prop: "storageId",
+      type: "select",
+      props: {
+        label: 'title',
+        value: 'value'
+      },
+      dicData:[],
+      cell: true,
       overHidden: true
     },
     {
-      label: "规格型号",
-      prop: "address",
-      cell:true,
+      label: "库存数量",
+      prop: "balanceQuantity",
+      cell: true,
       overHidden: true
     },
     {
-      label: "总数量",
-      prop: "address",
-      cell:true,
+      label: "批次号",
+      prop: "lotNo",
+      cell: true,
       overHidden: true
     },
     {
-      label: "单位",
-      prop: "address",
-      cell:true,
-      overHidden: true
-    },
-    {
-      label: "单价",
-      prop: "address",
-      cell:true,
+      label: "结余金额",
+      prop: "balanceAmount",
+      cell: true,
       overHidden: true
     },
     {
-      label: "金额",
-      prop: "address",
+      label: "库存下限",
+      prop: "lowerLimit",
+      cell: true,
       overHidden: true
     },
     {
       label: "送货数量",
-      prop: "address",
-      cell:true,
-      overHidden: true
-    },
-    {
-      label: "备注",
-      prop: "address",
-      cell:true,
-      overHidden: true
-    },
-    {
-      label: "供应商",
-      prop: "address",
-      cell:true,
-      overHidden: true
-    },
-    {
-      label: "进价",
-      prop: "address",
-      cell:true,
-      overHidden: true
-    },
-    {
-      label: "采购数量",
-      prop: "address",
-      cell:true,
-      overHidden: true
-    },
-    {
-      label: "总进价",
-      prop: "address",
-      overHidden: true
-    },
-  ]
-}
-
-export const feeOption = {
-  align: "center",
-  addBtn: false,
-  refreshBtn: false,
-  editBtn: false,
-  delBtn: false,
-  border: true,
-  menuWidth: 120,
-  stripe: true,
-  index:true,
-  column: [
-    {
-      label: "收款单号",
-      prop: "e",
-      overHidden: true
-    },
-    {
-      label: "收款日期",
-      prop: "a",
-      cell:true,
-      overHidden: true
-    },
-    {
-      label: "收款金额",
-      prop: "b",
-      cell:true,
-      overHidden: true
-    },
-    {
-      label: "收款账户",
-      prop: "c",
-      cell:true,
-      overHidden: true
-    },
-    {
-      label: "备注",
-      prop: "d",
-      cell:true,
+      prop: "actualQuantity",
+      cell: true,
       overHidden: true
     }
   ]

+ 3 - 3
src/views/salesOrder/components/feeInfo.vue

@@ -2,9 +2,9 @@
     <trade-card title="收款信息">
         <avue-crud ref="crud" :data="data" :option="feeOption" @saveColumn="saveColumn" @resetColumn="resetColumn"
             :cell-style="cellStyle">
-            <template slot="menuLeft">
-                <el-button type="primary" @click="addRow" size="mini" :disabled="detailData.status == 1">新增费用
-                </el-button>
+            <template slot="headerSerial">
+                <el-button type="primary" icon="el-icon-plus" size="mini" @click.stop="addRow"
+                    :disabled="detailData.status == 1" circle></el-button>
             </template>
         </avue-crud>
     </trade-card>

+ 162 - 68
src/views/salesOrder/detailsPage.vue

@@ -14,18 +14,50 @@
         </div>
       </div>
       <!-- <containerTitle title="基础资料" style="margin-top: 60px"></containerTitle> -->
-      <trade-card title="基础资料" style="margin-top: 60px">
+      <trade-card title="基础资料" style="margin-top: 60px" v-loading="loadingBtn">
         <avue-form ref="form" class="trading-form" v-model="form" :option="option">
+          <template slot="corpId">
+            <ypj-corp v-model="form.corpId" :disabled="detailData.status == 1" @getCorpData="getCorpData"
+              :dataInfo="true"></ypj-corp>
+          </template>
         </avue-form>
       </trade-card>
-      <trade-card title="商品信息">
+      <trade-card title="商品信息" v-loading="loadingBtn">
         <avue-form ref="form" class="trading-form" v-model="form" :option="option2">
+          <template slot="thisUsedProfit">
+            <el-input-number v-model="form.thisUsedProfit" @change="amountChange" placeholder="请输入" size="small"
+              :controls="false" style="width:100%;"></el-input-number>
+          </template>
         </avue-form>
         <avue-crud ref="crud" :option="optionList" :data="data" :table-loading="loading" @saveColumn="saveColumn"
           @resetColumn="resetColumn" :cell-style="cellStyle" @row-save="rowSave" @row-update="addUpdate">
-          <template slot="menuLeft">
-            <el-button type="primary" @click="addRow" size="mini" :disabled="detailData.status == 1">新增产品
-            </el-button>
+          <template slot="headerSerial">
+            <el-button type="primary" icon="el-icon-plus" size="mini" @click.stop="addRow"
+              :disabled="detailData.status == 1" circle></el-button>
+          </template>
+          <template slot="cname" slot-scope="{ row, index }">
+            <span style="display:flex">
+              <el-select v-model="row.cname" placeholder="请选择" size="small" filterable
+                @change="cnameChange(row, index)">
+                <el-option v-for="item in goodsoptions" :key="item.itemId" :label="item.cname" :value="item.cname">
+                </el-option>
+              </el-select>
+            </span>
+          </template>
+          <template slot="storageInQuantity" slot-scope="{ row, index }">
+            <el-input-number v-if="row.$cellEdit" v-model="row.storageInQuantity" @change="countChange(row)" placeholder="请输入"
+              size="small" :controls="false" style="width:100%;"></el-input-number>
+            <span v-else>{{ row.storageInQuantity }}</span>
+          </template>
+          <template slot="price" slot-scope="{ row, index }">
+            <el-input-number v-if="row.$cellEdit" v-model="row.price" @change="countChange(row)" placeholder="请输入"
+              size="small" :controls="false" style="width:100%;"></el-input-number>
+            <span v-else>{{ row.price }}</span>
+          </template>
+          <template slot="purchaseAmount" slot-scope="{ row, index }">
+            <el-input-number v-if="row.$cellEdit" v-model="row.purchaseAmount" @change="countChange(row)" placeholder="请输入"
+              size="small" :controls="false" style="width:100%;"></el-input-number>
+            <span v-else>{{ row.purchaseAmount }}</span>
           </template>
           <template slot="menu" slot-scope="{ row, index }">
             <el-button size="small" type="text" @click="rowCell(row, index)">{{
@@ -36,10 +68,11 @@
           </template>
         </avue-crud>
       </trade-card>
-      <fee-info :data="orderFeeList" :form="form" :detailData="detailData"></fee-info>
+      <fee-info :data="settlementList" :form="form" :detailData="detailData" v-loading="loadingBtn"></fee-info>
       <containerTitle title="上传附件"></containerTitle>
-      <c-upload typeUpload="CD" deleteUrl="/api/trade-purchase/woodHarvestingCloud/removeByFileId"
-        :data="orderFilesList" display :enumerationValue="35.1" :disabled="detailData.status == 1"></c-upload>
+      <c-upload v-loading="loadingBtn" typeUpload="CD"
+        deleteUrl="/api/trade-purchase/woodHarvestingCloud/removeByFileId" :data="orderFilesList" display
+        :enumerationValue="35.1" :disabled="detailData.status == 1"></c-upload>
       <el-dialog :title="addressTitle" v-dialogDrag :visible.sync="addressVisible" class="avue-dialog avue-dialog--top"
         width="50%" append-to-body>
         <span>
@@ -63,10 +96,9 @@
 
 <script>
 import { optionList } from "./js/optionList";
-import { getDetails } from "@/api/basicData/client";
-import { areaTypeTree } from "@/api/basicData/customerInformation";
-import { getCode } from "@/api/basicData/customerInquiry";
+import { getDetails, submit, getCorpDetails, remove, getGoodsList } from "@/api/basicData/salesOrder";
 import feeInfo from "./components/feeInfo.vue";
+import { multiply, sum, subtract } from "@/util/calculate";
 export default {
   name: "index",
   data() {
@@ -88,8 +120,7 @@ export default {
         column: [
           {
             label: "客户名称",
-            prop: "id",
-            type: "select",
+            prop: "corpId",
             rules: [
               {
                 required: true,
@@ -97,46 +128,48 @@ export default {
                 trigger: "blur"
               }
             ],
-            span: 16,
+            span: 8,
           },
           {
-            label: "非产品费用",
-            prop: "Fax",
-            span: 8,
+            label: "送货地址",
+            prop: "arrivalAddress",
+            type: 'select',
+            dicData: [],
+            props: {
+              label: 'detailedAddress',
+              value: 'detailedAddress'
+            },
+            allowCreate: true,
+            filterable: true,
+            span: 16,
           },
           {
             label: "销售日期",
-            prop: "mailbox",
+            prop: "businesDate",
             type: "date",
             format: "yyyy-MM-dd",
-            valueFormat: "yyyy-MM-dd",
+            valueFormat: "yyyy-MM-dd 00:00:00",
             span: 8,
           },
           {
             label: "计划收款日期",
-            prop: "mailbox",
+            prop: "advanceCollectionDate",
             type: "date",
             format: "yyyy-MM-dd",
-            valueFormat: "yyyy-MM-dd",
+            valueFormat: "yyyy-MM-dd 00:00:00",
             span: 8,
           },
           {
             label: "送货日期",
-            prop: "mailbox",
+            prop: "requiredDeliveryDate",
             type: "date",
             format: "yyyy-MM-dd",
-            valueFormat: "yyyy-MM-dd",
+            valueFormat: "yyyy-MM-dd 00:00:00",
             span: 8,
           },
           {
-            label: "送货地址",
-            prop: "mailbox",
-            type: 'select',
-            span: 24,
-          },
-          {
             label: "备注",
-            prop: "g",
+            prop: "orderRemark",
             placeholder: "打印时显示",
             type: "textarea",
             minRows: 3,
@@ -146,30 +179,36 @@ export default {
       },
       option2: {
         menuBtn: false,
-        labelWidth: 90,
+        labelWidth: 70,
         column: [
           {
             label: "税率",
-            prop: "id",
+            prop: "exchangeRate",
             type: "select",
-            span: 6,
+            props: {
+              label: "dictValue",
+              value: "dictKey"
+            },
+            dicUrl: "/api/blade-system/dict-biz/dictionary?code=tax_rate",
+            span: 4,
           },
           {
             label: "订单金额",
-            prop: "id",
+            prop: "purchaseAmount",
             disabled: true,
-            span: 6,
+            span: 4,
           },
           {
             label: "优惠金额",
-            prop: "id",
-            span: 6,
+            prop: "thisUsedProfit",
+            span: 4,
           },
           {
             label: "合同金额",
-            prop: "id",
+            prop: "orderAmount",
             disabled: true,
-            span: 6,
+            offset: 8,
+            span: 4,
           }
         ]
       },
@@ -275,7 +314,8 @@ export default {
         ]
       },
       optionList: {},
-      orderFeeList: []
+      goodsoptions: [],
+      settlementList: [],
     };
   },
   props: {
@@ -298,35 +338,82 @@ export default {
       this.option.disabled = true;
     }
     this.getAllWorkDicts()
+    getGoodsList(1, 10).then(res => {
+      if (res.data.data.total > 0) {
+        this.goodsoptions = res.data.data.records;
+        if (Math.ceil(res.data.data.total / 10) > 1) {
+          for (let i = 2; i <= Math.ceil(res.data.data.total / 10); i++) {
+            getGoodsList(i, 10).then(e => {
+              this.goodsoptions = this.goodsoptions.concat(e.data.data.records);
+            });
+          }
+        }
+      }
+    });
   },
   methods: {
     getAllWorkDicts() {
-      this.findObject(this.optionList.column, "departureId").dicData = JSON.parse(localStorage.getItem('areaTypeTree'));
+      this.getWorkDicts("unit").then(res => {
+        this.findObject(this.optionList.column, "unit").dicData = res.data.data;
+      });
+      this.$refs.crud.init();
     },
     cellStyle() {
       return "padding:0;height:40px;";
     },
-    selectValue(value, row) {
-      console.log(value, row)
-      if (row.feesId) {
-        row.feesName = value.cname
+    cnameChange(row) {
+      console.log(row)
+      if (row.cname) {
+        this.goodsoptions.forEach(e => {
+          if (e.cname == row.cname) {
+            row.unit = e.unit
+            row.price = e.standardPrice
+            row.storageInQuantity = 1
+            row.amount = e.standardPrice
+            row.purchaseAmount = e.purchasePrice
+            row.storageAmount = e.purchasePrice
+          }
+        })
       } else {
-        row.feesName = ""
+        row.unit = null
+        row.price = null
+        row.purchaseAmount = null
       }
     },
+    amountChange() {
+      let val = 0
+      this.data.forEach(e => {
+        val = sum(val, e.amount)
+        this.form.purchaseAmount = val
+        this.form.orderAmount = subtract(this.form.purchaseAmount, this.form.thisUsedProfit)
+      })
+    },
+    countChange(row) {
+      row.amount = multiply(row.price, row.storageInQuantity)
+      row.storageAmount = multiply(row.purchaseAmount, row.storageInQuantity)
+    },
     getDetail(id) {
       this.loadingBtn = true
       getDetails({ id: id })
         .then(res => {
           this.form = res.data.data;
-          this.data = res.data.data.orderCostItemList;
+          this.data = res.data.data.orderItemsList;
+          this.settlementList = res.data.data.settlementList
+          this.getAddress(res.data.data)
         })
         .finally(() => {
           this.loadingBtn = false;
         });
     },
     getCorpData(row) {
-      this.form.corpName = row.cname
+      console.log(row)
+      this.findObject(this.option.column, "arrivalAddress").dicData = row.corpsAddrList;
+      // this.form.corpName = row.cname
+    },
+    getAddress(row) {
+      getCorpDetails({ id: row.corpId }).then(res => {
+        this.findObject(this.option.column, "arrivalAddress").dicData = res.data.data.corpsAddrList;
+      })
     },
     addRow() {
       this.data.push({ $cellEdit: true })
@@ -347,13 +434,13 @@ export default {
         type: "warning"
       }).then(() => {
         if (row.id) {
-          // itemDel(row.id).then(res => {
-          //   this.$message({
-          //     type: "success",
-          //     message: "删除成功!"
-          //   });
-          //   this.data.splice(index, 1);
-          // });
+          remove(row.id).then(res => {
+            this.$message({
+              type: "success",
+              message: "删除成功!"
+            });
+            this.data.splice(index, 1);
+          });
         } else {
           this.$message({
             type: "success",
@@ -368,19 +455,17 @@ export default {
       this.$refs["form"].validate((valid, done) => {
         done();
         if (valid) {
-          this.data.forEach(e => {
-            e.departure = e.departureId ? e.departureId.replace(/,/g, "/") : ''
-          })
           this.loadingBtn = true;
-          // submit({ ...this.form, feesType: 1, orderCostItemList: this.data })
-          //   .then(res => {
-          //     this.$message.success("保存成功");
-          //     this.form = res.data.data;
-          //     this.data = res.data.data.orderCostItemList;
-          //   })
-          //   .finally(() => {
-          //     this.loadingBtn = false;
-          //   });
+          submit({ ...this.form, billType: 'XS', tradeType: 'YPJ', orderItemsList: this.data, settlementList: this.settlementList })
+            .then(res => {
+              this.$message.success("保存成功");
+              this.form = res.data.data;
+              this.data = res.data.data.orderItemsList;
+              this.settlementList = res.data.data.settlementList
+            })
+            .finally(() => {
+              this.loadingBtn = false;
+            });
         } else {
           return false;
         }
@@ -418,7 +503,16 @@ export default {
     //返回列表
     backToList() {
       this.$emit("goBack");
-      console.log(11111)
+    }
+  },
+  watch: {
+    data: function (rows) {
+      let val = 0
+      rows.forEach(e => {
+        val = sum(val, e.amount)
+        this.form.purchaseAmount = val
+        this.form.orderAmount = subtract(this.form.purchaseAmount, this.form.thisUsedProfit)
+      })
     }
   }
 };

+ 19 - 8
src/views/salesOrder/index.vue

@@ -9,10 +9,15 @@
           <el-button type="primary" size="mini" @click.stop="newAdd()">新建销售单
           </el-button>
         </template>
-        <template slot-scope="{ row, index }" slot="id">
-          <span style="color: #409EFF;cursor: pointer" @click.stop="editOpen(row, 2)">{{ row.cname }}
+        <template slot-scope="{ row, index }" slot="corpId">
+          <span style="color: #409EFF;cursor: pointer" @click.stop="editOpen(row, 2)">{{ row.corpsName }}
           </span>
         </template>
+        <template slot="businesDateSearch">
+          <el-date-picker v-model="search.businesDate" type="daterange" start-placeholder="开始日期" end-placeholder="结束日期"
+            format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss" :default-time="['00:00:00', '23:59:59']">
+          </el-date-picker>
+        </template>
         <template slot-scope="{ row, index }" slot="menu">
           <!-- <el-tooltip class="item" effect="dark" content="新建销售订单" placement="top">
             <i class="tradingIcon icon-add" />
@@ -48,7 +53,7 @@
 <script>
 import detailsPage from "./detailsPage";
 import { option } from "./js/optionList";
-import { getList, getCorpsAll, pageStatistics } from "@/api/basicData/client";
+import { getList, getCorpsAll, gainUser } from "@/api/basicData/salesOrder";
 export default {
   name: "index",
   data() {
@@ -80,8 +85,10 @@ export default {
   methods: {
     getAllWorkDicts() {
       getCorpsAll().then(res => {
-        this.findObject(this.option.column, "id").dicData = res.data.data;
-        this.findObject(this.option.column, "ids").dicData = res.data.data;
+        this.findObject(this.option.column, "corpId").dicData = res.data.data;
+      })
+      gainUser().then(res => {
+        this.findObject(this.option.column, "createUser").dicData = res.data.data;
       })
       this.$refs.crud.init();
     },
@@ -110,6 +117,13 @@ export default {
     },
     onLoad(page, params = {}) {
       let data = this.deepClone(Object.assign(params, this.search));
+      data.billType = 'XS';
+      data.tradeType = 'YPJ';
+      if (data.businesDate) {
+        data.orderStartDate = data.businesDate[0];
+        data.orderEndDate = data.businesDate[1];
+      }
+      delete data.businesDate
       this.loading = true;
       getList(
         page.currentPage,
@@ -121,9 +135,6 @@ export default {
           this.page.total = res.data.data.total;
         })
         .finally(() => {
-          pageStatistics(data).then(res => {
-            this.form = res.data.data
-          })
           this.loading = false;
         });
     },

+ 63 - 51
src/views/salesOrder/js/optionList.js

@@ -12,39 +12,30 @@ export const option = {
   viewBtn: false,
   editBtn: false,
   delBtn: false,
+  menu: false,
   menuWidth: 150,
   searchIcon: true,
   searchIndex: 2,
   column: [
     {
       label: "单号",
-      prop: "no",
+      prop: "orderNo",
       overHidden: true,
       search: true,
       index: 1
     },
     {
       label: "客户名称",
-      prop: "id",
+      prop: "corpId",
       type: 'select',
       dicData: [],
+      search: true,
       overHidden: true,
       index: 2
     },
     {
-      label: "客户名称",
-      prop: "ids",
-      type: 'select',
-      dicData: [],
-      overHidden: true,
-      hide: true,
-      showColumn: false,
-      search: true,
-      index: 3
-    },
-    {
       label: "日期",
-      prop: "data",
+      prop: "businesDate",
       search: true,
       overHidden: true,
       index: 4
@@ -77,18 +68,29 @@ export const option = {
       index: 8
     },
     {
-      label: "送货状态",
+      label: "收款状态",
       prop: "status",
       type: 'select',
-      search: true,
       index: 9
     },
     {
-      label: "制单人",
-      prop: "as",
+      label: "送货状态",
+      prop: "status",
       type: 'select',
       search: true,
       index: 10
+    },
+    {
+      label: "制单人",
+      prop: "createUser",
+      type: "select",
+      props: {
+        label: "name",
+        value: "id"
+      },
+      dicData: [],
+      search: true,
+      index: 11
     }
   ]
 }
@@ -101,81 +103,90 @@ export const optionList = {
   border: true,
   menuWidth: 120,
   stripe: true,
-  index:true,
+  index: true,
+  indexSlot: true,
+  showSummary: true,
+  summaryText: "合计",
+  sumColumnList: [
+    {
+      name: "amount",
+      type: "sum"
+    },
+    {
+      name: "storageAmount",
+      type: "sum"
+    }
+  ],
   column: [
     {
       label: "产品",
-      prop: "departureId",
-      cell:true,
+      prop: "cname",
       overHidden: true
     },
     {
       label: "图片",
-      prop: "address",
-      overHidden: true
-    },
-    {
-      label: "规格型号",
-      prop: "address",
-      cell:true,
+      prop: "img",
       overHidden: true
     },
     {
       label: "总数量",
-      prop: "address",
-      cell:true,
+      prop: "storageInQuantity",
       overHidden: true
     },
     {
       label: "单位",
-      prop: "address",
-      cell:true,
+      prop: "unit",
+      type: "select",
+      props: {
+        label: "dictValue",
+        value: "dictKey"
+      },
+      dicData:[],
+      cell: true,
       overHidden: true
     },
     {
       label: "单价",
-      prop: "address",
-      cell:true,
+      prop: "price",
       overHidden: true
     },
     {
       label: "金额",
-      prop: "address",
+      prop: "amount",
       overHidden: true
     },
     {
       label: "送货数量",
-      prop: "address",
-      cell:true,
+      prop: "actualQuantity",
+      cell: true,
       overHidden: true
     },
     {
       label: "备注",
-      prop: "address",
-      cell:true,
+      prop: "remarks",
+      cell: true,
       overHidden: true
     },
     {
       label: "供应商",
-      prop: "address",
-      cell:true,
+      prop: "corpId",
+      cell: true,
       overHidden: true
     },
     {
       label: "进价",
-      prop: "address",
-      cell:true,
+      prop: "purchaseAmount",
       overHidden: true
     },
     {
       label: "采购数量",
-      prop: "address",
-      cell:true,
+      prop: "purchaseQuantity",
+      cell: true,
       overHidden: true
     },
     {
       label: "总进价",
-      prop: "address",
+      prop: "storageAmount",
       overHidden: true
     },
   ]
@@ -190,7 +201,8 @@ export const feeOption = {
   border: true,
   menuWidth: 120,
   stripe: true,
-  index:true,
+  index: true,
+  indexSlot: true,
   column: [
     {
       label: "收款单号",
@@ -200,25 +212,25 @@ export const feeOption = {
     {
       label: "收款日期",
       prop: "a",
-      cell:true,
+      cell: true,
       overHidden: true
     },
     {
       label: "收款金额",
       prop: "b",
-      cell:true,
+      cell: true,
       overHidden: true
     },
     {
       label: "收款账户",
       prop: "c",
-      cell:true,
+      cell: true,
       overHidden: true
     },
     {
       label: "备注",
       prop: "d",
-      cell:true,
+      cell: true,
       overHidden: true
     }
   ]