Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

invoice-header-add.vue 6.5KB

vor 1 Jahr
vor 7 Monaten
vor 1 Jahr
vor 7 Monaten
vor 1 Jahr
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. <template>
  2. <view class="box">
  3. <view class="from">
  4. <u-form :model="form" ref="uForm">
  5. <u-form-item>
  6. <view class="from_item">
  7. <text>抬头类型:</text>
  8. <u-radio-group v-model="radiovalue1">
  9. <u-radio :customStyle="{marginBottom: '8px'}" activeColor="#2CE242"
  10. v-for="(item, index) in radiolist1" :key="index" :label="item.disabled"
  11. :name="item.name" @change="radioChange">
  12. {{item.name}}
  13. </u-radio>
  14. </u-radio-group>
  15. </view>
  16. </u-form-item>
  17. <u-form-item>
  18. <view class="from_item">
  19. <text><text style="color: red;">*</text>抬头名称:</text>
  20. <view style="display: flex;">
  21. <u-input v-model="form.buyerName" class="input" placeholder="请输入抬头名称" />
  22. </view>
  23. </view>
  24. </u-form-item>
  25. <u-form-item>
  26. <view class="from_item">
  27. <text><text style="color: red;">*</text>纳税人识别号:</text>
  28. <view style="display: flex;">
  29. <u-input v-model="form.buyerTaxNo" class="input" placeholder="请输入纳税人识别号" />
  30. </view>
  31. </view>
  32. </u-form-item>
  33. <u-form-item v-if="form.titleType==1">
  34. <view class="from_item">
  35. <text>单位地址</text>
  36. <view style="display: flex;">
  37. <u-input v-model="form.companyAddress" class="input" placeholder="请输入单位地址" />
  38. </view>
  39. </view>
  40. </u-form-item>
  41. <u-form-item v-if="form.titleType==1">
  42. <view class="from_item">
  43. <text>公司电话号码</text>
  44. <view style="display: flex;">
  45. <u-input v-model="form.companyTel" class="input" placeholder="请输入公司电话号码" type="number"
  46. maxlength="11" />
  47. </view>
  48. </view>
  49. </u-form-item>
  50. <u-form-item v-if="form.titleType==1">
  51. <view class="from_item">
  52. <text>开户银行</text>
  53. <view style="display: flex;">
  54. <u-input v-model="form.bankName" class="input" placeholder="请输入开户银行" />
  55. </view>
  56. </view>
  57. </u-form-item>
  58. <u-form-item v-if="form.titleType==1">
  59. <view class="from_item">
  60. <text>银行账户</text>
  61. <view style="display: flex;">
  62. <u-input v-model="form.bankAccount" class="input" placeholder="请输入银行账户" type="number" />
  63. </view>
  64. </view>
  65. </u-form-item>
  66. <view class="from_item">
  67. <text>设置默认抬头</text>
  68. <u-switch v-model="checked" active-color="#00B38B" inactive-color="#DCDCDC"
  69. @change='change'></u-switch>
  70. </view>
  71. </u-form>
  72. </view>
  73. <button class="submit" @click="submit()">保存</button>
  74. </view>
  75. </template>
  76. <script setup lang="ts">
  77. import {
  78. ref,
  79. reactive
  80. } from "vue";
  81. import { billRaiseInsert } from "@/utils/network/api.js";
  82. import {requestNew } from "@/utils/network/request.js";
  83. import { msg } from "@/utils/utils";
  84. import { onLoad } from "@dcloudio/uni-app";
  85. const form = reactive({
  86. titleType: 1, //抬头类型 1-单位抬头 2个人抬头
  87. buyerName: '',
  88. isDefault: -1, //1:默认抬头;-1:非默认抬头
  89. buyerTaxNo: "",//纳税人识别号
  90. companyAddress: "", //单位地址
  91. companyTel: "",//公司电话号码
  92. bankName: "",//开户银行
  93. bankAccount: "",//银行账号
  94. userMobile: "",//客户手机号
  95. })
  96. // 单选数据列表
  97. const radiolist1 = reactive([{
  98. name: '单位',
  99. disabled: false
  100. },
  101. {
  102. name: '个人',
  103. disabled: false
  104. },
  105. ])
  106. onLoad((options) => {
  107. form.userMobile = options.userMobile
  108. })
  109. const checked = ref(false)
  110. const change = (status) => {
  111. if (status) {
  112. form.isDefault = 1
  113. } else {
  114. form.isDefault = -1
  115. }
  116. console.log(status, form.isDefault);
  117. }
  118. // 单选默认数据
  119. const radiovalue1 = ref('单位')
  120. // 单选
  121. const radioChange = (n) => {
  122. console.log('radioChange', n);
  123. if (n == '单位') {
  124. form.titleType = 1
  125. console.log(form.titleType);
  126. } else {
  127. form.titleType = 2
  128. console.log(form.titleType);
  129. }
  130. empty()
  131. }
  132. const empty = () => {
  133. form.buyerName = "";
  134. form.isDefault = -1;
  135. form.buyerTaxNo = "";
  136. form.companyAddress = "";
  137. form.companyTel = "";
  138. form.bankName = "";
  139. form.bankAccount = "";
  140. checked.value = false
  141. }
  142. const submit = () => {
  143. if (!form.buyerName) {
  144. msg("请输入抬头名称!");
  145. return;
  146. }
  147. // 抬头类型为单位时必填 纳税人识别号
  148. if (!form.buyerTaxNo) {
  149. msg("请输入纳税人识别号!");
  150. return;
  151. }
  152. var data = {
  153. titleType: form.titleType,
  154. buyerName: form.buyerName,
  155. isDefault: form.isDefault,
  156. buyerTaxNo: form.buyerTaxNo,
  157. companyAddress: form.companyAddress,
  158. companyTel: form.companyTel,
  159. bankName: form.bankName,
  160. bankAccount: form.bankAccount,
  161. userMobile: form.userMobile,
  162. };
  163. const options = {
  164. type: 2,
  165. data: data,
  166. method: "POST",
  167. showLoading: true,
  168. };
  169. requestNew(billRaiseInsert, options).then((res) => {
  170. const data =res;
  171. console.log("data", data)
  172. uni.navigateBack({
  173. delta: 1
  174. })
  175. });
  176. }
  177. </script>
  178. <style>
  179. page {
  180. width: 100%;
  181. height: 100%;
  182. }
  183. </style>
  184. <style lang="scss" scoped>
  185. .box {
  186. width: 100%;
  187. height: 100%;
  188. background-color: #EEF7F7;
  189. border-top: 1rpx solid #DFDFDF;
  190. .from {
  191. background-color: #fff;
  192. margin-top: 30rpx;
  193. padding: 0 30rpx;
  194. box-shadow: 0rpx 2rpx 6rpx 0rpx rgba(223, 223, 223, 0.8);
  195. ::v-deep .u-form-item {
  196. padding: 0;
  197. line-height: normal;
  198. .u-form-item__message {
  199. margin-bottom: 12rpx
  200. }
  201. }
  202. .from_item {
  203. display: flex;
  204. flex-wrap: nowrap;
  205. justify-content: space-between;
  206. border-bottom: #DCDCDC 1px solid;
  207. align-items: center;
  208. height: 80rpx;
  209. text {
  210. font-size: 28rpx;
  211. font-family: Noto Sans S Chinese;
  212. font-weight: 400;
  213. color: #999999;
  214. }
  215. ::v-deep .input {
  216. text-align: right;
  217. flex: 1;
  218. input {
  219. text-align: right;
  220. }
  221. }
  222. }
  223. .from_item1 {
  224. display: flex;
  225. flex-wrap: nowrap;
  226. flex-direction: column;
  227. justify-content: space-between;
  228. padding: 30rpx;
  229. border-bottom: #DCDCDC 1px solid;
  230. input {
  231. text-align: right;
  232. }
  233. .textarea {
  234. background-color: #F1F1F1;
  235. width: 100%;
  236. border-radius: 20rpx;
  237. margin-top: 10rpx;
  238. text-indent: 1rem;
  239. height: 180rpx;
  240. padding: 20rpx;
  241. box-sizing: border-box;
  242. }
  243. }
  244. }
  245. .submit {
  246. width: 670rpx;
  247. height: 80rpx;
  248. background: linear-gradient(-90deg, #43A1E0 0%, #13E7C1 100%);
  249. border-radius: 40rpx;
  250. font-size: 32rpx;
  251. font-family: Noto Sans S Chinese;
  252. font-weight: 400;
  253. color: #FFFFFF;
  254. line-height: 80rpx;
  255. position: fixed;
  256. left: 50%;
  257. transform: translate(-50%);
  258. bottom: 100rpx;
  259. }
  260. }
  261. ::v-deep .u-icon__icon {
  262. top: -4px !important;
  263. }
  264. </style>