Commit e25c40bf authored by dragondean@qq.com's avatar dragondean@qq.com

优惠券-金额满减

parent 69ddd604
import request from '@/utils/request'
// 创建优惠券信息
export function createCoupon(data) {
return request({
url: '/ecw/coupon/createOrUpdate',
method: 'post',
data: data
})
}
// 更新优惠券信息
export function updateCoupon(data) {
return request({
url: '/ecw/coupon/createOrUpdate',
method: 'post',
data: data
})
}
// 删除优惠券信息
export function deleteCoupon(id) {
return request({
url: '/ecw/coupon/delete?id=' + id,
method: 'delete'
})
}
// 获得优惠券信息
export function getCoupon(id) {
return request({
url: '/ecw/coupon/get?id=' + id,
method: 'get'
})
}
// 获得优惠券信息分页
export function getCouponPage(query) {
return request({
url: '/ecw/coupon/page',
method: 'get',
params: query
})
}
// 导出优惠券信息 Excel
export function exportCouponExcel(query) {
return request({
url: '/ecw/coupon/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}
......@@ -43,6 +43,15 @@ export function getCustomerPage(query) {
})
}
// 获得客户下来
export function getCustomerSelect(query) {
return request({
url: '/ecw/customer/select',
method: 'get',
params: query
})
}
// 导出客户 Excel
export function exportCustomerExcel(query) {
return request({
......
<template>
<el-row class="" :gutter="10">
<el-col :span="10">
<el-card>
<div slot="header" class="header">
<el-input v-model="queryParams.searchKey" placeholder="用户名/手机/邮箱" style="width:200px" />
<dict-selector :type="DICT_TYPE.USER_TYPE" v-model="queryParams.customerType" style="width:100px" />
<el-button type="primary" @click="reLoad">搜搜1</el-button>
</div>
<div class="list">
<div class="item" v-for="item in list" :key="item.id">
<el-link class="el-icon-plus" @click="choose(item)" :disabled="customerIds.indexOf(item.id) > -1" />
{{item.name}}{{item.defaultContactName}}
</div>
</div>
</el-card>
</el-col>
<el-col :span="10">
<el-card>
<div slot="header" class="header">
已选客户
</div>
<div class="list">
<div class="item" v-for="item in choosedList" :key="item.id">
<el-link class="el-icon-delete" @click="remove(item)" />
{{item.name}}{{item.defaultContactName}}
</div>
</div>
</el-card>
</el-col>
</el-row>
</template>
<script>
import {getCustomerSelect} from '@/api/ecw/customer'
export default {
data(){
return {
list:[],
/* page: 1,
pages: 1, */
queryParams:{
page: 1,
name: null,
level: null
},
choosedList:[]
}
},
computed:{
customerIds(){
let arr = []
this.choosedList.forEach(item => {
arr.push(item.id)
})
return arr
}
},
watch:{
customerIds(val){
this.$emit('input', val)
}
},
created(){
this.reLoad()
},
methods:{
reLoad(){
this.queryParams.page = 1
this.list = []
this.getList()
},
loadNextPage(){
if(this.page >= this.pages){
return this.$message.error('已加载全部')
}
this.queryParams.page ++
this.getList()
},
getList(){
getCustomerSelect(this.queryParams).then(res => {
this.list = res.data
})
},
choose(customer){
this.choosedList.push(customer)
},
remove(customer){
this.choosedList.forEach((item,index) => {
if(item.id==customer.id) this.choosedList.splice(index,1)
})
}
}
}
</script>
<style scoped lang="scss">
.header{
>div{
margin-right: 5px;
}
}
.list{
height: 200px;
border: 1px solid #ccc;
overflow-y: auto;
overflow-x: hidden;
padding: 0 10px;
}
</style>
\ No newline at end of file
<template>
<el-select v-model="valueSync" :placeholder="placeholder" clearable :multiple="multiple">
<el-option v-for="dict in getList(type)"
:key="dict.value" :label="dict.label" :value="dict.value"/>
</el-select>
<div class="dict-selector">
<el-select v-if="formType == 'select'" v-model="valueSync" :placeholder="placeholder" clearable :multiple="multiple">
<el-option v-for="dict in dictList"
:key="dict.value" :label="dict.label" :value="dict.value"/>
</el-select>
<el-radio-group v-if="formType == 'radio'" v-model="valueSync">
<el-radio v-for="dict in dictList" :label="dict.value" :key="dict.value">{{dict.label}}</el-radio>
</el-radio-group>
<el-checkbox-group v-if="formType == 'checkbox'" v-model="valueSync">
<el-checkbox v-for="dict in dictList" :label="dict.value" :key="dict.value">{{dict.label}}</el-checkbox>
</el-checkbox-group>
</div>
</template>
<script>
const selfDefinedDict = {
_yesno: [
{label: '', value: '1'},
{label: '', value: '0'}
]
}
export default {
props:{
placeholder: {
......@@ -20,14 +22,24 @@ export default {
type: String,
value: [String, Number, Array],
multiple: Boolean,
formType:{
type: String,
default: 'select'
},
forceString: {
type: Boolean,
default: true
}
},
defaultable: Boolean, // 是否默认选择第一个
},
data(){
return {
valueSync: null
valueSync: this.multiple ? [] : null
}
},
computed:{
dictList(){
return this.getList(this.type)
}
},
watch:{
......@@ -36,21 +48,36 @@ export default {
},
value(val){
this.setValueSync()
},
dictList(){
this.setDefault()
}
},
created(){
this.setValueSync()
this.setDefault()
},
methods:{
setValueSync(){
if(!this.value || this.value == '') return
if(this.forceString && this.multiple){
this.valueSync = val.split(',')
this.valueSync = this.value.split(',')
}else this.valueSync = this.forceString ? String(this.value) : this.value
},
getList(){
return selfDefinedDict[this.type] || this.getDictDatas(this.type)
return this.getDictDatas(this.type)
},
setDefault(){
if(!this.defaultable) return
if(this.dictList.length && (this.valueSync === null || this.valueSync == '')){
this.valueSync = this.dictList[0].value
}
}
}
}
</script>
\ No newline at end of file
</script>
<style scoped>
.dict-selector{
display: inline-block;
}
</style>
\ No newline at end of file
<template>
<el-row class="" :gutter="10">
<el-col :span="10">
<el-card>
<div slot="header" class="header">
<el-select v-model="queryParams.typeId" placeholder="选择类型" style="width:120px" clearable>
<el-option v-for="item in typeList" :key="item.id" :label="item.titleZh" :value="item.id" />
</el-select>
<el-select v-model="queryParams.attrId" placeholder="选择属性" style="width:120px" clearable>
<el-option v-for="item in attrList" :key="item.id" :label="item.attrName" :value="item.id" />
</el-select>
<el-input v-model="queryParams.titleZh" placeholder="产品关键字" style="width:120px" clearable />
<el-button type="primary" @click="reLoad">搜搜</el-button>
</div>
<div class="list">
<div class="item" v-for="item in list" :key="item.id">
<el-checkbox @change="toggleCheck(item, $event)" :value="ids.indexOf(item.id) > -1" /> {{item.titleZh}}
<div>{{item.titleEn}}</div>
</div>
</div>
</el-card>
</el-col>
<el-col :span="10">
<el-card>
<div slot="header" class="header">
已选产品
</div>
<div class="list">
<div class="item" v-for="(choosed) in choosedList" :key="choosed.id" :data-data="JSON.stringify(choosed)">
<el-link class="el-icon-delete" @click="remove(choosed)" /> {{choosed.titleZh}}
<div>{{choosed.titleEn}}</div>
</div>
</div>
</el-card>
</el-col>
</el-row>
</template>
<script>
import {getProductPage} from '@/api/ecw/product'
import {getProductTypeList} from '@/api/ecw/productType'
import {getProductAttrList} from '@/api/ecw/productAttr'
export default {
data(){
return {
list:[],
page: 1,
pages: 1,
queryParams:{
page: 1,
attrId: null,
titleZh: null,
typeId: null
},
choosedList:[],
typeList:[],
attrList:[]
}
},
computed:{
ids(){
let arr = []
this.choosedList.forEach(item => {
arr.push(item.id)
})
return arr
}
},
watch:{
ids(val){
this.$emit('input', val)
}
},
created(){
getProductTypeList().then(res => this.typeList = res.data)
getProductAttrList().then(res => this.attrList = res.data)
this.reLoad()
},
methods:{
reLoad(){
this.queryParams.page = 1
this.list = []
this.getList()
},
loadNextPage(){
if(this.page >= this.pages){
return this.$message.error('已加载全部')
}
this.queryParams.page ++
this.getList()
},
getList(){
getProductPage(this.queryParams).then(res => {
this.list = res.data.list //.concat(res.data.list || [])
this.page = res.data.page
this.pages = res.data.pages
})
},
toggleCheck(item, checked){
if(checked){
this.choose(item)
}else{
this.remove(item)
}
},
choose(item){
this.choosedList.push(item)
},
remove(item){
this.choosedList.forEach((choosed,index) => {
if(choosed.id==item.id) this.choosedList.splice(index,1)
})
}
}
}
</script>
<style scoped lang="scss">
.header{
>div{
margin-right: 5px;
}
}
.list{
height: 200px;
border: 1px solid #ccc;
overflow-y: auto;
overflow-x: hidden;
padding: 0 10px;
display: flex;
flex-wrap: wrap;
.item{
width: 50%;
line-height: 20px;
height: 50px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
</style>
\ No newline at end of file
<template>
<el-select v-model="valueSync" :multiple="multiple">
<el-option v-for="item in optionsFormated" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</template>
<script>
export default {
data(){
return {
valueSync: null
}
},
props:{
options: Array,
value: [String, Number, Boolean, Object],
labelField: {
type: String,
default: 'label'
},
valueField: {
type: String,
default: 'value'
},
multiple: Boolean,
clearable: Boolean,
defaultable: Boolean, // 没有值的时候是否选择第一项
},
computed:{
optionsFormated(){
let arr = []
this.options.forEach(item => {
arr.push({
label: item[this.labelField],
value: item[this.valueField]
})
})
return arr
}
},
watch:{
valueSync(val){
this.$emit('input', val)
},
value(value){
this.valueSync = value
},
optionsFormated(){
this.setDefault()
}
},
created(){
this.valueSync = this.value
this.setDefault()
},
methods:{
setDefault(){
if(!this.defaultable){
return false
}
if(this.optionsFormated.length && (this.valueSync == null || this.valueSync == '')){
this.valueSync = this.optionsFormated[0].value
}
}
}
}
</script>
\ No newline at end of file
......@@ -68,6 +68,20 @@ export const DICT_TYPE = {
ECW_PACKAGING_TYPE: 'packaging_type', //包装要求
ECW_CONTAINER_LOCATION: 'container_location', //默认货柜位置
ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS: 'special_req_for_line_products', // 特殊需求
ECW_COUPON_TYPE: 'coupon_type', // 优惠券类型
ECW_COUPON_STATUS: 'coupon_status', // 优惠券状态
ECW_COUPON_COST_TYPE: 'coupon_cost_type', // 优惠券费用类型
ECW_COUPON_OVERDUE_STATUS: 'coupon_overdue_status', // 优惠券状态
ECW_COUPON_PUTON_STATUS: 'coupon_puton_status',
ECW_SUITABLE_USER_TYPE:'suitable_user_type', // 适用用户类型
ECW_SUITABLE_LINE_TYPE: 'suitable_line_type', // 适用线路类型
ECW_SUITABLE_PROD_TYPE: 'suitable_prod_type', // 适用产品类型
ECW_ORDER_ATTR: 'order_attr', // 订单属性
ECW_YESNO: 'yesno', // 是否 1,0
ECW_COMPANY_TYPE: 'company_type', // 供应商类别
ECW_COOPERATION_TYPE: 'cooperation_type', // 合作类型
ECW_SHIPPING_DECLARATION_TYPE: 'shipping_declaration_type', // 出货报关方式(与订单报关方式相同)
ECW_CUSTOMS_TYPE: 'customs_type', // 订单报关方式(非出货报关),优惠券中的单证报关
//--------ecw---------
CUSTOMER_STATUS: 'customer_status',
CUSTOMER_SOURCE: 'customer_source',
......
This diff is collapsed.
This diff is collapsed.
......@@ -20,7 +20,7 @@
<el-form-item label="路线" v-if="form.warehouseLineDO">
<el-input :value="'【' + getDictDataLabel(DICT_TYPE.ECW_TRANSPORT_TYPE, form.warehouseLineDO.transportType) + '】从【'+form.warehouseLineDO.startTitleZh+'】发往【'+form.warehouseLineDO.destTitleZh+'】'" disabled />
</el-form-item>
<router-selector v-if="!form.id" v-model="selectedRoutes" />
<routers-selector v-if="!form.id" v-model="selectedRoutes" />
<el-card style="margin-bottom: 10px">
<div slot="header" style="font-size:20px;">
价格设置
......@@ -155,7 +155,7 @@
</div>
</template>
<script>
import RouterSelector from '@/components/RouterSelector'
import RoutersSelector from '@/components/RoutersSelector'
import { createProductPrice, updateProductPrice, deleteProductPrice, getProductPrice, getProductPricePage, exportProductPriceExcel } from "@/api/ecw/productPrice";
import { getProduct } from '@/api/ecw/product'
import { getProductType, getProductTypeList } from '@/api/ecw/productType'
......@@ -164,7 +164,7 @@ import { getUnitList } from '@/api/ecw/unit';
import ProductSelector from '@/components/ProductSelector'
import {arrryToKeyedObjectBy} from '@/utils/index'
export default {
components: {RouterSelector, ProductSelector},
components: {RoutersSelector, ProductSelector},
data(){
return {
selectedRoutes: [], // 勾选的路线渠道
......
......@@ -44,10 +44,10 @@
<el-option v-for="dict in this.getDictDatas('company_type')"
:key="dict.value" :label="dict.label" :value="dict.value"/>
</el-select-->
<dict-selector type="company_type" v-model="queryParams.companyType" />
<dict-selector :type="DICT_TYPE.COMPANY_TYPE" v-model="queryParams.companyType" />
</el-form-item>
<el-form-item label="合作类型" prop="cooperationType">
<dict-selector type="cooperation_type" v-model="queryParams.cooperationType" />
<dict-selector :type="DICT_TYPE.ECW_COOPERATION_TYPE" v-model="queryParams.cooperationType" />
<!--el-select v-model="queryParams.cooperationType" placeholder="请选择合作类型" clearable size="small">
<el-option label="请选择字典生成" value="" />
</el-select-->
......@@ -65,7 +65,7 @@
<!-- <el-select v-model="queryParams.status" placeholder="请选择是否展示 默认为展示" clearable size="small">
<el-option label="请选择字典生成" value="" />
</el-select> -->
<dict-selector type="_yesno" v-model="queryParams.status" />
<dict-selector :type="DICT_TYPE.ECW_YES_NO" v-model="queryParams.status" />
</el-form-item>
<el-form-item label="创建时间">
<el-date-picker v-model="dateRangeCreateTime" style="width: 240px" value-format="yyyy-MM-dd"
......
......@@ -54,6 +54,7 @@
<el-button type="text" size="small" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['infra:codegen:delete']">删除</el-button>
<el-button type="text" size="small" icon="el-icon-refresh" @click="handleSynchDb(scope.row)" v-hasPermi="['infra:codegen:update']">同步</el-button>
<el-button type="text" size="small" icon="el-icon-download" @click="handleGenTable(scope.row)" v-hasPermi="['infra:codegen:download']">生成代码</el-button>
<el-button type="text" size="small" icon="el-icon-download" @click="generateValidateCode(scope.row)">生成验证配置</el-button>
</template>
</el-table-column>
</el-table>
......@@ -101,7 +102,7 @@
</template>
<script>
import { getCodegenTablePage, previewCodegen, downloadCodegen, deleteCodegen,
import {getCodegenDetail, getCodegenTablePage, previewCodegen, downloadCodegen, deleteCodegen,
syncCodegenFromDB, syncCodegenFromSQL, createCodegenListFromSQL } from "@/api/infra/codegen";
import importTable from "./importTable";
......@@ -371,7 +372,35 @@ export default {
this.getList();
});
});
}
},
generateValidateCode(row){
let l = this.$loading()
getCodegenDetail(row.id).then(res => {
let rules = {}
res.data.columns.forEach(item => {
let rule = {trigger: 'blur'}
if(!item.nullable){
rule.required = true
rule.message = '不能为空'
}
if(['int', 'tinyint', 'bigint'].indexOf(item.columnType)){
rule.type = 'integer'
}
if(item.columnType.indexOf('decimal') === 0){
rule.type = 'decimal'
}
if(item.columnType == 'datetime'){
rule.type = 'date'
}
rules[item.javaField] = [rule]
})
console.log(row.tableComment + '校验规则', JSON.stringify(rules))
this.$message('规则已生成,打开控制台查看')
})
.finally(res => {
l.close()
})
},
}
};
</script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment