|
|
@ -15,33 +15,33 @@
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="line line-icon ">
|
|
|
|
<view class="line line-icon ">
|
|
|
|
<u-form-item :required="true" label="发票抬头" prop="userInfo.invoiceHeader" borderBottom ref="item1">
|
|
|
|
<u-form-item :required="true" label="发票抬头" prop="userInfo.invoiceTitle" borderBottom ref="item1">
|
|
|
|
<u--input v-model="model1.userInfo.invoiceHeader" border="none" inputAlign='right'
|
|
|
|
<u--input v-model="model1.userInfo.invoiceTitle" border="none" inputAlign='right'
|
|
|
|
placeholder="请填写发票抬头"></u--input>
|
|
|
|
placeholder="请填写发票抬头"></u--input>
|
|
|
|
</u-form-item>
|
|
|
|
</u-form-item>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view v-if="checked==1">
|
|
|
|
<view v-if="checked==1">
|
|
|
|
<view class="line">
|
|
|
|
<view class="line">
|
|
|
|
<u-form-item :required="true" label="税号" prop="userInfo.taxId" borderBottom ref="item1">
|
|
|
|
<u-form-item :required="true" label="税号" prop="userInfo.dutyNumber" borderBottom ref="item1">
|
|
|
|
<u--input v-model="model1.userInfo.taxId" border="none" inputAlign='right'
|
|
|
|
<u--input v-model="model1.userInfo.dutyNumber" border="none" inputAlign='right'
|
|
|
|
placeholder="请填写纳税人识别号"></u--input>
|
|
|
|
placeholder="请填写纳税人识别号"></u--input>
|
|
|
|
</u-form-item>
|
|
|
|
</u-form-item>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="line">
|
|
|
|
<view class="line">
|
|
|
|
<u-form-item label="注册地址" prop="userInfo.address" borderBottom ref="item1">
|
|
|
|
<u-form-item label="注册地址" prop="userInfo.registeredAddress" borderBottom ref="item1">
|
|
|
|
<u--input v-model="model1.userInfo.address" border="none" inputAlign='right'
|
|
|
|
<u--input v-model="model1.userInfo.registeredAddress" border="none" inputAlign='right'
|
|
|
|
placeholder="请填写公司注册地址"></u--input>
|
|
|
|
placeholder="请填写公司注册地址"></u--input>
|
|
|
|
</u-form-item>
|
|
|
|
</u-form-item>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="line">
|
|
|
|
<view class="line">
|
|
|
|
<u-form-item label="公司开户行" prop="userInfo.bank" borderBottom ref="item1">
|
|
|
|
<u-form-item label="公司开户行" prop="userInfo.bankOfDeposit" borderBottom ref="item1">
|
|
|
|
<u--input v-model="model1.userInfo.bank" border="none" inputAlign='right'
|
|
|
|
<u--input v-model="model1.userInfo.bankOfDeposit" border="none" inputAlign='right'
|
|
|
|
placeholder="请填写银行名称"> </u--input>
|
|
|
|
placeholder="请填写银行名称"> </u--input>
|
|
|
|
</u-form-item>
|
|
|
|
</u-form-item>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="line">
|
|
|
|
<view class="line">
|
|
|
|
<u-form-item label="开户行账户" prop="userInfo.cardNo" borderBottom ref="item1">
|
|
|
|
<u-form-item label="开户行账户" prop="userInfo.openBankAccount" borderBottom ref="item1">
|
|
|
|
<u--input v-model="model1.userInfo.cardNo" border="none" inputAlign='right'
|
|
|
|
<u--input v-model="model1.userInfo.openBankAccount" border="none" inputAlign='right'
|
|
|
|
placeholder="请填写银行账号"></u--input>
|
|
|
|
placeholder="请填写银行账号"></u--input>
|
|
|
|
</u-form-item>
|
|
|
|
</u-form-item>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
@ -49,7 +49,7 @@
|
|
|
|
</u--form>
|
|
|
|
</u--form>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<!-- 邮寄信息 -->
|
|
|
|
<!-- 邮寄信息 -->
|
|
|
|
<view class="content-title">
|
|
|
|
<!-- <view class="content-title">
|
|
|
|
<view class="content-name">
|
|
|
|
<view class="content-name">
|
|
|
|
<view class="orders-line"></view>
|
|
|
|
<view class="orders-line"></view>
|
|
|
|
<view>邮寄信息</view>
|
|
|
|
<view>邮寄信息</view>
|
|
|
@ -88,7 +88,7 @@
|
|
|
|
<view class="">
|
|
|
|
<view class="">
|
|
|
|
<u-switch v-model="switchValue" @change="switchVhange"></u-switch>
|
|
|
|
<u-switch v-model="switchValue" @change="switchVhange"></u-switch>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view> -->
|
|
|
|
<!-- position bottom -->
|
|
|
|
<!-- position bottom -->
|
|
|
|
<view class="footer-box">
|
|
|
|
<view class="footer-box">
|
|
|
|
<view>
|
|
|
|
<view>
|
|
|
@ -127,11 +127,11 @@
|
|
|
|
const formAddress = ref(null);
|
|
|
|
const formAddress = ref(null);
|
|
|
|
const model1 = reactive({
|
|
|
|
const model1 = reactive({
|
|
|
|
userInfo: {
|
|
|
|
userInfo: {
|
|
|
|
invoiceHeader: '',
|
|
|
|
invoiceTitle: '',
|
|
|
|
taxId: '',
|
|
|
|
dutyNumber: '',
|
|
|
|
address: '',
|
|
|
|
registeredAddress: '',
|
|
|
|
bank: '',
|
|
|
|
bankOfDeposit: '',
|
|
|
|
cardNo: '',
|
|
|
|
openBankAccount: '',
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
const model2 = reactive({
|
|
|
|
const model2 = reactive({
|
|
|
@ -147,12 +147,12 @@
|
|
|
|
const saveTaxid = ref('')
|
|
|
|
const saveTaxid = ref('')
|
|
|
|
// 校验
|
|
|
|
// 校验
|
|
|
|
const rules = ref({
|
|
|
|
const rules = ref({
|
|
|
|
'userInfo.invoiceHeader': {
|
|
|
|
'userInfo.invoiceTitle': {
|
|
|
|
required: true,
|
|
|
|
required: true,
|
|
|
|
message: '请填写发票抬头',
|
|
|
|
message: '请填写发票抬头',
|
|
|
|
trigger: ['blur', 'change']
|
|
|
|
trigger: ['blur', 'change']
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'userInfo.taxId': {
|
|
|
|
'userInfo.dutyNumber': {
|
|
|
|
required: true,
|
|
|
|
required: true,
|
|
|
|
pattern: /^[0-9a-zA-Z]*$/g,
|
|
|
|
pattern: /^[0-9a-zA-Z]*$/g,
|
|
|
|
transform(value) {
|
|
|
|
transform(value) {
|
|
|
@ -187,33 +187,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
//
|
|
|
|
onLoad((option) => {
|
|
|
|
onLoad((option) => {
|
|
|
|
console.log(option, 'option');
|
|
|
|
// console.log(option, 'option');
|
|
|
|
if (option.detail) {
|
|
|
|
// if (option.detail) {
|
|
|
|
let detail = JSON.parse(option.detail)
|
|
|
|
// let detail = JSON.parse(option.detail)
|
|
|
|
model1.userInfo.invoiceHeader = detail.invoiceHeader
|
|
|
|
// model1.userInfo.invoiceHeader = detail.invoiceHeader
|
|
|
|
model1.userInfo.taxId = detail.taxId
|
|
|
|
// model1.userInfo.taxId = detail.taxId
|
|
|
|
model1.userInfo.address = detail.address
|
|
|
|
// model1.userInfo.address = detail.address
|
|
|
|
model1.userInfo.bank = detail.bank
|
|
|
|
// model1.userInfo.bank = detail.bank
|
|
|
|
model1.userInfo.cardNo = detail.cardNo
|
|
|
|
// model1.userInfo.cardNo = detail.cardNo
|
|
|
|
model2.userInfo2.address = detail.shippingAddress
|
|
|
|
// model2.userInfo2.address = detail.shippingAddress
|
|
|
|
model2.userInfo2.phone = detail.contactPhone
|
|
|
|
// model2.userInfo2.phone = detail.contactPhone
|
|
|
|
model2.userInfo2.contacts = detail.recipient
|
|
|
|
// model2.userInfo2.contacts = detail.recipient
|
|
|
|
email.value = detail.email
|
|
|
|
// email.value = detail.email
|
|
|
|
if (detail.type === 1) {
|
|
|
|
// if (detail.type === 1) {
|
|
|
|
isChecked.value = 0
|
|
|
|
// isChecked.value = 0
|
|
|
|
checked.value = 1
|
|
|
|
// checked.value = 1
|
|
|
|
} else {
|
|
|
|
// } else {
|
|
|
|
isChecked.value = 1
|
|
|
|
// isChecked.value = 1
|
|
|
|
checked.value = 2
|
|
|
|
// checked.value = 2
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
if (detail.isDefault === 1) {
|
|
|
|
// if (detail.isDefault === 1) {
|
|
|
|
switchValue.value = true
|
|
|
|
// switchValue.value = true
|
|
|
|
} else {
|
|
|
|
// } else {
|
|
|
|
switchValue.value = false
|
|
|
|
// switchValue.value = false
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
updataId.value = detail.id
|
|
|
|
// updataId.value = detail.id
|
|
|
|
console.log('JSON.parse(option.detail)', JSON.parse(option.detail));
|
|
|
|
// console.log('JSON.parse(option.detail)', JSON.parse(option.detail));
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
|
|
|
|
handle_start_access_token()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
// 监听
|
|
|
|
// 监听
|
|
|
|
watch(checked, (newVal, oldVal) => {
|
|
|
|
watch(checked, (newVal, oldVal) => {
|
|
|
@ -248,6 +249,15 @@
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const handle_start_access_token = async () => {
|
|
|
|
|
|
|
|
uni.$request({
|
|
|
|
|
|
|
|
url: "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=wx7b910c0c240c2676&secret=APPSECRET",
|
|
|
|
|
|
|
|
method: 'GET'
|
|
|
|
|
|
|
|
}).then(res => {
|
|
|
|
|
|
|
|
console.log(res, '===发票步骤1====?');
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 方法
|
|
|
|
// 方法
|
|
|
|
const onChange = (e) => {
|
|
|
|
const onChange = (e) => {
|
|
|
@ -276,68 +286,49 @@
|
|
|
|
console.log(err, '校验失败1');
|
|
|
|
console.log(err, '校验失败1');
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
let p2 = new Promise((resolve, reject) => {
|
|
|
|
// let p2 = new Promise((resolve, reject) => {
|
|
|
|
formAddress.value.validate().then(res => {
|
|
|
|
// formAddress.value.validate().then(res => {
|
|
|
|
resolve()
|
|
|
|
// resolve()
|
|
|
|
}).catch(err => {
|
|
|
|
// }).catch(err => {
|
|
|
|
console.log(err, '校验失败2');
|
|
|
|
// console.log(err, '校验失败2');
|
|
|
|
})
|
|
|
|
// })
|
|
|
|
})
|
|
|
|
// })
|
|
|
|
Promise.all([p1, p2]).then((result) => {
|
|
|
|
// Promise.all([p1, p2]).then((result) => {
|
|
|
|
console.log('xxxxxxxxx', model1.userInfo.invoiceHeader);
|
|
|
|
Promise.all([p1]).then((result) => {
|
|
|
|
if (checked.value == 2) {
|
|
|
|
// console.log('xxxxxxxxx', model1.userInfo.invoiceHeader);
|
|
|
|
model1.userInfo.taxId = ''
|
|
|
|
// if (checked.value == 2) {
|
|
|
|
model1.userInfo.address = ''
|
|
|
|
// model1.userInfo.taxId = ''
|
|
|
|
model1.userInfo.bank = ''
|
|
|
|
// model1.userInfo.address = ''
|
|
|
|
model1.userInfo.cardNo = ''
|
|
|
|
// model1.userInfo.bank = ''
|
|
|
|
}
|
|
|
|
// model1.userInfo.cardNo = ''
|
|
|
|
|
|
|
|
// }
|
|
|
|
let data = {
|
|
|
|
let data = {
|
|
|
|
id: updataId.value,
|
|
|
|
orderNo: 12,
|
|
|
|
|
|
|
|
invoiceStatus: 0,
|
|
|
|
type: checked.value,
|
|
|
|
type: checked.value,
|
|
|
|
isDefault: isDefault.value,
|
|
|
|
orderType: 1,
|
|
|
|
email: email.value,
|
|
|
|
|
|
|
|
// 1
|
|
|
|
// 1
|
|
|
|
invoiceHeader: model1.userInfo.invoiceHeader,
|
|
|
|
invoiceTitle: model1.userInfo.invoiceTitle,
|
|
|
|
taxId: model1.userInfo.taxId,
|
|
|
|
dutyNumber: model1.userInfo.dutyNumber,
|
|
|
|
address: model1.userInfo.address,
|
|
|
|
registeredAddress: model1.userInfo.registeredAddress,
|
|
|
|
bank: model1.userInfo.bank,
|
|
|
|
bankOfDeposit: model1.userInfo.bankOfDeposit,
|
|
|
|
cardNo: model1.userInfo.cardNo,
|
|
|
|
openBankAccount: model1.userInfo.openBankAccount,
|
|
|
|
|
|
|
|
|
|
|
|
// 2
|
|
|
|
|
|
|
|
shippingAddress: model2.userInfo2.address,
|
|
|
|
|
|
|
|
contactPhone: model2.userInfo2.phone,
|
|
|
|
|
|
|
|
recipient: model2.userInfo2.contacts,
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// uni.$u.toast('校验通过')
|
|
|
|
// uni.$u.toast('校验通过')
|
|
|
|
if (updataId.value) {
|
|
|
|
uni.$request({
|
|
|
|
uni.$request({
|
|
|
|
url: config.baseUrl + "app-api/cloud/invoice/create",
|
|
|
|
url: config.wxUrl_pay + "pay/invoice/modifyHeader",
|
|
|
|
method: 'POST',
|
|
|
|
method: 'POST',
|
|
|
|
data: data,
|
|
|
|
data: data,
|
|
|
|
}).then(res => {
|
|
|
|
}).then(res => {
|
|
|
|
uni.$u.toast(res.data.msg)
|
|
|
|
uni.$u.toast(res.data.msg)
|
|
|
|
// setTimeout(function() {
|
|
|
|
setTimeout(function() {
|
|
|
|
// uni.navigateBack({
|
|
|
|
uni.navigateBack({
|
|
|
|
// delta: 1,
|
|
|
|
delta: 1,
|
|
|
|
// });
|
|
|
|
});
|
|
|
|
// }, 500)
|
|
|
|
}, 500)
|
|
|
|
console.log(res.data.msg, '=======?');
|
|
|
|
console.log(res.data.msg, '=======?');
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
uni.$request({
|
|
|
|
|
|
|
|
url: config.wxUrl_pay + "pay/invoice/addHeader",
|
|
|
|
|
|
|
|
method: 'POST',
|
|
|
|
|
|
|
|
data: data,
|
|
|
|
|
|
|
|
}).then(res => {
|
|
|
|
|
|
|
|
uni.$u.toast(res.data.msg)
|
|
|
|
|
|
|
|
setTimeout(function() {
|
|
|
|
|
|
|
|
uni.navigateBack({
|
|
|
|
|
|
|
|
delta: 1,
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}, 500)
|
|
|
|
|
|
|
|
console.log(res.data.msg, '=======?');
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}).catch((error) => {
|
|
|
|
}).catch((error) => {
|
|
|
|
console.log(error)
|
|
|
|
console.log(error)
|
|
|
|