order.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709
  1. <template>
  2. <app-layout>
  3. <scroll-view @scrolltolower="getMore" scroll-y :style="{'height':`${windowHeight}px`}">
  4. <view v-if="search" class="search-item main-between cross-center">
  5. <view class="search-input">
  6. <image class="search-icon" src='/static/image/icon/icon-search.png'></image>
  7. <input :focus="!msg" @confirm='searchMethod' confirm-type='search' v-model='keyword' placeholder-style='color:#999999;font-size:13px;' @blur="getFocus=false" @focus="getFocus=true" :placeholder="is_user ? '请输入团长手机号':'请输入活动名称或买家手机号'"></input>
  8. <image v-if="getFocus && keyword.length > 0" @click="clearSearch" class="search-clear" src="../image/clear.png"></image>
  9. </view>
  10. <view @click="cancelSeacrch">取消</view>
  11. </view>
  12. <view v-if="!searchResult && search && list.length == 0" class="search-history">
  13. <view v-if="candidate.length != 0" class='main-between search-title'>
  14. <view>历史搜索</view>
  15. <view @click="clear">
  16. <image class="delete-icon" src="/static/image/icon/delete.png"></image>
  17. </view>
  18. </view>
  19. <view class='flex-wrap candidate-list'>
  20. <view @click="keywordSearch(item)" class="keyword-item box-grow-0" v-for="item in candidate" :key="item">
  21. <text class="t-omit">{{item}}</text>
  22. </view>
  23. </view>
  24. </view>
  25. <view v-if="!search" class="search-area main-between cross-center">
  26. <view class="search dir-left-nowrap" :class="{'all-search': is_user}" @click="toSearch">
  27. <image class="icon-search" src="/static/image/icon/icon-search.png"></image>
  28. <text :class="{'keyword':keyword.length> 0}">{{ keyword.length> 0?keyword:is_user ? '请输入团长手机号':'请输入活动名称或买家手机号'}}</text>
  29. </view>
  30. <view v-if="!is_user" class="choose dir-left-nowrap cross-center" @click='toTime' :class="getTheme + '-m-text ' + getTheme">
  31. <text v-if="time == 0">汇总</text>
  32. <text v-else-if="time == 1">今日</text>
  33. <text v-else-if="time == 2">昨日</text>
  34. <text v-else-if="time == 3">7日</text>
  35. <text v-else>自定义</text>
  36. <image :class="getTheme + '-m-back ' + getTheme" v-if="chooseTime" src='./../image/order-close.png'></image>
  37. <image :class="getTheme + '-m-back ' + getTheme" v-else src='./../image/order-open.png'></image>
  38. </view>
  39. </view>
  40. <view v-if="!search" class="main-between navs-info">
  41. <view @click="tab(0)" class="box-grow-1 main-center cross-center navs">
  42. <text :class="[`${_num==0?`${getTheme + '-m-text ' + getTheme + ' active ' + getTheme + '-m-border ' + getTheme}`:'nav-text'}`]">全部</text>
  43. </view>
  44. <view @click="tab(1)" class="box-grow-1 main-center cross-center navs">
  45. <text :class="[`${_num==1?`${getTheme + '-m-text ' + getTheme + ' active ' + getTheme + '-m-border ' + getTheme}`:'nav-text'}`]">未付款</text>
  46. </view>
  47. <view @click="tab(2)" class="box-grow-1 main-center cross-center navs">
  48. <text :class="[`${_num==2?`${getTheme + '-m-text ' + getTheme + ' active ' + getTheme + '-m-border ' + getTheme}`:'nav-text'}`]">待发货</text>
  49. </view>
  50. <view @click="show=!show" v-if="active" class="box-grow-1 main-center navs more-navs">
  51. <text :class="[`${_num==active.value?`${getTheme + '-m-text ' + getTheme + ' active ' + getTheme + '-m-border ' + getTheme}`:'nav-text'}`]">{{active.name}}</text>
  52. <image :class="getTheme + '-m-back ' + getTheme" src="./../image/more-active.png"></image>
  53. </view>
  54. <view @click="show=!show" v-if="!active" class="box-grow-1 main-center navs more-navs">
  55. <text class="nav-text">更多状态</text>
  56. <image src="./../image/more.png"></image>
  57. </view>
  58. </view>
  59. <view v-if="!search && show" class="more-menu">
  60. <view @click="chooseItem(item.value)" v-for="item in menu" :key="item.value">{{item.name}}</view>
  61. </view>
  62. <view v-if="!search" class="search-palce"></view>
  63. <!-- 订单信息 -->
  64. <view class='no-tip' v-if="list.length == 0">
  65. <image src="/static/image/order-empty.png"></image>
  66. <span>暂无{{activeTab == 0?'未付款': activeTab == 1?'待发货':activeTab == 2?'待提货':''}}订单</span>
  67. </view>
  68. <view v-else>
  69. <app-order v-for="(item,index) in list" :key="item.id" v-on:update="update" v-if="(_num==3 && item.is_confirm == 0) || _num!=3" :is_user="is_user" :theme="getTheme" :item="item"></app-order>
  70. </view>
  71. <app-time-screening @click="toChoose" @cancel="cancel" :theme="getTheme" v-if="chooseTime" :time="time" :start-date="date_start" :end-date="date_end"></app-time-screening>
  72. <app-menu v-if="!is_user" :theme="getTheme" active="order"></app-menu>
  73. </scroll-view>
  74. </app-layout>
  75. </template>
  76. <script>
  77. import { mapState, mapGetters } from "vuex";
  78. import appTimeScreening from "../../../components/page-component/app-time-screening/app-time-screening.vue";
  79. import appMenu from '../components/app-menu';
  80. import appOrder from '../components/app-order';
  81. export default {
  82. data() {
  83. return {
  84. _num: '0',
  85. getFocus: false,
  86. more_list: false,
  87. page: 1,
  88. menu: [
  89. {
  90. name: '待提货',
  91. value: '3'
  92. },
  93. {
  94. name: '已提货',
  95. value: '4'
  96. },
  97. {
  98. name: '已完成',
  99. value: '8'
  100. },
  101. {
  102. name: '已关闭',
  103. value: '6'
  104. }
  105. ],
  106. active: null,
  107. is_user: false,
  108. show: false,
  109. search: false,
  110. keyword: '',
  111. list: [],
  112. candidate: [],
  113. date_start: '',
  114. date_end: '',
  115. time: 0,
  116. activity_id: 0,
  117. windowHeight: 0,
  118. chooseTime: false,
  119. detail: {},
  120. custom: false,
  121. msg: false,
  122. searchResult: false,
  123. loading: false
  124. }
  125. },
  126. components: {
  127. "app-menu": appMenu,
  128. 'app-order': appOrder,
  129. "app-time-screening": appTimeScreening
  130. },
  131. computed: {
  132. ...mapGetters('mallConfig', {
  133. getTheme: 'getTheme',
  134. }),
  135. ...mapState({
  136. userInfo: state => state.user.info,
  137. adminImg: state => state.mallConfig.__wxapp_img.app_admin,
  138. })
  139. },
  140. methods: {
  141. cancel() {
  142. this.chooseTime = false;
  143. },
  144. update(e) {
  145. for(let index in this.list) {
  146. if(this.list[index].id == e.id) {
  147. this.list[index] = e;
  148. }
  149. }
  150. this.$forceUpdate();
  151. },
  152. clearSearch() {
  153. this.keyword = '';
  154. },
  155. toSearch() {
  156. this.search = true;
  157. this.list = [];
  158. this.searchResult = false;
  159. this.candidate = uni.getStorageSync('keyword');
  160. },
  161. keywordSearch(e) {
  162. this.keyword = e;
  163. this.searchResult = true;
  164. this.search = false;
  165. uni.showLoading({
  166. title: '加载中...'
  167. });
  168. this.page = 1;
  169. this.getList();
  170. },
  171. // 清除搜索记录
  172. clear() {
  173. let that = this;
  174. uni.removeStorage({
  175. key: 'keyword',
  176. success(res) {
  177. that.candidate = [];
  178. uni.showToast({
  179. title: '清理成功',
  180. duration: 1000,
  181. type: 'success',
  182. mask: false
  183. });
  184. }
  185. });
  186. },
  187. // 搜索
  188. searchMethod() {
  189. var value = uni.getStorageSync('keyword');
  190. if (this.keyword.length == 0) {
  191. return
  192. } else if (value.length > 0) {
  193. value.unshift(this.keyword)
  194. } else {
  195. value = [this.keyword]
  196. }
  197. uni.showLoading({
  198. title: '加载中...'
  199. });
  200. this.page = 1;
  201. this.getList();
  202. value.forEach(function(row, index) {
  203. if (value[0] == value[index] && index > 0) {
  204. value.splice(index, 1)
  205. }
  206. })
  207. uni.setStorage({
  208. key: "keyword",
  209. data: value
  210. })
  211. this.search = false;
  212. this.searchResult = true;
  213. },
  214. // 取消搜索
  215. cancelSeacrch() {
  216. uni.showLoading({
  217. title: '加载中...'
  218. });
  219. this.search = false;
  220. this.keyword = '';
  221. // this.list = [];
  222. this.page = 1;
  223. this.getList();
  224. },
  225. change(e) {
  226. let that = this;
  227. that.time = e;
  228. that.custom = false;
  229. if (that.time == 4) {
  230. that.custom = true;
  231. that.date_end = that.today;
  232. that.date_start = that.today + ' 00:00:00';
  233. }
  234. },
  235. // 确认选择时间
  236. toChoose(date_start,date_end,time) {
  237. let that = this;
  238. uni.showLoading({
  239. title: '加载中...'
  240. });
  241. that.date_start = date_start;
  242. that.date_end = date_end;
  243. that.time = time;
  244. that.page = 1;
  245. that.getList();
  246. that.chooseTime = false;
  247. },
  248. // 打开时间筛选
  249. toTime() {
  250. let that = this;
  251. that.chooseTime = !that.chooseTime;
  252. that.show = false;
  253. },
  254. // 选择更多状态
  255. chooseItem(e) {
  256. let that = this;
  257. uni.showLoading({
  258. title: '加载中...'
  259. });
  260. that._num = e;
  261. that.menu.forEach(function(row, index) {
  262. if (row.value == that._num) {
  263. that.active = row;
  264. }
  265. })
  266. that.show = !that.show;
  267. that.page = 1;
  268. that.list = [];
  269. that.getList();
  270. },
  271. // 切换状态
  272. tab(e) {
  273. this._num = e;
  274. this.show = false;
  275. this.active = null;
  276. this.list = [];
  277. this.page = 1;
  278. uni.showLoading({
  279. title: '加载中...'
  280. });
  281. this.getList();
  282. },
  283. getList() {
  284. let that = this;
  285. if(that.loading) {
  286. return false
  287. }
  288. that.loading = true;
  289. that.$request({
  290. url: that.is_user ? that.$api.community.order_list : that.$api.community.middle_list,
  291. data: {
  292. status: that._num,
  293. date_end: that.date_end,
  294. date_start: that.date_start,
  295. page: that.page,
  296. keyword: that.keyword
  297. }
  298. }).then(response=>{
  299. that.$hideLoading();
  300. uni.hideLoading();
  301. that.loading = false;
  302. if(response.code == 0) {
  303. let list = response.data.list;
  304. that.more_list = false;
  305. if (list.length == response.data.pagination.pageSize) {
  306. that.more_list = true;
  307. }
  308. if(that.page == 1) {
  309. that.list = response.data.list;
  310. that.$forceUpdate();
  311. }else {
  312. that.list = that.list.concat(list);
  313. that.$forceUpdate();
  314. }
  315. that.page++;
  316. }else {
  317. uni.showToast({
  318. title: response.msg,
  319. icon: 'none',
  320. duration: 1000
  321. });
  322. }
  323. }).catch(response => {
  324. that.loading = false;
  325. that.$hideLoading();
  326. uni.hideLoading();
  327. })
  328. },
  329. getMore() {
  330. if (this.more_list) {
  331. this.getList();
  332. }
  333. }
  334. },
  335. onShow: function() {
  336. this.page = 1;
  337. this.getList();
  338. },
  339. onLoad(options) {
  340. let that = this;
  341. if(options.is_user == 1) {
  342. that.is_user = true
  343. }
  344. if(options.keyword) {
  345. that.keyword = options.keyword;
  346. }
  347. uni.getSystemInfo({
  348. success: function (res) {
  349. that.windowHeight = res.windowHeight;
  350. }
  351. })
  352. that.$showLoading({
  353. type: 'global',
  354. text: '加载中...'
  355. });
  356. that._num = 0
  357. }
  358. }
  359. </script>
  360. <style scoped lang="scss">
  361. .more-menu {
  362. position: fixed;
  363. z-index: 5;
  364. top: #{166rpx};
  365. padding-top: #{22rpx};
  366. right: #{22rpx};
  367. width: #{196rpx};
  368. background-color: #fff;
  369. font-size: #{28rpx};
  370. color: #666;
  371. border-bottom: #{1rpx} solid #e0e0e0;
  372. .handle-btn {
  373. height: #{48rpx};
  374. display: flex;
  375. align-items: center;
  376. padding: 0 #{24rpx};
  377. border-radius: #{24rpx};
  378. border: #{2rpx} solid #bbb;
  379. color: #353535;
  380. font-size: #{24rpx};
  381. margin-left: #{16rpx};
  382. &.other {
  383. border: #{2rpx} solid #ff4544;
  384. color: #ff4544;
  385. }
  386. }
  387. view {
  388. width: #{196rpx};
  389. height: #{68rpx};
  390. line-height: #{68rpx};
  391. text-align: center;
  392. border-left: #{1rpx} solid #e0e0e0;
  393. border-right: #{1rpx} solid #e0e0e0;
  394. }
  395. }
  396. .search-area {
  397. position: fixed;
  398. z-index: 3;
  399. top: 0;
  400. left: 0;
  401. right: 0;
  402. height: #{88rpx};
  403. line-height: #{88rpx};
  404. background-color: #efeff4;
  405. padding: 0 #{48rpx} 0 #{24rpx};
  406. .icon-search {
  407. height: #{24rpx};
  408. width: #{24rpx};
  409. margin-top: #{16rpx};
  410. }
  411. .icon-search+text {
  412. color:#b2b2b2;
  413. font-size:#{24rpx};
  414. margin:0 #{5rpx};
  415. }
  416. .search {
  417. height: #{56rpx};
  418. line-height: #{56rpx};
  419. border-radius: #{28rpx};
  420. background-color: #fff;
  421. color: #b2b2b2;
  422. width: #{528rpx};
  423. &.all-search {
  424. width: #{702rpx};
  425. }
  426. .keyword {
  427. color: #353535;
  428. }
  429. image {
  430. margin-left: #{28rpx};
  431. margin-right: #{10rpx};
  432. }
  433. }
  434. .choose {
  435. font-size: #{26rpx};
  436. }
  437. image {
  438. width: #{22rpx};
  439. height: #{12rpx};
  440. margin-left: #{12rpx};
  441. }
  442. }
  443. .navs-info {
  444. background-color: #fff;
  445. border-bottom: #{1rpx} solid #e2e2e2;
  446. position: fixed;
  447. z-index: 2;
  448. top: #{78rpx};
  449. left: 0;
  450. right: 0;
  451. padding-top: #{10rpx};
  452. .navs {
  453. height: #{100rpx};
  454. font-size: #{28rpx};
  455. color: #666;
  456. text-align: center;
  457. position: relative;
  458. &.more-navs {
  459. line-height: #{100rpx};
  460. }
  461. .active {
  462. display: inline-block;
  463. height: #{100rpx};
  464. line-height: #{102rpx};
  465. border-bottom: #{2rpx} solid;
  466. }
  467. image {
  468. height: #{16rpx};
  469. width: #{16rpx};
  470. margin-left: #{16rpx};
  471. display: block;
  472. float: right;
  473. margin-top: #{42rpx};
  474. }
  475. }
  476. }
  477. .order-item {
  478. background-color: #fff;
  479. padding: #{24rpx};
  480. margin: #{20rpx} #{24rpx} 0;
  481. border-radius: #{16rpx};
  482. display: block;
  483. .order-info {
  484. font-size: #{24rpx};
  485. color: #353535;
  486. margin-bottom: #{24rpx};
  487. .remark-info {
  488. margin-top: #{8rpx};
  489. }
  490. }
  491. .order-user {
  492. height: #{72rpx};
  493. background-color: #f7f7f7;
  494. padding-left: #{28rpx};
  495. font-size: #{24rpx};
  496. color: #353535;
  497. view:first-of-type {
  498. margin-right: #{32rpx};
  499. }
  500. }
  501. .goods {
  502. height: #{160rpx};
  503. margin-top: #{24rpx};
  504. position: relative;
  505. font-size: #{24rpx};
  506. color: #353535;
  507. margin-bottom: #{24rpx};
  508. .goods-status {
  509. height: #{40rpx};
  510. line-height: #{40rpx};
  511. color: #fff;
  512. width: #{160rpx};
  513. position: absolute;
  514. bottom: 0;
  515. left: 0;
  516. text-align: center;
  517. background-color: #ff4544;
  518. border-bottom-left-radius: #{4rpx};
  519. border-bottom-right-radius: #{4rpx};
  520. }
  521. .goods-img {
  522. height: #{160rpx};
  523. width: #{160rpx};
  524. float: left;
  525. margin-right: #{20rpx};
  526. border-radius: #{4rpx};
  527. }
  528. .goods-name {
  529. padding-top: #{5rpx};
  530. }
  531. .goods-attr {
  532. font-size: #{24rpx};
  533. color: #999;
  534. position: absolute;
  535. top: #{78rpx};
  536. left: #{180rpx};
  537. width: 70%;
  538. text {
  539. margin-right: #{20rpx};
  540. }
  541. }
  542. .goods-num {
  543. font-size: #{24rpx};
  544. color: #999;
  545. position: absolute;
  546. top: #{126rpx};
  547. left: #{180rpx};
  548. }
  549. .goods-price {
  550. font-size: #{24rpx};
  551. color: #353535;
  552. position: absolute;
  553. bottom: 0;
  554. right: 0;
  555. }
  556. }
  557. .price-info {
  558. font-size: #{28rpx};
  559. color: #353535;
  560. .other {
  561. font-size: #{24rpx};
  562. color: #999;
  563. }
  564. }
  565. .menu-button {
  566. margin-top: #{24rpx};
  567. }
  568. }
  569. .search-item {
  570. height: #{96rpx};
  571. background-color: #efeff4;
  572. padding: 0 #{24rpx};
  573. font-size: #{28rpx};
  574. color: #00c203;
  575. .search-input {
  576. height: #{64rpx};
  577. position: relative;
  578. width: #{620rpx};
  579. .search-clear {
  580. position: absolute;
  581. right: #{15rpx};
  582. top: #{21rpx};
  583. width: #{30rpx};
  584. height: #{30rpx};
  585. z-index: 100;
  586. }
  587. .search-icon {
  588. height: #{22rpx};
  589. width: #{22rpx};
  590. position: absolute;
  591. top: #{21rpx};
  592. left: #{28rpx};
  593. z-index: 10;
  594. }
  595. input {
  596. padding-left: #{62rpx};
  597. padding-right: #{70rpx};
  598. background-color: #fff;
  599. border-radius: #{32rpx};
  600. height: #{64rpx};
  601. font-size: #{26rpx};
  602. color: #353535;
  603. }
  604. }
  605. }
  606. .search-history {
  607. position: absolute;
  608. top: #{96rpx};
  609. left: 0;
  610. right: 0;
  611. height: 100%;
  612. background-color: #fff;
  613. padding: #{24rpx} #{4rpx};
  614. font-size: #{28rpx};
  615. color: #666;
  616. z-index: 20;
  617. .delete-icon {
  618. height: #{34rpx};
  619. width: #{28rpx};
  620. }
  621. .candidate-list {
  622. max-height: #{420rpx};
  623. overflow: hidden;
  624. }
  625. .search-title {
  626. padding: 0 #{20rpx};
  627. margin-bottom: #{24rpx};
  628. }
  629. .keyword-item {
  630. height: #{64rpx};
  631. line-height: #{64rpx};
  632. padding: 0 #{20rpx};
  633. background-color: #f7f7f7;
  634. color: #333;
  635. border-radius: #{32rpx};
  636. font-size: #{28rpx};
  637. margin-left: #{20rpx};
  638. margin-bottom: #{20rpx};
  639. max-width: 90%;
  640. }
  641. }
  642. .no-tip {
  643. position: fixed;
  644. top: #{400rpx};
  645. left: 0;
  646. right: 0;
  647. margin: 0 auto;
  648. color: #666666;
  649. font-size: #{24rpx};
  650. width: #{240rpx};
  651. text-align: center;
  652. image {
  653. height: #{240rpx};
  654. width: #{240rpx};
  655. margin-bottom: #{20rpx};
  656. }
  657. }
  658. .search-palce {
  659. height: #{188rpx};
  660. }
  661. .dialog-bg {
  662. position: fixed;
  663. top: 0;
  664. left: 0;
  665. width: 100%;
  666. height: 100%;
  667. background-color: rgba(0,0,0,.3);
  668. z-index: 1000;
  669. .dialog {
  670. font-size: 30rpx;
  671. color: #353535;
  672. width: 480rpx;
  673. height: 200rpx;
  674. border-radius: 16rpx;
  675. text-align: center;
  676. background-color: #fff;
  677. .dialog-content {
  678. height: 110rpx;
  679. line-height: 110rpx;
  680. }
  681. .dialog-btn {
  682. position: relative;
  683. height: 90rpx;
  684. border-top: 2rpx solid #e2e2e2;
  685. .btn {
  686. width: 240rpx;
  687. height: 90rpx;
  688. text-align: center;
  689. line-height: 90rpx;
  690. font-size: 26rpx;
  691. color: #666;
  692. }
  693. .line {
  694. position: absolute;
  695. top: 20rpx;
  696. left: 50%;
  697. margin-left: -1rpx;
  698. width: 2rpx;
  699. height: 45rpx;
  700. background-color: #e2e2e2;
  701. }
  702. }
  703. }
  704. }
  705. </style>