Jelajahi Sumber

Merge branch 'feature/Feature-supply' into develop

莫绍宝 3 tahun lalu
induk
melakukan
801d5ecf37

+ 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
+  })
 }

+ 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;
     },
   }
 }