gift.js 3.23 KB
import { mapState } from 'vuex'
export default {
  data() {
    return {
      currentIndex: '1',
      goodsIndex: 1,
      serviceIndex: 7,
      carList: [],
      selectedCarList: [],
      goodsTabList: [
        { label: '卡券', type: 1 },
        { label: '直充', type: 2 }
      ],
      serviceTabList: [
        { label: '门店服务', type: 7 },
        { label: '折扣券', type: 2 },
        { label: '代金券', type: 3 },
        { label: '兑换券', type: 4 }
      ],
      carTableParams: {
        listName: 'list',
        // 行数据的key
        mutiSelectUniqueKey: 'packageCode',
        checkSelectKey: 'packageCode',
        checkSelectVal: '',
        // 多选ref的名称
        mutiSelectName: 'list',
        tableColumns: [
          {
            label: '名称',
            prop: 'packageName',
            width: 300,
            formatter: cellValue => {
              return cellValue.packageName || cellValue.serviceName
            }
          },
          {
            label: '价格',
            prop: 'packageServicePeriod',
            addHtml: 'price'
          }
        ]
      },
      serviceList: [],
      selectedServiceList: [],
      serviceTableParams: {
        listName: 'list',
        // 行数据的key
        mutiSelectUniqueKey: 'packageCode',
        checkSelectKey: 'id',
        checkSelectVal: '',
        checkSelectable: null,
        // 多选ref的名称
        mutiSelectName: 'list',
        tableColumns: [
          {
            label: '名称',
            prop: 'couponName',
            width: 180
          },
          {
            label: '预估成本/元',
            prop: 'anticipatedCost',
            formatter: cellValue => {
              return (cellValue.anticipatedCost / 100).toFixed(2)
            }
          },
          {
            label: '有效期',
            prop: 'effectiveType',
            addHtml: 'effectiveType'
          },
          {
            label: '使用限制',
            prop: 'useType',
            addHtml: 'useType'
          },
          {
            label: '剩余库存',
            prop: 'residueAmount',
            formatter: cellValue => {
              return '无限制'
            }
          }
        ]
      },
      goodsList: [],
      selectedGoodsList: [],
      goodsTableParams: {
        listName: 'list',
        // 行数据的key
        mutiSelectUniqueKey: 'id',
        // 多选ref的名称
        mutiSelectName: 'list',
        tableColumns: [
          {
            label: '品牌',
            prop: 'brandName',
            width: 120
          },
          {
            label: '商品名称',
            prop: 'goodsName',
            width: 180
          },
          {
            label: '劵面额',
            prop: 'denomination',
            formatter: cellValue => {
              return isNaN(cellValue.denomination) ? cellValue.denomination : (cellValue.denomination / 100).toFixed(2) + '元'
            }
          },
          {
            label: '有效期',
            prop: 'effectiveDays',
            formatter: cellValue => {
              return cellValue.effectiveDays + '天'
            }
          }
        ]
      }
    }
  },

  computed: {
    ...mapState('marketing', ['subscribe'])
  }
}