Browse Source

卖家发票申请开票

yangc 7 years ago
parent
commit
344da3a5b2

+ 60 - 0
assets/scss/mobileCommon.scss

@@ -1,3 +1,4 @@
+$base-color: #3f84f6;
 html {
   overflow-y: scroll;
   -webkit-text-size-adjust: 100%;
@@ -612,3 +613,62 @@ table.com-price-list {
   bottom: 0;
   background: rgb(255, 255, 255);
 }
+
+// 头部切换
+.com-switch-head {
+  height: .82rem;
+  line-height: .82rem;
+  text-align: center;
+  background: #fff;
+  .com-switch-item {
+    font-size: .28rem;
+    &:first-child {
+      margin-right: 1.24rem;
+    }
+    &.active {
+      color: #3f84f6;
+      border-bottom: 1px solid #3f84f6;
+    }
+  }
+}
+
+
+.com-select-wrap {
+  position: relative;
+  width: 1.25rem;
+  height: .5rem;
+  line-height: .5rem;
+  font-size: .28rem;
+  color: #666;
+  border: 1px solid #bfbfbf;
+  border-radius: .04rem;
+  margin: 0 auto;
+  text-align: left;
+  padding: 0 .23rem;
+  background: url('/images/mobile/select-arrow.png')no-repeat;
+  background-size: .12rem .06rem;
+  background-position: .94rem .2rem;
+  .select-list {
+    position: absolute;
+    left: -.02rem;
+    top: .48rem;
+    border: 1px solid #bfbfbf;
+    width: 1.25rem;
+    -webkit-box-shadow: 0 1px 5px 0 #aaa;
+    -moz-box-shadow: 0 1px 5px 0 #aaa;
+    box-shadow: 0 1px 5px 0 #aaa;
+    border-radius: .04rem;
+    li {
+      background: #fff;
+      text-align: left;
+      padding: 0 .2rem;
+      font-size: .28rem;
+      height: .53rem;
+      line-height: .53rem;
+      &:active, &:focus {
+        background: $base-color;
+        color: #fff;
+      }
+    }
+  }
+}

+ 115 - 0
assets/scss/mobileInvoice.scss

@@ -0,0 +1,115 @@
+$blue-base: #3f84f6;
+.mobile-invoice {
+  .switch-head {
+    border-bottom: .28rem solid #f1f3f6;
+  }
+  .mi-remind-area {
+    padding: .24rem .29rem;
+    font-size: .28rem;
+    color: #333;
+    line-height: .42rem;
+    .content {
+      word-break: break-all;
+      color: #666;
+      span {
+        &:first-child {
+          vertical-align: top;
+          width: 6%;
+        }
+        &:last-child {
+          width: 94%;
+        }
+      }
+    }
+  }
+  .mi-search-content {
+    padding: .24rem 0;
+    text-align: center;
+    background: #f1f3f6;
+    input {
+      border: 1px solid $blue-base;
+    }
+  }
+  .mi-list-content {
+    padding: 0 .3rem;
+    .mi-lc-filters {
+      padding-top: .1rem;
+      border-bottom: 1px solid #dcdcdc;
+    }
+    .mi-list {
+      font-size: .28rem;
+      li {
+        margin: .3rem 0;
+        border-radius: .06rem;
+        border: 1px solid #aaa;
+        &.active {
+          border-color: $blue-base;
+        }
+        .line {
+          border-bottom: 1px solid #dcdcdc;
+          word-break: break-all;
+          padding: .26rem;
+          .title {
+            width: 33%;
+            text-align: right;
+            color: #666;
+            vertical-align: top;
+          }
+          .content {
+            width: 67%;
+            text-align: right;
+            padding-right: .44rem;
+            padding-left: .6rem;
+            color: #333;
+            .inv {
+              width: .7rem;
+              height: .32rem;
+              line-height: .32rem;
+              text-align: center;
+              font-size: .24rem;
+              border-radius: .04rem;
+              background: rgba(21, 178, 98, .1);
+              border: 1px solid rgba(21, 178, 98, .1);
+              color: #15b262;
+              font-style: normal;
+              display: block;
+              float: right;
+              &.spec-inv {
+                background: rgba(254, 157, 3, .1);
+                border: 1px solid rgba(254, 157, 3, .1);
+                color: #fe9d03;
+              }
+            }
+          }
+          .price {
+            color: #ee1111;
+          }
+          .link {
+            color: $blue-base;
+          }
+        }
+      }
+    }
+  }
+  .mi-fix-result {
+    position: fixed;
+    bottom: .98rem;
+    height: 1.06rem;
+    width: 100%;
+    line-height: 1.06rem;
+    padding: 0 .3rem;
+    background: #fff;
+    border-top: 1px solid #bfbfbf;
+    button {
+      float: right;
+      width: 2.48rem;
+      height: .77rem;
+      line-height: .77rem;
+      font-size: .32rem;
+      color: #fff;
+      background: $blue-base;
+      border-radius: .08rem;
+      margin-top: .15rem;
+    }
+  }
+}

+ 1 - 1
components/mobile/MobileFooter.vue

@@ -33,7 +33,7 @@
         <i :class="activeType=='user'?'iconfont icon-icon':'iconfont icon-wo'"></i><p>我</p>
       </a>
     </span>
-    <a @click="toTop" v-show="!hideToTop"><i class="iconfont icon-arrow-up icon-xlg"></i></a>
+    <a @click.stop="toTop" v-show="!hideToTop"><i class="iconfont icon-arrow-up icon-xlg"></i></a>
     <login-box :url="url" @onLoginBoxClose="showLoginBox = false" v-if="showLoginBox"></login-box>
     <!--<publish-seek :showSayPriceBox="showSayPriceBox" @cancelAction="showSayPriceBox = false" @reloadAction="onReload" @remindAction="onRemind"></publish-seek>-->
     <remind-box :title="remindText" :timeoutCount="timeoutCount"></remind-box>

+ 206 - 0
pages/mobile/center/vendor/invoice/index.vue

@@ -0,0 +1,206 @@
+<template>
+  <div class="mobile-invoice mobile-content mobile-content-long vendor-invoice">
+    <div class="switch-head">
+      <div class="com-switch-head">
+        <span class="active com-switch-item inline-block">买家开票申请</span>
+        <span class="com-switch-item inline-block">开票记录</span>
+      </div>
+    </div>
+    <div class="mi-remind-area">
+      <p class="title">温馨提示</p>
+      <p class="content">
+        <span class="inline-block">1、</span>
+        <span class="inline-block">买家只能对订单状态为<b>“交易成功”</b>,且已不能再发起售后的人民币交易订单进行补开发票。</span>
+      </p>
+      <p class="content">
+        <span class="inline-block">2、</span>
+        <span class="inline-block">发票金额为产品总金额且不含运费、积分、优惠券、促销折扣等金额。</span>
+      </p>
+      <p class="content">
+        <span class="inline-block">3、</span>
+        <span class="inline-block">发票邮寄费用将由卖家承担。</span>
+      </p>
+    </div>
+    <div class="search-content mi-search-content">
+      <input type="text" placeholder="订单号/发票抬头/收票人/联系电话">
+      <span><i class="iconfont icon-sousuo"></i></span>
+    </div>
+    <div class="mi-list-content">
+      <div class="mi-lc-filters clearfix">
+        <div class="com-select-wrap fr">类型
+          <ul class="select-list">
+            <li>普票</li>
+            <li>专票</li>
+          </ul>
+        </div>
+      </div>
+      <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">
+              <i class="inv" :class="{'spec-inv' : inv.type === 1205}">{{inv.type === 1206 ? '普票' : '专票'}}</i>
+            </span>
+          </div>
+          <div class="line">
+            <span class="inline-block title">
+              申请时间:
+            </span>
+            <span class="inline-block content">{{inv.createTime | date}}</span>
+          </div>
+          <div class="line">
+            <span class="inline-block title">
+              订单号:
+            </span>
+            <span class="inline-block content">
+              <template v-for="id in inv.orderidArr">
+                {{id}}
+                <br/>
+              </template>
+            </span>
+          </div>
+          <div class="line">
+            <span class="inline-block title">
+              可开票金额(¥):
+            </span>
+            <span class="inline-block content">{{inv.price}}</span>
+          </div>
+          <div class="line">
+            <span class="inline-block title">
+              发票抬头:
+            </span>
+            <span class="inline-block content">{{inv.invoicetitle}}</span>
+          </div>
+          <div class="line">
+            <span class="inline-block title">
+              收票人:
+            </span>
+            <span class="inline-block content">{{inv.receiverName}}</span>
+          </div>
+          <div class="line">
+            <span class="inline-block title">
+              联系电话:
+            </span>
+            <span class="inline-block content">{{inv.recTel}}</span>
+          </div>
+          <div class="line">
+            <span class="inline-block title">
+              收票地址:
+            </span>
+            <span class="inline-block content">{{inv.invoiceAddress}}</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>确认开票</button>
+    </div>
+    <remind-box :title="remindText" :timeoutCount="timeoutCount"></remind-box>
+    <pull-up :searchMore="fetching" :allPage="invoices.data.totalPages" :page="page" @pullUpAction="onPullUp"></pull-up>
+  </div>
+</template>
+<script>
+  import { RemindBox, PullUp } from '~components/mobile/common'
+  export default {
+    layout: 'mobile',
+    middleware: 'authenticated',
+    data () {
+      return {
+        remindText: '',
+        timeoutCount: '',
+        invoiceList: [],
+        isChange: false,
+        page: 1,
+        count: 10
+      }
+    },
+    components: {
+      RemindBox,
+      PullUp
+    },
+    fetch ({store}) {
+      return Promise.all([
+        store.dispatch('invoice/getInvoices', {count: 10, page: 1, role: 'SELLER', sorting: {'createTime': 'DESC'}, status: 101})
+      ])
+    },
+    watch: {
+      '$store.state.invoice.data.invoices.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.orderidArr = item.orderids.split(',')
+              item.$active = false
+            })
+            this.invoiceList = [...this.invoiceList, ...arr]
+          }
+        },
+        immediate: true
+      }
+    },
+    computed: {
+      invoices () {
+        return this.$store.state.invoice.data.invoices
+      },
+      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
+      }
+    },
+    methods: {
+      setRemindText: function (str) {
+        this.remindText = str
+        this.timeoutCount++
+      },
+      setActive (inv) {
+        if (inv) {
+          inv.$active = !inv.$active
+        } else {
+          // 先存储 否则会重新计算
+          let flag = !this.allChecked
+          this.invoiceList.forEach(item => {
+            item.$active = flag
+          })
+        }
+      },
+      reloadList () {
+        this.$store.dispatch('invoice/getInvoices', {count: this.count, page: this.page, role: 'SELLER', sorting: {'createTime': 'DESC'}, status: 101})
+      },
+      onPullUp () {
+        this.page++
+        this.reloadList()
+      }
+    }
+  }
+</script>
+<style lang="scss" scoped>
+  @import '~assets/scss/mobileInvoice';
+  .vendor-invoice {
+    margin-bottom: 2.3rem;
+  }
+</style>

+ 14 - 0
store/invoice.js

@@ -0,0 +1,14 @@
+import axios from '~/plugins/axios'
+
+export const actions = {
+  // 获取开票列表
+  getInvoices ({ commit }, params = {}) {
+    commit('data/REQUEST_INV')
+    return axios.get('/trade/billSubmit', {params})
+      .then(response => {
+        commit('data/GET_INV_SUCCESS', response.data)
+      }, err => {
+        commit('data/GET_INV_FAILURE', err)
+      })
+  }
+}

+ 19 - 0
store/invoice/data.js

@@ -0,0 +1,19 @@
+export const state = () => ({
+  invoices: {
+    fetching: false,
+    data: []
+  }
+})
+
+export const mutations = {
+  REQUEST_INV (state) {
+    state.invoices.fetching = true
+  },
+  GET_INV_FAILURE (state) {
+    state.invoices.fetching = false
+  },
+  GET_INV_SUCCESS (state, result) {
+    state.invoices.fetching = false
+    state.invoices.data = result
+  }
+}