Browse Source

经销商

lichao 3 years ago
parent
commit
6d8afeb897

+ 9 - 0
src/api/basicData/inventoryAccount.js

@@ -57,3 +57,12 @@ export const getStock = (current, size, params) => {
     }
   })
 }
+
+// 库存账获得详情
+export function getDetail(data) {
+  return request({
+    url: '/api/blade-stock/stockgoods/message',
+    method: 'get',
+    params: data
+  })
+}

+ 53 - 0
src/api/dealer/purchase.js

@@ -0,0 +1,53 @@
+import request from '@/router/axios';
+
+//采购资料列表查询
+export function getPurchaseList(params) {
+  return request({
+    url: '/api/trade-purchase/dealer/purchaseOrder/list',
+    method: 'get',
+    params
+  })
+}
+//采购资料列表删除
+export function deleteDetails(data) {
+  return request({
+    url: '/api/trade-purchase/dealer/purchaseOrder/remove',
+    method: 'post',
+    params: {
+      ids:data
+    }
+  })
+}
+//采购资料列表查看明细
+export function dataDetail(data) {
+  return request({
+    url: '/api/trade-purchase/dealer/purchaseOrder/'+data,
+    method: 'get'
+  })
+}
+//采购资料列表修改和新增
+export function typeSave(data) {
+  return request({
+    url: '/api/trade-purchase/dealer/purchaseOrder/submit',
+    method: 'post',
+    data
+  })
+}
+//商品从表列表删除
+export function removeGoods(data) {
+  return request({
+    url: '/api/trade-purchase/dealer/purchaseOrder/removeByItem',
+    method: 'post',
+    data: {
+      id:data
+    }
+  })
+}
+//采购确认或取消订单
+export function dealerSubmit(params) {
+  return request({
+    url: '/api/trade-purchase/dealer/purchaseOrder/dealerSubmit',
+    method: 'get',
+    params
+  })
+}

+ 61 - 0
src/api/dealer/sales.js

@@ -0,0 +1,61 @@
+import request from '@/router/axios';
+
+//列表查询
+export function getSalesList(params) {
+  return request({
+    url: '/api/blade-purchase-sales/dealerOrder/page',
+    method: 'get',
+    params
+  })
+}
+//修改和保存
+export function typeSave(data) {
+  return request({
+    url: '/api/blade-purchase-sales/dealerOrder/submit',
+    method: 'post',
+    data
+  })
+}
+//查看详情
+export function dataDetail(data) {
+  return request({
+    url: '/api/blade-purchase-sales/dealerOrder/detail?id='+data,
+    method: 'get'
+  })
+}
+//列表删除
+export function deleteDetails(data) {
+  return request({
+    url: '/api/blade-purchase-sales/dealerOrder/update',
+    method: 'post',
+    data: {
+      id: data
+    }
+  })
+}
+//商品从表列表删除
+export function removeGoods(data) {
+  return request({
+    url: '/api/blade-purchase-sales/orderitems/update',
+    method: 'post',
+    data: {
+      id:data
+    }
+  })
+}
+//列表查询
+export function getLotNo(params) {
+  return request({
+    url: '/api/blade-purchase-sales/dealerOrder/lotNo',
+    method: 'get',
+    params
+  })
+}
+//确认或取消订单
+export function dealerSubmit(params) {
+  return request({
+    url: '/api/blade-purchase-sales/dealerOrder/dealerSubmit',
+    method: 'get',
+    params
+  })
+}

+ 9 - 1
src/components/finance/config/option.json

@@ -152,10 +152,18 @@
       "width": 120
     },
     {
+      "label": "商品名称",
+      "prop": "cname",
+      "overHidden": true,
+      "index": 12,
+      "value": 0,
+      "width": 120
+    },
+    {
       "label": "备注",
       "prop": "remarks",
       "overHidden": true,
-      "index": 12,
+      "index": 13,
       "cell": true,
       "width": 150
     }

+ 1 - 2
src/components/finance/financialAccount.vue

@@ -47,7 +47,7 @@
           <span v-else>{{corpsName}}</span>
         </template>
         <template slot-scope="{row,index}" slot="costType">
-          <span v-if="row.$cellEdit" class="required_fields">*</span>
+<!--          <span v-if="row.$cellEdit" class="required_fields">*</span>-->
           <breakdown-select
             v-if="row.$cellEdit"
             v-model="row.costType"
@@ -230,7 +230,6 @@
           this.billData = this.arrList[0]
           this.corpId = this.arrList[0].corpId
           this.corpsName = this.arrList[0].corpsName[0].cname
-          console.log(this.billData)
           this.arrList.forEach(item=>{
             this.$refs.crud.rowCellAdd(item);
           })

+ 60 - 35
src/views/basicData/productInformation/detailsPageEdit.vue

@@ -75,6 +75,15 @@
               placeholder="请输入 兑换积分"
             ></el-input>
           </template>
+          <template slot="batch">
+            <el-switch
+              v-model="form.batch"
+              active-text="是"
+              inactive-text="否"
+              :active-value="1"
+              :inactive-value="0"
+            />
+          </template>
         </avue-form>
       </basic-container>
     </div>
