Commit 6cfd2826 by LJM

发票管理

parent 43b76cce
......@@ -68,9 +68,9 @@
}
}
.p3 {
height: 66rpx;
font-size: 24rpx;
color: #919399;
margin-bottom: 16rpx;
}
.operate {
.edit {
......@@ -221,6 +221,11 @@
width: 155rpx;
font-size: 26rpx;
color: #484b59;
&.required::before {
content: '*';
font-size: 26rpx;
color: #1969f9;
}
}
.intl_code {
.uni-input {
......
......@@ -35,7 +35,7 @@
</view>
</template>
<view class="row verCenter">
<navigator class="edit row verCenter" url="/user/invoiceEdit" hover-class="none">
<navigator class="edit row verCenter" :url="'/user/invoiceEdit?tax_id=' + item.tax_id + '&inv_type=' + item.inv_type" hover-class="none">
<text class="iconfont icon-bjt"></text>
<text class="tt">编辑</text>
</navigator>
......
......@@ -100,12 +100,12 @@
</view>
</view>
</template>
<view class="setting-default row verCenter bothSide">
<view class="setting-default row verCenter bothSide" style="margin-bottom: 24rpx;">
<text class="tt">设为默认发票</text>
<view><switch @change="onSwitchChange" checked style="transform:scale(0.7)" /></view>
</view>
<!-- 收票信息 -->
<view class="info-title row bothSide verCenter" @click="toggle = !toggle">
<view class="info-title row bothSide verCenter" @click="toggle = !toggle" v-if="curr == 0">
<text class="info-title-t1">展开收票信息(非必填)</text>
<template v-if="toggle">
<text class="iconfont icon-arrtop"></text>
......@@ -116,11 +116,11 @@
</view>
<view class="form-box" v-if="toggle">
<view class="input-box input row verCenter">
<text class="tt">收货</text>
<input type="text" placeholder="请输入收人" class="uni-input" v-model="formParams.consignee" />
<text class="tt" :class="{ required: curr == 1 }">收票</text>
<input type="text" placeholder="请输入收人" class="uni-input" v-model="formParams.consignee" />
</view>
<view class="input-box input row verCenter">
<text class="tt">手机号码</text>
<text class="tt" :class="{ required: curr == 1 }">手机号码</text>
<picker @change="bindPickerChange" :value="index" :range="array" class="intl_code">
<view class="row verCenter bothSide">
<view class="uni-input">{{ array[index] }}</view>
......@@ -130,7 +130,7 @@
<input type="number" placeholder="请输入手机号" class="uni-input" style="margin-left: 24rpx;" v-model="formParams.consignee_phone" />
</view>
<view class="input-box input row verCenter">
<text class="tt">所在地区</text>
<text class="tt" :class="{ required: curr == 1 }">所在地区</text>
<picker mode="multiSelector" @change="pickerChange" @columnchange="bindMultiPickerColumnChange" :value="multiIndex" :range="multiArray" :range-key="'name'">
<view>{{ selectText }}</view>
</picker>
......@@ -138,7 +138,7 @@
<view class="input-box textarea row verCenter"><textarea placeholder="请输入详细街道地址" v-model="formParams.consignee_address"></textarea></view>
</view>
<view class="btn row verCenter">
<view class="btn1 row rowCenter verCenter"><text class="text">保存</text></view>
<view class="btn1 row rowCenter verCenter" @click="invoiceCreate()"><text class="text">保存</text></view>
</view>
</view>
</template>
......@@ -178,7 +178,7 @@ export default {
consignee_city: '', //寄送地址市
consignee_district: '', //寄送地址区
consignee_address: '', //详细地址
is_default: '' //设置默认
is_default: 1 //设置默认
}
};
},
......@@ -189,8 +189,20 @@ export default {
tab(index, type) {
if (type == 1) {
this.curr = index;
if (this.curr == 0) {
this.formParams.inv_type = 4;
} else if (this.curr == 1) {
this.formParams.inv_type = 3;
this.toggle = true;
}
} else if (type == 2) {
//增值税普通发票公司-个人切换
this.taxIndex = index;
if (this.taxIndex == 0) {
this.formParams.inv_type = 4;
} else if (this.taxIndex == 1) {
this.formParams.inv_type = 2;
}
}
},
/**
......@@ -206,6 +218,137 @@ export default {
this.formParams.intl_code = this.array[e.detail.value];
},
/**
* 新增发票
*/
invoiceCreate() {
if (this.curr == 0) {
if (this.taxIndex == 0) {
//增值税普通发票-公司
if (!this.formParams.tax_title) {
uni.showToast({
title: '请输入开票公司名称',
icon: 'none'
});
return false;
}
if (!this.formParams.tax_no) {
uni.showToast({
title: '请输入税务登记号',
icon: 'none'
});
return false;
}
var params = Object.assign({}, this.formParams, {
is_self: 1
});
} else if (this.taxIndex == 1) {
//增值税普通发票-个人
if (!this.formParams.tax_title) {
uni.showToast({
title: '请输入开票人名称',
icon: 'none'
});
return false;
}
var params = Object.assign({}, this.formParams, {
is_self: 1
});
}
} else {
//增值税专用发票
if (!this.formParams.tax_title) {
uni.showToast({
title: '请输入开票公司名称',
icon: 'none'
});
return false;
}
if (!this.formParams.company_address) {
uni.showToast({
title: '请输入注册地址',
icon: 'none'
});
return false;
}
if (!this.formParams.company_phone) {
uni.showToast({
title: '请输入电话号码',
icon: 'none'
});
return false;
}
if (!this.formParams.tax_no) {
uni.showToast({
title: '请输入纳税人识别号',
icon: 'none'
});
return false;
}
if (!this.formParams.bank_name) {
uni.showToast({
title: '请输入开户银行',
icon: 'none'
});
return false;
}
if (!this.formParams.bank_account) {
uni.showToast({
title: '请输入开户银行账号',
icon: 'none'
});
return false;
}
if (!this.formParams.consignee) {
uni.showToast({
title: '请输入收票人',
icon: 'none'
});
return false;
}
if (!this.formParams.consignee_phone) {
uni.showToast({
title: '请输入手机号',
icon: 'none'
});
return false;
}
if (!this.formParams.consignee_province) {
uni.showToast({
title: '请输入省、市、区',
icon: 'none'
});
return false;
}
if (!this.formParams.consignee_address) {
uni.showToast({
title: '请输入详细街道地址',
icon: 'none'
});
return false;
}
var params = Object.assign({}, this.formParams);
}
this.request(Api_Url + '/invoice/create', 'POST', params, true, true).then(res => {
if (res.err_code === 0) {
uni.showToast({
title: '新增发票成功',
icon: 'success'
});
setTimeout(() => {
uni.navigateBack({
delta: 1
});
}, 2000);
} else {
uni.showToast({
title: res.err_msg,
icon: 'none'
});
}
});
},
/**
* 省市区联动监听
* @param {Object} e
*/
......
......@@ -111,7 +111,7 @@ export default {
return result;
},
/**
* 地址监听
* 省市区联动监听
* @param {Object} e
*/
bindMultiPickerColumnChange(e) {
......@@ -138,7 +138,7 @@ export default {
this.$forceUpdate();
},
/**
* 省市区完成
* 省市区选择确定
* @param {Object} e
*/
pickerChange(e) {
......@@ -250,6 +250,7 @@ export default {
});
},
/**
* 获取市数据
* @param {Object} id
* @param {Object} defaultValue
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment