You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
high-mini-manage/pages/user/updateOilgun/updateOilgun.vue

173 lines
3.6 KiB

<template>
<view>
<view class="activeRefuel" v-for="(item,index) in oilgunList" :key="index">
{{item.gunNo}}号枪
<image src="../../../static/img/6.png" mode="widthFix" class="imgcha iconw" @click.stop="delGunNo(item.id)">
</image>
</view>
<view class="btn mart50" @click="addgasoilPrice()"> </view>
</view>
</template>
<script>
import {
getGunNoListByOilPrice,
addGasOilPrice,
delGunNo
} from '../../../Utils/Api.js';
let app = getApp();
export default {
data() {
return {
oilgunList: [], //油枪列表
oilNo: '' //油品
}
},
onLoad(options) {
this.oilNo = options.oilno;
this.getGunNoListByOilPrice();
},
methods: {
//添加油枪
addgasoilPrice() {
let that = this;
uni.showModal({
title: '添加油枪',
placeholderText: '请输入油枪号',
editable: true,
success: function(res) {
if (res.confirm) {
uni.showLoading({
title: '提交中'
})
let datas = {
"oilPriceId": that.oilNo,
"gunNo": res.content
}
addGasOilPrice(datas).then(res => {
if (res.return_code == '000000') {
that.getGunNoListByOilPrice();
} else {
uni.showToast({
title: res.return_msg,
duration: 2000,
icon: 'none'
})
}
});
} else if (res.cancel) {
}
}
});
},
//查询油枪
getGunNoListByOilPrice() {
uni.showLoading({
title: '加载中'
})
let datas = {
oilPriceId: this.oilNo
}
getGunNoListByOilPrice(datas).then(res => {
uni.hideLoading();
if (res.return_code == '000000') {
this.oilgunList = res.return_data;
} else {
uni.showToast({
title: res.return_msg,
duration: 2000,
icon: 'none'
})
}
});
},
//删除油枪
delGunNo(item) {
let that = this;
uni.showModal({
title: '删除油枪',
content: '是否删除当前油枪',
success: function(res) {
if (res.confirm) {
uni.showLoading({
title: '操作中'
})
let datas = {
"gunNoId": item
}
delGunNo(datas).then(res => {
uni.hideLoading();
if (res.return_code == '000000') {
uni.showToast({
title: '删除成功',
icon: 'none',
duration: 1000,
success() {
setTimeout(() => {
that.getGunNoListByOilPrice();
}, 1000);
}
})
}
});
}
}
})
}
}
}
</script>
<style lang="scss">
.refuel {
padding: 6px 10px;
border-radius: 5px;
background-color: #f6f6f6;
color: #666666;
margin-right: 10px;
margin-left: 15px;
margin-top: 20px;
display: inline-block;
font-size: 16px;
width: 20%;
text-align: center;
}
.activeRefuel {
padding: 6px 10px;
border-radius: 5px;
border: 1px solid #089bf5;
color: #089bf5;
margin-right: 10px;
margin-left: 15px;
margin-top: 20px;
display: inline-block;
font-size: 16px;
width: 20%;
text-align: center;
}
.btn {
bottom: 0px;
position: absolute;
color: #FFFFFF;
background-color: #0083f5;
width: 90%;
margin-left: 5%;
margin-top: 80rpx;
margin-bottom: 50rpx;
height: 90rpx;
display: flex;
justify-content: center;
align-items: center;
border-radius: 45rpx;
font-size: 40rpx;
}
.imgcha {
position: absolute;
margin-top: -15px;
margin-left: 10px;
}
</style>