12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412 |
- <template>
- <view class="invoice">
- <nav-bar title="发票申请"></nav-bar>
- <view class="invoice__tabs">
- <u-tabs :list="list" sticky :current="current" @change="change" active-color="#007AFF"></u-tabs>
- </view>
- <view class="invoice__content">
- <view class="open" v-if="current == 0">
- <view class="form">
- <u-form :model="form" ref="uForm">
- <u-form-item label="发票类型" label-width="150" required prop="type" >
- <u-radio-group v-model="form.type" @change="formTypeChange">
- <u-radio v-for="(item, index) in typeList" :key="index" :name="item.value">
- {{ item.name }}
- </u-radio>
- </u-radio-group>
- </u-form-item>
-
- <!-- 增值税发票 -->
- <template v-if="form.type == 2">
-
- <u-form-item label="申请主体" label-width="150" required prop="subject">
- <u-radio-group v-model="form.subject">
- <u-radio :key="index" name="2">
- 企业
- </u-radio>
- </u-radio-group>
- </u-form-item>
-
- <u-form-item label="发票抬头" label-width="150" required prop="invoiceTitle" >
- <u-input placeholder="请输入发票抬头" v-model="form.invoiceTitle" />
- </u-form-item>
- <u-form-item label="纳税登记号" label-width="150" required prop="taxRegistryNumber" >
- <u-input placeholder="请输入纳税登记号" v-model="form.taxRegistryNumber" />
- </u-form-item>
- <u-form-item label="单位地址" label-width="150" required prop="companyAddress" >
- <u-input placeholder="请输入单位地址" v-model="form.companyAddress" />
- </u-form-item>
- <u-form-item label="电话号码" label-width="150" required prop="phone" >
- <u-input placeholder="请输入电话号码" type="number" v-model="form.phone" />
- </u-form-item>
- <u-form-item label="开户银行" label-width="150" required prop="bankName" >
- <u-input placeholder="请输入开户银行" v-model="form.bankName" />
- </u-form-item>
- <u-form-item label="银行账号" label-width="150" required prop="bankAccount" >
- <u-input placeholder="请输入银行账号" type="number" v-model="form.bankAccount" />
- </u-form-item>
- <u-form-item label="收件地址" label-width="150" required prop="receivingAddress" >
- <u-input placeholder="请输入收件地址" v-model="form.receivingAddress" />
- </u-form-item>
- <u-form-item label="收件人" label-width="150" required prop="receivingName" >
- <u-input placeholder="请输入收件人" v-model="form.receivingName" />
- </u-form-item>
- <u-form-item label="收件手机" label-width="150" required prop="receivingTel" >
- <u-input placeholder="请输入收件手机" v-model="form.receivingTel" />
- </u-form-item>
-
- </template>
- <!-- 增值税发票 -->
-
- <!-- 普通发票 -->
- <template v-else>
- <u-form-item label="申请主体" label-width="150" required prop="subject">
- <u-radio-group v-model="form.subject">
- <u-radio v-for="(item, index) in mainList" :key="index" :name="item.value">
- {{ item.name }}
- </u-radio>
- </u-radio-group>
- </u-form-item>
-
- <u-form-item label="发票抬头" label-width="150" required prop="invoiceTitle" >
- <u-input placeholder="请输入发票抬头" v-model="form.invoiceTitle" />
- </u-form-item>
- <u-form-item v-if="form.subject == '2'" label="纳税登记号" label-width="150" required prop="taxRegistryNumber" >
- <u-input placeholder="请输入纳税登记号" v-model="form.taxRegistryNumber" />
- </u-form-item>
- </template>
- <!-- 普通发票 -->
-
-
- <u-form-item label="选择订单" label-width="150" required prop="orderGoodsIds" right-icon="arrow-right" ref="orderGoodsIds">
- <view class="form-item" @click="selectOrderModal = true">
- <u-input placeholder="请点击选择订单" disabled @click="selectOrderModal = true" />
- </view>
- </u-form-item>
- <view>
- <view class="check-order" v-for="(item,index) in orderList" :key="index" v-if="item.disabled">
- <view class="close" @click="deleteOrder(index)">
- <u-icon name="close-circle-fill" color="#FF2D55" size="40"></u-icon>
- </view>
- <view class="title">商品名称:{{item.goodsName}}</view>
- <view class="number">订单编号:{{item.orderSn}}</view>
- <view class="price">价格:¥ {{item.goodsPrice}}</view>
- </view>
- </view>
-
- </u-form>
- </view>
-
- <view class="order-text">
- <view class="order-text__label">本次申请开票金额:</view>
- <view class="order-text__price">¥ {{toFixed(invoicePirce)}}</view>
- </view>
-
- <view class="submit" @click="formSubmit">
- 提交申请
- </view>
- </view>
- <view class="record" v-if="current == 1">
- <view class="nodata" v-if="!recordList.length">
- 您暂无相关发票记录哦~
- </view>
-
- <view class="record__list">
- <view class="record-item" @click="showDetailModal(record);" v-for="(record,index) in recordList" :key="index">
- <view class="item__time">{{$method.timestampToTime(record.applyTime,false,false)}}</view>
- <view class="item__content">
- <view class="top">
- <view class="state" :class="{wait:record.periodStatus == 1,refuse:record.periodStatus == 2,agree:record.periodStatus == 3}">
- <text v-if="record.periodStatus == 1">待审核</text>
- <text v-if="record.periodStatus == 2">驳回</text>
- <text v-if="record.periodStatus == 3">通过</text>
- <u-icon class="arrow" name="arrow-right" color="#ffffff" size="28"></u-icon>
- </view>
- </view>
-
- <view class="bottom">
- <view class="flex">
- <view class="text">发票类型</view>
- <view class="flex__auto">
- <text v-if="record.type == 1">普通发票</text>
- <text v-if="record.type == 2">增值税专用发票</text>
- </view>
- </view>
- <view class="flex">
- <view class="text">申请主体</view>
- <view class="flex__auto">
- <text v-if="record.subject == 1">个人</text>
- <text v-if="record.subject == 2">企业</text>
- </view>
- </view>
- <view class="flex">
- <view class="text">发票状态</view>
- <view class="flex__auto">
- <text class="red" v-if="record.invoiceStatus == 1">未开票</text>
- <text class="green" v-if="record.invoiceStatus == 2">已开票</text>
- <text class="red" v-if="record.invoiceStatus == -1">已退票</text>
- </view>
- </view>
- <view @click.stop="showOrder(record.checked,index)">
- <view class="flex noborder" >
- <view class="text">开票订单</view>
- <view class="flex__auto">
- <text style="margin-right:10rpx;">{{record.orderList.length}}</text>
- <u-icon v-if="!record.checked" name="arrow-down" color="#ccc" size="28"></u-icon>
- <u-icon v-if="record.checked" name="arrow-up" color="#ccc" size="28"></u-icon>
- </view>
- </view>
- <view class="order-list" v-if="record.checked">
- <view class="order-item" :key="orderIndex" v-for="(orderItem,orderIndex) in record.orderList">{{orderIndex+1}}.{{orderItem.goodsName}}</view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
-
- <u-popup class="modal" v-model="selectOrderModal" mode="bottom" border-radius="24">
- <view class="select-order">
- <view class="line"></view>
- <view class="title">选择订单</view>
- <u-line color="#D6D6DB" />
- <view>
- <scroll-view scroll-y="true" style="height: 500rpx;">
- <view>
- <u-checkbox-group>
- <view v-for="(item, index) in orderList" :key="index" >
- <view class="order-item">
- <view>
- <u-checkbox
- :disabled="item.disabled"
- shape="circle"
- :name="item.name"
- v-model="item.checked"
- >
- <view class="order-item__bg" :class="item.checked?'active':''" >
- <view>
- <view class="order-title">{{item.goodsName}}</view>
- <view class="order-number">{{item.orderSn}}</view>
- <view class="order-price">¥ {{item.goodsPrice}}元</view>
- </view>
- </view>
- </u-checkbox >
- </view>
-
- </view>
- </view>
- </u-checkbox-group>
- </view>
- </scroll-view>
- </view>
- <view class="confrim-btn">
- <view class="okBtn" @click="okPopup()">确定</view>
- </view>
- </view>
- </u-popup>
-
- <u-popup class="modal" v-model="orderDetailModal" mode="center" border-radius="40">
- <view class="order-detail">
- <view class="order-detail__content">
- <scroll-view scroll-y="true" style="height: 860rpx;">
- <view class="content">
- <view class="header">{{$method.timestampToTime(invoiceDetail.applyTime,false,false)}}</view>
- <view class="body">
- <view class="body__item">
- <view class="title">发票申请信息</view>
- <view class="content">
- <u-cell-item :border-bottom="false" hover-class="none" :arrow="false">
- <view slot="title">发票类型:</view>
- <text v-if="invoiceDetail.type == 1">普通发票</text>
- <text v-if="invoiceDetail.type == 2">增值税专用发票</text>
- </u-cell-item>
- <u-cell-item :border-bottom="false" hover-class="none" :arrow="false">
- <view slot="title">申请主体:</view>
- <text v-if="invoiceDetail.subject == 1">个人</text>
- <text v-if="invoiceDetail.subject == 2">企业</text>
- </u-cell-item>
- <u-cell-item :border-bottom="false" hover-class="none" :arrow="false">
- <view slot="title">发票抬头:</view>
- <text>{{invoiceDetail.invoiceTitle}}</text>
- </u-cell-item>
- <template v-if="invoiceDetail.type == 2">
- <u-cell-item :border-bottom="false" hover-class="none" :arrow="false">
- <view slot="title">纳税登记号:</view>
- <text>{{invoiceDetail.taxRegistryNumber || ''}}</text>
- </u-cell-item>
- <u-cell-item :border-bottom="false" hover-class="none" :arrow="false">
- <view slot="title">单位地址:</view>
- <text>{{invoiceDetail.companyAddress || ''}}</text>
- </u-cell-item>
- <u-cell-item :border-bottom="false" hover-class="none" :arrow="false">
- <view slot="title">电话号码:</view>
- <text>{{invoiceDetail.phone || ''}}</text>
- </u-cell-item>
- <u-cell-item :border-bottom="false" hover-class="none" :arrow="false">
- <view slot="title">开户银行:</view>
- <text>{{invoiceDetail.bankName || ''}}</text>
- </u-cell-item>
- <u-cell-item :border-bottom="false" hover-class="none" :arrow="false">
- <view slot="title">银行账号:</view>
- <text>{{invoiceDetail.bankAccount || ''}}</text>
- </u-cell-item>
- <u-cell-item :border-bottom="false" hover-class="none" :arrow="false">
- <view slot="title">收件地址:</view>
- <text>{{invoiceDetail.receivingAddress || ''}}</text>
- </u-cell-item>
- <u-cell-item :border-bottom="false" hover-class="none" :arrow="false">
- <view slot="title">收件人:</view>
- <text>{{invoiceDetail.receivingName || ''}}</text>
- </u-cell-item>
- <u-cell-item :border-bottom="false" hover-class="none" :arrow="false" >
- <view slot="title">收件手机:</view>
- <text>{{invoiceDetail.receivingTel || ''}}</text>
- </u-cell-item>
- <u-cell-item :border-bottom="false" hover-class="none" :arrow="false" >
- <view slot="title">开票订单:</view>
- </u-cell-item>
- </template>
-
- <view class="order-list">
- <view class="order-item" :key="orderIndex" v-for="(orderItem,orderIndex) in invoiceDetail.orderList">
- <view class="order-title">{{orderItem.goodsName}}</view>
- <view class="order-number">{{orderItem.orderSn}}</view>
- <view class="order-price">¥ {{orderItem.goodsRealPrice}}元</view>
- </view>
- </view>
- <view class="order-text">
- <view class="order-text__label">本次申请开票金额:</view>
- <view class="order-text__price">¥ {{toFixed(invoiceDetail.amount)}}</view>
- </view>
- </view>
- </view>
- <view class="body__item">
- <view class="title">发票申请结果</view>
- <view class="content">
- <u-cell-item :border-bottom="false" hover-class="none" :arrow="false">
- <view slot="title">审核结果:</view>
- <text class="text wait" v-if="invoiceDetail.periodStatus == 1">待审核</text>
- <text class="text agree" v-if="invoiceDetail.periodStatus == 3">通过</text>
- <text class="text refuse" v-if="invoiceDetail.periodStatus == 2">驳回</text>
- </u-cell-item>
- <u-cell-item :border-bottom="false" hover-class="none" :arrow="false" v-if="invoiceDetail.periodReason">
- <view slot="title">审核反馈:</view>
- <text class="text">{{invoiceDetail.periodReason||''}}</text>
- </u-cell-item>
- <u-cell-item :border-bottom="false" hover-class="none" :arrow="false">
- <view slot="title">发票状态:</view>
- <text class="text refuse" v-if="invoiceDetail.invoiceStatus == 1">未开票</text>
- <text class="text agree" v-if="invoiceDetail.invoiceStatus == 2">已开票</text>
- <text class="text refuse" v-if="invoiceDetail.invoiceStatus == -1">已退票</text>
- </u-cell-item>
-
- <u-cell-item :border-bottom="false" hover-class="none" :arrow="false" v-if="invoiceDetail.periodStatus == 3 && (invoiceDetail.invoiceStatus == 2 || invoiceDetail.invoiceStatus == -1) && invoiceDetail.invoiceImg">
- <view slot="title">发票预览:</view>
- <view>
- <image class="preview" @click="previewImg(invoiceDetail)" :src="$method.splitImgHost(invoiceDetail.invoiceImg)"></image>
- <view class="download-btn" @click="download(invoiceDetail)">下载电子发票</view>
- </view>
- </u-cell-item>
-
-
- <u-cell-item :border-bottom="false" hover-class="none" :arrow="false" v-if="invoiceDetail.periodStatus == 3 && (invoiceDetail.invoiceStatus == 2 || invoiceDetail.invoiceStatus == -1) && invoiceDetail.type == 2 && invoiceDetail.subject == 2">
- <view slot="title">机构发票邮寄状态:</view>
- <text class="text" v-if="invoiceDetail.sendInvoice == 1">是</text>
- <text class="text" v-else>否</text>
- </u-cell-item>
-
- <u-cell-item v-if="invoiceDetail.periodStatus == 3 && (invoiceDetail.invoiceStatus == 2 || invoiceDetail.invoiceStatus == -1) && invoiceDetail.sendInvoice == 1 && invoiceDetail.type == 2 && invoiceDetail.subject == 2" @click.stop="copy(invoiceDetail.trackingNum)" :border-bottom="false" hover-class="none" :arrow="false">
- <view slot="title">发票邮寄快递单号:(点击可复制)</view>
- <text class="text">{{invoiceDetail.trackingNum || ''}}</text>
- </u-cell-item>
- </view>
- </view>
- </view>
- </view>
-
- </scroll-view>
- </view>
- <view class="order-detail__btns" v-if="invoiceDetail.periodStatus == 1">
- <view class="btn" @click="orderDetailModal = false;">知道了</view>
- <view class="btn warm" @click="orderCancelModal = true;">撤销申请</view>
- </view>
-
- <view class="order-detail__btns" v-else>
- <view class="btn ok" @click="orderDetailModal = false;">知道了</view>
- </view>
- </view>
- </u-popup>
-
- <u-popup class="modal" v-model="orderCancelModal" mode="center" border-radius="24">
- <view class="order-cancel">
- <view class="header">
- 温馨提示
- </view>
- <view class="body">
- <view>撤销申请后,</view>
- <view>本次的发票申请内容将不存在。</view>
- <view>请慎重考虑。 </view>
- <view>您确定要取消本次发票申请吗?</view>
- </view>
- <view class="footer">
- <view class="btn cancel" @click="orderCancelModal = false;">取消</view>
- <view class="btn ok" @click="orderCancel()">确定</view>
- </view>
- </view>
- </u-popup>
- </view>
- </template>
- <script>
- import { mapGetters } from 'vuex';
- export default {
- components: {},
- data() {
- return {
- checkOrderList:[],
- recordList:[],
- list: [
- {
- name: '发票申请'
- },
- {
- name: '发票记录'
- }
- ],
- invoiceDetail:{
- amount:0
- },
- form:{
- type:'1',
- subject:'1',
- invoiceTitle:'',
- orderGoodsIds:'',
- taxRegistryNumber:'',
- companyAddress:'',
- phone:'',
- bankName:'',
- bankAccount:'',
- receivingAddress:'',
- receivingName:'',
- receivingTel:'',
- },
- rules: {
- receivingTel: [
- {
- required: true,
- message: '请输入收件手机',
- // 可以单个或者同时写两个触发验证方式
- trigger: ['change'],
- },
- {
- validator: (rule, value, callback) => {
- // 上面有说,返回true表示校验通过,返回false表示不通过
- // this.$u.test.mobile()就是返回true或者false的
- console.log(this.$u.test.mobile(value),'this.$u.test.mobile(value)')
- return this.$u.test.mobile(value);
- },
- message: '手机号码格式不正确',
- // 触发器可以同时用blur和change
- trigger: ['change'],
- }
- ],
- type: [
- {
- required: true,
- message: '请选择发票类型',
- // 可以单个或者同时写两个触发验证方式
- trigger: ['change'],
- }
- ],
- subject: [
- {
- required: true,
- message: '请选择申请主体',
- // 可以单个或者同时写两个触发验证方式
- trigger: ['change'],
- }
- ],
- invoiceTitle: [
- {
- required: true,
- message: '请输入发票抬头',
- // 可以单个或者同时写两个触发验证方式
- trigger: ['change'],
- },
- ],
- taxRegistryNumber: [
- {
- required: true,
- message: '请输入纳税登记号',
- // 可以单个或者同时写两个触发验证方式
- trigger: ['change'],
- },
- {
- validator: (rule, value, callback) => {
- // 上面有说,返回true表示校验通过,返回false表示不通过
- var reg = /(^[0-9A-Z]{15,20}$)/;
- console.log( reg.test(value),' reg.test(value)')
- return reg.test(value);
- },
- message: '纳税登记号格式不正确',
- // 触发器可以同时用blur和change
- trigger: ['change'],
- }
- ],
- companyAddress: [
- {
- required: true,
- message: '请输入单位地址',
- // 可以单个或者同时写两个触发验证方式
- trigger: ['change'],
- }
- ],
- phone: [
- {
- required: true,
- message: '请输入电话号码',
- // 可以单个或者同时写两个触发验证方式
- trigger: ['change'],
- },
- {
- validator: (rule, value, callback) => {
- var vartest = /^([0-9]{3,4}-)?[0-9]{7,8}$/;
- var vartest1 = /^([0-9]{3,4})?[0-9]{7,8}$/;
- if (this.$u.test.mobile(value) || vartest.test(value) || vartest1.test(value)) {
- return true;
- } else {
- return false;
- }
- },
- message: '电话号码不正确',
- trigger: ['change', 'blur']
- }
- ],
- bankName: [
- {
- required: true,
- message: '请输入开户银行',
- // 可以单个或者同时写两个触发验证方式
- trigger: ['change'],
- },
- {
- validator: (rule, value, callback) => {
- var reg = /[\u4E00-\u9FA5]+/;
- return reg.test(value)
- },
- message: '开户银行名称不正确',
- trigger: ['change', 'blur']
- }
- ],
-
-
- bankAccount: [
- {
- required: true,
- message: '请输入银行账号',
- // 可以单个或者同时写两个触发验证方式
- trigger: ['change'],
-
- },
- {
- validator: (rule, value, callback) => {
- // 上面有说,返回true表示校验通过,返回false表示不通过
- var reg = /^[1-9]{1}(\d{15}|\d{18})$/;
- console.log( reg.test(value),' reg.test(value)')
- return reg.test(value);
- },
- message: '银行卡号格式不正确',
- // 触发器可以同时用blur和change
- trigger: ['change'],
- }
- ],
- receivingAddress: [
- {
- required: true,
- message: '请输入收件地址',
- // 可以单个或者同时写两个触发验证方式
- trigger: ['change'],
- }
- ],
- receivingName: [
- {
- required: true,
- message: '请输入收件人',
- // 可以单个或者同时写两个触发验证方式
- trigger: ['change'],
- }
- ],
- orderGoodsIds: [
- {
- required: true,
- message: '请选择订单',
- // 可以单个或者同时写两个触发验证方式
- trigger: ['change'],
- }
- ],
- },
- orderValue:'',
- orderList:[],
- selectOrderModal:false,
- orderDetailModal:false,
- orderCancelModal:false,
- current: 0,
- invoicePirce:0,
- order: [],
- typeList:[{
- name:'普通发票',
- value:'1'
- },{
- name:'增值税专用发票',
- value:'2'
- }],
- mainList:[{
- name:'个人',
- value:'1'
- },{
- name:'企业',
- value:'2'
- }]
- };
- },
- // onPullDownRefresh() {},
- onLoad(option) {
- this.orderInvoiceCanInvoiceList();
- this.$refs.uForm.setRules(this.rules)
- },
- onShow() {
-
- },
- methods: {
- orderCancel() {
- let invoiceDetail = JSON.parse(JSON.stringify(this.invoiceDetail))
- invoiceDetail.status = -1;
- this.$api.orderInvoiceCancel(invoiceDetail).then(res => {
- if(res.data.code == 200) {
- this.orderInvoiceList();
- this.orderInvoiceCanInvoiceList();
- this.orderDetailModal = false;
- this.orderCancelModal = false;
- uni.showToast({
- title:'撤销成功',
- icon:'none'
- })
- } else {
-
- }
- })
- },
- showDetailModal(item) {
- this.orderDetailModal = true;
- this.invoiceDetail = item;
- },
- toFixed(number) {
- console.log(number.toFixed(2))
- return number.toFixed(2)
- },
- /**
- * 获取可开发票的订单
- */
- orderInvoiceCanInvoiceList() {
- this.$api.orderInvoiceCanInvoiceList().then(res => {
- if(res.data.code == 200) {
- res.data.rows.forEach(item => {
- item.checked = false;
- })
- this.orderList = res.data.rows;
- }
- })
- },
- /**
- * @param {Object} checkedState 显示状态
- * @param {Object} index 索引值
- * 修改开票订单列表显示状态
- */
- showOrder(showState,index) {
- this.$set(this.recordList[index],'checked',!showState)
- },
- /**
- * 发票申请提交
- */
- formSubmit() {
- this.$refs.uForm.validate(valid => {
- console.log(valid,'valid')
- console.log(this.form,'this.form')
- if(valid) {
-
- if(this.invoicePirce > 10000) {
- uni.showModal({
- title:'提示',
- content:'您所选的订单总开票金额,大于10000元,超出单张发票的开票额度,请修改开票订单',
- showCancel:false,
- })
- return
- }
- let data = JSON.parse(JSON.stringify(this.form));
- data.orderGoodsIds = data.orderGoodsIds.split(',')
- data.amount = this.invoicePirce;
- if(data.subject == '1') {
- data.taxRegistryNumber = '';
- data.companyAddress = '';
- data.phone = '';
- data.bankName = '';
- data.bankAccount = '';
- data.receivingAddress = '';
- data.receivingName = '';
- data.receivingTel = '';
- }
- this.$api.orderInvoice(data).then(res => {
- if(res.data.code == 200) {
- this.orderInvoiceCanInvoiceList();
- this.form = {
- type:'1',
- subject:'1',
- invoiceTitle:'',
- orderGoodsIds:'',
- taxRegistryNumber:'',
- companyAddress:'',
- phone:'',
- bankName:'',
- bankAccount:'',
- receivingAddress:'',
- receivingName:'',
- receivingTel:'',
- };
- this.invoicePirce = 0;
- uni.showModal({
- title:'操作提示',
- content:`您本次的发票申请已经提交成功!\n机构将在3-7个工作日内进行处理,处理结果会在【发票记录】显示,请留意进度。`,
- showCancel:false,
- confirmText:'知道了'
- })
- } else {
- uni.showToast({
- icon:'none',
- title:res.data.msg
- })
- }
- })
- }
- })
- },
- /**
- * @param {Object} e value
- * 发票类型修改
- */
- formTypeChange(e) {
- console.log(e)
- if(e == '2') {
- this.$set(this.form,'subject','2')
- } else {
-
- }
- },
- /**
- * @param {Object} e
- * tabs 切换
- */
- change(e) {
- console.log(e)
- this.current = e;
-
- if(this.current == 1) {
- this.orderInvoiceList();
- } else {
- this.$nextTick(() => {
- this.$refs.uForm.setRules(this.rules)
- })
-
- }
- },
-
- orderInvoiceList() {
- this.$api.orderInvoiceList().then(res => {
- if(res.data.code == 200) {
- this.recordList = res.data.rows
- } else {
- uni.showToast({
- icon:'none',
- title:res.data.msg
- })
- }
- })
- },
-
- radioGroupChange(e) {
- console.log(e)
- },
- copy(str) {
- if(!str) {
- uni.showToast({
- icon:'none',
- title:'暂时没有可以复制的快递号'
- })
- return;
- }
- let newStr = String(str)
- uni.setClipboardData({
- data: newStr,
- success: function () {
- console.log('success');
- }
- });
- },
- okPopup() {
- this.selectOrderModal = false;
- let strArr = [];
- this.invoicePirce = 0;
- this.orderList.forEach((item,index) => {
- if(item.checked) {
- this.$set(this.orderList[index],'disabled',true)
- strArr.push(item.orderGoodsId)
- this.invoicePirce += item.goodsPrice
- }
- })
-
- this.form.orderGoodsIds = strArr.join(',')
- this.$nextTick(() => {
- this.$refs.orderGoodsIds.onFieldChange()
- })
- console.log(this.$refs.orderGoodsIds)
- },
-
- deleteOrder(index) {
- this.$set(this.orderList[index],'disabled',false)
- this.$set(this.orderList[index],'checked',false)
- let strArr = [];
- this.invoicePirce = 0;
- this.orderList.forEach((item,index) => {
- if(item.checked) {
- strArr.push(item.orderGoodsId)
- this.invoicePirce += item.goodsPrice
- }
- })
-
- this.form.orderGoodsIds = strArr.join(',')
- this.$nextTick(() => {
- this.$refs.orderGoodsIds.onFieldChange()
- })
- },
-
- previewImg(item) {
- // 预览图片
- uni.previewImage({
- urls: [this.$method.splitImgHost(item.invoiceImg,true,1000)],
- longPressActions: {
- itemList: ['发送给朋友', '保存图片', '收藏'],
- success: function(data) {
- console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
- },
- fail: function(err) {
- console.log(err.errMsg);
- }
- }
- });
- },
-
- download(item) {
- //获取相册授权
- uni.getSetting({
- success:(res) => {
- if (!res.authSetting['scope.writePhotosAlbum']) {
- uni.authorize({
- scope: 'scope.writePhotosAlbum',
- success() {
- //这里是用户同意授权后的回调
- this.saveImgToLocal(item);
- },
- fail() {//这里是用户拒绝授权后的回调
-
- }
- })
- } else {//用户已经授权过了
- this.saveImgToLocal(item);
- }
- }
- })
- },
-
- saveImgToLocal(item){
-
- uni.showModal({
- title: '提示',
- content: '确定保存到相册吗',
- success: (res) => {
- if (res.confirm) {
-
- uni.downloadFile({
- url: this.$method.splitImgHost(item.invoiceImg,true,1000),//图片地址
- success: (res) =>{
- if (res.statusCode === 200){
- uni.saveImageToPhotosAlbum({
- filePath: res.tempFilePath,
- success: function() {
- uni.showToast({
- title: "保存成功",
- icon: "none"
- });
- },
- fail: function() {
- uni.showToast({
- title: "保存失败",
- icon: "none"
- });
- }
- });
- }
- }
- })
-
-
- } else if (res.cancel) {
-
- }
- }
- });
-
- }
- },
- computed: { ...mapGetters(['userInfo']) }
- };
- </script>
- <style>
- page {
- background: #eaeef1;
- }
- </style>
- <style scoped lang="scss">
-
- .invoice {
- &__tabs {
- width: 100%;
- text-align: center;
- position: fixed;
- height: 96rpx;
- z-index: 999;
- }
-
- &__content {
- padding-top:96rpx;
-
- .open {
- padding-bottom:150rpx;
- margin:8rpx 24rpx 0;
-
- .form {
- padding:24rpx;
- width: 702rpx;
- background: #FFFFFF;
- border-radius: 24rpx;
-
- // /deep/ .u-input__input {
- // text-align: right;
- // }
-
-
- .form-item {
- height:78rpx;
- display: flex;
- align-items: center;
-
- .text {
- font-size: 28rpx;
- width:120rpx;
- // color: #999999;
- }
-
- .content {
- flex:1;
- text-align: left;
- color:#bbb;
- }
- }
-
- .check-order {
- margin-top:20rpx;
- width: 654rpx;
- height: 168rpx;
- background: #F5F5F5;
- border: 2px solid #F5F5F5;
- padding:20rpx;
- position:relative;
-
- .close {
- position:absolute;
- right:0;
- top:0;
- }
-
-
- .title,.number,.price {
- color:#333333;
- margin-top:10rpx;
- line-height: 30rpx;
- font-size: 30rpx;
- }
-
- .number {
- color:#999;
- }
- }
-
- }
-
- .order-text {
- margin-top:16rpx;
- padding:0 30rpx;
- width: 702rpx;
- height: 80rpx;
- background: #FFFFFF;
- border-radius: 24rpx;
- display: flex;
- align-items: center;
-
- &__label {
- font-size: 24rpx;
- }
-
- &__price {
- font-size: 30rpx;
- margin-left:20rpx;
- color:#FF2D55;
- }
- }
-
- .submit {
- text-align: center;
- line-height: 80rpx;
- color:#fff;
- font-size: 30rpx;
- width: 526rpx;
- height: 80rpx;
- background: #007AFF;
- box-shadow: 0rpx 8rpx 7rpx 1rpx rgba(0, 122, 255, 0.1);
- border-radius: 40rpx;
- position:fixed;
- left:50%;
- bottom:40rpx;
- z-index: 999;
- transform: translateX(-50%);
- }
- }
-
- .record {
- .nodata {
- padding-top:160rpx;
- font-size: 32rpx;
- text-align: center;
- color: #999999;
- }
-
- &__list {
-
- .record-item {
- margin:0 8rpx 10rpx;
- .item__time {
- padding:20rpx 0;
- text-align: center;
- font-size: 24rpx;
- color: #999999;
- }
-
- .item__content {
- background:#fff;
- border-radius: 16rpx;
-
- .top {
- padding:12rpx 0;
- border-bottom:1px solid #EEEEEE;
- .state {
- position:relative;
- text-align: center;
- color:#fff;
- font-size: 30rpx;
- margin:0 auto;
- width: 240rpx;
- height: 56rpx;
- line-height: 56rpx;
- background: #007AFF;
- border-radius: 28rpx;
-
- &.wait {
- background: #007AFF;
- }
- &.refuse {
- background: #FF3B30;
- }
- &.agree {
- background: #34C759;
- }
-
- .arrow {
- position:absolute;
- top:50%;
- transform: translateY(-50%);
- right:18rpx;
- }
- }
- }
-
- .bottom {
- padding:0 32rpx;
- .flex {
- height:80rpx;
- display: flex;
- align-items: center;
- border-bottom:1px solid #EEEEEE;
-
- &.noborder{
- border:0;
- }
-
-
- .text {
- font-size: 24rpx;
- color: #666666;
- }
-
- &__auto {
- text-align: right;
- flex:1;
- font-size: 30rpx;
- font-weight: bold;
- color: #666666;
-
- .red {
- color:#FF3B30;
- }
-
- .green {
- color:#34C759;
- }
- }
- }
-
- .order-list {
- padding-bottom:30rpx;
- .order-item {
- border-radius: 16rpx;
- padding:14rpx;
- background:#F5F5F5;
- font-size: 30rpx;
- color:#333;
- margin-top:16rpx;
- }
- }
- }
- }
- }
- }
- }
- }
-
- .modal {
-
- .select-order {
- .line {
- width: 80rpx;
- height: 8rpx;
- background: #999999;
- border-radius: 4rpx;
- margin:8rpx auto 0;
- }
-
- .title {
- margin:20rpx 0 15rpx;
- text-align: center;
- font-size: 24rpx;
- color: #999999;
- }
-
- .order-item {
- display: flex;
- align-items: center;
- padding: 20rpx;
-
-
- &__bg {
- width: 654rpx;
- height: 168rpx;
- background: #F5F5F5;
- border: 2px solid #F5F5F5;
- border-radius: 16rpx;
- padding:20rpx;
-
-
- &.active {
- background: #EBF5FF;
- border: 2px solid #007AFF;
- }
-
- .order-title,.order-number,.order-price {
- color:#333333;
- margin-top:10rpx;
- line-height: 30rpx;
- font-size: 30rpx;
- }
-
- .order-number {
- color:#999;
- }
- }
- }
-
- .confrim-btn {
- width: 750rpx;
- height: 98rpx;
- background: rgba(255, 255, 255, 0.98);
- display: flex;
- align-items: center;
- justify-content: center;
-
- .okBtn {
- text-align: center;
- line-height: 64rpx;
- color:#fff;
- font-size: 30rpx;
- width: 200rpx;
- height: 64rpx;
- background: linear-gradient(0deg, #015EEA, #00C0FA);
- border-radius: 32rpx;
- }
- }
- }
-
- .order-detail {
- width: 640rpx;
- height: 1000rpx;
- background: #FFFFFF;
- display: flex;
- flex-direction: column;
-
-
- &__content {
- flex:1;
-
- .content {
- padding:24rpx 24rpx 0;
-
- /deep/ .u-cell {
- padding:10rpx;
-
- &_title {
- color:#999;
- }
-
- &__value {
- color:#333;
- text-align: left;
- }
-
- .text {
- &.wait {
- color:#007AFF;
- }
-
- &.agree {
- color:#34C759;
- }
-
- &.refuse {
- color:#FF3B30;
- }
- }
-
- .preview {
- width:240rpx;
- height:160rpx;
- }
-
- .download-btn {
- margin:10rpx 0 0;
- text-align: center;
- line-height: 56rpx;
- color:#fff;
- font-size: 30rpx;
- width: 224rpx;
- height: 56rpx;
- background: #007AFF;
- border-radius: 16rpx;
- }
- }
-
-
- .header {
- font-size: 30rpx;
- font-weight: bold;
- color: #333333;
- line-height: 48rpx;
- }
-
- .body {
- &__item {
-
- border-bottom:1px solid #EEEEEE;
- padding-bottom:30rpx;
-
- &:last-child {
- border:0;
- }
-
- .title {
- margin-top:30rpx;
- font-size: 24rpx;
- color: #007AFF;
- line-height: 48rpx;
-
- &::before {
- content:'';
- width: 4rpx;
- height: 24rpx;
- background: #007AFF;
- border-radius: 2rpx;
- display: inline-block;
- margin-right:10rpx;
- }
- }
-
- .order-list {
-
- .order-item {
- overflow: hidden;
- border-radius: 16rpx;
- padding:0 14rpx 14rpx;
- background:#F5F5F5;
- font-size: 30rpx;
- color:#333;
- margin-top:16rpx;
-
- .order-title,.order-number,.order-price {
- color:#333333;
- margin-top:20rpx;
- line-height: 26rpx;
- font-size: 26rpx;
- }
-
- .order-number {
- color:#999;
- }
- }
- }
-
- .order-text {
- margin-top:16rpx;
- padding:0 30rpx;
- height: 80rpx;
- background: #F5F5F5;
- border-radius: 16rpx;
- display: flex;
- align-items: center;
-
- &__label {
- font-size: 24rpx;
- color:#999999;
- }
-
- &__price {
- font-size: 30rpx;
- margin-left:20rpx;
- color:#FF2D55;
- }
- }
- }
- }
- }
-
-
-
- }
-
- &__btns {
- border-top:1px solid #EEEEEE;
- padding:0 24rpx;
- width: 100%;
- height: 140rpx;
- background: #FFFFFF;
- display: flex;
- justify-content: center;
- align-items: center;
-
- .btn {
- text-align: center;
- width: 200rpx;
- height: 80rpx;
- line-height: 80rpx;
- background: #F5F5F5;
- border-radius: 40rpx;
- color:#007AFF;
- font-size: 30rpx;
- margin:0 10rpx;
-
-
- &.warm {
- background: #FF3B30;
- color:#fff;
- }
-
- &.ok {
- color:#fff;
- width: 526rpx;
- height: 80rpx;
- background: #007AFF;
- border-radius: 40rpx;
- }
- }
-
- }
- }
-
- .order-cancel {
- width: 640rpx;
- height: 439rpx;
- background: #FFFFFF;
- padding:40rpx;
- .header {
- text-align: center;
- font-size: 30rpx;
- font-weight: bold;
- color: #333333;
- line-height: 48rpx;
- }
-
- .body {
- margin-top:40rpx;
-
- view {
- font-size: 30rpx;
- color: #666666;
- line-height: 48rpx;
- }
- }
-
- .footer {
- margin-top:40rpx;
- display: flex;
- align-items: center;
- justify-content: center;
-
- .btn {
- text-align: center;
- line-height: 80rpx;
- font-size: 30rpx;
- color:#007AFF;
- width: 200rpx;
- height: 80rpx;
- background: #F5F5F5;
- border-radius: 40rpx;
- margin:0 10rpx;
-
- &.ok {
- color:#fff;
- background: #007AFF;
- }
- }
- }
- }
- }
- }
- </style>
|