index.vue 34 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318
  1. <template>
  2. <view class="invoice">
  3. <nav-bar title="发票申请"></nav-bar>
  4. <view class="invoice__tabs">
  5. <u-tabs :list="list" sticky :current="current" @change="change" active-color="#007AFF"></u-tabs>
  6. </view>
  7. <view class="invoice__content">
  8. <view class="open" v-if="current == 0">
  9. <view class="form">
  10. <u-form :model="form" ref="uForm">
  11. <u-form-item label="发票类型" label-width="130" required prop="type" >
  12. <u-radio-group v-model="form.type" @change="formTypeChange">
  13. <u-radio v-for="(item, index) in typeList" :key="index" :name="item.value">
  14. {{ item.name }}
  15. </u-radio>
  16. </u-radio-group>
  17. </u-form-item>
  18. <!-- 增值税发票 -->
  19. <template v-if="form.type == 2">
  20. <u-form-item label="申请主体" label-width="130" required prop="subject">
  21. <u-radio-group v-model="form.subject">
  22. <u-radio :key="index" name="2">
  23. 企业
  24. </u-radio>
  25. </u-radio-group>
  26. </u-form-item>
  27. <u-form-item label="发票抬头" label-width="130" required prop="invoiceTitle" >
  28. <u-input placeholder="请输入" v-model="form.invoiceTitle" />
  29. </u-form-item>
  30. <u-form-item label="单位税号" label-width="130" required prop="taxRegistryNumber" >
  31. <u-input placeholder="请输入" v-model="form.taxRegistryNumber" />
  32. </u-form-item>
  33. <u-form-item label="单位地址" label-width="130" required prop="companyAddress" >
  34. <u-input placeholder="请输入" v-model="form.companyAddress" />
  35. </u-form-item>
  36. <u-form-item label="电话号码" label-width="130" required prop="phone" >
  37. <u-input placeholder="请输入" type="number" v-model="form.phone" />
  38. </u-form-item>
  39. <u-form-item label="开户银行" label-width="130" required prop="bankName" >
  40. <u-input placeholder="请输入" v-model="form.bankName" />
  41. </u-form-item>
  42. <u-form-item label="银行账号" label-width="130" required prop="bankAccount" >
  43. <u-input placeholder="请输入" type="number" v-model="form.bankAccount" />
  44. </u-form-item>
  45. <u-form-item label="收件地址" label-width="130" required prop="receivingAddress" >
  46. <u-input placeholder="请输入" v-model="form.receivingAddress" />
  47. </u-form-item>
  48. <u-form-item label="收件人" label-width="130" required prop="receivingName" >
  49. <u-input placeholder="请输入" v-model="form.receivingName" />
  50. </u-form-item>
  51. <u-form-item label="收件手机" label-width="130" required prop="receivingTel" >
  52. <u-input placeholder="请输入" v-model="form.receivingTel" />
  53. </u-form-item>
  54. </template>
  55. <!-- 增值税发票 -->
  56. <!-- 普通发票 -->
  57. <template v-else>
  58. <u-form-item label="申请主体" label-width="130" required prop="subject">
  59. <u-radio-group v-model="form.subject">
  60. <u-radio v-for="(item, index) in mainList" :key="index" :name="item.value">
  61. {{ item.name }}
  62. </u-radio>
  63. </u-radio-group>
  64. </u-form-item>
  65. <u-form-item label="发票抬头" label-width="130" required prop="invoiceTitle" >
  66. <u-input placeholder="请输入" v-model="form.invoiceTitle" />
  67. </u-form-item>
  68. </template>
  69. <!-- 普通发票 -->
  70. <u-form-item label="选择订单" label-width="130" required prop="orderGoodsIds" right-icon="arrow-right" ref="orderGoodsIds">
  71. <view class="form-item" @click="selectOrderModal = true">
  72. <u-input placeholder="请选择" disabled @click="selectOrderModal = true" v-model="form.orderGoodsIds" />
  73. </view>
  74. </u-form-item>
  75. <view>
  76. <view class="check-order" v-for="(item,index) in orderList" :key="index" v-if="item.disabled">
  77. <view class="close" @click="deleteOrder(index)">
  78. <u-icon name="close-circle-fill" color="#FF2D55" size="40"></u-icon>
  79. </view>
  80. <view class="title">商品名称:{{item.goodsName}}</view>
  81. <view class="number">订单编号:{{item.orderSn}}</view>
  82. <view class="price">价格:¥ {{item.goodsPrice}}</view>
  83. </view>
  84. </view>
  85. </u-form>
  86. </view>
  87. <view class="order-text">
  88. <view class="order-text__label">本次申请开票金额:</view>
  89. <view class="order-text__price">¥ {{toFixed(invoicePirce)}}</view>
  90. </view>
  91. <view class="submit" @click="formSubmit">
  92. 提交申请
  93. </view>
  94. </view>
  95. <view class="record" v-if="current == 1">
  96. <view class="nodata" v-if="!recordList.length">
  97. 您暂无相关发票记录哦~
  98. </view>
  99. <view class="record__list">
  100. <view class="record-item" @click="showDetailModal(record);" v-for="(record,index) in recordList" :key="index">
  101. <view class="item__time">2021/10/29 09:30:00</view>
  102. <view class="item__content">
  103. <view class="top">
  104. <view class="state" :class="{wait:record.periodStatus == 1,refuse:record.periodStatus == 2,agree:record.periodStatus == 3}">
  105. <text v-if="record.periodStatus == 1">待审核</text>
  106. <text v-if="record.periodStatus == 2">驳回</text>
  107. <text v-if="record.periodStatus == 3">通过</text>
  108. <u-icon class="arrow" name="arrow-right" color="#ffffff" size="28"></u-icon>
  109. </view>
  110. </view>
  111. <view class="bottom">
  112. <view class="flex">
  113. <view class="text">发票类型</view>
  114. <view class="flex__auto">
  115. <text v-if="record.type == 1">普通发票</text>
  116. <text v-if="record.type == 2">增值税专用发票</text>
  117. </view>
  118. </view>
  119. <view class="flex">
  120. <view class="text">申请主体</view>
  121. <view class="flex__auto">
  122. <text v-if="record.subject == 1">个人</text>
  123. <text v-if="record.subject == 2">企业</text>
  124. </view>
  125. </view>
  126. <view class="flex">
  127. <view class="text">发票状态</view>
  128. <view class="flex__auto">
  129. <text class="red" v-if="record.invoiceStatus == 1">未开票</text>
  130. <text class="green" v-if="record.invoiceStatus == 2">已开票</text>
  131. <text class="red" v-if="record.invoiceStatus == -1">已退票</text>
  132. </view>
  133. </view>
  134. <view @click.stop="showOrder(record.checked,index)">
  135. <view class="flex noborder" >
  136. <view class="text">开票订单</view>
  137. <view class="flex__auto">
  138. <text style="margin-right:10rpx;">{{record.orderList.length}}</text>
  139. <u-icon v-if="!record.checked" name="arrow-down" color="#ccc" size="28"></u-icon>
  140. <u-icon v-if="record.checked" name="arrow-up" color="#ccc" size="28"></u-icon>
  141. </view>
  142. </view>
  143. <view class="order-list" v-if="record.checked">
  144. <view class="order-item" :key="orderIndex" v-for="(orderItem,orderIndex) in record.orderList">{{orderIndex+1}}.{{orderItem.goodsName}}</view>
  145. </view>
  146. </view>
  147. </view>
  148. </view>
  149. </view>
  150. </view>
  151. </view>
  152. </view>
  153. <u-popup class="modal" v-model="selectOrderModal" mode="bottom" border-radius="24">
  154. <view class="select-order">
  155. <view class="line"></view>
  156. <view class="title">选择订单</view>
  157. <u-line color="#D6D6DB" />
  158. <view>
  159. <scroll-view scroll-y="true" style="height: 500rpx;">
  160. <view>
  161. <u-checkbox-group>
  162. <view v-for="(item, index) in orderList" :key="index" >
  163. <view class="order-item">
  164. <view>
  165. <u-checkbox
  166. :disabled="item.disabled"
  167. shape="circle"
  168. :name="item.name"
  169. v-model="item.checked"
  170. >
  171. <view class="order-item__bg" :class="item.checked?'active':''" >
  172. <view>
  173. <view class="order-title">{{item.goodsName}}</view>
  174. <view class="order-number">{{item.orderSn}}</view>
  175. <view class="order-price">¥ {{item.goodsPrice}}元</view>
  176. </view>
  177. </view>
  178. </u-checkbox >
  179. </view>
  180. </view>
  181. </view>
  182. </u-checkbox-group>
  183. </view>
  184. </scroll-view>
  185. </view>
  186. <view class="confrim-btn">
  187. <view class="okBtn" @click="okPopup()">确定</view>
  188. </view>
  189. </view>
  190. </u-popup>
  191. <u-popup class="modal" v-model="orderDetailModal" mode="center" border-radius="40">
  192. <view class="order-detail">
  193. <view class="order-detail__content">
  194. <scroll-view scroll-y="true" style="height: 860rpx;">
  195. <view class="content">
  196. <view class="header">2021年10月29日 09:30:00</view>
  197. <view class="body">
  198. <view class="body__item">
  199. <view class="title">发票申请信息</view>
  200. <view class="content">
  201. <u-cell-item :border-bottom="false" hover-class="none" :arrow="false">
  202. <view slot="title">发票类型:</view>
  203. <text v-if="invoiceDetail.type == 1">普通发票</text>
  204. <text v-if="invoiceDetail.type == 2">增值税专用发票</text>
  205. </u-cell-item>
  206. <u-cell-item :border-bottom="false" hover-class="none" :arrow="false">
  207. <view slot="title">申请主体:</view>
  208. <text v-if="invoiceDetail.subject == 1">个人</text>
  209. <text v-if="invoiceDetail.subject == 2">企业</text>
  210. </u-cell-item>
  211. <u-cell-item :border-bottom="false" hover-class="none" :arrow="false">
  212. <view slot="title">发票抬头:</view>
  213. <text>{{invoiceDetail.invoiceTitle}}</text>
  214. </u-cell-item>
  215. <u-cell-item :border-bottom="false" hover-class="none" :arrow="false">
  216. <view slot="title">单位税号:</view>
  217. <text>{{invoiceDetail.taxRegistryNumber || ''}}</text>
  218. </u-cell-item>
  219. <u-cell-item :border-bottom="false" hover-class="none" :arrow="false">
  220. <view slot="title">单位地址:</view>
  221. <text>{{invoiceDetail.companyAddress || ''}}</text>
  222. </u-cell-item>
  223. <u-cell-item :border-bottom="false" hover-class="none" :arrow="false">
  224. <view slot="title">电话号码:</view>
  225. <text>{{invoiceDetail.phone || ''}}</text>
  226. </u-cell-item>
  227. <u-cell-item :border-bottom="false" hover-class="none" :arrow="false">
  228. <view slot="title">开户银行:</view>
  229. <text>{{invoiceDetail.bankName || ''}}</text>
  230. </u-cell-item>
  231. <u-cell-item :border-bottom="false" hover-class="none" :arrow="false">
  232. <view slot="title">银行账号:</view>
  233. <text>{{invoiceDetail.bankAccount || ''}}</text>
  234. </u-cell-item>
  235. <u-cell-item :border-bottom="false" hover-class="none" :arrow="false">
  236. <view slot="title">收件地址:</view>
  237. <text>{{invoiceDetail.receivingAddress || ''}}</text>
  238. </u-cell-item>
  239. <u-cell-item :border-bottom="false" hover-class="none" :arrow="false">
  240. <view slot="title">收件人:</view>
  241. <text>{{invoiceDetail.receivingName || ''}}</text>
  242. </u-cell-item>
  243. <u-cell-item :border-bottom="false" hover-class="none" :arrow="false" >
  244. <view slot="title">收件手机:</view>
  245. <text>{{invoiceDetail.receivingTel || ''}}</text>
  246. </u-cell-item>
  247. <u-cell-item :border-bottom="false" hover-class="none" :arrow="false" >
  248. <view slot="title">开票订单:</view>
  249. </u-cell-item>
  250. <view class="order-list">
  251. <view class="order-item" :key="orderIndex" v-for="(orderItem,orderIndex) in invoiceDetail.orderList">
  252. <view class="order-title">{{orderItem.goodsName}}</view>
  253. <view class="order-number">{{orderItem.orderSn}}</view>
  254. <view class="order-price">¥ {{orderItem.goodsRealPrice}}元</view>
  255. </view>
  256. </view>
  257. <view class="order-text">
  258. <view class="order-text__label">本次申请开票金额:</view>
  259. <view class="order-text__price">¥ {{toFixed(invoiceDetail.amount)}}</view>
  260. </view>
  261. </view>
  262. </view>
  263. <view class="body__item">
  264. <view class="title">发票申请结果</view>
  265. <view class="content">
  266. <u-cell-item :border-bottom="false" hover-class="none" :arrow="false">
  267. <view slot="title">审核结果:</view>
  268. <text class="text wait" v-if="invoiceDetail.periodStatus == 1">待审核</text>
  269. <text class="text agree" v-if="invoiceDetail.periodStatus == 3">通过</text>
  270. <text class="text refuse" v-if="invoiceDetail.periodStatus == 2">驳回</text>
  271. </u-cell-item>
  272. <u-cell-item :border-bottom="false" hover-class="none" :arrow="false">
  273. <view slot="title">发票状态:</view>
  274. <text class="text refuse" v-if="invoiceDetail.invoiceStatus == 1">未开票</text>
  275. <text class="text agree" v-if="invoiceDetail.invoiceStatus == 2">已开票</text>
  276. <text class="text refuse" v-if="invoiceDetail.invoiceStatus == -1">已退票</text>
  277. </u-cell-item>
  278. <u-cell-item :border-bottom="false" hover-class="none" :arrow="false" v-if="invoiceDetail.invoiceImg">
  279. <view slot="title">发票预览:</view>
  280. <view>
  281. <image class="preview" @click="previewImg(invoiceDetail)" :src="$method.splitImgHost(invoiceDetail.invoiceImg)"></image>
  282. <view class="download-btn" @click="download(invoiceDetail)">下载电子发票</view>
  283. </view>
  284. </u-cell-item>
  285. <u-cell-item :border-bottom="false" hover-class="none" :arrow="false">
  286. <view slot="title">机构发票邮寄状态:</view>
  287. <text class="text" v-if="invoiceDetail.sendInvoice == 1">是</text>
  288. <text class="text" v-else>否</text>
  289. </u-cell-item>
  290. <u-cell-item v-if="invoiceDetail.sendInvoice == 1" @click.stop="copy(invoiceDetail.trackingNum)" :border-bottom="false" hover-class="none" :arrow="false">
  291. <view slot="title">发票邮寄快递单号:(点击可复制)</view>
  292. <text class="text">{{invoiceDetail.trackingNum}}</text>
  293. </u-cell-item>
  294. </view>
  295. </view>
  296. </view>
  297. </view>
  298. </scroll-view>
  299. </view>
  300. <view class="order-detail__btns" v-if="invoiceDetail.periodStatus == 1">
  301. <view class="btn" @click="orderDetailModal = false;">知道了</view>
  302. <view class="btn warm" @click="orderCancelModal = true;">撤销申请</view>
  303. </view>
  304. <view class="order-detail__btns" v-else>
  305. <view class="btn ok" @click="orderDetailModal = false;">知道了</view>
  306. </view>
  307. </view>
  308. </u-popup>
  309. <u-popup class="modal" v-model="orderCancelModal" mode="center" border-radius="24">
  310. <view class="order-cancel">
  311. <view class="header">
  312. 温馨提示
  313. </view>
  314. <view class="body">
  315. <view>撤销申请后,</view>
  316. <view>本次的发票申请内容将不存在。</view>
  317. <view>请慎重考虑。 </view>
  318. <view>您确定要取消本次发票申请吗?</view>
  319. </view>
  320. <view class="footer">
  321. <view class="btn cancel" @click="orderCancelModal = false;">取消</view>
  322. <view class="btn ok" @click="orderCancel()">确定</view>
  323. </view>
  324. </view>
  325. </u-popup>
  326. </view>
  327. </template>
  328. <script>
  329. import { mapGetters } from 'vuex';
  330. export default {
  331. components: {},
  332. data() {
  333. return {
  334. checkOrderList:[],
  335. recordList:[],
  336. list: [
  337. {
  338. name: '发票申请'
  339. },
  340. {
  341. name: '发票记录'
  342. }
  343. ],
  344. invoiceDetail:{
  345. amount:0
  346. },
  347. form:{
  348. type:'1',
  349. subject:'',
  350. invoiceTitle:'',
  351. orderGoodsIds:'',
  352. taxRegistryNumber:'',
  353. companyAddress:'',
  354. phone:'',
  355. bankName:'',
  356. bankAccount:'',
  357. receivingAddress:'',
  358. receivingName:'',
  359. receivingTel:'',
  360. },
  361. rules: {
  362. receivingTel: [
  363. {
  364. required: true,
  365. message: '请输入收件手机',
  366. // 可以单个或者同时写两个触发验证方式
  367. trigger: ['change'],
  368. },
  369. {
  370. validator: (rule, value, callback) => {
  371. // 上面有说,返回true表示校验通过,返回false表示不通过
  372. // this.$u.test.mobile()就是返回true或者false的
  373. return this.$u.test.mobile(value);
  374. },
  375. message: '手机号码格式不正确',
  376. // 触发器可以同时用blur和change
  377. trigger: ['change'],
  378. }
  379. ],
  380. type: [
  381. {
  382. required: true,
  383. message: '请选择发票类型',
  384. // 可以单个或者同时写两个触发验证方式
  385. trigger: ['change'],
  386. }
  387. ],
  388. subject: [
  389. {
  390. required: true,
  391. message: '请选择申请主体',
  392. // 可以单个或者同时写两个触发验证方式
  393. trigger: ['change'],
  394. }
  395. ],
  396. invoiceTitle: [
  397. {
  398. required: true,
  399. message: '请输入发票抬头',
  400. // 可以单个或者同时写两个触发验证方式
  401. trigger: ['change'],
  402. }
  403. ],
  404. taxRegistryNumber: [
  405. {
  406. required: true,
  407. message: '请输入单位税号',
  408. // 可以单个或者同时写两个触发验证方式
  409. trigger: ['change'],
  410. }
  411. ],
  412. companyAddress: [
  413. {
  414. required: true,
  415. message: '请输入单位地址',
  416. // 可以单个或者同时写两个触发验证方式
  417. trigger: ['change'],
  418. }
  419. ],
  420. phone: [
  421. {
  422. required: true,
  423. message: '请输入电话号码',
  424. // 可以单个或者同时写两个触发验证方式
  425. trigger: ['change'],
  426. }
  427. ],
  428. bankName: [
  429. {
  430. required: true,
  431. message: '请输入开户银行',
  432. // 可以单个或者同时写两个触发验证方式
  433. trigger: ['change'],
  434. }
  435. ],
  436. bankAccount: [
  437. {
  438. required: true,
  439. message: '请输入银行账号',
  440. // 可以单个或者同时写两个触发验证方式
  441. trigger: ['change'],
  442. }
  443. ],
  444. receivingAddress: [
  445. {
  446. required: true,
  447. message: '请输入收件地址',
  448. // 可以单个或者同时写两个触发验证方式
  449. trigger: ['change'],
  450. }
  451. ],
  452. receivingName: [
  453. {
  454. required: true,
  455. message: '请输入收件人',
  456. // 可以单个或者同时写两个触发验证方式
  457. trigger: ['change'],
  458. }
  459. ],
  460. orderGoodsIds: [
  461. {
  462. required: true,
  463. message: '请选择订单',
  464. // 可以单个或者同时写两个触发验证方式
  465. trigger: ['change'],
  466. }
  467. ],
  468. },
  469. orderValue:'',
  470. orderList:[],
  471. selectOrderModal:false,
  472. orderDetailModal:false,
  473. orderCancelModal:false,
  474. current: 0,
  475. invoicePirce:0,
  476. order: [],
  477. typeList:[{
  478. name:'普通发票',
  479. value:'1'
  480. },{
  481. name:'增值税专用发票',
  482. value:'2'
  483. }],
  484. mainList:[{
  485. name:'个人',
  486. value:'1'
  487. },{
  488. name:'企业',
  489. value:'2'
  490. }]
  491. };
  492. },
  493. // onPullDownRefresh() {},
  494. onLoad(option) {
  495. this.orderInvoiceCanInvoiceList();
  496. this.$refs.uForm.setRules(this.rules)
  497. },
  498. onShow() {
  499. },
  500. methods: {
  501. orderCancel() {
  502. let invoiceDetail = JSON.parse(JSON.stringify(this.invoiceDetail))
  503. invoiceDetail.status = -1;
  504. this.$api.orderInvoiceCancel(invoiceDetail).then(res => {
  505. if(res.data.code == 200) {
  506. this.orderInvoiceList();
  507. this.orderInvoiceCanInvoiceList();
  508. this.orderDetailModal = false;
  509. this.orderCancelModal = false;
  510. uni.showToast({
  511. title:'撤销成功',
  512. icon:'none'
  513. })
  514. } else {
  515. }
  516. })
  517. },
  518. showDetailModal(item) {
  519. this.orderDetailModal = true;
  520. this.invoiceDetail = item;
  521. },
  522. toFixed(number) {
  523. console.log(number.toFixed(2))
  524. return number.toFixed(2)
  525. },
  526. /**
  527. * 获取可开发票的订单
  528. */
  529. orderInvoiceCanInvoiceList() {
  530. this.$api.orderInvoiceCanInvoiceList().then(res => {
  531. if(res.data.code == 200) {
  532. res.data.rows.forEach(item => {
  533. item.checked = false;
  534. })
  535. this.orderList = res.data.rows;
  536. }
  537. })
  538. },
  539. /**
  540. * @param {Object} checkedState 显示状态
  541. * @param {Object} index 索引值
  542. * 修改开票订单列表显示状态
  543. */
  544. showOrder(showState,index) {
  545. this.$set(this.recordList[index],'checked',!showState)
  546. },
  547. /**
  548. * 发票申请提交
  549. */
  550. formSubmit() {
  551. this.$refs.uForm.validate(valid => {
  552. if(valid) {
  553. let data = JSON.parse(JSON.stringify(this.form));
  554. data.orderGoodsIds = data.orderGoodsIds.split(',')
  555. data.amount = this.invoicePirce
  556. this.$api.orderInvoice(data).then(res => {
  557. if(res.data.code == 200) {
  558. this.orderInvoiceCanInvoiceList();
  559. this.form = {
  560. type:'',
  561. subject:'',
  562. invoiceTitle:'',
  563. orderGoodsIds:'',
  564. taxRegistryNumber:'',
  565. companyAddress:'',
  566. phone:'',
  567. bankName:'',
  568. bankAccount:'',
  569. receivingAddress:'',
  570. receivingName:'',
  571. receivingTel:'',
  572. };
  573. uni.showToast({
  574. title:'申请成功'
  575. })
  576. } else {
  577. uni.showToast({
  578. icon:'none',
  579. title:res.data.msg
  580. })
  581. }
  582. })
  583. }
  584. })
  585. },
  586. /**
  587. * @param {Object} e value
  588. * 发票类型修改
  589. */
  590. formTypeChange(e) {
  591. console.log(e)
  592. if(e == '2') {
  593. this.$set(this.form,'subject','2')
  594. } else {
  595. this.$set(this.form,'subject','')
  596. }
  597. },
  598. /**
  599. * @param {Object} e
  600. * tabs 切换
  601. */
  602. change(e) {
  603. console.log(e)
  604. this.current = e;
  605. if(this.current == 1) {
  606. this.orderInvoiceList();
  607. }
  608. },
  609. orderInvoiceList() {
  610. this.$api.orderInvoiceList().then(res => {
  611. if(res.data.code == 200) {
  612. this.recordList = res.data.rows
  613. } else {
  614. uni.showToast({
  615. icon:'none',
  616. title:res.data.msg
  617. })
  618. }
  619. })
  620. },
  621. radioGroupChange(e) {
  622. console.log(e)
  623. },
  624. copy(str) {
  625. let newStr = String(str)
  626. uni.setClipboardData({
  627. data: newStr,
  628. success: function () {
  629. console.log('success');
  630. }
  631. });
  632. },
  633. okPopup() {
  634. this.selectOrderModal = false;
  635. let strArr = [];
  636. this.invoicePirce = 0;
  637. this.orderList.forEach((item,index) => {
  638. if(item.checked) {
  639. this.$set(this.orderList[index],'disabled',true)
  640. strArr.push(item.orderGoodsId)
  641. this.invoicePirce += item.goodsPrice
  642. }
  643. })
  644. this.form.orderGoodsIds = strArr.join(',')
  645. this.$nextTick(() => {
  646. this.$refs.orderGoodsIds.onFieldChange()
  647. })
  648. console.log(this.$refs.orderGoodsIds)
  649. },
  650. deleteOrder(index) {
  651. this.$set(this.orderList[index],'disabled',false)
  652. this.$set(this.orderList[index],'checked',false)
  653. let strArr = [];
  654. this.invoicePirce = 0;
  655. this.orderList.forEach((item,index) => {
  656. if(item.checked) {
  657. strArr.push(item.orderGoodsId)
  658. this.invoicePirce += item.goodsPrice
  659. }
  660. })
  661. this.form.orderGoodsIds = strArr.join(',')
  662. this.$nextTick(() => {
  663. this.$refs.orderGoodsIds.onFieldChange()
  664. })
  665. },
  666. previewImg(item) {
  667. // 预览图片
  668. uni.previewImage({
  669. urls: [this.$method.splitImgHost(item.invoiceImg,true,1000)],
  670. longPressActions: {
  671. itemList: ['发送给朋友', '保存图片', '收藏'],
  672. success: function(data) {
  673. console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
  674. },
  675. fail: function(err) {
  676. console.log(err.errMsg);
  677. }
  678. }
  679. });
  680. },
  681. download(item) {
  682. //获取相册授权
  683. uni.getSetting({
  684. success:(res) => {
  685. if (!res.authSetting['scope.writePhotosAlbum']) {
  686. uni.authorize({
  687. scope: 'scope.writePhotosAlbum',
  688. success() {
  689. //这里是用户同意授权后的回调
  690. this.saveImgToLocal(item);
  691. },
  692. fail() {//这里是用户拒绝授权后的回调
  693. }
  694. })
  695. } else {//用户已经授权过了
  696. this.saveImgToLocal(item);
  697. }
  698. }
  699. })
  700. },
  701. saveImgToLocal(item){
  702. uni.showModal({
  703. title: '提示',
  704. content: '确定保存到相册吗',
  705. success: (res) => {
  706. if (res.confirm) {
  707. uni.downloadFile({
  708. url: this.$method.splitImgHost(item.invoiceImg,true,1000),//图片地址
  709. success: (res) =>{
  710. if (res.statusCode === 200){
  711. uni.saveImageToPhotosAlbum({
  712. filePath: res.tempFilePath,
  713. success: function() {
  714. uni.showToast({
  715. title: "保存成功",
  716. icon: "none"
  717. });
  718. },
  719. fail: function() {
  720. uni.showToast({
  721. title: "保存失败",
  722. icon: "none"
  723. });
  724. }
  725. });
  726. }
  727. }
  728. })
  729. } else if (res.cancel) {
  730. }
  731. }
  732. });
  733. }
  734. },
  735. computed: { ...mapGetters(['userInfo']) }
  736. };
  737. </script>
  738. <style>
  739. page {
  740. background: #eaeef1;
  741. }
  742. </style>
  743. <style scoped lang="scss">
  744. .invoice {
  745. &__tabs {
  746. width: 100%;
  747. text-align: center;
  748. position: fixed;
  749. height: 96rpx;
  750. z-index: 999;
  751. }
  752. &__content {
  753. padding-top:96rpx;
  754. .open {
  755. padding-bottom:150rpx;
  756. margin:8rpx 24rpx 0;
  757. .form {
  758. padding:24rpx;
  759. width: 702rpx;
  760. background: #FFFFFF;
  761. border-radius: 24rpx;
  762. // /deep/ .u-input__input {
  763. // text-align: right;
  764. // }
  765. .form-item {
  766. height:78rpx;
  767. display: flex;
  768. align-items: center;
  769. .text {
  770. font-size: 28rpx;
  771. width:120rpx;
  772. // color: #999999;
  773. }
  774. .content {
  775. flex:1;
  776. text-align: left;
  777. color:#bbb;
  778. }
  779. }
  780. .check-order {
  781. margin-top:20rpx;
  782. width: 654rpx;
  783. height: 168rpx;
  784. background: #F5F5F5;
  785. border: 2px solid #F5F5F5;
  786. padding:20rpx;
  787. position:relative;
  788. .close {
  789. position:absolute;
  790. right:0;
  791. top:0;
  792. }
  793. .title,.number,.price {
  794. color:#333333;
  795. margin-top:10rpx;
  796. line-height: 30rpx;
  797. font-size: 30rpx;
  798. }
  799. .number {
  800. color:#999;
  801. }
  802. }
  803. }
  804. .order-text {
  805. margin-top:16rpx;
  806. padding:0 30rpx;
  807. width: 702rpx;
  808. height: 80rpx;
  809. background: #FFFFFF;
  810. border-radius: 24rpx;
  811. display: flex;
  812. align-items: center;
  813. &__label {
  814. font-size: 24rpx;
  815. }
  816. &__price {
  817. font-size: 30rpx;
  818. margin-left:20rpx;
  819. color:#FF2D55;
  820. }
  821. }
  822. .submit {
  823. text-align: center;
  824. line-height: 80rpx;
  825. color:#fff;
  826. font-size: 30rpx;
  827. width: 526rpx;
  828. height: 80rpx;
  829. background: #007AFF;
  830. box-shadow: 0rpx 8rpx 7rpx 1rpx rgba(0, 122, 255, 0.1);
  831. border-radius: 40rpx;
  832. position:fixed;
  833. left:50%;
  834. bottom:40rpx;
  835. z-index: 999;
  836. transform: translateX(-50%);
  837. }
  838. }
  839. .record {
  840. .nodata {
  841. padding-top:160rpx;
  842. font-size: 32rpx;
  843. text-align: center;
  844. color: #999999;
  845. }
  846. &__list {
  847. .record-item {
  848. margin:0 8rpx 10rpx;
  849. .item__time {
  850. padding:20rpx 0;
  851. text-align: center;
  852. font-size: 24rpx;
  853. color: #999999;
  854. }
  855. .item__content {
  856. background:#fff;
  857. border-radius: 16rpx;
  858. .top {
  859. padding:12rpx 0;
  860. border-bottom:1px solid #EEEEEE;
  861. .state {
  862. position:relative;
  863. text-align: center;
  864. color:#fff;
  865. font-size: 30rpx;
  866. margin:0 auto;
  867. width: 240rpx;
  868. height: 56rpx;
  869. line-height: 56rpx;
  870. background: #007AFF;
  871. border-radius: 28rpx;
  872. &.wait {
  873. background: #007AFF;
  874. }
  875. &.refuse {
  876. background: #FF3B30;
  877. }
  878. &.agree {
  879. background: #34C759;
  880. }
  881. .arrow {
  882. position:absolute;
  883. top:50%;
  884. transform: translateY(-50%);
  885. right:18rpx;
  886. }
  887. }
  888. }
  889. .bottom {
  890. padding:0 32rpx;
  891. .flex {
  892. height:80rpx;
  893. display: flex;
  894. align-items: center;
  895. border-bottom:1px solid #EEEEEE;
  896. &.noborder{
  897. border:0;
  898. }
  899. .text {
  900. font-size: 24rpx;
  901. color: #666666;
  902. }
  903. &__auto {
  904. text-align: right;
  905. flex:1;
  906. font-size: 30rpx;
  907. font-weight: bold;
  908. color: #666666;
  909. .red {
  910. color:#FF3B30;
  911. }
  912. .green {
  913. color:#34C759;
  914. }
  915. }
  916. }
  917. .order-list {
  918. padding-bottom:30rpx;
  919. .order-item {
  920. border-radius: 16rpx;
  921. padding:14rpx;
  922. background:#F5F5F5;
  923. font-size: 30rpx;
  924. color:#333;
  925. margin-top:16rpx;
  926. }
  927. }
  928. }
  929. }
  930. }
  931. }
  932. }
  933. }
  934. .modal {
  935. .select-order {
  936. .line {
  937. width: 80rpx;
  938. height: 8rpx;
  939. background: #999999;
  940. border-radius: 4rpx;
  941. margin:8rpx auto 0;
  942. }
  943. .title {
  944. margin:20rpx 0 15rpx;
  945. text-align: center;
  946. font-size: 24rpx;
  947. color: #999999;
  948. }
  949. .order-item {
  950. display: flex;
  951. align-items: center;
  952. padding: 20rpx;
  953. &__bg {
  954. width: 654rpx;
  955. height: 168rpx;
  956. background: #F5F5F5;
  957. border: 2px solid #F5F5F5;
  958. border-radius: 16rpx;
  959. padding:20rpx;
  960. &.active {
  961. background: #EBF5FF;
  962. border: 2px solid #007AFF;
  963. }
  964. .order-title,.order-number,.order-price {
  965. color:#333333;
  966. margin-top:10rpx;
  967. line-height: 30rpx;
  968. font-size: 30rpx;
  969. }
  970. .order-number {
  971. color:#999;
  972. }
  973. }
  974. }
  975. .confrim-btn {
  976. width: 750rpx;
  977. height: 98rpx;
  978. background: rgba(255, 255, 255, 0.98);
  979. display: flex;
  980. align-items: center;
  981. justify-content: center;
  982. .okBtn {
  983. text-align: center;
  984. line-height: 64rpx;
  985. color:#fff;
  986. font-size: 30rpx;
  987. width: 200rpx;
  988. height: 64rpx;
  989. background: linear-gradient(0deg, #015EEA, #00C0FA);
  990. border-radius: 32rpx;
  991. }
  992. }
  993. }
  994. .order-detail {
  995. width: 640rpx;
  996. height: 1000rpx;
  997. background: #FFFFFF;
  998. display: flex;
  999. flex-direction: column;
  1000. &__content {
  1001. flex:1;
  1002. .content {
  1003. padding:24rpx 24rpx 0;
  1004. /deep/ .u-cell {
  1005. padding:10rpx;
  1006. &_title {
  1007. color:#999;
  1008. }
  1009. &__value {
  1010. color:#333;
  1011. text-align: left;
  1012. }
  1013. .text {
  1014. &.wait {
  1015. color:#007AFF;
  1016. }
  1017. &.agree {
  1018. color:#34C759;
  1019. }
  1020. &.refuse {
  1021. color:#FF3B30;
  1022. }
  1023. }
  1024. .preview {
  1025. width:240rpx;
  1026. height:160rpx;
  1027. }
  1028. .download-btn {
  1029. margin:10rpx 0 0;
  1030. text-align: center;
  1031. line-height: 56rpx;
  1032. color:#fff;
  1033. font-size: 30rpx;
  1034. width: 224rpx;
  1035. height: 56rpx;
  1036. background: #007AFF;
  1037. border-radius: 16rpx;
  1038. }
  1039. }
  1040. .header {
  1041. font-size: 30rpx;
  1042. font-weight: bold;
  1043. color: #333333;
  1044. line-height: 48rpx;
  1045. }
  1046. .body {
  1047. &__item {
  1048. border-bottom:1px solid #EEEEEE;
  1049. padding-bottom:30rpx;
  1050. &:last-child {
  1051. border:0;
  1052. }
  1053. .title {
  1054. margin-top:30rpx;
  1055. font-size: 24rpx;
  1056. color: #007AFF;
  1057. line-height: 48rpx;
  1058. &::before {
  1059. content:'';
  1060. width: 4rpx;
  1061. height: 24rpx;
  1062. background: #007AFF;
  1063. border-radius: 2rpx;
  1064. display: inline-block;
  1065. margin-right:10rpx;
  1066. }
  1067. }
  1068. .order-list {
  1069. .order-item {
  1070. overflow: hidden;
  1071. border-radius: 16rpx;
  1072. padding:0 14rpx 14rpx;
  1073. background:#F5F5F5;
  1074. font-size: 30rpx;
  1075. color:#333;
  1076. margin-top:16rpx;
  1077. .order-title,.order-number,.order-price {
  1078. color:#333333;
  1079. margin-top:20rpx;
  1080. line-height: 26rpx;
  1081. font-size: 26rpx;
  1082. }
  1083. .order-number {
  1084. color:#999;
  1085. }
  1086. }
  1087. }
  1088. .order-text {
  1089. margin-top:16rpx;
  1090. padding:0 30rpx;
  1091. height: 80rpx;
  1092. background: #F5F5F5;
  1093. border-radius: 16rpx;
  1094. display: flex;
  1095. align-items: center;
  1096. &__label {
  1097. font-size: 24rpx;
  1098. color:#999999;
  1099. }
  1100. &__price {
  1101. font-size: 30rpx;
  1102. margin-left:20rpx;
  1103. color:#FF2D55;
  1104. }
  1105. }
  1106. }
  1107. }
  1108. }
  1109. }
  1110. &__btns {
  1111. border-top:1px solid #EEEEEE;
  1112. padding:0 24rpx;
  1113. width: 100%;
  1114. height: 140rpx;
  1115. background: #FFFFFF;
  1116. display: flex;
  1117. justify-content: center;
  1118. align-items: center;
  1119. .btn {
  1120. text-align: center;
  1121. width: 200rpx;
  1122. height: 80rpx;
  1123. line-height: 80rpx;
  1124. background: #F5F5F5;
  1125. border-radius: 40rpx;
  1126. color:#007AFF;
  1127. font-size: 30rpx;
  1128. margin:0 10rpx;
  1129. &.warm {
  1130. background: #FF3B30;
  1131. color:#fff;
  1132. }
  1133. &.ok {
  1134. color:#fff;
  1135. width: 526rpx;
  1136. height: 80rpx;
  1137. background: #007AFF;
  1138. border-radius: 40rpx;
  1139. }
  1140. }
  1141. }
  1142. }
  1143. .order-cancel {
  1144. width: 640rpx;
  1145. height: 439rpx;
  1146. background: #FFFFFF;
  1147. padding:40rpx;
  1148. .header {
  1149. text-align: center;
  1150. font-size: 30rpx;
  1151. font-weight: bold;
  1152. color: #333333;
  1153. line-height: 48rpx;
  1154. }
  1155. .body {
  1156. margin-top:40rpx;
  1157. view {
  1158. font-size: 30rpx;
  1159. color: #666666;
  1160. line-height: 48rpx;
  1161. }
  1162. }
  1163. .footer {
  1164. margin-top:40rpx;
  1165. display: flex;
  1166. align-items: center;
  1167. justify-content: center;
  1168. .btn {
  1169. text-align: center;
  1170. line-height: 80rpx;
  1171. font-size: 30rpx;
  1172. color:#007AFF;
  1173. width: 200rpx;
  1174. height: 80rpx;
  1175. background: #F5F5F5;
  1176. border-radius: 40rpx;
  1177. margin:0 10rpx;
  1178. &.ok {
  1179. color:#fff;
  1180. background: #007AFF;
  1181. }
  1182. }
  1183. }
  1184. }
  1185. }
  1186. }
  1187. </style>