|
@@ -7,14 +7,14 @@
|
|
|
<div v-else-if="pageStatus == 3">加载发生错误</div>
|
|
|
<div v-else-if="pageStatus == 4" class="app-container">
|
|
|
<el-form
|
|
|
- :model="queryForm"
|
|
|
- ref="queryForm"
|
|
|
+ :model="createForm"
|
|
|
+ ref="createForm"
|
|
|
:inline="true"
|
|
|
label-width="88px"
|
|
|
>
|
|
|
<el-form-item label="设备类型" prop="deviceType">
|
|
|
<el-select
|
|
|
- v-model="queryForm.deviceType"
|
|
|
+ v-model="createForm.deviceType"
|
|
|
clearable
|
|
|
placeholder="请选择"
|
|
|
>
|
|
@@ -25,7 +25,7 @@
|
|
|
|
|
|
<el-form-item label="密钥" prop="deviceSerialNum">
|
|
|
<el-input
|
|
|
- v-model="queryForm.deviceSerialNum"
|
|
|
+ v-model="createForm.deviceSerialNum"
|
|
|
placeholder="请输入设备密钥"
|
|
|
clearable
|
|
|
size="small"
|
|
@@ -58,8 +58,8 @@
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
|
|
|
- <el-table :data="equipmentList">
|
|
|
- <af-table-column label="优惠" align="center" prop="deviceType">
|
|
|
+ <el-table :data="couponList">
|
|
|
+ <!-- <af-table-column label="优惠" align="center" prop="deviceType">
|
|
|
<template slot-scope="scope">
|
|
|
{{
|
|
|
scope.row.deviceType == "1"
|
|
@@ -69,10 +69,10 @@
|
|
|
: "不明设备"
|
|
|
}}
|
|
|
</template>
|
|
|
- </af-table-column>
|
|
|
- <af-table-column label="优惠券名称" align="center" prop="deviceNo" />
|
|
|
- <af-table-column label="面值" align="center" prop="gunNo" />
|
|
|
- <af-table-column label="有效期" align="center" prop="deviceFactory" />
|
|
|
+ </af-table-column> -->
|
|
|
+ <af-table-column label="优惠券名称" align="center" prop="couponName" />
|
|
|
+ <!-- <af-table-column label="面值" align="center" prop="gunNo" /> -->
|
|
|
+ <!-- <af-table-column label="有效期" align="center" prop="deviceFactory" /> -->
|
|
|
<af-table-column
|
|
|
label="操作"
|
|
|
align="center"
|
|
@@ -103,7 +103,7 @@
|
|
|
:total="total"
|
|
|
:page.sync="queryForm.pageNum"
|
|
|
:limit.sync="queryForm.pageSize"
|
|
|
- @pagination="getList"
|
|
|
+ @pagination="getCoupon"
|
|
|
:autoScroll="true"
|
|
|
/>
|
|
|
|
|
@@ -117,7 +117,7 @@
|
|
|
>
|
|
|
<el-form
|
|
|
ref="dialogForm"
|
|
|
- :model="dialogForm"
|
|
|
+ :model="createForm"
|
|
|
:rules="rules"
|
|
|
label-width="180px"
|
|
|
>
|
|
@@ -125,7 +125,7 @@
|
|
|
<input
|
|
|
type="text"
|
|
|
class="form-control"
|
|
|
- v-model="queryParams.couponName"
|
|
|
+ v-model="createForm.couponName"
|
|
|
style="width: 180px"
|
|
|
/>
|
|
|
</el-form-item>
|
|
@@ -133,7 +133,7 @@
|
|
|
<input
|
|
|
type="text"
|
|
|
class="form-control"
|
|
|
- v-model="queryParams.couponDetails"
|
|
|
+ v-model="createForm.couponDetails"
|
|
|
style="width: 180px"
|
|
|
/>
|
|
|
</el-form-item>
|
|
@@ -143,7 +143,7 @@
|
|
|
<input
|
|
|
type="text"
|
|
|
class="form-control d-inline"
|
|
|
- v-model.number="queryParams.couponThresholdAmt"
|
|
|
+ v-model.number="createForm.couponThresholdAmt"
|
|
|
style="width: 100px"
|
|
|
/>
|
|
|
元 可用
|
|
@@ -151,7 +151,7 @@
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="优惠券类型" prop="couponType">
|
|
|
- <el-radio-group v-model="queryParams.couponType">
|
|
|
+ <el-radio-group v-model="createForm.couponType">
|
|
|
<el-radio label="1">现金券</el-radio>
|
|
|
<el-radio label="2">折扣劵</el-radio>
|
|
|
<el-radio label="3">兑换劵</el-radio>
|
|
@@ -159,47 +159,48 @@
|
|
|
</el-form-item>
|
|
|
<el-form-item label="优惠金额"
|
|
|
prop="couponAmt"
|
|
|
- v-if="queryParams.couponType == 1 ||queryParams.couponType == 2"
|
|
|
+ v-if="createForm.couponType == 1 ||createForm.couponType == 2"
|
|
|
>
|
|
|
- <div v-if="queryParams.couponType == 1">
|
|
|
+ <div v-if="createForm.couponType == 1">
|
|
|
固定面值—<input
|
|
|
type="text"
|
|
|
class="form-control d-inline"
|
|
|
- v-model.number="queryParams.couponAmt"
|
|
|
+ v-model.number="createForm.couponAmt"
|
|
|
style="width: 100px"
|
|
|
/>
|
|
|
元
|
|
|
</div>
|
|
|
- <div v-if="queryParams.couponType == 2">
|
|
|
+ <div v-if="createForm.couponType == 2">
|
|
|
折扣比例—<input
|
|
|
type="text"
|
|
|
class="form-control d-inline"
|
|
|
- v-model.number="queryParams.couponAmt"
|
|
|
+ v-model.number="createForm.couponAmt"
|
|
|
style="width: 100px"
|
|
|
/>
|
|
|
%
|
|
|
</div>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="优惠券适用油品" prop="oilNameList">
|
|
|
- <el-checkbox-group v-model="queryParams.oilNameList">
|
|
|
- <el-checkbox label="92#"></el-checkbox>
|
|
|
+ <el-checkbox-group v-model="createForm.oilNameList">
|
|
|
+ <!-- <el-checkbox label="92#"></el-checkbox>
|
|
|
<el-checkbox label="93#"></el-checkbox>
|
|
|
- <el-checkbox label="94#"></el-checkbox>
|
|
|
+ <el-checkbox label="94#"></el-checkbox> -->
|
|
|
+ <el-checkbox label="94#" v-for="ele in oilNameList" :key="ele.oilName"></el-checkbox>
|
|
|
</el-checkbox-group>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="优惠券有效期" prop="effectiveTimeType">
|
|
|
<div>
|
|
|
<div>
|
|
|
- <el-radio-group v-model="queryParams.effectiveTimeType">
|
|
|
+ <el-radio-group v-model="createForm.effectiveTimeType">
|
|
|
<el-radio label="1">固定时间段</el-radio>
|
|
|
<el-radio label="2">固定天数</el-radio>
|
|
|
</el-radio-group>
|
|
|
</div>
|
|
|
- <div style="margin-top: 10px; ">
|
|
|
- <div v-if="queryParams.effectiveTimeType == 1">
|
|
|
+ <div style="margin-top: 10px;">
|
|
|
+ <div v-if="createForm.effectiveTimeType == 1">
|
|
|
<el-date-picker
|
|
|
style="margin: 0px 10px; width: 300px"
|
|
|
- v-model="queryParams.dateRangeCreatedDate"
|
|
|
+ v-model="createForm.effectiveTime"
|
|
|
type="datetimerange"
|
|
|
value-format="yyyy-MM-dd HH:mm:ss"
|
|
|
size="mini"
|
|
@@ -209,12 +210,12 @@
|
|
|
>
|
|
|
</el-date-picker>
|
|
|
</div>
|
|
|
- <div v-if="queryParams.effectiveTimeType == 2" style="margin-left: 20px">
|
|
|
+ <div v-if="createForm.effectiveTimeType == 2" style="margin-left: 20px">
|
|
|
自用户领取后
|
|
|
<input
|
|
|
type="text"
|
|
|
class="form-control d-inline"
|
|
|
- v-model.number="queryParams.effectiveDayNum"
|
|
|
+ v-model.number="createForm.effectiveDayNum"
|
|
|
style="width: 80px"
|
|
|
/>
|
|
|
天内有效
|
|
@@ -228,7 +229,7 @@
|
|
|
<input
|
|
|
type="text"
|
|
|
class="form-control d-inline"
|
|
|
- v-model.number="queryParams.couponNum"
|
|
|
+ v-model.number="createForm.couponNum"
|
|
|
style="width: 100px"
|
|
|
/>
|
|
|
张
|
|
@@ -238,7 +239,7 @@
|
|
|
<input
|
|
|
type="text"
|
|
|
class="form-control d-inline"
|
|
|
- v-model.number="queryParams.couponHoldNum"
|
|
|
+ v-model.number="createForm.couponHoldNum"
|
|
|
style="width: 100px"
|
|
|
/>
|
|
|
张优惠券
|
|
@@ -248,15 +249,15 @@
|
|
|
<input
|
|
|
type="text"
|
|
|
class="form-control d-inline"
|
|
|
- v-model.number="queryParams.couponReceiveNum"
|
|
|
+ v-model.number="createForm.couponReceiveNum"
|
|
|
style="width: 100px"
|
|
|
/>
|
|
|
张优惠券
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="优惠券的核销方" prop="couponType" v-if="queryParams.couponType == 3">
|
|
|
+ <el-form-item label="优惠券的核销方" prop="couponType" v-if="createForm.couponType == 3">
|
|
|
(自己的站点也是核销商)
|
|
|
</el-form-item>
|
|
|
- <div v-if="queryParams.couponType == 3">
|
|
|
+ <div v-if="createForm.couponType == 3">
|
|
|
<el-col :span="11">
|
|
|
<el-table
|
|
|
:data="unselectedCouponList"
|
|
@@ -355,8 +356,9 @@ import {
|
|
|
changeManageStatus,
|
|
|
} from "@/api/station/manage";
|
|
|
import { listGun } from "@/api/station/gun";
|
|
|
+import { listPrice } from "@/api/station/price";
|
|
|
|
|
|
-import { addInfo,verificationList } from "@/api/coupon";
|
|
|
+import { addInfo,verificationList,listInfo } from "@/api/coupon";
|
|
|
|
|
|
export default {
|
|
|
name: "Station_Equipment",
|
|
@@ -367,14 +369,15 @@ export default {
|
|
|
return {
|
|
|
pageStatus: 4,
|
|
|
// 油站设备管理表格数据
|
|
|
- queryParams: {
|
|
|
+ createForm: {
|
|
|
couponName: "",
|
|
|
couponDetails:'',
|
|
|
couponThresholdAmt: 0,
|
|
|
couponType: "1",
|
|
|
couponAmt: 0,
|
|
|
- oilNameList: [],
|
|
|
+ oilNameList: ['92#'],
|
|
|
effectiveTimeType: "", //有效时间类型: 1,固定时间;2,领取后x天内有效
|
|
|
+ effectiveTime:[],
|
|
|
effectiveDayNum: 3,
|
|
|
couponHoldNum: 2,
|
|
|
couponReceiveNum: 1,
|
|
@@ -382,7 +385,9 @@ export default {
|
|
|
status: 1,
|
|
|
verificationList: [2,5,7],
|
|
|
},
|
|
|
- couponList: [{
|
|
|
+ couponList:[],
|
|
|
+ oilNameList:[],
|
|
|
+ allVerificationList: [{
|
|
|
deptId: 1,
|
|
|
deptName:'固定1'
|
|
|
},{
|
|
@@ -430,8 +435,6 @@ export default {
|
|
|
queryForm: {
|
|
|
pageNum: 1,
|
|
|
pageSize: 10, // 初始值只能比10大
|
|
|
- deviceNo: null,
|
|
|
- deviceSerialNum: null, // 设备密钥
|
|
|
},
|
|
|
// 表单校验
|
|
|
rules: {
|
|
@@ -440,9 +443,8 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
- console.log("111111111111111111111")
|
|
|
-
|
|
|
this.init();
|
|
|
+ this.getCoupon();
|
|
|
this.setPageStatus();
|
|
|
},
|
|
|
computed: {
|
|
@@ -453,73 +455,54 @@ export default {
|
|
|
return false;
|
|
|
},
|
|
|
selectedCouponList(){
|
|
|
- return this.couponList.filter((ele)=>{
|
|
|
- return this.queryParams.verificationList.includes(ele.deptId)
|
|
|
+ return this.allVerificationList.filter((ele)=>{
|
|
|
+ return this.createForm.verificationList.includes(ele.deptId)
|
|
|
})
|
|
|
},
|
|
|
unselectedCouponList(){
|
|
|
- return this.couponList.filter((ele)=>{
|
|
|
- return !!!this.queryParams.verificationList.includes(ele.deptId)
|
|
|
+ return this.allVerificationList.filter((ele)=>{
|
|
|
+ return !!!this.createForm.verificationList.includes(ele.deptId)
|
|
|
})
|
|
|
},
|
|
|
getTodayDateString(){
|
|
|
const today = new Date()
|
|
|
- // const day = today.getD()
|
|
|
return
|
|
|
},
|
|
|
- posList() {
|
|
|
- // 排除其他pos已经添加过的
|
|
|
- const temp = this.allGunList.filter((item) => {
|
|
|
- let flag = false;
|
|
|
- this.equipmentList.map((ele) => {
|
|
|
- if (ele.deviceType == 2) {
|
|
|
- if (ele.gunNo.split(",").includes(item.oilGunNo)) {
|
|
|
- flag = true;
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- return flag;
|
|
|
- });
|
|
|
- // 查找自己的
|
|
|
- const temp2 = this.allGunList.filter((item) => {
|
|
|
- let flag = true;
|
|
|
- temp.map((ele) => {
|
|
|
- if (item.oilGunNo == ele.oilGunNo) {
|
|
|
- flag = false;
|
|
|
- }
|
|
|
- });
|
|
|
- return flag;
|
|
|
- });
|
|
|
- return this.currentList.concat(temp2);
|
|
|
-
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ getOilList(){
|
|
|
+ listPrice().then((res) => {
|
|
|
+ console.log('油品',res)
|
|
|
+ if(res.code == 200){
|
|
|
+ this.oilNameList = res.rows || []
|
|
|
+ }else{
|
|
|
+ throw new Error("")
|
|
|
+ }
|
|
|
+ }).catch((err) => {
|
|
|
+ this.msgError("亲,拉取油品列表失败~")
|
|
|
+ })
|
|
|
},
|
|
|
- printList() {
|
|
|
- const temp = this.allGunList.filter((item) => {
|
|
|
- let flag = false;
|
|
|
- this.equipmentList.map((ele) => {
|
|
|
- if (ele.deviceType == 1) {
|
|
|
- if (ele.gunNo.split(",").includes(item.oilGunNo)) {
|
|
|
- flag = true;
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- return flag;
|
|
|
- });
|
|
|
- const temp2 = this.allGunList.filter((item) => {
|
|
|
- let flag = true;
|
|
|
- temp.map((ele) => {
|
|
|
- if (item.oilGunNo == ele.oilGunNo) {
|
|
|
- flag = false;
|
|
|
+ getCoupon() {
|
|
|
+ listInfo({
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ }).then((res)=>{
|
|
|
+ if(res.code == 200){
|
|
|
+ console.log(res)
|
|
|
+ if(res.rows == null){
|
|
|
+ this.total = 0
|
|
|
+ this.couponList = [];
|
|
|
+ }else{
|
|
|
+ this.total = res.total;
|
|
|
+ this.couponList = res.rows;
|
|
|
}
|
|
|
- });
|
|
|
- return flag;
|
|
|
- });
|
|
|
- return this.currentList.concat(temp2);
|
|
|
+ }else{
|
|
|
+ throw new Error('');
|
|
|
+ }
|
|
|
+ }).catch((err)=>{
|
|
|
+ this.msgError("亲,拉取优惠券列表失败~")
|
|
|
+ })
|
|
|
},
|
|
|
- },
|
|
|
- methods: {
|
|
|
getVerificationList(){
|
|
|
verificationList({
|
|
|
pageNum: 1,
|
|
@@ -527,9 +510,9 @@ export default {
|
|
|
}).then((res)=>{
|
|
|
if(res.code == 200){
|
|
|
if(res.rows == null){
|
|
|
- this.couponList = [];
|
|
|
+ this.allVerificationList = [];
|
|
|
}else{
|
|
|
- this.couponList = res.rows;
|
|
|
+ this.allVerificationList = res.rows;
|
|
|
}
|
|
|
}else{
|
|
|
throw new Error('');
|
|
@@ -540,17 +523,17 @@ export default {
|
|
|
},
|
|
|
toggleLabel(){
|
|
|
if(this.moveLeftData.length !== 0){
|
|
|
- this.queryParams.verificationList = this.queryParams.verificationList.filter((ele)=>{
|
|
|
+ this.createForm.verificationList = this.createForm.verificationList.filter((ele)=>{
|
|
|
return ele != this.moveLeftData
|
|
|
})
|
|
|
- this.queryParams = {...this.queryParams}
|
|
|
+ this.createForm = {...this.createForm}
|
|
|
return;
|
|
|
}
|
|
|
if(this.moveRightData.length !== 0){
|
|
|
- this.queryParams.verificationList = [...new Set(this.queryParams.verificationList.concat(this.moveRightData))].filter((ele)=>{
|
|
|
+ this.createForm.verificationList = [...new Set(this.createForm.verificationList.concat(this.moveRightData))].filter((ele)=>{
|
|
|
return !!ele
|
|
|
})
|
|
|
- this.queryParams = {...this.queryParams}
|
|
|
+ this.createForm = {...this.createForm}
|
|
|
return;
|
|
|
}
|
|
|
return;
|
|
@@ -576,41 +559,22 @@ export default {
|
|
|
this.$refs.leftTable.clearSelection()
|
|
|
},
|
|
|
init() {
|
|
|
- this.getList();
|
|
|
+ this.getOilList()
|
|
|
+ this.getCoupon();
|
|
|
this.getVerificationList();
|
|
|
- //字典设备状态
|
|
|
- this.getDicts("device_status").then((response) => {
|
|
|
- this.deviceStatusOptions = response.data;
|
|
|
- });
|
|
|
- //字典设备类型
|
|
|
- this.getDicts("device_type").then((response) => {
|
|
|
- this.deviceTypeOptions = response.data;
|
|
|
- });
|
|
|
- listGun({
|
|
|
- stationId: this.deptId,
|
|
|
- }).then((response) => {
|
|
|
- this.allGunList = response.rows;
|
|
|
- });
|
|
|
},
|
|
|
setPageStatus() {
|
|
|
this.queryPageStatus([2]).then((res) => {
|
|
|
this.pageStatus = res;
|
|
|
});
|
|
|
},
|
|
|
- /** 查询油站设备管理列表 首页表单 */
|
|
|
- getList() {
|
|
|
- listManage(this.queryForm).then((response) => {
|
|
|
- this.equipmentList = response.rows;
|
|
|
- this.total = response.total;
|
|
|
- });
|
|
|
- },
|
|
|
// 取消按钮
|
|
|
cancel() {
|
|
|
this.open = false;
|
|
|
},
|
|
|
/** 搜索按钮操作 */
|
|
|
handleQuery() {
|
|
|
- this.queryForm.pageNum = 1;
|
|
|
+ this.createForm.pageNum = 1;
|
|
|
this.getList();
|
|
|
},
|
|
|
deviceNoInput(value) {
|
|
@@ -618,39 +582,18 @@ export default {
|
|
|
},
|
|
|
/** 重置按钮操作 */
|
|
|
resetQuery() {
|
|
|
- this.resetForm("queryForm");
|
|
|
+ this.resetForm("createForm");
|
|
|
this.handleQuery();
|
|
|
},
|
|
|
/** 新增按钮操作 */
|
|
|
handleAdd() {
|
|
|
- this.updateAble = false;
|
|
|
- this.currentList = [];
|
|
|
- this.title = "添加油站设备管理";
|
|
|
- this.dialogForm = {
|
|
|
- checkedGunList: [],
|
|
|
- deviceStatus: "1",
|
|
|
- deviceType: "1",
|
|
|
- posFanoutExchange: "posFanoutExchange-" + this.deptId,
|
|
|
- };
|
|
|
+ this.title = "添加优惠券";
|
|
|
this.open = true;
|
|
|
},
|
|
|
/** 修改按钮操作 */
|
|
|
handleUpdate(row) {
|
|
|
- // 查找自己已经选中的枪号
|
|
|
- this.updateAble = true;
|
|
|
- this.currentList = this.allGunList.filter((ele) => {
|
|
|
- return row.gunNo.split(",").includes(ele.oilGunNo);
|
|
|
- });
|
|
|
- let checkedGunList;
|
|
|
- // 将自己有的抢号 默认勾选
|
|
|
- if (Object.prototype.toString.call(row.gunNo) === "[object String]") {
|
|
|
- checkedGunList = [...new Set(row.gunNo.split(","))].filter((ele) => {
|
|
|
- return ele.toString().trim() !== "";
|
|
|
- });
|
|
|
- } else {
|
|
|
- checkedGunList = [];
|
|
|
- }
|
|
|
- this.dialogForm = { ...row, checkedGunList };
|
|
|
+ // // 查找自己已经选中的枪号
|
|
|
+ this.createForm = JSON.parse(JSON.stringify(row))
|
|
|
this.title = "修改油站设备管理";
|
|
|
this.open = true;
|
|
|
},
|
|
@@ -660,7 +603,7 @@ export default {
|
|
|
this.$refs["dialogForm"].validate((valid) => {
|
|
|
if (valid) {
|
|
|
//this.dialogForm.gunNo = this.dialogForm.checkedGunList.toString();
|
|
|
- addInfo(this.queryParams).then((res) => {
|
|
|
+ addInfo(this.createForm).then((res) => {
|
|
|
console.log(res)
|
|
|
})
|
|
|
}
|