Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

invoice-header-add.vue 6.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. <template>
  2. <view class="bg">
  3. <view class="t-select">
  4. <view @click="radioChange(1)" class="item-select l-item" :class="{active:form.titleType==1}">
  5. 单位
  6. </view>
  7. <view @click="radioChange(2)" class="item-select r-item"
  8. :class="{active:form.titleType==2}">
  9. 个人
  10. </view>
  11. </view>
  12. <u-form label-width="230" :model="form" ref="uForm" :label-style='labelStyle'>
  13. <u-form-item label="抬头名称" :left-icon='`${$imgUrl}issuance/point-form.png`' :left-icon-style='leftIcon'
  14. borderBottom>
  15. <u-input placeholder='请输入抬头名称' v-model="form.buyerName" inputAlign="right" />
  16. </u-form-item>
  17. <u-form-item label="纳税人识别号" :left-icon='`${$imgUrl}issuance/point-form.png`' :left-icon-style='leftIcon'
  18. borderBottom>
  19. <u-input placeholder='请输入纳税人识别号' v-model="form.buyerTaxNo"
  20. inputAlign="right" />
  21. </u-form-item>
  22. <u-form-item v-if="form.titleType==1" label="单位地址" :left-icon='`${$imgUrl}issuance/point-form.png`' :left-icon-style='leftIcon'
  23. borderBottom>
  24. <u-input placeholder='请输入单位地址' v-model="form.companyAddress"
  25. inputAlign="right" />
  26. </u-form-item>
  27. <u-form-item v-if="form.titleType==1" label="公司电话号码" :left-icon='`${$imgUrl}issuance/point-form.png`' :left-icon-style='leftIcon'
  28. borderBottom>
  29. <u-input placeholder='请输入公司电话号码' type="number" v-model="form.companyTel" maxlength="11"
  30. inputAlign="right" />
  31. </u-form-item>
  32. <u-form-item v-if="form.titleType==1" label="开户银行" :left-icon='`${$imgUrl}issuance/point-form.png`' :left-icon-style='leftIcon'
  33. borderBottom>
  34. <u-input placeholder='请输入开户银行' v-model="form.bankName"
  35. inputAlign="right" />
  36. </u-form-item>
  37. <u-form-item v-if="form.titleType==1" label="银行账户" :left-icon='`${$imgUrl}issuance/point-form.png`' :left-icon-style='leftIcon'
  38. borderBottom>
  39. <u-input placeholder='请输入银行账户' type="number" v-model="form.bankAccount"
  40. inputAlign="right" />
  41. </u-form-item>
  42. <u-form-item label="设置默认抬头" :left-icon='`${$imgUrl}issuance/point-form.png`' :left-icon-style='leftIcon'
  43. borderBottom>
  44. <view style="display: flex;justify-content: flex-end;">
  45. <u-switch v-model="checked" active-color="#00B38B" inactive-color="#DCDCDC"
  46. @change='change'></u-switch>
  47. </view>
  48. </u-form-item>
  49. </u-form>
  50. </view>
  51. <view class="action">
  52. <button type="default" class="ui-btn" @click="submit()">
  53. 新增
  54. </button>
  55. </view>
  56. </template>
  57. <script setup lang="ts">
  58. import {
  59. ref,
  60. reactive
  61. } from "vue";
  62. import { billRaiseInsert } from "@/utils/network/api.js";
  63. import {requestNew } from "@/utils/network/request.js";
  64. import { msg } from "@/utils/utils";
  65. import { onLoad } from "@dcloudio/uni-app";
  66. import { getItem } from "../../../utils/storage";
  67. const form = reactive({
  68. titleType: 1, //抬头类型 1-单位抬头 2个人抬头
  69. buyerName: '',
  70. isDefault: 0, //1:默认抬头;0:非默认抬头
  71. buyerTaxNo: "",//纳税人识别号
  72. companyAddress: "", //单位地址
  73. companyTel: "",//公司电话号码
  74. bankName: "",//开户银行
  75. bankAccount: "",//银行账号
  76. userMobile: "",//客户手机号
  77. })
  78. const labelStyle = {
  79. color: "#004576",
  80. fontSize: "28rpx",
  81. }
  82. const leftIcon = {
  83. height: '100%',
  84. width: '8rpx',
  85. display: 'flex',
  86. 'align-items': 'center',
  87. 'margin-right': '4rpx',
  88. }
  89. // 单选数据列表
  90. const radiolist1 = reactive([{
  91. name: '单位',
  92. disabled: false
  93. },
  94. {
  95. name: '个人',
  96. disabled: false
  97. },
  98. ])
  99. onLoad((options) => {
  100. })
  101. const checked = ref(false)
  102. const change = (status) => {
  103. if (status) {
  104. form.isDefault = 1
  105. } else {
  106. form.isDefault = 0
  107. }
  108. console.log(status, form.isDefault);
  109. }
  110. // 单选默认数据
  111. const radiovalue1 = ref('单位')
  112. // 单选
  113. const radioChange = (n) => {
  114. console.log('radioChange', n);
  115. form.titleType=n
  116. empty()
  117. }
  118. const empty = () => {
  119. form.buyerName = "";
  120. form.isDefault = 0;
  121. form.buyerTaxNo = "";
  122. form.companyAddress = "";
  123. form.companyTel = "";
  124. form.bankName = "";
  125. form.bankAccount = "";
  126. checked.value = false
  127. }
  128. const submit = () => {
  129. if (!form.buyerName) {
  130. msg("请输入抬头名称!");
  131. return;
  132. }
  133. // 抬头类型为单位时必填 纳税人识别号
  134. if (!form.buyerTaxNo) {
  135. msg("请输入纳税人识别号!");
  136. return;
  137. }
  138. var data = {
  139. titleType: form.titleType,
  140. buyerName: form.buyerName,
  141. isDefault: form.isDefault,
  142. buyerTaxNo: form.buyerTaxNo,
  143. companyAddress: form.companyAddress,
  144. companyTel: form.companyTel,
  145. bankName: form.bankName,
  146. bankAccount: form.bankAccount,
  147. userMobile: getItem('mobile'),
  148. customerId: getItem('customerObj')['customerId'],
  149. };
  150. const options = {
  151. type: 2,
  152. data: data,
  153. method: "POST",
  154. showLoading: true,
  155. };
  156. requestNew(billRaiseInsert, options).then((res) => {
  157. const data =res;
  158. console.log("data", data)
  159. uni.navigateBack({
  160. delta: 1
  161. })
  162. });
  163. }
  164. </script>
  165. <style>
  166. page {
  167. width: 100%;
  168. height: 100%;
  169. }
  170. </style>
  171. <style lang="scss" scoped>
  172. .bg {
  173. background-color: white;
  174. width: 88%;
  175. margin: 0 auto;
  176. margin-top: 20rpx;
  177. border-radius: 12px;
  178. border: 1px solid #FFFFFF;
  179. padding: 20rpx;
  180. overflow: hidden;
  181. .des {
  182. font-weight: 400;
  183. font-size: 28rpx;
  184. color: #01243A;
  185. line-height: 56rpx;
  186. margin-top: 10rpx;
  187. text-indent: 1rem;
  188. }
  189. }
  190. .action {
  191. position: fixed;
  192. left: 0;
  193. bottom: 0;
  194. height: 188rpx;
  195. background-color: #fff;
  196. border-radius: 30rpx 30rpx 0 0;
  197. width: 100vw;
  198. display: flex;
  199. align-items: center;
  200. justify-content: center;
  201. flex-direction: column;
  202. margin-top: 20rpx;
  203. }
  204. .t-select {
  205. display: flex;
  206. padding-bottom: 30rpx;
  207. justify-content: center;
  208. align-items: center;
  209. .item-select {
  210. width: 200rpx;
  211. height: 68rpx;
  212. font-family: SourceHanSansSC, SourceHanSansSC;
  213. font-weight: 400;
  214. font-size: 28rpx;
  215. color: #CCB375;
  216. text-align: center;
  217. line-height: 68rpx;
  218. border: 1rpx solid #CCB375;
  219. &.l-item {
  220. border-radius: 34rpx 0 0 34rpx;
  221. }
  222. &.r-item {
  223. border-radius: 0 34rpx 34rpx 0;
  224. }
  225. &.active {
  226. color: #fff;
  227. background: #CCB375;
  228. }
  229. }
  230. }
  231. </style>