index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565
  1. <template>
  2. <view>
  3. <view class="order-index">
  4. <view class="topBox">
  5. <view class="header acea-row">
  6. <view class="items">
  7. <image :src="user.avatar" mode=""></image>
  8. <span class="font">{{user.staff_name}}</span><span>({{manager == 0?'店员':'店长'}})</span>
  9. </view>
  10. <view class="item">
  11. <!-- <view class="iconfont icon-saoma" @click="scanCode"></view> -->
  12. <!-- #ifdef MP || MP-WEIXIN || APP -->
  13. <view class="iconfont icon-saoma" @click="scanCode">
  14. </view>
  15. <!-- #endif -->
  16. <!-- #ifdef H5 -->
  17. <view v-if="isWeixin" class="iconfont icon-saoma" @click="scanCode"></view>
  18. <!-- #endif -->
  19. </view>
  20. </view>
  21. <view class="topstatus acea-row" v-if="is_manager == 1 || user.order_status == 1">
  22. <navigator url="/pages/admin/store/order/index?type=0" hover-class="none">
  23. <view class="title">{{orderlist.unpaid_count}}</view>
  24. <view>待付款</view>
  25. </navigator>
  26. <navigator url="/pages/admin/store/order/index?type=1" hover-class="none">
  27. <view class="title">{{orderlist.unshipped_count}}</view>
  28. <view>待配送</view>
  29. </navigator>
  30. <navigator url="/pages/admin/store/order/index?type=5" hover-class="none">
  31. <view class="title">{{orderlist.unwriteoff_count}}</view>
  32. <view>待核销</view>
  33. </navigator>
  34. <navigator url="/pages/admin/store/order/index?type=3" hover-class="none">
  35. <view class="title">{{orderlist.evaluated_count}}</view>
  36. <view>待评价</view>
  37. </navigator>
  38. <navigator url="/pages/admin/store/order/index?type=-3" hover-class="none">
  39. <view class="title">{{orderlist.refund_count}}</view>
  40. <view>退款</view>
  41. </navigator>
  42. </view>
  43. </view>
  44. <view class="wrapper">
  45. <view class="title">
  46. <view class="uni-list-cell-db" @click="hiddened">
  47. <picker @change="bindPickerChange" :range="array" @cancel="cancel" v-if="is_manager == 1">
  48. <span class="iconfont icon-shujutongji"></span>
  49. <label class="aa">{{array[index]}}</label>
  50. <text class='iconfont' :class='hidden==true?"icon-xiangxia":"icon-xiangshang"'></text>
  51. </picker>
  52. <view v-else><span class="iconfont icon-shujutongji"></span>数据统计</view>
  53. </view>
  54. <view class="tab">
  55. <view class="box" :class="detailtabs== 'today' ? 'on':''" @click="detailtab('today')">今日</view>
  56. <view class="box" :class="detailtabs== 'yesterday' ? 'on':''" @click="detailtab('yesterday')">昨日</view>
  57. <view class="box" :class="detailtabs== 'month' ? 'on':''" @click="detailtab('month')">本月</view>
  58. </view>
  59. </view>
  60. <view class="list acea-row">
  61. <navigator v-if="manager == 1" class="item" :url="`/pages/admin/store/statistics/index?type=1&time=${detailtabs}&manager=1`" hover-class="none">
  62. <view class="num">{{ census.send_price }}</view>
  63. <view>配送订单额</view>
  64. </navigator>
  65. <navigator v-if="manager == 1" class="item" :url="`/pages/admin/store/statistics/index?type=2&time=${detailtabs}&manager=1`" hover-class="none">
  66. <view class="num">{{ census.send_count }}</view>
  67. <view>配送订单数</view>
  68. </navigator>
  69. <navigator v-if="manager == 1" class="item" :url="`/pages/admin/store/statistics/index?type=3&time=${detailtabs}&manager=1`" hover-class="none">
  70. <view class="num">{{ census.refund_price }}</view>
  71. <view>退款订单额</view>
  72. </navigator>
  73. <navigator class="item" :url="`/pages/admin/store/statistics/index?type=4&time=${detailtabs}&manager=${manager}`" hover-class="none">
  74. <view class="num">{{ census.cashier_price }}</view>
  75. <view>收银订单额</view>
  76. </navigator>
  77. <navigator class="item" :url="`/pages/admin/store/statistics/index?type=5&time=${detailtabs}&manager=${manager}`" hover-class="none">
  78. <view class="num">{{ census.writeoff_price }}</view>
  79. <view>核销订单额</view>
  80. </navigator>
  81. <navigator class="item" :url="`/pages/admin/store/statistics/index?type=6&time=${detailtabs}&manager=${manager}`" hover-class="none">
  82. <view class="num">{{ census.svip_price }}</view>
  83. <view>付费会员额</view>
  84. </navigator>
  85. <navigator class="item" :url="`/pages/admin/store/statistics/index?type=7&time=${detailtabs}&manager=${manager}`" hover-class="none">
  86. <view class="num">{{ census.recharge_price }}</view>
  87. <view>充值订单额</view>
  88. </navigator>
  89. <navigator class="item" :url="`/pages/admin/store/statistics/index?type=8&time=${detailtabs}&manager=${manager}`" hover-class="none">
  90. <view class="num">{{ census.spread_count }}</view>
  91. <view>推广用户数</view>
  92. </navigator>
  93. <navigator class="item" :url="`/pages/admin/store/statistics/index?type=9&time=${detailtabs}&manager=${manager}`" hover-class="none">
  94. <view class="num">{{ census.card_count }}</view>
  95. <view>激活会员卡</view>
  96. </navigator>
  97. </view>
  98. </view>
  99. <view class="public-wrapper">
  100. <view class="title">
  101. <view class="uni-list-cell-db" @click="hiddened">
  102. <span class="iconfont icon-xiangxishuju"></span>详细数据
  103. </view>
  104. <view class="tab">
  105. <view v-if="manager == 1" class="box" :class="tabs== 1 ? 'on':''" @click="tab(1)">配送</view>
  106. <view class="box" :class="tabs== 2 ? 'on':''" @click="tab(2)">收银</view>
  107. <view class="box" :class="tabs== 3 ? 'on':''" @click="tab(3)">核销</view>
  108. <view class="box" :class="tabs== 4 ? 'on':''" @click="tab(4)">充值</view>
  109. </view>
  110. </view>
  111. <view class="nav acea-row row-between-wrapper">
  112. <view class="data">日期</view>
  113. <view class="browse">订单数</view>
  114. <view class="turnover">金额</view>
  115. </view>
  116. <Loading :loaded="loaded" :loading="loading"></Loading>
  117. <view v-if="list.length" class="conter">
  118. <view class="item acea-row row-between-wrapper" v-for="(item, index) in list" :key="index">
  119. <view class="data">{{ item.time }}</view>
  120. <view class="browse">{{ item.count }}</view>
  121. <view class="turnover">¥{{ item.price }}</view>
  122. </view>
  123. </view>
  124. <view v-else class="unconter">
  125. <view v-if="!loading">暂无数据</view>
  126. </view>
  127. </view>
  128. </view>
  129. <home v-if="navigation"></home>
  130. </view>
  131. </template>
  132. <script>
  133. import home from '@/components/home';
  134. import colors from '@/mixins/color.js';
  135. import {
  136. // getStatisticsInfo,
  137. // getStatisticsMonth,
  138. userInfo,
  139. orderInfo,
  140. statisticsMenuApi,
  141. getListApi,
  142. orderWriteoffInfo
  143. } from "@/api/admin";
  144. import Loading from '@/components/Loading/index.vue'
  145. export default {
  146. name: 'adminOrder',
  147. components: {
  148. Loading,
  149. home
  150. },
  151. mixins:[colors],
  152. data() {
  153. return {
  154. is_manager: 0,//判断首次进入是否为店长或店员
  155. manager: 0,//更改店长与店员的切换
  156. user: {},
  157. orderlist: {},
  158. hidden: true,
  159. page: 1,
  160. limit: 7,
  161. tip: 1,
  162. index: 0,
  163. detailtabs: 'today',
  164. array: ['门店统计', '数据统计'],
  165. tabs: 1,
  166. census: {},
  167. list: [],
  168. loaded: false,
  169. loading: false,
  170. verify_code: '',
  171. // #ifdef H5
  172. isWeixin: this.$wechat.isWeixin()
  173. // #endif
  174. }
  175. },
  176. onLoad() {
  177. this.userInfo()
  178. },
  179. methods: {
  180. // 用户信息
  181. userInfo: function() {
  182. userInfo().then(res=>{
  183. this.manager = res.data.is_manager
  184. this.is_manager = res.data.is_manager
  185. this.user = res.data
  186. if(res.data.is_manager == 0){
  187. this.tabs = 2
  188. }
  189. this.orderList()
  190. // this.getList()
  191. this.detailtab('today')
  192. })
  193. },
  194. // 订单统计
  195. orderList: function() {
  196. orderInfo({is_manager:this.manager}).then(res=>{
  197. this.orderlist = res.data
  198. })
  199. },
  200. // 统计菜单
  201. statisticsMenu: function(data) {
  202. statisticsMenuApi(data).then(res=>{
  203. this.census = res.data;
  204. })
  205. },
  206. // 详细数据列表
  207. getList: function() {
  208. let data ={
  209. type: this.tabs,
  210. is_manager : this.manager,
  211. page: this.page,
  212. limit: this.limit,
  213. data:this.detailtabs
  214. }
  215. // if (this.loading || this.loaded) return;
  216. this.loading = true;
  217. getListApi(data).then(res=>{
  218. this.loading = false
  219. // this.list.push(res.data);
  220. this.page += 1;
  221. this.list = this.list.concat(res.data);
  222. if(res.data.length < this.limit){
  223. this.tip = 2
  224. }
  225. })
  226. },
  227. hiddened: function(e) {
  228. this.hidden = !this.hidden;
  229. },
  230. cancel: function() {
  231. this.hidden = !this.hidden;
  232. },
  233. bindPickerChange: function(e) {
  234. this.tip = 1
  235. this.page = 1
  236. this.list = []
  237. this.hidden = !this.hidden;//改变的事件名
  238. this.index = e.target.value //将数组改变索引赋给定义的index变量
  239. let select = ''
  240. select=this.array[this.index] //将array【改变索引】的值赋给定义的jg变量
  241. if(select == '数据统计'){
  242. this.manager = 0
  243. this.tabs = 2
  244. this.detailtab('today')
  245. }
  246. if(select == '门店统计'){
  247. this.manager = 1
  248. this.tabs = 1
  249. this.detailtab('today')
  250. }
  251. this.orderList()
  252. },
  253. tab: function(type) {
  254. this.tip = 1
  255. this.tabs = type
  256. this.page = 1;
  257. this.list = []
  258. this.getList()
  259. },
  260. // 统计菜单
  261. detailtab: function(type) {
  262. this.detailtabs = type
  263. let data = {
  264. is_manager: this.manager,
  265. data: type
  266. }
  267. this.list = []
  268. this.page = 1;
  269. this.tip = 1
  270. this.getList()
  271. this.statisticsMenu(data)
  272. },
  273. scanCode() {
  274. var self = this;
  275. // #ifdef MP || APP
  276. uni.scanCode({
  277. scanType: ["qrCode", "barCode"],
  278. success(res) {
  279. self.verify_code = res.result
  280. self.codeChange();
  281. },
  282. fail(res) {},
  283. })
  284. // #endif
  285. //#ifdef H5
  286. this.$wechat.wechatEvevt('scanQRCode', {
  287. needResult: 1,
  288. scanType: ["qrCode", "barCode"]
  289. }).then(res => {
  290. let result = res.resultStr;
  291. if(result.includes(',')){
  292. result = result.split(",")[1]
  293. }
  294. this.verify_code = result
  295. this.codeChange();
  296. });
  297. //#endif
  298. },
  299. // 立即核销
  300. codeChange: function() {
  301. let self = this
  302. let ref = /^[0-9]*$/;
  303. if (!self.verify_code) return self.$util.Tips({
  304. title: '请输入核销码'
  305. });
  306. if (!ref.test(self.verify_code)) return self.$util.Tips({
  307. title: '请输入正确的核销码'
  308. });
  309. self.$util.Tips({
  310. title: '查询中'
  311. });
  312. setTimeout(() => {
  313. orderWriteoffInfo(1,{verify_code:self.verify_code,code_type:2}).then(res=>{
  314. if(res.status == 200){
  315. uni.navigateTo({
  316. url:'./scanning/index?code='+self.verify_code
  317. })
  318. }else{
  319. self.$util.Tips({ title: res.msg });
  320. }
  321. }).catch(err=>{
  322. self.$util.Tips({
  323. title: err
  324. });
  325. })
  326. }, 800);
  327. },
  328. },
  329. onReachBottom(){
  330. if(this.tip == 1){
  331. this.getList()
  332. }
  333. }
  334. }
  335. </script>
  336. <style lang="scss" scoped>
  337. /*订单首页*/
  338. .order-index .topBox{
  339. padding-bottom: 40upx;
  340. // height: 360upx;
  341. background: linear-gradient(270deg, #4276F6 0%, #00ACF8 100%);
  342. }
  343. .order-index .header {
  344. box-sizing: border-box;
  345. display: flex;
  346. background-size: 100% 100%;
  347. width: 100%;
  348. // height: 120upx;
  349. padding: 0upx 30upx 0upx 30upx;
  350. justify-content: space-between;
  351. }
  352. .order-index .header .icon-saoma{
  353. font-size: 40rpx;
  354. padding: 30rpx 20rpx 30rpx 80rpx;
  355. }
  356. .order-index .header .item,.order-index .header .items {
  357. font-size: 24upx;
  358. color: #fff;
  359. height: 120upx;
  360. display: flex;
  361. align-items: center;
  362. }
  363. .order-index .header .item .font,.order-index .header .items .font{
  364. display: inline-block;
  365. margin-left: 16upx;
  366. margin-right: 16upx;
  367. font-size: 30upx;
  368. }
  369. .order-index .header .items image{
  370. width: 64upx;
  371. height: 64upx;
  372. border-radius: 60upx;
  373. border: 2upx solid #FFFFFF;
  374. }
  375. .order-index .topstatus{
  376. padding: 0upx 56upx 30upx;
  377. display: flex;
  378. justify-content: space-between;
  379. color: #FFFFFF;
  380. text-align: center;
  381. font-size: 24upx;
  382. font-weight: 400;
  383. box-sizing: border-box;
  384. // background: linear-gradient(270deg, #4276F6 0%, #00ACF8 100%);
  385. .title{
  386. font-size: 40upx;
  387. margin-bottom: 6upx;
  388. }
  389. }
  390. .order-index .wrapper {
  391. width: 690upx;
  392. background-color: #fff;
  393. border-radius: 10upx;
  394. margin: -46upx auto 0 auto;
  395. padding-top: 25upx;
  396. }
  397. .order-index .wrapper .title .iconfont {
  398. color: #2291f8;
  399. font-size: 40upx;
  400. margin-right: 13upx;
  401. vertical-align: middle;
  402. }
  403. .order-index .wrapper .title {
  404. font-size: 30upx;
  405. color: #282828;
  406. padding: 0 30upx;
  407. margin-bottom: 40upx;
  408. display: flex;
  409. justify-content: space-between;
  410. .uni-list-cell-db .iconfont{
  411. font-size: 24upx ;
  412. color: #999 ;
  413. margin-left: 14upx;
  414. }
  415. .tab{
  416. width: 240upx;
  417. height: 48upx;
  418. background: #F5F5F5;
  419. border-radius: 24upx;
  420. display: flex;
  421. justify-content: space-between;
  422. font-weight: 400;
  423. color: #999999;
  424. font-size: 24upx;
  425. .box{
  426. width: 82upx;
  427. height: 48upx;
  428. border-radius: 24upx;
  429. text-align: center;
  430. line-height: 48upx;
  431. }
  432. .on{
  433. background: #1890FF;
  434. color: #FFFFFF;
  435. }
  436. }
  437. }
  438. .order-index .wrapper .list .item {
  439. width: 33.33%;
  440. text-align: center;
  441. font-size: 24upx;
  442. color: #999;
  443. margin-bottom: 45upx;
  444. }
  445. .order-index .wrapper .list .item .num {
  446. font-size: 40upx;
  447. color: #333;
  448. }
  449. .public-wrapper .title {
  450. font-size: 30upx;
  451. color: #282828;
  452. padding: 0 30upx;
  453. margin-bottom: 20upx;
  454. font-size: 30upx;
  455. // margin-bottom: 40upx;
  456. display: flex;
  457. justify-content: space-between;
  458. .uni-list-cell-db .iconfont{
  459. font-size: 24upx ;
  460. color: #999 ;
  461. margin-left: 14upx;
  462. }
  463. .tab{
  464. // width: 240upx;
  465. height: 48upx;
  466. background: #F5F5F5;
  467. border-radius: 24upx;
  468. display: flex;
  469. justify-content: space-between;
  470. font-weight: 400;
  471. color: #999999;
  472. font-size: 24upx;
  473. .box{
  474. width: 82upx;
  475. height: 48upx;
  476. border-radius: 24upx;
  477. text-align: center;
  478. line-height: 48upx;
  479. }
  480. .on{
  481. background: #1890FF;
  482. color: #FFFFFF;
  483. }
  484. }
  485. }
  486. .public-wrapper .title .iconfont {
  487. color: #2291f8;
  488. font-size: 40upx;
  489. margin-right: 13upx;
  490. vertical-align: middle;
  491. }
  492. .public-wrapper {
  493. margin: 18upx auto 0 auto;
  494. width: 690upx;
  495. background-color: #fff;
  496. border-radius: 10upx;
  497. padding-top: 25upx;
  498. // padding-bottom: 25upx;
  499. }
  500. .public-wrapper .nav {
  501. padding: 0 30upx;
  502. height: 70upx;
  503. line-height: 70upx;
  504. font-size: 24upx;
  505. color: #999;
  506. }
  507. .public-wrapper .data {
  508. width: 210upx;
  509. text-align: left;
  510. }
  511. .public-wrapper .browse {
  512. width: 192upx;
  513. text-align: left;
  514. }
  515. .public-wrapper .turnover {
  516. width: 227upx;
  517. text-align: right;
  518. }
  519. .public-wrapper .conter {
  520. padding: 0 30upx;
  521. margin-bottom: 40upx;
  522. }
  523. .public-wrapper .conter .item {
  524. border-bottom: 1px solid #f7f7f7;
  525. height: 70upx;
  526. font-size: 24upx;
  527. }
  528. .public-wrapper .conter .item .turnover {
  529. color: #000000;
  530. font-weight: 400;
  531. }
  532. .public-wrapper .unconter{
  533. text-align: center;
  534. color: #999;
  535. padding: 25upx;
  536. }
  537. </style>