mainpage.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  1. <template>
  2. <div id="mainPage">
  3. <img src="../static/images/main/banner.png" height="121" width="414"/>
  4. <span class="shopNum">
  5. 俱乐部场馆共 1 处
  6. </span>
  7. <ul class="list">
  8. <li v-for="l in list" @click="goAppoint(l)" v-if="l.Status == 1 && l.ShopID == currShopId">
  9. <img src="../static/images/main/771.png" height="133" width="130"/>
  10. <div class="rt">
  11. <h5>{{l.ShopName}}</h5>
  12. <span>今日预约名额剩余
  13. <i v-if="l.RemainOrdernum > 0">{{l.RemainOrdernum}}</i>
  14. <i v-if="l.RemainOrdernum == 0" class="red">{{l.RemainOrdernum}}</i>
  15. 人</span>
  16. <span>地址:{{l.Addr}}</span>
  17. <em class="green" v-if="l.WxStatus == 1">点击预约</em>
  18. <em class="red" v-else>不可预约</em>
  19. </div>
  20. </li>
  21. <div class="tips" v-if="list == ''">
  22. <p style="text-align: center">
  23. 暂无可预约的门店
  24. </p>
  25. </div>
  26. </ul>
  27. <bottomTab :curTab="thisTab"></bottomTab>
  28. </div>
  29. </template>
  30. <script>
  31. import {
  32. ManagerSelfQuery,
  33. OrderShopQuery,
  34. testSelect,
  35. testTable,
  36. } from '../api/getApiRes.js'
  37. import bottomTab from '../components/bottomTab'
  38. import axios from 'axios';
  39. let qs = require('qs');
  40. import Global from '../Global.js'
  41. export default {
  42. data() {
  43. return {
  44. thisTab: '预约课程',
  45. shopNum: 0,
  46. recordNum: 0,
  47. Dannum: 0,
  48. GetHotelCounts: 0,
  49. GetDetectorNum: 0,
  50. currShopId: 0,
  51. list: [],
  52. }
  53. },
  54. mounted() {
  55. this.getManagerSelfQuery();
  56. },
  57. destroyed() {
  58. },
  59. methods: {
  60. getManagerSelfQuery() {
  61. let that = this;
  62. let param = {
  63. token: localStorage.token,
  64. };
  65. let postdata = qs.stringify(param);
  66. ManagerSelfQuery(postdata).then(res => {
  67. let json = res;
  68. if (json.Code == 0) {
  69. this.currShopId = json.Rs.ShopId;
  70. this.getList();
  71. } else {
  72. that.$toast.message(json.Memo);
  73. if (json.Code == 1010) {
  74. that.$router.push({path: '/login'});
  75. }
  76. }
  77. })
  78. },
  79. getList() {
  80. let that = this;
  81. let param = {
  82. token: localStorage.token,
  83. };
  84. let postdata = qs.stringify(param);
  85. OrderShopQuery(postdata).then(res => {
  86. let json = res;
  87. if (json.Code == 0) {
  88. that.list = json.Rs;
  89. if (that.list) {
  90. that.shopNum = json.Rs.length;
  91. }
  92. } else {
  93. that.$toast.message(json.Memo);
  94. }
  95. })
  96. },
  97. onGoNewPage(path) {
  98. this.$router.push({path: '/' + path});
  99. },
  100. goPage(pages) {
  101. this.$router.push({path: pages});
  102. },
  103. goAppoint(row) {
  104. let that = this;
  105. if (row.Status == 2) {
  106. that.Toast(row.name + '不可预约');
  107. return false
  108. } else {
  109. this.$router.push({
  110. path: '/appoint', query: {
  111. shopId: row.ShopID
  112. }
  113. });
  114. }
  115. }
  116. },
  117. beforeRouteEnter(to, from, next) {
  118. next(vm => {
  119. //因为当钩子执行前,组件实例还没被创建
  120. // vm 就是当前组件的实例相当于上面的 this,所以在 next 方法里你就可以把 vm 当 this 来用了。
  121. if (to.name == '') {
  122. vm.getList();
  123. }
  124. });
  125. },
  126. watch: {
  127. $route(to) {
  128. if (to.name == '') {
  129. this.getList();
  130. }
  131. },
  132. 'active'() {
  133. this.getList();
  134. }
  135. },
  136. components: {
  137. bottomTab
  138. }
  139. }
  140. </script>
  141. <style scoped>
  142. #mainPage {
  143. width: 100%;
  144. height: 100%;
  145. overflow: hidden;
  146. display: block;
  147. margin: 0 auto;
  148. background: #f2f2f2;
  149. }
  150. .goPage {
  151. overflow: hidden;
  152. display: block;
  153. margin: 0 auto;
  154. background: #fff;
  155. height: 50px;
  156. line-height: 50px;
  157. padding: 0 20px;
  158. color: #333;
  159. font-size: 18px;
  160. border-bottom: 1px solid #f2f2f2;
  161. }
  162. .goPage span {
  163. float: left;
  164. }
  165. .goPage i {
  166. float: right;
  167. margin-top: 12px;
  168. }
  169. .goPage img {
  170. overflow: hidden;
  171. display: block;
  172. width: 8px;
  173. height: 14px;
  174. float: right;
  175. margin-top: 16px;
  176. margin-right: 10px;
  177. }
  178. .goTitle i {
  179. margin-top: 10px;
  180. float: right;
  181. }
  182. .mapContainer {
  183. width: 100%;
  184. overflow: hidden;
  185. display: block;
  186. margin: 0 auto;
  187. max-height: 317px;
  188. }
  189. .shopNum {
  190. width: 100%;
  191. overflow: hidden;
  192. display: block;
  193. margin: 0 auto;
  194. font-family: "PingFang SC";
  195. font-weight: 300;
  196. font-size: 14px;
  197. color: #909090;
  198. text-align: center;
  199. }
  200. .list {
  201. width: 94%;
  202. overflow: hidden;
  203. display: block;
  204. margin: 0 auto;
  205. padding-left: 3%;
  206. padding-right: 3%;
  207. margin-top: 10px;
  208. padding-bottom: 20px;
  209. }
  210. .list li {
  211. width: 100%;
  212. height: 133px;
  213. background: transparent;
  214. margin-bottom: 20px;
  215. border-radius: 13px;
  216. background: #fff;
  217. box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.16);
  218. overflow: hidden;
  219. }
  220. .list img {
  221. float: left;
  222. }
  223. .list .rt {
  224. width: 58%;
  225. float: left;
  226. padding-left: 15px;
  227. }
  228. .list .rt h5 {
  229. font-family: "PingFang SC";
  230. font-weight: normal;
  231. font-size: 18px;
  232. text-align: left;
  233. color: #3b3b3b;
  234. margin: 0;
  235. margin-top: 18px;
  236. margin-bottom: 7px;
  237. }
  238. .list .rt span {
  239. width: 100%;
  240. overflow: hidden;
  241. display: block;
  242. margin: 0 auto;
  243. font-family: "PingFang SC";
  244. font-weight: normal;
  245. font-size: 12px;
  246. text-align: left;
  247. color: #909090;
  248. }
  249. .list .rt em {
  250. width: 100%;
  251. overflow: hidden;
  252. display: block;
  253. margin: 0 auto;
  254. font-family: "PingFang SC";
  255. font-weight: normal;
  256. font-size: 16px;
  257. padding-right: 1px;
  258. margin-top: 5px;
  259. float: right;
  260. text-align: right;
  261. }
  262. .list .rt em.green {
  263. color: #37cb00;
  264. }
  265. .list .rt em.red {
  266. color: #F8847F;
  267. }
  268. .red {
  269. color: #F8847F;
  270. }
  271. @media only screen and (max-width: 640px) {
  272. }
  273. @media only screen and (max-width: 480px) {
  274. }
  275. @media only screen and (max-width: 375px) {
  276. }
  277. @media only screen and (max-width: 360px) {
  278. }
  279. @media only screen and (max-width: 320px) {
  280. .list .rt {
  281. width: 52%;
  282. }
  283. .list .rt em {
  284. font-size: 14px;
  285. }
  286. }
  287. @media only screen and (min-width: 641px) {
  288. }
  289. </style>