瀏覽代碼

Merge branch 'develop_yh44' of http://git.chelingzhu.com/jianguan-web/qpls-md-html into develop_yh46

# Conflicts:
#	public/version.json
#	src/views/financialManagement/companyReceivablePayableNew/collectionPayment.vue
#	src/views/salesManagement/salesQueryNew/productSalesRecordModal.vue
lilei 10 月之前
父節點
當前提交
66d70b6d8c

+ 1 - 1
public/version.json

@@ -1,5 +1,5 @@
 {
   "message": "发现有新版本发布,确定更新系统?",
   "vendorJsVersion": "",
-  "version": 1721188696974
+  "version": 1722669717493
 }

+ 142 - 0
src/api/promoActive.js

@@ -0,0 +1,142 @@
+import { axios } from '@/utils/request'
+
+//  促销活动 列表  有分页
+export const promoActiveList = (params) => {
+  const url = `/promoActive/queryPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+// 促销活动 关闭
+export const closeActive = (params) => {
+  return axios({
+    url: `/promoActive/closeActive/${params.sn}`,
+    method: 'get'
+  })
+}
+// 促销活动 开启
+export const publishActive = (params) => {
+  return axios({
+    url: `/promoActive/publishActive/${params.sn}`,
+    method: 'get'
+  })
+}
+
+//  促销活动 详情
+export const promoActiveDetail = (params) => {
+  const url = `/promoActive/findBySn/${params.sn}`
+  return axios({
+    url: url,
+    method: 'get'
+  })
+}
+
+// 促销活动 发布修改
+export const promoActivePublish = (params) => {
+  return axios({
+    url: '/promoRuleDetail/updateList',
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('发布修改')
+    }
+  })
+}
+
+// 促销活动 选择产品列表
+export const queryWaitingProductPage = (params) => {
+  const url = `/promoRuleProduct/queryWaitingProductPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('列表查询')
+    }
+  })
+}
+
+// 新增一行
+export const getNewScopeSn = (params) => {
+  return axios({
+    url: '/promoActive/getNewSn',
+    data: params,
+    method: 'get'
+  })
+}
+
+// 修理厂促销   保存产品范围
+export const saveBatchEntity = (params) => {
+  return axios({
+    url: '/promoRuleProductRange/saveBatchEntity',
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('保存产品范围')
+    }
+  })
+}
+// 批量创建产品
+export const promoCreateBatch = (params) => {
+  return axios({
+    url: '/promoRuleProduct/createBatch',
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('批量创建产品')
+    }
+  })
+}
+export const promoUpdateBatch = (params) => {
+  return axios({
+    url: '/promoRuleProduct/updateBatch',
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('批量创建产品')
+    }
+  })
+}
+// 获取已选产品列表数据  有分页
+export const promoRuleProductList = (params) => {
+  const url = `/promoRuleProduct/queryPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('列表查询')
+    }
+  })
+}
+
+// 批量删除
+export const deleteBatch = (params) => {
+  return axios({
+    url: '/promoRuleProduct/deleteBatch',
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('批量删除')
+    }
+  })
+}
+// 删除产品范围  数据变化 promoActiveSn  productTypeSnList
+export const deleteByProductType = (params) => {
+  return axios({
+    url: '/promoRuleProduct/deleteByProductType',
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('批量删除')
+    }
+  })
+}

+ 1 - 1
src/api/settle.js

@@ -75,7 +75,7 @@ export const settleUnitQuerySum = (params) => {
 //详情  打印
 export const settleUnitPrint = params => {
   const data = {
-    url: `/settle/unit/print/${params.type}`,
+    url: `/settle/unit/print/${params.type}/${params.remarksFlag}`,
     data: params,
     method: 'post',
     headers: {

+ 22 - 0
src/api/ticket.js

@@ -0,0 +1,22 @@
+import { axios } from '@/utils/request'
+
+//  优惠券详情 列表  有分页
+export const ticketQueryPage = (params) => {
+  const url = `/ticket/queryPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+
+// 优惠券详情 核销
+export const ticketCheckTicket = (params) => {
+  return axios({
+    url: '/ticket/checkTicket',
+    data: params,
+    method: 'post'
+  })
+}

+ 3 - 3
src/components/Select/index.js

@@ -33,9 +33,9 @@ export default {
     const data = allLookup.find(item => item.code == _this.code)
     // 判断是否是省仓用户
     _this.dataList = _this.$store.state.user.dealerSupplierFlag == '1' ? data.itemList : data.itemList.filter(item => item.dispName != '省级批发价')
-    setTimeout(()=>{
+    setTimeout(() => {
       _this.$emit('loadDataFinish', _this.dataList)
-    },100)
+    }, 100)
   },
   methods: {
     // 根据code 获取名称
@@ -74,7 +74,7 @@ export default {
     }
     if (this.showType === 'radio') {
       return (
-        <a-radio-group vModel={props.value} {...{ props, on: radioOn }} >,
+        <a-radio-group vModel={props.value} {...{ props, on: radioOn }} >
           {
             this.dataList.map(item => {
               return (<a-radio value={item.code} key={item.code}>{item['dispName']}</a-radio>)

+ 36 - 0
src/config/router.config.js

@@ -3334,6 +3334,42 @@ export const asyncRouterMap = [
                   hidden: true,
                   permission: 'M_promotionInfoList'
                 }
+              },
+              {
+                path: 'edit/:sn/:pageType',
+                name: 'promotionInfoEdit',
+                component: () => import(/* webpackChunkName: "productManagement" */ '@/views/promotionManagement/promotionInfo/edit.vue'),
+                meta: {
+                  title: '编辑促销',
+                  icon: 'contacts',
+                  hidden: true,
+                  permission: 'M_promotionInfoEdit'
+                }
+              }
+            ]
+          },
+          {
+            path: '/promotionManagement/couponDetails',
+            redirect: '/promotionManagement/couponDetails/list',
+            name: 'couponDetails',
+            component: BlankLayout,
+            meta: {
+              title: '优惠券详情',
+              icon: 'contacts',
+              permission: 'M_couponDetailsList'
+            },
+            hideChildrenInMenu: true,
+            children: [
+              {
+                path: 'list',
+                name: 'couponDetailsList',
+                component: () => import(/* webpackChunkName: "productManagement" */ '@/views/promotionManagement/couponDetails/list.vue'),
+                meta: {
+                  title: '优惠券详情',
+                  icon: 'contacts',
+                  hidden: true,
+                  permission: 'M_couponDetailsList'
+                }
               }
             ]
           }

+ 1 - 0
src/views/common/print.vue

@@ -4,6 +4,7 @@
       <a-radio value="NEEDLE" id="print-printerType1">针式</a-radio>
       <a-radio value="INK" id="print-printerType0">喷墨</a-radio>
     </a-radio-group>
+    <slot name="extendCons"></slot>
     <a-button key="3" id="print-preview-btn" :loading="$store.state.app.printLoading" :disabled="disabled" @click="handlePrint('preview')">打印预览</a-button>
     <a-button
       key="2"

+ 8 - 1
src/views/financialManagement/companyReceivablePayable/collectionPayment.vue

@@ -8,7 +8,11 @@
           <p style=" display: inline-block;margin: 0 0 0 30px;color: #000;font-size: 14px;font-weight: 600;">客户:{{ $route.params.name!='undefined'?$route.params.name: '--' }}</p>
         </template>
         <template slot="extra" v-if="$hasPermissions('B_cPayment_printAndExport')">
-          <Print :disabled="chooseLoadData.length==0||totalBalance==0" @handlePrint="handlePrint"></Print>
+          <Print :disabled="chooseLoadData.length==0||totalBalance==0" @handlePrint="handlePrint">
+            <template slot="extendCons">
+              <a-checkbox v-model="remarksFlag">打印备注</a-checkbox>
+            </template>
+          </Print>
         </template>
       </a-page-header>
       <!-- 已选单据 -->
@@ -198,6 +202,7 @@ export default {
       disabled: false,
       spinning: false,
       loading: false, //  表格加载中
+      remarksFlag: false, // 打印备注
       chooseQueryParam: {
         productCode: '', // 产品编码
         productName: '' // 产品名称
@@ -283,6 +288,8 @@ export default {
       if (type == 'export') { //  导出
         url = settleUnitExport
       }
+      // 是否打印备注
+      params.remarksFlag = _this.remarksFlag ? 1 : 0
       // 打印或导出
       hdPrint(printerType, type, url, params, '单位应收应付', function () {
         _this.spinning = false

+ 8 - 5
src/views/financialManagement/companyReceivablePayableNew/collectionPayment.vue

@@ -10,10 +10,11 @@
         <template slot="extra" v-if="$hasPermissions('B_cPayment_printAndExport')">
           <div style="margin-top: 5px;">
             <PrintPanel ref="printBox" @handlePrint="handlePrint">
-              <!-- <div style="padding:10px;" slot="extendCons">
-                <a-checkbox v-model="printTotalKs" :checked="printTotalKs" id="salesQuery-printTotalKs">打印总款数</a-checkbox>
-                <a-checkbox v-model="printTotalNums" :checked="printTotalNums" id="salesQuery-printTotalNums">打印总数量</a-checkbox>
-              </div> -->
+              <div style="padding:10px;" slot="extendCons">
+                <a-checkbox v-model="remarksFlag" id="salesQuery-remarksFlag">打印备注</a-checkbox>
+                <!-- <a-checkbox v-model="printTotalKs" :checked="printTotalKs" id="salesQuery-printTotalKs">打印总款数</a-checkbox> -->
+                <!-- <a-checkbox v-model="printTotalNums" :checked="printTotalNums" id="salesQuery-printTotalNums">打印总数量</a-checkbox> -->
+              </div>
             </PrintPanel>
             <a-divider type="vertical" />
             <a-button id="scollectionPayEdit-del-btn" class="button-default" type="link" @click="handleOk([])"><a-icon type="close" />清空单据</a-button>
@@ -245,7 +246,8 @@ export default {
       maxAmountSettled: 0, // 结算金额最大值
       enableFundAccount: false, // 结算账户是否开启
       printTotalKs: false, // 打印原创编码
-      printTotalNums: false // 打印全部名称
+      printTotalNums: false, // 打印全部名称
+      remarksFlag: false // 打印备注
     }
   },
   computed: {
@@ -295,6 +297,7 @@ export default {
         // 打印
         // params.printTotalKs = params.printTotalKs ? 1 : 0
         // params.printTotalNums = params.printTotalNums ? 1 : 0
+        params.remarksFlag = this.remarksFlag ? 1 : 0
       }
       // 打印或导出
       hdPrint(printerType, type, url, params, '单位应收应付', function () {

+ 228 - 0
src/views/promotionManagement/couponDetails/list.vue

@@ -0,0 +1,228 @@
+<template>
+  <a-card size="small" :bordered="false" class="jg-page-wrap couponDetails-wrap">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <!-- 搜索条件 -->
+      <div ref="tableSearch" class="table-page-search-wrapper">
+        <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)" id="couponDetails-form">
+          <a-row :gutter="15">
+            <a-col :md="6" :sm="24">
+              <a-form-item label="券名称/券副标题">
+                <a-input id="couponDetails-queryWord" v-model.trim="queryParam.queryWord" allowClear placeholder="请输入券名称/券副标题"/>
+              </a-form-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-item label="客户名称">
+                <selectCust ref="custList" id="couponDetails-customerSn" :isValidateEnabled="true" @change="custChange" v-model="queryParam.customerSn"></selectCust>
+              </a-form-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-item label="券状态">
+                <v-select
+                  id="couponDetails-ticketState"
+                  v-model="queryParam.ticketState"
+                  ref="sourceType"
+                  code="TICKET_STATE"
+                  placeholder="请选择优惠券使用状态"
+                  allowClear></v-select>
+              </a-form-item>
+            </a-col>
+            <a-col :md="4" :sm="24">
+              <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="couponDetails-refresh">查询</a-button>
+              <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="couponDetails-reset">重置</a-button>
+            </a-col>
+          </a-row>
+        </a-form>
+      </div>
+      <!-- 列表 -->
+      <s-table
+        class="sTable fixPagination"
+        ref="table"
+        :style="{ height: tableHeight+84.5+'px' }"
+        size="small"
+        :rowKey="(record) => record.id"
+        :columns="columns"
+        :data="loadData"
+        :scroll="{ y: tableHeight }"
+        :defaultLoadData="false"
+        bordered>
+        <!-- 有效期 -->
+        <template slot="dateBox" slot-scope="text, record">
+          <span v-if="record.validStartDate&&record.validEndDate">
+            {{ record.validStartDate }}-{{ record.validEndDate }}
+          </span>
+          <span v-else>--</span>
+        </template>
+        <!-- 优惠券状态 ticketState  已使用USED   未使用  UNUSED  已过期 DATED -->
+        <template slot="action" slot-scope="text, record">
+          <a-button
+            size="small"
+            v-if="record.ticketState==='UNUSED'&&$hasPermissions('B_checkTicketBtn')"
+            type="link"
+            class="button-success"
+            @click="handleWriteoff(record)"
+            :id="'couponDetails-cancel-btn'+record.id">核销</a-button>
+          <span v-else>--</span>
+        </template>
+      </s-table>
+    </a-spin>
+    <!-- 核销 -->
+    <writeOffModal :itemObj="writeOffObj" :openModal="openModal" @ok="$refs.table.refresh()" @close="closeModal"/>
+  </a-card>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+// 组件
+import { STable, VSelect } from '@/components'
+import selectCust from '@/views/common/selectCust.vue'
+import writeOffModal from './writeOffModal.vue'
+// 接口
+import { ticketQueryPage } from '@/api/ticket'
+
+export default {
+  name: 'CouponDetails',
+  components: { STable, VSelect, writeOffModal, selectCust },
+  mixins: [commonMixin],
+  data () {
+    return {
+      spinning: false,
+      tableHeight: 0, // 表格高度
+      openModal: false, // 核销弹窗
+      disabled: false, //  查询、重置按钮是否可操作
+      //  查询条件
+      queryParam: {
+        queryWord: undefined, // 券名称/券副标题
+        customerSn: undefined, // 客户名称sn
+        ticketState: undefined// 券状态
+      },
+      writeOffObj: null, // 核销弹窗回显数据
+      // 表头
+      columns: [
+        { title: '序号', dataIndex: 'no', width: '60px', align: 'center' },
+        { title: '销售单号', dataIndex: 'usedBizNo', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '客户名称', dataIndex: 'customerName', width: '20%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '货架名称', dataIndex: 'shelfName', width: '20%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '券名称', dataIndex: 'ruleName', width: '20%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '券副标题', dataIndex: 'ruleTitle', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '券金额', dataIndex: 'ticketValue', width: '10%', align: 'right', customRender: text => { return text || text == 0 ? this.toThousands(text, 2) : '--' } },
+        { title: '促销名称', dataIndex: 'promoActiveName', width: '20%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '有效期', scopedSlots: { customRender: 'dateBox' }, width: '20%', align: 'center' },
+        { title: '券状态', dataIndex: 'ticketStateDictValue', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '核销时间', dataIndex: 'usedBizDate', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
+      ],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        this.spinning = true
+        // 获取优惠券列表数据  有分页
+        return ticketQueryPage(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
+            }
+            this.disabled = false
+          }
+          this.spinning = false
+          return data
+        })
+      }
+    }
+  },
+  methods: {
+    // 核销
+    handleWriteoff (row) {
+      this.writeOffObj = {
+        customerName: row.customerName,
+        ticketSn: row.ticketSn
+      }
+      this.openModal = true
+    },
+    // 关闭核销弹窗
+    closeModal () {
+      this.writeOffObj = null
+      this.openModal = false
+    },
+    // 客户名称
+    custChange (obj) {
+      const _this = this
+      if (obj && obj.key) {
+        const cust = obj.row
+        _this.queryParam.customerSn = cust.customerSn
+      } else {
+        _this.$refs.custList.resetForm()
+      }
+    },
+    //  重置
+    resetSearchForm () {
+      this.queryParam.queryWord = undefined
+      this.queryParam.customerSn = undefined
+      this.queryParam.ticketState = undefined
+      this.$refs.custList.resetForm()
+      this.$refs.table.refresh(true)
+    },
+    // 初始化
+    pageInit () {
+      const _this = this
+      _this.resetSearchForm()
+      this.$nextTick(() => { // 页面渲染完成后的回调
+        _this.setTableH()
+      })
+    },
+    // 计算表格高度
+    setTableH () {
+      const tableSearchH = this.$refs.tableSearch.offsetHeight
+      this.tableHeight = window.innerHeight - tableSearchH - 203
+    }
+  },
+  mounted () {
+    if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
+      this.pageInit()
+    }
+  },
+  watch: {
+    '$store.state.app.winHeight' (newValue, oldValue) { //  窗口变更时,需同时更改表格高度
+      this.setTableH()
+    }
+  },
+  activated () {
+    // 如果是新页签打开,则重置当前页面
+    if (this.$store.state.app.isNewTab) {
+      this.pageInit()
+    }
+    // 只刷新列表
+    if (this.$store.state.app.updateList) {
+      this.pageInit()
+      this.$refs.table.refresh()
+    }
+  },
+  beforeRouteEnter (to, from, next) {
+    next(vm => {})
+  }
+}
+</script>
+
+<style lang="less">
+  .couponDetails-wrap{
+    .red{
+      color: #ed1c24;
+    }
+    .green{
+      color: #19be6b;
+    }
+    .font1{
+     color:#39f;
+    }
+    .desc{
+      width: 100%;
+      overflow: hidden;
+      text-overflow: ellipsis;
+      display: -webkit-box;
+      -webkit-line-clamp: 3;
+      -webkit-box-orient: vertical;
+    }
+  }
+</style>

+ 124 - 0
src/views/promotionManagement/couponDetails/writeOffModal.vue

@@ -0,0 +1,124 @@
+<template>
+  <a-modal
+    centered
+    class="writeOff-modal"
+    :footer="null"
+    :maskClosable="false"
+    title="核销"
+    v-model="isShow"
+    @cancel="isShow=false"
+    :width="450">
+    <div class="writeOffCon">
+      <!-- :rules="rules" -->
+      <a-form-model
+        id="writeOffModal-form"
+        ref="ruleForm"
+        :model="form"
+        :label-col="formItemLayout.labelCol"
+        :wrapper-col="formItemLayout.wrapperCol" >
+        <a-form-model-item label="客户名称" prop="purchaseTargetSn">
+          {{ itemObj&&itemObj.customerName?itemObj.customerName:'--' }}
+        </a-form-model-item>
+        <a-form-model-item label="核销码" prop="usedBizNo">
+          <a-input id="writeOffModal-customerName" v-model.trim="form.usedBizNo" allowClear placeholder="请输入该客户的销售单号核销"/>
+        </a-form-model-item>
+      </a-form-model>
+    </div>
+    <div class="btn-cont">
+      <a-button style="margin-right:10px;" id="writeOff-modal-back" @click="isShow = false">取消</a-button>
+      <a-button type="primary" id="writeOff-modal-back" @click="submitSave" >确定</a-button>
+    </div>
+  </a-modal>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+import { ticketCheckTicket } from '@/api/ticket'
+export default {
+  name: 'WriteOffModal',
+  mixins: [commonMixin],
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    },
+    itemObj: {
+      type: Object,
+      default: () => {
+        return {}
+      }
+    }
+  },
+  data () {
+    return {
+      isShow: this.openModal, //  是否打开弹框
+      formItemLayout: {
+        labelCol: { span: 4 },
+        wrapperCol: { span: 18 }
+      },
+      form: {
+        usedBizNo: undefined
+      },
+      rules: {
+        usedBizNo: [
+          { required: true, message: '请输入核销码', trigger: 'blur' }
+        ]
+      }
+    }
+  },
+  methods: {
+    submitSave () {
+      const _this = this
+      console.log('1111111111111')
+      _this.form.ticketSn = _this.itemObj.ticketSn
+
+      ticketCheckTicket(_this.form).then(res => {
+        if (res.status == 200) {
+          _this.$message.success(res.message)
+          _this.isShow = false
+          _this.$emit('ok')
+        }
+      })
+      // _this.$refs.ruleForm.validate(valid => {
+      //   if (valid) {
+
+      //   } else {
+      //     return false
+      //   }
+      // })
+    },
+    reSetData () {
+      this.$refs.ruleForm.resetFields()
+      this.form.usedBizNo = undefined
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.reSetData()
+        this.$emit('close')
+      }
+    }
+  }
+}
+</script>
+
+<style lang="less" scoped>
+  .writeOff-modal{
+    .writeOffCon{
+      /deep/.ant-form-item{
+        margin-bottom:18px;
+      }
+    }
+
+    .btn-cont {
+      text-align: center;
+      margin: 40px 0 0px;
+    }
+  }
+</style>

+ 299 - 0
src/views/promotionManagement/promotionInfo/chooseProductsModal.vue

@@ -0,0 +1,299 @@
+<template>
+  <a-drawer
+    :zIndex="zIndex"
+    title="选择产品"
+    placement="right"
+    :visible="isShow"
+    width="80%"
+    :get-container="false"
+    :wrap-style="{ position: 'absolute' }"
+    :headerStyle="{ padding: '10px' }"
+    @close="onClose"
+    wrapClassName="chooseProducts-modal">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <div class="products-con">
+        <!-- 搜索条件 -->
+        <div class="table-page-search-wrapper">
+          <a-form-model
+            ref="ruleForm"
+            class="form-model-con"
+            layout="inline"
+            :model="queryParam"
+            :label-col="formItemLayout.labelCol"
+            :wrapper-col="formItemLayout.wrapperCol">
+            <a-row :gutter="15">
+              <a-col :md="8" :sm="24">
+                <a-form-model-item label="产品编码">
+                  <a-input id="chooseProducts-code" v-model.trim="queryParam.productCode" allowClear placeholder="请输入产品编码"/>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="8" :sm="24">
+                <a-form-model-item label="原厂编码">
+                  <a-input id="chooseProducts-code" v-model.trim="queryParam.origCode" allowClear placeholder="请输入原厂编码"/>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="8" :sm="24">
+                <a-form-model-item label="产品名称">
+                  <a-input id="chooseProducts-name" v-model.trim="queryParam.productName" allowClear placeholder="请输入产品名称"/>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="8" :sm="24">
+                <a-form-model-item label="产品分类">
+                  <ProductType id="chooseProducts-productType" placeholder="请选择产品分类" :isDealer="true" @change="changeProductType" v-model="queryParam.productType"></ProductType>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="8" :sm="24">
+                <a-form-model-item label="产品品牌">
+                  <ProductBrand id="chooseProducts-productBrandSn" v-model="queryParam.productBrandSn"></ProductBrand>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="8" :sm="24" style="margin-bottom: 10px;">
+                <a-button type="primary" @click="$refs.table.refresh()" :disabled="disabled" id="chooseProducts-refresh">查询</a-button>
+                <a-button style="margin-left: 5px" @click="resetData" :disabled="disabled" id="chooseProducts-reset">重置</a-button>
+              </a-col>
+            </a-row>
+          </a-form-model>
+        </div>
+        <div style="margin-bottom: 10px">
+          <a-button type="primary" ghost :loading="loading" @click="handleSave">批量添加</a-button>
+          <span style="margin-left: 5px">
+            <template v-if="selectCount"> {{ `已选 ${selectCount} 项` }} </template>
+          </span>
+        </div>
+        <!-- 列表 -->
+        <s-table
+          class="sTable"
+          ref="table"
+          size="small"
+          :rowKey="(record) => record.productSn"
+          rowKeyName="productSn"
+          :row-selection="{ columnWidth: 40, getCheckboxProps: record => ({ props: { disabled: !record.terminalPrice } })}"
+          @rowSelection="rowSelectionFun"
+          :columns="columns"
+          :pagination="{pageSizeOptions: ['20','50','100','200','500']}"
+          :data="loadData"
+          :defaultLoadData="false"
+          style="max-height:700px;"
+          :scroll="{ y: 550 }"
+          bordered>
+          <!-- 产品分类 -->
+          <template slot="productType" slot-scope="text, record">
+            <span v-if="record.productTypeName2 || record.productTypeName3">{{ record.productTypeName2 }} {{ record.productTypeName3 ? '>' : '' }} {{ record.productTypeName3 }}</span>
+            <span v-else>--</span>
+          </template>
+          <!-- 包装数 -->
+          <template slot="productQty" slot-scope="text, record">
+            <span v-if="record.packQty">
+              {{ record.packQty }}{{ record.unit }}/{{ record.packQtyUnit?record.packQtyUnit:'--' }}
+            </span>
+            <span v-else>--</span>
+          </template>
+        </s-table>
+      </div>
+    </a-spin>
+  </a-drawer>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+import { STable } from '@/components'
+import { queryWaitingProductPage } from '@/api/promoActive'
+import ProductBrand from '@/views/common/productBrand.js'
+import ProductType from '../../common/productType.js'
+export default {
+  name: 'ChooseProductsModal',
+  components: { STable, ProductBrand, ProductType },
+  mixins: [commonMixin],
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    },
+    chooseData: {// 隐藏选择的产品
+      type: Array,
+      default: () => {
+        return []
+      }
+    },
+    chooseType: {// 选中的分类
+      type: Array,
+      default: () => {
+        return []
+      }
+    },
+    chooseProduct: {// 当前行选中的数据
+      type: Array,
+      default: () => {
+        return []
+      }
+    },
+    itemSn: {
+      type: String,
+      default: ''
+    },
+    zIndex: { // 层级
+      type: [String, Number],
+      default: 1000
+    }
+  },
+  data () {
+    const _this = this
+    return {
+      spinning: false,
+      isShow: this.openModal, //  是否打开弹框
+      formItemLayout: {
+        labelCol: { span: 4 },
+        wrapperCol: { span: 20 }
+      },
+      queryParam: { //  查询条件
+        productName: '', // 产品名称
+        productCode: '', //  产品编码
+        origCode: '', // 原厂编码
+        productBrandSn: undefined, //  产品品牌
+        productType: [],
+        productTypeSn1: '', //  产品一级分类
+        productTypeSn2: '', //  产品二级分类
+        productTypeSn3: '', //  产品三级分类
+        hideProductSnList: [],
+        productTypeSnList: []
+      },
+      chooseDataList: [],
+      disabled: false, //  查询、重置按钮是否可操作
+      loading: false, //  表格加载中
+      columns: [
+        { title: '序号', dataIndex: 'no', width: 60, align: 'center' },
+        { title: '产品编码', dataIndex: 'code', align: 'center' },
+        { title: '产品名称', dataIndex: 'name', align: 'center', width: '18%', ellipsis: true, customRender: function (text) { return text || '--' } },
+        { title: '原厂编码', dataIndex: 'origCode', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
+        { title: '终端价', dataIndex: 'terminalPrice', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        // { title: '市级价', dataIndex: 'cityPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        // { title: '特约价', dataIndex: 'specialPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '品牌', dataIndex: 'productBrandName', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
+        { title: '产品分类', scopedSlots: { customRender: 'productType' }, width: '10%', align: 'center' },
+        { title: '包装数', scopedSlots: { customRender: 'productQty' }, width: '10%', align: 'center' },
+        { title: '单位', dataIndex: 'unit', align: 'center', width: '10%', ellipsis: true, customRender: function (text) { return text || '--' } }
+      ],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        this.spinning = true
+        const params = Object.assign(parameter, this.queryParam)
+        params.hideProductSnList = this.chooseData
+        params.productTypeSnList = this.chooseType
+        params.promoActiveSn = this.itemSn
+        return queryWaitingProductPage(params).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
+            }
+            this.disabled = false
+            const _this = this
+            // 选中回显
+            if (_this.chooseProduct && _this.chooseProduct.length > 0) {
+              const selectedRows = []
+              let selectedRowKeys = []
+              data.list.forEach(item => {
+                const flag = _this.chooseProduct.includes(item.productSn)
+                if (flag) {
+                  selectedRows.push(item)
+                }
+              })
+              selectedRowKeys = _this.chooseProduct
+              _this.$nextTick(() => { // 页面渲染完成后的回调
+                _this.$refs.table.setTableSelected(selectedRowKeys, selectedRows) // 设置表格选中项
+              })
+            }
+          }
+          _this.spinning = false
+          return data
+        })
+      },
+      rowSelectionInfo: null
+    }
+  },
+  computed: {
+    selectCount () {
+      return this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length
+    }
+  },
+  methods: {
+    // 表格选中项
+    rowSelectionFun (obj) {
+      this.rowSelectionInfo = obj || null
+    },
+    // 重置数据
+    resetData () {
+      this.queryParam.productName = ''
+      this.queryParam.productCode = ''
+      this.queryParam.origCode = ''
+      this.queryParam.productBrandSn = undefined
+      this.queryParam.productTypeSn1 = ''
+      this.queryParam.productTypeSn2 = ''
+      this.queryParam.productTypeSn3 = ''
+      this.queryParam.productType = []
+      this.$nextTick(() => {
+        this.$refs.table.refresh(true)
+      })
+    },
+    //  清空选项
+    resetSearchForm () {
+      this.$refs.table.clearSelected()
+    },
+    // 批量添加
+    handleSave () {
+      if (!this.rowSelectionInfo || (this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length < 1)) {
+        this.$message.warning('请在列表勾选后再进行操作!')
+        return
+      }
+      const resultList = JSON.parse(JSON.stringify(this.rowSelectionInfo && this.rowSelectionInfo.selectedRows))
+      this.$emit('ok', resultList)
+      this.isShow = false
+    },
+    // 关闭弹框
+    onClose () {
+      this.isShow = false
+      this.$emit('close')
+    },
+    //  产品分类  change
+    changeProductType (val, opt) {
+      this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
+      this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
+      this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.resetSearchForm()
+        this.rowSelectionInfo = null
+        this.$emit('close')
+      } else {
+        const _this = this
+        _this.resetData()
+      }
+    }
+  }
+}
+</script>
+
+<style lang="less" scoped>
+  .chooseProducts-modal{
+    .products-con{
+      .btn-con{
+        text-align: center;
+        margin: 30px 0 20px;
+        .button-cancel{
+          font-size: 12px;
+        }
+      }
+    }
+  }
+</style>

