|
@@ -0,0 +1,349 @@
|
|
|
+<template>
|
|
|
+ <div class="better-scroll wrapper" ref="wrapper">
|
|
|
+ <ul>
|
|
|
+ <li class="list" v-for="(item, index) in listData" :key="index"
|
|
|
+ @click="$emit('funSelect', item.orderId)">
|
|
|
+ <p class="add-time">下单时间:{{ item.orderCreatedTime }}</p>
|
|
|
+ <div class="select-wrap">
|
|
|
+ <div class="icon-wrap" v-if="$route.name === 'all'">
|
|
|
+ <img src="" alt="" v-show="selectedData.indexOf(item.orderId) > -1">
|
|
|
+ <i v-show="selectedData.indexOf(item.orderId) < 0"></i>
|
|
|
+ </div>
|
|
|
+ <div :class="$route.name === 'all' ? 'w-575' : 'w-640'">
|
|
|
+ <div class="goods-info">
|
|
|
+ <div class="left-wrap">
|
|
|
+ <img :src="item.productImg.imgUrl" alt="">
|
|
|
+ </div>
|
|
|
+ <div class="right-wrap">
|
|
|
+ <p>订单编号:{{ item.orderId }}</p>
|
|
|
+ <p>订单金额:¥{{ item.orderAmount }}</p>
|
|
|
+ <p>开票金额:¥{{ item.ableAmount }}</p>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <p class="good-list">包含商品:{{ funGetGoodsDetail(item.productInfo) }}</p>
|
|
|
+ <!--已开票订单列表,才展示这个按钮-->
|
|
|
+ <p class="jump-detail" v-if="$route.name === 'complete'" @click="funJumpDetail(item)">
|
|
|
+ <a href="javascript:;">查看发票</a>
|
|
|
+ </p>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </li>
|
|
|
+ <li class="bitmap" v-if="!listData.length && booFetchData">
|
|
|
+ <p>暂无记录</p>
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+ import BScroll from 'better-scroll'
|
|
|
+ import { Toast } from 'vant'
|
|
|
+ import axios from 'axios'
|
|
|
+
|
|
|
+ const PAGESIZE = 20
|
|
|
+ const eapiDomain = process.env.API_DOMAIN
|
|
|
+ export default {
|
|
|
+ name: 'mains',
|
|
|
+ props: {
|
|
|
+ numPositionY: {
|
|
|
+ type: Number,
|
|
|
+ default: 0
|
|
|
+ },
|
|
|
+ selectedData: {
|
|
|
+ type: Array,
|
|
|
+ default: function () {
|
|
|
+ return []
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 发票唯一编码
|
|
|
+ invoiceNo: {
|
|
|
+ type: String,
|
|
|
+ default: ''
|
|
|
+ }
|
|
|
+ },
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ pager: {
|
|
|
+ pagenum: 1,
|
|
|
+ pagesize: PAGESIZE
|
|
|
+ },
|
|
|
+ listData: [],
|
|
|
+ scroll: null,
|
|
|
+ numFetchStatus: 0,
|
|
|
+ arrFetchStatus: ['正在加载,请稍后~', '到底了'],
|
|
|
+ booFetchData: false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ activated () {
|
|
|
+ if (!this.$route.meta.isUseCache) {
|
|
|
+ this.pager = {
|
|
|
+ pagenum: 1,
|
|
|
+ pagesize: PAGESIZE
|
|
|
+ }
|
|
|
+ this.listData = []
|
|
|
+ this.numFetchStatus = 0
|
|
|
+ this.booFetchData = false
|
|
|
+ this.funFetch()
|
|
|
+ } else {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ if (this.scroll) {
|
|
|
+ this.scroll.refresh()
|
|
|
+ this.scroll.scrollTo(0, this.numPositionY)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ beforeDestroy () {
|
|
|
+ if (this.scroll) {
|
|
|
+ this.scroll.destroy()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ funFetch () {
|
|
|
+ const vm = this
|
|
|
+ const { CellPhoneParam } = vm.$root
|
|
|
+ let api = ''
|
|
|
+ let postData = {}
|
|
|
+ switch (vm.$route.name) {
|
|
|
+ case 'all':
|
|
|
+ api = '/web/ApiInvoice/getInvoiceOrderList'
|
|
|
+ postData = {
|
|
|
+ LoginCellphone: CellPhoneParam
|
|
|
+ }
|
|
|
+ break
|
|
|
+ case 'complete':
|
|
|
+ api = '/web/ApiInvoice/getHadInvoiceOrderList'
|
|
|
+ postData = {
|
|
|
+ LoginCellphone: CellPhoneParam
|
|
|
+ }
|
|
|
+ break
|
|
|
+ case 'order':
|
|
|
+ api = '/web/ApiInvoice/getInvoiceOrderByInvoiceNo'
|
|
|
+ postData = {
|
|
|
+ invoiceNo: this.invoiceNo
|
|
|
+ }
|
|
|
+ break
|
|
|
+ }
|
|
|
+ if (!CellPhoneParam) {
|
|
|
+ vm.$toast('未登录')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ axios.post(`${eapiDomain}${api}`, {
|
|
|
+ ...postData,
|
|
|
+ page: vm.pager.pagenum,
|
|
|
+ pageSize: vm.pager.pagesize
|
|
|
+ }).then(response => {
|
|
|
+ if (response.Status === 1) {
|
|
|
+ let list = []
|
|
|
+ switch (vm.$route.name) {
|
|
|
+ case 'all':
|
|
|
+ if (Object.keys(response.Data).indexOf('list') > -1) {
|
|
|
+ list = response.Data.list
|
|
|
+ }
|
|
|
+ break
|
|
|
+ case 'complete':
|
|
|
+ list = response.Data
|
|
|
+ break
|
|
|
+ case 'order':
|
|
|
+ list = response.Data
|
|
|
+ break
|
|
|
+ }
|
|
|
+ vm.pager.pagenum++
|
|
|
+ vm.booFetchData = true
|
|
|
+ if (list && list.length) {
|
|
|
+ vm.listData = vm.listData.concat(list)
|
|
|
+ if (vm.$route.name === 'all') {
|
|
|
+ vm.$emit('funGetInitData', vm.listData, response.Data.amount, response.Data.orderIdList)
|
|
|
+ }
|
|
|
+ vm.$nextTick(() => {
|
|
|
+ if (!vm.scroll) {
|
|
|
+ vm.scroll = new BScroll(vm.$refs.wrapper, {
|
|
|
+ click: true,
|
|
|
+ pullUpLoad: {
|
|
|
+ threshold: -20
|
|
|
+ },
|
|
|
+ scrollbar: true
|
|
|
+ })
|
|
|
+ vm.scroll.on('pullingUp', () => {
|
|
|
+ vm.funFetch()
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ vm.scroll.refresh()
|
|
|
+ vm.scroll.finishPullUp()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ Toast(response.ErrorMsg)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ funGetGoodsDetail (goods) {
|
|
|
+ return goods.map(item => item.bigCateName + 'x' + item.productNum).join(';')
|
|
|
+ },
|
|
|
+ funJumpDetail (item) {
|
|
|
+ if (item.isOfflineOpen === '是') {
|
|
|
+ this.$toast('线下开票订单,如有疑问,请联系客服处理')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.$router.push({ path: '/' })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+ .wrapper {
|
|
|
+ position: relative;
|
|
|
+ width: 100%;
|
|
|
+ height: calc(100vh - 124px);
|
|
|
+ margin-top: 124px;
|
|
|
+ overflow: hidden;
|
|
|
+
|
|
|
+ ul {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ align-items: center;
|
|
|
+ width: 100%;
|
|
|
+ padding: 0 0 300px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .list {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ align-items: center;
|
|
|
+ width: 694px;
|
|
|
+ border-radius: 6px;
|
|
|
+ margin-bottom: 19px;
|
|
|
+ background: #fff;
|
|
|
+
|
|
|
+ &:nth-last-child(1) {
|
|
|
+ margin-bottom: 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ .add-time {
|
|
|
+ width: 100%;
|
|
|
+ padding: 22px 28px 20px;
|
|
|
+ border-bottom: 1px dashed #DFDFDF;
|
|
|
+ line-height: 32px;
|
|
|
+ font-size: 22px;
|
|
|
+ color: #333;
|
|
|
+ }
|
|
|
+
|
|
|
+ .select-wrap {
|
|
|
+ display: flex;
|
|
|
+ margin-top: 28px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .icon-wrap {
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ width: 46px;
|
|
|
+ height: 46px;
|
|
|
+ margin-right: 26px;
|
|
|
+
|
|
|
+ img {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ margin-top: 42px;
|
|
|
+ }
|
|
|
+
|
|
|
+ i {
|
|
|
+ width: 37px;
|
|
|
+ height: 37px;
|
|
|
+ margin-top: 46px;
|
|
|
+ border: 2px solid #CCCCCC;
|
|
|
+ border-radius: 50%;
|
|
|
+ background: #FFFFFF;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .w-575 {
|
|
|
+ width: 575px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .w-640 {
|
|
|
+ width: 640px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .goods-info {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ width: 100%;
|
|
|
+ }
|
|
|
+
|
|
|
+ .left-wrap {
|
|
|
+ width: 127px;
|
|
|
+ height: 127px;
|
|
|
+ overflow: hidden;
|
|
|
+
|
|
|
+ img {
|
|
|
+ display: block;
|
|
|
+ width: 100%;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .right-wrap {
|
|
|
+ margin-left: 25px;
|
|
|
+
|
|
|
+ p {
|
|
|
+ line-height: 32px;
|
|
|
+ font-size: 22px;
|
|
|
+ color: #333;
|
|
|
+
|
|
|
+ &:nth-of-type(2) {
|
|
|
+ margin-top: 10px;
|
|
|
+ }
|
|
|
+
|
|
|
+ &:nth-of-type(3) {
|
|
|
+ margin-top: 10px;
|
|
|
+ color: #BA877A;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .good-list {
|
|
|
+ width: 100%;
|
|
|
+ padding: 9px 19px;
|
|
|
+ margin: 17px 0 28px;
|
|
|
+ line-height: 32px;
|
|
|
+ font-size: 22px;
|
|
|
+ word-break: break-all;
|
|
|
+ color: #999;
|
|
|
+ background: #F9F9F9;
|
|
|
+ }
|
|
|
+
|
|
|
+ .jump-detail {
|
|
|
+ display: flex;
|
|
|
+ justify-content: flex-end;
|
|
|
+ width: 100%;
|
|
|
+ padding: 18px 0 22px;
|
|
|
+ border-top: 1px dashed #DFDFDF;
|
|
|
+
|
|
|
+ a {
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ width: 134px;
|
|
|
+ height: 49px;
|
|
|
+ background: #FFFFFF;
|
|
|
+ border-radius: 2px;
|
|
|
+ border: 1px solid #001947;
|
|
|
+ font-size: 22px;
|
|
|
+ color: #001947;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .bitmap {
|
|
|
+ padding-top: 200px;
|
|
|
+
|
|
|
+ p {
|
|
|
+ line-height: 38px;
|
|
|
+ font-size: 28px;
|
|
|
+ font-weight: 500;
|
|
|
+ color: #999;
|
|
|
+ }
|
|
|
+ }
|
|
|
+</style>
|