index.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742
  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.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.nickname }}</span><span>( 配送员 )</span>
  81. </view>
  82. <view class="item">
  83. <!-- #ifdef MP || MP-WEIXIN || APP -->
  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. background: #FFFFFF;
  381. position: fixed;
  382. bottom: 0;
  383. left: 0;
  384. height: calc(100upx+ constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
  385. height: calc(100upx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
  386. padding-bottom: constant(safe-area-inset-bottom); ///兼容 IOS<11.2/
  387. padding-bottom: env(safe-area-inset-bottom); ///兼容 IOS>11.2/
  388. .tab{
  389. display: flex;
  390. flex-direction: column;
  391. color: #999999;
  392. margin-top: 16upx;
  393. }
  394. .on{
  395. color: #1890FF;
  396. .font{
  397. color: #3B3B3B;
  398. }
  399. }
  400. }
  401. .tongji-index{
  402. padding-bottom: 160upx;
  403. .header {
  404. background-size: 100% 100%;
  405. width: 100%;
  406. height: 186upx !important;
  407. padding: 20upx 30upx 0 30upx !important;
  408. box-sizing: border-box;
  409. background: linear-gradient(270deg, #4276F6 0%, #00ACF8 100%);
  410. display: flex;
  411. justify-content: space-between;
  412. .items, .item{
  413. font-size: 24upx;
  414. color: #fff;
  415. height: 120upx;
  416. display: flex;
  417. align-items: center;
  418. image{
  419. width: 64upx;
  420. height: 64upx;
  421. border-radius: 60upx;
  422. border: 2upx solid #FFFFFF;
  423. }
  424. .font{
  425. display: inline-block;
  426. margin-left: 16upx;
  427. margin-right: 16upx;
  428. font-size: 30upx;
  429. }
  430. }
  431. }
  432. .tab{
  433. width: 694upx;
  434. height: 86upx;
  435. background: #FFFFFF;
  436. border-radius: 12upx;
  437. margin: -40upx auto 0 auto;
  438. display: flex;
  439. justify-content: space-around;
  440. text-align: center;
  441. align-items: center;
  442. .box{
  443. display: block;
  444. height: 62upx;
  445. margin-top: 26upx;
  446. }
  447. .on{
  448. border-bottom: 4upx solid #1890FF;
  449. color: #1890FF;
  450. }
  451. }
  452. .content{
  453. margin: 16upx auto 16upx auto;
  454. width: 694upx;
  455. // height: 428upx;
  456. padding-bottom: 20upx;
  457. background: #FFFFFF;
  458. border-radius: 12upx;
  459. .pad{padding: 20upx 20upx 22upx;}
  460. .content_top{
  461. // height: 78upx;
  462. align-items: center;
  463. font-weight: 400;
  464. display: flex;
  465. justify-content: space-between;
  466. border-bottom: 2upx solid #F5F5F5;
  467. .content_top_left{
  468. font-size: 26upx;
  469. }
  470. .content_top_right{
  471. font-size: 18upx;
  472. color: #1890FF;
  473. border: 2upx solid #1890FF;
  474. padding: 6upx 10upx;
  475. max-width: 300upx;
  476. }
  477. }
  478. .content_font{
  479. font-size: 24upx;
  480. color: #666666;
  481. font-weight: 400;
  482. .txt{margin-bottom: 14upx;}
  483. }
  484. .content_box{
  485. // height: 70px;
  486. background: #F5F5F5;
  487. border-radius: 8upx;
  488. margin: 0upx 20upx 22upx;
  489. padding: 14upx;
  490. padding-right: 22upx;
  491. display: flex;
  492. justify-content: start;
  493. image{
  494. width: 112upx;
  495. height: 112upx;
  496. border-radius: 8upx;
  497. }
  498. .content_box_title{
  499. flex: 1;
  500. margin-left: 18upx;
  501. font-size: 20upx;
  502. font-weight: 400;
  503. .txt{
  504. display: flex;
  505. justify-content: space-between;
  506. font-size: 24upx;
  507. .textbox{
  508. width: 408upx;
  509. white-space: nowrap;
  510. text-overflow: ellipsis;
  511. overflow: hidden;
  512. word-break: break-all;
  513. }
  514. }
  515. .attribute{
  516. color: #999999;
  517. margin: 4upx 0upx 10upx;
  518. }
  519. }
  520. }
  521. .content_bottom{
  522. display: flex;
  523. justify-content: space-between;
  524. font-size: 22upx;
  525. padding: 0upx 20upx;
  526. color: #666666;
  527. .money{
  528. font-size: 26upx;
  529. color: #F5222D;
  530. }
  531. }
  532. }
  533. }
  534. /*订单首页*/
  535. .order-index{position: relative;}
  536. .order-index .header {
  537. background-size: 100% 100%;
  538. width: 100%;
  539. height: 302upx;
  540. padding: 45upx 30upx 0 30upx;
  541. box-sizing: border-box;
  542. background: linear-gradient(270deg, #4276F6 0%, #00ACF8 100%);
  543. display: flex;
  544. justify-content: space-between;
  545. }
  546. .order-index .header .icon-saoma{
  547. font-size: 40rpx;
  548. padding: 30rpx 20rpx 30rpx 80rpx;
  549. }
  550. .order-index .header .item,.order-index .header .items {
  551. font-size: 24upx;
  552. color: #fff;
  553. height: 120upx;
  554. display: flex;
  555. align-items: center;
  556. }
  557. .order-index .header .item .font,.order-index .header .items .font{
  558. display: inline-block;
  559. margin-left: 16upx;
  560. margin-right: 16upx;
  561. font-size: 30upx;
  562. }
  563. .order-index .header .items image{
  564. width: 64upx;
  565. height: 64upx;
  566. border-radius: 60upx;
  567. border: 2upx solid #FFFFFF;
  568. }
  569. .order-index .wrapper {
  570. width: 690upx;
  571. background-color: #fff;
  572. border-radius: 10upx;
  573. margin: -115upx auto 0 auto;
  574. padding-top: 25upx;
  575. }
  576. .order-index .wrapper .title .iconfont {
  577. color: #2291f8;
  578. font-size: 40upx;
  579. margin-right: 13upx;
  580. vertical-align: middle;
  581. }
  582. .order-index .wrapper .title {
  583. font-size: 30upx;
  584. color: #282828;
  585. padding: 0 30upx;
  586. margin-bottom: 40upx;
  587. display: flex;
  588. justify-content: space-between;
  589. .uni-list-cell-db .iconfont{
  590. font-size: 24upx ;
  591. color: #999 ;
  592. margin-left: 14upx;
  593. }
  594. .tab{
  595. width: 240upx;
  596. height: 48upx;
  597. background: #F5F5F5;
  598. border-radius: 24upx;
  599. display: flex;
  600. justify-content: space-between;
  601. font-weight: 400;
  602. color: #999999;
  603. font-size: 24upx;
  604. .box{
  605. width: 82upx;
  606. height: 48upx;
  607. border-radius: 24upx;
  608. text-align: center;
  609. line-height: 48upx;
  610. }
  611. .on{
  612. background: #1890FF;
  613. color: #FFFFFF;
  614. }
  615. }
  616. }
  617. .order-index .wrapper .list .item {
  618. width: 33.33%;
  619. text-align: center;
  620. font-size: 24upx;
  621. color: #999;
  622. margin-bottom: 45upx;
  623. }
  624. .order-index .wrapper .list .item .num {
  625. font-size: 40upx;
  626. color: #333;
  627. }
  628. .public-wrapper .title {
  629. font-size: 30upx;
  630. color: #282828;
  631. padding: 0 30upx;
  632. margin-bottom: 20upx;
  633. font-size: 30upx;
  634. // margin-bottom: 40upx;
  635. display: flex;
  636. justify-content: space-between;
  637. .uni-list-cell-db .iconfont{
  638. font-size: 24upx ;
  639. color: #999 ;
  640. margin-left: 14upx;
  641. }
  642. .tab{
  643. width: 240upx;
  644. height: 48upx;
  645. background: #F5F5F5;
  646. border-radius: 24upx;
  647. display: flex;
  648. justify-content: space-between;
  649. font-weight: 400;
  650. color: #999999;
  651. font-size: 24upx;
  652. .box{
  653. width: 82upx;
  654. height: 48upx;
  655. border-radius: 24upx;
  656. text-align: center;
  657. line-height: 48upx;
  658. }
  659. .on{
  660. background: #1890FF;
  661. color: #FFFFFF;
  662. }
  663. }
  664. }
  665. .public-wrapper .title .iconfont {
  666. color: #2291f8;
  667. font-size: 40upx;
  668. margin-right: 13upx;
  669. vertical-align: middle;
  670. }
  671. .public-wrapper {
  672. margin: 18upx auto 0 auto;
  673. margin-bottom: 160upx;
  674. width: 690upx;
  675. background-color: #fff;
  676. border-radius: 10upx;
  677. padding-top: 25upx;
  678. }
  679. .public-wrapper .nav {
  680. padding: 0 30upx;
  681. height: 70upx;
  682. line-height: 70upx;
  683. font-size: 24upx;
  684. color: #999;
  685. }
  686. .public-wrapper .data {
  687. width: 33.33%;
  688. text-align: left;
  689. }
  690. .public-wrapper .browse {
  691. width: 33.33%;
  692. text-align: center;
  693. }
  694. .public-wrapper .turnover {
  695. width: 33.33%;
  696. text-align: right;
  697. }
  698. .public-wrapper .conter {
  699. padding: 0 30upx;
  700. }
  701. .public-wrapper .conter .item {
  702. border-bottom: 1px solid #f7f7f7;
  703. height: 70upx;
  704. font-size: 24upx;
  705. }
  706. .public-wrapper .conter .item .turnover {
  707. color: #000000;
  708. font-weight: 400;
  709. }
  710. .public-wrapper .unconter{
  711. text-align: center;
  712. color: #999;
  713. padding: 25upx;
  714. }
  715. </style>