|
@@ -2,104 +2,193 @@
|
|
|
<div class="information-layout">
|
|
|
<div class="user-con">
|
|
|
<div class="user-top">
|
|
|
- <div class="user-img">
|
|
|
- <img src alt />
|
|
|
+ <div class="user-img" :style="{backgroundImage:`url(${info.head||`${$cdn}images/head-default.png`})`}">
|
|
|
</div>
|
|
|
<div class="user-upload">
|
|
|
<p>上传头像</p>
|
|
|
- <button type="button" class="ant-btn">
|
|
|
+ <div type="button" class="ant-btn">
|
|
|
+ <input class="el-upload" ref="uploadInput" name="file" type="file" @change="update">
|
|
|
<span>选择文件</span>
|
|
|
- </button>
|
|
|
+ </div>
|
|
|
<p>允许的文件类型为JPG 或 PNG。</p>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="address-con">
|
|
|
- <p class="sub-title">我的收货地址</p>
|
|
|
- <div class="address-input-con">
|
|
|
- <div class="address-input-item">
|
|
|
- <div class="address-sub address-name">
|
|
|
- <div class="top-title">姓名</div>
|
|
|
- <input class="ant-input" type="text" placeholder="何" />
|
|
|
- </div>
|
|
|
- <div class="address-sub address-phone">
|
|
|
- <div class="top-title">联系电话</div>
|
|
|
- <input class="ant-input" type="text" placeholder="联系电话" />
|
|
|
+ <p class="sub-title">
|
|
|
+ <span>我的收货地址</span>
|
|
|
+ </p>
|
|
|
+ <div class="address-show" v-if="isShowAddress">
|
|
|
+ <template v-if="address.shipName">
|
|
|
+ <div class="add-info">
|
|
|
+ <div class="show-name">
|
|
|
+ <span>{{address.shipName}}</span>
|
|
|
+ <span>{{address.shipMobile}}</span>
|
|
|
+ </div>
|
|
|
+ <div class="show-address">
|
|
|
+ {{`${address.shipAreaPath}${address.shipAddress}`}}
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- <div class="address-input-item">
|
|
|
- <div class="address-sub prov-name">
|
|
|
- <div class="top-title">省份</div>
|
|
|
- <input class="ant-input" type="text" placeholder="省份" />
|
|
|
+ <div class="add-edit" @click="isShowAddress=false">
|
|
|
+ <img :src="`${$cdn}images/icon/edit.png`" alt="">
|
|
|
</div>
|
|
|
- <div class="address-sub city-phone">
|
|
|
- <div class="top-title">城市</div>
|
|
|
- <input class="ant-input" type="text" placeholder="城市" />
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="address-input-item">
|
|
|
- <div class="address-sub">
|
|
|
- <div class="top-title">地址</div>
|
|
|
- <input class="ant-input" type="text" style="margin-bottom:8px;" placeholder="区/县" />
|
|
|
- <input class="ant-input" type="text" placeholder="详细地址" />
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ <div class="add-info">暂无地址信息</div>
|
|
|
+ <div class="add-edit" @click="isShowAddress=false">
|
|
|
+ <img :src="`${$cdn}images/icon/edit.png`" alt="">
|
|
|
</div>
|
|
|
- </div>
|
|
|
- <p class="p-dec">请务必详细填写相符无误的地址以免耽误收货</p>
|
|
|
- <button type="submit" class="ant-btn ant-btn-primary">
|
|
|
- <span>保 存</span>
|
|
|
- </button>
|
|
|
+ </template>
|
|
|
</div>
|
|
|
+ <citySelect class="address-scon" :address='address' :token="token" @closeSelect="data=>{isShowAddress=data}" v-else/>
|
|
|
</div>
|
|
|
<div class="address-con">
|
|
|
<p class="sub-title">我的发票抬头</p>
|
|
|
- <div class="address-input-con">
|
|
|
- <div class="address-input-item">
|
|
|
- <div class="address-sub">
|
|
|
- <div class="top-title">抬头名称</div>
|
|
|
- <input class="ant-input" type="text" placeholder="发票抬头" />
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="address-input-item">
|
|
|
- <div class="address-sub">
|
|
|
- <div class="top-title">税号</div>
|
|
|
- <input class="ant-input" type="text" placeholder="税务登记号" />
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="address-input-item">
|
|
|
- <div class="address-sub">
|
|
|
- <div class="top-title">地址</div>
|
|
|
- <input class="ant-input" type="text" placeholder="公司地址" />
|
|
|
+ <div class="invoice-show" v-if="isShowInvoice">
|
|
|
+ <template v-if="invoice2.title||invoice3.title">
|
|
|
+ <div class="add-info">
|
|
|
+ <div class="show-name">
|
|
|
+ <span>{{invoice2.title||invoice3.title}}</span>
|
|
|
+ </div>
|
|
|
+ <div class="show-address">
|
|
|
+ {{invoice2.code}}
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- <div class="address-input-item">
|
|
|
- <div class="address-sub">
|
|
|
- <div class="top-title">电话号码</div>
|
|
|
- <input class="ant-input" type="text" placeholder="公司电话号码" />
|
|
|
+ <div class="add-edit" @click="isShowInvoice=false">
|
|
|
+ <img :src="`${$cdn}images/icon/edit.png`" alt="">
|
|
|
</div>
|
|
|
- </div>
|
|
|
- <div class="address-input-item">
|
|
|
- <div class="address-sub">
|
|
|
- <div class="top-title">开户银行</div>
|
|
|
- <input class="ant-input" type="text" placeholder="开户银行" />
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="address-input-item">
|
|
|
- <div class="address-sub">
|
|
|
- <div class="top-title">银行账户</div>
|
|
|
- <input class="ant-input" type="text" placeholder="银行账户" />
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ <div class="add-info">暂无发票信息</div>
|
|
|
+ <div class="add-edit" @click="isShowInvoice=false">
|
|
|
+ <img :src="`${$cdn}images/icon/edit.png`" alt="">
|
|
|
</div>
|
|
|
- </div>
|
|
|
- <p class="p-dec">如需开具增值税专用发票,需全部填写</p>
|
|
|
- <button type="submit" class="ant-btn ant-btn-primary">
|
|
|
- <span>保 存</span>
|
|
|
- </button>
|
|
|
+ </template>
|
|
|
</div>
|
|
|
+ <invoices :invoice='invoice2' :invoicet="invoice3" :token="token" @closeInvoice="data=>{isShowInvoice=data}" v-else />
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-export default {}
|
|
|
+import { mapState } from 'vuex'
|
|
|
+import citySelect from '@/components/citySelect'
|
|
|
+import invoices from '@/components/invoices'
|
|
|
+
|
|
|
+export default {
|
|
|
+ components: {
|
|
|
+ citySelect,
|
|
|
+ invoices
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapState({
|
|
|
+ info: state => state.user.info,
|
|
|
+ token: state => state.user.token,
|
|
|
+ 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) : {})
|
|
|
+ },
|
|
|
+ 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) : {})
|
|
|
+ },
|
|
|
+ address: state => state.user.address || {}
|
|
|
+ })
|
|
|
+ },
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ isShowAddress: true,
|
|
|
+ tempSelect: '',
|
|
|
+ isShowInvoice: true
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ getCurrentStatus (data) {
|
|
|
+ this.tempSelect = data
|
|
|
+ },
|
|
|
+ uAddress () {
|
|
|
+ this.address.province = this.tempSelect[0]
|
|
|
+ this.address.city = this.tempSelect[1]
|
|
|
+ this.address.shipAreaPath = this.tempSelect.join(',')
|
|
|
+ let {
|
|
|
+ shipAddress,
|
|
|
+ shipAreaPath,
|
|
|
+ province,
|
|
|
+ city,
|
|
|
+ shipMobile,
|
|
|
+ shipName
|
|
|
+ } = this.address
|
|
|
+ let params = {
|
|
|
+ shipAddress,
|
|
|
+ shipAreaPath,
|
|
|
+ province,
|
|
|
+ city,
|
|
|
+ shipMobile,
|
|
|
+ shipName
|
|
|
+ }
|
|
|
+ this.$http
|
|
|
+ .post('/user/updateAddress', params, {
|
|
|
+ headers: {
|
|
|
+ token: this.token
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .then(data => {
|
|
|
+ let res = data.data
|
|
|
+ this.addressStatus = true
|
|
|
+ localStorage.setItem('address', JSON.stringify(res.data))
|
|
|
+ })
|
|
|
+ },
|
|
|
+ update (e) {
|
|
|
+ let file = e.target.files[0]
|
|
|
+ let token = this.token
|
|
|
+ let config = {
|
|
|
+ headers: {
|
|
|
+ token
|
|
|
+ }
|
|
|
+ } // 添加请求头
|
|
|
+ var reader = new FileReader()
|
|
|
+ reader.onload = async e => {
|
|
|
+ let imgdata = e.target.result
|
|
|
+ let res = await this.$http.post('/user/uploadHead', { imgdata }, config)
|
|
|
+ if (res.data.code === 0) {
|
|
|
+ this.info.head = res.data.msg
|
|
|
+ localStorage.setItem('info', JSON.stringify(this.info))
|
|
|
+ } else {
|
|
|
+ this.$toast.show('warn', '上传失败,请稍后再试')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ reader.readAsDataURL(file)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted () {
|
|
|
+ this.$store.dispatch('getInfo', {
|
|
|
+ url: '/user/getReceiverInfo',
|
|
|
+ name: 'address'
|
|
|
+ })
|
|
|
+
|
|
|
+ Object.keys(this.invoice2).length === 0 && this.$store.dispatch('getInvoice', {
|
|
|
+ type: 2,
|
|
|
+ params: {
|
|
|
+ invoiceType: 2
|
|
|
+ }
|
|
|
+ })
|
|
|
+ Object.keys(this.invoice3).length === 0 && this.$store.dispatch('getInvoice', {
|
|
|
+ type: 3,
|
|
|
+ params: {
|
|
|
+ invoiceType: 3
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|