lilei 4 tahun lalu
induk
melakukan
1530e16527

+ 29 - 14
src/views/salesManagement/examineVerify/list.vue

@@ -26,20 +26,25 @@
               <a-input id="examineVerifyList-salesBillNo" v-model.trim="queryParam.salesBillNo" allowClear placeholder="请输入销售单号"/>
             </a-form-item>
           </a-col>
-          <a-col :md="6" :sm="24">
-            <a-form-item label="打印状态">
-              <v-select
-                v-model="queryParam.printStatus"
-                ref="printStatus"
-                id="examineVerifyList-printStatus"
-                code="PRINT_STATUS"
-                placeholder="请选择打印状态"
-                allowClear></v-select>
-            </a-form-item>
-          </a-col>
           <template v-if="advanced">
             <a-col :md="6" :sm="24">
-              <a-form-item label="单据状态">
+              <a-form-item label="出库单号">
+                <a-input id="examineVerifyList-stockOutNo" v-model.trim="queryParam.stockOutNo" allowClear placeholder="请输入出库单号"/>
+              </a-form-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-item label="打印状态">
+                <v-select
+                  v-model="queryParam.printStatus"
+                  ref="printStatus"
+                  id="examineVerifyList-printStatus"
+                  code="PRINT_STATUS"
+                  placeholder="请选择打印状态"
+                  allowClear></v-select>
+              </a-form-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-item label="业务状态">
                 <v-select
                   v-model="queryParam.billStatus"
                   ref="billStatus"
@@ -49,6 +54,11 @@
                   allowClear></v-select>
               </a-form-item>
             </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-item label="备货单号">
+                <a-input id="examineVerifyList-dispatchBillNo" v-model.trim="queryParam.dispatchBillNo" allowClear placeholder="请输入备货单号"/>
+              </a-form-item>
+            </a-col>
           </template>
           <a-col :md="6" :sm="24" style="margin-bottom: 24px;">
             <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="examineVerifyList-refresh">查询</a-button>
@@ -79,7 +89,7 @@
       :columns="columns"
       :data="loadData"
       :showPagination="false"
-      :scroll="{ x: 1680, y:tableHeight }"
+      :scroll="{ x: 2000, y:tableHeight }"
       bordered>
       <!-- 下推单号 -->
       <template slot="dispatchBillNo" slot-scope="text, record">
