Commit 4c8df3bd by cwq0219

素材编辑;发券宝;表头搜索

1 parent 46f1c49e
......@@ -38,3 +38,8 @@ export function exportDetailListApi(data) {
data.method = `${pathCustomer}coupon.exportExcel`
return request(data)
}
export function getDistinctColum(data) {
data.method = `${pathCustomer}coupon.distinctColum`
return request(data)
}
......@@ -107,172 +107,26 @@
</el-input>
</el-form-item>
</div>
<!-- <div class="w-50">
<el-form-item
label="额外成本"
prop="extraCost">
<el-input
v-model="proInfo.extraCost"
placeholder="请输入额外成本"
class="dis-in-block"
@input="handleExtraCost"
>
<i
slot="suffix"
class="suffix"
>元</i>
</el-input>
</el-form-item>
</div> -->
<!-- <div class="w-50">
<el-form-item label="零售折扣">
<el-input
v-model="proInfo.maxUpgradeDiscount"
placeholder="仅支持输入1.0~9.9的数值"
clearable
class="dis-in-block"
@input="handleMaxUpgradeDiscount"
>
<i
slot="suffix"
class="suffix"
>折</i>
</el-input>
</el-form-item>
</div> -->
<!-- <div class="w-50">
<el-form-item label="零售价格">
<el-input
v-model="proInfo.retailPrice"
placeholder="请输入零售价格"
clearable
class="dis-in-block"
@input="handleRetailPrice"
>
<i
slot="suffix"
class="suffix"
>元</i>
</el-input>
</el-form-item>
</div> -->
</el-form>
</div>
<!-- <div class="relateProDialog flex">
<span class="sub-title">分配给导流方 (4S门店)</span>
<el-form
:model="proInfo"
:rules="rules"
label-width="110px"
ref="proRuleForm2"
style="width: calc(100% - 185px)"
>
<div class="w-50">
<el-form-item
label="分润规则"
prop="profitType"
>
<el-select
style="width: 98%;"
v-model="proInfo.profitType"
placeholder="请选择分润规则"
>
<el-option
v-for="x in separateOpt"
:key="x.confId"
:value="x.confId"
:label="x.confLabel"
></el-option>
</el-select>
</el-form-item>
</div>
<div class="w-50">
<el-form-item
label="分润比例"
title="每笔订单分配给4s店的金额结算比例。"
prop="profitValue"
label="商品最低价"
prop="shopMinPrice"
>
<el-input
v-model="proInfo.profitValue"
@input="handleProfitInput"
placeholder="请输入0~100整数"
v-model="proInfo.shopMinPrice"
placeholder="请输入商品最低价"
class="dis-in-block"
@input="handleShopMinPrice"
>
<i
slot="suffix"
class="suffix"
>%</i>
</el-input>
</el-form-item>
</div>
</el-form>
</div> -->
<!-- <div class="relateProDialog flex">
<span class="sub-title" style="margin-right: 42px;">分配给合伙人 (合作商)</span>
<el-form
:model="proInfo"
:rules="rules"
label-width="110px"
ref="proRuleForm3"
style="width: calc(100% - 185px)"
>
<div class="w-50">
<el-form-item
label="阳光激励费"
title="每笔订单分配给合作商的金额结算比例。"
prop="incentiveCost"
>
<el-input
v-model="proInfo.incentiveCost"
@input="handleIncentiveCost"
placeholder="请输入阳光激励费"
class="input-with-select"
>
<el-select
slot="prepend"
style="width: 75px;"
v-model="proInfo.incentiveType"
@change="handleChangeType"
>
<el-option
v-for="(item, index) in incentiveTypeList"
:key="index"
:value="item.confId"
:label="item.confLabel"
></el-option>
</el-select>
<i
slot="suffix"
class="suffix"
>{{proInfo.incentiveType === 1 ? '%' : '元'}}</i>
</el-input>
</el-form-item>
</div>
<div class="w-50">
<el-form-item
label="分润比例"
title="每笔订单分配给合作商的金额结算比例。"
prop="partnerProfitPer"
>
<el-input
v-model="proInfo.partnerProfitPer"
@input="handlePartnerProfitPer"
placeholder="请输入0~100整数"
class="dis-in-block"
>
<i
slot="suffix"
class="suffix"
>%</i>
>元</i>
</el-input>
</el-form-item>
</div>
</el-form>
</div> -->
<!-- <span
class="btn-txt"
slot="btn-start"
>提示:配置的分润规则和比例将优先根据门店打款方式结算。</span> -->
</div>
</d2-dialog>
</template>
......@@ -285,7 +139,6 @@ export default {
return {
goodVal: {},
proInfo: {
// thumbUrl: 'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1244233290,1050095100&fm=26&gp=0.jpg',
thumbUrl: '',
goodsCode: '',
goodsName: '',
......@@ -293,13 +146,8 @@ export default {
type: '',
upgradePrice: '',
shopPrice: '',
// profitType: '',
// profitValue: '',
// extraCost: '',
// partnerProfitPer: '',
// maxUpgradeDiscount: '',
incentiveType: 1
// incentiveCost: ''
incentiveType: 1,
shopMinPrice: ''
},
rules: {
goodsCode: [{ required: true, message: '请选择关联升级商品', trigger: 'change' }],
......@@ -311,16 +159,13 @@ export default {
(+value < +this.proInfo.shopPrice) ? callback(new Error('建议升级价需要大于或等于产品成本')) : callback()
}
}],
shopPrice: [{ required: true, message: '请输入产品成本', trigger: 'blur' }]
// profitType: [{ required: true, message: '请输入分润规则', trigger: 'change' }],
// profitValue: [{ required: true, message: '请输入分润比例', trigger: 'blur' }],
// incentiveCost: [{ required: true, message: '请输入阳光激励费', trigger: 'change' }],
// partnerProfitPer: [{ required: true, message: '请输入分润比例', trigger: 'blur' }]
shopPrice: [{ required: true, message: '请输入产品成本', trigger: 'blur' }],
shopMinPrice: [{ required: true, message: '请输入商品最低价', trigger: 'blur' }]
},
oldVal: {
upgradePrice: '',
shopPrice: ''
// maxUpgradeDiscount: ''
shopPrice: '',
shopMinPrice: ''
},
separateOpt: [{
confId: 1,
......@@ -369,13 +214,9 @@ export default {
},
handleRelateProConfirm() {
this.$refs.proRuleForm1.validate(valid1 => {
// this.$refs.proRuleForm2.validate(valid2 => {
// this.$refs.proRuleForm3.validate(valid3 => {
if (valid1) {
this.$emit('handleRelateProConfirm', this.proInfo)
}
// })
// })
})
},
handleRelateProClose() {
......@@ -389,40 +230,16 @@ export default {
this.proInfo.shopPrice = limitPrice(newVal, this.oldVal.shopPrice, 6, 2)
this.oldVal.shopPrice = this.proInfo.shopPrice
},
handleShopMinPrice(newVal) {
this.proInfo.shopMinPrice = limitPrice(newVal, this.oldVal.shopMinPrice, 6, 2)
this.oldVal.shopMinPrice = this.proInfo.shopMinPrice
},
handleShopPriceBlur() {
if (this.proInfo.upgradePrice) {
var validateObj = (this.proInfo.shopPrice <= this.proInfo.upgradePrice) ? 'clearValidate' : 'validateField'
this.$refs.proRuleForm1[validateObj]('upgradePrice')
}
}
// handleMaxUpgradeDiscount(newVal) {
// this.proInfo.maxUpgradeDiscount = limitPrice(newVal, this.oldVal.maxUpgradeDiscount, 1, 1, 1)
// this.oldVal.maxUpgradeDiscount = this.proInfo.maxUpgradeDiscount
// },
// handleProfitInput(newVal) {
// this.proInfo.profitValue = limitPrice(newVal, this.oldVal.profitValue, 3, 0, 0, 100)
// this.oldVal.profitValue = this.proInfo.profitValue
// },
// handlePartnerProfitPer(newVal) {
// this.proInfo.partnerProfitPer = limitPrice(newVal, this.oldVal.partnerProfitPer, 3, 0, 0, 100)
// this.oldVal.partnerProfitPer = this.proInfo.partnerProfitPer
// },
// handleExtraCost(newVal) {
// this.proInfo.extraCost = limitPrice(newVal, this.oldVal.extraCost, 8, 2)
// this.oldVal.extraCost = this.proInfo.extraCost
// },
// handleRetailPrice(newVal) {
// this.proInfo.retailPrice = limitPrice(newVal, this.oldVal.retailPrice, 6, 2)
// this.oldVal.retailPrice = this.proInfo.retailPrice
// }
// handleIncentiveCost(newVal) {
// this.proInfo.incentiveCost = this.proInfo.incentiveType === 1 ? limitPrice(newVal, this.oldVal.incentiveCost, 3, 0, 0, 100) : limitPrice(newVal, this.oldVal.incentiveCost, 6, 2)
// this.oldVal.incentiveCost = this.proInfo.incentiveCost
// },
// handleChangeType() {
// this.proInfo.incentiveCost = ''
// this.oldVal.incentiveCost = ''
// }
}
}
......
......@@ -24,7 +24,7 @@
@change="handleCheckedChange"
>
<el-checkbox
v-for="item in mutiCheckOption"
v-for="item in optionList"
:label="item[optionConfig.optionId]"
:key="item[optionConfig.optionId]"
@change="handleCheckedChange"
......@@ -57,14 +57,14 @@ export default {
// 原来的model值
searchForm: {
type: Array,
default: () => {}
default: () => { }
},
optionConfig: {
type: Object,
default: () => { }
},
// 多选列表
mutiCheckOption: {
optionList: {
type: Array,
default: () => []
}
......@@ -79,12 +79,12 @@ export default {
handleCheckedChange(value) {
const checkedCount = value.length
this.checkAll = checkedCount === this.mutiCheckOption.length
this.isIndeterminate = checkedCount > 0 && checkedCount < this.mutiCheckOption.length
this.checkAll = checkedCount === this.optionList.length
this.isIndeterminate = checkedCount > 0 && checkedCount < this.optionList.length
},
handleCheckAllChange(val) {
this.checkedList = val ? this.mutiCheckOption.map(item => item[this.optionConfig.optionId]) : []
this.checkedList = val ? this.optionList.map(item => item[this.optionConfig.optionId]) : []
this.isIndeterminate = false
},
......
......@@ -40,10 +40,10 @@
<template slot="header">
<span>{{item.label}}</span>
<table-head-search
v-if="item.mutiCheckOption"
v-if="item.optionList"
:searchForm="searchForm"
:optionConfig="item.optionConfig"
:mutiCheckOption="item.mutiCheckOption"
:optionList="item.optionList"
@handleTableHeadChange="handleTableHeadChange"
></table-head-search>
</template>
......
......@@ -74,7 +74,7 @@
v-if="customerStatusObj[1].includes(scope.row.status)"
>未完成</span>
<span v-else>已完成</span> -->
<span>{{baseData.customerStatusList.find(item => item.confId == scope.row.status).confLabel}}</span>
<span :class="{ 'red': scope.row.status === 1 }">{{baseData.customerStatusList.find(item => item.confId == scope.row.status).confLabel}}</span>
<!-- <span>{{scope.row.status}}</span> -->
</template>
</el-table-column>
......@@ -242,7 +242,7 @@ export default {
// 1: [1, 3],
// 2: [2, 4, 6]
// },
// 客户状态;1-系统录入;2-现场升级;5-核销抵扣
// 创建方式;1-系统录入;2-现场升级;5-核销抵扣
sourceStatusObj: {
1: [1, 2],
2: [3],
......
......@@ -5,23 +5,27 @@
ref="couponsDetailTable"
:hasNum="false"
:sortObj="sortObj"
:searchForm="searchFormSearch"
:searchForm="searchForm"
:tableParams="tableParams"
:getListApi="getListApi"
:beforeSearchFn="beforeSearchFn"
@handleTableHeadChange="(value) => handleTableHeadChange('searchForm', value)"
@handleTableHeadChange="handleTableHeadChange"
></d2-table>
</div>
</template>
<script>
import { getDetailList } from '@api/coupons'
import { getDetailList, getDistinctColum } from '@api/coupons'
import { Util } from '@/common/util'
export default {
name: 'couponsDetail',
data() {
return {
searchForm: {},
searchForm: {
usedFlagList: [],
employeeNameList: [],
sellerNameList: []
},
searchFormSearch: {},
getListApi: getDetailList,
sortObj: {
......@@ -61,12 +65,11 @@ export default {
label: '发券人',
prop: 'employeeName',
optionConfig: {
searchItemName: '',
optionId: '',
optionLabel: ''
searchItemName: 'employeeNameList',
optionId: 'confId',
optionLabel: 'confValue'
},
mutiCheckOption: []
// mutiCheckList: [{ confLabel: '启用', confId: '1' }, { confLabel: '停用', confId: '2' }]
optionList: []
}, {
label: '核销状态',
prop: 'usedFlag',
......@@ -82,17 +85,16 @@ export default {
optionId: 'confId',
optionLabel: 'confValue'
},
mutiCheckOption: [{ confValue: '待核销', confId: 'N' }, { confValue: '已核销', confId: 'Y' }]
optionList: [{ confValue: '待核销', confId: 'N' }, { confValue: '已核销', confId: 'Y' }]
}, {
label: '核销人',
prop: 'sellerName',
optionConfig: {
searchItemName: '',
optionId: '',
optionLabel: ''
searchItemName: 'sellerNameList',
optionId: 'confId',
optionLabel: 'confValue'
},
mutiCheckOption: []
// mutiCheckList: [{ confLabel: '启用', confId: '1' }, { confLabel: '停用', confId: '2' }]
optionList: []
}, {
label: '核销时间',
prop: 'usedTime',
......@@ -113,11 +115,34 @@ export default {
}
},
mounted() { },
mounted() {
this.getDistinctColumList(1, 'employeeName')
this.getDistinctColumList(2, 'sellerName')
},
methods: {
// columType属性类型(1:发券人;2:转化人)
getDistinctColumList(columType, tableColumnsProp) {
getDistinctColum({ columType: columType, currentPage: 1, pageSize: 100 }).then(res => {
var tempArr = []
res.forEach(item => {
tempArr.push({
confId: item,
confValue: item
})
})
this.tableParams.tableColumns[this.findFormIdx(tableColumnsProp)].optionList = tempArr
})
},
// 找到在formList的位置,通过name来匹配
findFormIdx(prop) {
return this.tableParams.tableColumns.findIndex(item => item.prop === prop)
},
// 表格头部搜索-改变
handleTableHeadChange({ searchItemName, checkedList }) {
this.searchForm[searchItemName] = _.cloneDeep(checkedList)
},
beforeSearchFn() {
console.log(this.parentSearchForm)
return new Promise(resolve => {
this.searchFormSearch = {
condition: {
......
......@@ -29,7 +29,10 @@
label="类型"
prop="couponType"
>
<el-select :disabled="couponInfo" v-model="couponsForm.couponType">
<el-select
:disabled="couponInfo"
v-model="couponsForm.couponType"
>
<el-option
v-for="(item, index) in baseData.productTypeList"
:key="index"
......@@ -39,7 +42,10 @@
</el-select>
</el-form-item>
<el-form-item label="是否收费">
<el-radio-group :disabled="couponInfo" v-model="couponsForm.chargeFlag">
<el-radio-group
:disabled="couponInfo"
v-model="couponsForm.chargeFlag"
>
<el-radio label="N">免费</el-radio>
<el-radio
label="Y"
......@@ -59,9 +65,31 @@
>
</el-input>
</el-form-item>
<template v-if="couponInfo">
<el-form-item label="门店名称:">
<span>{{couponInfo.merchantName}}</span>
</el-form-item>
<el-form-item
label="券码数量:"
prop="amount"
:rules="[
{ required: true, message: '请输入券码数量', trigger: 'blur'},
{ validator: validateAccount, trigger: 'blur' }
]"
>
<el-input-number
v-model="couponsForm.amount"
:min="1"
:max="999"
size="mini"
></el-input-number>
</el-form-item>
</template>
<el-form-item
v-if="!couponInfo"
label="批量发放门店:"
prop="merchantCouponDTOList"
:rules="[{ required: true, message: '请选择门店', trigger: 'change' }]"
>
<el-button @click="handleAddStore">添加</el-button>
<selected-show-table
......@@ -134,7 +162,7 @@
</template>
<script>
import { addCouponApi, updateCouponApi } from '@api/coupons'
import * as api from '@api/coupons'
import selectedShowTable from './selectedShowTable'
import { mapActions } from 'vuex'
import { BaseData } from '@/common/constants.js'
......@@ -157,8 +185,8 @@ export default {
formRules: {
couponName: [{ required: true, message: '请输入精品礼券名称', trigger: 'change' }],
couponType: [{ required: true, message: '请选择类型', trigger: 'change' }],
remark: [{ required: true, message: '请输入礼券说明', trigger: 'change' }],
merchantCouponDTOList: [{ required: true, message: '请选择门店', trigger: 'change' }]
remark: [{ required: true, message: '请输入礼券说明', trigger: 'change' }]
// merchantCouponDTOList: [{ required: true, message: '请选择门店', trigger: 'change' }]
},
// 关联门店
relateStoreVisible: false,
......@@ -220,6 +248,11 @@ export default {
async getBaseData() {
this.baseData.productTypeList = _.cloneDeep(await this.get(BaseData.productType))
},
validateAccount(rule, value, callback) {
value < this.couponInfo.amount
? callback(new Error(`数量不能小于${this.couponInfo.amount}张`))
: callback()
},
handleAdd() {
// this.couponsVisible = !this.couponsVisible
this.$emit('couponClose', false)
......@@ -277,25 +310,32 @@ export default {
// console.log(this.couponsForm.remark)
this.$refs.couponAddForm.validate(valid => {
if (valid) {
if (!this.couponsForm.merchantCouponDTOList.every(item => item.amount)) {
return true
}
var params = _.cloneDeep(this.couponsForm)
params.couponTypeName = this.baseData.productTypeList.find(item => item.goodsType === this.couponsForm.couponType).goodsTypeName
params.createdBy = this.userInfo.detail[this.userInfo.userType === 1 ? 'name' : 'merchantName']
params.merchantCouponDTOList = []
this.couponsForm.merchantCouponDTOList.forEach((item, idx) => {
params.merchantCouponDTOList.push({
yqMerchantId: item.yqMerchantId,
yqMerchantName: item.yqMerchantName,
merchantId: item.merchantId,
merchantName: item.merchantName,
channelType: item.channelType,
amount: item.amount
if (this.couponInfo) {
// 编辑
} else {
// 新增
if (!this.couponsForm.merchantCouponDTOList.every(item => item.amount)) {
return true
}
params.merchantCouponDTOList = []
this.couponsForm.merchantCouponDTOList.forEach((item, idx) => {
params.merchantCouponDTOList.push({
yqMerchantId: item.yqMerchantId,
yqMerchantName: item.yqMerchantName,
merchantId: item.merchantId,
merchantName: item.merchantName,
channelType: item.channelType,
amount: item.amount
})
})
})
}
// console.log(params)
addCouponApi(params).then(res => {
var apiName = this.couponInfo ? 'updateCouponApi' : 'addCouponApi'
api[apiName](params).then(res => {
this.notice.okTips()
this.$emit('couponClose', true)
this.$refs.couponAddForm && this.$refs.couponAddForm.resetFields()
......
......@@ -34,23 +34,21 @@
<el-tabs
v-model="activeName"
type="card"
@tab-click="handleClick"
@tab-click="handleSearch"
>
<el-tab-pane
label=""
label="店面列表"
name="storeList"
>
<span slot="label">店面列表</span>
<store-list
ref="storeList"
:parentSearchForm="parentSearchForm"
></store-list>
</el-tab-pane>
<el-tab-pane
label=""
label="领用明细"
name="couponsDetail"
>
<span slot="label">领用明细</span>
<coupons-detail
ref="couponsDetail"
:parentSearchForm="parentSearchForm"
......
......@@ -38,7 +38,8 @@ export default {
return {
searchForm: {
couponTypeList: [],
regionList: []
regionList: [],
enabledFlagList: []
},
searchFormSearch: {},
// 编辑
......@@ -85,7 +86,7 @@ export default {
optionId: 'goodsType',
optionLabel: 'goodsTypeName'
},
mutiCheckOption: []
optionList: []
}, {
label: '区域',
parentProp: 'yqMerchantInfo',
......@@ -95,7 +96,7 @@ export default {
optionId: 'confKey',
optionLabel: 'confValue'
},
mutiCheckOption: []
optionList: []
}, {
label: '门店名称',
prop: 'merchantName'
......@@ -126,7 +127,7 @@ export default {
optionId: 'confId',
optionLabel: 'confLabel'
},
mutiCheckOption: [{ confLabel: '启用', confId: 'Y' }, { confLabel: '停用', confId: 'N' }],
optionList: [{ confLabel: '启用', confId: 'Y' }, { confLabel: '停用', confId: 'N' }],
formatter: cellValue => {
return {
'Y': '启用',
......@@ -163,12 +164,12 @@ export default {
get: 'd2admin/base/get'
}),
async getBaseData() {
this.tableParams.tableColumns[this.findFormIdx('couponTypeName')].mutiCheckOption = _.cloneDeep(await this.get(BaseData.productType))
this.tableParams.tableColumns[this.findFormIdx('couponTypeName')].optionList = _.cloneDeep(await this.get(BaseData.productType))
this.$nextTick()
},
getCommonConfig() {
commonConfigApi({ confGroup: 'MERCHANT_REGION' }).then(res => {
this.tableParams.tableColumns[this.findFormIdx('region')].mutiCheckOption = res
this.tableParams.tableColumns[this.findFormIdx('region')].optionList = res
this.$nextTick()
})
},
......@@ -205,7 +206,7 @@ export default {
couponClose(isRefresh) {
this.couponsVisible = !this.couponsVisible
isRefresh && this.handleSearch()
isRefresh && this.keyDowmGetList()
// this.$refs.couponAddForm && this.$refs.couponAddForm.resetFields()
},
......
......@@ -219,7 +219,7 @@ export default {
})
return true
}
var upgradeGoodsAttr = ['goodsCode', 'shopPrice', 'upgradePrice', 'incentiveType']
var upgradeGoodsAttr = ['goodsCode', 'shopPrice', 'upgradePrice', 'incentiveType', 'shopMinPrice']
var params = {
// yqMerchantId: this.userInfo.beSuper ? data.yqMerchantId : this.userInfo.detail.merchantId,
merchantId: this.userInfo.detail.merchantId,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!