优化测试

This commit is contained in:
wuxw 2023-10-17 11:41:27 +08:00
parent 7829753d63
commit 952a604f0e
6 changed files with 309 additions and 2 deletions

54
api/fee/feeDetailApi.js Normal file
View File

@ -0,0 +1,54 @@
import {
request,
requestNoAuth
} from '../../lib/java110/java110Request.js'
import
url
from '../../constant/url.js'
import {
formatDate
} from '@/lib/java110/utils/DateUtil.js'
/**
* 查询开票抬头
* @param {Object} _objData 数据
*/
export function getFeeDetail(_objData) {
return new Promise((resolve, reject) => {
request({
url: url.queryFeeDetail,
method: "GET",
data: _objData, //动态数据
success: function(res) {
let _json = res.data;
let _feeDetails = _json.feeDetails;
if (!_feeDetails) {
_feeDetails = [];
resolve(_feeDetails);
return;
}
_feeDetails.forEach(function(_feeDetail) {
let _tmpCreateTime = _feeDetail.createTime.replace(/\-/g, "/")
let _createTime = new Date(_tmpCreateTime);
_feeDetail.createTime = formatDate(_createTime);
if (_feeDetail.hasOwnProperty("startTime")) {
let _tmpStartTime = _feeDetail.startTime.replace(/\-/g, "/")
let _startTime = new Date(_tmpStartTime);
_feeDetail.startTime = formatDate(_startTime);
}
if (_feeDetail.hasOwnProperty("endTime")) {
let _tmpEndTime = _feeDetail.endTime.replace(/\-/g, "/")
let _endTime = new Date(_tmpEndTime);
_feeDetail.endTime = formatDate(_endTime);
}
});
resolve(_feeDetails);
},
fail: function(e) {
reject(e);
}
});
})
}

View File

@ -129,3 +129,21 @@ export function getInvoiceEvent(_objData) {
});
})
}
export function saveInvoiceApply(_data) {
return new Promise((resolve, reject) => {
request({
url: url.saveInvoiceApply,
method: "POST",
data: _data,
//动态数据
success: function(res) {
resolve(res.data);
},
fail: function(e) {
reject("服务器异常了");
}
});
})
}

View File

@ -227,6 +227,8 @@ export default {
listInvoiceApply: baseUrl+"app/invoice.listInvoiceApply",
deleteInvoiceApply: baseUrl+"app/invoice.deleteInvoiceApply",
listInvoiceEvent: baseUrl+"app/invoice.listInvoiceEvent",
saveInvoiceApply: baseUrl+"app/invoice.saveInvoiceApply",

View File

@ -983,7 +983,16 @@
"path" : "pages/invoice/invoiceDetail",
"style" :
{
"navigationBarTitleText": "",
"navigationBarTitleText": "发票详情",
"enablePullDownRefresh": false
}
}
,{
"path" : "pages/invoice/addInvoiceApply",
"style" :
{
"navigationBarTitleText": "申请开票",
"enablePullDownRefresh": false
}

View File

@ -47,6 +47,10 @@
<view class="text-gray">备注</view>
<view class="text-gray">{{item.remark}}</view>
</view>
<view class="flex margin-top-xs justify-between">
<view class="text-gray"></view>
<view class="text-gray"><button class="cu-btn sm line-blue" @click="_applyInvoice(item)">申请开票</button></view>
</view>
</view>
<uni-load-more :status="loadingStatus" :content-text="loadingContentText" />
</view>
@ -65,7 +69,6 @@
import noDataPage from '@/components/no-data-page/no-data-page.vue'
import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
const util = context.util;
export default {
data() {
@ -168,6 +171,11 @@
})
}
});
},
_applyInvoice:function(_feeDetail){
uni.navigateTo({
url:'/pages/invoice/addInvoiceApply?detailId='+_feeDetail.detailId+'&feeId='+_feeDetail.feeId
})
}
}
}

View File