+ 388 - 0
src/views/promotionManagement/promotionInfo/detailModal.vue

@@ -0,0 +1,388 @@
+<template>
+  <a-modal
+    centered
+    class="promotion-basicInfo-modal"
+    :footer="null"
+    :maskClosable="false"
+    title="详情"
+    v-model="isShow"
+    @cancel="isShow=false"
+    width="70%">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <div class="detailModal-con">
+        <a-form-model
+          id="promotion-basicInfo-form"
+          ref="ruleForm"
+          :model="form"
+          :rules="rules"
+          :label-col="formItemLayout.labelCol"
+          :wrapper-col="formItemLayout.wrapperCol" >
+          <a-form-model-item label="标题" prop="title">
+            {{ form.title }}
+          </a-form-model-item>
+          <a-form-model-item label="排序" prop="sort">
+            {{ form.sort }}
+          </a-form-model-item>
+          <a-form-model-item label="封面图片" prop="imageSet">
+            <img
+              :src="con"
+              alt="图片走丢了"
+              width="80"
+              height="80"
+              v-for="(con,i) in imageSet"
+              style="margin-right:10px;object-fit: cover;"
+              :key="i"/>
+            <div class="upload-desc">说明:单张大小小于10Mb;建议尺寸:宽(420px)*高(230px)</div>
+          </a-form-model-item>
+          <a-form-model-item label="内容类型" prop="contentType">
+            {{ form.contentType==='IMAGE_CONTENT'?'图文展示':form.contentType==='VIDEO'?'视频展示':'跳转链接' }}
+          </a-form-model-item>
+          <div v-if="form.contentType==='IMAGE_CONTENT'">
+            <a-form-model-item label="内容" prop="content" >
+              <div class="box" v-html="form.content"></div>
+            </a-form-model-item>
+          </div>
+          <div v-if="form.contentType==='VIDEO'">
+            <a-form-model-item label="内容" prop="content" >
+              <video
+                ref="videoPlayer"
+                width="230"
+                height="150"
+                controls
+                loop
+                controlsList="nodownload">
+                <source :src="form.content" type="video/mp4">
+              </video>
+            </a-form-model-item>
+          </div>
+          <div v-if="form.contentType==='LINK'">
+            <a-form-model-item label="内容" prop="ruleType">
+              {{ form.content }}
+            </a-form-model-item>
+          </div>
+          <div v-show="form.contentType==='LINK'&&form.content === '/pagesB/promoDetail'">
+            <a-form-model-item label="基本规则" prop="ruleType">
+              {{ form.promoRule&&form.promoRule.ruleType?form.promoRule.ruleType==='ticket'?'指定产品返代金券':'--':'--' }}
+            </a-form-model-item>
+            <a-form-model-item label="券名称" prop="ruleName">
+              {{ form.promoRule&&form.promoRule.ruleName?form.promoRule.ruleName:'--' }}
+            </a-form-model-item>
+            <a-form-model-item label="券副标题" prop="ruleTitle">
+              {{ form.promoRule&&form.promoRule.ruleTitle?form.promoRule.ruleTitle:'--' }}
+            </a-form-model-item>
+            <a-form-model-item label="生成方式" prop="ruleBaseType">
+              {{ form.promoRule&&form.promoRule.ruleBaseType?form.promoRule.ruleBaseType==='bill'?'按订单生成券':'按订单产品款数生成券':'--' }}
+            </a-form-model-item>
+            <a-form-model-item label="券有效期" prop="validType" >
+              <span>
+                {{ form.promoRule&&form.promoRule.validType?form.promoRule.validType==='FIXED'?'固定日期':'领取后,立即生效,':'--' }}
+              </span>
+              <span class="timeBox" v-if="form.promoRule&&form.promoRule.validType&&form.promoRule.validType==='FIXED'">{{ form.promoRule.validStartDate }}~{{ form.promoRule.validEndDate }}</span>
+              <span class="timeBox" v-else>有效期{{ form.promoRule&&form.promoRule.validDays?form.promoRule.validDays:'--' }}天</span>
+            </a-form-model-item>
+            <a-form-model-item label="券适用范围" prop="range" >
+              全部产品
+            </a-form-model-item>
+            <a-form-model-item label="使用说明" prop="ruleExplain" >
+              {{ form.promoRule&&form.promoRule.ruleExplain?form.promoRule.ruleExplain:'--' }}
+            </a-form-model-item>
+            <a-form-model-item label="产品范围" prop="productRangeList" >
+              <div v-if="productRangeList&&productRangeList.length>0" style="margin-bottom:10px;">
+                <a-tree-select
+                  v-model="productRangeList"
+                  :tree-data="productTypeList"
+                  tree-checkable
+                  :disabled="true"
+                  :getPopupContainer="triggerNode => triggerNode.parentNode"
+                  :replaceFields="{children:'children',title: 'productTypeName',key: 'productTypeSn',value: 'productTypeSn'}"
+                  placeholder="请选择产品范围" />
+              </div>
+              <div v-else>--</div>
+            </a-form-model-item>
+            <a-form-model-item label="返券产品" prop="publishFlag" >
+              <div class="productTable">
+                <s-table
+                  class="sTable"
+                  ref="table"
+                  size="small"
+                  :rowKey="(record) => record.id"
+                  :columns="columns"
+                  :data="loadData"
+                  :defaultLoadData="false"
+                  :style="{ maxHeight: 300+'px' }"
+                  :scroll="{ y:230 }"
+                  bordered>
+                </s-table>
+              </div>
+            </a-form-model-item>
+          </div>
+        </a-form-model>
+        <div class="btn-cont">
+          <a-button id="promotion-basicInfo-modal-back" @click="isShow = false">关闭</a-button>
+        </div>
+      </div>
+    </a-spin>
+  </a-modal>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+import { STable } from '@/components'
+import { productTypeQuery } from '@/api/productType'
+import { promoActiveDetail, promoRuleProductList } from '@/api/promoActive'
+
+export default {
+  name: 'DetailModal',
+  mixins: [commonMixin],
+  components: { STable },
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    },
+    itemSn: {
+      type: String,
+      default: ''
+    }
+  },
+  data () {
+    return {
+      isShow: this.openModal, //  是否打开弹框
+      spinning: false,
+      formItemLayout: {
+        labelCol: { span: 4 },
+        wrapperCol: { span: 18 }
+      },
+      productTypeList: [],
+      productRangeList: [],
+      form: {
+        promoActiveSn: undefined, // 促销活动sn
+        title: '', // 标题
+        imageSet: '', // 图片
+        contentType: 'IMAGE_CONTENT', // 内容类型
+        content: '', // 内容
+        contentLink: '', // 链接内容
+        sort: undefined, // 排序
+        ruleEnableFlag: '1', // 参数配置 1勾选配置  0不能配置
+        publishFlag: '0',
+        dealerEditFlag: '0', // 加盟商编辑 1是 0否
+        promoRule: {
+          ruleType: 'ticket', // 基本规则类型
+          productRangeFlag: '', // 产品范围标记 0无  1有产品范围
+          productRangeList: [], // 产品范围列表
+          ruleName: '', // 券名称
+          ruleTitle: '', // 副标题
+          ruleBaseType: 'category', // 券生成方式
+          ruleExplain: '', // 使用说明
+          validType: undefined, // 券有效期类型
+          validStartDate: undefined, // 券生效时间
+          validEndDate: undefined, // 券失效时间
+          validDays: undefined, // 券有效期天数
+          range: '1'
+        }
+      },
+      imageSet: [],
+      columns: [
+        { title: '序号', dataIndex: 'no', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品编码', dataIndex: 'productCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productName', width: '20%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '原厂编码', dataIndex: 'origCode', width: '20%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '活动价', dataIndex: 'price', width: '12%', align: 'right', customRender: text => { return ((text || text == 0) ? this.toThousands(text) : '--') } },
+        { title: '返券金额', dataIndex: 'ruleValue', width: '12%', align: 'right', customRender: text => { return ((text || text == 0) ? this.toThousands(text) : '--') } },
+        { title: '参考终端价', dataIndex: 'terminalPrice', width: '10%', align: 'right', customRender: text => { return ((text || text == 0) ? this.toThousands(text) : '--') } }
+      ],
+      rules: {
+        title: [{ required: true, message: '请输入标题名称', trigger: 'blur' }],
+        imageSet: [{ required: true, message: '请选择要上传的封面图片', trigger: 'change' }],
+        sort: [{ required: true, message: '请输入排序数字', trigger: 'blur' }],
+        contentType: [{ required: true, message: '请选择内容类型', trigger: 'change' }],
+        content: [{ required: true, message: '请输入对应内容', trigger: ['blur', 'change'] }],
+        contentLink: [{ required: true, message: '请输入对应内容', trigger: 'blur' }],
+        range: [{ required: true, message: '请选择券适用范围', trigger: 'change' }],
+        ruleType: [{ required: true, message: '请选择基本规则', trigger: 'change' }],
+        ruleName: [{ required: true, message: '请输入券名称', trigger: ['change', 'blur'] }],
+        ruleBaseType: [{ required: true, message: '请选择生成方式', trigger: 'change' }],
+        validType: [{ required: true, message: '请选择券有效期类型', trigger: 'change' }],
+        ruleDetailList: [{ type: 'array', required: true, message: '请选择券内容', trigger: 'blur' }]
+      },
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        this.spinning = true
+        const params = Object.assign(parameter, this.queryParam)
+        params.promoActiveSn = this.itemSn
+        return promoRuleProductList(params).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
+            }
+            this.disabled = false
+          }
+          this.spinning = false
+          return data
+        })
+      }
+    }
+  },
+  methods: {
+    // 重置
+    resetSearchForm () {
+      this.form = {
+        promoActiveSn: undefined, // 促销活动sn
+        title: '', // 标题
+        imageSet: '', // 图片
+        contentType: 'IMAGE_CONTENT', // 内容类型
+        content: '', // 内容
+        contentLink: '', // 链接内容
+        sort: undefined, // 排序
+        ruleEnableFlag: '1', // 参数配置 1勾选配置  0不能配置
+        publishFlag: '0',
+        dealerEditFlag: '0', // 加盟商编辑 1是 0否
+        promoRule: {
+          ruleType: 'ticket', // 基本规则类型
+          productRangeFlag: '', // 产品范围标记 0无  1有产品范围
+          productRangeList: [], // 产品范围列表
+          ruleName: '', // 券名称
+          ruleTitle: '', // 副标题
+          ruleBaseType: 'category', // 券生成方式
+          ruleExplain: '', // 使用说明
+          validType: undefined, // 券有效期类型
+          validStartDate: undefined, // 券生效时间
+          validEndDate: undefined, // 券失效时间
+          validDays: undefined, // 券有效期天数
+          range: '1'
+        }
+      }
+      this.imageSet = []
+      this.productRangeList = []
+    },
+    // 获取列表详情
+    getDetail () {
+      promoActiveDetail({ sn: this.itemSn }).then(res => {
+        if (res.status == 200) {
+          if (res.data.contentType === 'LINK') {
+            console.log('加载产品范围')
+            this.$nextTick(() => {
+              this.getTreeData()
+            })
+            if (res.data.promoRule && res.data.promoRule.productRangeList && res.data.promoRule.productRangeList.length > 0) {
+              this.productRangeList = res.data.promoRule.productRangeList.map(item => { return item.productTypeSn })
+            } else {
+              this.productRangeList = []
+            }
+          }
+          if (res.data.images) {
+            this.form.imageSet = res.data.images
+            this.imageSet = res.data.images.split(',')
+          }
+          this.form = res.data
+        }
+      })
+    },
+    // 获取产品范围数据
+    getTreeData () {
+      productTypeQuery({}).then(res => {
+        if (res.status == 200) {
+          this.productTypeList = res.data
+        } else {
+          this.productTypeList = []
+        }
+      })
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.$emit('close')
+        this.resetSearchForm()
+      } else {
+        this.getDetail()
+        this.$nextTick(() => {
+          this.$refs.table.refresh(true)
+        })
+      }
+    }
+  }
+}
+</script>
+
+<style lang="less" scoped>
+  .promotion-basicInfo-modal{
+    .detailModal-con{
+      max-height: 600px;
+      overflow-y: scroll;
+    }
+    .timeBox{
+      color:#ed1c24;
+      opacity: .7;
+    }
+    .ant-modal-body {
+      padding: 40px 40px 24px;
+    }
+    .promotion-basicInfo-con{
+      margin-top:10px;
+    }
+    .ant-form-item{
+      margin-bottom:0 !important;
+    }
+    .buyerBox{
+      border:1px solid #d9d9d9;margin-top:10px;border-radius:4px;padding:4px 10px;background:#f2f2f2;max-height:130px;overflow-y:scroll;
+    }
+    .btn-cont {
+      text-align: center;
+      margin: 35px 0 10px;
+    }
+    //处理滚动条不显示
+    .tabBox{
+       max-height:100px;
+       overflow-y:scroll;
+    }
+   .tabBox::-webkit-scrollbar {
+       width: 0px;
+    }
+    .tabBox::-webkit-scrollbar-track {
+      background: transparent;
+    }
+
+    .tabBox::-webkit-scrollbar-thumb {
+      background: transparent;
+    }
+
+    .tabBox::-webkit-scrollbar-button {
+      display: none;
+    }
+    // 设置input  禁用颜色
+    .ant-form-item-control .ant-input[disabled]{
+      color:#333333;
+      background:#ffffff;
+    }
+   .ant-radio-button-wrapper-disabled{
+     color:#333333;
+     padding:0 16px;
+   }
+   .ant-radio-button-wrapper-disabled.ant-radio-button-wrapper-checked{
+       background-color: #ed1c24 !important;
+       color:#ffffff;
+       padding:0 16px;
+   }
+   /deep/.ant-select-disabled .ant-select-selection, .ant-cascader-picker-disabled{
+      color:#333 !important;
+      background:#fff;
+   }
+   .productTable{
+     width:100%;
+   }
+   /deep/.ant-select-disabled .ant-select-selection--multiple .ant-select-selection__choice{
+     color:#333;
+   }
+  }
+
+</style>

