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

347 lines
8.0 KiB

6 months ago
4 months ago
6 months ago
4 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
4 months ago
6 months ago
4 months ago
3 months ago
4 months ago
6 months ago
4 months ago
6 months ago
4 months ago
4 months ago
6 months ago
6 months ago
6 months ago
3 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
4 months ago
6 months ago
4 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
3 months ago
6 months ago
4 months ago
3 months ago
4 months ago
6 months ago
6 months ago
6 months ago
6 months ago
4 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. <picker
  57. mode="region"
  58. @change="bindTimeChange">
  59. <view class="flex-center">
  60. <view class="flex-start-col">
  61. <span>所在地区</span>
  62. <input
  63. :value="form.province + form.city + form.area"
  64. disabled
  65. placeholder="请选择所在地区"
  66. type="text" class="input"
  67. style="width: 580rpx;"></input>
  68. </view>
  69. </view>
  70. </picker>
  71. <view class="flex-center">
  72. <view class="flex-start-col">
  73. <span>详细地址</span>
  74. <input v-model="form.address"
  75. :disabled="id"
  76. placeholder="请输入详情地址"
  77. type="text" class="input"
  78. style="width: 580rpx;"></input>
  79. </view>
  80. </view>
  81. </view>
  82. </view>
  83. </view>
  84. <view class="flex-center" style="gap: 30rpx;">
  85. <view class="next-btn" style="padding: 16rpx 80rpx;" @click="pre">
  86. 返回
  87. </view>
  88. <view class="next-btn-2"
  89. v-if="!id"
  90. style="padding: 16rpx 80rpx;" @click="submit">
  91. 确认/提交
  92. </view>
  93. <view class="next-btn-2"
  94. v-else
  95. style="padding: 16rpx 80rpx;" @click="closeSubmit">
  96. 取消预约
  97. </view>
  98. </view>
  99. <view class="second-color">{{ configList.bg_title }}</view>
  100. <uv-datetime-picker
  101. ref="datetimePicker"
  102. v-model="date"
  103. mode="datetime"
  104. :minDate="new Date().getTime()"
  105. @confirm="confirm">
  106. </uv-datetime-picker>
  107. </view>
  108. </template>
  109. <script>
  110. import { mapState } from 'vuex'
  111. export default {
  112. data() {
  113. return {
  114. // year: '2024年',
  115. // date: '9月20日',
  116. // time: '08:00',
  117. // firstName: '张',
  118. // lastName: '里于',
  119. // gender: '',
  120. // phone: '',
  121. // message: '',
  122. date : new Date().getTime(),
  123. address : {
  124. province : '',
  125. city : '',
  126. district : '',
  127. address : '',
  128. },
  129. form : {
  130. username:'',
  131. phone:'',
  132. province : '',
  133. city : '',
  134. area : '',
  135. },
  136. id : 0,
  137. }
  138. },
  139. computed : {
  140. addressCity(){
  141. return this.address.province +
  142. this.address.city +
  143. this.address.district
  144. },
  145. ...mapState(['problemList', 'configList', 'queryMyLog']),
  146. },
  147. onLoad(args) {
  148. if(args.id){
  149. this.id = args.id
  150. return
  151. }
  152. if(uni.getStorageSync('user_address')){
  153. this.address = JSON.parse(uni.getStorageSync('user_address'))
  154. }
  155. if(uni.getStorageSync('user_phone')){
  156. this.form = JSON.parse(uni.getStorageSync('user_phone'))
  157. }
  158. },
  159. onShow() {
  160. this.getDetail()
  161. },
  162. methods: {
  163. getDetail(){
  164. if(!this.id){
  165. return
  166. }
  167. this.$api('queryReservationDetail',{
  168. id : this.id
  169. }, res => {
  170. if(res.code == 200){
  171. this.date = new Date(`${res.result.yearValue}-${res.result.monthDay} ${res.result.dayTime}:00`).getTime()
  172. this.address = res.result
  173. this.address.district = res.result.area
  174. this.form = res.result
  175. this.form.username = res.result.name
  176. }
  177. })
  178. },
  179. next() {
  180. // uni.navigate
  181. },
  182. pre(){
  183. uni.navigateBack(-1)
  184. // uni.reLaunch({
  185. // url: '/pages/index/index'
  186. // })
  187. },
  188. confirm(e){
  189. this.date = e.value
  190. },
  191. submit(){
  192. if(this.$utils.verificationAll(this.form, {
  193. username : '请输入姓名',
  194. phone : '请输入电话号码',
  195. address : '请输入详情地址',
  196. })){
  197. return
  198. }
  199. if(!this.$utils.verificationPhone(this.form.phone)){
  200. uni.showToast({
  201. title: '请输入正确的手机号',
  202. icon: 'none',
  203. })
  204. return
  205. }
  206. this.$api('submit', {
  207. ...this.form,
  208. name : this.form.username,
  209. yearValue : this.$dayjs(this.date).format('YYYY'),
  210. monthDay : this.$dayjs(this.date).format('MM-DD'),
  211. dayTime : this.$dayjs(this.date).format('HH:mm'),
  212. }, res => {
  213. if(res.code == 200){
  214. // setTimeout(uni.reLaunch, 1000, {
  215. // url : '/pages/index/index'
  216. // })
  217. uni.navigateTo({
  218. url: '/pages/index/cancelArticle?key=success_text'
  219. })
  220. }
  221. })
  222. },
  223. // 取消预约
  224. closeSubmit(){
  225. uni.showModal({
  226. title: '确认取消预约吗?',
  227. success: (res) => {
  228. if(res.confirm){
  229. this.$api('cancelReservation', {
  230. id : this.id
  231. }, res => {
  232. if(res.code == 200){
  233. uni.navigateTo({
  234. url: '/pages/index/cancelArticle?key=cancel_value'
  235. })
  236. }
  237. })
  238. }
  239. }
  240. })
  241. },
  242. // 获取省市区
  243. bindTimeChange(e) {
  244. this.form.province = e.detail.value[0];
  245. this.form.city = e.detail.value[1];
  246. this.form.area = e.detail.value[2];
  247. // this.form.provinceName = e.detail.value[0] + e.detail.value[1] + e.detail.value[2];
  248. },
  249. },
  250. }
  251. </script>
  252. <style lang="scss" scoped>
  253. .home{
  254. font-size: 28rpx;
  255. .logo{
  256. width: 600rpx;
  257. height: 100rpx;
  258. margin: 150rpx 75rpx;
  259. margin-bottom: 50rpx;
  260. }
  261. .content{
  262. position: relative;
  263. display: flex;
  264. flex-direction: column;
  265. align-items: center;
  266. justify-content: center;
  267. box-sizing: border-box;
  268. padding: 60rpx;
  269. text-align: center;
  270. width: 720rpx;
  271. margin: 0 auto;
  272. .content-bg{
  273. height: 100%;
  274. width: 700rpx;
  275. position: absolute;
  276. top: 0;
  277. left: 0;
  278. z-index: -1;
  279. }
  280. .topt{
  281. width: 600rpx;
  282. padding: 20rpx 0;
  283. gap: 10rpx;
  284. border-radius: 12rpx;
  285. border: 2rpx solid #ecb864;
  286. display: flex;
  287. flex-direction: column;
  288. }
  289. }
  290. .second-color{
  291. text-align: center;
  292. margin-top: 40rpx;
  293. }
  294. }
  295. .date {
  296. border: 2rpx solid $uni-color;
  297. padding: 10rpx 30rpx;
  298. border-radius: 12rpx;
  299. }
  300. .main-color{
  301. flex-wrap: nowrap;
  302. }
  303. .input{
  304. border: 2rpx solid $uni-color;
  305. border-radius: 10rpx;
  306. padding: 4rpx 10rpx;
  307. }
  308. .next-btn{
  309. width: 160rpx;
  310. display: flex;
  311. align-items: center;
  312. justify-content: center;
  313. color: white;
  314. padding: 16rpx 90rpx;
  315. background-color: $uni-color;
  316. border-radius: 30rpx;
  317. }
  318. .next-btn-2{
  319. width: 160rpx;
  320. display: flex;
  321. align-items: center;
  322. justify-content: center;
  323. color: white;
  324. padding: 16rpx 90rpx;
  325. background-color: $uni-color-primary;
  326. border-radius: 30rpx;
  327. }
  328. </style>