@ -0,0 +1,216 @@
<template>
<view>
<view v-if="oiId">
<view class="block__title">发票抬头</view>
<view class="cu-form-group">
<view class="title">发票类型</view>
<view><text>{{invoiceType=='1001'?'个人':'公司'}}</text></view>
</view>
<view class="cu-form-group">
<view class="title">发票名头</view>
<view><text>{{invoiceName}}</text></view>
</view>
<view class="cu-form-group">
<view class="title">纳税人识别号</view>
<view><text>{{invoiceNum}}</text></view>
</view>
<view class="cu-form-group">
<view class="title">地址电话</view>
<view><text>{{invoiceAddress}}</text></view>
</view>
<view class="margin-top">
<checkbox-group class="block" @change="checkboxChange($event)">
<view class="cu-list menu" v-for="(item,index) in feeDetails" :key="index" :data-item="item">
<view class="cu-item">
<view class="content padding-tb-sm flex justify-start">
<view>
<checkbox :class="item.selected == '1'?'checked':''"
:checked="item.selected == '1'?true:false" :value="item.detailId">
</checkbox>
</view>
<view class="margin-left-sm">
<view>
<view class="text-cut" style="width:220px">{{item.feeName || '-'}}</view>
</view>
<view class="text-gray text-sm">
<text class="margin-right-xs">{{item.startTime}}{{item.endTime}}</text>
</view>
</view>
</view>
<view class="action">
<text class="text-grey text-sm">金额:{{item.receivedAmount}}</text>
</view>
</view>
</view>
</checkbox-group>
</view>
<view style="height: 200upx;"></view>
<view v-if="feeDetails.length > 0" class="bg-white border flex justify-end"
style="position: fixed;width: 100%;bottom: 0;">
<view class="action text-orange margin-right line-height">
</view>
<view class="btn-group">
<button class="cu-btn bg-red shadow-blur lgplus sharp" @click="_submitInvoice()">提交订单</button>
</view>
</view>
</view>
</view>
</template>
<script>
import {
getOwnerId,
getOwnerName
} from '@/api/owner/ownerApi.js';
import {
getOwnerInvoice,
saveInvoiceApply
} from '@/api/invoice/invoiceApi.js';
import {
getCommunityId
} from '@/api/community/communityApi.js';
import {
getFeeDetail
} from '@/api/fee/feeDetailApi.js'
export default {
data() {
return {
detailId: '',
invoiceType: '',
invoiceName: '',
invoiceNum: '',
invoiceAddress: '',
ownerId: '',
oiId: '',
detailIds: [],
feeDetails: [],
}
},
onLoad(options) {
this.detailId = options.detailId;
let _ownerId = getOwnerId();
if (!_ownerId) {
uni.showToast({
icon: 'none',
title: '业主不存在',
})
return;
}
this.ownerId = _ownerId;
//todo
this._getOwnerInvoice();
this._loadFeeDetail();
},
methods: {
_getOwnerInvoice: function() {
let _that = this;
getOwnerInvoice({
page: 1,
row: 1,
communityId: getCommunityId(),
ownerId: this.ownerId,
}).then(_data => {
if (!_data || _data.length < 1) {
return;
}
_that.invoiceType = _data[0].invoiceType;
_that.invoiceName = _data[0].invoiceName;
_that.invoiceNum = _data[0].invoiceNum;
_that.invoiceAddress = _data[0].invoiceAddress;
_that.oiId = _data[0].oiId;
})
},
_loadFeeDetail: function() {
let _that = this;
getFeeDetail({
page: 1,
row: 15,
communityId: getCommunityId(),
ownerId: this.ownerId,
state: '1400'
}).then(_details => {
_details.forEach(function(_item) {
_item.selected = "1";
_that.detailIds.push(_item.detailId);
})
_that.feeDetails = _details;
})
},
checkboxChange: function(e) {
let _that = this;
this.detailIds = e.detail.value;
_that.feeDetails.forEach(function(_item) {
_item.selected = "0";
_that.detailIds.forEach(_detailId => {
if (_item.detailId == _detailId) {
_item.selected = "1";
}
});
})
},
_submitInvoice: function() {
let _that = this;
if(!_that.detailIds || _that.detailIds.length < 1){
uni.showToast({
icon:'none',
title:'未选择缴费记录'
});
return;
}
saveInvoiceApply({
invoiceAddress: _that.invoiceAddress,
invoiceFlag: _that.invoiceFlag,
invoiceName: _that.invoiceName,
invoiceNum: _that.invoiceNum,
invoiceType: _that.invoiceType,
ownerId: _that.ownerId,
ownerName: getOwnerName(),
oiId: _that.oiId,
detailIds: _that.detailIds,
communityId: getCommunityId(),
}).then(_data =>{
uni.showToast({
icon:'none',
title:_data.msg
})
if (_data.code == 0) {
uni.navigateTo({
url:'/pages/invoice/invoiceApply'
})
}
})
}
}
}
</script>
<style lang="scss">
.block__title {
margin: 0;
font-weight: 400;
font-size: 14px;
color: rgba(69, 90, 100, .6);
padding: 40rpx 30rpx 20rpx;
}
.button_up_blank {
height: 40rpx;
}
.cu-btn.lgplus {
padding: 0 20px;
font-size: 18px;
height: 100upx;
}
.cu-btn.sharp {
border-radius: 0upx;
}
</style>