+ 743 - 0
src/views/promotionManagement/promotionInfo/edit.vue

@@ -0,0 +1,743 @@
+<template>
+  <div class="promotionEdit-wrap">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <a-page-header :ghost="false" :backIcon="false" class="promotionEdit-cont" >
+        <!-- 自定义的二级文字标题 -->
+        <template slot="subTitle">
+          <a id="promotionEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" />返回列表</a>
+          <span v-if="pageType==='edit'" style="margin: 0 10px 0 20px;color: #666;font-size: 14px;font-weight: 600;">促销名称:{{ promotionName||'--' }}</span>
+        </template>
+      </a-page-header>
+      <!-- 表单 -->
+      <a-card :bordered="false" class="promotionEdit-cont">
+        <a-form-model
+          id="promotionEdit-form"
+          ref="ruleForm"
+          :model="form"
+          :rules="rules"
+          :label-col="formItemLayout.labelCol"
+          :wrapper-col="formItemLayout.wrapperCol"
+        >
+          <a-row>
+            <a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
+              <a-form-model-item label="标题" prop="title" :label-col="{span:4}" :wrapper-col="{span:16}">
+                <a-input
+                  id="promotionEdit-title"
+                  :maxLength="30"
+                  v-model.trim="form.title"
+                  placeholder="请输入标题名称(最多30个字符)"
+                  :disabled="isDisabled"
+                  allowClear/>
+              </a-form-model-item>
+            </a-col>
+            <a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
+              <a-form-model-item label="排序" prop="sort" :label-col="{span:4}" :wrapper-col="{span:16}">
+                <a-input-number
+                  style="width:100%"
+                  id="promotionEdit-sort"
+                  :disabled="isDisabled"
+                  allowClear
+                  placeholder="请输入排序数字(数字越大越靠后)"
+                  v-model="form.sort"
+                  :min="0"
+                  :max="999999"/>
+              </a-form-model-item>
+            </a-col>
+            <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
+              <a-form-model-item label="封面图片" prop="imageSet">
+                <Upload
+                  v-if="pageType==='add'||(pageType==='edit'&&!isDisabled)"
+                  class="upload"
+                  id="promotionEdit-imageSet"
+                  v-model="form.imageSet"
+                  ref="imageSet"
+                  :fileSize="10"
+                  :maxNums="1"
+                  @change="changeImage"
+                  listType="picture-card"></Upload>
+                <div v-else>
+                  <img
+                    :src="con"
+                    alt="图片走丢了"
+                    width="80"
+                    height="80"
+                    v-for="(con,i) in imageSet"
+                    style="margin-right:10px;object-fit: cover;"
+                    :key="i" />
+                </div>
+                <span class="upload-desc">说明:单张大小小于10Mb;建议尺寸:宽(420px)*高(230px)</span>
+              </a-form-model-item>
+            </a-col>
+            <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
+              <a-form-model-item label="内容类型" prop="contentType">
+                <v-select
+                  v-model="form.contentType"
+                  id="promotion-saleStatus"
+                  code="PROMO_CONTENT_TYPE"
+                  showType="radio"
+                  :disabled="isDisabled"
+                  @change="changeContentType"
+                  allowClear></v-select>
+              </a-form-model-item>
+            </a-col>
+            <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
+              <a-form-model-item label="内容" prop="content" v-show="form.contentType =='IMAGE_CONTENT'">
+                <editor
+                  v-show="pageType === 'add'||(pageType === 'edit'&&!isDisabled)"
+                  id="promotionEdit-editor"
+                  ref="editor"
+                  class="promotionEdit-editor"
+                  @on-change="editorChange"
+                  :cache="false"></editor>
+                <div v-if="(pageType === 'edit')&&isDisabled" class="box" v-html="form.content"></div>
+              </a-form-model-item>
+              <a-form-model-item label="上传视频" prop="content" v-show="form.contentType =='VIDEO'">
+                <Upload
+                  v-if="pageType==='add'||(pageType==='edit'&&!isDisabled)"
+                  class="upload"
+                  id="promotionEdit-imageSet"
+                  v-model="form.content"
+                  fileType="video/mp4"
+                  ref="videoSet"
+                  :fileSize="100"
+                  :maxNums="1"
+                  @change="changeVideo"
+                ></Upload>
+                <div v-else>
+                  <video
+                    ref="videoPlayer"
+                    width="230"
+                    height="150"
+                    controls
+                    loop
+                    controlsList="nodownload">
+                    <source :src="form.content" type="video/mp4">
+                  </video>
+                </div>
+                <span class="upload-desc">说明:文件最大100M;视频:mp4.avi.flv</span>
+              </a-form-model-item>
+              <a-form-model-item label="跳转链接" prop="contentLink" v-if="form.contentType =='LINK'">
+                <a-input
+                  style="width:50%;"
+                  :disabled="form.linkType==='1'||(pageType==='edit'&&isDisabled)"
+                  id="promotionEdit-title"
+                  :maxLength="100"
+                  v-model.trim="form.contentLink"
+                  placeholder="请输入跳转链接"
+                  @blur="handleLink"
+                  allowClear />
+                <a-select
+                  id="promotionEdit-title"
+                  :disabled="isDisabled"
+                  default-value="货架促销"
+                  @change="handleLinkType"
+                  style="width: 120px;margin-left:10px;"
+                  v-model="form.linkType">
+                  <a-select-option value="1">
+                    货架促销
+                  </a-select-option>
+                  <a-select-option value="2">
+                    其他
+                  </a-select-option>
+                </a-select>
+                <!-- <span class="tip upload-desc">
+                  选择【货架促销】,促销内容会同步显示在促销模块内
+                </span> -->
+              </a-form-model-item>
+            </a-col>
+          </a-row>
+          <a-row v-if="form.contentType ==='LINK'&&form.linkType==='1'">
+            <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
+              <a-form-model-item label="基本规则" prop="promoRule.ruleType">
+                <v-select
+                  style="width:40%;"
+                  v-model="form.promoRule.ruleType"
+                  placeholder="请选择基本规则"
+                  id="promotionEdit-ruleType"
+                  code="PROMO_ACTIVE_RULE_TYPE"
+                  :disabled="isDisabled"
+                  allowClear></v-select>
+              </a-form-model-item>
+            </a-col>
+            <a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
+              <a-form-model-item label="券名称" :label-col="{span:4}" :wrapper-col="{span:16}" prop="promoRule.ruleName">
+                <a-input
+                  :disabled="isDisabled"
+                  id="promotionEdit-ruleName"
+                  :maxLength="20"
+                  v-model.trim="form.promoRule.ruleName"
+                  placeholder="请输入券名称(最多20个字符)"
+                  allowClear />
+              </a-form-model-item>
+            </a-col>
+            <a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
+              <a-form-model-item label="券副标题" :label-col="{span:4}" :wrapper-col="{span:16}">
+                <a-input
+                  :disabled="isDisabled"
+                  id="promotionEdit-ruleTitle"
+                  :maxLength="20"
+                  v-model.trim="form.promoRule.ruleTitle"
+                  placeholder="请输入券副标题(最多20个字符)"
+                  allowClear />
+              </a-form-model-item>
+            </a-col>
+            <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
+              <a-form-model-item label="生成方式" prop="promoRule.ruleBaseType">
+                <v-select
+                  style="width:40%;"
+                  v-model="form.promoRule.ruleBaseType"
+                  id="promotionEdit-ruleBaseType"
+                  code="PROMO_RULE_BASE_TYPE"
+                  :disabled="isDisabled"
+                  allowClear></v-select>
+              </a-form-model-item>
+            </a-col>
+            <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
+              <a-form-model-item label="券有效期" prop="promoRule.validType">
+                <v-select
+                  style="width:40%;"
+                  v-model="form.promoRule.validType"
+                  placeholder="请选择券有效期"
+                  id="promotionEdit-validType"
+                  code="PROMO_RULE_TICKET_TYPE"
+                  :disabled="isDisabled"
+                  @change="handleValidType"
+                  allowClear></v-select>
+                <a-range-picker
+                  v-show="form.promoRule.validType==='FIXED'"
+                  style="width:40%;margin-left:10px;"
+                  v-model="time"
+                  :format="dateFormat"
+                  @change="dateChange"
+                  :disabled="isDisabled"
+                  :disabled-date="disabledDate"
+                  :placeholder="['开始时间', '结束时间']" />
+                <span style="width:40%;margin-left:10px;" v-show="form.promoRule.validType==='LIMIT'">
+                  有效期<a-input-number
+                    style="margin:0 5px;"
+                    v-model="form.promoRule.validDays"
+                    :step="1"
+                    :max="99999999"
+                    :min="1"
+                    :disabled="isDisabled"
+                    :precision="0"/>天
+                </span>
+              </a-form-model-item>
+            </a-col>
+            <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
+              <a-form-model-item class="productName" label="券适用范围" prop="promoRule.range">
+                全部产品
+              </a-form-model-item>
+            </a-col>
+            <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
+              <a-form-model-item label="使用说明" prop="promoRule.ruleExplain">
+                <a-input
+                  v-model="form.promoRule.ruleExplain"
+                  :disabled="isDisabled"
+                  type="textarea"
+                  placeholder="请输入使用说明(最多50个字符)"
+                  :maxLength="50" />
+              </a-form-model-item>
+            </a-col>
+            <div style="text-align:center;" v-if="!isShowNextStep"><a-button type="primary" size="large" :disabled="isDisabled" @click="handleSave('part')" >保存后设置产品</a-button></div>
+            <div v-if="form.contentType =='LINK'&&isShowNextStep">
+              <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
+                <a-form-model-item label="产品范围">
+                  <div id="setPromotion-productRange" style="position:relative;">
+                    <a-tree-select
+                      v-model="productRangeList"
+                      :maxTagCount="12"
+                      :tree-data="productTypeList"
+                      tree-checkable
+                      :disabled="isDisabled"
+                      :getPopupContainer="triggerNode => triggerNode.parentNode"
+                      :replaceFields="{children:'children',title: 'productTypeName',key: 'productTypeSn',value: 'productTypeSn'}"
+                      @change="onChangeTree"
+                      placeholder="请选择产品范围" />
+                  </div>
+                </a-form-model-item>
+              </a-col>
+              <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
+                <a-form-model-item label="返券产品" prop="promoRule.range">
+                  <div class="productInfo flex-center">
+                    <div>
+                      返券金额<a-input-number
+                        v-model="form.promoRule.ruleValue"
+                        style="margin:0 5px;"
+                        :min="0"
+                        :step="1"
+                        :precision="2"
+                        :max="99999999"
+                        size="small"/> 元
+                      <a-button type="primary" class="button-primary" size="small" @click="handleBatchAdd">批量设置</a-button>
+                    </div>
+                    <a-button v-if="this.productRangeList&&this.productRangeList.length>0" type="primary" @click="handleAddProduct" size="small">添加产品</a-button>
+                  </div>
+                </a-form-model-item>
+              </a-col>
+              <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
+                <div style="width: 83%;margin:0 auto 10px;">
+                  <productTable ref="chooseProductList" :promoActiveSn="$route.params.sn"></productTable>
+                </div>
+              </a-col>
+            </div>
+          </a-row>
+        </a-form-model>
+      </a-card>
+    </a-spin>
+    <div class="affix-cont">
+      <a-button
+        type="primary"
+        class="button-primary"
+        :disabled="spinning"
+        id="productInfoEdit-submit-btn"
+        size="large"
+        @click="handleSave('all')"
+        v-if="form.contentType !='LINK'|| isShowNextStep ||(form.contentType ==='LINK'&&form.linkType ==='2')"
+        style="padding: 0 60px;">保存</a-button>
+    </div>
+    <!-- 添加产品 -->
+    <chooseProduct
+      ref="chooseProduct"
+      :chooseType="chooseTypeList"
+      :itemSn="$route.params.sn"
+      :openModal="showProModal"
+      @ok="addProductSuccess"
+      @close="closeProductModal"></chooseProduct>
+  </div>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+import moment from 'moment'
+// 组件
+import { VSelect, Upload } from '@/components'
+import Editor from '@/components/WEeditor'
+import promotionShowModal from './promotionShowModal'
+import productTable from './productTable'
+import chooseProduct from './chooseProductsModal.vue'
+// 接口
+import { productTypeQuery } from '@/api/productType'
+import { promoActivePublish, promoActiveDetail, saveBatchEntity, promoCreateBatch, deleteByProductType } from '@/api/promoActive'
+export default {
+  name: 'ProductBrandEditModal',
+  mixins: [commonMixin],
+  components: { VSelect, Upload, Editor, promotionShowModal, chooseProduct, productTable },
+  data () {
+    return {
+      spinning: false,
+      // 第一个表单 label 设置
+      formItemLayout: {
+        labelCol: { span: 2 },
+        wrapperCol: { span: 20 }
+      },
+      productRangeList: [], // 产品范围列表
+      // 链接配置内容
+      form: {
+        promoActiveSn: undefined, // 促销活动sn
+        title: '', // 标题
+        imageSet: '', // 图片
+        contentType: 'IMAGE_CONTENT', // 内容类型
+        content: '', // 内容
+        contentLink: '', // 链接内容
+        sort: undefined, // 排序
+        publishFlag: '0', // 是否发布
+        linkType: '1',
+        dealerEditFlag: '0', // 加盟商编辑 1是 0否
+        promoRule: {
+          ruleType: 'ticket', // 基本规则类型
+          ruleName: '', // 券名称
+          ruleTitle: '', // 副标题
+          ruleBaseType: 'category', // 券生成方式
+          ruleExplain: '', // 使用说明
+          validType: undefined, // 券有效期类型
+          validStartDate: undefined, // 券生效时间
+          validEndDate: undefined, // 券失效时间
+          validDays: undefined, // 券有效期天数
+          dealerEditFlag: '0', // 加盟商编辑 1是 0否
+          publishFlag: '0', // 是否发布
+          range: '1'
+        }
+      },
+      time: [], // 有效期
+      dateFormat: 'YYYY-MM-DD', // 有效期时间格式
+      promotionName: '', // 促销名称
+      pageType: undefined, // 页面类型
+      showProModal: false, // 打开产品弹窗
+      isShowNextStep: false, // 是否显示下一步 并提交一半配置产品
+      isDisabled: false, // 控制页面是否能编辑
+      chooseTypeList: [], // 已选中产品范围
+      imageSet: [], // 回显显示图片数据
+      productTypeList: [], // 产品范围    列表数据
+      rules: {
+        title: [{ required: true, message: '请输入标题名称', trigger: 'blur' }],
+        imageSet: [{ required: true, message: '请选择要上传的封面图片', trigger: 'change' }],
+        sort: [{ required: true, message: '请输入排序数字', trigger: 'blur' }],
+        contentType: [{ required: true, message: '请选择内容类型', trigger: 'change' }],
+        content: [{ required: true, message: '请输入对应内容', trigger: ['blur', 'change'] }],
+        contentLink: [{ required: true, message: '请输入对应内容', trigger: 'blur' }],
+        publishFlag: [{ required: true, message: '请选择是否发布', trigger: 'change' }],
+        'promoRule.ruleType': [{ required: true, message: '请选择基本规则', trigger: 'change' }],
+        'promoRule.ruleName': [{ required: true, message: '请输入券名称', trigger: ['change', 'blur'] }],
+        'promoRule.ruleBaseType': [{ required: true, message: '请选择生成方式', trigger: 'change' }],
+        'promoRule.validType': [{ required: true, message: '请选择券有效期类型', trigger: 'change' }],
+        'promoRule.publishFlag': [{ required: true, message: '请选择是否发布', trigger: 'change' }],
+        'promoRule.dealerEditFlag': [{ required: true, message: '请选择加盟商是否可编辑', trigger: 'change' }],
+        'promoRule.range': [{ required: true, message: '请选择', trigger: 'blur' }],
+        dealerEditFlag: [{ required: true, message: '请选择加盟商是否可编辑', trigger: 'change' }]
+      }
+    }
+  },
+  methods: {
+    // 禁用日期时间
+    disabledDate (current) {
+      return current && current < moment().startOf('day')
+    },
+    dateChange (date, dateString) {
+      this.time = date
+      if (dateString[0] != '' && dateString[1] != '') {
+        this.form.promoRule.validStartDate = dateString[0] + ' 00:00:00'
+        this.form.promoRule.validEndDate = dateString[1] + ' 23:59:59'
+      }
+    },
+    // 打开产品弹窗
+    insterProduct (obj) {
+      if (obj && Object.keys(obj).length > 0) {
+        this.chooseTypeList = obj.typeArr
+      }
+      this.showProModal = true
+    },
+    closeProductModal () {
+      this.showProModal = false
+    },
+    // 返回列表
+    handleBack () {
+      this.$router.push({ name: 'promotionInfoList', query: { closeLastOldTab: true } })
+    },
+    //  详情  挨个赋值原因:该接口和修理厂促销列表详情用的同一个接口,给后端传值过滤多余参数
+    getDetail () {
+      const _this = this
+      promoActiveDetail({ sn: this.$route.params.sn }).then(res => {
+        if (res.status == 200) {
+          // 编辑按钮时,publishState 已发布,只能编辑是否发布;publishState已关闭,都可以编辑
+          if (_this.pageType === 'edit') {
+            _this.isDisabled = res.data.publishState === 'PUBLISH'
+            _this.form.promoRule.publishFlag = res.data.publishFlag
+            _this.form.promoRule.dealerEditFlag = res.data.dealerEditFlag
+          }
+          _this.form.publishFlag = res.data.publishFlag
+          _this.form.dealerEditFlag = res.data.dealerEditFlag
+          _this.form.promoActiveSn = res.data.promoActiveSn
+          _this.form.title = res.data.title
+          _this.form.contentType = res.data.contentType
+          _this.form.sort = res.data.sort
+          _this.imageSet = res.data.imageSet
+          if (res.data.images) {
+            const images = res.data.images.split(',')
+            _this.imageSet = images
+            if (this.pageType === 'add' || (this.pageType === 'edit' && res.data.publishState != 'PUBLISH')) {
+              _this.$refs.imageSet.setFileList(images)
+            }
+          }
+          _this.form.content = res.data.content
+          _this.promotionName = res.data.name || ''
+          _this.form.dealerEditFlag = res.data.dealerEditFlag
+          if (res.data.contentType == 'IMAGE_CONTENT') {
+            _this.$refs.editor.setHtml(res.data.content)
+          } else if (res.data.contentType == 'VIDEO') {
+            if (res.data.publishState != 'PUBLISH') {
+              _this.$refs.videoSet.setFileList(res.data.content)
+            }
+          } else if (res.data.contentType == 'LINK') {
+            _this.form.contentLink = res.data.content
+            _this.form.linkType = res.data.content != '/pagesB/promoDetail' ? '2' : '1'
+            if (res.data.promoRule) {
+              _this.isShowNextStep = true
+              _this.form.promoRule.range = '1'
+              _this.time = [res.data.promoRule.validStartDate, res.data.promoRule.validEndDate]
+              if (res.data.promoRule.productRangeList && res.data.promoRule.productRangeList.length > 0) {
+                _this.productRangeList = res.data.promoRule.productRangeList.map(item => { return item.productTypeSn })
+              }
+            }
+            _this.form.promoRule = { ..._this.form.promoRule, ...res.data.promoRule }
+          }
+        }
+      })
+    },
+    // 券有效期 change
+    handleValidType (con) {
+      this.form.promoRule.validType = con
+      if (con === 'FIXED') {
+        this.form.promoRule.validDays = undefined
+      } else {
+        this.time = []
+        this.form.promoRule.validStartDate = undefined
+        this.form.promoRule.validEndDate = undefined
+      }
+    },
+    //  确定保存  验证必填
+    handleSave () {
+      if (this.form.contentType === 'LINK') {
+        if (this.$refs.chooseProductList) {
+          const numInfo = this.$refs.chooseProductList.getDataNum()
+          if (numInfo == 0) {
+            this.$message.warning('请选择返券产品!')
+            return
+          }
+        }
+      }
+      this.$message.success('保存成功')
+      this.$nextTick(() => {
+        this.handleBack()
+        this.resetSearchForm()
+      })
+    },
+    //  图片上传
+    changeImage (file) {
+      this.form.imageSet = file
+    },
+    // 视频上传
+    changeVideo (file) {
+      this.form.content = file
+    },
+    //  文本编辑器
+    editorChange (html, text) {
+      this.form.content = html
+    },
+    // 重置
+    resetSearchForm () {
+      if (this.pageType == 'add' || (this.pageType == 'edit' && !this.isDisabled)) {
+        if (this.$refs.imageSet) {
+          this.$refs.imageSet.setFileList('')
+        }
+        if (this.$refs.videoSet) {
+          this.$refs.videoSet.setFileList('')
+        }
+      }
+      if (this.$refs.editor) {
+        this.$refs.editor.setHtml('')
+      }
+      this.form = {
+        promoActiveSn: undefined, // 促销活动sn
+        title: '', // 标题
+        imageSet: '', // 图片
+        contentType: 'IMAGE_CONTENT', // 内容类型
+        content: '', // 内容
+        contentLink: '', // 链接内容
+        sort: undefined, // 排序
+        publishFlag: '0', // 是否发布
+        linkType: '1',
+        dealerEditFlag: '0', // 加盟商编辑 1是 0否
+        productRangeList: [], // 产品范围列表
+        promoRule: {
+          ruleType: 'ticket', // 基本规则类型
+          ruleName: '', // 券名称
+          ruleTitle: '', // 副标题
+          ruleBaseType: 'category', // 券生成方式
+          ruleExplain: '', // 使用说明
+          validType: undefined, // 券有效期类型
+          validStartDate: undefined, // 券生效时间
+          validEndDate: undefined, // 券失效时间
+          validDays: undefined, // 券有效期天数
+          dealerEditFlag: '0', // 加盟商编辑 1是 0否
+          publishFlag: '0', // 是否发布
+          range: '1'
+        } // 链接配置内容
+      }
+      this.isShowNextStep = false
+      this.isDisabled = false
+      if (this.$refs.ruleForm) {
+        this.$refs.ruleForm.resetFields()
+      }
+      if (this.$refs.ruleForm) {
+        this.$refs.ruleForm.resetFields()
+      }
+    },
+    // 获取产品范围数据
+    getTreeData () {
+      productTypeQuery({}).then(res => {
+        if (res.status == 200) {
+          this.productTypeList = res.data
+        } else {
+          this.productTypeList = []
+        }
+      })
+    },
+    // 选择内容类型
+    changeContentType (e) {
+      if (e === 'LINK') {
+        this.form.linkType = '1'
+        this.form.contentLink = '/pagesB/promoDetail'
+        this.form.content = '/pagesB/promoDetail'
+      } else {
+        this.form.linkType = undefined
+        this.form.contentLink = ''
+        this.form.content = ''
+      }
+      this.form.contentType = e
+    },
+    // 填入link内容
+    handleLink (con) {
+      if (!con.target.value || con.target.value != '/pagesB/promoDetail') {
+        this.form.linkType = '2'
+      } else {
+        this.form.linkType = '1'
+      }
+      this.form.contentLink = con.target.value
+    },
+    // 选择货架促销填入默认值
+    handleLinkType (val) {
+      this.form.contentLink = val === '2' ? '' : '/pagesB/promoDetail'
+    },
+    // 添加产品
+    handleAddProduct () {
+      this.chooseTypeList = this.productRangeList
+      this.showProModal = true
+    },
+    // 批量添加
+    handleBatchAdd () {
+      if (!this.form.promoRule.ruleValue) {
+        this.$message.warning('请输入返券金额(需大于0)!')
+        return
+      }
+      this.$refs.chooseProductList.editMorePrice(this.form.promoRule.ruleValue)
+    },
+    // 添加产品成功
+    addProductSuccess (list) {
+      const productArr = list.map(item => {
+        return {
+          promoActiveSn: this.$route.params.sn,
+          promoRuleSn: this.form.promoRule.promoRuleSn,
+          productCode: item.code,
+          productSn: item.productSn,
+          ruleValue: this.form.promoRule.ruleValue,
+          price: item.terminalPrice
+        }
+      })
+      promoCreateBatch(productArr).then(res => {
+        if (res.status == 200) {
+          this.showProModal = false
+          // 获取产品列表 有分页
+          this.$refs.chooseProductList.pageInit()
+        }
+      })
+    },
+    onChangeTree (e) {
+      deleteByProductType({ promoActiveSn: this.$route.params.sn, productTypeSnList: this.productRangeList || [] }).then(res => {
+        if (res.status == 200) {
+          this.$refs.chooseProductList.pageInit()
+        }
+      })
+      // 保存产品范围
+      const newArr = this.productRangeList.map(item => {
+        return {
+          promoActiveSn: this.$route.params.sn,
+          promoRuleSn: this.form.promoRule.promoRuleSn,
+          productTypeSn: item
+        }
+      })
+      saveBatchEntity({ list: newArr, promoActiveSn: this.$route.params.sn }).then(res => {
+        if (res.status == 200) {
+          console.log('保存产品范围成功')
+        }
+      })
+    },
+    pageInit () {
+      this.pageType = this.$route.params.pageType
+      if (this.pageType === 'edit') {
+        this.getDetail()
+      }
+      console.log('加载产品范围')
+      this.$nextTick(() => {
+        this.getTreeData()
+      })
+    }
+  },
+  mounted () {
+    if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
+      this.pageInit()
+    }
+  },
+  activated () {
+    // 如果是新页签打开,则重置当前页面
+    if (this.$store.state.app.isNewTab) {
+      this.pageInit()
+    }
+    // 仅刷新列表,不重置页面
+    if (this.$store.state.app.updateList) {
+      this.pageInit()
+    }
+  },
+  beforeRouteEnter (to, from, next) {
+    next(vm => {})
+  }
+}
+</script>
+
+<style lang="less" scoped>
+.promotionEdit-wrap{
+    position: relative;
+    height: 100%;
+    box-sizing: border-box;
+    padding-bottom:51px;
+    >.ant-spin-nested-loading{
+      overflow-y: scroll;
+      height: 100%;
+    }
+    /deep/.ant-form-item{
+      margin-bottom:8px;
+    }
+    .promotionEdit-cont{
+      margin-bottom: 10px;
+    }
+    .upload{
+      width: 100%!important;
+    }
+    //  文本编辑器  工具栏样式换行
+    .promotionEdit-editor{
+      .w-e-toolbar{
+        flex-wrap: wrap;
+        z-index: 0;
+      }
+    }
+    //  商品图片描述
+    .upload-desc{
+      font-size: 12px;
+      color: #808695;
+    }
+    #promotionEdit-attachList{
+      height: auto;
+    }
+    .box{
+      border:1px solid #d9d9d9;
+      border-radius:4px;
+      padding:4px 11px;
+      color:rgba(0, 0, 0, 0.25);
+      cursor: not-allowed;
+      background:#fdfdfd;
+    }
+    .affix{
+      .ant-affix{
+        z-index: 101;
+        display:inline-block
+      }
+    }
+    /deep/.ant-radio-disabled + span{
+     color:#000!important;
+    }
+    .tip{
+      margin-left:10px;
+    }
+
+    .productInfo{
+      display:flex;
+      align-items:center;
+      justify-content: space-between;
+    }
+    #setPromotion-productRange{
+      /deep/.ant-select-dropdown{
+        max-height:30vh !important;
+      }
+    }
+  }
+</style>

