BaseInfo.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. <template>
  2. <view class="info-panel">
  3. <view class="space"></view>
  4. <view class="row">
  5. <view class="label">企业Logo</view>
  6. <image class="avatar" src="@/static/auth-icon.png" mode="aspectFill"></image>
  7. </view>
  8. <view class="row">
  9. <view class="label">企业全称</view>
  10. <input class="text" type="text" placeholder="必填" placeholder-class="gray" v-model="form.customerName" maxlength="40"/>
  11. </view>
  12. <view class="row">
  13. <view class="label">企业简称</view>
  14. <input class="text" type="text" placeholder="选填" placeholder-class="gray" v-model="form.customerTitle" maxlength="30"/>
  15. </view>
  16. <view class="row">
  17. <view class="label">统一信用代码</view>
  18. <input class="text" type="text" placeholder="选填" placeholder-class="gray" v-model="form.customerUsci" maxlength="18"/>
  19. </view>
  20. <view class="row">
  21. <view class="label">注册资本</view>
  22. <input class="text" type="text" placeholder="选填" placeholder-class="gray" v-model="form.capital" maxlength="12"/>
  23. </view>
  24. <view class="row no-border">
  25. <view class="label">注册地址</view>
  26. <input class="text" type="text" placeholder="选填" placeholder-class="gray" v-model="form.address" maxlength="40"/>
  27. </view>
  28. <view class="space"></view>
  29. <picker :range="companyTypeList" range-key="dictLabel" @change="onCompanyTypePickerChange">
  30. <view class="row">
  31. <view class="label">企业类型</view>
  32. <view :class="{text: true, gray: !form.companyType}">{{ form.companyType ? filterDict(form.companyType, companyTypeList) : '请选择' }}</view>
  33. <image class="arrow" src="@/static/svg/arrow.svg"></image>
  34. </view>
  35. </picker>
  36. <picker :range="companyTaxList" range-key="dictLabel" @change="onCompanyTaxPickerChange">
  37. <view class="row">
  38. <view class="label">纳税性质</view>
  39. <view :class="{text: true, gray: !form.tax}">{{ form.tax ? filterDict(form.tax, companyTaxList) : '请选择' }}</view>
  40. <image class="arrow" src="@/static/svg/arrow.svg"></image>
  41. </view>
  42. </picker>
  43. <picker mode="region" @change="onRegionPickerChange">
  44. <view class="row">
  45. <view class="label">所属地区</view>
  46. <view :class="{text: true, gray: !form.region}">{{ form.region || '请选择' }}</view>
  47. <image class="arrow" src="@/static/svg/arrow.svg"></image>
  48. </view>
  49. </picker>
  50. <picker :range="companyIndustryList" range-key="dictLabel" @change="onCompanyIndustryPickerChange">
  51. <view class="row">
  52. <view class="label">所属行业</view>
  53. <view :class="{text: true, gray: !form.industry}">{{ form.industry ? filterDict(form.industry, companyIndustryList) : '请选择' }}</view>
  54. <image class="arrow" src="@/static/svg/arrow.svg"></image>
  55. </view>
  56. </picker>
  57. <picker :range="companySizeList" range-key="dictLabel" @change="onCompanySizePickerChange">
  58. <view class="row">
  59. <view class="label">人员规模</view>
  60. <view :class="{text: true, gray: !form.staffSize}">{{ form.staffSize ? filterDict(form.staffSize, companySizeList) : '请选择' }}</view>
  61. <image class="arrow" src="@/static/svg/arrow.svg"></image>
  62. </view>
  63. </picker>
  64. <view class="space"></view>
  65. <view class="row">
  66. <view class="label">联系人</view>
  67. <input class="text" type="text" placeholder="选填" placeholder-class="gray" v-model="form.contact" maxlength="20"/>
  68. </view>
  69. <view class="row">
  70. <view class="label">联系电话</view>
  71. <input class="text" type="text" placeholder="选填" placeholder-class="gray" v-model="form.tel" maxlength="11"/>
  72. </view>
  73. <view class="row">
  74. <view class="label">电子件接收邮箱</view>
  75. <input class="text" type="text" placeholder="选填" placeholder-class="gray" v-model="form.email" maxlength="20"/>
  76. </view>
  77. </view>
  78. </template>
  79. <script>
  80. import systemService from '@/api/system.js';
  81. import enterpriseService from '@/api/enterprise.js';
  82. import { filterDict } from '@/utils/util.js';
  83. export default {
  84. props: ['enterpriseId'],
  85. data() {
  86. return {
  87. form: {
  88. customerName: '',
  89. customerTitle: '',
  90. customerUsci: '',
  91. capital: '',
  92. address: '',
  93. companyType: '',
  94. tax: '',
  95. region: '',
  96. industry: '',
  97. staffSize: '',
  98. contact: '',
  99. tel: '',
  100. email: ''
  101. },
  102. companyTypeList: [],
  103. companyTaxList: [],
  104. companyIndustryList: [],
  105. companySizeList: [],
  106. };
  107. },
  108. created() {
  109. this.getOptionsConfig();
  110. },
  111. mounted(){
  112. if(this.enterpriseId) this.getEnterpriseInfo()
  113. },
  114. beforeDestroy() {
  115. this.updateEnterpriseInfo();
  116. },
  117. methods: {
  118. // 获取企业资料
  119. async getEnterpriseInfo(){
  120. console.log('获取企业资料')
  121. },
  122. // 修改企业资料
  123. async updateEnterpriseInfo() {
  124. if(!this.form.customerName) return
  125. await enterpriseService.addEnterprise(this.form);
  126. uni.$emit('onUpdateEnterprise')
  127. },
  128. // 获取选项配置
  129. async getOptionsConfig() {
  130. const { rows: companyTypeList } = await systemService.getDict('biz_company_type');
  131. const { rows: companyTaxList } = await systemService.getDict('biz_company_tax ');
  132. const { rows: companyIndustryList } = await systemService.getDict('biz_company_industry');
  133. const { rows: companySizeList } = await systemService.getDict('biz_company_size');
  134. this.companyTypeList = companyTypeList;
  135. this.companyTaxList = companyTaxList;
  136. this.companyIndustryList = companyIndustryList;
  137. this.companySizeList = companySizeList;
  138. },
  139. // 监听选择器变化-企业类型
  140. onCompanyTypePickerChange(e) {
  141. this.form.companyType = this.companyTypeList[e.detail.value].dictValue;
  142. },
  143. // 监听选择器变化-纳税性质
  144. onCompanyTaxPickerChange(e) {
  145. this.form.tax = this.companyTaxList[e.detail.value].dictValue;
  146. },
  147. // 监听选择器变化-省市区
  148. onRegionPickerChange(e) {
  149. this.form.region = e.detail.value.join('/');
  150. },
  151. // 监听选择器变化-所属行业
  152. onCompanyIndustryPickerChange(e) {
  153. this.form.industry = this.companyIndustryList[e.detail.value].dictValue;
  154. },
  155. // 监听选择器变化-人员规模
  156. onCompanySizePickerChange(e) {
  157. this.form.staffSize = this.companySizeList[e.detail.value].dictValue;
  158. },
  159. // 引用方法需要手动注入,否则报错
  160. filterDict
  161. }
  162. };
  163. </script>
  164. <style lang="scss" scoped>
  165. .info-panel {
  166. font-size: 27.47rpx;
  167. .row {
  168. min-height: 96.15rpx;
  169. display: flex;
  170. align-items: center;
  171. justify-content: space-between;
  172. padding: 20.6rpx 41.21rpx;
  173. box-sizing: border-box;
  174. background: #fff;
  175. position: relative;
  176. color: #515151;
  177. border-bottom: 1rpx solid #e0e0e0;
  178. &.no-border {
  179. border: none;
  180. }
  181. .label {
  182. white-space: nowrap;
  183. margin-right: 54.95rpx;
  184. }
  185. .text {
  186. flex: 1;
  187. text-align: right;
  188. }
  189. .arrow {
  190. width: 27.47rpx;
  191. height: 27.47rpx;
  192. margin-left: 6.87rpx;
  193. }
  194. .avatar {
  195. width: 82.42rpx;
  196. height: 82.42rpx;
  197. border-radius: 50%;
  198. }
  199. /deep/.gray{
  200. color: #ccc;
  201. }
  202. }
  203. .title {
  204. color: #666666;
  205. padding: 0 41.21rpx;
  206. line-height: 82.42rpx;
  207. }
  208. .space {
  209. background: #f3f3f3;
  210. height: 13.74rpx;
  211. }
  212. .radio-group {
  213. display: flex;
  214. .item {
  215. position: relative;
  216. padding-left: 43.96rpx;
  217. line-height: 32.97rpx;
  218. margin-left: 41.21rpx;
  219. &:before {
  220. content: '';
  221. position: absolute;
  222. left: 0%;
  223. top: 50%;
  224. transform: translateY(-50%);
  225. width: 30.22rpx;
  226. height: 30.22rpx;
  227. border: 1rpx solid #ddd;
  228. border-radius: 50%;
  229. box-sizing: border-box;
  230. }
  231. .radio {
  232. width: 32.97rpx;
  233. height: 32.97rpx;
  234. position: absolute;
  235. left: 0;
  236. top: 50%;
  237. transform: translateY(-50%);
  238. display: none;
  239. z-index: 1;
  240. }
  241. &.active .radio {
  242. display: block;
  243. }
  244. }
  245. }
  246. }
  247. </style>