applyForBilling.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  1. <template>
  2. <view class="container">
  3. <view class="card-box">
  4. <view class="card-item-box">
  5. <view class="required"></view>
  6. <view class="label">
  7. 开票金额
  8. </view>
  9. <view class="text">
  10. ¥{{ formData.form.price }}元
  11. </view>
  12. </view>
  13. </view>
  14. <u-form :model="formData.form" ref="formRef">
  15. <view class="card-box">
  16. <view class="card-item-box">
  17. <view class="required">*</view>
  18. <view class="label">
  19. 发票类型
  20. </view>
  21. <view class="text">
  22. <u-form-item prop="type">
  23. <u-radio-group v-model="formData.form.type">
  24. <u-radio
  25. @change="onTypeChange"
  26. v-for="(item, index) in typeList" :key="index"
  27. :name="item.name"
  28. icon-size="26"
  29. label-size="26"
  30. >
  31. {{item.name}}
  32. </u-radio>
  33. </u-radio-group>
  34. </u-form-item>
  35. </view>
  36. </view>
  37. <view class="card-item-box">
  38. <view class="required">*</view>
  39. <view class="label">
  40. 抬头类型
  41. </view>
  42. <view class="text">
  43. <u-form-item prop="titleType">
  44. <u-radio-group v-model="formData.form.titleType">
  45. <u-radio
  46. @change="onTitleTypeChange"
  47. v-for="(item, index) in titleTypeList" :key="index"
  48. :name="item.name"
  49. icon-size="26"
  50. label-size="26"
  51. >
  52. {{item.name}}
  53. </u-radio>
  54. </u-radio-group>
  55. </u-form-item>
  56. </view>
  57. </view>
  58. <view class="card-item-box">
  59. <view class="required">*</view>
  60. <view class="label">
  61. 抬头名称
  62. </view>
  63. <view class="text">
  64. <u-form-item prop="name">
  65. <u-input v-model="formData.form.name" type="text" :border="false" placeholder=""/>
  66. </u-form-item>
  67. </view>
  68. </view>
  69. <view class="card-item-box">
  70. <view class="required">{{formData.form.titleType === '企业单位' ? '*' : ''}}</view>
  71. <view class="label">
  72. 纳税人识别号
  73. </view>
  74. <view class="text">
  75. <u-form-item prop="number">
  76. <u-input v-model="formData.form.number" type="text" :border="false" placeholder=""/>
  77. </u-form-item>
  78. </view>
  79. </view>
  80. <view class="card-item-box">
  81. <view class="required">*</view>
  82. <view class="label">
  83. 收票人邮箱
  84. </view>
  85. <view class="text">
  86. <u-form-item prop="email">
  87. <u-input v-model="formData.form.email" type="text" :border="false" placeholder=""/>
  88. </u-form-item>
  89. </view>
  90. </view>
  91. <view class="card-item-box">
  92. <view class="required">*</view>
  93. <view class="label">
  94. 手机号码
  95. </view>
  96. <view class="text">
  97. <u-form-item prop="tel">
  98. <u-input v-model="formData.form.tel" type="text" :border="false" placeholder=""/>
  99. </u-form-item>
  100. </view>
  101. </view>
  102. <view class="card-item-box" v-if="showMore">
  103. <view class="required"></view>
  104. <view class="label">
  105. 地址
  106. </view>
  107. <view class="text">
  108. <u-form-item prop="address">
  109. <u-input v-model="formData.form.address" type="text" :border="false" placeholder=""/>
  110. </u-form-item>
  111. </view>
  112. </view>
  113. <view class="card-item-box" v-if="showMore">
  114. <view class="required"></view>
  115. <view class="label">
  116. 开户银行
  117. </view>
  118. <view class="text">
  119. <u-form-item prop="bank">
  120. <u-input v-model="formData.form.bank" type="text" :border="false" placeholder=""/>
  121. </u-form-item>
  122. </view>
  123. </view>
  124. <view class="card-item-box" v-if="showMore">
  125. <view class="required"></view>
  126. <view class="label">
  127. 银行账号
  128. </view>
  129. <view class="text">
  130. <u-form-item prop="bankAccount">
  131. <u-input v-model="formData.form.bankAccount" type="text" :border="false" placeholder=""/>
  132. </u-form-item>
  133. </view>
  134. </view>
  135. <view class="card-item-box" v-if="showMore">
  136. <view class="required"></view>
  137. <view class="label">
  138. 备注说明
  139. </view>
  140. <view class="text">
  141. <u-form-item prop="remark">
  142. <u-input v-model="formData.form.remark" type="text" :border="false" placeholder=""/>
  143. </u-form-item>
  144. </view>
  145. </view>
  146. <view class="card-item-box func" @click="showMore = !showMore">
  147. <view class="text">
  148. {{ showMore ? '收起' : '展开' }}选项信息&nbsp;<span class="iconfont icon-chevron-up" :class="{'reversal': !showMore}"></span>
  149. </view>
  150. </view>
  151. </view>
  152. <view class="bottom-box">
  153. <u-button type="error" shape="circle" @click="onSubmit">提交申请</u-button>
  154. </view>
  155. </u-form>
  156. </view>
  157. </template>
  158. <script setup>
  159. import { ref, reactive } from 'vue'
  160. import { onReady, onLoad } from '@dcloudio/uni-app'
  161. const showMore = ref(false)
  162. const formRef = ref()
  163. const formData = reactive({
  164. form: {
  165. orderIds: null, // 订单Id
  166. price: '0.00', // 开票金额
  167. type: '全电专票', // 发票类型
  168. titleType: '企业单位', // 抬头类型
  169. name: null, // 抬头名称
  170. number: null, // 纳税人识别号
  171. email: null, // 收票人邮箱
  172. tel: null, // 手机号码
  173. address: null, // 地址
  174. bank: null, // 开户银行
  175. bankAccount: null, // 银行账号
  176. remark: null // 备注说明
  177. },
  178. rules: {
  179. type: [
  180. {
  181. required: true,
  182. message: '请选择发票类型',
  183. // 可以单个或者同时写两个触发验证方式
  184. trigger: ['change','blur'],
  185. }
  186. ],
  187. titleType: [
  188. {
  189. required: true,
  190. message: '请选择抬头类型',
  191. // 可以单个或者同时写两个触发验证方式
  192. trigger: ['change','blur'],
  193. }
  194. ],
  195. name: [
  196. {
  197. required: true,
  198. message: '请输入抬头名称',
  199. // 可以单个或者同时写两个触发验证方式
  200. trigger: 'blur',
  201. }
  202. ],
  203. number: [
  204. {
  205. required: true,
  206. message: '请输入纳税人识别号',
  207. // 可以单个或者同时写两个触发验证方式
  208. trigger: 'blur',
  209. }
  210. ],
  211. email: [
  212. {
  213. required: true,
  214. message: '请输入收票人邮箱',
  215. // 可以单个或者同时写两个触发验证方式
  216. trigger: 'blur',
  217. }
  218. ],
  219. tel: [
  220. {
  221. required: true,
  222. message: '请输入手机号码',
  223. // 可以单个或者同时写两个触发验证方式
  224. trigger: 'blur',
  225. }
  226. ],
  227. }
  228. })
  229. const typeList = ref([
  230. {
  231. name: '全电专票'
  232. },
  233. {
  234. name: '全店普票'
  235. }
  236. ])
  237. const titleTypeList = ref([
  238. {
  239. name: '企业单位'
  240. },
  241. {
  242. name: '个人/非企业单位'
  243. }
  244. ])
  245. function onTypeChange(val) {}
  246. function onTitleTypeChange(val) {
  247. if (val !== '企业单位') {
  248. formData.rules.number[0].required = false
  249. } else {
  250. formData.rules.number[0].required = true
  251. }
  252. }
  253. function onSubmit() {
  254. formRef.value.validate((valid) => {
  255. if (valid) {
  256. uni.redirectTo({
  257. url: '/pages/invoiceResult/invoiceResult'
  258. })
  259. }
  260. })
  261. }
  262. onReady(() => {
  263. formRef.value.setRules(formData.rules)
  264. })
  265. onLoad((load) => {
  266. formData.form.orderIds = load.ids
  267. formData.form.price = load.price
  268. console.log('form', formData.form)
  269. })
  270. </script>
  271. <style lang="scss" scoped>
  272. .container {
  273. height: 100vh;
  274. width: 100vw;
  275. background-color: $uni-bg-color;
  276. padding: 0 20rpx;
  277. position: relative;
  278. .card-box {
  279. padding: 0 20rpx;
  280. background-color: $uni-text-color-inverse;
  281. border-radius: $uni-card-border-radius;
  282. margin-bottom: 20rpx;
  283. // &:first-child {
  284. // .card-item-box {
  285. // padding: 0;
  286. // }
  287. // }
  288. .card-item-box {
  289. display: flex;
  290. align-items: center;
  291. // padding: 20rpx 0;
  292. font-size: $uni-title-font-size-2;
  293. border-bottom: 1rpx solid #E6E6E6;
  294. height: 82rpx;
  295. &:last-child {
  296. border-bottom: none;
  297. }
  298. .required {
  299. width: 3%;
  300. color: $uni-color-error;
  301. font-weight: bold;
  302. }
  303. .label {
  304. width: 27%;
  305. font-weight: bold;
  306. }
  307. .text {
  308. width: 70%;
  309. ::v-deep .u-form-item {
  310. padding: 0 !important;
  311. line-height: 0;
  312. font-size: $uni-title-font-size-2;
  313. }
  314. }
  315. }
  316. .func {
  317. justify-content: center;
  318. text-align: center;
  319. color: $uni-text-color-grey;
  320. .reversal {
  321. display: inline-block;
  322. transform: rotate(180deg);
  323. }
  324. }
  325. }
  326. .bottom-box {
  327. padding: 20rpx;
  328. position: absolute;
  329. bottom: 50rpx;
  330. width: 95%;
  331. }
  332. }
  333. </style>