+ 125 - 22
src/views/promotionManagement/promotionInfo/list.vue

@@ -15,30 +15,29 @@
                 <a-input id="promotionInfoList-name" v-model.trim="queryParam.name" allowClear placeholder="请输入促销名称"/>
               </a-form-item>
             </a-col>
-            <a-col :md="4" :sm="24">
+            <!-- <a-col :md="4" :sm="24">
               <a-form-item label="显示状态">
                 <a-select
                   v-model="queryParam.showFlag"
                   placeholder="请选择显示状态"
-                  allowClear
-                >
+                  allowClear>
                   <a-select-option :value="1">已显示</a-select-option>
                   <a-select-option :value="0">未显示</a-select-option>
                 </a-select>
               </a-form-item>
-            </a-col>
-            <a-col :md="4" :sm="24">
+            </a-col> -->
+            <a-col :md="6" :sm="24">
               <a-form-item label="促销状态">
                 <v-select
-                  v-model="queryParam.state"
+                  v-model="queryParam.dealerPublishState"
                   ref="sourceType"
-                  id="promotionInfoList-sourceType"
+                  id="promotionInfoList-dealerPublishState"
                   code="PROMO_STATE"
                   placeholder="请选择促销状态"
                   allowClear></v-select>
               </a-form-item>
             </a-col>
