appointment-form.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. <template>
  2. <view>
  3. <!-- <image src="../../../static/image/index/appointment_top.png" mode=""></image> -->
  4. <app-nav-bar v-if="true" :fixed="true" :xStyle="1" :hasMallSetting="2" :title="'预约'" color="#fff" :background-color="'#e2c47b'"></app-nav-bar>
  5. <!-- <app-nav-bar v-if="true" :fixed="true" :background-color="''" :xStyle="1" :hasMallSetting="2" -->
  6. <view class="main-between-y builInfo">
  7. <view class="main-between cross-center" style="height: 72rpx;" @click="$jump({open_type:'navigate',url:'/pages/sale/properties/addProperties'})">
  8. <view class="hjx-ts-30 hjx-tw-600 hjx-tc-222">楼盘名称</view>
  9. <view class="hjx-ts-30 hjx-tc-222">
  10. <view class="cross-center hjx-ts-28 t-omit" style="width: 510rpx;text-align: right;"
  11. :class="{'hjx-tc-999':estate_name==''?true:false,'hjx-tc-000':estate_name!=''?true:false}">{{estate_name===''?'请选择':estate_name}}
  12. <image style="width: 12.8rpx;height: 22.8rpx;margin-left: 20rpx;"
  13. src="https://t17.9026.com/web/statics/image/index/arrow-right-gray.png" mode=""></image>
  14. </view>
  15. </view>
  16. </view>
  17. <view class="main-between cross-center" style="height: 72rpx;" @click="$jump({open_type:'navigate',url:'/pages/sale/properties/addProperties'})">
  18. <view class="hjx-ts-30 hjx-tw-600 hjx-tc-222">楼盘地址</view>
  19. <view class="hjx-ts-30 hjx-tc-222">
  20. <view class="cross-center hjx-ts-28 t-omit" style="width: 510rpx;text-align: right;"
  21. :class="{'hjx-tc-999':estate_address==''?true:false,'hjx-tc-000':estate_address!=''?true:false}">{{estate_address===''?'请选择':estate_address}}
  22. <image style="width: 12.8rpx;height: 22.8rpx;margin-left: 20rpx;"
  23. src="https://t17.9026.com/web/statics/image/index/arrow-right-gray.png" mode=""></image>
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. <view class="form_box">
  29. <view class="title">预约人信息</view>
  30. <view class="hjx-line"></view>
  31. <view class="item main-between cross-center">
  32. <view class="hjx-ts-28 hjx-tw-600 hjx-tc-000">姓名</view>
  33. <view>
  34. <view class="cross-center hjx-ts-28 ">
  35. <input type="text" v-model="username" style="text-align:right;color: #000000;" placeholder="请输入"
  36. placeholder-style="text-align:right" placeholder-class="hjx-tc-999" />
  37. </view>
  38. </view>
  39. </view>
  40. <view class="item main-between cross-center">
  41. <view class="hjx-ts-28 hjx-tw-600 hjx-tc-000">电话</view>
  42. <view>
  43. <view class="cross-center hjx-ts-28 ">
  44. <input type="number" v-model="mobile" style="text-align:right;color: #000000;" placeholder="请输入"
  45. placeholder-style="text-align:right" placeholder-class="hjx-tc-999" />
  46. </view>
  47. </view>
  48. </view>
  49. <view class="item main-between cross-center">
  50. <view class="hjx-ts-28 hjx-tw-600 hjx-tc-000">看房日期</view>
  51. <view>
  52. <picker mode="date" :value="date" :start="startDate" :end="endDate" @change="bindDateChange">
  53. <view class="cross-center hjx-ts-28"
  54. :class="{'hjx-tc-999':date=='请选择'?true:false,'hjx-tc-000':date!='请选择'?true:false}">{{date}}
  55. <image style="width: 12.8rpx;height: 22.8rpx;margin-left: 20rpx;"
  56. src="https://t17.9026.com/web/statics/image/index/arrow-right-gray.png" mode=""></image>
  57. </view>
  58. </picker>
  59. </view>
  60. </view>
  61. <view class="item main-between cross-center">
  62. <view class="hjx-ts-28 hjx-tw-600 hjx-tc-000">看房时间</view>
  63. <view>
  64. <picker mode="time" :value="time" start="09:01" end="21:01" @change="bindTimeChange">
  65. <view class="cross-center hjx-ts-28"
  66. :class="{'hjx-tc-999':time=='请选择'?true:false,'hjx-tc-000':time!='请选择'?true:false}">{{time}}
  67. <image style="width: 12.8rpx;height: 22.8rpx;margin-left: 20rpx;"
  68. src="https://t17.9026.com/web/statics/image/index/arrow-right-gray.png" mode=""></image>
  69. </view>
  70. </picker>
  71. </view>
  72. </view>
  73. </view>
  74. <view class="noMake cross-center">
  75. <button type="default" @tap="goAppointment">立即预约</button>
  76. </view>
  77. </view>
  78. </template>
  79. <script>
  80. import AppNavBar from '@/components/page-component/index/app-nav-bar.vue';
  81. export default {
  82. components: {
  83. AppNavBar,
  84. },
  85. computed: {
  86. startDate() {
  87. return this.getDate('start');
  88. },
  89. endDate() {
  90. return this.getDate('end');
  91. }
  92. },
  93. data() {
  94. return {
  95. estate_id:'',
  96. estate_name:'',
  97. estate_address:'',
  98. username: '',
  99. mobile: '',
  100. time: '请选择',
  101. date: '请选择'
  102. };
  103. },
  104. onShow() {
  105. var pages = getCurrentPages();
  106. var currPage = pages[pages.length - 1]; //当前页面
  107. 'estateInfo' in currPage.$vm ? this.estate_name = currPage.$vm.estateInfo.name : ''
  108. 'estateInfo' in currPage.$vm ? this.estate_id = currPage.$vm.estateInfo.id : ''
  109. // 'estateInfo' in currPage.$vm ? this.multiIndex = currPage.$vm.estateInfo.multiIndex : ''
  110. if('estateInfo' in currPage.$vm){
  111. let address=currPage.$vm.estateInfo.address.split(' ').filter((s)=>{
  112. return s && s.trim()
  113. })
  114. this.estate_address=address[2]+address[3]
  115. }''
  116. },
  117. methods: {
  118. bindTimeChange(e) {
  119. this.time = e.target.value
  120. },
  121. bindDateChange(e) {
  122. this.date = e.target.value
  123. },
  124. getDate(type) {
  125. const date = new Date();
  126. let year = date.getFullYear();
  127. let month = date.getMonth() + 1;
  128. let day = date.getDate();
  129. if (type === 'start') {
  130. year = year - 60;
  131. } else if (type === 'end') {
  132. year = year + 2;
  133. }
  134. month = month > 9 ? month : '0' + month;
  135. day = day > 9 ? day : '0' + day;
  136. return `${year}-${month}-${day}`;
  137. },
  138. goAppointment() {
  139. this.$request({
  140. url: this.$api.user.visit_house,
  141. data: {
  142. estate_id: this.estate_id,
  143. username: this.username,
  144. phone: this.mobile,
  145. visit_date: this.date + ' ' + this.time,
  146. },
  147. method: 'post'
  148. }).then(res => {
  149. if (res.code === 0) {
  150. uni.showToast({
  151. title: '预约成功'
  152. })
  153. } else {
  154. uni.showToast({
  155. title: res.msg,
  156. icon: 'none'
  157. })
  158. }
  159. })
  160. }
  161. }
  162. }
  163. </script>
  164. <style lang="scss" scoped>
  165. .builInfo {
  166. padding: 30rpx 36rpx;
  167. height: auto;
  168. }
  169. .form_box {
  170. width: 678rpx;
  171. height: 459rpx;
  172. background: #FFFFFF;
  173. border-radius: 6rpx;
  174. margin: 20rpx auto;
  175. .title {
  176. height: 99rpx;
  177. padding: 0 30rpx;
  178. font-size: 32rpx;
  179. font-weight: bold;
  180. color: #000000;
  181. line-height: 99rpx;
  182. }
  183. .item {
  184. height: 89rpx;
  185. padding: 0 30rpx;
  186. }
  187. }
  188. .noMake {
  189. position: fixed;
  190. bottom: 0;
  191. width: 100%;
  192. height: 156rpx;
  193. background: #FFFFFF;
  194. box-shadow: 0px 7rpx 45rpx 1rpx rgba(85, 82, 82, 0.64);
  195. button {
  196. width: 678rpx;
  197. height: 84rpx;
  198. background: #A18353;
  199. border-radius: 6rpx;
  200. margin: 0 auto;
  201. font-size: 30rpx;
  202. font-weight: bold;
  203. color: #FFFFFF;
  204. }
  205. }
  206. </style>