Qukatie 3 лет назад
Родитель
Сommit
90e6da02f4

+ 8 - 0
src/api/basicData/client.js

@@ -61,3 +61,11 @@ export const remove = (data) => {
     data:data
   })
 }
+
+export function customerList(data) {
+  return request({
+      url: '/api/blade-client/corpstype/page',
+      method: 'get',
+      params: data
+  })
+}

+ 3 - 0
src/enums/column-name.js

@@ -878,6 +878,9 @@ const columnName = [{
   code: 208,
   name: '客户(Y)-明细表'
 }, {
+  code: 208.4,
+  name: '客户(Y)-明细表2'
+}, {
   code: 208.1,
   name: '客户(Y)-销售记录'
 }, {

+ 71 - 2
src/views/client/detailsInfo.vue

@@ -93,7 +93,7 @@
                         <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']">
+                                :default-time="['00:00:00', '23:59:59']" :picker-options="pickerOptions">
                             </el-date-picker>
                         </template>
                     </avue-crud>
@@ -183,7 +183,76 @@ export default {
             capitalOption: {},
             sellList: [],
             capitalList: [],
-            corpsAddrList: []
+            corpsAddrList: [],
+            pickerOptions: {
+        shortcuts: [
+          {
+            text: '当天',
+            onClick(picker) {
+              const date = new Date();
+              const start = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);
+              const end = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 23, 59, 59);
+              picker.$emit('pick', [start, end]);
+            }
+          },
+          {
+            text: '昨天',
+            onClick(picker) {
+              const date = new Date();
+              const start = new Date(date.getFullYear(), date.getMonth(), date.getDate() - 1, 0, 0, 0);
+              const end = new Date(date.getFullYear(), date.getMonth(), date.getDate() - 1, 23, 59, 59);
+              picker.$emit('pick', [start, end]);
+            }
+          }, {
+            text: '当月',
+            onClick(picker) {
+              const date = new Date();
+              const start = new Date(date.getFullYear(), date.getMonth(), 1, 0, 0, 0);
+              const end = new Date(date.getFullYear(), date.getMonth() + 1, 0, 23, 59, 59);
+              picker.$emit('pick', [start, end]);
+            }
+          }, {
+            text: '当季',
+            onClick(picker) {
+              const date = new Date();
+              const start = new Date(date.getFullYear(),parseInt(date.getMonth()/3)*3, 1, 0, 0, 0);
+              const end = new Date(date.getFullYear(),parseInt(date.getMonth()/3)*3+3, 0, 23, 59, 59);
+              picker.$emit('pick', [start, end]);
+            }
+          }, {
+            text: '当年',
+            onClick(picker) {
+              const date = new Date();
+              const start = new Date(date.getFullYear(), date.getMonth(), 1, 0, 0, 0);
+              const end = new Date(date.getFullYear() + 1, 0, 0, 23, 59, 59);
+              picker.$emit('pick', [start, end]);
+            }
+          }, {
+            text: '最近一周',
+            onClick(picker) {
+              const date = new Date();
+              const start = new Date(date.getFullYear(), date.getMonth(), date.getDate() - 7, 0, 0, 0);
+              const end = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 23, 59, 59);
+              picker.$emit('pick', [start, end]);
+            }
+          }, {
+            text: '最近二周',
+            onClick(picker) {
+              const date = new Date();
+              const start = new Date(date.getFullYear(), date.getMonth(), date.getDate() - 7*2, 0, 0, 0);
+              const end = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 23, 59, 59);
+              picker.$emit('pick', [start, end]);
+            }
+          }, {
+            text: '最近三周',
+            onClick(picker) {
+              const date = new Date();
+              const start = new Date(date.getFullYear(), date.getMonth(), date.getDate() - 7*3, 0, 0, 0);
+              const end = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 23, 59, 59);
+              picker.$emit('pick', [start, end]);
+            }
+          }]
+      },
         };
     },
     props: {

+ 144 - 231
src/views/client/detailsPage.vue

@@ -17,9 +17,9 @@
         <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> -->
+              <avue-cascader :emit-path="false" check-strictly :show-all-levels="false" v-model="form.corpsTypeId"
+                placeholder="请选择客户分类" :dic="corpTypeList" :props="props">
+              </avue-cascader>
               <i class="el-icon-circle-plus-outline" style="font-size:18px;line-height: 32px;margin-left:4px"
                 @click="corpTypeVisible = true"></i>
             </div>
@@ -27,48 +27,50 @@
         </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" @row-save="rowSave" @row-update="addUpdate">
-          <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>
+        <el-tabs v-model="activeName">
+          <el-tab-pane label="客户地址" name="first">
+            <avue-crud ref="crud" :option="option2" :data="data1" :table-loading="loading" @saveColumn="saveColumn"
+              @resetColumn="resetColumn" :cell-style="cellStyle" class="address">
+              <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>
+          </el-tab-pane>
+          <el-tab-pane label="物流地址" name="second">
+            <avue-crud ref="crud2" :option="option3" :data="data2" :table-loading="loading" @saveColumn="saveColumn2"
+              @resetColumn="resetColumn2" :cell-style="cellStyle">
+              <template slot="headerSerial">
+                <el-button type="primary" icon="el-icon-plus" size="mini" @click.stop="addRow2"
+                  :disabled="detailData.status == 1" circle></el-button>
+              </template>
+              <template slot="menu" slot-scope="{ row, index }">
+                <el-button size="small" type="text" @click="rowCell2(row, index)">{{
+                    row.$cellEdit ? "保存" : "修改"
+                }}</el-button>
+                <el-button size="small" type="text" @click="rowDel2(row, index)">删除
+                </el-button>
+              </template>
+            </avue-crud>
+          </el-tab-pane>
+        </el-tabs>
+
       </trade-card>
       <containerTitle title="上传附件"></containerTitle>
       <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 @closed="addressClosed">
-        <span>
-          <el-tabs v-model="activeName">
-            <el-tab-pane label="客户地址" name="first">
-              <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 :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="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 :key="reload" ref="corpType" v-model="form4" :option="option4" style="margin-top:20px">
           </avue-form>
         </span>
         <div class="avue-dialog__footer">
@@ -81,8 +83,8 @@
 </template>
 
 <script>
-import { optionList } from "./js/optionList";
-import { getDetails, addCorpType, getCorpType, submit } from "@/api/basicData/client";
+import { option2, option3 } from "./js/optionList";
+import { getDetails, addCorpType, getCorpType, submit, customerList } from "@/api/basicData/client";
 export default {
   name: "index",
   data() {
@@ -101,7 +103,8 @@ export default {
       form2: {},
       form3: {},
       form4: {},
-      data: [],
+      data1: [],
+      data2: [],
       option: {
         menuBtn: false,
         labelWidth: 130,
@@ -157,38 +160,15 @@ export default {
           }
         ]
       },
-      option2: {
+      option2: {},
+      option3: {},
+      option4: {
         menuBtn: false,
-        labelWidth: 90,
+        labelWidth: 80,
         column: [
           {
-            label: "简称",
-            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: "addr",
-            dicData: JSON.parse(localStorage.getItem('areaTypeTree')),
-            dataType: "string",
-            type: "cascader",
-            props: {
-              label: 'name',
-              value: 'name'
-            },
-            span: 24,
-          },
-          {
-            label: "详细地址",
-            prop: "detailedAddress",
+            label: "分类名称",
+            prop: "cname",
             rules: [
               {
                 required: true,
@@ -199,110 +179,18 @@ export default {
             span: 24,
           },
           {
-            label: "邮编",
-            prop: "postalCode",
-            span: 24,
-          },
-          {
-            label: "备注",
-            prop: "remarks",
-            type: 'textarea',
-            minRows: 3,
-            span: 24,
-          },
-          {
-            label: "地址智能识别",
-            prop: "ad",
-            placeholder: "例:上海市徐汇区枫林街道斜土路100号",
-            type: "textarea",
-            minRows: 3,
-            span: 24,
-          }
-        ]
-      },
-      option3: {
-        menuBtn: false,
-        labelWidth: 90,
-        column: [
-          {
-            label: "目的地",
-            prop: "destination",
-            span: 24,
-          },
-          {
-            label: "物流公司",
-            prop: "logisticsCompany",
-            span: 24,
-          },
-          {
-            label: "电话",
-            prop: "tel",
-            span: 24,
-          },
-          {
-            label: "地址",
-            prop: "addr",
-            dicData: JSON.parse(localStorage.getItem('areaTypeTree')),
-            dataType: "string",
-            type: "cascader",
+            label: "上级类型",
+            prop: "parentId",
+            dicData: [],
+            type: "tree",
             props: {
-              label: 'name',
-              value: 'name'
+              label: "cname",
+              value: "id"
             },
             span: 24,
-          },
-          {
-            label: "详细地址",
-            prop: "detailedAddress",
-            rules: [
-              {
-                required: true,
-                message: "",
-                trigger: "blur"
-              }
-            ],
-            span: 24,
-          },
-          {
-            label: "邮编",
-            prop: "postalCode",
-            span: 24,
-          },
-          {
-            label: "备注",
-            prop: "remarks",
-            type: "textarea",
-            minRows: 3,
-            span: 24,
-          },
-          {
-            label: "地址智能识别",
-            prop: "g",
-            type: "textarea",
-            minRows: 3,
-            span: 24,
           }
         ]
       },
-      option4: {
-        menuBtn: false,
-        labelWidth: 80,
-        column: [
-          {
-            label: "分类名称",
-            prop: "cname",
-            rules: [
-              {
-                required: true,
-                message: "",
-                trigger: "blur"
-              }
-            ],
-            span: 24,
-          }
-        ]
-      },
-      optionList: {},
     };
   },
   props: {
@@ -311,9 +199,13 @@ export default {
     }
   },
   async created() {
-    this.optionList = await this.getColumnData(
+    this.option2 = await this.getColumnData(
       this.getColumnName(208),
-      optionList
+      option2
+    );
+    this.option3 = await this.getColumnData(
+      this.getColumnName(208.4),
+      option3
     );
     if (this.detailData.id) {
       this.getDetail(this.detailData.id);
@@ -322,17 +214,21 @@ export default {
       this.option.disabled = true;
     }
     this.getCorpType()
+    this.getAllWorkDicts()
   },
   methods: {
     getAllWorkDicts() {
-      this.findObject(this.option2.column, "addr").dicData = JSON.parse(localStorage.getItem('areaTypeTree'));
-      this.findObject(this.option3.column, "addr").dicData = JSON.parse(localStorage.getItem('areaTypeTree'));
+      customerList({ corpType: "KH" }).then(res => {
+        this.findObject(this.option4.column, "parentId").dicData = res.data.data.records
+      });
+      this.getWorkDicts("abbreviation").then(res => {
+        this.findObject(this.option2.column, "abbreviation").dicData = res.data.data;
+      });
     },
     cellStyle() {
       return "padding:0;height:40px;";
     },
     selectValue(value, row) {
-      console.log(value, row)
       if (row.feesId) {
         row.feesName = value.cname
       } else {
@@ -354,27 +250,15 @@ export default {
       this.form.corpName = row.cname
     },
     addRow() {
-      this.addressTitle = '新增地址'
-      this.addressVisible = true
+      this.data1.push({ $cellEdit: true, type: 0 })
     },
     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
+      if (row.$cellEdit == true) {
+        this.$set(row, "$cellEdit", false);
+      } else {
+        this.$set(row, "$cellEdit", true);
       }
     },
-    rowSave(form, done) {
-      done()
-    },
-    addUpdate(form, index, done, loading) {
-      done()
-    },
     rowDel(row, index) {
       this.$confirm("确定删除数据?", {
         confirmButtonText: "确定",
@@ -387,58 +271,54 @@ export default {
           //     type: "success",
           //     message: "删除成功!"
           //   });
-          //   this.data.splice(index, 1);
+          //   this.data1.splice(index, 1);
           // });
         } else {
           this.$message({
             type: "success",
             message: "删除成功!"
           });
-          this.data.splice(index, 1);
+          this.data1.splice(index, 1);
         }
       });
     },
-    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
+    addRow2() {
+      this.data2.push({ $cellEdit: true, type: 1 })
     },
-    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;
-          }
-        });
+    rowCell2(row, index) {
+      if (row.$cellEdit == true) {
+        this.$set(row, "$cellEdit", 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;
-          }
-        });
+        this.$set(row, "$cellEdit", true);
       }
     },
+    rowDe2(row, index) {
+      this.$confirm("确定删除数据?", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        if (row.id) {
+          // itemDel(row.id).then(res => {
+          //   this.$message({
+          //     type: "success",
+          //     message: "删除成功!"
+          //   });
+          //   this.data2.splice(index, 1);
+          // });
+        } else {
+          this.$message({
+            type: "success",
+            message: "删除成功!"
+          });
+          this.data2.splice(index, 1);
+        }
+      });
+    },
+    corpTypeClosed() {
+      this.reload = Math.random();
+      this.form4 = this.$options.data().form4
+    },
     getCorpType() {
       getCorpType({ corpType: 'KH' }).then(res => {
         this.corpTypeList = res.data.data
@@ -482,7 +362,7 @@ export default {
     async saveColumn() {
       const inSave = await this.saveColumnData(
         this.getColumnName(208),
-        this.optionList
+        this.option2
       );
       if (inSave) {
         this.$nextTick(() => {
@@ -494,10 +374,10 @@ export default {
       }
     },
     async resetColumn() {
-      this.optionList = optionList;
+      this.option2 = option2;
       const inSave = await this.delColumnData(
         this.getColumnName(208),
-        optionList
+        option2
       );
       if (inSave) {
         this.$nextTick(() => {
@@ -508,6 +388,35 @@ export default {
         this.$refs.crud.$refs.dialogColumn.columnBox = false;
       }
     },
+    async saveColumn2() {
+      const inSave = await this.saveColumnData(
+        this.getColumnName(208.4),
+        this.option3
+      );
+      if (inSave) {
+        this.$nextTick(() => {
+          this.$refs.crud.doLayout();
+        });
+        this.$message.success("保存成功");
+        //关闭窗口
+        this.$refs.crud2.$refs.dialogColumn.columnBox = false;
+      }
+    },
+    async resetColumn2() {
+      this.option3 = option3;
+      const inSave = await this.delColumnData(
+        this.getColumnName(208.4),
+        option3
+      );
+      if (inSave) {
+        this.$nextTick(() => {
+          this.$refs.crud.doLayout();
+        });
+        this.getAllWorkDicts()
+        this.$message.success("重置成功");
+        this.$refs.crud2.$refs.dialogColumn.columnBox = false;
+      }
+    },
     //返回列表
     backToList() {
       this.$emit("goBack");
@@ -530,6 +439,10 @@ export default {
   display: none !important;
 }
 
+.el-dialog ::v-deep .el-form-item__error {
+  display: none !important;
+}
+
 .img-form ::v-deep .el-form-item {
   height: 150px;
   line-height: 150px;

+ 148 - 44
src/views/client/index.vue

@@ -1,7 +1,7 @@
 <template>
   <div>
     <basic-container v-show="show && showInfo" class="page-crad">
-      <table border="0" width="100%" style="margin-bottom:20px;" v-loading="loading">
+      <table border="0" width="100%" style="margin-bottom:20px;" v-loading="loading" :option="option">
         <tr>
           <td class="stat-td">
             <img src="@/assets/img/contractAmountBg.png" class="stat-img">
@@ -57,47 +57,59 @@
           </td>
         </tr>
       </table>
-      <avue-crud ref="crud" :option="option" :data="dataList" :page.sync="page" :search.sync="search"
-        @search-change="searchChange" @current-change="currentChange" @size-change="sizeChange"
-        @refresh-change="refreshChange" @on-load="onLoad" :table-loading="loading" @saveColumn="saveColumn"
-        @resetColumn="resetColumn" :cell-style="cellStyle" @search-criteria-switch="searchCriteriaSwitch">
-        <template slot="menuLeft">
-          <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="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-del" @click.stop="rowDel(row)"/>
-          </el-tooltip>
-          <el-tooltip class="item" effect="dark" content="编辑" placement="top">
-            <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" />
-          </el-tooltip>
-          <el-tooltip class="item" effect="dark" content="发货" placement="top">
-            <i class="tradingIcon icon-deliver" />
-          </el-tooltip>
-          <el-tooltip class="item" effect="dark" content="对账" placement="top">
-            <i class="tradingIcon icon-reconciliation" />
-          </el-tooltip>
-          <!-- <el-button type="text" size="small" @click.stop="editOpen(row, 2)">
+      <el-row>
+        <el-col :span="4">
+          <avue-tree :option="treeOption" :data="treeData" @node-click="nodeClick" style="height:73vh;" />
+        </el-col>
+        <el-col :span="20">
+          <avue-crud ref="crud" :option="option" :data="dataList" :page.sync="page" :search.sync="search"
+            @search-change="searchChange" @current-change="currentChange" @size-change="sizeChange"
+            @refresh-change="refreshChange" @on-load="onLoad" :table-loading="loading" @saveColumn="saveColumn"
+            @resetColumn="resetColumn" :cell-style="cellStyle" @search-criteria-switch="searchCriteriaSwitch">
+            <template slot="menuLeft">
+              <el-button type="primary" size="mini" @click.stop="newAdd()">新建客户
+              </el-button>
+            </template>
+            <template slot-scope="{ row, index }" slot="cname">
+              <span style="color: #409EFF;cursor: pointer" @click.stop="viewInfo(row)">{{ row.cname }}
+              </span>
+            </template>
+            <template slot="idsSearch">
+              <crop-select v-model="search.ids" corpType="KH"></crop-select>
+            </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']"
+                :picker-options="pickerOptions">
+              </el-date-picker>
+            </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)" />
+              </el-tooltip>
+              <el-tooltip class="item" effect="dark" content="编辑" placement="top">
+                <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" />
+              </el-tooltip>
+              <el-tooltip class="item" effect="dark" content="发货" placement="top">
+                <i class="tradingIcon icon-deliver" />
+              </el-tooltip>
+              <el-tooltip class="item" effect="dark" content="对账" placement="top">
+                <i class="tradingIcon icon-reconciliation" />
+              </el-tooltip>
+              <!-- <el-button type="text" size="small" @click.stop="editOpen(row, 2)">
             查看
           </el-button>
           <el-button type="text" size="small" @click.stop="rowDel(row, index)">
             删除
           </el-button> -->
-        </template>
-      </avue-crud>
+            </template>
+          </avue-crud>
+        </el-col>
+      </el-row>
+
     </basic-container>
     <details-page v-if="!show" @goBack="goBack()" :detailData="detailData" />
     <details-info v-if="!showInfo" @goBack="goBack()" :detailData="detailData" />
@@ -108,7 +120,7 @@
 import detailsInfo from "./detailsInfo";
 import detailsPage from "./detailsPage";
 import { option } from "./js/optionList";
-import { getList, getCorpsAll, pageStatistics,remove } from "@/api/basicData/client";
+import { getList, getCorpType, pageStatistics, remove } from "@/api/basicData/client";
 export default {
   name: "index",
   data() {
@@ -134,7 +146,87 @@ export default {
         balanceAmount: 0,
         settlmentAmount: 0
       },
-      option: {},
+      formSerach: {},
+      pickerOptions: {
+        shortcuts: [
+          {
+            text: '当天',
+            onClick(picker) {
+              const date = new Date();
+              const start = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);
+              const end = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 23, 59, 59);
+              picker.$emit('pick', [start, end]);
+            }
+          },
+          {
+            text: '昨天',
+            onClick(picker) {
+              const date = new Date();
+              const start = new Date(date.getFullYear(), date.getMonth(), date.getDate() - 1, 0, 0, 0);
+              const end = new Date(date.getFullYear(), date.getMonth(), date.getDate() - 1, 23, 59, 59);
+              picker.$emit('pick', [start, end]);
+            }
+          }, {
+            text: '当月',
+            onClick(picker) {
+              const date = new Date();
+              const start = new Date(date.getFullYear(), date.getMonth(), 1, 0, 0, 0);
+              const end = new Date(date.getFullYear(), date.getMonth() + 1, 0, 23, 59, 59);
+              picker.$emit('pick', [start, end]);
+            }
+          }, {
+            text: '当季',
+            onClick(picker) {
+              const date = new Date();
+              const start = new Date(date.getFullYear(),parseInt(date.getMonth()/3)*3, 1, 0, 0, 0);
+              const end = new Date(date.getFullYear(),parseInt(date.getMonth()/3)*3+3, 0, 23, 59, 59);
+              picker.$emit('pick', [start, end]);
+            }
+          }, {
+            text: '当年',
+            onClick(picker) {
+              const date = new Date();
+              const start = new Date(date.getFullYear(), date.getMonth(), 1, 0, 0, 0);
+              const end = new Date(date.getFullYear() + 1, 0, 0, 23, 59, 59);
+              picker.$emit('pick', [start, end]);
+            }
+          }, {
+            text: '最近一周',
+            onClick(picker) {
+              const date = new Date();
+              const start = new Date(date.getFullYear(), date.getMonth(), date.getDate() - 7, 0, 0, 0);
+              const end = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 23, 59, 59);
+              picker.$emit('pick', [start, end]);
+            }
+          }, {
+            text: '最近二周',
+            onClick(picker) {
+              const date = new Date();
+              const start = new Date(date.getFullYear(), date.getMonth(), date.getDate() - 7*2, 0, 0, 0);
+              const end = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 23, 59, 59);
+              picker.$emit('pick', [start, end]);
+            }
+          }, {
+            text: '最近三周',
+            onClick(picker) {
+              const date = new Date();
+              const start = new Date(date.getFullYear(), date.getMonth(), date.getDate() - 7*3, 0, 0, 0);
+              const end = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 23, 59, 59);
+              picker.$emit('pick', [start, end]);
+            }
+          }]
+      },
+      treeOption: {
+        addBtn: false,
+        menu: false,
+        size: "small",
+        props: {
+          labelText: "标题",
+          label: "title",
+          value: "value",
+        }
+      },
+      treeData: []
     };
   },
   components: {
@@ -147,11 +239,23 @@ export default {
     this.getAllWorkDicts()
   },
   methods: {
+    filterNode(value, data) {
+      console.log(value, data)
+      if (!value) return true;
+      return data.label.indexOf(value) !== -1;
+    },
+    nodeClick(data) {
+      this.search.corpsTypeId = data.value
+      this.page.currentPage = 1;
+      this.onLoad(this.page, this.search);
+    },
     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.getWorkDicts("client_status").then(res => {
+        this.findObject(this.option.column, "status").dicData = res.data.data;
+      });
+      getCorpType({ corpType: 'KH' }).then(res => {
+        this.treeData = res.data.data
+      });
       this.$refs.crud.init();
     },
     searchCriteriaSwitch(type) {
@@ -229,7 +333,7 @@ export default {
         cancelButtonText: "取消",
         type: "warning"
       }).then(() => {
-        remove({id:row.id,corpType:"KH"}).then(res => {
+        remove({ id: row.id, corpType: "KH" }).then(res => {
           if (res.data.code == 200) {
             this.$message({
               type: "success",

+ 133 - 18
src/views/client/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,
@@ -18,9 +18,7 @@ export const option = {
   column: [
     {
       label: "客户名称",
-      prop: "id",
-      type: 'select',
-      dicData: [],
+      prop: "cname",
       overHidden: true,
       index: 1
     },
@@ -28,8 +26,6 @@ export const option = {
       label: "客户名称",
       prop: "ids",
       type: 'select',
-      dicData: [],
-      overHidden: true,
       hide: true,
       showColumn: false,
       search: true,
@@ -83,16 +79,6 @@ export const option = {
       index: 9
     },
     {
-      label: "客户分类",
-      prop: "corpsTypeId",
-      type: 'select',
-      hide: true,
-      search: true,
-      showColumn: false,
-      overHidden: true,
-      index: 10
-    },
-    {
       label: "日期",
       prop: "date",
       hide: true,
@@ -112,7 +98,7 @@ export const optionList = {
   border: true,
   menuWidth: 120,
   stripe: true,
-  index:true,
+  index: true,
   indexSlot: true,
   column: [
     {
@@ -143,7 +129,136 @@ export const optionList = {
     }
   ]
 }
-
+export const option2 = {
+  align: "center",
+  addBtn: false,
+  refreshBtn: false,
+  editBtn: false,
+  delBtn: false,
+  border: true,
+  menuWidth: 120,
+  stripe: true,
+  index: true,
+  indexSlot: true,
+  column: [
+    {
+      label: "简称",
+      allowCreate: true,
+      filterable: true,
+      prop: "abbreviation",
+      type: "select",
+      props: {
+        label: "dictValue",
+        value: "dictKey"
+      },
+      // dicUrl: "/api/blade-system/dict-biz/dictionary?code=abbreviation",
+      dicData:[],
+      cell: true,
+      minWidth:200,
+      span: 24,
+    },
+    {
+      label: "地址",
+      prop: "addr",
+      dicData: JSON.parse(localStorage.getItem('areaTypeTree')),
+      dataType: "string",
+      type: "cascader",
+      props: {
+        label: 'name',
+        value: 'name'
+      },
+      filterable:true,
+      cell: true,
+      minWidth:250,
+      span: 24,
+    },
+    {
+      label: "详细地址",
+      prop: "detailedAddress",
+      cell: true,
+      minWidth:350,
+      span: 24,
+    },
+    {
+      label: "邮编",
+      prop: "postalCode",
+      cell: true,
+      minWidth:150,
+      span: 24,
+    },
+    {
+      label: "备注",
+      prop: "remarks",
+      cell: true,
+      minWidth:300,
+      span: 24,
+    }
+  ]
+}
+export const option3 = {
+  align: "center",
+  addBtn: false,
+  refreshBtn: false,
+  editBtn: false,
+  delBtn: false,
+  border: true,
+  menuWidth: 120,
+  stripe: true,
+  index: true,
+  indexSlot: true,
+  column: [
+    {
+      label: "目的地",
+      prop: "destination",
+      minWidth:150,
+      cell: true,
+    },
+    {
+      label: "物流公司",
+      prop: "logisticsCompany",
+      minWidth:200,
+      cell: true,
+    },
+    {
+      label: "电话",
+      prop: "tel",
+      minWidth:150,
+      cell: true,
+    },
+    {
+      label: "地址",
+      prop: "addr",
+      dicData: JSON.parse(localStorage.getItem('areaTypeTree')),
+      dataType: "string",
+      type: "cascader",
+      props: {
+        label: 'name',
+        value: 'name'
+      },
+      minWidth:250,
+      filterable:true,
+      cell: true
+    },
+    {
+      label: "详细地址",
+      prop: "detailedAddress",
+      minWidth:350,
+      cell: true,
+    },
+    {
+      label: "邮编",
+      prop: "postalCode",
+      minWidth:150,
+      cell: true,
+    },
+    {
+      label: "备注",
+      prop: "remarks",
+      minWidth:300,
+      cell: true,
+    }
+  ]
+}
 export const sellOptionList = {
   searchShow: true,
   searchMenuSpan: 8,

+ 65 - 14
src/views/product/detailsPage.vue

@@ -17,11 +17,12 @@
         <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>
+              <avue-cascader :emit-path="false" check-strictly :show-all-levels="false" v-model="form.goodsTypeId"
+                placeholder="请选择产品分类" :dic="goodsTypeList" :props="props">
+              </avue-cascader>
               <!-- <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>
+                @click="goodsTypeVisible = true"></i>
             </div>
           </template>
           <template slot="whether">
@@ -47,19 +48,32 @@
       </trade-card>
       <containerTitle title="主图附件"></containerTitle>
       <c-upload :data="filesList" display deleteUrl="/api/blade-client/goodsfiles/delete" :enumerationValue="160" />
+      <el-dialog title="添加产品分类" v-dialogDrag :visible.sync="goodsTypeVisible" class="avue-dialog avue-dialog--top"
+        width="30%" append-to-body @closed="goodsTypeClosed">
+        <span>
+          <avue-form :key="reload" ref="goodsType" v-model="form2" :option="option2" style="margin-top:20px">
+          </avue-form>
+        </span>
+        <div class="avue-dialog__footer">
+          <el-button @click="goodsTypeVisible = false" size="mini">取 消</el-button>
+          <el-button @click="saveGoodstype" type="primary" size="mini">确 定</el-button>
+        </div>
+      </el-dialog>
     </div>
   </div>
 </template>
 
 <script>
-import { getGoodstype, getDetails, goodsTypesubmit, getStoragetype, submit,itemRemove } from "@/api/basicData/product";
+import { getGoodstype, getDetails, goodsTypesubmit, getStoragetype, submit, itemRemove } from "@/api/basicData/product";
 import { optionList } from "./js/optionList";
 export default {
   name: "index",
   data() {
     return {
       loadingBtn: false,
+      goodsTypeVisible: false,
       form: {},
+      form2: {},
       data: [],
       option: {
         menuBtn: false,
@@ -144,6 +158,35 @@ export default {
           }
         ]
       },
+      option2: {
+        menuBtn: false,
+        labelWidth: 80,
+        column: [
+          {
+            label: "分类名称",
+            prop: "cname",
+            rules: [
+              {
+                required: true,
+                message: "",
+                trigger: "blur"
+              }
+            ],
+            span: 24,
+          },
+          {
+            label: "上级类型",
+            prop: "parentId",
+            dicData: [],
+            type: "tree",
+            props: {
+              label: "title",
+              value: "id"
+            },
+            span: 24,
+          }
+        ]
+      },
       filesList: [],
       props: {
         label: 'title',
@@ -175,6 +218,7 @@ export default {
     getAllWorkDicts() {
       getGoodstype().then(res => {
         this.goodsTypeList = res.data.data;
+        this.findObject(this.option2.column, "parentId").dicData = res.data.data;
       });
       getStoragetype().then(res => {
         this.findObject(this.optionList.column, "storageId").dicData = res.data.data;
@@ -197,7 +241,7 @@ export default {
         type: "warning"
       }).then(() => {
         if (row.id) {
-          itemRemove({ids:row.id}).then(res => {
+          itemRemove({ ids: row.id }).then(res => {
             this.$message({
               type: "success",
               message: "删除成功!"
@@ -213,15 +257,22 @@ export default {
         }
       });
     },
-    addGoodstype() {
-      this.$prompt('产品分类名称', '产品分类', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-      }).then(({ value }) => {
-        goodsTypesubmit({ cname: value, status: 0 }).then(res => {
-          this.getAllWorkDicts()
-        })
-      })
+    saveGoodstype() {
+      this.$refs["goodsType"].validate((valid, done) => {
+        done();
+        if (valid) {
+          goodsTypesubmit({ ...this.form2, status: 0 }).then(res => {
+            this.getAllWorkDicts()
+          })
+          this.goodsTypeVisible = false
+        } else {
+          return false;
+        }
+      });
+    },
+    goodsTypeClosed() {
+      this.reload = Math.random();
+      this.form2 = this.$options.data().form2
     },
     getDetail(id) {
       this.loadingBtn = true

+ 17 - 8
src/views/salesOrder/detailsPage.vue

@@ -16,9 +16,12 @@
       <!-- <containerTitle title="基础资料" style="margin-top: 60px"></containerTitle> -->
       <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">
+          <!-- <template slot="corpId">
             <ypj-corp v-model="form.corpId" :disabled="detailData.status == 1" @getCorpData="getCorpData"
               :dataInfo="true"></ypj-corp>
+          </template> -->
+          <template slot="corpId">
+            <crop-select v-model="form.corpId" corpType="KH" @getCorpData="getCorpData"></crop-select>
           </template>
         </avue-form>
       </trade-card>
@@ -45,8 +48,8 @@
             </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>
+            <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 }">
@@ -55,8 +58,8 @@
             <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>
+            <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 }">
@@ -406,9 +409,15 @@ export default {
         });
     },
     getCorpData(row) {
-      console.log(row)
-      this.findObject(this.option.column, "arrivalAddress").dicData = row.corpsAddrList;
-      // this.form.corpName = row.cname
+      if (row) {
+        this.form.corpsName = row.cname
+        getCorpDetails({ id: row.id }).then(res => {
+          this.findObject(this.option.column, "arrivalAddress").dicData = res.data.data.corpsAddrList;
+        })
+      } else {
+        this.form.corpsName = null
+        this.findObject(this.option.column, "arrivalAddress").dicData = []
+      }
     },
     getAddress(row) {
       getCorpDetails({ id: row.corpId }).then(res => {

+ 60 - 10
src/views/salesOrder/index.vue

@@ -9,13 +9,17 @@
           <el-button type="primary" size="mini" @click.stop="newAdd()">新建销售单
           </el-button>
         </template>
+        <template slot="corpIdSearch">
+          <crop-select v-model="search.corpId" corpType="KH"></crop-select>
+        </template>
         <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']" :picker-options="pickerOptions">
+            format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss" :default-time="['00:00:00', '23:59:59']"
+            :picker-options="pickerOptions">
           </el-date-picker>
         </template>
         <template slot-scope="{ row, index }" slot="menu">
@@ -73,24 +77,70 @@ export default {
       },
       option: {},
       pickerOptions: {
-        disabledDate(time) {
-          return time.getTime() > Date.now();
-        },
         shortcuts: [
           {
+            text: '当天',
+            onClick(picker) {
+              const date = new Date();
+              const start = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);
+              const end = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 23, 59, 59);
+              picker.$emit('pick', [start, end]);
+            }
+          },
+          {
             text: '昨天',
             onClick(picker) {
-              const end = new Date();
-              const start = new Date();
-              start.setTime(start.getTime() - 3600 * 1000 * 24);
+              const date = new Date();
+              const start = new Date(date.getFullYear(), date.getMonth(), date.getDate() - 1, 0, 0, 0);
+              const end = new Date(date.getFullYear(), date.getMonth(), date.getDate() - 1, 23, 59, 59);
+              picker.$emit('pick', [start, end]);
+            }
+          }, {
+            text: '当月',
+            onClick(picker) {
+              const date = new Date();
+              const start = new Date(date.getFullYear(), date.getMonth(), 1, 0, 0, 0);
+              const end = new Date(date.getFullYear(), date.getMonth() + 1, 0, 23, 59, 59);
+              picker.$emit('pick', [start, end]);
+            }
+          }, {
+            text: '当季',
+            onClick(picker) {
+              const date = new Date();
+              const start = new Date(date.getFullYear(), parseInt(date.getMonth() / 3) * 3, 1, 0, 0, 0);
+              const end = new Date(date.getFullYear(), parseInt(date.getMonth() / 3) * 3 + 3, 0, 23, 59, 59);
+              picker.$emit('pick', [start, end]);
+            }
+          }, {
+            text: '当年',
+            onClick(picker) {
+              const date = new Date();
+              const start = new Date(date.getFullYear(), date.getMonth(), 1, 0, 0, 0);
+              const end = new Date(date.getFullYear() + 1, 0, 0, 23, 59, 59);
               picker.$emit('pick', [start, end]);
             }
           }, {
             text: '最近一周',
             onClick(picker) {
-              const end = new Date();
-              const start = new Date();
-              start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
+              const date = new Date();
+              const start = new Date(date.getFullYear(), date.getMonth(), date.getDate() - 7, 0, 0, 0);
+              const end = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 23, 59, 59);
+              picker.$emit('pick', [start, end]);
+            }
+          }, {
+            text: '最近二周',
+            onClick(picker) {
+              const date = new Date();
+              const start = new Date(date.getFullYear(), date.getMonth(), date.getDate() - 7 * 2, 0, 0, 0);
+              const end = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 23, 59, 59);
+              picker.$emit('pick', [start, end]);
+            }
+          }, {
+            text: '最近三周',
+            onClick(picker) {
+              const date = new Date();
+              const start = new Date(date.getFullYear(), date.getMonth(), date.getDate() - 7 * 3, 0, 0, 0);
+              const end = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 23, 59, 59);
               picker.$emit('pick', [start, end]);
             }
           }]