-            <a-col :md="4" :sm="24">
+            <a-col :md="6" :sm="24">
               <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="promotionInfoList-refresh">查询</a-button>
               <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="promotionInfoList-reset">重置</a-button>
             </a-col>
@@ -72,8 +71,11 @@
           <div v-else class="desc font1" @click="handleDescModal(record)">{{ record.description }}</div>
         </template>
         <!-- 状态 -->
-        <template slot="showStatus" slot-scope="text, record">
-          {{ record.showFlag == '1'?'已显示':'未显示' }}
+        <template slot="dealerPublishState" slot-scope="text, record">
+          <span v-if="record.dealerPublishState">
+            {{ record.dealerPublishState == 'PUBLISH'?'已开启':record.dealerPublishState == 'END'?'已结束':record.dealerPublishState == 'CLOSE'?'已关闭' :'未开启' }}
+          </span>
+          <span v-else>--</span>
         </template>
         <!-- 促销展示 -->
         <template slot="salesShow" slot-scope="text, record">
@@ -85,24 +87,59 @@
           </div>
           <span v-else>--</span>
         </template>
+        <!-- 操作 -->
+        <!-- state  PUBLISH 已开启 END 已结束 CLOSE 已关闭 UNPUBLISH 未开启 -->
+        <template slot="action" slot-scope="text, record">
+          <a-button
+            size="small"
+            type="link"
+            class="button-primary"
+            @click="handleOpen(record)"
+            v-if="record.dealerEditFlag==='1'&&(record.dealerPublishState=='UNPUBLISH'||record.dealerPublishState=='CLOSE')&&$hasPermissions('B_publishActiveBtn')"
+            id="productOnlineInfoList-detail-btn">开启</a-button>
+          <a-button
+            size="small"
+            type="link"
+            class="button-primary"
+            v-if="record.dealerEditFlag==='1'&&record.dealerPublishState=='PUBLISH'&&$hasPermissions('B_closeActiveBtn')"
+            @click="handleClose(record)"
+            id="productOnlineInfoList-detail-btn">关闭</a-button>
+          <a-button
+            size="small"
+            type="link"
+            class="button-primary"
+            v-if="record.dealerEditFlag==='1'&&record.dealerPublishState!='END'&&$hasPermissions('B_promoActiveEditBtn')"
+            @click="handleEdit(record,'edit')">编辑</a-button>
+          <a-button
+            size="small"
+            type="link"
+            class="button-success"
+            v-if="$hasPermissions('B_promoActiveSeeBtn')"
+            @click="handleSee(record)">查看</a-button>
+        </template>
       </s-table>
     </a-spin>
