发票助手添加删除功能

version/0412
mujinxia 9 months ago
parent d037de83ea
commit 07545d28af
  1. 7
      api/invoice.js
  2. 104
      pages/invoice/indexset.vue
  3. 2
      pages/news1/feedback.vue

@ -9,9 +9,12 @@ const api = {
invoicingDel: 'user/invoicingDel',
invoicingDetail: 'user/invoicingDetail',
invoicingAdd: 'user/invoicingAdd',
invoicingEdit: 'user/invoicingEdit'
invoicingEdit: 'user/invoicingEdit',
invoicingDelNew: 'user/delInvoicing'
}
export const invoicingDelNew = (data) => {
return request.get(api.invoicingDelNew,data)
}
export const invoicingEdit = (orderGoodsId, data) => {
return request.post(api.invoicingEdit, {
orderGoodsId,

@ -15,31 +15,37 @@
<view class="bill-record" v-else>
<view class="bill-item" v-for="(item, index) in recordList" :key="index">
<view class="bill-item-left">
<view class="commpany-name">{{item.header}}</view>
<view class="commpany-name">{{ item.header }}</view>
<view class="bill-price">
<text>¥</text>{{item.price}}
<text>¥</text>{{ item.price }}
</view>
</view>
<text class="bill-time">{{item.created_at}}</text>
<text class="bill-time">{{ item.created_at }}</text>
</view>
</view>
</view>
<!-- 发票抬头 -->
<view v-if="tabIndex == 1">
<view class="invoice-header">
<view class="bill-header-item" @click="onAddInvoice(item)" v-for="(item, index) in recordHeaderList" :key="index">
<view class="bill-header-left">
<view class="header-type"> 普通增值税发票-{{item.source == 1?'个人':'单位'}}</view>
<view class="bill-header">
{{item.header}}
</view>
<view class="bill-header" style="margin-top:18rpx" v-if="item.source==2">
税号{{item.duty_no}}
<view class="empty" v-if="recordHeaderList.length == 0">
<u-empty text="暂无信息" mode="list"></u-empty>
</view>
<view v-else class="invoice-header">
<u-swipe-action :show="item.show" :options="options" @click="onActionClick(index)"
v-for="(item, index) in recordHeaderList" :key="index" @open="onActionOpen(index)">
<view class="bill-header-item" @click="onAddInvoice(item)">
<view class="bill-header-left">
<view class="header-type"> 普通增值税发票-{{ item.source == 1 ? '个人' : '单位' }}</view>
<view class="bill-header">
{{ item.header }}
</view>
<view class="bill-header" style="margin-top:18rpx" v-if="item.source == 2">
税号{{ item.duty_no }}
</view>
</view>
<u-icon name="edit-pen" size="30" color="#838383"></u-icon>
</view>
<u-icon name="edit-pen" size="30" color="#838383"></u-icon>
</view>
</u-swipe-action>
</view>
<view class="invoice-btn-box">
<view class="invoice-btn" @click="onAddInvoice(null)">
@ -50,7 +56,6 @@
</view>
</template>
<script>
@ -59,9 +64,17 @@ import * as InvoiceApi from '@/api/invoice'
export default {
data() {
return {
tabIndex: 0,
tabIndex: 0,
recordList: [],
recordHeaderList:[]
recordHeaderList: [],
options: [
{
text: '删除',
style: {
backgroundColor: '#dd524d'
}
}
]
};
},
onLoad() {
@ -69,12 +82,12 @@ export default {
},
methods: {
onTabClick(index) {
this.tabIndex = index
if(index == 1){
this.tabIndex = index
if (index == 1) {
this.recordHeaderList = []
this.getHeaderList()
}else{
this.recordList = []
} else {
this.recordList = []
this.getRecordList()
}
},
@ -82,30 +95,55 @@ export default {
async getRecordList() {
uni.showLoading({
title: "加载中"
})
})
let {
status,
status,
data
} = await InvoiceApi.invoicingLog({});
if (status == 200) {
uni.hideLoading();
this.recordList = data.list
uni.hideLoading();
this.recordList = data.list
}
},
//
async getHeaderList() {
uni.showLoading({
title: "加载中"
})
})
let {
status,
status,
data
} = await InvoiceApi.myInvoicing({});
if (status == 200) {
uni.hideLoading();
this.recordHeaderList = data.list
uni.hideLoading();
this.recordHeaderList = data.list
this.recordHeaderList.map(item => {
item.show = false
})
}
},
},
//
async onActionClick(index) {
let that = this
let {
status,
data
} = await InvoiceApi.invoicingDelNew({ id: that.recordHeaderList[index].id});
if (status == 200) {
that.getHeaderList()
uni.showToast({
title: '删除成功!',
icon: 'none',
duration: 2000
})
}
},
onActionOpen(index) {
this.recordHeaderList[index].show = true;
this.recordHeaderList.map((val, idx) => {
if (index != idx) this.recordHeaderList[idx].show = false;
})
},
onAddInvoice(item) {
uni.navigateTo({
url: "/pages/invoice/editset?detailObj=" + JSON.stringify(item)
@ -115,9 +153,10 @@ export default {
}
</script>
<style lang="scss" scoped>
page{
page {
background: red;
}
.invoice-btn-box {
width: 100%;
position: fixed;
@ -148,11 +187,12 @@ page{
.invoice-header {
background: #fff;
padding-bottom: 164rpx;
.bill-header-item {
display: flex;
justify-content: space-between;
align-items: flex-end;
padding: 54rpx 46rpx 64rpx 64rpx;
padding: 40rpx 46rpx 40rpx 64rpx;
font-size: 32rpx;
}

@ -522,7 +522,7 @@ page {
z-index: 88;
bottom: 0;
padding: 30rpx 32rpx;
background: #fff;
background: #fafafa;
}
.submitBtn {

Loading…
Cancel
Save