瀏覽代碼

销售退货对接

lilei 2 年之前
父節點
當前提交
83f6d2e03b

+ 7 - 2
src/api/sales.js

@@ -30,11 +30,16 @@ export const salesDel = (params) => {
 export const salesDetailBySn = (params) => {
   return axios({
     url: `/sales/findBySn/${params.salesBillSn}`,
-    data: params,
     method: 'get'
   })
 }
-
+// 查询客户名称
+export const salesDetailByNo = (params) => {
+  return axios({
+    url: `/sales/findBySaleBillNo/${params.salesBillNo}`,
+    method: 'get'
+  })
+}
 //  销售 新增或编辑
 export const salesSave = (params) => {
   return axios({

+ 8 - 0
src/api/salesReturnDetail.js

@@ -89,4 +89,12 @@ export const setReturnPrice = (params) => {
     data: params,
     method: 'post'
   })
+}
+
+// 客服删除销售退货明细
+export const deleteByCustomerService = (params) => {
+  return axios({
+    url: `/salesReturn/detail/deleteByCustomerService/${params.salesReturnDetailSn}`,
+    method: 'get'
+  })
 }

+ 1 - 1
src/config/router.config.js

@@ -544,7 +544,6 @@ export const asyncRouterMap = [
                    title: '销售退货详情',
                    icon: 'fund',
                    hidden: true
-                   // permission: 'M_salesReturn'
                  }
                },
                {
@@ -564,6 +563,7 @@ export const asyncRouterMap = [
                  meta: {
                    title: '客服确认',
                    icon: 'fund',
+                   replaceTab: true,
                    hidden: true
                  }
                },

+ 163 - 98
src/views/salesReturnManagement/custConfirm/list.vue

@@ -10,10 +10,10 @@
       </a-page-header>
       <a-card size="small" :bordered="false" class="custConfirm-cont">
         <a-form layout="inline" style="margin-bottom:10px;" @keyup.enter.native="$refs.table.refresh(true)">
-          <a-form-item label="产品编码" prop="productCode">
+          <a-form-item label="产品编码">
             <a-input id="custConfirm-productCode" v-model.trim="queryParam.productCode" placeholder="请输入产品编码" allowClear />
           </a-form-item>
-          <a-form-item label="产品名称" prop="productName">
+          <a-form-item label="产品名称">
             <a-input id="custConfirm-productName" v-model.trim="queryParam.productName" placeholder="请输入产品名称" allowClear />
           </a-form-item>
           <a-form-item>
@@ -44,7 +44,7 @@
           <!-- 退货数量 -->
           <template slot="qty" slot-scope="text, record">
             <a-input-number
-              v-if="record.addFlag == '0'"
+              v-if="record.isEdit"
               size="small"
               v-model="record.qty"
               :precision="0"
@@ -52,12 +52,14 @@
               :max="record.qty"
               placeholder="请输入"
               style="width: 100%;" />
-            <span v-else>--</span>
+            <span v-else>
+              {{ record.qty }}
+            </span>
           </template>
           <!-- 仓库实收数量 -->
           <template slot="receiveQty" slot-scope="text, record">
             <a-input-number
-              v-if="record.addFlag == '0'"
+              v-if="record.isEdit"
               size="small"
               v-model="record.receiveQty"
               :precision="0"
@@ -65,12 +67,14 @@
               :max="999999"
               placeholder="请输入"
               style="width: 100%;" />
-            <span v-else>--</span>
+            <span v-else>
+              {{ record.receiveQty }}
+            </span>
           </template>
           <!-- 坏件数量 -->
           <template slot="badQty" slot-scope="text, record">
             <a-input-number
-              v-if="record.addFlag == '0'"
+              v-if="record.isEdit"
               size="small"
               v-model="record.badQty"
               :precision="0"
@@ -78,12 +82,14 @@
               :max="999999"
               placeholder="请输入"
               style="width: 100%;" />
-            <span v-else>--</span>
+            <span v-else>
+              {{ record.badQty }}
+            </span>
           </template>
           <!-- 良品数量 -->
           <template slot="goodQty" slot-scope="text, record">
             <a-input-number
-              v-if="record.addFlag == '0'"
+              v-if="record.isEdit"
               size="small"
               v-model="record.goodQty"
               :precision="0"
@@ -91,12 +97,14 @@
               :max="999999"
               placeholder="请输入"
               style="width: 100%;" />
-            <span v-else>--</span>
+            <span v-else>
+              {{ record.goodQty }}
+            </span>
           </template>
           <!-- 返库数量 -->
           <template slot="backStockQty" slot-scope="text, record">
             <a-input-number
-              v-if="record.addFlag == '0'"
+              v-if="record.isEdit"
               size="small"
               v-model="record.backStockQty"
               :precision="0"
@@ -104,12 +112,14 @@
               :max="999999"
               placeholder="请输入"
               style="width: 100%;" />
-            <span v-else>--</span>
+            <span v-else>
+              {{ record.backStockQty }}
+            </span>
           </template>
           <!-- 退货原因 -->
           <template slot="returnReason" slot-scope="text, record">
             <a-select
-              v-if="record.addFlag == '0'"
+              v-if="record.isEdit"
               style="width:100%;"
               v-model="record.returnReason"
               placeholder="请选择退货原因"
@@ -118,22 +128,48 @@
                 {{ item.dispName }}
               </a-select-option>
             </a-select>
-            <span v-else>--</span>
+            <span v-else>
+              {{ record.returnReasonDictValue||'--' }}
+            </span>
           </template>
           <!-- 操作 -->
           <template slot="action" slot-scope="text, record">
-            <a-button
-              size="small"
-              type="link"
-              class="button-warning"
-              @click="handleEdit(record)"
-            >保存</a-button>
-            <a-button
-              size="small"
-              type="link"
-              class="button-warning"
-              @click="handleDel(record)"
-            >删除</a-button>
+            <div v-if="record.isEdit">
+              <a-button
+                size="small"
+                type="link"
+                class="button-warning"
+                :loading="loading"
+                @click="handleSave(record)"
+              >保存</a-button>
+              <a-button
+                size="small"
+                type="link"
+                class="button-warning"
+                @click="handleCancel(record)"
+              >取消</a-button>
+            </div>
+            <div v-else>
+              <a-button
+                size="small"
+                type="link"
+                class="button-warning"
+                @click="handleSetPrice(record)"
+              >设置退货单价</a-button>
+              <a-button
+                size="small"
+                type="link"
+                class="button-warning"
+                @click="handleEdit(record)"
+              >编辑</a-button>
+              <a-button
+                :loading="loading"
+                size="small"
+                type="link"
+                class="button-error"
+                @click="handleDel(record)"
+              >删除</a-button>
+            </div>
           </template>
         </s-table>
       </a-card>
@@ -148,64 +184,68 @@
         @click="handleSubmit()"
         id="salesReturn-handleSubmit">审核通过</a-button>
     </div>
+    <!-- 设置退货单价 -->
+    <setPriceModal
+      ref="setPriceModal"
+      modalTit="设置退货单价"
+      :chooseData="chooseData"
+      :openModal="showSetPriceModal"
+      @setOk="setPriceOk"
+      @cancel="showSetPriceModal=false"></setPriceModal>
   </div>
 </template>
 
 <script>
 import { commonMixin } from '@/utils/mixin'
 import { STable, VSelect } from '@/components'
-import { salesReturnDetail, salesReturnCheck } from '@/api/salesReturn'
-import { salesReturnDetailList, updateByCustomerService, setReturnPrice } from '@/api/salesReturnDetail'
+import setPriceModal from './setPriceModal.vue'
+import { salesReturnDetail, customerServiceConfirm } from '@/api/salesReturn'
+import { salesReturnDetailList, updateByCustomerService, deleteByCustomerService } from '@/api/salesReturnDetail'
 export default {
-  name: 'SalesReturnCheck',
+  name: 'CustConfirm',
   mixins: [commonMixin],
   components: {
     STable,
-    VSelect
+    VSelect,
+    setPriceModal
   },
   data () {
     return {
       spinning: false,
       tableHeight: 0, // 表格高度
-      orderId: null,
       orderSn: null,
-      buyerSn: null,
       disabled: false,
-      isInster: false, // 是否正在添加产品
-      ordeDetail: { discountAmount: 0 },
+      ordeDetail: null,
       loading: false,
-      // 已选产品
-      dataSource: [],
-      productForm: {
-        salesReturnBillSn: ''
+      queryParam: {
+        salesReturnBillSn: '',
+        productName: '',
+        productCode: ''
       },
-      chooseLoadData: [],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
         // 查询总计
-        this.productForm.salesReturnBillSn = this.$route.params.sn
-        return salesReturnDetailList(Object.assign(parameter, this.productForm)).then(res => {
+        this.queryParam.salesReturnBillSn = this.$route.params.sn
+        return salesReturnDetailList(Object.assign(parameter, this.queryParam)).then(res => {
           let data
           if (res.status == 200) {
             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
+              data.list[i].isEdit = false
               data.list[i].backStockQtyBackups = data.list[i].backStockQty
             }
             this.disabled = false
-            this.chooseLoadData = data.list
           }
           return data
         })
       },
       rowSelectionInfo: null,
-      queryParam: {
-        productCode: '',
-        productName: ''
-      },
-      returnReasonList: [] // 申请退货列表
+      returnReasonList: [], // 申请退货列表
+      showSetPriceModal: false,
+      chooseData: []
     }
   },
   computed: {
@@ -224,7 +264,7 @@ export default {
         { title: '实际退货金额', dataIndex: 'totalAmount', align: 'center', width: '10%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '退货单价说明', dataIndex: 'priceRemark', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '退货原因', dataIndex: 'returnReason', width: '15%', align: 'center', scopedSlots: { customRender: 'returnReason' } },
-        { title: '操作', scopedSlots: { customRender: 'action' }, width: '15%', align: 'center' }
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: '20%', align: 'center' }
       ]
       return arr
     }
@@ -236,15 +276,16 @@ export default {
     },
     //  返回
     handleBack () {
-      this.$router.push({ name: 'receiveCheckList' })
+      this.$router.push({ name: 'salesReturnList', query: { closeLastOldTab: true } })
     },
-    // 添加
-    handleAdd (row) {
+    // 新增产品
+    handleAdd () {
 
     },
-    // 删除
-    handleDel (row) {
-
+    // 设置价格
+    handleSetPrice (record) {
+      this.chooseData = [record]
+      this.showSetPriceModal = true
     },
     // 批量设置退货单价
     handlePlss () {
@@ -253,48 +294,63 @@ export default {
         _this.$message.warning('请先选择产品!')
         return
       }
-      this.$confirm({
-        title: '提示',
-        content: '确认要批量设置退货单价吗?',
-        centered: true,
-        onOk () {
-          const obj = []
-          _this.rowSelectionInfo && _this.rowSelectionInfo.selectedRows.map(item => {
-            obj.push({
-              salesReturnDetailSn: item.salesReturnDetailSn,
-              backStockQty: item.qty
-            })
-          })
-          _this.setPrice(obj)
-        }
-      })
+      this.chooseData = _this.rowSelectionInfo.selectedRows
+      this.showSetPriceModal = true
     },
-    // 保存编辑
-    handleEdit (record) {
+    // 设置价格成功
+    setPriceOk () {
+      this.showSetPriceModal = false
+      this.rowSelectionInfo = null
+      this.$refs.table.clearTable()
+      this.resetSearchForm(true)
+    },
+    // 保存
+    handleSave (record) {
+      if (!record.returnReason) {
+        this.$message.warning('请先选择退货原因!')
+        return
+      }
       this.loading = true
       this.spinning = true
       updateByCustomerService(record).then(res => {
         if (res.status == 200) {
-          this.resetSearchForm(true)
           this.$message.success(res.message)
         }
         this.loading = false
         this.spinning = false
       })
     },
-    // 设置退货单价
-    setPrice (data) {
-      this.loading = true
-      this.spinning = true
-      setReturnPrice(data).then(res => {
-        if (res.status == 200) {
-          this.resetSearchForm(true)
-          this.$message.success(res.message)
+    // 删除产品
+    handleDel (row) {
+      const _this = this
+      this.$confirm({
+        title: '提示',
+        content: '确认要删除吗?',
+        centered: true,
+        closable: true,
+        onOk () {
+          _this.loading = true
+          _this.spinning = true
+          deleteByCustomerService({ salesReturnDetailSn: row.salesReturnDetailSn }).then(res => {
+            if (res.status == 200) {
+              _this.resetSearchForm(true)
+            }
+            _this.$message.info(res.message)
+            _this.loading = false
+            _this.spinning = false
+          })
         }
-        this.loading = false
-        this.spinning = false
       })
     },
+    // 编辑
+    handleEdit (record) {
+      record.isEdit = true
+    },
+    // 取消
+    handleCancel (record) {
+      record.isEdit = false
+      this.$refs.table.refresh()
+    },
     // 获取单据详细
     getOrderDetail () {
       this.rowSelectionInfo = null
@@ -302,35 +358,44 @@ export default {
         this.ordeDetail = res.data || null
       })
     },
-    //  重置
-    resetSearchForm (flag) {
-      this.$refs.table.refresh(!!flag)
-      this.getOrderDetail()
-    },
-    // 提交销售单
+    // 审核销售单
     handleSubmit () {
-      this.spinning = true
-      salesReturnCheck({ salesReturnBillSn: this.orderSn }).then(res => {
-        if (res.status == 200) {
-          this.handleBack()
-          this.$message.success(res.message)
-          this.spinning = false
-        } else {
-          this.spinning = false
+      const _this = this
+      this.$confirm({
+        title: '提示',
+        content: '确认审核通过吗?',
+        centered: true,
+        closable: true,
+        onOk () {
+          _this.spinning = true
+          customerServiceConfirm({ salesReturnBillSn: _this.orderSn }).then(res => {
+            if (res.status == 200) {
+              _this.handleBack()
+              _this.$message.success(res.message)
+              _this.spinning = false
+            } else {
+              _this.spinning = false
+            }
+          })
         }
       })
     },
+    //  重置
+    resetSearchForm (flag) {
+      this.queryParam.productName = ''
+      this.queryParam.productCode = ''
+      this.$refs.table.refresh(!!flag)
+    },
     pageInit () {
       const _this = this
       this.$nextTick(() => { // 页面渲染完成后的回调
         _this.setTableH()
       })
       this.orderSn = this.$route.params.sn
-      this.buyerSn = this.$route.params.buyerSn
       this.rowSelectionInfo = null
       this.$refs.table.clearTable()
-      this.getOrderDetail()
       this.returnReasonList = this.$store.state.app.returnReason
+      this.getOrderDetail()
     },
     setTableH () {
       this.tableHeight = window.innerHeight - 340

+ 261 - 2
src/views/salesReturnManagement/custConfirm/setPriceModal.vue

@@ -1,9 +1,268 @@
 <template>
-
+  <a-modal
+    centered
+    class="setPrice-detail-modal"
+    :footer="null"
+    :maskClosable="false"
+    v-model="isShow"
+    :title="modalTit"
+    :bodyStyle="{padding: modalTit?'25px 32px 20px':'50px 32px 15px'}"
+    @cancel="isShow=false"
+    width="80%">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <div class="common-main">
+        <div class="form-row">
+          <div>
+            退货单价:
+            <a-radio-group v-model="form.grabFlag" @change="grabChange">
+              <a-radio :value="0">
+                不抓单
+              </a-radio>
+              <a-radio :value="1">
+                抓单
+              </a-radio>
+            </a-radio-group>
+          </div>
+          <div v-if="form.grabFlag==0">
+            是否打折:
+            <a-radio-group v-model="form.discountFlag">
+              <a-radio :value="0">
+                不打折
+              </a-radio>
+              <a-radio :value="1">
+                打折
+              </a-radio>
+            </a-radio-group>
+            <div v-if="form.discountFlag==1">
+              <a-input-number placeholder="请输入折扣" v-model="form.discount" :min="0" :max="10" :precision="2" />
+              <span class="mleft">示例:7折表示使用当前售价×0.7作为退货单价(保留两位小数)</span>
+              <a-button type="primary" :disabled="disabled" @click="handleSave" class="button-error">设置完成</a-button>
+            </div>
+            <div v-else>
+              <a-button type="primary" :disabled="disabled" @click="handleSave" class="button-error">设置完成</a-button>
+            </div>
+          </div>
+          <div v-else>
+            销售单号:
+            <a-input placeholder="请输入销售单号" v-model="form.salesBillNo" :maxlength="50" @change="fetchUser"/>
+            <span class="mleft">{{ buyerName }}</span>
+            <a-button type="primary" :disabled="disabled" @click="handleSave" class="button-error">设置完成</a-button>
+          </div>
+        </div>
+        <a-divider>请给以下产品设置新的退货单价</a-divider>
+        <!-- 搜索条件 -->
+        <div>
+          <a-form layout="inline" style="margin-bottom:10px;" @keyup.enter.native="searchProduct">
+            <a-form-item label="产品编码">
+              <a-input id="setPrice-productCode" v-model.trim="queryParam.productCode" placeholder="请输入产品编码" allowClear />
+            </a-form-item>
+            <a-form-item label="产品名称">
+              <a-input id="setPrice-productName" v-model.trim="queryParam.productName" placeholder="请输入产品名称" allowClear />
+            </a-form-item>
+            <a-form-item>
+              <a-button type="primary" class="button-info" @click="searchProduct" :disabled="disabled" id="setPrice-refresh">查询</a-button>
+              <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="setPrice-reset">重置</a-button>
+            </a-form-item>
+          </a-form>
+        </div>
+        <!-- 表格数据 -->
+        <s-table
+          class="sTable"
+          ref="table"
+          size="small"
+          :rowKey="(record) => record.id"
+          :columns="columns"
+          :data="loadData"
+          :scroll="{ y: 400 }"
+          :showPagination="false"
+          bordered>
+        </s-table>
+      </div>
+    </a-spin>
+  </a-modal>
 </template>
 
 <script>
+import debounce from 'lodash/debounce'
+import { STable, VSelect } from '@/components'
+import { salesDetailByNo } from '@/api/sales'
+import { setReturnPrice } from '@/api/salesReturnDetail'
+export default {
+  name: 'SetPriceModal',
+  components: { STable, VSelect },
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    },
+    modalTit: { // 弹框标题
+      type: String,
+      default: null
+    },
+    chooseData: {
+      type: Array,
+      default: function () {
+        return []
+      }
+    }
+  },
+  data () {
+    this.fetchUser = debounce(this.fetchUser, 800)
+    return {
+      isShow: this.openModal, //  是否打开弹框
+      disabled: false,
+      spinning: false,
+      queryParam: {
+        productName: '',
+        productCode: ''
+      },
+      form: {
+        grabFlag: 0, // 是否抓单
+        discountFlag: 0, // 是否打折
+        discount: '', // 折扣
+        salesBillNo: '' // 销售单号
+      },
+      columns: [
+        { title: '序号', dataIndex: 'no', width: '6%', align: 'center' },
+        { title: '产品编码', dataIndex: 'productEntity.code', align: 'center', width: '13%', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productEntity.name', width: '25%', align: 'left', customRender: function (text) { return text || '--' } },
+        { title: '单位', dataIndex: 'productEntity.unit', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '申请退货数量', dataIndex: 'qty', align: 'center', width: '10%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '仓库实收数量', dataIndex: 'receiveQty', align: 'center', width: '10%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '坏件数量', dataIndex: 'badQty', align: 'center', width: '10%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '良品数量', dataIndex: 'goodQty', align: 'center', width: '10%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '返库数量', dataIndex: 'backStockQty', align: 'center', width: '10%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '实际退货单价', dataIndex: 'price', align: 'center', width: '10%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '实际退货金额', dataIndex: 'totalAmount', align: 'center', width: '10%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '退货单价说明', dataIndex: 'priceRemark', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '退货原因', dataIndex: 'returnReasonDictValue', width: '15%', align: 'center', customRender: function (text) { return text || '--' } }
+      ],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        return new Promise((res, rej) => {
+          const ret = this.chooseData.filter(item => {
+            return item.productEntity.code.indexOf(this.queryParam.productCode) >= 0 &&
+            item.productEntity.name.indexOf(this.queryParam.productName) >= 0
+          })
+          res({
+            list: ret,
+            count: ret.length
+          })
+        })
+      },
+      buyerName: ''
+    }
+  },
+  methods: {
+    fetchUser () {
+      if (!this.form.salesBillNo.replace(/\s+/g, '')) {
+        this.form.salesBillNo = ''
+        this.buyerName = ''
+        return
+      }
+      this.spinning = true
+      salesDetailByNo({ salesBillNo: this.form.salesBillNo }).then(res => {
+        this.spinning = false
+        this.buyerName = res.data ? res.data.buyerName : ''
+      })
+    },
+    // 设置价格
+    handleSave () {
+      // 不抓单且打折
+      if (this.form.grabFlag == 0 && this.form.discountFlag == 1) {
+        if (!this.form.discount) {
+          this.$message.info('请输入折扣')
+          return
+        }
+      }
+      // 抓单
+      if (this.form.grabFlag == 1) {
+        if (!this.form.salesBillNo) {
+          this.$message.info('请输入销售单号')
+          return
+        }
+      }
+      const snList = []
+      this.chooseData.map(item => {
+        snList.push(item.salesReturnDetailSn)
+      })
+      const params = Object.assign(this.form, { salesReturnBillDetailSnList: snList })
+      console.log(params)
+      this.disabled = true
+      this.spinning = true
+      setReturnPrice(params).then(res => {
+        if (res.status == 200) {
+          this.$emit('setOk')
+          this.$message.info(res.message)
+        }
+        this.disabled = false
+        this.spinning = false
+      })
+    },
+    grabChange (e) {
+      if (e.target.value == 1) {
+        this.form.salesBillNo = ''
+      } else {
+        this.form.discountFlag = 0
+        this.form.discount = ''
+      }
+    },
+    // 取消
+    handleCommonCancel () {
+      this.$emit('cancel')
+    },
+    // 查询
+    searchProduct () {
+      this.$refs.table.refresh(true)
+    },
+    // 重置
+    resetSearchForm () {
+      this.form = {
+        grabFlag: 0, // 是否抓单
+        discountFlag: 0, // 是否打折
+        discount: '', // 折扣
+        salesBillNo: '' // 销售单号
+      }
+      this.queryParam = {
+        productName: '',
+        productCode: ''
+      }
+      if (this.$refs.table) {
+        this.$refs.table.refresh(true)
+      }
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.handleCommonCancel()
+      } else {
+        this.resetSearchForm()
+      }
+    }
+  }
+}
 </script>
 
-<style>
+<style lang="less">
+  .setPrice-detail-modal{
+    .form-row{
+      > div{
+        display: flex;
+        align-items:center;
+        padding: 10px 0;
+        input[type='text']{
+          width:250px;
+        }
+        .mleft{
+          margin-left:10px;
+        }
+      }
+    }
+  }
 </style>

+ 86 - 0
src/views/salesReturnManagement/salesReturn/auditDetail.vue

@@ -0,0 +1,86 @@
+<template>
+  <div>
+    <p>说明:以下信息来自钉钉</p>
+    <a-spin :spinning="spinning" tip="Loading...">
+      <s-table
+        class="sTable fixPagination"
+        ref="table"
+        size="small"
+        :rowKey="(record) => record.id"
+        :columns="columns"
+        :data="loadData"
+        :scroll="{ y: 500 }"
+        :showPagination="false"
+        bordered>
+      </s-table>
+    </a-spin>
+  </div>
+</template>
+
+<script>
+import { STable } from '@/components'
+import { getProcessInstance } from '@/api/expenseManagement'
+export default {
+  name: 'AuditDetail',
+  components: { STable },
+  props: {
+    openModal: {
+      type: Boolean,
+      default: false
+    },
+    itemSn: {
+      type: [Number, String],
+      default: ''
+    },
+    businessType: {
+      type: [Number, String],
+      default: ''
+    }
+  },
+  data () {
+    return {
+      spinning: false,
+      columns: [{ title: '序号', dataIndex: 'no', width: '8%', align: 'center' },
+        { title: '人员姓名', width: '12%', dataIndex: 'userName', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '人员类型', dataIndex: 'userType', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '状态', dataIndex: 'state', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '审批意见', dataIndex: 'remark', width: '20%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '附件', dataIndex: 'hasAttachments', width: '20%', align: 'center', customRender: function (text) { return text != '0' ? '请在钉钉中查看附件内容' : '--' } },
+        { title: '操作时间', dataIndex: 'date', width: '20%', align: 'center', customRender: function (text) { return text || '--' } }],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.spinning = true
+        delete parameter.tableId
+        delete parameter.index
+        return getProcessInstance({ businessType: this.businessType, businessSn: this.itemSn }).then(res => {
+          let data
+          if (res.status == 200) {
+            data = res.data
+            const no = 0
+            for (var i = 0; i < data.length; i++) {
+              data[i].no = no + i + 1
+            }
+            this.spinning = false
+            return data
+          } else {
+            this.spinning = false
+            this.$emit('loadError')
+            return {
+              list: [],
+              count: 0
+            }
+          }
+        })
+      }
+    }
+  },
+  methods: {
+    clearTable () {
+      this.$refs.table.clearTable()
+    }
+  }
+}
+</script>
+
+<style>
+</style>

+ 18 - 17
src/views/salesReturnManagement/salesReturn/detail.vue

@@ -68,8 +68,8 @@
               :defaultLoadData="false"
               bordered></s-table>
           </a-tab-pane>
-          <a-tab-pane key="2" tab="审核进度" force-render>
-            审核进度
+          <a-tab-pane key="2" tab="审核进度" >
+            <auditDetail ref="auditDetail" businessType="SALES_RETURN" :itemSn="$route.params.sn"></auditDetail>
           </a-tab-pane>
           <a-tab-pane key="3" tab="操作记录" force-render>
             操作记录
@@ -87,12 +87,13 @@ import { commonMixin } from '@/utils/mixin'
 import { getOperationalPrecision } from '@/libs/tools.js'
 import { STable, VSelect } from '@/components'
 import { printFun, exportExcel } from '@/libs/JGPrint.js'
+import auditDetail from './auditDetail.vue'
 import { salesReturnDetail, salesReturnPrint, salesReturnExport } from '@/api/salesReturn'
 import { salesReturnDetailList } from '@/api/salesReturnDetail'
 export default {
   name: 'SalesReturnDetail',
   mixins: [commonMixin],
-  components: { STable, VSelect },
+  components: { STable, VSelect, auditDetail },
   data () {
     return {
       spinning: false,
@@ -127,21 +128,21 @@ export default {
     columns () {
       const arr = [
         { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
-        { title: '采购单号', dataIndex: 'purchaseBillNo', align: 'center', width: '17%', customRender: function (text) { return text || '--' } },
-        { title: '产品编码', dataIndex: 'productEntity.code', align: 'center', width: '12%', customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'productEntity.name', align: 'left', width: '17%', customRender: function (text) { return text || '--' }, ellipsis: true },
-        // { title: '售价', dataIndex: 'price', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '退货数量', dataIndex: 'qty', width: '6%', align: 'center', customRender: function (text) { return text || text == 0 ? text : '--' } },
-        { title: '坏件数量', dataIndex: 'badQty', width: '6%', align: 'center', customRender: function (text) { return text || text == 0 ? text : '--' } },
-        { title: '返库数量', dataIndex: 'backStockQty', width: '6%', align: 'center', customRender: function (text) { return text || text == 0 ? text : '--' } },
-        { title: '单位', dataIndex: 'productEntity.unit', align: 'center', width: '4%', customRender: function (text) { return text || '--' } },
-        // { title: '退货金额小计', dataIndex: 'saleReturnSubtotal', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '退货原因', dataIndex: 'remark', width: '14%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true }
+        { title: '产品编码', dataIndex: 'productEntity.code', align: 'center', width: '7%', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productEntity.name', width: '8%', align: 'left', customRender: function (text) { return text || '--' } },
+        { title: '单位', dataIndex: 'productEntity.unit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '申请退货数量', dataIndex: 'qty', align: 'center', width: '7%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '仓库实收数量', dataIndex: 'receiveQty', align: 'center', width: '7%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '坏件数量', dataIndex: 'badQty', align: 'center', width: '6%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '良品数量', dataIndex: 'goodQty', align: 'center', width: '6%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '返库数量', dataIndex: 'backStockQty', align: 'center', width: '6%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '退货原因', dataIndex: 'returnReasonDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '参考退货单价', dataIndex: 'initialPrice', align: 'center', width: '7%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '参考退货金额', dataIndex: 'initialAmount', align: 'center', width: '7%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '实际退货单价', dataIndex: 'price', align: 'center', width: '7%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '实际退货金额', dataIndex: 'totalAmount', align: 'center', width: '7%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '实际退货单价说明', dataIndex: 'priceRemark', width: '8%', align: 'center', customRender: function (text) { return text || '--' } }
       ]
-      if (this.$hasPermissions('B_isShowPrice')) { //  售价权限
-        arr.splice(4, 0, { title: '售价', dataIndex: 'price', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
-        arr.splice(9, 0, { title: '退货金额小计', dataIndex: 'saleReturnSubtotal', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
-      }
       return arr
     }
   },

+ 51 - 9
src/views/salesReturnManagement/salesReturn/salesReturnEdit.vue

@@ -7,6 +7,34 @@
           <a id="salesReturnEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
           <span style="margin: 0 15px;color: #666;">客户名称:{{ ordeDetail&&ordeDetail.buyerName || '--' }}</span>
         </template>
+        <!-- 操作区,位于 title 行的行尾 -->
+        <template slot="extra">
+          <a-button
+            key="3"
+            type="default"
+            class="button-info"
+            id="salesReturnEdit-preview-btn"
+            v-if="$hasPermissions('B_salesReturnPrint')"
+            :disabled="chooseLoadData.length==0"
+            @click="handlePrint('preview')">打印预览</a-button>
+          <a-button
+            key="2"
+            type="primary"
+            class="button-info"
+            id="salesReturnEdit-print-btn"
+            v-if="$hasPermissions('B_salesReturnPrint')"
+            :disabled="chooseLoadData.length==0"
+            @click="handlePrint('print')">快捷打印</a-button>
+          <a-divider type="vertical" />
+          <a-button
+            key="1"
+            type="primary"
+            class="button-warning"
+            id="salesReturnEdit-export-btn"
+            v-if="$hasPermissions('B_salesReturnExport')"
+            :disabled="chooseLoadData.length==0"
+            @click="handlePrint('export')">导出Excel</a-button>
+        </template>
       </a-page-header>
       <a-card size="small" :bordered="false" class="salesReturnEdit-cont" v-show="ordeDetail&&ordeDetail.salesReturnBillSource=='SALES'">
         <!-- 查询配件列表 -->
@@ -27,12 +55,12 @@
               <a-row :gutter="15">
                 <a-col :md="6" :sm="24">
                   <a-form-item label="产品编码">
-                    <a-input v-model.trim="productForm.productEntity.code" allowClear placeholder="请输入产品编码"/>
+                    <a-input v-model.trim="productForm.productCode" allowClear placeholder="请输入产品编码"/>
                   </a-form-item>
                 </a-col>
                 <a-col :md="6" :sm="24">
                   <a-form-item label="产品名称">
-                    <a-input v-model.trim="productForm.productEntity.name" allowClear placeholder="请输入产品名称"/>
+                    <a-input v-model.trim="productForm.productName" allowClear placeholder="请输入产品名称"/>
                   </a-form-item>
                 </a-col>
                 <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
@@ -129,11 +157,12 @@
 <script>
 import { commonMixin } from '@/utils/mixin'
 import { STable, VSelect } from '@/components'
+import { printFun, exportExcel } from '@/libs/JGPrint.js'
 import ImportGuideModal from './importGuideModal.vue'
 import queryPart from './queryPart.vue'
 import EditableCell from '@/views/common/editInput.js'
 import chooseDepartUserModal from './chooseDepartUserModal.vue'
-import { salesReturnDetail, salesReturnSubmit, salesReturnBatchInsert } from '@/api/salesReturn'
+import { salesReturnDetail, salesReturnSubmit, salesReturnBatchInsert, salesReturnPrint, salesReturnExport } from '@/api/salesReturn'
 import {
   salesReturnDetailList,
   salesReturnDetailDel,
@@ -167,10 +196,8 @@ export default {
       dataSource: [],
       productForm: {
         salesReturnBillSn: '',
-        productEntity: {
-          name: '', // 产品名称
-          code: '' //  产品编码
-        }
+        productName: '',
+        productCode: ''
       },
       chooseLoadData: [],
       // 加载数据方法 必须为 Promise 对象
@@ -307,8 +334,8 @@ export default {
     },
     //  重置
     resetSearchForm (flag) {
-      this.productForm.productEntity.code = ''
-      this.productForm.productEntity.name = ''
+      this.productForm.productName = ''
+      this.productForm.productCode = ''
       this.$refs.table.refresh(!!flag)
       this.getOrderDetail()
     },
@@ -373,6 +400,21 @@ export default {
         }
       })
     },
+    // 打印预览/快捷打印
+    handlePrint (type) {
+      const _this = this
+      const params = { sn: this.$route.params.sn }
+      _this.spinning = true
+      // 导出
+      if (type == 'export') {
+        exportExcel(salesReturnExport, params, '销售退货', function () {
+          _this.spinning = false
+        })
+      } else {
+        // 打印或预览
+        printFun(salesReturnPrint, params, type, '销售退货', () => { _this.spinning = false })
+      }
+    },
     pageInit () {
       this.orderSn = this.$route.params.sn
       this.buyerSn = this.$route.params.buyerSn

+ 5 - 53
src/views/salesReturnManagement/salesReturn/verifyModal.vue

@@ -7,30 +7,15 @@
     v-model="isShow"
     @cancel="isShow=false"
     width="50%">
-    <p>说明:以下信息来自钉钉</p>
-    <a-spin :spinning="spinning" tip="Loading...">
-      <s-table
-        class="sTable fixPagination"
-        ref="table"
-        size="small"
-        :rowKey="(record) => record.id"
-        :columns="columns"
-        :data="loadData"
-        :scroll="{ y: 500 }"
-        :showPagination="false"
-        :defaultLoadData="true"
-        bordered>
-      </s-table>
-    </a-spin>
+    <auditDetail ref="auditDetail" businessType="SALES_RETURN" @loadError="isShow = false" :itemSn="itemSn"></auditDetail>
   </a-modal>
 </template>
 
 <script>
-import { STable } from '@/components'
-import { getProcessInstance } from '@/api/expenseManagement'
+import auditDetail from './auditDetail.vue'
 export default {
   name: 'VerifyModal',
-  components: { STable },
+  components: { auditDetail },
   props: {
     openModal: {
       type: Boolean,
@@ -43,36 +28,7 @@ export default {
   },
   data () {
     return {
-      spinning: false,
-      isShow: this.openModal,
-      columns: [{ title: '序号', dataIndex: 'no', width: '8%', align: 'center' },
-        { title: '人员姓名', width: '12%', dataIndex: 'userName', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '人员类型', dataIndex: 'userType', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '状态', dataIndex: 'state', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '审批意见', dataIndex: 'remark', width: '20%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '附件', dataIndex: 'hasAttachments', width: '20%', align: 'center', customRender: function (text) { return text != '0' ? '请在钉钉中查看附件内容' : '--' } },
-        { title: '操作时间', dataIndex: 'date', width: '20%', align: 'center', customRender: function (text) { return text || '--' } }],
-      // 加载数据方法 必须为 Promise 对象
-      loadData: parameter => {
-        this.spinning = true
-        delete parameter.tableId
-        delete parameter.index
-        return getProcessInstance({ businessType: 'SALES_RETURN', businessSn: this.itemSn }).then(res => {
-          let data
-          if (res.status == 200) {
-            data = res.data
-            const no = 0
-            for (var i = 0; i < data.length; i++) {
-              data[i].no = no + i + 1
-            }
-            this.disabled = false
-          } else {
-            this.isShow = false
-          }
-          this.spinning = false
-          return data
-        })
-      }
+      isShow: this.openModal
     }
   },
   watch: {
@@ -82,11 +38,7 @@ export default {
     isShow (nVal, oVal) {
       if (!nVal) {
         this.$emit('close')
-        this.$refs.table.clearTable()
-      } else {
-        this.$nextTick(() => {
-          this.$refs.table.refresh()
-        })
+        this.$refs.auditDetail.clearTable()
       }
     }
   }