Commit b81f5aa6 by gyt

feat(客户管理): crm4需求变更

parent 877e3f28
......@@ -47,6 +47,42 @@
color: #666666;
}
}
.tax-title-wrap{
position: relative;
}
.company-list{
z-index: 999;
position: absolute;
top: 102rpx;
left: 125rpx;
width: calc(100% - 100rpx);
max-height: 400rpx;
height: fix-content;
overflow-y: auto;
background-color: #ffffff;
box-shadow: 0px 5px 5px 3px #e6e6e6;
padding: 30rpx 10rpx 10rpx;
.close{
position: absolute;
top: 5rpx;
right: 20rpx;
width: 40rpx;
height: 40rpx;
text-align: center;
line-height: 40rpx;
font-weight: 700;
border: 1px solid #929292;
color: #979797;
border-radius: 50%;
}
.company-list-item{
font-size: 28rpx;
line-height: 50rpx;
}
}
}
.tab-group{
padding:25rpx 20rpx;
......
......@@ -6,35 +6,54 @@
<view class="cons">
<view class="input-box">
<view class="input-group row verCenter">
<text class="label required">公司名称</text>
<input type="text" v-model="formParams.com_name" placeholder="请输入公司名称" placeholder-class="placeholder-class" @blur="tianyancha()" :disabled="id" />
</view>
<view class="input-group row verCenter">
<text class="label required ">公司税号</text>
<input type="text" v-model="formParams.tax_no" placeholder="系统自动查询后补充" placeholder-class="placeholder-class" :disabled="id" />
<text class="label required">客户类型</text>
<radio-group @change="radioChange" class="row">
<label class="row customer-type" v-for="(item, index) in items" :key="item.value">
<view>
<radio :value="item.value" :checked="item.value == formParams.customer_type" />
</view>
<view >{{item.label}}</view>
</label>
</radio-group>
</view>
<view class="input-group row verCenter">
<text class="label required">公司电话</text>
<input type="text" v-model="formParams.com_tel" placeholder="系统自动查询后补充" placeholder-class="placeholder-class" :disabled="id" />
<text class="label required">公司名称</text>
<input type="text" v-model="formParams.com_name" placeholder="请输入公司名称" placeholder-class="placeholder-class" @blur="tianyancha()" :disabled="id" />
</view>
<view class="input-group row verCenter">
<text class="label required">注册地址</text>
<input type="text" v-model="formParams.com_addr" placeholder="系统自动查询后补充" placeholder-class="placeholder-class" :disabled="id" />
<text class="label required ">公司性质</text>
<picker @change="bindPickerChange($event, 'company_nature')" :value="Number(formParams.company_nature)-1" :range="company_nature_list" :range-key="'name'">
<view class="areabox-but ">
<text class="but-val">{{showPickerName('company_nature','请选择公司性质')}}</text>
<text class="icon iconfont icon-arrowxia"></text>
</view>
</picker>
</view>
<view class="input-group row verCenter">
<text class="label required">联系人</text>
<input type="text" v-model="formParams.contact_person" placeholder="请输入联系人" placeholder-class="placeholder-class" />
<text class="label" >产品用途</text>
<picker mode="multiSelector" @change="pickerChange" @columnchange="bindMultiPickerColumnChange" :value="multiIndex" :range="multiArray" :range-key="'name'">
<view class="uni-input product-use" :class="{'color666':selectText=='请选择产品用途'}">{{ selectText }} <text class="icon iconfont icon-arrowxia"></text></view>
</picker>
</view>
<view class="input-group row verCenter">
<text class="label required">联系电话</text>
<input type="text" v-model="formParams.contact_phone" placeholder="请输入联系电话" placeholder-class="placeholder-class" />
<text class="label required ">所属行业</text>
<picker @change="bindPickerChange($event, 'com_industry')" :value="Number(formParams.com_industry)-1" :range="com_industry_list" :range-key="'name'">
<view class="areabox-but ">
<text class="but-val">{{showPickerName('com_industry','请选择所属行业')}}</text>
<text class="icon iconfont icon-arrowxia"></text>
</view>
</picker>
</view>
<view class="input-group row verCenter">
<text class="label required">邮箱</text>
<input type="text" v-model="formParams.email" placeholder="请输入邮箱" placeholder-class="placeholder-class" />
<text class="label required ">行业规模</text>
<picker @change="bindPickerChange($event, 'com_size')" :value="Number(formParams.com_size)-1" :range="com_size_list" :range-key="'name'">
<view class="areabox-but ">
<text class="but-val">{{showPickerName('com_size','请选择所属行业')}}</text>
<text class="icon iconfont icon-arrowxia"></text>
</view>
</picker>
</view>
</view>
</view>
<view class="foot">
<view class="btn" @click="submitI()">{{id?'编辑':'新增'}}企业资料</view>
......@@ -52,16 +71,138 @@
export default {
data() {
return {
items: [{
value: '1',
label: '国内客户',
checked: 'true'
},
{
value: '2',
label: '国外客户',
},
],
customer_type: 0,
company_nature_list: [
{
name: 'KA终端',
value: 1,
},
{
name: 'SMB终端',
value: 2,
},
{
name: '贸易商',
value: 3,
},
{
name: '科研院校',
value: 4,
},
{
name: '其他',
value: 5,
},
],
com_industry_list: [
{
name: '消费电子',
value: 1,
},
{
name: '医疗',
value: 2,
},
{
name: '工业控制',
value: 3,
},
{
name: '汽车电子',
value: 4,
},
{
name: '新能源',
value: 5,
},
{
name: '人工智能',
value: 6,
},
{
name: '电力',
value: 7,
},
{
name: '仪器仪表',
value: 8,
},
{
name: '轨道交通',
value: 9,
},
{
name: 'OEM代工',
value: 10,
},
{
name: '航空航天航海',
value: 11,
},
{
name: '勘探',
value: 13,
},
{
name: '通信',
value: 14,
},
],
com_size_list: [
{
name: '100人以下',
value: 1,
},
{
name: '100~300人',
value: 2,
},
{
name: '300~500人',
value: 3,
},
{
name: '500~1000人',
value: 4,
},
{
name: '1000~3000人',
value: 5,
},
{
name: '3000人以上',
value: 6,
},
],
multiArray: [
[],
[]
],
multiIndex: [0, 0],
selectText: '请选择产品用途',
id: "",
formParams: {
customer_type: 1,
com_name: "",
tax_no: "",
com_tel: "",
com_addr: "",
contact_person: "",
contact_phone: "",
email: ""
company_nature: "",
com_industry: "",
com_size: '',
product_use_classone_sn: '',
product_use_classtwo_sn: '',
},
areaIndex: 0,
certification: []
}
},
......@@ -69,22 +210,37 @@
this.id = options.id || ""
if (this.id) {
this.getData()
}else{
this.getProduceCate1Code();
}
},
onShow() {
},
methods: {
showPickerName(key, msg) {
return this.formParams[key]
?this[key+'_list'][Number(this.formParams[key])-1].name
:msg
},
getData() {
//获取用户信息
this.request(Api_Url + '/api/user/info', 'GET', {}, true).then(res => {
if (res.code == 0) {
let arr_ = res.data.certification || []
this.certification = arr_.filter(item => item.id == this.id)
this.certification = arr_.filter(item => item.customer_id == this.id)
let obj = this.certification[0]
this.formParams = {
...this.certification[0]
customer_type: obj.customer_type,
com_name: obj.customer_name,
company_nature: obj.com_nature,
com_industry: obj.com_industry,
com_size: obj.com_size,
product_use_classone_sn: obj.product_use_classone_sn,
product_use_classtwo_sn: obj.product_use_classtwo_sn,
// ...this.certification[0]
}
console.log(this.formParams)
this.getProduceCate1Code(this.formParams.product_use_classone_sn,this.formParams.product_use_classtwo_sn);
}
});
},
......@@ -103,8 +259,6 @@
}
this.formParams.com_name = res.data.com_name;
this.formParams.tax_no = res.data.tax_number;
this.formParams.com_tel = res.data.phone_number;
this.formParams.com_addr = res.data.com_address;
} else {
uni.showToast({
title: res.msg,
......@@ -115,14 +269,98 @@
},
changeTab(inv_type) {
this.formParams.inv_type = inv_type
console.log(this.formParams.inv_type)
},
onSwitchChange(e) {
this.formParams.is_default = e.detail.value ? 1 : 0;
},
submitI() {
bindPickerChange(e,key){
if(!e.detail.value)return
if(e.detail.value==-1)return
this.formParams[key] = this[key+'_list'][e.detail.value].value
},
bindMultiPickerColumnChange(e) {
console.log(e.detail);
if (e.detail.column === 0) {
// 第一列滑动
this.multiIndex[0] = e.detail.value;
this.getProduceCate2Code(this.multiArray[0][e.detail.value].value, true);
this.multiIndex.splice(1, 1, 0);
this.multiIndex.splice(2, 1, 0);
} else {
this.multiIndex[1] = e.detail.value;
}
this.$forceUpdate();
},
findIndex(arr, target) {
const result = [];
arr.map((item, index) => {
if (item.value == target) {
result.push(index);
}
});
return result;
},
getProduceCate1Code(product_use_classone_sn=1,product_use_classtwo_sn) {
this.request(Api_Url + '/api/data/getProduceCate1Code', 'GET', {
product_cate1_code: 1
}, false, true).then(res => {
if (res.code === 0) {
var arr = [];
for (var key in res.data) {
arr.push({
name: res.data[key],
value: parseInt(key)
});
}
if (product_use_classone_sn) {
let index = this.findIndex(arr, product_use_classone_sn);
this.multiIndex.splice(0, 1, index[0]);
}
this.multiArray[0] = arr;
this.getProduceCate2Code(product_use_classone_sn, product_use_classtwo_sn);
this.$forceUpdate();
}
});
},
getProduceCate2Code(product_use_classone_sn,product_use_classtwo_sn) {
this.request(Api_Url + '/api/data/getProduceCate2Code', 'GET', {
product_cate1_code: product_use_classone_sn == -1 ? 1 : product_use_classone_sn
}, false, true).then(res => {
if (res.code === 0) {
var arr = res.data.map(item=>{
return {
name: item.name,
value: item.id
}
});
this.multiArray[1] = arr;
if (product_use_classtwo_sn) {
let index = this.findIndex(arr, product_use_classtwo_sn);
this.multiIndex.splice(1, 1, index[0]);
if(product_use_classtwo_sn){
this.selectText =
`${this.multiArray[0][this.multiIndex[0]].name + ',' + this.multiArray[1][this.multiIndex[1]].name}`;
}
}
this.$forceUpdate();
}
});
},
/**
* 产品用途
* @param {Object} e
*/
pickerChange(e) {
this.multiIndex = e.detail.value;
this.formParams.product_use_classone_sn = this.multiArray[0][this.multiIndex[0]].value;
this.formParams.product_use_classtwo_sn = this.multiArray[1][this.multiIndex[1]].value;
this.selectText =
`${this.multiArray[0][this.multiIndex[0]].name + ',' + this.multiArray[1][this.multiIndex[1]].name}`;
},
submitI() {
if (!this.formParams.com_name) {
uni.showToast({
title: '公司名称不能为空',
......@@ -130,44 +368,30 @@
});
return;
}
if (!this.formParams.tax_no) {
if (!this.formParams.company_nature) {
uni.showToast({
title: '公司税号不能为空',
title: '请选择公司性质',
icon: 'none'
});
return;
}
if (!this.formParams.com_tel) {
if (!this.formParams.com_industry) {
uni.showToast({
title: '公司电话不能为空',
title: '请选择公司行业',
icon: 'none'
});
return;
}
if (!this.formParams.com_addr) {
if (!this.formParams.com_size) {
uni.showToast({
title: '注册地址不能为空',
title: '请选择公司规模',
icon: 'none'
});
return;
}
if (!this.formParams.contact_person) {
if (!this.formParams.product_use_classone_sn) {
uni.showToast({
title: '联系人不能为空',
icon: 'none'
});
return;
}
if (!this.formParams.contact_phone) {
uni.showToast({
title: '联系电话不能为空',
icon: 'none'
});
return;
}
if (!this.formParams.email) {
uni.showToast({
title: '邮箱不能为空',
title: '请选择产品用途',
icon: 'none'
});
return;
......@@ -175,8 +399,14 @@
let url = '/api/com/add'
if (this.id) {
this.formParams.id = this.id
this.formParams.customer_id = this.id
url = '/api/com/edit'
}
if(process.env.UNI_PLATFORM === 'mp-weixin'){
this.formParams.pf = 'xcx'
}else{
this.formParams.pf = 'h5'
}
this.request(Api_Url + url, 'POST', this.formParams, true).then(res => {
if (res.code == 0) {
uni.showToast({
......@@ -207,4 +437,16 @@
<style scoped lang="scss">
@import '../../assets/css/user/companyInfo.scss';
.icon-arrowxia{
margin-left: 20rpx;
}
.customer-type{
margin-right: 10rpx;
}
.product-use{
width: 384rpx !important;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
</style>
\ No newline at end of file
......@@ -18,19 +18,20 @@
<view><text>收票邮箱</text>{{item.email}}</view>
</view>
<view class="b row bothSide">
<view class="l row verCenter" @click="setdefault(item.tax_id)" v-if="!form">
<view class="l row verCenter"></view>
<!-- <view class="l row verCenter" @click="setdefault(item.tax_id)" v-if="!form">
<text class="icon iconfont icon-checked1"
:class="{'icon-checked':item.is_default==1}"></text>
<text>{{item.is_default==1?"已默认":"设为默认"}}</text>
</view>
<view v-else></view>
</view> -->
<!-- <view v-else></view> -->
<!-- <view class="l row verCenter" @click="setChoose(item.tax_id)" v-else>
<text class="icon iconfont icon-checked1"
:class="{'icon-checked':item.checkedx}"></text>
<text>{{item.checkedx?"已选择":"选择"}}</text>
</view> -->
<view class="r row verCenter">
<text @click.stop="deleteAdress(item.tax_id)">删除</text>
<!-- <text @click.stop="deleteAdress(item.tax_id)">删除</text> -->
<view @click.stop="goUpdate(item.tax_id)">修改</view>
</view>
</view>
......
......@@ -19,58 +19,36 @@
<text :class="{'act':formParams.inv_type==2}" @click="changeTab(2)">个人</text>
</view>
</view>
<view class="input-group row verCenter" v-if="formParams.inv_type!=2">
<view class="input-group row verCenter tax-title-wrap" v-if="formParams.inv_type!=2">
<text class="label required">公司名称</text>
<input type="text" v-model="formParams.tax_title" @blur="tianyancha()" placeholder="请输入公司名称" placeholder-class="placeholder-class" />
<input type="text" v-model="formParams.tax_title" @input="searchCompay" @blur="tianyancha()" placeholder="请输入公司名称"
placeholder-class="placeholder-class" />
<view v-show="showCompanyList" class="company-list">
<view class="close" @click="showCompanyList = false">X</view>
<view v-for="item in certification" class="company-list-item" @click="companyClick(item.customer_name)">{{item.customer_name}}</view>
</view>
</view>
<view class="input-group row verCenter" v-if="formParams.inv_type==2">
<text class="label required">开票人名称</text>
<input type="text" v-model="formParams.tax_title" placeholder="请输入开票人名称" placeholder-class="placeholder-class" />
<input type="text" v-model="formParams.tax_title" placeholder="请输入开票人名称"
placeholder-class="placeholder-class" />
</view>
<view class="input-group row verCenter" v-if="formParams.inv_type!=2">
<text class="label required ">公司税号</text>
<input type="text" v-model="formParams.tax_no" placeholder="系统自动查询后补充" placeholder-class="placeholder-class" />
</view>
<view class="input-group row verCenter" v-if="formParams.inv_type!=2">
<text class="label required">公司电话</text>
<input type="text" v-model="formParams.company_phone" placeholder="系统自动查询后补充" placeholder-class="placeholder-class" />
</view>
<view class="input-group row verCenter" v-if="formParams.inv_type==3">
<text class="label required">注册地址</text>
<input type="text" v-model="formParams.consignee_address" placeholder="系统自动查询后补充" placeholder-class="placeholder-class" />
</view>
<view class="input-group row verCenter" v-if="formParams.inv_type==3">
<text class="label required">开户银行</text>
<input type="text" v-model="formParams.bank_name" placeholder="请输入开户银行" placeholder-class="placeholder-class" />
</view>
<view class="input-group row verCenter" v-if="formParams.inv_type==3">
<text class="label required">开户银行账号</text>
<input type="text" v-model="formParams.bank_account" placeholder="请输入开户银行账号" placeholder-class="placeholder-class" />
</view>
<view class="input-group row verCenter">
<text class="label required">发票接收邮箱</text>
<input type="text" v-model="formParams.email" placeholder="请输入发票接收邮箱" placeholder-class="placeholder-class" />
</view>
<view class="input-group row verCenter">
<text class="label" :class="{'required':formParams.inv_type!=3}">收票人</text>
<input type="text" v-model="formParams.consignee" placeholder="请输入收票人" placeholder-class="placeholder-class" />
<input type="text" v-model="formParams.tax_no" placeholder="系统自动查询后补充"
placeholder-class="placeholder-class" />
</view>
<view class="input-group row verCenter">
<text class="label" :class="{'required':formParams.inv_type!=3}">收票人手机号</text>
<input type="number" v-model="formParams.consignee_phone" placeholder="请输入收票人手机号" placeholder-class="placeholder-class" />
<text class="label required">{{formParams.inv_type==3?'邮箱':'发票接收邮箱'}}</text>
<input type="text" v-model="formParams.email" placeholder="请输入邮箱" placeholder-class="placeholder-class" />
</view>
</view>
<view class="setting-default row verCenter bothSide">
<!-- <view class="setting-default row verCenter bothSide">
<view class="tt">默认发票信息</view>
<view>
<switch @change="onSwitchChange" checked color="#D0121B" style="transform:scale(0.8)" />
</view>
</view>
</view> -->
</view>
<view class="foot">
<view class="btn" @click="submitI()">确认</view>
......@@ -88,24 +66,19 @@
export default {
data() {
return {
showCompanyList: false,
certification: [],
formParams:{
tax_title: "",
consignee_address: "",
company_phone: "",
tax_no: "",
bank_name: "",
bank_account: "",
consignee: "",
consignee_phone: "",
email: "",
intl_code: "0086",
is_default:1,
inv_type:3 // 3 专票 2普票个人 否则普票 公司
inv_type:3, // 3 专票 2普票个人 否则普票 公司
}
}
},
onLoad: function() {
this.getUsreInfo()
},
onShow() {
......@@ -123,8 +96,6 @@
}
this.formParams.tax_title=res.data.com_name||this.formParams.tax_title
this.formParams.tax_no=res.data.tax_number||this.formParams.tax_no
this.formParams.company_phone=res.data.phone_number
this.formParams.consignee_address=res.data.com_address
} else {
uni.showToast({
title: res.msg,
......@@ -133,6 +104,13 @@
}
});
},
getUsreInfo(){
this.request(Api_Url + '/api/user/info', 'GET', {}, true).then(res => {
if (res.code == 0) {
this.certification = res.data.certification
}
});
},
changeTab(inv_type){
this.formParams.inv_type=inv_type
console.log(this.formParams.inv_type)
......@@ -140,6 +118,13 @@
onSwitchChange(e) {
this.formParams.is_default = e.detail.value ? 1 : 0;
},
searchCompay(e) {
this.showCompanyList = true
},
companyClick(e) {
this.formParams.tax_title = e
this.showCompanyList = false
},
submitI(){
if(!this.formParams.tax_title){
uni.showToast({
......@@ -148,112 +133,20 @@
});
return;
}
if(this.formParams.inv_type==3){
if(!this.formParams.tax_no){
uni.showToast({
title: '公司税号不能为空',
icon: 'none'
});
return;
}
if(!this.formParams.company_phone){
uni.showToast({
title: '公司电话不能为空',
icon: 'none'
});
return;
}
if(!this.formParams.consignee_address){
uni.showToast({
title: '注册地址不能为空',
icon: 'none'
});
return;
}
if(!this.formParams.bank_name){
uni.showToast({
title: '开户银行不能为空',
icon: 'none'
});
return;
}
if(!this.formParams.bank_account){
uni.showToast({
title: '银行账号不能为空',
icon: 'none'
});
return;
}
if(!this.formParams.email){
uni.showToast({
title: '发票接收邮箱不能为空',
icon: 'none'
});
return;
}
}else if(this.formParams.inv_type==2){
if(!this.formParams.email){
uni.showToast({
title: '发票接收邮箱不能为空',
icon: 'none'
});
return;
}
if(!this.formParams.consignee){
uni.showToast({
title: '收票人不能为空',
icon: 'none'
});
return;
}
if(!this.formParams.consignee_phone){
uni.showToast({
title: '收票人手机不能为空',
icon: 'none'
});
return;
}
}else{
if(!this.formParams.tax_no){
uni.showToast({
title: '公司税号不能为空',
icon: 'none'
});
return;
}
if(!this.formParams.company_phone){
uni.showToast({
title: '公司电话不能为空',
icon: 'none'
});
return;
}
if(!this.formParams.email){
uni.showToast({
title: '发票接收邮箱不能为空',
icon: 'none'
});
return;
}
if(!this.formParams.consignee){
uni.showToast({
title: '收票人不能为空',
icon: 'none'
});
return;
}
if(!this.formParams.consignee_phone){
uni.showToast({
title: '收票人手机不能为空',
icon: 'none'
});
return;
}
if(!this.formParams.email){
uni.showToast({
title: '邮箱不能为空',
icon: 'none'
});
return;
}
if (this.formParams.inv_type != 2 && !this.formParams.tax_no) {
uni.showToast({
title: '公司税号不能为空',
icon: 'none'
});
return;
}
this.request(Api_Url + '/api/invoice/add', 'POST', this.formParams, true).then(res => {
if (res.code === 0) {
uni.showToast({
......
......@@ -20,10 +20,14 @@
<text :class="{'act':formParams.inv_type==2}" @click="changeTab(2)">个人</text>
</view>
</view>
<view class="input-group row verCenter" v-if="formParams.inv_type!=2">
<view class="input-group row verCenter tax-title-wrap" v-if="formParams.inv_type!=2">
<text class="label required">公司名称</text>
<input type="text" v-model="formParams.tax_title" @blur="tianyancha()" placeholder="请输入公司名称"
<input type="text" v-model="formParams.tax_title" @input="searchCompay" @blur="tianyancha()" placeholder="请输入公司名称"
placeholder-class="placeholder-class" />
<view v-show="showCompanyList" class="company-list">
<view class="close" @click="showCompanyList = false">X</view>
<view v-for="item in certification" class="company-list-item" @click="companyClick(item.customer_name)">{{item.customer_name}}</view>
</view>
</view>
<view class="input-group row verCenter" v-if="formParams.inv_type==2">
<text class="label required">开票人名称</text>
......@@ -35,53 +39,19 @@
<input type="text" v-model="formParams.tax_no" placeholder="系统自动查询后补充"
placeholder-class="placeholder-class" />
</view>
<view class="input-group row verCenter" v-if="formParams.inv_type!=2">
<text class="label required">公司电话</text>
<input type="text" v-model="formParams.company_phone" placeholder="系统自动查询后补充"
placeholder-class="placeholder-class" />
</view>
<view class="input-group row verCenter" v-if="formParams.inv_type==3">
<text class="label required">注册地址</text>
<input type="text" v-model="formParams.consignee_address" placeholder="系统自动查询后补充"
placeholder-class="placeholder-class" />
</view>
<view class="input-group row verCenter" v-if="formParams.inv_type==3">
<text class="label required">开户银行</text>
<input type="text" v-model="formParams.bank_name" placeholder="请输入开户银行"
placeholder-class="placeholder-class" />
</view>
<view class="input-group row verCenter" v-if="formParams.inv_type==3">
<text class="label required">开户银行账号</text>
<input type="text" v-model="formParams.bank_account" placeholder="请输入开户银行账号"
placeholder-class="placeholder-class" />
</view>
<view class="input-group row verCenter">
<text class="label required">发票接收邮箱</text>
<input type="text" v-model="formParams.email" placeholder="请输入发票接收邮箱"
placeholder-class="placeholder-class" />
</view>
<view class="input-group row verCenter">
<text class="label" :class="{'required':formParams.inv_type!=3}">收票人</text>
<input type="text" v-model="formParams.consignee" placeholder="请输入收票人"
<text class="label required">{{formParams.inv_type==3?'邮箱':'发票接收邮箱'}}</text>
<input type="text" v-model="formParams.email" placeholder="请输入收邮箱"
placeholder-class="placeholder-class" />
</view>
<view class="input-group row verCenter">
<text class="label" :class="{'required':formParams.inv_type!=3}">收票人手机号</text>
<input type="number" v-model="formParams.consignee_phone" placeholder="请输入收票人手机号"
placeholder-class="placeholder-class" />
</view>
</view>
<view class="setting-default row verCenter bothSide">
<!-- <view class="setting-default row verCenter bothSide">
<view class="tt">默认发票信息</view>
<view>
<switch @change="onSwitchChange" :checked="formParams.is_default==1" color="#D0121B" style="transform:scale(0.8)" />
</view>
</view>
</view> -->
</view>
<view class="foot">
<view class="btn" @click="submitI()">确认</view>
......@@ -99,18 +69,13 @@
export default {
data() {
return {
showCompanyList: false,
certification: [],
formParams: {
tax_id: "",
tax_title: "",
consignee_address: "",
company_phone: "",
tax_no: "",
bank_name: "",
bank_account: "",
consignee: "",
consignee_phone: "",
email: "",
intl_code: "0086",
is_default: 1,
inv_type: 3 // 3 专票 2普票个人 否则普票 公司
}
......@@ -119,6 +84,7 @@
onLoad: function(options) {
this.formParams.tax_id = options.tax_id || ''
this.getData()
this.getUsreInfo()
},
onShow() {
......@@ -166,6 +132,13 @@
}
});
},
getUsreInfo(){
this.request(Api_Url + '/api/user/info', 'GET', {}, true).then(res => {
if (res.code == 0) {
this.certification = res.data.certification
}
});
},
changeTab(inv_type) {
this.formParams.inv_type = inv_type
console.log(this.formParams.inv_type)
......@@ -173,6 +146,13 @@
onSwitchChange(e) {
this.formParams.is_default = e.detail.value ? 1 : 0;
},
searchCompay(e) {
this.showCompanyList = true
},
companyClick(e) {
this.formParams.tax_title = e
this.showCompanyList = false
},
submitI() {
if (!this.formParams.tax_title) {
uni.showToast({
......@@ -181,112 +161,21 @@
});
return;
}
if (this.formParams.inv_type == 3) {
if (!this.formParams.tax_no) {
uni.showToast({
title: '公司税号不能为空',
icon: 'none'
});
return;
}
if (!this.formParams.company_phone) {
uni.showToast({
title: '公司电话不能为空',
icon: 'none'
});
return;
}
if (!this.formParams.consignee_address) {
uni.showToast({
title: '注册地址不能为空',
icon: 'none'
});
return;
}
if (!this.formParams.bank_name) {
uni.showToast({
title: '开户银行不能为空',
icon: 'none'
});
return;
}
if (!this.formParams.bank_account) {
uni.showToast({
title: '银行账号不能为空',
icon: 'none'
});
return;
}
if (!this.formParams.email) {
uni.showToast({
title: '发票接收邮箱不能为空',
icon: 'none'
});
return;
}
} else if (this.formParams.inv_type == 2) {
if (!this.formParams.email) {
uni.showToast({
title: '发票接收邮箱不能为空',
icon: 'none'
});
return;
}
if (!this.formParams.consignee) {
uni.showToast({
title: '收票人不能为空',
icon: 'none'
});
return;
}
if (!this.formParams.consignee_phone) {
uni.showToast({
title: '收票人手机不能为空',
icon: 'none'
});
return;
}
} else {
if (!this.formParams.tax_no) {
uni.showToast({
title: '公司税号不能为空',
icon: 'none'
});
return;
}
if (!this.formParams.company_phone) {
uni.showToast({
title: '公司电话不能为空',
icon: 'none'
});
return;
}
if (!this.formParams.email) {
uni.showToast({
title: '发票接收邮箱不能为空',
icon: 'none'
});
return;
}
if (!this.formParams.consignee) {
uni.showToast({
title: '收票人不能为空',
icon: 'none'
});
return;
}
if (!this.formParams.consignee_phone) {
uni.showToast({
title: '收票人手机不能为空',
icon: 'none'
});
return;
}
if (!this.formParams.email) {
uni.showToast({
title: '发票接收邮箱不能为空',
icon: 'none'
});
return;
}
if (this.formParams.inv_type != 2&&!this.formParams.tax_no) {
uni.showToast({
title: '公司税号不能为空',
icon: 'none'
});
return;
}
this.request(Api_Url + '/api/invoice/update', 'POST', this.formParams, true).then(res => {
if (res.code === 0) {
uni.showToast({
......
......@@ -147,10 +147,12 @@
this.userinfo = res.data.userinfo
uni.setStorageSync('user_info', JSON.stringify(this.userinfo));
this.certification.forEach(item => {
if (item.com_name == this.userinfo.company_name) {
if (item.customer_name == this.userinfo.company_name) {
this.companyId = item.id
}
})
this.companyId = this.companyId || this.certification[0].customer_id
this.userinfo.company_name = this.userinfo.company_name || this.certification[0].customer_name
} else {
uni.showToast({
title: res.msg,
......
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