敢为人鲜小程序前端代码仓库
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.

334 lines
8.7 KiB

  1. <template>
  2. <view class="page">
  3. <!-- 导航栏 -->
  4. <navbar title="团长申请" leftClick @leftClick="$utils.navigateBack" bgColor="#019245" color="#fff" />
  5. <!-- 顶部图片区域 -->
  6. <view class="banner">
  7. <image src="/static/image/红烧肉.png" mode="aspectFill" class="banner-image"></image>
  8. </view>
  9. <view class="content-area">
  10. <!-- 送餐点照片上传区域 -->
  11. <view class="section-title">送餐点照片</view>
  12. <view class="section-block">
  13. <view class="upload-container">
  14. <view class="upload-area" @click="chooseImage" v-if="!locationImage">
  15. <view class="plus">+</view>
  16. <view class="upload-text">添加图片</view>
  17. </view>
  18. <image v-else :src="locationImage" mode="aspectFill" class="upload-area" @click="chooseImage" />
  19. </view>
  20. </view>
  21. <!-- 送餐点信息填写区域 -->
  22. <view class="section-title">送餐点信息</view>
  23. <view class="section-block">
  24. <view class="form-item">
  25. <text class="label">送餐点名称</text>
  26. <input class="input" type="text" v-model="formData.name" placeholder="请输入送餐点名称"
  27. placeholder-class="placeholder" />
  28. </view>
  29. <view class="form-item">
  30. <text class="label">您的姓名</text>
  31. <input class="input" type="text" v-model="formData.contactName" placeholder="请输入您的姓名"
  32. placeholder-class="placeholder" />
  33. </view>
  34. <view class="form-item">
  35. <text class="label">联系手机号</text>
  36. <input class="input" type="number" v-model="formData.contactPhone" placeholder="请输入您的手机号"
  37. placeholder-class="placeholder" />
  38. </view>
  39. <view class="form-item region-item" @click="showRegionPicker">
  40. <text class="label">所在地区</text>
  41. <view class="region-value">
  42. <text :class="{ 'placeholder': !formData.region }" style="color: #000;">{{ formData.region || '请选择' }}</text>
  43. <uv-icon name="arrow-right" color="#000" />
  44. </view>
  45. </view>
  46. <view class="address-item">
  47. <text class="label">详细地址</text>
  48. <view class="address-box">
  49. <textarea class="address-input" v-model="formData.address" placeholder="请输入详细地址"
  50. placeholder-class="placeholder" />
  51. </view>
  52. </view>
  53. </view>
  54. <!-- 提交按钮 -->
  55. <view class="submit-btn" @click="submitApplication">
  56. 提交申请
  57. </view>
  58. </view>
  59. </view>
  60. </template>
  61. <script>
  62. import navbar from '@/components/base/navbar.vue'
  63. export default {
  64. components: {
  65. navbar
  66. },
  67. data() {
  68. return {
  69. locationImage: '', // 上传的送餐点照片
  70. formData: {
  71. name: '', // 送餐点名称
  72. contactName: '', // 联系人姓名
  73. contactPhone: '', // 联系电话
  74. region: '', // 所在地区
  75. address: '' // 详细地址
  76. }
  77. }
  78. },
  79. methods: {
  80. // 选择图片
  81. chooseImage() {
  82. uni.chooseImage({
  83. count: 1,
  84. sizeType: ['compressed'],
  85. sourceType: ['album', 'camera'],
  86. success: (res) => {
  87. // 这里可以添加图片上传到服务器的逻辑
  88. // 暂时只展示选择的图片
  89. this.locationImage = res.tempFilePaths[0]
  90. }
  91. })
  92. },
  93. // 显示地区选择器(当前只是一个简单的点击反应)
  94. showRegionPicker() {
  95. // 模拟选择了一个地区
  96. this.formData.region = '长沙市雨花区'
  97. // 显示提示
  98. uni.showToast({
  99. title: '已选择地区',
  100. icon: 'none'
  101. })
  102. },
  103. // 提交申请
  104. submitApplication() {
  105. // 表单验证
  106. if (!this.locationImage) {
  107. return uni.showToast({
  108. title: '请上传送餐点照片',
  109. icon: 'none'
  110. })
  111. }
  112. if (!this.formData.name) {
  113. return uni.showToast({
  114. title: '请输入送餐点名称',
  115. icon: 'none'
  116. })
  117. }
  118. if (!this.formData.contactName) {
  119. return uni.showToast({
  120. title: '请输入您的姓名',
  121. icon: 'none'
  122. })
  123. }
  124. if (!this.formData.contactPhone) {
  125. return uni.showToast({
  126. title: '请输入联系手机号',
  127. icon: 'none'
  128. })
  129. }
  130. if (!this.$utils.verificationPhone(this.formData.contactPhone)) {
  131. return uni.showToast({
  132. title: '请输入正确的手机号',
  133. icon: 'none'
  134. })
  135. }
  136. if (!this.formData.region) {
  137. return uni.showToast({
  138. title: '请选择所在地区',
  139. icon: 'none'
  140. })
  141. }
  142. if (!this.formData.address) {
  143. return uni.showToast({
  144. title: '请输入详细地址',
  145. icon: 'none'
  146. })
  147. }
  148. // 显示提交中
  149. uni.showLoading({
  150. title: '提交中...'
  151. })
  152. // 模拟提交申请的过程
  153. setTimeout(() => {
  154. uni.hideLoading()
  155. uni.showToast({
  156. title: '申请提交成功',
  157. icon: 'success'
  158. })
  159. // 延迟返回上一页
  160. setTimeout(() => {
  161. this.$utils.navigateBack()
  162. }, 1500)
  163. }, 1000)
  164. }
  165. }
  166. }
  167. </script>
  168. <style lang="scss" scoped>
  169. .page {
  170. background-color: #f5f5f5;
  171. min-height: 100vh;
  172. }
  173. .banner {
  174. width: 100%;
  175. height: 240rpx;
  176. background-color: #019245;
  177. .banner-image {
  178. width: 100%;
  179. height: 100%;
  180. display: block;
  181. }
  182. }
  183. .content-area {
  184. padding: 20rpx;
  185. }
  186. .section-block {
  187. margin-bottom: 20rpx;
  188. background-color: #fff;
  189. border-radius: 20rpx;
  190. padding: 10rpx 20rpx;
  191. overflow: hidden;
  192. }
  193. .section-title {
  194. font-size: 28rpx;
  195. color: #333;
  196. padding: 20rpx;
  197. // border-bottom: 1rpx solid #f5f5f5;
  198. }
  199. .upload-container {
  200. padding: 20rpx;
  201. min-height: 140rpx;
  202. }
  203. .upload-area {
  204. width: 150rpx;
  205. height: 150rpx;
  206. border: 3rpx dashed $uni-color;
  207. // border-radius: 8rpx;
  208. display: flex;
  209. flex-direction: column;
  210. justify-content: center;
  211. align-items: center;
  212. .plus {
  213. font-size: 80rpx;
  214. color: $uni-color;
  215. line-height: 1;
  216. // margin-bottom: 5rpx;
  217. font-weight: 100;
  218. }
  219. .upload-text {
  220. font-size: 24rpx;
  221. color: $uni-color-third;
  222. }
  223. }
  224. .form-item {
  225. padding: 24rpx 0;
  226. display: flex;
  227. align-items: center;
  228. border-bottom: 2rpx solid #C7C7C7;
  229. &:last-child {
  230. border-bottom: none;
  231. }
  232. }
  233. .label {
  234. flex: 3;
  235. font-size: 28rpx;
  236. color: #333;
  237. padding-left: 10rpx;
  238. }
  239. .input {
  240. flex: 2;
  241. font-size: 28rpx;
  242. // height: 60rpx;
  243. text-align: left;
  244. }
  245. .placeholder,
  246. .region-item .region-value text.placeholder {
  247. // height: 60rpx;
  248. color: #999;
  249. }
  250. .region-item {
  251. cursor: pointer;
  252. .region-value {
  253. flex: 1;
  254. text-align: right;
  255. font-size: 28rpx;
  256. display: flex;
  257. justify-content: flex-end;
  258. align-items: center;
  259. }
  260. }
  261. .address-item {
  262. padding: 24rpx 0;
  263. display: flex;
  264. flex-direction: column;
  265. gap: 20rpx;
  266. .address-box {
  267. }
  268. .address-input {
  269. padding: 20rpx;
  270. background-color: #F5F5F5;
  271. border-radius: 10rpx;
  272. width: inherit;
  273. height: 60rpx;
  274. font-size: 28rpx;
  275. }
  276. }
  277. .submit-btn {
  278. width: 80%;
  279. margin: 40rpx auto 0;
  280. height: 100rpx;
  281. background-color: $uni-color;
  282. color: #fff;
  283. font-size: 32rpx;
  284. display: flex;
  285. justify-content: center;
  286. align-items: center;
  287. border-radius: 50rpx;
  288. // margin-top: 60rpx;
  289. }
  290. </style>