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

320 lines
7.2 KiB

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