@@ -109,7 +118,7 @@ export default {
       detailsSelect: {},
       option: {
         menuBtn: false,
-        labelWidth: 100,
+        labelWidth: 110,
         column: [
           {
             label: "产品编码",
@@ -149,8 +158,8 @@ export default {
             ]
           },
           {
-            label: "花纹",
-            prop: "brandItem",
+            label: "规格",
+            prop: "typeno", //specs
             span: 8,
             rules: [
               {
@@ -161,8 +170,8 @@ export default {
             ]
           },
           {
-            label: "品牌",
-            prop: "brand",
+            label: "规格1(花纹)",
+            prop: "brandItem",
             span: 8,
             rules: [
               {
@@ -173,24 +182,25 @@ export default {
             ]
           },
           {
-            label: "状态",
-            prop: "status",
-            span: 8,
-            type: "select",
-            dicData: [
-              {
-                label: "正常",
-                value: 0
-              },
+            label: "规格2(尺寸)",
+            prop: "size",
+            span: 8
+          },
+          {
+            label: "供应商",
+            prop: "corpId",
+            span:16,
+            rules: [
               {
-                label: "停用",
-                value: 1
+                required: true,
+                message: " ",
+                trigger: "blur"
               }
             ]
           },
           {
-            label: "规格",
-            prop: "typeno", //specs
+            label: "品牌",
+            prop: "brand",
             span: 8,
             rules: [
               {
@@ -201,31 +211,31 @@ export default {
             ]
           },
           {
-            label: "负荷指数",
+            label: "级别(负荷指数)",
             prop: "specsOne",
             span: 8,
             rules: [
               {
-                required: true,
+                required: false,
                 message: " ",
                 trigger: "blur"
               }
             ]
           },
           {
-            label: "速级",
+            label: "级别2(速级)",
             prop: "specsTwo",
             span: 8,
             rules: [
               {
-                required: true,
+                required: false,
                 message: " ",
                 trigger: "blur"
               }
             ]
           },
           {
-            label: "加强型",
+            label: "级别3(加强型)",
             prop: "level",
             span: 8,
             rules: [
@@ -273,23 +283,32 @@ export default {
             ]
           },
           {
-            label: "供应商",
-            prop: "corpId",
-             span:16,
-            rules: [
-              {
-                required: true,
-                message: " ",
-                trigger: "blur"
-              }
-            ]
+            label: "计量单位",
+            prop: "unit",
+            span: 8
           },
           {
-            label: "三包",
-            prop: "threeGuarantees",
+            label: "辅助单位",
+            prop: "assistUnit",
             span: 8
           },
           {
+            label: "状态",
+            prop: "status",
+            span: 8,
+            type: "select",
+            dicData: [
+              {
+                label: "正常",
+                value: 0
+              },
+              {
+                label: "停用",
+                value: 1
+              }
+            ]
+          },
+          {
             label: "积分倍数",
             prop: "integralMultiples",
             span: 8
@@ -300,6 +319,11 @@ export default {
             span: 8
           },
           {
+            label: "按批次号计算",
+            prop: "batch",
+            span: 8
+          },
+          {
             label: "备注",
             prop: "remarks",
             type: "textarea",
@@ -318,6 +342,7 @@ export default {
     });
     this.$set(this.form, 'integralMultiples', 1)
     this.$set(this.form, 'integral', 0)
+    this.$set(this.form, 'batch', 0)
     if (this.detailData.id) {
       this.queryData(this.detailData.id)
     } else {

+ 5 - 7
src/views/businessManagement/salesOrder/detailsPageEdit.vue

@@ -478,8 +478,8 @@
                        @on-load="onLoad">
               <template slot="menuLeft" slot-scope="{size}">
                 <el-tabs v-model="activeName" @tab-click="tabHandle">
-                  <el-tab-pane label="查询结果" name="searchList"></el-tab-pane>
-                  <el-tab-pane label="已选定数据" name="importStaging"></el-tab-pane>
+                  <el-tab-pane label="查询结果" name="searchList"/>
+                  <el-tab-pane label="已选定数据" name="importStaging"/>
                 </el-tabs>
               </template>
               <template slot-scope="scope" slot="menu">
@@ -490,16 +490,14 @@
                   @click.stop="importStagList(scope.row,scope.index)"
                   v-if="activeName=='searchList'"
                   :disabled="goodsListSave.findIndex(item => item.id == scope.row.id) !== -1"
-                >选择
-                </el-button>
+                >选择</el-button>
                 <el-button
                   type="text"
                   icon="el-icon-delete"
                   size="small"
                   @click.stop="removeStagList(scope.row,scope.index)"
                   v-else
-                >移除
-                </el-button>
+                >移除</el-button>
               </template>
             </avue-crud>
           </basic-container>
@@ -629,7 +627,7 @@
       :reportId="form.id"
       reportName="销售明细(N)"
       @onClose="onClose()"
-    ></report-dialog>
+    />
 
     <el-dialog
       append-to-body

+ 1 - 1
src/views/dealer/purchase/config/commodity.json

@@ -9,7 +9,7 @@
   "editBtn": false,
   "delBtn": false,
   "addBtn": false,
-  "menu": false,
+  "menu": true,
   "align": "center",
   "menuWidth": "180",
   "selection": true,

+ 31 - 3
src/views/dealer/purchase/config/customerContact.json

@@ -42,6 +42,13 @@
       "overHidden": true
     },
     {
+      "label": "是否批次号",
+      "prop": "batch",
+      "index": 2,
+      "width": 200,
+      "overHidden": true
+    },
+    {
       "label": "规格",
       "prop": "typeno",
       "index": 3,
@@ -71,7 +78,7 @@
     },
     {
       "label": "单位",
-      "prop": "a",
+      "prop": "unit",
       "index": 7,
       "width": 100,
       "overHidden": true
@@ -85,7 +92,7 @@
     },
     {
       "label": "数量",
-      "prop": "actualQuantity",
+      "prop": "orderQuantity",
       "index": 9,
       "width": 100,
       "overHidden": true
@@ -105,9 +112,30 @@
       "overHidden": true
     },
     {
+      "label": "库存价格",
+      "prop": "purchaseAmount",
+      "index": 12,
+      "width": 100,
+      "overHidden": true
+    },
+    {
+      "label": "税率",
+      "prop": "taxRate",
+      "index": 13,
+      "width": 100,
+      "overHidden": true
+    },
+    {
       "label": "小计",
       "prop": "amount",
-      "index": 12,
+      "index": 14,
+      "width": 100,
+      "overHidden": true
+    },
+    {
+      "label": "备注",
+      "prop": "remarks",
+      "index": 15,
       "width": 100,
       "overHidden": true
     }

+ 2 - 2
src/views/dealer/purchase/config/mainList.json

@@ -59,7 +59,7 @@
     },
     {
       "label": "电话",
-      "prop": "tel",
+      "prop": "corpTel",
       "search": false,
       "index": 5,
       "minWidth": 80,
@@ -67,7 +67,7 @@
     },
     {
       "label": "地址",
-      "prop": "attn",
+      "prop": "arrivalAddress",
       "search": false,
       "index": 6,
       "minWidth": 80,

+ 439 - 77
src/views/dealer/purchase/detail.vue

@@ -7,6 +7,7 @@
           style="border: none;background: none;color: red"
           icon="el-icon-arrow-left"
           @click="backToList"
+          :loading="btnLoading"
         >返回列表</el-button>
       </div>
       <div class="add-customer-btn">
@@ -15,12 +16,33 @@
           size="small"
           class="el-button--small-yh"
           @click.stop="openEdit"
+          v-if="form.id"
         >编 辑</el-button>
         <el-button
+          type="primary"
+          size="small"
+          class="el-button--small-yh"
+          style="margin-right: 8px;"
+          @click="dealerSubmit"
+          :disabled="disabled"
+        >
+          {{ form.status == 0? '确 认': form.status == 3? '撤 销': '' }}
+        </el-button>
+        <el-dropdown style="margin-right: 8px;">
+          <el-button type="warning" size="small">账单处理<i class="el-icon-arrow-down el-icon--right"></i></el-button>
+          <el-dropdown-menu slot="dropdown">
+            <el-dropdown-item
+              @click.native="applySettlement('申请')"
+              :disabled="disabled">申请货款
+            </el-dropdown-item>
+          </el-dropdown-menu>
+        </el-dropdown>
+        <el-button
           type="success"
-          :disabled="!form.id"
+          :disabled="!form.id || disabled"
           size="small"
           @click="copyDoc"
+          :loading="btnLoading"
         >
           复制单据
         </el-button>
@@ -28,6 +50,8 @@
           type="primary"
           @click="editCustomer"
           size="small"
+          :loading="btnLoading"
+          :disabled="disabled"
         >保存数据
         </el-button>
       </div>
@@ -46,8 +70,15 @@
               v-model="form.corpId"
               @getCorpData="getCorpData"
               corpType="GYS"
+              :disabled="disabled"
             ></crop-select>
           </template>
+          <template slot="storageId">
+            <warehouse-select
+              v-model="form.storageId"
+              :configuration="configurationWarehouse"
+              :disabled="disabled"/>
+          </template>
         </avue-form>
       </basic-container>
       <containerTitle title="商品信息"/>
@@ -66,6 +97,7 @@
               icon="el-icon-plus"
               size="small"
               @click.stop="newDetails"
+              :disabled="disabled"
             >录入明细</el-button>
             <el-button
               type="info"
@@ -81,6 +113,7 @@
               icon="el-icon-edit"
               type="text"
               @click="rowCell(row, index)"
+              :disabled="disabled"
             >{{ row.$cellEdit ? "保存" : "修改" }}</el-button
             >
             <el-button
@@ -88,6 +121,7 @@
               icon="el-icon-delete"
               type="text"
               @click="rowDel(row, index)"
+              :disabled="disabled"
             >删除</el-button
             >
           </template>
@@ -99,6 +133,7 @@
                 size="small"
                 style="width:60%"
                 @change="cnameChange(row, index)"
+                :disabled="!form.lotNo"
               >
                 <el-option
                   v-for="item in goodsoptions"
@@ -114,20 +149,23 @@
                 @click="rePick(row, index)"
               ></el-button>
             </span>
-
             <span v-else> {{ row.cname }}</span>
           </template>
-          <template slot="actualQuantity" slot-scope="{ row, index }">
+          <template slot="batch" slot-scope="{row, index}">
+            <span>{{ row.batch == 0? '否': '是' }}</span>
+          </template>
+          <template slot="orderQuantity" slot-scope="{ row, index }">
             <el-input-number
               v-if="row.$cellEdit"
-              v-model="row.actualQuantity"
+              v-model="row.orderQuantity"
               size="small"
               :controls="false"
               :precision="0"
               @input="amountChange(row)"
               style="width: 100%"
+              :disabled="!form.lotNo"
             />
-            <span v-else>{{ row.actualQuantity }}</span>
+            <span v-else>{{ row.orderQuantity | IntegerFormat }}</span>
           </template>
           <template slot="price" slot-scope="{ row, index }">
             <el-input-number
@@ -138,33 +176,32 @@
               :precision="2"
               @input="amountChange(row)"
               style="width: 100%"
+              :disabled="!form.lotNo"
             ></el-input-number>
             <span v-else>{{ row.price }}</span>
           </template>
           <!--          单位-->
-          <template slot="a" slot-scope="{ row, index }">
+          <template slot="unit" slot-scope="{ row, index }">
             <el-input
               v-if="row.$cellEdit"
-              v-model="row.a"
+              v-model="row.unit"
               size="small"
+              :disabled="!form.lotNo"
             ></el-input>
-            <span v-else>{{ row.a }}</span>
+            <span v-else>{{ row.unit }}</span>
           </template>
-          <!--          尺寸-->
-          <template slot="size" slot-scope="{ row, index }">
-            <el-input
-              v-if="row.$cellEdit"
-              v-model="row.size"
-              size="small"
-            ></el-input>
-            <span v-else>{{ row.size }}</span>
+          <template slot="amount" slot-scope="{ row, index }">
+            <span>{{ row.amount | decimalFormat }}</span>
+          </template>
+          <template slot="storageQuantity" slot-scope="{ row, index }">
+            <span>{{ row.storageQuantity | IntegerFormat }}</span>
           </template>
         </avue-crud>
       </basic-container>
       <containerTitle title="详细信息"/>
       <basic-container :showBtn="true">
         <avue-form
-          ref="form"
+          ref="form1"
           class="trading-form"
           v-model="form"
           :option="detailOption"
@@ -175,6 +212,7 @@
         :data="uploadData"
         deleteUrl="/api/blade-client/corpsbank/update"
         :enumerationValue="84"
+        :disabled="disabled"
       />
     </div>
     <el-dialog
@@ -220,7 +258,33 @@
               @saveColumn="saveGoodsColumn"
               @resetColumn="resetGoodsColumn"
               :cell-style="cellStyle"
-            ></avue-crud>
+            >
+              <template slot="menuLeft">
+                <el-tabs v-model="activeName" @tab-click="tabHandle">
+                  <el-tab-pane label="查询结果" name="searchList"></el-tab-pane>
+                  <el-tab-pane label="已选定数据" name="importStaging"></el-tab-pane>
+                </el-tabs>
+              </template>
+              <template slot-scope="scope" slot="menu">
+                <el-button
+                  type="text"
+                  icon="el-icon-edit"
+                  size="small"
+                  @click.stop="importStagList(scope.row,scope.index)"
+                  v-if="activeName=='searchList'"
+                  :disabled="goodsListSave.findIndex(item => item.id == scope.row.id) !== -1"
+                >选择
+                </el-button>
+                <el-button
+                  type="text"
+                  icon="el-icon-delete"
+                  size="small"
+                  @click.stop="removeStagList(scope.row,scope.index)"
+                  v-else
+                >移除
+                </el-button>
+              </template>
+            </avue-crud>
           </el-col>
         </el-row>
       </span>
@@ -230,11 +294,31 @@
         <el-button
           type="primary"
           @click="importGoods"
-          :disabled="selectionList.length == 0"
+          :disabled="selectionList.length == 0 && goodsListSave.length == 0"
         >导入</el-button
         >
       </span>
     </el-dialog>
+    <!--    账单-->
+    <el-dialog
+      append-to-body
+      title="账单"
+      class="el-dialogDeep"
+      :visible.sync="financialAccountDialog"
+      width="70%"
+      :close-on-click-modal="false"
+      :destroy-on-close="true"
+      :close-on-press-escape="false"
+      v-dialog-drag
+    >
+      <financial-account
+        :billType="billType"
+        :billData="{}"
+        :arrList="applyPaymentList"
+        :belongCompany="form.belongToCorpId"
+        @choceFun="choceFun"
+      />
+    </el-dialog>
   </div>
 </template>
 
@@ -245,6 +329,19 @@ import {getDeptLazyTree,
   getGoods,} from "@/api/basicData/customerInquiry";
 import {selectGoodsNum} from "@/api/basicData/inventoryAccount"; // 库存查询
 import {getUserInfo} from "@/api/system/user"; //登录用户信息
+import {dataDetail, removeGoods, typeSave, dealerSubmit} from "@/api/dealer/purchase";
+import {
+  isDiscount,
+  isPercentage,
+  micrometerFormat,
+  IntegerFormat
+} from "@/util/validate";
+import reportDialog from "@/components/report-dialog/main";
+import financialAccount from "../../../components/finance/financialAccount";
+import checkSchedule from "@/components/check/checkSchedule";
+import  billApplication from "@/components/bill/billApplication";
+import { customerList as feeList } from "@/api/basicData/basicFeesDesc";
+import {getDetail} from "@/api/basicData/inventoryAccount";
 
 export default {
   name: "detail",
@@ -253,9 +350,17 @@ export default {
       type: Object
     }
   },
+  components: {
+    reportDialog,
+    billApplication,
+    financialAccount,
+    checkSchedule,
+  },
   data() {
     return {
       pageLoading: false,
+      btnLoading: false,
+      disabled: false,
       form: {},
       option: {
         menuBtn: false,
@@ -272,7 +377,7 @@ export default {
               }
             ],
             span: 16,
-            slot: true
+            slot: true,
           },
           {
             label: "业务时间",
@@ -290,6 +395,31 @@ export default {
             ]
           },
           {
+            label: "批次号",
+            prop: "lotNo",
+            rules: [
+              {
+                required: true,
+                message: " ",
+                trigger: "blur"
+              }
+            ],
+            span: 8,
+            slot: true
+          },
+          {
+            label: "收货仓库",
+            prop: "storageId",
+            span: 8,
+            rules: [
+              {
+                required: true,
+                message: " ",
+                trigger: "change"
+              }
+            ],
+          },
+          {
             label: "电话",
             prop: "corpTel",
             span: 8
@@ -320,48 +450,56 @@ export default {
           },
           {
             label: "打印时间",
-            prop: "a",
+            prop: "printTime",
             span: 8,
             disabled: true
           },
           {
             label: "打印次数",
-            prop: "a",
+            prop: "printNumber",
             span: 8,
             disabled: true
           },
           {
             label: "客户欠款",
-            prop: "a",
+            prop: "corpDebt",
             span: 8,
             disabled: true
           },
           {
             label: "总数量",
-            prop: "b",
+            prop: "orderQuantity",
             span: 8,
             disabled: true
           },
           {
             label: "应付金额",
-            prop: "c",
+            prop: "debitAmount",
             span: 8,
             disabled: true
           },
           {
             label: "总金额",
-            prop: "d",
+            prop: "amount",
             span: 8,
             disabled: true
           },
           {
             label: "制单人",
-            prop: "createUser",
+            prop: "createUserName",
             span: 8,
             disabled: true,
           },
         ]
       },
+      // 仓库配置
+      configurationWarehouse: {
+        multipleChoices: false,
+        multiple: false,
+        collapseTags: false,
+        placeholder: "请点击右边按钮选择",
+        dicData: [],
+      },
       dataList: [],
       tableOption: {},
       dialogVisible: false,
@@ -405,6 +543,22 @@ export default {
       treeStyle: "height:" + (window.innerHeight - 315) + "px",
       goodsoptions: [],
       uploadData: [],
+      activeName: 'searchList',
+      // 商品列表数据合计
+      goodsListShow: [],
+      // 商品列表暂存
+      goodsListSave: [],
+      pageList: {
+        pageSize: 10,
+        currentPage: 1,
+        total: 0
+      },
+      applyPaymentList: [],
+      billType:"收费",  //账单类型
+      billData:{},     //账单需要数据
+      applySettlementDialog:false,//生成账单组件
+      financialAccountDialog:false,
+      feesOption: [],
     }
   },
   async created() {
@@ -420,15 +574,19 @@ export default {
       this.goodsoptions = res.data.data.records;
     });
     getUserInfo().then(res => {
-      this.$set(this.form, 'createUser', res.data.data.realName)
+      this.$set(this.form, 'createUserName', res.data.data.realName)
+      this.$set(this.form, 'createUser', res.data.data.id)
     })
-
-    if (this.detailData.id) {
-      this.$set(this.form, 'id', this.detailData.id)
-      this.$set(this.form, 'businesDate', this.detailData.row.businesDate)
-      this.$set(this.form, 'corpId', this.detailData.row.corpsName)
-      this.$set(this.form, 'corpTel', '1918766221')
-      this.$set(this.form, 'arrivalAddress', '山东省青岛市')
+    feeList().then(res => {
+      this.feesOption = res.data.data.records
+    });
+    this.$set(this.form, 'status', 0);
+    if (this.detailData.query) {
+      this.disabled = true;
+      this.option.column.map(e => {
+        this.$set(e, 'disabled', true)
+      })
+      this.queryData(this.detailData.id);
     } else {
       this.dataList = [
         {
@@ -438,9 +596,9 @@ export default {
           brandItem: null,
           specsOne: null,
           specsTwo: null,
-          a: null,
+          unit: null,
           storageQuantity: 0,
-          actualQuantity: 0,
+          orderQuantity: 0,
           size: null,
           price: 0,
           amount: 0,
@@ -449,18 +607,66 @@ export default {
       ]
     }
   },
+  filters: {
+    IntegerFormat(num) {
+      return IntegerFormat(num);
+    },
+    decimalFormat(num) {
+      return num ? Number(num).toFixed(2) : "0.00";
+    }
+  },
   methods: {
+    // 查询
+    queryData(id) {
+      this.pageLoading = true;
+      dataDetail(id).then(res => {
+        this.form = res.data.data;
+        this.form.amount = Number(this.form.amount).toFixed(2);
+        this.dataList = this.form.orderItemsList? this.form.orderItemsList: [];
+        this.uploadData = this.form.orderFilesList? this.form.orderFilesList: [];
+        delete this.form.orderItemsList;
+        delete this.form.orderFilesList;
+      }).finally(() => {
+        this.pageLoading = false;
+      })
+    },
     cellStyle() {
       return "padding:0;height:40px;";
     },
-    openEdit() {},
+    openEdit() {
+      this.disabled = false;
+      this.option.column.map(e => {
+        // e.disabled = false;
+        this.$set(e, 'disabled', false)
+      })
+    },
     copyDoc() {
       this.$emit("copyOrder", this.form.id);
     },
     getCorpData(row) {},
     //修改提交触发
     editCustomer(status) {
-      this.$message.success('保存成功')
+      this.$refs["form"].validate((valid) => {
+        if (valid) {
+          // 总金额计算
+          let amount = 0;
+          this.dataList.forEach(item => {
+            amount = Number(amount) + Number(item.amount)
+          })
+          this.$set(this.form, 'debitAmount', amount.toFixed(2));
+          this.$set(this.form, 'amount', amount.toFixed(2));
+          this.form.billType = 'CG';
+          this.$set(this.form, 'itemsVOList', this.dataList);
+          this.$set(this.form, 'orderFilesList', this.uploadData);
+          this.btnLoading = true;
+          typeSave(this.form).then(res => {
+            this.$message({type: "success", message: this.form.id ? "修改成功!" : "新增成功!"});
+            this.queryData(res.data.data);
+          }).finally(() => {
+            this.btnLoading = false;
+          })
+        }
+      })
     },
     //返回列表
     backToList() {
@@ -499,26 +705,32 @@ export default {
     },
     //商品明细导入
     newDetails() {
+      this.$refs["form"].validate((valid) => {
+        if (valid) {
+          this.dialogVisible = !this.dialogVisible;
+        }
+      })
       // if (!this.form.corpId) {
       //   return this.$message.error("请选择客户名称");
       // }
-      this.dialogVisible = !this.dialogVisible;
     },
     importGoods() {
+      let form = {};
       if (this.reData) {
         if (this.selectionList.length != 1) {
           return this.$message.error("重新选择的时候只能选择一条数据");
         } else {
           this.selectionList.forEach(e => {
-            this.dataList.forEach((item, index) => {
+            this.dataList.forEach(async (item, index) => {
               if (index == this.reData.index) {
-                selectGoodsNum({
+                form = await this.getStockInfo({
+                  tradeType: 'JXS',
                   goodsId: e.id,
-                  itemType: e.typeno,
-                  tradeType: 'GN'
-                }).then((res) => {
-                  item.storageQuantity =  res.data.data
+                  storageId: this.form.storageId,
+                  lotNo: e.batch == 1? this.form.lotNo: null
                 })
+                item.storageQuantity = form.stock;
+                item.purchaseAmount = form.purchaseAmount;
                 item.itemId = e.id;
                 item.code = e.code;
                 item.cname = e.cname;
@@ -528,6 +740,9 @@ export default {
                 item.specsOne = e.specsOne;
                 item.specsTwo = e.specsTwo;
                 item.typeno = e.typeno;
+                item.unit = e.unit;
+                item.size = e.size;
+                item.lotNo = e.batch == 1? this.form.lotNo: null;
                 item.priceCategory = e.goodsTypeName;
                 item.$cellEdit = true;
               }
@@ -535,13 +750,16 @@ export default {
           });
         }
       } else {
-        this.selectionList.forEach(e => {
-          selectGoodsNum({
-            goodsId: e.id,
-            itemType: e.typeno,
-            tradeType: 'GN'
-          }).then(res => {
-            e.storageQuantity =  res.data.data
+        if (this.goodsListSave.length > 0) { // 暂存的有数据
+          this.goodsListSave.forEach(async e => {
+            form = await this.getStockInfo({
+              tradeType: 'JXS',
+              goodsId: e.id,
+              storageId: this.form.storageId,
+              lotNo: e.batch == 1? this.form.lotNo: null
+            })
+            e.storageQuantity = form.stock;
+            e.purchaseAmount = form.purchaseAmount;
             this.dataList.push({
               itemId: e.id,
               code: e.code,
@@ -552,14 +770,49 @@ export default {
               typeno: e.typeno,
               corpId: e.corpId,
               corpName: e.corpName,
+              unit: e.unit,
+              size: e.size,
               price: 0,
               amount: 0,
-              actualQuantity: 0,
+              orderQuantity: 0,
               storageQuantity: e.storageQuantity,
+              purchaseAmount: e.purchaseAmount,
+              lotNo: e.batch == 1? this.form.lotNo: null,
               $cellEdit: true
             });
-          })
-        });
+          });
+        } else {
+          this.selectionList.forEach(async e => {
+            form = await this.getStockInfo({
+              tradeType: 'JXS',
+              goodsId: e.id,
+              storageId: this.form.storageId,
+              lotNo: e.batch == 1? this.form.lotNo: null
+            })
+            e.storageQuantity = form.stock;
+            e.purchaseAmount = form.purchaseAmount;
+            this.dataList.push({
+              itemId: e.id,
+              code: e.code,
+              cname: e.cname,
+              brandItem: e.brandItem,
+              specsOne: e.specsOne,
+              specsTwo: e.specsTwo,
+              typeno: e.typeno,
+              corpId: e.corpId,
+              corpName: e.corpName,
+              unit: e.unit,
+              size: e.size,
+              price: 0,
+              amount: 0,
+              orderQuantity: 0,
+              storageQuantity: e.storageQuantity,
+              purchaseAmount: e.purchaseAmount,
+              lotNo: e.batch == 1? this.form.lotNo: null,
+              $cellEdit: true
+            });
+          });
+        }
       }
       this.dialogVisible = false;
     },
@@ -567,6 +820,8 @@ export default {
       this.selectionList = [];
       this.treeDeptId = "";
       this.reData = null;
+      this.activeName = 'searchList';
+      this.goodsListSave = [];
     },
     nodeClick(data) {
       this.treeDeptId = data.id;
@@ -647,36 +902,50 @@ export default {
         type: "warning"
       }).then(() => {
         if (row.id) {
+          removeGoods(row.id).then(res => {
+            this.$message({
+              type: 'success',
+              message: '删除成功!'
+            })
+            this.dataList.splice(row.$index, 1);
+          })
         } else {
           this.$message({
             type: "success",
             message: "删除成功!"
           });
-          this.data.splice(row.$index, 1);
+          this.dataList.splice(row.$index, 1);
         }
       });
     },
     cnameChange(row) {
-      this.goodsoptions.forEach(e => {
+      let form = {};
+      this.goodsoptions.forEach(async e => {
         if (e.id == row.itemId) {
-          selectGoodsNum({
+          form = await this.getStockInfo({
+            tradeType: 'JXS',
             goodsId: e.id,
-            itemType: e.typeno,
-            tradeType: 'GN'
-          }).then(res => {
-            row.storageQuantity =  res.data.data
-            row.cname = e.cname;
-            row.code = e.code;
-            row.corpId = e.corpId;
-            row.corpName = e.corpName;
-            row.brandItem = e.brandItem;
-            row.specsOne = e.specsOne;
-            row.specsTwo = e.specsTwo;
-            row.typeno = e.typeno;
-            row.priceCategory = e.goodsTypeName;
-            row.purchaseAmount = 0;
-            row.amount = 0;
+            storageId: this.form.storageId,
+            lotNo: e.batch == 1? this.form.lotNo: null
           })
+          e.storageQuantity = form.stock;
+          e.purchaseAmount = form.purchaseAmount;
+          row.storageQuantity =  res.data.data
+          row.cname = e.cname;
+          row.code = e.code;
+          row.corpId = e.corpId;
+          row.corpName = e.corpName;
+          row.brandItem = e.brandItem;
+          row.specsOne = e.specsOne;
+          row.specsTwo = e.specsTwo;
+          row.typeno = e.typeno;
+          row.unit = e.unit;
+          row.size = e.size;
+          row.priceCategory = e.goodsTypeName;
+          row.storageQuantity = e.storageQuantity;
+          row.purchaseAmount = e.purchaseAmount;
+          row.lotNo = e.batch == 1? this.form.lotNo: null;
+          // row.amount = 0;
         }
       });
     },
@@ -689,13 +958,106 @@ export default {
     },
     // 商品信息价格计算
     amountChange(row) {
-      if (!row.actualQuantity) {
-        row.actualQuantity = 0;
+      if (!row.orderQuantity) {
+        row.orderQuantity = 0;
       }
       if (!row.price) {
         row.price = 0;
       }
-      row.amount = Number(row.price) * Number(row.actualQuantity)
+      row.amount = Number(row.price) * Number(row.orderQuantity)
+    },
+    // 标签页切换
+    tabHandle(data) {
+      if (data.name == 'searchList') {
+        this.goodsListShow = this.goodsList;
+        this.page.total = this.pageList.total
+      } else if (data.name == 'importStaging') {
+        this.goodsListShow = this.goodsListSave;
+        this.page.total = 0
+      }
+    },
+    removeStagList(row, index) {
+      this.goodsListSave.splice(row.$index, 1)
+    },
+    importStagList(row, index) {
+      this.goodsListSave.push(row);
+    },
+    // 生成结算
+    applySettlement(type) {
+      this.beforeBillData(true,type)
+      this.financialAccountDialog = true;
+    },
+    //生成账单 拿到主表信息
+    beforeBillData(bool,type) {
+      this.billType = type;
+      this.applyPaymentList = [];
+      this.dataList.map(e => {
+        const form = {
+          srcOrderno:this.form.orgOrderNo,
+          itemType:"采购",
+          corpsName:this.form.corpName,
+          corpId:this.form.corpId,
+          currency: 'CNY',
+          exchangeRate: '1',
+          taxRate: '0',
+          accDate: this.form.businesDate,
+          srcType: 1,
+          // chargeMember: this.form.chargeMember,
+          parentId: this.form.id,
+          tradeType: 'JXS',
+          optionType: 'JXS',
+          amount: e.amount,
+          costType: this.feesOption.find(item => item.cname == '货款')? this.feesOption.find(item => item.cname == '货款').id: null,
+          srcFeesId: e.id,
+          cname: e.cname
+        }
+        this.applyPaymentList.push(form);
+      })
+    },
+    //关闭账单
+    choceFun(){
+      this.financialAccountDialog  = false
+    },
+    // 获得库存信息
+    async getStockInfo(data) {
+      //tradeType JXS
+      //goodsId
+      //storageId
+      //lotNo 批次号
+      let form = {};
+      await getDetail(data).then(res => {
+        const a = res.data.data? res.data.data: {
+          stock: 0,
+          balanceAmount: 0,
+          balanceQuantity: 0,
+        };
+        this.$set(form, 'purchaseAmount', a.balanceQuantity == 0? 0: (Number(a.balanceAmount) / Number(a.balanceQuantity)).toFixed(2));
+        this.$set(form, 'stock', a.balanceQuantity);
+      })
+      return form;
+    },
+    // 确认或者取消订单
+    dealerSubmit() {
+      let dealer;
+      if (this.form.status == 0) {
+        dealer = 1;
+      } else if (this.form.status == 3) {
+        dealer = 2;
+      }
+      this.btnLoading = true;
+      dealerSubmit({
+        id: this.form.id,
+        dealer
+      }).then(res => {
+        if (res.data.code == 200) {
+          this.$message.success('操作成功')
+          this.queryData(this.form.id)
+        } else {
+          this.$message.error(res.data.msg)
+        }
+      }).finally(() => {
+        this.btnLoading = false;
+      })
     },
   },
 }

+ 31 - 51
src/views/dealer/purchase/index.vue

@@ -24,7 +24,10 @@
           <span style="color: #409EFF;cursor: pointer" @click.stop="beforeOpenPage(scope.row,scope.index)">{{ scope.row.orderNo }}</span>
         </template>
         <template slot="corpId" slot-scope="scope">
-          <span style="color: #409EFF;cursor: pointer" @click.stop="beforeOpenPage(scope.row,scope.index)">{{ scope.row.corpsName }}</span>
+          <span style="color: #409EFF;cursor: pointer" @click.stop="beforeOpenPage(scope.row,scope.index)">{{ scope.row.strCorpName }}</span>
+        </template>
+        <template slot="createUser" slot-scope="scope">
+          <span>{{ scope.row.createUserName }}</span>
         </template>
         <template slot="corpIdSearch">
           <crop-select
@@ -71,6 +74,7 @@
 import option from './config/mainList.json';
 import detailPage from "./detail";
 import { gainUser } from "@/api/basicData/customerInquiry";
+import {getPurchaseList, deleteDetails} from "@/api/dealer/purchase";
 
 export default {
   name: "index",
@@ -78,58 +82,12 @@ export default {
   data() {
     return {
       option: {},
-      dataList: [
-        {
-          id: 1,
-          orderNo: 'cg001',
-          sysNo: 'cgbh001',
-          corpId: '1',
-          corpsName: '张汉三',
-          businesDate: '2022-03-10',
-          tel: '19188887777'
-        },
-        {
-          id: 2,
-          orderNo: 'cg002',
-          sysNo: 'cgbh002',
-          corpId: '2',
-          corpsName: '李富贵',
-          businesDate: '2022-03-10',
-          tel: '18688882222'
-        },
-        {
-          id: 3,
-          orderNo: 'cg003',
-          sysNo: 'cgbh003',
-          corpId: '3',
-          corpsName: '王老五',
-          businesDate: '2022-03-10',
-          tel: '13570628888'
-        },
-        {
-          id: 4,
-          orderNo: 'cg004',
-          sysNo: 'cgbh004',
-          corpId: '4',
-          corpsName: '赵全蛋',
-          businesDate: '2022-03-10',
-          tel: '13899991234'
-        },
-        {
-          id: 5,
-          orderNo: 'cg005',
-          sysNo: 'cgbh005',
-          corpId: '5',
-          corpsName: '万大丫',
-          businesDate: '2022-03-10',
-          tel: '152890988876'
-        },
-      ],
+      dataList: [],
       form: {},
       page: {
         pageSize: 10,
         currentPage: 1,
-        total: 5,
+        total: 0,
         pageSizes: [10, 50, 100, 200, 300, 400, 500]
       },
       search: {},
@@ -176,12 +134,16 @@ export default {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
         type: "warning"
+      }).then(res => {
+        return deleteDetails(row.id)
       }).then(() => {
         this.dataList.splice(row.$index, 1)
         this.$message({
           type: "success",
           message: "删除成功!"
         });
+        this.page.currentPage = 1;
+        this.onLoad(this.page)
       })
     },
     //点击搜索按钮触发
@@ -203,7 +165,25 @@ export default {
       return "padding:0;height:40px;";
     },
     onLoad(page, params) {
-      // this.option.height = window.innerHeight - 240;
+      // 重置掉展开
+      this.dataList.forEach(item => {
+        this.$refs.crud.toggleRowExpansion(item, false)
+      })
+      const queryParams = Object.assign({}, params, {
+        size: page.pageSize,
+        current: page.currentPage,
+      })
+      this.loading = true;
+      getPurchaseList(queryParams).then(res => {
+        this.dataList = res.data.data.records;
+        this.page.total = res.data.data.total;
+        this.option.height = window.innerHeight - 240;
+        this.$nextTick(() => {
+          this.$refs.crud.doLayout()
+        })
+      }).finally(() => {
+        this.loading = false;
+      })
     },
     async saveColumn() {
       const inSave = await this.saveColumnData(
@@ -255,7 +235,7 @@ export default {
       this.show = false;
       this.detailData = {
         id: row.id,
-        row: row
+        query: true, // 表示只是查询
       };
     },
   },

+ 1 - 1
src/views/dealer/sales/config/commodity.json

@@ -9,7 +9,7 @@
   "editBtn": false,
   "delBtn": false,
   "addBtn": false,
-  "menu": false,
+  "menu": true,
   "align": "center",
   "menuWidth": "180",
   "selection": true,

+ 29 - 7
src/views/dealer/sales/config/customerContact.json

@@ -71,43 +71,65 @@
     },
     {
       "label": "单位",
-      "prop": "a",
+      "prop": "unit",
       "index": 7,
       "width": 100,
       "overHidden": true
     },
     {
+      "label": "批次号",
+      "prop": "lotNo",
+      "index": 8,
+      "width": 140,
+      "overHidden": true
+    },
+    {
       "label": "库存",
       "prop": "storageQuantity",
-      "index": 8,
+      "index": 9,
       "width": 100,
       "overHidden": true
     },
+
     {
       "label": "数量",
-      "prop": "actualQuantity",
-      "index": 9,
+      "prop": "orderQuantity",
+      "index": 10,
       "width": 100,
       "overHidden": true
     },
     {
       "label": "尺寸",
       "prop": "size",
-      "index": 10,
+      "index": 11,
+      "width": 100,
+      "overHidden": true
+    },
+    {
+      "label": "库存价格",
+      "prop": "purchaseAmount",
+      "index": 12,
       "width": 100,
       "overHidden": true
     },
     {
       "label": "价格",
       "prop": "price",
-      "index": 11,
+      "index": 13,
       "width": 100,
       "overHidden": true
     },
     {
       "label": "小计",
       "prop": "amount",
-      "index": 12,
+      "index": 14,
+      "width": 100,
+      "overHidden": true
+    },
+    {
+      "label": "备注",
+      "prop": "remarks",
+      "index": 15,
       "width": 100,
       "overHidden": true
     }

+ 5 - 5
src/views/dealer/sales/config/mainList.json

@@ -37,7 +37,7 @@
     },
     {
       "label": "所属公司",
-      "prop": "belongToCorpId",
+      "prop": "belongToCorpName",
       "search": false,
       "index": 3,
       "minWidth": 80,
@@ -58,7 +58,7 @@
     },
     {
       "label": "电话",
-      "prop": "tel",
+      "prop": "corpTel",
       "search": false,
       "index": 5,
       "minWidth": 80,
@@ -66,7 +66,7 @@
     },
     {
       "label": "地址",
-      "prop": "attn",
+      "prop": "arrivalAddress",
       "search": false,
       "index": 6,
       "minWidth": 80,
@@ -74,7 +74,7 @@
     },
     {
       "label": "经办人",
-      "prop": "e",
+      "prop": "chargeMember",
       "search": true,
       "index": 7,
       "minWidth": 80,
@@ -95,7 +95,7 @@
     },
     {
       "label": "配送方式",
-      "prop": "f",
+      "prop": "distributionMode",
       "search": false,
       "index": 9,
       "minWidth": 80,

+ 571 - 103
src/views/dealer/sales/detail.vue

@@ -7,6 +7,7 @@
           style="border: none;background: none;color: red"
           icon="el-icon-arrow-left"
           @click="backToList"
+          :loading="btnLoading"
         >返回列表</el-button>
       </div>
       <div class="add-customer-btn">
@@ -15,12 +16,33 @@
           size="small"
           class="el-button--small-yh"
           @click.stop="openEdit"
+          v-if="form.id"
         >编 辑</el-button>
         <el-button
+          type="primary"
+          size="small"
+          style="margin-right: 8px;"
+          @click="dealerSubmit"
+          :disabled="disabled"
+        >
+          {{ form.status == 0? '确 认': form.status == 3? '撤 销': '' }}
+        </el-button>
+        <el-dropdown style="margin-right: 8px;">
+          <el-button type="warning" size="small">账单处理<i class="el-icon-arrow-down el-icon--right"></i></el-button>
+          <el-dropdown-menu slot="dropdown">
+            <el-dropdown-item
+              @click.native="applySettlement('收费')"
+              :disabled="disabled"
+            >生成账单
+            </el-dropdown-item>
+          </el-dropdown-menu>
+        </el-dropdown>
+        <el-button
           type="success"
-          :disabled="!form.id"
+          :disabled="!form.id || disabled"
           size="small"
           @click="copyDoc"
+          :loading="btnLoading"
         >
           复制单据
         </el-button>
@@ -28,6 +50,8 @@
           type="primary"
           @click="editCustomer"
           size="small"
+          :loading="btnLoading"
+          :disabled="disabled"
         >保存数据
         </el-button>
       </div>
@@ -46,6 +70,7 @@
               v-model="form.corpId"
               @getCorpData="getCorpData"
               corpType="KH"
+              :disabled="disabled"
             />
           </template>
           <template slot="belongToCorpId">
@@ -53,12 +78,30 @@
               v-model="form.belongToCorpId"
               @getCorpData="getGSData"
               corpType="GS"
+              :disabled="disabled"
             />
           </template>
           <template slot="storageId">
             <warehouse-select
               v-model="form.storageId"
-              :configuration="configurationWarehouse"/>
+              :configuration="configurationWarehouse"
+              :disabled="disabled"/>
+          </template>
+          <template slot="chargeMember">
+            <el-select
+              v-model="form.chargeMember"
+              filterable
+              clearable
+              size="small"
+              :disabled="disabled"
+            >
+              <el-option
+                v-for="(item,index) in userList"
+                :key="index"
+                :label="item.realName"
+                :value="item.realName"
+              ></el-option>
+            </el-select>
           </template>
         </avue-form>
       </basic-container>
@@ -78,12 +121,13 @@
               icon="el-icon-plus"
               size="small"
               @click.stop="newDetails"
+              :disabled="disabled"
             >录入明细</el-button>
             <el-button
               type="info"
               icon="el-icon-printer"
               size="small"
-              @click.stop="openReport()"
+              @click.stop="openReport"
             >报 表</el-button
             >
           </template>
@@ -93,6 +137,7 @@
               icon="el-icon-edit"
               type="text"
               @click="rowCell(row, index)"
+              :disabled="disabled"
             >{{ row.$cellEdit ? "保存" : "修改" }}</el-button
             >
             <el-button
@@ -100,6 +145,7 @@
               icon="el-icon-delete"
               type="text"
               @click="rowDel(row, index)"
+              :disabled="disabled"
             >删除</el-button
             >
           </template>
@@ -129,17 +175,17 @@
 
             <span v-else> {{ row.cname }}</span>
           </template>
-          <template slot="actualQuantity" slot-scope="{ row, index }">
+          <template slot="orderQuantity" slot-scope="{ row, index }">
             <el-input-number
               v-if="row.$cellEdit"
-              v-model="row.actualQuantity"
+              v-model="row.orderQuantity"
               size="small"
               :controls="false"
               :precision="0"
               @input="amountChange(row)"
               style="width: 100%"
             />
-            <span v-else>{{ row.actualQuantity }}</span>
+            <span v-else>{{ row.orderQuantity | IntegerFormat }}</span>
           </template>
           <template slot="price" slot-scope="{ row, index }">
             <el-input-number
@@ -154,29 +200,54 @@
             <span v-else>{{ row.price }}</span>
           </template>
 <!--          单位-->
-          <template slot="a" slot-scope="{ row, index }">
+          <template slot="unit" slot-scope="{ row, index }">
             <el-input
               v-if="row.$cellEdit"
-              v-model="row.a"
+              v-model="row.unit"
               size="small"
             ></el-input>
-            <span v-else>{{ row.a }}</span>
+            <span v-else>{{ row.unit }}</span>
+          </template>
+          <template slot="amount" slot-scope="{ row, index }">
+            <span>{{ row.amount | decimalFormat }}</span>
           </template>
-<!--          尺寸-->
-          <template slot="size" slot-scope="{ row, index }">
+          <template slot="storageQuantity" slot-scope="{ row, index }">
+            <span>{{ row.storageQuantity | IntegerFormat }}</span>
+          </template>
+          <template slot="lotNo" slot-scope="{ row, index }">
+            <span v-if="row.batch == 1" style="color: #c90707;margin-right: 3px">*</span>
+            <el-select
+              v-if="row.$cellEdit"
+              v-model="row.lotNo"
+              size="small"
+              filterable
+              allow-create
+              clearable
+              @change="lotNoChange(row)"
+            >
+              <el-option
+                v-for="(item, index) in row.arr"
+                :key="index"
+                :label="item.lotNo"
+                :value="item.lotNo"
+              />
+            </el-select>
+            <span v-else>{{ row.lotNo }}</span>
+          </template>
+          <template slot="remarks" slot-scope="{ row, index }">
             <el-input
               v-if="row.$cellEdit"
-              v-model="row.size"
+              v-model="row.remarks"
               size="small"
-            ></el-input>
-            <span v-else>{{ row.size }}</span>
+            />
+            <span v-else>{{ row.remarks }}</span>
           </template>
         </avue-crud>
       </basic-container>
       <containerTitle title="详细信息"/>
       <basic-container :showBtn="true">
         <avue-form
-          ref="form"
+          ref="form1"
           class="trading-form"
           v-model="form"
           :option="detailOption"
@@ -187,8 +258,10 @@
         :data="uploadData"
         deleteUrl="/api/blade-client/corpsbank/update"
         :enumerationValue="84"
+        :disabled="disabled"
       />
     </div>
+<!--    商品弹窗-->
     <el-dialog
       title="导入商品"
       append-to-body
@@ -221,7 +294,7 @@
             <avue-crud
               :option="goodsOption"
               :table-loading="loading"
-              :data="goodsList"
+              :data="goodsListShow"
               ref="goodsCrud"
               :search.sync="search"
               @search-change="searchChange"
@@ -232,7 +305,33 @@
               @saveColumn="saveGoodsColumn"
               @resetColumn="resetGoodsColumn"
               :cell-style="cellStyle"
-            ></avue-crud>
+            >
+              <template slot="menuLeft">
+                <el-tabs v-model="activeName" @tab-click="tabHandle">
+                  <el-tab-pane label="查询结果" name="searchList"></el-tab-pane>
+                  <el-tab-pane label="已选定数据" name="importStaging"></el-tab-pane>
+                </el-tabs>
+              </template>
+              <template slot-scope="scope" slot="menu">
+                <el-button
+                  type="text"
+                  icon="el-icon-edit"
+                  size="small"
+                  @click.stop="importStagList(scope.row,scope.index)"
+                  v-if="activeName=='searchList'"
+                  :disabled="goodsListSave.findIndex(item => item.id == scope.row.id) !== -1"
+                >选择
+                </el-button>
+                <el-button
+                  type="text"
+                  icon="el-icon-delete"
+                  size="small"
+                  @click.stop="removeStagList(scope.row,scope.index)"
+                  v-else
+                >移除
+                </el-button>
+              </template>
+            </avue-crud>
           </el-col>
         </el-row>
       </span>
@@ -242,11 +341,38 @@
         <el-button
           type="primary"
           @click="importGoods"
-          :disabled="selectionList.length == 0"
+          :disabled="selectionList.length == 0 && goodsListSave.length == 0"
         >导入</el-button
         >
       </span>
     </el-dialog>
+<!--    报表-->
+    <report-dialog
+      :switchDialog="switchDialog"
+      :reportId="form.id"
+      reportName="代理商-报表"
+      @onClose="onClose()"
+    />
+<!--    账单-->
+    <el-dialog
+      append-to-body
+      title="账单"
+      class="el-dialogDeep"
+      :visible.sync="financialAccountDialog"
+      width="70%"
+      :close-on-click-modal="false"
+      :destroy-on-close="true"
+      :close-on-press-escape="false"
+      v-dialog-drag
+    >
+      <financial-account
+        :billType="billType"
+        :billData="{}"
+        :arrList="applyPaymentList"
+        :belongCompany="form.belongToCorpId"
+        @choceFun="choceFun"
+      />
+    </el-dialog>
   </div>
 </template>
 
@@ -256,8 +382,22 @@ import goodsOption from "./config/commodity.json";
 import {getDeptLazyTree,
   getGoods,} from "@/api/basicData/customerInquiry";
 import {getUserInfo} from "@/api/system/user";
+import { gainUser } from "@/api/basicData/customerInquiry";
 import {selectGoodsNum} from "@/api/basicData/inventoryAccount"; // 库存查询
 import {detail as KHDetail} from "@/api/basicData/customerInformation";
+import {dataDetail, removeGoods, typeSave, getLotNo, dealerSubmit} from "@/api/dealer/sales";
+import reportDialog from "@/components/report-dialog/main";
+import {
+  isDiscount,
+  isPercentage,
+  micrometerFormat,
+  IntegerFormat
+} from "@/util/validate";
+import financialAccount from "../../../components/finance/financialAccount";
+import checkSchedule from "@/components/check/checkSchedule";
+import  billApplication from "@/components/bill/billApplication";
+import { customerList as feeList } from "@/api/basicData/basicFeesDesc";
+import {getDetail} from "@/api/basicData/inventoryAccount";
 
 export default {
   name: "detail",
@@ -266,9 +406,17 @@ export default {
       type: Object
     }
   },
+  components: {
+    reportDialog,
+    billApplication,
+    financialAccount,
+    checkSchedule,
+  },
   data() {
     return {
       pageLoading: false,
+      btnLoading: false,
+      disabled: false, // 编辑
       form: {},
       option: {
         menuBtn: false,
@@ -285,7 +433,7 @@ export default {
               }
             ],
             span: 16,
-            slot: true
+            slot: true,
           },
           {
             label: "业务时间",
@@ -313,21 +461,33 @@ export default {
               }
             ],
             span: 16,
-            slot: true
+            slot: true,
+          },
+          {
+            label: "发货仓库",
+            prop: "storageId",
+            span: 8,
+            rules: [
+              {
+                required: true,
+                message: " ",
+                trigger: "change"
+              }
+            ],
           },
           {
             label: "电话",
             prop: "corpTel",
-            span: 8
+            span: 8,
           },
           {
             label: "地址",
             prop: "arrivalAddress",
-            span: 8
+            span: 8,
           },
           {
             label: "经办人",
-            prop: "e",
+            prop: "chargeMember",
             span: 8,
           },
           {
@@ -339,16 +499,11 @@ export default {
             props: {
               label: "dictValue",
               value: "dictValue"
-            }
+            },
           },
           {
             label: "配送方式",
-            prop: "f",
-            span: 8,
-          },
-          {
-            label: "发货仓库",
-            prop: "storageId",
+            prop: "distributionMode",
             span: 8,
           },
           {
@@ -356,7 +511,7 @@ export default {
             prop: "orderRemark",
             type: "textarea",
             minRows: 2,
-            span: 24
+            span: 24,
           },
         ],
       },
@@ -372,43 +527,43 @@ export default {
           },
           {
             label: "打印时间",
-            prop: "a",
+            prop: "printTime",
             span: 8,
             disabled: true
           },
           {
             label: "打印次数",
-            prop: "a",
+            prop: "printNumber",
             span: 8,
             disabled: true
           },
           {
             label: "客户欠款",
-            prop: "a",
+            prop: "corpDebt",
             span: 8,
             disabled: true
           },
           {
             label: "总数量",
-            prop: "b",
+            prop: "orderQuantity",
             span: 8,
             disabled: true
           },
           {
             label: "应收金额",
-            prop: "c",
+            prop: "debitAmount",
             span: 8,
             disabled: true
           },
           {
             label: "总金额",
-            prop: "d",
+            prop: "amount",
             span: 8,
             disabled: true
           },
           {
             label: "制单人",
-            prop: "createUser",
+            prop: "createUserName",
             span: 8,
             disabled: true,
           },
@@ -465,6 +620,24 @@ export default {
         dicData: [],
       },
       uploadData: [],
+      switchDialog: false, // 报表弹窗控制
+      userList: [],
+      activeName: 'searchList',
+      // 商品列表数据合计
+      goodsListShow: [],
+      // 商品列表暂存
+      goodsListSave: [],
+      pageList: {
+        pageSize: 10,
+        currentPage: 1,
+        total: 0
+      },
+      applyPaymentList: [],
+      billType:"收费",  //账单类型
+      billData:{},     //账单需要数据
+      applySettlementDialog:false,//生成账单组件
+      financialAccountDialog:false,
+      feesOption: [],
     }
   },
   async created() {
@@ -480,21 +653,22 @@ export default {
       this.goodsoptions = res.data.data.records;
     });
     getUserInfo().then(res => {
-      this.$set(this.form, 'createUser', res.data.data.realName)
+      this.$set(this.form, 'createUserName', res.data.data.realName)
+      this.$set(this.form, 'createUser', res.data.data.id)
     })
-    if (this.detailData.id) {
-      this.$set(this.form, 'id', this.detailData.id)
-      this.$set(this.form, 'businesDate', this.detailData.row.businesDate)
-      this.$set(this.form, 'corpId', this.detailData.row.corpsName)
-      this.$set(this.form, 'corpTel', this.detailData.row.tel)
-      this.$set(this.form, 'arrivalAddress', this.detailData.row.attn)
-      this.$set(this.form, 'createUser', this.detailData.row.createUser)
-      this.$set(this.form, 'storageId', this.detailData.row.storageId)
-      this.$set(this.form, 'paymentType', this.detailData.row.paymentType)
-      this.$set(this.form, 'belongToCorpId', this.detailData.row.belongToCorpId)
-      this.$set(this.form, 'e', this.detailData.row.e)
-      this.$set(this.form, 'f', this.detailData.row.f)
-
+    gainUser().then(res => {
+      this.userList = res.data.data;
+    });
+    feeList().then(res => {
+      this.feesOption = res.data.data.records
+    });
+    this.$set(this.form, 'status', 0);
+    if (this.detailData.query) {
+      this.disabled = true;
+      this.option.column.map(e => {
+        this.$set(e, 'disabled', true)
+      })
+      this.queryData(this.detailData.id);
     } else {
       this.dataList = [
         {
@@ -504,9 +678,9 @@ export default {
           brandItem: null,
           specsOne: null,
           specsTwo: null,
-          a: null,
+          unit: null,
           storageQuantity: 0,
-          actualQuantity: 0,
+          orderQuantity: 0,
           size: null,
           price: 0,
           amount: 0,
@@ -515,11 +689,48 @@ export default {
       ]
     }
   },
+  filters: {
+    IntegerFormat(num) {
+      return IntegerFormat(num);
+    },
+    decimalFormat(num) {
+      return num ? Number(num).toFixed(2) : "0.00";
+    }
+  },
   methods: {
+    // 查询
+    queryData(id) {
+      this.pageLoading = true;
+      dataDetail(id).then(res => {
+        this.form = res.data.data;
+        this.form.amount = Number(this.form.amount).toFixed(2);
+        this.dataList = this.form.orderItemsList? this.form.orderItemsList: [];
+        this.uploadData = this.form.orderFilesList? this.form.orderFilesList: [];
+        delete this.form.orderItemsList;
+        delete this.form.orderFilesList;
+        this.dataList.forEach(async item => {
+          if (item.batch == 1) {
+            item.arr = await this.getLotNo({
+              itemId: item.itemId,
+              storageId: this.form.storageId,
+              tradeType: 'JXS'
+            });
+          }
+        })
+      }).finally(() => {
+        this.pageLoading = false;
+      })
+    },
     cellStyle() {
       return "padding:0;height:40px;";
     },
-    openEdit() {},
+    openEdit() {
+      this.disabled = false;
+      this.option.column.map(e => {
+        // e.disabled = false;
+        this.$set(e, 'disabled', false)
+      })
+    },
     copyDoc() {
       this.$emit("copyOrder", this.form.id);
     },
@@ -535,7 +746,37 @@ export default {
     getGSData(row) {},
     //修改提交触发
     editCustomer(status) {
-      this.$message.success('保存成功')
+      this.$refs["form"].validate((valid) => {
+        if (valid) {
+          for (let item in this.dataList) {
+            if (this.dataList[item].batch == 1 && !this.dataList[item].lotNo) {
+              return this.$message.error('第' +( Number(item) + 1) + '行明细批次号未填写')
+            }
+          }
+          // 总金额计算
+          let amount = 0;
+          this.dataList.forEach((item, index) => {
+            if (item.batch == 1 && !item.lotNo) {
+
+            }
+            amount = Number(amount) + Number(item.amount)
+          })
+          this.$set(this.form, 'debitAmount', amount.toFixed(2));
+          this.$set(this.form, 'amount', amount.toFixed(2));
+          this.form.billType = 'XS';
+          this.$set(this.form, 'orderItemsList', this.dataList);
+          this.$set(this.form, 'orderFilesList', this.uploadData);
+          this.btnLoading = true;
+          typeSave(this.form).then(res => {
+            this.$message({type: "success", message: this.form.id ? "修改成功!" : "新增成功!"});
+            this.queryData(res.data.data.id);
+          }).finally(() => {
+            this.btnLoading = false;
+          })
+        } else {
+          return false
+        }
+      })
     },
     //返回列表
     backToList() {
@@ -574,26 +815,64 @@ export default {
     },
     //商品明细导入
     newDetails() {
-      // if (!this.form.corpId) {
-      //   return this.$message.error("请选择客户名称");
-      // }
-      this.dialogVisible = !this.dialogVisible;
+      this.$refs["form"].validate((valid) => {
+        if (valid) {
+          this.dialogVisible = !this.dialogVisible;
+        }
+      })
+    },
+    // 获得库存价
+    async getStockInfo(data) {
+      //tradeType JXS
+      //goodsId
+      //storageId
+      //lotNo 批次号
+      let form = {};
+      await getDetail(data).then(res => {
+        const a = res.data.data? res.data.data: {
+          stock: 0,
+          balanceAmount: 0,
+          balanceQuantity: 0,
+        };
+        this.$set(form, 'purchaseAmount', a.balanceQuantity == 0? 0: (Number(a.balanceAmount) / Number(a.balanceQuantity)).toFixed(2));
+        this.$set(form, 'stock', a.balanceQuantity);
+      })
+      return form;
+    },
+    // 获得批次号
+    async getLotNo(data) {
+      let arr = [];
+      await getLotNo(data).then(res => {
+        arr = res.data.data? res.data.data: []
+      })
+      return arr;
     },
     importGoods() {
+      let form = {};
       if (this.reData) {
         if (this.selectionList.length != 1) {
           return this.$message.error("重新选择的时候只能选择一条数据");
         } else {
           this.selectionList.forEach(e => {
-            this.dataList.forEach((item, index) => {
+            this.dataList.forEach(async (item, index) => {
               if (index == this.reData.index) {
-                selectGoodsNum({
-                  goodsId: e.id,
-                  itemType: e.typeno,
-                  tradeType: 'GN'
-                }).then((res) => {
-                  item.storageQuantity =  res.data.data
-                })
+                if (e.batch == 0) {
+                  form = await this.getStockInfo({
+                    tradeType: 'JXS',
+                    goodsId: e.id,
+                    storageId: this.form.storageId,
+                  })
+                  item.storageQuantity = form.stock;
+                  item.purchaseAmount = form.purchaseAmount;
+                } else {
+                  item.storageQuantity = 0
+                  item.purchaseAmount = 0;
+                  item.arr = await this.getLotNo({
+                    itemId: e.id,
+                    storageId: this.form.storageId,
+                    tradeType: 'JXS'
+                  });
+                }
                 item.itemId = e.id;
                 item.code = e.code;
                 item.cname = e.cname;
@@ -603,20 +882,37 @@ export default {
                 item.specsOne = e.specsOne;
                 item.specsTwo = e.specsTwo;
                 item.typeno = e.typeno;
+                item.unit = e.unit;
+                item.size = e.size;
                 item.priceCategory = e.goodsTypeName;
+                item.purchaseAmount = e.purchaseAmount;
+                item.batch = e.batch;
                 item.$cellEdit = true;
               }
             });
           });
         }
       } else {
-        this.selectionList.forEach(e => {
-          selectGoodsNum({
-            goodsId: e.id,
-            itemType: e.typeno,
-            tradeType: 'GN'
-          }).then((res) => {
-            e.storageQuantity =  res.data.data
+        if (this.goodsListSave.length > 0) { // 暂存的有数据
+          this.goodsListSave.forEach(async e => {
+            if (e.batch == 0) {
+              form = await this.getStockInfo({
+                tradeType: 'JXS',
+                goodsId: e.id,
+                storageId: this.form.storageId,
+              })
+              e.storageQuantity = form.stock;
+              e.purchaseAmount = form.purchaseAmount;
+              e.arr = [];
+            } else {
+              e.storageQuantity = 0
+              e.purchaseAmount = 0;
+              e.arr = await this.getLotNo({
+                itemId: e.id,
+                storageId: this.form.storageId,
+                tradeType: 'JXS'
+              });
+            }
             this.dataList.push({
               itemId: e.id,
               code: e.code,
@@ -627,14 +923,61 @@ export default {
               typeno: e.typeno,
               corpId: e.corpId,
               corpName: e.corpName,
+              unit: e.unit,
+              size: e.size,
               price: 0,
               amount: 0,
-              actualQuantity: 0,
+              orderQuantity: 0,
               storageQuantity: e.storageQuantity,
+              purchaseAmount: e.purchaseAmount,
+              batch: e.batch,
+              arr: e.arr,
               $cellEdit: true
             });
-          })
-        });
+          });
+        } else {
+          this.selectionList.forEach(async e => {
+            if (e.batch == 0) {
+              form = await this.getStockInfo({
+                tradeType: 'JXS',
+                goodsId: e.id,
+                storageId: this.form.storageId,
+              })
+              e.storageQuantity = form.stock;
+              e.purchaseAmount = form.purchaseAmount;
+              e.arr = [];
+            } else {
+              e.storageQuantity = 0
+              e.purchaseAmount = 0;
+              e.arr = await this.getLotNo({
+                itemId: e.id,
+                storageId: this.form.storageId,
+                tradeType: 'JXS'
+              });
+            }
+            this.dataList.push({
+              itemId: e.id,
+              code: e.code,
+              cname: e.cname,
+              brandItem: e.brandItem,
+              specsOne: e.specsOne,
+              specsTwo: e.specsTwo,
+              typeno: e.typeno,
+              corpId: e.corpId,
+              corpName: e.corpName,
+              unit: e.unit,
+              size: e.size,
+              price: 0,
+              amount: 0,
+              orderQuantity: 0,
+              storageQuantity: e.storageQuantity,
+              purchaseAmount: e.purchaseAmount,
+              batch: e.batch,
+              arr: e.arr,
+              $cellEdit: true
+            });
+          });
+        }
       }
       this.dialogVisible = false;
     },
@@ -642,13 +985,15 @@ export default {
       this.selectionList = [];
       this.treeDeptId = "";
       this.reData = null;
+      this.activeName = 'searchList';
+      this.goodsListSave = [];
     },
     nodeClick(data) {
       this.treeDeptId = data.id;
       this.page.currentPage = 1;
       this.onLoad(this.page);
     },
-    //费用查询
+    //商品查询
     onLoad(page, params = {}) {
       let obj = this.deepClone(Object.assign(params, this.search));
       this.loading = true;
@@ -657,6 +1002,8 @@ export default {
           const data = res.data.data;
           this.page.total = data.total;
           this.goodsList = data.records;
+          this.pageList.total = data.total;
+          this.goodsListShow = data.records;
           if (this.page.total) {
             this.goodsOption.height = window.innerHeight - 350;
           }
@@ -707,7 +1054,14 @@ export default {
         }, 1000);
       }
     },
-    openReport() {},
+    // 报表
+    openReport() {
+      this.switchDialog =! this.switchDialog;
+    },
+    // 报表关闭
+    onClose(val) {
+      this.switchDialog = val;
+    },
     rowCell(row, index) {
       if (row.$cellEdit == true) {
         this.$set(row, "$cellEdit", false);
@@ -722,36 +1076,59 @@ export default {
         type: "warning"
       }).then(() => {
         if (row.id) {
+          removeGoods(row.id).then(res => {
+            this.$message({
+              type: 'success',
+              message: '删除成功!'
+            })
+            this.dataList.splice(row.$index, 1);
+          })
         } else {
           this.$message({
             type: "success",
             message: "删除成功!"
           });
-          this.data.splice(row.$index, 1);
+          this.dataList.splice(row.$index, 1);
         }
       });
     },
     cnameChange(row) {
-      this.goodsoptions.forEach(e => {
+      let form = {};
+      this.goodsoptions.forEach(async e => {
         if (e.id == row.itemId) {
-          selectGoodsNum({
-            goodsId: e.id,
-            itemType: e.typeno,
-            tradeType: 'GN'
-          }).then(res => {
-            row.storageQuantity =  res.data.data
-            row.cname = e.cname;
-            row.code = e.code;
-            row.corpId = e.corpId;
-            row.corpName = e.corpName;
-            row.brandItem = e.brandItem;
-            row.specsOne = e.specsOne;
-            row.specsTwo = e.specsTwo;
-            row.typeno = e.typeno;
-            row.priceCategory = e.goodsTypeName;
-            row.purchaseAmount = 0;
-            row.amount = 0;
-          })
+          if (e.batch == 0) {
+            form = await this.getStockInfo({
+              tradeType: 'JXS',
+              goodsId: e.id,
+              storageId: this.form.storageId,
+            })
+            e.storageQuantity = form.stock;
+            e.purchaseAmount = form.purchaseAmount;
+            e.arr = [];
+          } else {
+            e.storageQuantity = 0
+            e.purchaseAmount = 0;
+            e.arr = await this.getLotNo({
+              itemId: e.id,
+              storageId: this.form.storageId,
+              tradeType: 'JXS'
+            });
+          }
+          row.storageQuantity =  e.storageQuantity
+          row.cname = e.cname;
+          row.code = e.code;
+          row.corpId = e.corpId;
+          row.corpName = e.corpName;
+          row.brandItem = e.brandItem;
+          row.specsOne = e.specsOne;
+          row.specsTwo = e.specsTwo;
+          row.typeno = e.typeno;
+          row.unit = e.unit;
+          row.size = e.size;
+          row.arr = e.arr;
+          row.priceCategory = e.goodsTypeName;
+          row.purchaseAmount = e.purchaseAmount;
+          row.batch = e.batch;
         }
       });
     },
@@ -764,13 +1141,104 @@ export default {
     },
     // 商品信息价格计算
     amountChange(row) {
-      if (!row.actualQuantity) {
-        row.actualQuantity = 0;
+      if (!row.orderQuantity) {
+        row.orderQuantity = 0;
       }
       if (!row.price) {
         row.price = 0;
       }
-      row.amount = Number(row.price) * Number(row.actualQuantity)
+      row.amount = Number(row.price) * Number(row.orderQuantity)
+    },
+    // 标签页切换
+    tabHandle(data) {
+      if (data.name == 'searchList') {
+        this.goodsListShow = this.goodsList;
+        this.page.total = this.pageList.total
+      } else if (data.name == 'importStaging') {
+        this.goodsListShow = this.goodsListSave;
+        this.page.total = 0
+      }
+    },
+    removeStagList(row, index) {
+      this.goodsListSave.splice(row.$index, 1)
+    },
+    importStagList(row, index) {
+      this.goodsListSave.push(row);
+    },
+    // 生成结算
+    applySettlement(type) {
+      this.beforeBillData(true,type)
+      this.financialAccountDialog = true;
+    },
+    //生成账单 拿到主表信息
+    beforeBillData(bool,type) {
+      this.billType = type;
+      this.applyPaymentList = [];
+      this.dataList.map(e => {
+        const form = {
+          srcOrderno:this.form.orgOrderNo,
+          itemType:"销售",
+          corpsName:this.form.corpName,
+          corpId:this.form.corpId,
+          currency: 'CNY',
+          exchangeRate: '1',
+          taxRate: '0',
+          accDate: this.form.businesDate,
+          srcType: 1,
+          chargeMember: this.form.chargeMember,
+          parentId: this.form.id,
+          tradeType: 'JXS',
+          optionType: 'JXS',
+          amount: e.amount,
+          costType: this.feesOption.find(item => item.cname == '货款')? this.feesOption.find(item => item.cname == '货款').id: null,
+          srcFeesId: e.id,
+          cname: e.cname
+        }
+        this.applyPaymentList.push(form);
+      })
+    },
+    //关闭账单
+    choceFun(){
+      this.financialAccountDialog  = false
+    },
+    // 批次号选择
+    async lotNoChange(row) {
+      if (row.lotNo) {
+        const form = await this.getStockInfo({
+          tradeType: 'JXS',
+          goodsId: row.itemId,
+          storageId: this.form.storageId,
+          lotNo: row.lotNo
+        })
+        row.storageQuantity = form.stock;
+        row.purchaseAmount = form.purchaseAmount;
+      } else {
+        row.storageQuantity = 0;
+        row.purchaseAmount = 0;
+      }
+    },
+    // 确认或者取消订单
+    dealerSubmit() {
+      let dealer;
+      if (this.form.status == 0) {
+        dealer = 1;
+      } else if (this.form.status == 3) {
+        dealer = 2;
+      }
+      this.btnLoading = true;
+      dealerSubmit({
+        id: this.form.id,
+        dealer
+      }).then(res => {
+        if (res.data.code == 200) {
+          this.$message.success('操作成功')
+          this.queryData(this.form.id)
+        } else {
+          this.$message.error(res.data.msg)
+        }
+      }).finally(() => {
+        this.btnLoading = false;
+      })
     },
   },
 }

+ 33 - 35
src/views/dealer/sales/index.vue

@@ -26,6 +26,12 @@
         <template slot="corpId" slot-scope="scope">
           <span style="color: #409EFF;cursor: pointer" @click.stop="beforeOpenPage(scope.row,scope.index)">{{ scope.row.corpsName }}</span>
         </template>
+        <template slot="storageId" slot-scope="scope">
+          <span>{{ scope.row.storageName }}</span>
+        </template>
+        <template slot="createUser" slot-scope="scope">
+          <span>{{ scope.row.createUserName }}</span>
+        </template>
         <template slot="storageIdSearch">
           <warehouse-select
             v-model="search.storageId"
@@ -76,6 +82,7 @@
 import option from './config/mainList.json';
 import detailPage from "./detail";
 import { gainUser } from "@/api/basicData/customerInquiry";
+import {getSalesList, detail, deleteDetails} from "@/api/dealer/sales";
 
 export default {
   name: "index",
@@ -83,43 +90,12 @@ export default {
   data() {
     return {
       option: {},
-      dataList: [
-        {
-          id: 10,
-          orderNo: 'xs00001',
-          sysNo: 'xt00001',
-          corpId: '1',
-          corpsName: '张叁',
-          businesDate: '2022-03-09',
-          storageId: '测试库',
-          paymentType: '预付',
-          belongToCorpId: '测试所属公司',
-          tel: '13887762678',
-          attn: '山东省青岛市李沧区峰山路',
-          e: 'admin',
-          f: '空运',
-          createUser: 'admin'
-        },
-        {id: 11, orderNo: 'xs00002',
-          sysNo: 'xt00002',
-          corpId: '2',
-          corpsName: '李四',
-          businesDate: '2022-03-09',
-          storageId: '测试库',
-          paymentType: '到付',
-          belongToCorpId: '测试所属公司',
-          tel: '13633346789',
-          attn: '山东省青岛市市北区台东步行街',
-          e: 'admin',
-          f: '陆运',
-          createUser: '王富贵'},
-        {id: 12, orderNo: 'xs00003', sysNo: 'xt00003', corpId: '3', corpsName: '王五', businesDate: '2022-03-10'},
-      ],
+      dataList: [],
       form: {},
       page: {
         pageSize: 10,
         currentPage: 1,
-        total: 3,
+        total: 0,
         pageSizes: [10, 50, 100, 200, 300, 400, 500]
       },
       search: {},
@@ -178,12 +154,16 @@ export default {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
         type: "warning"
+      }).then(res => {
+        return deleteDetails(row.id)
       }).then(() => {
         this.dataList.splice(row.$index, 1)
         this.$message({
           type: "success",
           message: "删除成功!"
         });
+        this.page.currentPage = 1;
+        this.onLoad(this.page)
       })
     },
     //点击搜索按钮触发
@@ -205,7 +185,25 @@ export default {
       return "padding:0;height:40px;";
     },
     onLoad(page, params) {
-      // this.option.height = window.innerHeight - 240;
+      // 重置掉展开
+      this.dataList.forEach(item => {
+        this.$refs.crud.toggleRowExpansion(item, false)
+      })
+      const queryParams = Object.assign({}, params, {
+        size: page.pageSize,
+        current: page.currentPage,
+      })
+      this.loading = true;
+      getSalesList(queryParams).then(res => {
+        this.dataList = res.data.data.records;
+        this.page.total = res.data.data.total;
+        this.option.height = window.innerHeight - 240;
+        this.$nextTick(() => {
+          this.$refs.crud.doLayout()
+        })
+      }).finally(() => {
+        this.loading = false;
+      })
     },
     async saveColumn() {
       const inSave = await this.saveColumnData(
@@ -257,7 +255,7 @@ export default {
       this.show = false;
       this.detailData = {
         id: row.id,
-        row: row
+        query: true, // 表示只是查询
       };
     },
   },