فهرست منبع

Merge remote-tracking branch 'origin/develop' into develop

FengChaoYu 3 سال پیش
والد
کامیت
e7ab3fbc41

+ 18 - 0
src/api/supply/return.js

@@ -16,4 +16,22 @@ export function getDetail(params) {
     method: 'get',
     params
   })
+}
+
+// 获取引用列表
+export function getGoodsList(params) {
+  return request({
+    url: '/retreat/listInvoice',
+    method: 'get',
+    params
+  })
+}
+
+// 新增
+export function addData(params) {
+  return request({
+    url: '/retreat/add',
+    method: 'post',
+    data: params
+  })
 }

+ 31 - 17
src/views/basic_data/taker/taker_car.vue

@@ -41,24 +41,30 @@
     <!-- 按钮 -->
     <div class="btn-group clearfix">
       <div class="fl">
-        <el-button type="primary" size="small" @click="addDataList"
+        <el-button
+          type="primary"
+          icon="el-icon-plus"
+          size="small"
+          @click="addDataList"
           >新增</el-button
         >
 
-        <el-popconfirm @onConfirm="delFn" title="这是一段内容确定删除吗?">
+        <el-popconfirm
+          class="delClass"
+          @onConfirm="delFn"
+          title="这是一段内容确定删除吗?"
+        >
           <el-button
-            size="small"
-            type="primary"
-            class="textColor"
             slot="reference"
+            type="danger"
+            icon="el-icon-minus"
+            size="small"
             >批量删除</el-button
           >
         </el-popconfirm>
       </div>
       <div class="fr">
-        <el-button type="primary" size="small" @click="exportFn"
-          >导出</el-button
-        >
+        <ExportButton :exUrl="'/take-car-record/export'" :exParams="exParams" />
       </div>
     </div>
     <!-- 列表 -->
@@ -281,6 +287,14 @@ export default {
       ids: [],
     };
   },
