index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739
  1. <template>
  2. <view>
  3. <view v-if="footer == 'tongji'" class="order-index" ref="container">
  4. <view class="header acea-row">
  5. <view class="items">
  6. <image :src="user.avatar" mode=""></image>
  7. <span class="font">{{ user.user_nickname }}</span><span>( 配送员 )</span>
  8. </view>
  9. <!-- #ifdef MP || APP-->
  10. <view class="item">
  11. <view class="iconfont icon-saoma ite" @click="to"></view>
  12. </view>
  13. <!-- #endif -->
  14. <!-- #ifdef H5 -->
  15. <view v-if="isWeixin" class="item">
  16. <view class="iconfont icon-saoma ite" @click="to"></view>
  17. </view>
  18. <!-- #endif -->
  19. </view>
  20. <view class="wrapper">
  21. <view class="title">
  22. <view class="uni-list-cell-db" @click="hiddened">
  23. <picker @change="bindPickerChange" :range="arrays" @cancel="cancel">
  24. <!-- <span class="iconfont icon-shujutongji"></span> -->
  25. <label class="aa">{{array[index].name}}</label>
  26. <text class='iconfont' :class='hidden==true?"icon-xiangxia":"icon-xiangshang"'></text>
  27. </picker>
  28. </view>
  29. <view class="tab">
  30. <view class="box" :class="detailtabs== 'today' ? 'on':''" @click="detailtab('today')">今日</view>
  31. <view class="box" :class="detailtabs== 'yesterday' ? 'on':''" @click="detailtab('yesterday')">昨日</view>
  32. <view class="box" :class="detailtabs== 'month' ? 'on':''" @click="detailtab('month')">本月</view>
  33. </view>
  34. </view>
  35. <Loading :loaded="loaded" :loading="loading"></Loading>
  36. <view class="list acea-row" v-if="!loading">
  37. <view class="item">
  38. <view class="num">{{ census.unsend }}</view>
  39. <view>待配送订单</view>
  40. </view>
  41. <view class="item">
  42. <view class="num">{{ census.send }}</view>
  43. <view>已配送订单</view>
  44. </view>
  45. <view class="item">
  46. <view class="num">{{ census.send_price }}</view>
  47. <view>完成配送额</view>
  48. </view>
  49. </view>
  50. </view>
  51. <view class="public-wrapper">
  52. <view class="title">
  53. <view class="uni-list-cell-db" @click="hiddened">
  54. 配送数据
  55. </view>
  56. </view>
  57. <view class="nav acea-row row-between-wrapper">
  58. <view class="data">日期</view>
  59. <view class="browse">订单数</view>
  60. <view class="turnover">金额</view>
  61. </view>
  62. <Loading :loaded="loaded" :loading="loading"></Loading>
  63. <view v-if="list[0]" class="conter">
  64. <view class="item acea-row row-between-wrapper" v-for="(item, index) in list" :key="index">
  65. <view class="data">{{ item.time }}</view>
  66. <view class="browse">{{ item.count }}</view>
  67. <view class="turnover">¥{{ item.price }}</view>
  68. </view>
  69. </view>
  70. <view v-else class="unconter">
  71. <view v-if="!loading">暂无数据</view>
  72. </view>
  73. </view>
  74. </view>
  75. <view v-if="footer == 'list'" class="order-index">
  76. <view class="tongji-index">
  77. <view class="header acea-row">
  78. <view class="items">
  79. <image :src="user.avatar" mode=""></image>
  80. <span class="font">{{ user.user_nickname }}</span><span>( 配送员 )</span>
  81. </view>
  82. <view class="item">
  83. <!-- #ifdef MP || MP-WEIXIN -->
  84. <view class="item">
  85. <view class="iconfont icon-saoma ite" @click="to"></view>
  86. </view>
  87. <!-- #endif -->
  88. <!-- #ifdef H5 -->
  89. <view v-if="isWeixin" class="item">
  90. <view class="iconfont icon-saoma ite" @click="to"></view>
  91. </view>
  92. <!-- #endif -->
  93. </view>
  94. </view>
  95. <view class="tab">
  96. <view><span class="box" :class="type == '1'?'on':''" @click="tab('1')">待配送( {{ count.unsend }} )</span></view>
  97. <view><span class="box" :class="type == '2'?'on':''" @click="tab('2')">已配送( {{ count.send }} )</span></view>
  98. </view>
  99. <view>
  100. <view v-if="orderlist.length != 0" class="content" v-for="(item,index) in orderlist" @click="jump(item.id)">
  101. <view class="content_top pad">
  102. <!-- item.order_id -->
  103. <view class="content_top_left">{{ item.add_time }}</view>
  104. <view v-if="item.store" class="content_top_right line1">{{item.store.name}}</view>
  105. </view>
  106. <view class="content_font pad">
  107. <p v-if="item.store" class="txt">门店地址:{{item.store.detailed_address}}</p>
  108. <p class="txt">配送地址:{{item.user_address}}</p>
  109. </view>
  110. <view class="content_box" v-for="(val, key) in item._info" :key="key">
  111. <image :src="val.cart_info.productInfo.image" mode=""></image>
  112. <view class="content_box_title">
  113. <view class="txt">
  114. <view class="textbox"><text class="icon-color" v-if="val.cart_info.is_gift">[赠品]</text>{{ val.cart_info.productInfo.store_name }}</view>
  115. <view>x {{ val.cart_info.cart_num }}</view>
  116. </view>
  117. <p class="attribute">属性:{{ val.cart_info.productInfo.attrInfo.suk }}</p>
  118. <p>¥ {{ val.cart_info.productInfo.attrInfo.price }} </p>
  119. </view>
  120. </view>
  121. <view class="content_bottom">
  122. <view></view>
  123. <view>共{{ item.total_num }}件商品,订单实付:<span class="money">¥{{ item.pay_price }}</span></view>
  124. </view>
  125. </view>
  126. <view v-if="!orderlist.length && !loading" class="nothing">
  127. <image :src="imgHost + '/statics/images/no-thing.png'" mode=""></image>
  128. <view>暂无数据</view>
  129. </view>
  130. </view>
  131. <Loading :loaded="loaded" :loading="loading"></Loading>
  132. </view>
  133. </view>
  134. <view class="footer">
  135. <view class="tab" :class="footer == 'list'?'on':''" @click="footerTab('list')">
  136. <view class="iconfont icon-dingdan"></view>
  137. <view class="font">订单列表</view>
  138. </view>
  139. <view class="tab" :class="footer == 'tongji'?'on':''" @click="footerTab('tongji')">
  140. <view class="iconfont icon-tongji"></view>
  141. <view class="font">数据统计</view>
  142. </view>
  143. </view>
  144. </view>
  145. </template>
  146. <script>
  147. import {
  148. // getStatisticsInfo,
  149. // getStatisticsMonth,
  150. deliveryInfo,
  151. deliveryStatistics,
  152. deliveryList,
  153. deliveryOrderList,
  154. orderWriteoffInfo
  155. } from "@/api/admin";
  156. import Loading from '@/components/Loading/index.vue';
  157. import {HTTP_REQUEST_URL} from '@/config/app';
  158. export default {
  159. name: 'adminOrder',
  160. components: {
  161. Loading
  162. },
  163. data() {
  164. return {
  165. hidden: true,
  166. index: 0,
  167. detailtabs: 'today',
  168. footer: 'list',
  169. type: '1',
  170. arrays: [], //展示下拉时的数据
  171. array: [], //下拉时选择的数据
  172. storeInfoid: 0, //下拉时选择的数据ID
  173. census: {},
  174. list: [],
  175. orderlist: [],
  176. count: {},
  177. page: 1,
  178. limit: 15,
  179. loaded: false,
  180. loading: false,
  181. user: {},
  182. ids: '',
  183. verify_code: '',
  184. // #ifdef H5
  185. isWeixin: this.$wechat.isWeixin(),
  186. // #endif
  187. imgHost:HTTP_REQUEST_URL
  188. }
  189. },
  190. onLoad() {
  191. // this.getIndex();
  192. // this.init()
  193. this.userInfo();
  194. this.footerTab('list')
  195. // this.$scroll(this.$refs.container, () => {
  196. // !this.loading && this.getList();
  197. // });
  198. },
  199. methods: {
  200. userInfo(){
  201. deliveryInfo().then(res=>{
  202. this.user = res.data
  203. this.array = res.data.store_info.map(a => a);
  204. this.arrays = res.data.store_info.map(a => a.name);
  205. let obj = {
  206. id: 0,
  207. name: '全部'
  208. }
  209. this.array.unshift(obj);
  210. this.arrays.unshift(obj.name);
  211. })
  212. },
  213. getStatistics(){
  214. let data = {
  215. store_id: this.storeInfoid,
  216. data: this.detailtabs
  217. }
  218. deliveryStatistics(data).then(res=>{
  219. this.census = res.data
  220. })
  221. },
  222. deliveryLists(){
  223. let data = {
  224. page: this.page,
  225. limit: this.limit,
  226. store_id: this.storeInfoid,
  227. data: this.detailtabs
  228. }
  229. if (this.loading || this.loaded) return;
  230. this.loading = true
  231. deliveryList(data).then(res=>{
  232. this.loading = false
  233. this.loaded = res.data.length < this.limit
  234. this.page += 1
  235. // this.list = res.data
  236. this.list.push.apply(this.list, res.data);
  237. })
  238. },
  239. getOrderList(){
  240. if (this.loading || this.loaded) return;
  241. this.loading = true
  242. deliveryOrderList({type:this.type,page:this.page,limit:this.limit}).then(res=>{
  243. this.loading = false
  244. this.count = res.data.data
  245. this.loaded = res.data.list.length < this.limit
  246. this.page += 1
  247. this.orderlist.push.apply(this.orderlist, res.data.list);
  248. })
  249. },
  250. init: function() {
  251. this.orderlist = [];
  252. this.list = [];
  253. this.page = 1;
  254. this.loaded = false;
  255. this.loading = false;
  256. },
  257. to(){
  258. var self = this;
  259. // #ifdef MP || APP
  260. uni.scanCode({
  261. scanType: ["qrCode", "barCode"],
  262. success(res) {
  263. self.verify_code = res.result
  264. self.codeChange();
  265. },
  266. fail(res) {},
  267. })
  268. // #endif
  269. //#ifdef H5
  270. this.$wechat.wechatEvevt('scanQRCode', {
  271. needResult: 1,
  272. scanType: ["qrCode", "barCode"]
  273. }).then(res => {
  274. let result = res.resultStr;
  275. if(result.includes(',')){
  276. result = result.split(",")[1]
  277. }
  278. this.verify_code = result
  279. this.codeChange();
  280. });
  281. //#endif
  282. },
  283. // 立即核销
  284. codeChange: function() {
  285. let self = this
  286. let ref = /^[0-9]*$/;
  287. if (!this.verify_code) return self.$util.Tips({
  288. title: '请输入核销码'
  289. });
  290. if (!ref.test(this.verify_code)) return self.$util.Tips({
  291. title: '请输入正确的核销码'
  292. });
  293. self.$util.Tips({
  294. title: '查询中'
  295. });
  296. setTimeout(() => {
  297. orderWriteoffInfo(2,{verify_code:self.verify_code,code_type:2}).then(res=>{
  298. if(res.status == 200){
  299. uni.navigateTo({
  300. url:'./scanning/index?code='+self.verify_code
  301. })
  302. }else{
  303. self.$util.Tips({ title: res.msg });
  304. }
  305. }).catch(err=>{
  306. self.$util.Tips({
  307. title: err
  308. });
  309. })
  310. }, 800);
  311. },
  312. footerTab: function(type) {
  313. this.footer = type
  314. this.init()
  315. if(type == 'tongji'){
  316. this.deliveryLists()
  317. this.getStatistics()
  318. }
  319. if(type == 'list'){
  320. this.getOrderList()
  321. }
  322. },
  323. tab(type){
  324. this.type = type
  325. this.init()
  326. this.getOrderList()
  327. },
  328. hiddened: function(e) {
  329. this.hidden = !this.hidden;
  330. },
  331. cancel: function() {
  332. this.hidden = !this.hidden;
  333. },
  334. bindPickerChange: function(e) {
  335. this.hidden = !this.hidden;
  336. this.index = e.target.value
  337. this.storeInfoid = this.array[this.index].id
  338. this.init()
  339. this.getStatistics()
  340. this.deliveryLists()
  341. },
  342. detailtab: function(type) {
  343. this.detailtabs = type
  344. this.init()
  345. this.deliveryLists()
  346. this.getStatistics()
  347. },
  348. jump: function(id){
  349. uni.navigateTo({
  350. url:'orderDetail/index?id='+id
  351. })
  352. }
  353. },
  354. onReachBottom(){
  355. if(this.footer == 'tongji'){
  356. this.deliveryList()
  357. }
  358. if(this.footer == 'list'){
  359. this.getOrderList()
  360. }
  361. }
  362. }
  363. </script>
  364. <style lang="scss" scoped>
  365. .nothing{
  366. width: 80%;
  367. margin: 0 auto;
  368. margin-top: 30px;
  369. text-align: center;
  370. color: #cfcfcf;
  371. }
  372. .ite{
  373. font-size: 20px;
  374. }
  375. .footer{
  376. display: flex;
  377. justify-content: space-around;
  378. width: 100%;
  379. text-align: center;
  380. height: 100upx;
  381. background: #FFFFFF;
  382. position: fixed;
  383. bottom: 0;
  384. left: 0;
  385. .tab{
  386. display: flex;
  387. flex-direction: column;
  388. color: #999999;
  389. margin-top: 16upx;
  390. }
  391. .on{
  392. color: #1890FF;
  393. .font{
  394. color: #3B3B3B;
  395. }
  396. }
  397. }
  398. .tongji-index{
  399. padding-bottom: 160upx;
  400. .header {
  401. background-size: 100% 100%;
  402. width: 100%;
  403. height: 186upx !important;
  404. padding: 20upx 30upx 0 30upx !important;
  405. box-sizing: border-box;
  406. background: linear-gradient(270deg, #4276F6 0%, #00ACF8 100%);
  407. display: flex;
  408. justify-content: space-between;
  409. .items, .item{
  410. font-size: 24upx;
  411. color: #fff;
  412. height: 120upx;
  413. display: flex;
  414. align-items: center;
  415. image{
  416. width: 64upx;
  417. height: 64upx;
  418. border-radius: 60upx;
  419. border: 2upx solid #FFFFFF;
  420. }
  421. .font{
  422. display: inline-block;
  423. margin-left: 16upx;
  424. margin-right: 16upx;
  425. font-size: 30upx;
  426. }
  427. }
  428. }
  429. .tab{
  430. width: 694upx;
  431. height: 86upx;
  432. background: #FFFFFF;
  433. border-radius: 12upx;
  434. margin: -40upx auto 0 auto;
  435. display: flex;
  436. justify-content: space-around;
  437. text-align: center;
  438. align-items: center;
  439. .box{
  440. display: block;
  441. height: 62upx;
  442. margin-top: 26upx;
  443. }
  444. .on{
  445. border-bottom: 4upx solid #1890FF;
  446. color: #1890FF;
  447. }
  448. }
  449. .content{
  450. margin: 16upx auto 16upx auto;
  451. width: 694upx;
  452. // height: 428upx;
  453. padding-bottom: 20upx;
  454. background: #FFFFFF;
  455. border-radius: 12upx;
  456. .pad{padding: 20upx 20upx 22upx;}
  457. .content_top{
  458. // height: 78upx;
  459. align-items: center;
  460. font-weight: 400;
  461. display: flex;
  462. justify-content: space-between;
  463. border-bottom: 2upx solid #F5F5F5;
  464. .content_top_left{
  465. font-size: 26upx;
  466. }
  467. .content_top_right{
  468. font-size: 18upx;
  469. color: #1890FF;
  470. border: 2upx solid #1890FF;
  471. padding: 6upx 10upx;
  472. max-width: 300upx;
  473. }
  474. }
  475. .content_font{
  476. font-size: 24upx;
  477. color: #666666;
  478. font-weight: 400;
  479. .txt{margin-bottom: 14upx;}
  480. }
  481. .content_box{
  482. // height: 70px;
  483. background: #F5F5F5;
  484. border-radius: 8upx;
  485. margin: 0upx 20upx 22upx;
  486. padding: 14upx;
  487. padding-right: 22upx;
  488. display: flex;
  489. justify-content: start;
  490. image{
  491. width: 112upx;
  492. height: 112upx;
  493. border-radius: 8upx;
  494. }
  495. .content_box_title{
  496. flex: 1;
  497. margin-left: 18upx;
  498. font-size: 20upx;
  499. font-weight: 400;
  500. .txt{
  501. display: flex;
  502. justify-content: space-between;
  503. font-size: 24upx;
  504. .textbox{
  505. width: 408upx;
  506. white-space: nowrap;
  507. text-overflow: ellipsis;
  508. overflow: hidden;
  509. word-break: break-all;
  510. }
  511. }
  512. .attribute{
  513. color: #999999;
  514. margin: 4upx 0upx 10upx;
  515. }
  516. }
  517. }
  518. .content_bottom{
  519. display: flex;
  520. justify-content: space-between;
  521. font-size: 22upx;
  522. padding: 0upx 20upx;
  523. color: #666666;
  524. .money{
  525. font-size: 26upx;
  526. color: #F5222D;
  527. }
  528. }
  529. }
  530. }
  531. /*订单首页*/
  532. .order-index{position: relative;}
  533. .order-index .header {
  534. background-size: 100% 100%;
  535. width: 100%;
  536. height: 302upx;
  537. padding: 45upx 30upx 0 30upx;
  538. box-sizing: border-box;
  539. background: linear-gradient(270deg, #4276F6 0%, #00ACF8 100%);
  540. display: flex;
  541. justify-content: space-between;
  542. }
  543. .order-index .header .icon-saoma{
  544. font-size: 40rpx;
  545. padding: 30rpx 20rpx 30rpx 80rpx;
  546. }
  547. .order-index .header .item,.order-index .header .items {
  548. font-size: 24upx;
  549. color: #fff;
  550. height: 120upx;
  551. display: flex;
  552. align-items: center;
  553. }
  554. .order-index .header .item .font,.order-index .header .items .font{
  555. display: inline-block;
  556. margin-left: 16upx;
  557. margin-right: 16upx;
  558. font-size: 30upx;
  559. }
  560. .order-index .header .items image{
  561. width: 64upx;
  562. height: 64upx;
  563. border-radius: 60upx;
  564. border: 2upx solid #FFFFFF;
  565. }
  566. .order-index .wrapper {
  567. width: 690upx;
  568. background-color: #fff;
  569. border-radius: 10upx;
  570. margin: -115upx auto 0 auto;
  571. padding-top: 25upx;
  572. }
  573. .order-index .wrapper .title .iconfont {
  574. color: #2291f8;
  575. font-size: 40upx;
  576. margin-right: 13upx;
  577. vertical-align: middle;
  578. }
  579. .order-index .wrapper .title {
  580. font-size: 30upx;
  581. color: #282828;
  582. padding: 0 30upx;
  583. margin-bottom: 40upx;
  584. display: flex;
  585. justify-content: space-between;
  586. .uni-list-cell-db .iconfont{
  587. font-size: 24upx ;
  588. color: #999 ;
  589. margin-left: 14upx;
  590. }
  591. .tab{
  592. width: 240upx;
  593. height: 48upx;
  594. background: #F5F5F5;
  595. border-radius: 24upx;
  596. display: flex;
  597. justify-content: space-between;
  598. font-weight: 400;
  599. color: #999999;
  600. font-size: 24upx;
  601. .box{
  602. width: 82upx;
  603. height: 48upx;
  604. border-radius: 24upx;
  605. text-align: center;
  606. line-height: 48upx;
  607. }
  608. .on{
  609. background: #1890FF;
  610. color: #FFFFFF;
  611. }
  612. }
  613. }
  614. .order-index .wrapper .list .item {
  615. width: 33.33%;
  616. text-align: center;
  617. font-size: 24upx;
  618. color: #999;
  619. margin-bottom: 45upx;
  620. }
  621. .order-index .wrapper .list .item .num {
  622. font-size: 40upx;
  623. color: #333;
  624. }
  625. .public-wrapper .title {
  626. font-size: 30upx;
  627. color: #282828;
  628. padding: 0 30upx;
  629. margin-bottom: 20upx;
  630. font-size: 30upx;
  631. // margin-bottom: 40upx;
  632. display: flex;
  633. justify-content: space-between;
  634. .uni-list-cell-db .iconfont{
  635. font-size: 24upx ;
  636. color: #999 ;
  637. margin-left: 14upx;
  638. }
  639. .tab{
  640. width: 240upx;
  641. height: 48upx;
  642. background: #F5F5F5;
  643. border-radius: 24upx;
  644. display: flex;
  645. justify-content: space-between;
  646. font-weight: 400;
  647. color: #999999;
  648. font-size: 24upx;
  649. .box{
  650. width: 82upx;
  651. height: 48upx;
  652. border-radius: 24upx;
  653. text-align: center;
  654. line-height: 48upx;
  655. }
  656. .on{
  657. background: #1890FF;
  658. color: #FFFFFF;
  659. }
  660. }
  661. }
  662. .public-wrapper .title .iconfont {
  663. color: #2291f8;
  664. font-size: 40upx;
  665. margin-right: 13upx;
  666. vertical-align: middle;
  667. }
  668. .public-wrapper {
  669. margin: 18upx auto 0 auto;
  670. margin-bottom: 160upx;
  671. width: 690upx;
  672. background-color: #fff;
  673. border-radius: 10upx;
  674. padding-top: 25upx;
  675. }
  676. .public-wrapper .nav {
  677. padding: 0 30upx;
  678. height: 70upx;
  679. line-height: 70upx;
  680. font-size: 24upx;
  681. color: #999;
  682. }
  683. .public-wrapper .data {
  684. width: 210upx;
  685. text-align: left;
  686. }
  687. .public-wrapper .browse {
  688. width: 192upx;
  689. text-align: left;
  690. }
  691. .public-wrapper .turnover {
  692. width: 227upx;
  693. text-align: right;
  694. }
  695. .public-wrapper .conter {
  696. padding: 0 30upx;
  697. }
  698. .public-wrapper .conter .item {
  699. border-bottom: 1px solid #f7f7f7;
  700. height: 70upx;
  701. font-size: 24upx;
  702. }
  703. .public-wrapper .conter .item .turnover {
  704. color: #000000;
  705. font-weight: 400;
  706. }
  707. .public-wrapper .unconter{
  708. text-align: center;
  709. color: #999;
  710. padding: 25upx;
  711. }
  712. </style>