|
@@ -22,20 +22,20 @@
|
|
|
</div>
|
|
|
<div class="address edit-address" slot="edit">
|
|
|
<div class="input-con">
|
|
|
- <input type="text" v-model="address.shipName" :placeholder="address.shipName||'姓名'">
|
|
|
- <input type="text" v-model="address.shipMobile" :placeholder="address.shipMobile||'电话'">
|
|
|
+ <input type="text" v-model="editAdd.shipName" :placeholder="address.shipName||'姓名'">
|
|
|
+ <input type="text" v-model="editAdd.shipMobile" :placeholder="address.shipMobile||'电话'">
|
|
|
</div>
|
|
|
<div class="input-con">
|
|
|
- <citySelect :areaPath="address.shipAreaPath" @currentVal="getCurrentSelect"/>
|
|
|
+ <citySelect :areaPath="editAdd.shipAreaPath" @currentVal="getCurrentSelect"/>
|
|
|
</div>
|
|
|
<div class="input-con address-input">
|
|
|
<input
|
|
|
type="text"
|
|
|
- v-model="address.shipAddress"
|
|
|
- :placeholder="address.shipAddress||'详细地址'"
|
|
|
+ v-model="editAdd.shipAddress"
|
|
|
+ :placeholder="editAdd.shipAddress||'详细地址'"
|
|
|
>
|
|
|
</div>
|
|
|
- <div class="btn parmary">保存</div>
|
|
|
+ <div class="btn parmary" @click="uAddress">保存</div>
|
|
|
</div>
|
|
|
</edit>
|
|
|
<div class="pay-type">
|
|
@@ -82,24 +82,30 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="invoice-detail" v-if="invoice==='normal'">
|
|
|
- <p>{{invoice2.title}}</p>
|
|
|
- <p class="p-desc">{{invoice2.code}}</p>
|
|
|
+ <template v-if="!invoice2.title">
|
|
|
+ <p class="p-desc">暂无信息</p>
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ <p>{{invoice2.title}}</p>
|
|
|
+ <p class="p-desc">{{invoice2.code}}</p>
|
|
|
+ </template>
|
|
|
</div>
|
|
|
<div class="invoice-detail" v-if="invoice==='zengzhi'">
|
|
|
- <p>{{invoice3.title}}</p>
|
|
|
- <p class="p-desc">{{invoice3.code}}</p>
|
|
|
- <p class="p-desc">{{invoice3.organizedAddress}}</p>
|
|
|
- <p class="p-desc">{{invoice3.registerPhone}}</p>
|
|
|
- <p class="p-desc">{{invoice3.bankName}}</p>
|
|
|
- <p class="p-desc">{{invoice3.bankAccount}}</p>
|
|
|
+ <template v-if="!invoice3.title">
|
|
|
+ <p class="p-desc">暂无信息</p>
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ <p>{{invoice3.title}}</p>
|
|
|
+ <p class="p-desc">{{invoice3.code}}</p>
|
|
|
+ <p class="p-desc">{{invoice3.organizedAddress}}</p>
|
|
|
+ <p class="p-desc">{{invoice3.registerPhone}}</p>
|
|
|
+ <p class="p-desc">{{invoice3.bankName}}</p>
|
|
|
+ <p class="p-desc">{{invoice3.bankAccount}}</p>
|
|
|
+ </template>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="invoice edit-invoice" slot="edit">
|
|
|
<div class="select-con">
|
|
|
- <div :class="{'tag-active':invoice==='noinvoice'}" @click="invoice='noinvoice'">
|
|
|
- <span>不需要发票</span>
|
|
|
- <img src="@/assets/images/tag-icon.png" alt>
|
|
|
- </div>
|
|
|
<div :class="{'tag-active':invoice==='normal'}" @click="invoice='normal'">
|
|
|
<span>增值税普通发票</span>
|
|
|
<img src="@/assets/images/tag-icon.png" alt>
|
|
@@ -112,22 +118,22 @@
|
|
|
</div>
|
|
|
<div class="invoice-input" v-if="invoice==='normal'">
|
|
|
<div class="input-con">
|
|
|
- <input type="text" placeholder="请输入发票抬头" v-model="invoice2.title">
|
|
|
- <input type="text" placeholder="请输入税务登记号(个人用户可不填)" v-model="invoice2.code">
|
|
|
+ <input type="text" placeholder="请输入发票抬头" v-model="editInvoice2.title">
|
|
|
+ <input type="text" placeholder="请输入税务登记号(个人用户可不填)" v-model="editInvoice2.code">
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="invoice-input" v-if="invoice==='zengzhi'">
|
|
|
<div class="input-con">
|
|
|
- <input type="text" v-model="invoice3.title" placeholder="请输入发票抬头">
|
|
|
- <input type="text" v-model="invoice3.code" placeholder="请输入税务登记号(个人用户可不填)">
|
|
|
+ <input type="text" v-model="editInvoice3.title" placeholder="请输入发票抬头">
|
|
|
+ <input type="text" v-model="editInvoice3.code" placeholder="请输入税务登记号(个人用户可不填)">
|
|
|
</div>
|
|
|
<div class="input-con">
|
|
|
- <input type="text" v-model="invoice3.organizedAddress" placeholder="注册地址">
|
|
|
- <input type="text" v-model="invoice3.registerPhone" placeholder="注册电话">
|
|
|
+ <input type="text" v-model="editInvoice3.organizedAddress" placeholder="注册地址">
|
|
|
+ <input type="text" v-model="editInvoice3.registerPhone" placeholder="注册电话">
|
|
|
</div>
|
|
|
<div class="input-con">
|
|
|
- <input type="text" v-model="invoice3.bankName" placeholder="开户银行">
|
|
|
- <input type="text" v-model="invoice3.bankAccount" placeholder="银行账户">
|
|
|
+ <input type="text" v-model="editInvoice3.bankName" placeholder="开户银行">
|
|
|
+ <input type="text" v-model="editInvoice3.bankAccount" placeholder="银行账户">
|
|
|
</div>
|
|
|
</div>
|
|
|
<div @click="saveInvoice(invoice)" class="btn parmary">保存</div>
|
|
@@ -140,9 +146,9 @@
|
|
|
<div class="product-type">
|
|
|
<div class="title">商品信息</div>
|
|
|
<div class="p-info" v-for="(item,i) in sku" :key="i">
|
|
|
- <img src="@/assets/images/banner_pro.png" alt>
|
|
|
+ <img :src="item.goodsId===4?`${$cdn}images/banner_pro.png`:`${$cdn}images/t_product.png`" alt>
|
|
|
<div class="p-params">
|
|
|
- <h3>四维看看 Pro</h3>
|
|
|
+ <h3>{{item.goodsId === 4?'四维看看 Pro':'四维看看 Lite'}}</h3>
|
|
|
<p>本机主体 x {{item.goodsCount}}, 拍摄支架 x {{item.goodsCount}}</p>
|
|
|
</div>
|
|
|
<div class="p-price">¥ {{item.price}}</div>
|
|
@@ -184,13 +190,24 @@ import vcenter from '@/components/vcenter'
|
|
|
import edit from '@/components/edit'
|
|
|
import citySelect from '@/components/citySelect'
|
|
|
import { mapState } from 'vuex'
|
|
|
-
|
|
|
+var cloneObj = function (obj) {
|
|
|
+ var newObj = {}
|
|
|
+ if (obj instanceof Array) {
|
|
|
+ newObj = []
|
|
|
+ }
|
|
|
+ for (var key in obj) {
|
|
|
+ var val = obj[key]
|
|
|
+ newObj[key] = typeof val === 'object' ? cloneObj(val) : val
|
|
|
+ }
|
|
|
+ return newObj
|
|
|
+}
|
|
|
export default {
|
|
|
props: ['sku', 'fromList'],
|
|
|
data () {
|
|
|
return {
|
|
|
agree: -1,
|
|
|
addressStatus: true,
|
|
|
+ tempSelect: '',
|
|
|
invoiceStatus: true,
|
|
|
invoice: 'noinvoice',
|
|
|
paytype: 0
|
|
@@ -203,10 +220,43 @@ export default {
|
|
|
},
|
|
|
computed: {
|
|
|
...mapState({
|
|
|
- invoice2: state => state.user.invoice2 || {},
|
|
|
- invoice3: state => state.user.invoice3 || {},
|
|
|
+ invoice2: state => {
|
|
|
+ let type = Object.prototype.toString.call(state.user.invoice2)
|
|
|
+ if (type === '[object Object]') {
|
|
|
+ return state.user.invoice2
|
|
|
+ }
|
|
|
+ let condition = state.user.invoice2 && state.user.invoice2 !== 'null' && type !== '[object Array]'
|
|
|
+ return (condition ? JSON.parse(state.user.invoice2) : {})
|
|
|
+ },
|
|
|
+ editInvoice2: state => {
|
|
|
+ let type = Object.prototype.toString.call(state.user.invoice2)
|
|
|
+ if (type === '[object Object]') {
|
|
|
+ return state.user.invoice2
|
|
|
+ }
|
|
|
+ let condition = state.user.invoice2 && state.user.invoice2 !== 'null' && type !== '[object Array]'
|
|
|
+ return cloneObj(condition ? JSON.parse(state.user.invoice2) : {})
|
|
|
+ },
|
|
|
+ invoice3: state => {
|
|
|
+ let type = Object.prototype.toString.call(state.user.invoice3)
|
|
|
+ if (type === '[object Object]') {
|
|
|
+ return state.user.invoice3
|
|
|
+ }
|
|
|
+ let condition = state.user.invoice3 && state.user.invoice3 !== 'null' && type !== '[object Array]'
|
|
|
+
|
|
|
+ return (condition ? JSON.parse(state.user.invoice3) : {})
|
|
|
+ },
|
|
|
+ editInvoice3: state => {
|
|
|
+ let type = Object.prototype.toString.call(state.user.invoice3)
|
|
|
+ if (type === '[object Object]') {
|
|
|
+ return state.user.invoice3
|
|
|
+ }
|
|
|
+ let condition = state.user.invoice3 && state.user.invoice3 !== 'null' && type !== '[object Array]'
|
|
|
+ return cloneObj(condition ? JSON.parse(state.user.invoice3) : {})
|
|
|
+ },
|
|
|
token: state => state.user.token,
|
|
|
- address: state => state.user.address || {}
|
|
|
+ address: state => state.user.address || {},
|
|
|
+ editAdd: state => cloneObj(state.user.address) || {}
|
|
|
+
|
|
|
})
|
|
|
},
|
|
|
methods: {
|
|
@@ -217,7 +267,45 @@ export default {
|
|
|
this.$bus.$emit('hideAside')
|
|
|
},
|
|
|
handleOper (type) {
|
|
|
- this[type] = !this[type]
|
|
|
+ if (type === 'invoiceStatus') {
|
|
|
+ this.invoice === 'noinvoice' ? this[type] = true : this[type] = !this[type]
|
|
|
+ } else {
|
|
|
+ this[type] = !this[type]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ uAddress () {
|
|
|
+ this.editAdd.province = this.tempSelect[0]
|
|
|
+ this.editAdd.city = this.tempSelect[1]
|
|
|
+ this.editAdd.shipAreaPath = this.tempSelect.join(',')
|
|
|
+ let {
|
|
|
+ shipAddress,
|
|
|
+ shipAreaPath,
|
|
|
+ province,
|
|
|
+ city,
|
|
|
+ shipMobile,
|
|
|
+ shipName
|
|
|
+ } = this.editAdd
|
|
|
+ let params = {
|
|
|
+ shipAddress,
|
|
|
+ shipAreaPath,
|
|
|
+ province,
|
|
|
+ city,
|
|
|
+ shipMobile,
|
|
|
+ shipName
|
|
|
+ }
|
|
|
+ this.$http
|
|
|
+ .post('/user/updateAddress', params, {
|
|
|
+ headers: {
|
|
|
+ token: this.token
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .then(data => {
|
|
|
+ this.addressStatus = true
|
|
|
+ this.$store.dispatch('getInfo', {
|
|
|
+ url: '/user/getReceiverInfo',
|
|
|
+ name: 'address'
|
|
|
+ })
|
|
|
+ })
|
|
|
},
|
|
|
getCurrentSelect (data) {
|
|
|
this.tempSelect = data
|
|
@@ -232,7 +320,9 @@ export default {
|
|
|
return [count, sum]
|
|
|
},
|
|
|
async pay () {
|
|
|
- if (!this.agree) { return alert('请同意协议') }
|
|
|
+ if (!this.agree) {
|
|
|
+ return this.$toast.show('warn', '请同意条款')
|
|
|
+ }
|
|
|
let invoice = this.invoice === 'normal' ? this.invoice2 : this.invoice === 'zengzhi' ? this.invoice3 : null
|
|
|
let params = {
|
|
|
goods: this.sku,
|
|
@@ -247,24 +337,31 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
this.$bus.$emit('hideAside')
|
|
|
+ this.$store.dispatch('getCart')
|
|
|
this.$router.push({name: 'pay',
|
|
|
params: {
|
|
|
+ payType: this.paytype,
|
|
|
orderId: res.data.data.id,
|
|
|
- orderType: 0
|
|
|
+ orderType: 0,
|
|
|
+ orderSn: res.data.data.orderSn
|
|
|
}})
|
|
|
},
|
|
|
saveInvoice (cInvoice) {
|
|
|
let params = {}
|
|
|
+ let invoiceType = ''
|
|
|
+
|
|
|
if (cInvoice === 'normal') {
|
|
|
+ invoiceType = 2
|
|
|
params = {
|
|
|
- invoiceType: 2,
|
|
|
- title: this.invoice2.title,
|
|
|
- code: this.invoice2.code
|
|
|
+ invoiceType,
|
|
|
+ title: this.editInvoice2.title,
|
|
|
+ code: this.editInvoice2.code
|
|
|
}
|
|
|
} else {
|
|
|
- let {title, code, organizedAddress, registerPhone, bankName, bankAccount} = this.invoice3
|
|
|
+ let {title, code, organizedAddress, registerPhone, bankName, bankAccount} = this.editInvoice3
|
|
|
+ invoiceType = 3
|
|
|
params = {
|
|
|
- invoiceType: 3,
|
|
|
+ invoiceType,
|
|
|
title,
|
|
|
code,
|
|
|
organizedAddress,
|
|
@@ -281,9 +378,13 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
.then(data => {
|
|
|
- let res = data.data
|
|
|
this.invoiceStatus = true
|
|
|
- localStorage.setItem('invoice', JSON.stringify(res.data))
|
|
|
+ this.$store.dispatch('getInvoice', {
|
|
|
+ type: invoiceType,
|
|
|
+ params: {
|
|
|
+ invoiceType: invoiceType
|
|
|
+ }
|
|
|
+ })
|
|
|
})
|
|
|
}
|
|
|
},
|