index.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. <template>
  2. <div class="home">
  3. <div class="tab">
  4. <div class="make-order"
  5. v-for="item,index in tabList"
  6. :key="index">
  7. <div class="make-icon">
  8. <img :src="item.image">
  9. </div>
  10. <div class="make-tips">
  11. <div class="make-num">{{ item.num }}</div>
  12. <div class="make-name">{{ item.name }}</div>
  13. </div>
  14. </div>
  15. </div>
  16. <div class="order-list">
  17. <div class="title">预约订单列表</div>
  18. <div v-if="orderList.length>0"
  19. class="list-info"
  20. @click="toOrderDetails(item)">
  21. <div class="user-info"
  22. v-for="(item,index) in orderList"
  23. :key="index"
  24. :style="index==orderList.length-1?'border-bottom:0px':''">
  25. <div class="head-img">
  26. <div class="new">新</div><img :src="item.avatar_url"
  27. alt="">
  28. </div>
  29. <div class="user-information">
  30. <div class="name">客户昵称:<span>{{ item.nickname }}</span></div>
  31. <div class="name">预约项目时间:<span>{{ item.order_time }}</span></div>
  32. <div class="name">预约项目数量:<span>{{ item.project_num }}</span></div>
  33. </div>
  34. <ul class="product-list">
  35. <li class="product-image"
  36. v-for="value,i in item.project_list"
  37. :key="i"><img :src="value.cover_url"
  38. alt=""></li>
  39. </ul>
  40. <div class="status"
  41. :style="item.status==0?'color: #FC3019':item.status==5?'color: #A999EA':'color: #61D09D;'">
  42. {{ item.status==0?'未支付':item.status==5?'已取消':'待使用' }}
  43. </div>
  44. </div>
  45. </div>
  46. <div v-else
  47. class="empty">
  48. 暂无数据
  49. </div>
  50. </div>
  51. </div>
  52. </template>
  53. <script>
  54. import api from '@/server/home'
  55. export default {
  56. name: 'home',
  57. data () {
  58. return {
  59. tabList: [
  60. {
  61. image: 'https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/home/make.png',
  62. num: 3,
  63. name: '预约订单'
  64. },
  65. {
  66. image: 'https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/home/unpaid.png',
  67. num: 4,
  68. name: '未支付订单'
  69. },
  70. {
  71. image: 'https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/home/cancelOrder.png',
  72. num: 9,
  73. name: '取消订单'
  74. },
  75. ],
  76. orderList: [
  77. ],
  78. }
  79. },
  80. mounted: function () {
  81. },
  82. created: function () {
  83. this.getTotal()
  84. this.getToday()
  85. console.log(this.$store.state.comVal.token, 'this.$store.state.comVal.token');
  86. },
  87. methods: {
  88. getTotal () {
  89. api.getTotal().then(res => {
  90. if (res.code == 200) {
  91. this.tabList[0].num = res.data.order_num
  92. this.tabList[1].num = res.data.wait_pay_num
  93. this.tabList[2].num = res.data.cancel_num
  94. }
  95. console.log(res, 'res====');
  96. })
  97. },
  98. getToday () {
  99. api.getToday().then(res => {
  100. if (res.code = 200) {
  101. this.orderList = res.data.list
  102. }
  103. console.log(res, 'res');
  104. })
  105. },
  106. toOrderDetails (e) {
  107. if (e.status != 0) return
  108. this.$router.push({
  109. path: '/confirmOrder/details',
  110. query: {
  111. id: e.id
  112. }
  113. })
  114. },
  115. initData () {
  116. },
  117. },
  118. computed: {},
  119. watch: {}
  120. }
  121. </script>
  122. <style lang='less' scoped>
  123. @import url(../../style/root.less);
  124. .home {
  125. text-align: center;
  126. .tab {
  127. display: flex;
  128. justify-content: space-between;
  129. align-items: center;
  130. .make-order {
  131. width: 274px;
  132. padding: 14px 30px;
  133. background: #ffffff;
  134. box-shadow: 0px 2px 4px 0px rgba(184, 191, 198, 0.2);
  135. border-radius: 8px;
  136. display: flex;
  137. align-items: center;
  138. .make-icon {
  139. img {
  140. width: 68px;
  141. }
  142. }
  143. .make-tips {
  144. margin-left: 20px;
  145. .make-num {
  146. font-size: 34px;
  147. font-family: OPPOSans-B, OPPOSans;
  148. font-weight: normal;
  149. color: #333333;
  150. line-height: 40px;
  151. text-align: left;
  152. }
  153. .make-name {
  154. font-size: 14px;
  155. font-family: PingFangSC-Regular, PingFang SC;
  156. font-weight: 400;
  157. color: #333333;
  158. line-height: 20px;
  159. }
  160. }
  161. }
  162. }
  163. .order-list {
  164. margin-top: 18px;
  165. width: 100%;
  166. background: #ffffff;
  167. box-shadow: 0px 2px 4px 0px rgba(184, 191, 198, 0.2);
  168. border-radius: 8px;
  169. padding: 14px 12px;
  170. .title {
  171. font-size: 14px;
  172. font-family: PingFangSC-Medium, PingFang SC;
  173. font-weight: 500;
  174. color: #333333;
  175. line-height: 20px;
  176. text-align: left;
  177. padding-bottom: 5px;
  178. }
  179. .list-info {
  180. height: 300px;
  181. overflow: auto;
  182. .user-info {
  183. padding: 14px 0;
  184. border-bottom: 1px solid #e6e6e6;
  185. display: flex;
  186. align-items: center;
  187. .head-img {
  188. position: relative;
  189. width: 72px;
  190. .new {
  191. position: absolute;
  192. top: -2px;
  193. right: -2px;
  194. width: 21px;
  195. height: 21px;
  196. line-height: 21px;
  197. text-align: center;
  198. font-size: 12px;
  199. font-family: PingFangSC-Regular, PingFang SC;
  200. font-weight: 400;
  201. color: #ffffff;
  202. line-height: 17px;
  203. background: #ff6945;
  204. border-radius: 50%;
  205. }
  206. img {
  207. width: 100%;
  208. border-radius: 50%;
  209. }
  210. }
  211. .user-information {
  212. margin-left: 16px;
  213. text-align: left;
  214. font-size: 14px;
  215. font-family: SourceHanSansCN-Regular, SourceHanSansCN;
  216. font-weight: 400;
  217. color: #999999;
  218. line-height: 21px;
  219. .name {
  220. span {
  221. color: #333333;
  222. }
  223. }
  224. }
  225. .product-list {
  226. width: 322px;
  227. margin-left: 22px;
  228. white-space: nowrap;
  229. overflow-x: scroll;
  230. overflow-y: hidden;
  231. padding-left: 8px;
  232. .product-image {
  233. display: inline-block;
  234. margin-left: 16px;
  235. width: 72px;
  236. img {
  237. border-radius: 8px;
  238. width: 100%;
  239. display: block;
  240. }
  241. }
  242. }
  243. .status {
  244. margin-left: 56px;
  245. font-size: 16px;
  246. font-family: SourceHanSansCN-Regular, SourceHanSansCN;
  247. font-weight: 400;
  248. color: #fc3019;
  249. line-height: 24px;
  250. }
  251. }
  252. }
  253. .empty {
  254. height: 300px;
  255. line-height: 300px;
  256. width: 100%;
  257. font-size: 28px;
  258. color: slategrey;
  259. }
  260. }
  261. }
  262. </style>