721 lines
22 KiB
Vue
721 lines
22 KiB
Vue
<template>
|
||
<div class="app-containers">
|
||
<!-- 存油卡-->
|
||
|
||
<div class="card-box" style="margin-bottom: 20px">
|
||
<div class="d-s">
|
||
<div class="gang"></div>
|
||
<div style="font-weight: bold">电子囤油卡</div>
|
||
</div>
|
||
<div style="display: flex;justify-content: space-between;box-sizing: border-box;align-items: center;padding: 1px">
|
||
<div class="left-c">新型加油卡,以储油为特色,让车主提前锁定油价,享受便捷灵活的加油体验</div>
|
||
<div>
|
||
<el-button type="primary" @click="addCrule()" >编辑囤油卡规则</el-button>
|
||
<el-button type="primary" style="margin-bottom: 10px " @click="addoilBlock()">新增囤油卡活动</el-button>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
|
||
<el-table
|
||
:data="tableData"
|
||
border
|
||
style="width: 100%">
|
||
<el-table-column
|
||
label="序号"
|
||
type="index"
|
||
>
|
||
</el-table-column>
|
||
|
||
<el-table-column
|
||
prop="type"
|
||
label="油品油号"
|
||
>
|
||
</el-table-column>
|
||
<el-table-column
|
||
prop="lockPrice"
|
||
label="锁价活动价(元)/L"
|
||
>
|
||
</el-table-column>
|
||
<el-table-column
|
||
prop="oilPrice"
|
||
label="当前挂牌价(元)/L"
|
||
>
|
||
</el-table-column>
|
||
<el-table-column
|
||
prop="gbPrice"
|
||
label="当前国标价(元)/L"
|
||
>
|
||
</el-table-column>
|
||
<el-table-column prop="startTime" label="活动时间" align="center" width="165">
|
||
<template slot-scope="scope">
|
||
<span v-if="scope.row.activeTime == 1">不限时间</span>
|
||
<span v-if="scope.row.activeTime == 2">{{scope.row.startTime }}-{{scope.row.endTime }}</span>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column
|
||
prop="activeStatus"
|
||
label="活动状态"
|
||
>
|
||
<template slot-scope="scope">
|
||
<span v-if="scope.row.activeStatus == 0"> <el-tag>已上架</el-tag></span>
|
||
<span v-if="scope.row.activeStatus == 1"> <el-tag>未下架</el-tag></span>
|
||
|
||
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="销售信息" align="center">
|
||
<el-table-column prop="rechargeBalance" label="售出金额(元)" align="center" > </el-table-column>
|
||
<el-table-column prop="giftBalance" label="售出人数" align="center" > </el-table-column>
|
||
<el-table-column prop="points" label="会员人数" align="center" > </el-table-column>
|
||
</el-table-column>
|
||
<el-table-column prop="createBy" label="操作人" align="center"> </el-table-column>
|
||
<el-table-column prop="createTime" label="创建时间" align="center" width="160"> </el-table-column>
|
||
|
||
|
||
|
||
<el-table-column
|
||
label="编辑"
|
||
>
|
||
<template slot-scope="scope">
|
||
<div style="display: flex">
|
||
<el-button
|
||
size="mini"
|
||
type="text"
|
||
@click="handleUpdate(scope.row)"
|
||
>修改</el-button>
|
||
|
||
<el-button
|
||
size="mini"
|
||
type="text"
|
||
@click="lookorder()"
|
||
>查看订单记录
|
||
</el-button>
|
||
</div>
|
||
|
||
</template>
|
||
|
||
</el-table-column>
|
||
</el-table>
|
||
<pagination
|
||
v-show="total>0"
|
||
:total="total"
|
||
:page.sync="pageNo"
|
||
:limit.sync="pageSize"
|
||
@pagination="getlist"
|
||
/>
|
||
</div>
|
||
<el-drawer
|
||
title="订单记录"
|
||
:visible.sync="orderShow"
|
||
size="55%"
|
||
center>
|
||
<div class="box-der">
|
||
<div class="d-b">
|
||
<div class="d-s">
|
||
<el-input v-model="order.orderNo" style="width: 200px;margin-right: 10px" placeholder="请输入订单号"></el-input>
|
||
<el-select v-model="order.ordertype" placeholder="请选择" style="width: 200px;margin-right: 10px">
|
||
<el-option
|
||
v-for="item in options"
|
||
:key="item.value"
|
||
:label="item.label"
|
||
:value="item.value">
|
||
</el-option>
|
||
</el-select>
|
||
<el-date-picker
|
||
v-model="dataRange"
|
||
type="daterange"
|
||
range-separator="至"
|
||
start-placeholder="开始日期"
|
||
end-placeholder="结束日期">
|
||
</el-date-picker>
|
||
</div>
|
||
<el-button type="primary" icon="el-icon-search" @click="RecordList()" >搜索</el-button>
|
||
</div>
|
||
<el-table
|
||
:data="orderData"
|
||
border
|
||
style="width: 100%">
|
||
<el-table-column
|
||
label="序号"
|
||
type="index"
|
||
>
|
||
</el-table-column>
|
||
<el-table-column
|
||
prop="orderNo"
|
||
label="订单号"
|
||
>
|
||
</el-table-column>
|
||
<el-table-column
|
||
prop="mobile"
|
||
label="会员手机号"
|
||
>
|
||
</el-table-column>
|
||
<el-table-column
|
||
prop="amount"
|
||
label="订单金额">
|
||
</el-table-column>
|
||
|
||
<el-table-column
|
||
prop="incomeLitres"
|
||
label="所得升数">
|
||
</el-table-column>
|
||
<el-table-column
|
||
prop="points"
|
||
label="赠送积分">
|
||
</el-table-column>
|
||
<el-table-column
|
||
prop="growthValue"
|
||
label="赠送成长值">
|
||
</el-table-column>
|
||
<el-table-column
|
||
prop="status"
|
||
label="订单状态">
|
||
</el-table-column>
|
||
<el-table-column
|
||
prop="payTime"
|
||
label="订单完成时间">
|
||
</el-table-column>
|
||
</el-table>
|
||
<pagination
|
||
v-show="orderTotal>0"
|
||
:total="orderTotal"
|
||
:page.sync="order.pageNo"
|
||
:limit.sync="order.pageSize"
|
||
@pagination="RecordList"
|
||
/>
|
||
</div>
|
||
</el-drawer>
|
||
<!-- 规则-->
|
||
<el-dialog title="编辑囤油卡规则" width="30%" :visible.sync="Crule">
|
||
<el-form :model="oilForm" :rules="ruleInfo" ref="oilForm" label-width="70px" class="demo-ruleForm" >
|
||
<el-form-item label="名称" prop="name">
|
||
<el-input disabled v-model="oilForm.name"></el-input>
|
||
</el-form-item>
|
||
<el-form-item label="权益说明" prop="desc">
|
||
<el-input type="textarea" v-model="oilForm.qyDetail"></el-input>
|
||
</el-form-item>
|
||
<el-form-item label="规则说明" prop="desc">
|
||
<el-input type="textarea" v-model="oilForm.gzDetail"></el-input>
|
||
</el-form-item>
|
||
|
||
<el-form-item >
|
||
<el-button type="primary" @click="submitForms('oilForm')">保存</el-button>
|
||
<el-button @click="resetForm('oilForm')">取消</el-button>
|
||
</el-form-item>
|
||
</el-form>
|
||
</el-dialog>
|
||
|
||
<el-dialog
|
||
title="囤油卡操作"
|
||
:visible.sync="centerDialogVisible"
|
||
width="30%"
|
||
center>
|
||
|
||
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="80px" class="demo-ruleForm">
|
||
<div style="display: flex; align-items: center ">
|
||
<el-form-item label="油品油号" prop="oilNumberId">
|
||
<el-select style="width: 440px" v-model="ruleForm.oilNumberId" placeholder="请选择" @change="getoiltype" >
|
||
<el-option
|
||
v-for="dict in oilList"
|
||
:key="dict.id"
|
||
:label="dict.oilName"
|
||
:value="dict.id">
|
||
</el-option>
|
||
</el-select>
|
||
</el-form-item>
|
||
|
||
</div>
|
||
<el-form-item label="充值金额" prop="rechargeBalance">
|
||
<div style="width: 100%">
|
||
<el-input v-model="ruleForm.rechargeBalance" min="1" placeholder="请输入充值金额">
|
||
<template slot="append">元</template>
|
||
</el-input>
|
||
</div>
|
||
</el-form-item>
|
||
<el-form-item label="锁定单价" prop="lockPrice">
|
||
<div style="width: 100%">
|
||
<el-input v-model="ruleForm.lockPrice" min="1" placeholder="请输入锁定单价">
|
||
<template slot="append">元/升</template>
|
||
</el-input>
|
||
</div>
|
||
</el-form-item>
|
||
<el-form-item label="赠送积分" prop="points">
|
||
<div style="width: 100%">
|
||
<el-input v-model="ruleForm.points">
|
||
<template slot="append">分</template>
|
||
</el-input>
|
||
</div>
|
||
</el-form-item>
|
||
<el-form-item label="活动时间" prop="resource">
|
||
<el-radio-group v-model="ruleForm.activeTime">
|
||
<el-radio label="1">不限时间</el-radio>
|
||
<el-radio label="2">自定义时间</el-radio>
|
||
</el-radio-group>
|
||
</el-form-item>
|
||
<el-form-item label="时间范围" v-if="ruleForm.activeTime == 2" prop="startTime">
|
||
<div style="width: 100%;display: flex;align-items: center ">
|
||
<div style="width: 200px">
|
||
<el-date-picker
|
||
v-model="ruleForm.startTime"
|
||
value-format="yyyy-MM-dd HH:mm:ss"
|
||
type="datetime"
|
||
placeholder="开始日期">
|
||
</el-date-picker>
|
||
</div>
|
||
<div style="margin: 0 5px">
|
||
-
|
||
</div>
|
||
<div style="width: 200px">
|
||
<el-date-picker
|
||
v-model="ruleForm.endTime"
|
||
value-format="yyyy-MM-dd HH:mm:ss"
|
||
type="datetime"
|
||
placeholder="结束日期">
|
||
</el-date-picker>
|
||
</div>
|
||
</div>
|
||
</el-form-item>
|
||
<el-form-item label="活动状态" prop="resource">
|
||
<el-radio-group v-model="ruleForm.activeStatus">
|
||
<el-radio label="1">启用</el-radio>
|
||
<el-radio label="2">禁用</el-radio>
|
||
</el-radio-group>
|
||
</el-form-item>
|
||
<el-form-item label="附加特权" prop="privilege">
|
||
<el-input
|
||
type="textarea"
|
||
placeholder="请输入内容"
|
||
maxlength="225"
|
||
v-model="ruleForm.privilege"
|
||
show-word-limit
|
||
>
|
||
</el-input>
|
||
</el-form-item>
|
||
|
||
</el-form>
|
||
<span slot="footer" class="dialog-footer">
|
||
<el-button @click="centerDialogVisible = false">取 消</el-button>
|
||
<el-button type="primary" @click="postadd(ruleForm)">确 定</el-button>
|
||
</span>
|
||
</el-dialog>
|
||
</div>
|
||
</template>
|
||
|
||
<script>
|
||
import { getList,oilName,addList,eitList,getById,getoilnum,getstatistics,deleteById,cardFuleOrders} from "@/api/EventMarketing/oilBlock";
|
||
import {cardValueRule, saveOrUpdate} from "@/api/EventMarketing/SaveBlock";
|
||
export default {
|
||
dicts: ['oil_type'],
|
||
name: 'index',
|
||
data(){
|
||
return{
|
||
Crule:false,
|
||
gbPrice:null,
|
||
oilPrice:null,
|
||
tjlist:[],
|
||
value:'',
|
||
type:0,
|
||
dataRange:[],
|
||
orderShow:false,
|
||
centerDialogVisible:false,
|
||
value1:'',
|
||
total:0,
|
||
pageNo:1,
|
||
pageSize:10,
|
||
oilForm:{},
|
||
ruleInfo: {
|
||
participationNo: [
|
||
{ required: true, message: '不能为空', trigger: 'blur' },
|
||
],
|
||
activeName: [
|
||
{ required: true, message: '不能为空', trigger: 'blur' },
|
||
],
|
||
refuelMoney: [
|
||
{ required: true, message: '不能为空', trigger: 'blur' },
|
||
],
|
||
growthValue: [
|
||
{ required: true, message: '不能为空', trigger: 'blur' },
|
||
],
|
||
points: [
|
||
{ required: true, message: '不能为空', trigger: 'blur' },
|
||
],
|
||
giftBalance: [
|
||
{ required: true, message: '不能为空', trigger: 'blur' },
|
||
],
|
||
membershipLevel:[
|
||
{ required: true, message: '不能为空', trigger: 'blur' },
|
||
],
|
||
rechargeBalance: [
|
||
{ required: true, message: '不能为空', trigger: 'blur' },
|
||
],
|
||
groupOriented: [
|
||
{ required: true, message: '不能为空', trigger: 'blur' },
|
||
],
|
||
sort: [
|
||
{ required: true, message: '不能为空', trigger: 'blur' },
|
||
],
|
||
employeeCommission: [
|
||
{ required: true, message: '不能为空', trigger: 'blur' },
|
||
],
|
||
royaltyType: [
|
||
{ required: true, message: '不能为空', trigger: 'blur' },
|
||
],
|
||
resource: [
|
||
{ required: true, message: '不能为空', trigger: 'blur' },
|
||
],
|
||
activeTime: [
|
||
{ required: true, message: '不能为空', trigger: 'blur' },
|
||
],
|
||
activeStatus: [
|
||
{ required: true, message: '不能为空', trigger: 'blur' },
|
||
],
|
||
paymentValue: [
|
||
{ required: true, message: '不能为空', trigger: 'blur' },
|
||
],
|
||
amountCommission: [
|
||
{ required: true, message: '不能为空', trigger: 'blur' },
|
||
],
|
||
percentageCommissions: [
|
||
{ required: true, message: '不能为空', trigger: 'blur' },
|
||
],
|
||
|
||
},
|
||
options:[
|
||
{
|
||
value: '0',
|
||
label: '汽油卡'
|
||
},
|
||
{
|
||
value: '1',
|
||
label: '柴油卡'
|
||
}, {
|
||
value: '2',
|
||
label: '天然气'
|
||
},],
|
||
option: [
|
||
{
|
||
value: '',
|
||
label: '全部'
|
||
},
|
||
{
|
||
value: '1',
|
||
label: '正常'
|
||
}, {
|
||
value: '2',
|
||
label: '禁用'
|
||
},],
|
||
orderTotal:0,
|
||
order:{
|
||
orderNo:'',
|
||
ordertype:'',
|
||
cardValueId:'',
|
||
pageNo:1,
|
||
pageSize:10
|
||
},
|
||
orderData: [{
|
||
date: '2016-05-02',
|
||
name: '王小虎',
|
||
address: '上海市普陀区金沙江路 1518 弄'
|
||
}, ],
|
||
tableData: [],
|
||
oilList:[],
|
||
ruleForm:{
|
||
oilNumberId:null,
|
||
lockupPrice: "" ,
|
||
lockPrice: "" ,
|
||
lockMoney: "" ,
|
||
rechargeBalance:"",
|
||
incomeLitres:0,
|
||
points:'',
|
||
status:'0',
|
||
activeTime:'1',
|
||
activeStatus:'0'
|
||
},
|
||
queryParams:{
|
||
type:'汽油',
|
||
oilType:'',
|
||
activeStatus:'',
|
||
pageNo:1,
|
||
pageSize:10,
|
||
},
|
||
queryParamss:{
|
||
type:'',
|
||
oilType:'',
|
||
activeStatus:'',
|
||
pageNo:1,
|
||
pageSize:10,
|
||
},
|
||
rules:{
|
||
oilNumberId: [
|
||
{ required: true, message: '不能为空', trigger: 'blur' },
|
||
],
|
||
rechargeBalance: [
|
||
{ required: true, message: '不能为空', trigger: 'blur' },
|
||
],
|
||
points: [
|
||
{ required: true, message: '不能为空', trigger: 'blur' },
|
||
],
|
||
lockPrice: [
|
||
{ required: true, message: '不能为空', trigger: 'blur' },
|
||
],
|
||
incomeLitres:[
|
||
{ required: true, message: '不能为空', trigger: 'blur' },
|
||
]
|
||
}
|
||
}
|
||
|
||
},
|
||
mounted() {
|
||
this.getlist()
|
||
this.radiovalue()
|
||
},
|
||
watch:{
|
||
'ruleForm.rechargeBalance':{
|
||
handler: function() {
|
||
if(this.ruleForm.rechargeBalance != 0 && this.ruleForm.lockupPrice != 0 ){
|
||
this.ruleForm.incomeLitres = this.ruleForm.rechargeBalance / this.ruleForm.lockupPrice
|
||
|
||
}else {
|
||
this.ruleForm.incomeLitres = 0
|
||
}
|
||
|
||
},
|
||
},
|
||
'ruleForm.lockupPrice':{
|
||
handler: function() {
|
||
if(this.ruleForm.rechargeBalance != 0 && this.ruleForm.lockupPrice != 0 ){
|
||
this.ruleForm.incomeLitres = this.ruleForm.rechargeBalance / this.ruleForm.lockupPrice
|
||
|
||
}else {
|
||
this.ruleForm.incomeLitres = 0
|
||
}
|
||
},
|
||
}
|
||
},
|
||
computed: {
|
||
// 计算属性很重要的特性: 带缓存, 性能极强
|
||
// 在第一次使用该属性时进行计算, 计算后将结果缓存起来, 后面如果还有其他地方用到, 会直接从缓存中取值, 不会再次计算
|
||
// 如果依赖的数据更新, 也会重新计算, 然后重复上述操作
|
||
totalCount () {
|
||
console.log('我是 computed 里的求和属性')
|
||
this.ruleForm.incomeLitres = this.ruleForm.rechargeBalance / this.ruleForm.lockupPrice
|
||
return this.ruleForm.incomeLitres
|
||
}
|
||
},
|
||
|
||
methods:{
|
||
submitForms(formName) {
|
||
this.$refs[formName].validate((valid) => {
|
||
if (valid) {
|
||
saveOrUpdate(this.oilForm).then(res=>{
|
||
if(res.code == 200){
|
||
this.$message.success('成功')
|
||
this.Crule = false
|
||
}
|
||
})
|
||
} else {
|
||
return false;
|
||
}
|
||
});
|
||
},
|
||
resetForm(formName) {
|
||
this.$refs[formName].resetFields();
|
||
this.Crule = false
|
||
},
|
||
addCrule(){
|
||
this.Crule =! this.Crule
|
||
cardValueRule({type:'1'}).then(res=>{
|
||
this.oilForm = res.data
|
||
|
||
})
|
||
},
|
||
lookorder(){
|
||
this.orderShow = !this.orderShow
|
||
this.RecordList()
|
||
},
|
||
RecordList(){
|
||
cardFuleOrders(this.addDateRange(this.order,this.dataRange)).then(res=>{
|
||
this.orderData = res.data.records
|
||
this.order.total = res.data.total
|
||
|
||
console.log(res)
|
||
|
||
})
|
||
},
|
||
getoiltype(e){
|
||
getoilnum(e).then(res=>{
|
||
console.log(res)
|
||
if(res.code == 200){
|
||
this.gbPrice = res.data.gbPrice
|
||
this.oilPrice = res.data.oilPrice
|
||
}
|
||
|
||
})
|
||
},
|
||
|
||
radiovalue(lable){
|
||
this.oilList = []
|
||
oilName(this.queryParams.type).then(res=>{
|
||
this.oilList = res.data.records
|
||
})
|
||
this.getlist()
|
||
},
|
||
// 重置按钮操作
|
||
resetQuery() {
|
||
this.queryParams = {
|
||
type:'汽油',
|
||
oilType:'',
|
||
activeStatus:'',
|
||
pageNo:1,
|
||
pageSize:10,
|
||
}
|
||
this.getlist();
|
||
},
|
||
getlist(){
|
||
this.queryParams.pageNo=this.pageNo
|
||
this.queryParams.pageSize=this.pageSize
|
||
getList(this.queryParams).then(res=>{
|
||
if(res.code == 200){
|
||
this.tableData = res.data.records
|
||
this.total = res.data.total;
|
||
}
|
||
})
|
||
getstatistics().then(res=>{
|
||
console.log(res)
|
||
this.tjlist = res.data
|
||
})
|
||
|
||
},
|
||
addoilBlock(){
|
||
this.gbPrice = null,
|
||
this.oilPrice=null,
|
||
this.ruleForm = {
|
||
type:this.queryParams.type,
|
||
lockupPrice: 0 ,
|
||
rechargeBalance:0,
|
||
incomeLitres:0,
|
||
|
||
points:'',
|
||
activeTime:'1',
|
||
activeStatus:'1',
|
||
tatus:'1'
|
||
},
|
||
this.radiovalue()
|
||
this.centerDialogVisible = true
|
||
},
|
||
posteid(data){
|
||
eitList(data).then(res=>{
|
||
if (res.code == 200){
|
||
this.$message.success('修改成功')
|
||
}
|
||
})
|
||
},
|
||
postadd(formName){
|
||
|
||
this.ruleForm.type = this.queryParams.type
|
||
this.ruleForm.status = '1'
|
||
// this.ruleForm.startTime = this.ruleForm.startTime.toLocaleDateString()
|
||
// this.ruleForm.endTime = this.ruleForm.endTime.toLocaleDateString()
|
||
if( this.ruleForm.id ){
|
||
console.log("修改")
|
||
eitList(this.ruleForm).then(res=>{
|
||
if (res.code == 200){
|
||
this.$message.success('修改成功')
|
||
this.getlist()
|
||
}
|
||
})
|
||
}else{
|
||
addList(this.ruleForm).then(res=>{
|
||
if (res.code == 200){
|
||
this.$message.success('新增成功')
|
||
this.getlist()
|
||
}
|
||
})
|
||
}
|
||
|
||
this.centerDialogVisible = false
|
||
},
|
||
handleDelete(data){
|
||
|
||
this.$modal.confirm('确定删除此条电子囤油卡信息?').then(function() {
|
||
return deleteById(data.id);
|
||
}).then(() => {
|
||
this.getlist()
|
||
this.$modal.msgSuccess("删除成功");
|
||
}).catch(() => {});
|
||
},
|
||
handleUpdate(data){
|
||
getById(data.id).then(res=>{
|
||
if (res.code == 200){
|
||
this.ruleForm = res.data
|
||
this.centerDialogVisible = true
|
||
}
|
||
})
|
||
}
|
||
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style scoped lang="scss">
|
||
.d-b{
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
width: 100%;
|
||
margin-bottom: 10px;
|
||
}
|
||
.top-sousuo{
|
||
margin-top: 10px;
|
||
display: flex;
|
||
align-items: center;
|
||
}
|
||
.tjbox{
|
||
width: 19%;
|
||
background: #f9f9f9;
|
||
margin-right: 1%;
|
||
margin-bottom: 1%;
|
||
box-sizing: border-box;
|
||
padding: 15px;
|
||
border-radius: 6px;
|
||
}
|
||
.cu{
|
||
font-weight: bold;
|
||
}
|
||
.wrap-box{
|
||
width: 100%;
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
margin-bottom: 20px;
|
||
}
|
||
.card-box{
|
||
width: 100%;
|
||
background: #fff;
|
||
box-sizing: border-box;
|
||
padding: 15px;
|
||
border-radius: 10px;
|
||
}
|
||
.box-der{
|
||
box-sizing: border-box;
|
||
padding: 15px;
|
||
}
|
||
.gang{
|
||
width: 2px;
|
||
height: 13px;
|
||
background: #FF9655;
|
||
margin-right: 5px;
|
||
}
|
||
.d-s{
|
||
display: flex;
|
||
align-items: center;
|
||
}
|
||
.left-c{
|
||
background: rgba(255,150,85,0.15);
|
||
font-size: 12px;
|
||
color: #FF9655;
|
||
box-sizing: border-box;
|
||
padding: 4px 15px ;
|
||
}
|
||
</style>
|