index.vue 39 KB

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