index.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. <template>
  2. <view class="sales-warp">
  3. <!--销售数据统计 -->
  4. <view class="content-data">
  5. <view class="date-type">
  6. <text v-for="(item, index) in tabNav" :key="index" :class="[index == navInd ? 'active_day' : '']" @click="seleteTime(index)">{{item.name}}</text>
  7. </view>
  8. <view class="total">
  9. <view class="item-box">
  10. <u-count-to v-if="navInd==0" :end-val="bizData&&bizData.sales&&(bizData.sales.dayTotalQty || bizData.sales.dayTotalQty==0) ? bizData.sales.dayTotalQty : 0" separator=","></u-count-to>
  11. <u-count-to v-if="navInd==1" :end-val="bizData&&bizData.sales&&(bizData.sales.weekSalesQty || bizData.sales.weekSalesQty==0) ? bizData.sales.weekSalesQty : 0" separator=","></u-count-to>
  12. <u-count-to v-if="navInd==2" :end-val="bizData&&bizData.sales&&(bizData.sales.monthSalesQty || bizData.sales.monthSalesQty==0) ? bizData.sales.monthSalesQty : 0" separator=","></u-count-to>
  13. <view>销售总单量(个)</view>
  14. </view>
  15. <view class="item-box">
  16. <u-count-to v-if="navInd==0" :end-val="bizData&&bizData.sales&&(bizData.sales.dayTotalAmount || bizData.sales.dayTotalAmount==0) ? bizData.sales.dayTotalAmount : 0" separator="," :decimals="2"></u-count-to>
  17. <u-count-to v-if="navInd==1" :end-val="bizData&&bizData.sales&&(bizData.sales.weekSalesAmount || bizData.sales.weekSalesAmount==0) ? bizData.sales.weekSalesAmount : 0" separator="," :decimals="2"></u-count-to>
  18. <u-count-to v-if="navInd==2" :end-val="bizData&&bizData.sales&&(bizData.sales.monthSalesAmount || bizData.sales.monthSalesAmount==0) ? bizData.sales.monthSalesAmount : 0" separator="," :decimals="2"></u-count-to>
  19. <view>销售总金额(¥)</view>
  20. </view>
  21. </view>
  22. </view>
  23. <!-- 产品报价及新增销售单 -->
  24. <view class="nav-cont flex align_center justify_between">
  25. <view class="nav-item" @click="toPage('/pages/sales/productPricing')">
  26. <u-image class="nav-pic" style="margin-top: 5upx;" :src="`../../static/${theme}/navIcon/price_icon.png`" width="60" height="60"></u-image>
  27. <text class="nav-txt" style="margin-top: 5upx;">产品报价</text>
  28. </view>
  29. <view class="nav-item" @click="toPage('')">
  30. <u-image class="nav-pic" :src="`../../static/${theme}/navIcon/sale_icon.png`" width="70" height="70"></u-image>
  31. <text class="nav-txt">新增销售单</text>
  32. </view>
  33. </view>
  34. <!-- 销售单 -->
  35. <view class="sales-list">
  36. <view class="title">
  37. <text class="title-name">销售单</text>
  38. <view class="title-all" @click="toPage('/pages/sales/list')">查看全部<u-icon name="arrow-right" color="#666" size="28"></u-icon></view>
  39. </view>
  40. <!-- 销售单列表 -->
  41. <listComponent height="458" />
  42. </view>
  43. </view>
  44. </template>
  45. <script>
  46. import ListComponent from './listComponent.vue'
  47. import { toThousands } from '@/libs/tools'
  48. import { bizData } from '@/api/sales'
  49. export default{
  50. components: { ListComponent },
  51. data(){
  52. return{
  53. tabNav: [
  54. { name: '今日', ind: 0 },
  55. { name: '本周', ind: 1 },
  56. { name: '本月', ind: 2 }
  57. ],
  58. navInd: 0,
  59. bizData: null, // 销售数据统计
  60. theme: ''
  61. }
  62. },
  63. onLoad() {
  64. this.theme = getApp().globalData.theme
  65. },
  66. onShow() {
  67. this.getBizData()
  68. },
  69. methods:{
  70. seleteTime(val){
  71. this.navInd = val
  72. },
  73. toPage(url){
  74. uni.navigateTo({ url: url })
  75. },
  76. getBizData () {
  77. bizData({}).then(res => {
  78. if (res.status == 200) {
  79. this.bizData = res.data || null
  80. } else {
  81. this.bizData = null
  82. }
  83. })
  84. }
  85. }
  86. }
  87. </script>
  88. <style lang="scss">
  89. .sales-warp{
  90. width: 100%;
  91. padding: 20rpx 20upx;
  92. .color_6{
  93. color: #666;
  94. }
  95. .font_13{
  96. font-size: 26upx;
  97. }
  98. .content-data{
  99. background-color: #fff;
  100. padding: 20upx 20upx;
  101. border-radius: 20upx;
  102. box-shadow: 3upx 2upx 6upx #eee;
  103. margin-bottom: 20upx;
  104. .date-type{
  105. margin: 0 120upx 20upx;
  106. border-radius: 50upx;
  107. border: 1upx solid #eee;
  108. text{
  109. display: inline-block;
  110. padding: 10upx 0;
  111. width: 33%;
  112. text-align: center;
  113. }
  114. text:first-child{
  115. border-top-left-radius: 50upx;
  116. border-bottom-left-radius: 50upx;
  117. }
  118. text:last-child{
  119. border-top-right-radius: 50upx;
  120. border-bottom-right-radius: 50upx;
  121. }
  122. text:not(:last-child){
  123. border-right: 1upx solid #eee;
  124. }
  125. .active_day {
  126. background: rgb(0, 122, 255);
  127. color: #fff;
  128. }
  129. }
  130. .total{
  131. display: flex;
  132. .item-box{
  133. text-align: center;
  134. width: 50%;
  135. color:#999;
  136. }
  137. .item-box:first-child{
  138. border-right: 1px solid #e4e7ed;
  139. }
  140. }
  141. }
  142. .nav-cont{
  143. .nav-item{
  144. width: 49%;
  145. border-radius: 25upx;
  146. background-color: #ffffff;
  147. padding: 14upx 0;
  148. box-shadow: 3upx 2upx 6upx #eee;
  149. margin-bottom: 20upx;
  150. text-align: center;
  151. .nav-pic{
  152. margin: 0 auto;
  153. }
  154. .nav-txt{
  155. font-size: 28upx;
  156. color: #666666;
  157. }
  158. }
  159. }
  160. .sales-list{
  161. .title{
  162. margin-bottom: 14upx;
  163. display: flex;
  164. align-items: center;
  165. justify-content: space-between;
  166. .title-name{
  167. font-size: 32upx;
  168. color: #333;
  169. font-weight: 1000;
  170. }
  171. .title-all{
  172. color: #666;
  173. }
  174. }
  175. }
  176. }
  177. </style>