lilei 3 年之前
父節點
當前提交
a4c856a58a

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

@@ -1033,12 +1033,13 @@ export const asyncRouterMap = [
                 }
               },
               {
-                path: 'add/:sn/:dealerLevel',
+                path: 'editGrap/:sn/:dealerLevel',
                 name: 'transferReturnGrpEdit',
                 component: () => import(/* webpackChunkName: "allocationManagement" */ '@/views/allocationManagement/transferReturn/editGrp.vue'),
                 meta: {
                   title: '编辑调拨退货单(抓单)',
                   icon: 'pull-request',
+                  replaceTab: true,
                   hidden: true
                 }
               },
@@ -1049,6 +1050,7 @@ export const asyncRouterMap = [
                 meta: {
                   title: '编辑调拨退货单(不抓单)',
                   icon: 'pull-request',
+                  replaceTab: true,
                   hidden: true
                 }
               },
@@ -1059,6 +1061,18 @@ export const asyncRouterMap = [
                 meta: {
                   title: '调拨退货单详情',
                   icon: 'pull-request',
+                  replaceTab: true,
+                  hidden: true
+                }
+              },
+              {
+                path: 'check/:sn/:grapFlag',
+                name: 'transferReturnCheck',
+                component: () => import(/* webpackChunkName: "allocationManagement" */ '@/views/allocationManagement/transferReturn/check.vue'),
+                meta: {
+                  title: '调拨退货品检',
+                  icon: 'fund',
+                  replaceTab: true,
                   hidden: true
                 }
               }

+ 278 - 0
src/views/allocationManagement/transferReturn/check.vue

