選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

invoice-header-edit.vue 7.6KB

1年前
1週間前
1年前
1週間前
1年前
1週間前
1年前
8ヶ月前
1年前
1週間前
1年前
1週間前
1年前
1週間前
1年前
1週間前
1年前
1週間前
1年前
1週間前
1年前
1週間前
1年前
1週間前
1年前
8ヶ月前
1年前
1週間前
1年前
1週間前
1年前
8ヶ月前
1年前
1週間前
1年前
1週間前
1年前
1週間前
1年前
1週間前
1年前
1週間前
1年前
1週間前
1年前
1週間前
1年前
1週間前
1年前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  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="btns" @click="submit()">保存</button>
  53. <button type="default" class="btns del" @click="del()">删除</button>
  54. </view>
  55. </template>
  56. <script setup lang="ts">
  57. import {
  58. ref,
  59. reactive
  60. } from "vue";
  61. import { billRaiseUpdate, billRaiseDelete } from "@/utils/network/api.js";
  62. import { requestNew } from "@/utils/network/request.js";
  63. import { msg} from "@/utils/utils";
  64. import { onLoad } from "@dcloudio/uni-app";
  65. import {
  66. getItem
  67. } from "@/utils/storage";
  68. const form = reactive({
  69. titleType: 1, //抬头类型 1-单位抬头 2个人抬头
  70. buyerName: '',
  71. isDefault:0, //1:默认抬头;0:非默认抬头
  72. buyerTaxNo: "",//纳税人识别号
  73. companyAddress: "", //单位地址
  74. companyTel: "",//公司电话号码
  75. bankName: "",//开户银行
  76. bankAccount: "",//银行账号
  77. id: "",
  78. })
  79. const labelStyle = {
  80. color: "#004576",
  81. fontSize: "28rpx",
  82. }
  83. const leftIcon = {
  84. height: '100%',
  85. width: '8rpx',
  86. display: 'flex',
  87. 'align-items': 'center',
  88. 'margin-right': '4rpx',
  89. }
  90. // 单选数据列表
  91. const radiolist1 = reactive([{
  92. name: '单位',
  93. disabled: false
  94. },
  95. {
  96. name: '个人',
  97. disabled: false
  98. },
  99. ])
  100. onLoad((options) => {
  101. let data = JSON.parse(decodeURIComponent(options.params))
  102. console.log("data", data, data.isDefault)
  103. form.buyerName = data.buyerName;
  104. form.isDefault = data.isDefault;
  105. form.buyerTaxNo = data.buyerTaxNo;
  106. form.companyAddress = data.companyAddress;
  107. form.companyTel = data.companyTel;
  108. form.bankName = data.bankName;
  109. form.bankAccount = data.bankAccount;
  110. form.titleType = data.titleType;
  111. form.id = data.id;
  112. if (data.isDefault==1) {
  113. checked.value = true
  114. } else {
  115. console.log("data.isDefault", data.isDefault)
  116. checked.value = false
  117. }
  118. })
  119. const checked = ref(false)
  120. const change = (status) => {
  121. if (status) {
  122. form.isDefault = 1
  123. } else {
  124. form.isDefault =0
  125. }
  126. console.log(status, form.isDefault);
  127. }
  128. // 单选
  129. const radioChange = (n) => {
  130. console.log('radioChange', n);
  131. form.titleType = n
  132. empty()
  133. }
  134. const empty = () => {
  135. form.buyerName = "";
  136. form.isDefault =0;
  137. form.buyerTaxNo = "";
  138. form.companyAddress = "";
  139. form.companyTel = "";
  140. form.bankName = "";
  141. form.bankAccount = "";
  142. checked.value = false
  143. }
  144. const submit = () => {
  145. if (!form.buyerName) {
  146. msg("请输入抬头名称!");
  147. return;
  148. }
  149. if (!form.buyerTaxNo) {
  150. msg("请输入纳税人识别号!");
  151. return;
  152. }
  153. var data = {
  154. titleType: form.titleType,
  155. buyerName: form.buyerName,
  156. isDefault: form.isDefault,
  157. buyerTaxNo: form.buyerTaxNo,
  158. companyAddress: form.companyAddress,
  159. companyTel: form.companyTel,
  160. bankName: form.bankName,
  161. bankAccount: form.bankAccount,
  162. userMobile: getItem('mobile'),
  163. id: form.id,
  164. customerId:getItem('customerObj')['customerId'],
  165. };
  166. const options = {
  167. type: 2,
  168. data: data,
  169. method: "POST",
  170. showLoading: true,
  171. };
  172. requestNew(billRaiseUpdate, options).then((res) => {
  173. const data = res;
  174. console.log("data", data)
  175. msg("修改成功")
  176. setTimeout(()=>{
  177. uni.navigateBack({
  178. delta: 1
  179. })
  180. },1500)
  181. });
  182. }
  183. const del = () => {
  184. var data = {
  185. id: form.id,
  186. userMobile: getItem('mobile'),
  187. };
  188. const options = {
  189. type: 2,
  190. data: data,
  191. method: "POST",
  192. showLoading: true,
  193. };
  194. requestNew(billRaiseDelete, options).then((res) => {
  195. const data = res;
  196. console.log("data", data)
  197. msg("删除成功")
  198. setTimeout(()=>{
  199. uni.navigateBack({
  200. delta: 1
  201. })
  202. },1500)
  203. });
  204. }
  205. </script>
  206. <style>
  207. page {
  208. width: 100%;
  209. height: 100%;
  210. }
  211. </style>
  212. <style lang="scss" scoped>
  213. .bg {
  214. background-color: white;
  215. width: 88%;
  216. margin: 0 auto;
  217. margin-top: 20rpx;
  218. border-radius: 12px;
  219. border: 1px solid #FFFFFF;
  220. padding: 20rpx;
  221. overflow: hidden;
  222. .des {
  223. font-weight: 400;
  224. font-size: 28rpx;
  225. color: #01243A;
  226. line-height: 56rpx;
  227. margin-top: 10rpx;
  228. text-indent: 1rem;
  229. }
  230. }
  231. .t-select {
  232. display: flex;
  233. padding-bottom: 30rpx;
  234. justify-content: center;
  235. align-items: center;
  236. .item-select {
  237. width: 200rpx;
  238. height: 68rpx;
  239. font-family: SourceHanSansSC, SourceHanSansSC;
  240. font-weight: 400;
  241. font-size: 28rpx;
  242. color: #CCB375;
  243. text-align: center;
  244. line-height: 68rpx;
  245. border: 1rpx solid #CCB375;
  246. &.l-item {
  247. border-radius: 34rpx 0 0 34rpx;
  248. }
  249. &.r-item {
  250. border-radius: 0 34rpx 34rpx 0;
  251. }
  252. &.active {
  253. color: #fff;
  254. background: #CCB375;
  255. }
  256. }
  257. }
  258. .action {
  259. padding-left: 20rpx;
  260. padding-right: 20rpx;
  261. padding-bottom: 30rpx;
  262. margin-top: 30rpx;
  263. .button::after {
  264. border: none;
  265. }
  266. .button-default::after {
  267. border: none;
  268. }
  269. .btns {
  270. height: 80rpx;
  271. background: radial-gradient(at 0% 0%, #01243A 0%, #004576 100%);
  272. border-radius: 40rpx;
  273. font-size: 32rpx;
  274. font-weight: 400;
  275. color: #ffffff;
  276. line-height: 80rpx;
  277. width: 670rpx;
  278. margin: 0 auto;
  279. box-sizing: border-box;
  280. &.del {
  281. background: #fff;
  282. border: 2rpx solid #DCDCDC;
  283. color: #666666;
  284. margin-top: 30rpx;
  285. }
  286. }
  287. .button-default {
  288. height: 80rpx;
  289. background: rgba(0, 179, 139, .1);
  290. border-radius: 40rpx;
  291. font-size: 32rpx;
  292. font-weight: 400;
  293. color: #00B38B;
  294. line-height: 80rpx;
  295. width: 45%;
  296. }
  297. }
  298. </style>