+  computed: {
+    exParams() {
+      return {
+        carBrand: this.searchForm.carBrand,
+        customerName: this.searchForm.customerName,
+      };
+    },
+  },
   async created() {
     this.getDataList({ pageNum: 1, pageSize: 10 });
     this.getDealerDataList({ pageNum: 1, pageSize: 10 });
@@ -295,14 +309,14 @@ export default {
       this.ids = selection.map((v) => v.id);
       console.log(this.ids);
     },
-    //导出
-    exportFn() {
-      let screenData = {
-        customerName: this.searchForm.customerName,
-        carBrand: this.searchForm.carBrand,
-      };
-      downloadFiles("/take-car-record/export", screenData);
-    },
+    // //导出
+    // exportFn() {
+    //   let screenData = {
+    //     customerName: this.searchForm.customerName,
+    //     carBrand: this.searchForm.carBrand,
+    //   };
+    //   downloadFiles("/take-car-record/export", screenData);
+    // },
     //取消
     async cancelFn() {
       if (this.addForm.id) {
@@ -430,4 +444,4 @@ export default {
 ::v-deep .el-dialog__header {
   background-color: #dddddd;
 }
-</style>
+</style>

+ 17 - 12
src/views/basic_data/taker/taker_list.vue

@@ -52,9 +52,7 @@
         <el-button type="primary" size="small" @click="addFn">新增</el-button>
       </div>
       <div class="fr">
-        <el-button type="primary" size="small" @click="exportFn"
-          >导出</el-button
-        >
+        <ExportButton :exUrl="'/taker-record/export'" :exParams="exParams" />
       </div>
     </div>
     <!-- 列表 -->
@@ -308,6 +306,13 @@ export default {
   },
   computed: {
     ...mapGetters(["customerId", "customerName"]),
+    exParams() {
+      return {
+        customerName: this.searchForm.customerName,
+        takerName: this.searchForm.takerName,
+        phoneKeyword: this.searchForm.phoneKeyword,
+      };
+    },
   },
   data() {
     return {
@@ -453,14 +458,14 @@ export default {
     handlefile(response, file, fileList) {
       console.log(response, file, fileList);
     },
-    //导出
-    exportFn() {
-      let screenData = {
-        customerName: this.searchForm.customerName,
-        takerName: this.searchForm.takerName,
-      };
-      downloadFiles("/taker-record/export", screenData);
-    },
+    // //导出
+    // exportFn() {
+    //   let screenData = {
+    //     customerName: this.searchForm.customerName,
+    //     takerName: this.searchForm.takerName,
+    //   };
+    //   downloadFiles("/taker-record/export", screenData);
+    // },
     //停用提货人档案
     async stopFn(id) {
       await stopTaker({ id });
@@ -607,4 +612,4 @@ export default {
 .right {
   float: right;
 }
-</style>
+</style>

+ 4 - 3
src/views/finance/components/rebate_list-edit.vue

@@ -495,8 +495,6 @@ export default {
           );
 
           v.walletName = arr[0].name;
-
-          delete v.walletList;
         });
       }
 
@@ -514,8 +512,11 @@ export default {
     //选择经销商名称事件
     async changeCustomerFn(v, index, value) {
       this.state2 = true;
+      this.$nextTick(function () {
+        value.customerWalletId = "";
+        value.walletName = "";
+      });
 
-      value.customerWalletId = "";
       const res = await getWalletCustomerList({
         customerId: v,
         type: "REBATE",

+ 17 - 13
src/views/finance/credit_list.vue

@@ -43,9 +43,11 @@
       <!-- 按钮 -->
       <div class="btn-group clearfix">
         <div class="fr">
-          <el-button type="primary" size="small" @click="exportList"
-            >导出</el-button
-          >
+          <ExportButton
+            :exUrl="'/wallet/customer/list/export'"
+            :exParams="exParams"
+            class="exportClass"
+          />
           <el-button type="primary" size="small">打印</el-button>
         </div>
       </div>
@@ -245,6 +247,14 @@ export default {
       },
     };
   },
+  computed: {
+    exParams() {
+      return {
+        customerId: this.searchForm.customerId,
+        type: "COMMONLY",
+      };
+    },
+  },
   created() {
     this.getDataList({
       type: "COMMONLY",
@@ -268,16 +278,6 @@ export default {
       };
       this.dialogForm = true;
     },
-    //导出
-    exportList() {
-      let screenData = {
-        amount: this.searchForm.amount,
-        customerNumber: this.searchForm.customerNumber,
-        customerName: this.searchForm.customerName,
-        walletName: this.searchForm.walletName,
-      };
-      downloadFiles("/credit/exportData", screenData);
-    },
     //清空
     clearFn() {
       this.$refs.searchForm.resetFields();
@@ -341,4 +341,8 @@ export default {
 .selectStyle {
   width: 100%;
 }
+.exportClass {
+  display: inline-block;
+  margin-right: 10px;
+}
 </style>

+ 5 - 4
src/views/finance/rebate_form.vue

@@ -379,23 +379,24 @@ export default {
     },
     //新增
     async addFn() {
+      let arr;
       await this.$refs.searchForm.validate();
       this.dataList.forEach((v) => {
-        const arr = v.walletList.filter(
+        arr = v.walletList.filter(
           (i) => i.customerWalletId == v.customerWalletId
         );
-
+        console.log(arr);
         v.walletName = arr[0].name;
-        delete v.walletList;
       });
       console.log(this.dataList);
       await getRebateOrderAdd({ ...this.searchForm, items: this.dataList });
       this.$message.success("保存成功");
+      this.$router.push("/finance/rebate_list");
     },
     //选择经销商名称事件
     async changeCustomerFn(v, index, value) {
       value.customerWalletId = "";
-      console.log(v, 322311);
+
       const res = await getWalletCustomerList({
         customerId: v,
         type: "REBATE",

+ 17 - 2
src/views/finance/receivable_list.vue

@@ -111,7 +111,10 @@
           </el-popconfirm>
         </div>
         <div class="fr">
-          <el-button type="primary" size="small">导出</el-button>
+          <ExportButton
+            :exUrl="'/finance/other/rece/listExport'"
+            :exParams="exParams"
+          />
         </div>
       </div>
       <!-- 列表 -->
@@ -294,6 +297,18 @@ export default {
       deleList: null,
     };
   },
+  computed: {
+    exParams() {
+      return {
+        source: this.searchForm.source,
+        code: this.searchForm.code,
+        userName: this.searchForm.userName,
+        startTime: this.searchForm.startTime,
+        endTime: this.searchForm.endTime,
+        examineStatus: this.examine,
+      };
+    },
+  },
   created() {
     this.getDataList({ pageSize: this.pageSize, pageNum: this.currentPage });
   },
@@ -375,4 +390,4 @@ export default {
 .delClass {
   margin-left: 10px;
 }
-</style>
+</style>

+ 1 - 3
src/views/supply/apply/components/apply_form.vue

@@ -211,9 +211,7 @@ export default {
         createMan: '',
       },
       mainFormRules: {
-        date: [
-          { required: true, message: '请选择单据日期', trigger: 'change' }
-        ],
+        date: [{ required: true, message: '请选择单据日期', trigger: 'change' }],
       },
       dealerList: [],
       fileList: [],

+ 33 - 81
src/views/supply/return/components/return_detail.vue

@@ -10,110 +10,62 @@
         <el-row :gutter="0">
           <el-col :span="8" class="item">
             <div class="label">退货单号</div>
-            <div class="value">{{detailData.retreatOrderNo}}</div>
+            <div class="value">{{detailData.id}}</div>
           </el-col>
           <el-col :span="8" class="item">
-            <div class="label">退货日期</div>
-            <div class="value">{{detailData.retreatTime}}</div>
-          </el-col>
-          <el-col :span="8" class="item">
-            <div class="label">业务类型</div>
-            <div class="value">{{detailData.aaa}}</div>
-          </el-col>
-          <el-col :span="8" class="item">
-            <div class="label">销售类型</div>
-            <div class="value">{{detailData.salesType}}</div>
-          </el-col>
-          <el-col :span="8" class="item">
-            <div class="label">订单号</div>
-            <div class="value">{{detailData.orderNo}}</div>
-          </el-col>
-          <el-col :span="8" class="item">
-            <div class="label">发票号</div>
-            <div class="value">{{detailData.billNumber}}</div>
-          </el-col>
-          <el-col :span="8" class="item">
-            <div class="label">客户名称</div>
-            <div class="value">{{detailData.clientName}}</div>
-          </el-col>
-          <el-col :span="8" class="item">
-            <div class="label">销售部门</div>
-            <div class="value">{{detailData.salesDep}}</div>
+            <div class="label">制单人</div>
+            <div class="value">{{detailData.createBy}}</div>
           </el-col>
           <el-col :span="8" class="item">
-            <div class="label">业务员</div>
-            <div class="value">{{detailData.salesman}}</div>
-          </el-col>
-          <el-col :span="8" class="item">
-            <div class="label">工程编号</div>
-            <div class="value">{{detailData.projectNumber}}</div>
-          </el-col>
-          <el-col :span="8" class="item">
-            <div class="label">币种</div>
-            <div class="value">{{detailData.currency}}</div>
-          </el-col>
-          <el-col :span="8" class="item">
-            <div class="label">订单类型</div>
-            <div class="value">{{detailData.orderType}}</div>
-          </el-col>
-          <el-col :span="8" class="item">
-            <div class="label">仓库</div>
-            <div class="value">{{detailData.stockName}}</div>
+            <div class="label">单据日期</div>
+            <div class="value">{{detailData.retreatTime}}</div>
           </el-col>
           <el-col :span="8" class="item">
-            <div class="label">发货单号</div>
-            <div class="value">{{detailData.invoiceOrderNo}}</div>
+            <div class="label">经销商编码</div>
+            <div class="value">{{detailData.customerNumber}}</div>
           </el-col>
-          <el-col :span="8" class="item">
-            <div class="label">台账备注</div>
-            <div class="value">{{detailData.iedgerRemark}}</div>
+          <el-col :span="16" class="item">
+            <div class="label">经销商名称</div>
+            <div class="value">{{detailData.customerName}}</div>
           </el-col>
-          <el-col :xs="24" :sm="24" :lg="24" class="item">
+          <el-col :span="24" class="item">
             <div class="label">备注</div>
             <div class="value">{{detailData.remark}}</div>
           </el-col>
         </el-row>
       </div>
 
-      <div class="main-title">
-        <div class="title">货品信息</div>
-      </div>
-      <div class="table">
+      <div class="table" style="margin-top: 20px">
         <el-table :data="detailData.retreatDocumentOrder" element-loading-text="Loading" border fit highlight-current-row stripe>
           <el-table-column align="center" label="序号" type="index" width="50"></el-table-column>
-          <el-table-column align="center" label="订单号" prop="orderNumber" min-width="160" show-overflow-tooltip></el-table-column>
-          <el-table-column align="center" label="仓库名称" prop="stockName" min-width="160" show-overflow-tooltip></el-table-column>
-          <el-table-column align="center" label="产品编号" prop="productNumber" min-width="160" show-overflow-tooltip></el-table-column>
-          <el-table-column align="center" label="产品名称" prop="productName" min-width="160" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="订单号" prop="mainOrderId" min-width="200" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="发货单号" prop="invoiceId" min-width="180" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="仓库名称" prop="correspondName" min-width="120" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="产品编号" prop="materialCode" min-width="160" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="产品名称" prop="materialName" min-width="160" show-overflow-tooltip></el-table-column>
           <el-table-column align="center" label="规格型号" prop="specification" min-width="160" show-overflow-tooltip></el-table-column>
-          <el-table-column align="center" label="主计量" prop="unit" min-width="160" show-overflow-tooltip></el-table-column>
-          <el-table-column align="center" label="数量" prop="number" min-width="160" show-overflow-tooltip></el-table-column>
-          <el-table-column align="center" label="含税单价" prop="includedPrice" min-width="160" show-overflow-tooltip></el-table-column>
-          <el-table-column align="center" label="含税金额" prop="includedPrice" min-width="100" show-overflow-tooltip>
-            <template slot-scope="scope">
-              {{ scope.row.number * scope.row.includedPrice }}
-            </template>
-          </el-table-column>
-          <el-table-column align="center" label="无税单价" prop="price" min-width="100" show-overflow-tooltip></el-table-column>
-          <el-table-column align="center" label="无税金额" prop="price" min-width="100" show-overflow-tooltip>
-            <template slot-scope="scope">
-              {{ scope.row.number * scope.row.price }}
-            </template>
-          </el-table-column>
-          <el-table-column align="center" label="价税合计" prop="totalPrice" min-width="100" show-overflow-tooltip></el-table-column>
-          <el-table-column align="center" label="税率(%)" prop="rate" min-width="100" show-overflow-tooltip></el-table-column>
-          <el-table-column align="center" label="退补标记" prop="refund" min-width="100" show-overflow-tooltip></el-table-column>
-          <el-table-column align="center" label="厂产品代码" prop="factoryNumber" min-width="100" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="单位" prop="unit" min-width="100" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="数量" prop="num" min-width="100" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="含税单价" prop="price" min-width="100" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="含税金额" prop="payAmount" min-width="100" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="无税单价" prop="afterTaxPrice" min-width="100" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="无税金额" prop="noTotalAmount" min-width="100" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="价税合计" prop="payAmount" min-width="100" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="税率(%)" prop="tax" min-width="100" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="使用返利金额" prop="payRebateAmount" min-width="120" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="折扣金额" prop="totalDiscAmount" min-width="100" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="退补标记" prop="status" min-width="100" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="厂产品代码" prop="materialOldNumber" min-width="160" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="业务员" prop="serviceName" min-width="100" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="备注" prop="remark" min-width="160" show-overflow-tooltip></el-table-column>
         </el-table>
       </div>
     </div>
     
     <div class="page-footer">
       <div class="footer" :class="classObj">
-        <el-button  type="primary" icon="el-icon-printer" v-print="printObj">打 印</el-button>
-        <el-popconfirm title="确定关闭吗?" @onConfirm="goBack" style="margin-left: 10px;">
-          <el-button slot="reference">关 闭</el-button>
-        </el-popconfirm>
+        <!-- <el-button  type="primary" icon="el-icon-printer" v-print="printObj">打 印</el-button> -->
+        <el-button @click="goBack">关 闭</el-button>
       </div>
     </div>
 

+ 298 - 75
src/views/supply/return/components/return_form.vue

@@ -5,100 +5,91 @@
     <div class="main-title">
       <div class="title">退货申请</div>
     </div>
-    <div class="diy-table-1">
-      <el-row :gutter="0">
-        <el-col :span="8" class="item">
-          <div class="label">发货申请单号</div>
-          <div class="value"><el-input v-model="mainForm.remark" placeholder="请输入发货申请单号"></el-input></div>
+    <el-form ref="mainForm" :model="mainForm" :rules="mainFormRules" label-width="90px" size="small" label-position="right">
+      <el-row :gutter="20">
+        <el-col :xs="24" :sm="12" :lg="8">
+          <el-form-item label="退货单号" prop="orderNum">
+            <el-input v-model="mainForm.orderNum" placeholder="系统自动生成" readonly></el-input>
+          </el-form-item>
         </el-col>
-        <el-col :span="8" class="item">
-          <div class="label">申请日期</div>
-          <div class="value">2022123233435342</div>
+        <el-col :xs="24" :sm="12" :lg="8">
+          <el-form-item label="制单人" prop="createMan">
+            <el-input v-model="mainForm.createMan" readonly></el-input>
+          </el-form-item>
         </el-col>
-        <el-col :span="8" class="item">
-          <div class="label">单据状态</div>
-          <div class="value">2022123233435342</div>
+        <el-col :xs="24" :sm="12" :lg="8" style="height: 51px;">
+          <el-form-item label="单据日期" prop="date">
+            <el-date-picker
+              v-model="mainForm.date"
+              type="date"
+              value-format="yyyy-MM-dd"
+              style="width: 100%;"
+              placeholder="选择日期">
+            </el-date-picker>
+          </el-form-item>
         </el-col>
-        <el-col :span="8" class="item">
-          <div class="label">经销商编号</div>
-          <div class="value">万豪仓</div>
+        
+        <el-col :xs="24" :sm="12" :lg="8">
+          <el-form-item label="经销商编号" prop="jxsNum">
+            <el-input v-model="mainForm.jxsNum" readonly></el-input>
+          </el-form-item>
         </el-col>
-        <el-col :span="8" class="item">
-          <div class="label">经销商名称</div>
-          <div class="value">2022123233435342</div>
+        <el-col :xs="24" :sm="12" :lg="16">
+          <el-form-item label="经销商名称" prop="jxsName">
+            <el-input v-model="mainForm.jxsName" readonly></el-input>
+          </el-form-item>
         </el-col>
-        <el-col :span="8" class="item">
-          <div class="label">仓库</div>
-          <div class="value">广州格匠机电有限公司</div>
-        </el-col>
-        <el-col :xs="24" :sm="24" :lg="24" class="item">
-          <div class="label">备注</div>
-          <div class="value">2022123233435342</div>
-        </el-col>
-        <el-col :span="8" class="item">
-          <div class="label">制单人</div>
-          <div class="value">广州格匠机电有限公司</div>
-        </el-col>
-        <el-col :span="16" class="item">
-          <div class="label">制表日期</div>
-          <div class="value">广州格匠机电有限公司</div>
+        <el-col :xs="24" :sm="24" :lg="24">
+          <el-form-item label="备注" prop="remark">
+            <el-input v-model="mainForm.remark" placeholder="请输入备注"></el-input>
+          </el-form-item>
         </el-col>
       </el-row>
-    </div>
+    </el-form>
 
     <div class="main-title">
-      <div class="title">货品信息</div>
+      <el-button type="primary" size="small" icon="el-icon-plus" @click="openDialog">添加引用</el-button>
     </div>
     <div class="table">
-      <el-table :data="detailData.retreatDocumentOrder" element-loading-text="Loading" border fit highlight-current-row stripe>
+      <el-table :data="goodsList" element-loading-text="Loading" border fit highlight-current-row stripe>
         <el-table-column align="center" label="序号" type="index" width="50"></el-table-column>
-        <el-table-column align="center" label="销售类型" prop="salesType" min-width="160" show-overflow-tooltip>
+        <el-table-column align="center" label="发货单号" prop="id" min-width="200" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="销售类型" prop="saleTypeName" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="发货仓库" prop="correspondName" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="销售订单号" prop="mainOrderId" min-width="200" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="产品编码" prop="materialCode" min-width="160" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="产品名称" prop="materialName" min-width="160" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="规格型号" prop="specification" min-width="160" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="单位" prop="unit" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="数量" prop="approvalNumber" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="出货状态" prop="shipStatus" min-width="100" show-overflow-tooltip>
           <template slot-scope="scope">
-            {{ scope.row.salesType }}
+            {{scope.row.shipStatus | chStatusFilter}}
           </template>
         </el-table-column>
-        <el-table-column align="center" label="发货仓库" prop="stockName" min-width="160" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="销售订单号" prop="retreatTime" min-width="160" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="产品编码" prop="customerName" min-width="160" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="产品名称" prop="productName" min-width="160" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="规格型号" prop="specification" min-width="160" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="计量单位" prop="unit" min-width="100" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="数量" prop="number" min-width="100" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="是否退货" prop="isReturn" min-width="100" show-overflow-tooltip>
+        <el-table-column align="center" label="开票状态" prop="billStatus" min-width="100" show-overflow-tooltip>
+          <template slot-scope="scope">
+            {{scope.row.billStatus | kpStatusFilter}}
+          </template>
+        </el-table-column>
+        <el-table-column align="center" label="是否退货" prop="isReturn" min-width="100">
           <template slot-scope="scope">
             <el-checkbox v-model="scope.row.isReturn"></el-checkbox>
           </template>
         </el-table-column>
-        <el-table-column align="center" label="可退数量" prop="number" min-width="100" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="退货数量" prop="number" min-width="100" show-overflow-tooltip>
+        <el-table-column align="center" label="可退数量" prop="refundableQty" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="退货数量" prop="num" min-width="120" show-overflow-tooltip>
+          <template slot-scope="scope">
+            <el-input v-model="scope.row.num" size="small" type="number"></el-input>
+          </template>
+        </el-table-column>
+        <el-table-column align="center" label="备注" prop="remark" min-width="160" show-overflow-tooltip>
           <template slot-scope="scope">
-            <el-input v-model="scope.row.number" placeholder="请输入退货数量"></el-input>
+            <el-input v-model="scope.row.remark" size="small"></el-input>
           </template>
         </el-table-column>
       </el-table>
     </div>
-
-    <div class="main-title">
-      <div class="title">退货信息</div>
-    </div>
-    <div class="diy-table-1">
-      <el-row :gutter="0">
-        <el-col :span="12" class="item">
-          <div class="label">操作人</div>
-          <div class="value">2022123233435342</div>
-        </el-col>
-        <el-col :span="12" class="item">
-          <div class="label">退货日期</div>
-          <div class="value">2022123233435342</div>
-        </el-col>
-        <el-col :span="24" class="item">
-          <div class="label">退货说明</div>
-          <div class="value">
-            <el-input v-model="mainForm.remark" placeholder="请输入退货说明"></el-input>
-          </div>
-        </el-col>
-      </el-row>
-    </div>
     
     <div class="page-footer">
       <div class="footer" :class="classObj">
@@ -109,26 +100,119 @@
       </div>
     </div>
 
+    <el-dialog title="添加引用" :visible.sync="isShowDialog" width="80%">
+      <el-form ref="screenForm" :model="screenForm" size="small" label-position="left" label-width="70px">
+        <el-row :gutter="20">
+          <el-col :xs="12" :sm="12" :lg="12">
+            <el-form-item prop="orderNum" label="发货单号">
+              <el-input v-model="screenForm.orderNum" placeholder="请输入发货单号"></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :xs="12" :sm="6" :lg="6">
+            <el-form-item label="">
+              <el-button size="small" @click="resetScreenForm">清空</el-button>
+              <el-button size="small" type="primary" @click="submitScreenForm">搜索</el-button>
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+
+      <div class="table">
+        <el-table :data="tableGoodsList" element-loading-text="Loading" border fit highlight-current-row stripe height="400" @selection-change="tableSelectionChange">
+          <el-table-column align="center" type="selection" width="55" :selectable='checkboxSelect'></el-table-column>
+          <el-table-column align="center" label="发货单号" prop="id" min-width="200" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="销售类型" prop="saleTypeName" min-width="100" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="发货仓库" prop="correspondName" min-width="100" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="销售订单号" prop="mainOrderId" min-width="200" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="产品编码" prop="materialCode" min-width="160" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="产品名称" prop="materialName" min-width="160" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="规格型号" prop="specification" min-width="160" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="单位" prop="unit" min-width="100" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="数量" prop="approvalNumber" min-width="100" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="出货状态" prop="shipStatus" min-width="100" show-overflow-tooltip>
+            <template slot-scope="scope">
+              {{scope.row.shipStatus | chStatusFilter}}
+            </template>
+          </el-table-column>
+          <el-table-column align="center" label="开票状态" prop="billStatus" min-width="100" show-overflow-tooltip>
+            <template slot-scope="scope">
+              {{scope.row.billStatus | kpStatusFilter}}
+            </template>
+          </el-table-column>
+          <el-table-column align="center" label="可退数量" prop="refundableQty" min-width="100" show-overflow-tooltip></el-table-column>
+        </el-table>
+        <div class="pagination clearfix" style="margin-top: 10px">
+          <div class="fr">
+            <el-pagination
+              @current-change="handleTableCurrentChange"
+              :current-page="currentPage"
+              :page-size="10"
+              background
+              layout="prev, pager, next"
+              :total="listTotal">
+            </el-pagination>
+          </div>
+        </div>
+      </div>
+      
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="closeDialog">取 消</el-button>
+        <el-button type="primary" @click="submitAddGoods">确 定</el-button>
+      </span>
+    </el-dialog>
+
   </div>
 </template>
 
 <script>
-import { getDetail } from "@/api/supply/return";
+import { getDetail, getGoodsList, addData } from "@/api/supply/return";
 
 export default {
   name: 'ReturnForm',
   componentName: 'ReturnForm',
   props: ['listItem'],
+  filters: {
+    chStatusFilter(val) {
+      const MAP = {
+        0: '未出货',
+        1: '已出货',
+      }
+      return MAP[val];
+    },
+    kpStatusFilter(val) {
+      const MAP = {
+        0: '未开票',
+        1: '已开票',
+      }
+      return MAP[val];
+    }
+  },
   data() {
     return {
       detailData: {},
       formLoading: false,
       mainForm: {
+        orderNum: '',
+        createMan: '',
+        date: '',
+        jxsNum: '',
+        jxsName: '',
         remark: '',
       },
-      goodsList: [{
-        goodsId: 1,
-      }]
+      mainFormRules: {
+        date: [{ required: true, message: '请选择单据日期', trigger: 'change' }],
+      },
+      goodsList: [],
+
+      isShowDialog: false,
+      screenForm: {
+        orderNum: '',
+      },
+      currentPage: 1,
+      listTotal: 0,
+      
+      tableGoodsList: [],
+      tableSelection: [],
     }
   },
 
@@ -145,7 +229,13 @@ export default {
   },
 
   created() {
-    this.getDetail();
+    if(this.listItem) {
+      this.getDetail();
+    }else {
+      this.mainForm.jxsNum = JSON.parse(localStorage.getItem("supply_user")).customerId;
+      this.mainForm.jxsName = JSON.parse(localStorage.getItem("supply_user")).customerName;
+      this.mainForm.createMan = JSON.parse(localStorage.getItem("supply_user")).nickName;
+    }
   },
 
   methods: {
@@ -161,8 +251,141 @@ export default {
       })
     },
 
+    // 获取商品列表
+    getGoodsList() {
+      getGoodsList({
+        pageNum: this.currentPage,
+        pageSize: 10,
+        customerId: JSON.parse(localStorage.getItem("supply_user")).customerId,
+        id: this.screenForm.orderNum,
+      }).then(res => {
+        res.data.records.forEach(item => {
+          item.num = '';
+          item.remark = '';
+          item.isReturn = true;
+        });
+        let oldGoodsList = this.goodsList;
+        let newGoodsList = res.data.records;
+        for(let i = 0; i < oldGoodsList.length; i++) {
+          let oldItem = oldGoodsList[i]
+          for(let j = 0; j < newGoodsList.length; j++) {
+            let newItem = newGoodsList[j]
+            if(newItem.materialId === oldItem.materialId){
+              newGoodsList[j].selected = true;
+              break;
+            }
+          }
+        }
+
+        this.tableGoodsList = newGoodsList;
+        this.listTotal = res.data.total;
+      })
+    },
+
+    // 查询重复值并禁选
+    checkboxSelect(row, rowIndex) {
+      if (row.selected) {
+        return false // 禁用
+      }else{
+        return true // 不禁用
+      }
+    },
+
+    // 点击 选择商品
+    openDialog() {
+      this.isShowDialog = true;
+      if(this.screenForm.orderNum) {
+        this.getGoodsList();
+      }
+    },
+
+    // 提交筛选表单
+    submitScreenForm() {
+      if(!this.screenForm.orderNum) {
+        return this.$errorMsg('请填写发货申请单号');
+      }
+      this.currentPage = 1;
+      this.getGoodsList();
+    },
+
+    // 重置筛选表单
+    resetScreenForm() {
+      this.$refs.screenForm.resetFields();
+      this.currentPage = 1;
+      this.tableGoodsList = [];
+      // this.getGoodsList();
+    },
+
+    // 更改列表当前页
+    handleTableCurrentChange(val) {
+      if(this.tableSelection.length > 0) {
+        return this.$errorMsg('已选择产品不可切换');
+      }
+      this.currentPage = val;
+      this.getGoodsList();
+    },
+
+    // 关闭 弹窗
+    closeDialog() {
+      this.isShowDialog = false;
+    },
+
+    // 列表选择
+    tableSelectionChange(val) {
+      this.tableSelection = val;
+    },
+
+    // 确定 添加产品
+    submitAddGoods() {
+      this.goodsList = this.goodsList.concat(this.tableSelection);
+      this.isShowDialog = false;
+    },
+
+    // 删除产品
+    deleteItem(index) {
+      this.goodsList.splice(index, 1);
+    },
+
     clickSubmitForm() {
+      this.$refs.mainForm.validate((valid) => {
+        if (valid) {
+          if(this.goodsList.length < 1) {
+            return this.$errorMsg('请添加引用');
+          }
+          for(let i=0; i<this.goodsList.length; i++) {
+            if(!this.goodsList[i].num) {
+              this.$errorMsg('请输入退货数量');
+              return;
+            }
+            if(this.goodsList[i].num > this.goodsList[i].refundableQty) {
+              this.$errorMsg('退货数量不能大于可退数量');
+              return;
+            }
+          }
+
+          let goodsList = this.goodsList.filter(item => {
+            return item.isReturn;
+          })
+          goodsList = goodsList.map(item => {
+            return {
+              invoiceOrderId: item.invoiceOrderId,
+              num: item.num,
+              remark: item.remark
+            }
+          })
+          let params = {
+            retreatTime: this.mainForm.date + ' 00:00:00',
+            remark: this.mainForm.remark,
+            retreatDocumentOrder: goodsList,
+          }
+          addData(params).then(res => {
+            this.$successMsg('添加成功');
+            this.goBack();
+            this.$parent.getList();
+          })
 
+        }
+      })
     },
   }
 }

+ 30 - 33
src/views/supply/return/return_list.vue

@@ -21,8 +21,8 @@
               </el-form-item>
             </el-col>
             <el-col :xs="24" :sm="12" :lg="6">
-              <el-form-item label="存货名称" prop="chName">
-                <el-input v-model="screenForm.chName" placeholder="请输入存货名称"></el-input>
+              <el-form-item label="产品名称" prop="goodsName">
+                <el-input v-model="screenForm.goodsName" placeholder="请输入产品名称"></el-input>
               </el-form-item>
             </el-col>
             <el-col :xs="24" :sm="12" :lg="6">
@@ -56,31 +56,29 @@
 
       <div class="mymain-container">
         <div class="btn-group clearfix">
+          <div class="fl">
+            <el-button size="small" type="primary" icon="el-icon-plus" @click="toForm()">退货</el-button>
+          </div>
           <div class="fr">
-            <ExportButton :exUrl="'admin/user/mch/export'" :exParams="exParams" />
+            <ExportButton :exUrl="'retreat/export'" :exParams="exParams" />
           </div>
         </div>
         <div class="table">
           <el-table v-loading="listLoading" :data="dataList" element-loading-text="Loading" border fit highlight-current-row stripe>
-            <el-table-column align="center" label="退换单号" prop="retreatOrderNo" min-width="160" show-overflow-tooltip></el-table-column>
+            <el-table-column align="center" label="退换单号" prop="id" min-width="180" show-overflow-tooltip></el-table-column>
             <el-table-column align="center" label="退货日期" prop="retreatTime" min-width="160" show-overflow-tooltip></el-table-column>
-            <el-table-column align="center" label="仓库" prop="stockName" min-width="160" show-overflow-tooltip></el-table-column>
+            <el-table-column align="center" label="仓库" prop="correspondName" min-width="160" show-overflow-tooltip></el-table-column>
             <el-table-column align="center" label="经销商" prop="customerName" min-width="160" show-overflow-tooltip></el-table-column>
-            <el-table-column align="center" label="产品名称" prop="productName" min-width="160" show-overflow-tooltip></el-table-column>
+            <el-table-column align="center" label="产品名称" prop="materialName" min-width="160" show-overflow-tooltip></el-table-column>
             <el-table-column align="center" label="规格型号" prop="specification" min-width="160" show-overflow-tooltip></el-table-column>
-            <el-table-column align="center" label="价税合计" prop="totalPrice" min-width="100" show-overflow-tooltip></el-table-column>
-            <el-table-column align="center" label="无税金额" prop="price" min-width="100" show-overflow-tooltip>
-              <template slot-scope="scope">
-                {{ scope.row.number * scope.row.price }}
-              </template>
-            </el-table-column>
-            <el-table-column align="center" label="无税单价" prop="price" min-width="100" show-overflow-tooltip></el-table-column>
-            <el-table-column align="center" label="数量" prop="number" min-width="100" show-overflow-tooltip></el-table-column>
+            <el-table-column align="center" label="价税合计" prop="price" min-width="100" show-overflow-tooltip></el-table-column>
+            <el-table-column align="center" label="无税金额" prop="noTotalAmount" min-width="100" show-overflow-tooltip></el-table-column>
+            <el-table-column align="center" label="无税单价" prop="afterTaxPrice" min-width="100" show-overflow-tooltip></el-table-column>
+            <el-table-column align="center" label="数量" prop="num" min-width="100" show-overflow-tooltip></el-table-column>
             <el-table-column align="center" label="备注" prop="remark" min-width="200" show-overflow-tooltip></el-table-column>
-            <el-table-column align="center" label="操作" width="120" fixed="right">
+            <el-table-column align="center" label="操作" width="100" fixed="right">
               <template slot-scope="scope">
-                <el-button type="text" @click="toDetail('detail', scope.row)">详情</el-button>
-                <el-button type="text" @click="toDetail('form', scope.row)">退货</el-button>
+                <el-button type="text" @click="toDetail(scope.row)">详情</el-button>
               </template>
             </el-table-column>
           </el-table>
@@ -108,7 +106,6 @@
 </template>
 
 <script>
-import { COMMON_SELECT } from '@/utils/select_data'
 import { getList } from "@/api/supply/return";
 import ReturnDetail from "@/views/supply/return/components/return_detail";
 import ReturnForm from "@/views/supply/return/components/return_form";
@@ -129,13 +126,14 @@ export default {
         orderNum: '',
         jxsNum: '',
         jxsName: '',
-        chName: '',
+        goodsName: '',
         model: '',
         date: '',
       },
 
-      jumpType: '',
       queryItem: {},
+      isShowDetail: false,
+      isShowForm: false,
     }
   },
 
@@ -145,19 +143,12 @@ export default {
         retreatOrderNo: this.screenForm.orderNum,
         customerNumber: this.screenForm.jxsNum,
         customerName: this.screenForm.jxsName,
-        productName: this.screenForm.chName,
+        materialName: this.screenForm.goodsName,
         specification: this.screenForm.model,
         startTime: this.screenForm.date ? this.screenForm.date[0] : '',
         endTime: this.screenForm.date ? this.screenForm.date[1] : '',
-        status: 1, // 1:退货单,2:电商退货单
       }
     },
-    isShowDetail() {
-      return this.queryItem.hasOwnProperty('id') && this.jumpType == 'detail';
-    },
-    isShowForm() {
-      return this.queryItem.hasOwnProperty('id') && this.jumpType == 'form';
-    },
   },
 
   created() {
@@ -184,11 +175,10 @@ export default {
         retreatOrderNo: this.screenForm.orderNum,
         customerNumber: this.screenForm.jxsNum,
         customerName: this.screenForm.jxsName,
-        productName: this.screenForm.chName,
+        materialName: this.screenForm.goodsName,
         specification: this.screenForm.model,
         startTime: this.screenForm.date ? this.screenForm.date[0] : '',
         endTime: this.screenForm.date ? this.screenForm.date[1] : '',
-        status: 1, // 1:退货单,2:电商退货单
       };
       getList(params).then((res) => {
         this.dataList = res.data.records;
@@ -224,14 +214,21 @@ export default {
     },
 
     // 进入详情
-    toDetail(type, item) {
-      this.jumpType = type;
+    toDetail(item) {
+      this.queryItem = item;
+      this.isShowDetail = true;
+    },
+    
+    // 进入表单
+    toForm(item) {
       this.queryItem = item;
+      this.isShowForm = true;
     },
 
     backList() {
-      this.jumpType = '';
       this.queryItem = {};
+      this.isShowForm = false;
+      this.isShowDetail = false;
     },
   }
 }