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

276 lines
6.7 KiB

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