|
@@ -1,113 +1,120 @@
|
|
|
<template>
|
|
|
- <scroll-view class="scroll-Y" scroll-y>
|
|
|
- <div class="part top">
|
|
|
- <div class="invoice-header">
|
|
|
- <div class="part-item header-type lines">
|
|
|
- <span class="part-item-key">抬头类型</span>
|
|
|
- <van-radio-group v-model="condition.invoiceTitleType" direction="horizontal" class="part-item-value" @change="radioChange">
|
|
|
- <van-radio
|
|
|
- v-for="item in items"
|
|
|
- :key="item.name+item.value"
|
|
|
- checked-color="#064C8A"
|
|
|
- :name="item.value"
|
|
|
+ <div>
|
|
|
+ <scroll-view class="scroll-Y" scroll-y>
|
|
|
+ <div class="part top">
|
|
|
+ <div class="invoice-header">
|
|
|
+ <div class="part-item header-type lines">
|
|
|
+ <span class="part-item-key">抬头类型</span>
|
|
|
+ <van-radio-group
|
|
|
+ v-model="condition.invoiceTitleType"
|
|
|
+ direction="horizontal"
|
|
|
+ class="part-item-value"
|
|
|
+ @change="radioChange"
|
|
|
>
|
|
|
- {{ item.name }}
|
|
|
- </van-radio>
|
|
|
- </van-radio-group>
|
|
|
- </div>
|
|
|
- <div class="part-item lines">
|
|
|
- <span class="part-item-key">抬头名称</span>
|
|
|
- <div class="part-item-value">
|
|
|
- <!-- <input
|
|
|
+ <van-radio
|
|
|
+ v-for="item in items"
|
|
|
+ :key="item.name + item.value"
|
|
|
+ checked-color="#064C8A"
|
|
|
+ :name="item.value"
|
|
|
+ >
|
|
|
+ {{ item.name }}
|
|
|
+ </van-radio>
|
|
|
+ </van-radio-group>
|
|
|
+ </div>
|
|
|
+ <div class="part-item lines">
|
|
|
+ <span class="part-item-key">抬头名称</span>
|
|
|
+ <div class="part-item-value">
|
|
|
+ <!-- <input
|
|
|
type="text"
|
|
|
placeholder="请输入抬头名称"
|
|
|
v-model="condition.invoiceTitleName"
|
|
|
/> -->
|
|
|
- <van-field
|
|
|
- v-model="condition.invoiceTitleName"
|
|
|
- right-icon="arrow"
|
|
|
- input-align="right"
|
|
|
- placeholder="请输入抬头名称"
|
|
|
- />
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="part-item lines" v-if="isCompany">
|
|
|
- <span class="part-item-key">公司税号</span>
|
|
|
- <div class="part-item-value">
|
|
|
- <!-- <input
|
|
|
- type="text"
|
|
|
- placeholder="请输入公司税号"
|
|
|
- v-model="condition.corporationTax"
|
|
|
- /> -->
|
|
|
- <van-field
|
|
|
- v-model="condition.corporationTax"
|
|
|
- right-icon="arrow"
|
|
|
- input-align="right"
|
|
|
- placeholder="请输入公司税号"
|
|
|
- />
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="part-item lines">
|
|
|
- <span class="part-item-key">设为默认</span>
|
|
|
- <div class="part-item-value">
|
|
|
- <van-switch
|
|
|
- active-color="#064C8A"
|
|
|
- v-model="isDefault"
|
|
|
- @change="switch1Change"
|
|
|
- />
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="invoice-more" v-if="isCompany">
|
|
|
- <div class="tab-title">更多信息(以下为选填内容)</div>
|
|
|
- <div class="company-box">
|
|
|
- <div class="part-item lines">
|
|
|
- <span class="part-item-key">公司地址</span>
|
|
|
- <div class="part-item-value">
|
|
|
<van-field
|
|
|
- v-model="condition.companyAddress"
|
|
|
+ v-model="condition.invoiceTitleName"
|
|
|
right-icon="arrow"
|
|
|
input-align="right"
|
|
|
- placeholder="请输入公司地址"
|
|
|
+ placeholder="请输入抬头名称"
|
|
|
/>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="part-item lines">
|
|
|
- <span class="part-item-key">公司电话</span>
|
|
|
+ <div class="part-item lines" v-if="isCompany">
|
|
|
+ <span class="part-item-key">公司税号</span>
|
|
|
<div class="part-item-value">
|
|
|
+ <!-- <input
|
|
|
+ type="text"
|
|
|
+ placeholder="请输入公司税号"
|
|
|
+ v-model="condition.corporationTax"
|
|
|
+ /> -->
|
|
|
<van-field
|
|
|
- v-model="condition.companyTel"
|
|
|
+ v-model="condition.corporationTax"
|
|
|
right-icon="arrow"
|
|
|
input-align="right"
|
|
|
- placeholder="请输入公司电话"
|
|
|
+ placeholder="请输入公司税号"
|
|
|
/>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="part-item lines">
|
|
|
- <span class="part-item-key">开户银行</span>
|
|
|
+ <span class="part-item-key">设为默认</span>
|
|
|
<div class="part-item-value">
|
|
|
- <van-field
|
|
|
- v-model="condition.depositBank"
|
|
|
- right-icon="arrow"
|
|
|
- input-align="right"
|
|
|
- placeholder="请输入开户银行"
|
|
|
+ <van-switch
|
|
|
+ active-color="#064C8A"
|
|
|
+ v-model="isDefault"
|
|
|
+ @change="switch1Change"
|
|
|
/>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="part-item lines" style="border: none">
|
|
|
- <span class="part-item-key">开户账户</span>
|
|
|
- <div class="part-item-value">
|
|
|
- <van-field
|
|
|
- v-model="condition.accountNumber"
|
|
|
- right-icon="arrow"
|
|
|
- input-align="right"
|
|
|
- placeholder="请输入开户账户"
|
|
|
- />
|
|
|
+ </div>
|
|
|
+ <div class="invoice-more" v-if="isCompany">
|
|
|
+ <div class="tab-title">更多信息(以下为选填内容)</div>
|
|
|
+ <div class="company-box">
|
|
|
+ <div class="part-item lines">
|
|
|
+ <span class="part-item-key">公司地址</span>
|
|
|
+ <div class="part-item-value">
|
|
|
+ <van-field
|
|
|
+ v-model="condition.companyAddress"
|
|
|
+ right-icon="arrow"
|
|
|
+ input-align="right"
|
|
|
+ placeholder="请输入公司地址"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="part-item lines">
|
|
|
+ <span class="part-item-key">公司电话</span>
|
|
|
+ <div class="part-item-value">
|
|
|
+ <van-field
|
|
|
+ v-model="condition.companyTel"
|
|
|
+ right-icon="arrow"
|
|
|
+ input-align="right"
|
|
|
+ placeholder="请输入公司电话"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="part-item lines">
|
|
|
+ <span class="part-item-key">开户银行</span>
|
|
|
+ <div class="part-item-value">
|
|
|
+ <van-field
|
|
|
+ v-model="condition.depositBank"
|
|
|
+ right-icon="arrow"
|
|
|
+ input-align="right"
|
|
|
+ placeholder="请输入开户银行"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="part-item lines" style="border: none">
|
|
|
+ <span class="part-item-key">开户账户</span>
|
|
|
+ <div class="part-item-value">
|
|
|
+ <van-field
|
|
|
+ v-model="condition.accountNumber"
|
|
|
+ right-icon="arrow"
|
|
|
+ input-align="right"
|
|
|
+ placeholder="请输入开户账户"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
+ </scroll-view>
|
|
|
<div class="part footer">
|
|
|
<div
|
|
|
:class="{
|
|
@@ -116,18 +123,19 @@
|
|
|
'green-push-again-btn': custTypeId === 2,
|
|
|
}"
|
|
|
@click="submit"
|
|
|
- >保存
|
|
|
+ >
|
|
|
+ 保存
|
|
|
</div>
|
|
|
</div>
|
|
|
- </scroll-view>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
// const app = getApp()
|
|
|
-const app = {}
|
|
|
-import { mapState } from 'vuex'
|
|
|
-import MemberCacheTool from '@/utils/member-cache-tool.js'
|
|
|
-import uni from '@/utils/uniHooks'
|
|
|
+const app = {};
|
|
|
+import { mapState } from 'vuex';
|
|
|
+import MemberCacheTool from '@/utils/member-cache-tool.js';
|
|
|
+import uni from '@/utils/uniHooks';
|
|
|
|
|
|
export default {
|
|
|
data() {
|
|
@@ -137,8 +145,8 @@ export default {
|
|
|
id: '',
|
|
|
globalData: app.globalData,
|
|
|
items: [
|
|
|
- {value: 0,name: '单位'},
|
|
|
- {value: 1,name: '个人/非企业单位'},
|
|
|
+ { value: 0, name: '单位' },
|
|
|
+ { value: 1, name: '个人/非企业单位' },
|
|
|
],
|
|
|
isDefault: true, // 记录
|
|
|
condition: {
|
|
@@ -154,114 +162,117 @@ export default {
|
|
|
createUser: '', // |String|是|创建人
|
|
|
creator: '', // |Long|是|创建者id
|
|
|
updateUser: this.member?.nickname, // |String|是|更新人
|
|
|
- updater: this.member?.id, // |Long|是|更新人id
|
|
|
- mobile: this.member?.mobile, // |String|是|手机号
|
|
|
- vipcode: this.member?.vipcode, // |String|是|会员号
|
|
|
+ // updater: this.member?.id, // |Long|是|更新人id
|
|
|
+ // mobile: this.member?.mobile, // |String|是|手机号
|
|
|
+ // vipcode: this.member?.vipcode, // |String|是|会员号
|
|
|
// openid: MemberCacheTool.getOpenId(app), // |String|是|openid
|
|
|
},
|
|
|
preUrl: '',
|
|
|
- }
|
|
|
+ };
|
|
|
},
|
|
|
computed: {
|
|
|
isCompany: function () {
|
|
|
- return this.condition.invoiceTitleType == 0
|
|
|
+ return this.condition.invoiceTitleType == 0;
|
|
|
},
|
|
|
...mapState({
|
|
|
- custTypeId: ( state ) => state.custTypeId,
|
|
|
- member: ( state ) => state.member,
|
|
|
- openid: ( state ) => state.openid,// |String|是|openid
|
|
|
+ custTypeId: (state) => state.custTypeId,
|
|
|
+ member: (state) => state.member,
|
|
|
+ openid: (state) => state.openid, // |String|是|openid
|
|
|
}),
|
|
|
},
|
|
|
created() {
|
|
|
const options = this.$route.query;
|
|
|
- console.log(this.globalData)
|
|
|
- if ( options.type ) this.type = options.type
|
|
|
- if ( options.id ) ( this.id = options.id ), this.getInvoiceTitleById()
|
|
|
+ console.log(this.globalData);
|
|
|
+ if (options.type) this.type = options.type;
|
|
|
+ if (options.id) (this.id = options.id), this.getInvoiceTitleById();
|
|
|
// 埋点本地化
|
|
|
- this.preUrl = uni.getStorageSync('previousUrl')
|
|
|
+ this.preUrl = uni.getStorageSync('previousUrl');
|
|
|
uni.setStorageSync(
|
|
|
'previousUrl',
|
|
|
'/pages/parkingFee/parkingReceipt/parkingChangeHeader.vue'
|
|
|
- )
|
|
|
+ );
|
|
|
},
|
|
|
mounted() {
|
|
|
setTimeout(() => {
|
|
|
uni.setNavigationBarTitle({
|
|
|
- title: "发票抬头"
|
|
|
- })
|
|
|
- }, 300)
|
|
|
+ title: '发票抬头',
|
|
|
+ });
|
|
|
+ }, 300);
|
|
|
},
|
|
|
methods: {
|
|
|
- radioChange: function ( e ) {
|
|
|
- for ( let i = 0; i < this.items.length; i++ ) {
|
|
|
- if ( this.items[i].value === e.detail.value ) {
|
|
|
- this.condition.invoiceTitleType = i
|
|
|
- break
|
|
|
+ radioChange: function (e) {
|
|
|
+ for (let i = 0; i < this.items.length; i++) {
|
|
|
+ if (this.items[i].value === e.detail.value) {
|
|
|
+ this.condition.invoiceTitleType = i;
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- switch1Change: function ( e ) {
|
|
|
- console.log('switch1 发生 change 事件,携带值为',e.target.value)
|
|
|
- this.isDefault = e.target.value
|
|
|
+ switch1Change: function (e) {
|
|
|
+ console.log('switch1 发生 change 事件,携带值为', e.target.value);
|
|
|
+ this.isDefault = e.target.value;
|
|
|
},
|
|
|
// 根据抬头ID获取抬头详情信息 api/1.0/invoiceTitle/{id}
|
|
|
getInvoiceTitleById() {
|
|
|
- const self = this
|
|
|
+ const self = this;
|
|
|
const params = {
|
|
|
id: this.id,
|
|
|
- }
|
|
|
- self.$md(params)
|
|
|
+ };
|
|
|
+ self.$md(params);
|
|
|
uni.request({
|
|
|
url: self.$baseURL + 'api/1.0/invoiceTitle/' + this.id,
|
|
|
method: 'GET',
|
|
|
data: params,
|
|
|
header: JSON.parse(uni.getStorageSync('handleUser')),
|
|
|
- success: ( res ) => {
|
|
|
- console.log('获取抬头详情信息',res.data)
|
|
|
- if ( res.data.code === 0 ) {
|
|
|
- self.condition = res.data.data
|
|
|
+ success: (res) => {
|
|
|
+ console.log('获取抬头详情信息', res.data);
|
|
|
+ if (res.data.code === 0) {
|
|
|
+ self.condition = res.data.data;
|
|
|
// 单独对默认选项进行赋值
|
|
|
- self.isDefault = res.data.data.setDefault === 1 ? true : false
|
|
|
+ self.isDefault = res.data.data.setDefault === 1 ? true : false;
|
|
|
} else {
|
|
|
uni.showToast({
|
|
|
title: res.data.msg,
|
|
|
duration: 2000,
|
|
|
icon: 'none',
|
|
|
- })
|
|
|
+ });
|
|
|
}
|
|
|
},
|
|
|
fail: () => {
|
|
|
uni.showToast({
|
|
|
title: '服务器开小差了呢,请您稍后再试',
|
|
|
icon: 'none',
|
|
|
- })
|
|
|
+ });
|
|
|
},
|
|
|
- })
|
|
|
+ });
|
|
|
},
|
|
|
// 添加、编辑抬头信息
|
|
|
submit() {
|
|
|
- const self = this
|
|
|
+ const self = this;
|
|
|
const url =
|
|
|
- self.type === 'add' ? 'api/1.0/invoiceTitle' : 'api/1.0/invoiceTitle'
|
|
|
- const methodType = self.type === 'add' ? 'POST' : 'PUT'
|
|
|
- if ( self.type === 'add' ) {
|
|
|
- self.condition.createUser = self.globalData.wxMember.nickname
|
|
|
- self.condition.creator = self.globalData.wxMember.id
|
|
|
+ self.type === 'add' ? 'api/1.0/invoiceTitle' : 'api/1.0/invoiceTitle';
|
|
|
+ const methodType = self.type === 'add' ? 'POST' : 'PUT';
|
|
|
+ if (self.type === 'add') {
|
|
|
+ self.condition.createUser = self.$store.state.userInfo.nickname;
|
|
|
+ self.condition.creator = self.$store.state.userInfo.id;
|
|
|
}
|
|
|
- self.condition.setDefault = self.isDefault ? 1 : 0
|
|
|
+ self.condition.setDefault = self.isDefault ? 1 : 0;
|
|
|
const params = {
|
|
|
...self.condition,
|
|
|
- }
|
|
|
- console.log('提交信息',params)
|
|
|
- self.$md(params)
|
|
|
+ updater: this.member?.id, // |Long|是|更新人id
|
|
|
+ mobile: this.member?.mobile, // |String|是|手机号
|
|
|
+ vipcode: this.member?.vipcode, // |String|是|会员号
|
|
|
+ };
|
|
|
+ console.log('提交信息', params);
|
|
|
+ self.$md(params);
|
|
|
uni.request({
|
|
|
url: self.$baseURL + url,
|
|
|
method: methodType,
|
|
|
data: params,
|
|
|
header: JSON.parse(uni.getStorageSync('handleUser')),
|
|
|
- success: ( res ) => {
|
|
|
- console.log(res.data)
|
|
|
- if ( res.data.code === 0 ) {
|
|
|
+ success: (res) => {
|
|
|
+ console.log(271, res.data);
|
|
|
+ if (res.data.code === 0) {
|
|
|
// 保存结果埋点
|
|
|
// self.sensorsClick('$ClickSubmitHeader',{
|
|
|
// redirect_url: '',
|
|
@@ -274,27 +285,27 @@ export default {
|
|
|
// ? 'SetAsDefaultClose'
|
|
|
// : 'SetAsDefaultOpen',
|
|
|
// })
|
|
|
- this.$router.back()
|
|
|
+ this.$router.back();
|
|
|
// uni.navigateBack({delta: 1})
|
|
|
} else {
|
|
|
uni.showToast({
|
|
|
title: res.data.msg,
|
|
|
duration: 2000,
|
|
|
icon: 'none',
|
|
|
- })
|
|
|
+ });
|
|
|
}
|
|
|
},
|
|
|
fail: () => {
|
|
|
uni.showToast({
|
|
|
title: '服务器开小差了呢,请您稍后再试',
|
|
|
icon: 'none',
|
|
|
- })
|
|
|
+ });
|
|
|
},
|
|
|
- })
|
|
|
+ });
|
|
|
},
|
|
|
// 埋点方法
|
|
|
- sensorsClick( eventName,params ) {
|
|
|
- let optionsQuery = uni.getStorageSync('options_query')
|
|
|
+ sensorsClick(eventName, params) {
|
|
|
+ let optionsQuery = uni.getStorageSync('options_query');
|
|
|
let fixedParams = {
|
|
|
cta_itemno: '',
|
|
|
cta_name: '',
|
|
@@ -309,11 +320,11 @@ export default {
|
|
|
$utm_function: optionsQuery.utm_function || '',
|
|
|
$utm_user: optionsQuery.utm_user || '',
|
|
|
},
|
|
|
- finalParams = Object.assign(fixedParams,params)
|
|
|
- this.$sensors.track(eventName,finalParams)
|
|
|
+ finalParams = Object.assign(fixedParams, params);
|
|
|
+ this.$sensors.track(eventName, finalParams);
|
|
|
},
|
|
|
},
|
|
|
-}
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style lang="less" scoped>
|
|
@@ -324,7 +335,7 @@ export default {
|
|
|
flex-direction: column;
|
|
|
height: 100vh;
|
|
|
// background: #f2f2f2;
|
|
|
- background: #F4F7FF;
|
|
|
+ background: #f4f7ff;
|
|
|
//padding: 30px 30px 30px 30px;
|
|
|
|
|
|
.part {
|
|
@@ -374,9 +385,9 @@ export default {
|
|
|
}
|
|
|
|
|
|
.company-box {
|
|
|
- background: #FAFBFF;
|
|
|
+ background: #fafbff;
|
|
|
border-radius: 4px;
|
|
|
- border: 1px solid #D8DAE0;
|
|
|
+ border: 1px solid #d8dae0;
|
|
|
}
|
|
|
|
|
|
.lines {
|
|
@@ -388,16 +399,15 @@ export default {
|
|
|
}
|
|
|
|
|
|
.invoice-header {
|
|
|
- background: #FAFBFF;
|
|
|
+ background: #fafbff;
|
|
|
border-radius: 4px;
|
|
|
- border: 1px solid #D8DAE0;
|
|
|
+ border: 1px solid #d8dae0;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
.top {
|
|
|
- margin-top: 30px;
|
|
|
+ margin-top: 30px;
|
|
|
margin-left: 30px;
|
|
|
-
|
|
|
}
|
|
|
|
|
|
.middle {
|
|
@@ -408,13 +418,15 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- .footer {
|
|
|
+
|
|
|
+}
|
|
|
+.footer {
|
|
|
width: 100%;
|
|
|
height: 150px;
|
|
|
position: fixed;
|
|
|
bottom: 0px;
|
|
|
- padding-bottom: constant(safe-area-inset-bottom);
|
|
|
- padding-bottom: env(safe-area-inset-bottom);
|
|
|
+ padding-bottom: constant(safe-area-inset-bottom);
|
|
|
+ padding-bottom: env(safe-area-inset-bottom);
|
|
|
//padding-bottom: 20px;
|
|
|
box-shadow: 0 0 10px 0 hsla(0, 6%, 58%, 0.6);
|
|
|
-webkit-box-shadow: 0 0 20px 0 hsla(0, 6%, 58%, 0.6);
|
|
@@ -448,7 +460,7 @@ export default {
|
|
|
.push-again-btn {
|
|
|
margin: 25px 30px;
|
|
|
//background-image: linear-gradient(to right, #7d4ea1, #40397c);
|
|
|
- background: #064C8A;
|
|
|
+ background: #064c8a;
|
|
|
border-radius: 45px;
|
|
|
//border-radius: 50px;
|
|
|
color: #ffffff;
|
|
@@ -464,8 +476,4 @@ export default {
|
|
|
.color-background-color('green');
|
|
|
}
|
|
|
}
|
|
|
-}
|
|
|
</style>
|
|
|
-
|
|
|
-
|
|
|
-
|