index.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  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 class="nav-item" @click="toPage('/pages/webviews/openview?title=产品查询&url=https://jgqp.51cjml.com/h5/#!/')">
  34. <u-image class="nav-pic" :src="`../../static/${theme}/navIcon/pfind.png`" width="64" height="64"></u-image>
  35. <text class="nav-txt">产品查询</text>
  36. </view>
  37. </view>
  38. <!-- 销售单 -->
  39. <view class="sales-list">
  40. <view class="title">
  41. <text class="title-name">销售单</text>
  42. <view class="title-all" @click="toPage('/pages/sales/list')">查看全部<u-icon name="arrow-right" color="rgb(144, 147, 153)" size="28"></u-icon></view>
  43. </view>
  44. <!-- 销售单列表 -->
  45. <listComponent ref="salesList" height="458" />
  46. </view>
  47. </view>
  48. </template>
  49. <script>
  50. import ListComponent from './listComponent.vue'
  51. import { toThousands } from '@/libs/tools'
  52. import { bizData } from '@/api/sales'
  53. export default{
  54. components: { ListComponent },
  55. data(){
  56. return{
  57. tabNav: [
  58. { name: '今日', ind: 0 },
  59. { name: '本周', ind: 1 },
  60. { name: '本月', ind: 2 }
  61. ],
  62. navInd: 0,
  63. bizData: null, // 销售数据统计
  64. theme: ''
  65. }
  66. },
  67. onLoad() {
  68. const _this = this
  69. this.$nextTick(function(){
  70. // 监听整改完成后刷新事件
  71. uni.$on('refreshBL', function(data){
  72. _this.$refs.salesList.getList(1)
  73. })
  74. })
  75. const theme = getApp().globalData.theme
  76. this.theme = theme
  77. uni.setTabBarItem({
  78. "index": 0,
  79. "iconPath": "static/"+theme+"/tabbar/home.png",
  80. "selectedIconPath": "static/"+theme+"/tabbar/home-active.png",
  81. })
  82. uni.setTabBarItem({
  83. "index": 1,
  84. "iconPath": "static/"+theme+"/tabbar/stock.png",
  85. "selectedIconPath": "static/"+theme+"/tabbar/stock-active.png",
  86. })
  87. uni.setTabBarItem({
  88. "index": 2,
  89. "iconPath": "static/"+theme+"/tabbar/shelf.png",
  90. "selectedIconPath": "static/"+theme+"/tabbar/shelf-active.png",
  91. })
  92. uni.setTabBarItem({
  93. "index": 3,
  94. "iconPath": "static/"+theme+"/tabbar/user.png",
  95. "selectedIconPath": "static/"+theme+"/tabbar/user-active.png",
  96. })
  97. uni.setTabBarStyle({
  98. color: this.$config("topBarTitleColors"),
  99. selectedColor: this.$config("primaryColor"),
  100. borderStyle: 'white',
  101. complete: function(res){
  102. console.log(res)
  103. }
  104. })
  105. },
  106. onUnload() {
  107. uni.$off('refreshBL')
  108. },
  109. onShow() {
  110. this.getBizData()
  111. },
  112. methods:{
  113. seleteTime(val){
  114. this.navInd = val
  115. },
  116. toPage(url){
  117. uni.navigateTo({ url: url })
  118. },
  119. getBizData () {
  120. bizData({}).then(res => {
  121. if (res.status == 200) {
  122. this.bizData = res.data || null
  123. } else {
  124. this.bizData = null
  125. }
  126. })
  127. }
  128. }
  129. }
  130. </script>
  131. <style lang="scss">
  132. .sales-warp{
  133. width: 100%;
  134. padding: 20rpx 20upx;
  135. .color_6{
  136. color: #666;
  137. }
  138. .font_13{
  139. font-size: 26upx;
  140. }
  141. .content-data{
  142. background-color: #fff;
  143. padding: 20upx 20upx;
  144. border-radius: 20upx;
  145. box-shadow: 3upx 2upx 6upx #eee;
  146. margin-bottom: 20upx;
  147. .date-type{
  148. margin: 0 120upx 20upx;
  149. border-radius: 50upx;
  150. border: 1upx solid #eee;
  151. text{
  152. display: inline-block;
  153. padding: 10upx 0;
  154. width: 33%;
  155. text-align: center;
  156. }
  157. text:first-child{
  158. border-top-left-radius: 50upx;
  159. border-bottom-left-radius: 50upx;
  160. }
  161. text:last-child{
  162. border-top-right-radius: 50upx;
  163. border-bottom-right-radius: 50upx;
  164. }
  165. text:not(:last-child){
  166. border-right: 1upx solid #eee;
  167. }
  168. .active_day {
  169. background: rgb(0, 122, 255);
  170. color: #fff;
  171. }
  172. }
  173. .total{
  174. display: flex;
  175. .item-box{
  176. text-align: center;
  177. width: 50%;
  178. color:#999;
  179. }
  180. .item-box:first-child{
  181. border-right: 1px solid #e4e7ed;
  182. }
  183. }
  184. }
  185. .nav-cont{
  186. .nav-item{
  187. width: 49%;
  188. border-radius: 25upx;
  189. background-color: #ffffff;
  190. padding: 14upx 0;
  191. box-shadow: 3upx 2upx 6upx #eee;
  192. margin-bottom: 20upx;
  193. text-align: center;
  194. .nav-pic{
  195. margin: 0 auto;
  196. }
  197. .nav-txt{
  198. font-size: 28upx;
  199. color: #666666;
  200. }
  201. }
  202. }
  203. .sales-list{
  204. .title{
  205. margin-bottom: 14upx;
  206. display: flex;
  207. align-items: center;
  208. justify-content: space-between;
  209. .title-name{
  210. font-size: 32upx;
  211. color: #333;
  212. font-weight: 1000;
  213. }
  214. .title-all{
  215. color: rgb(144, 147, 153);
  216. }
  217. }
  218. }
  219. }
  220. </style>