index.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  1. <template>
  2. <view class="home">
  3. <capsule></capsule>
  4. <view class="bg-box"></view>
  5. <view class="header-top" :style="{ height: menuButtonHeight }">
  6. <view class="shop-title">麦乐鸡烤肉店</view>
  7. <view class="shop-state">
  8. <tui-icon style="height: 36rpx;" name="circle-fill" color="rgb(70,208,88)" :size="20"></tui-icon>
  9. <text>营业中</text>
  10. </view>
  11. </view>
  12. <view class="header-content"></view>
  13. <view class="main-tool">
  14. <view class="tool-list">
  15. <view class="tool-item" v-for="item in toolList" :key="item.title">
  16. <image :src="item.img" alt="" />
  17. <text>{{ item.title }}</text>
  18. </view>
  19. </view>
  20. </view>
  21. <view class="summarize-box">
  22. <view class="summarize-left">经营概括</view>
  23. <view class="summarize-right">
  24. <text>更多</text>
  25. <tui-icon name="arrowright" :size="24"></tui-icon>
  26. </view>
  27. </view>
  28. <view class="statistics-list">
  29. <view class="statistics-item" v-for="(item, index) in statisticsList" :key="index">
  30. <view class="statistics-trans">{{ item.title }}</view>
  31. <view class="statistics-price">
  32. <view class="price">{{ item.price }}</view>
  33. <view class="text">较昨日</view>
  34. </view>
  35. <view class="proportion" v-if="item.state !== 2">
  36. <view class="proportion-box">
  37. <text :style="{ color: item.state == 0 ? '#42D373' : '#EF530E' }">{{ item.proportion }}%</text>
  38. <image
  39. :src="item.state == 0 ? require('@/static/image/home/decline-icon.png') : require('@/static/image/home/rise-icon.png')"
  40. alt="" />
  41. <!-- <image src="@/static/image/home/decline-icon.png" alt="" /> -->
  42. </view>
  43. </view>
  44. <view class="chart-img" v-if="item.state !== 2">
  45. <template v-if="item.state == 0">
  46. <image
  47. :src="item.proportion <= 16 ? require('@/static/image/home/green.png') : require('@/static/image/home/green-more.png')"
  48. alt="" />
  49. </template>
  50. <template v-if="item.state == 1">
  51. <image src="@/static/image/home/red.png" alt="" />
  52. </template>
  53. </view>
  54. <view class="empty" v-if="item.state == 2">
  55. <view class="left"></view>
  56. <view class="bottom"></view>
  57. </view>
  58. </view>
  59. </view>
  60. </view>
  61. </template>
  62. <script>
  63. export default {
  64. created() {
  65. // 获取胶囊的高度
  66. // #ifdef MP-WEIXIN
  67. let menuButtonInfo = uni.getMenuButtonBoundingClientRect();
  68. this.menuButtonHeight = menuButtonInfo.height + 'px'
  69. // #endif
  70. },
  71. data() {
  72. return {
  73. // 胶囊的高度
  74. menuButtonHeight: null,
  75. toolList: [
  76. {
  77. title: "扫码验劵",
  78. img: require('@/static/image/home/1.png')
  79. },
  80. {
  81. title: "输码验劵",
  82. img: require('@/static/image/home/2.png')
  83. },
  84. {
  85. title: "核销明细",
  86. img: require('@/static/image/home/3.png')
  87. },
  88. {
  89. title: "收款记录",
  90. img: require('@/static/image/home/4.png')
  91. },
  92. ],
  93. statisticsList: [
  94. {
  95. title: "今日成交金额",
  96. price: "16500元",
  97. proportion: "16",
  98. state: 0
  99. },
  100. {
  101. title: "今日成交订单量",
  102. price: "60单",
  103. proportion: "20",
  104. state: 0
  105. },
  106. {
  107. title: "今日核销金额",
  108. price: "14200元",
  109. proportion: "16",
  110. state: 1
  111. },
  112. {
  113. title: "今日成交订单量",
  114. price: "0",
  115. proportion: "16",
  116. state: 2
  117. },
  118. ]
  119. }
  120. },
  121. onLoad() {
  122. },
  123. methods: {
  124. }
  125. }
  126. </script>
  127. <style lang="scss" scoped>
  128. .home {
  129. width: 100vw;
  130. height: 100vh;
  131. background-color: rgb(247, 247, 247);
  132. position: relative;
  133. z-index: -2;
  134. .bg-box {
  135. position: absolute;
  136. top: 0;
  137. left: 0;
  138. width: 100vw;
  139. height: 654rpx;
  140. z-index: -1;
  141. background: linear-gradient(136deg, rgba(239, 83, 14, 0.63) 13%, rgba(239, 83, 14, 0.27) 54%);
  142. }
  143. .header-top {
  144. margin-left: 32rpx;
  145. @include flex(flex-start, null, 12rpx);
  146. .shop-title {
  147. font-size: 36rpx;
  148. color: #000;
  149. }
  150. .shop-state {
  151. width: 148rpx;
  152. height: 48rpx;
  153. border-radius: 24rpx;
  154. background-color: #fff;
  155. box-sizing: border-box;
  156. padding: 0 16rpx;
  157. @include flex(space-between, null, 6rpx);
  158. text {
  159. font-size: 24rpx;
  160. }
  161. }
  162. }
  163. .header-content {
  164. width: 694rpx;
  165. height: 294rpx;
  166. margin: 60rpx auto 40rpx;
  167. background: rgba(255, 255, 255, 0.5);
  168. border-radius: 32rpx;
  169. }
  170. .main-tool {
  171. .tool-list {
  172. padding: 40rpx 60rpx 50rpx;
  173. background-color: #fff;
  174. height: 208rpx;
  175. width: 100%;
  176. border-radius: 28px 28px 0px 0px;
  177. box-sizing: border-box;
  178. @include flex(space-between, null, 60rpx);
  179. .tool-item {
  180. @include flex(center, column, 10rpx);
  181. image {
  182. width: 48rpx;
  183. height: 48rpx;
  184. }
  185. text {
  186. color: #666666;
  187. font-size: 28rpx;
  188. }
  189. }
  190. }
  191. }
  192. .summarize-box {
  193. padding: 0 32rpx;
  194. box-sizing: border-box;
  195. @include flex(space-between);
  196. margin: 32rpx 0;
  197. .summarize-left {
  198. font-size: 36rpx;
  199. color: #3D3D3D;
  200. }
  201. .summarize-right {
  202. @include flex(center, null);
  203. font-size: 28rpx;
  204. color: #999999;
  205. }
  206. }
  207. .statistics-list {
  208. @include flex(space-between, null, 18rpx);
  209. flex-wrap: wrap;
  210. padding: 0 12rpx;
  211. box-sizing: border-box;
  212. .statistics-item {
  213. width: 354rpx;
  214. height: 286rpx;
  215. padding: 32rpx;
  216. box-sizing: border-box;
  217. background-color: #fff;
  218. border-radius: 28rpx;
  219. .statistics-trans {
  220. color: #666666;
  221. font-size: 28rpx;
  222. margin-bottom: 24rpx;
  223. }
  224. .statistics-price {
  225. @include flex(space-between);
  226. .price {
  227. color: #333333;
  228. font-size: 36rpx;
  229. }
  230. .text {
  231. margin-right: 10rpx;
  232. color: #666666;
  233. font-size: 24rpx
  234. }
  235. }
  236. .proportion {
  237. @include flex(flex-end);
  238. margin: 20rpx 0 12rpx;
  239. .proportion-box {
  240. @include flex(center, null, 5rpx);
  241. text {
  242. font-size: 28rpx;
  243. }
  244. image {
  245. width: 20rpx;
  246. height: 28rpx;
  247. display: block;
  248. }
  249. }
  250. }
  251. .chart-img {
  252. width: 100%;
  253. height: 80rpx;
  254. image {
  255. width: 100%;
  256. height: 100%;
  257. }
  258. }
  259. .empty{
  260. position: relative;
  261. width: 100%;
  262. height: 135rpx;
  263. .left{
  264. position: absolute;
  265. right: 25rpx;
  266. top: 20rpx;
  267. width: 28rpx;
  268. height: 5rpx;
  269. background-color: #666666;
  270. }
  271. .bottom{
  272. width: 100%;
  273. position: absolute;
  274. left: 0;
  275. bottom: 0;
  276. height: 5rpx;
  277. background-color: #666666;
  278. }
  279. }
  280. }
  281. }
  282. }
  283. </style>