+    <!-- 促销描述 -->
     <promotion-desc-modal :con="descInfo" :openModal="openDescModal" @close="openDescModal = false"/>
+    <!-- 促销展示 -->
     <promotion-show-modal ref="promotionShow" :openModal="openShowModal" @close="openShowModal = false"/>
+    <!-- 查看 -->
+    <detail-Modal :openModal="openDetailModal" :itemSn="itemId" @close="closeDetailModal" @ok="$refs.table.refresh()" />
   </a-card>
 </template>
 
 <script>
 import { commonMixin } from '@/utils/mixin'
-import { promoTerminalList } from '@/api/promoTerminal'
 import { STable, VSelect } from '@/components'
 import rangeDate from '@/views/common/rangeDate.vue'
 import promotionDescModal from './promotionDescModal'
 import promotionShowModal from './promotionShowModal'
+import detailModal from './detailModal'
+import { promoActiveList, closeActive, publishActive } from '@/api/promoActive'
 
 export default {
   name: 'UrgentOffsetList',
-  components: { STable, VSelect, rangeDate, promotionDescModal, promotionShowModal },
+  components: { STable, VSelect, rangeDate, promotionDescModal, promotionShowModal, detailModal },
   mixins: [commonMixin],
   data () {
     return {
@@ -115,26 +152,28 @@ export default {
         beginDate: undefined,
         endDate: undefined,
         name: '', //  促销名称
-        showFlag: undefined, // 显示状态
-        state: undefined// 促销状态
+        dealerPublishState: undefined// 促销状态
       },
       descInfo: '', // 促销描述
       disabled: false, //  查询、重置按钮是否可操作
+      openDetailModal: false,
       columns: [
         { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
-        { title: '发布时间', dataIndex: 'createDate', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '促销名称', dataIndex: 'name', width: '24%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '发布时间', dataIndex: 'publishTime', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '促销名称', dataIndex: 'name', width: '20%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '标题', dataIndex: 'title', width: '20%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '促销时间', scopedSlots: { customRender: 'promotionTime' }, width: '20%', align: 'center' },
         { title: '促销描述', scopedSlots: { customRender: 'desc' }, width: '20%', align: 'center' },
         { title: '促销展示', scopedSlots: { customRender: 'salesShow' }, width: '10%', align: 'center' },
-        { title: '显示状态', scopedSlots: { customRender: 'showStatus' }, width: '10%', align: 'center' },
-        { title: '状态', dataIndex: 'stateDictValue', width: '10%', align: 'center', customRender: function (text) { return text || '--' } }
+        // { title: '显示状态', scopedSlots: { customRender: 'showStatus' }, width: '10%', align: 'center' },
+        { title: '状态', scopedSlots: { customRender: 'dealerPublishState' }, width: '10%', align: 'center' },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
         this.spinning = true
-        return promoTerminalList(Object.assign(parameter, this.queryParam)).then(res => {
+        return promoActiveList(Object.assign(parameter, this.queryParam)).then(res => {
           let data
           if (res.status == 200) {
             data = res.data
@@ -152,6 +191,16 @@ export default {
     }
   },
   methods: {
+    // 打开详情
+    handleSee (row) {
+      this.openDetailModal = true
+      this.itemId = row.promoActiveSn
+    },
+    // 关闭详情
+    closeDetailModal () {
+      this.openDetailModal = false
+      this.itemId = ''
+    },
     //  时间  change
     dateChange (date) {
       this.queryParam.beginDate = date[0]
@@ -173,14 +222,68 @@ export default {
         _this.$refs.promotionShow.getDetail({ id: row.promoActiveSn, showType: row.contentType })
       })
     },
+    // 开启
+    handleOpen (row) {
+      const _this = this
+      this.$confirm({
+        title: '提示',
+        content: '促销活动一旦开启,客户可参与活动。确认开启吗?',
+        centered: true,
+        onOk () {
+          _this.spinning = true
+          publishActive({ sn: row.promoActiveSn }).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.$refs.table.refresh()
+              _this.spinning = false
+            } else {
+              _this.spinning = false
+            }
+          })
+        }
+      })
+    },
+    // 关闭
+    handleClose (row) {
+      const _this = this
+      this.$confirm({
+        title: '提示',
+        content: '促销活动一旦关闭,客户无法参与活动。确认关闭吗?',
+        centered: true,
+        onOk () {
+          _this.spinning = true
+          closeActive({ sn: row.promoActiveSn }).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.$refs.table.refresh()
+              _this.spinning = false
+            } else {
+              _this.spinning = false
+            }
+          })
+        }
+      })
+    },
+    // 编辑
+    handleEdit (row, type) {
+      const _this = this
+      if (row.dealerPublishState === 'PUBLISH' && type === 'edit') {
+        _this.$warning({
+          title: '提示',
+          content: '请先关闭活动,活动关闭后可编辑活动'
+        })
+      } else {
+        const nameInfo = type === 'edit' ? 'promotionInfoEdit' : 'promotionInfoDetail'
+        _this.$router.push({ name: nameInfo, params: { sn: row.promoActiveSn, pageType: type } })
+      }
+    },
     //  重置
     resetSearchForm () {
       this.$refs.rangeDate.resetDate(this.time)
       this.queryParam.beginDate = undefined
       this.queryParam.endDate = undefined
       this.queryParam.name = ''
-      this.queryParam.showFlag = undefined
-      this.queryParam.state = undefined
+      this.queryParam.dealerPublishState = undefined
       this.$refs.table.refresh(true)
     },
     pageInit () {
@@ -191,7 +294,7 @@ export default {
     },
     setTableH () {
       const tableSearchH = this.$refs.tableSearch.offsetHeight
-      this.tableHeight = window.innerHeight - tableSearchH - 195
+      this.tableHeight = window.innerHeight - tableSearchH - 203
     }
   },
   mounted () {

+ 192 - 0
src/views/promotionManagement/promotionInfo/productTable.vue

@@ -0,0 +1,192 @@
+<template>
+  <div class="veTableCon">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <s-table
+        class="sTable"
+        ref="table"
+        size="small"
+        :rowKey="(record) => record.id"
+        :columns="columns"
+        :data="loadData"
+        :row-selection="{ columnWidth: 40 }"
+        @rowSelection="rowSelectionFun"
+        :defaultLoadData="false"
+        :style="{ maxHeight: 300+'px' }"
+        :scroll="{ y:230 }"
+        bordered>
+        <template slot="price" slot-scope="text,record">
+          <a-input-number
+            :min="0"
+            :step="1"
+            :precision="2"
+            :max="99999999"
+            @blur="editAllPrice(record,'price')"
+            placeholder="请输入"
+            :disabled="disabledVal"
+            v-model="record.price"
+            :id="'productTable-price'+record.id "
+            size="small"/>
+        </template>
+        <template slot="ruleValue" slot-scope="text,record">
+          <a-input-number
+            :min="0"
+            :step="1"
+            :precision="2"
+            :max="99999999"
+            :disabled="disabledVal"
+            @blur="editAllPrice(record,'ruleValue')"
+            placeholder="请输入"
+            v-model="record.ruleValue"
+            :id="'productTable-ruleValue'+record.id "
+            size="small"/>
+        </template>
+        <!-- 操作 -->
+        <template slot="action" slot-scope="text,record">
+          <a-button
+            size="small"
+            type="link"
+            class="button-error"
+            :id="'productTable-del-btn'+record.id "
+            :disabled="disabledVal"
+            @click="handleDel(record)"
+          >删除</a-button>
+        </template>
+      </s-table>
+    </a-spin>
+  </div>
+</template>
+<script>
+import { commonMixin } from '@/utils/mixin'
+import { STable } from '@/components'
+import { promoRuleProductList, deleteBatch, promoUpdateBatch } from '@/api/promoActive'
+export default {
+  name: 'ProductTable',
+  mixins: [commonMixin],
+  components: { STable },
+  props: {
+    promoActiveSn: {
+      type: String,
+      default: ''
+    },
+    disabledVal: {
+      type: Boolean,
+      default: false
+    }
+  },
+  data () {
+    return {
+      spinning: false,
+      rowSelectionInfo: null,
+      queryParam: {},
+      dataListQty: '0',
+      columns: [
+        { title: '序号', dataIndex: 'no', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品编码', dataIndex: 'productCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productName', width: '20%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '原厂编码', dataIndex: 'origCode', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '活动价', scopedSlots: { customRender: 'price' }, width: '10%', align: 'right' },
+        { title: '返券金额', scopedSlots: { customRender: 'ruleValue' }, width: '10%', align: 'right' },
+        { title: '参考终端价', dataIndex: 'terminalPrice', width: '10%', align: 'right', customRender: text => { return ((text || text == 0) ? this.toThousands(text) : '--') } },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
+      ],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        this.spinning = true
+        const params = Object.assign(parameter, this.queryParam)
+        params.promoActiveSn = this.promoActiveSn
+        return promoRuleProductList(params).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
+              if (!data.list[i].price && data.list[i].price != 0) {
+                data.list[i].price = data.list[i].terminalPrice
+              } else {
+                data.list[i].price = data.list[i].price
+              }
+            }
+            this.disabled = false
+            this.dataListQty = res.data.count
+          }
+          this.spinning = false
+          return data
+        })
+      }
+    }
+  },
+  methods: {
+    // 表格选中项
+    rowSelectionFun (obj) {
+      this.rowSelectionInfo = obj || null
+    },
+    // 批量修改价格
+    editAllPrice (row, typeName) {
+      let ajaxData = []
+      if (typeName != 'all') {
+        ajaxData.push({
+          id: row.id,
+          price: typeName === 'price' ? row.price : undefined,
+          ruleValue: typeName === 'ruleValue' ? row.ruleValue : undefined
+        })
+      } else {
+        ajaxData = row || []
+      }
+      promoUpdateBatch(ajaxData).then(res => {
+        if (res.status == 200) {
+          this.$refs.table.refresh(true)
+          this.$refs.table.clearSelected() // 清空表格选中项
+        }
+      })
+    },
+    editMorePrice (numInfo) {
+      if (!this.rowSelectionInfo || (this.rowSelectionInfo && this.rowSelectionInfo.selectedRows && this.rowSelectionInfo.selectedRows.length === 0)) {
+        this.$message.warning('请选择要修改的产品!')
+        return
+      }
+      const ajaxArr = this.rowSelectionInfo.selectedRows.map(item => { return { id: item.id, ruleValue: numInfo } })
+      this.editAllPrice(ajaxArr, 'all')
+    },
+    // 删除
+    handleDel (row) {
+      const _this = this
+      _this.spinning = true
+      deleteBatch([row.id]).then(res => {
+        if (res.status == 200) {
+          _this.$message.success(res.message)
+          _this.$refs.table.refresh()
+          _this.spinning = false
+        } else {
+          _this.spinning = false
+        }
+      })
+    },
+    getDataNum () {
+      return this.dataListQty
+    },
+    pageInit () {
+      this.$nextTick(() => {
+        this.$refs.table.refresh(true)
+      })
+    }
+  },
+  mounted () {
+    this.pageInit()
+  },
+  activated () {
+    this.pageInit()
+  },
+  beforeRouteEnter (to, from, next) {
+    next(vm => {})
+  }
+}
+</script>
+
+<style>
+ /* form input[type='radio'], form input[type='checkbox'] {
+      width: 15px;
+      height: 14px;
+  } */
+</style>

