Browse Source

新增买家订单

shenjj 6 years ago
parent
commit
e4718f0c9e

+ 2 - 1
assets/scss/mobileCommon.scss

@@ -118,7 +118,8 @@ html {
   }
 
   input[type="text"],
-  input[type="number"]{
+  input[type="number"],
+  input[type="tel"]{
     -webkit-appearance: none;
     -moz-appearance: none;
     appearance: none;

+ 3 - 0
components/mobile/MobileHeader.vue

@@ -211,6 +211,9 @@
         } else if (this.startWith(val, '/mobile/center/user/payCenter')) {
           this.showSearchIcon = false
           title = '支付中心'
+        } else if (this.startWith(val, '/mobile/center/user/invoice')) {
+          this.showSearchIcon = false
+          title = '发票管理'
         } else if (this.startWith(val, '/mobile/center/vendor/payCenter')) {
           this.showSearchIcon = false
           title = '财务对账'

+ 396 - 0
components/mobile/center/addinvoice.vue

@@ -0,0 +1,396 @@
+<template>
+  <div class="addinvoice-wrapper">
+    <div class="mobile-nav">
+      <div class="mobile-header mobile-center-header">
+        <a @click="goBack()"><i class="iconfont icon-fanhui"></i></a>
+        <p>{{joinType === 'update' ? '修改': '新增'}}发票信息</p>
+        <p class="en-name">
+          <img :src="`/images/mobile/center/${user.data.enterprise && user.data.enterprise.uu ? 'en' : 'self'}.png`" alt="">
+          {{currentEnName}}
+        </p>
+      </div>
+    </div>
+    <div class="addinvoice-content-wrapper">
+      <div class="addinvoice-title" v-if="joinType !== 'add'">{{chooseItem.kind === 1206 ? '增值税普票' : '增值税专票'}}</div>
+      <div class="addinvoice-ul" :style="joinType === 'add' ? 'margin-top: 0.2rem' : ''">
+        <div class="addinvoice-focus clearfix" v-if="joinType === 'add'">
+          <div class="pull-left addinvoice-focus-name"><a class="red">*</a>发票类型:</div>
+          <div class="pull-left clearfix">
+            <div class="normal pull-left" style="margin-right: 0.2rem;" @click="isSaveinvoiceType === 0 ? invoiceType = 'speci' : ''">
+              <div class="icon" :class="invoiceType === 'speci' ? 'active' : ''">
+                <div class="icon-next"></div>
+              </div>
+              增值税专票
+            </div>
+            <div class="normal pull-left" @click="isSaveinvoiceType === 0 ? invoiceType = 'normal' : ''">
+              <div class="icon" :class="invoiceType === 'normal' ? 'active' : ''">
+                <div class="icon-next"></div>
+              </div>
+              增值税普票
+            </div>
+          </div>
+        </div>
+        <div class="addinvoice-focus clearfix">
+          <div class="pull-left addinvoice-focus-name"><a class="red">*</a>发票抬头:</div>
+          <div class="pull-left input">
+            <input placeholder="请输入发票抬头" type="text" v-model="chooseItem.head" />
+          </div>
+        </div>
+        <div class="addinvoice-focus clearfix" v-if="invoiceType === 'speci'">
+          <div class="pull-left addinvoice-focus-name"><a class="red">*</a>单位地址:</div>
+          <div class="pull-left input">
+            <input placeholder="请输入单位地址" type="text" v-model="chooseItem.companyAddress" maxlength="50" />
+          </div>
+        </div>
+
+        <div class="addinvoice-focus clearfix" v-if="invoiceType === 'speci'">
+          <div class="pull-left addinvoice-focus-name"><a class="red">*</a>单位电话:</div>
+          <div class="pull-left input">
+            <input placeholder="区号和号码用“-”隔开" type="text" v-model="chooseItem.companyPhone"/>
+          </div>
+        </div>
+
+        <div class="addinvoice-focus clearfix" v-if="invoiceType === 'speci'">
+          <div class="pull-left addinvoice-focus-name"><a class="red">*</a>税务登记号:</div>
+          <div class="pull-left input">
+            <input placeholder="请输入税务登记号" type="text" v-model="chooseItem.companyTaxNumber" maxlength="20"/>
+          </div>
+        </div>
+
+        <div class="addinvoice-focus clearfix" v-if="invoiceType === 'speci'">
+          <div class="pull-left addinvoice-focus-name"><a class="red">*</a>开户银行:</div>
+          <div class="pull-left input">
+            <input placeholder="请输入开户银行" type="text" v-model="chooseItem.bankName" maxlength="30"/>
+          </div>
+        </div>
+
+        <div class="addinvoice-focus clearfix" v-if="invoiceType === 'speci'">
+          <div class="pull-left addinvoice-focus-name"><a class="red">*</a>开户银行账号:</div>
+          <div class="pull-left input">
+            <input placeholder="请输入开户银行账号" type="number" v-model="chooseItem.bankAccount" maxlength="30" />
+          </div>
+        </div>
+
+        <div class="addinvoice-focus clearfix">
+          <div class="pull-left addinvoice-focus-name"><a class="red">*</a>收票人:</div>
+          <div class="pull-left input">
+            <input placeholder="请输入收票人" type="text" maxlength="10" v-model="chooseItem.name" />
+          </div>
+        </div>
+
+        <div class="addinvoice-focus clearfix">
+          <div class="pull-left addinvoice-focus-name"><a class="red">*</a>联系电话:</div>
+          <div class="pull-left input">
+            <input placeholder="请输入联系电话" type="text" maxlength="11" v-model="chooseItem.telephone" />
+          </div>
+        </div>
+
+        <div class="addinvoice-focus clearfix">
+          <div class="pull-left addinvoice-focus-name"><a class="red">*</a>所在地区:</div>
+          <div class="pull-left input" @click="addressShow = true">
+            <span v-text="chooseItem.area || '选择地区'">选择地区</span>
+            <i class="iconfont icon-xiangyou"></i>
+            <!--<input placeholder="省/市/区" type="text" />-->
+          </div>
+        </div>
+
+        <div class="addinvoice-focus clearfix">
+          <div class="pull-left addinvoice-focus-name"><a class="red">*</a>详细地址:</div>
+          <div class="pull-left input">
+            <input placeholder="建议您填写详细发件地址,如街道名,门牌号楼层和房间号等信息" type="text" v-model="chooseItem.detailAddress" />
+          </div>
+        </div>
+
+        <div class="addinvoice-agree" v-if="joinType === 'add'">
+          <input type="checkbox" id="awesome" :checked="agreeInfo" @click="agreeInfo = !agreeInfo"/>
+          <label for="awesome">我已阅读并同意<a>《发票须知》</a></label>
+        </div>
+
+        <div class="addinvoice-controll clearfix">
+          <div class="pull-left" @click="goBack()">取消</div>
+          <div class="pull-right" @click="goBack(true)">确认</div>
+        </div>
+      </div>
+    </div>
+    <remind-box :title="collectResult" :timeoutCount="timeoutCount"></remind-box>
+    <select-address :className="''" :isShow="addressShow" @closeAction="addressData"></select-address>
+  </div>
+</template>
+
+<script>
+  import { RemindBox } from '~components/mobile/common'
+  import SelectAddress from '~components/mobile/base/SelectAddress.vue'
+  export default {
+    name: 'addinvoice',
+    props: {
+      chooseItem: {
+        type: Object,
+        default: {}
+      },
+      isSaveinvoiceType: { // 已保存的发票信息
+        type: Number,
+        default: 0
+      },
+      joinType: {
+        type: String,
+        default: 'add'
+      }
+    },
+    computed: {
+      isEmpty() {
+        return this.chooseItem.kind
+      }
+      // invoiceType() {
+      //   return this.isSaveinvoiceType > 0 ? (this.isSaveinvoiceType === 1205 ? 'speci' : 'normal') : 'speci'
+      // }
+    },
+    mounted() {
+      if (this.isSaveinvoiceType === 1205) {
+        this.invoiceType = 'normal'
+      } else if (this.isSaveinvoiceType === 1206) {
+        this.invoiceType = 'speci'
+      } else {
+        this.invoiceType = this.chooseItem.kind === 1205 ? 'speci' : 'normal'
+        if (this.chooseItem.kind) {
+          this.agreeInfo = true
+        }
+      }
+    },
+    data() {
+      return {
+        invoiceType: 'speci',
+        agreeInfo: false,
+        collectResult: '',
+        timeoutCount: 0,
+        addressShow: false
+      }
+    },
+    methods: {
+      goBack(str) {
+        if (str) {
+          if (this.chooseItem.head === '' || !this.chooseItem.head) {
+            this.setRemindText('发票抬头不能为空')
+          } else if (this.invoiceType !== 'normal' && (this.chooseItem.companyAddress === '' || !this.chooseItem.companyAddress)) {
+            this.setRemindText('单位地址不能为空')
+          } else if (this.invoiceType !== 'normal' && (!/^0\d{2,3}-\d{7,8}$/.test(this.chooseItem.companyPhone))) {
+            this.setRemindText('单位电话不正确')
+          } else if (this.invoiceType !== 'normal' && (this.chooseItem.companyTaxNumber === '' || !this.chooseItem.companyTaxNumber)) {
+            this.setRemindText('税务登记号不能为空')
+          } else if (this.invoiceType !== 'normal' && (!/^[0-9a-zA-Z]*$/g.test(this.chooseItem.companyTaxNumber))) {
+            this.setRemindText('税务登记号为只能输入字母和数字')
+          } else if (this.invoiceType !== 'normal' && (this.chooseItem.bankName === '' || !this.chooseItem.bankName)) {
+            this.setRemindText('开户银行不能为空')
+          } else if (this.invoiceType !== 'normal' && (this.chooseItem.bankAccount === '' || !this.chooseItem.bankAccount)) {
+            this.setRemindText('开户银行账号不能为空')
+          } else if (this.chooseItem.name === '' || !this.chooseItem.name) {
+            this.setRemindText('收票人不能为空')
+          } else if (!/^1\d{10}$/.test(this.chooseItem.telephone)) {
+            this.setRemindText('联系电话不正确')
+          } else if (this.chooseItem.detailAddress === '' || !this.chooseItem.detailAddress) {
+            this.setRemindText('详细地址不能为空')
+          } else if (!this.agreeInfo) {
+            this.setRemindText('请阅读并勾选发票须知')
+          } else {
+            this.chooseItem.kind = this.invoiceType === 'normal' ? 1206 : 1205
+            this.chooseItem.is_agree = true
+            let params = new FormData()
+            params.append('bill', JSON.stringify(this.chooseItem))
+            let config = {
+              headers: {'Content-Type': 'multipart/form-data'}
+            }
+            this.$http.post('/trade/bill/save', params).then(res => {
+              this.setRemindText('保存成功')
+              this.$emit('addinvoiceBtn', str)
+            }, config)
+          }
+        } else {
+          this.$emit('addinvoiceBtn')
+        }
+      },
+      addressData(item) {
+        this.addressShow = false
+        if (item) {
+          this.chooseItem.address = item
+          this.chooseItem.area = item.province + ',' + item.city + ',' + item.area
+        }
+      },
+      setRemindText(str) {
+        this.collectResult = str
+        this.timeoutCount++
+      }
+    },
+    components: {
+      RemindBox,
+      SelectAddress
+    }
+  }
+</script>
+
+<style scoped lang="scss">
+  @mixin overFlowHidden {
+    overflow: hidden;
+    text-overflow: ellipsis;
+    white-space: nowrap;
+  }
+  @mixin lineHeight($value) {
+    height: $value;
+    line-height: $value;
+  }
+  .addinvoice-wrapper {
+    position: fixed;
+    z-index: 99;
+    background: #f1f3f6;
+    top: 0;
+    left: 0;
+    bottom: 0;
+    right: 0;
+    .mobile-header{
+      position: fixed;
+      top: 0;
+      z-index: 10;
+      width:100%;
+      height: 1.26rem;
+      line-height: 1.26rem;
+      /*border-bottom:.01rem solid #ccc;*/
+      background: #3e82f5;
+      padding:0 .2rem 0 .1rem;
+      color:#fff;
+    }
+    .mobile-header p{
+      overflow: hidden;
+      text-overflow: ellipsis;
+      white-space: nowrap;
+      font-size:.36rem;
+      text-align: center;
+      width: 6rem;
+      padding-left: 1rem;
+    }
+    .mobile-header a{
+      font-size:.28rem;
+      color:#fff;
+      position: absolute;
+    }
+    .mobile-header a i{
+      font-size: .48rem;
+      margin-right: -.1rem;
+    }
+    .addinvoice-content-wrapper {
+      margin: 1.26rem 0 0 0;
+      height: calc(100vh - 1.26rem);
+      overflow-y: scroll;
+      .addinvoice-title {
+        font-size: 0.28rem;
+        color: #333;
+        @include lineHeight(0.8rem);
+        margin: 0 0.2rem;
+      }
+      .addinvoice-ul {
+        background: #fff;
+        margin: 0 0.2rem;
+        padding-bottom: 0.5rem;
+        border: 1px solid #e0e0e0;
+        border-radius: 0.07rem;
+      }
+      .addinvoice-focus {
+        font-size: 0.28rem;
+        color: #226ce7;
+        line-height: 1.16rem;
+        border-bottom: 1px solid #dcdcdc;
+        margin: 0 0.2rem;
+        .addinvoice-focus-name {
+          width: 2.1rem;
+        }
+        .red {
+          color: #ff0000;
+        }
+        .normal {
+          .icon {
+            font-size: 0.28rem;
+            color: #333;
+            width: 0.5rem;
+            height: 0.5rem;
+            border-radius: 50%;
+            border: 1px solid #dcdcdc;
+            position: relative;
+            display: inline-block;
+            vertical-align: top;
+            margin-top: 0.32rem;
+            &.active .icon-next {
+              background: #226ce7;
+              width: 0.3rem;
+              height: 0.3rem;
+              border-radius: 50%;
+              position: absolute;
+              left: 50%;
+              top: 50%;
+              transform: translate3d(-50%, -50%, 0);
+            }
+          }
+        }
+        input {
+          width: 4.55rem;
+          font-size: 0.28rem;
+          height: 0.5rem;
+          line-height: 0.5rem;
+          color: #666;
+        }
+        .input {
+          width: 4.55rem;
+          font-size: 0.28rem;
+          color: #666;
+          position: relative;
+          i {
+            position: absolute;
+            right: 0;
+          }
+        }
+      }
+      .addinvoice-agree {
+        margin: 0.25rem 0.2rem 0;
+        font-size: 0.24rem;
+        color: #666;
+        input[type="checkbox"] + label::before {
+          content: "\a0";  /*不换行空格*/
+          display: inline-block;
+          width: 0.36rem;
+          height: 0.36rem;
+          vertical-align: top;
+          margin-right: .05rem;
+          border-radius: 0.07rem;
+          background-color: #fff;
+          text-indent: .15em;
+          border: 1px solid #226ce7;
+          line-height: 0.36rem;  /*行高不加单位,子元素将继承数字乘以自身字体尺寸而非父元素行高*/
+        }
+        input[type="checkbox"]:checked + label::before {
+          content: "\2713";
+          color: #226ce7;
+        }
+        input {
+          position: absolute;
+          clip: rect(0, 0, 0, 0);
+        }
+        a {
+          color: #226ce7
+        }
+      }
+      .addinvoice-controll {
+        font-size: 0.32rem;
+        color: #fff;
+        margin: 0.5rem 0.2rem 0;
+        div {
+          width: 3.16rem;
+          @include lineHeight(0.77rem);
+          border-radius: 0.07rem;
+          text-align: center;
+          &:first-child {
+            background: #bfbfbf;
+          }
+          &:last-child {
+            background: #3f84f6
+          }
+        }
+      }
+    }
+  }
+</style>

+ 2 - 1
components/mobile/center/index.js

@@ -1,3 +1,4 @@
 import Seek from './Seek.vue'
 import Message from './Message.vue'
-export { Seek, Message }
+import addinvoice from './addinvoice.vue'
+export { Seek, Message, addinvoice }

+ 4 - 0
pages/mobile/center/user/index.vue

@@ -38,6 +38,10 @@
             <img src="/images/mobile/center/user/cart.jpg" alt="">
             <p>购物车<span class="text" v-if="carCount > 0">{{carCount && carCount >= 99 ? 99 : carCount || 0}}</span></p>
           </nuxt-link>
+          <nuxt-link tag="li" to="/mobile/center/user/invoice" class="content-line">
+            <img src="/images/mobile/center/user/invoice_icon.png" alt="">
+            <p>发票管理</p>
+          </nuxt-link>
           <nuxt-link tag="li" to="/mobile/center/user/collect/component" class="content-line">
             <img src="/images/mobile/center/user/comp-collect2.png" alt="">
             <p>器件收藏<span class="text" v-if="compCount.data > 0">{{compCount.data && compCount.data >= 99 ? 99 : compCount.data || 0}}</span></p>

+ 444 - 0
pages/mobile/center/user/invoice/index.vue

@@ -0,0 +1,444 @@
+<template>
+  <div class="invoice-wrapper">
+    <div class="order-nav">
+      <div class="active" @click="changeTab('')"><span>开票信息</span></div>
+      <nuxt-link to="/mobile/center/user/invoice/waitinvoice" tag="div"><span>待开票信息</span></nuxt-link>
+      <div @click="changeTab('comfirmed')"><span>开票记录</span></div>
+    </div>
+    <div class="invoice-top clearfix">
+      <div class="pull-left">已设置的开票信息</div>
+      <div class="pull-right" v-if="invoiceList.length !== 2" @click="addInvoiceNew()"><img src="/images/mobile/center/user/icon-rm-invoice.png"/>新增发票</div>
+    </div>
+    <div class="invoice-middle" v-if="invoiceList.length > 0">
+      <div v-for="(item, index) in invoiceList">
+        <!-- 普票 -->
+        <div class="invoice-normal" v-if="item.kind === 1206">
+          <div class="invoice-list clearfix">
+            <div class="invoice-list-title pull-left">发票类型:</div>
+            <div class="pull-right normal-primary">普票</div>
+          </div>
+
+          <div class="invoice-list clearfix">
+            <div class="invoice-list-title pull-left">开票抬头:</div>
+            <div class="pull-right">{{item.head}}</div>
+          </div>
+
+          <div class="invoice-list clearfix">
+            <div class="invoice-list-title pull-left">收票人:</div>
+            <div class="pull-right">{{item.name}}</div>
+          </div>
+
+          <div class="invoice-list clearfix">
+            <div class="invoice-list-title pull-left">收票人电话:</div>
+            <div class="pull-right">{{item.telephone}}</div>
+          </div>
+
+          <div class="invoice-list clearfix">
+            <div class="invoice-list-title pull-left">收票地址:</div>
+            <div class="pull-right">
+              <p>{{item.area}}</p>
+              <p>{{item.detailAddress}}</p>
+            </div>
+          </div>
+
+          <div class="invoice-controll clearfix">
+            <div class="pull-left" @click="updateInvoice(item, index)"><i class="iconfont icon-edit" ></i>修改</div>
+            <div class="pull-left" @click="deleteInvoice(item, index)"><i class="iconfont icon-lajitong" ></i>删除</div>
+          </div>
+        </div>
+        <!-- 专票 -->
+        <div :style="!hasnormal ? '': 'margin-top: 0.24rem'" class="invoice-normal invoice-speci" v-else-if="item.kind === 1205">
+          <div class="invoice-list clearfix">
+            <div class="invoice-list-title pull-left">发票类型:</div>
+            <div class="pull-right normal-primary">专票</div>
+          </div>
+
+          <div class="invoice-list clearfix">
+            <div class="invoice-list-title pull-left">开票抬头:</div>
+            <div class="pull-right">{{item.head}}</div>
+          </div>
+
+          <div class="invoice-list clearfix">
+            <div class="invoice-list-title pull-left">单位地址:</div>
+            <div class="pull-right overhiden">{{item.companyAddress}}</div>
+          </div>
+
+          <div class="invoice-list clearfix">
+            <div class="invoice-list-title pull-left">收票电话:</div>
+            <div class="pull-right">{{item.companyPhone}}</div>
+          </div>
+
+          <div class="invoice-list clearfix">
+            <div class="invoice-list-title pull-left">税务登记号:</div>
+            <div class="pull-right">{{item.companyTaxNumber}}</div>
+          </div>
+
+          <div class="invoice-list clearfix">
+            <div class="invoice-list-title pull-left">开户银行:</div>
+            <div class="pull-right">{{item.bankName}}</div>
+          </div>
+
+          <div class="invoice-list clearfix">
+            <div class="invoice-list-title pull-left">开户银行账号:</div>
+            <div class="pull-right">{{item.bankAccount}}</div>
+          </div>
+
+          <div class="invoice-list clearfix">
+            <div class="invoice-list-title pull-left">收票人:</div>
+            <div class="pull-right">{{item.name}}</div>
+          </div>
+
+          <div class="invoice-list clearfix">
+            <div class="invoice-list-title pull-left">联系电话:</div>
+            <div class="pull-right">{{item.telephone}}</div>
+          </div>
+
+          <div class="invoice-list clearfix">
+            <div class="invoice-list-title pull-left">收票地址:</div>
+            <div class="pull-right">
+              <p>{{item.area}}</p>
+              <p>{{item.detailAddress}}</p>
+            </div>
+          </div>
+
+          <div class="invoice-controll clearfix">
+            <div class="pull-left" @click="updateInvoice(item, index)"><i class="iconfont icon-edit" ></i>修改</div>
+            <div class="pull-left" @click="deleteInvoice(item, index)"><i class="iconfont icon-lajitong" ></i>删除</div>
+          </div>
+        </div>
+      </div>
+    </div>
+    <div class="com-none-state" v-if="invoiceList.length === 0">
+      <img src="/images/mobile/@2x/empty-collect.png">
+      <p>抱歉,暂无发票消息</p>
+    </div>
+    <div class="deleteKuang" v-if="showDeleteAlert" @touchmove="preventTouchMove($event)">
+      <div class="kuangContent">
+        <div class="title">删除信息</div>
+        <div class="titleinfo">是否删除此订单</div>
+        <!--<div class="info" v-show="isUploadpro">*存在已上架信息</div>-->
+        <div class="K_btn">
+          <div class="cancelBtn" @click="showDeleteAlert = false">取消</div>
+          <div class="answerBtn" @click="deleteFn()">确定</div>
+        </div>
+      </div>
+    </div>
+
+    <remind-box :title="collectResult" :timeoutCount="timeoutCount"></remind-box>
+
+   <addinvoice
+     :chooseItem="chooseItem"
+     @addinvoiceBtn="addinvoiceFn"
+     v-if="showAddinvoice"
+     :isSaveinvoiceType="$kind"
+     :joinType="joinType"
+   ></addinvoice>
+  </div>
+</template>
+
+<script>
+  import axios from '~plugins/axios'
+  import { RemindBox } from '~components/mobile/common'
+  import { addinvoice } from '~components/mobile/center'
+  export default {
+    name: 'invoice-view',
+    layout: 'mobile',
+    middleware: 'authenticated',
+    data() {
+      return {
+        activeType: '',
+        invoiceList: [],
+        hasnormal: false, // 是否拥有普票
+        showDeleteAlert: false,
+        collectResult: '',
+        timeoutCount: 0,
+        chooseItem: {},
+        showAddinvoice: false,
+        $kind: 0,
+        joinType: 'add'
+      }
+    },
+    async asyncData() {
+      let { data } = await axios.get('/trade/bill/list/personal')
+      let _arr = []
+      data.forEach(obj => {
+        if (obj.kind === 1206) {
+          _arr.splice(0, 0, obj)
+        } else {
+          _arr.push(obj)
+        }
+      })
+      let hasnormal = data.find(item => {
+        return item.kind === 1206
+      })
+      return {
+        invoiceList: _arr,
+        hasnormal: hasnormal
+      }
+    },
+    methods: {
+      changeTab(str) {
+        this.activeType = str
+      },
+      deleteInvoice(item, index) {
+        this.$item = item
+        this.$index = index
+        this.showDeleteAlert = true
+      },
+      async addinvoiceFn(ty, item) {
+        this.showAddinvoice = false
+        if (ty) {
+          let { data } = await axios.get('/trade/bill/list/personal')
+          let _arr = []
+          data.forEach(obj => {
+            if (obj.kind === 1206) {
+              _arr.splice(0, 0, obj)
+            } else {
+              _arr.push(obj)
+            }
+          })
+          let hasnormal = data.find(item => {
+            return item.kind === 1206
+          })
+          this.invoiceList = _arr
+          this.hasnormal = hasnormal
+        }
+      },
+      updateInvoice(item, index) {
+        this.joinType = 'update'
+        this.chooseItem = item
+        this.$kind = 0
+        this.showAddinvoice = true
+      },
+      addInvoiceNew() {
+        this.joinType = 'add'
+        this.$kind = this.invoiceList.length > 0 ? this.invoiceList[0].kind : 0
+        this.chooseItem = {}
+        this.showAddinvoice = true
+      },
+      deleteFn() {
+        this.$http.delete(`/trade/bill/delete/${this.$item.id}`).then(res => {
+          this.setRemindText('删除成功')
+          this.showDeleteAlert = false
+          this.invoiceList.splice(this.$index, 1)
+        })
+      },
+      setRemindText(str) {
+        this.collectResult = str
+        this.timeoutCount++
+      }
+    },
+    components: {
+      RemindBox,
+      addinvoice
+    }
+  }
+</script>
+
+<style lang="scss" scoped>
+  @import '~assets/scss/mobileInvoice';
+  @mixin overFlowHidden {
+    overflow: hidden;
+    text-overflow: ellipsis;
+    white-space: nowrap;
+  }
+  @mixin lineHeight($value) {
+    height: $value;
+    line-height: $value;
+  }
+  .invoice-wrapper {
+    background: #f1f3f6;
+    margin: 1.26rem 0 0.98rem 0;
+    height: calc(100vh - 1.26rem - 0.98rem);
+    overflow-y: scroll;
+    .order-nav {
+      background: #fff;
+      div {
+        height: 0.82rem;
+        line-height: 0.82rem;
+        display: inline-block;
+        width: 33.3%;
+        text-align: center;
+        font-size: .28rem;
+        color: #666;
+        &.active span{
+          color: #3f84f6;
+          border-bottom: 0.04rem solid #3f84f6;
+          padding-bottom: 0.2rem;
+        }
+      }
+    }
+    .invoice-top {
+      padding: 0 0.3rem;
+      font-weight: bold;
+      font-size: 0.28rem;
+      color: #333;
+      @include lineHeight(0.78rem);
+      img {
+        width: 0.29rem;
+        vertical-align: top;
+        height: 0.33rem;
+        margin-top: 0.22rem;
+        margin-right: 0.04rem;
+      }
+    }
+    .invoice-middle {
+      padding-bottom: 0.4rem;
+      .invoice-normal {
+        font-size: 0.28rem;
+        line-height: 0.76rem;
+        background: #fff;
+        margin: 0 0.3rem;
+        color: #333;
+        .invoice-list {
+          .pull-right {
+            max-width: 4.4rem;
+            text-align: right;
+          }
+          .overhiden {
+            @include overFlowHidden()
+          }
+          border-bottom: 1px solid #d9d9d9;
+          padding: 0 0.24rem;
+          .invoice-list-title {
+            color: #666;
+            width: 2rem;
+            display: inline-block;
+            text-align: justify;
+            vertical-align: top;
+            height: 0.76rem;
+            &:after {
+              content: '';
+              display: inline-block;
+              width: 100%;
+              overflow: hidden;
+              height: 0;
+            }
+          }
+          p {
+            line-height: 0.4rem;
+          }
+          &:nth-last-of-type(2){
+            padding: 0.2rem 0.24rem;
+          }
+          .normal-primary {
+            margin-top: 0.24rem;
+            color: #15b262;
+            font-size: 0.24rem;
+            width: 0.7rem;
+            @include lineHeight(0.32rem);
+            text-align: center;
+            border-radius: 0.07rem;
+            border: 1px solid #15b262;
+            background: #e7f7ef;
+          }
+        }
+      }
+      .invoice-speci {
+        .invoice-list {
+          .normal-primary {
+            background: #fff5e5;
+            color: #fe9d03;
+            border: 1px solid #fe9d03;
+          }
+        }
+      }
+      .invoice-controll {
+        color: #333;
+        text-align: center;
+        font-size: 0.26rem;
+        @include lineHeight(0.8rem);
+        div {
+          width: 50%;
+          &:nth-child(1) {
+            border-right: 1px solid #d9d9d9;
+          }
+        }
+        .icon-edit {
+          font-size: 0.34rem;
+          vertical-align: top;
+          margin-top: 0.02rem;
+        }
+        .icon-lajitong {
+          font-size: 0.35rem;
+          vertical-align: top;
+          margin-top: 0.02rem;
+        }
+      }
+    }
+    .com-none-state {
+      background: #fff;
+      margin: 0 0.3rem;
+      padding-bottom: 2rem;
+      width: auto;
+    }
+    .deleteKuang {
+      position: fixed;
+      background: rgba(0,0,0,0.5);
+      top: 0;
+      left: 0;
+      right: 0;
+      bottom: 0;
+      z-index: 9999;
+      .kuangContent {
+        border-radius: 5px;
+        background: #fff;
+        width: 5rem;
+        position: absolute;
+        left: 50%;
+        top: 50%;
+        transform: translate3d(-50%, -50%, 0);
+        overflow: hidden;
+        .titleinfo {
+          font-size: .3rem;
+          color: #666;
+          text-align: center;
+          margin-top: 0.5rem;
+          margin-bottom: 0.1rem;
+        }
+        .title {
+          background: #5078cb;
+          height: .7rem;
+          line-height: .7rem;
+          font-size: .3rem;
+          color: #fff;
+          text-align: center;
+        }
+        .info {
+          color: #f00;
+          text-align: center;
+        }
+        .K_btn {
+          margin-top: 0.4rem;
+          line-height: 0.7rem;
+          height: 0.7rem;
+          &::after{
+            clear: both;
+            display: block;
+            content: ' ';
+            visibility: hidden;
+            zoom: 1;
+          }
+          div {
+            float: left;
+            width: 50%;
+            font-size: 0.3rem;
+            text-align: center;
+            &.cancelBtn {
+              background: #b4b5b9;
+              color: #333;
+            }
+            &.answerBtn {
+              background: #5078cb;
+              color: #fff;
+            }
+          }
+        }
+      }
+    }
+    .mi-remind-area {
+      background: #fff;
+    }
+  }
+</style>
+

+ 306 - 0
pages/mobile/center/user/invoice/waitinvoice.vue

@@ -0,0 +1,306 @@
+<template>
+  <div class="invoice-wrapper">
+    <div class="order-nav">
+      <div><span>开票信息</span></div>
+      <div class="active"><span>待开票信息</span></div>
+      <div><span>开票记录</span></div>
+    </div>
+    <div class="mobile-invoice">
+      <div class="mi-remind-area">
+        <p class="title">温馨提示</p>
+        <p class="content">
+          <span class="inline-block">1、</span>
+          <span class="inline-block">申请发票时默认将同一店铺的订单合并开一张发票,如需分开开票,请分别申请;</span>
+        </p>
+        <p class="content">
+          <span class="inline-block">2、</span>
+          <span class="inline-block">您只能对订单状态为<b>“交易完成”</b>,且已不能再发起售后的人民币交易订单进行补开发票;</span>
+        </p>
+        <p class="content">
+          <span class="inline-block">3、</span>
+          <span class="inline-block">发票金额为产品总金额且不含运费、积分、优惠卷、促销折扣等金额;</span>
+        </p>
+        <p class="content">
+          <span class="inline-block">4、</span>
+          <span class="inline-block">发票邮寄费用将由卖家承担。</span>
+        </p>
+      </div>
+      <div class="search-content mi-search-content">
+        <input type="text" placeholder="商家名称/订单号" v-model="keyword">
+        <span @click="searchMore()"><i class="iconfont icon-sousuo"></i></span>
+      </div>
+      <div class="mi-list-content">
+        <ul class="mi-list">
+          <li v-for="inv in invoiceList" @click.stop="setActive(inv)" :class="{active: inv.$active}">
+            <div class="line">
+              <span class="inline-block title">
+                 <label class="bottom-modal-check mobile-cart-check" :class="{active: inv.$active}">
+                   <input type="checkbox">
+                 </label>
+                商家名称:
+              </span>
+              <span class="inline-block content" @click.stop="toShopdetails(inv)">{{inv.sellername}}</span>
+            </div>
+            <div class="line">
+              <span class="inline-block title">
+                订单号:
+              </span>
+              <span class="inline-block content" @click.stop="lookOrderDetail(inv)">
+              {{inv.orderid}}
+              </span>
+            </div>
+            <div class="line">
+              <span class="inline-block title">
+                可开票金额(¥):
+              </span>
+              <span class="inline-block content pri">{{inv.price}}</span>
+            </div>
+          </li>
+        </ul>
+      </div>
+      <div class="mi-fix-result">
+        <label class="bottom-modal-check mobile-cart-check" :class="{active: allChecked}">
+          <input type="checkbox" @change="setActive()">
+          <span>全选</span>
+        </label>
+        <button @click="applyInvoice()">申请开票</button>
+      </div>
+    </div>
+    <remind-box :title="collectResult" :timeoutCount="timeoutCount"></remind-box>
+
+    <addinvoice
+      :chooseItem="chooseItem"
+      @addinvoiceBtn="addinvoiceFn"
+      v-if="showAddinvoice"
+      :isSaveinvoiceType="$kind"
+      :joinType="joinType"
+    ></addinvoice>
+
+    <pull-up :searchMore="fetching" :allPage="invoices.data.totalPages" :page="page" @pullUpAction="onPullUp"></pull-up>
+  </div>
+</template>
+
+<script>
+  import { EncryptionFilter } from '~utils/tools.js'
+  import axios from '~plugins/axios'
+  import { RemindBox, PullUp } from '~components/mobile/common'
+  import { addinvoice } from '~components/mobile/center'
+  export default {
+    name: 'invoice-view',
+    layout: 'mobile',
+    middleware: 'authenticated',
+    computed: {
+      invoices () {
+        return this.$store.state.invoice.data.Buyerinvoices
+      },
+      fetching () {
+        return this.invoices.fetching
+      },
+      listActiveFlag () {
+        let allChecked = true
+        for (let i = 0; i < this.invoiceList.length; i++) {
+          if (!this.invoiceList[i].$active) {
+            allChecked = false
+            break
+          }
+        }
+        return allChecked
+      },
+      allChecked () {
+        return this.invoiceList.length && this.listActiveFlag
+      }
+    },
+    fetch ({store}) {
+      return Promise.all([
+        store.dispatch('invoice/getBuyerInvoices', {count: 10, keyword: '', page: 1, sorting: {'creattime': 'DESC'}, status: 520})
+      ])
+    },
+    watch: {
+      '$store.state.invoice.data.Buyerinvoices.data': {
+        handler: function (val) {
+          if (val && val.content) {
+            if (this.isChange) {
+              this.invoiceList = []
+              this.isChange = false
+            }
+            let arr = this.baseUtils.deepCopy(val.content)
+            arr.forEach(item => {
+              item.$active = false
+            })
+            this.invoiceList = [...this.invoiceList, ...arr]
+          }
+        },
+        immediate: true
+      }
+    },
+    data() {
+      return {
+        activeType: '',
+        invoiceList: [],
+        collectResult: '',
+        timeoutCount: 0,
+        chooseItem: {},
+        showAddinvoice: false,
+        $kind: 0,
+        joinType: 'add',
+        keyword: '',
+        page: 1
+      }
+    },
+    async asyncData() {
+      // let { data } = await axios.get('/trade/bill/list/personal')
+      // let _arr = []
+      // data.forEach(obj => {
+      //   if (obj.kind === 1206) {
+      //     _arr.splice(0, 0, obj)
+      //   } else {
+      //     _arr.push(obj)
+      //   }
+      // })
+      // let hasnormal = data.find(item => {
+      //   return item.kind === 1206
+      // })
+      // return {
+      //   invoiceList: _arr,
+      //   hasnormal: hasnormal
+      // }
+    },
+    methods: {
+      setActive (inv) {
+        if (inv) {
+          inv.$active = !inv.$active
+        } else {
+          // 先存储 否则会重新计算
+          let flag = !this.allChecked
+          this.invoiceList.forEach(item => {
+            item.$active = flag
+          })
+        }
+      },
+      async addinvoiceFn(ty, item) {
+        this.showAddinvoice = false
+        if (ty) {
+          let { data } = await axios.get('/trade/bill/list/personal')
+          let _arr = []
+          data.forEach(obj => {
+            if (obj.kind === 1206) {
+              _arr.splice(0, 0, obj)
+            } else {
+              _arr.push(obj)
+            }
+          })
+          let hasnormal = data.find(item => {
+            return item.kind === 1206
+          })
+          this.invoiceList = _arr
+          this.hasnormal = hasnormal
+        }
+      },
+      setRemindText(str) {
+        this.collectResult = str
+        this.timeoutCount++
+      },
+      // 店铺详情页
+      toShopdetails(item) {
+        this.$router.push(`/mobile/shop/${item.storeid}`)
+      },
+      // 查看订单详情
+      lookOrderDetail(item) {
+        let id = EncryptionFilter(item.orderid)
+        this.$router.push(`/mobile/order/details?uuid=${id}&type=buyer&paytype=${item.paytype}`)
+      },
+      // 申请开票
+      applyInvoice() {
+        let _arr = []
+        let _orderNum = 0
+        this.invoiceList.forEach(obj => {
+          if (obj.$active) {
+            _orderNum++
+            let _find = this._arr.find($it => {
+              return $it.storeid === obj.storeid
+            })
+            _find.orderAllPrice += obj.price
+          }
+        })
+      },
+      reloadList () {
+        this.isChange = true
+        this.$store.dispatch('invoice/getBuyerInvoices', {count: 10, page: this.page, keyword: this.keyword, sorting: {'creattime': 'DESC'}, status: 520})
+      },
+      searchMore() {
+        this.page = 1
+        this.reloadList()
+      },
+      onPullUp () {
+        this.page++
+        this.reloadList()
+      }
+    },
+    components: {
+      RemindBox,
+      addinvoice,
+      PullUp
+    }
+  }
+</script>
+
+<style lang="scss" scoped>
+  @import '~assets/scss/mobileInvoice';
+  @mixin overFlowHidden {
+    overflow: hidden;
+    text-overflow: ellipsis;
+    white-space: nowrap;
+  }
+  @mixin lineHeight($value) {
+    height: $value;
+    line-height: $value;
+  }
+  .invoice-wrapper {
+    background: #f1f3f6;
+    margin: 2.08rem 0 0.98rem 0;
+    height: calc(100vh - 1.26rem - 0.98rem - 1.06rem - 0.82rem);
+    overflow-y: scroll;
+    .order-nav {
+      background: #fff;
+      position: fixed;
+      width: 100%;
+      top: 1.26rem;
+      div {
+        height: 0.82rem;
+        line-height: 0.82rem;
+        display: inline-block;
+        width: 33.3%;
+        text-align: center;
+        font-size: .28rem;
+        color: #666;
+        &.active span{
+          color: #3f84f6;
+          border-bottom: 0.04rem solid #3f84f6;
+          padding-bottom: 0.2rem;
+        }
+      }
+    }
+    .mi-remind-area {
+      margin-top: 0.24rem;
+      background: #fff;
+    }
+    .mi-list-content .mi-list li {
+      background: #fff;
+      &:nth-child(1) {
+        margin-top: 0;
+      }
+    }
+    .mi-search-content input {
+      width: 7rem;
+      margin: 0;
+    }
+    .mobile-invoice .mi-list-content .mi-list li .line .content {
+      padding: 0;
+      color: #3976f4;
+      &.pri {
+        color: #ee1111
+      }
+    }
+  }
+</style>
+

+ 4 - 4
pages/mobile/center/vendor/index.vue

@@ -58,10 +58,10 @@
             <img src="/images/mobile/center/user/finance_icon.png" alt="">
             <p>财务对账</p>
           </nuxt-link>
-          <!--<nuxt-link tag="li" to="/">-->
-            <!--<img src="/images/mobile/center/user/invoice_icon.png" alt="">-->
-            <!--<p>发票管理</p>-->
-          <!--</nuxt-link>-->
+          <nuxt-link tag="li" to="/">
+            <img src="/images/mobile/center/user/invoice_icon.png" alt="">
+            <p>发票管理</p>
+          </nuxt-link>
           <nuxt-link tag="li" to="/mobile/center/vendor/message"  v-if="user.data.enterprise.uu">
             <img src="/images/mobile/center/user/message.png" alt="">
             <p>消息中心<span class="text" v-if="messageCount.count > 0">{{messageCount.count && messageCount.count >= 99 ? 99 : messageCount.count || 0}}</span></p>

+ 1 - 1
pages/mobile/user/address.vue

@@ -20,7 +20,7 @@
     },
     components: {
       AddressView,
-      AddressEdit
+      AddressEdit,
     },
     data () {
       return {

BIN
static/images/mobile/center/user/icon-rm-invoice.png


+ 10 - 0
store/invoice.js

@@ -10,5 +10,15 @@ export const actions = {
       }, err => {
         commit('data/GET_INV_FAILURE', err)
       })
+  },
+  // 获取买家开票列表
+  getBuyerInvoices ({ commit }, params = {}) {
+    commit('data/REQUEST_BUYERINV')
+    return axios.get('/trade/order/bill/status/personal', {params})
+      .then(response => {
+        commit('data/GET_BUYERINV_SUCCESS', response.data)
+      }, err => {
+        commit('data/GET_BUYERINV_FAILURE', err)
+      })
   }
 }

+ 14 - 0
store/invoice/data.js

@@ -2,6 +2,10 @@ export const state = () => ({
   invoices: {
     fetching: false,
     data: []
+  },
+  Buyerinvoices: {
+    fetching: false,
+    data: []
   }
 })
 
@@ -15,5 +19,15 @@ export const mutations = {
   GET_INV_SUCCESS (state, result) {
     state.invoices.fetching = false
     state.invoices.data = result
+  },
+  REQUEST_BUYERINV (state) {
+    state.Buyerinvoices.fetching = true
+  },
+  GET_BUYERINV_FAILURE (state) {
+    state.Buyerinvoices.fetching = false
+  },
+  GET_BUYERINV_SUCCESS (state, result) {
+    state.Buyerinvoices.fetching = false
+    state.Buyerinvoices.data = result
   }
 }