stepTwo.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. <!-- @format -->
  2. <script lang="ts" setup>
  3. import type { FormInstance, FormRules } from 'element-plus'
  4. import { useRegister } from '~/pages/register/useRegister'
  5. import { getCategoryListApi, getDictListApi } from '~/api/model/common'
  6. const { params, nextStep } = useRegister()
  7. const countryList = ref()
  8. const categoryList = ref()
  9. const businessTypesList = ref()
  10. const annualPurchaseAmountList = ref()
  11. const companySizeList = ref()
  12. const ruleFormRef = ref<FormInstance>()
  13. const rules = ref<FormRules>({
  14. country: [
  15. {
  16. required: true,
  17. message: 'Country must be selected',
  18. trigger: 'change',
  19. },
  20. ],
  21. companyName: [
  22. {
  23. required: true,
  24. message: 'CompanyName must be filled in',
  25. trigger: 'blur',
  26. },
  27. ],
  28. purchaseCategory: [
  29. {
  30. required: true,
  31. message: 'Category must be selected',
  32. trigger: 'change',
  33. },
  34. ],
  35. companyType: [
  36. {
  37. required: true,
  38. message: 'CompanyType must be selected',
  39. trigger: 'change',
  40. },
  41. ],
  42. annualPurchaseAmount: [
  43. {
  44. required: true,
  45. message: 'AnnualPurchaseAmount must be selected',
  46. trigger: 'change',
  47. },
  48. ],
  49. companySize: [
  50. {
  51. required: true,
  52. message: 'CompanySize must be selected',
  53. trigger: 'blur',
  54. },
  55. ],
  56. })
  57. async function getCountryList() {
  58. const list = await getDictListApi('A070')
  59. countryList.value = list
  60. }
  61. async function getBusinessTypesList() {
  62. const list = await getDictListApi('A071')
  63. businessTypesList.value = list
  64. }
  65. async function getAnnualPurchaseAmountList() {
  66. const list = await getDictListApi('A072')
  67. annualPurchaseAmountList.value = list
  68. }
  69. async function getCompanySizeList() {
  70. const list = await getDictListApi('A167')
  71. companySizeList.value = list
  72. }
  73. async function getCategoryList() {
  74. const list = await getCategoryListApi({
  75. all: false,
  76. })
  77. categoryList.value = list
  78. }
  79. async function submitForm(formEl: FormInstance | undefined) {
  80. if (!formEl)
  81. return
  82. await formEl.validate((valid, fields) => {
  83. if (valid)
  84. nextStep()
  85. else
  86. console.log('error submit!', fields)
  87. })
  88. }
  89. getCountryList()
  90. getCategoryList()
  91. getCompanySizeList()
  92. getBusinessTypesList()
  93. getAnnualPurchaseAmountList()
  94. </script>
  95. <template>
  96. <div>
  97. <div class="fw-500 mb-24px text-40px text-#000">
  98. Company
  99. </div>
  100. <el-form
  101. ref="ruleFormRef"
  102. :model="params"
  103. :rules="rules"
  104. label-width="auto"
  105. size="default"
  106. status-icon
  107. >
  108. <el-form-item label="Country" prop="country" class="custom-form-item">
  109. <el-select v-model="params.country" placeholder="Country" filterable>
  110. <el-option
  111. v-for="(item, index) in countryList"
  112. :key="index"
  113. class="!h-50px !lh-50px"
  114. :label="item.label"
  115. :value="item.value"
  116. />
  117. </el-select>
  118. </el-form-item>
  119. <el-form-item
  120. label="Company Name"
  121. class="custom-form-item"
  122. prop="companyName"
  123. >
  124. <el-input
  125. v-model="params.companyName"
  126. placeholder="Company name"
  127. class="h-50px"
  128. />
  129. </el-form-item>
  130. <el-form-item
  131. label="Category"
  132. prop="purchaseCategory"
  133. class="custom-form-item"
  134. >
  135. <el-select v-model="params.purchaseCategory" placeholder="Category" multiple>
  136. <el-option
  137. v-for="(item, index) in categoryList"
  138. :key="index"
  139. class="!h-50px !lh-50px"
  140. :label="item.title"
  141. :value="item.key"
  142. />
  143. </el-select>
  144. </el-form-item>
  145. <el-form-item
  146. label="Business Types"
  147. prop="companyType"
  148. class="custom-form-item"
  149. >
  150. <el-select v-model="params.companyType" placeholder="Business Types">
  151. <el-option
  152. v-for="(item, index) in businessTypesList"
  153. :key="index"
  154. class="!h-50px !lh-50px"
  155. :label="item.label"
  156. :value="item.value"
  157. />
  158. </el-select>
  159. </el-form-item>
  160. <el-form-item
  161. label="Annual sourcing budget"
  162. prop="annualPurchaseAmount"
  163. class="custom-form-item"
  164. >
  165. <el-select
  166. v-model="params.annualPurchaseAmount"
  167. placeholder="Annual sourcing budget"
  168. >
  169. <el-option
  170. v-for="(item, index) in annualPurchaseAmountList"
  171. :key="index"
  172. class="!h-50px !lh-50px"
  173. :label="item.label"
  174. :value="item.value"
  175. />
  176. </el-select>
  177. </el-form-item>
  178. <el-form-item
  179. label="company size"
  180. prop="companySize"
  181. class="custom-form-item"
  182. >
  183. <el-select
  184. v-model="params.companySize"
  185. placeholder="company size"
  186. >
  187. <el-option
  188. v-for="(item, index) in companySizeList"
  189. :key="index"
  190. class="!h-50px !lh-50px"
  191. :label="item.label"
  192. :value="item.value"
  193. />
  194. </el-select>
  195. </el-form-item>
  196. <el-form-item label="Website" class="custom-form-item">
  197. <el-input
  198. v-model="params.website"
  199. placeholder="website"
  200. class="h-50px"
  201. />
  202. </el-form-item>
  203. <el-form-item class="form-footer mt-50px">
  204. <!-- <el-button
  205. class="!bg-#fff !text-#5B463E !w-48% !h-50px !text-18px !fw-500 !b-rd-6px b-#5B463E"
  206. @click="backStep"
  207. >
  208. Back
  209. </el-button>
  210. <el-button
  211. class="!bg-#C58C64 !text-#fff !ml-0 !w-48% !h-50px !text-18px !fw-500 !b-rd-6px"
  212. @click="submitForm(ruleFormRef)"
  213. >
  214. Next
  215. </el-button> -->
  216. <el-button class="!bg-#C58C64 !text-#fff !w-full !h-50px !text-16px !fw-500 !b-rd-6px " @click="submitForm(ruleFormRef)">
  217. Next
  218. </el-button>
  219. </el-form-item>
  220. </el-form>
  221. </div>
  222. </template>
  223. <style lang="less" scoped>
  224. :deep(.custom-form-item) {
  225. width: 100%;
  226. margin-bottom: 22px;
  227. display: block !important;
  228. .el-select__wrapper {
  229. height: 50px !important;
  230. }
  231. .el-form-item__label-wrap {
  232. margin-left: unset !important;
  233. .el-form-item__label {
  234. margin-bottom: 5px;
  235. font-size: 16px !important;
  236. color: #5b463e !important;
  237. }
  238. }
  239. .el-checkbox {
  240. .el-checkbox__input {
  241. &.is-checked {
  242. .el-checkbox__inner {
  243. color: #CC9879 !important;
  244. background-color: #CC9879 !important;
  245. border: 1px solid #CC9879 !important;
  246. }
  247. }
  248. .el-checkbox__inner {
  249. &:hover {
  250. border-color: #CC9879 !important;
  251. }
  252. }
  253. }
  254. &.is-checked {
  255. .el-checkbox__label {
  256. color: #CC9879 !important;
  257. }
  258. }
  259. }
  260. }
  261. ::v-deep(.form-footer) {
  262. .el-form-item__content {
  263. display: flex;
  264. justify-content: space-between;
  265. }
  266. }
  267. </style>