@@ -0,0 +1,278 @@
+<template>
+  <div class="salesReturnCheck-wrap">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <a-page-header :ghost="false" :backIcon="false" class="salesReturnCheck-back" >
+        <!-- 自定义的二级文字标题 -->
+        <template slot="subTitle">
+          <a id="salesReturnCheck-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-card size="small" :bordered="false" class="salesReturnCheck-cont">
+        <div>
+          <a-button type="primary" :loading="loading" class="button-error" @click="backStock">批量返库</a-button>
+        </div>
+        <!-- 已选配件列表 -->
+        <s-table
+          class="sTable"
+          ref="table"
+          :style="{ height: tableHeight+84.5+'px' }"
+          size="small"
+          :rowKey="(record) => record.id"
+          :row-selection="{ columnWidth: 40 }"
+          @rowSelection="rowSelectionFun"
+          :columns="columns"
+          :data="loadData"
+          :scroll="{ y: tableHeight }"
+          :defaultLoadData="false"
+          bordered>
+          <!-- 返库数量 -->
+          <template slot="backStockQty" slot-scope="text, record">
+            <a-input-number
+              id="salesReturn-backStockQty"
+              size="small"
+              v-model="record.backStockQty"
+              :precision="0"
+              :min="0"
+              :max="record.qty"
+              placeholder="请输入"
+              @blur="e => onCellBlur(e.target.value, record)"
+              style="width: 100%;" />
+          </template>
+        </s-table>
+      </a-card>
+    </a-spin>
+    <div class="affix-cont">
+      <a-button
+        size="large"
+        style="padding: 0 60px;"
+        :disabled="spinning"
+        type="primary"
+        class="button-primary"
+        @click="handleSubmit()"
+        id="salesReturn-handleSubmit">提交</a-button>
+    </div>
+  </div>
+</template>
+
+<script>
+import { STable, VSelect } from '@/components'
+import { salesReturnDetail, salesReturnCheck } from '@/api/salesReturn'
+import {
+  salesReturnDetailList,
+  updateBackStockQty
+} from '@/api/salesReturnDetail'
+export default {
+  name: 'SalesReturnEdit',
+  components: {
+    STable,
+    VSelect
+  },
+  data () {
+    return {
+      spinning: false,
+      tableHeight: 0, // 表格高度
+      orderId: null,
+      orderSn: null,
+      buyerSn: null,
+      disabled: false,
+      isInster: false, // 是否正在添加产品
+      ordeDetail: { discountAmount: 0 },
+      loading: false,
+      // 已选产品
+      dataSource: [],
+      productForm: {
+        salesReturnBillSn: ''
+      },
+      chooseLoadData: [],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        // 查询总计
+        this.productForm.salesReturnBillSn = this.$route.params.sn
+        return salesReturnDetailList(Object.assign(parameter, this.productForm)).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].backStockQtyBackups = data.list[i].backStockQty
+            }
+            this.disabled = false
+            this.chooseLoadData = data.list
+          }
+          return data
+        })
+      },
+      rowSelectionInfo: null
+    }
+  },
+  computed: {
+    columns () {
+      const arr = [
+        { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
+        { title: '产品编码', dataIndex: 'productEntity.code', align: 'center', width: '23%', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productEntity.name', width: '25%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '退货数量', dataIndex: 'qty', 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: 'backStockQty', width: '10%', align: 'center', scopedSlots: { customRender: 'backStockQty' } },
+        { title: '单位', dataIndex: 'productEntity.unit', width: '8%', align: 'center', customRender: function (text) { return text || '--' } }
+        // { title: '售价', dataIndex: 'price', align: 'center', width: '10%', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
+      ]
+      if (this.$hasPermissions('B_isShowPrice')) { //  售价权限
+        arr.splice(7, 0, { title: '售价', dataIndex: 'price', align: 'center', width: '10%', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
+      }
+      return arr
+    }
+  },
+  methods: {
+    // 表格选中项
+    rowSelectionFun (obj) {
+      this.rowSelectionInfo = obj || null
+    },
+    //  返回
+    handleBack () {
+      this.$router.push({ path: '/salesManagement/salesReturn/list', query: { closeLastOldTab: true } })
+    },
+    // 批量返库
+    backStock () {
+      const _this = this
+      if (!_this.rowSelectionInfo || (_this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys.length < 1)) {
+        _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.submitCheck(obj)
+        }
+      })
+    },
+    // 已选产品  blur
+    onCellBlur (val, record) {
+      //  光标移出,值发生改变再调用编辑接口
+      if (val && val != record.backStockQtyBackups) {
+        this.submitCheck([{
+          salesReturnDetailSn: record.salesReturnDetailSn,
+          backStockQty: record.backStockQty
+        }])
+      } else {
+        record.backStockQty = record.backStockQtyBackups
+      }
+    },
+    // 品检
+    submitCheck (data) {
+      this.loading = true
+      this.spinning = true
+      updateBackStockQty(data).then(res => {
+        if (res.status == 200) {
+          this.resetSearchForm(true)
+          this.$message.success(res.message)
+        }
+        this.loading = false
+        this.spinning = false
+      })
+    },
+    // 重置列表
+    resetForm () {
+      this.$refs.table.refresh(true)
+    },
+    // 获取单据详细
+    getOrderDetail () {
+      salesReturnDetail({ sn: this.orderSn }).then(res => {
+        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
+        }
+      })
+    },
+    pageInit () {
+      const _this = this
+      this.$nextTick(() => { // 页面渲染完成后的回调
+        _this.setTableH()
+      })
+      this.orderSn = this.$route.params.sn
+      this.buyerSn = this.$route.params.buyerSn
+      this.getOrderDetail()
+    },
+    setTableH () {
+      this.tableHeight = window.innerHeight - 340
+    }
+  },
+  mounted () {
+    if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
+      this.$refs.table.refresh(true)
+      this.pageInit()
+    }
+  },
+  activated () {
+    // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
+    if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
+      this.$refs.table.refresh(true)
+      this.pageInit()
+    }
+  },
+  beforeRouteEnter (to, from, next) {
+    next(vm => {})
+  }
+}
+</script>
+
+<style lang="less">
+  .salesReturnCheck-wrap{
+    position: relative;
+    height: 100%;
+    padding-bottom: 51px;
+    box-sizing: border-box;
+    >.ant-spin-nested-loading{
+      overflow-y: scroll;
+      height: 100%;
+    }
+    .salesReturnCheck-cont{
+      margin-top: 10px;
+      .sTable{
+        margin-top: 10px;
+      }
+      .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>

+ 1 - 4
src/views/allocationManagement/transferReturn/detail.vue

@@ -77,8 +77,6 @@
         </s-table>
       </a-card>
     </a-spin>
-    <!-- 打印导出 -->
-    <print-modal :openModal="openModal" :itemData="basicInfoData" :nowType="nowType" @ok="handleOk" @close="openModal=false" />
     <!-- 打印 -->
     <div id="print"></div>
   </div>
@@ -86,11 +84,10 @@
 
 <script>
 import { STable, VSelect } from '@/components'
-import printModal from './printModal.vue'
 import { hdExportExcel } from '@/libs/exportExcel'
 import { allocateBillDetailList, allocateBillDetail, allocateBillDetailCount, allocateBillDetailPrint, allocateBillDetailExcel } from '@/api/allocateBill'
 export default {
-  components: { STable, VSelect, printModal },
+  components: { STable, VSelect },
   props: {
     outBizSn: { //  有值则为弹框,无值则为页面
       type: [Number, String],

+ 134 - 208
src/views/allocationManagement/transferReturn/edit.vue

@@ -9,47 +9,23 @@
         </template>
         <!-- 操作区,位于 title 行的行尾 -->
         <template slot="extra">
-          <a-button
-            key="3"
-            type="primary"
-            class="button-warning"
-            v-if="$hasPermissions('B_transferOut_detail_export')"
-            id="allocateBillEdit-export-btn"
-            :disabled="localDataSource.length==0"
-            @click="handleExcel">导出Excel</a-button>
-          <a-button
-            key="2"
-            type="primary"
-            class="button-error"
-            v-if="$hasPermissions('B_transferOut_print')"
-            id="allocateBillEdit-db-print-btn"
-            :disabled="localDataSource.length==0"
-            @click="handlePrint('dbPrint')">调拨打印</a-button>
-          <a-button
-            key="1"
-            type="primary"
-            class="button-info"
-            v-if="$hasPermissions('B_transferOut_print')"
-            id="allocateBillEdit-dbfl-print-btn"
-            :disabled="localDataSource.length==0"
-            @click="handlePrint('dbflPrint')">调拨分类打印</a-button>
+          <print :params="{allocateSn: $route.params.sn}" :disabled="localDataSource.length==0" @loading="spinning=true" @unloading="spinning=false"></print>
         </template>
       </a-page-header>
       <a-card size="small" :bordered="false" v-if="basicInfoData" class="allocateBillEdit-cont">
         <a-collapse :activeKey="['0']">
           <a-collapse-panel key="0" header="基础信息">
             <a-descriptions :column="3">
-              <a-descriptions-item label="调对象">{{ (basicInfoData&&basicInfoData.targetName) || '--' }}</a-descriptions-item>
-              <a-descriptions-item label="调拨单号">{{ (basicInfoData&&basicInfoData.allocateNo) || '--' }}</a-descriptions-item>
-              <a-descriptions-item label="调拨类型">
+              <a-descriptions-item label="调拨退货对象">{{ (basicInfoData&&basicInfoData.targetName) || '--' }}</a-descriptions-item>
+              <a-descriptions-item label="调拨退货对象名称">{{ (basicInfoData&&basicInfoData.allocateNo) || '--' }}</a-descriptions-item>
+              <a-descriptions-item label="调拨退货类型">
                 <AllocateType id="allocateEdit-allocateTypeSn" style="width: 200px;" @change="changeAllocateType" v-model="basicInfoData.allocateTypeSn"></AllocateType>
               </a-descriptions-item>
-              <a-descriptions-item label="业务状态">{{ (basicInfoData&&basicInfoData.stateDictValue) || '--' }}</a-descriptions-item>
-              <a-descriptions-item label="起止时间">
-                <span v-if="basicInfoData&&(basicInfoData.promoStartDate || basicInfoData.promoEndDate)">{{ (basicInfoData&&basicInfoData.promoStartDate) || '--' }} ~ {{ (basicInfoData&&basicInfoData.promoEndDate) || '--' }}</span>
-                <span v-else>--</span>
+              <a-descriptions-item label="是否抓单">{{ (basicInfoData&&basicInfoData.allocateNo) || '--' }}</a-descriptions-item>
+              <a-descriptions-item label="备注">
+                {{ (basicInfoData&&basicInfoData.remark) || '--' }}
+                <a-icon type="form" title="编辑备注" @click="editRemark = true" style="color: dodgerblue;font-size: 14px;" />
               </a-descriptions-item>
-              <a-descriptions-item label="备注">{{ (basicInfoData&&basicInfoData.remark) || '--' }}</a-descriptions-item>
             </a-descriptions>
           </a-collapse-panel>
         </a-collapse>
@@ -72,11 +48,6 @@
                       <a-input id="allocateBillEdit-productName" v-model.trim="queryParam.productName" placeholder="请输入产品名称" allowClear />
                     </a-form-item>
                   </a-col>
-                  <a-col :md="6" :sm="24">
-                    <a-form-item label="原厂编码" prop="productOrigCode">
-                      <a-input id="allocateBillEdit-productOrigCode" v-model.trim="queryParam.productOrigCode" placeholder="请输入原厂编码" allowClear />
-                    </a-form-item>
-                  </a-col>
                   <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
                     <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="storeTransferOutList-refresh">查询</a-button>
                     <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="storeTransferOutList-reset">重置</a-button>
@@ -98,8 +69,34 @@
               :scroll="{ y: 300 }"
               :defaultLoadData="false"
               bordered>
+              <!-- 退货单价 -->
+              <template slot="returnPrice" slot-scope="text, record">
+                <div @dblclick.stop>
+                  <a-input-number
+                    size="small"
+                    v-model="record.productPrice"
+                    :precision="2"
+                    :min="0"
+                    :max="999999"
+                    placeholder="请输入"
+                    style="width: 100%;" />
+                </div>
+              </template>
+              <!-- 退货数量 -->
+              <template slot="returnQty" slot-scope="text, record">
+                <div @dblclick.stop>
+                  <a-input-number
+                    size="small"
+                    v-model="record.qty"
+                    :precision="0"
+                    :min="0"
+                    :max="999999"
+                    placeholder="请输入"
+                    style="width: 100%;" />
+                </div>
+              </template>
               <!-- 操作 -->
-              <template slot="action1" slot-scope="text, record">
+              <template slot="action" slot-scope="text, record">
                 <a-button size="small" type="primary" class="button-primary" @click="handleAdd(record)" id="allocateBillEdit-add-btn">添加</a-button>
               </template>
             </s-table>
@@ -113,9 +110,8 @@
             <!-- 总计 -->
             <a-alert type="info" style="margin-bottom:10px">
               <div slot="message">
-                总数量:<strong>{{ (productTotal&&(productTotal.totalQty || productTotal.totalQty==0)) ? productTotal.totalQty : '--' }}</strong> ,
-                <span v-if="$hasPermissions('B_isShowCost')">总成本(¥):<strong>{{ (productTotal&&(productTotal.totalCost || productTotal.totalCost==0)) ? productTotal.totalCost : '--' }}</strong> ,</span>
-                <span v-if="$hasPermissions('B_isShowPrice')">总售价(¥):<strong>{{ (productTotal&&(productTotal.totalPrice || productTotal.totalPrice==0)) ? productTotal.totalPrice : '--' }}</strong></span>
+                退货总数量:<strong>{{ (productTotal&&(productTotal.totalQty || productTotal.totalQty==0)) ? productTotal.totalQty : '--' }}</strong> ,
+                <span>退货总金额(¥):<strong>{{ (productTotal&&(productTotal.totalPrice || productTotal.totalPrice==0)) ? productTotal.totalPrice : '--' }}</strong></span>
               </div>
             </a-alert>
             <!-- 筛选条件 -->
@@ -143,8 +139,8 @@
                 </div>
               </a-col>
               <a-col :span="7" style="text-align: right;">
-                <a-button size="small" id="allocateBillEdit-import-btn" @click="openGuideModal=true">导入产品</a-button>
-                <a-button size="small" type="danger" style="margin-left: 5px" @click.stop="handleDel('', 'all')" id="chainTransferOutEdit-del-all-btn">整单删除</a-button>
+                <!-- <a-button size="small" id="allocateBillEdit-import-btn" @click="openGuideModal=true">导入产品</a-button> -->
+                <!-- <a-button size="small" type="danger" style="margin-left: 5px" @click.stop="handleDel('', 'all')" id="chainTransferOutEdit-del-all-btn">整单删除</a-button> -->
               </a-col>
             </a-row>
             <!-- 列表 -->
@@ -160,38 +156,28 @@
               :scroll="{ y: 300 }"
               :defaultLoadData="false"
               bordered>
-              <!-- 售价 -->
-              <template slot="price" slot-scope="text, record, index">
-                <!-- 调往对象为经销商时不可编辑售价,为员工或其他时可编辑售价 -->
-                <div v-if="$route.params.dealerLevel == 'OTHER'">
-                  <a-select
-                    size="small"
-                    id="allocateBillEdit-price"
-                    option-label-prop="label"
-                    v-model="record.price"
-                    placeholder="请选择"
-                    @change="e => priceChange(e, record)"
-                    @focus="e => priceFocus(record, index)"
-                    style="width: 100%;">
-                    <a-select-option v-if="record.cost" :value="record.cost" :key="'cb-'+record.cost" :label="record.cost">成本 {{ record.cost }}</a-select-option>
-                    <a-select-option v-if="loadDataSource&&loadDataSource[index]&&loadDataSource[index].provincePrice" :value="loadDataSource[index].provincePrice" :key="'A-'+loadDataSource[index].productSn" :label="loadDataSource[index].provincePrice">A价 {{ loadDataSource[index].provincePrice }}</a-select-option>
-                    <a-select-option v-if="loadDataSource&&loadDataSource[index]&&loadDataSource[index].cityPrice" :value="loadDataSource[index].cityPrice" :key="'B-'+loadDataSource[index].productSn" :label="loadDataSource[index].cityPrice">B价 {{ loadDataSource[index].cityPrice }}</a-select-option>
-                    <a-select-option v-if="loadDataSource&&loadDataSource[index]&&loadDataSource[index].specialPrice" :value="loadDataSource[index].specialPrice" :key="'C-'+loadDataSource[index].productSn" :label="loadDataSource[index].specialPrice">C价 {{ loadDataSource[index].specialPrice }}</a-select-option>
-                  </a-select>
-                </div>
-                <span v-else>{{ record.price }}</span>
+              <!-- 退货单价 -->
+              <template slot="returnPrice" slot-scope="text, record">
+                <a-input-number
+                  size="small"
+                  v-model="record.price"
+                  :precision="2"
+                  :min="0"
+                  :max="999999"
+                  @blur="e => priceChange(e.target.value, record)"
+                  placeholder="请输入"
+                  style="width: 100%;" />
               </template>
-              <!-- 调出数量 -->
-              <template slot="qty" slot-scope="text, record">
+              <!-- 退货数量 -->
+              <template slot="returnQty" slot-scope="text, record">
                 <a-input-number
                   size="small"
-                  id="allocateBillEdit-qty"
                   v-model="record.qty"
                   :precision="0"
-                  :min="1"
+                  :min="0"
                   :max="999999"
-                  placeholder="请输入"
                   @blur="e => qtyBlur(e.target.value, record)"
+                  placeholder="请输入"
                   style="width: 100%;" />
               </template>
               <!-- 操作 -->
@@ -215,26 +201,42 @@
         style="padding: 0 60px;">提交</a-button>
     </div>
     <!-- 导入产品 -->
-    <importGuideModal :openModal="openGuideModal" :params="{allocateSn: $route.params.sn}" @close="openGuideModal=false" @ok="handleGuideOk" />
-    <!-- 打印导出 -->
-    <print-modal :openModal="openModal" :itemData="basicInfoData" :nowType="nowType" @ok="handleOk" @close="openModal=false" />
-    <!-- 打印 -->
-    <div id="print"></div>
+    <!-- <importGuideModal :openModal="openGuideModal" :params="{allocateSn: $route.params.sn}" @close="openGuideModal=false" @ok="handleGuideOk" /> -->
+    <!-- 修改基础信息 -->
+    <a-modal
+      centered
+      wrapClassName="allocateBill-editRemark-modal"
+      v-if="basicInfoData"
+      :footer="null"
+      :maskClosable="false"
+      title="修改备注"
+      v-model="editRemark"
+      @cancle="editRemark = false"
+      :width="600">
+      <a-textarea
+        v-model="basicInfoData.remark"
+        placeholder="请输入备注(最多120个字符)"
+        :maxLength="120"
+        :auto-size="{ minRows: 3, maxRows: 5 }"
+      />
+      <div class="btn-cont">
+        <a-button type="primary" id="allocateBill-basicInfo-modal-save" @click="handleEditRemark">保存</a-button>
+        <a-button id="allocateBill-basicInfo-modal-back" @click="editRemark = false" style="margin-left: 15px;">取消</a-button>
+      </div>
+    </a-modal>
   </div>
 </template>
 
 <script>
 import { STable, VSelect } from '@/components'
-import ImportGuideModal from './importGuideModal.vue'
-import printModal from './printModal.vue'
-import { hdExportExcel } from '@/libs/exportExcel'
+// import ImportGuideModal from './importGuideModal.vue'
+import print from './print.vue'
 import { queryStockProductPage } from '@/api/stock'
-import { productPriceInfo } from '@/api/product'
 import AllocateType from '@/views/common/allocateType.js'
-import { allocateBillSave, allocateBillDetailList, allocateBillDetailCount, allocateBillDetail, allocateBillDetailSave, allocateBillSubmit, allocateBillDetailDel, allocateBillDetailDelAll, allocateBillDetailPrint, allocateBillBatchInsert, allocateBillDetailExcel } from '@/api/allocateBill'
+import { allocateBillSave, allocateBillDetailList, allocateBillDetailCount, allocateBillDetail, allocateBillDetailSave, allocateBillSubmit, allocateBillDetailDel, allocateBillDetailDelAll, allocateBillBatchInsert } from '@/api/allocateBill'
 
 export default {
-  components: { STable, VSelect, ImportGuideModal, AllocateType, printModal },
+  components: { STable, VSelect, print, AllocateType },
   data () {
     return {
       spinning: false,
@@ -247,14 +249,11 @@ export default {
         productCode: '',
         productName: ''
       },
+      editRemark: false,
       disabled: false, //  查询、重置按钮是否可操作
       loading: false,
       chooseDisabled: false, //  查询、重置按钮是否可操作
       advanced: false, // 高级搜索 展开/关闭
-      productBrandList: [], //  产品品牌  下拉数据
-      productTypeList: [], //  产品分类  下拉数据
-      productType: [],
-      warehouseList: [], //  仓库  下拉数据
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
@@ -264,6 +263,7 @@ export default {
           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].qty = 1
           }
           this.loadDataSource = data.list || []
           this.disabled = false
@@ -272,6 +272,25 @@ export default {
       },
       loadDataSource: [],
       localDataSource: [],
+      columns: [
+        { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
+        { title: '产品编码', dataIndex: 'productCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productName', align: 'center', width: '29%', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '单位', dataIndex: 'productUnit', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '退货单价', scopedSlots: { customRender: 'returnPrice' }, width: '10%', align: 'center' },
+        { title: '退货数量', scopedSlots: { customRender: 'returnQty' }, width: '10%', align: 'center' },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
+      ],
+      chooseColumns: [
+        { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
+        { title: '产品编码', dataIndex: 'productEntity.code', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productEntity.name', align: 'center', width: '29%', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '单位', dataIndex: 'productEntity.unit', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '退货单价', scopedSlots: { customRender: 'returnPrice' }, width: '10%', align: 'center' },
+        { title: '退货数量', scopedSlots: { customRender: 'returnQty' }, width: '10%', align: 'center' },
+        { title: '退货金额', dataIndex: 'returnAmount', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
+      ],
       // 加载数据方法 必须为 Promise 对象
       chooseLoadData: parameter => {
         this.chooseDisabled = true
@@ -297,76 +316,37 @@ export default {
       nowType: null
     }
   },
-  computed: {
-    columns () {
-      const arr = [
-        { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
-        { title: '产品编码', dataIndex: 'productCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'productName', align: 'center', width: '29%', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '原厂编码', dataIndex: 'productOrigCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
-        // { title: '成本价', dataIndex: 'lastStockCost', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        // { title: '售价', dataIndex: 'productPrice', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '库存数量', dataIndex: 'currentStockQty', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '单位', dataIndex: 'productUnit', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '操作', scopedSlots: { customRender: 'action1' }, width: '10%', align: 'center' }
-      ]
-      if (this.$hasPermissions('B_isShowCost')) { //  成本价权限
-        arr.splice(4, 0, { title: '成本价', dataIndex: 'lastStockCost', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
-      }
-      if (this.$hasPermissions('B_isShowPrice')) { //  售价权限
-        const ind = this.$hasPermissions('B_isShowCost') ? 5 : 4
-        arr.splice(ind, 0, { title: '售价', dataIndex: 'productPrice', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
-      }
-      return arr
-    },
-    chooseColumns () {
-      const arr = [
-        { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
-        { title: '产品编码', dataIndex: 'productEntity.code', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'productEntity.name', width: '20%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '原厂编码', dataIndex: 'productEntity.origCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
-        // { title: '成本价', dataIndex: 'cost', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        // { title: '售价', scopedSlots: { customRender: 'price' }, width: '10%', align: 'center' },
-        { title: '库存数量', dataIndex: 'currentStockQty', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '调出数量', scopedSlots: { customRender: 'qty' }, width: '10%', align: 'center' },
-        { title: '单位', dataIndex: 'productEntity.unit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '操作', scopedSlots: { customRender: 'action' }, width: '6%', align: 'center' }
-      ]
-      if (this.$hasPermissions('B_isShowCost')) { //  成本价权限
-        arr.splice(4, 0, { title: '成本价', dataIndex: 'cost', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
-      }
-      if (this.$hasPermissions('B_isShowPrice')) { //  售价权限
-        const ind = this.$hasPermissions('B_isShowCost') ? 5 : 4
-        arr.splice(ind, 0, { title: '售价', scopedSlots: { customRender: 'price' }, width: '10%', align: 'center' })
-      }
-      return arr
-    }
-  },
   methods: {
+    // 修改备注
+    handleEditRemark () {
+      const _this = this
+      const params = _this.basicInfoData
+      allocateBillSave({
+        allocateSn: params.allocateSn,
+        targetType: params.targetType,
+        targetSn: params.targetSn,
+        targetName: params.targetName,
+        allocateTypeSn: params.allocateTypeSn,
+        remark: params.remark
+      }).then(res => {
+        if (res.status == 200) {
+          _this.$message.success(res.message)
+          _this.getDetail()
+        } else {
+          _this.spinning = false
+        }
+      })
+      _this.editRemark = false
+    },
     // 修改调拨类型
     changeAllocateType (val) {
       const _this = this
       this.$confirm({
         title: '提示',
-        content: '确定要更改调拨类型吗?',
+        content: '确定要更改调拨退货类型吗?',
         centered: true,
         onOk () {
-          const params = _this.basicInfoData
-          allocateBillSave({
-            allocateSn: params.allocateSn,
-            targetType: params.targetType,
-            targetSn: params.targetSn,
-            targetName: params.targetName,
-            allocateTypeSn: params.allocateTypeSn,
-            remark: params.remark
-          }).then(res => {
-            if (res.status == 200) {
-              _this.$message.success(res.message)
-              _this.getDetail()
-            } else {
-              _this.spinning = false
-            }
-          })
+          _this.handleEditRemark()
         }
       })
     },
@@ -503,82 +483,22 @@ export default {
     },
     //  返回列表
     handleBack () {
-      this.$router.push({ path: '/allocationManagement/transferOut/list', query: { closeLastOldTab: true } })
+      this.$router.push({ name: 'transferReturnList', query: { closeLastOldTab: true } })
     },
-    // 已选产品 调出数量  blur
+    // 已选产品 退货数量  blur
     qtyBlur (val, record) {
       //  光标移出,值发生改变再调用编辑接口
       if (val != record.qtyBackups) {
         this.handleAdd(record, 'edit')
       }
     },
-    // 已选产品 价  change
+    // 已选产品 退货单价  change
     priceChange (val, record) {
       //  光标移出,值发生改变再调用编辑接口
       if (val != record.priceBackups) {
         this.handleAdd(record, 'edit', 'noRefresh')
       }
     },
-    // 获取价格
-    priceFocus (row, index) {
-      if (row.productSn) {
-        productPriceInfo({ sn: row.productSn }).then(res => {
-          if (res.status == 200 && res.data) {
-            this.loadDataSource[index].provincePrice = res.data.provincePrice || undefined
-            this.loadDataSource[index].cityPrice = res.data.cityPrice || undefined
-            this.loadDataSource[index].specialPrice = res.data.specialPrice || undefined
-          }
-        })
-      }
-    },
-    // 导出
-    handleExcel () {
-      const _this = this
-      this.spinning = true
-      hdExportExcel(allocateBillDetailExcel, { allocateSn: this.$route.params.sn }, '调拨明细', function () {
-        _this.spinning = false
-      })
-    },
-    // 打印预览/快捷打印
-    handlePrint (type) {
-      this.nowType = type
-      this.openModal = true
-    },
-    handleOk (objs) {
-      const _this = this
-      const params = JSON.parse(JSON.stringify(objs))
-      delete params.type
-      _this.spinning = true
-      allocateBillDetailPrint(params).then(res => {
-        _this.spinning = false
-        if (res.type == 'application/json') {
-          var reader = new FileReader()
-          reader.addEventListener('loadend', function () {
-            const obj = JSON.parse(reader.result)
-            _this.$notification.error({
-              message: '提示',
-              description: obj.message
-            })
-          })
-          reader.readAsText(res)
-        } else {
-          this.print(res, objs.isPreview)
-        }
-      })
-    },
-    print (data, type) {
-      if (!data) {
-        return
-      }
-      const url = window.URL.createObjectURL(new Blob([data], { type: 'application/pdf' }))
-      document.getElementById('print').innerHTML = '<iframe id="printftoe" name="printftoe" src="' + url + '" hidden></iframe>'
-      if (type == '1') { //  预览
-        window.open(url)
-      } else if (type == '0') { //  打印
-        window.frames['printftoe'].focus()
-        window.frames['printftoe'].print()
-      }
-    },
     // 刷新当前页面
     refashPage () {
       this.$refs.table.refresh()
@@ -642,4 +562,10 @@ export default {
       }
     }
   }
+  .allocateBill-editRemark-modal{
+    .btn-cont{
+      text-align: center;
+      padding-top: 20px;
+    }
+  }
 </style>

+ 130 - 214
src/views/allocationManagement/transferReturn/editGrp.vue

@@ -1,61 +1,37 @@
 <template>
-  <div class="allocateBillEdit-wrap">
+  <div class="editGrap-wrap">
     <!-- <a-spin :spinning="spinning" tip="Loading..."> -->
     <div class="ant-spin-nested-loading">
-      <a-page-header :ghost="false" :backIcon="false" class="allocateBillEdit-back" >
+      <a-page-header :ghost="false" :backIcon="false" class="editGrap-back" >
         <!-- 自定义的二级文字标题 -->
         <template slot="subTitle">
-          <a id="allocateBillEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
+          <a id="editGrap-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
         </template>
         <!-- 操作区,位于 title 行的行尾 -->
         <template slot="extra">
-          <a-button
-            key="3"
-            type="primary"
-            class="button-warning"
-            v-if="$hasPermissions('B_transferOut_detail_export')"
-            id="allocateBillEdit-export-btn"
-            :disabled="localDataSource.length==0"
-            @click="handleExcel">导出Excel</a-button>
-          <a-button
-            key="2"
-            type="primary"
-            class="button-error"
-            v-if="$hasPermissions('B_transferOut_print')"
-            id="allocateBillEdit-db-print-btn"
-            :disabled="localDataSource.length==0"
-            @click="handlePrint('dbPrint')">调拨打印</a-button>
-          <a-button
-            key="1"
-            type="primary"
-            class="button-info"
-            v-if="$hasPermissions('B_transferOut_print')"
-            id="allocateBillEdit-dbfl-print-btn"
-            :disabled="localDataSource.length==0"
-            @click="handlePrint('dbflPrint')">调拨分类打印</a-button>
+          <print :params="{allocateSn: $route.params.sn}" :disabled="localDataSource.length==0" @loading="spinning=true" @unloading="spinning=false"></print>
         </template>
       </a-page-header>
-      <a-card size="small" :bordered="false" v-if="basicInfoData" class="allocateBillEdit-cont">
+      <a-card size="small" :bordered="false" v-if="basicInfoData" class="editGrap-cont">
         <a-collapse :activeKey="['0']">
           <a-collapse-panel key="0" header="基础信息">
             <a-descriptions :column="3">
-              <a-descriptions-item label="调对象">{{ (basicInfoData&&basicInfoData.targetName) || '--' }}</a-descriptions-item>
-              <a-descriptions-item label="调拨单号">{{ (basicInfoData&&basicInfoData.allocateNo) || '--' }}</a-descriptions-item>
-              <a-descriptions-item label="调拨类型">
+              <a-descriptions-item label="调拨退货对象">{{ (basicInfoData&&basicInfoData.targetName) || '--' }}</a-descriptions-item>
+              <a-descriptions-item label="调拨退货对象名称">{{ (basicInfoData&&basicInfoData.targetName) || '--' }}</a-descriptions-item>
+              <a-descriptions-item label="调拨退货类型">
                 <AllocateType id="allocateEdit-allocateTypeSn" style="width: 200px;" @change="changeAllocateType" v-model="basicInfoData.allocateTypeSn"></AllocateType>
               </a-descriptions-item>
-              <a-descriptions-item label="业务状态">{{ (basicInfoData&&basicInfoData.stateDictValue) || '--' }}</a-descriptions-item>
-              <a-descriptions-item label="起止时间">
-                <span v-if="basicInfoData&&(basicInfoData.promoStartDate || basicInfoData.promoEndDate)">{{ (basicInfoData&&basicInfoData.promoStartDate) || '--' }} ~ {{ (basicInfoData&&basicInfoData.promoEndDate) || '--' }}</span>
-                <span v-else>--</span>
+              <a-descriptions-item label="是否抓单">{{ (basicInfoData&&basicInfoData.allocateNo) || '--' }}</a-descriptions-item>
+              <a-descriptions-item label="备注">
+                {{ (basicInfoData&&basicInfoData.remark) }}
+                <a-icon type="form" title="编辑备注" @click="editRemark = true" style="color: dodgerblue;font-size: 14px;" />
               </a-descriptions-item>
-              <a-descriptions-item label="备注">{{ (basicInfoData&&basicInfoData.remark) || '--' }}</a-descriptions-item>
             </a-descriptions>
           </a-collapse-panel>
         </a-collapse>
       </a-card>
       <!-- 选择产品 -->
-      <a-card size="small" :bordered="false" class="allocateBillEdit-cont">
+      <a-card size="small" :bordered="false" class="editGrap-cont">
         <a-collapse :activeKey="['1']">
           <a-collapse-panel key="1" :forceRender="true" header="选择产品">
             <!-- 筛选条件 -->
@@ -63,18 +39,18 @@
               <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
                 <a-row :gutter="15">
                   <a-col :md="6" :sm="24">
-                    <a-form-item label="产品编码" prop="productCode">
-                      <a-input id="allocateBillEdit-productCode" v-model.trim="queryParam.productCode" placeholder="请输入产品编码" allowClear />
+                    <a-form-item label="调拨单号" prop="productOrigCode">
+                      <a-input id="editGrap-productOrigCode" v-model.trim="queryParam.productOrigCode" placeholder="请输入调拨单号" allowClear />
                     </a-form-item>
                   </a-col>
                   <a-col :md="6" :sm="24">
-                    <a-form-item label="产品名称" prop="productName">
-                      <a-input id="allocateBillEdit-productName" v-model.trim="queryParam.productName" placeholder="请输入产品名称" allowClear />
+                    <a-form-item label="产品编码" prop="productCode">
+                      <a-input id="editGrap-productCode" v-model.trim="queryParam.productCode" placeholder="请输入产品编码" allowClear />
                     </a-form-item>
                   </a-col>
                   <a-col :md="6" :sm="24">
-                    <a-form-item label="原厂编码" prop="productOrigCode">
-                      <a-input id="allocateBillEdit-productOrigCode" v-model.trim="queryParam.productOrigCode" placeholder="请输入原厂编码" allowClear />
+                    <a-form-item label="产品名称" prop="productName">
+                      <a-input id="editGrap-productName" v-model.trim="queryParam.productName" placeholder="请输入产品名称" allowClear />
                     </a-form-item>
                   </a-col>
                   <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
@@ -98,24 +74,36 @@
               :scroll="{ y: 300 }"
               :defaultLoadData="false"
               bordered>
+              <!-- 退货单价 -->
+              <template slot="returnPrice" slot-scope="text, record">
+                <div @dblclick.stop>
+                  <a-input-number
+                    size="small"
+                    v-model="record.returnPrice"
+                    :precision="2"
+                    :min="0"
+                    :max="999999"
+                    placeholder="请输入"
+                    style="width: 100%;" />
+                </div>
+              </template>
               <!-- 操作 -->
-              <template slot="action1" slot-scope="text, record">
-                <a-button size="small" type="primary" class="button-primary" @click="handleAdd(record)" id="allocateBillEdit-add-btn">添加</a-button>
+              <template slot="action" slot-scope="text, record">
+                <a-button size="small" type="primary" class="button-primary" @click="handleAdd(record)" id="editGrap-add-btn">添加</a-button>
               </template>
             </s-table>
           </a-collapse-panel>
         </a-collapse>
       </a-card>
       <!-- 已选产品 -->
-      <a-card size="small" :bordered="false" class="allocateBillEdit-cont">
+      <a-card size="small" :bordered="false" class="editGrap-cont">
         <a-collapse :activeKey="['2']">
           <a-collapse-panel key="2" :forceRender="true" header="已选产品">
             <!-- 总计 -->
             <a-alert type="info" style="margin-bottom:10px">
               <div slot="message">
-                总数量:<strong>{{ (productTotal&&(productTotal.totalQty || productTotal.totalQty==0)) ? productTotal.totalQty : '--' }}</strong> ,
-                <span v-if="$hasPermissions('B_isShowCost')">总成本(¥):<strong>{{ (productTotal&&(productTotal.totalCost || productTotal.totalCost==0)) ? productTotal.totalCost : '--' }}</strong> ,</span>
-                <span v-if="$hasPermissions('B_isShowPrice')">总售价(¥):<strong>{{ (productTotal&&(productTotal.totalPrice || productTotal.totalPrice==0)) ? productTotal.totalPrice : '--' }}</strong></span>
+                退货总数量:<strong>{{ (productTotal&&(productTotal.totalQty || productTotal.totalQty==0)) ? productTotal.totalQty : '--' }}</strong> ,
+                <span v-if="$hasPermissions('B_isShowPrice')">退货总金额(¥):<strong>{{ (productTotal&&(productTotal.totalPrice || productTotal.totalPrice==0)) ? productTotal.totalPrice : '--' }}</strong></span>
               </div>
             </a-alert>
             <!-- 筛选条件 -->
@@ -126,12 +114,12 @@
                     <a-row :gutter="15">
                       <a-col :md="9" :sm="24">
                         <a-form-item label="产品编码" prop="productCode">
-                          <a-input id="allocateBillEdit-productCode" v-model.trim="chooseQueryParam.productCode" placeholder="请输入产品编码" allowClear />
+                          <a-input id="editGrap-productCode" v-model.trim="chooseQueryParam.productCode" placeholder="请输入产品编码" allowClear />
                         </a-form-item>
                       </a-col>
                       <a-col :md="9" :sm="24">
                         <a-form-item label="产品名称" prop="productName">
-                          <a-input id="allocateBillEdit-productName" v-model.trim="chooseQueryParam.productName" placeholder="请输入产品名称" allowClear />
+                          <a-input id="editGrap-productName" v-model.trim="chooseQueryParam.productName" placeholder="请输入产品名称" allowClear />
                         </a-form-item>
                       </a-col>
                       <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
@@ -143,8 +131,8 @@
                 </div>
               </a-col>
               <a-col :span="7" style="text-align: right;">
-                <a-button size="small" id="allocateBillEdit-import-btn" @click="openGuideModal=true">导入产品</a-button>
-                <a-button size="small" type="danger" style="margin-left: 5px" @click.stop="handleDel('', 'all')" id="chainTransferOutEdit-del-all-btn">整单删除</a-button>
+                <!-- <a-button size="small" id="editGrap-import-btn" @click="openGuideModal=true">导入产品</a-button> -->
+                <!-- <a-button size="small" type="danger" style="margin-left: 5px" @click.stop="handleDel('', 'all')" id="chainTransferOutEdit-del-all-btn">整单删除</a-button> -->
               </a-col>
             </a-row>
             <!-- 列表 -->
@@ -160,43 +148,21 @@
               :scroll="{ y: 300 }"
               :defaultLoadData="false"
               bordered>
-              <!-- 售价 -->
-              <template slot="price" slot-scope="text, record, index">
-                <!-- 调往对象为经销商时不可编辑售价,为员工或其他时可编辑售价 -->
-                <div v-if="$route.params.dealerLevel == 'OTHER'">
-                  <a-select
-                    size="small"
-                    id="allocateBillEdit-price"
-                    option-label-prop="label"
-                    v-model="record.price"
-                    placeholder="请选择"
-                    @change="e => priceChange(e, record)"
-                    @focus="e => priceFocus(record, index)"
-                    style="width: 100%;">
-                    <a-select-option v-if="record.cost" :value="record.cost" :key="'cb-'+record.cost" :label="record.cost">成本 {{ record.cost }}</a-select-option>
-                    <a-select-option v-if="loadDataSource&&loadDataSource[index]&&loadDataSource[index].provincePrice" :value="loadDataSource[index].provincePrice" :key="'A-'+loadDataSource[index].productSn" :label="loadDataSource[index].provincePrice">A价 {{ loadDataSource[index].provincePrice }}</a-select-option>
-                    <a-select-option v-if="loadDataSource&&loadDataSource[index]&&loadDataSource[index].cityPrice" :value="loadDataSource[index].cityPrice" :key="'B-'+loadDataSource[index].productSn" :label="loadDataSource[index].cityPrice">B价 {{ loadDataSource[index].cityPrice }}</a-select-option>
-                    <a-select-option v-if="loadDataSource&&loadDataSource[index]&&loadDataSource[index].specialPrice" :value="loadDataSource[index].specialPrice" :key="'C-'+loadDataSource[index].productSn" :label="loadDataSource[index].specialPrice">C价 {{ loadDataSource[index].specialPrice }}</a-select-option>
-                  </a-select>
-                </div>
-                <span v-else>{{ record.price }}</span>
-              </template>
-              <!-- 调出数量 -->
-              <template slot="qty" slot-scope="text, record">
+              <!-- 退货单价 -->
+              <template slot="returnPrice" slot-scope="text, record">
                 <a-input-number
                   size="small"
-                  id="allocateBillEdit-qty"
-                  v-model="record.qty"
-                  :precision="0"
-                  :min="1"
+                  v-model="record.returnPrice"
+                  @blur="e => priceChange(e.target.value, record)"
+                  :precision="2"
+                  :min="0"
                   :max="999999"
                   placeholder="请输入"
-                  @blur="e => qtyBlur(e.target.value, record)"
                   style="width: 100%;" />
               </template>
               <!-- 操作 -->
               <template slot="action" slot-scope="text, record">
-                <a-button size="small" type="primary" class="button-error" @click="handleDel(record)" id="allocateBillEdit-del-btn">删除</a-button>
+                <a-button size="small" type="primary" class="button-error" @click="handleDel(record)" id="editGrap-del-btn">删除</a-button>
               </template>
             </s-table>
           </a-collapse-panel>
@@ -207,7 +173,7 @@
     <div class="affix-cont">
       <a-button
         type="primary"
-        id="allocateBillEdit-submit"
+        id="editGrap-submit"
         size="large"
         :disabled="spinning"
         class="button-primary"
@@ -215,26 +181,42 @@
         style="padding: 0 60px;">提交</a-button>
     </div>
     <!-- 导入产品 -->
-    <importGuideModal :openModal="openGuideModal" :params="{allocateSn: $route.params.sn}" @close="openGuideModal=false" @ok="handleGuideOk" />
-    <!-- 打印导出 -->
-    <print-modal :openModal="openModal" :itemData="basicInfoData" :nowType="nowType" @ok="handleOk" @close="openModal=false" />
-    <!-- 打印 -->
-    <div id="print"></div>
+    <!-- <importGuideModal :openModal="openGuideModal" :params="{allocateSn: $route.params.sn}" @close="openGuideModal=false" @ok="handleGuideOk" /> -->
+    <!-- 修改基础信息 -->
+    <a-modal
+      centered
+      wrapClassName="allocateBill-editRemark-modal"
+      v-if="basicInfoData"
+      :footer="null"
+      :maskClosable="false"
+      title="修改备注"
+      v-model="editRemark"
+      @cancle="editRemark = false"
+      :width="600">
+      <a-textarea
+        v-model="basicInfoData.remark"
+        placeholder="请输入备注(最多120个字符)"
+        :maxLength="120"
+        :auto-size="{ minRows: 3, maxRows: 5 }"
+      />
+      <div class="btn-cont">
+        <a-button type="primary" id="allocateBill-basicInfo-modal-save" @click="handleEditRemark">保存</a-button>
+        <a-button id="allocateBill-basicInfo-modal-back" @click="editRemark = false" style="margin-left: 15px;">取消</a-button>
+      </div>
+    </a-modal>
   </div>
 </template>
 
 <script>
 import { STable, VSelect } from '@/components'
-import ImportGuideModal from './importGuideModal.vue'
-import printModal from './printModal.vue'
-import { hdExportExcel } from '@/libs/exportExcel'
+// import ImportGuideModal from './importGuideModal.vue'
+import print from './print.vue'
 import { queryStockProductPage } from '@/api/stock'
-import { productPriceInfo } from '@/api/product'
 import AllocateType from '@/views/common/allocateType.js'
-import { allocateBillSave, allocateBillDetailList, allocateBillDetailCount, allocateBillDetail, allocateBillDetailSave, allocateBillSubmit, allocateBillDetailDel, allocateBillDetailDelAll, allocateBillDetailPrint, allocateBillBatchInsert, allocateBillDetailExcel } from '@/api/allocateBill'
+import { allocateBillSave, allocateBillDetailList, allocateBillDetailCount, allocateBillDetail, allocateBillDetailSave, allocateBillSubmit, allocateBillDetailDel, allocateBillDetailDelAll, allocateBillBatchInsert } from '@/api/allocateBill'
 
 export default {
-  components: { STable, VSelect, ImportGuideModal, AllocateType, printModal },
+  components: { STable, VSelect, AllocateType, print },
   data () {
     return {
       spinning: false,
@@ -247,6 +229,7 @@ export default {
         productCode: '',
         productName: ''
       },
+      editRemark: false,
       disabled: false, //  查询、重置按钮是否可操作
       loading: false,
       chooseDisabled: false, //  查询、重置按钮是否可操作
@@ -292,81 +275,75 @@ export default {
       },
       productTotal: null, //  合计
       basicInfoData: null, // 基本信息
-      openGuideModal: false, //  导入产品引导
-      openModal: false,
-      nowType: null
+      openGuideModal: false //  导入产品引导
     }
   },
   computed: {
     columns () {
       const arr = [
         { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
+        { title: '调拨单号', dataIndex: 'productOrigCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '产品编码', dataIndex: 'productCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '产品名称', dataIndex: 'productName', align: 'center', width: '29%', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '原厂编码', dataIndex: 'productOrigCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
-        // { title: '成本价', dataIndex: 'lastStockCost', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        // { title: '售价', dataIndex: 'productPrice', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '库存数量', dataIndex: 'currentStockQty', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '单位', dataIndex: 'productUnit', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '操作', scopedSlots: { customRender: 'action1' }, width: '10%', align: 'center' }
+        { title: '单位', dataIndex: 'productUnit', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '调拨单价', dataIndex: 'lastStockCost', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '调拨数量', dataIndex: 'currentStockQty', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '剩余可退数量', dataIndex: 'productPrice', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '退货单价', scopedSlots: { customRender: 'returnPrice' }, width: '10%', align: 'center' },
+        { title: '退货数量', dataIndex: 'returnQty', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
       ]
-      if (this.$hasPermissions('B_isShowCost')) { //  成本价权限
-        arr.splice(4, 0, { title: '成本价', dataIndex: 'lastStockCost', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
-      }
-      if (this.$hasPermissions('B_isShowPrice')) { //  售价权限
-        const ind = this.$hasPermissions('B_isShowCost') ? 5 : 4
-        arr.splice(ind, 0, { title: '售价', dataIndex: 'productPrice', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
-      }
       return arr
     },
     chooseColumns () {
       const arr = [
         { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
+        { title: '调拨单号', dataIndex: 'productOrigCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '产品编码', dataIndex: 'productEntity.code', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'productEntity.name', width: '20%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '原厂编码', dataIndex: 'productEntity.origCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
-        // { title: '成本价', dataIndex: 'cost', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        // { title: '售价', scopedSlots: { customRender: 'price' }, width: '10%', align: 'center' },
-        { title: '库存数量', dataIndex: 'currentStockQty', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '调出数量', scopedSlots: { customRender: 'qty' }, width: '10%', align: 'center' },
-        { title: '单位', dataIndex: 'productEntity.unit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '操作', scopedSlots: { customRender: 'action' }, width: '6%', align: 'center' }
+        { title: '产品名称', dataIndex: 'productEntity.name', align: 'center', width: '29%', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '单位', dataIndex: 'productEntity.unit', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '调拨单价', dataIndex: 'lastStockCost', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '调拨数量', dataIndex: 'currentStockQty', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '剩余可退数量', dataIndex: 'productPrice', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '退货单价', scopedSlots: { customRender: 'returnPrice' }, width: '10%', align: 'center' },
+        { title: '退货数量', dataIndex: 'returnQty', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '退货金额', dataIndex: 'returnAmount', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
       ]
-      if (this.$hasPermissions('B_isShowCost')) { //  成本价权限
-        arr.splice(4, 0, { title: '成本价', dataIndex: 'cost', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
-      }
-      if (this.$hasPermissions('B_isShowPrice')) { //  售价权限
-        const ind = this.$hasPermissions('B_isShowCost') ? 5 : 4
-        arr.splice(ind, 0, { title: '售价', scopedSlots: { customRender: 'price' }, width: '10%', align: 'center' })
-      }
       return arr
     }
   },
   methods: {
+    // 修改备注
+    handleEditRemark () {
+      const _this = this
+      const params = _this.basicInfoData
+      allocateBillSave({
+        allocateSn: params.allocateSn,
+        targetType: params.targetType,
+        targetSn: params.targetSn,
+        targetName: params.targetName,
+        allocateTypeSn: params.allocateTypeSn,
+        remark: params.remark
+      }).then(res => {
+        if (res.status == 200) {
+          _this.$message.success(res.message)
+          _this.getDetail()
+        } else {
+          _this.spinning = false
+        }
+      })
+      _this.editRemark = false
+    },
     // 修改调拨类型
     changeAllocateType (val) {
       const _this = this
       this.$confirm({
         title: '提示',
-        content: '确定要更改调拨类型吗?',
+        content: '确定要更改调拨退货类型吗?',
         centered: true,
         onOk () {
-          const params = _this.basicInfoData
-          allocateBillSave({
-            allocateSn: params.allocateSn,
-            targetType: params.targetType,
-            targetSn: params.targetSn,
-            targetName: params.targetName,
-            allocateTypeSn: params.allocateTypeSn,
-            remark: params.remark
-          }).then(res => {
-            if (res.status == 200) {
-              _this.$message.success(res.message)
-              _this.getDetail()
-            } else {
-              _this.spinning = false
-            }
-          })
+          _this.handleEditRemark()
         }
       })
     },
@@ -503,82 +480,15 @@ export default {
     },
     //  返回列表
     handleBack () {
-      this.$router.push({ path: '/allocationManagement/transferOut/list', query: { closeLastOldTab: true } })
-    },
-    // 已选产品 调出数量  blur
-    qtyBlur (val, record) {
-      //  光标移出,值发生改变再调用编辑接口
-      if (val != record.qtyBackups) {
-        this.handleAdd(record, 'edit')
-      }
+      this.$router.push({ name: 'transferReturnList', query: { closeLastOldTab: true } })
     },
-    // 已选产品 价  change
+    // 已选产品 退货单价  change
     priceChange (val, record) {
       //  光标移出,值发生改变再调用编辑接口
       if (val != record.priceBackups) {
         this.handleAdd(record, 'edit', 'noRefresh')
       }
     },
-    // 获取价格
-    priceFocus (row, index) {
-      if (row.productSn) {
-        productPriceInfo({ sn: row.productSn }).then(res => {
-          if (res.status == 200 && res.data) {
-            this.loadDataSource[index].provincePrice = res.data.provincePrice || undefined
-            this.loadDataSource[index].cityPrice = res.data.cityPrice || undefined
-            this.loadDataSource[index].specialPrice = res.data.specialPrice || undefined
-          }
-        })
-      }
-    },
-    // 导出
-    handleExcel () {
-      const _this = this
-      this.spinning = true
-      hdExportExcel(allocateBillDetailExcel, { allocateSn: this.$route.params.sn }, '调拨明细', function () {
-        _this.spinning = false
-      })
-    },
-    // 打印预览/快捷打印
-    handlePrint (type) {
-      this.nowType = type
-      this.openModal = true
-    },
-    handleOk (objs) {
-      const _this = this
-      const params = JSON.parse(JSON.stringify(objs))
-      delete params.type
-      _this.spinning = true
-      allocateBillDetailPrint(params).then(res => {
-        _this.spinning = false
-        if (res.type == 'application/json') {
-          var reader = new FileReader()
-          reader.addEventListener('loadend', function () {
-            const obj = JSON.parse(reader.result)
-            _this.$notification.error({
-              message: '提示',
-              description: obj.message
-            })
-          })
-          reader.readAsText(res)
-        } else {
-          this.print(res, objs.isPreview)
-        }
-      })
-    },
-    print (data, type) {
-      if (!data) {
-        return
-      }
-      const url = window.URL.createObjectURL(new Blob([data], { type: 'application/pdf' }))
-      document.getElementById('print').innerHTML = '<iframe id="printftoe" name="printftoe" src="' + url + '" hidden></iframe>'
-      if (type == '1') { //  预览
-        window.open(url)
-      } else if (type == '0') { //  打印
-        window.frames['printftoe'].focus()
-        window.frames['printftoe'].print()
-      }
-    },
     // 刷新当前页面
     refashPage () {
       this.$refs.table.refresh()
@@ -608,7 +518,7 @@ export default {
 </script>
 
 <style lang="less">
-  .allocateBillEdit-wrap{
+  .editGrap-wrap{
     position: relative;
     height: 100%;
     box-sizing: border-box;
@@ -617,10 +527,10 @@ export default {
       height: 100%;
       padding-bottom: 51px;
     }
-    .allocateBillEdit-back{
+    .editGrap-back{
       margin-bottom: 10px;
     }
-    .allocateBillEdit-cont{
+    .editGrap-cont{
       margin-bottom: 10px;
       .sub-title{
         font-size: 12px;
@@ -642,4 +552,10 @@ export default {
       }
     }
   }
+  .allocateBill-editRemark-modal{
+    .btn-cont{
+      text-align: center;
+      padding-top: 20px;
+    }
+  }
 </style>

+ 33 - 35
src/views/allocationManagement/transferReturn/list.vue

@@ -1,5 +1,5 @@
 <template>
-  <a-card size="small" :bordered="false" class="allocateBillList-wrap">
+  <a-card size="small" :bordered="false" class="transferReturn-wrap">
     <a-spin :spinning="spinning" tip="Loading...">
       <!-- 搜索条件 -->
       <div ref="tableSearch" class="table-page-search-wrapper">
@@ -12,17 +12,17 @@
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="调拨退货单号">
-                <a-input id="allocateBillList-allocateNo" v-model.trim="queryParam.allocateNo" allowClear placeholder="请输入调拨退货单号"/>
+                <a-input id="transferReturn-allocateNo" v-model.trim="queryParam.allocateNo" allowClear placeholder="请输入调拨退货单号"/>
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="调拨退货对象名称">
-                <a-input id="allocateBillList-targetName" v-model.trim="queryParam.targetName" allowClear placeholder="请输入调拨退货对象名称"/>
+                <a-input id="transferReturn-targetName" v-model.trim="queryParam.targetName" allowClear placeholder="请输入调拨退货对象名称"/>
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="调拨退货对象类型">
-                <AllocateType id="allocateBillList-allocateTypeSn" v-model="queryParam.allocateTypeSn"></AllocateType>
+                <AllocateType id="transferReturn-allocateTypeSn" v-model="queryParam.allocateTypeSn"></AllocateType>
               </a-form-item>
             </a-col>
             <template v-if="advanced">
@@ -31,7 +31,7 @@
                   <v-select
                     v-model="queryParam.state"
                     ref="state"
-                    id="allocateBillList-state"
+                    id="transferReturn-state"
                     code="ALLOCATE_STATUS"
                     placeholder="请选择业务状态"
                     allowClear
@@ -40,8 +40,8 @@
               </a-col>
             </template>
             <a-col :md="6" :sm="24">
-              <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="allocateBillList-refresh">查询</a-button>
-              <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="allocateBillList-reset">重置</a-button>
+              <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="transferReturn-refresh">查询</a-button>
+              <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="transferReturn-reset">重置</a-button>
               <a-button
                 style="margin-left: 5px"
                 type="primary"
@@ -50,7 +50,7 @@
                 @click="handleExport"
                 :disabled="disabled"
                 :loading="exportLoading"
-                id="allocateBillList-export">导出</a-button>
+                id="transferReturn-export">导出</a-button>
               <a @click="advanced=!advanced" style="margin-left: 5px">
                 {{ advanced ? '收起' : '展开' }}
                 <a-icon :type="advanced ? 'up' : 'down'"/>
@@ -61,7 +61,7 @@
       </div>
       <!-- 操作按钮 -->
       <div class="table-operator">
-        <a-button v-if="$hasPermissions('B_transferOut_add')" id="allocateBillList-add" type="primary" class="button-error" @click="openModal=true">新增</a-button>
+        <a-button v-if="$hasPermissions('B_transferOut_add')" id="transferReturn-add" type="primary" class="button-error" @click="openModal=true">新增</a-button>
       </div>
       <!-- 列表 -->
       <s-table
@@ -79,11 +79,6 @@
         <template slot="allocateNo" slot-scope="text, record">
           <span :class="$hasPermissions('M_transferOut_detail')?'active':'common'" @click="handleDetail(record)">{{ record.allocateNo }}</span>
         </template>
-        <!-- 起止时间 -->
-        <template slot="promoDate" slot-scope="text, record">
-          <span v-if="record.promoStartDate || record.promoEndDate">{{ record.promoStartDate }} ~ {{ record.promoEndDate }}</span>
-          <span v-else>--</span>
-        </template>
         <!-- 操作 -->
         <template slot="action" slot-scope="text, record">
           <a-button
@@ -92,21 +87,27 @@
             v-if="record.state == 'WAIT_AUDIT' && $hasPermissions('B_transferOut_audit')"
             class="button-warning"
             @click="handleExamine(record)"
-            id="allocateBillList-examine-btn">审核</a-button>
+            id="transferReturn-examine-btn">审核</a-button>
+          <a-button
+            size="small"
+            type="link"
+            class="button-warning"
+            @click="handleCheck(record)"
+            id="transferReturn-examine-btn">品检</a-button>
           <a-button
             size="small"
             type="link"
             v-if="((record.state == 'WAIT_SUBMIT') || (record.state == 'WAIT_AUDIT') || (record.state == 'AUDIT_REJECT')) && $hasPermissions('M_transferOut_edit')"
             class="button-info"
             @click="handleEdit(record)"
-            id="allocateBillList-edit-btn">编辑</a-button>
+            id="transferReturn-edit-btn">编辑</a-button>
           <a-button
             size="small"
             type="link"
             v-if="((record.state == 'WAIT_SUBMIT') || (record.state == 'WAIT_AUDIT') || (record.state == 'AUDIT_REJECT')) && $hasPermissions('B_transferOut_del')"
             class="button-error"
             @click="handleDel(record)"
-            id="allocateBillList-del-btn">删除</a-button>
+            id="transferReturn-del-btn">删除</a-button>
           <span v-if="((record.state != 'WAIT_SUBMIT') && (record.state != 'WAIT_AUDIT') && (record.state != 'AUDIT_REJECT'))||(!$hasPermissions('B_transferOut_audit') && !$hasPermissions('M_transferOut_edit') && !$hasPermissions('B_transferOut_del'))">--</span>
         </template>
       </s-table>
@@ -160,6 +161,7 @@ export default {
             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].grapFlag = data.list[i].no % 2
             }
             this.disabled = false
           }
@@ -178,27 +180,19 @@ export default {
       const arr = [
         { title: '序号', dataIndex: 'no', width: '3.5%', align: 'center' },
         { title: '创建时间', dataIndex: 'createDate', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '调拨单号', scopedSlots: { customRender: 'allocateNo' }, align: 'center', width: '13.5%' },
-        { title: '起止时间', scopedSlots: { customRender: 'promoDate' }, align: 'center', width: '8%' },
-        { title: '调往对象', dataIndex: 'targetName', width: '8%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '客户类型', dataIndex: 'dealerLevelDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
-        // { title: '总成本', dataIndex: 'totalCost', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '总数量', dataIndex: 'totalQty', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        // { title: '总售价', dataIndex: 'totalPrice', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '调拨退货单号', scopedSlots: { customRender: 'allocateNo' }, align: 'center', width: '13.5%' },
+        { title: '调拨退货对象类型', dataIndex: 'allocateTypeName', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '调拨退货对象名称', dataIndex: 'targetName', width: '8%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '调拨退货类型', dataIndex: 'dealerLevelDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '是否抓单', dataIndex: 'grapFlagDictValue', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '退货总数量', dataIndex: 'totalQty', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '坏件数量', dataIndex: 'printCount', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '返库数量', dataIndex: 'printCount1', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '退货总金额', dataIndex: 'totalPrice', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '审核时间', dataIndex: 'auditTime', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '调拨类型', dataIndex: 'allocateTypeName', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '业务状态', dataIndex: 'stateDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '打印状态', dataIndex: 'printStateDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '打印次数', dataIndex: 'printCount', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
       ]
-      if (this.$hasPermissions('B_isShowCost')) { //  成本价权限
-        arr.splice(6, 0, { title: '总成本', dataIndex: 'totalCost', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
-      }
-      if (this.$hasPermissions('B_isShowPrice')) { //  售价权限
-        const ind = this.$hasPermissions('B_isShowCost') ? 8 : 7
-        arr.splice(ind, 0, { title: '总售价', dataIndex: 'totalPrice', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
-      }
       return arr
     }
   },
@@ -269,7 +263,11 @@ export default {
     },
     //  编辑
     handleEdit (row) {
-      this.$router.push({ name: row.grabFlag == 1 ? 'transferReturnGrpEdit' : 'transferReturnEdit', params: { sn: row.allocateSn, dealerLevel: row.dealerLevel } })
+      this.$router.push({ name: row.grapFlag == 1 ? 'transferReturnGrpEdit' : 'transferReturnEdit', params: { sn: row.allocateSn, dealerLevel: row.dealerLevel } })
+    },
+    // 品检
+    handleCheck (row) {
+      this.$router.push({ name: 'transferReturnCheck', params: { sn: row.allocateSn, grapFlag: row.grapFlag } })
     },
     //  导出
     handleExport () {

+ 99 - 0
src/views/allocationManagement/transferReturn/print.vue

@@ -0,0 +1,99 @@
+<template>
+  <div>
+    <a-button
+      key="1"
+      type="default"
+      v-if="$hasPermissions('B_transferOut_print')"
+      id="editGrap-db-print-btn"
+      :disabled="disabled"
+      @click="handlePrint('views')">打印预览</a-button>
+    <a-button
+      key="2"
+      type="primary"
+      class="button-info"
+      v-if="$hasPermissions('B_transferOut_print')"
+      id="editGrap-dbfl-print-btn"
+      :disabled="disabled"
+      @click="handlePrint('print')">快捷打印</a-button>
+    <a-button
+      key="3"
+      type="primary"
+      class="button-warning"
+      v-if="$hasPermissions('B_transferOut_detail_export')"
+      id="editGrap-export-btn"
+      :disabled="disabled"
+      @click="handleExcel">导出Excel</a-button>
+    <!-- 打印 -->
+    <div id="print"></div>
+  </div>
+</template>
+
+<script>
+import { hdExportExcel } from '@/libs/exportExcel'
+import { allocateBillDetailExcel, allocateBillDetailPrint } from '@/api/allocateBill'
+export default {
+  props: {
+    params: {
+      type: Object,
+      default: function () {
+        return {}
+      }
+    },
+    disabled: {
+      type: Boolean,
+      default: false
+    }
+  },
+  methods: {
+    handlePrint (type) {
+      const _this = this
+      const params = {
+        allocateSn: this.params.allocateSn || '',
+        printType: 'ALLOCATE_BILL'
+      }
+      this.$emit('loading')
+      allocateBillDetailPrint(params).then(res => {
+        _this.spinning = false
+        if (res.type == 'application/json') {
+          var reader = new FileReader()
+          reader.addEventListener('loadend', function () {
+            const obj = JSON.parse(reader.result)
+            _this.$notification.error({
+              message: '提示',
+              description: obj.message
+            })
+          })
+          reader.readAsText(res)
+        } else {
+          this.print(res, type)
+        }
+        _this.$emit('unloading')
+      })
+    },
+    print (data, type) {
+      if (!data) {
+        return
+      }
+      const url = window.URL.createObjectURL(new Blob([data], { type: 'application/pdf' }))
+      document.getElementById('print').innerHTML = '<iframe id="printftoe" name="printftoe" src="' + url + '" hidden></iframe>'
+      if (type == 'views') { //  预览
+        window.open(url)
+      } else if (type == 'print') { //  打印
+        window.frames['printftoe'].focus()
+        window.frames['printftoe'].print()
+      }
+    },
+    // 导出
+    handleExcel () {
+      const _this = this
+      this.$emit('loading')
+      hdExportExcel(allocateBillDetailExcel, { allocateSn: this.params.allocateSn || '' }, '调拨退货单明细', function () {
+        _this.$emit('unloading')
+      })
+    }
+  }
+}
+</script>
+
+<style>
+</style>

+ 0 - 167
src/views/allocationManagement/transferReturn/printModal.vue

@@ -1,167 +0,0 @@
-<template>
-  <a-modal
-    centered
-    :footer="null"
-    :maskClosable="false"
-    class="allocateBill-print-type-modal"
-    :title="modalTit"
-    v-model="isShow"
-    @cancle="isShow=false"
-    :width="600">
-    <a-spin :spinning="spinning" tip="Loading...">
-      <a-form-model
-        id="allocateBill-print-form"
-        ref="ruleForm"
-        :model="form"
-        :rules="rules"
-        :label-col="formItemLayout.labelCol"
-        :wrapper-col="formItemLayout.wrapperCol"
-      >
-        <a-form-model-item label="调拨单号">{{ itemData&&itemData.allocateNo || '--' }}</a-form-model-item>
-        <a-form-model-item label="客户名称">{{ itemData&&itemData.targetName || '--' }}</a-form-model-item>
-        <a-form-model-item label="产品分类" prop="id" v-if="nowType=='dbflPrint'">
-          <a-select id="allocateBill-print-form" v-model="form.id" placeholder="请选择产品分类">
-            <a-select-option v-for="item in typeList" :value="item.id" :key="item.id">
-              <span v-if="item.id != 'all'">{{ item.productBrandName }} - {{ item.productTypeName3 }}</span>
-              <span v-else>全部</span>
-            </a-select-option>
-          </a-select>
-        </a-form-model-item>
-        <a-form-model-item label="产品价格" prop="priceType" v-if="nowType=='dbPrint'">
-          <a-radio-group v-model="form.priceType">
-            <a-radio value="ALLOCATE_BILL_PRICE">销售价</a-radio>
-            <a-radio value="ALLOCATE_BILL_COST">成本价</a-radio>
-            <a-radio value="ALLOCATE_BILL">不打印</a-radio>
-          </a-radio-group>
-        </a-form-model-item>
-      </a-form-model>
-      <div class="btn-cont">
-        <a-button type="primary" id="allocateBill-print-save" @click="handleSave('preview')">打印预览</a-button>
-        <a-button id="allocateBill-print-back" @click="handleSave('print')" style="margin-left: 15px;">快捷打印</a-button>
-      </div>
-    </a-spin>
-  </a-modal>
-</template>
-
-<script>
-import { allocateBillProductTypeList } from '@/api/allocateBill'
-export default {
-  props: {
-    openModal: { //  弹框显示状态
-      type: Boolean,
-      default: false
-    },
-    itemData: {
-      type: Object,
-      default: () => {
-        return null
-      }
-    },
-    nowType: {
-      type: String,
-      default: ''
-    }
-  },
-  data () {
-    return {
-      isShow: this.openModal, //  是否打开弹框
-      form: {
-        id: 'all',
-        priceType: undefined
-      },
-      rules: {
-        id: [{ required: true, message: '请选择产品分类', trigger: 'change' }],
-        priceType: [{ required: true, message: '请选择产品价格', trigger: 'change' }]
-      },
-      formItemLayout: {
-        labelCol: { span: 6 },
-        wrapperCol: { span: 18 }
-      },
-      spinning: false,
-      typeList: []
-    }
-  },
-  computed: {
-    modalTit () {
-      let title = ''
-      if (this.nowType == 'dbPrint') {
-        title = '调拨打印'
-      } else if (this.nowType == 'dbflPrint') {
-        title = '调拨分类打印'
-      }
-      return title
-    }
-  },
-  methods: {
-    // 确认
-    handleSave (type) {
-      const _this = this
-      this.$refs.ruleForm.validate(valid => {
-        if (valid) {
-          if (_this.nowType == 'dbflPrint') {
-            const item = _this.typeList.find(item => item.id == _this.form.id)
-            if (item) {
-              const obj = {
-                allocateSn: _this.itemData.allocateSn,
-                productBrandSn: item.productBrandSn,
-                productTypeSn3: item.productTypeSn3,
-                printType: 'ALLOCATE_BILL_TYPE',
-                isPreview: type == 'preview' ? 1 : 0
-              }
-              _this.$emit('ok', obj)
-            }
-          } else {
-            const obj = {
-              allocateSn: _this.itemData.allocateSn,
-              printType: _this.form.priceType,
-              isPreview: type == 'preview' ? 1 : 0
-            }
-            _this.$emit('ok', obj)
-          }
-          _this.isShow = false
-        } else {
-          console.log('error submit!!')
-          return false
-        }
-      })
-    },
-    // 获取该销售单产品二级分类
-    getTypeData () {
-      this.typeList = [{ id: 'all' }]
-      allocateBillProductTypeList({ sn: this.itemData.allocateSn || null }).then(res => {
-        if (res.status == 200) {
-          if (res.data && res.data.length > 0) {
-            this.typeList = [...this.typeList, ...res.data]
-          }
-        }
-      })
-    }
-  },
-  watch: {
-    //  父页面传过来的弹框状态
-    openModal (newValue, oldValue) {
-      this.isShow = newValue
-    },
-    //  重定义的弹框状态
-    isShow (newValue, oldValue) {
-      if (!newValue) {
-        this.$emit('close')
-        this.$refs.ruleForm.resetFields()
-      } else {
-        if (this.nowType == 'dbflPrint') {
-          this.getTypeData()
-        }
-      }
-    }
-  }
-}
-</script>
-
-<style lang="less">
-  .allocateBill-print-type-modal{
-    .btn-cont {
-      text-align: center;
-      margin: 35px 0 10px;
-    }
-  }
-</style>

+ 1 - 3
src/views/salesManagement/salesReturn/salesReturnCheck.vue

@@ -57,7 +57,6 @@
 
 <script>
 import { STable, VSelect } from '@/components'
-import queryPart from './queryPart.vue'
 import { salesReturnDetail, salesReturnCheck } from '@/api/salesReturn'
 import {
   salesReturnDetailList,
@@ -67,8 +66,7 @@ export default {
   name: 'SalesReturnEdit',
   components: {
     STable,
-    VSelect,
-    queryPart
+    VSelect
   },
   data () {
     return {