editinvoice.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  1. <template>
  2. <div class="editinvoice">
  3. <div class="top">
  4. <span>本次共选择{{ list.length }}个订单,合计¥{{ money }}</span>
  5. </div>
  6. <div class="tit">发票详情</div>
  7. <div class="formBar">
  8. <div class="form-item flex_r flex_jb">
  9. <div class="label">发票类型</div>
  10. <div class="input">增值税电子普通发票</div>
  11. </div>
  12. <div class="form-item flex_r flex_jb">
  13. <div class="label">抬头类型</div>
  14. <div class="input">
  15. <div class="option-i" @click="type = 1">
  16. <img
  17. src="@/static/img/xuanzhong_icon.png"
  18. v-if="type == 1"
  19. class="ico"
  20. alt=""
  21. />
  22. <img
  23. src="@/static/img/weixuanzhong_icon.png"
  24. v-else
  25. class="ico"
  26. alt=""
  27. />
  28. <span class="txt">个人或事业单位</span>
  29. </div>
  30. <div class="option-i" @click="type = 2">
  31. <img
  32. src="@/static/img/xuanzhong_icon.png"
  33. v-if="type == 2"
  34. class="ico"
  35. alt=""
  36. />
  37. <img
  38. src="@/static/img/weixuanzhong_icon.png"
  39. v-else
  40. class="ico"
  41. alt=""
  42. />
  43. <span class="txt">企业</span>
  44. </div>
  45. </div>
  46. </div>
  47. <div class="form-item flex_r flex_jb">
  48. <div class="label">发票抬头</div>
  49. <input class="input" placeholder="请填写发票抬头" v-model="gmf_mc" />
  50. </div>
  51. <div class="form-item flex_r flex_jb" v-if="type == 2">
  52. <div class="label">税号</div>
  53. <input class="input" placeholder="请填写税号" v-model="gmf_nsrsbh" />
  54. </div>
  55. <div class="form-item flex_r flex_jb" v-if="type == 1">
  56. <div class="label">身份证号</div>
  57. <input
  58. class="input"
  59. placeholder="请填写身份证号"
  60. v-model="gmf_nsrsbh"
  61. />
  62. </div>
  63. </div>
  64. <div class="tit">接收信息</div>
  65. <div class="formBar">
  66. <div class="form-item flex_r flex_jb">
  67. <div class="label">电子邮箱:</div>
  68. <input class="input" placeholder="请填写邮箱地址" v-model="email" />
  69. </div>
  70. <div class="form-item flex_r flex_jb">
  71. <div class="label">手机号码:</div>
  72. <input
  73. class="input"
  74. placeholder="请填写手机号码"
  75. :value="userinfo.mobile"
  76. disabled
  77. />
  78. </div>
  79. </div>
  80. <div class="submitBtn" @click="onsubmitBtn">提交</div>
  81. <uni-popup ref="uniPopup" type="bottom">
  82. <div class="uniPopup_Box">
  83. <div class="Popup_tit">开票信息确认</div>
  84. <div class="closeBtn iconfont" @click="closeBtn">&#xe609;</div>
  85. <div class="infoLi">
  86. <div class="info-item flex_r flex_jb">
  87. <div class="label">发票抬头</div>
  88. <div class="input">{{ gmf_mc }}</div>
  89. </div>
  90. <div class="info-item flex_r flex_jb">
  91. <div class="label">税号</div>
  92. <div class="input">{{ gmf_nsrsbh }}</div>
  93. </div>
  94. <div class="info-item flex_r flex_jb">
  95. <div class="label">价税合计</div>
  96. <div class="input">数字商城 {{ money }}元</div>
  97. </div>
  98. <div class="info-item flex_r flex_jb">
  99. <div class="label">电子邮箱</div>
  100. <div class="input">{{ email }}</div>
  101. </div>
  102. <div class="info-item flex_r flex_jb">
  103. <div class="label">手机号码</div>
  104. <div class="input">{{ userinfo.mobile }}</div>
  105. </div>
  106. </div>
  107. <div class="btn-bar flex_r flex_jb">
  108. <div class="btn-item" @click="reset">重置</div>
  109. <div class="btn-item confirm" @click="confirm">确认</div>
  110. </div>
  111. </div>
  112. </uni-popup>
  113. </div>
  114. </template>
  115. <script>
  116. import uniPopup from "@/components/uni-popup/uni-popup.vue";
  117. import { post } from "@/request/api.js";
  118. let app = getApp();
  119. var appEv = app.$vm.$options;
  120. export default {
  121. name: "editinvoice",
  122. components: {
  123. uniPopup,
  124. },
  125. data() {
  126. return {
  127. type: 1,
  128. list: [],
  129. money: 0,
  130. listString: undefined,
  131. userinfo: undefined,
  132. gmf_nsrsbh: undefined,
  133. gmf_mc: undefined,
  134. email: undefined,
  135. };
  136. },
  137. onLoad(option) {
  138. this.list = option.icheckList.split(",");
  139. this.money = option.money;
  140. this.userinfo = uni.getStorageSync("userinfo");
  141. },
  142. onLaunch() {},
  143. onShow() {},
  144. onHide() {},
  145. methods: {
  146. onsubmitBtn() {
  147. if (!this.email || !this.gmf_nsrsbh || !this.gmf_mc) {
  148. appEv.errTips("请完整填写资料");
  149. return;
  150. }
  151. this.$refs.uniPopup.open();
  152. },
  153. // 点击关闭弹窗
  154. closeBtn() {
  155. this.$refs.uniPopup.close();
  156. },
  157. confirm() {
  158. if (!this.email || !this.gmf_nsrsbh || !this.gmf_mc) {
  159. appEv.errTips("请完整填写资料");
  160. return;
  161. }
  162. let data = {
  163. type: this.type - 1,
  164. email: this.email,
  165. mobile: this.userinfo.mobile,
  166. gmf_mc: this.gmf_mc,
  167. gmf_nsrsbh: this.gmf_nsrsbh,
  168. orderId: this.list.toString(),
  169. };
  170. uni.showLoading({
  171. mask: true,
  172. title: "开票中...",
  173. });
  174. post("v1/invoice/invoicing", data).then((res) => {
  175. uni.hideLoading();
  176. if (res.code === 0) {
  177. this.goto("/pagesB/invoice/Billingresult", { id: res.data });
  178. }
  179. });
  180. },
  181. //重置
  182. reset() {
  183. this.gmf_nsrsbh = undefined;
  184. this.gmf_mc = undefined;
  185. this.email = undefined;
  186. this.type = 1;
  187. this.closeBtn();
  188. },
  189. },
  190. computed: {},
  191. watch: {},
  192. };
  193. </script>
  194. <style scoped lang='scss'>
  195. page {
  196. background-color: #f6f6f6;
  197. }
  198. .top {
  199. padding: 20rpx 36rpx;
  200. background: #fff;
  201. margin-bottom: 20rpx;
  202. span {
  203. font-size: 32rpx;
  204. }
  205. }
  206. .editinvoice {
  207. padding: 36rpx;
  208. .tit {
  209. font-size: 32rpx;
  210. font-weight: bold;
  211. margin-bottom: 26rpx;
  212. }
  213. .formBar {
  214. background: #fff;
  215. border-radius: 16rpx;
  216. padding: 36rpx 28rpx;
  217. margin-bottom: 52rpx;
  218. }
  219. .form-item {
  220. margin-bottom: 26rpx;
  221. font-size: 30rpx;
  222. &:last-child {
  223. margin-bottom: 0;
  224. }
  225. .label {
  226. width: 168rpx;
  227. }
  228. .input {
  229. width: calc(100% - 168rpx);
  230. text-align: right;
  231. }
  232. .option-i {
  233. display: inline-block;
  234. margin-right: 32rpx;
  235. &:last-child {
  236. margin-right: 0;
  237. }
  238. }
  239. .ico {
  240. width: 32rpx;
  241. height: 32rpx;
  242. margin-right: 6rpx;
  243. }
  244. .txt,
  245. .ico {
  246. vertical-align: middle;
  247. }
  248. }
  249. .submitBtn {
  250. height: 90rpx;
  251. line-height: 90rpx;
  252. border-radius: 45rpx;
  253. background: #18bb88;
  254. text-align: center;
  255. font-size: 34rpx;
  256. color: #fff;
  257. width: calc(100% - 72rpx);
  258. position: fixed;
  259. left: 36rpx;
  260. bottom: 46rpx;
  261. }
  262. }
  263. .uniPopup_Box {
  264. min-height: 40vh;
  265. background: #fff;
  266. border-radius: 36rpx 36rpx 0 0;
  267. padding: 0 36rpx 36rpx;
  268. position: relative;
  269. .Popup_tit {
  270. font-size: 32rpx;
  271. font-weight: bold;
  272. padding: 30rpx 0;
  273. text-align: center;
  274. }
  275. .closeBtn {
  276. position: absolute;
  277. right: 30rpx;
  278. top: 26rpx;
  279. font-size: 43rpx;
  280. color: #555;
  281. }
  282. .infoLi {
  283. padding: 20rpx 36rpx;
  284. background: #fafafa;
  285. border-radius: 16rpx;
  286. .info-item {
  287. margin-bottom: 26rpx;
  288. font-size: 30rpx;
  289. &:last-child {
  290. margin-bottom: 0;
  291. }
  292. .label {
  293. width: 140rpx;
  294. color: #333;
  295. text-align: justify;
  296. text-align-last: justify;
  297. }
  298. .input {
  299. width: calc(100% - 140rpx);
  300. text-align: right;
  301. color: #666;
  302. }
  303. }
  304. }
  305. .btn-bar {
  306. width: calc(100% - 72rpx);
  307. height: 80rpx;
  308. line-height: 80rpx;
  309. border-radius: 40rpx;
  310. position: absolute;
  311. bottom: 36rpx;
  312. left: 36rpx;
  313. border: 1px solid #18bb88;
  314. .btn-item {
  315. width: 50%;
  316. text-align: center;
  317. }
  318. .confirm {
  319. background: #18bb88;
  320. color: #fff;
  321. border-radius: 0 40rpx 40rpx 0;
  322. }
  323. }
  324. }
  325. </style>