混凝土运输管理微信小程序、替班
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

382 lines
9.3 KiB

2 weeks ago
  1. <template>
  2. <view class="content">
  3. <navbar title="推荐员工" leftClick @leftClick="$utils.navigateBack" />
  4. <view class="form-container">
  5. <!-- 推荐类型 -->
  6. <view class="form-item">
  7. <view class="label">推荐类型</view>
  8. <view class="type-display">
  9. <text>{{ recommendType === 'driver' ? '推荐司机' : '推荐老板' }}</text>
  10. </view>
  11. </view>
  12. <!-- 姓名 -->
  13. <view class="form-item">
  14. <view class="label">{{ recommendType === 'driver' ? '司机姓名' : '老板姓名' }}</view>
  15. <input
  16. v-model="recommendInfo.name"
  17. :placeholder="'请输入' + (recommendType === 'driver' ? '司机' : '老板') + '姓名'"
  18. class="input"
  19. />
  20. </view>
  21. <!-- 联系电话 -->
  22. <view class="form-item">
  23. <view class="label">联系电话</view>
  24. <input
  25. v-model="recommendInfo.phone"
  26. placeholder="请输入联系电话"
  27. class="input"
  28. type="number"
  29. maxlength="11"
  30. />
  31. </view>
  32. <!-- 司机专属字段 -->
  33. <template v-if="recommendType === 'driver'">
  34. <!-- 驾驶车型 -->
  35. <view class="form-item">
  36. <view class="label">驾驶车型</view>
  37. <view class="select-value" @click="selectCarType">
  38. <text v-if="!recommendInfo.carType" class="placeholder">请选择驾驶车型</text>
  39. <text v-else>{{ recommendInfo.carType }}</text>
  40. <uv-icon name="arrow-right" size="16" color="#999"></uv-icon>
  41. </view>
  42. </view>
  43. <!-- 工作经验 -->
  44. <view class="form-item">
  45. <view class="label">工作经验</view>
  46. <view class="select-value" @click="selectExperience">
  47. <text v-if="!recommendInfo.experience" class="placeholder">请选择工作经验</text>
  48. <text v-else>{{ recommendInfo.experience }}</text>
  49. <uv-icon name="arrow-right" size="16" color="#999"></uv-icon>
  50. </view>
  51. </view>
  52. </template>
  53. <!-- 老板专属字段 -->
  54. <template v-if="recommendType === 'boss'">
  55. <!-- 公司名称 -->
  56. <view class="form-item">
  57. <view class="label">公司名称</view>
  58. <input
  59. v-model="recommendInfo.companyName"
  60. placeholder="请输入公司名称"
  61. class="input"
  62. />
  63. </view>
  64. <!-- 业务类型 -->
  65. <view class="form-item">
  66. <view class="label">业务类型</view>
  67. <view class="select-value" @click="selectBusinessType">
  68. <text v-if="!recommendInfo.businessType" class="placeholder">请选择业务类型</text>
  69. <text v-else>{{ recommendInfo.businessType }}</text>
  70. <uv-icon name="arrow-right" size="16" color="#999"></uv-icon>
  71. </view>
  72. </view>
  73. </template>
  74. <!-- 所在地区 -->
  75. <view class="form-item">
  76. <view class="label">所在地区</view>
  77. <view class="address-input" @click="selectLocation">
  78. <text v-if="!recommendInfo.location" class="placeholder">请选择所在地区</text>
  79. <text v-else>{{ recommendInfo.location }}</text>
  80. <uv-icon name="map-pin" size="20" color="#007AFF"></uv-icon>
  81. </view>
  82. </view>
  83. <!-- 推荐理由 -->
  84. <view class="form-item">
  85. <view class="label">推荐理由</view>
  86. <textarea
  87. v-model="recommendInfo.reason"
  88. :placeholder="'请简述推荐' + (recommendType === 'driver' ? '司机' : '老板') + '的理由'"
  89. class="textarea"
  90. maxlength="200"
  91. ></textarea>
  92. </view>
  93. <!-- 您的联系方式 -->
  94. <view class="form-item">
  95. <view class="label">您的联系方式</view>
  96. <input
  97. v-model="recommendInfo.myPhone"
  98. placeholder="请输入您的联系电话"
  99. class="input"
  100. type="number"
  101. maxlength="11"
  102. />
  103. </view>
  104. </view>
  105. <!-- 推荐说明 -->
  106. <view class="tip-container">
  107. <view class="tip-title">推荐说明</view>
  108. <view class="tip-content">
  109. <text> 推荐成功后平台将联系被推荐人进行沟通</text>
  110. <text> 如推荐人成功入驻并产生业务您将获得丰厚奖励</text>
  111. <text> 请确保提供的信息真实有效</text>
  112. <text> 感谢您对平台发展的支持</text>
  113. </view>
  114. </view>
  115. <!-- 底部按钮 -->
  116. <view class="bottom-buttons">
  117. <button class="btn-save" @click="submitRecommendation">提交推荐</button>
  118. </view>
  119. </view>
  120. </template>
  121. <script>
  122. import navbar from '@/components/base/navbar.vue'
  123. export default {
  124. name: 'BaseAddyuan',
  125. components: {
  126. navbar
  127. },
  128. data() {
  129. return {
  130. recommendType: 'driver', // driver 或 boss
  131. recommendInfo: {
  132. name: '',
  133. phone: '',
  134. carType: '',
  135. experience: '',
  136. companyName: '',
  137. businessType: '',
  138. location: '',
  139. reason: '',
  140. myPhone: ''
  141. }
  142. }
  143. },
  144. onLoad(options) {
  145. if (options.type) {
  146. this.recommendType = options.type;
  147. }
  148. uni.setNavigationBarTitle({
  149. title: this.recommendType === 'driver' ? '推荐司机' : '推荐老板'
  150. });
  151. },
  152. methods: {
  153. selectCarType() {
  154. uni.showActionSheet({
  155. itemList: ['泵车', '搅拌车', '车载泵', '其他'],
  156. success: (res) => {
  157. const types = ['泵车', '搅拌车', '车载泵', '其他'];
  158. this.recommendInfo.carType = types[res.tapIndex];
  159. }
  160. });
  161. },
  162. selectExperience() {
  163. uni.showActionSheet({
  164. itemList: ['1年以下', '1-3年', '3-5年', '5-10年', '10年以上'],
  165. success: (res) => {
  166. const experiences = ['1年以下', '1-3年', '3-5年', '5-10年', '10年以上'];
  167. this.recommendInfo.experience = experiences[res.tapIndex];
  168. }
  169. });
  170. },
  171. selectBusinessType() {
  172. uni.showActionSheet({
  173. itemList: ['混凝土生产', '建筑施工', '设备租赁', '物流运输', '其他'],
  174. success: (res) => {
  175. const types = ['混凝土生产', '建筑施工', '设备租赁', '物流运输', '其他'];
  176. this.recommendInfo.businessType = types[res.tapIndex];
  177. }
  178. });
  179. },
  180. selectLocation() {
  181. uni.chooseLocation({
  182. success: (res) => {
  183. this.recommendInfo.location = res.address;
  184. }
  185. });
  186. },
  187. submitRecommendation() {
  188. // 表单验证
  189. if (!this.recommendInfo.name) {
  190. uni.showToast({
  191. title: `请输入${this.recommendType === 'driver' ? '司机' : '老板'}姓名`,
  192. icon: 'none'
  193. });
  194. return;
  195. }
  196. if (!this.recommendInfo.phone) {
  197. uni.showToast({ title: '请输入联系电话', icon: 'none' });
  198. return;
  199. }
  200. if (!/^1[3-9]\d{9}$/.test(this.recommendInfo.phone)) {
  201. uni.showToast({ title: '请输入正确的手机号', icon: 'none' });
  202. return;
  203. }
  204. if (this.recommendType === 'driver' && !this.recommendInfo.carType) {
  205. uni.showToast({ title: '请选择驾驶车型', icon: 'none' });
  206. return;
  207. }
  208. if (this.recommendType === 'boss' && !this.recommendInfo.companyName) {
  209. uni.showToast({ title: '请输入公司名称', icon: 'none' });
  210. return;
  211. }
  212. if (!this.recommendInfo.myPhone) {
  213. uni.showToast({ title: '请输入您的联系方式', icon: 'none' });
  214. return;
  215. }
  216. if (!/^1[3-9]\d{9}$/.test(this.recommendInfo.myPhone)) {
  217. uni.showToast({ title: '请输入正确的联系方式', icon: 'none' });
  218. return;
  219. }
  220. uni.showToast({
  221. title: '推荐提交成功',
  222. icon: 'success'
  223. });
  224. setTimeout(() => {
  225. uni.navigateBack();
  226. }, 1500);
  227. }
  228. }
  229. }
  230. </script>
  231. <style scoped lang="scss">
  232. .content {
  233. padding: 20rpx;
  234. min-height: 100vh;
  235. background-color: #f5f5f5;
  236. padding-bottom: 120rpx;
  237. }
  238. .form-container {
  239. background-color: #fff;
  240. border-radius: 10rpx;
  241. padding: 30rpx;
  242. margin-bottom: 20rpx;
  243. }
  244. .form-item {
  245. margin-bottom: 40rpx;
  246. &:last-child {
  247. margin-bottom: 0;
  248. }
  249. }
  250. .label {
  251. font-size: 28rpx;
  252. color: #333;
  253. margin-bottom: 20rpx;
  254. font-weight: 500;
  255. }
  256. .type-display {
  257. height: 80rpx;
  258. padding: 0 20rpx;
  259. background-color: #f8f8f8;
  260. border-radius: 8rpx;
  261. font-size: 28rpx;
  262. color: #007AFF;
  263. display: flex;
  264. align-items: center;
  265. font-weight: 500;
  266. }
  267. .input {
  268. width: 100%;
  269. height: 80rpx;
  270. padding: 0 20rpx;
  271. border: 1rpx solid #e0e0e0;
  272. border-radius: 8rpx;
  273. font-size: 28rpx;
  274. box-sizing: border-box;
  275. }
  276. .textarea {
  277. width: 100%;
  278. height: 120rpx;
  279. padding: 20rpx;
  280. border: 1rpx solid #e0e0e0;
  281. border-radius: 8rpx;
  282. font-size: 28rpx;
  283. box-sizing: border-box;
  284. resize: none;
  285. }
  286. .select-value {
  287. display: flex;
  288. justify-content: space-between;
  289. align-items: center;
  290. height: 80rpx;
  291. padding: 0 20rpx;
  292. border: 1rpx solid #e0e0e0;
  293. border-radius: 8rpx;
  294. font-size: 28rpx;
  295. }
  296. .address-input {
  297. display: flex;
  298. justify-content: space-between;
  299. align-items: center;
  300. height: 80rpx;
  301. padding: 0 20rpx;
  302. border: 1rpx solid #e0e0e0;
  303. border-radius: 8rpx;
  304. font-size: 28rpx;
  305. }
  306. .placeholder {
  307. color: #999;
  308. }
  309. .tip-container {
  310. background-color: #fff;
  311. border-radius: 10rpx;
  312. padding: 30rpx;
  313. margin-bottom: 20rpx;
  314. }
  315. .tip-title {
  316. font-size: 30rpx;
  317. font-weight: 500;
  318. color: #333;
  319. margin-bottom: 20rpx;
  320. }
  321. .tip-content {
  322. display: flex;
  323. flex-direction: column;
  324. gap: 15rpx;
  325. text {
  326. font-size: 26rpx;
  327. color: #666;
  328. line-height: 1.5;
  329. }
  330. }
  331. .bottom-buttons {
  332. position: fixed;
  333. bottom: 0;
  334. left: 0;
  335. right: 0;
  336. padding: 20rpx;
  337. background-color: #fff;
  338. border-top: 1rpx solid #f0f0f0;
  339. padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
  340. }
  341. .btn-save {
  342. width: 100%;
  343. height: 80rpx;
  344. line-height: 80rpx;
  345. background-color: #007AFF;
  346. color: #fff;
  347. border-radius: 40rpx;
  348. font-size: 32rpx;
  349. border: none;
  350. }
  351. </style>