395 lines
13 KiB
Vue
395 lines
13 KiB
Vue
<template>
|
||
<view class="page">
|
||
<hqs-popup class="hqs-popup" height="40vh" title="向下滑动关闭" from="top" :mask-click="maskClick" @back="onBack" v-model="showPop">
|
||
<view class="from-item">
|
||
<view class="from-item-label">项目名称:</view>
|
||
<u-search class="from-item-input" @focus="selectShow = true" v-model="queryFrom.projectName" :showAction="false"
|
||
disabledColor="#ffffff" placeholder="请选择项目名称"></u-search>
|
||
</view>
|
||
<view class="from-item">
|
||
<view class="from-item-label">创建人:</view>
|
||
<view class="bianju">
|
||
<u-input v-model="queryFrom.createdBy" :type="type" border="true"
|
||
custom-style="background-color:rgb(246,246,246)" placeholder="请输入会员姓名" />
|
||
</view>
|
||
</view>
|
||
<view class="from-item">
|
||
<view class="from-item-label">开始时间:</view>
|
||
<u-search class="from-item-input" @focus="showTime = true; type = 'createdStartDt'"
|
||
v-model="queryFrom.createdStartDt" :showAction="false" disabledColor="#ffffff"
|
||
placeholder="请选择开始时间"></u-search>
|
||
</view>
|
||
<view class="from-item">
|
||
<view class="from-item-label">结束时间:</view>
|
||
<u-search class="from-item-input" @focus="showTime = true; type = 'createdEndDt'"
|
||
v-model="queryFrom.createdEndDt" :showAction="false" disabledColor="#ffffff"
|
||
placeholder="请选择结束时间"></u-search>
|
||
</view>
|
||
<template v-slot:bottom>
|
||
<view class="chaxunx">
|
||
<u-button type="info" size="medium" :ripple="true" ripple-bg-color="#909399"
|
||
@click="resultFunc">重置</u-button>
|
||
<u-button type="primary" size="medium" :ripple="true" ripple-bg-color="#909399"
|
||
@click="queryFunc">查询</u-button>
|
||
</view>
|
||
</template>
|
||
</hqs-popup>
|
||
<view class="query-view">
|
||
<view class="header">
|
||
<u-search placeholder="请查询" input-align="center" :show-action="false" @focus="onShowPopup"></u-search>
|
||
</view>
|
||
</view>
|
||
<view class="list-view" >
|
||
<view class="list-view-item" :key="index" v-for="(item,index) in tableData">
|
||
<view style="display: flex;flex-direction: column;flex:4.5">
|
||
<span class="span-porject span-porject-top">
|
||
<ul>项目名称</ul>
|
||
<ul>{{item.projectName}}</ul>
|
||
</span>
|
||
<span class="span-porject">
|
||
<ul>创建时间</ul>
|
||
<ul>{{item.createdDtFormatted}}</ul>
|
||
</span>
|
||
<span class="span-porject">
|
||
<ul>数量</ul>
|
||
<ul>{{item.quantity}}</ul>
|
||
</span>
|
||
</view>
|
||
<view style="display: block;flex: 0.01;background-color: #58b6ec;height: 82%;margin-top: 4%;"></view>
|
||
<view style="margin-left: 1ex;display: flex;flex-direction: column;flex:3.5">
|
||
<span class="span-porject span-porject-top">
|
||
<ul>单价</ul>
|
||
<ul>{{item.unitPrice}}</ul>
|
||
</span>
|
||
<span class="span-porject">
|
||
<ul>创建人</ul>
|
||
<ul>{{item.createdBy}}</ul>
|
||
</span>
|
||
<span class="span-porject">
|
||
<ul>总价</ul>
|
||
<ul>{{item.totalPrice}}</ul>
|
||
</span>
|
||
</view>
|
||
|
||
<view style="flex:2;display:flex;flex-direction:column;">
|
||
<view style="margin-bottom:auto;">
|
||
<span class="span-porject">
|
||
<ul class="font1">是否作废</ul>
|
||
<ul class="font">{{item.status}}</ul>
|
||
</span>
|
||
</view>
|
||
<!-- <view style="margin-top:auto;">
|
||
<u-button type="warning" size="mini" ripple-bg-color="#909399"
|
||
@click="editItem(item)">修改项目</u-button>
|
||
</view> -->
|
||
<view style="margin-top:1ex;margin-bottom: 0ex;">
|
||
<u-button type="error" size="mini" :ripple="true" ripple-bg-color="#909399"
|
||
@click="delItem(item)">项目作废</u-button>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="foot-view">
|
||
<view class="jine">
|
||
<view style="margin-left: 3vw;">
|
||
总金额:{{zong}}(元)
|
||
</view>
|
||
<view style="margin-left: 15vw;">
|
||
| 余额:{{yue}}(元)
|
||
</view>
|
||
</view>
|
||
<view class="chaxunx">
|
||
<u-button type="primary" size="medium" :ripple="true" ripple-bg-color="#909399"
|
||
@click="addItem">新增项目</u-button>
|
||
</view>
|
||
</view>
|
||
<u-picker :show="selectShow" :columns="columns" @confirm="confirm" @cancel="selectShow = false" :closeOnClickOverlay="true" @close="close1"></u-picker>
|
||
<u-picker :show="selectShowA" :columns="columnsA" @confirm="confirmA" @cancel="selectShowA = false" :closeOnClickOverlay="true" @close="close1"></u-picker>
|
||
<u-datetime-picker :show="showTime" v-model="time" format="YYYY-MM-DD HH:mm:ss" mode="date"
|
||
closeOnClickOverlay @confirm="timeConfirm" @cancel="showTime = false" @close = "showTime = false"></u-datetime-picker>
|
||
<hqs-popup class="hqs-popup" height="50vh" title="向下滑动关闭" from="top" :mask-click="maskClick" @back="onBack" v-model="addAndEditShow">
|
||
<view>
|
||
<view class="from-item">
|
||
<view class="from-item-label">项目名称:</view>
|
||
<u-search class="from-item-input" @focus="selectShowA = true" v-model="selectRow.projectName" :showAction="false"
|
||
disabledColor="#ffffff" placeholder="请选择项目名称"></u-search>
|
||
</view>
|
||
<view class="from-item">
|
||
<view class="from-item-label">单价(元):</view>
|
||
<u-input class="from-item-input" disabled="true" v-model="selectRow.unitPrice"
|
||
placeholder="禁止修改"></u-input>
|
||
</view>
|
||
<view class="from-item">
|
||
<view class="from-item-label">数量:</view>
|
||
<u-input class="from-item-input" placeholder="请输入数量" v-model="selectRow.quantity" @change="xiugaisl" @touchmove="xiugaisl1"></u-input>
|
||
</view>
|
||
<view class="from-item">
|
||
<view class="from-item-label">总金额(元):</view>
|
||
<u-input class="from-item-input" disabled="true" placeholder="禁止修改" v-model="selectRow.amountAll"></u-input>
|
||
</view>
|
||
<view class="chaxunx" style="margin-top: 2ex;">
|
||
<u-button type="primary" size="medium" :ripple="true" ripple-bg-color="#909399"
|
||
@click="commitInfo">提交</u-button>
|
||
<u-button type="info" size="medium" :ripple="true" ripple-bg-color="#909399"
|
||
@click="addAndEditShow = false">关闭</u-button>
|
||
</view>
|
||
</view>
|
||
</hqs-popup>
|
||
<u-popup :show="chongzhiShow" :round="10" mode="top" @close="close">
|
||
<view>
|
||
<view class="from-item">
|
||
<view class="from-item-label">充值金额(元):</view>
|
||
<u--input class="from-item-input" placeholder="请输入金额" v-model="selectRow.amount"></u--input>
|
||
</view>
|
||
<view class="chaxunx" style="margin-top: 2ex;">
|
||
<u-button type="primary" size="medium" :ripple="true" ripple-bg-color="#909399"
|
||
@click="commitInfo1">提交</u-button>
|
||
<u-button type="info" size="medium" :ripple="true" ripple-bg-color="#909399"
|
||
@click="chongzhiShow = false">关闭</u-button>
|
||
</view>
|
||
</view>
|
||
</u-popup>
|
||
<view class="">
|
||
<u-notify style="height: 50upx;line-height: 50upx;" ref="uNotify" message="Hi uView"></u-notify>
|
||
</view>
|
||
</view>
|
||
|
||
</template>
|
||
<script>
|
||
import {
|
||
MemberInfo
|
||
} from "../../api/api.js"
|
||
export default {
|
||
data() {
|
||
return {
|
||
zong:"",
|
||
yue:"",
|
||
asMemberSid:"",
|
||
selectRow: {},
|
||
type: '',
|
||
addAndEditShow: false,
|
||
chongzhiShow: false,
|
||
maskClick: true,
|
||
showPop: false,
|
||
queryFrom: {
|
||
projectName: '',
|
||
asMemberSid: '',
|
||
createdStartDt: '',
|
||
createdEndDt: '',
|
||
createdBy:''
|
||
},
|
||
selectShow: false,
|
||
selectShowA: false,
|
||
showTime: false,
|
||
columns: [[]],
|
||
columnsA: [[]],
|
||
time: Number(new Date()),
|
||
tableData: [],
|
||
jiage:{
|
||
|
||
}
|
||
}
|
||
|
||
},
|
||
onLoad(options) {
|
||
console.log(options.memberId)
|
||
this.asMemberSid = options.memberId
|
||
this.queryFrom.asMemberSid = options.memberId
|
||
MemberInfo('amountAccount/findAmountAccountList', this.queryFrom).then((res) => {
|
||
console.log(res)
|
||
this.tableData = res.data
|
||
this.zong = res.data[0].totalPrice
|
||
this.yue = res.data[0].unitPrice
|
||
})
|
||
},
|
||
async onShow() {
|
||
const res = await MemberInfo('project/findProjectList','{"projectName":"","createdStartDt":"","createdEndDt":""}')
|
||
console.log(res.data)
|
||
let a
|
||
for(a=0;a<res.data.length;a++){
|
||
this.columns[0].push(res.data[a].projectName)
|
||
}
|
||
|
||
},
|
||
methods: {
|
||
cheng(arg1, arg2) {
|
||
var m = 0, s1 = arg1.toString(), s2 = arg2.toString();
|
||
try { m += s1.split(".")[1].length } catch (e) { }
|
||
try { m += s2.split(".")[1].length } catch (e) { }
|
||
return Number(s1.replace(".", "")) * Number(s2.replace(".", "")) / Math.pow(10, m);
|
||
},
|
||
xiugaisl(){
|
||
if(this.selectRow.projectName == "" ||this.selectRow.projectName== null ||this.selectRow.projectName == undefined){
|
||
this.$refs.uNotify.show({
|
||
top: 20,
|
||
type: 'error',
|
||
message: "请先选择项目再填写数量",
|
||
duration: 1000 * 3,
|
||
fontSize: 40,
|
||
safeAreaInsetTop:false
|
||
})
|
||
this.selectRow.quantity = ""
|
||
return
|
||
}
|
||
|
||
this.selectRow.amountAll =this.cheng(this.selectRow.quantity,this.selectRow.unitPrice)
|
||
},
|
||
|
||
onBack() {
|
||
uni.showToast({
|
||
title: 'test',
|
||
})
|
||
},
|
||
onShowPopup() {
|
||
this.showPop = true
|
||
},
|
||
confirm(e) {
|
||
console.log(e)
|
||
this.queryFrom.projectName = e.value
|
||
this.selectShow = false
|
||
},
|
||
confirmA(e) {
|
||
console.log(e.value)
|
||
this.selectRow.projectName = e.value[0]
|
||
this.selectRow.unitPrice=this.jiage[this.selectRow.projectName]
|
||
this.selectShowA = false
|
||
},
|
||
timeConfirm(e) {
|
||
// this.$set(this.queryFrom, this.type, this.time)
|
||
this.queryFrom[this.type] = this.formatMillisecondsToDate(e.value)
|
||
this.showTime = false
|
||
},
|
||
async queryFunc() {
|
||
this.showPop = false
|
||
const res = await MemberInfo('amountAccount/findAmountAccountList', this.queryFrom)
|
||
// console.log(res)
|
||
if (res.code == 200) {
|
||
this.tableData = res.data
|
||
this.zong = res.data[0].totalPrice
|
||
this.yue = res.data[0].unitPrice
|
||
this.resultFunc()
|
||
}
|
||
},
|
||
async delItem(item) {
|
||
console.log(item)
|
||
item.status = "是"
|
||
const res = await MemberInfo('amountAccount/editAmountAccount',item)
|
||
if(res.code == 200){
|
||
this.queryFunc()
|
||
this.$refs.uNotify.show({
|
||
top: 20,
|
||
type: 'success',
|
||
message: "删除成功",
|
||
duration: 1000 * 3,
|
||
fontSize: 40,
|
||
safeAreaInsetTop:false
|
||
})
|
||
}
|
||
this.queryFunc()
|
||
},
|
||
formatMillisecondsToDate(milliseconds) {
|
||
// 创建一个新的Date对象,参数为毫秒值
|
||
var date = new Date(milliseconds);
|
||
// 提取年、月、日
|
||
var year = date.getFullYear();
|
||
var month = ("0" + (date.getMonth() + 1)).slice(-2); // 月份从0开始,所以加1,并格式化为两位数
|
||
var day = ("0" + date.getDate()).slice(-2); // 格式化为两位数
|
||
// 返回年月日的字符串格式
|
||
return year + "-" + month + "-" + day;
|
||
},
|
||
resultFunc() {
|
||
this.queryFrom = {
|
||
projectName: '',
|
||
asMemberSid: this.hospitalName,
|
||
createdStartDt:'',
|
||
createdEndDt:'',
|
||
createdBy: ''
|
||
}
|
||
},
|
||
async addItem() {
|
||
const res = await MemberInfo('project/findProjectList','{"projectName":"","createdStartDt":"","createdEndDt":""}')
|
||
console.log(res.data)
|
||
|
||
let a
|
||
for(a=0;a<res.data.length;a++){
|
||
this.columnsA[0].push(res.data[a].projectName)
|
||
this.jiage[res.data[a].projectName]=res.data[a].unitPrice
|
||
}
|
||
this.addAndEditShow = true
|
||
this.selectRow= {}
|
||
},
|
||
|
||
editItem(item) {
|
||
console.log(item)
|
||
this.selectRow= {}
|
||
this.selectRow.memberId = item.memberId
|
||
this.selectRow.amount = ""
|
||
},
|
||
close(){
|
||
this.addAndEditShow = false
|
||
},
|
||
close1(){
|
||
this.selectShow = false
|
||
this.selectShowA = false
|
||
},
|
||
async commitInfo() {
|
||
const {
|
||
projectName,
|
||
amountAll,
|
||
quantity
|
||
} = this.selectRow
|
||
console.log(this.selectRow)
|
||
if (!projectName) {
|
||
this.$refs.uNotify.show({
|
||
top: 20,
|
||
type: 'error',
|
||
message: "项目名称不能为空",
|
||
duration: 1000 * 3,
|
||
fontSize: 40,
|
||
safeAreaInsetTop:false
|
||
})
|
||
return
|
||
}
|
||
if (!quantity) {
|
||
this.$refs.uNotify.show({
|
||
top: 20,
|
||
type: 'error',
|
||
message: "数量不能为空",
|
||
duration: 1000 * 3,
|
||
fontSize: 40,
|
||
safeAreaInsetTop:false
|
||
})
|
||
return
|
||
}
|
||
if ( amountAll > this.yue) {
|
||
this.$refs.uNotify.show({
|
||
top: 20,
|
||
type: 'error',
|
||
message: "余额不足,请返回上一页进行充值",
|
||
duration: 1000 * 3,
|
||
fontSize: 40,
|
||
safeAreaInsetTop:false
|
||
})
|
||
return
|
||
}
|
||
this.selectRow.asMemberSid = this.asMemberSid
|
||
const res = await MemberInfo('amountAccount/addAmountAccount', this.selectRow)
|
||
if (res.code == 200) {
|
||
this.addAndEditShow = false
|
||
this.$refs.uNotify.show({
|
||
top: 20,
|
||
type: 'success',
|
||
message: res.message,
|
||
duration: 1000 * 3,
|
||
fontSize: 40,
|
||
safeAreaInsetTop: false
|
||
})
|
||
this.queryFunc()
|
||
}
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
<style>
|
||
@import 'member.css'
|
||
</style> |