index.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  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('/pages/sales/chooseCustomer')">
  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="rgb(144, 147, 153)" size="28"></u-icon></view>
  39. </view>
  40. <!-- 销售单列表 -->
  41. <listComponent ref="salesList" 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. const _this = this
  65. this.theme = getApp().globalData.theme
  66. this.$nextTick(function(){
  67. // 监听整改完成后刷新事件
  68. uni.$on('refreshBL', function(data){
  69. _this.$refs.salesList.getList(1)
  70. })
  71. })
  72. },
  73. onUnload() {
  74. uni.$off('refreshBL')
  75. },
  76. onShow() {
  77. this.getBizData()
  78. },
  79. methods:{
  80. seleteTime(val){
  81. this.navInd = val
  82. },
  83. toPage(url){
  84. uni.navigateTo({ url: url })
  85. },
  86. getBizData () {
  87. bizData({}).then(res => {
  88. if (res.status == 200) {
  89. this.bizData = res.data || null
  90. } else {
  91. this.bizData = null
  92. }
  93. })
  94. }
  95. }
  96. }
  97. </script>
  98. <style lang="scss">
  99. .sales-warp{
  100. width: 100%;
  101. padding: 20rpx 20upx;
  102. .color_6{
  103. color: #666;
  104. }
  105. .font_13{
  106. font-size: 26upx;
  107. }
  108. .content-data{
  109. background-color: #fff;
  110. padding: 20upx 20upx;
  111. border-radius: 20upx;
  112. box-shadow: 3upx 2upx 6upx #eee;
  113. margin-bottom: 20upx;
  114. .date-type{
  115. margin: 0 120upx 20upx;
  116. border-radius: 50upx;
  117. border: 1upx solid #eee;
  118. text{
  119. display: inline-block;
  120. padding: 10upx 0;
  121. width: 33%;
  122. text-align: center;
  123. }
  124. text:first-child{
  125. border-top-left-radius: 50upx;
  126. border-bottom-left-radius: 50upx;
  127. }
  128. text:last-child{
  129. border-top-right-radius: 50upx;
  130. border-bottom-right-radius: 50upx;
  131. }
  132. text:not(:last-child){
  133. border-right: 1upx solid #eee;
  134. }
  135. .active_day {
  136. background: rgb(0, 122, 255);
  137. color: #fff;
  138. }
  139. }
  140. .total{
  141. display: flex;
  142. .item-box{
  143. text-align: center;
  144. width: 50%;
  145. color:#999;
  146. }
  147. .item-box:first-child{
  148. border-right: 1px solid #e4e7ed;
  149. }
  150. }
  151. }
  152. .nav-cont{
  153. .nav-item{
  154. // width: 49%;
  155. width: 100%;
  156. border-radius: 25upx;
  157. background-color: #ffffff;
  158. padding: 14upx 0;
  159. box-shadow: 3upx 2upx 6upx #eee;
  160. margin-bottom: 20upx;
  161. text-align: center;
  162. .nav-pic{
  163. margin: 0 auto;
  164. }
  165. .nav-txt{
  166. font-size: 28upx;
  167. color: #666666;
  168. }
  169. }
  170. }
  171. .sales-list{
  172. .title{
  173. margin-bottom: 14upx;
  174. display: flex;
  175. align-items: center;
  176. justify-content: space-between;
  177. .title-name{
  178. font-size: 32upx;
  179. color: #333;
  180. font-weight: 1000;
  181. }
  182. .title-all{
  183. color: rgb(144, 147, 153);
  184. }
  185. }
  186. }
  187. }
  188. </style>