酷炫直播运营系统小程序版本

selfInfo.vue 4.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <template>
  2. <view>
  3. <view class="con">
  4. <view class="lineItem">
  5. <text class="txt">公司 </text>
  6. <picker v-model="companyIdx" :range="companyRange" @change="pickerCompany" placeholder="请选择公司" style="width: 100%">
  7. <view class="uni-input">{{companyRange[companyIdx]}}</view>
  8. </picker>
  9. </view>
  10. <view class="lineItem">
  11. <text class="txt">部门</text>
  12. <picker v-model="departIdx" :range="departmentRange" @change="pickerDepart" placeholder="请选择部门" style="width: 100%">
  13. <view class="uni-input">{{departmentRange[departIdx]}}</view>
  14. </picker>
  15. </view>
  16. <view class="lineItem">
  17. <text class="txt">真实姓名</text>
  18. <input v-model="realName" type="text" placeholder="请输入真实姓名" />
  19. </view>
  20. <view class="save" @click="saveClick">保存</view>
  21. </view>
  22. <wm-watermark :text="real_name"></wm-watermark>
  23. </view>
  24. </template>
  25. <script>
  26. export default {
  27. data () {
  28. return {
  29. real_name: '',
  30. realName: '',
  31. departIdx: null,
  32. departmentList: [],
  33. departmentRange: [],
  34. departId: null,//保存信息的部门id
  35. companyIdx: null,
  36. companyList: [],
  37. companyRange: [],
  38. companyId: null,//保存信息的部门id
  39. }
  40. },
  41. async onLoad () {
  42. this.real_name = uni.getStorageSync('userInfo').info.real_name;
  43. await this.$onLaunched;
  44. this.get_companySubjectList()//报销主体列表
  45. },
  46. methods: {
  47. get_userInfoReback () {
  48. this.$req(this.$api.userReiInfoDetail, 'get', {}, (res) => {
  49. if (res && res.errno == 0) {
  50. this.realName = res.rst.reimburse_name
  51. this.departmentList.forEach((item, item_idx) => {
  52. if (item.id == res.rst.department_id) {
  53. this.departIdx = item_idx
  54. this.departId = item.id
  55. }
  56. })
  57. this.companyList.forEach((item, item_idx) => {
  58. if (item.id == res.rst.company_subject_id) {
  59. this.companyIdx = item_idx
  60. this.companyId = item.id
  61. }
  62. })
  63. this.$hide_init_loading()
  64. }
  65. }, err => {
  66. this.$hide_init_loading()
  67. })
  68. },
  69. pickerCompany (e) {
  70. this.companyIdx = e.target.value
  71. this.companyId = this.companyList[this.companyIdx].id
  72. },
  73. pickerDepart (e) {
  74. this.departIdx = e.target.value
  75. this.departId = this.departmentList[this.departIdx].id
  76. },
  77. get_companySubjectList () {
  78. this.$show_init_loading()
  79. this.$req(this.$api.companySubjectList, 'get', {
  80. page: 1,
  81. page_size: 999
  82. }, (res) => {
  83. if (res && res.errno == 0) {
  84. this.companyList = res.rst.data
  85. this.get_departmentList()
  86. res.rst.data.forEach(i => {
  87. this.companyRange.push(i.company_name)
  88. })
  89. }
  90. })
  91. },
  92. get_departmentList () {
  93. this.$req(this.$api.departments, 'get', {
  94. page: 1,
  95. page_size: 999
  96. }, (res) => {
  97. if (res && res.errno == 0) {
  98. this.departmentList = res.rst.data
  99. res.rst.data.forEach(i => {
  100. this.departmentRange.push(i.department_name)
  101. })
  102. this.get_userInfoReback()
  103. }
  104. })
  105. },
  106. saveClick () {
  107. if (this.realName == '' || this.companyId==null || this.departId == null) {
  108. uni.showToast({
  109. title: '选项不能为空,请重新操作',
  110. icon: 'none',
  111. duration: 2000
  112. })
  113. return false
  114. }
  115. this.$show_init_loading()
  116. this.$req(this.$api.userReiInfoOperate, 'post', {
  117. company_subject_id: this.companyId,
  118. department_id: this.departId,
  119. reimburse_name: this.realName
  120. }, (res) => {
  121. uni.showToast({
  122. title: res.err,
  123. icon: 'none',
  124. duration: 2000
  125. })
  126. if (res && res.errno == 0) {
  127. this.$nav_back()
  128. this.$hide_init_loading()
  129. }
  130. }, (err) => {
  131. uni.showToast({
  132. title: res.err,
  133. icon: 'none',
  134. duration: 2000
  135. })
  136. this.$hide_init_loading()
  137. })
  138. }
  139. }
  140. }
  141. </script>
  142. <style lang="scss" scoped>
  143. .con {
  144. padding: 68rpx 40rpx;
  145. font-size: 32rpx;
  146. .lineItem {
  147. display: flex;
  148. align-items: center;
  149. margin-top: 40rpx;
  150. .uni-input {
  151. background: #1c222e;
  152. height: 80rpx;
  153. border-radius: 40rpx;
  154. width: 100%;
  155. line-height: 80rpx;
  156. color: #fff;
  157. padding: 0 40rpx;
  158. overflow: hidden;
  159. }
  160. input {
  161. background: #1c222e;
  162. height: 80rpx;
  163. border-radius: 40rpx;
  164. width: 76%;
  165. line-height: 80rpx;
  166. color: #fff;
  167. padding: 0 40rpx;
  168. }
  169. .txt {
  170. display: inline-block;
  171. width: 24%;
  172. }
  173. }
  174. .save {
  175. margin: 40rpx auto;
  176. background-color: #5b80f4;
  177. width: 20%;
  178. border-radius: 40rpx;
  179. height: 72rpx;
  180. line-height: 72rpx;
  181. text-align: center;
  182. }
  183. }
  184. </style>