index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594
  1. <template>
  2. <view class="content">
  3. <view class="text" @click="textButton">
  4. 测试
  5. </view>
  6. <view class="rotation">
  7. <swiper :indicator-dots="false" :autoplay="true" :interval="3000" :duration="1000" >
  8. <swiper-item v-for="(index,item) in image" :key="item">
  9. <view class="swiper-item">
  10. {{index}}</view>
  11. </swiper-item>
  12. <!-- <swiper-item>
  13. <view class="swiper-item">图片2</view>
  14. </swiper-item> -->
  15. </swiper>
  16. <!-- 轮播图 -->
  17. </view>
  18. <view class="tag">
  19. <text class="tag-title">{{name}}</text>
  20. <view class="tag-text">{{description}}</view>
  21. </view>
  22. <!-- 预约列表 -->
  23. <view class="reserve-list">
  24. <view class="list-title">
  25. <view type="default" class="list-left" :class="{active:current==index}" :data-current="0" @tap="tabChange">南塘私人定制区</view>
  26. <view type="default" class="list-left" :class="{active:current==index}" :data-current="1" @tap="tabChange">北塘主场</view>
  27. </view>
  28. <swiper @change="swiperChange" :current="current" class="sorth" style="height: 510rpx">
  29. <swiper-item v-for="(list,index) in orderList" :key="index">
  30. <view class="swiper-item" >
  31. <view class="north-li" v-for="(lists,index1) in list.day_text" :key="index1">
  32. <view class="li-left">
  33. <view class="north-time">
  34. {{lists.date}}({{lists.w}})
  35. </view>
  36. <text class="ordered">已预约:</text><text class="ordered-num">{{list.pid}}</text>
  37. <text class="site">总坐席:</text><text class="site-num">{{list.number}}</text>
  38. </view>
  39. <view class="li-middle">
  40. ¥{{list.money}}
  41. </view>
  42. <view class="li-right">
  43. <button class="li-order" @click="orderSeat(lists,list)">预约</button>
  44. </view>
  45. </view>
  46. </view>
  47. </swiper-item>
  48. </swiper>
  49. </view>
  50. <!-- 垂钓园简介 -->
  51. <view class="introduce">
  52. <view class="introduce-title">
  53. ~~盛和垂钓园简介~~
  54. </view>
  55. <view class="introduce-del">
  56. <text>
  57. 🐠🐠盛和垂钓园🐠🐠\n&nbsp; &nbsp; &nbsp; &nbsp;郑州市内南三环紫荆山路\n&nbsp; (每周二,四,六放鱼)共3个塘\n\n&nbsp; &nbsp; &nbsp;🐠 主场(北塘0.7 亩)🐠\n&nbsp; 7月11号周六投放狂口鲤鱼1500斤 (前一天下午五点放鱼过称,欢迎钓友监督)25人以上加放标鱼10条(50元代金券)限杆3.9米钓位30个,提前转账200元当天220,定金转账为准。\n主场结束溜鱼收费100到晚上11点半结束作钓。第二天溜鱼6点半开始60元随来随钓8小时,下午4点半结束。\n&nbsp; &nbsp; &nbsp; &nbsp; 上场坑冠130斤👏👏👏\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;\n&nbsp; &nbsp;🐠私人定制(南塘0.5亩)🐠\n&nbsp; &nbsp; &nbsp;上场私人订制因天气原因全部改签,封塘未动,7月11号周六继续放鱼1000斤,钓费不变,提前转账400现场450,抓住机会就10个位置想过瘾赶紧报名。 限杆3.9米&nbsp; &nbsp; &nbsp; &nbsp;\n&nbsp; &nbsp; &nbsp;\n\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;🐠&nbsp; &nbsp; 休闲塘&nbsp; &nbsp; 🐠\n现已开塘,底鱼鲤鱼2500斤左右,6-15斤草鱼500斤,10-15斤青鱼400斤,收费100元8小时, 早上6点30-23点30分,随来随钓(西塘不定时放鱼)限杆4.8米\n\n本塘强制回鱼 ,三元一斤。带回去自己吃10斤以内,需要大量带走提前沟通!鱼价太高,实实在在放鱼,望多理解。挣个回鱼的钱!\n❗本塘禁用胶粘颗粒❗禁止串窝,蹭窝\n❗禁止手打窝&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;❗禁止各种坏水小药\n❗禁止一切红虫活诱❗所有主线加子不能超过60公分,已经发现清护走人\n&nbsp;一旦发现罚款1000元,有小孩看管好 风险自负本塘概不负责 ! 本塘不改签 不退票 黑坑有险 下杆需谨慎&nbsp; &nbsp;&nbsp;\n&nbsp;本塘规律不多,望遵守\n所有代金券溜鱼无效,仅限下次主场使用。每次仅限使用一张。(有效期一个月)\n本塘提供饭菜,有超市,渔具。有果树采摘,周末可以带家人亲子活动。自助烧烤!&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;\n&nbsp;地址✨紫荆山南路宇通路往西走到头左转向南100米路西,导航(盛和农业即到)电话 18039330363&nbsp; 微信同步\n\n
  58. </text>
  59. </view>
  60. </view>
  61. <!-- 技术支持 -->
  62. <view class="foot">
  63. 希梦耐康提供技术支持
  64. </view>
  65. <!-- 自定义弹出框 -->
  66. <view class="Popup" :catchtouchmove="noneEnoughPeople" v-show="isShow" >
  67. <view class="popu-content">
  68. <view class="popu-title">预约订单</view>
  69. <view class="popu-order">
  70. {{orderMessage.date}}({{orderMessage.w}})/{{sitePosition}}
  71. </view>
  72. <view class="popu-count">
  73. <view class="popu-count-title">预约位席数:</view>
  74. <view class="count-button">
  75. <view class="reduce" @click="reduceOrder" :style="{color:color}">
  76. -
  77. </view>
  78. <input class="num" type="text" :value="count" />
  79. <view class="add" @click="addOrder">
  80. +
  81. </view>
  82. </view>
  83. </view>
  84. <view class="tw-button">
  85. <view class="left-button" @click="cancelOrder">取消</view>
  86. <view class="right-button" @click="sureOrder">确定</view>
  87. </view>
  88. </view>
  89. </view>
  90. </view>
  91. </template>
  92. <script>
  93. export default {
  94. data() {
  95. return {
  96. title: 'Hello',
  97. state: 0,
  98. current: '0',
  99. name:"",//垂钓园名称
  100. description:'',//垂钓园简介
  101. introduce:"",//鱼塘详细介绍
  102. image:"",//轮播图片
  103. orderList:"",//预约列表
  104. orderName:"",//预约列表名称
  105. isShow:false,//弹出层是否出现
  106. count:1,//预约数量
  107. color:"black",
  108. orderMessage:'',//预约信息
  109. sitePosition:'',//预约位置信息(南塘北塘)
  110. position:'',
  111. }
  112. },
  113. onLoad() {
  114. // 微信登陆接口并获取token
  115. wx.login({
  116. success(res){
  117. console.log(res,"这是登录接口测试")
  118. if(res.code){
  119. console.log('mead')
  120. wx.request({
  121. url:"https://yutang.web.ximengnaikang.com/api/login",
  122. method:'POST',
  123. data:{
  124. code:res.code
  125. },
  126. header:{
  127. 'content-type':'application/json'
  128. },
  129. success:function(res){
  130. console.log(res,"这是用户id测试")
  131. getApp().globalData.token=res.data.data.authorize
  132. }
  133. })
  134. }
  135. }
  136. })
  137. // 首页、预约列表等信息调用
  138. wx.request({
  139. url: 'https://yutang.web.ximengnaikang.com/api/company',
  140. method:'GET',
  141. header: {
  142. 'content-type': 'application/json' ,// 默认值
  143. // 'a': ''
  144. },
  145. success:(res)=>{
  146. var record= res.data.data.company
  147. this.name= record.name
  148. this.description=record.description
  149. this.introduce=record.body
  150. this.image=record.cover
  151. this.orderList=res.data.data.seats
  152. this.orderName=record.tabs
  153. console.log(this.orderList,'这是调用get')
  154. }
  155. })
  156. // 用户信息刷新
  157. setTimeout(
  158. function(){
  159. var that=this
  160. console.log(that.nickName,'这是用户名')
  161. wx.request({
  162. url:'https://yutang.web.ximengnaikang.com/api/syncUserInfo',
  163. method:'POST',
  164. header:{
  165. 'content-type':'application/json' ,// 默认值
  166. 'Authorization':getApp().globalData.token,
  167. },
  168. data:{
  169. "nickName": getApp().globalData.nickName,
  170. "avatarUrl":getApp().globalData.avatarUrl,
  171. "gender":1,//性别 0:未知、1:男、2:女
  172. "province":getApp().globalData.province,
  173. "city" :getApp().globalData.city,
  174. "country":getApp().globalData.country,
  175. },
  176. success:function(res){
  177. console.log(res,'这是用户信息刷新')
  178. }
  179. })
  180. },3000)
  181. },
  182. methods: {
  183. textButton:function(){
  184. wx.navigateTo({
  185. url:'../pay/pay'
  186. })
  187. },
  188. tabChange: function(e) {
  189. var index = e.target.dataset.current || e.currentTarget.dataset.current;
  190. this.current = index;
  191. },
  192. swiperChange: function(e) {
  193. var index = e.target.current || e.detail.current;
  194. this.current = index;
  195. },
  196. //作为预约
  197. orderSeat:function(e, aa){
  198. // console.log(getApp().globalData.token)
  199. var token=getApp().globalData.token;
  200. var that=this;
  201. console.log(e,'这是点击预约之后的按钮')
  202. console.log(aa,'这是点击预约之后的按钮1213')
  203. //判断用户是否进行授权
  204. wx.getSetting({
  205. success(res){
  206. console.log(res,"这是用户授权信息")
  207. if(res.authSetting["scope.userInfo"]){
  208. console.log("用户已经授权")
  209. that.isShow=true
  210. that.orderMessage=e
  211. that.sitePosition=aa.name
  212. console.log(that.orderMessage,'这是点击预约之后的按钮3333')
  213. }
  214. else{
  215. wx.showModal({
  216. title:'用户授权',
  217. content:'此功能需要获取您的昵称等公开信息,请到小程序的设置中打开用户权限',
  218. cancelText:'下次再说',
  219. confirmText:'去授权',
  220. success(res) {
  221. if(res.confirm){
  222. wx.navigateTo({
  223. url:'../userInfo/userInfo'
  224. })
  225. // console.log(res.authSetting["scope.userInfo"],"这是微信是否授权验证")
  226. }else if(res.cancel){
  227. }
  228. }
  229. })
  230. }
  231. }
  232. })
  233. },
  234. //预约数量减少
  235. reduceOrder:function(){
  236. if(this.count<=1){
  237. // this.count=1
  238. this.color="black";
  239. }
  240. else{
  241. this.count--;
  242. console.log(this.color)
  243. }
  244. },
  245. //预约数量增加
  246. addOrder:function(){
  247. this.count++;
  248. if(this.count>1){
  249. this.color="#1087e2";
  250. }
  251. },
  252. //弹出层消失按钮、取消预约按钮
  253. cancelOrder:function(){
  254. this.isShow=false
  255. },
  256. //确定预约按钮
  257. sureOrder:function(e){
  258. var day=this.orderMessage.date
  259. var seat_id=this.orderMessage.site_id
  260. var number=this.count
  261. console.log(day,seat_id,number)
  262. wx.request({
  263. url:'https://yutang.web.ximengnaikang.com/api/storeOrder',
  264. method:'POST',
  265. header:{
  266. 'content-type':'application/json' ,// 默认值
  267. 'Authorization':getApp().globalData.token,
  268. },
  269. data:{
  270. day:day,
  271. seat_id:seat_id,
  272. number:number,
  273. },
  274. success(res) {
  275. console.log(res.data.data.no,'这是预约成功发')
  276. getApp().globalData.no=res.data.data.no
  277. wx.requestPayment({
  278. timeStamp: res.data.data.timeStamp,
  279. nonceStr: res.data.data.nonceStr,
  280. package: res.data.data.package,
  281. signType: 'MD5',
  282. paySign: res.data.data.paySign,
  283. success (res) {
  284. console.log(res,"支付成功")
  285. wx.navigateTo({
  286. url:'../pay/pay',
  287. })
  288. },
  289. fail (err) {
  290. console.log(res,"支付失败")
  291. // console.log(packages,"支付失败")
  292. }
  293. })
  294. },
  295. fail:function(){
  296. }
  297. })
  298. this.isShow=false
  299. // console.log()
  300. }
  301. },
  302. }
  303. </script>
  304. <style>
  305. page {
  306. background-color: #f8f7f8;
  307. }
  308. .list-left {
  309. background-color: #007AFF;
  310. }
  311. .content {
  312. position: relative;
  313. display: flex;
  314. height:100%;
  315. flex-direction: column;
  316. align-items: center;
  317. justify-content: center;
  318. }
  319. /* 弹出框样式 */
  320. .Popup{
  321. position: fixed;
  322. display: flex;
  323. flex-direction: column;
  324. align-items: center;
  325. justify-content: center;
  326. top: 0;
  327. z-index:400;
  328. width:100%;
  329. height:100%;
  330. background-color:rgba(128,128,128,0.5);
  331. }
  332. .popu-content{
  333. height: 450rpx;
  334. width: 75%;
  335. background-color: white;
  336. opacity: 1;
  337. border-radius: 10rpx;
  338. }
  339. .popu-title{
  340. height: 80rpx;
  341. line-height: 80rpx;
  342. text-align: center;
  343. font-size: 30rpx;
  344. border-bottom: solid 1rpx #e3e3e3;
  345. }
  346. .popu-order{
  347. height: 120rpx;
  348. padding: 0 14rpx;
  349. margin: 30rpx 30rpx;
  350. background-color: #C0C0C0;
  351. color: red;
  352. font-weight: 540;
  353. line-height: 55rpx;
  354. text-align: center;
  355. font-size: 38rpx;
  356. }
  357. .popu-count{
  358. display: flex;
  359. height: 80rpx;
  360. line-height: 80rpx;
  361. margin: 30rpx;
  362. }
  363. .popu-count-title{
  364. flex: 1;
  365. }
  366. .count-button{
  367. flex: 1;
  368. /* float: ; */
  369. /* height: 140rpx;
  370. width: 300rpx; */
  371. /* background-color: #007AFF; */
  372. }
  373. .reduce{
  374. margin-left:60rpx;
  375. border-top-left-radius: 10rpx;
  376. border-bottom-left-radius: 10rpx;
  377. line-height: 60rpx;
  378. font-size:50rpx;
  379. }
  380. .add{
  381. border-top-right-radius: 10rpx;
  382. border-bottom-right-radius: 10rpx;
  383. line-height: 60rpx;
  384. font-size:40rpx;
  385. color: #1087e2;
  386. }
  387. .reduce,.add,.num{
  388. margin-top: 10rpx;
  389. width: 60rpx;
  390. height: 60rpx;
  391. display: inline-block;
  392. vertical-align: top;
  393. text-align: center;
  394. border: solid 1px #C0C0C0;
  395. }
  396. .tw-button{
  397. display: flex;
  398. height: 80rpx;
  399. text-align: center;
  400. border-top: solid 1px #e3e3e3;
  401. }
  402. .left-button,.right-button{
  403. flex: 1;
  404. text-align: center;
  405. line-height: 80rpx;
  406. }
  407. .right-button{
  408. color: #1087e2;
  409. }
  410. .left-button{
  411. border-right: solid 1px #e3e3e3;
  412. }
  413. .rotation {
  414. height: 280rpx;
  415. width: 100%;
  416. background-color: #55ffff;
  417. }
  418. .scroll-view-item_H {
  419. display: inline-block;
  420. width: 100%;
  421. height:600rpx;
  422. }
  423. .tag {
  424. padding: 5px 10px;
  425. height: 200rpx;
  426. width: 90%;
  427. background-color: white;
  428. border-radius: 12rpx;
  429. margin-top: -50rpx;
  430. }
  431. .tag-title {
  432. font-size: 28px;
  433. font-weight: 600;
  434. }
  435. .tag-text {
  436. font-size: 16px;
  437. margin-top: 10rpx;
  438. }
  439. .reserve-list {
  440. margin-top: 30rpx;
  441. background-color: white;
  442. height: 510rpx;
  443. width: 100%;
  444. }
  445. .list-left,
  446. .list-right {
  447. width: 50%;
  448. display: inline-block;
  449. border: none;
  450. height: 50px;
  451. line-height: 50px;
  452. text-align: center;
  453. border-bottom: #F1F1F1 solid 1rpx;
  454. }
  455. .north-li {
  456. display: flex;
  457. border-bottom: solid 1rpx #C0C0C0;
  458. padding: 20rpx 0;
  459. /* background-color: #007AFF; */
  460. height: 100rpx;
  461. }
  462. .li-left {
  463. flex: 0 0 50%;
  464. text-align: center;
  465. border-right: #C0C0C0 dashed 1rpx;
  466. }
  467. .li-right {
  468. flex: 1;
  469. text-align: center;
  470. }
  471. .li-middle {
  472. flex: 1;
  473. line-height: 100rpx;
  474. color: #f50004;
  475. text-align: center;
  476. font-size: 36rpx;
  477. border-right: #C0C0C0 dashed 1rpx;
  478. }
  479. .li-order {
  480. margin-top: 20rpx;
  481. height: 60rpx;
  482. width: 150rpx;
  483. background-color: #f50004;
  484. color: white;
  485. line-height: 60rpx;
  486. font-size: 16px;
  487. border-radius: 5rpx;
  488. }
  489. .north-time {
  490. height: 60rpx;
  491. /* line-height: 70rpx; */
  492. font-size: 35rpx;
  493. text-align: center;
  494. }
  495. .ordered-num {
  496. margin-right: 20px;
  497. }
  498. .site-num,
  499. .ordered-num {
  500. color: #f50004;
  501. }
  502. .ordered,
  503. .site {
  504. color: #999999;
  505. }
  506. .ordered,
  507. .site,
  508. .site-num,
  509. .ordered-num {
  510. font-size: 28rpx;
  511. }
  512. .introduce{
  513. margin-top:40rpx;
  514. background-color: white;
  515. width: 100%;
  516. padding-bottom: 50rpx;
  517. }
  518. .introduce-title{
  519. height: 80rpx;
  520. line-height: 80rpx;
  521. font-size: 40rpx;
  522. /* font-weight: 600; */
  523. text-align: center;
  524. border-bottom: #999999 dashed 2rpx;
  525. }
  526. .foot{
  527. width: 100%;
  528. font-size: 30rpx;
  529. color: #999999;
  530. text-align: center;
  531. margin-top: 100rpx;
  532. padding-bottom: 40rpx;
  533. }
  534. .introduce-del{
  535. padding:40rpx 40rpx;
  536. font-size: 28rpx;
  537. color: #4a4a4a;
  538. }
  539. </style>