index.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. <template>
  2. <view class="contact">
  3. <view class="head">
  4. <view class="title">
  5. <image class="img-title" src="/static/img/contact/head_title.png" mode="aspectFill" />
  6. </view>
  7. <view class="tel">
  8. <image class="tel-img" src="/static/img/contact/icon_phone.png" mode="aspectFill" />
  9. </view>
  10. </view>
  11. <view class="form-warpper">
  12. <view class="input-content-wrapper">
  13. <form @submit="formSubmit" @reset="formReset">
  14. <view class="input-content">
  15. <view class="iconfont">
  16. <image class="image" src="/static/img/contact/icon_01.png" mode="aspectFill" />
  17. </view>
  18. <view class="flex align-center">
  19. <input class="uni-input" v-model="form.customer_name" name="customerName" placeholder="请输入您的姓名" />
  20. </view>
  21. </view>
  22. <view class="input-content">
  23. <view class="iconfont">
  24. <image class="image" src="/static/img/contact/icon_02.png" mode="aspectFill" />
  25. </view>
  26. <view class="flex align-center">
  27. <input class="uni-input" maxlength="11" v-model="form.mobile" name="mobile" placeholder="请输入联系方式" />
  28. </view>
  29. </view>
  30. <view class="input-content">
  31. <view class="iconfont">
  32. <image class="image" src="/static/img/contact/icon_03.png" mode="aspectFill" />
  33. </view>
  34. <view class="area flex align-center">
  35. <pick-regions name="regionCode" :defaultRegion="defaultRegionCode" @getRegion="handleGetRegion">
  36. <text :class="['regions', regionName ? '' : 'empty']" >{{ regionName || '请选择所在地区' }}</text>
  37. </pick-regions>
  38. <!-- <input class="uni-input" v-model="form.parentName" name="parentName" placeholder="请选择所在地区" /> -->
  39. <image class="arrow" src="/static/img/contact/down.png" mode="aspectFill" />
  40. </view>
  41. </view>
  42. <view class="input-content">
  43. <view class="iconfont">
  44. <image class="image" src="/static/img/contact/icon_04.png" mode="aspectFill" />
  45. </view>
  46. <view class="area flex align-center">
  47. <picker mode="selector" name="type" @change="typeChange" :value="typeIndex" :range="typeList" range-key="label">
  48. <view class="empty" v-if="typeIndex == -1">
  49. {{ '您的意向' }}
  50. </view>
  51. <view v-else>
  52. {{ typeList[typeIndex] }}
  53. </view>
  54. </picker>
  55. <!-- <input class="uni-input" v-model="form.parentName" name="parentName" placeholder="您的意向" /> -->
  56. <image class="arrow" src="/static/img/contact/down.png" mode="aspectFill" />
  57. </view>
  58. </view>
  59. <view class="submit-btn">
  60. <image src="/static/img/contact/submit.png" mode="aspectFill" />
  61. <button class="confirm-btn" :disabled="disabled" form-type="submit"></button>
  62. </view>
  63. </form>
  64. </view>
  65. </view>
  66. <view class="adderss flex align-start">
  67. <view class="text">
  68. <view>
  69. 地址:北京市朝阳区高碑店乡西店记忆文创小镇E6号楼
  70. </view>
  71. <view>
  72. 一层102号
  73. </view>
  74. </view>
  75. </view>
  76. </view>
  77. </template>
  78. <script>
  79. import pickRegions from '@/components/pick-regions/pick-regions.vue';
  80. export default {
  81. data() {
  82. return {
  83. disabled:false,
  84. form: {
  85. customer_name: '',
  86. mobile: ''
  87. },
  88. region:[],
  89. defaultRegionCode: '110101',
  90. defaultRegion:['北京市','市辖区','东城区'],
  91. typeIndex: -1,
  92. typeList: ["教学渠道代理", "思维芯游戏教室渠道代理", "家庭版渠道代理", "HOME&PLUS渠道代理", "探索小镇渠道代理(TOWN)", "合作园所(北京地区园所)"],
  93. reqBody: {}
  94. }
  95. },
  96. computed: {
  97. regionName: {
  98. get: function() {
  99. return this.region.map(item=>item.name).join('/')
  100. },
  101. set: function(val) {
  102. if(val) {
  103. this.region = val.map(item => {
  104. return {
  105. name: item
  106. }
  107. })
  108. }
  109. return val;
  110. }
  111. },
  112. regionCode() {
  113. if (this.region.length > 0) {
  114. return this.region[this.region.length - 1].code;
  115. } else {
  116. return this.defaultRegionCode;
  117. }
  118. }
  119. },
  120. components: {
  121. pickRegions
  122. },
  123. methods: {
  124. formSubmit(e) {
  125. console.log(e.detail.value);
  126. let rules = [
  127. { name: 'parentName', checkType: 'notnull', checkRule: '', errorMsg: '请填写家长姓名' },
  128. { name: 'parentPhone', checkType: 'phoneno', checkRule: '', errorMsg: '联系方式不正确'},
  129. // { name: 'address', checkType: 'notnull', checkRule: '', errorMsg: '请填写详细地址'},
  130. ]
  131. },
  132. typeChange(e) {
  133. const index = e.detail.value;
  134. this.typeIndex = index;
  135. // this.form.sex = this.genderList[index].value;
  136. },
  137. // 获取选择的地区
  138. handleGetRegion(region){
  139. this.region = region
  140. }
  141. }
  142. }
  143. </script>
  144. <style lang="scss">
  145. .contact {
  146. padding: 86upx 0 44upx;
  147. background: url('@/static/img/contact/bg.png') no-repeat #01A2E8;
  148. background-size: cover;
  149. .title {
  150. text-align: center;
  151. .img-title {
  152. width: 598upx;
  153. height: 168upx;
  154. vertical-align: middle;
  155. }
  156. }
  157. .tel {
  158. margin-top: 36upx;
  159. .tel-img {
  160. width: 564upx;
  161. height: 134upx;
  162. vertical-align: middle;
  163. margin-left: 68upx;
  164. }
  165. }
  166. .form-warpper {
  167. margin-top: 52upx;
  168. padding: 0 96upx;
  169. }
  170. .input-content-wrapper {
  171. margin-bottom: 0upx
  172. }
  173. .input-content {
  174. display: flex;
  175. align-items: center;
  176. box-sizing: border-box;
  177. height: 100upx;
  178. border: 2upx solid #003F66;
  179. margin-bottom: 36upx;
  180. padding: 0 42upx 0 42upx;
  181. background: #FFFFFF;
  182. border-radius: 172upx;
  183. .iconfont {
  184. position: relative;
  185. margin-right: 52upx;
  186. &::after {
  187. content: "";
  188. width: 2upx;
  189. height: 34upx;
  190. background:#B9B9B9;
  191. border-radius: 4upx;
  192. position: absolute;
  193. top: 4upx;
  194. right: -26upx;
  195. }
  196. image {
  197. width: 40upx;
  198. height: 46upx;
  199. vertical-align: middle;
  200. }
  201. }
  202. .input-placeholder {
  203. color: #B9B9B9;
  204. line-height: 36px;
  205. font-size: 28upx;
  206. font-family: PingFangSC-Regular, PingFang SC;
  207. font-weight: 400;
  208. }
  209. .area {
  210. width: 100%;
  211. }
  212. uni-picker {
  213. width: 100%;
  214. }
  215. .regions {
  216. &.empty {
  217. color: #B9B9B9;
  218. line-height: 36px;
  219. font-size: 28upx;
  220. font-family: PingFangSC-Regular, PingFang SC;
  221. font-weight: 400;
  222. }
  223. }
  224. .empty {
  225. color: #B9B9B9;
  226. line-height: 36px;
  227. font-size: 28upx;
  228. font-family: PingFangSC-Regular, PingFang SC;
  229. font-weight: 400;
  230. }
  231. .picker {
  232. color: #B9B9B9;
  233. line-height: 36px;
  234. font-size: 28upx;
  235. font-family: PingFangSC-Regular, PingFang SC;
  236. font-weight: 400;
  237. }
  238. .arrow {
  239. width: 24upx;
  240. height: 12upx;
  241. vertical-align: middle;
  242. }
  243. }
  244. .submit-btn {
  245. position: relative;
  246. margin-top: 94upx;
  247. text-align: center;
  248. image {
  249. width: 334upx;
  250. height: 92upx;
  251. vertical-align: middle;
  252. }
  253. .confirm-btn {
  254. position: absolute;
  255. bottom: 0;
  256. left: 50%;
  257. transform: translateX(-50%);
  258. width: 334upx;
  259. height: 92upx;
  260. background: red;
  261. opacity: 0;
  262. }
  263. }
  264. .adderss {
  265. margin: 150upx 0 0 60upx;
  266. .text {
  267. font-size: 24upx;
  268. font-family: PingFangSC-Semibold, PingFang SC;
  269. font-weight: 600;
  270. color: #B2E8FF;
  271. line-height: 34upx;
  272. }
  273. }
  274. }
  275. </style>