+ 4 - 0
src/views/salesManagement/salesQuery/detail.vue

@@ -66,6 +66,7 @@
               折后总售价:<strong>{{ detailData&&(detailData.discountedAmount || detailData.discountedAmount==0) ? toThousands(detailData.discountedAmount) : '--' }}</strong>;
               折扣:<strong>{{ detailData&&(detailData.discountRate || detailData.discountRate==0) ? detailData.discountRate+'%' : '--' }}</strong>;
               折扣金额:<strong>{{ detailData&&(detailData.discountAmount || detailData.discountAmount==0) ? toThousands(detailData.discountAmount) : '--' }}</strong>;
+              <span v-if="detailData&&detailData.sourceType&&detailData.sourceType==='XPRH_PURCHASE'"> 返券金额:<strong>{{ detailData&&(detailData.totalGiveAmount || detailData.totalGiveAmount==0) ? toThousands(detailData.totalGiveAmount) : '--' }}</strong>;</span>
             </div>
             <div>
               <a-checkbox v-model="showCost" v-if="$hasPermissions('M_ShowAllCost')" id="salesQuery-cost">成本价</a-checkbox>
@@ -227,6 +228,9 @@ export default {
       } else {
         arr.splice(11, 1)
       }
+      if (this.detailData && this.detailData.sourceType && this.detailData.sourceType === 'XPRH_PURCHASE') {
+        arr.splice(11, 1, { title: <a-tooltip placement="bottom" title='返券金额以销售单完结时的活动规则为准'>返券金额&nbsp;<a-icon type="question-circle" /></a-tooltip>, dataIndex: 'giveAmount', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+      }
       // 下级创建,不显示仓库仓位
       if (!this.isOwerEdit) {
         arr.splice(this.showCost ? 12 : 11, 0, { title: '库存数量', dataIndex: 'currentStockQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })

+ 3 - 0
src/views/salesManagement/salesQuery/edit.vue

@@ -339,6 +339,9 @@ export default {
         arr.splice(5, 0, { title: '仓库', dataIndex: 'warehouseEntity.name', width: '8%', align: 'center', sorter: true, customRender: function (text) { return text || '--' } })
         arr.splice(6, 0, { title: '仓位', dataIndex: 'warehouseLocationEntity.name', width: '8%', align: 'center', customRender: function (text) { return text || '--' } })
       }
+      if (this.detailData && this.detailData.sourceType && this.detailData.sourceType === 'XPRH_PURCHASE') {
+        arr.splice(11, 1, { title: <a-tooltip placement="bottom" title='返券金额以销售单完结时的活动规则为准'>返券金额&nbsp;<a-icon type="question-circle" /></a-tooltip>, dataIndex: 'giveAmount', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+      }
       // 实际总成本
       if (this.isCosts) {
         arr.splice(!this.isOwerEdit ? 11 : 12, 0, { slots: { title: 'costTitle' }, dataIndex: 'totalCost', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })

+ 4 - 3
src/views/salesManagement/salesQuery/list.vue

@@ -188,6 +188,7 @@
           <stateIcon :title="record.financialStatusDictValue" :state="record.financialStatus == 'FINISH'?'1':'2'"></stateIcon>
         </template>
         <!-- 操作 -->
+        <!-- 操作 -->
         <template slot="action" slot-scope="text, record">
           <a-button
             size="small"
@@ -210,7 +211,7 @@
             type="link"
             :id="'salesManagementList-edit-'+record.salesBillNo"
             class="button-primary"
-            v-if="((record.sourceType == 'SATELLITE' || record.sourceType == 'SALES' || record.sourceType == 'TEMPORARY_DISPATCHING') && (record.billStatus == 'WAIT_AUDIT' || record.billStatus == 'WAIT_SUBMIT' || record.billStatus == 'AUDIT_REJECT')) && $hasPermissions('B_salesEdit')"
+            v-if="((record.sourceType == 'SATELLITE' || record.sourceType == 'SALES' || record.sourceType == 'TEMPORARY_DISPATCHING'||record.sourceType == 'XPRH_PURCHASE') && (record.billStatus == 'WAIT_AUDIT' || record.billStatus == 'WAIT_SUBMIT' || record.billStatus == 'AUDIT_REJECT')) && $hasPermissions('B_salesEdit')"
             @click="handleEdit(record)"
           >
             编辑
@@ -220,7 +221,7 @@
             type="link"
             :id="'salesManagementList-del-'+record.salesBillNo"
             class="button-error"
-            v-if="((record.sourceType == 'SATELLITE' || record.sourceType == 'SALES' || record.sourceType == 'TEMPORARY_DISPATCHING') && record.billStatus != 'FINISH') && $hasPermissions('B_salesDel')"
+            v-if="((record.sourceType == 'SATELLITE' || record.sourceType == 'SALES' || record.sourceType == 'TEMPORARY_DISPATCHING' ||record.sourceType =='XPRH_PURCHASE' ) && record.billStatus != 'FINISH') && $hasPermissions('B_salesDel')"
             @click="handleDel(record)"
           >
             删除
@@ -245,7 +246,7 @@
           >
             取消
           </a-button>
-          <span v-if="!(record.billStatus == 'WAIT_AUDIT' && $hasPermissions('B_salesAudit')) && !(record.billStatus == 'WAIT_OUT_WAREHOUSE' && $hasPermissions('B_salesStockOut')) && !(((record.sourceType == 'SATELLITE' || record.sourceType == 'SALES' || record.sourceType == 'TEMPORARY_DISPATCHING') && (record.billStatus == 'WAIT_AUDIT' || record.billStatus == 'WAIT_SUBMIT' || record.billStatus == 'AUDIT_REJECT')) && $hasPermissions('B_salesEdit')) && !(((record.sourceType == 'SATELLITE' || record.sourceType == 'SALES' || record.sourceType == 'TEMPORARY_DISPATCHING') && record.billStatus != 'FINISH') && $hasPermissions('B_salesDel'))">
+          <span v-if="!(record.billStatus == 'WAIT_AUDIT' && $hasPermissions('B_salesAudit')) && !(record.billStatus == 'WAIT_OUT_WAREHOUSE' && $hasPermissions('B_salesStockOut')) && !(((record.sourceType == 'SATELLITE' || record.sourceType == 'SALES' || record.sourceType == 'TEMPORARY_DISPATCHING'||record.sourceType == 'XPRH_PURCHASE') && (record.billStatus == 'WAIT_AUDIT' || record.billStatus == 'WAIT_SUBMIT' || record.billStatus == 'AUDIT_REJECT')) && $hasPermissions('B_salesEdit')) && !(((record.sourceType == 'SATELLITE' || record.sourceType == 'SALES' || record.sourceType == 'TEMPORARY_DISPATCHING') && record.billStatus != 'FINISH') && $hasPermissions('B_salesDel'))">
             <span v-if="!(((record.sourceType == 'CHILD_PURCHASE'||record.sourceType == 'DEALER_PURCHASE') && (record.billStatus == 'WAIT_AUDIT' || record.billStatus == 'SUPERIOR_CHANGE')) &&$hasPermissions('B_salesEdit')) && !(((record.sourceType == 'CHILD_PURCHASE'||record.sourceType == 'DEALER_PURCHASE') && (record.billStatus == 'WAIT_AUDIT' || record.billStatus == 'SUPERIOR_CHANGE')) && $hasPermissions('B_salesDel'))">--</span>
           </span>
         </template>

+ 3 - 1
src/views/salesManagement/salesQuery/productSalesRecordModal.vue

@@ -82,10 +82,12 @@ export default {
       },
       // 表头
       columns: [
+        { title: '销售单号', dataIndex: 'salesBillNo', width: 150, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '销售时间', dataIndex: 'salesBillEntity.createDate', width: 250, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '销售价', dataIndex: 'price', width: 150, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
         { title: '销售数量', dataIndex: 'qty', width: 150, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '客户名称', dataIndex: 'salesBillEntity.buyerNameCurrent', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true }
+        { title: '客户名称', dataIndex: 'salesBillEntity.buyerNameCurrent', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '单据来源', dataIndex: 'salesBillEntity.sourceTypeDictValue', width: 100, align: 'center', customRender: function (text) { return text || '--' } }
       ],
       list: [], // 列表数据
       loading: false, // 加载动画

+ 9 - 5
src/views/salesManagement/salesQueryNew/detail.vue

@@ -71,6 +71,7 @@
               折后总售价:<strong>{{ detailData&&(detailData.discountedAmount || detailData.discountedAmount==0) ? toThousands(detailData.discountedAmount) : '--' }}</strong>;
               折扣:<strong>{{ detailData&&(detailData.discountRate || detailData.discountRate==0) ? detailData.discountRate+'%' : '--' }}</strong>;
               折扣金额:<strong>{{ detailData&&(detailData.discountAmount || detailData.discountAmount==0) ? toThousands(detailData.discountAmount) : '--' }}</strong>;
+              <span v-if="detailData&&detailData.sourceType&&detailData.sourceType==='XPRH_PURCHASE'"> 返券金额:<strong>{{ detailData&&(detailData.totalGiveAmount || detailData.totalGiveAmount==0) ? toThousands(detailData.totalGiveAmount) : '--' }}</strong>;</span>
             </div>
             <div>
               <a-checkbox v-model="showCost" v-if="$hasPermissions('M_ShowAllCost')" id="salesQuery-cost">成本价</a-checkbox>
@@ -231,16 +232,19 @@ export default {
       ]
       // 实际总成本
       if (this.showCost) {
-        arr.splice(11, 0, { slots: { title: 'costTitle' }, dataIndex: 'totalCost', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+        arr.splice(12, 0, { slots: { title: 'costTitle' }, dataIndex: 'totalCost', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
       } else {
-        arr.splice(11, 1)
+        arr.splice(12, 1)
+      }
+      if (this.detailData && this.detailData.sourceType && this.detailData.sourceType === 'XPRH_PURCHASE') {
+        arr.splice(11, 1, { title: <a-tooltip placement="bottom" title='返券金额以销售单完结时的活动规则为准'>返券金额&nbsp;<a-icon type="question-circle" /></a-tooltip>, dataIndex: 'giveAmount', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
       }
       // 下级创建,不显示仓库仓位
       if (!this.isOwerEdit) {
-        arr.splice(this.showCost ? 12 : 11, 0, { title: '库存数量', dataIndex: 'currentStockQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
+        arr.splice(this.showCost ? 13 : 12, 0, { title: '库存数量', dataIndex: 'currentStockQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
       } else {
-        arr.splice(this.showCost ? 12 : 11, 0, { title: '仓库', dataIndex: 'warehouseName', width: '7%', align: 'center', customRender: function (text) { return text || '--' } })
-        arr.splice(this.showCost ? 13 : 12, 0, { title: '仓位', dataIndex: 'warehouseLocationName', width: '7%', align: 'center', customRender: function (text) { return text || '--' } })
+        arr.splice(this.showCost ? 13 : 12, 0, { title: '仓库', dataIndex: 'warehouseName', width: '7%', align: 'center', customRender: function (text) { return text || '--' } })
+        arr.splice(this.showCost ? 14 : 13, 0, { title: '仓位', dataIndex: 'warehouseLocationName', width: '7%', align: 'center', customRender: function (text) { return text || '--' } })
       }
       return arr
     }

+ 4 - 0
src/views/salesManagement/salesQueryNew/edit.vue

@@ -448,6 +448,10 @@ export default {
         arr.splice(5, 0, { title: '仓库', dataIndex: 'warehouseEntity.name', width: '8%', align: 'center', sorter: true, customRender: function (text) { return text || '--' } })
         arr.splice(6, 0, { title: '仓位', dataIndex: 'warehouseLocationEntity.name', width: '8%', align: 'center', customRender: function (text) { return text || '--' } })
       }
+
+      if (this.detailData && this.detailData.sourceType && this.detailData.sourceType === 'XPRH_PURCHASE') {
+        arr.splice(10, 1, { title: <a-tooltip placement="bottom" title='返券金额以销售单完结时的活动规则为准'>返券金额&nbsp;<a-icon type="question-circle" /></a-tooltip>, dataIndex: 'giveAmount', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+      }
       // 实际总成本
       if (this.isCosts) {
         arr.splice(!this.isOwerEdit ? 11 : 12, 0, { slots: { title: 'costTitle' }, dataIndex: 'totalCost', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })

+ 3 - 3
src/views/salesManagement/salesQueryNew/list.vue

@@ -209,7 +209,7 @@
               size="small"
               type="link"
               class="button-primary"
-              v-if="((record.sourceType == 'SATELLITE' || record.sourceType == 'SALES' || record.sourceType == 'TEMPORARY_DISPATCHING') && (record.billStatus == 'WAIT_AUDIT' || record.billStatus == 'WAIT_SUBMIT' || record.billStatus == 'AUDIT_REJECT')) && $hasPermissions('B_salesEdit')"
+              v-if="((record.sourceType == 'SATELLITE' || record.sourceType == 'SALES' || record.sourceType == 'TEMPORARY_DISPATCHING'||record.sourceType == 'XPRH_PURCHASE') && (record.billStatus == 'WAIT_AUDIT' || record.billStatus == 'WAIT_SUBMIT' || record.billStatus == 'AUDIT_REJECT')) && $hasPermissions('B_salesEdit')"
               @click="handleEdit(record)"
             >
               编辑
@@ -219,7 +219,7 @@
               size="small"
               type="link"
               class="button-error"
-              v-if="((record.sourceType == 'SATELLITE' || record.sourceType == 'SALES' || record.sourceType == 'TEMPORARY_DISPATCHING') && record.billStatus != 'FINISH') && $hasPermissions('B_salesDel')"
+              v-if="((record.sourceType == 'SATELLITE' || record.sourceType == 'SALES' || record.sourceType == 'TEMPORARY_DISPATCHING' ||record.sourceType =='XPRH_PURCHASE' ) && record.billStatus != 'FINISH') && $hasPermissions('B_salesDel')"
               @click="handleDel(record)"
             >
               删除
@@ -244,7 +244,7 @@
             >
               取消
             </a-button>
-            <span v-if="!(record.billStatus == 'WAIT_AUDIT' && $hasPermissions('B_salesAudit')) && !(record.billStatus == 'WAIT_OUT_WAREHOUSE' && $hasPermissions('B_salesStockOut')) && !(((record.sourceType == 'SATELLITE' || record.sourceType == 'SALES' || record.sourceType == 'TEMPORARY_DISPATCHING') && (record.billStatus == 'WAIT_AUDIT' || record.billStatus == 'WAIT_SUBMIT' || record.billStatus == 'AUDIT_REJECT')) && $hasPermissions('B_salesEdit')) && !(((record.sourceType == 'SATELLITE' || record.sourceType == 'SALES' || record.sourceType == 'TEMPORARY_DISPATCHING') && record.billStatus != 'FINISH') && $hasPermissions('B_salesDel'))">
+            <span v-if="!(record.billStatus == 'WAIT_AUDIT' && $hasPermissions('B_salesAudit')) && !(record.billStatus == 'WAIT_OUT_WAREHOUSE' && $hasPermissions('B_salesStockOut')) && !(((record.sourceType == 'SATELLITE' || record.sourceType == 'SALES' || record.sourceType == 'TEMPORARY_DISPATCHING'||record.sourceType == 'XPRH_PURCHASE') && (record.billStatus == 'WAIT_AUDIT' || record.billStatus == 'WAIT_SUBMIT' || record.billStatus == 'AUDIT_REJECT')) && $hasPermissions('B_salesEdit')) && !(((record.sourceType == 'SATELLITE' || record.sourceType == 'SALES' || record.sourceType == 'TEMPORARY_DISPATCHING') && record.billStatus != 'FINISH') && $hasPermissions('B_salesDel'))">
               <span v-if="!(((record.sourceType == 'CHILD_PURCHASE'||record.sourceType == 'DEALER_PURCHASE') && (record.billStatus == 'WAIT_AUDIT' || record.billStatus == 'SUPERIOR_CHANGE')) &&$hasPermissions('B_salesEdit')) && !(((record.sourceType == 'CHILD_PURCHASE'||record.sourceType == 'DEALER_PURCHASE') && (record.billStatus == 'WAIT_AUDIT' || record.billStatus == 'SUPERIOR_CHANGE')) && $hasPermissions('B_salesDel'))">--</span>
             </span>
           </template>

+ 5 - 5
src/views/salesManagement/salesQueryNew/productSalesRecordModal.vue

@@ -16,10 +16,8 @@
           <div style="flex:1">产品名称:{{ baseData.productName }}</div>
         </div>
         <a-tabs id="sales-record-tab" size="small" type="card" v-model="curTab" @change="callback">
-          <a-tab-pane key="1" tab="当前客户" id="sales-record-tab1">
-          </a-tab-pane>
-          <a-tab-pane key="2" tab="全部客户" id="sales-record-tab2">
-          </a-tab-pane>
+          <a-tab-pane key="1" tab="当前客户" id="sales-record-tab1"></a-tab-pane>
+          <a-tab-pane key="2" tab="全部客户" id="sales-record-tab2"></a-tab-pane>
         </a-tabs>
       </div>
       <!-- 表格 -->
@@ -83,10 +81,12 @@ export default {
       },
       // 表头
       columns: [
+        { title: '销售单号', dataIndex: 'salesBillNo', width: 150, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '销售时间', dataIndex: 'salesBillEntity.createDate', width: 250, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '销售价', dataIndex: 'price', width: 150, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
         { title: '销售数量', dataIndex: 'qty', width: 150, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '客户名称', dataIndex: 'salesBillEntity.buyerName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true }
+        { title: '客户名称', dataIndex: 'salesBillEntity.buyerNameCurrent', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '单据来源', dataIndex: 'salesBillEntity.sourceTypeDictValue', width: 100, align: 'center', customRender: function (text) { return text || '--' } }
       ],
       list: [], // 列表数据
       loading: false,

+ 2 - 2
vue.config.js

@@ -209,8 +209,8 @@ const vueConfig = {
     // If you want to turn on the proxy, please remove the mockjs /src/main.jsL11
     proxy: {
       '/api': {
-        // target: 'http://192.168.2.124/qpls-md',
-        target: 'https://p.iscm.360arrow.com/qpls-md',
+        target: 'http://192.168.2.10/qpls-md',
+        // target: 'https://p.iscm.360arrow.com/qpls-md',
         // ws: false,
         ws: true,
         changeOrigin: true,