@@ -115,6 +125,8 @@ export default {
       queryParam: { //  查询条件
         buyerName: undefined, //  客户名称
         salesBillNo: '', //  销售单号
+        dispatchBillNo: '', // 备货单号
+        stockOutNo: '', // 出库单号
         printStatus: undefined, //  打印状态
         billStatus: undefined //  业务状态
       },
@@ -125,7 +137,8 @@ export default {
         { title: '创建时间', dataIndex: 'createDate', width: 160, align: 'center' },
         { title: '单据来源', dataIndex: 'salesBillEntity.salesBillSourceDictValue', width: 100, align: 'center' },
         { title: '销售单号', dataIndex: 'salesBillNo', width: 230, align: 'center' },
-        { title: '下推单号', scopedSlots: { customRender: 'dispatchBillNo' }, width: 230, align: 'center' },
+        { title: '备货单号', scopedSlots: { customRender: 'dispatchBillNo' }, width: 230, align: 'center' },
+        { title: '出库单号', dataIndex: 'stockOutNo', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '客户名称', dataIndex: 'buyerName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '数量', dataIndex: 'totalQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '售价', dataIndex: 'totalAmount', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
@@ -180,6 +193,8 @@ export default {
     resetSearchForm () {
       this.queryParam.buyerName = undefined
       this.queryParam.salesBillNo = ''
+      this.queryParam.dispatchBillNo = '' // 备货单号
+      this.queryParam.stockOutNo = '' // 出库单号
       this.queryParam.billStatus = undefined
       this.queryParam.printStatus = undefined
       this.time = []

+ 5 - 5
src/views/salesManagement/pushOrderManagement/list.vue

@@ -27,8 +27,8 @@
           </a-col>
           <template v-if="advanced">
             <a-col :md="6" :sm="24">
-              <a-form-item label="下推单号">
-                <a-input id="pushOrder-dispatchBillNo" v-model.trim="queryParam.dispatchBillNo" allowClear placeholder="请输入下推单号"/>
+              <a-form-item label="备货单号">
+                <a-input id="pushOrder-dispatchBillNo" v-model.trim="queryParam.dispatchBillNo" allowClear placeholder="请输入备货单号"/>
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
@@ -78,7 +78,7 @@
       <template slot="salesBillNo" slot-scope="text, record">
         <span style="color: #ed1c24;cursor: pointer;" @click="handleDetail(record,0)">{{ record.salesBillNo }}</span>
       </template>
-      <!-- 下推单号 -->
+      <!-- 备货单号 -->
       <template slot="dispatchBillNo" slot-scope="text, record">
         <span style="color: #ed1c24;cursor: pointer;" @click="handleDetail(record,1)">{{ record.dispatchBillNo }}</span>
       </template>
@@ -105,7 +105,7 @@ export default {
       queryParam: {
         buyerName: undefined, //  客户名称
         salesBillNo: '', //  销售单号
-        dispatchBillNo: '', //  下推单号
+        dispatchBillNo: '', //  备货单号
         billStatus: undefined //  业务状态
       },
       totalData: {
@@ -119,7 +119,7 @@ export default {
         // { title: '区域', dataIndex: 'shippingAddrCountyName', width: 120, align: 'center' },
         // { title: '省份', dataIndex: 'shippingAddrProvinceName', width: 120, align: 'center' },
         { title: '创建时间', dataIndex: 'createDate', width: 160, align: 'center' },
-        { title: '下推单号', scopedSlots: { customRender: 'dispatchBillNo' }, width: 210, align: 'center' },
+        { title: '备货单号', scopedSlots: { customRender: 'dispatchBillNo' }, width: 210, align: 'center' },
         { title: '关联销售单号', scopedSlots: { customRender: 'salesBillNo' }, width: 210, align: 'center' },
         { title: '客户名称', dataIndex: 'buyerName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '下推数量', dataIndex: 'totalQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },

+ 2 - 2
src/views/salesManagement/salesQuery/list.vue

@@ -106,7 +106,7 @@
       :rowKey="(record) => record.id"
       :columns="columns"
       :data="loadData"
-      :scroll="{ x: 2050, y:tableHeight }"
+      :scroll="{ x: 2500, y:tableHeight }"
       bordered>
       <!-- 销售单号 -->
       <template slot="salesBillNo" slot-scope="text, record">
@@ -340,7 +340,7 @@ export default {
       const _this = this
       this.$confirm({
         title: '提示',
-        content: '确认要删除吗?',
+        content: row.salesBillSource == 'PURCHASE' ? '确认要取消吗?' : '确认要删除吗?',
         centered: true,
         closable: true,
         onOk () {

+ 1 - 1
src/views/salesManagement/salesQuery/queryPart.vue

@@ -125,7 +125,7 @@ export default {
       exportLoading: false, // 导出loading
       columns: [
         { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
-        { title: '产品编码', dataIndex: 'productCode', width: 150, align: 'center' },
+        { title: '产品编码', dataIndex: 'productCode', width: 150, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '产品名称', dataIndex: 'productName', scopedSlots: { customRender: 'productName' }, align: 'center' },
         { title: '原厂编码', dataIndex: 'productOrigCode', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '品牌', dataIndex: 'productBrandName', width: 150, align: 'center', customRender: function (text) { return text || '--' } },

+ 26 - 13
src/views/salesManagement/salesReturn/list.vue

@@ -273,10 +273,10 @@ export default {
       const _this = this
       this.$confirm({
         title: '提示',
-        content: '确认要删除吗?',
+        content: row.salesReturnBillSource == 'SALES' ? '确认要删除吗?' : '确认要取消吗?',
         centered: true,
         onOk () {
-          salesReturnDel({ sn: row.salesReturnSn }).then(res => {
+          salesReturnDel({ salesReturnBillSn: row.salesReturnBillSn }).then(res => {
             if (res.status == 200) {
               _this.$message.success(res.message)
               _this.$refs.table.refresh()
@@ -290,23 +290,36 @@ export default {
       const _this = this
       this.$confirm({
         title: '提示',
-        content: '确认要审核吗?',
+        content: '请点击下方按钮确认操作?',
         centered: true,
+        closable: true,
+        okText: '审核通过',
+        cancelText: '审核不通过',
         onOk () {
-          salesReturnAudit({
-            sn: row.salesReturnSn
-          }).then(res => {
-            if (res.status == 200) {
-              _this.$message.success(res.message)
-              _this.$refs.table.refresh()
-            }
-          })
+          _this.auditOrder(row.salesReturnBillSn, 'OUTING_WAREHOUSE')
+        },
+        onCancel (e) {
+          if (!e.triggerCancel) {
+            _this.auditOrder(row.salesReturnBillSn, 'AUDIT_REJECT')
+          }
+          _this.$destroyAll()
+        }
+      })
+    },
+    auditOrder (salesReturnBillSn, billStatus) {
+      salesReturnAudit({
+        salesReturnBillSn,
+        billStatus
+      }).then(res => {
+        if (res.status == 200) {
+          this.$message.success(res.message)
+          this.$refs.table.refresh()
         }
       })
     },
     // 品检
-    handleCheck () {
-
+    handleCheck (row) {
+      this.$router.push({ name: 'salesReturnCheck', params: { sn: row.salesReturnBillSn } })
     },
     resetSearchForm () {
       this.queryParam.buyerSn = undefined

+ 20 - 13
src/views/salesManagement/salesReturn/queryPart.vue

@@ -4,7 +4,7 @@
     <div class="table-page-search-wrapper">
       <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
         <a-row :gutter="15">
-          <a-col :md="6" :sm="24">
+          <a-col :md="6" :sm="24" v-if="grabFlag == 1">
             <a-form-item label="销售单号">
               <a-input id="productInfoList-salesBillNo" v-model.trim="queryParam.salesBillNo" allowClear placeholder="请输入销售单号"/>
             </a-form-item>
@@ -113,7 +113,7 @@ export default {
         }
         // 不抓单
         if (this.grabFlag == 0) {
-          this.queryParam.salePriceType = this.priceType
+          this.queryParam.dealerSn = this.buyerSn
         }
         const fun = [queryStockProductPage, salesQueryByReturn]
         return fun[this.grabFlag](Object.assign(parameter, this.queryParam)).then(res => {
@@ -200,7 +200,7 @@ export default {
         title: '产品编码',
         dataIndex: 'productCode',
         align: 'center',
-        sorter: true,
+        customRender: function (text) { return text || '--' },
         width: 160
       },
       {
@@ -209,22 +209,29 @@ export default {
         align: 'center'
       },
       {
-        title: '原厂编码',
-        dataIndex: 'productOrigCode',
+        title: '当前售价',
+        dataIndex: 'productPrice',
         align: 'center',
-        customRender: function (text) { return text || '--' },
-        width: 160
+        width: 120,
+        customRender: function (text) { return '¥' + (text || 0) }
       },
       {
-        title: '售价',
-        dataIndex: 'salePrice',
+        title: '退货数量',
+        dataIndex: 'qty',
         align: 'center',
-        width: 120,
-        scopedSlots: { customRender: 'price' }
+        scopedSlots: { customRender: 'qty' },
+        width: 120
+      },
+      {
+        title: '采购价',
+        dataIndex: 'lastStockCost',
+        align: 'center',
+        customRender: function (text) { return '¥' + (text || 0) },
+        width: 120
       },
       {
         title: '单位',
-        dataIndex: 'unit',
+        dataIndex: 'productUnit',
         align: 'center',
         customRender: function (text) { return text || '--' },
         width: 120
@@ -254,7 +261,7 @@ export default {
     },
     // 选择配件
     handleAdd (row) {
-      this.$emit('add', row, 'new')
+      this.$emit('add', row)
     }
   }
 }

+ 297 - 0
src/views/salesManagement/salesReturn/salesReturnCheck.vue

@@ -0,0 +1,297 @@
+<template>
+  <div>
+    <a-affix :target="() => this.$refs.container">
+      <a-page-header
+        :ghost="false"
+        @back="handleBack"
+        :backIcon="false"
+      >
+        <template slot="subTitle">
+          <a id="back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
+          <span style="margin: 0 15px;color: #666;">客户名称:{{ ordeDetail&&ordeDetail.buyerName }}</span>
+        </template>
+      </a-page-header>
+    </a-affix>
+    <a-card size="small" :bordered="false" class="pages-wrap">
+      <div class="table-operator">
+        <a-button type="primary" class="button-error" @click="backStock">批量返库</a-button>
+      </div>
+      <!-- 已选配件列表 -->
+      <s-table
+        class="sTable"
+        ref="table"
+        size="default"
+        :rowKey="(record) => record.id"
+        :columns="columns"
+        :data="loadData"
+        :scroll="{ x: 1500, y: 300 }"
+        bordered>
+        <!-- 返库数量 -->
+        <template slot="backStockQty" slot-scope="text, record">
+          <editable-cell
+            size="small"
+            :text="record.backStockQty"
+            :max="999999"
+            :min="0"
+            :precision="0"
+            @change="onCellChange(record.id, 'backStockQty', $event)" />
+        </template>
+      </s-table>
+    </a-card>
+    <a-affix :offset-bottom="0">
+      <div
+        style="text-align: center;width: 100%;background-color: #fff;padding: 12px 0;box-shadow: 0 0 20px #dcdee2;">
+        <a-button
+          size="large"
+          style="width: 150px;"
+          type="primary"
+          class="button-primary"
+          @click="handleSubmit()"
+          id="salesReturn-handleSubmit">提交</a-button>
+      </div>
+    </a-affix>
+  </div>
+</template>
+
+<script>
+import { STable, VSelect } from '@/components'
+import queryPart from './queryPart.vue'
+import EditableCell from '@/views/common/editInput.js'
+import { salesReturnDetail, salesReturnSubmit } from '@/api/salesReturn'
+import {
+  salesReturnDetailList,
+  salesReturnDetailDel,
+  salesReturnDetailInsert,
+  salesReturnDetailUpdateQty,
+  salesReturnDetailUpdateReason
+} from '@/api/salesReturnDetail'
+export default {
+  name: 'SalesReturnEdit',
+  components: {
+    STable,
+    VSelect,
+    queryPart,
+    EditableCell
+  },
+  data () {
+    return {
+      orderId: null,
+      orderSn: null,
+      buyerSn: null,
+      disabled: false,
+      isInster: false, // 是否正在添加产品
+      ordeDetail: { discountAmount: 0 },
+      delLoading: false,
+      // 已选产品
+      dataSource: [],
+      productForm: {
+        salesReturnBillSn: ''
+      },
+      // 表头
+      columns: [
+        {
+          title: '序号',
+          dataIndex: 'no',
+          align: 'center',
+          width: 100
+        },
+        {
+          title: '产品编码',
+          dataIndex: 'dealerProductEntity.code',
+          align: 'center',
+          width: 160
+        },
+        {
+          title: '产品名称',
+          dataIndex: 'dealerProductEntity.name',
+          align: 'center',
+          width: 200
+        },
+        {
+          title: '坏件数量',
+          dataIndex: 'badQty',
+          align: 'center',
+          width: 150
+        },
+        {
+          title: '返库数量',
+          dataIndex: 'backStockQty',
+          align: 'center',
+          width: 150,
+          scopedSlots: { customRender: 'backStockQty' }
+        },
+        {
+          title: '单位',
+          dataIndex: 'dealerProductEntity.unit',
+          align: 'center',
+          width: 100
+        },
+        {
+          title: '售价',
+          dataIndex: 'price',
+          customRender: function (text) { return '¥' + (text || 0) },
+          align: 'center',
+          width: 150
+        }
+      ],
+      chooseLoadData: [],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        // 查询总计
+        this.productForm.salesReturnBillSn = this.$route.params.sn
+        return salesReturnDetailList(Object.assign(parameter, this.productForm)).then(res => {
+          const data = res.data
+          const no = (data.pageNo - 1) * data.pageSize
+          for (var i = 0; i < data.list.length; i++) {
+            data.list[i].no = no + i + 1
+          }
+          this.disabled = false
+          this.chooseLoadData = data.list
+          return data
+        })
+      }
+    }
+  },
+  methods: {
+    //  返回
+    handleBack () {
+      this.$router.push({ name: 'salesReturnList' })
+    },
+    // 批量返库
+    backStock () {
+
+    },
+    // 修改返库数量
+    onCellChange (id, key, value) {
+      const chooseLoadData = [...this.chooseLoadData]
+      const row = chooseLoadData.find(item => item.id === id)
+      if (row) {
+        row[key] = Number(value)
+        salesReturnDetailUpdateQty({
+          salesReturnDetailSn: row.salesReturnDetailSn,
+          backStockQty: row.backStockQty
+        }).then(res => {
+          if (res.status == 200) {
+            this.resetSearchForm(true)
+            this.$message.success(res.message)
+          }
+        })
+      }
+    },
+    // 修改退货原因
+    updateRemark (row) {
+      salesReturnDetailUpdateReason({
+        salesReturnDetailSn: row.salesReturnDetailSn,
+        remarks: row.remarks
+      }).then(res => {
+        if (res.status == 200) {
+          this.resetSearchForm(true)
+          this.$message.success(res.message)
+        }
+      })
+    },
+    // 重置列表
+    resetForm () {
+      this.$refs.table.refresh(true)
+    },
+    // 获取单据详细
+    getOrderDetail () {
+      salesReturnDetail({ sn: this.orderSn }).then(res => {
+        this.ordeDetail = res.data || null
+      })
+    },
+    // 删除产品
+    handleDel (row) {
+      const _this = this
+      this.$confirm({
+        title: '提示',
+        content: '确认要删除吗?',
+        centered: true,
+        closable: true,
+        onOk () {
+          _this.delLoading = true
+          salesReturnDetailDel({ id: row.id }).then(res => {
+            if (res.status == 200) {
+              _this.resetSearchForm(true)
+            }
+            _this.$message.info(res.message)
+            _this.delLoading = false
+          })
+        }
+      })
+    },
+    //  重置
+    resetSearchForm (flag) {
+      this.$refs.table.refresh(!!flag)
+      this.getOrderDetail()
+    },
+    // 添加或修改产品
+    saveProduct (row) {
+      console.log(row)
+      // 防止多次添加产品
+      if (this.isInster) {
+        return
+      }
+      this.isInster = true
+      const params = {
+        'salesReturnBillSn': this.orderSn,
+        'price': row.productPrice,
+        'cost': row.lastStockCost,
+        'productSn': row.productSn,
+        'qty': row.qty
+      }
+      salesReturnDetailInsert(params).then(res => {
+        if (res.status == 200) {
+          this.resetSearchForm(true)
+          this.$message.success(res.message)
+        }
+        this.isInster = false
+      })
+    },
+    // 提交销售单
+    handleSubmit () {
+      salesReturnSubmit({ sn: this.orderSn }).then(res => {
+        if (res.status == 200) {
+          this.handleBack()
+          this.$message.success(res.message)
+        }
+      })
+    }
+  },
+  mounted () {
+    this.orderSn = this.$route.params.sn
+    this.buyerSn = this.$route.params.buyerSn
+    this.getOrderDetail()
+  },
+  beforeRouteEnter (to, from, next) {
+    next(vm => {
+      console.log('beforeRouteEnter')
+    })
+  }
+}
+</script>
+
+<style lang="less">
+  .pages-wrap{
+    margin-top: 15px;
+    .sTable{
+      margin-top: 15px;
+    }
+    .total-bar{
+      display: flex;
+      align-items: center;
+      justify-content: space-between;
+      > div{
+        &:last-child{
+          display: flex;
+          align-items: center;
+          justify-content: space-between;
+          > div{
+            padding: 0 10px;
+          }
+        }
+      }
+    }
+  }
+</style>

+ 59 - 248
src/views/salesManagement/salesReturn/salesReturnEdit.vue

@@ -24,62 +24,22 @@
       </a-page-header>
     </a-affix>
 
-    <a-card size="small" :bordered="false" class="pages-wrap">
+    <a-card size="small" :bordered="false" class="pages-wrap" v-if="ordeDetail&&ordeDetail.salesReturnBillSource=='SALES'">
       <!-- 查询配件列表 -->
-      <queryPart :buyerSn="$route.params.buyerSn" :priceType="ordeDetail.priceType" grabFlag="0" :newLoading="isInster" @add="saveProduct"></queryPart>
+      <queryPart :buyerSn="$route.params.buyerSn" grabFlag="0" :newLoading="isInster" @add="saveProduct"></queryPart>
     </a-card>
     <a-card size="small" :bordered="false" class="pages-wrap">
       <!-- alert -->
       <a-alert style="margin-bottom: 10px;" type="info">
         <div slot="message" class="total-bar">
           <div>
-            <span>退货总金额:{{ countData&&countData.totalAmount }}元;</span>
-            <span>总款数:{{ countData&&countData.totalCategory }};</span>
-            <span>总数量:{{ countData&&countData.totalQty }};</span>
-            <span>废品总数量:{{ countData&&countData.totalCelQty }};</span>
+            <span>退货总金额:{{ ordeDetail&&ordeDetail.totalAmount }}元;</span>
+            <span>退货总数量:{{ ordeDetail&&ordeDetail.totalQty }};</span>
           </div>
           <div>
-            <div>
-              折扣金额:
-              <a-input-number id="discount" v-model="ordeDetail.discountAmount" :min="0" :precision="2" :max="999999"/>
-              <a-button type="primary" @click="salesReturnDiscount" class="button-info">打折</a-button>
-            </div>
-            <div>
-              折扣:<strong>{{ ordeDetail&&ordeDetail.discountRate || 0 }}%</strong>;
-              折后总售价:<strong>¥{{ ordeDetail&&ordeDetail.discountedAmount || 0 }}</strong>;
-            </div>
           </div>
         </div>
       </a-alert>
-      <!-- 查询条件 -->
-      <a-row :gutter="15">
-        <a-col :span="18">
-          <a-form-model layout="inline" :model="productForm">
-            <a-form-model-item label="产品编码">
-              <a-input v-model="productForm.productCode" placeholder="输入产品编码" />
-            </a-form-model-item>
-            <a-form-model-item label="产品名称">
-              <a-input v-model="productForm.productName" placeholder="输入产品名称" />
-            </a-form-model-item>
-            <a-form-model-item>
-              <a-button style="margin-bottom: 18px;" type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="salesReturn-refresh">查询</a-button>
-              <a-button style="margin: 0 0 18px 8px" @click="resetForm" id="salesReturn-reset">重置</a-button>
-            </a-form-model-item>
-          </a-form-model>
-        </a-col>
-        <a-col :span="6">
-          <div style="float:right;overflow: hidden;">
-            <a-button id="salesReturn-dru">导入明细</a-button>
-            <a-button
-              size="small"
-              type="primary"
-              @click="salesReturnDelAll"
-              :loading="delLoading"
-              style="margin-left: 10px"
-              id="salesReturn-del-all">整单删除</a-button>
-          </div>
-        </a-col>
-      </a-row>
       <!-- 已选配件列表 -->
       <s-table
         class="sTable"
@@ -100,42 +60,9 @@
             :precision="0"
             @change="onCellChange(record.id, 'qty', $event)" />
         </template>
-        <!-- 废品数量 -->
-        <template slot="celQty" slot-scope="text, record">
-          <editable-cell
-            size="small"
-            :text="record.celQty"
-            :max="999999"
-            :min="0"
-            :precision="0"
-            @change="onCellChange(record.id, 'celQty', $event)" />
-        </template>
-        <!-- 价格 -->
-        <template slot="price" slot-scope="text, record">
-          <editable-cell
-            size="small"
-            :text="text"
-            :max="999999"
-            :min="0"
-            :precision="2"
-            punit="¥"
-            @change="onCellChange(record.id, 'price', $event)" />
-        </template>
-        <!-- 退货金额小计 -->
-        <template slot="returnAmount" slot-scope="text, record">
-          ¥{{ (record.price * record.qty).toFixed(2) }}
-        </template>
-        <!-- 仓库仓位 -->
-        <template slot="warehouse" slot-scope="text, record, index">
-          <a-cascader
-            @change="e => changeWarehouseCascade(e, record, index)"
-            v-model="record.warehouseCascade"
-            expand-trigger="hover"
-            :options="warehouseCascadeData"
-            :fieldNames="{ label: 'name', value: 'sn', children: 'warehouseLocationList' }"
-            id="bulkWarehousingOrderEdit-warehouseCascade"
-            placeholder="请选择仓库仓位"
-            style="width: 100%;" />
+        <!-- 退货原因 -->
+        <template slot="remarks" slot-scope="text, record">
+          <a-input placeholder="30个字符内" maxlength="30" v-model="record.remarks" @change="updateRemark(record)"></a-input>
         </template>
         <!-- 操作 -->
         <template slot="action" slot-scope="text, record">
@@ -161,8 +88,6 @@
           id="salesReturn-handleSubmit">提交</a-button>
       </div>
     </a-affix>
-    <!-- 选择客户弹框 -->
-    <choose-custom-modal :show="openModal" @ok="chooseCustomOk" @cancel="openModal=false"></choose-custom-modal>
   </div>
 </template>
 
@@ -170,17 +95,21 @@
 import { STable, VSelect } from '@/components'
 import queryPart from './queryPart.vue'
 import EditableCell from '@/views/common/editInput.js'
-import chooseCustomModal from './chooseCustomModal.vue'
-import { warehouseCascadeList } from '@/api/warehouse'
-import { salesReturnDetail, salesReturnQueryCount, salesReturnDetailList, salesReturnDiscount, salesReturnDelAll, salesReturnDetailDel, salesReturnSaveProduct, salesReturnSubmit } from '@/api/salesReturn'
+import { salesReturnDetail, salesReturnSubmit } from '@/api/salesReturn'
+import {
+  salesReturnDetailList,
+  salesReturnDetailDel,
+  salesReturnDetailInsert,
+  salesReturnDetailUpdateQty,
+  salesReturnDetailUpdateReason
+} from '@/api/salesReturnDetail'
 export default {
-  name: 'SalesDetail',
+  name: 'SalesReturnEdit',
   components: {
     STable,
     VSelect,
     queryPart,
-    EditableCell,
-    chooseCustomModal
+    EditableCell
   },
   data () {
     return {
@@ -188,18 +117,14 @@ export default {
       orderSn: null,
       buyerSn: null,
       disabled: false,
-      openModal: false,
       isInster: false, // 是否正在添加产品
       ordeDetail: { discountAmount: 0 },
       delLoading: false,
-      warehouseCascadeData: [], //  仓库仓位
       // 已选产品
       dataSource: [],
       productForm: {
-        productCode: '',
-        productName: ''
+        salesReturnBillSn: ''
       },
-      countData: null,
       // 表头
       columns: [
         {
@@ -221,18 +146,18 @@ export default {
           width: 200
         },
         {
-          title: '原厂编码',
-          dataIndex: 'dealerProductEntity.origCode',
+          title: '退货数量',
+          dataIndex: 'qty',
           align: 'center',
-          width: 160,
-          customRender: function (text) { return text || '--' }
+          width: 150,
+          scopedSlots: { customRender: 'qty' }
         },
         {
-          title: '价',
+          title: '退货单价',
           dataIndex: 'price',
+          customRender: function (text) { return '¥' + (text || 0) },
           align: 'center',
-          width: 150,
-          scopedSlots: { customRender: 'price' }
+          width: 150
         },
         {
           title: '单位',
@@ -240,32 +165,19 @@ export default {
           align: 'center',
           width: 100
         },
-        { title: '仓库仓位', scopedSlots: { customRender: 'warehouse' }, width: 200, align: 'center' },
         {
-          title: '退货数量',
-          dataIndex: 'qty',
-          align: 'center',
-          width: 150,
-          scopedSlots: { customRender: 'qty' }
-        },
-        {
-          title: '废品数量',
-          dataIndex: 'celQty',
-          align: 'center',
-          width: 150,
-          scopedSlots: { customRender: 'celQty' }
-        },
-        {
-          title: '退货金额小计',
+          title: '退货小计',
           align: 'center',
-          scopedSlots: { customRender: 'returnAmount' },
+          dataIndex: 'totalAmount',
+          customRender: function (text) { return '¥' + (text || 0) },
           width: 100
         },
         {
-          title: '折后金额小计',
-          dataIndex: 'discountedAmount',
+          title: '退货原因',
+          dataIndex: 'remarks',
           align: 'center',
-          width: 100
+          width: 150,
+          scopedSlots: { customRender: 'remarks' }
         },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center', fixed: 'right' }
       ],
@@ -275,21 +187,11 @@ export default {
         this.disabled = true
         // 查询总计
         this.productForm.salesReturnBillSn = this.$route.params.sn
-        this.getQueryCount(Object.assign(parameter, this.productForm))
         return salesReturnDetailList(Object.assign(parameter, this.productForm)).then(res => {
           const data = res.data
           const no = (data.pageNo - 1) * data.pageSize
           for (var i = 0; i < data.list.length; i++) {
             data.list[i].no = no + i + 1
-            const warehouseSn = data.list[i].warehouseSn || undefined
-            const warehouseLocationSn = data.list[i].warehouseLocationSn || undefined
-            if (warehouseSn || warehouseLocationSn) {
-              data.list[i].warehouseSnBackups = warehouseSn
-              data.list[i].warehouseLocationSnBackups = warehouseLocationSn
-              data.list[i].warehouseCascade = [warehouseSn, warehouseLocationSn]
-            } else {
-              data.list[i].warehouseCascade = undefined
-            }
           }
           this.disabled = false
           this.chooseLoadData = data.list
@@ -303,123 +205,45 @@ export default {
     handleBack () {
       this.$router.push({ name: 'salesReturnList' })
     },
-    // 选择客户成功
-    chooseCustomOk (data) {
-
-    },
-    handleEditCustom () {
-      this.openModal = true
-    },
+    // 修改退货数量
     onCellChange (id, key, value) {
       const chooseLoadData = [...this.chooseLoadData]
       const row = chooseLoadData.find(item => item.id === id)
       if (row) {
         row[key] = Number(value)
-        if (row.celQty > row.qty) {
-          this.$message.info('废品数量不可大于本次退货数量')
-        } else {
-          this.saveProduct(row, 'edit')
-        }
+        salesReturnDetailUpdateQty({
+          salesReturnDetailSn: row.salesReturnDetailSn,
+          qty: row.qty
+        }).then(res => {
+          if (res.status == 200) {
+            this.resetSearchForm(true)
+            this.$message.success(res.message)
+          }
+        })
       }
     },
-    //  仓库仓位  级联  列表
-    getWarehouseCascade () {
-      warehouseCascadeList({}).then(res => {
+    // 修改退货原因
+    updateRemark (row) {
+      salesReturnDetailUpdateReason({
+        salesReturnDetailSn: row.salesReturnDetailSn,
+        remarks: row.remarks
+      }).then(res => {
         if (res.status == 200) {
-		  res.data.map(item => {
-		    item.sn = item.warehouseSn
-		    if (item.warehouseLocationList) {
-		  	item.warehouseLocationList.map(subItem => {
-		  	  subItem.sn = subItem.warehouseLocationSn
-		  	})
-		    }
-		  })
-          this.warehouseCascadeData = res.data
-        } else {
-          this.warehouseCascadeData = []
+          this.resetSearchForm(true)
+          this.$message.success(res.message)
         }
       })
     },
-    // 修改仓库仓位
-    changeWarehouseCascade (val, opt, ind) {
-      console.log(val, opt, ind)
-      let loadData = this.chooseLoadData[ind]
-      if (val.length < 2) {
-        this.$message.warning('当前仓库无仓位,请选择其他仓库')
-        const warehouseSnBackups = loadData.warehouseSnBackups || undefined
-        const warehouseLocationSnBackups = loadData.warehouseLocationSnBackups || undefined
-        loadData.warehouseSn = warehouseSnBackups
-        loadData.warehouseLocationSn = warehouseLocationSnBackups
-        if (warehouseSnBackups || warehouseLocationSnBackups) {
-          loadData.warehouseCascade = [warehouseSnBackups, warehouseLocationSnBackups]
-        } else {
-          loadData.warehouseCascade = undefined
-        }
-      } else {
-        loadData.warehouseSn = val[0] ? val[0] : ''
-        loadData.warehouseLocationSn = val[1] ? val[1] : ''
-        loadData.warehouseSnBackups = val[0] ? val[0] : ''
-        loadData.warehouseLocationSnBackups = val[1] ? val[1] : ''
-        loadData = this.chooseLoadData[ind]
-        console.log(loadData)
-        this.saveProduct(loadData, 'edit')
-      }
-    },
     // 重置列表
     resetForm () {
-      this.productForm = {
-        productName: '',
-        productCode: ''
-      }
       this.$refs.table.refresh(true)
     },
-    // 明细统计
-    getQueryCount (params) {
-      salesReturnQueryCount(params).then(res => {
-        this.countData = res.data || null
-      })
-    },
     // 获取单据详细
     getOrderDetail () {
       salesReturnDetail({ sn: this.orderSn }).then(res => {
         this.ordeDetail = res.data || null
       })
     },
-    // 打折
-    salesReturnDiscount () {
-      if (this.ordeDetail.discountAmount < 0) {
-        return
-      }
-      salesReturnDiscount({
-        discountAmount: this.ordeDetail.discountAmount,
-        salesReturnSn: this.ordeDetail.salesReturnSn,
-        id: this.ordeDetail.id
-      }).then(res => {
-        if (res.status == 200) {
-          this.resetSearchForm()
-        }
-      })
-    },
-    // 整单删除
-    salesReturnDelAll () {
-      const _this = this
-      this.$confirm({
-        title: '提示',
-        content: '确认要整单删除吗?',
-        centered: true,
-        closable: true,
-        onOk () {
-          _this.delLoading = true
-          salesReturnDelAll({ sn: _this.ordeDetail.salesReturnSn }).then(res => {
-            if (res.status == 200) {
-              _this.resetSearchForm()
-            }
-            _this.$message.info(res.message)
-            _this.delLoading = false
-          })
-        }
-      })
-    },
     // 删除产品
     handleDel (row) {
       const _this = this
@@ -446,7 +270,7 @@ export default {
       this.getOrderDetail()
     },
     // 添加或修改产品
-    saveProduct (row, type) {
+    saveProduct (row) {
       console.log(row)
       // 防止多次添加产品
       if (this.isInster) {
@@ -455,27 +279,16 @@ export default {
       this.isInster = true
       const params = {
         'salesReturnBillSn': this.orderSn,
-        'salesReturnBillNo': this.ordeDetail.salesReturnBillNo,
-        'salesBillSn': row.salesBillSn,
-        'salesBillNo': row.salesBillNo,
-        'salesBillDetailSn': row.salesBillDetailSn,
-        'price': row.price,
-        'cost': row.cost,
+        'price': row.productPrice,
+        'cost': row.lastStockCost,
         'productSn': row.productSn,
-        'celQty': row.celQty,
-        'hasReturnQty': row.hasReturnQty,
-        'warehouseLocationSn': row.warehouseLocationSn,
-        'warehouseSn': row.warehouseSn
+        'qty': row.qty
       }
-      // 编辑
-      if (type == 'edit') {
-        params.id = row.id
-        params.qty = row.qty
-      } else {
-        params.salesQty = row.qty
-      }
-      salesReturnSaveProduct(params).then(res => {
-        this.resetSearchForm(true)
+      salesReturnDetailInsert(params).then(res => {
+        if (res.status == 200) {
+          this.resetSearchForm(true)
+          this.$message.success(res.message)
+        }
         this.isInster = false
       })
     },
@@ -490,11 +303,9 @@ export default {
     }
   },
   mounted () {
-    this.orderId = this.$route.params.id
     this.orderSn = this.$route.params.sn
     this.buyerSn = this.$route.params.buyerSn
     this.getOrderDetail()
-    this.getWarehouseCascade()
   },
   beforeRouteEnter (to, from, next) {
     next(vm => {

+ 11 - 22
src/views/salesManagement/salesReturn/salesReturnGrabEdit.vue

@@ -24,7 +24,7 @@
       </a-page-header>
     </a-affix>
 
-    <a-card size="small" :bordered="false" class="pages-wrap">
+    <a-card size="small" :bordered="false" class="pages-wrap" v-if="ordeDetail&&ordeDetail.salesReturnBillSource=='SALES'">
       <!-- 查询配件列表 -->
       <queryPart :buyerSn="$route.params.buyerSn" grabFlag="1" :newLoading="isInster" @add="saveProduct"></queryPart>
     </a-card>
@@ -60,14 +60,10 @@
             :precision="0"
             @change="onCellChange(record.id, 'qty', $event)" />
         </template>
-        <!-- 废品数量 -->
+        <!-- 退货原因 -->
         <template slot="remarks" slot-scope="text, record">
           <a-input placeholder="30个字符内" maxlength="30" v-model="record.remarks" @change="updateRemark(record)"></a-input>
         </template>
-        <!-- 退货金额小计 -->
-        <template slot="returnAmount" slot-scope="text, record">
-          ¥{{ (record.price * record.qty).toFixed(2) }}
-        </template>
         <!-- 操作 -->
         <template slot="action" slot-scope="text, record">
           <a-button
@@ -108,7 +104,7 @@ import {
   salesReturnDetailUpdateReason
 } from '@/api/salesReturnDetail'
 export default {
-  name: 'SalesDetail',
+  name: 'SalesReturnGrabEdit',
   components: {
     STable,
     VSelect,
@@ -124,7 +120,6 @@ export default {
       isInster: false, // 是否正在添加产品
       ordeDetail: { discountAmount: 0 },
       delLoading: false,
-      warehouseCascadeData: [], //  仓库仓位
       // 已选产品
       dataSource: [],
       productForm: {
@@ -292,7 +287,7 @@ export default {
       this.getOrderDetail()
     },
     // 添加或修改产品
-    saveProduct (row, type) {
+    saveProduct (row) {
       console.log(row)
       // 防止多次添加产品
       if (this.isInster) {
@@ -304,24 +299,18 @@ export default {
         'salesReturnBillNo': this.ordeDetail.salesReturnBillNo,
         'salesBillSn': row.salesBillSn,
         'salesBillNo': row.salesBillNo,
+        'refundableQty': row.refundableQty,
         'salesBillDetailSn': row.salesBillDetailSn,
         'price': row.price,
-        'cost': row.cost,
+        'cost': row.showCost,
         'productSn': row.productSn,
-        'celQty': row.celQty,
-        'hasReturnQty': row.hasReturnQty,
-        'warehouseLocationSn': row.warehouseLocationSn,
-        'warehouseSn': row.warehouseSn
-      }
-      // 编辑
-      if (type == 'edit') {
-        params.id = row.id
-        params.qty = row.qty
-      } else {
-        params.salesQty = row.qty
+        'qty': row.qty
       }
       salesReturnDetailInsert(params).then(res => {
-        this.resetSearchForm(true)
+        if (res.status == 200) {
+          this.resetSearchForm(true)
+          this.$message.success(res.message)
+        }
         this.isInster = false
       })
     },