百富门答题小程序
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.

218 lines
5.5 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
  1. <template>
  2. <view class="home">
  3. <image src="/static/image/bg/1.png"
  4. class="page-bg"
  5. mode="aspectFill"></image>
  6. <view class="content_now">
  7. <view class="flex-col" style="width: 600rpx; padding: 20rpx 0; gap: 10rpx; border-radius: 12rpx; border: 2rpx solid #ecb864;">
  8. <span style="font-size: 25rpx;">请选择您方便的时间</span>
  9. <span style="font-size: 25rpx;">我们将根据您的日程为您安排上门威士忌品鉴服务</span>
  10. <span style="font-size: 25rpx;">确保您能在舒适的环境中尽享专属体验</span>
  11. </view>
  12. <span class="font-bold" style="margin-top: 10rpx;">预约信息</span>
  13. <view class="" style="width: 600rpx;">
  14. <view class="flex-sb" style="margin-top: 10rpx;"
  15. @click="$refs.datetimePicker.open()">
  16. <view class="date">
  17. {{ $dayjs(date).format('YYYY') }}
  18. <img src="../static/info/a.png" style="width: 25rpx; height: 25rpx;"/>
  19. </view>
  20. <view class="date">
  21. {{ $dayjs(date).format('MM-DD') }}
  22. <img src="../static/info/a.png" style="width: 25rpx; height: 25rpx;"/>
  23. </view>
  24. <view class="date">
  25. {{ $dayjs(date).format('HH:mm') }}
  26. <img src="../static/info/a.png" style="width: 25rpx; height: 25rpx;"/>
  27. </view>
  28. </view>
  29. <view class="flex-start-col" style="margin-top: 10rpx;">
  30. <view class="flex-center" style="align-items: flex-end;">
  31. <view class="flex-start-col" style="gap: 10rpx;">
  32. <span>姓名:</span>
  33. <input v-model="form.username" type="text" class="input" style="width: 20vw;"></input>
  34. </view>
  35. <!-- <span style="margin-left: 20rpx; color: #dddddc; font-size: 26rpx;">(最开始填写的直接导入)</span> -->
  36. </view>
  37. <view class="flex-center" style="align-items: flex-end;">
  38. <view class="flex-start-col" style="gap: 10rpx;">
  39. <span>联系电话:</span>
  40. <input v-model="form.phone" type="tel" class="input"></input>
  41. </view>
  42. <!-- <span style="margin-left: 20rpx; color: #dddddc; font-size: 26rpx;">(最开始填写的直接导入)</span> -->
  43. </view>
  44. <view class="flex-center">
  45. <view class="flex-start-col" style="gap: 10rpx; width: 80vw;">
  46. <span>地址: {{ addressCity }}</span>
  47. <input v-model="address.address" placeholder="请输入详情地址" type="text" class="input" style="width: 100%; height: 60rpx;"></input>
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. <view class="an">
  54. <view class="flex-center" style="gap: 30rpx;">
  55. <view class="btn2" style="padding: 16rpx 80rpx;" @click="pre">
  56. 返回
  57. </view>
  58. <view class="btn2" style="padding: 16rpx 80rpx;" @click="submit">
  59. <!-- 确定 / 提交 -->
  60. 预约
  61. </view>
  62. </view>
  63. <text class="second-color">{{ configList.bg_title }}</text>
  64. </view>
  65. <uv-datetime-picker
  66. ref="datetimePicker"
  67. v-model="date"
  68. mode="datetime"
  69. :minDate="new Date().getTime()"
  70. @confirm="confirm">
  71. </uv-datetime-picker>
  72. </view>
  73. </template>
  74. <script>
  75. import { mapState } from 'vuex'
  76. export default {
  77. data() {
  78. return {
  79. // year: '2024年',
  80. // date: '9月20日',
  81. // time: '08:00',
  82. // firstName: '张',
  83. // lastName: '里于',
  84. // gender: '',
  85. // phone: '',
  86. // message: '',
  87. date : new Date().getTime(),
  88. address : {
  89. province : '',
  90. city : '',
  91. district : '',
  92. address : '',
  93. },
  94. form : {
  95. username:'',
  96. phone:'',
  97. },
  98. }
  99. },
  100. computed : {
  101. addressCity(){
  102. return this.address.province +
  103. this.address.city +
  104. this.address.district
  105. },
  106. ...mapState(['problemList', 'configList', 'queryMyLog']),
  107. },
  108. onLoad() {
  109. if(uni.getStorageSync('user_address')){
  110. this.address = JSON.parse(uni.getStorageSync('user_address'))
  111. }
  112. if(uni.getStorageSync('user_phone')){
  113. this.form = JSON.parse(uni.getStorageSync('user_phone'))
  114. }
  115. },
  116. methods: {
  117. next() {
  118. // uni.navigate
  119. },
  120. pre(){
  121. // uni.navigateBack({
  122. // delta:1
  123. // })
  124. uni.reLaunch({
  125. url: '/pages/index/index'
  126. })
  127. },
  128. confirm(e){
  129. this.date = e.value
  130. },
  131. submit(){
  132. if(this.$utils.verificationAll(this.form, {
  133. username : '请输入姓名',
  134. phone : '请输入电话号码',
  135. })){
  136. return
  137. }
  138. if(this.$utils.verificationPhone(this.form.phone)){
  139. uni.showToast({
  140. title: '请输入正确的手机号',
  141. icon: 'none',
  142. })
  143. return
  144. }
  145. if(this.$utils.verificationAll(this.address, {
  146. address : '请输入详情地址',
  147. })){
  148. return
  149. }
  150. uni.setStorageSync('user_address', this.address)
  151. this.$api('submit', {
  152. ...this.address,
  153. ...this.form,
  154. name : this.form.username,
  155. area : this.address.district,
  156. yearValue : this.$dayjs(this.date).format('YYYY'),
  157. monthDay : this.$dayjs(this.date).format('MM-DD'),
  158. dayTime : this.$dayjs(this.date).format('HH:mm'),
  159. }, res => {
  160. if(res.code == 200){
  161. uni.showToast({
  162. title: '预约成功',
  163. icon: 'none'
  164. })
  165. setTimeout(uni.reLaunch, 1000, {
  166. url : '/pages/index/index'
  167. })
  168. }
  169. })
  170. },
  171. },
  172. }
  173. </script>
  174. <style lang="scss" scoped>
  175. .home{
  176. font-size: 28rpx;
  177. }
  178. .an{
  179. position: fixed;
  180. bottom: 300rpx;
  181. text-align: center;
  182. display: flex;
  183. flex-direction: column;
  184. align-items: center;
  185. justify-content: center;
  186. width: 100%;
  187. }
  188. .date {
  189. border: 2rpx solid $uni-color;
  190. padding: 10rpx 30rpx;
  191. border-radius: 12rpx;
  192. }
  193. .main-color{
  194. flex-wrap: nowrap;
  195. }
  196. .input{
  197. border: 2rpx solid $uni-color;
  198. border-radius: 10rpx;
  199. padding: 4rpx 10rpx;
  200. }
  201. </style>