sold.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <template>
  2. <view class="sold">
  3. <custom-nav :title="pageTitle"></custom-nav>
  4. <view class="content">
  5. <scroll-view scroll-y :style="{ height: scrollViewHeight + 'px' }">
  6. <view class="top">
  7. <ucharts-pie ref="pie" v-if="data1" :chartData="sold_data.sold_data1" :season="userServerInfo.season"></ucharts-pie>
  8. </view>
  9. <view class="bot">
  10. <ucharts-column v-if="data2" :chartData="sold_data.sold_data2" :season="userServerInfo.season"></ucharts-column>
  11. <view class="table">
  12. <view class="row">
  13. <view class="item left">
  14. <text>今日销售总量:</text>
  15. <text style="color: #FA6342;">{{ simple_today + hard_today + old_today + newold_today + youth_today }}套</text>
  16. </view>
  17. <view class="item">
  18. <text>一周销售总量:</text>
  19. <text style="color: #FA6342;">{{ simple_week + hard_week + old_week + newold_week + youth_week }}套</text>
  20. </view>
  21. </view>
  22. <view class="row">
  23. <view class="item left">
  24. <text>简约版:</text>
  25. <text style="color: #FA6342;">{{ simple_today }}套</text>
  26. </view>
  27. <view class="item">
  28. <text>简约版:</text>
  29. <text style="color: #FA6342;">{{ simple_week }}套</text>
  30. </view>
  31. </view>
  32. <view class="row">
  33. <view class="item left">
  34. <text>精装版:</text>
  35. <text style="color: #FA6342;">{{ hard_today }}套</text>
  36. </view>
  37. <view class="item">
  38. <text>精装版:</text>
  39. <text style="color: #FA6342;">{{ hard_week }}套</text>
  40. </view>
  41. </view>
  42. <view class="row">
  43. <view class="item left">
  44. <text>高腰版:</text>
  45. <text style="color: #FA6342;">{{ old_today }}套</text>
  46. </view>
  47. <view class="item">
  48. <text>高腰版:</text>
  49. <text style="color: #FA6342;">{{ old_week }}套</text>
  50. </view>
  51. </view>
  52. <view class="row">
  53. <view class="item left">
  54. <text>青春版:</text>
  55. <text style="color: #FA6342;">{{ youth_today }}套</text>
  56. </view>
  57. <view class="item">
  58. <text>青春版:</text>
  59. <text style="color: #FA6342;">{{ youth_week }}套</text>
  60. </view>
  61. </view>
  62. <view class="row">
  63. <view class="item left">
  64. <text>纯棉老人版:</text>
  65. <text style="color: #FA6342;">{{ newold_today }}套</text>
  66. </view>
  67. <view class="item">
  68. <text>纯棉老人版:</text>
  69. <text style="color: #FA6342;">{{ newold_week }}套</text>
  70. </view>
  71. </view>
  72. </view>
  73. </view>
  74. </scroll-view>
  75. </view>
  76. </view>
  77. </template>
  78. <script>
  79. import { api_getSoldTotal, api_getCurrentSoldInfo } from '../../api.js'
  80. import uchartsPie from '../../components/ucharts-pie.vue'
  81. import uchartsColumn from '../../components/ucharts-column.vue'
  82. export default {
  83. components: {
  84. uchartsPie,
  85. uchartsColumn
  86. },
  87. data() {
  88. return {
  89. pageTitle: '产品销售',
  90. scrollViewHeight: 0, //scrollview 高
  91. sold_data: {}, //图表数据
  92. simple_today: 0, //简约版今日销售
  93. hard_today: 0, //精装版今日销售
  94. old_today: 0, //高腰版今日销售
  95. youth_today: 0, //青春版今日销售
  96. simple_week: 0, //简约版本周销售
  97. hard_week: 0, //精装版本周销售
  98. old_week: 0, //高腰版本周销售
  99. youth_week: 0, //青春版本周销售
  100. newold_today: 0,
  101. newold_week: 0,
  102. data1: false,
  103. data2: false
  104. }
  105. },
  106. computed: {
  107. userServerInfo () { //用户服务器信息
  108. return this.$store.state.userServerInfo
  109. }
  110. },
  111. created() {
  112. console.log(this.userServerInfo.season)
  113. uni.showLoading({ title: '加载中', mask: true }) //显示loading
  114. this.$scrollViewHeight('.content') //设置页面内 scroll view 的高度
  115. this.$ajax.get(`${api_getSoldTotal}?season=${this.userServerInfo.season}`).then(([ , { data: res }]) => { //获取赛季总销售数据
  116. this.sold_data.sold_data1 = res.data.sold_data
  117. this.data1 = true
  118. })
  119. this.$ajax.get(`${api_getCurrentSoldInfo}?season=${this.userServerInfo.season}`).then(([ , { data: res }]) => { //获取当前赛季获销售数据
  120. this.sold_data.sold_data2 = res.data.sold_data
  121. this.data2 = true
  122. this.simple_today = res.data.simple_today
  123. this.hard_today = res.data.hard_today
  124. this.old_today = res.data.old_today
  125. this.simple_week = res.data.simple_week
  126. this.hard_week = res.data.hard_week
  127. this.old_week = res.data.old_week
  128. this.newold_week = res.data.newold_week
  129. this.newold_today = res.data.newold_today
  130. this.youth_week = res.data.youth_week
  131. this.youth_today = res.data.youth_today
  132. })
  133. this.$hideLoading() //异步操作结束,停止 loading
  134. }
  135. }
  136. </script>
  137. <style lang="scss" scoped>
  138. .sold {
  139. @include page();
  140. .content {
  141. border-top: $custom-nav-borderbot-height solid $custom-nav-borderbot-color;
  142. background: $custom-nav-borderbot-color;
  143. .top {
  144. height: 410rpx;
  145. margin-bottom: 20rpx;
  146. background: #FFFFFF;
  147. position: relative;
  148. }
  149. .bot {
  150. min-height: 77rpx;
  151. background: #FFFFFF;
  152. .table {
  153. width: 650rpx;
  154. margin: 40rpx auto 0;
  155. border-top: 1rpx solid #EEEEEE;
  156. padding-bottom: 26rpx;
  157. .row {
  158. height: 63rpx;
  159. border-bottom: 1rpx solid #EEEEEE;
  160. .item {
  161. box-sizing: border-box;
  162. width: 50%;
  163. height: 100%;
  164. float: left;
  165. display: flex;
  166. justify-content: center;
  167. align-items: center;
  168. font-size: 24rpx;
  169. &.left {
  170. border-right: 1rpx solid #EEEEEE;
  171. }
  172. }
  173. }
  174. }
  175. }
  176. }
  177. }
  178. </style>