index.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  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.$nextTick(function(){
  66. // 监听整改完成后刷新事件
  67. uni.$on('refreshBL', function(data){
  68. _this.$refs.salesList.getList(1)
  69. })
  70. })
  71. const theme = getApp().globalData.theme
  72. this.theme = theme
  73. uni.setTabBarItem({
  74. "index": 0,
  75. "iconPath": "static/"+theme+"/tabbar/home.png",
  76. "selectedIconPath": "static/"+theme+"/tabbar/home-active.png",
  77. })
  78. uni.setTabBarItem({
  79. "index": 1,
  80. "iconPath": "static/"+theme+"/tabbar/stock.png",
  81. "selectedIconPath": "static/"+theme+"/tabbar/stock-active.png",
  82. })
  83. uni.setTabBarItem({
  84. "index": 2,
  85. "iconPath": "static/"+theme+"/tabbar/shelf.png",
  86. "selectedIconPath": "static/"+theme+"/tabbar/shelf-active.png",
  87. })
  88. uni.setTabBarItem({
  89. "index": 3,
  90. "iconPath": "static/"+theme+"/tabbar/user.png",
  91. "selectedIconPath": "static/"+theme+"/tabbar/user-active.png",
  92. })
  93. uni.setTabBarStyle({
  94. color: this.$config("topBarTitleColors"),
  95. selectedColor: this.$config("primaryColor"),
  96. borderStyle: 'white',
  97. complete: function(res){
  98. console.log(res)
  99. }
  100. })
  101. },
  102. onUnload() {
  103. uni.$off('refreshBL')
  104. },
  105. onShow() {
  106. this.getBizData()
  107. },
  108. methods:{
  109. seleteTime(val){
  110. this.navInd = val
  111. },
  112. toPage(url){
  113. uni.navigateTo({ url: url })
  114. },
  115. getBizData () {
  116. bizData({}).then(res => {
  117. if (res.status == 200) {
  118. this.bizData = res.data || null
  119. } else {
  120. this.bizData = null
  121. }
  122. })
  123. }
  124. }
  125. }
  126. </script>
  127. <style lang="scss">
  128. .sales-warp{
  129. width: 100%;
  130. padding: 20rpx 20upx;
  131. .color_6{
  132. color: #666;
  133. }
  134. .font_13{
  135. font-size: 26upx;
  136. }
  137. .content-data{
  138. background-color: #fff;
  139. padding: 20upx 20upx;
  140. border-radius: 20upx;
  141. box-shadow: 3upx 2upx 6upx #eee;
  142. margin-bottom: 20upx;
  143. .date-type{
  144. margin: 0 120upx 20upx;
  145. border-radius: 50upx;
  146. border: 1upx solid #eee;
  147. text{
  148. display: inline-block;
  149. padding: 10upx 0;
  150. width: 33%;
  151. text-align: center;
  152. }
  153. text:first-child{
  154. border-top-left-radius: 50upx;
  155. border-bottom-left-radius: 50upx;
  156. }
  157. text:last-child{
  158. border-top-right-radius: 50upx;
  159. border-bottom-right-radius: 50upx;
  160. }
  161. text:not(:last-child){
  162. border-right: 1upx solid #eee;
  163. }
  164. .active_day {
  165. background: rgb(0, 122, 255);
  166. color: #fff;
  167. }
  168. }
  169. .total{
  170. display: flex;
  171. .item-box{
  172. text-align: center;
  173. width: 50%;
  174. color:#999;
  175. }
  176. .item-box:first-child{
  177. border-right: 1px solid #e4e7ed;
  178. }
  179. }
  180. }
  181. .nav-cont{
  182. .nav-item{
  183. width: 49%;
  184. border-radius: 25upx;
  185. background-color: #ffffff;
  186. padding: 14upx 0;
  187. box-shadow: 3upx 2upx 6upx #eee;
  188. margin-bottom: 20upx;
  189. text-align: center;
  190. .nav-pic{
  191. margin: 0 auto;
  192. }
  193. .nav-txt{
  194. font-size: 28upx;
  195. color: #666666;
  196. }
  197. }
  198. }
  199. .sales-list{
  200. .title{
  201. margin-bottom: 14upx;
  202. display: flex;
  203. align-items: center;
  204. justify-content: space-between;
  205. .title-name{
  206. font-size: 32upx;
  207. color: #333;
  208. font-weight: 1000;
  209. }
  210. .title-all{
  211. color: rgb(144, 147, 153);
  212. }
  213. }
  214. }
  215. }
  216. </style>